function jsAddToCart() {
	if (document.atc.shoeCart_1_available_Add.selectedIndex == 0) {
		alert("Please Choose a Size/Color");
		return false;		
	}
	ajax();
	document.getElementById('apDiv1').style.visibility="visible";
	document.getElementById('apDiv2').style.visibility="visible";
	document.getElementById("apDiv1").style.height = document.body.scrollHeight + 'px';	
}
function continueShopping() {
		//document.getElementsByTagName('html')[0].style.overflow="hidden";
		document.getElementById('apDiv1').style.visibility="hidden";
		document.getElementById('apDiv2').style.visibility="hidden";
		var sURL = unescape(window.location.pathname);
}

var xmlHttp;
var contentText;
// id browsers
var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);

function ajax() {
	var skin;
	dd=document.atc.shoeCart_1_available_Add.value;
	qty=document.atc.shoeCart_1_Quantity_Add.value;
	pid=document.atc.shoeCart_1_ID_Add.value;
	sc=document.atc.shoeCart_1_shipSurCharge_Add.value;
	cid=document.atc.cid.value;
	scid=document.atc.scid.value;
	disd=document.atc.disd.value;
	sp=document.atc.subproducts.value;
	temp=document.atc.shoeCart_1_available_Add.value;
	newprice=temp.split("|");
	price=newprice[3];
	if(document.atc.admin_price.value!="") {
		price=document.atc.admin_price.value;
	}
	if(nav) skin=document.apDiv2;
	if(iex) skin=apDiv2.style;
	if(n_6) skin=document.getElementById("apDiv2").style;
	try {
		createCheckRequest();
		var url = "../ajax/ajaxAddToCart.php?ID="+pid+"&qty="+qty+"&sp="+sp+"&dd="+dd+"&sc="+sc+"&cid="+cid+"&disd="+disd+"&price="+price+"&scid="+scid;
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = StateChangeCompare;
		xmlHttp.send(null);
	}
	catch (e)
	{
		window.location.href="../../ajax/ajaxAddToCart.php?ID="+pid+"&qty="+qty+"&sp="+sp+"&dd="+dd+"&sc="+sc+"&cid="+cid+"&disd="+disd+"&price="+price+"&scid="+scid+"&muffed=1";
	}
}

function StateChangeCompare(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		contentText = xmlHttp.responseText;
		var splitText=contentText.split("^")
		//main div
		if(nav)	{ document.apDiv2.open();document.apDiv2.write(splitText[0]);document.apDiv2.close();} else
		{ document.getElementById("apDiv2").innerHTML=splitText[0];}
		//if(iex) { document.getElementById("apDiv2").innerHTML=splitText[0];}  
		//if(n_6) { document.getElementById("apDiv2").innerHTML=splitText[0];}	
		//cart div
		if(nav)	{ document.apDivCart.open();document.apDiv2.write(splitText[1]);document.apDiv2.close();} else 
		{ document.getElementById("apDivCart").innerHTML=splitText[1];}  
		//if(iex) { document.getElementById("apDivCart").innerHTML=splitText[1];}  
		//if(n_6) { document.getElementById("apDivCart").innerHTML=splitText[1];}		
	
	} 
}
function createCheckRequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
}