function show(id)
{
	var str =document.getElementById(id);
	str.style.display="block";
}
function change_color(id)
{
	var get_id =document.getElementById(id);
	var text =get_id;
	text.style.color='#fff';
}
function change_color_again(id)
{
	var get_id =document.getElementById(id);
	var text =get_id;
	text.style.color='#ff7225';
}


function setTpa(){
var lhnum=document.getElementById("lhnum").value;
var tpnum=document.getElementById("tpnum").value;	
	var nameb="tpa";
	tpnum = tpnum + 1;
	document.getElementById("tpnum").value = tpnum;
	if(tpnum > lhnum){
	tpnum = lhnum;
	document.getElementById("tpnum").value = lhnum;
	return false;	
	}
 for(k=1;k<=lhnum;k++){
  var conb=document.getElementById("pic"+k);
  conb.style.display=k==tpnum?"block":"none";
 }
}

function setTpb(){
var lhnum=document.getElementById("lhnum").value;
var tpnum=document.getElementById("tpnum").value;	
	var nameb="tpa";
	tpnum = tpnum - 1;
	document.getElementById("tpnum").value = tpnum;
	if(tpnum < 1){
	tpnum = 1;
	document.getElementById("tpnum").value = 1;
	return false;	
	}
 for(k=1;k<=lhnum;k++){
  var conb=document.getElementById("pic"+k);
  conb.style.display=k==tpnum?"block":"none";
 }
}

function sbigpicaa(pica){
 document.getElementById("vpica").value = pica;
document.getElementById("bigpica").innerHTML = "<a href=\"#\" onclick=\"tanppic();return false\"><img src='/code/files/"+pica+"' border='0' /></a>";	
}

function tanppic() { 
var widtha = screen.width;
var heighta = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
var pica = document.getElementById("vpica").value;
 widthb = (widtha - 600) / 2;
 document.getElementById("tcppic").style.display = "block";
 document.getElementById("tcppica").style.height = heighta + "px";
 document.getElementById("tcppicb").style.left = widthb + "px";
 document.getElementById("pbigpic").innerHTML = "<img src='/code/files/"+pica+"' border='0' />";	
}

function disppic(pa){
	document.getElementById(pa).style.display="none";
}

//¼ì²éÊýÁ¿
function changesl(){
var zhengshu = /^[-]{0,1}[0-9]{1,}$/;
var shulianga=document.getElementById("sl");
var shuliangb=shulianga.value;
 if (shuliangb < 1 || !zhengshu.exec(shuliangb))
     {
        alert("Please enter the number");
		document.getElementById("sl").value = "1" ;
		shulianga.focus();
        return false;
     }
}

function addToCarta() { 
var p_id = document.getElementById("p_id").value;
var sl = document.getElementById("sl").value;
var cma = document.getElementById("cma").value;
var cm = document.getElementById("cm").value;
if(cma > 0){
	if(cm==""){
	alert("Size Can not be empty"); return false;	
	}
}

 document.getElementById("pshowcr").style.display="block";
 document.getElementById("pshowcr").style.left=( mpx + 20 ) +"px";
 document.getElementById("pshowcr").style.top=( mpy - 55 )+"px";	
	
$.get("/cart/index.php", {adc:"addcart",p_id:p_id,sl:sl,cm:cm}, function(mydata){
	 document.getElementById("pcart").innerHTML = mydata;
 });		

}

function addToCart(p_id) { 
var p_id = p_id;
var sl = 1;

 document.getElementById("pshowcr").style.display="block";
 document.getElementById("pshowcr").style.left=( mpx + 20 ) +"px";
 document.getElementById("pshowcr").style.top=( mpy - 55 )+"px";	
	
$.get("/cart/index.php", {adc:"addcart",p_id:p_id,sl:sl}, function(mydata){
	 document.getElementById("pcart").innerHTML = mydata;
 });		

}

function dhcart() { 		
$.get("/cart/index.php", {adc:"dhcart"}, function(mydata){
	 document.getElementById("dhcarta").innerHTML = mydata;
 });		

}

function checkpayid(pid) { 
var pid = pid;
$.get("/cart/index.php", {adc:"checkpayid",pid:pid}, function(mydata){
 });		

}

function changeliwu(picb) { 
var picb = picb;
$.get("/cart/index.php", {adc:"changeliwu",picb:picb}, function(mydata){
 });		

}

function addemaillist() { 
var email = document.getElementById("user_email").value;
if(email.indexOf("@") == -1 || email.indexOf(".") == -1 || email==""){
	    alert("Enter a valid E-mail");
		document.getElementById("user_email").focus();
        return false;
	}
$.post("/code/appdata.php", {adc:"adddingzhi",email:email}, function(mydata){
 document.getElementById("emailist").innerHTML = mydata;
 });		

}

function prevpic() { 
var p_id = document.getElementById("p_id").value;
var vpica = document.getElementById("vpica").value;	
document.getElementById("bigpica").innerHTML = "<div class='load_a'></div>";	
$.get("/code/appdata.php", {adc:"prevpic",p_id:p_id,vpica:vpica}, function(mydata){
	var pica = mydata;
	document.getElementById("vpica").value = pica;
	document.getElementById("bigpica").innerHTML = "<a href=\"#\" onclick=\"tanppic();return false\"><img src='/code/files/"+pica+"' border='0' /></a>";	
 });		

}

function nextpic() { 
var p_id = document.getElementById("p_id").value;
var vpica = document.getElementById("vpica").value;	
	document.getElementById("bigpica").innerHTML = "<div class='load_a'></div>";
$.get("/code/appdata.php", {adc:"nextpic",p_id:p_id,vpica:vpica}, function(mydata){
	var pica = mydata;
	document.getElementById("vpica").value = pica;
	document.getElementById("bigpica").innerHTML = "<a href=\"#\" onclick=\"tanppic();return false\"><img src='/code/files/"+pica+"' border='0' /></a>";	
 });		

}

function setpaylw(name,cursel,n){
 for(i=1;i<=n;i++){
  var con=document.getElementById("con_"+name+"_"+i);
  con.style.display=i==cursel?"block":"none";
 }
}

function checkorder() { 
var ordernum=document.getElementById("order_check").value;
var orderemail=document.getElementById("order_email").value;
if(ordernum==""){
	alert('Num Can not be empty!');
	return false;
}
if(orderemail==""){
	alert('Email Can not be empty!');
	return false;
}
$.get("/code/ajcode.php", {adc:"checkorder",ordernum:ordernum,email:orderemail}, function(mydata){
	 document.getElementById("checkresult").innerHTML = mydata;
 });		

}

function chcartyhm() { 
var youhuima=document.getElementById("youhuima").value;
if(youhuima!=""){

$.get("/cart/index.php", {adc:"chcartyhm",youhuima:youhuima}, function(mydata){
   var strdata = mydata.split('|');
	 for(var i=0;i<strdata.length;i++){
	 var dataa = strdata[0];	 
     var datab = strdata[1];
    }
	 document.getElementById("chruyhm").innerHTML = datab;
	 document.getElementById("yhmhouid").innerHTML = dataa;
 });		
}
}
