<?php
/**
 * Joomla! component sexypolling
 *
 * @version $Id: edit.php 2012-04-05 14:30:25 svn $
 * @author 2GLux.com
 * @package Sexy Polling
 * @subpackage com_sexycontactform
 * @license GNU/GPL
 *
 */

// no direct access
defined('_JEXEC') or die('Restircted access');

$db = JFactory::getDBO();
$document = JFactory::getDocument();

$cssFile = JURI::base(true).'/components/com_sexycontactform/assets/css/jquery-ui-1.8.11.custom.css';
$document->addStyleSheet($cssFile, 'text/css', null, array());

$cssFile = JURI::base(true).'/components/com_sexycontactform/assets/css/options_styles.css';
$document->addStyleSheet($cssFile, 'text/css', null, array());

$jsFile = JURI::base(true).'/components/com_sexycontactform/assets/js/jquery-1.7.2.min.js';
$document->addScript($jsFile);

if(JV == 'j2') {
	$document->addScriptDeclaration ( 'jQuery.noConflict();' );
}
else {
	$document->addScriptDeclaration ( 'jQuery.noConflict();' );
}

$jsFile = JURI::base(true).'/components/com_sexycontactform/assets/js/jquery-ui-1.8.2.custom.min.js';
$document->addScript($jsFile);

$jsFile = JURI::base(true).'/components/com_sexycontactform/assets/js/options_functions.js';
$document->addScript($jsFile);
?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
	var form = document.adminForm;
	if (task == 'sexyfield.cancel') {
		submitform( task );
	}
	else {
		if (form.jform_name.value != ""){
			form.jform_name.style.border = "1px solid green";
		} 
		
		if (form.jform_name.value == ""){
			form.jform_name.style.border = "1px solid red";
			form.jform_name.focus();
		} 
		else {
			var id_type = document.getElementById("jform_id_type").value;
			if(id_type == '13' || id_type == '14')
				alert('Please Upgrade to PRO Version to use this field type.');
			else
				submitform( task );
		}
	}
}
</script>
<?php if(JV == 'j2') {//////////////////////////////////////////////////////////////////////////////////////Joomla2.x/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////?>
<form action="<?php echo JRoute::_('index.php?option=com_sexycontactform&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm">
	<?php if(($this->max_id < 5) || ($this->item->id != 0)) {?>
	<fieldset class="adminform" style="border-bottom: none !important;">
		<legend><?php echo JText::_( 'Details' ); ?></legend>
		<ul class="adminformlist">
			<?php 
			$k = 0;
			foreach($this->form->getFieldset() as $field){ 
				if($this->item->id_type== '' && $k == 6) {//add option
					break;
				}
				if(in_array($this->item->id_type,array(11,12)) && $k == 6) {//radio, checkbox,upload hide width
					$k ++;
					continue;
				}
				if(in_array($this->item->id_type,array(1,2,3,4,5,6,7,8)) && $k == 7) { //all except select, m select, radio, checkbox hide options
					break;
				}
				if(in_array($this->item->id_type,array(9,10,11,12)) && $k == 13) { //radio,checkbox, select, m elect, hide upload options
					break;
				}
				if($k == 7 && in_array($this->item->id_type,array(9,10,11,12))) {
					echo '<h3  style="float: left;margin-top: 7px;margin-bottom: 15px;clear: both;">Option parameters</h3>';
				}
				if(in_array($this->item->id_type,array(11,12)) && ($k == 9 || $k == 10 || $k == 11  || $k == 12)) { //radio, checkbox hide default text
					$k ++;
					continue;
				}
				if($this->item->id_type == 14 && in_array($k,array(6,7,8,9,10,11,12,20))) { //file upload hide select options
					$k ++;
					continue;
				}
				if($this->item->id_type == 13 && in_array($k,array(4,6,7,8,9,10,11,12,13,14,15,16,17,18,19))) { //captcha hide select options
					$k ++;
					continue;
				}
				?>
				<li><?php echo $field->label;echo $field->input;?></li>
			<?php 
			$k ++;
			}
			?>
		</ul>
			<?php } else { ?>
				<div style="color: rgb(235, 9, 9);font-size: 16px;font-weight: bold;">Please Upgrade to PRO Version to have more than 5 fields.</div>
					<div id="cpanel" style="float: left;">
					<div class="icon" style="float: right;">
					<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_LINK' ); ?>" target="_blank" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_DESCRIPTION' ); ?>">
					<table style="width: 100%;height: 100%;text-decoration: none;">
					<tr>
					<td align="center" valign="middle">
					<img src="components/com_sexycontactform/assets/images/shopping_cart.png" /><br />
											<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION' ); ?>
										</td>
									</tr>
								</table>
							</a>
						</div>
					</div>
			<?php }?>
	<div>
		<input type="hidden" name="task" value="sexyfield.add" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</fieldset>
</form>
	
	<?php 
//options
if(in_array($this->item->id_type,array(9,10,11,12))) {
echo '<div style="border-top: none !important;margin: -11px 9px 0 10px;padding-left: 5px;border: 1px #ccc solid;">';
	if(isset($_GET['load_countries'])) {
		$query = "
		SELECT
		spo.name,
		spo.id,
		spo.ordering,
		spo.showrow
		FROM
		`#__sexy_form_options` spo
		WHERE spo.id_parent = '".$this->item->id."'";
		$db->setQuery($query);
		$childs_array_current = $db->loadAssocList();
		
		if (sizeof($childs_array_current) == 0) {
			$query = 
					"
						INSERT INTO `#__sexy_form_options` (`id`, `id_parent`, `name`, `value`, `ordering`, `showrow`, `selected`) VALUES 
							(NULL, '".$this->item->id."', 'Afghanistan', 'Afghanistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Albania', 'Albania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Algeria', 'Algeria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'American Samoa', 'American Samoa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Andorra', 'Andorra', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Angola', 'Angola', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Anguilla', 'Anguilla', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Antarctica', 'Antarctica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Antigua and Barbuda', 'Antigua and Barbuda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Argentina', 'Argentina', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Armenia', 'Armenia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Aruba', 'Aruba', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Australia', 'Australia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Austria', 'Austria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Azerbaijan', 'Azerbaijan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bahamas', 'Bahamas', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bahrain', 'Bahrain', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bangladesh', 'Bangladesh', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Barbados', 'Barbados', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belarus', 'Belarus', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belgium', 'Belgium', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belize', 'Belize', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Benin', 'Benin', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bermuda', 'Bermuda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bhutan', 'Bhutan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bolivia', 'Bolivia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bosnia and Herzegowina', 'Bosnia and Herzegowina', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Botswana', 'Botswana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bouvet Island', 'Bouvet Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Brazil', 'Brazil', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'British Indian Ocean Territory', 'British Indian Ocean Territory', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Brunei Darussalam', 'Brunei Darussalam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bulgaria', 'Bulgaria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Burkina Faso', 'Burkina Faso', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Burundi', 'Burundi', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cambodia', 'Cambodia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cameroon', 'Cameroon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Canada', 'Canada', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cape Verde', 'Cape Verde', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cayman Islands', 'Cayman Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Central African Republic', 'Central African Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Chad', 'Chad', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Chile', 'Chile', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'China', 'China', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Christmas Island', 'Christmas Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cocos (Keeling) Islands', 'Cocos (Keeling) Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Colombia', 'Colombia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Comoros', 'Comoros', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Congo', 'Congo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cook Islands', 'Cook Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Costa Rica', 'Costa Rica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cote D\'Ivoire', 'Cote DIvoire', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Croatia', 'Croatia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cuba', 'Cuba', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cyprus', 'Cyprus', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Czech Republic', 'Czech Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Democratic Republic of Congo', 'Democratic Republic of Congo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Denmark', 'Denmark', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Djibouti', 'Djibouti', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Dominica', 'Dominica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Dominican Republic', 'Dominican Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'East Timor', 'East Timor', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ecuador', 'Ecuador', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Egypt', 'Egypt', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'El Salvador', 'El Salvador', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Equatorial Guinea', 'Equatorial Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Eritrea', 'Eritrea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Estonia', 'Estonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ethiopia', 'Ethiopia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Falkland Islands (Malvinas)', 'Falkland Islands (Malvinas)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Faroe Islands', 'Faroe Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Fiji', 'Fiji', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Finland', 'Finland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'France', 'France', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'France, Metropolitan', 'France, Metropolitan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Guiana', 'French Guiana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Polynesia', 'French Polynesia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Southern Territories', 'French Southern Territories', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gabon', 'Gabon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gambia', 'Gambia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Georgia', 'Georgia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Germany', 'Germany', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ghana', 'Ghana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gibraltar', 'Gibraltar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Greece', 'Greece', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Greenland', 'Greenland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Grenada', 'Grenada', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guadeloupe', 'Guadeloupe', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guam', 'Guam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guatemala', 'Guatemala', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guinea', 'Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guinea-bissau', 'Guinea-bissau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guyana', 'Guyana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Haiti', 'Haiti', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Heard and Mc Donald Islands', 'Heard and Mc Donald Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Honduras', 'Honduras', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Hong Kong', 'Hong Kong', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Hungary', 'Hungary', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iceland', 'Iceland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'India', 'India', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Indonesia', 'Indonesia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iran (Islamic Republic of)', 'Iran (Islamic Republic of)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iraq', 'Iraq', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ireland', 'Ireland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Israel', 'Israel', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Italy', 'Italy', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Jamaica', 'Jamaica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Japan', 'Japan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Jordan', 'Jordan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kazakhstan', 'Kazakhstan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kenya', 'Kenya', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kiribati', 'Kiribati', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Korea, Republic of', 'Korea, Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kuwait', 'Kuwait', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kyrgyzstan', 'Kyrgyzstan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lao People\'s Democratic Republic', 'Lao Peoples Democratic Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Latvia', 'Latvia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lebanon', 'Lebanon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lesotho', 'Lesotho', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Liberia', 'Liberia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Libyan Arab Jamahiriya', 'Libyan Arab Jamahiriya', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Liechtenstein', 'Liechtenstein', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lithuania', 'Lithuania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Luxembourg', 'Luxembourg', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Macau', 'Macau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Macedonia', 'Macedonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Madagascar', 'Madagascar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malawi', 'Malawi', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malaysia', 'Malaysia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Maldives', 'Maldives', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mali', 'Mali', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malta', 'Malta', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Marshall Islands', 'Marshall Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Martinique', 'Martinique', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mauritania', 'Mauritania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mauritius', 'Mauritius', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mayotte', 'Mayotte', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mexico', 'Mexico', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Micronesia, Federated States of', 'Micronesia, Federated States of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Moldova, Republic of', 'Moldova, Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Monaco', 'Monaco', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mongolia', 'Mongolia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Montserrat', 'Montserrat', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Morocco', 'Morocco', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mozambique', 'Mozambique', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Myanmar', 'Myanmar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Namibia', 'Namibia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nauru', 'Nauru', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nepal', 'Nepal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Netherlands', 'Netherlands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Netherlands Antilles', 'Netherlands Antilles', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'New Caledonia', 'New Caledonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'New Zealand', 'New Zealand', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nicaragua', 'Nicaragua', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Niger', 'Niger', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nigeria', 'Nigeria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Niue', 'Niue', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Norfolk Island', 'Norfolk Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'North Korea', 'North Korea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Northern Mariana Islands', 'Northern Mariana Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Norway', 'Norway', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Oman', 'Oman', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Pakistan', 'Pakistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Palau', 'Palau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Panama', 'Panama', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Papua New Guinea', 'Papua New Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Paraguay', 'Paraguay', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Peru', 'Peru', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Philippines', 'Philippines', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Pitcairn', 'Pitcairn', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Poland', 'Poland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Portugal', 'Portugal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Puerto Rico', 'Puerto Rico', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Qatar', 'Qatar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Reunion', 'Reunion', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Romania', 'Romania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Russian Federation', 'Russian Federation', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Rwanda', 'Rwanda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Kitts and Nevis', 'Saint Kitts and Nevis', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Lucia', 'Saint Lucia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Vincent and the Grenadines', 'Saint Vincent and the Grenadines', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Samoa', 'Samoa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'San Marino', 'San Marino', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sao Tome and Principe', 'Sao Tome and Principe', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saudi Arabia', 'Saudi Arabia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Senegal', 'Senegal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Seychelles', 'Seychelles', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sierra Leone', 'Sierra Leone', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Singapore', 'Singapore', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Slovak Republic', 'Slovak Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Slovenia', 'Slovenia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Solomon Islands', 'Solomon Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Somalia', 'Somalia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'South Africa', 'South Africa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'South Georgia &amp; South Sandwich Islands', 'South Georgia & South Sandwich Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Spain', 'Spain', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sri Lanka', 'Sri Lanka', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'St. Helena', 'St. Helena', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'St. Pierre and Miquelon', 'St. Pierre and Miquelon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sudan', 'Sudan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Suriname', 'Suriname', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Svalbard and Jan Mayen Islands', 'Svalbard and Jan Mayen Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Swaziland', 'Swaziland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sweden', 'Sweden', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Switzerland', 'Switzerland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Syrian Arab Republic', 'Syrian Arab Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Taiwan', 'Taiwan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tajikistan', 'Tajikistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tanzania, United Republic of', 'Tanzania, United Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Thailand', 'Thailand', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Togo', 'Togo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tokelau', 'Tokelau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tonga', 'Tonga', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Trinidad and Tobago', 'Trinidad and Tobago', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tunisia', 'Tunisia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turkey', 'Turkey', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turkmenistan', 'Turkmenistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turks and Caicos Islands', 'Turks and Caicos Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tuvalu', 'Tuvalu', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uganda', 'Uganda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ukraine', 'Ukraine', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United Arab Emirates', 'United Arab Emirates', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United Kingdom', 'United Kingdom', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United States', 'United States', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United States Minor Outlying Islands', 'United States Minor Outlying Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uruguay', 'Uruguay', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uzbekistan', 'Uzbekistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Vanuatu', 'Vanuatu', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Vatican City State (Holy See)', 'Vatican City State (Holy See)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Venezuela', 'Venezuela', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Viet Nam', 'Viet Nam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Virgin Islands (British)', 'Virgin Islands (British)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Virgin Islands (U.S.)', 'Virgin Islands (U.S.)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Wallis and Futuna Islands', 'Wallis and Futuna Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Western Sahara', 'Western Sahara', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Yemen', 'Yemen', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Yugoslavia', 'Yugoslavia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Zambia', 'Zambia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Zimbabwe', 'Zimbabwe', '0', '1', '0')
					";
			$db->setQuery($query);
			$db->query();
		}
			
	}
	$query = "
				SELECT
					spo.name,
					spo.id,
					spo.ordering,
					spo.showrow
				FROM
					`#__sexy_form_options` spo
				WHERE spo.id_parent = '".$this->item->id."'
				ORDER BY ";
	if($this->item->ordering_field == 0)
		$query .= "spo.ordering";
	else
		$query .= "spo.name";
	$db->setQuery($query);
	$childs_array = $db->loadAssocList();
	
	echo '<H3 style="margin-top: 0px;">Options</H3>';
	
	echo '<div class="options_wrapper">';
	
		echo '<div class="menus_header">';
			echo  '<img src="components/com_sexycontactform/assets/images/new_page.gif" class="new_submenu_img" title="New Option" menu_id="'.$this->item->id.'" />';
			if (sizeof($childs_array) == 0) {
				echo  '<img src="components/com_sexycontactform/assets/images/country.png" class="load_countries_data" title="Load countries data? (239 countries)" />';
			}
		echo '</div>';
		
		$disabled_ordering = $this->item->ordering_field == 1 ? 'disabledordering' : '';

		
		
		
		echo '<div class="menu_tree">';
		echo '<ul id="sortable_menu">';
		if (sizeof($childs_array) > 0)
		{
			foreach ($childs_array as $key => $value)
			{
				$show = $value['showrow'];
				$class = " ui-state-default text";
				$show_class = $show == 1 ? 'hide' : 'show';
				$show_title = $show == 0 ? 'Publish option' : 'Unpublish option';
				
				echo '<li class="'.$class.'" id="option_li_'.$value["id"].'">';
					echo '<div class="option_item" id="option_'.$value["id"].'">'.$value["name"].'</div>';
					echo '<div class="menu_moove '.$disabled_ordering.'" title="Move option" >&nbsp;</div>';
					echo '<div id="edit_'.$value["id"].'" menu_id="'.$value["id"].'" class="edit" title="Edit option" >&nbsp;</div>';
					echo '<div id="showrow_'.$value["id"].'" menu_id="'.$value["id"].'" class="'.$show_class.'" title="'.$show_title.'" >&nbsp;</div>';
					echo '<div id="remove_'.$value["id"].'" menu_id="'.$value["id"].'" class="delete" title="Delete option" >&nbsp;</div>';
				echo '</li>';
			}
		}
		echo '</div>';
		echo '</ul>';
	echo '</div>';
echo '</div>';
}
?>
<div id="edit_menu_data" style="display: none;">
	<div id="ajax_loader">&nbsp;</div>
	<div id="dialog_inner_wrapper"></div>
	<input type="hidden" value="" id="menu_id" />
</div>
	
	
	
	
	
<table class="adminlist" style="width: 100%;margin-top: 12px;clear: both;"><tr><td align="center" valign="middle" id="twoglux_ext_td" style="position: relative;">
	<div id="twoglux_bottom_link"><a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_LINK' ); ?>" target="_blank"><?php echo JText::_( 'COM_SEXYCONTACTFORM' ); ?></a> <?php echo JText::_( 'COM_SEXYCONTACTFORM_DEVELOPED_BY' ); ?> <a href="http://2glux.com" target="_blank">2GLux.com</a></div>
	<div style="position: absolute;right: 2px;top: 7px;">
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_RATE_US_LINK' ); ?>" target="_blank" id="twoglux_ext_rate" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_RATE_US_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_LINK' ); ?>" target="_blank" id="twoglux_ext_homepage" style="margin: 0 2px 0 0px;" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_SUPPORT_FORUM_LINK' ); ?>" target="_blank" id="twoglux_ext_support" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_SUPPORT_FORUM_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_LINK' ); ?>" target="_blank" id="twoglux_ext_buy" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_DESCRIPTION' ); ?>">&nbsp;</a>
	</div>
</td></tr></table>
<?php }elseif(JV == 'j3') {//////////////////////////////////////////////////////////////////////////////////////Joomla3.x/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////?>
<?php 
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
?>
<form action="<?php echo JRoute::_('index.php?option=com_sexycontactform&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate form-horizontal">
	<div class="row-fluid">
		<!-- Begin Newsfeed -->
		<div class="span10 form-horizontal">
			<?php if(($this->max_id < 5) || ($this->item->id != 0)) {?>
			<fieldset>
				<div class="tab-content">
					<div class="tab-pane active" id="details">
						<div class="control-group">
							<?php 
							$k = 0;
							foreach($this->form->getFieldset() as $field) {
								if($this->item->id_type== '' && $k == 6) {//add option
									break;	
								}
								if(in_array($this->item->id_type,array(11,12)) && $k == 6) {//radio, checkbox,upload hide width
									$k ++;
									continue;
								}
								if(in_array($this->item->id_type,array(1,2,3,4,5,6,7,8)) && $k == 7) { //all except select, m select, radio, checkbox hide options
										break;
								}
								if(in_array($this->item->id_type,array(9,10,11,12)) && $k == 13) { //radio,checkbox, select, m elect, hide upload options
									break;
								}
								if($k == 7 && in_array($this->item->id_type,array(9,10,11,12))) {
									echo '<h3 style="margin-bottom: 15px;">Option parameters</h3>';
								}
								if(in_array($this->item->id_type,array(11,12)) && ($k == 9 || $k == 10 || $k == 11  || $k == 12)) { //radio, checkbox hide default text
									$k ++;
									continue;	
								}
								if($this->item->id_type == 14 && in_array($k,array(6,7,8,9,10,11,12,20))) { //file upload hide select options
									$k ++;
									continue;	
								}
								if($this->item->id_type == 13 && in_array($k,array(4,6,7,8,9,10,11,12,13,14,15,16,17,18,19))) { //captcha hide select options
									$k ++;
									continue;	
								}
								?>
								<div class="control-label"><?php echo $field->label;?></div>
								<div class="controls"><?php echo $field->input;?></div>
								<div style="clear: both;height: 8px;">&nbsp;</div>
								<?php 
								 $k ++;
							} ?>
							<?php 
								
							?>
						</div>
					</div>
				</div>
			</fieldset>
			<?php } else { ?>
				<div style="color: rgb(235, 9, 9);font-size: 16px;font-weight: bold;">Please Upgrade to PRO Version to have more than 5 fields.</div>
					<div id="cpanel" style="float: left;">
					<div class="icon" style="float: right;">
					<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_LINK' ); ?>" target="_blank" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_DESCRIPTION' ); ?>">
					<table style="width: 100%;height: 100%;text-decoration: none;">
					<tr>
					<td align="center" valign="middle">
					<img src="components/com_sexycontactform/assets/images/shopping_cart.png" /><br />
											<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION' ); ?>
										</td>
									</tr>
								</table>
							</a>
						</div>
					</div>
			<?php }?>
		</div>
	</div>
<input type="hidden" name="task" value="sexyfield.add" />
<?php echo JHtml::_('form.token'); ?>
</form>
<?php 
//options
if(in_array($this->item->id_type,array(9,10,11,12))) {
	if(isset($_GET['load_countries'])) {
		$query = "
		SELECT
		spo.name,
		spo.id,
		spo.ordering,
		spo.showrow
		FROM
		`#__sexy_form_options` spo
		WHERE spo.id_parent = '".$this->item->id."'";
		$db->setQuery($query);
		$childs_array_current = $db->loadAssocList();
		
		if (sizeof($childs_array_current) == 0) {
			$query = 
					"
						INSERT INTO `#__sexy_form_options` (`id`, `id_parent`, `name`, `value`, `ordering`, `showrow`, `selected`) VALUES 
							(NULL, '".$this->item->id."', 'Afghanistan', 'Afghanistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Albania', 'Albania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Algeria', 'Algeria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'American Samoa', 'American Samoa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Andorra', 'Andorra', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Angola', 'Angola', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Anguilla', 'Anguilla', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Antarctica', 'Antarctica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Antigua and Barbuda', 'Antigua and Barbuda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Argentina', 'Argentina', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Armenia', 'Armenia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Aruba', 'Aruba', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Australia', 'Australia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Austria', 'Austria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Azerbaijan', 'Azerbaijan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bahamas', 'Bahamas', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bahrain', 'Bahrain', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bangladesh', 'Bangladesh', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Barbados', 'Barbados', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belarus', 'Belarus', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belgium', 'Belgium', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Belize', 'Belize', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Benin', 'Benin', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bermuda', 'Bermuda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bhutan', 'Bhutan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bolivia', 'Bolivia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bosnia and Herzegowina', 'Bosnia and Herzegowina', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Botswana', 'Botswana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bouvet Island', 'Bouvet Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Brazil', 'Brazil', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'British Indian Ocean Territory', 'British Indian Ocean Territory', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Brunei Darussalam', 'Brunei Darussalam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Bulgaria', 'Bulgaria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Burkina Faso', 'Burkina Faso', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Burundi', 'Burundi', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cambodia', 'Cambodia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cameroon', 'Cameroon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Canada', 'Canada', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cape Verde', 'Cape Verde', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cayman Islands', 'Cayman Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Central African Republic', 'Central African Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Chad', 'Chad', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Chile', 'Chile', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'China', 'China', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Christmas Island', 'Christmas Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cocos (Keeling) Islands', 'Cocos (Keeling) Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Colombia', 'Colombia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Comoros', 'Comoros', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Congo', 'Congo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cook Islands', 'Cook Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Costa Rica', 'Costa Rica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cote D\'Ivoire', 'Cote DIvoire', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Croatia', 'Croatia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cuba', 'Cuba', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Cyprus', 'Cyprus', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Czech Republic', 'Czech Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Democratic Republic of Congo', 'Democratic Republic of Congo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Denmark', 'Denmark', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Djibouti', 'Djibouti', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Dominica', 'Dominica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Dominican Republic', 'Dominican Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'East Timor', 'East Timor', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ecuador', 'Ecuador', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Egypt', 'Egypt', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'El Salvador', 'El Salvador', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Equatorial Guinea', 'Equatorial Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Eritrea', 'Eritrea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Estonia', 'Estonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ethiopia', 'Ethiopia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Falkland Islands (Malvinas)', 'Falkland Islands (Malvinas)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Faroe Islands', 'Faroe Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Fiji', 'Fiji', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Finland', 'Finland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'France', 'France', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'France, Metropolitan', 'France, Metropolitan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Guiana', 'French Guiana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Polynesia', 'French Polynesia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'French Southern Territories', 'French Southern Territories', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gabon', 'Gabon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gambia', 'Gambia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Georgia', 'Georgia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Germany', 'Germany', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ghana', 'Ghana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Gibraltar', 'Gibraltar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Greece', 'Greece', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Greenland', 'Greenland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Grenada', 'Grenada', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guadeloupe', 'Guadeloupe', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guam', 'Guam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guatemala', 'Guatemala', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guinea', 'Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guinea-bissau', 'Guinea-bissau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Guyana', 'Guyana', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Haiti', 'Haiti', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Heard and Mc Donald Islands', 'Heard and Mc Donald Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Honduras', 'Honduras', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Hong Kong', 'Hong Kong', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Hungary', 'Hungary', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iceland', 'Iceland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'India', 'India', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Indonesia', 'Indonesia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iran (Islamic Republic of)', 'Iran (Islamic Republic of)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Iraq', 'Iraq', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ireland', 'Ireland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Israel', 'Israel', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Italy', 'Italy', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Jamaica', 'Jamaica', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Japan', 'Japan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Jordan', 'Jordan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kazakhstan', 'Kazakhstan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kenya', 'Kenya', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kiribati', 'Kiribati', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Korea, Republic of', 'Korea, Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kuwait', 'Kuwait', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Kyrgyzstan', 'Kyrgyzstan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lao People\'s Democratic Republic', 'Lao Peoples Democratic Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Latvia', 'Latvia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lebanon', 'Lebanon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lesotho', 'Lesotho', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Liberia', 'Liberia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Libyan Arab Jamahiriya', 'Libyan Arab Jamahiriya', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Liechtenstein', 'Liechtenstein', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Lithuania', 'Lithuania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Luxembourg', 'Luxembourg', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Macau', 'Macau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Macedonia', 'Macedonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Madagascar', 'Madagascar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malawi', 'Malawi', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malaysia', 'Malaysia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Maldives', 'Maldives', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mali', 'Mali', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Malta', 'Malta', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Marshall Islands', 'Marshall Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Martinique', 'Martinique', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mauritania', 'Mauritania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mauritius', 'Mauritius', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mayotte', 'Mayotte', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mexico', 'Mexico', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Micronesia, Federated States of', 'Micronesia, Federated States of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Moldova, Republic of', 'Moldova, Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Monaco', 'Monaco', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mongolia', 'Mongolia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Montserrat', 'Montserrat', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Morocco', 'Morocco', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Mozambique', 'Mozambique', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Myanmar', 'Myanmar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Namibia', 'Namibia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nauru', 'Nauru', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nepal', 'Nepal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Netherlands', 'Netherlands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Netherlands Antilles', 'Netherlands Antilles', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'New Caledonia', 'New Caledonia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'New Zealand', 'New Zealand', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nicaragua', 'Nicaragua', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Niger', 'Niger', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Nigeria', 'Nigeria', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Niue', 'Niue', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Norfolk Island', 'Norfolk Island', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'North Korea', 'North Korea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Northern Mariana Islands', 'Northern Mariana Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Norway', 'Norway', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Oman', 'Oman', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Pakistan', 'Pakistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Palau', 'Palau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Panama', 'Panama', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Papua New Guinea', 'Papua New Guinea', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Paraguay', 'Paraguay', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Peru', 'Peru', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Philippines', 'Philippines', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Pitcairn', 'Pitcairn', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Poland', 'Poland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Portugal', 'Portugal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Puerto Rico', 'Puerto Rico', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Qatar', 'Qatar', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Reunion', 'Reunion', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Romania', 'Romania', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Russian Federation', 'Russian Federation', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Rwanda', 'Rwanda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Kitts and Nevis', 'Saint Kitts and Nevis', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Lucia', 'Saint Lucia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saint Vincent and the Grenadines', 'Saint Vincent and the Grenadines', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Samoa', 'Samoa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'San Marino', 'San Marino', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sao Tome and Principe', 'Sao Tome and Principe', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Saudi Arabia', 'Saudi Arabia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Senegal', 'Senegal', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Seychelles', 'Seychelles', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sierra Leone', 'Sierra Leone', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Singapore', 'Singapore', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Slovak Republic', 'Slovak Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Slovenia', 'Slovenia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Solomon Islands', 'Solomon Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Somalia', 'Somalia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'South Africa', 'South Africa', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'South Georgia &amp; South Sandwich Islands', 'South Georgia & South Sandwich Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Spain', 'Spain', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sri Lanka', 'Sri Lanka', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'St. Helena', 'St. Helena', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'St. Pierre and Miquelon', 'St. Pierre and Miquelon', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sudan', 'Sudan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Suriname', 'Suriname', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Svalbard and Jan Mayen Islands', 'Svalbard and Jan Mayen Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Swaziland', 'Swaziland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Sweden', 'Sweden', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Switzerland', 'Switzerland', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Syrian Arab Republic', 'Syrian Arab Republic', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Taiwan', 'Taiwan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tajikistan', 'Tajikistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tanzania, United Republic of', 'Tanzania, United Republic of', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Thailand', 'Thailand', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Togo', 'Togo', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tokelau', 'Tokelau', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tonga', 'Tonga', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Trinidad and Tobago', 'Trinidad and Tobago', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tunisia', 'Tunisia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turkey', 'Turkey', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turkmenistan', 'Turkmenistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Turks and Caicos Islands', 'Turks and Caicos Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Tuvalu', 'Tuvalu', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uganda', 'Uganda', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Ukraine', 'Ukraine', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United Arab Emirates', 'United Arab Emirates', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United Kingdom', 'United Kingdom', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United States', 'United States', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'United States Minor Outlying Islands', 'United States Minor Outlying Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uruguay', 'Uruguay', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Uzbekistan', 'Uzbekistan', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Vanuatu', 'Vanuatu', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Vatican City State (Holy See)', 'Vatican City State (Holy See)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Venezuela', 'Venezuela', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Viet Nam', 'Viet Nam', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Virgin Islands (British)', 'Virgin Islands (British)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Virgin Islands (U.S.)', 'Virgin Islands (U.S.)', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Wallis and Futuna Islands', 'Wallis and Futuna Islands', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Western Sahara', 'Western Sahara', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Yemen', 'Yemen', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Yugoslavia', 'Yugoslavia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Zambia', 'Zambia', '0', '1', '0'),
			                (NULL, '".$this->item->id."', 'Zimbabwe', 'Zimbabwe', '0', '1', '0')
					";
			$db->setQuery($query);
			$db->query();
		}
			
	}
	$query = "
				SELECT
					spo.name,
					spo.id,
					spo.ordering,
					spo.showrow
				FROM
					`#__sexy_form_options` spo
				WHERE spo.id_parent = '".$this->item->id."'
				ORDER BY ";
	if($this->item->ordering_field == 0)
		$query .= "spo.ordering";
	else
		$query .= "spo.name";
	$db->setQuery($query);
	$childs_array = $db->loadAssocList();
	
	echo '<H3 style="margin-top: -30px;">Options</H3>';
	
	echo '<div class="options_wrapper">';
	
		echo '<div class="menus_header">';
			echo  '<img src="components/com_sexycontactform/assets/images/new_page.gif" class="new_submenu_img" title="New Option" menu_id="'.$this->item->id.'" />';
			if (sizeof($childs_array) == 0) {
				echo  '<img src="components/com_sexycontactform/assets/images/country.png" class="load_countries_data" title="Load countries data? (239 countries)" />';
			}
		echo '</div>';
		
		$disabled_ordering = $this->item->ordering_field == 1 ? 'disabledordering' : '';

		
		
		
		echo '<div class="menu_tree">';
		echo '<ul id="sortable_menu">';
		if (sizeof($childs_array) > 0)
		{
			foreach ($childs_array as $key => $value)
			{
				$show = $value['showrow'];
				$class = " ui-state-default text";
				$show_class = $show == 1 ? 'hide' : 'show';
				$show_title = $show == 0 ? 'Publish option' : 'Unpublish option';
				
				echo '<li class="'.$class.'" id="option_li_'.$value["id"].'">';
					echo '<div class="option_item" id="option_'.$value["id"].'">'.$value["name"].'</div>';
					echo '<div class="menu_moove '.$disabled_ordering.'" title="Move option" >&nbsp;</div>';
					echo '<div id="edit_'.$value["id"].'" menu_id="'.$value["id"].'" class="edit" title="Edit option" >&nbsp;</div>';
					echo '<div id="showrow_'.$value["id"].'" menu_id="'.$value["id"].'" class="'.$show_class.'" title="'.$show_title.'" >&nbsp;</div>';
					echo '<div id="remove_'.$value["id"].'" menu_id="'.$value["id"].'" class="delete" title="Delete option" >&nbsp;</div>';
				echo '</li>';
			}
		}
		echo '</div>';
		echo '</ul>';
	echo '</div>';
}


//select id = 9
if($this->item->id_type == 9) {
	
}



?>
<div id="edit_menu_data" style="display: none;">
	<div id="ajax_loader">&nbsp;</div>
	<div id="dialog_inner_wrapper"></div>
	<input type="hidden" value="" id="menu_id" />
</div>




<table class="adminlist" style="width: 100%;margin-top: 12px;clear: both;"><tr><td align="center" valign="middle" id="twoglux_ext_td" style="position: relative;">
	<div id="twoglux_bottom_link"><a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_LINK' ); ?>" target="_blank"><?php echo JText::_( 'COM_SEXYCONTACTFORM' ); ?></a> <?php echo JText::_( 'COM_SEXYCONTACTFORM_DEVELOPED_BY' ); ?> <a href="http://2glux.com" target="_blank">2GLux.com</a></div>
	<div style="position: absolute;right: 2px;top: 7px;">
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_RATE_US_LINK' ); ?>" target="_blank" id="twoglux_ext_rate" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_RATE_US_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_LINK' ); ?>" target="_blank" id="twoglux_ext_homepage" style="margin: 0 2px 0 0px;" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_PROJECT_HOMEPAGE_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_SUPPORT_FORUM_LINK' ); ?>" target="_blank" id="twoglux_ext_support" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_SUPPORT_FORUM_DESCRIPTION' ); ?>">&nbsp;</a>
		<a href="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_LINK' ); ?>" target="_blank" id="twoglux_ext_buy" class="twoglux_ext_bottom_icon" title="<?php echo JText::_( 'COM_SEXYCONTACTFORM_SUBMENU_BUY_PRO_VERSION_DESCRIPTION' ); ?>">&nbsp;</a>
	</div>
</td></tr></table>
<?php }?>

<style>
.ui-widget-overlay {
background: black url(components/com_sexycontactform/assets/images/ui/noise_pattern.jpg) 50% 50% repeat ;
opacity: .80;
filter: Alpha(Opacity=80);
</style>
