﻿// JavaScript Document
$(document).ready(function(){	
		$(".sub_menu:last").css("margin-top","0");	
		//$(".dotLine:last").css("display","none");
		$(".current > ul > li > a").click(function(){
			//var select_id=$(".current > ul > li >a").index(this);
			var right_height=$("#column_bottom").height();
			$("#column_top").height(right_height);
		});
		
		if( $(".sub_menu:eq(1) > li:eq(2)").hasClass("current") ){
			$(".menu_static").css("display","inline");
		}
		
	//makeup image
	//click little image and big image changed
		var s_src_value=$(".image_makeup_top img:eq(0)").attr("src");
		var s_id_value=$(".image_makeup_top img:eq(0)").attr("id");
		if(typeof(s_src_value)=="undefined" || typeof(s_id_value)=="undefined"){
			//
		}
		else
		{
			if(s_id_value=="c_F5013301"){
				var b_src_value1=s_src_value.replace("c_F5013301","p_F5013301_01");
				var spacial_obj_big  =$(".image_makeup_bottom").find("img");
				var spacial_obj_small=$(".image_makeup_top").find("img");
				spacial_obj_big.attr("src", b_src_value1);
				spacial_obj_small.after("\<div class='image_spacial'\>s\<span class='sp1'\>s\<\/span>\<span class='sp1'\>s\<\/span>\<span class='sp1'\>s\<\/span>\<span class='sp1'\>s\<\/span> \<\/div\>");				
				spacial_obj_small.css("display","none");
				$(".makeup_img_bottom_letter").html("step 1 底色");
			}
			else{
				var b_src_value1=s_src_value.replace("c","p")
				$(".image_makeup_bottom").find("img").attr("src", b_src_value1);
			}
		}
	 $(".sp1").click(function(){
		$(".sp1").css("border-color","#fff");
		$(this).css("border-color","#f00");
		var src_value=$(".image_makeup_top img").attr("src");
		var div_index=$(".image_spacial >.sp1").index(this)+1;
		var sp_src=src_value.replace("c_F5013301","p_F5013301_0" + div_index);
		$(".image_makeup_bottom").find("img").attr("src", sp_src);
		if(div_index==1){
			$(".makeup_img_bottom_letter").html("step 1 底色");
		}
		if(div_index==2){
			$(".makeup_img_bottom_letter").html("step 2 阴影");
		}
		if(div_index==3){
			$(".makeup_img_bottom_letter").html("step 3 高光");
		}
		if(div_index==4){
			$(".makeup_img_bottom_letter").html("step 4 眼线色");
		}
	 });

	$(".image_makeup_top img").click(function(){
		var src_value=$(this).attr("src");
		var id_value =$(this).attr("id");
		var b_src_value=src_value.replace("c","p");
		if(id_value=="c_F5013301"){
			//特殊字段处理
			//$(this).append("\<div class='image_spacial'\>\<\/div\>");
			//$(this).css("display","none");
		}
		else{
			$(".image_makeup_top img").removeClass("img_click");
			$(this).addClass("img_click");
			
			//$(this).addClass("image_makeup_down");
			var src_value=$(this).attr("src");
			var b_src_value=src_value.replace("c","p")
			$(".image_makeup_bottom").find("img").attr("src", b_src_value);
			//alert(b_src_value);
		}
	});

		
		//always at last line
		var right_height=$("#column_bottom").height();
		$("#column_top").height(right_height);
		//alert(right_height);
		
	function QueryString(item){
		var sValue=window.location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i"));
		return sValue?sValue[1]:sValue
	 }	
	
	if(QueryString("prdcode")=="SK0308"){
		$("#column_top").css("height","800px");
		$("#mainProdInfo img").css("margin-left","0px");
	}	
	if(QueryString("prdcode")=="CN0901"){
		$("#column_top").css("height","999px");
		$("#mainProdInfo img").css("margin-left","0px");
	}
	if(QueryString("prdcode")=="SK0407"){
		$("#mainProdInfo img").css("margin-left","0px");
	}	
	
 });
	