
function ShowProSize_formCarts(ProID,iTems)
{  var LenProSize = document.getElementById("LopSize_"+ProID).value;
	   var LenProItem = document.getElementById("iLop_hid").value;
	   var ProiTem ; 
	   var Check_ProID ;
	   
		if (LenProItem > 1) 
			{  Check_ProID = document.formCarts.elements['ProID'][iTems-1].checked;  }
		else
			{  Check_ProID = document.formCarts.elements['ProID'].checked;  }
		
			document.getElementById('ProTotal_'+ProID).disabled = !(Check_ProID);
			
			if (LenProSize > 1)
			{
				for(ProiTem = 1 ; ProiTem <= LenProSize ; ProiTem ++)
				{	document.formCarts.elements['Prosize_'+ProID][ProiTem-1].disabled = !(Check_ProID);
					document.formCarts.elements['Prosize_'+ProID][ProiTem-1].checked = false;	}
					
				if (Check_ProID == true)
				for(ProiTem = 1 ; ProiTem <= LenProSize ; ProiTem ++)
				{	document.formCarts.elements['Prosize_'+ProID][0].checked = (Check_ProID);  }
			}
			else
			{
				document.getElementById('Prosize_'+ProID).disabled = !(Check_ProID);
				document.getElementById('Prosize_'+ProID).checked =  Check_ProID;
			}
	}










	function CheckControl(Post)
	{	document.formCarts.elements['Sizes'][Post].check = false;
	
		
	}

	function CheckSubmit()
	{	
		document.formCarts.submit();
	}


//------------------------------- Shoping page ------------------------------------//

    function ShowQty(Productname)
  {
	  if (document.getElementById(Productname).disabled){
	   document.getElementById(Productname).disabled=false; 
	  }
	  else{
		   document.getElementById(Productname).disabled=true; 
	  }
}



//------------------------------- SWAP IMAGE SCRIPT ------------------------------------//

var xmlHttp
function MainImage(PID,POST,SID)
{ var PID = document.getElementById('MainID').value ;
  var MainPost = document.getElementById('MainPost').value ;
  xmlHttp = GetHttp(xmlHttp)
  if (xmlHttp == null)
  {	alert("not support");
  	return ;
  }

  var url = "MainImage.asp?ST=M&PID="+PID+"&SID="+SID+"&POST="+POST+"&MainPost="+MainPost;
  xmlHttp.onreadystatechange = function(){
			if(xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
			{	
				document.getElementById('ImgB').innerHTML = xmlHttp.responseText;
				document.getElementById('InnerText').innerHTML = "";
				SubImage(PID,POST,SID,MainPost);
				document.getElementById('MainID').value = SID;
			}		
		}
  
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
  
}

var xmlHttpS
function SubImage(PID,POST,SID,MainPost)
{	
  xmlHttpS = GetHttp(xmlHttpS)
  if (xmlHttpS == null)
  {	alert("not support");
  	return ;
  }
  var urlS = "MainImage.asp?ST=S&PID="+PID+"&SID="+SID+"&POST="+POST+"&MainPost="+MainPost;
  xmlHttpS.onreadystatechange = function(){
			if(xmlHttpS.readyState == 4)
				{	document.getElementById('ImgS_'+POST).innerHTML = xmlHttpS.responseText;	
				}	
			}		
  xmlHttpS.open("GET",urlS,true);
  xmlHttpS.send(null);
  
	
  if (MainPost == "0") 
  		{	document.getElementById('MainPost').value = POST; 
			ShowText(SID);   }
  else if (MainPost == POST )  
  		{	document.getElementById('MainPost').value = 0;   }
  else  { 	ShowText(SID);   }
}

var xmlHttpT
function ShowText(SID)
{	
  xmlHttpT = GetHttp(xmlHttpT)
  if (xmlHttpT == null)
  {	alert("not support");
  	return ;
  }
  var urlT = "MainImage.asp?ST=T&SID="+SID ;
  xmlHttpT.onreadystatechange = function(){
			if(xmlHttpT.readyState == 4)
				{	document.getElementById('InnerText').innerHTML = xmlHttpT.responseText;	 }	
			}		
  xmlHttpT.open("GET",urlT,true);
  xmlHttpT.send(null);
}

function GetHttp(XX)
{	var XX = null;
	try 
	{  XX = new XMLHttpRequest(); }
	catch (e)
	{  try
		{  XX = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e)
		{  XX = new ActiveXObject("Microsoft.XMLHTTP"); }
	}
	return XX;
}
//--------------------------------- END SWAP IMAGE SCRIPT -------------------------------------//
