<?php /* Smarty version 2.6.26, created on 2017-04-18 10:59:51
         compiled from /home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'strpos', '/home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl', 2, false),array('modifier', 'cat', '/home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl', 5, false),array('modifier', 'explode', '/home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl', 34, false),array('modifier', 'trim', '/home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl', 35, false),array('function', 'counter', '/home3/bargaip4/public_html/gevimmo/plugins/multiField/mf_block_account.tpl', 11, false),)), $this); ?>
<?php if ($this->_tpl_vars['multi_formats'][$this->_tpl_vars['field']['Condition']]): ?>
	<?php if (((is_array($_tmp=$this->_tpl_vars['field']['Key'])) ? $this->_run_mod_handler('strpos', true, $_tmp, 'level') : strpos($_tmp, 'level')) === false): ?>
		<?php if ($this->_tpl_vars['post_form_key']): ?>
			<?php $this->assign('mf_form_key', $this->_tpl_vars['post_form_key']); ?>
			<?php $this->assign('mf_form_prefix', ((is_array($_tmp=$this->_tpl_vars['post_form_key'])) ? $this->_run_mod_handler('cat', true, $_tmp, '_') : smarty_modifier_cat($_tmp, '_'))); ?>
		<?php endif; ?>

		<?php $this->assign('last_field_key', $this->_tpl_vars['field']['Key']); ?>
		<?php $this->assign('last_post_value', $this->_tpl_vars['fVal'][$this->_tpl_vars['fKey']]); ?>

		<?php echo smarty_function_counter(array('start' => 1,'assign' => 'mf_index'), $this);?>

		<?php $_from = $this->_tpl_vars['fVal']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['pval']):
?>
			<?php $this->assign('field_key', ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['field']['Key'])) ? $this->_run_mod_handler('cat', true, $_tmp, '_level') : smarty_modifier_cat($_tmp, '_level')))) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['mf_index']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['mf_index']))); ?>
			<?php if ($this->_tpl_vars['fVal'][$this->_tpl_vars['field_key']]): ?>
				<?php echo smarty_function_counter(array(), $this);?>

				<?php $this->assign('last_field_key', $this->_tpl_vars['field_key']); ?>
				<?php $this->assign('last_post_value', $this->_tpl_vars['fVal'][$this->_tpl_vars['field_key']]); ?>
			<?php endif; ?>
		<?php endforeach; endif; unset($_from); ?>

		<?php if (! $this->_tpl_vars['last_post_value']): ?>
			<?php $_from = $this->_tpl_vars['field']['Values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['dvalue']):
?>
				<?php if ($this->_tpl_vars['dvalue']['Default']): ?>
					<?php $this->assign('last_post_value', $this->_tpl_vars['dvalue']['Key']); ?>
					<?php $this->assign('last_field_key', $this->_tpl_vars['field']['Key']); ?>
				<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		<?php endif; ?>

		<input type="hidden" value="<?php echo $this->_tpl_vars['last_post_value']; ?>
" id="<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
_val" />
		<input type="hidden" value="<?php echo $this->_tpl_vars['last_field_key']; ?>
" id="<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
_lastsel" />
	<?php endif; ?>

	<?php $this->assign('tmp', ((is_array($_tmp='level')) ? $this->_run_mod_handler('explode', true, $_tmp, $this->_tpl_vars['field']['Key']) : explode($_tmp, $this->_tpl_vars['field']['Key']))); ?>
	<input type="hidden" value="<?php echo $this->_tpl_vars['field']['Key']; ?>
" class="<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo ((is_array($_tmp=$this->_tpl_vars['tmp']['0'])) ? $this->_run_mod_handler('trim', true, $_tmp, '_') : trim($_tmp, '_')); ?>
_mf" />

	<script type="text/javascript">
		<?php echo '
		$(document).ready(function(){
			'; ?>

			<?php if ($this->_tpl_vars['mf_form_key']): ?>
				var post_form_dom = 'form:has(input[value=<?php echo $this->_tpl_vars['mf_form_key']; ?>
],name=[post_form_key]) ';
			<?php else: ?>
				var post_form_dom = '';
			<?php endif; ?><?php echo '

			if( \''; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '\'.indexOf(\'level\') > 0 && $(post_form_dom + \'select[name="account['; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo ']"]\').val() == "0" )
			{
				var top_field = trim(\''; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '\'.split(\'level\')[0], \'_\');
				var level = \''; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '\'.split(\'level\')[1];
				var prev_level = level-1;
				var prev_field = level > 1 ? top_field + \'_level\' + prev_level : top_field;

				if( !$(post_form_dom + \'select[name="account[\'+prev_field+\']"]\').val() || $(post_form_dom + \'select[name="account[\'+prev_field+\']"]\').val() == "0" )
				{
					$(post_form_dom + \'select[name="account['; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo ']"]\').attr(\'disabled\', \'disabled\').addClass(\'disabled\');
				}
			}
			
			$(post_form_dom + \'select[name="account['; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo ']"]\').change(function(){
				'; ?>

				var top_field = trim('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[0], '_');

				var level = parseInt('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[1]) ? parseInt('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[1]) : 0;

				<?php echo '			
				if( $(this).val() == "0" )
				{
					if( level > 1 )
					{
						var prev_field = top_field +\'_level\'+(level-1);
					}
					else
					{
						var prev_field = top_field;
					}
					var prev_val = $(post_form_dom + \'select[name="account[\'+ prev_field +\']"]\').val();

					'; ?>

					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_lastsel').val( prev_field );
					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_val').val( prev_val );
					<?php echo '
				}else
				{
					'; ?>

					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_lastsel').val('<?php echo $this->_tpl_vars['field']['Key']; ?>
');
					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_val').val( $(this).val() );
					<?php echo '
				}
				
				if( $(this).val() != "0" && $(this).val() && $(post_form_dom + \'select[name="account[\'+top_field+\'_level\'+(level+1)+\']"]\').length > 0 )
				{
					xajax_mfGetNext( $(this).val(), $(this).attr(\'name\'), \''; ?>
<?php echo $this->_tpl_vars['mf_form_key']; ?>
<?php echo '\', $(\'.'; ?>
<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '_mf\').length, \'account\', '; ?>
'<?php echo $this->_tpl_vars['multi_formats'][$this->_tpl_vars['field']['Condition']]['Order_type']; ?>
'<?php echo ' );
				}
			});

			$(post_form_dom + \'select[name="f['; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo ']"]\').change(function(){
				'; ?>

				var top_field = trim('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[0], '_');

				var level = parseInt('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[1]) ? parseInt('<?php echo $this->_tpl_vars['field']['Key']; ?>
'.split('level')[1]) : 0;

				<?php echo '			
				if( $(this).val() == "0" )
				{
					if( level > 1 )
					{
						var prev_field = top_field +\'_level\'+(level-1);
					}
					else
					{
						var prev_field = top_field;
					}
					var prev_val = $(post_form_dom + \'select[name="f[\'+ prev_field +\']"]\').val();

					'; ?>

					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_lastsel').val( prev_field );
					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_val').val( prev_val );
					<?php echo '
				}else
				{
					'; ?>

					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_lastsel').val('<?php echo $this->_tpl_vars['field']['Key']; ?>
');
					$('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
'+top_field+'_val').val( $(this).val() );
					<?php echo '
				}
				
				if( $(this).val() != "0" && $(this).val() && $(post_form_dom + \'select[name="f[\'+top_field+\'_level\'+(level+1)+\']"]\').length > 0 )
				{
					xajax_mfGetNext( $(this).val(), $(this).attr(\'name\'), \''; ?>
<?php echo $this->_tpl_vars['mf_form_key']; ?>
<?php echo '\', $(\'.'; ?>
<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '_mf\').length, \'account\', '; ?>
'<?php echo $this->_tpl_vars['multi_formats'][$this->_tpl_vars['field']['Condition']]['Order_type']; ?>
'<?php echo ' );
				}
			});
			
			if( \''; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '\'.indexOf(\'level\') < 0 || \''; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
<?php echo '\'.indexOf(\'level\') == false)
			{
				'; ?>
	
				xajax_mfBuild( $('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
_val').val(), $('#<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
_lastsel').val(), '<?php echo $this->_tpl_vars['mf_form_key']; ?>
', $('.<?php echo $this->_tpl_vars['mf_form_prefix']; ?>
<?php echo $this->_tpl_vars['field']['Key']; ?>
_mf').length, 'account', '<?php echo $this->_tpl_vars['multi_formats'][$this->_tpl_vars['field']['Condition']]['Order_type']; ?>
' );
				<?php echo '
			}
		});
	'; ?>

	</script>
<?php endif; ?>
