<?php echo $this->render('admin/header.phtml'); ?>


<script type="text/javascript" language="javascript">

	$(document).ready(function () {

		<?php if( isset( $this->addProductSuccess ) ){ ?>
			alertify.success("<i class='fa fa-check'></i> <?php echo @Lib_Lang::translate(admin_product_add_success); ?>");
		<?php } ?>

		<?php if( isset( $this->editProductSuccess ) ){ ?>
			alertify.success("<i class='fa fa-check'></i> <?php echo @Lib_Lang::translate(admin_product_editproduct_success); ?>");
		<?php } ?>	
		
	});

</script>

<div class="container">		

<?php echo $this->render('admin/menu.phtml'); ?>
<?php echo $this->render('admin/productmenu.phtml'); ?>


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

		$('#formEditProduct').validate({
			errorClass: "formError",
			errorElement: "div",
			rules: {
				product_name: {
					required: true
				},
				image_product: {
					required: false
				}
			},
			messages: {
				product_name: {
					required: "<?php echo @Lib_Lang::translate(admin_product_required); ?>"
				}
			}
		});	
	
		$('[name="admin_editproduct"]').click(function(){
			/*if( $('#category_id0').val() == 0 ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_category_selecterr); ?>");
				return false;
			}else if( $('#category_id1').val() == 0 ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_category_selecterr); ?>");
				return false;
			}else{
				return true;
			}*/
			return true;
		});
	
	
	
		$(
			'[name="product_body"],[name="product_front"],[name="product_front_2"],[name="product_type"],[name="product_accessories"],[name="product_accessories_0"],[name="product_accessories_1"],[name="product_accessories_2"],[name="product_accessories_3"],[name="product_legs"],[name="product_handles"],[name="product_options"],[name="product_options2"]'
		).change(function(){
			if( $(this).val() == 0 ){
				$(this).css('background','silver');
			}else{
				$(this).css('background','lawngreen');			
			}
		});
	
	
	});

</script>

	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_product_edit_top); ?><br /><small><?php echo$this->ProductInfo['product_name']; ?></small></h3>
			
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>

	<?php echo $this->render('admin/producteditmenu.phtml'); ?>

		
	<form id="formEditProduct" method="post" class="form-horizontal">
	

	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_category_edit_top_general); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_name); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="product_name" class="form-control" value="<?php echo$this->rowProduct['product_name']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_code); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="product_code" class="form-control" value="<?php echo$this->rowProduct['product_code']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_price_scheme); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
			<select name="product_price_scheme" class="form-control">
			<?php for( $j = 0; $j != 5; $j++ ){ ?>
				<option value="<?php echo$j; ?>" <?php if($this->rowProduct['product_price_scheme'] == $j)echo'selected';?>><?php echo @Lib_Lang::consta(product_price_scheme_.$j); ?></option>
			<?php } ?>
			</select>		
		</div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_price); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" name="product_price" class="form-control" value="<?php echo$this->rowProduct['product_price']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_pack1); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="1" name="product_pack1" class="form-control" value="<?php echo$this->rowProduct['product_pack1']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_pack2); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="1" name="product_pack2" class="form-control" value="<?php echo$this->rowProduct['product_pack2']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_pack3); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="1" name="product_pack3" class="form-control" value="<?php echo$this->rowProduct['product_pack3']; ?>" /></div>
	</div>

	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_pack4); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="1" name="product_pack4" class="form-control" value="<?php echo$this->rowProduct['product_pack4']; ?>" /></div>
	</div>

	
	
	
		
			<?php if( $this->rowProduct['product_front'] == 1 ){ ?>
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop">ParF1</div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" min="0" name="product_front_price_praf1" class="form-control" value="<?php echo$this->rowProduct['product_front_price_praf1']; ?>" /></div>
	</div>
			<?php } ?>
		
			<?php if( $this->rowProduct['product_front_2'] == 1 ){ ?>
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop">ParF2</div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" min="0" name="product_front_price_praf2" class="form-control" value="<?php echo$this->rowProduct['product_front_price_praf2']; ?>" /></div>
	</div>
			<?php } ?>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_image_main); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product" class="form-control fileInput" />
		
		<div id="message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_image'] ){ ?>
	$("#message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message").css({'display':'block'});
	$("#finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphoto'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_image']; ?>'}, function(){$("#message").css({'display':'none'});$("#message").html('');});
	<?php } ?>

	$("[name='image_product']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto").html('');
			$("#message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphoto'), 'default', true); ?>", 
					type: "POST",  
					data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message").css({'display':'none'});
						$("#message").html('');
						$("#finishPhoto").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>


	
	
	
	
	
	
	
	
<?php
	for( $i = 1; $i <= 8; $i++ ){
?>	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_image); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$i; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$i; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$i; ?>"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_image_'.$i] ){ ?>
	$("#message_<?php echo$i; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$i; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$i; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphoto2', 'num' => $i), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_image_'.$i]; ?>'}, function(){$("#message_<?php echo$i; ?>").css({'display':'none'});$("#message_<?php echo$i; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$i; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$i; ?>").html('');
			$("#message_<?php echo$i; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$i; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphoto2', 'num' => $i), 'default', true); ?>", 
					type: "POST",  
					data: {'image_product_<?php echo$i; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$i; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$i; ?>").css({'display':'none'});
						$("#message_<?php echo$i; ?>").html('');
						$("#finishPhoto_<?php echo$i; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>


<?php
	}
?>	






















	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_parent); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8 formLabelMarginTop" id="categoryMargin">
	
<script type="text/javascript" language="javascript">

	$(document).ready(function () {			
	
		$("#changeCategory0").click(function(){
			$( "#categoryBox0" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddcategory'), 'default', true); ?>", {category_id: 0, category_type: 0}, function(){$("#categoryMargin").removeClass('formLabelMarginTop');} );
			$("#category_id0").val('0');
		});

		
	});
	
</script>
	
			<div id="categoryBox0">	
		
		<?php 
			if( $this->rowProduct['category_id'] > 0 ){
				$Lib_Category = new Lib_Category();
				$dataCategoryParent = $Lib_Category->parentListO($this->rowProduct['category_id']); 
				foreach($dataCategoryParent as $k => $v):
					echo $v['category_name'].' &rarr; ';
				endforeach;
			}else{
				echo @Lib_Lang::translate(admin_category_parent_no);
			}
		?><br />
		<a class="btn btn-primary btn-xs" href="javascript:void(0);" id="changeCategory0"><?php echo @Lib_Lang::translate(admin_product_parent_change); ?></a></div>
			<input type="hidden" name="category_id0" id="category_id0" value="<?php echo$this->rowProduct['category_id']; ?>" />



		</div>
	</div>



	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_parent_1); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8 formLabelMarginTop" id="categoryMargin">
	
<script type="text/javascript" language="javascript">

	$(document).ready(function () {			
	
		$("#changeCategory1").click(function(){
			$( "#categoryBox1" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddcategory'), 'default', true); ?>", {category_id: 0, category_type: 1}, function(){$("#categoryMargin").removeClass('formLabelMarginTop');} );
			$("#category_id1").val('0');
		});

		
	});
	
</script>
	
			<div id="categoryBox1">	
		
		<?php 
			if( $this->rowProduct['category_id1'] > 0 ){
				$Lib_Category = new Lib_Category();
				$dataCategoryParent = $Lib_Category->parentListO($this->rowProduct['category_id1'],1); 
				foreach($dataCategoryParent as $k => $v):
					echo $v['category_name'].' &rarr; ';
				endforeach;
			}else{
				echo @Lib_Lang::translate(admin_category_parent_no);
			}
		?><br />
		<a class="btn btn-primary btn-xs" href="javascript:void(0);" id="changeCategory1"><?php echo @Lib_Lang::translate(admin_product_parent_change); ?></a></div>
			<input type="hidden" name="category_id1" id="category_id1" value="<?php echo$this->rowProduct['category_id1']; ?>" />



		</div>
	</div>



	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_category_edit_top_option); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>	


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_body); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_body" class="form-control" style="background:<?php if( $this->rowProduct['product_body'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;" >
				<option value="0" <?php if( $this->rowProduct['product_body'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_body'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_front); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_front" class="form-control" style="background:<?php if( $this->rowProduct['product_front'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_front'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_front'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_front_2); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_front_2" class="form-control" style="background:<?php if( $this->rowProduct['product_front_2'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_front_2'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_front_2'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_type); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_type" class="form-control" style="background:<?php if( $this->rowProduct['product_type'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_type'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_type'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_accessories); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_accessories" class="form-control" style="background:<?php if( $this->rowProduct['product_accessories'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_accessories'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_accessories'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_accessories'] == 0 ){ ?>
			$('#productAccessories').hide();
		<?php } ?>
	
	
		$('[name="product_accessories"]').change(function(){
		
			if( $(this).val() == 0 ){
				$('#productAccessories').hide();
			}else{
				$('#productAccessories').show();
			}
		
		});
	
	});

</script>
		
		</div>
	</div>
			<div class="row" style="margin-left:15px;" id="productAccessories">
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_product_accessories_0); ?>		
						<select name="product_accessories_0" class="form-control" style="background:<?php if( $this->rowProduct['product_accessories_0'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
							<option value="0" <?php if( $this->rowProduct['product_accessories_0'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
							<option value="1" <?php if( $this->rowProduct['product_accessories_0'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
						</select>
					</div>	
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_product_accessories_1); ?>		
						<select name="product_accessories_1" class="form-control" style="background:<?php if( $this->rowProduct['product_accessories_1'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
							<option value="0" <?php if( $this->rowProduct['product_accessories_1'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
							<option value="1" <?php if( $this->rowProduct['product_accessories_1'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
						</select>
					</div>		
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_product_accessories_2); ?>		
						<select name="product_accessories_2" class="form-control" style="background:<?php if( $this->rowProduct['product_accessories_2'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
							<option value="0" <?php if( $this->rowProduct['product_accessories_2'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
							<option value="1" <?php if( $this->rowProduct['product_accessories_2'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
						</select>
					</div>	
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_product_accessories_3); ?>		
						<select name="product_accessories_3" class="form-control" style="background:<?php if( $this->rowProduct['product_accessories_3'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
							<option value="0" <?php if( $this->rowProduct['product_accessories_3'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
							<option value="1" <?php if( $this->rowProduct['product_accessories_3'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
						</select>
					</div>					
			
			</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_legs); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_legs" class="form-control" style="background:<?php if( $this->rowProduct['product_legs'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_legs'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_legs'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_handles); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_handles" class="form-control" style="background:<?php if( $this->rowProduct['product_handles'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_handles'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_handles'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		</div>
	</div>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_options1); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_options" class="form-control" style="background:<?php if( $this->rowProduct['product_options'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_options'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_options'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_options'] == 0 ){ ?>
			$('#productOptions').hide();
		<?php } ?>
	
	
		$('[name="product_options"]').change(function(){
		
			if( $(this).val() == 0 ){
				$('#productOptions').hide();
			}else{
				$('#productOptions').show();
			}
		
		});
	
	});

</script>
		
		</div>
	</div>
			<div class="row" style="margin-left:15px;" id="productOptions">
						
						
						
						
						
						
						
						
						
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_1); ?>		
						<input type="number" step="0.01" min="0" name="product_options_1" value="<?php echo$this->rowProduct['product_options_1']; ?>" class="form-control" />
					</div>	

					<?php
						$iOption = 1;
					?>
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-bottom:15px;margin-bottom:15px;">
						<input type="file" name="product_options_<?php echo$iOption; ?>_image" class="form-control fileInput" />
						<div id="product_options_<?php echo$iOption; ?>_message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
						<div class="row" id="product_options_<?php echo$iOption; ?>_finishPhoto"></div>
					</div>
					
					<script type="text/javascript" language="javascript">
						
					$(document).ready(function () {

						<?php if( $this->rowProduct['product_options_'.$iOption.'_img'] ){ ?>
						$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
						$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
						$("#product_options_<?php echo$iOption; ?>_finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotooption'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_options_'.$iOption.'_img']; ?>', opt: <?php echo$iOption; ?>}, function(){$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});$("#product_options_<?php echo$iOption; ?>_message").html('');});
						<?php } ?>

						$("[name='product_options_<?php echo$iOption; ?>_image']").change(function() {
							var file = this.files[0];
							var imagefile = file.type;
							var imagename = file.name;
							var imagesize = file.size;
							
							if(imagesize > 1024*1024){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
							}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
							}else{
								$("#product_options_<?php echo$iOption; ?>_finishPhoto").html('');
								$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
								$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
								$("input").attr('disabled','disabled');
								var reader = new FileReader();
								reader.onload = function(){
								  var dataURL = reader.result;
								  
									$.ajax({
										url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotooption'), 'default', true); ?>", 
										type: "POST",  
										data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, ""), opt: <?php echo$iOption; ?>},     
										success: function(data)  
										{
											var control = $("[name='product_options_<?php echo$iOption; ?>_image']");
											control.replaceWith( control = control.clone( true ) );
											$("input").removeAttr('disabled');
											$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});
											$("#product_options_<?php echo$iOption; ?>_message").html('');
											$("#product_options_<?php echo$iOption; ?>_finishPhoto").html(data);
										}
									});
									
								};
								reader.readAsDataURL(this.files[0]);
							}
							
						});
						
					});

					</script>					
					
					
					
					
					
					
					
					
					
					
					
					
					
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_2) ?>		
						<input type="number" step="0.01" min="0" name="product_options_2" value="<?php echo$this->rowProduct['product_options_2']; ?>" class="form-control" />
					</div>		

					<?php
						$iOption = 2;
					?>
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-bottom:15px;margin-bottom:15px;">
						<input type="file" name="product_options_<?php echo$iOption; ?>_image" class="form-control fileInput" />
						<div id="product_options_<?php echo$iOption; ?>_message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
						<div class="row" id="product_options_<?php echo$iOption; ?>_finishPhoto"></div>
					</div>
					
					<script type="text/javascript" language="javascript">
						
					$(document).ready(function () {

						<?php if( $this->rowProduct['product_options_'.$iOption.'_img'] ){ ?>
						$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
						$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
						$("#product_options_<?php echo$iOption; ?>_finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotooption'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_options_'.$iOption.'_img']; ?>', opt: <?php echo$iOption; ?>}, function(){$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});$("#product_options_<?php echo$iOption; ?>_message").html('');});
						<?php } ?>

						$("[name='product_options_<?php echo$iOption; ?>_image']").change(function() {
							var file = this.files[0];
							var imagefile = file.type;
							var imagename = file.name;
							var imagesize = file.size;
							
							if(imagesize > 1024*1024){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
							}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
							}else{
								$("#product_options_<?php echo$iOption; ?>_finishPhoto").html('');
								$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
								$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
								$("input").attr('disabled','disabled');
								var reader = new FileReader();
								reader.onload = function(){
								  var dataURL = reader.result;
								  
									$.ajax({
										url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotooption'), 'default', true); ?>", 
										type: "POST",  
										data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, ""), opt: <?php echo$iOption; ?>},     
										success: function(data)  
										{
											var control = $("[name='product_options_<?php echo$iOption; ?>_image']");
											control.replaceWith( control = control.clone( true ) );
											$("input").removeAttr('disabled');
											$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});
											$("#product_options_<?php echo$iOption; ?>_message").html('');
											$("#product_options_<?php echo$iOption; ?>_finishPhoto").html(data);
										}
									});
									
								};
								reader.readAsDataURL(this.files[0]);
							}
							
						});
						
					});

					</script>		




					
		
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_3); ?>		
						<input type="number" step="0.01" min="0" name="product_options_3" value="<?php echo$this->rowProduct['product_options_3']; ?>" class="form-control" />
					</div>		

					<?php
						$iOption = 3;
					?>
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-bottom:15px;margin-bottom:15px;">
						<input type="file" name="product_options_<?php echo$iOption; ?>_image" class="form-control fileInput" />
						<div id="product_options_<?php echo$iOption; ?>_message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
						<div class="row" id="product_options_<?php echo$iOption; ?>_finishPhoto"></div>
					</div>
					
					<script type="text/javascript" language="javascript">
						
					$(document).ready(function () {

						<?php if( $this->rowProduct['product_options_'.$iOption.'_img'] ){ ?>
						$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
						$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
						$("#product_options_<?php echo$iOption; ?>_finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotooption'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_options_'.$iOption.'_img']; ?>', opt: <?php echo$iOption; ?>}, function(){$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});$("#product_options_<?php echo$iOption; ?>_message").html('');});
						<?php } ?>

						$("[name='product_options_<?php echo$iOption; ?>_image']").change(function() {
							var file = this.files[0];
							var imagefile = file.type;
							var imagename = file.name;
							var imagesize = file.size;
							
							if(imagesize > 1024*1024){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
							}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
							}else{
								$("#product_options_<?php echo$iOption; ?>_finishPhoto").html('');
								$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
								$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
								$("input").attr('disabled','disabled');
								var reader = new FileReader();
								reader.onload = function(){
								  var dataURL = reader.result;
								  
									$.ajax({
										url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotooption'), 'default', true); ?>", 
										type: "POST",  
										data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, ""), opt: <?php echo$iOption; ?>},     
										success: function(data)  
										{
											var control = $("[name='product_options_<?php echo$iOption; ?>_image']");
											control.replaceWith( control = control.clone( true ) );
											$("input").removeAttr('disabled');
											$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});
											$("#product_options_<?php echo$iOption; ?>_message").html('');
											$("#product_options_<?php echo$iOption; ?>_finishPhoto").html(data);
										}
									});
									
								};
								reader.readAsDataURL(this.files[0]);
							}
							
						});
						
					});

					</script>		
					
					
					
					
					
					
				
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_4); ?>		
						<input type="number" step="0.01" min="0" name="product_options_4" value="<?php echo$this->rowProduct['product_options_4']; ?>" class="form-control" />
					</div>	

					<?php
						$iOption = 4;
					?>
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-bottom:15px;margin-bottom:15px;">
						<input type="file" name="product_options_<?php echo$iOption; ?>_image" class="form-control fileInput" />
						<div id="product_options_<?php echo$iOption; ?>_message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
						<div class="row" id="product_options_<?php echo$iOption; ?>_finishPhoto"></div>
					</div>
					
					<script type="text/javascript" language="javascript">
						
					$(document).ready(function () {

						<?php if( $this->rowProduct['product_options_'.$iOption.'_img'] ){ ?>
						$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
						$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
						$("#product_options_<?php echo$iOption; ?>_finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotooption'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_options_'.$iOption.'_img']; ?>', opt: <?php echo$iOption; ?>}, function(){$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});$("#product_options_<?php echo$iOption; ?>_message").html('');});
						<?php } ?>

						$("[name='product_options_<?php echo$iOption; ?>_image']").change(function() {
							var file = this.files[0];
							var imagefile = file.type;
							var imagename = file.name;
							var imagesize = file.size;
							
							if(imagesize > 1024*1024){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
							}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
							}else{
								$("#product_options_<?php echo$iOption; ?>_finishPhoto").html('');
								$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
								$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
								$("input").attr('disabled','disabled');
								var reader = new FileReader();
								reader.onload = function(){
								  var dataURL = reader.result;
								  
									$.ajax({
										url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotooption'), 'default', true); ?>", 
										type: "POST",  
										data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, ""), opt: <?php echo$iOption; ?>},     
										success: function(data)  
										{
											var control = $("[name='product_options_<?php echo$iOption; ?>_image']");
											control.replaceWith( control = control.clone( true ) );
											$("input").removeAttr('disabled');
											$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});
											$("#product_options_<?php echo$iOption; ?>_message").html('');
											$("#product_options_<?php echo$iOption; ?>_finishPhoto").html(data);
										}
									});
									
								};
								reader.readAsDataURL(this.files[0]);
							}
							
						});
						
					});

					</script>		
					
					
					
					
					
						
			
			</div>
						
						
						
						
						
						
						
						
						
						
						
	


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_options2); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_options2" class="form-control" style="background:<?php if( $this->rowProduct['product_options2'] == 0 ){ ?>silver<?php }else{ ?>lawngreen<?php } ?>;">
				<option value="0" <?php if( $this->rowProduct['product_options2'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_options2'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_options_1); ?></option>
			</select>
		
		

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_options2'] == 0 ){ ?>
			$('#productOptions2').hide();
		<?php } ?>
	
	
		$('[name="product_options2"]').change(function(){
		
			if( $(this).val() == 0 ){
				$('#productOptions2').hide();
			}else{
				$('#productOptions2').show();
			}
		
		});
	
	});

</script>
		
		</div>
	</div>					
			<div class="row" style="margin-left:15px;" id="productOptions2">
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_wd); ?>		
						
						<select name="product_options_wd" class="form-control">
							<option value="0" <?php if($this->rowProduct['product_options_wd']==0)echo'selected';?>><?php echo @Lib_Lang::translate(admin_product_options_wd0); ?></option>
							<option value="1" <?php if($this->rowProduct['product_options_wd']==1)echo'selected';?>><?php echo @Lib_Lang::translate(admin_product_options_wd1); ?></option>
						</select>
					</div>	
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_ww0); ?>		
						<input type="number" step="0.01" min="0" name="product_options_ww0" value="<?php echo$this->rowProduct['product_options_ww0']; ?>" class="form-control" />
					</div>	
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_ww1); ?>		
						<input type="number" step="0.01" min="0" name="product_options_ww1" value="<?php echo$this->rowProduct['product_options_ww1']; ?>" class="form-control" />
					</div>	
						
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:15px;padding-bottom:15px;">
						<?php echo @Lib_Lang::translate(admin_product_options_rp); ?>		
						
						<select name="product_options_rp" class="form-control">
							<option value="0" <?php if($this->rowProduct['product_options_rp']==0)echo'selected';?>><?php echo @Lib_Lang::translate(admin_product_options_rp0); ?></option>
							<option value="1" <?php if($this->rowProduct['product_options_rp']==1)echo'selected';?>><?php echo @Lib_Lang::translate(admin_product_options_rp1); ?></option>
							<option value="2" <?php if($this->rowProduct['product_options_rp']==2)echo'selected';?>><?php echo @Lib_Lang::translate(admin_product_options_rp2); ?></option>
						</select>
					</div>		
			
			
			
			
			
			
			
			




			
					<?php
						$arrayOption = array( 'img1', 'img2', 'img3', 'img4', 'img5' );
						foreach( $arrayOption as $keyOption => $iOption ){
					?>
					<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"></div>
					<div class="col-xs-12 col-sm-8 col-md-8" style="background-color:#eee;padding-top:10px;margin-top:10px;">
					
						<?php echo @Lib_Lang::consta(product_options2_.$iOption); ?>
						
						<input type="file" name="product_options_<?php echo$iOption; ?>_image" class="form-control fileInput" />
						<div id="product_options_<?php echo$iOption; ?>_message" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
						<div class="row" id="product_options_<?php echo$iOption; ?>_finishPhoto"></div>
					</div>
					
					<script type="text/javascript" language="javascript">
						
					$(document).ready(function () {

						<?php if( $this->rowProduct['product_options2_'.$iOption.''] ){ ?>
						$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
						$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
						$("#product_options_<?php echo$iOption; ?>_finishPhoto").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotooption'), 'default', true); ?>",{filename: '<?php echo$this->rowProduct['product_options2_'.$iOption.'']; ?>', opt: '<?php echo$iOption; ?>'}, function(){$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});$("#product_options_<?php echo$iOption; ?>_message").html('');});
						<?php } ?>

						$("[name='product_options_<?php echo$iOption; ?>_image']").change(function() {
							var file = this.files[0];
							var imagefile = file.type;
							var imagename = file.name;
							var imagesize = file.size;
							
							if(imagesize > 1024*1024){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
							}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
								alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
							}else{
								$("#product_options_<?php echo$iOption; ?>_finishPhoto").html('');
								$("#product_options_<?php echo$iOption; ?>_message").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
								$("#product_options_<?php echo$iOption; ?>_message").css({'display':'block'});
								$("input").attr('disabled','disabled');
								var reader = new FileReader();
								reader.onload = function(){
								  var dataURL = reader.result;
								  
									$.ajax({
										url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotooption'), 'default', true); ?>", 
										type: "POST",  
										data: {'image_product':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, ""), opt: '<?php echo$iOption; ?>'},     
										success: function(data)  
										{
											var control = $("[name='product_options_<?php echo$iOption; ?>_image']");
											control.replaceWith( control = control.clone( true ) );
											$("input").removeAttr('disabled');
											$("#product_options_<?php echo$iOption; ?>_message").css({'display':'none'});
											$("#product_options_<?php echo$iOption; ?>_message").html('');
											$("#product_options_<?php echo$iOption; ?>_finishPhoto").html(data);
										}
									});
									
								};
								reader.readAsDataURL(this.files[0]);
							}
							
						});
						
					});

					</script>		
					
					<?php
						}
					?>
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			</div>
			
			
			
			
			
			
			
			
			
	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_category_edit_top_optionrim); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>	
	
	
	

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rimdefault); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim_default" class="form-control">
				<option value="0"></option>
				<option value="1" <?php if( $this->rowProduct['product_rim_default'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim1); ?></option>
				<option value="2" <?php if( $this->rowProduct['product_rim_default'] == 2 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim2); ?></option>
				<option value="3" <?php if( $this->rowProduct['product_rim_default'] == 3 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim3); ?></option>
				<option value="4" <?php if( $this->rowProduct['product_rim_default'] == 4 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim4); ?></option>
			</select>
		
		</div>
	</div>
	
	

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim2default); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim2_default" class="form-control">
				<option value="0"></option>
				<option value="1" <?php if( $this->rowProduct['product_rim2_default'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim1); ?></option>
				<option value="2" <?php if( $this->rowProduct['product_rim2_default'] == 2 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim2); ?></option>
				<option value="3" <?php if( $this->rowProduct['product_rim2_default'] == 3 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim3); ?></option>
				<option value="4" <?php if( $this->rowProduct['product_rim2_default'] == 4 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_rim4); ?></option>
			</select>
		
		</div>
	</div>

	
	<div class="row"><hr /></div>


	
	

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_rim1'] == 0 ){ ?>
			$('.rim1price').hide();
			$("[name='product_rim_default'] option[value='1']").remove();
			$("[name='product_rim2_default'] option[value='1']").remove();
		<?php }else{ ?>
			$('.rim1price').show();		
		<?php } ?>
	
		$('[name="product_rim1"]').change(function(){
			if( $(this).val() == 0 ){
				$('.rim1price').hide();
				$("[name='product_rim_default'] option[value='1']").remove();
				$("[name='product_rim2_default'] option[value='1']").remove();
			}
			else{
				$('.rim1price').show();	
				$("[name='product_rim_default']").append('<option value="1"><?php echo @Lib_Lang::translate(admin_product_product_rim1); ?></option>');
				$("[name='product_rim2_default']").append('<option value="1"><?php echo @Lib_Lang::translate(admin_product_product_rim1); ?></option>');
			}
		});
	
	});

</script>

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim1); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim1" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_rim1'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_rim1'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_1); ?></option>
			</select>
		
		</div>
	</div>
	
	<div class="row rim1price">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim_price); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" name="product_rim1_price" class="form-control" value="<?php echo$this->rowProduct['product_rim1_price']; ?>" /></div>
	</div>
	
	<div class="row"><hr /></div>

	


	
	

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_rim2'] == 0 ){ ?>
			$('.rim2price').hide();
			$("[name='product_rim_default'] option[value='2']").remove();
			$("[name='product_rim2_default'] option[value='2']").remove();
		<?php }else{ ?>
			$('.rim2price').show();		
		<?php } ?>
	
		$('[name="product_rim2"]').change(function(){
			if( $(this).val() == 0 ){
				$('.rim2price').hide();
				$("[name='product_rim_default'] option[value='2']").remove();
				$("[name='product_rim2_default'] option[value='2']").remove();
			}
			else{
				$('.rim2price').show();
				$("[name='product_rim_default']").append('<option value="2"><?php echo @Lib_Lang::translate(admin_product_product_rim2); ?></option>');
				$("[name='product_rim2_default']").append('<option value="2"><?php echo @Lib_Lang::translate(admin_product_product_rim2); ?></option>');
			}		
		});
	
	});

</script>

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim2); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim2" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_rim2'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_rim2'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_1); ?></option>
			</select>
		
		</div>
	</div>
	
	<div class="row rim2price">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim_price); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" name="product_rim2_price" class="form-control" value="<?php echo$this->rowProduct['product_rim2_price']; ?>" /></div>
	</div>

	<div class="row"><hr /></div>

	


	
	

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_rim3'] == 0 ){ ?>
			$('.rim3price').hide();
			$("[name='product_rim_default'] option[value='3']").remove();
			$("[name='product_rim2_default'] option[value='3']").remove();
		<?php }else{ ?>
			$('.rim3price').show();		
		<?php } ?>
	
		$('[name="product_rim3"]').change(function(){
			if( $(this).val() == 0 ){
				$('.rim3price').hide();
				$("[name='product_rim_default'] option[value='3']").remove();
				$("[name='product_rim2_default'] option[value='3']").remove();
			}
			else{
				$('.rim3price').show();	
				$("[name='product_rim_default']").append('<option value="3"><?php echo @Lib_Lang::translate(admin_product_product_rim3); ?></option>');	
				$("[name='product_rim2_default']").append('<option value="3"><?php echo @Lib_Lang::translate(admin_product_product_rim3); ?></option>');	
			}
		});
	
	});

</script>

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim3); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim3" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_rim3'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_rim3'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_1); ?></option>
			</select>
		
		</div>
	</div>
	
	<div class="row rim3price">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim_price); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" name="product_rim3_price" class="form-control" value="<?php echo$this->rowProduct['product_rim3_price']; ?>" /></div>
	</div>

	<div class="row"><hr /></div>

	


	
	

<script type="text/javascript" language="javascript">

	$(document).ready(function () {
	
		<?php if( $this->rowProduct['product_rim4'] == 0 ){ ?>
			$('.rim4price').hide();
			$("[name='product_rim_default'] option[value='4']").remove();
			$("[name='product_rim2_default'] option[value='4']").remove();
		<?php }else{ ?>
			$('.rim4price').show();		
		<?php } ?>
	
		$('[name="product_rim4"]').change(function(){
			if( $(this).val() == 0 ){
				$('.rim4price').hide();
				$("[name='product_rim_default'] option[value='4']").remove();
				$("[name='product_rim2_default'] option[value='4']").remove();
			}
			else{
				$('.rim4price').show();		
				$("[name='product_rim_default']").append('<option value="4"><?php echo @Lib_Lang::translate(admin_product_product_rim4); ?></option>');
				$("[name='product_rim2_default']").append('<option value="4"><?php echo @Lib_Lang::translate(admin_product_product_rim4); ?></option>');
			}
		});
	
	});

</script>

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim4); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_rim4" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_rim4'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_rim4'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_product_optionsrim_1); ?></option>
			</select>
		
		</div>
	</div>
	
	<div class="row rim4price">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_product_rim_price); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="number" step="0.01" name="product_rim4_price" class="form-control" value="<?php echo$this->rowProduct['product_rim4_price']; ?>" /></div>
	</div>
	
	



	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_category_edit_top_translate); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>	
	
	
	<?php foreach ($this->dataLang as $key => $val):?>
	<div class="row">
	
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><u><b><?php echo $val['lang_name']; ?></b></u></div>
		<div class="col-xs-12 col-sm-8 col-md-8"></div>
		
	</div>
	<div class="row">
	
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_name); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="product_name_translate[<?php echo $val['lang_suffix']; ?>]" class="form-control" value="<?php echo $val['language_value']; ?>" /></div>
		
	</div>
	<div class="row">
	
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_description); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><textarea maxlength="3000" name="product_description_translate[<?php echo $val['lang_suffix']; ?>]" class="form-control"><?php echo $val['language_value_2']; ?></textarea></div>
		
	</div>
	<div class="row"><hr /></div>
	<?php endforeach; ?>
	
	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right"></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input name="admin_editproduct" class="btn btn-info form-control" type="submit" value="<?php echo @Lib_Lang::translate(admin_product_edit_button); ?>" /></div>
	</div>
	
	</form>	
		
</div>

<?php echo $this->render('admin/footer.phtml'); ?>