function jsAddToCart() {
	if (document.atc.shoeCart_1_available_Add2.selectedIndex == 0) {
		alert("Please Choose a Size/Color");
		return false;		
	}
	ajax();
	document.getElementById('apDiv1').style.visibility="visible";
	document.getElementById('apDiv2').style.visibility="visible";
}
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_Add0.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;
	price=document.atc.shoeCart_1_ProdPrice.value;
	c=document.atc.count.value;
	var sp="";
    for (y=0;y<c;y++) 
	{
		sp=sp+document.forms["atc"].elements["shoeCart_1_available_Add"+y].value+">";
	}
	dd=sp;
	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+"&dd="+dd+"&sc="+sc+"&sp="+sp+"&price="+price;
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = StateChangeCompare;
		xmlHttp.send(null);
	}
	catch (e)
	{
		window.location.href="../../ajax/ajaxAddToCart.php?ID="+pid+"&qty="+qty+"&dd="+dd+"&sc="+sc+"&sp="+sp+"&price="+price+"&cid="+cid+"&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();
	}
}
