<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<div id="prd_view">
    <h3><?php echo $curr_product->name; ?></h3>
    <div class="air"></div>
    <span class="nme"><?php echo $curr_product->masters['ProductCategory']->name; ?></span>
    <div class="intro">
       
        <?php echo $curr_product->introduction; ?>
    </div>
    
    
    
    <!--Cart Style Start-->
    	<div style="height:20px; clear:both; "></div>
        
        <div class="productcontent">
			<?php if ($curr_product->online_orderable) { ?>
                <div class="prd_CartInfo">
                    <div class="l">
                        <a href="<?php echo $curr_product->feature_img; ?>" title="<?php echo $curr_product->name; ?>" class="thickbox">
                        <img src="<?php echo $curr_product->feature_smallimg; ?>" alt="" border="0" align="left" class="productimg" /></a>
                    </div>
                    <div class="r">
                        <ul>
                        <?php if ($curr_product->discount_price != $curr_product->price) { ?>
                            <li>
                                <span class="label"><?php _e('Price'); ?> : </span>
                                <span class="cnt">￥<?php echo $curr_product->price; ?></span>
                            </li>
                            <li>
                                <span class="label"><?php _e('Discount Price'); ?> : </span>
                                <span class="cnt">￥<?php echo $curr_product->discount_price; ?></span>
                            </li>
                        <?php } else { ?>
                            <li>
                                <span class="label"><?php _e('Price'); ?> : </span>
                                <span class="cnt">￥<?php echo $curr_product->price; ?></span>
                            </li>
                        <?php } ?>
                        
                            
                            <li>
                                <span class="label"><?php _e('Delivery Fee'); ?> : </span>
                                <span class="cnt">￥<?php echo $curr_product->delivery_fee; ?></span>
                            </li>
                            <li>
                                <span class="label"><?php _e('Quantity'); ?> : </span>
                                <span class="cnt"><?php echo Html::input('text', 'prod_num_'.$curr_product->id, $_COOKIE['n_prd'][$curr_product->id]?$_COOKIE['n_prd'][$curr_product->id]:1, 'size="4"'); ?></span>
                            </li>
                            <li class="cartLink">
                                <a class="orange" href="#" onclick="add2cart('<?php echo $curr_product->id; ?>');return false;" title="<?php _e('Add to cart'); ?>">
                            <img src="<?php echo P_TPL_WEB; ?>/images/cart.gif" border="0" class="imgvmid" alt="<?php _e('Add to cart'); ?>" align="absmiddle" />
                            <?php _e('Add to cart'); ?></a>
                            </li>
                        </ul>
                    </div>
                    <div class="kkair"></div>
                </div>
                <div class="kkair"></div>
                <p><?php echo $curr_product->description; ?></p>
        	<?php }else{?>
				<p>
                	<a href="<?php echo $curr_product->feature_img; ?>" title="<?php echo $curr_product->name; ?>" class="thickbox">
                    <img src="<?php echo $curr_product->feature_smallimg; ?>" alt="" border="0" align="left" class="productimg" /></a>
					<?php echo $curr_product->description; ?>
                </p>
            <?php } ?>
            <?php if (defined('SYSVER')) { ?>
        <p id="product_gallery">
            <?php
                $curr_product->loadRelatedObjects(REL_CHILDREN, array('ProductPic'));
                $ext_pics = $curr_product->slaves['ProductPic'];
                if (sizeof($ext_pics) > 0) {
                    foreach ($ext_pics as $pic) {
            ?>
                <a href="<?php echo $pic->pic; ?>" rel="product_gallery" class="thickbox">
                    <img class="product_gallery_pic" src="<?php echo $pic->pic; ?>" /></a>
            <?php
                    }
                }
            ?>
        </p>
<?php } ?>

    </div>
    
    	
			<script type="text/javascript" language="javascript">
			<!--
				//////////////////////////////Add Cart Script////////////////////////
				function updatecartstate(response) {
					var o_result = _eval_json(response);
					if (!o_result) {
						return addprodfailed(response);
					}
					
					if (o_result.result == "ERROR") {
						alert(o_result.errmsg);
						return false;
					} else if (o_result.result == "OK") {
						$("#disp_n_prds").html(o_result.n_prds);
						alert("<?php _e('The product has been added to cart!'); ?>");
						return true;
					} else {
						return on_failure(response);
					}
				}
				
				function addprodfailed(response) {
					alert("<?php _e('Request failed!'); ?>");
					return false;
				}
				
				function add2cart(p_id) {
					var p_num = document.getElementById("prod_num_" + p_id).value;
					_ajax_request("mod_cart", "addtocart", 
						{ p_id: p_id, p_num: p_num }, updatecartstate, addprodfailed);
				}
			//-->
			</script>
    <!--Cart Style End-->
</div>