<?php

defined ( '_JEXEC' ) or die ( 'Restricted access' );
/*
 * @component Calc Builder 
 * @copyright Copyright (C) January 2017. 
 * @license GPL 3.0 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details. 
 * See <http://www.gnu.org/licenses/>. 
 * More info www.moonsoft.es 
 * gestion@moonsoft.es
 */
JHtml::_ ( 'behavior.framework' );
JHTML::_ ( 'behavior.formvalidation' );
JHTML::_ ( 'behavior.calendar' );
$pathImagen = JURI::base () . 'components/com_calcbuilder/assets/img/';
$pathImagenCalendar = JURI::base () . 'templates/bluestork/images/system/calendar.png';
include JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'mailchimp.php'; // Mailchimp
$document = JFactory::getDocument ();
JHTML::script ( 'mootools_wrapper.js', JURI::base () . 'components/com_calcbuilder/assets/js/', true );
$css = $this->__getCSS ();
foreach ( $css as $style ) {
	$document->addStyleSheet ( $style );
}
$js = $this->__getJS ();
$js [] = JURI::base () . 'components/com_calcbuilder/assets/js/edit.js';
$js [] = JURI::base () . 'components/com_calcbuilder/assets/js/codeEdit.js';
$js [] = JURI::base () . 'components/com_calcbuilder/assets/js/jquery.csv-0.71.min.js';
$js [] = JURI::base () . 'components/com_calcbuilder/assets/js/edit_area_full.js';
foreach ( $js as $jscript ) {
	?><script src="<?php echo $jscript;?>"></script><?php
}
?>
<script type="text/javascript">
<!--
function getLangTrads(text){
	switch(text){
		case 'INCORRECT_VALUES' : return '<?php echo JText::_('INCORRECT_VALUES')?>';
		case 'ADD_SQL_STRING_VALUES' : return '<?php echo JText::_('ADD_SQL_STRING_VALUES')?>';
		case 'SQL_STRING_VALUE_DELETED' : return '<?php echo JText::_('SQL_STRING_VALUE_DELETED')?>';
		case 'ADD_SQL_STRING' : return '<?php echo JText::_('ADD_SQL_STRING')?>';
		case 'ADD_VALUES' : return '<?php echo JText::_('ADD_VALUES')?>';
		case 'NAME' : return '<?php echo JText::_('NAME')?>';
		case 'VALUE' : return '<?php echo JText::_('VALUE')?>';
		case 'INCORRECT_VALUES' : return '<?php echo JText::_('INCORRECT_VALUES')?>';
		case 'SELECT' : return '<?php echo JText::_('SELECT')?>';
		case 'NUMBER' : return '<?php echo JText::_('NUMBER')?>';
		case 'DATE' : return '<?php echo JText::_('DATE')?>';
		case 'OPTION_LIST' : return '<?php echo JText::_('OPTION_LIST')?>';		
		case 'LINKED_LIST' : return '<?php echo JText::_('LINKED_LIST')?>';
		case 'MULTIPLE_OPTION_LIST' : return '<?php echo JText::_('MULTIPLE_OPTION_LIST')?>';
		case 'YES_NO' : return '<?php echo JText::_('YES_NO')?>';
		case 'TEXT' : return '<?php echo JText::_('TEXT')?>';
		case 'TEXTAREA' : return '<?php echo JText::_('TEXTAREA')?>';
		case 'CAPTCHA' : return '<?php echo JText::_('CAPTCHA')?>';
		case 'AUTOCOMPLETER' : return '<?php echo JText::_('AUTOCOMPLETER')?>';
		case 'FILE' : return '<?php echo JText::_('FILE')?>';
		case 'SECTION_NAME' : return '<?php echo JText::_('SECTION_NAME')?>';
		case 'SECTION_ADD' : return '<?php echo JText::_('SECTION_ADD')?>';
		case 'NO' : return '<?php echo JText::_('NO')?>';
		case 'YES' : return '<?php echo JText::_('YES')?>';
		case 'DEFAULT_SECTIONS' : return '<?php echo JText::_('DEFAULT_SECTIONS')?>';
		case 'LIMIT_SECTIONS' : return '<?php echo JText::_('LIMIT_SECTIONS')?>';
		case 'FIELDS' : return '<?php echo JText::_('FIELDS')?>';
		case 'NEW' : return '<?php echo JText::_('NEW')?>';
		case 'ERROR_SQL' : return '<?php echo JText::_('ERROR_SQL')?>';
		case 'CODE_HELPER_VARIABLES' : return '<?php echo JText::_('CODE_HELPER_VARIABLES')?>';
		case 'CODE_HELPER_VARIABLES_IN_CODE' : return '<?php echo JText::_('CODE_HELPER_VARIABLES_IN_CODE')?>';				
	}
}
function saveEditors(){
	<?php
	$editor_preform = JFactory::getEditor ();
	echo $editor_preform->save ( 'preformhtml' );
	?>
	var content=<?php echo $editor_preform->getContent('preformhtml'); ?>
	jQuery('#preformhtml').val(content);
	<?php
			$editor_precalc = JFactory::getEditor ();
			echo $editor_precalc->save ( 'precalcprint' );
			?>
	content=<?php echo $editor_precalc->getContent('precalcprint'); ?>
	jQuery('#precalcprint').val(content);
	<?php
			$editor_poscalc = JFactory::getEditor ();
			echo $editor_poscalc->save ( 'poscalcprint' );
			?>
	content=<?php echo $editor_poscalc->getContent('poscalcprint'); ?>
	jQuery('#poscalcprint').val(content);	
	<?php
			$editor_precalcpdf = JFactory::getEditor ();
			echo $editor_precalcpdf->save ( 'precalcprintpdf' );
			?>
	content=<?php echo $editor_precalcpdf->getContent('precalcprintpdf'); ?>
	jQuery('#precalcprintpdf').val(content);
	<?php
			$editor_poscalcpdf = JFactory::getEditor ();
			echo $editor_poscalcpdf->save ( 'poscalcprintpdf' );
			?>
	content=<?php echo $editor_poscalcpdf->getContent('poscalcprintpdf'); ?>
	jQuery('#poscalcprintpdf').val(content);
}
//-->
</script>
<input type="hidden" id="csrf"
	value="<?php echo JSession::getFormToken();?>"></input>
<div class="cb_table_wrapper">
	<form action="index.php" method="post" name="vm_categories"
		id="vm_categories">
		<input type="hidden" name="option" value="com_calcbuilder" /> <input
			type="hidden" name="task" value="vm_getProducts" /> <input
			type="hidden" name="boxchecked" value="0" /> <input type="hidden"
			name="controller" value="helper" /> <input type="hidden"
			name="format" value="raw" /> <input type="hidden" name="check"
			value="post" />
<?php echo JHtml::_( 'form.token' ); ?>
<input type="hidden" name="idcategory" id="idcategory" value="" />
	</form>
	<div id="vm_result" style="display: none"></div>
	<ul class="nav nav-tabs" id="navmenu">
		<li><a data-toggle="tab" style="height: 26px;" href="#general"><i
				class="igeneral pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_GENERAL' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#fields"><i
				class="ifields pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_FIELDS' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#code"><i
				class="icode pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_CODE' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#sections"><i
				class="isections pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_SECTIONS' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#layout"><i
				class="ipreferences pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_LAYOUT_PREFERENCES_FORMATS' ); ?></div></a>
		</li>
		<!--SHPInit1-->
		<li>  		
    	<a data-toggle="tab" style="height: 26px;" href="#vm"><i class="ivm pull-left">&nbsp;</i><div class="cb_editmenu_item"><?php echo JText::_( 'SM_VIRTUEMART' ); ?></div></a>			
    	</li>
    	<!--SHPEnd1-->
		<li><a data-toggle="tab" style="height: 26px;" href="#print"><i
				class="iprint pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_PRINT_PREFERENCES_FORMATS' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#events"><i
				class="ijs pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_JAVASCRIPT_EVENTS' ); ?></div></a>
		</li>
		<li><a data-toggle="tab" style="height: 26px;" href="#email"><i
				class="iemail pull-left">&nbsp;</i>
			<div class="cb_editmenu_item"><?php echo JText::_( 'SM_EMAIL' ); ?></div></a>
		</li>
	</ul>
	<div class="cb_clear"></div>
	<div id="editcell" class="tab-content">
		<div id="general" class="tab-pane fade in form-horizontal">
			<div class="control-group">
				<label class="control-label" rel="tooltip"
					data-original-title="<?php echo JText::_("T_NAME")?>"
					title="<?php echo JText::_("T_NAME")?>"><?php echo JText::_( 'NAME' ); ?></label>
				<div class="controls">
					<input type="text" name="name"
						value="<?php echo $this->item['name']; ?>" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" rel="tooltip"
					data-original-title="<?php echo JText::_("T_DESC")?>"
					title="<?php echo JText::_("T_DESC")?>"><?php echo JText::_( 'INFORMATION' ); ?></label>
				<div class="controls">
					<textarea rows="5" name="info"><?php echo $this->item['info']; ?></textarea>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" rel="tooltip"
					data-original-title="<?php echo JText::_("T_PREFORM")?>"
					title="<?php echo JText::_("T_PREFORM")?>"><?php echo JText::_( 'PRE_FORM_TEXT' ); ?></label>
				<div class="controls">
				<?php
				echo $editor_preform->display ( 'preformhtml', $this->item ['preformhtml'], '90%', '300', '75', '6' );
				?> 
			</div>
			</div>
		</div>
		<div id="fields" class="tab-pane fade in">

			<div class="row">
				<div class="span2 offset1">
					<h4 rel="tooltip"
						data-original-title="<?php echo JText::_("T_USER_VARIABLE_LIST")?>"
						title="<?php echo JText::_("T_USER_VARIABLE_LIST")?>"><?php echo JText::_( 'USER_VARIABLE_LIST' ); ?></h4>
				</div>
				<div class="span9">
					<button class="btn" type="button" name="addfield" id="addfield"><?php echo JText::_( "ADD_FIELD" ); ?></button>
					<button class="btn btn-danger" type="button" name="delfield"
						id="delfield"><?php echo JText::_( "DELETE_FIELD" ); ?></button>
				</div>
			</div>
			<div class="tabbable tabs-left" id="field_nav">
				<ul class="nav nav-tabs"
					style="height: 575px; overflow-y: auto; overflow-x: hidden; padding-right: 10px;">
	          	<?php
												foreach ( $this->fields as $field ) {
													?>
			    <li><a data-toggle="tab" href="#fc_<?php echo $field->id;?>"><?php echo $field->name;?></a>
					</li>
			    <?php }?>
			  </ul>
				<div class="tab-content">
			  	<?php
						foreach ( $this->fields as $field ) {
							?>
				<div id="fc_<?php echo $field->id;?>"
						class="tab-pane fade in form-horizontal row"
						style="min-height: 550px; padding-left: 6px;">
						<blockquote style="margin-left: 26px;">
							<p><?php echo JText::_( 'SETTINGS' ); ?></p>
						</blockquote>
						<div class="span5" style="padding-left: 15px;">
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_ID")?>"
									title="<?php echo JText::_("T_F_ID")?>"><?php echo JText::_( 'ID' ); ?></label>
								<div class="controls">
									<span class="input-small uneditable-input"><?php echo $field->id; ?></span>
									<input name="id" id="chk" type="hidden"
										value="<?php echo $field->id; ?>" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_NAME")?>"
									title="<?php echo JText::_("T_F_NAME")?>"><?php echo JText::_( 'F_NAME' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="name" id="name" type="text"
										value="<?php echo $field->name; ?>" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_VAR")?>"
									title="<?php echo JText::_("T_F_VAR")?>"><?php echo JText::_( 'VAR' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="var" id="var" type="text"
										value="<?php echo $field->var; ?>" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_REQUIRED")?>"
									title="<?php echo JText::_("T_F_REQUIRED")?>"><?php echo JText::_( 'REQUIRED' ); ?></label>
								<div class="controls">
									<div class="btn-group cb_radio" data-toggle="buttons-radio">
										<button type="button"
											class="btn btn_no <?php echo ($field->mandatory=='0'||$field->mandatory==null)?'active':'';?>"
											aria-label="0"><?php echo JText::_('NO')?></button>
										<button type="button"
											class="btn btn_yes <?php echo $field->mandatory=='1'?'active':'';?>"
											aria-label="1"><?php echo JText::_('YES')?></button>
										<input type="hidden" class="radio_hidden" name="mandatory"
											value="<?php echo ($field->mandatory=='0'||$field->mandatory==null)?'0':'1';?>" />
									</div>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_TYPE")?>"
									title="<?php echo JText::_("T_F_TYPE")?>"><?php echo JText::_( 'TYPE' ); ?></label>
								<div class="controls" id="tdtype">
									<select class="type" onchange='javascript:changeType(this);'
										id="type" name="type" />
									<option value="-1"><?php echo JText::_( "SELECT" ); ?></option>
									<!-- <option value="99" <?php if ($field->type==99) echo 'selected';?>><?php echo JText::_( "cb_separator" ); ?></option>-->
									<optgroup label="<?php echo JText::_( "GRP_TEXT" ); ?>">
										<option value="4"
											<?php if ($field->type==4) echo 'selected';?>><?php echo JText::_( "TEXT" ); ?></option>
										<option value="8"
											<?php if ($field->type==8) echo 'selected';?>><?php echo JText::_( "TEXTAREA" ); ?></option>
										<option value="0"
											<?php if ($field->type==0) echo 'selected';?>><?php echo JText::_( "NUMBER" ); ?></option>
										<option value="1"
											<?php if ($field->type==1) echo 'selected';?>><?php echo JText::_( "DATE" ); ?></option>
										<option value="10"
											<?php if ($field->type==10) echo 'selected';?>><?php echo JText::_( "AUTOCOMPLETER" ); ?></option>
									</optgroup>
									<optgroup label="<?php echo JText::_( "GRP_MULTI" ); ?>">
										<option value="2"
											<?php if ($field->type==2) echo 'selected';?>><?php echo JText::_( "OPTION_LIST" ); ?></option>
										<option value="6"
											<?php if ($field->type==6) echo 'selected';?>><?php echo JText::_( "LINKED_LIST" ); ?></option>
										<option value="15"
											<?php if ($field->type==15) echo 'selected';?>><?php echo JText::_( "COMBO_INLINE_SQL" ); ?></option>
										<option value="7"
											<?php if ($field->type==7) echo 'selected';?>><?php echo JText::_( "MULTIPLE_OPTION_LIST" ); ?></option>
										<option value="3"
											<?php if ($field->type==3) echo 'selected';?>><?php echo JText::_( "YES_NO" ); ?></option>
										<option value="12"
											<?php if ($field->type==12) echo 'selected';?>><?php echo JText::_( "RADIOBUTTON" ); ?></option>
									</optgroup>
									<optgroup label="<?php echo JText::_( "GRP_OTHERS" ); ?>">
										<option value="14"
											<?php if ($field->type==14) echo 'selected';?>><?php echo JText::_( "INLINE" ); ?></option>										
										<option value="9"
											<?php if ($field->type==9) echo 'selected';?>><?php echo JText::_( "CAPTCHA" ); ?></option>
										<option value="11"
											<?php if ($field->type==11) echo 'selected';?>><?php echo JText::_( "FILE" ); ?></option>
									</optgroup>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_ORDER")?>"
									title="<?php echo JText::_("T_F_ORDER")?>"><?php echo JText::_( 'ORDER' ); ?></label>
								<div class="controls">
									<input class="input-mini order" name="order" id="order"
										type="text" value="<?php echo $field->order; ?>" />
								</div>
							</div>
						</div>
						<div class="span6" style="padding-left: 15px;">
							<div class="control-group decimal">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_DECIMALS")?>"
									title="<?php echo JText::_("T_F_DECIMALS")?>"><?php echo JText::_( 'DECIMALS' ); ?></label>
								<div class="controls">
									<input class="input-mini validate-numeric" name="decimal"
										type="text" value="<?php echo $field->decimal; ?>" />
								</div>
							</div>
							<div class="control-group mask">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_MASK")?>"
									title="<?php echo JText::_("T_F_MASK")?>"><?php echo JText::_( 'MASK' ); ?></label>
								<div class="controls">
									<div class="input-append mask-input">
										<div class="btn-group pull-left">
											<button class="btn dropdown-toggle" data-toggle="dropdown"><?php echo JText::_('PREDEFINED_MASKS')?> <span
													class="caret"></span>
											</button>
											<ul class="dropdown-menu">
												<li><a mask="phone"><?php echo JText::_('MASK_PHONE')?></a></li>
												<li><a mask="phone-us"><?php echo JText::_('MASK_PHONE_US')?></a></li>
												<li><a mask="time"><?php echo JText::_('MASK_TIME')?></a></li>
												<li><a mask="cc"><?php echo JText::_('MASK_CREDIT_CARD')?></a></li>
												<li><a mask="integer"><?php echo JText::_('MASK_INTEGER')?></a></li>
												<li><a mask="integer-us"><?php echo JText::_('MASK_INTEGER_US')?></a></li>
												<li><a mask="decimal"><?php echo JText::_('MASK_DECIMAL')?></a></li>
												<li><a mask="decimal-us"><?php echo JText::_('MASK_DECIMAL_US')?></a></li>
												<li><a mask="euro-after"><?php echo JText::_('MASK_EURO_AFTER')?></a></li>
												<li><a mask="euro-before"><?php echo JText::_('MASK_EURO_BEFORE')?></a></li>
												<li><a mask="dollar-after"><?php echo JText::_('MASK_DOLLAR_AFTER')?></a></li>
												<li><a mask="dollar-before"><?php echo JText::_('MASK_DOLLAR_BEFORE')?></a></li>
												<li><a mask="pound-after"><?php echo JText::_('MASK_POUND_AFTER')?></a></li>
												<li><a mask="pound-before"><?php echo JText::_('MASK_POUND_BEFORE')?></a></li>
												<li><a mask="yen-after"><?php echo JText::_('MASK_YEN_AFTER')?></a></li>
												<li><a mask="yen-before"><?php echo JText::_('MASK_YEN_BEFORE')?></a></li>
											</ul>
										</div>
										<input class="input-small" name="mask" type="text"
											value="<?php echo $field->mask; ?>" />
									</div>
								</div>
							</div>
							<div class="control-group limit0">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_DOWN_LIMIT")?>"
									title="<?php echo JText::_("T_F_DOWN_LIMIT")?>"><?php echo JText::_( 'DOWN_LIMIT' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="limit0" id="limit0"
										type="text" value="<?php echo $field->limit0; ?>" />
								</div>
							</div>
							<div class="control-group limit1">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_UP_LIMIT")?>"
									title="<?php echo JText::_("T_F_UP_LIMIT")?>"><?php echo JText::_( 'UP_LIMIT' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="limit1" id="limit1"
										type="text" value="<?php echo $field->limit1; ?>" />
								</div>
							</div>
							<div class="control-group default">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_DEFAULT")?>"
									title="<?php echo JText::_("T_F_DEFAULT")?>"><?php echo JText::_( 'DEFAULT' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="defaulttext" id="defaulttext"
										type="text" value="<?php echo $field->defaulttext; ?>" />
								</div>
							</div>
							<div class="control-group placeholder">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_PLACEHOLDER")?>"
									title="<?php echo JText::_("T_F_PLACEHOLDER")?>"><?php echo JText::_( 'PLACEHOLDER' ); ?></label>
								<div class="controls">
									<input class="input-medium" name="placeholder" id="placeholder"
										type="text" value="<?php echo $field->placeholder; ?>" />
								</div>
							</div>
							<div class="control-group css">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_CSS")?>"
									title="<?php echo JText::_("T_F_CSS")?>"><?php echo JText::_( 'CSS' ); ?></label>
								<div class="controls">
									<input class="input-medium" id="css" name="css" type="text"
										value="<?php echo $field->css; ?>" />
								</div>
							</div>
							<div class="control-group inlineevent">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_INLINEEVENT")?>"
									title="<?php echo JText::_("T_F_INLINEEVENT")?>"><?php echo JText::_( 'INLINEEVENT' ); ?></label>
								<div class="controls">
									<div class="btn-group cb_radio" data-toggle="buttons-radio">
										<button type="button"
											class="btn btn_no <?php echo ($field->inlineevent=='0')?'active':'';?>"
											aria-label="0"><?php echo JText::_('NO')?></button>
										<button type="button"
											class="btn btn_yes <?php echo ($field->inlineevent=='1'||$field->inlineevent==null)?'active':'';?>"
											aria-label="1"><?php echo JText::_('YES')?></button>
										<input type="hidden" class="radio_hidden" name="inlineevent"
											value="<?php echo ($field->inlineevent=='1'||$field->inlineevent==null)?'1':'0';?>" />
									</div>
								</div>								
							</div>
							<div class="control-group combosql">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_DEPENDANT_FIELD")?>"
									title="<?php echo JText::_("T_F_DEPENDANT_FIELD")?>"><?php echo JText::_( 'DEPENDANT_FIELD' ); ?></label>
								<div class="controls">
									<select class="input-large" id="combodependantfield" name="combodependantfield" >
										<option value="-1"><?php echo JText::_('DEPENDAT_FIELD_FIRST_OPTION');?></option>
										<?php foreach ( $this->fields as $fielddependant ): ?>
											<?php if ($field->id!=$fielddependant->id):?>
											<option value="<?php echo $fielddependant->id;?>" <?php echo ($fielddependant->id==$field->combodependantfield)?'selected="selected"':'';?>><?php echo $fielddependant->name;?></option>
											<?php endif;?>
										<?php endforeach;?>
									</select>
								</div>
							</div>
							<div class="control-group combosql">
									<label class="control-label" rel="tooltip"
										data-original-title="<?php echo JText::_("T_F_DEPENDANT_SQL")?>"
										title="<?php echo JText::_("T_F_DEPENDANT_SQL")?>"><?php echo JText::_( 'DEPENDANT_SQL' ); ?></label>
									<div class="controls">
										<textarea class="" id="combodependantsql" name="combodependantsql"><?php echo $field->combodependantsql; ?></textarea>
									</div>
							</div>								
						</div>
						<div class="clearfix"></div>
						<div
							class="mv_block <?php if (!in_array($field->type, array('2','6','7','10'))){echo 'hide';}?>"
							style="padding-left: 15px;">
							<blockquote>
								<p><?php echo JText::_( 'MULTIVALUES' ); ?></p>
							</blockquote>
							<div class="span5">
								<div class="control-group">
									<label class="control-label" rel="tooltip"
										data-original-title="<?php echo JText::_("T_F_MULTIVALUES_ACTIONS")?>"
										title="<?php echo JText::_("T_F_MULTIVALUES_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_ACTIONS' ); ?></label>
									<div class="controls">
										<div class="btn-group">
											<button class="btn" type="button" id="multi"
												onclick="javascript:addMultivalue(this)">
											<?php echo JText::_( 'MULTIVALUES_ACTIONS_ADD' ); ?>
				                        </button>
											<button class="btn btn-danger" type="button" id="multi"
												onclick="javascript:deleteAllMultivalue(this)">
											<?php echo JText::_( 'MULTIVALUES_ACTIONS_DELALL' ); ?>
				                        </button>
										</div>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" rel="tooltip"
										data-original-title="<?php echo JText::_("T_F_MULTIVALUES_SQL_ACTIONS")?>"
										title="<?php echo JText::_("T_F_MULTIVALUES_SQL_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_SQL_ACTIONS' ); ?></label>
									<div class="controls">
										<div class="btn-group">
											<button class="btn" type="button" id="multisql"
												onclick="javascript:addSQL(this)">
											<?php echo JText::_( 'MULTIVALUES_SQL_ADD' ); ?>
				                        </button>
											<button class="btn btn-danger" type="button" id="multidelsql"
												onclick="javascript:delSQL(this)">
											<?php echo JText::_( 'MULTIVALUES_SQL_DEL' ); ?>
				                        </button>
											<input type="hidden" name="sqltext" class="sqltext"
												value="<?php echo $field->sqltext;?>" />
										</div>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" rel="tooltip"
										data-original-title="<?php echo JText::_("T_F_MULTIVALUES_CSV_ACTIONS")?>"
										title="<?php echo JText::_("T_F_MULTIVALUES_CSV_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_CSV_ACTIONS' ); ?></label>
									<div class="controls">
										<div class="btn-group">
											<button class="btn" type="button" id="multiimportcsv"
												onclick="javascript:importCSV(this)">
				                        	<?php echo JText::_( 'MULTIVALUES_CSV' ); ?>
				                        </button>
										</div>
									</div>
								</div>
							</div>
							<div class="span6 multivalue">
						<?php						
							foreach ( $this->multivalues as &$fila ) {
								if ($fila->idfield != $field->id)
									continue;
								?>  
							<div class="form-inline multivalue_elem">
									<label class="cb_input_label"><?php echo JText::_( 'NAME' ); ?></label>
									<input type="text" class="input-small" id="mvname"
										name="mvname" value="<?php echo $fila->name; ?>"> <label
										class="cb_input_label"><?php echo JText::_( 'VALUE' ); ?></label>
									<input type="text" class="input-small" id="mvval" name="mvval"
										value="<?php echo $fila->value; ?>"> <input type="hidden"
										id="mvid" name="mvid" value="<?php echo $fila->id; ?>">
									<div class="btn-group cb_mv_buttons">
										<a class="btn cb_cmove"><i class="icon-move">&nbsp;</i></a> <a
											class="btn btn-danger" onclick="javascript:mv_remove(this);"><i
											class="icon-remove">&nbsp;</i></a>
									</div>
								</div>	
						<?php }?>
						</div>
						</div>
					</div>
	            <?php }?>
	           </div>
				<div id="sqldel" class="modal hide fade csvimport form-horizontal"
					tabindex="-1" role="dialog"
					aria-labelledby="<?php echo JText::_( 'CSV_FIELD_IMPORT' ); ?>"
					aria-hidden="true">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">x</button>
						<h3><?php echo JText::_( 'SQL_DELETE_TITLE' ); ?></h3>
					</div>
					<div class="modal-body">
						<div class="span6 alert alert-block">
							<?php echo JText::_('SQL_DELETE_TEXT')?>				
						</div>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal"><?php echo JText::_('CLOSE');?></button>
						<button class="btn btn-primary" data-dismiss="modal"
							onclick="javascript:delSQLQuery();"><?php echo JText::_('SQL_DELETE_ACTION')?></button>
					</div>
				</div>
				<div id="csvimport"
					class="modal hide fade csvimport form-horizontal" tabindex="-1"
					role="dialog"
					aria-labelledby="<?php echo JText::_( 'CSV_FIELD_IMPORT' ); ?>"
					aria-hidden="true">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">&times;</button>
						<h3><?php echo JText::_( 'CSV_FIELD_IMPORT' ); ?></h3>
					</div>
					<div class="modal-body">
						<div class="span6">
							<h3><?php echo JText::_( 'CSV_TEXT' ); ?></h3>
							<h6><?php echo JText::_( 'CSV_EXAMPLE' ); ?></h6>
						</div>
						<div class="span6">
							<textarea rows="15" style="width: 470px;" class="csvdata"></textarea>
						</div>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal"><?php echo JText::_('CLOSE');?></button>
						<button class="btn btn-primary" data-dismiss="modal"
							onclick="javascript:addCSVData();"><?php echo JText::_('SAVE');?></button>
					</div>
				</div>
				<div id="sqlimport"
					class="modal hide fade sqlimport form-horizontal" tabindex="-1"
					role="dialog"
					aria-labelledby="<?php echo JText::_( 'CSV_FIELD_IMPORT' ); ?>">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">&times;</button>
						<h3><?php echo JText::_( 'SQL_FIELD_IMPORT' ); ?></h3>
					</div>
					<div class="modal-body" style="overflow-x: hidden">
						<div class="span12">
							<h6><?php echo JText::_( 'SQL_EXAMPLE' ); ?></h6>
						</div>
						<div class="span12">
							<textarea rows="10" style="width: 470px;" class="sqldata"></textarea>
						</div>
						<div class="span12">
							<h4>
								<span class="label label-info" style="margin-right: 5px;"><?php echo JText::_( 'INFO' ); ?></span><?php echo JText::_( 'SQL_TEXT' ); ?></h4>
							<h4>
								<span class="label label-important" style="margin-right: 5px;"><?php echo JText::_( 'IMPORTANT' ); ?></span><?php echo JText::_( 'SQL_TEXT_INTERACT' ); ?></h4>
						</div>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal"><?php echo JText::_('CLOSE');?></button>
						<button class="btn btn-success" type="button" id="multipreviewsql"
							onclick="javascript:previewSQL(this)">
			                        	<?php echo JText::_( 'MULTIVALUES_SQL_PREVIEW' ); ?>
			                        </button>
						<button class="btn btn-primary" data-dismiss="modal"
							onclick="javascript:addSQLQuery();"><?php echo JText::_('SAVE');?></button>
					</div>
					<div id="sqlpreview"
						class="modal hide fade sqlimport form-horizontal" tabindex="-1"
						role="dialog">
						<div class="modal-header">
							<button type="button" class="sqlpreview_close close">&times;</button>
							<h3><?php echo JText::_( 'SQL_PREVIEW_RESULT' ); ?></h3>
						</div>
						<div class="modal-body result"></div>
						<div class="modal-footer">
							<button class="btn sqlpreview_close"><?php echo JText::_('CLOSE');?></button>
						</div>
					</div>
				</div>
			</div>
			<div id="input_field_duplicate" style="display: none">
				<div class="tab-pane fade in form-horizontal row"
					style="min-height: 550px; padding-left: 6px;">
					<blockquote style="margin-left: 26px;">
						<p><?php echo JText::_( 'SETTINGS' ); ?></p>
					</blockquote>
					<div class="span5" style="padding-left: 15px;">
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_NAME")?>"
								title="<?php echo JText::_("T_F_NAME")?>"><?php echo JText::_( 'F_NAME' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="name" id="name" type="text">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_VAR")?>"
								title="<?php echo JText::_("T_F_VAR")?>"><?php echo JText::_( 'VAR' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="var" id="var" type="text">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_REQUIRED")?>"
								title="<?php echo JText::_("T_F_REQUIRED")?>"><?php echo JText::_( 'REQUIRED' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button" class="btn btn_no active" aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button" class="btn btn_yes" aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="mandatory"
										value="0" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_TYPE")?>"
								title="<?php echo JText::_("T_F_TYPE")?>"><?php echo JText::_( 'TYPE' ); ?></label>
							<div class="controls" id="tdtype">
								<select class="type" onchange='javascript:changeType(this);'
									id="type" name="type">
									<option value="-1" selected="selected"><?php echo JText::_( "SELECT" ); ?></option>
									<optgroup label="<?php echo JText::_( "GRP_TEXT" ); ?>">
										<option value="4"><?php echo JText::_( "TEXT" ); ?></option>
										<option value="8"><?php echo JText::_( "TEXTAREA" ); ?></option>
										<option value="0"><?php echo JText::_( "NUMBER" ); ?></option>
										<option value="1"><?php echo JText::_( "DATE" ); ?></option>
										<option value="10"><?php echo JText::_( "AUTOCOMPLETER" ); ?></option>
									</optgroup>
									<optgroup label="<?php echo JText::_( "GRP_MULTI" ); ?>">
										<option value="2"><?php echo JText::_( "OPTION_LIST" ); ?></option>
										<option value="6"><?php echo JText::_( "LINKED_LIST" ); ?></option>
										<option value="15"><?php echo JText::_( "COMBO_INLINE_SQL" ); ?></option>
										<option value="7"><?php echo JText::_( "MULTIPLE_OPTION_LIST" ); ?></option>
										<option value="3"><?php echo JText::_( "YES_NO" ); ?></option>
										<option value="12"><?php echo JText::_( "RADIOBUTTON" ); ?></option>
									</optgroup>
									<optgroup label="<?php echo JText::_( "GRP_OTHERS" ); ?>">
										<option value="14"><?php echo JText::_( "INLINE" ); ?></option>										
										<option value="9"><?php echo JText::_( "CAPTCHA" ); ?></option>
										<option value="11"><?php echo JText::_( "FILE" ); ?></option>
									</optgroup>
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_ORDER")?>"
								title="<?php echo JText::_("T_F_ORDER")?>"><?php echo JText::_( 'ORDER' ); ?></label>
							<div class="controls">
								<input class="input-mini order" name="order" id="order"
									type="text" />
							</div>
						</div>
					</div>
					<div class="span6" style="padding-left: 15px;">
						<div class="control-group decimal">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_DECIMALS")?>"
								title="<?php echo JText::_("T_F_DECIMALS")?>"><?php echo JText::_( 'DECIMALS' ); ?></label>
							<div class="controls">
								<input class="input-mini validate-numeric" name="decimal"
									type="text" />
							</div>
						</div>
						<div class="control-group mask">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_MASK")?>"
								title="<?php echo JText::_("T_F_MASK")?>"><?php echo JText::_( 'MASK' ); ?></label>
							<div class="controls">
								<div class="input-append mask-input">
									<div class="btn-group pull-left">
										<button class="btn dropdown-toggle" data-toggle="dropdown"><?php echo JText::_('PREDEFINED_MASKS')?> <span
												class="caret"></span>
										</button>
										<ul class="dropdown-menu">
											<li><a mask="phone"><?php echo JText::_('MASK_PHONE')?></a></li>
											<li><a mask="phone-us"><?php echo JText::_('MASK_PHONE_US')?></a></li>
											<li><a mask="time"><?php echo JText::_('MASK_TIME')?></a></li>
											<li><a mask="cc"><?php echo JText::_('MASK_CREDIT_CARD')?></a></li>
											<li><a mask="integer"><?php echo JText::_('MASK_INTEGER')?></a></li>
											<li><a mask="integer-us"><?php echo JText::_('MASK_INTEGER_US')?></a></li>
											<li><a mask="decimal"><?php echo JText::_('MASK_DECIMAL')?></a></li>
											<li><a mask="decimal-us"><?php echo JText::_('MASK_DECIMAL_US')?></a></li>
											<li><a mask="euro-after"><?php echo JText::_('MASK_EURO_AFTER')?></a></li>
											<li><a mask="euro-before"><?php echo JText::_('MASK_EURO_BEFORE')?></a></li>
											<li><a mask="dollar-after"><?php echo JText::_('MASK_DOLLAR_AFTER')?></a></li>
											<li><a mask="dollar-before"><?php echo JText::_('MASK_DOLLAR_BEFORE')?></a></li>
											<li><a mask="pound-after"><?php echo JText::_('MASK_POUND_AFTER')?></a></li>
											<li><a mask="pound-before"><?php echo JText::_('MASK_POUND_BEFORE')?></a></li>
											<li><a mask="yen-after"><?php echo JText::_('MASK_YEN_AFTER')?></a></li>
											<li><a mask="yen-before"><?php echo JText::_('MASK_YEN_BEFORE')?></a></li>
										</ul>
									</div>
									<input class="input-small" id="mask" name="mask" type="text">
								</div>
							</div>
						</div>
						<div class="control-group limit0">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_DOWN_LIMIT")?>"
								title="<?php echo JText::_("T_F_DOWN_LIMIT")?>"><?php echo JText::_( 'DOWN_LIMIT' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="limit0" id="limit0"
									type="text" />
							</div>
						</div>
						<div class="control-group limit1">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_UP_LIMIT")?>"
								title="<?php echo JText::_("T_F_UP_LIMIT")?>"><?php echo JText::_( 'UP_LIMIT' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="limit1" id="limit1"
									type="text" />
							</div>
						</div>
						<div class="control-group default">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_DEFAULT")?>"
								title="<?php echo JText::_("T_F_DEFAULT")?>"><?php echo JText::_( 'DEFAULT' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="defaulttext" id="defaulttext"
									type="text" />
							</div>
						</div>
						<div class="control-group placeholder">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_PLACEHOLDER")?>"
								title="<?php echo JText::_("T_F_PLACEHOLDER")?>"><?php echo JText::_( 'PLACEHOLDER' ); ?></label>
							<div class="controls">
								<input class="input-medium" name="placeholder" id="placeholder"
									type="text" />
							</div>
						</div>
						<div class="control-group css">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_F_CSS")?>"
								title="<?php echo JText::_("T_F_CSS")?>"><?php echo JText::_( 'CSS' ); ?></label>
							<div class="controls">
								<input class="input-medium" id="css" name="css" type="text" />
							</div>
						</div>
						<div class="control-group inlineevent">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_INLINEEVENT")?>"
									title="<?php echo JText::_("T_F_INLINEEVENT")?>"><?php echo JText::_( 'INLINEEVENT' ); ?></label>
								<div class="controls">
									<div class="btn-group cb_radio" data-toggle="buttons-radio">
										<button type="button" class="btn btn_no" aria-label="0"><?php echo JText::_('NO')?></button>
										<button type="button" class="btn btn_yes active" aria-label="1"><?php echo JText::_('YES')?></button>
										<input type="hidden" class="radio_hidden" name="inlineevent" value="1" />
									</div>
								</div>								
							</div>
						<div class="control-group combosql">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_DEPENDANT_FIELD")?>"
									title="<?php echo JText::_("T_F_DEPENDANT_FIELD")?>"><?php echo JText::_( 'DEPENDANT_FIELD' ); ?></label>
								<div class="controls">
									<select class="input-large" id="combodependantfield" name="combodependantfield" >
										<option value="-1"><?php echo JText::_('DEPENDAT_FIELD_FIRST_OPTION');?></option>			
										<?php foreach ( $this->fields as $fielddependant ): ?>
											<?php if ($field->id!=$fielddependant->id):?>
											<option value="<?php echo $fielddependant->id;?>" <?php echo ($fielddependant->id==$field->combodependantfield)?'selected="selected"':'';?>><?php echo $fielddependant->name;?></option>
											<?php endif;?>
										<?php endforeach;?>							
									</select>
								</div>
							</div>
							<div class="control-group combosql">
									<label class="control-label" rel="tooltip"
										data-original-title="<?php echo JText::_("T_F_DEPENDANT_SQL")?>"
										title="<?php echo JText::_("T_F_DEPENDANT_SQL")?>"><?php echo JText::_( 'DEPENDANT_SQL' ); ?></label>
									<div class="controls">
										<textarea class="" id="combodependantsql" name="combodependantsql"></textarea>
									</div>
							</div>							
					</div>
					<div class="clearfix"></div>
					<div class="mv_block hide" style="padding-left: 15px;">
						<blockquote>
							<p><?php echo JText::_( 'MULTIVALUES' ); ?></p>
						</blockquote>
						<div class="span5">
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_MULTIVALUES_ACTIONS")?>"
									title="<?php echo JText::_("T_F_MULTIVALUES_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_ACTIONS' ); ?></label>
								<div class="controls">
									<div class="btn-group">
										<button class="btn" type="button" id="multi"
											onclick="javascript:addMultivalue(this)">
											<?php echo JText::_( 'MULTIVALUES_ACTIONS_ADD' ); ?>
				                        </button>
										<button class="btn btn-danger" type="button" id="multi"
											onclick="javascript:deleteAllMultivalue(this)">
											<?php echo JText::_( 'MULTIVALUES_ACTIONS_DELALL' ); ?>
				                        </button>
									</div>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_MULTIVALUES_SQL_ACTIONS")?>"
									title="<?php echo JText::_("T_F_MULTIVALUES_SQL_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_SQL_ACTIONS' ); ?></label>
								<div class="controls">
									<div class="btn-group">
										<button class="btn" type="button" id="multisql"
											onclick="javascript:addSQL(this)">
											<?php echo JText::_( 'MULTIVALUES_SQL_ADD' ); ?>
				                        </button>
										<button class="btn btn-danger" type="button" id="multidelsql"
											onclick="javascript:delSQL(this)">
											<?php echo JText::_( 'MULTIVALUES_SQL_DEL' ); ?>
				                        </button>
										<input type="hidden" id="sqltext" name="sqltext" />
									</div>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" rel="tooltip"
									data-original-title="<?php echo JText::_("T_F_MULTIVALUES_CSV_ACTIONS")?>"
									title="<?php echo JText::_("T_F_MULTIVALUES_CSV_ACTIONS")?>"><?php echo JText::_( 'MULTIVALUES_CSV_ACTIONS' ); ?></label>
								<div class="controls">
									<div class="btn-group">
										<button class="btn" type="button" id="multiimportcsv"
											onclick="javascript:importCSV(this)">
				                        	<?php echo JText::_( 'MULTIVALUES_CSV' ); ?>
				                        </button>
									</div>
								</div>
							</div>
						</div>
						<div class="span6 multivalue"></div>
					</div>
				</div>
			</div>
		</div>
		<div id="code" class="tab-pane fade in">
			<div class="row-fluid" style="width: 98%">
				<div class="span4">
					<blockquote>
						<p>Code Tips</p>
					</blockquote>					
					<div id="code_tweaks">					
					<!--SHPInit3-->
					<div class="group">
                        <div class="heading">Link to Hika Shop code</div>
                        <div class="body">
                            <div class="inner">
                           
                            <h6>
                                <div id="code_1" class="modal hide fade">
                                    <div class="modal-header"></div>
                                    <div class="modal-body">
                                        <p><img src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png"/></p>
                                    </div>
                                    <div class="modal-footer">
                                        <a href="#" class="btn" data-dismiss="modal">Close</a>
                                    </div>
                                </div>
                              
                            </h6>
                  <h5>Instructions:</h5>
                            <small>Paste this code at the end of the code area (once you have finished your calculations) and fill in the parameters (in italic) for your product. You can use previous calculations and variables of your code, for ex:<br>
                            <br>$mycalculatedprice=$input1*5;<br>
              $hk_pricehikaproduct=$mycalculatedprice;
              </small>
                         
                            <h5>Code:</h5>                                                                       
                            <pre>//Modify these parameters according to your product
//QTY
$hk_quantity=<i>1</i>;
//NAME
$hk_product_name='<i>Test</i>';
//LONG DESCRIPTION
$hk_product_description='<i>Description</i>';
//PRICE
$hk_pricehikaproduct=<i>10</i>;
//CODE
$hk_product_code='<i>COD</i>';

//More options (from #_hikashop_product table)
$hk_productfields=array();
$hk_productfields['<i>product_width</i>']=<i>23</i>;
$hk_productfields['<i>product_length</i>']=<i>12</i>;

//Complete file parameters in order to attach a pdf file to your product
$hk_file_name='<i>PDFFile</i>';
$hk_file_description='<i>File Attached</i>';



</pre>
                       
                            </div>
                        </div>       
                    </div>
					<!--SHPEnd3-->					
						<div class="group">
							<div class="heading">Get Value from one-value field</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number, Date, Option List, Linked List, Yes/No, Text,
										Textarea, TextAutocompleter</small>
									<h6>
										<div id="code_1" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_1" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar;</pre>
									<h5>Result:</h5>
									<small>PHP variable with one value. In case of Yes/No field,
										values are 'Y' or nothing</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Value from multi-value field</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Multiple Option</small>
									<h6>
										<div id="code_2" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_2" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar;</pre>
									<h5>Result:</h5>
									<small>PHP array with all values</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Name from Option List, Linked List and
								Text Autocompleter</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Option List, Linked List and Text Autocompleter</small>
									<h6>
										<div id="code_3" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_3" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar_name;</pre>
									<h5>Result:</h5>
									<small>PHP variable with one name</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Name from Multiple Option</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Multiple Option</small>
									<h6>
										<div id="code_4" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_4" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar_name;</pre>
									<h5>Result:</h5>
									<small>PHP array with all names</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Value from Fields in Section</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number, Date, Option List, Text, Textarea,
										TextAutocompleter</small>
									<h6>
										<div id="code_5" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_5" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar;</pre>
									<h5>Result:</h5>
									<small>PHP array with all values</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Names from Fields in Section</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number, Date, Option List, Text, Textarea,
										TextAutocompleter</small>
									<h6>
										<div id="code_6" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_6" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>$myvar_name;</pre>
									<h5>Result:</h5>
									<small>PHP array with all names</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Format number</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number</small>
									<h6>
										<div id="code_7" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#code_7" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code Explain:</h5>
									<h6>number_format($myvar,NUMBER_OF_DECIMALS,DECIMAL_POINT,THOUSAND_SEPARATOR);</h6>
									<h5>Code:</h5>
									<pre>number_format($myvar,2,'.',',');</pre>
									<h5>Result:</h5>
									<small>123,235.21</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Get Array values</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Multiple Option and all fields inside sections</small>
									<h5>Code Explain:</h5>
									<h6>To get into array values you can use index like this
										(Remember arrays index start at 0):</h6>
									<pre>$first_value=$myvar[0];</pre>
									<h6>or use a for statement, for example to sum all values:</h6>
									<pre>$result_sum=0;<br />for($i=0;$i&lt;count($myvar);$i++){<br />$result_sum = $result_sum + $myvar[$i];<br />}</pre>
									<h6>or, you coud use foreach statement as follows:</h6>
									<pre>$result_sum=0;<br />foreach($my_var as $var_int){<br />$result_sum = $result_sum + $var_int;<br />}</pre>
									<h6>Also you could use array functions, for example to get a
										string with all values separated with - :</h6>
									<pre>$chained_values=implode(' - ',$my_var); </pre>
									<h6>
										You could get more ingo at: <br />
										<a href="http://php.net/manual/en/language.types.array.php"
											target="_blank">PHP Manual</a>
									</h6>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Math Functions</div>
							<div id="t1" class="body">
								<div class="inner">
									<h5>Addition</h5>
									<pre>$result=$a+$b;</pre>
									<h5>Subtraction</h5>
									<pre>$result=$a-$b;</pre>
									<h5>Multiplication</h5>
									<pre>$result=$a*$b;</pre>
									<h5>Division</h5>
									<pre>$result=$a/$b;</pre>
									<h5>More Math Functions</h5>
									<a href="http://www.w3schools.com/php/php_operators.asp"
										target="_blank">link</a>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="span8">
					<div class="well well-small"
						style="height: 29px; margin-bottom: 5px;">
						<div class="span12">
							<div class="input-append"
								style="float: left; margin-right: 5px; width: 265px;">
								<input id="addvar" type="text" style="width: 125px;">
								<button class="btn" type="button" id="addvarButton"
									style="margin-top: 0px; margin-right: 5px;"><?php echo JText::_('ADD_NEW_VAR');?></button>
							</div>
							<div class="input-append" style="float: left; margin-right: 7px;">
								<select class="chselect" style="width: auto;"
									id="select_existing_fields">
									<option><?php echo JText::_('SELECT_FIELDS');?></option>
								<?php foreach ($this->fields as $field){ ?>
									<option value="<?php echo $field->var;?>"><?php echo $field->name;?></option>
					            <?php } ?>
							</select>
							</div>
							<div class="chcontainer0" style="float: left;"></div>
						</div>
					</div>
					<div class="well well-small">
						<div class="chcontainer"></div>
						<div class="chcontainer2"
							style='margin-bottom: 8px; margin-top: 5px;'></div>
					</div>
					<textarea rows="25" id="code_ta" style="width: 100%" name="code"><?php echo $this->item['code']; ?></textarea>
				</div>
			</div>
		</div>
		<div id="sections" class="tab-pane fade in form-horizontal">
			<div class="row">
				<div class="offset1">
					<h4><?php echo JText::_( 'SM_SECTIONS_PREFERENCES' ); ?></h4>
				</div>
			</div>
			<div class="row-fluid offset1" id="sectionspreferences">
				<div class="control-group">
					<label class="control-label" rel="tooltip"
						data-original-title="<?php echo JText::_("SM_ADD_POSITION")?>"
						title="<?php echo JText::_("SM_ADD_POSITION")?>"><?php echo JText::_( 'SM_ADD_POSITION' ); ?></label>
					<div class="controls">
						<select class="sectionaddposition" id="sectionaddposition" name="sectionaddposition">
							<option value="0"<?php echo (!isset($this->item['sectionaddposition']) || $this->item['sectionaddposition']=='0')?'selected="selected"':''; ?> ><?php echo JText::_( "SM_BEFORE" ); ?></option>
							<option value="1"<?php echo (isset($this->item['sectionaddposition']) && $this->item['sectionaddposition']=='1')?'selected="selected"':''; ?>><?php echo JText::_( "SM_AFTER" ); ?></option>
						</select>
					</div>
				</div>				
				<div class="control-group">
					<label class="control-label" rel="tooltip"
						data-original-title="<?php echo JText::_("SM_SECTION_POSITION")?>"
						title="<?php echo JText::_("SM_SECTION_POSITION")?>"><?php echo JText::_( 'SM_SECTION_POSITION' ); ?></label>
					<div class="controls">
						<select class="sectionposition" id="sectionposition" name="sectionposition">
							<option value="0"<?php echo (!isset($this->item['sectionposition']) || $this->item['sectionposition']=='0')?'selected="selected"':''; ?> ><?php echo JText::_( "SM_BOTTOM_SECTION" ); ?></option>
							<option value="1"<?php echo (isset($this->item['sectionposition']) && $this->item['sectionposition']=='1')?'selected="selected"':''; ?>><?php echo JText::_( "SM_TOP_SECTION" ); ?></option>
						</select>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="span2 offset1">
					<h4><?php echo JText::_( 'SM_SECTIONS' ); ?></h4>
				</div>
				<div class="span9">
					<button class="btn" type="button" name="addsection" id="addsection"><?php echo JText::_( "CREATE_SECTION" ); ?></button>
					<button class="btn btn-danger" type="button" name="delsection"
						id="delsection"><?php echo JText::_( "DELETE_SECTION" ); ?></button>
				</div>
			</div>
			<div class="tabbable tabs-left" id="section_nav">
				<ul class="nav nav-tabs">
	          	<?php foreach ($this->sections as $index=>$section){?>
			    <li><a data-toggle="tab" href="#sc_<?php echo $section->id;?>"><?php echo $section->name;?></a>
					</li>
			    <?php }?>
			  </ul>
				<div class="tab-content">
			  	<?php foreach ($this->sections as $index=>&$section){?>
			  		<div id="sc_<?php echo $section->id;?>"
						class="tab-pane fade in form-horizontal row-flow">
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_S_SECTION_NAME")?>"
								title="<?php echo JText::_("T_S_SECTION_NAME")?>"><?php echo JText::_( 'SECTION_NAME' ); ?></label>
							<div class="controls">
								<input class="input-small validate-numeric decimal" name="name"
									type="text" value="<?php echo $section->name;?>" /> <input
									name="id" type="hidden" value="<?php echo $section->id;?>" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_S_SECTION_ADD")?>"
								title="<?php echo JText::_("T_S_SECTION_ADD")?>"><?php echo JText::_( 'SECTION_ADD' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo $section->addbutton=='0'?'active':'';?>"
										aria-label="0"><?php echo JText::_('CB_NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $section->addbutton=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('CB_YES')?></button>
									<input type="hidden" class="radio_hidden" name="addbutton"
										value="<?php echo $section->addbutton;?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("SM_ADD_INLINEEVENT")?>"
								title="<?php echo JText::_("SM_ADD_INLINEEVENT")?>"><?php echo JText::_( 'SM_ADD_INLINEEVENT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo $section->addinlineevent=='0'?'active':'';?>"
										aria-label="0"><?php echo JText::_('CB_NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $section->addinlineevent=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('CB_YES')?></button>
									<input type="hidden" class="radio_hidden" name="addinlineevent"
										value="<?php echo $section->addinlineevent;?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("SM_DEL_INLINEEVENT")?>"
								title="<?php echo JText::_("SM_DEL_INLINEEVENT")?>"><?php echo JText::_( 'SM_DEL_INLINEEVENT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo $section->delinlineevent=='0'?'active':'';?>"
										aria-label="0"><?php echo JText::_('CB_NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $section->delinlineevent=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('CB_YES')?></button>
									<input type="hidden" class="radio_hidden" name="delinlineevent"
										value="<?php echo $section->delinlineevent;?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_S_DEFAULT_SECTIONS")?>"
								title="<?php echo JText::_("T_S_DEFAULT_SECTIONS")?>"><?php echo JText::_( 'DEFAULT_SECTIONS' ); ?></label>
							<div class="controls">
								<input class="input-mini validate-numeric decimal"
									name="defaultsections" type="text"
									value="<?php echo $section->defaultsections;?>" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_S_LIMIT_SECTIONS")?>"
								title="<?php echo JText::_("T_S_LIMIT_SECTIONS")?>"><?php echo JText::_( 'LIMIT_SECTIONS' ); ?></label>
							<div class="controls">
								<input class="input-mini validate-numeric decimal"
									name="limitsections" type="text"
									value="<?php echo $section->limitsections;?>" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_S_FIELDS")?>"
								title="<?php echo JText::_("T_S_FIELDS")?>"><?php echo JText::_( 'FIELDS' ); ?></label>
							<div class="controls">
							<?php $arr_fields=explode(',',$section->fields);?>
		            		<?php
							
foreach ( $this->fields as $field ) {
								//if ($field->type != 9 && $field->type != 7&& $field->type != 15) {
								if ($field->type != 9 && $field->type != 7) {
									?>
								<label class="checkbox inline"> <input type="checkbox"
									name="fields" value="<?php echo $field->id?>"
									<?php echo in_array($field->id,$arr_fields)?'checked=checked':'';?>><?php echo $field->name?>
								</label>	
							<?php } ?>            		
		            		<?php } ?>						
							</div>
						</div>
					</div>
			  	<?php }?>
			  </div>
			</div>
			<div id="section_duplicate" style="display: none">
				<div class="tab-pane fade in form-horizontal row-flow">
					<div class="control-group">
						<label class="control-label" rel="tooltip"
							data-original-title="<?php echo JText::_("T_S_SECTION_NAME")?>"
							title="<?php echo JText::_("T_S_SECTION_NAME")?>"><?php echo JText::_( 'SECTION_NAME' ); ?></label>
						<div class="controls">
							<input class="input-small validate-numeric decimal" name="name"
								type="text" /> <input name="id" type="hidden" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" rel="tooltip"
							data-original-title="<?php echo JText::_("T_S_SECTION_ADD")?>"
							title="<?php echo JText::_("T_S_SECTION_ADD")?>"><?php echo JText::_( 'SECTION_ADD' ); ?></label>
						<div class="controls">
							<div class="btn-group cb_radio" data-toggle="buttons-radio">
								<button type="button" class="btn btn_no active" aria-label="0"><?php echo JText::_('CB_NO')?></button>
								<button type="button" class="btn btn_yes" aria-label="1"><?php echo JText::_('CB_YES')?></button>
								<input type="hidden" class="radio_hidden" name="addbutton" value="0" />
							</div>
						</div>
					</div>
					<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("SM_ADD_INLINEEVENT")?>"
								title="<?php echo JText::_("SM_ADD_INLINEEVENT")?>"><?php echo JText::_( 'SM_ADD_INLINEEVENT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button" class="btn btn_no active" aria-label="0"><?php echo JText::_('CB_NO')?></button>
									<button type="button" class="btn btn_yes" aria-label="1"><?php echo JText::_('CB_YES')?></button>
									<input type="hidden" class="radio_hidden" name="addinlineevent" value="0"/>
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("SM_DEL_INLINEEVENT")?>"
								title="<?php echo JText::_("SM_DEL_INLINEEVENT")?>"><?php echo JText::_( 'SM_DEL_INLINEEVENT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button" class="btn btn_no active" aria-label="0"><?php echo JText::_('CB_NO')?></button>
									<button type="button" class="btn btn_yes" aria-label="1"><?php echo JText::_('CB_YES')?></button>
									<input type="hidden" class="radio_hidden" name="delinlineevent" value="0" />
								</div>
							</div>
						</div>
					<div class="control-group">
						<label class="control-label" rel="tooltip"
							data-original-title="<?php echo JText::_("T_S_DEFAULT_SECTIONS")?>"
							title="<?php echo JText::_("T_S_DEFAULT_SECTIONS")?>"><?php echo JText::_( 'DEFAULT_SECTIONS' ); ?></label>
						<div class="controls">
							<input class="input-mini validate-numeric decimal"
								name="defaultsections" type="text" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" rel="tooltip"
							data-original-title="<?php echo JText::_("T_S_LIMIT_SECTIONS")?>"
							title="<?php echo JText::_("T_S_LIMIT_SECTIONS")?>"><?php echo JText::_( 'LIMIT_SECTIONS' ); ?></label>
						<div class="controls">
							<input class="input-mini validate-numeric decimal"
								name="limitsections" type="text" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" rel="tooltip"
							data-original-title="<?php echo JText::_("T_S_FIELDS")?>"
							title="<?php echo JText::_("T_S_FIELDS")?>"><?php echo JText::_( 'FIELDS' ); ?></label>
						<div class="controls">
							<?php
							
foreach ( $this->fields as $field ) {
								if ($field->type != 9 && $field->type != 7&& $field->type != 15) {
									?>
								<label class="checkbox inline"> <input type="checkbox"
								name="fields" value="<?php echo $field->id?>"><?php echo $field->name?>
								</label>	
								<?php } ?>            		
		            		<?php } ?>						
							</div>
					</div>
				</div>
			</div>
		</div>
		<!--SHPInit2-->
		<div id="vm" class="tab-pane fade in form-horizontal">
	  	<?php if ($this->validateComponent('com_virtuemart','011')){?> 	
		 <div class="control-group">
			<label class="control-label" rel="tooltip" data-original-title="<?php echo JText::_("VIRTUEMART_TYPE_DESC")?>" title="<?php echo JText::_("VIRTUEMART_TYPE_DESC")?>"><?php echo JText::_( 'VIRTUEMART_TYPE' ); ?></label>
			<div class="controls">
				<div class="btn-group cb_radio" data-toggle="buttons-radio">							    
				    <button type="button" class="btn <?php echo ($this->item['vm_product_type']=='0'||$empty)?'active':'';?>" aria-label="0"><?php echo JText::_('VIRTUEMART_TYPE_DUPLICATE')?></button>
				    <button type="button" class="btn <?php echo $this->item['vm_product_type']=='1'?'active':'';?>" aria-label="1"><?php echo JText::_('VIRTUEMART_TYPE_EXISTING')?></button>
				    <input type="hidden" class="radio_hidden" name="vm_product_type" value="<?php echo $this->item['vm_product_type'];?>"/>
			    </div>
			</div>
		</div>		
		<div>
			<label class="control-label" rel="tooltip" data-original-title="<?php echo JText::_("VIRTUEMART_PRODUCT_MAPPING_DESC")?>" title="<?php echo JText::_("VIRTUEMART_PRODUCT_MAPPING_DESC")?>"><?php echo JText::_( 'VIRTUEMART_PRODUCT_MAPPING' ); ?></label>
			<div class="controls" id="vm_main">
				<button class="btn btn-primary" type="button" onclick="javascript:addVMBlock();">Add Products</button>
	            <div class="cb_clear"></div>
	             <?php foreach ($this->vmproducts as $key=>$value){?>			 	
				 <div class="span12 cb_mv_buttons">
	              	<a class="btn btn-danger" style="float:left;margin-right:15px;margin-bottom:15px;" onclick="javascript:delVMBlock(this);"><i class="icon-remove">&nbsp;</i></a>
	              	<label><?php echo $key;?> - <?php echo $value;?></label>              
	              	<input type="hidden" name="vm_product[]" value="<?php echo $key;?>"/>		    
				 </div>
				 <?php } ?>
				 <?php 
				    if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
				    VmConfig::loadConfig();
				    $categoryModel = VmModel::getModel('Category');
				    $categories=$categoryModel->getCategoryTree();
				    ?>
	              <div class="vm_wrapper span12 cb_mv_buttons cb_vm_elems" id="vm_wrapper_main">
	              	<a class="btn btn-danger" style="float:left;margin-right:15px;margin-top:3px;" onclick="javascript:delVMBlock(this);"><i class="icon-remove">&nbsp;</i></a>
	              	<div class="input-prepend">
						<span class="add-on"><?php echo JText::_( 'VIRTUEMART_CATEGORIES' ); ?></span>
						<select id="vm_categories" class="vm_categories" name="vm_categories[]">
				    	<option value="-1"><?php echo JText::_( 'VM_SELECT_CATEGORY' ); ?></option>
					    <?php 
					    foreach ($categories as $category){
					    	?><option value="<?php echo $category->virtuemart_category_id;?>"><?php echo $category->category_name;?></option><?php 
					    }
					    ?>
					    </select>	
					</div>					
					<div class="input-prepend">
						<span class="add-on"><?php echo JText::_( 'VIRTUEMART_PRODUCTS' ); ?></span>
						<select id="vm_product" class="vm_product" name="vm_product[]"></select>	
					</div>					            	
				 </div>
				</div>
			</div>
			<div class="cb_clear"></div>
			<div class="control-group" style="margin-top:20px;">
			 	<label class="control-label" rel="tooltip" data-original-title="<?php echo JText::_("VIRTUEMART_CODE_DESC")?>" title="<?php echo JText::_("VIRTUEMART_CODE_DESC")?>"><?php echo JText::_( 'VIRTUEMART_CODE' ); ?></label>
				<div class="controls">
				    <textarea readonly="readonly" rows="12" style="width:500px"><?php foreach ($this->vmproducts as $key=>$value){
					 	echo '// Product -> '.$value.'('.$key.')&#10;'; 
					 	if($this->item['vm_product_type']=='0'){ 
					 		echo '$vm_price_'.$key.'="'.JText::_('VIRTUEMART_PRICE').'";&#10;';
					 		echo '$vm_desc_'.$key.'="'.JText::_('VIRTUEMART_DESC').'";&#10;'; 
					 	}
					 	echo '$vm_qty_'.$key.'="'.JText::_('VIRTUEMART_QUANTITY').'";&#10;&#10;';
	                }?></textarea>														
				</div>								 			
		</div>
		<?php } else { ?>
		<div class="alert">
		    <strong><?php echo JText::_( 'WARNING' ); ?></strong> <?php echo JText::_( 'VIRTUEMART_NOT_FOUND' ); ?>
	    </div>		
		<?php } ?>	
	  </div>
	  <!--SHPEnd2-->		
		
		<div id="layout" class="tab-pane fade in">
	  <?php $empty=!isset($this->item['calculateonfly']);?>
		  <div class="tab-pane fade in form-horizontal row-flow">
				<blockquote>
					<p><?php echo JText::_( 'SM_LAYOUT_PREFERENCES_FORMATS' ); ?></p>
				</blockquote>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_CALCULATE_ON_FLY")?>"
						title="<?php echo JText::_("T_CALCULATE_ON_FLY")?>"><?php echo JText::_( 'CALCULATE_ON_FLY' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['calculateonfly']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['calculateonfly']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="calculateonfly"
								value="<?php echo $this->item['calculateonfly'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_CALCULATE_ON_INIT")?>"
						title="<?php echo JText::_("T_CALCULATE_ON_INIT")?>"><?php echo JText::_( 'CALCULATE_ON_INIT' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['calc_on_init']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['calc_on_init']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="calc_on_init"
								value="<?php echo $this->item['calc_on_init'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_CALCULATE_TEXT")?>"
						title="<?php echo JText::_("T_CALCULATE_TEXT")?>"><?php echo JText::_( 'CALCULATE_TEXT' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<input type="text" name="calculate_button_text"
								value="<?php echo $this->item['calculate_button_text']==''?JText::_('CALCULATE'):$this->item['calculate_button_text'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_IMPORT_BOOTSTRAP")?>"
						title="<?php echo JText::_("T_IMPORT_BOOTSTRAP")?>"><?php echo JText::_( 'IMPORT_BOOTSTRAP' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo $this->item['import_bootstrap']=='0'?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo ($this->item['import_bootstrap']=='1'||$empty)?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="import_bootstrap"
								value="<?php echo $this->item['import_bootstrap'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_RESULT_POPUP")?>"
						title="<?php echo JText::_("T_RESULT_POPUP")?>"><?php echo JText::_( 'RESULT_POPUP' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" id="cof"
							data-toggle="buttons-radio" style="float: left;">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['resultpopup']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['resultpopup']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="resultpopup"
								value="<?php echo $this->item['resultpopup'];?>" />
						</div>
						<div class="input-append" id="cofY" style="margin-top:3px; margin-left:8px;<?php echo ($this->item['resultpopup']=='0'||$empty)?'display:none;':'';?>">
							<label class="control-label" style="margin-right: 5px;"><?php echo JText::_( 'RESULT_POPUP_WIDTH' ); ?></label>
							<input class="input-mini" style="text-align: right;" type="text"
								name="popupwidth"
								value="<?php echo $empty?'250':$this->item['popupwidth'];?>"> <span
								class="add-on">px</span>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_RESET_BUTTON")?>"
						title="<?php echo JText::_("T_RESET_BUTTON")?>"><?php echo JText::_( 'RESET_BUTTON' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['reset_button']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['reset_button']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="reset_button"
								value="<?php echo $this->item['reset_button'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SHOW_INFO_TITLE")?>"
						title="<?php echo JText::_("T_SHOW_INFO_TITLE")?>"><?php echo JText::_( 'SHOW_INFO_TITLE' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['info_img']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['info_img']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="info_img"
								value="<?php echo $this->item['info_img'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SHOW_FRONT_EMAIL")?>"
						title="<?php echo JText::_("T_SHOW_FRONT_EMAIL")?>"><?php echo JText::_( 'SHOW_FRONT_EMAIL' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['front_email']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['front_email']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="front_email"
								value="<?php echo $this->item['front_email'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SUBJECT_FRONT_EMAIL")?>"
						title="<?php echo JText::_("T_SUBJECT_FRONT_EMAIL")?>"><?php echo JText::_( 'SUBJECT_FRONT_EMAIL' ); ?></label>
					<div class="controls">
						<input type="text" class="input-large" name="mail_subject"
							value="<?php echo $this->item['mail_subject']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SHOW_FRONT_PDF")?>"
						title="<?php echo JText::_("T_SHOW_FRONT_PDF")?>"><?php echo JText::_( 'SHOW_FRONT_PDF' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['front_pdf']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['front_pdf']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="front_pdf"
								value="<?php echo $this->item['front_pdf'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SHOW_FRONT_EXCEL")?>"
						title="<?php echo JText::_("T_SHOW_FRONT_EXCEL")?>"><?php echo JText::_( 'SHOW_FRONT_EXCEL' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo ($this->item['front_excel']=='0'||$empty)?'active':'';?>"
								aria-label="0"><?php echo JText::_('NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['front_excel']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('YES')?></button>
							<input type="hidden" class="radio_hidden" name="front_excel"
								value="<?php echo $this->item['front_excel'];?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_SAVE_DATA")?>"
						title="<?php echo JText::_("T_SAVE_DATA")?>"><?php echo JText::_( 'SAVE_DATA' ); ?></label>
					<div class="controls">
						<div class="btn-group" data-toggle="buttons-radio">
							<select name="datasave">
								<option value="-1"
									<?php echo $this->item['datasave']=='-1'?'selected="selected"':'';?>><?php echo JText::_('SELECT')?></option>
								<option value="0"
									<?php echo $this->item['datasave']=='0'?'selected="selected"':'';?>><?php echo JText::_('USER')?></option>
								<option value="1"
									<?php echo $this->item['datasave']=='1'?'selected="selected"':'';?>><?php echo JText::_('COOKIES')?></option>
							</select>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_DATE_FRONTEND_FORMAT")?>"
						title="<?php echo JText::_("T_DATE_FRONTEND_FORMAT")?>"><?php echo JText::_( 'DATE_FRONTEND_FORMAT' ); ?><br />
						<a href="#" data-target="#dateformat" role="button" class=""
						data-toggle="modal"><?php echo JText::_( 'DATE_FRONTEND_FORMAT_MORE' ); ?></a></label>
					<div class="controls">
						<input type="text" class="input-small" name="date_frontend_format"
							value="<?php echo $this->item['date_frontend_format']; ?>" />
					</div>
				</div>
				<div id="dateformat"
					class="modal hide fade csvimport form-horizontal" tabindex="-1"
					role="dialog"
					aria-labelledby="<?php echo JText::_( 'MODAL_T_DATE_FRONTEND_FORMAT' ); ?>"
					aria-hidden="true">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">x</button>
						<h3><?php echo JText::_( 'MODAL_T_DATE_FRONTEND_FORMAT' ); ?></h3>
					</div>
					<div class="modal-body">
						<div class="span6">
							<?php echo JText::_('MODAL_T_DATE_FRONTEND_FORMAT_TEXT')?>				
						</div>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal"><?php echo JText::_('CLOSE');?></button>
					</div>
				</div>
				<div class="control-group form-inline">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_NUMBER_FORMAT")?>"
						title="<?php echo JText::_("T_NUMBER_FORMAT")?>"><?php echo JText::_( 'NUMBER_FORMAT' ); ?></label>
					<div class="controls">
						<label for="dnf"><?php echo JText::_( 'DECIMAL_NUMBER_FORMAT' ); ?></label>
						<input type="text" class="input-mini" name="decimal_number_format"
							value="<?php echo $empty?'.':$this->item['decimal_number_format']; ?>" />
						<label for="tnf"><?php echo JText::_( 'THOUSAND_NUMBER_FORMAT' ); ?></label>
						<input type="text" class="input-mini"
							name="thousand_number_format"
							value="<?php echo $empty?',':$this->item['thousand_number_format']; ?>" />
					</div>
				</div>				
				<blockquote>
					<p><?php echo JText::_( 'SM_LAYOUT_PREFERENCES_UPLOAD' ); ?></p>
				</blockquote>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_FILE_SIZE")?>"
						title="<?php echo JText::_("T_UPLOAD_FILE_SIZE")?>"><?php echo JText::_( 'UPLOAD_FILE_SIZE' ); ?></label>
					<div class="controls">
						<input type="text" class="input-mini" name="up_filesize"
							value="<?php echo $empty?'8':$this->item['up_filesize']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_FILE_EXT")?>"
						title="<?php echo JText::_("T_UPLOAD_FILE_EXT")?>"><?php echo JText::_( 'UPLOAD_FILE_EXT' ); ?></label>
					<div class="controls">
						<input type="text" class="input-xlarge" name="up_extensions"
							value="<?php echo $this->item['up_extensions']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_FILE_MIME")?>"
						title="<?php echo JText::_("T_UPLOAD_FILE_MIME")?>"><?php echo JText::_( 'UPLOAD_FILE_MIME' ); ?></label>
					<div class="controls">
						<input type="text" class="input-xlarge" name="up_mimetypes"
							value="<?php echo $this->item['up_mimetypes']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_FILE_FOLDER")?>"
						title="<?php echo JText::_("T_UPLOAD_FILE_FOLDER")?>"><?php echo JText::_( 'UPLOAD_FILE_FOLDER' ); ?></label>
					<div class="input-prepend">
						<span class="add-on">/images/stories/</span> <input type="text"
							class="input-xlarge" name="up_folder"
							value="<?php echo $this->item['up_folder']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_MAX_FILES")?>"
						title="<?php echo JText::_("T_UPLOAD_MAX_FILES")?>"><?php echo JText::_( 'UPLOAD_MAX_FILES' ); ?></label>
					<div class="controls">
						<input type="text" class="input-mini" name="up_maxuploadfiles"
							value="<?php echo $empty?'10':$this->item['up_maxuploadfiles']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_UPLOAD_PREFIX")?>"
						title="<?php echo JText::_("T_UPLOAD_PREFIX")?>"><?php echo JText::_( 'UPLOAD_PREFIX' ); ?></label>
					<div class="controls">
						<select name="up_prefix">
							<option value="-1"
								<?php echo $this->item['up_prefix']=='-1'?'selected="selected"':'';?>><?php echo JText::_( 'SELECT' ); ?></option>
							<option value="0"
								<?php echo $this->item['up_prefix']=='0'?'selected="selected"':'';?>><?php echo JText::_( 'PREFIX_DATETIME' ); ?></option>
							<option value="1"
								<?php echo $this->item['up_prefix']=='1'?'selected="selected"':'';?>><?php echo JText::_( 'PREFIX_USER' ); ?></option>
							<option value="2"
								<?php echo $this->item['up_prefix']=='2'?'selected="selected"':'';?>><?php echo JText::_( 'PREFIX_IDCALC' ); ?></option>
							<option value="3"
								<?php echo $this->item['up_prefix']=='3'?'selected="selected"':'';?>><?php echo JText::_( 'PREFIX_DATETIME_USER' ); ?></option>
							<option value="4"
								<?php echo $this->item['up_prefix']=='4'?'selected="selected"':'';?>><?php echo JText::_( 'PREFIX_DATETIME_USER_IDCALC' ); ?></option>
						</select>
					</div>
				</div>
			</div>
		</div>
		<div id="print" class="tab-pane fade in">
			<div class="form-horizontal row-flow">			
				<ul class="nav nav-pills nav-justified" role="tablist">
				  <li role="presentation" class="active"><a  id="printemail-tab" data-toggle="tab"  href="#printemail"><?php echo JText::_("T_PRINT_EMAIL")?></a></li>
				  <li role="presentation"><a id="printpdf-tab" data-toggle="tab" href="#printpdf"><?php echo JText::_("T_PRINT_PDF")?></a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane in active form-horizontal row-flow" id="printemail">
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_EMAIL_ADD_PDF")?>"
								title="<?php echo JText::_("T_EMAIL_ADD_PDF")?>"><?php echo JText::_( 'EMAIL_ADD_PDF' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo ($this->item['emailaddpdf']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $this->item['emailaddpdf']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="emailaddpdf"
										value="<?php echo $this->item['emailaddpdf'];?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_INCLUDE_INPUT")?>"
								title="<?php echo JText::_("T_INCLUDE_INPUT")?>"><?php echo JText::_( 'INCLUDE_INPUT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo ($this->item['include_input']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $this->item['include_input']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="include_input"
										value="<?php echo $this->item['include_input'];?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_INCLUDE_RESULT")?>"
								title="<?php echo JText::_("T_INCLUDE_RESULT")?>"><?php echo JText::_( 'INCLUDE_RESULT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo ($this->item['include_result']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $this->item['include_result']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="include_result"
										value="<?php echo $this->item['include_result'];?>" />
								</div>
							</div>
						</div>				
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_PRINT_PRECALC_TEXT")?>"
								title="<?php echo JText::_("T_PRINT_PRECALC_TEXT")?>"><?php echo JText::_( 'PRINT_PRECALC_TEXT' ); ?></label>
							<div class="controls">
						    <?php
										echo $editor_precalc->display ( 'precalcprint', $this->item ['precalcprint'], '80%', '400', '100', '6' );
										?>  															
						</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_PRINT_POSCALC_TEXT")?>"
								title="<?php echo JText::_("T_PRINT_POSCALC_TEXT")?>"><?php echo JText::_( 'PRINT_POSCALC_TEXT' ); ?></label>
							<div class="controls">
						    <?php
										echo $editor_poscalc->display ( 'poscalcprint', $this->item ['poscalcprint'], '80%', '400', '100', '6' );
										?>  															
						</div>
						</div>
					</div>					
					<div class="tab-pane fade in form-horizontal row-flow" id="printpdf"">
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_PDF_ORIENTATION")?>"
								title="<?php echo JText::_("T_PDF_ORIENTATION")?>"><?php echo JText::_( 'PDF_ORIENTATION' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn <?php echo ($this->item['pdf_orientation']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('PORTRAIT')?></button>
									<button type="button"
										class="btn <?php echo $this->item['pdf_orientation']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('LANDSCAPE')?></button>
									<input type="hidden" class="radio_hidden" name="pdf_orientation"
										value="<?php echo $this->item['pdf_orientation'];?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_INCLUDE_INPUT")?>"
								title="<?php echo JText::_("T_INCLUDE_INPUT")?>"><?php echo JText::_( 'INCLUDE_INPUT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo ($this->item['include_input_pdf']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $this->item['include_input_pdf']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="include_input_pdf"
										value="<?php echo $this->item['include_input_pdf'];?>" />
								</div>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_INCLUDE_RESULT")?>"
								title="<?php echo JText::_("T_INCLUDE_RESULT")?>"><?php echo JText::_( 'INCLUDE_RESULT' ); ?></label>
							<div class="controls">
								<div class="btn-group cb_radio" data-toggle="buttons-radio">
									<button type="button"
										class="btn btn_no <?php echo ($this->item['include_result_pdf']=='0'||$empty)?'active':'';?>"
										aria-label="0"><?php echo JText::_('NO')?></button>
									<button type="button"
										class="btn btn_yes <?php echo $this->item['include_result_pdf']=='1'?'active':'';?>"
										aria-label="1"><?php echo JText::_('YES')?></button>
									<input type="hidden" class="radio_hidden" name="include_result_pdf"
										value="<?php echo $this->item['include_result_pdf'];?>" />
								</div>
							</div>
						</div>				
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_PRINT_PRECALC_TEXT")?>"
								title="<?php echo JText::_("T_PRINT_PRECALC_TEXT")?>"><?php echo JText::_( 'PRINT_PRECALC_TEXT' ); ?></label>
							<div class="controls">
						    <?php
										echo $editor_precalcpdf->display ( 'precalcprintpdf', $this->item ['precalcprintpdf'], '80%', '400', '100', '6' );
										?>  															
						</div>
						</div>
						<div class="control-group">
							<label class="control-label" rel="tooltip"
								data-original-title="<?php echo JText::_("T_PRINT_POSCALC_TEXT")?>"
								title="<?php echo JText::_("T_PRINT_POSCALC_TEXT")?>"><?php echo JText::_( 'PRINT_POSCALC_TEXT' ); ?></label>
							<div class="controls">
						    <?php
										echo $editor_poscalcpdf->display ( 'poscalcprintpdf', $this->item ['poscalcprintpdf'], '80%', '400', '100', '6' );
										?>  															
						</div>
						</div>
					</div>
				</div>
			
				
			</div>
		</div>
		<div id="events" class="tab-pane fade in">
			<div class="row-fluid" style="width: 98%">
				<div class="span4">
					<blockquote>
						<p><?php echo JText::_( 'JAVASCRIPT_EVENTS_HELP_TITLE' ); ?></p>
					</blockquote>
					<div id="js_code_tweaks">
						<div class="group">
							<div class="heading">Get Value from field</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number, Date, Option List, Linked List, Yes/No, Text,
										Textarea, TextAutocompleter, Multiple Option</small>
									<h6>
										<div id="js_code_1" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="#js_code_1" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>var result=cb_getValue('myvar');</pre>
									<h5>Result:</h5>
									<small>If the field is unique, returs the value of the field.</small><br />
									<small>If the field is in Section or is a Multiple Option,
										returns an array of values.</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">Set Value to Field</div>
							<div class="body">
								<div class="inner">
									<h5>Types:</h5>
									<small>Number, Date, Option List, Linked List, Yes/No, Text,
										Textarea, TextAutocompleter, Multiple Option</small>
									<h6>
										<div id="#js_code_2" class="modal hide fade">
											<div class="modal-header"></div>
											<div class="modal-body">
												<p>
													<img
														src="<?php echo JURI::base(true);?>/components/com_calcbuilder/assets/img/code/code_1.png" />
												</p>
											</div>
											<div class="modal-footer">
												<a href="#" class="btn" data-dismiss="modal">Close</a>
											</div>
										</div>
										<a href="#" data-target="##js_code_2" role="button" class=""
											data-toggle="modal">Field Configuration</a>
									</h6>
									<h5>Code:</h5>
									<pre>cb_setValue('myvar','NEW_VALUE');</pre>
									<h5>Result:</h5>
									<small>Set the value into the field. If the field is in section
										it applies to all fields.</small>
								</div>
							</div>
						</div>
						<div class="group">
							<div class="heading">jQuery use</div>
							<div class="body">
								<div class="inner">
									<h5>Code:</h5>
									<pre>CB('SELECTOR')</pre>
									<small>Use CB instead of $</small><br /> <small>$ is reserved
										for Mootools</small>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="span8">
					<div class="tabbable tabs-below">
						<div class="tab-content">
							<div id="A" class="tab-pane active">
								<p>
									<textarea id="js_ta_A" name="js_event_code" style="width: 90%"
										rows="15"><?php echo $this->item['js_event_code']!=null?$this->item['js_event_code']:'';?></textarea>
								</p>
							</div>
							<div id="B" class="tab-pane">
								<p>
									<textarea id="js_ta_B" name="js_functions" style="width: 90%"
										rows="15"><?php echo $this->item['js_functions'];?></textarea>
								</p>
							</div>
							<div id="C" class="tab-pane">
								<p>
									<textarea id="js_ta_C" name="js_pre_calc_button"
										style="width: 90%" rows="15"><?php echo $this->item['js_pre_calc_button'];?></textarea>
								</p>
							</div>
							<div id="D" class="tab-pane">
								<p>
									<textarea id="js_ta_D" name="js_post_calc_button"
										style="width: 90%" rows="15"><?php echo $this->item['js_post_calc_button'];?></textarea>
								</p>
							</div>
							<div id="E" class="tab-pane">
								<p>
									<textarea id="js_ta_E" name="js_reset_button"
										style="width: 90%" rows="15"><?php echo $this->item['js_reset_button'];?></textarea>
								</p>
							</div>
						</div>
						<ul class="nav nav-tabs">
							<li class="active"><a data-toggle="tab" href="#A"><?php echo JText::_( 'JAVASCRIPT_EVENTS' ); ?></a></li>
							<li><a data-toggle="tab" href="#B"><?php echo JText::_( 'JAVASCRIPT_FUNCTIONS' ); ?></a></li>
							<li><a data-toggle="tab" href="#C"><?php echo JText::_( 'JAVASCRIPT_PRE_CALC_BUTTON' ); ?></a></li>
							<li><a data-toggle="tab" href="#D"><?php echo JText::_( 'JAVASCRIPT_POST_CALC_BUTTON' ); ?></a></li>
							<li><a data-toggle="tab" href="#E"><?php echo JText::_( 'JAVASCRIPT_RESET_BUTTON' ); ?></a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div id="email" class="tab-pane fade in">
			<div class="tab-pane fade in form-horizontal row-flow">
				<blockquote>
						<p><?php echo JText::_( 'EMAIL_HELP_TITLE' ); ?></p>
				</blockquote>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_EMAIL_SEND_FORM")?>"
						title="<?php echo JText::_("T_EMAIL_SEND_FORM")?>"><?php echo JText::_( 'EMAIL_SEND_FORM' ); ?></label>
					<div class="controls">
						<div class="input-append emailfield-input">
							<div class="btn-group">
								<button class="btn dropdown-toggle" data-toggle="dropdown"><?php echo JText::_('FIELDS')?> <span
										class="caret"></span>
								</button>
								<ul class="dropdown-menu">
		                <?php
																		foreach ( $this->fields as $field ) {
																			if ($field->type == '4') {
																				?>
		                  <li><a emailfield="$<?php
																				
echo $field->var;
																				?>"><?php echo $field->name;?></a></li>
		                  <?php } ?>
		                <?php } ?>		                  				                  
		                </ul>
							</div>
							<input type="text" class="input-xlarge" name="sendemailform"
								value="<?php echo $this->item['sendemailform']; ?>" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_EMAIL_SEND_CC")?>"
						title="<?php echo JText::_("T_EMAIL_SEND_CC")?>"><?php echo JText::_( 'EMAIL_SEND_CC' ); ?></label>
					<div class="controls">						
							<input type="text" class="input-xlarge" name="sendemailcc" value="<?php echo $this->item['sendemailcc']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_EMAIL_SEND_BCC")?>"
						title="<?php echo JText::_("T_EMAIL_SEND_BCC")?>"><?php echo JText::_( 'EMAIL_SEND_BCC' ); ?></label>
					<div class="controls">						
							<input type="text" class="input-xlarge" name="sendemailbcc" value="<?php echo $this->item['sendemailbcc']; ?>" />
					</div>
				</div>
				<blockquote>
						<p><?php echo JText::_( 'MAILCHIMP_HELP_TITLE' ); ?></p>
				</blockquote>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_APPLY")?>"
						title="<?php echo JText::_("T_MC_APPLY")?>"><?php echo JText::_( 'MC_APPLY' ); ?></label>
					<div class="controls">
						<div class="btn-group cb_radio" data-toggle="buttons-radio">
							<button type="button"
								class="btn btn_no <?php echo (!isset($this->item['mc_apply'])||$this->item['mc_apply'])=='0'?'active':'';?>"
								aria-label="0"><?php echo JText::_('CB_NO')?></button>
							<button type="button"
								class="btn btn_yes <?php echo $this->item['mc_apply']=='1'?'active':'';?>"
								aria-label="1"><?php echo JText::_('CB_YES')?></button>
							<input type="hidden" class="radio_hidden" name="mc_apply"
								value="<?php echo $this->item['mc_apply'];?>" />
						</div>
					</div>
				</div>				
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_API_KEY")?>"
						title="<?php echo JText::_("T_MC_API_KEY")?>"><?php echo JText::_( 'MC_API_KEY' ); ?></label>
					<div class="controls">						
							<input type="text" class="input-xxlarge" name="mc_api" value="<?php echo $this->item['mc_api']; ?>" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_EMAIL")?>"
						title="<?php echo JText::_("T_MC_EMAIL")?>"><?php echo JText::_( 'MC_EMAIL' ); ?></label>
					<div class="controls">						
							<div class="btn-group" data-toggle="buttons-radio">
							<select name="mc_email">
							<?php
							foreach ( $this->fields as $field ) {
								if ($field->type == '4') {
									?>
		                  <option value="<?php	echo $field->var;?>" <?php echo ($field->var==$this->item['mc_email'])?'selected=selected':'';?>><?php echo $field->name;?></option>
		                  <?php } ?>
		                <?php } ?>
							</select>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_LIST")?>"
						title="<?php echo JText::_("T_MC_LIST")?>"><?php echo JText::_( 'MC_LIST' ); ?></label>
					<div class="controls">						
							<div class="btn-group" data-toggle="buttons-radio">
							<?php if (isset($this->item['mc_api'])):?>
								<select name="mc_list">
								<?php //Mailchimp
								$mailchimp=new MailChimp($this->item['mc_api']);
								$mc_result=$mailchimp->call('lists/list', array());
								$lists=$mc_result['data'];
								foreach ($lists as $listitem):?>
									<option value="<?php echo $listitem['id'];?>" <?php echo ($listitem['id']==$this->item['mc_list'])?'selected="selected"':'';?>><?php echo $listitem['name'];?></option>		
								<?php endforeach; ?>
								</select>
							<?php endif;?>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_EMAIL_NAME")?>"
						title="<?php echo JText::_("T_MC_EMAIL_NAME")?>"><?php echo JText::_( 'MC_EMAIL_NAME' ); ?></label>
					<div class="controls">						
							<div class="btn-group" data-toggle="buttons-radio">
							<select name="mc_email_name">
							<option value=""><?php echo JText::_( 'SELECT' );?></option>
							<?php
							foreach ( $this->fields as $field ) {
								if ($field->type == '4') {
									?>
		                  <option value="<?php	echo $field->var;?>" <?php echo ($field->var==$this->item['mc_email_name'])?'selected=selected':'';?>><?php echo $field->name;?></option>
		                  <?php } ?>
		                <?php } ?>
							</select>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label cb_label_preferences" rel="tooltip"
						data-original-title="<?php echo JText::_("T_MC_EMAIL_LASTNAME")?>"
						title="<?php echo JText::_("T_MC_EMAIL_LASTNAME")?>"><?php echo JText::_( 'MC_EMAIL_LASTNAME' ); ?></label>
					<div class="controls">						
							<div class="btn-group" data-toggle="buttons-radio">							
							<select name="mc_email_lastname">
							<option value=""><?php echo JText::_( 'SELECT' );?></option>
							<?php
							foreach ( $this->fields as $field ) {
								if ($field->type == '4') {
									?>
		                  <option value="<?php	echo $field->var;?>" <?php echo ($field->var==$this->item['mc_email_lastname'])?'selected=selected':'';?>><?php echo $field->name;?></option>
		                  <?php } ?>
		                <?php } ?>
							</select>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<form action="index.php" method="post" name="adminForm" id="adminForm">
		<input type="hidden" name="id"
			value="<?php echo $this->item['id']; ?>" /> <input type="hidden"
			name="idutility" value="<?php echo $this->item['id']; ?>" /> <input
			type="hidden" name="cid[]" value="<?php echo $this->item['id']; ?>" />
		<input type="hidden" name="option" value="com_calcbuilder" /> <input
			type="hidden" name="task" value="store" /> <input type="hidden"
			name="boxchecked" value="0" /> <input type="hidden" name="controller"
			value="utility" /> <input type="hidden" name="check" value="post" />
		<input type="hidden" name="class" value="0" />
<?php echo JHtml::_( 'form.token' ); ?>
</form>
</div>