function show_Child_Div(target,tot){
	for(i=0;i<tot;i++){
		tg		=	target.split("_")
		tgid	=	parseInt(tg[2]);
		if(i==tgid){
			document.getElementById('comp_divs_'+i).style.display='block';
		}else{
			document.getElementById('comp_divs_'+i).style.display='none';
		}
	}
}

//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}

//Our XmlHttpRequest object to get the auto suggest
var searchReq = getXmlHttpRequestObject();


function addToCartNew(products_id){
	URLL	=	window.location.protocol + '//' + window.location.hostname+'/newATC.php?products_id=' + products_id + '&products_quanity=1'
	//alert(URLL)
	document.getElementById("AtcImg"+products_id).style.display="block"
	//document.getElementById("AtcLink"+products_id).style.display="none"	
	searchReq.open("GET", URLL, true);			
		searchReq.onreadystatechange = handleATC; 
		searchReq.send(null);	
}

function handleATC(){
	if (searchReq.readyState == 4) {
		if(document.getElementById("cartContainerDiv")!=null){
			resp	=	searchReq.responseText.split("^")
		document.getElementById("cartContainerDiv").innerHTML=resp[0]
		divname2	=	"ContDivProd"+resp[1]
		document.getElementById("AtcImg"+resp[1]).style.display="none"
		document.getElementById("AtcLink"+resp[1]).style.display="block"		
		document.getElementById(divname2).innerHTML='<b>Item Added</b><br><a href="_new_shopping_cart_2_.php" style="color:#000000;font-size:10px;">view cart</a>';
		document.getElementById(divname2).style.display='block';					
			//answer	=	confirm("Item added successfully to shopping basket.\n Would you like to go to shopping basket?\n \t Press OK to go to shopping basket page.\n \t Press cancel to continue shopping.")
			//if(answer==true){
			//	window.location.href="_new_shopping_cart_2_.php";
			//}
		}

	}
	
}