function showform($row, $posted)
    {
        global $mainframe;
        $database =& JFactory::getDBO();
        $MyForm =& CFChronoForm::getInstance($row->name);
        $CF_PATH = $mainframe->isSite() ? JURI::Base() : $mainframe->getSiteURL();
        $uri =& JFactory::getURI();
        if ($uri->isSSL()) {
            $CF_PATH = str_replace('http:', 'https:', $CF_PATH);
        }
        if (!empty($MyForm->formrow->name) && $MyForm->formrow->published) {
            ?>
		<?php 
            if ($MyForm->formparams('LoadFiles') == 'Yes' || trim($MyForm->formparams('validate')) == 'Yes' || $MyForm->formparams('captcha_dataload')) {
                ?>
	
			<?php 
                JHTML::_('behavior.mootools');
                ?>
        <?php 
            }
            ?>
        <?php 
            ob_start();
            ?>
        
        <?php 
            if ($MyForm->formparams('LoadFiles') == 'Yes') {
                ?>
        	
			<?php 
                if (!trim($MyForm->formrow->theme) || trim($MyForm->formrow->theme) == 'default') {
                    ?>
                <link href="<?php 
                    echo $CF_PATH . 'components/com_chronocontact/themes/default/css/';
                    ?>
style1.css" rel="stylesheet" type="text/css" />
                <!--[if lt IE 6]><link href="<?php 
                    echo $CF_PATH . 'components/com_chronocontact/themes/default/css/';
                    ?>
style1-ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
                <!--[if lt IE 7]><link href="<?php 
                    echo $CF_PATH . 'components/com_chronocontact/themes/default/css/';
                    ?>
style1-ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
            <?php 
                } else {
                    $directory = JPATH_SITE . '/components/com_chronocontact/themes/' . trim($MyForm->formrow->theme) . '/css/';
                    $results = array();
                    $handler = opendir($directory);
                    while ($file = readdir($handler)) {
                        if ($file != '.' && $file != '..') {
                            $results[] = $file;
                        }
                    }
                    closedir($handler);
                    $counter = 0;
                    foreach ($results as $result) {
                        ?>
	
                    <link href="<?php 
                        echo $CF_PATH . 'components/com_chronocontact/themes/' . trim($MyForm->formrow->theme) . '/css/' . $result;
                        ?>
" rel="stylesheet" type="text/css" />
                <?php 
                        //$counter++;
                    }
                }
                ?>
            <script type="text/javascript">
			<?php 
                echo "var CF_LV_Type = '" . $MyForm->formparams('validation_type', 'default') . "';";
                ?>
			</script>
            <link rel="stylesheet" href="<?php 
                echo $CF_PATH;
                ?>
components/com_chronocontact/css/calendar2.css" type="text/css" />
            <link href="<?php 
                echo $CF_PATH . 'components/com_chronocontact/css/';
                ?>
tooltip.css" rel="stylesheet" type="text/css" />
            <script type="text/javascript" src="<?php 
                echo $CF_PATH;
                ?>
components/com_chronocontact/js/calendar2.js"></script>
            <script src="<?php 
                echo $CF_PATH . 'components/com_chronocontact/js/';
                ?>
livevalidation_standalone.js" type="text/javascript"></script>
            <link href="<?php 
                echo $CF_PATH . 'components/com_chronocontact/css/';
                ?>
consolidated_common.css" rel="stylesheet" type="text/css" />
			<script src="<?php 
                echo $CF_PATH . 'components/com_chronocontact/js/';
                ?>
customclasses.js" type="text/javascript"></script>
            <?php 
                include JPATH_SITE . DS . 'components' . DS . 'com_chronocontact' . DS . 'libraries' . DS . 'includes' . DS . 'JSvalidation.php';
                ?>
		<?php 
            }
            ?>
	
        <?php 
            if ($MyForm->formparams('LoadFiles') == 'Yes' || trim($MyForm->formparams('datefieldsnames', ''))) {
                ?>
			<?php 
                if ($MyForm->formparams('LoadFiles') != 'Yes') {
                    ?>
                <link rel="stylesheet" href="<?php 
                    echo $CF_PATH;
                    ?>
components/com_chronocontact/css/calendar2.css" type="text/css" />
                <script type="text/javascript" src="<?php 
                    echo $CF_PATH;
                    ?>
components/com_chronocontact/js/calendar2.js"></script>
            <?php 
                }
                ?>
            <?php 
                JHTML::_('behavior.mootools');
                ?>
            <script type="text/javascript">	
                window.addEvent('domready', function() {
                <?php 
                //include_once(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSCustomClasses.php');
                $datefieldsnames = explode(",", $MyForm->formparams('datefieldsnames'));
                if (count($datefieldsnames)) {
                    foreach ($datefieldsnames as $datefieldsname) {
                        if (trim($datefieldsname)) {
                            HTML_ChronoContact::initiateCalendar(trim($datefieldsname), $MyForm);
                        }
                    }
                }
                ?>
                });
            </script>
			<?php 
            }
            ?>
		<style type="text/css">
			span.cf_alert {
				background:#FFD5D5 url(<?php 
            echo $CF_PATH . 'components/com_chronocontact/css/';
            ?>
images/alert.png) no-repeat scroll 10px 50%;
				border:1px solid #FFACAD;
				color:#CF3738;
				display:block;
				margin:15px 0pt;
				padding:8px 10px 8px 36px;
			}
		</style>	
		
		<?php 
            if (trim($MyForm->formparams('validate')) == 'Yes' && $MyForm->formparams('LoadFiles') != 'Yes') {
                ?>
        		<script type="text/javascript">
				<?php 
                echo "var CF_LV_Type = '" . $MyForm->formparams('validation_type', 'default') . "';";
                ?>
				</script>	
				<script src="<?php 
                echo $CF_PATH . 'components/com_chronocontact/js/';
                ?>
livevalidation_standalone.js" type="text/javascript"></script>
				<link href="<?php 
                echo $CF_PATH . 'components/com_chronocontact/css/';
                ?>
consolidated_common.css" rel="stylesheet" type="text/css" />
                <?php 
                include JPATH_SITE . DS . 'components' . DS . 'com_chronocontact' . DS . 'libraries' . DS . 'includes' . DS . 'JSvalidation.php';
                ?>
                
        <?php 
            }
            ?>
		
        <?php 
            if (trim($MyForm->formparams('validate')) == 'Yes' || $MyForm->formparams('LoadFiles') == 'Yes') {
                ?>
        <script src="<?php 
                echo $CF_PATH . 'components/com_chronocontact/js/';
                ?>
jsvalidation2.js" type="text/javascript"></script>
        	<?php 
                $jsformname = "ChronoContact_" . $MyForm->formrow->name;
                $valonBlur = $MyForm->formparams('validate_onlyOnBlur', 1) ? 1 : 0;
                $valonSubmit = $MyForm->formparams('validate_onlyOnSubmit', '0') ? 1 : 0;
                $valwait_time = $MyForm->formparams('validate_wait', 0);
                echo "<script type='text/javascript'>\n\t\t\t\tvar fieldsarray = new Array();\n\t\t\t\tvar fieldsarray_count = 0;";
                echo "window.addEvent('domready', function() {\n\t\t\t\telementExtend();";
                echo 'setValidation("' . $jsformname . '", ' . $valonBlur . ', ' . $valonSubmit . ', ' . $valwait_time . ');';
                echo "});";
                echo "</script>";
                ?>
	
        	<?php 
                include JPATH_SITE . DS . 'components' . DS . 'com_chronocontact' . DS . 'libraries' . DS . 'includes' . DS . 'JSvalidation2.php';
                ?>
		<?php 
            }
            ?>
        <?php 
            if (!empty($MyForm->formrow->scriptcode)) {
                echo "<script type='text/javascript'>\n";
                echo "//<![CDATA[\n";
                eval("?>" . $MyForm->formrow->scriptcode);
                echo "//]]>\n";
                echo "</script>\n";
            }
            ?>
        <?php 
            if (!empty($MyForm->formrow->stylecode)) {
                ?>
 
			<style type="text/css">
			<?php 
                eval("?>" . $MyForm->formrow->stylecode);
                ?>
	
			</style>		
		<?php 
            }
            ?>
        <?php 
            $header_code = ob_get_clean();
            ?>
        <?php 
            ?>
		<?php 
            $actionurl = $MyForm->getAction($MyForm->formrow->name);
            ?>
		<?php 
            $session =& JFactory::getSession();
            ?>
		<?php 
            if ($MyForm->formerrors) {
                ?>
            <span class="cf_alert"><?php 
                echo '<ol>' . $MyForm->formerrors . '</ol>';
                ?>
</span>
		<?php 
            }
            ?>
        <?php 
            if ($posted && $MyForm->formparams('captcha_dataload')) {
                include_once JPATH_SITE . DS . 'components' . DS . 'com_chronocontact' . DS . 'libraries' . DS . 'includes' . DS . 'JSrepublish.php';
            }
            ?>
<form name="<?php 
            echo $MyForm->formname ? $MyForm->formname : "ChronoContact_" . $MyForm->formrow->name;
            ?>
" id="<?php 
            echo "ChronoContact_" . $MyForm->formrow->name;
            ?>
" method="<?php 
            echo $MyForm->formparams('formmethod');
            ?>
"<?php 
            if ($MyForm->formparams('uploads') == 'Yes') {
                echo ' enctype="multipart/form-data"';
            }
            ?>
 action="<?php 
            echo $actionurl;
            ?>
" <?php 
            echo $MyForm->formrow->attformtag;
            ?>
>
		
				<?php 
            $imver = "";
            if (trim($MyForm->formparams('imagever')) == 'Yes') {
                $imver = '<input name="chrono_verification" style="vertical-align:top;" type="text" id="chrono_verification" class="inputbox" value="" />
							&nbsp;&nbsp;<img src="' . $CF_PATH . 'components/com_chronocontact/chrono_verification.php?imtype=' . $MyForm->formparams('imtype') . '" alt="" />';
            }
            $MyForm->formrow->html = str_replace('{imageverification}', $imver, $MyForm->formrow->html);
            eval("?>" . $MyForm->formrow->html);
            ?>
		<?php 
            echo JHTML::_('form.token');
            ?>
	
        <?php 
            if ($MyForm->formparams('enablecftoken', 1)) {
                ?>
        	<input type="hidden" name="1cf1" value="<?php 
                echo $MyForm->generateCFToken($MyForm->formrow->name);
                ?>
" />
        <?php 
            }
            ?>
        <?php 
            if ($MyForm->pagetype != 'chronocontact') {
                ?>
        	<?php 
                $session->set("cfreturnurl_" . $MyForm->formrow->name, $MyForm->selfURL(), md5('chrono'));
                ?>
        <?php 
            }
            ?>
</form>

		<?php 
            eval(base64_decode('JGRvY3VtZW50ID0mIEpGYWN0b3J5OjpnZXREb2N1bWVudCgpOw0KJGRvY3VtZW50LT5hZGRDdXN0b21UYWcoJGhlYWRlcl9jb2RlKTsNCmVjaG8gJE15Rm9ybS0+YWRkaGFzaCgpOw=='));
        } else {
            echo "There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management";
        }
    }
Ejemplo n.º 2
0
 function showForm($formname, $posted = array(), $runplugins = true)
 {
     $MyForm =& CFChronoForm::getInstance($formname);
     if (!$MyForm->formrow->id) {
         echo "There is no form with this name";
         return;
     }
     $session =& JFactory::getSession();
     //if(!trim($session->get('cfreturnurl_'.$formname, '', md5('chrono')))){
     $session->clear('chrono_form_errors_' . $formname, md5('chrono'));
     $session->clear('chrono_form_data_' . $formname, md5('chrono'));
     $session->clear('cfreturnurl_' . $formname, md5('chrono'));
     //}
     if (trim($MyForm->formparams('enmambots')) == 'Yes') {
         $MyForm->runMambots($MyForm->formrow->name);
     }
     if ($runplugins) {
         $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
         $MyPlugins->runPlugin('', array('ONLOAD', 'ONLOADONSUBMIT'));
     }
     if (!$MyForm->stoploading) {
         HTML_ChronoContact::showform($MyForm->formrow, $posted);
     }
 }
    function editChronoContact($row, $option)
    {
        global $mainframe;
        $paramsvalues = new JParameter($row->paramsall);
        if (is_array($paramsvalues->get('uploadfields'))) {
            $paramsvalues->set('uploadfields', implode('|', $paramsvalues->get('uploadfields')));
        }
        /*JHTML::_('behavior.switcher');
        		$contents = '';
        		ob_start();
        		require_once(JPATH_COMPONENT.DS.'tmpl'.DS.'navigation.php');
        		$contents = ob_get_contents();
        		ob_clean();*/
        //$document =& JFactory::getDocument();
        //$document->setBuffer($contents, 'module', 'submenu');
        ?>
	
		<!--[if gte IE 6]><link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
style1-ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
		<!--[if gte IE 7]><link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
style1-ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
		<!--[if !IE]> <--><link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
style1.css" rel="stylesheet" type="text/css" /><!--> <![endif]-->
		<link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
calendar.css" rel="stylesheet" type="text/css" />
		<link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
tooltip.css" rel="stylesheet" type="text/css" />
		<link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
accordion.css" rel="stylesheet" type="text/css" />
		<link href="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
smoothbox/smoothbox.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<?php 
        echo JURI::Base() . 'components/com_chronocontact/js/';
        ?>
CFElements.js"></script>
	  <script language="javascript" type="text/javascript">
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == "cancel") {
				submitform( pressbutton );
				return;
			}
			// do field validation
			if (($('cf_adminform_name').value == '')||($('cf_adminform_name').value.search(/ /) > -1)) {
				alert( "Please enter the form name without any spaces" );
			} else {
				Checkform();
				submitform( pressbutton );
			}
		}
		function addmenuitem(){
			var form = document.adminForm;
			if (form.menutext.value == '') {
				alert( "Please enter a text for the menu link" );
			} else {
				submitform( 'addmenuitem' );
			}
		}
		function toggleList(e){
		element = document.getElementById(e).style;
		element.display == 'none' ? element.display = 'block' :
		element.display='none';
		}
		function change_order1_plus(e){
			element = document.getElementById(e);
			if(trim(element.value) == "" ) element.value = "0";
			element.value = parseInt(element.value) + 1;
		}
		function change_order1_minus(e){
			element = document.getElementById(e);
			if(trim(element.value) == "" ) element.value = "0";
			parseInt(element.value) == 0 ? element.value = 0 :			
			element.value = parseInt(element.value) - 1;
		}
		function enable_order(e1, e2){
			element1 = document.getElementById(e1);
			element2 = document.getElementById(e2);
			if(element2.checked == true)element1.disabled = false;
			if(element2.checked == false)element1.disabled = true;
		}
		function change_order2_plus(e){
			element = document.getElementById(e);
			if(trim(element.value) == "" ) element.value = "0";
			element.value = parseInt(element.value) + 1;
		}
		function change_order2_minus(e){
			element = document.getElementById(e);
			if(trim(element.value) == "" ) element.value = "0";
			parseInt(element.value) == 0 ? element.value = 0 :			
			element.value = parseInt(element.value) - 1;
		}
		
		Element.extend({
			highlight: function(color){
				var style = this.getStyle('background-color');
				style = (style == 'transparent') ? '#ffffff' : style;
				new Fx.Style(this,'background-color').start(color || '#face8f', style);
				return this;
			},
			injectHTML: function(content, where){
				new Element('div').setHTML(content).getChildren().inject(this, where);
				return this;
			},
			showProperties: function(ParentTag){
				var Prop = new ELEMPROP(ParentTag, this);
				return Prop;
			}
		});
		
		
		
		function Checkform(){
				// Prepare form code				
				// Prepare Emails
				Output2 = $('left_column2').clone();
				var emailstring = '';
				var arrcount = 0;
				var emails_temp_ids = '';
				$ES('.cf_email',Output2).each(function(emailitem){
					// Define arrays
					var toarray = new Array();
					var dtoarray = new Array();
					var subarray = new Array();
					var dsubarray = new Array();
					var ccarray = new Array();
					var dccarray = new Array();
					var bccarray = new Array();
					var dbccarray = new Array();
					var fromnamearray = new Array();
					var dfromnamearray = new Array();
					var fromemailarray = new Array();
					var dfromemailarray = new Array();
					var replytonamearray = new Array();
					var dreplytonamearray = new Array();
					var replytoemailarray = new Array();
					var dreplytoemailarray = new Array();
					emails_temp_ids = emails_temp_ids + ',' + emailitem.getProperty('name');
				
					emailstring = emailstring + 'start_email{';
					// add TO items
					$ES('input[name^=to]',emailitem).each(function(toitem){
						toarray[arrcount] = toitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'TO=[' + toarray.join(',') + ']||';
					// add Dynamic TO items
					$ES('input[name^=dto]',emailitem).each(function(dtoitem){
						dtoarray[arrcount] = dtoitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DTO=[' + dtoarray.join(',') + ']||';
					// add Subject items
					$ES('input[name^=subject]',emailitem).each(function(subitem){
						subarray[arrcount] = subitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'SUBJECT=[' + subarray.join(',') + ']||';
					// add Dynamic Subject items
					$ES('input[name^=dsubject]',emailitem).each(function(dsubitem){
						dsubarray[arrcount] = dsubitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DSUBJECT=[' + dsubarray.join(',') + ']||';
					// add CC items
					$ES('input[name^=cc]',emailitem).each(function(ccitem){
						ccarray[arrcount] = ccitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'CC=[' + ccarray.join(',') + ']||';
					// add Dynamic CC items
					$ES('input[name^=dcc]',emailitem).each(function(dccitem){
						dccarray[arrcount] = dccitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DCC=[' + dccarray.join(',') + ']||';
					// add BCC items
					$ES('input[name^=bcc]',emailitem).each(function(bccitem){
						bccarray[arrcount] = bccitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'BCC=[' + bccarray.join(',') + ']||';
					// add Dynamic BCC items
					$ES('input[name^=dbcc]',emailitem).each(function(dbccitem){
						dbccarray[arrcount] = dbccitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DBCC=[' + dbccarray.join(',') + ']||';
					// add FromName items
					$ES('input[name^=fromname]',emailitem).each(function(fromnameitem){
						fromnamearray[arrcount] = fromnameitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'FROMNAME=[' + fromnamearray.join(',') + ']||';
					// add Dynamic FromName items
					$ES('input[name^=dfromname]',emailitem).each(function(dfromnameitem){
						dfromnamearray[arrcount] = dfromnameitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DFROMNAME=[' + dfromnamearray.join(',') + ']||';
					// add FromEmail items
					$ES('input[name^=fromemail]',emailitem).each(function(fromemailitem){
						fromemailarray[arrcount] = fromemailitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'FROMEMAIL=[' + fromemailarray.join(',') + ']||';
					// add Dynamic FromEmail items
					$ES('input[name^=dfromemail]',emailitem).each(function(dfromemailitem){
						dfromemailarray[arrcount] = dfromemailitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DFROMEMAIL=[' + dfromemailarray.join(',') + ']||';
					/// new at V3.1
					// add ReplyToName items
					$ES('input[name^=replytoname]',emailitem).each(function(replytonameitem){
						replytonamearray[arrcount] = replytonameitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'REPLYTONAME=[' + replytonamearray.join(',') + ']||';
					// add Dynamic ReplyToName items
					$ES('input[name^=dreplytoname]',emailitem).each(function(dreplytonameitem){
						dreplytonamearray[arrcount] = dreplytonameitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DREPLYTONAME=[' + dreplytonamearray.join(',') + ']||';
					// add ReplyToEmail items
					$ES('input[name^=replytoemail]',emailitem).each(function(replytoemailitem){
						replytoemailarray[arrcount] = replytoemailitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'REPLYTOEMAIL=[' + replytoemailarray.join(',') + ']||';
					// add Dynamic ReplyToEmail items
					$ES('input[name^=dreplytoemail]',emailitem).each(function(dreplytoemailitem){
						dreplytoemailarray[arrcount] = dreplytoemailitem.value;
						arrcount = arrcount + 1;
					});
					arrcount = 0;
					emailstring = emailstring + 'DREPLYTOEMAIL=[' + dreplytoemailarray.join(',') + ']';
					
					
					emailstring = emailstring + '}end_email';
				});
				
				$('emails_temp').value = emailstring;
				$('emails_temp_ids').value = emails_temp_ids;
				//$('form_html_template').empty();
				//document.adminForm.submit();
			
		}
		
		function ShowEmailProperties(){
			$('prop_cf_Email').setStyle('display','block');
			$$('div.cf_email').each(function(item){
				if(item.getProperty('id') == 'cf_email_active'){
					var params = $('params_'+item.getProperty('name')).value.split(',');
					$('prop_cf_Email_IP').value = params[0];
					$('prop_cf_Email_format').value = params[1];
					$('prop_cf_Email_enable').value = params[2];
					$('prop_cf_Email_editor').value = params[3];
					$('prop_cf_Email_enable_attachments').value = params[4];
					if(($chk($E('input[name^=to_]', item)) || $chk($E('input[name^=dto_]', item))) && ($chk($E('input[name^=subject_]', item)) || $chk($E('input[name^=dsubject_]', item))) && ($chk($E('input[name^=fromname_]', item)) || $chk($E('input[name^=dfromname_]', item))) && ($chk($E('input[name^=fromemail_]', item)) || $chk($E('input[name^=dfromemail_]', item))) ){
					//if($chk($E('input[name^=to_]', item))){
						$('prop_cf_Email_enable').disabled = false;
					}else{
						$('prop_cf_Email_enable').disabled = true;
					}
				}
			});
			$('prop_cf_Email_done').removeEvents();
			$('prop_cf_Email_done').addEvent('click', function() {
				$$('div.cf_email').each(function(item){
					if(item.getProperty('id') == 'cf_email_active'){
						$('params_'+item.getProperty('name')).value = '';
						$('params_'+item.getProperty('name')).value = $('prop_cf_Email_IP').value;
						$('params_'+item.getProperty('name')).value = $('params_'+item.getProperty('name')).value + ',' + $('prop_cf_Email_format').value;
						$('params_'+item.getProperty('name')).value = $('params_'+item.getProperty('name')).value + ',' + $('prop_cf_Email_enable').value;
						$('params_'+item.getProperty('name')).value = $('params_'+item.getProperty('name')).value + ',' + $('prop_cf_Email_editor').value;
						$('params_'+item.getProperty('name')).value = $('params_'+item.getProperty('name')).value + ',' + $('prop_cf_Email_enable_attachments').value;
					}
				});
			});
			//$('emailbuilder').setStyle('height',  ($('left_column2').getCoordinates().height + $('top_column2').getCoordinates().height) + 140 );
		}
		
		function deletemail(){
			deleted = 0;
			$$('div.cf_email').each(function(item){
				if(item.getProperty('id') == 'cf_email_active'){
					item.remove();
					if($('editor_'+item.getProperty('name')).hasClass('2mce_editable')){
						tinyMCE.execCommand('mceRemoveControl', false, 'editor_'+item.getProperty('name'));
					}					
					$E('textarea#editor_'+ item.getProperty('name')).remove();
					$('params_'+ item.getProperty('name')).remove();
					$E('div#'+'after_editor_'+ item.getProperty('name')).remove();
					$E('div#'+'before_editor_'+ item.getProperty('name')).remove();
					deleted = 1;
				}
			});
			if(!deleted)alert('Choose an email first to delete');
		}
		<?php 
        $database =& JFactory::getDBO();
        $query = "SELECT * FROM #__chrono_contact_emails WHERE formid = '" . $row->id . "' ORDER BY emailid";
        $database->setQuery($query);
        $emails = $database->loadObjectList();
        ?>
		
		var emailcounter = <?php 
        echo count($emails);
        ?>
;
		var counter = 0;
		function addEmail(){
			newemail = new Element('div', {'class': 'cf_email', 'id': 'email_'+emailcounter, 'name': 'email_'+emailcounter});
			neweditor = new Element('textarea', {'class': 'mce_editable', 'id': 'editor_email_'+emailcounter, 'name': 'editor_email_'+emailcounter, 'rows':'20', 'cols':'75', 'styles': {'width':'90%', 'height':'350px' } });
			new Element('div', {'id':'before_'+ 'editor_email_'+emailcounter}).inject($('left_column33'));
			new Element('span', {'styles':{'font-weight':'bold', 'font-size':'12px'}}).setText('Email Template').inject($('before_'+ 'editor_email_'+emailcounter));
			neweditor.inject($('left_column33'));
			new Element('input', {'type':'hidden', 'id': 'params_email_'+emailcounter, 'value':'1,html,0,1,1', 'name': 'params_email_'+emailcounter}).inject($('left_column33'));
			new Element('div', {'id':'after_'+ 'editor_email_'+emailcounter}).inject($('left_column33'));
			new Element('br').inject($('after_'+ 'editor_email_'+emailcounter));
			new Element('br').inject($('after_'+ 'editor_email_'+emailcounter));
			
			tinyMCE.execCommand('mceAddControl', false, 'editor_email_'+emailcounter);
			if(window.ie6){
				newemail.setStyles({'width':'500px', 'border':'1px #111 solid', 'padding':'15px', 'background-color':'#FFAEA5', 'height':'auto', 'height':'75px', 'margin-top':'15px'});
			}else{
				newemail.setStyles({'width':'500px', 'border':'1px #111 solid', 'padding':'15px', 'background-color':'#FFAEA5', 'min-height':'75px', 'margin-top':'15px'});
			}
			newemail.addEvent('click', function() {
				$$('div.cf_email').each(function(item){
					item.setProperty('id','');
					item.setStyles({'border':'1px #111 solid'});
				});
				this.setProperty('id','cf_email_active');
				this.setStyles({'border':'3px #111 solid'});
				ShowEmailProperties();
			});	
			infodiv = new Element('div', {'class': 'infodiv'}).setText('Drag Email elements from the toolbox on the right side to build your email, the email box color will turn to green only when all the needed elements are existing!');
			infodiv.inject(newemail);	
			cleardiv = new Element('div', {'class': 'clear'});
			cleardiv.inject(newemail);
			newemail.inject($('left_column2'));
			//if(emailcounter == 0)$('logdiv').setText('Drag and Drop Email elements to the new Email area');
			emailcounter = emailcounter + 1;
			//var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect,	
			$$('.emailitem').each(function(item){
				item.removeEvents();
			});
			//var counter = 0; 
			$$('.emailitem').each(function(item){	 
				item.addEvent('mousedown', function(e) {
					e = new Event(e).stop();
					
					
					var clone = new Element('div', {'class':'emailitem'}).adopt( new Element('span', {'id':this.getFirst().getProperty('id')}).setText(this.getFirst().getText()) )//this.clone()
					//var clonetext = new Element('span', {'id':this.getFirst().getProperty('id')}).injectInside(clone);
						.setStyles(this.getCoordinates()) // this returns an object with left/top/bottom/right, so its perfect
						.setStyles({'opacity': 0.7, 'position': 'absolute'})
						.addEvent('emptydrop', function() {
							this.remove();
							$ES('div[class=cf_email]', $('left_column2')).each(function(droparea){
								droparea.removeEvents();
								droparea.addEvent('click', function() {
									$$('div.cf_email').each(function(item){
										item.setProperty('id','');
										item.setStyles({'border':'1px #111 solid'});
									});
									this.setProperty('id','cf_email_active');
									this.setStyles({'border':'3px #111 solid'});
									ShowEmailProperties();
								});	
							});
						}).inject(document.body);
						
						
					var thisitemtype = item.clone().getFirst().getProperty('id');
					var theitem = new Element('div').setProperty("class", 'form_element');
					$ES('div[class=cf_email]', $('left_column2')).each(function(droparea){
						droparea.addEvents({
							'drop': function() {
								$ES('div[class=cf_email]', $('left_column2')).each(function(dropareain){
									dropareain.removeEvents();
									dropareain.addEvent('click', function() {
										$$('div.cf_email').each(function(item){
											item.setProperty('id','');
											item.setStyles({'border':'1px #111 solid'});
										});
										this.setProperty('id','cf_email_active');
										this.setStyles({'border':'3px #111 solid'});
										ShowEmailProperties();
									});	
								});
								clone.remove();
								// add proper item
								if(thisitemtype == 'cf_to'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'to_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'To', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dto'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dto_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic To', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_subject'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'subject_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Subject', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dsubject'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dsubject_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic Subject', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_cc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'cc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'CC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic CC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_bcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'bcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'BCC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dbcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dbcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic BCC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_fromname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'fromname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'From Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dfromname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dfromname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic From Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_fromemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'fromemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'From Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dfromemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dfromemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic From Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_replytoname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'replytoname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'ReplyTo Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dreplytoname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dreplytoname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic ReplyTo Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_replytoemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'replytoemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'ReplyTo Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dreplytoemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dreplytoemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic ReplyTo Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else {}
								form_item = new Element('div').setProperty("class", 'form_item_email');
								theitem.injectInside(form_item);
								theitem = form_item;
								
								// add main attributes
								theitem.getLast().injectHTML('<div class="delete_icon"><img src="<?php 
        echo JURI::Base() . "components/com_chronocontact/css/";
        ?>
images/icon_delete.gif" alt="delete" width="15" height="15"  /></div>', 'after');
								theitem.getLast().setStyle('display', 'none');
								theitem.getLast().addEvent('click', function(e) {
									new Event(e).stop();
									this.getParent().remove();
									if(($chk($E('input[name^=to_]', droparea)) || $chk($E('input[name^=dto_]', droparea))) && ($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))) && ($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))) && ($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))) ){
										droparea.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
									}else{
										var email_params = $('params_'+droparea.getProperty('name')).value.split(',');
										$('params_'+droparea.getProperty('name')).value = email_params[0] + ',' + email_params[1] + ',' + '0';
										$('prop_cf_Email_enable').value = 0;
										$('prop_cf_Email_enable').disabled = true;
										droparea.effect('background-color', {wait: false, duration: 100}).start('FFAEA5','FFAEA5');
									}
								})
								theitem.getLast().injectHTML('<div class="clear">&nbsp;</div>', 'after');
								theitem.addEvents({
									'mouseover': function(e) {
										//new Event(e).stop();
										theitem.effect('background-color', {wait: false, duration: 100}).start('E7DFE7','E7DFE7');							
									},
									'mouseout': function(e) {
										//new Event(e).stop();
										theitem.effect('background-color', {wait: false, duration: 100}).start('ffffff','ffffff');
									},
									'click': function(e) {
										//new Event(e).stop();
										$ES('.form_item_email',droparea).each(function(item2){
											item2.setStyle('border', '0px solid #000');
											$E('.delete_icon', item2).setStyle('display', 'none');
										});
										theitem.effect('background-color', {wait: false, duration: 100}).start('ffffff','ffffff');
										theitem.setStyle('border', '1px solid #000');		
										$E('.delete_icon', theitem).setStyle('display', 'inline');
									}			
								});
								theitem.effect('background-color', {wait: false, duration: 100}).start('E7DFE7','E7DFE7');
								
								var dropthis = 1;
								if((thisitemtype == 'cf_fromemail')||(thisitemtype == 'cf_dfromemail')){
									if($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))){
										$('logdiv').setText('Only one From Email or Dynamic From Email is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_fromname')||(thisitemtype == 'cf_dfromname')){
									if($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))){
										$('logdiv').setText('Only one From Name or Dynamic From Name is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_replytoemail')||(thisitemtype == 'cf_dreplytoemail')){
									if($chk($E('input[name^=replytoemail_]', droparea)) || $chk($E('input[name^=dreplytoemail_]', droparea))){
										$('logdiv').setText('Only one ReplyTo Email or Dynamic ReplyTo Email is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_replytoname')||(thisitemtype == 'cf_dreplytoname')){
									if($chk($E('input[name^=replytoname_]', droparea)) || $chk($E('input[name^=dreplytoname_]', droparea))){
										$('logdiv').setText('Only one ReplyTo Name or Dynamic ReplyTo Name is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_subject')||(thisitemtype == 'cf_dsubject')){
									if($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))){
										$('logdiv').setText('Only one Subject or Dynamic Subject is accepted per Email');
										dropthis = 0;
									}
								}
								if(dropthis == 1)
								theitem.injectBefore(droparea.getLast());
								counter = counter + 1;
								if($chk($E('div[class=infodiv]', droparea)))$E('div[class=infodiv]', droparea).remove();
								if(($chk($E('input[name^=to_]', droparea)) || $chk($E('input[name^=dto_]', droparea))) && ($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))) && ($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))) && ($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))) ){
									droparea.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
									if(droparea.getProperty('id') == 'cf_email_active'){
										$('prop_cf_Email_enable').disabled = false;
									}
								}
								//$('emailbuilder').setStyle('height',  ($('left_column2').getCoordinates().height + $('top_column2').getCoordinates().height) );
								
							},
							'over': function() {
								//dropFx.start('98B5C1');
							},
							'leave': function() {
								//dropFx.start('ffffff');
							}
						});
						
					});
					
					//counter = counter + 1;
					var drag2 = clone.makeDraggable({
						droppables: $ES('div[class=cf_email]', $('left_column2'))
					}); // this returns the dragged element
			 
					drag2.start(e); // start the event manual
				});
			 
			});
			//drop2.inject($('left_column2'));
			//$('emailbuilder').setStyle('height',  ($('left_column2').getCoordinates().height + $('top_column2').getCoordinates().height) );
			
		}
		
	  </script>
	<?php 
        global $mainframe;
        ?>
	
	<script type="text/javascript" src="<?php 
        echo JURI::Base() . 'components/com_chronocontact/js/';
        ?>
tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript">
			tinyMCE.init({
			theme : "advanced",
			language : "en",
			mode : "textareas",
			gecko_spellcheck : "true",
			editor_selector : "mce_editable",
			document_base_url : "<?php 
        echo $mainframe->getSiteURL();
        ?>
",
			entities : "60,lt,62,gt",
			relative_urls : 1,
			remove_script_host : false,
			save_callback : "TinyMCE_Save",
			invalid_elements : "applet",
			extended_valid_elements : "a[class|name|href|target|title|onclick|rel],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],,hr[id|title|alt|class|width|size|noshade]",
			theme_advanced_toolbar_location : "top",
			theme_advanced_source_editor_height : "550",
			theme_advanced_source_editor_width : "450",
			directionality: "ltr",
			force_br_newlines : "false",
			force_p_newlines : "true",
			content_css : "<?php 
        echo $mainframe->getSiteURL();
        ?>
templates/system/css/editor.css",
			debug : false,
			cleanup : true,
			cleanup_on_startup : false,
			safari_warning : false,
			plugins : "advlink, advimage, searchreplace,insertdatetime,emotions,media,advhr,table,fullscreen,directionality,layer,style",
			theme_advanced_resizing : true,
			//theme_advanced_buttons1_add : "fontselect",
			theme_advanced_buttons2_add : "media,ltr,rtl,insertlayer,forecolor",
			theme_advanced_buttons3_add : "advhr,fullscreen,styleprops,fontselect",
			theme_advanced_buttons4 : "tablecontrols",
			//theme_advanced_buttons5 : "fontselect",
			theme_advanced_disable : "help",
			plugin_insertdate_dateFormat : "%Y-%m-%d",
			plugin_insertdate_timeFormat : "%H:%M:%S",
			
			fullscreen_settings : {
				theme_advanced_path_location : "top"
			}
			
		});
		function TinyMCE_Save(editor_id, content, node)
		{
			base_url = tinyMCE.settings['document_base_url'];
			var vHTML = content;
			if (true == true){
				//vHTML = tinyMCE.regexpReplace(vHTML, 'href\s*=\s*"?'+base_url+'', 'href="', 'gi');
				//vHTML = tinyMCE.regexpReplace(vHTML, 'src\s*=\s*"?'+base_url+'', 'src="', 'gi');
				//vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_src\s*=\s*"?', '', 'gi');
				//vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_href\s*=\s*"?', '', 'gi');
			}
			return vHTML;
		}
	</script>
	<script type="text/javascript">
		window.addEvent('domready', function() {
		<?php 
        for ($iemail = 0; $iemail < count($emails); $iemail++) {
            ?>
		<?php 
            $emailparams = new JParameter($emails[$iemail]->params);
            if ($emailparams->get('editor') == '1') {
                ?>
		tinyMCE.execCommand('mceAddControl', false, 'editor_email_'+<?php 
                echo $iemail;
                ?>
);
		<?php 
            }
            ?>
		<?php 
        }
        ?>
			$$('.cf_email').each(function(emailitem){
				if(($chk($E('input[name^=to_]', emailitem)) || $chk($E('input[name^=dto_]', emailitem))) && ($chk($E('input[name^=subject_]', emailitem)) || $chk($E('input[name^=dsubject_]', emailitem))) && ($chk($E('input[name^=fromname_]', emailitem)) || $chk($E('input[name^=dfromname_]', emailitem))) && ($chk($E('input[name^=fromemail_]', emailitem)) || $chk($E('input[name^=dfromemail_]', emailitem))) ){
					emailitem.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
				}
				emailitem.addEvent('click', function() {
					$$('div.cf_email').each(function(item){
						item.setProperty('id','');
						item.setStyles({'border':'1px #111 solid'});
					});
					this.setProperty('id','cf_email_active');
					this.setStyles({'border':'3px #111 solid'});
					ShowEmailProperties();
				});
			});
			$$('.form_item_email').each(function(formitem){
				formitem.addEvent('click', function() {
					$$('.form_item_email').each(function(item2){
						item2.setStyle('border', '0px solid #000');
						$E('.delete_icon', item2).setStyle('display', 'none');
					});
					this.setStyle('border', '0px solid #000');
					$E('.delete_icon', this).setStyle('display', 'none');
					this.effect('background-color', {wait: false, duration: 100}).start('ffffff','ffffff');
					this.setStyle('border', '1px solid #000');		
					$E('.delete_icon', this).setStyle('display', 'inline');
				});
			});
			$$('.delete_icon').each(function(deleteicon){
				deleteicon.addEvent('click', function(e) {
					//new Event(e).stop();
					droparea = this.getParent().getParent();
					this.getParent().remove();
					if(($chk($E('input[name^=to_]', droparea)) || $chk($E('input[name^=dto_]', droparea))) && ($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))) && ($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))) && ($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))) ){
						droparea.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
					}else{
						var email_params = $('params_'+droparea.getProperty('name')).value.split(',');
						$('params_'+droparea.getProperty('name')).value = email_params[0] + ',' + email_params[1] + ',' + '0';
						$('prop_cf_Email_enable').value = 0;
						$('prop_cf_Email_enable').disabled = true;
						droparea.effect('background-color', {wait: false, duration: 100}).start('FFAEA5','FFAEA5');
					}
				});
			});
			
			
			$$('.emailitem').each(function(item){
				item.removeEvents();
			});
			//var counter = 0; 
			$$('.emailitem').each(function(item){	 
				item.addEvent('mousedown', function(e) {
					e = new Event(e).stop();
					
					
					var clone = new Element('div', {'class':'emailitem'}).adopt( new Element('span', {'id':this.getFirst().getProperty('id')}).setText(this.getFirst().getText()) )//this.clone()
					//var clonetext = new Element('span', {'id':this.getFirst().getProperty('id')}).injectInside(clone);
						.setStyles(this.getCoordinates()) // this returns an object with left/top/bottom/right, so its perfect
						.setStyles({'opacity': 0.7, 'position': 'absolute'})
						.addEvent('emptydrop', function() {
							this.remove();
							$ES('div[class=cf_email]', $('left_column2')).each(function(droparea){
								droparea.removeEvents();
								droparea.addEvent('click', function() {
									$$('div.cf_email').each(function(item){
										item.setProperty('id','');
										item.setStyles({'border':'1px #111 solid'});
									});
									this.setProperty('id','cf_email_active');
									this.setStyles({'border':'3px #111 solid'});
									ShowEmailProperties();
								});	
							});
						}).inject(document.body);
						
						
					var thisitemtype = item.clone().getFirst().getProperty('id');
					var theitem = new Element('div').setProperty("class", 'form_element');
					$ES('div[class=cf_email]', $('left_column2')).each(function(droparea){
						droparea.addEvents({
							'drop': function() {
								$ES('div[class=cf_email]', $('left_column2')).each(function(dropareain){
									dropareain.removeEvents();
									dropareain.addEvent('click', function() {
										$$('div.cf_email').each(function(item){
											item.setProperty('id','');
											item.setStyles({'border':'1px #111 solid'});
										});
										this.setProperty('id','cf_email_active');
										this.setStyles({'border':'3px #111 solid'});
										ShowEmailProperties();
									});	
								});
								clone.remove();
								// add proper item
								if(thisitemtype == 'cf_to'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'to_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'To', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dto'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dto_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic To', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_subject'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'subject_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Subject', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dsubject'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dsubject_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic Subject', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_cc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'cc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'CC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic CC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_bcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'bcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'BCC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dbcc'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dbcc_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic BCC', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_fromname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'fromname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'From Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dfromname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dfromname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic From Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_fromemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'fromemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'From Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dfromemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dfromemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic From Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								//v3.1
								}else if(thisitemtype == 'cf_replytoname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'replytoname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'ReplyTo Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dreplytoname'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dreplytoname_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic ReplyTo Name', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_replytoemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'replytoemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'ReplyTo Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else if(thisitemtype == 'cf_dreplytoemail'){
									theitem.empty();
									var newTextbox = new CFTEXTBOX('cf_inputbox', '30', 'dreplytoemail_'+counter);
									newTextbox.createElement().injectTop(theitem);
									theitem.addClass('cf_textbox');
									var newLabel = new CFLABEL('cf_label', 'Dynamic ReplyTo Email', 'input_'+counter);
									newLabel.createElement().injectTop(theitem);
								}else {}
								form_item = new Element('div').setProperty("class", 'form_item_email');
								theitem.injectInside(form_item);
								theitem = form_item;
								
								// add main attributes
								theitem.getLast().injectHTML('<div class="delete_icon"><img src="<?php 
        echo JURI::Base() . "components/com_chronocontact/css/";
        ?>
images/icon_delete.gif" alt="delete" width="15" height="15"  /></div>', 'after');
								theitem.getLast().setStyle('display', 'none');
								theitem.getLast().addEvent('click', function(e) {
									new Event(e).stop();
									this.getParent().remove();
									if(($chk($E('input[name^=to_]', droparea)) || $chk($E('input[name^=dto_]', droparea))) && ($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))) && ($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))) && ($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))) ){
										droparea.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
									}else{
										var email_params = $('params_'+droparea.getProperty('name')).value.split(',');
										$('params_'+droparea.getProperty('name')).value = email_params[0] + ',' + email_params[1] + ',' + '0,1,1';
										$('prop_cf_Email_enable').value = 0;
										$('prop_cf_Email_enable').disabled = true;
										droparea.effect('background-color', {wait: false, duration: 100}).start('FFAEA5','FFAEA5');
									}
								})
								theitem.getLast().injectHTML('<div class="clear">&nbsp;</div>', 'after');
								theitem.addEvents({
									'mouseover': function(e) {
										//new Event(e).stop();
										theitem.effect('background-color', {wait: false, duration: 100}).start('E7DFE7','E7DFE7');							
									},
									'mouseout': function(e) {
										//new Event(e).stop();
										theitem.effect('background-color', {wait: false, duration: 100}).start('ffffff','ffffff');
									},
									'click': function(e) {
										//new Event(e).stop();
										$ES('.form_item_email',droparea).each(function(item2){
											item2.setStyle('border', '0px solid #000');
											$E('.delete_icon', item2).setStyle('display', 'none');
										});
										theitem.effect('background-color', {wait: false, duration: 100}).start('ffffff','ffffff');
										theitem.setStyle('border', '1px solid #000');		
										$E('.delete_icon', theitem).setStyle('display', 'inline');
									}			
								});
								theitem.effect('background-color', {wait: false, duration: 100}).start('E7DFE7','E7DFE7');
								
								var dropthis = 1;
								if((thisitemtype == 'cf_fromemail')||(thisitemtype == 'cf_dfromemail')){
									if($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))){
										$('logdiv').setText('Only one From Email or Dynamic From Email is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_fromname')||(thisitemtype == 'cf_dfromname')){
									if($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))){
										$('logdiv').setText('Only one From Name or Dynamic From Name is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_replytoemail')||(thisitemtype == 'cf_dreplytoemail')){
									if($chk($E('input[name^=replytoemail_]', droparea)) || $chk($E('input[name^=dreplytoemail_]', droparea))){
										$('logdiv').setText('Only one ReplyTo Email or Dynamic ReplyTo Email is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_replytoname')||(thisitemtype == 'cf_dreplytoname')){
									if($chk($E('input[name^=replytoname_]', droparea)) || $chk($E('input[name^=dreplytoname_]', droparea))){
										$('logdiv').setText('Only one ReplyTo Name or Dynamic ReplyTo Name is accepted per Email');
										dropthis = 0;
									}
								}
								if((thisitemtype == 'cf_subject')||(thisitemtype == 'cf_dsubject')){
									if($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))){
										$('logdiv').setText('Only one Subject or Dynamic Subject is accepted per Email');
										dropthis = 0;
									}
								}
								if(dropthis == 1)
								theitem.injectBefore(droparea.getLast());
								counter = counter + 1;
								if($chk($E('div[class=infodiv]', droparea)))$E('div[class=infodiv]', droparea).remove();
								if(($chk($E('input[name^=to_]', droparea)) || $chk($E('input[name^=dto_]', droparea))) && ($chk($E('input[name^=subject_]', droparea)) || $chk($E('input[name^=dsubject_]', droparea))) && ($chk($E('input[name^=fromname_]', droparea)) || $chk($E('input[name^=dfromname_]', droparea))) && ($chk($E('input[name^=fromemail_]', droparea)) || $chk($E('input[name^=dfromemail_]', droparea))) ){
									droparea.effect('background-color', {wait: false, duration: 100}).start('CEFF63','CEFF63');
									if(droparea.getProperty('id') == 'cf_email_active'){
										$('prop_cf_Email_enable').disabled = false;
									}
								}
								//$('emailbuilder').setStyle('height',  ($('left_column2').getCoordinates().height + $('top_column2').getCoordinates().height) );
								
							},
							'over': function() {
								//dropFx.start('98B5C1');
							},
							'leave': function() {
								//dropFx.start('ffffff');
							}
						});
						
					});
					
					//counter = counter + 1;
					var drag2 = clone.makeDraggable({
						droppables: $ES('div[class=cf_email]', $('left_column2'))
					}); // this returns the dragged element
			 
					drag2.start(e); // start the event manual
				});
			 
			});
			
			var Tips1 = new ChronoTips($('cf_to'));
			var Tips2 = new ChronoTips($('cf_dto'));
			var Tips3 = new ChronoTips($('cf_subject'));
			var Tips4 = new ChronoTips($('cf_dsubject'));
			var Tips5 = new ChronoTips($('cf_cc'));
			var Tips6 = new ChronoTips($('cf_dcc'));
			var Tips7 = new ChronoTips($('cf_bcc'));
			var Tips8 = new ChronoTips($('cf_dbcc'));
			var Tips9 = new ChronoTips($('cf_fromname'));
			var Tips10 = new ChronoTips($('cf_dfromname'));
			var Tips11 = new ChronoTips($('cf_fromemail'));
			var Tips12 = new ChronoTips($('cf_dfromemail'));
			var Tips90 = new ChronoTips($('cf_replytoname'));
			var Tips100 = new ChronoTips($('cf_dreplytoname'));
			var Tips110 = new ChronoTips($('cf_replytoemail'));
			var Tips120 = new ChronoTips($('cf_dreplytoemail'));
			
			var Tipsnew = new ChronoTips($('cf_newemail'));
			var Tipsdel = new ChronoTips($('cf_delemail'));
			
		});
		window.addEvent('domready', function() {
			var top ;//= $('right_column').getPosition().y - 2;
			var marginChange = new Fx.Style('right_column', 'margin-top', {wait:false, duration:500, transition:Fx.Transitions.Elastic.easeOut});		
			window.addEvent('scroll', function() {
				if(!top)top = $('right_column').getPosition().y;
				marginChange.start(Math.max(0, window.getScrollTop() - top));
			});
		});
	</script>



	  <?php 
        echo JHTML::_('behavior.tooltip');
        ?>
	<center><strong style="font-size:16px; "><?php 
        echo $row->name;
        ?>
</strong></center><?php 
        echo JHTML::_('tooltip', "This is a tooltip with some usefull info about the field");
        ?>
 ToolTip
	  <form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
	  <div class="col width-120">
	  <?php 
        jimport('joomla.html.pane');
        $pane =& JPane::getInstance('tabs');
        echo $pane->startPane("content-pane2");
        echo $pane->startPanel('General', "general");
        ?>
	  <!--<div id="config-document">-->
	  <div id="page-general">
	<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Main Settings');
        ?>
</legend>
	<table class="admintable">
  	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is the Form name, It must be Unique.");
        ?>
</td>
		<td class="key"><strong>Form Name:</strong> <br><strong style="color:#FF0000 ">must be unique between forms</strong></td>
		<td></td>
		<td><input type="text" class="inputbox" size="50" maxlength="100" name="name" id="cf_adminform_name" value="<?php 
        echo $row->name;
        ?>
" /></td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is a global Emailing switch for the form, even if emails are setup to email and this is No then the form will email nothing!");
        ?>
</td>
		<td class="key"><strong>Email the results ?</strong> </td>
		<td></td>
		<td><select name="emailresults" id="emailresults" >
          <option value="0" <?php 
        if ($row->emailresults == 0) {
            echo 'selected';
        }
        ?>
>No</option>
		  <option value="2" <?php 
        if ($row->emailresults == 2) {
            echo 'selected';
        }
        ?>
>Yes</option>
        </select></td>
	</tr>
    </table>
    </fieldset>
    <fieldset class="adminform">
	<legend><?php 
        echo JText::_('Core/View Form Settings');
        ?>
</legend>
	<table class="admintable">	
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put here any code you want to use inside the form tag, like a validation javascript function to be executed when the form is submitted, code example : onsubmit=return validateForm()");
        ?>
</td>
		<td class="key"><strong>Form tag attachment:</strong><br><strong style="color:#FF0000 ">something like onSubmit()</strong> </td>
		<td></td>
		<td><input type="text" class="inputbox" size="100" name="attformtag" value="<?php 
        echo htmlspecialchars($row->attformtag);
        ?>
" /></td>
	</tr>
    <input type="hidden" name="theme" value="<?php 
        echo $row->theme;
        ?>
" />
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Form method");
        ?>
</td>
		<td class="key"><strong>Form method:</strong> </td>
		<td></td>
		<td>
		<select name="params[formmethod]" id="params[formmethod]">
		<option<?php 
        if ($paramsvalues->get('formmethod') == 'post') {
            echo ' selected';
        }
        ?>
 value="post">Post</option>
		<option<?php 
        if ($paramsvalues->get('formmethod') == 'get') {
            echo ' selected';
        }
        ?>
 value="get">Get</option>
		</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Load Chronoforms CSS/JS files? Necessary for forms created with the wizard");
        ?>
</td>
		<td class="key"><strong>Load Chronoforms CSS/JS Files?</strong> </td>
		<td></td>
		<td>
		<select name="params[LoadFiles]" id="params[LoadFiles]">
			<option<?php 
        if ($paramsvalues->get('LoadFiles') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('LoadFiles') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
	</tr>
    </table>        
    </fieldset>
    <fieldset class="adminform">
        <legend><?php 
        echo JText::_('Form URLs');
        ?>
</legend>
        <table class="admintable">	
        <tr>
            <td><?php 
        echo JHTML::_('tooltip', "This is the URL where the form will go after its submitted");
        ?>
</td>
            <td class="key"><strong>Redirect URL:</strong> </td>
            <td></td>
            <td><input type="text" class="inputbox" size="50" name="redirecturl" value="<?php 
        echo htmlspecialchars($row->redirecturl);
        ?>
" />
            <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::by default(if empty) will load an empty body area">
			<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
        	</span>
            </td>
        </tr>    
        <tr>
            <td><?php 
        echo JHTML::_('tooltip', "This is the *action* URL, you can use this to submit the form results to an external page like your payment gateway for example");
        ?>
</td>
            <td class="key"><strong>Submit URL:</strong><br><strong style="color:#FF0000 ">The form's "action" URL</strong> </td>
            <td></td>
            <td><input type="text" class="inputbox" size="50" name="submiturl" value="<?php 
        echo htmlspecialchars($row->submiturl);
        ?>
" />
            <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::don't put anything here unless you know what you are doing">
			<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
        	</span>
            </td>
        </tr>
        </table>
        </fieldset>
	<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Other Form Settings');
        ?>
</legend>
	<table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Limit how soon the same user can resubmit the form, we check here using user session, so if he got a new session then this will not limit it, this is usefull incase you want to prevent resubmitting the form in case of page refresh!");
        ?>
</td>
		<td class="key"><strong>Submissions limit (in seconds):</strong> </td>
		<td></td>
		<td>
		<input type="text" name="params[submissions_limit]" id="params[submissions_limit]" class="inputbox" size="50" maxlength="100" value="<?php 
        echo $paramsvalues->get('submissions_limit');
        ?>
">
		</td>
	</tr>   
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Error message which will appear in case of exhausted submissions limit");
        ?>
</td>
		<td class="key">Submissions Limit error</td>
		<td></td>
		<td>
		<input type="text" name="params[submissions_limit_error]" id="params[submissions_limit_error]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('submissions_limit_error', 'Sorry but you can not submit the form again very soon like this!');
        ?>
">
		</td>
	</tr> 
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "by defaults chronoforms will concatenate posted arrays' values with commas to be a string, if you don't want this to happen then set this to No");
        ?>
</td>
		<td class="key">ChronoForms handle my posted arrays:</td>
		<td></td>
		<td>
		<select name="params[handlepostedarrays]" id="params[handlepostedarrays]">
				<option<?php 
        if ($paramsvalues->get('handlepostedarrays') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
				<option<?php 
        if ($paramsvalues->get('handlepostedarrays') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
		</select>
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "if debug is ON then ChronoForms will show diagnostic output");
        ?>
</td>
		<td class="key"><strong>Debug:</strong> </td>
		<td></td>
		<td>
			<select name="params[debug]" id="params[debug]">
				<option<?php 
        if ($paramsvalues->get('debug') == '0') {
            echo ' selected';
        }
        ?>
 value="0">OFF</option>
				<option<?php 
        if ($paramsvalues->get('debug') == '1') {
            echo ' selected';
        }
        ?>
 value="1">ON</option>
			</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Enable the Joomla checkToken function once the form is submitted.");
        ?>
</td>
		<td class="key"><strong>checkToken:</strong> </td>
		<td></td>
		<td>
			<select name="params[checkToken]" id="params[checkToken]">				
				<option<?php 
        if ($paramsvalues->get('checkToken') == '1') {
            echo ' selected';
        }
        ?>
 value="1">ON</option>
                <option<?php 
        if ($paramsvalues->get('checkToken') == '0') {
            echo ' selected';
        }
        ?>
 value="0">OFF</option>
			</select>
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "The most used is ENGINE (v4+) however you can consider changing this to TYPE of you get a mysql error when you try to create a table");
        ?>
</td>
		<td class="key"><strong>MYSQL Statement ? ENGINE or TYPE</strong> </td>
		<td></td>
		<td>
			<select name="params[mysql_type]" id="params[mysql_type]">
				<option<?php 
        if ($paramsvalues->get('mysql_type') == '1') {
            echo ' selected';
        }
        ?>
 value="1">ENGINE</option>
				<option<?php 
        if ($paramsvalues->get('mysql_type') == '2') {
            echo ' selected';
        }
        ?>
 value="2">TYPE</option>
			</select>
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Enable mambots to be applied to this form contents?");
        ?>
</td>
		<td class="key"><strong>Enable mambots?</strong> </td>
		<td></td>
		<td>
		<select name="params[enmambots]" id="params[enmambots]">
			<option<?php 
        if ($paramsvalues->get('enmambots') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('enmambots') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
	</tr>
    <tr>
	   <td><?php 
        echo JHTML::_('tooltip', "Chronoforms will try to republish all your fileds with submitted data in case of wrong captcha code submission by user or any error occured and form reshown while posted data array not empty");
        ?>
</td>
		<td class="key">Republish fields if error occured</td>
        <td></td>
	   <td>
	   <select name="params[captcha_dataload]" id="params[captcha_dataload]">
            <option<?php 
        if ($paramsvalues->get('captcha_dataload') == '0') {
            echo ' selected';
        }
        ?>
 value="0">Dont Republish</option>
            <option<?php 
        if ($paramsvalues->get('captcha_dataload') == '1') {
            echo ' selected';
        }
        ?>
 value="1">Try to Republish</option>
        </select>
	   </td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Enter the list of fields to get skipped when the form is trying to republish the data");
        ?>
</td>
		<td class="key">Republish skip list</td>
		<td></td>
		<td>
		<input type="text" name="params[captcha_dataload_skip]" id="params[captcha_dataload_skip]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('captcha_dataload_skip');
        ?>
">
		</td>
	</tr> 
    <tr>
	   <td><?php 
        echo JHTML::_('tooltip', "Choose wheather Chronoforms will renew the form instance when its submitted ? using the same instance may be useful to edit some form data/settings in the extra code boxes before going into the submit routine!");
        ?>
</td>
		<td class="key">Renew Form Instance On Submit</td>
        <td></td>
	   <td>
	   <select name="params[useCurrent]" id="params[useCurrent]">
            <option<?php 
        if ($paramsvalues->get('useCurrent') == '') {
            echo ' selected';
        }
        ?>
 value="">New Instance</option>
            <option<?php 
        if ($paramsvalues->get('useCurrent') == '1') {
            echo ' selected';
        }
        ?>
 value="1">Same Instance</option>
        </select>
	   </td>
	</tr>
    <!--
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "choose if Chronoforms should parse the HTML when the form is saved to generate fields names or email templates, this may make errors if your form code has strange PHP or JS code!");
        ?>
</td>
		<td class="key"><strong>Parse HTML on save:</strong> </td>
		<td></td>
		<td>
			<select name="params[parsehtml]" id="params[parsehtml]">
				<option<?php 
        if ($paramsvalues->get('parsehtml') == '1') {
            echo ' selected';
        }
        ?>
 value="1">ON</option>
				<option<?php 
        if ($paramsvalues->get('parsehtml') == '0') {
            echo ' selected';
        }
        ?>
 value="0">OFF</option>
			</select>
		</td>
	</tr>
    -->
	</table>    
    </fieldset>
    <fieldset class="adminform">
	<legend><?php 
        echo JText::_('Date Fields Settings');
        ?>
</legend>
	<table class="admintable">   
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "set the format to the date field in any datetimepicker element used in the form");
        ?>
</td>
		<td class="key"><strong>Date Format:</strong> </td>
		<td></td>
		<td>
		<input type="text" name="params[datefieldformat]" id="params[datefieldformat]" class="inputbox" size="50" maxlength="100" value="<?php 
        echo $paramsvalues->get('datefieldformat', 'd/m/Y');
        ?>
">
		</td>
	</tr>	
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Date fields which will load the calendar");
        ?>
</td>
		<td class="key">Date Fields names:<br><strong style="color:#FF0000 ">E.g: date_1,date_2</strong> </td>
		<td></td>
		<td>
		<input type="text" name="params[datefieldsnames]" id="params[datefieldsnames]" class="inputbox" size="100" value="<?php 
        echo $paramsvalues->get('datefieldsnames');
        ?>
">
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Date fields which will load the calendar");
        ?>
</td>
		<td class="key">Date Fields extras:</td>
		<td></td>
		<td>
		<input type="text" name="params[datefieldextras]" id="params[datefieldextras]" class="inputbox" size="100" value="<?php 
        echo $paramsvalues->get('datefieldextras', "classes: ['dashboard']");
        ?>
">
		</td>
	</tr>
    </table>
    </fieldset>
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Setup Emails", 'semails');
        $database =& JFactory::getDBO();
        $query = "SELECT * FROM #__chrono_contact_emails WHERE formid = '" . $row->id . "' ORDER BY emailid";
        $database->setQuery($query);
        $emails = $database->loadObjectList();
        $emailscounter = 0;
        ?>
	<div id="page-semails">
		<table border="0" cellpadding="0" cellspacing="0" width="810px">
  <tr>
  <td valign="top">		
				<div class="float_left width1" >
					<div id="top_column2">				
					<a href="#" onClick="addEmail();return false;"><img id="cf_newemail" title="New Email :: Click to insert a new Email container" border="0" src="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
images/get_msgs_f2.png" width="32" height="32"></a>
					<a href="#" onClick="deletemail();return false;"><img id="cf_delemail" title="Delete Email :: Choose an email from below then click to delete it" border="0" src="<?php 
        echo JURI::Base() . 'components/com_chronocontact/css/';
        ?>
images/trash.png" width="32" height="32"></a>
					</div>
					<div id="left_column2"><div id="logdiv" style="color:#FF0000; text-align:center ">Click Add Email to add new Email</div>
					<?php 
        foreach ($emails as $email) {
            ?>
						<div class="cf_email" id="" name="email_<?php 
            echo $emailscounter;
            ?>
" style="border: 1px solid rgb(17, 17, 17); padding: 15px; width: 500px; background-color: rgb(255, 174, 165); min-height: 75px; margin-top: 15px;">
							<?php 
            if ($email->to) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">To</label>
									<input type="text" name="to_<?php 
                echo $emailscounter;
                ?>
" id="to_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->to;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dto) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic To</label>
									<input type="text" name="dto_<?php 
                echo $emailscounter;
                ?>
" id="dto_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dto;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->subject) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Subject</label>
									<input type="text" name="subject_<?php 
                echo $emailscounter;
                ?>
" id="subject_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->subject;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dsubject) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic Subject</label>
									<input type="text" name="dsubject_<?php 
                echo $emailscounter;
                ?>
" id="dsubject_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dsubject;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->cc) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">CC</label>
									<input type="text" name="cc_<?php 
                echo $emailscounter;
                ?>
" id="cc_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->cc;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dcc) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic CC</label>
									<input type="text" name="dcc_<?php 
                echo $emailscounter;
                ?>
" id="dcc_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dcc;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->bcc) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">BCC</label>
									<input type="text" name="bcc_<?php 
                echo $emailscounter;
                ?>
" id="bcc_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->bcc;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dbcc) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic BCC</label>
									<input type="text" name="dbcc_<?php 
                echo $emailscounter;
                ?>
" id="dbcc_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dbcc;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->fromname) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Fromname</label>
									<input type="text" name="fromname_<?php 
                echo $emailscounter;
                ?>
" id="fromname_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->fromname;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dfromname) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic Fromname</label>
									<input type="text" name="dfromname_<?php 
                echo $emailscounter;
                ?>
" id="dfromname_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dfromname;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->fromemail) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">FromEmail</label>
									<input type="text" name="fromemail_<?php 
                echo $emailscounter;
                ?>
" id="fromemail_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->fromemail;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dfromemail) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic FromEmail</label>
									<input type="text" name="dfromemail_<?php 
                echo $emailscounter;
                ?>
" id="dfromemail_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dfromemail;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
                            
                            <?php 
            if ($email->replytoname) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">ReplyTo name</label>
									<input type="text" name="replytoname_<?php 
                echo $emailscounter;
                ?>
" id="replytoname_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->replytoname;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dreplytoname) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic ReplyTo name</label>
									<input type="text" name="dreplytoname_<?php 
                echo $emailscounter;
                ?>
" id="dreplytoname_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dreplytoname;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->replytoemail) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">ReplyTo Email</label>
									<input type="text" name="replytoemail_<?php 
                echo $emailscounter;
                ?>
" id="replytoemail_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->replytoemail;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							<?php 
            if ($email->dreplytoemail) {
                ?>
							<div class="form_item_email" style="border: 0px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
								<div class="form_element cf_textbox">
									<label class="cf_label">Dynamic ReplyTo Email</label>
									<input type="text" name="dreplytoemail_<?php 
                echo $emailscounter;
                ?>
" id="dreplytoemail_<?php 
                echo $emailscounter;
                ?>
" size="30" maxlength="150" value="<?php 
                echo $email->dreplytoemail;
                ?>
" class="cf_inputbox"/>
								</div>
								<div class="delete_icon" style="display: none;">
									<img height="15" width="15" alt="delete" src="<?php 
                echo JURI::Base();
                ?>
components/com_chronocontact/css/images/icon_delete.gif"/>
								</div>
								<div class="clear"> </div>
							</div>
							<?php 
            }
            ?>
							
							<div class="clear"> </div>
						</div>
					<?php 
            $emailscounter++;
            ?>
	
					<?php 
        }
        ?>
					</div>
					<div class="clear"> </div>   
				</div> 
				</td><td valign="top">
				<div id="right_column" style="top:0px; ">
					<div class="box_header">Toolbox</div>
					<div class="items">
						<div class="emailitem"><span id="cf_to" title="To :: The To Email Address(es), if more than one, separate with comma , although you can add many of this">To</span></div>
						<div class="emailitem"><span id="cf_dto" title="Dynamic To :: This will hold a field name which will contain the To Email address, the wizard will let you pick one of the fields you already created in step 1">Dynamic To</span></div>
						<div class="emailitem"><span id="cf_subject" title="Subject :: The Email Subject Text">Subject</span></div>
						<div class="emailitem"><span id="cf_dsubject" title="Dynamic Subject :: This will hold a field name which will contain the Email Subject, the wizard will let you pick one of the fields you already created in step 1">Dynamic Subject</span></div>
						<div class="emailitem"><span id="cf_cc" title="CC :: The CC Email Address(es), if more than one, separate with comma , although you can add many of this">CC</span></div>
						<div class="emailitem"><span id="cf_dcc" title="Dynamic CC :: This will hold a field name which will contain the CC Email address, the wizard will let you pick one of the fields you already created in step 1">Dynamic CC</span></div>
						<div class="emailitem"><span id="cf_bcc" title="BCC :: The BCC Email Address(es), if more than one, separate with comma , although you can add many of this">BCC</span></div>
						<div class="emailitem"><span id="cf_dbcc" title="Dynamic BCC :: This will hold a field name which will contain the BCC Email address, the wizard will let you pick one of the fields you already created in step 1">Dynamic BCC</span></div>
						<div class="emailitem"><span id="cf_fromname" title="From Name :: The Email From Name, e.g. Admin">From Name</span></div>
						<div class="emailitem"><span id="cf_dfromname" title="Dynamic From Name :: This will hold a field name which will contain The Email From Name, the wizard will let you pick one of the fields you already created in step 1">Dynamic From Name</span></div>
						<div class="emailitem"><span id="cf_fromemail" title="From Email :: The Email From Email, e.g. Admin@Admin.com">From Email</span></div>
						<div class="emailitem"><span id="cf_dfromemail" title="Dynamic From Email :: This will hold a field name which will contain The Email From Email, the wizard will let you pick one of the fields you already created in step 1">Dynamic From Email</span></div>
						<div class="emailitem"><span id="cf_replytoname" title="ReplyTo Name :: The Replyto name, e.g. Admin">ReplyTo Name</span></div>
						<div class="emailitem"><span id="cf_dreplytoname" title="Dynamic ReplyTo Name :: This will hold a field name which will contain The Email ReplyTo Name, the wizard will let you pick one of the fields you already created in step 1">Dynamic ReplyTo Name</span></div>
						<div class="emailitem"><span id="cf_replytoemail" title="ReplyTo Email :: The Email ReplyTo Email, e.g. Admin@Admin.com">ReplyTo Email</span></div>
						<div class="emailitem"><span id="cf_dreplytoemail" title="Dynamic ReplyTo Email :: This will hold a field name which will contain The Email ReplyTo Email, the wizard will let you pick one of the fields you already created in step 1">Dynamic ReplyTo Email</span></div>
                    </div>
					<div id="Properties2">
						<div class="box_header border-top">Email Properties</div>        
							<div class="box_text">
								<div id="prop_cf_Email" class="Propertiesitem" style="display:none ">
									<span>Email Format:</span> <select name="prop_cf_Email_format" id="prop_cf_Email_format" size="1" class="select1"><option value="html" selected="selected">HTML</option><option value="text">Plain Text</option></select><hr />
									<span>Record IP:</span> <select name="prop_cf_Email_IP" id="prop_cf_Email_IP" size="1" class="select1"><option value="1" selected="selected">Yes</option><option value="0">No</option></select><hr />
									<span>Enabled:</span> <select name="prop_cf_Email_enable" id="prop_cf_Email_enable" size="1" class="select1"><option value="1" selected="selected">Yes</option><option value="0">No</option></select><hr />
									<span>Use Template Editor:</span> <select name="prop_cf_Email_editor" id="prop_cf_Email_editor" size="1" class="select1"><option value="1" selected="selected">Yes</option><option value="0">No</option></select><hr />
                                    <span>Enable Attachments:</span> <select name="prop_cf_Email_enable_attachments" id="prop_cf_Email_enable_attachments" size="1" class="select1"><option value="1" selected="selected">Yes</option><option value="0">No</option></select><hr />
                                    <input id="prop_cf_Email_done" type="button" name="prop_cf_Email_done" value="Apply" class="cf_button1" />
								</div>
								<div class="clear"></div>
							</div>
						<!--</div>	-->
					</div>
				</div>
								
		</td>
		</tr>
	</table>
		
			<textarea name="emails_temp" id="emails_temp" style="display:none; "></textarea>
			<input type="hidden" name="emails_temp_ids" id="emails_temp_ids" value="">
	</div>
	
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Emails Templates", 'extracodes');
        ?>
	<div id="page-codes">
		
				<div id="top_column3" style="display:none ">
				</div>
				<div id="left_column33">
					<div id="logdiv2" style="color:#FF0000; text-align:center ">If you left your Email template empty, a template will be automaticly generated similar to your form layout!</div>
						
					<?php 
        $emailscounter = 0;
        ?>
					<?php 
        foreach ($emails as $email) {
            ?>
					<?php 
            $emailparams = new JParameter($email->params);
            $params = $emailparams->get('recordip') . ',' . $emailparams->get('emailtype') . ',' . $emailparams->get('enabled') . ',' . $emailparams->get('editor') . ',' . $emailparams->get('enable_attachments');
            ?>
						<div id="before_editor_email_<?php 
            echo $emailscounter;
            ?>
"><span style="font-weight: bold; font-size: 12px;">Email Template</span></div>
						<textarea class="<?php 
            if ($emailparams->get('editor') == '1') {
                ?>
2mce_editable<?php 
            }
            ?>
" id="editor_email_<?php 
            echo $emailscounter;
            ?>
" name="editor_email_<?php 
            echo $emailscounter;
            ?>
" rows="20" cols="75" style="width:90%; height:350px; "><?php 
            echo $email->template;
            ?>
</textarea>
						<input type="hidden" id="params_email_<?php 
            echo $emailscounter;
            ?>
" value="<?php 
            echo $params;
            ?>
" name="params_email_<?php 
            echo $emailscounter;
            ?>
">
						<div id="after_editor_email_<?php 
            echo $emailscounter;
            ?>
">
                        
                        <br/><br/></div>
					<?php 
            $emailscounter++;
            ?>
	
					<?php 
        }
        ?>
				</div>				   
			
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Form Code", 'codes');
        ?>
	<div id="page-codes">
	<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Main onLoad/View Code');
        ?>
</legend>
	<table class="admintable">
    <tr>
		<td></td>
		<td class="key" style="width:250px">Hint:</td>
		<td colspan="2">Don't use &lt;html&gt; - &lt;body&gt; - &lt;head&gt; - &lt;form&gt; - &lt;script&gt; -&lt;style&gt; tags in the 2 boxes below!</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Plz enter the form HTML code here, the code may contains proper PHP code with tags and do NOT use the *form* tags, it will be created automaticlly");
        ?>
</td>
		<td><strong>Form HTML:</strong><br><strong style="color:#FF0000 ">(May contain PHP code with tags)</strong> </td>
		<td><a href="javascript:toggleList('html')">[+/-]</a></td>
		<td><textarea name="html" id="html" style="display:none" cols="80" rows="30"><?php 
        echo htmlspecialchars($row->html);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "you can use some Javascript code here, plz dont enter the script opening or close tags");
        ?>
</td>
		<td><strong>Form JavaScript:</strong><br><strong style="color:#FF0000 ">(May contain PHP code with tags)</strong> </td>
		<td><a href="javascript:toggleList('scriptcode')">[+/-]</a></td>
		<td><textarea name="scriptcode" id="scriptcode" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->scriptcode);
        ?>
</textarea></td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "you can use your CSS code here to style your own form or override Chronoforms' css code, please don't use any style tags");
        ?>
</td>
		<td><strong>CSS Styles</strong><br><strong style="color:#FF0000 ">(May override Chronoforms CSS)</strong> </td>
		<td><a href="javascript:toggleList('stylecode')">[+/-]</a></td>
		<td><textarea name="stylecode" id="stylecode" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->stylecode);
        ?>
</textarea></td>
	</tr>
	</table>
    </fieldset>
    <fieldset class="adminform">
	<legend><?php 
        echo JText::_('onSubmit Events Code');
        ?>
</legend>
	<table class="admintable">
    <tr>
		<td></td>
		<td class="key" style="width:250px">Hint:</td>
		<td colspan="2">The simplest usage of the next 2 boxes is to show a thank you message after the form is submitted.</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "well formatted PHP code to be executed just when form is submitted but BEFORE Mail is sent");
        ?>
</td>
		<td><strong>On Submit code - before sending email:</strong><br><strong style="color:#FF0000 ">(May contain PHP code with tags)</strong> </td>
		<td><a href="javascript:toggleList('onsubmitcodeb4')">[+/-]</a></td>
		<td><textarea name="onsubmitcodeb4" id="onsubmitcodeb4" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->onsubmitcodeb4);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "well formatted PHP code to be executed just when form is submitted but AFTER Mail is sent");
        ?>
</td>
		<td><strong>On Submit code - after sending email:</strong><br><strong style="color:#FF0000 ">(May contain PHP code with tags)</strong> </td>
		<td><a href="javascript:toggleList('onsubmitcode')">[+/-]</a></td>
		<td><textarea name="onsubmitcode" id="onsubmitcode" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->onsubmitcode);
        ?>
</textarea></td>
	</tr>	
	</table>
    </fieldset>
    
    <fieldset class="adminform">
	<legend><?php 
        echo JText::_('Extra Code');
        ?>
</legend>
	<table class="admintable">
    <tr>
		<td></td>
		<td class="key" style="width:250px">Info:</td>
		<td colspan="2">This code will run if task=extra is provided in the form URL</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is an extra code box which can be used by the user to store any data");
        ?>
</td>
		<td class="key"><strong>Extra code 1:</strong> </td>
		<td><a href="javascript:toggleList('extra1')">[+/-]</a></td>
		<td><textarea name="extra1" id="extra1" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->extra1);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is an extra code box which can be used by the user to store any data");
        ?>
</td>
		<td class="key"><strong>Extra code 2:</strong> </td>
		<td><a href="javascript:toggleList('extra2')">[+/-]</a></td>
		<td><textarea name="extra2" id="extra2" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->extra2);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is an extra code box which can be used by the user to store any data");
        ?>
</td>
		<td class="key"><strong>Extra code 3:</strong> </td>
		<td><a href="javascript:toggleList('extra3')">[+/-]</a></td>
		<td><textarea name="extra3" id="extra3" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->extra3);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is an extra code box which can be used by the user to store any data");
        ?>
</td>
		<td class="key"><strong>Extra code 4:</strong> </td>
		<td><a href="javascript:toggleList('extra4')">[+/-]</a></td>
		<td><textarea name="extra4" id="extra4" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->extra4);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This is an extra code box which can be used by the user to store any data");
        ?>
</td>
		<td class="key"><strong>Extra code 5:</strong> </td>
		<td><a href="javascript:toggleList('extra5')">[+/-]</a></td>
		<td><textarea name="extra5" id="extra5" style="display:none" cols="80" rows="10"><?php 
        echo htmlspecialchars($row->extra5);
        ?>
</textarea></td>
	</tr>
	</table>
    </fieldset>
	</div>
	
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("DB Connection", 'dbconnection');
        $database =& JFactory::getDBO();
        $tables = $database->getTableList();
        $storedtables = explode(",", $paramsvalues->get('tablenames'));
        ?>
	<div id="page-titlesx">
	<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Data Saving/Logging Settings');
        ?>
</legend>
	<table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Choose if you want to enable the DB connection which means writing data to some table you choose");
        ?>
</td>
		<td class="key"><strong>Enable Data storage:</strong><br><strong style="color:#FF0000 "></strong> </td>
		<td></td>
		<td>
		<select name="params[dbconnection]" id="params[dbconnection]">
			<option<?php 
        if ($paramsvalues->get('dbconnection') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('dbconnection') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Select the table(s) which you want the form to save/update to");
        ?>
</td>
		<td class="key">TableName(s):</td><td></td>
		<td>
			<select name="tablenames[]" multiple size="10" id="tablenames">
				<?php 
        foreach ($tables as $table) {
            ?>
				<option <?php 
            if (in_array($table, $storedtables)) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $table;
            ?>
"><?php 
            echo $table;
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Saving Data to the Database will be before sending emails or after it ?");
        ?>
</td>
		<td class="key">Saving Data/Emails order:</td>
		<td></td>
		<td>
		<select name="params[savedataorder]" id="params[savedataorder]">
				<option<?php 
        if ($paramsvalues->get('savedataorder') == 'after_email') {
            echo ' selected';
        }
        ?>
 value="after_email">After Email</option>
				<option<?php 
        if ($paramsvalues->get('savedataorder') == 'before_email') {
            echo ' selected';
        }
        ?>
 value="before_email">Before Email</option>
		</select>
		</td>
	</tr>
	</table>
    </fieldset>
    <fieldset class="adminform">
	<legend><?php 
        echo JText::_('DataView Fields');
        ?>
</legend>
	<table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put here a list of fields names you would like to appear at the datagrid for this form data page, more than 1 field can be used separarted with a comma ,");
        ?>
</td>
		<td class="key"><strong>Extra dataview columns fields names:</strong> </td>
		<td></td>
		<td>
		<input type="text" name="params[dvfields]" id="params[dvfields]" class="inputbox" size="50" value="<?php 
        if (!$row->id) {
            echo "recordtime";
        } else {
            echo $paramsvalues->get('dvfields');
        }
        ?>
">
		</td>
	</tr>
	<tr style="background-color:#fff ">
		<td><?php 
        echo JHTML::_('tooltip', 'Main record view field text');
        ?>
</td>
		<td class="key"><strong><?php 
        echo 'main view record';
        ?>
:</strong> </td>
		<td></td>
		<td>
		<?php 
        if (!trim($paramsvalues->get('dvrecord'))) {
            $paramsvalues->set('dvrecord', "Record #n");
        }
        ?>
		<input type="text" name="params[dvrecord]" id="params[dvrecord]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('dvrecord');
        ?>
">
		</td>
	</tr>
	</table>
    </fieldset>
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("AutoGenerated code", 'autogen');
        ?>
	<div id="page-autogen">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('AutoGenerated Code/Data');
        ?>
</legend>
    <table class="admintable">	
    <tr>
		<td></td>
		<td class="key" style="width:250px">Hint</td>
		<td></td>
		<td>The data below is auto generated by Chronoforms and will be regenerated everytime the form is saved, editing it is worthless.</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "This code has been auto generated when you created a table for this form and is required for saving data");
        ?>
</td>
		<td class="key" style="width:250px">Auto generated:<br><strong style="color:#FF0000 ">Dont touch this unless you know what you are doing</strong> </td>
		<td><a href="javascript:toggleList('autogenerated')">[+/-]</a></td>
		<td><textarea name="autogenerated" style="display:none" id="autogenerated" cols="80" rows="20"><?php 
        echo htmlspecialchars($row->autogenerated);
        ?>
</textarea></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Chronoforms will process your form code and get all fields names and stores it here once you save the form, it will be used later many times and so this leads to better performance!");
        ?>
</td>
		<td class="key">Form Fields names:<br><strong style="color:#FF0000 ">E.g: field_name_1,field_name_2</strong> </td>
		<td></td>
		<td>
		<input type="text" name="fieldsnames" id="fieldsnames" class="inputbox" size="100" value="<?php 
        echo $row->fieldsnames;
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Chronoforms will process your form code and get all fields types and stores it here once you save the form, it will be used later many times and so this leads to better performance!");
        ?>
</td>
		<td class="key">Form Fields types:<br><strong style="color:#FF0000 ">E.g: input_text,select,file</strong> </td>
		<td></td>
		<td>
		<input type="text" name="fieldstypes" id="fieldstypes" class="inputbox" size="100" value="<?php 
        echo $row->fieldstypes;
        ?>
">
		</td>
	</tr>    
	</table>
    </fieldset>
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("File Uploads", 'uploads');
        ?>
	<div id="page-uploads">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('Files Upload Settings');
        ?>
</legend>
    <table class="admintable">	
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Choose if you want to enable file uploads through your form");
        ?>
</td>
		<td class="key">Enable uploads:</td>
		<td></td>
		<td>
		<select name="params[uploads]" id="params[uploads]">
			<option<?php 
        if ($paramsvalues->get('uploads') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('uploads') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
        <td></td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Which fields are of type FILE ? Use this syntax to control allowable extensions : file_2:jpg|png{222-1},file_3:gz|zip{99-0}");
        ?>
</td>
		<td class="key" style="width:250px">Field names/allowed Extensions/sizes(KB)</td>
		<td></td>
		<td>
		<input type="text" name="params[uploadfields]" id="params[uploadfields]" class="inputbox" size="100" value="<?php 
        echo $paramsvalues->get('uploadfields');
        ?>
">
		</td>
        <td>
        <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::E.g: file_2:jpg|png{222-1},file_3:gz|zip{99-0} and all extensions should be in low case!">
			<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
        </span>
        </td>
	</tr>   
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Set the upload path");
        ?>
</td>
		<td class="key">Full upload Path:</td>
		<td></td>
		<td>
        <?php 
        if ($row->name) {
            $uploadpath = JPATH_SITE . DS . "components" . DS . "com_chronocontact" . DS . 'uploads' . DS . $row->name . DS;
        } else {
            $uploadpath = '';
        }
        ?>
		<input type="text" name="params[uploadpath]" id="params[uploadpath]" class="inputbox" size="100" value="<?php 
        if (trim($paramsvalues->get('uploadpath'))) {
            echo $paramsvalues->get('uploadpath');
        } else {
            echo $uploadpath;
        }
        ?>
"><br />
        
		</td>
        <td>
		<?php 
        $uploadpath = $paramsvalues->get('uploadpath') ? $paramsvalues->get('uploadpath') : JPATH_SITE . DS . "components" . DS . "com_chronocontact" . DS . 'uploads' . DS . $row->name . DS;
        if (is_writable($uploadpath)) {
            echo "<font style='color:#00FF00'>Writable</font>";
        } else {
            echo "<font style='color:#FF0000'>Not Writable</font>";
        }
        ?>
        </td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "PHP code to format the file name, use this carefully as it may break the form");
        ?>
</td>
		<td class="key" style="width:250px">FileName format</td>
		<td></td>
		<td>
		<input type="text" name="params[filename_format]" id="params[filename_format]" class="inputbox" size="100" value="<?php 
        echo $paramsvalues->get('filename_format', "\$filename = date('YmdHis').'_'.\$chronofile['name'];");
        ?>
">
		</td>
        <td>
        <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::This field should contain valid PHP code formula without tags or it may break the whole form!">
			<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
        </span>
        </td>
	</tr> 
    <tr>
    <td></td>
    <td colspan="3" class="key" style="text-align:left">Default Path:<strong><?php 
        echo JPATH_SITE . DS . "components" . DS . "com_chronocontact" . DS . 'uploads' . DS . $row->name . DS;
        ?>
</strong></td>
    <td></td>
    </tr>
	</table>
    </fieldset>
    <fieldset class="adminform">
    <legend><?php 
        echo JText::_('Files Upload Erros');
        ?>
</legend>
    <table class="admintable">	
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Error message which will appear in case of exceeded size limit");
        ?>
</td>
		<td class="key">Size Exceeded error</td>
		<td></td>
		<td>
		<input type="text" name="params[upload_exceedslimit]" id="params[upload_exceedslimit]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('upload_exceedslimit', 'Sorry, Your uploaded file size exceeds the allowed limit.');
        ?>
">
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Error message which will appear in case of small files sizes");
        ?>
</td>
		<td class="key">Size less error</td>
		<td></td>
		<td>
		<input type="text" name="params[upload_lesslimit]" id="params[upload_lesslimit]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('upload_lesslimit', 'Sorry, Your uploaded file size is less than the allowed limit');
        ?>
">
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Error message which will appear in case of wrong files types uploaded");
        ?>
</td>
		<td class="key">Type not allowed error</td>
		<td></td>
		<td>
		<input type="text" name="params[upload_notallowed]" id="params[upload_notallowed]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('upload_notallowed', 'Sorry, Your uploaded file type is not allowed');
        ?>
">
		</td>
	</tr>
    </table>
    </fieldset>
	</div>
	
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Anti Spam", 'antispam');
        // :: HACK :: show GD capability
        if (function_exists('gd_info')) {
            $gd_info = gd_info();
            $imagever_ok = true;
        } else {
            $imagever_ok = false;
        }
        if ($imagever_ok) {
            if (!$gd_info['GD Version']) {
                $imagever_ok = false;
                $gd_info['GD Version'] = "GD library not found.";
            } else {
                if ($gd_info['FreeType Support']) {
                    $gd_info['FreeType Support'] = 'Yes';
                } else {
                    $gd_info['FreeType Support'] = 'No';
                    $imagever_ok = false;
                }
                if ($gd_info['PNG Support']) {
                    $gd_info['PNG Support'] = 'Yes';
                } else {
                    $gd_info['PNG Support'] = 'No';
                    $imagever_ok = false;
                }
            }
        }
        ?>
	<div id="page-antispam">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('Captcha Settings');
        ?>
</legend>
    <table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "If you want to use image verification select *Yes* here then add {imageverification} inside your form html where you want the image verification to appear.");
        ?>
</td>
		<td class="key">Use Image verification:</td>
        <td></td>
        <td>
        <select name="params[imagever]" id="params[imagever]">
            <option<?php 
        if ($paramsvalues->get('imagever') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
            <option<?php 
        if ($paramsvalues->get('imagever') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
        </select>
        </td>
	</tr>
	<tr>
	<td><?php 
        echo JHTML::_('tooltip', "If your server wont support using true type fonts to draw the image then use without fonts or ask your host to install this feature");
        ?>
</td>
	<td class="key">What type of image to show ?</td>
    <td></td>
    <td>
        <select name="params[imtype]" id="params[imtype]">
            <option<?php 
        if ($paramsvalues->get('imtype') == '0') {
            echo ' selected';
        }
        ?>
 value="0">Without Fonts</option>
            <option<?php 
        if ($paramsvalues->get('imtype') == '1') {
            echo ' selected';
        }
        ?>
 value="1">With Fonts</option>
        </select>
	<?php 
        /*} else {
              echo "Image verification cannot be enabled becasue the GD Library has not been detected at your PHP installation.
                <input type='hidden' name='params[imagever]' id='params[imagever]' value ='No' />";
          }*/
        ?>
	</td>
	</tr>	
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Error message which will appear in case of wrong CAPTCHA entry");
        ?>
</td>
		<td class="key">Error Message</td>
		<td></td>
		<td>
		<input type="text" name="params[imgver_error_msg]" id="params[imgver_error_msg]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('imgver_error_msg', 'You have entered an incorrect verification code at the bottom of the form.');
        ?>
">
		</td>
	</tr>
    </table>
    </fieldset>
    <fieldset class="adminform">
    <legend><?php 
        echo JText::_('GD Info');
        ?>
</legend>
    <table class="admintable">
	<tr>
	   <td></td>
	   <td class="key">GD Version</td>
	   <td><?php 
        echo $gd_info['GD Version'];
        ?>
</td>
	</tr>
		<tr>
	   <td></td>
	   <td class="key">FreeType Support</td>
	   <td><?php 
        echo $gd_info['FreeType Support'];
        ?>
</td>
	</tr>
	</tr>
		<tr>
	   <td></td>
	   <td class="key">PNG Support</td>
	   <td><?php 
        echo $gd_info['PNG Support'];
        ?>
</td>

	</tr>	
   <tr>
   <td></td>
   <td class="key">Sample image: </td>
   <td><img src='<?php 
        echo $mainframe->getSiteURL();
        ?>
components/com_chronocontact/chrono_verification.php<?php 
        if ($paramsvalues->get('imtype') == '1') {
            echo '?imtype=1';
        } else {
            echo '?imtype=0';
        }
        ?>
'></td>
   </tr>		   
	<!-- // end hack -->
	</table>
    </fieldset>
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Validation", 'validation');
        ?>
	<div id="page-validation">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('Javascript Live Validation');
        ?>
    <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::<?php 
        echo JText::_('This is a Javascript validation which will work while the user is filling the form and before the form is submitted, it may not work if your form has any JS errors or if the user has JS disabled at his browser and its not the best way of validation if the data collected are critical!');
        ?>
">
		<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
    </span>
    </legend>
    <table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Enable Validation ?");
        ?>
</td>
		<td class="key">Enable Validation</td>
		<td></td>
		<td>
		<select name="params[validate]" id="params[validate]">
			<option<?php 
        if ($paramsvalues->get('validate') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('validate') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
	</tr>    
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Validation Library used");
        ?>
</td>
		<td class="key"><?php 
        echo "Validation Library";
        ?>
</td>
		<td></td>
		<td>
		<select name="params[validatetype]" id="params[validatetype]">
			<option<?php 
        if ($paramsvalues->get('validatetype') == 'mootools') {
            echo ' selected';
        }
        ?>
 value="mootools">mootools</option>
		</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "whether you want it to validate as you type or only on blur");
        ?>
</td>
		<td class="key">Run Validation onlyOnBlur</td>
		<td></td>
		<td>
		<select name="params[validate_onlyOnBlur]" id="params[validate_onlyOnBlur]">
			<option<?php 
        if ($paramsvalues->get('validate_onlyOnBlur', '1') == '0') {
            echo ' selected';
        }
        ?>
 value="0">No</option>
			<option<?php 
        if ($paramsvalues->get('validate_onlyOnBlur', '1') == '1') {
            echo ' selected';
        }
        ?>
 value="1">Yes</option>
		</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "the time you want it to pause from the last keystroke before it validates (ms)");
        ?>
</td>
		<td class="key">Waiting time</td>
		<td></td>
		<td>
		<input type="text" name="params[validate_wait]" id="params[validate_wait]" class="inputbox" size="10" value="<?php 
        echo $paramsvalues->get('validate_wait');
        ?>
">
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "whether should be validated only when the form it belongs to is submitted");
        ?>
</td>
		<td class="key">Run Validation onlyOnSubmit</td>
		<td></td>
		<td>
		<select name="params[validate_onlyOnSubmit]" id="params[validate_onlyOnSubmit]">
			<option<?php 
        if ($paramsvalues->get('validate_onlyOnSubmit') == '0') {
            echo ' selected';
        }
        ?>
 value="0">No</option>
			<option<?php 
        if ($paramsvalues->get('validate_onlyOnSubmit') == '1') {
            echo ' selected';
        }
        ?>
 value="1">Yes</option>
		</select>
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Should the validation show the error messages or show your error divs with classes like : CF_LV_ERROR_field_id");
        ?>
</td>
		<td class="key">Validation Messages type</td>
		<td></td>
		<td>
		<select name="params[validation_type]" id="params[validation_type]">
			<option<?php 
        if ($paramsvalues->get('validation_type', 'default') == 'default') {
            echo ' selected';
        }
        ?>
 value="default">default style</option>
			<option<?php 
        if ($paramsvalues->get('validation_type', 'default') == 'showalert') {
            echo ' selected';
        }
        ?>
 value="showalert">Show My own Divs</option>
		</select>
		</td>
	</tr>
    <tr>
		<td></td>
		<td class="key">Hint</td>
		<td></td>
		<td>
		If you need a custom error message then put it at your field title attribute! e.g: &lt;input name="field1" title="Enter your first name here"&gt;
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">1 - required (not blank)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_required]" id="params[val_required]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_required');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">2- validate-number (a valid number)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_number]" id="params[val_validate_number]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_number');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">3- validate-digits (digits only)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_digits]" id="params[val_validate_digits]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_digits');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">4- validate-alpha (letters only)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_alpha]" id="params[val_validate_alpha]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_alpha');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">5- validate-alphanum (only letters and numbers)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_alphanum]" id="params[val_validate_alphanum]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_alphanum');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">6- validate-date (a valid date value)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_date]" id="params[val_validate_date]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_date');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">7- validate-email (a valid email address)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_email]" id="params[val_validate_email]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_email');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">8- validate-url (a valid URL)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_url]" id="params[val_validate_url]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_url');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">9- validate-date-au (a date formatted as; dd/mm/yyyy)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_date_au]" id="params[val_validate_date_au]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_date_au');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">10- validate-currency-dollar (a valid dollar value)</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_currency_dollar]" id="params[val_validate_currency_dollar]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_currency_dollar');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "(first option e.g. *Select one...* is not selected option) -- Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">11- validate-selection</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_selection]" id="params[val_validate_selection]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_selection');
        ?>
">
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "(At least one textbox/radio element must be selected in a group - see below*) -- Put list of fields names separated with comma *,* if more than one");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">12- validate-one-required</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_one_required]" id="params[val_validate_one_required]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_one_required');
        ?>
">
		</td>
	</tr>
    <tr>
		<td><?php 
        echo JHTML::_('tooltip', "Validate that 2 fields values are the same, enter the 1st field name to validate then '=' then the 2nd field name, e.g : password=confirm_password");
        ?>
</td>
		<td class="key" style="width:300px; text-align:left">13- validate-confirmation</td>
		<td></td>
		<td>
		<input type="text" name="params[val_validate_confirmation]" id="params[val_validate_confirmation]" class="inputbox" size="50" value="<?php 
        echo $paramsvalues->get('val_validate_confirmation');
        ?>
">
		</td>
	</tr>
    <tr>
		<td></td>
		<td class="key"></td>
		<td></td>
		<td>
		Special thanks to "bouton" for referring to this feature!!
		</td>
	</tr>
	</table>
    </fieldset>
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('ServerSide Validation');
        ?>
    <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::<?php 
        echo JText::_('This is a Serverside validation which will work once the form is submitted, you are using PHP code here and any client side settings will not affect it so its the best way of validation if the data collected are critical!');
        ?>
">
		<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
    </span>
    </legend>
    <table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Enable Server Side Validation ?");
        ?>
</td>
		<td class="key">Enable Server Side Validation</td>
		<td></td>
		<td>
		<select name="params[servervalidate]" id="params[servervalidate]">
			<option<?php 
        if ($paramsvalues->get('servervalidate') == 'No') {
            echo ' selected';
        }
        ?>
 value="No">No</option>
			<option<?php 
        if ($paramsvalues->get('servervalidate') == 'Yes') {
            echo ' selected';
        }
        ?>
 value="Yes">Yes</option>
		</select>
		</td>
	</tr>
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Add here some PHP code with tags to get executed on form submission, in case this code returned any data, the form submission will be halted, the form will be reshown and your retruned data will be dsiplayed in a message above the form!");
        ?>
</td>
		<td class="key">Server Side validation Code:</td>
		<td><a href="javascript:toggleList('server_validation')">[+/-]</a></td>
		<td><textarea name="server_validation" id="server_validation" cols="80" rows="20"><?php 
        echo $row->server_validation;
        ?>
</textarea></td>
	</tr>
	<tr>
    	<td></td>
		<td class="key">Example Code</td>
		<td></td>
		<td>
		&lt;?php <br>
		if($_POST['accept_terms'] != 'yes')<br>
		return 'Sorry, but you need to accept our terms to proceed';<br>
		?&gt;<br>
		</td>
	</tr>
	</table>	
	</fieldset>
	</div>
	
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Plugins", 'plugins');
        ?>
	<div id="page-plugins">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('Plugins Order');
        ?>
    <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::<?php 
        echo JText::_('Pay attention: Some plugins work onsubmit the form event and will do some database changes, please assure that plugins are very well configured or this may end up saving wrong data to the database tables');
        ?>
">
		<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
    </span>
    </legend>
    <script type="text/javascript">
	window.addEvent('domready', function() {
		new Sortables($('plugins_container'), {		 
			initialize: function(){
				var step = 0;
				$ES('.plugins_order_count', 'plugins_container').each(function(element, i){
					step = step + 1;
					$(element.getProperty('id')).setText(step);
					$(element.getProperty('id')+'_value').value = step;
				});
			},
			onComplete:	function(){
				var step2 = 0;
				$ES('.plugins_order_count', 'plugins_container').each(function(element){
					step2 = step2 + 1;
					$(element.getProperty('id')).setText(step2);
					$(element.getProperty('id')+'_value').value = step2;
				});
			},
			handles: 'span.plugins_order_drag'
		});
		var Tips1 = new Tips($$('.plugins_order'));
		
	});
	function enablePlugin(pluginname){
		if($('plugins_order_'+pluginname+'_enable_value').value != '1'){
			$('plugins_order_'+pluginname).setStyle('background-color', '#00BB00');
			$('plugins_order_'+pluginname+'_enable_value').value = '1';
			$('plugins_order_'+pluginname+'_enableimg').src = '<?php 
        echo JURI::Base() . 'components/com_chronocontact/images/';
        ?>
disable.png';
		}else{
			$('plugins_order_'+pluginname).setStyle('background-color', '#DD0000');
			$('plugins_order_'+pluginname+'_enable_value').value = '0';
			$('plugins_order_'+pluginname+'_enableimg').src = '<?php 
        echo JURI::Base() . 'components/com_chronocontact/images/';
        ?>
enable.png';
		}
	}
	</script>
    <style type="text/css">
		#plugins_container { 
			position: inherit;
		}
		 
		div#sortables {
			width: 300px;
			margin: 0;
			padding: 0;
		}
		 
		div.plugins_order {
			padding: 4px 8px;
			color: #fff;
			cursor: pointer;
			list-style: none;
			width: 300px;
			background-color:#DD0000;
			border:4px solid #000;
			overflow:hidden;
		}
		 
		div#sortables div {
			margin: 10px 0;
		}		
		
		span.plugins_order_count{
			float:right;
			font-size:14px;
			font-weight:bold;
		}
		
		span.plugins_order_enable{
			float:right;
			font-size:14px;
			font-weight:bold;
			padding:0px 0px 0px 10px;
		}
		
		span.plugins_order_drag{
			float:right;
			font-size:14px;
			font-weight:bold;
			padding:0px 0px 0px 10px;
		}
		
		span.plugins_order_text{
			float:left;
			font-size:12px;
			font-weight:bold;
		}
	</style>
    <table class="admintable">	
    <tr>
		<td>
        <div id="plugins_container">        
			<?php 
        $directory = JPATH_SITE . '/components/com_chronocontact/plugins/';
        $results = array();
        $handler = opendir($directory);
        while ($file = readdir($handler)) {
            if ($file != '.' && $file != '..' && substr($file, -4) == '.php' && substr($file, 0, 3) == 'cf_') {
                $results[] = str_replace(".php", "", $file);
            }
        }
        closedir($handler);
        $order = 0;
        $mplugins_order = explode(",", $paramsvalues->get('mplugins_order', ''));
        $plugins = explode(",", $paramsvalues->get('plugins'));
        sort($results);
        $neworder = array();
        foreach ($results as $k => $result) {
            require_once JPATH_SITE . "/components/com_chronocontact/plugins/" . $result . ".php";
            ${$result} = new $result();
            if (!in_array($result, $plugins)) {
                for ($i = 0; $i < count($results); $i++) {
                    if (!in_array($i + 1, $mplugins_order) && empty($neworder[$i])) {
                        $neworder[$i] = $result;
                        break;
                    }
                }
            }
        }
        if ($paramsvalues->get('mplugins_order', '')) {
            foreach ($mplugins_order as $k => $mplugin_order) {
                $neworder[$mplugin_order - 1] = $plugins[$k];
            }
        }
        ksort($neworder);
        //print_r($neworder);
        $results = $neworder;
        foreach ($results as $k => $result) {
            require_once JPATH_SITE . "/components/com_chronocontact/plugins/" . $result . ".php";
            ${$result} = new $result();
            ?>
                <!--<tr>
                    <td><?php 
            echo JHTML::_('tooltip', ${$result}->result_TOOLTIP);
            ?>
</td>
                    <td class="key"><?php 
            echo ${$result}->result_TITLE;
            ?>
:</td>
                    <td>
                    <input type="checkbox" onClick="enable_order('mplugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
','plugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
')" id="plugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
" name="plugins[]" <?php 
            if (in_array($result, explode(",", $paramsvalues->get('plugins')))) {
                echo "checked";
            }
            ?>
 class="inputbox" size="50" value="<?php 
            echo $result;
            ?>
">
                    </td>
                    <td><input type="text" maxlength="2" <?php 
            if (in_array($result, explode(",", $paramsvalues->get('plugins')))) {
            } else {
                ?>
disabled="true"<?php 
            }
            ?>
 size="2" name="mplugins_order[]" id="mplugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
" value="<?php 
            if (in_array($result, explode(",", $paramsvalues->get('plugins')))) {
                echo $mplugins_order[$order];
            }
            ?>
">
                    <a href="javascript:change_order1_plus('mplugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
')">[+]</a>&nbsp;
                    <a href="javascript:change_order1_minus('mplugins_order_<?php 
            echo ${$result}->result_TITLE;
            ?>
')">[-]</a>
                    </td>
                </tr>-->
                <?php 
            if (in_array($result, explode(",", $paramsvalues->get('plugins')))) {
                $plugin_state = 'disable';
                $plugin_row_color = "#00BB00";
                $plugin_enabled = "1";
            } else {
                $plugin_state = 'enable';
                $plugin_row_color = "#DD0000";
                $plugin_enabled = "0";
            }
            ?>
                <div style="background-color:<?php 
            echo $plugin_row_color;
            ?>
" class="plugins_order" title="<?php 
            echo ${$result}->result_TITLE;
            ?>
 :: <?php 
            echo ${$result}->result_TOOLTIP;
            ?>
" id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
">
                    <span class="plugins_order_text"><?php 
            echo ${$result}->result_TITLE;
            ?>
</span>
                    <input type="hidden" name="mplugins_order[]" id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
_count_value" value="" />
                    <input type="hidden" name="plugins[]" value="<?php 
            echo ${$result}->plugin_name;
            ?>
" />
                    <input type="hidden" name="plugins_enable[]" id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
_enable_value" value="<?php 
            echo $plugin_enabled;
            ?>
" />
                    <span class="plugins_order_enable" id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
_enable"><img id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
_enableimg" onclick="enablePlugin('<?php 
            echo ${$result}->plugin_name;
            ?>
')" src="<?php 
            echo JURI::Base() . 'components/com_chronocontact/images/' . $plugin_state;
            ?>
.png" width="16" height="16" alt="" /></span>
                    <span class="plugins_order_drag"><img src="<?php 
            echo JURI::Base() . 'components/com_chronocontact/images/';
            ?>
rearrange.png" width="16" height="16" alt="" /></span>
                    <span class="plugins_order_count" id="plugins_order_<?php 
            echo ${$result}->plugin_name;
            ?>
_count"></span>            
                </div>
        <?php 
            if (in_array($result, explode(",", $paramsvalues->get('plugins')))) {
                $order++;
            }
        }
        ?>
    	</ul>
        </td>
	</tr>
	</table>
    </fieldset>
	</div>
	<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('RunOrder', 'RunOrder');
        if (!$paramsvalues->get('autogenerated_order') || !$paramsvalues->get('onsubmitcode_order') || !$paramsvalues->get('plugins_order')) {
            $paramsvalues->set('autogenerated_order', 3);
            $paramsvalues->set('onsubmitcode_order', 2);
            $paramsvalues->set('plugins_order', 1);
        }
        ?>
	<div id="page-runorder">
	<fieldset class="adminform">
    <legend><?php 
        echo JText::_('RunOrder Settings');
        ?>
    <span class="error hasTip" title="<?php 
        echo JText::_('Warning');
        ?>
::<?php 
        echo JText::_('Here you can change the order the different code blocks run, valid values are 1 or 2 or 3 using other values will result in the whole block doesn\'t executed!');
        ?>
">
		<?php 
        echo HTML_ChronoContact::WarningIcon();
        ?>
    </span>
    </legend>
    <table class="admintable">
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Order of Autogenerated block");
        ?>
</td>
		<td class="key"><?php 
        echo "Order of Autogenerated block";
        ?>
</td>
		<td></td>
		<td>
		<input type="text" name="params[autogenerated_order]" id="params_autogenerated_order" class="inputbox" size="1" maxlength="1" value="<?php 
        echo $paramsvalues->get('autogenerated_order');
        ?>
">
		<a href="javascript:change_order1_plus('params_autogenerated_order')">[+]</a>&nbsp;
		<a href="javascript:change_order1_minus('params_autogenerated_order')">[-]</a>
		</td>
	</tr>	
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Order of OnSubmit block");
        ?>
</td>
		<td class="key"><?php 
        echo "Order of OnSubmit block";
        ?>
</td>
		<td></td>
		<td>
		<input type="text" name="params[onsubmitcode_order]" id="params_onsubmitcode_order" class="inputbox" size="1" maxlength="1" value="<?php 
        echo $paramsvalues->get('onsubmitcode_order');
        ?>
">
		<a href="javascript:change_order1_plus('params_onsubmitcode_order')">[+]</a>&nbsp;
		<a href="javascript:change_order1_minus('params_onsubmitcode_order')">[-]</a>
		</td>
	</tr>	
	<tr>
		<td><?php 
        echo JHTML::_('tooltip', "Order of Plugins block");
        ?>
</td>
		<td class="key"><?php 
        echo "Order of Plugins block";
        ?>
</td>
		<td></td>
		<td>
		<input type="text" name="params[plugins_order]" id="params_plugins_order" class="inputbox" size="1" maxlength="1" value="<?php 
        echo $paramsvalues->get('plugins_order');
        ?>
">
		<a href="javascript:change_order1_plus('params_plugins_order')">[+]</a>&nbsp;
		<a href="javascript:change_order1_minus('params_plugins_order')">[-]</a>
		</td>
	</tr>	
	</table>
    </fieldset>
	</div>
	
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        ?>
</div>
<!--</div>--><div class="clr"></div>
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="task" value="" />
	</form>
  <?php 
        echo JHTML::_('behavior.keepalive');
    }
Ejemplo n.º 4
0
function editElement($id, $option)
{
    $database =& JFactory::getDBO();
    $row =& JTable::getInstance('chronocontactelements', 'Table');
    $row->load($id);
    HTML_ChronoContact::editElement($row, $option);
}