function cadd(prodID, prodP) {
	parent.addtocart(prodID, prodP);
}
function cremove(prodID) {
	parent.removefromcart(prodID);
}
function pagesize() {
	parent.document.getElementById("cframe").style.height=document.getElementById("page").offsetHeight+20+"px";
}

function addtocart(prodID, prodP) {
	if((document[prodID+"-c"]) == undefined) {
		document[prodID+"-c"]=prodP;
	}
	if((document[prodID+"-q"]) != undefined) {
		document[prodID+"-q"]+=1;
	} else {
		document[prodID+"-q"]=1;
	}
	if(document.totalcost != undefined) {
		document.totalcost+=document[prodID+"-c"];
	} else {
		document.totalcost=document[prodID+"-c"];
	}
	document.getElementById("shop").style.display="block";
	document.getElementById("shoptemp").style.display="none";
	document.getElementById(prodID).style.display="block";
	document.getElementById([prodID+"-q"]).innerHTML=document[prodID+"-q"];
	document.getElementById([prodID+"-p"]).innerHTML="R"+(document[prodID+"-c"])*(document[prodID+"-q"]);
	document.getElementById("totalcost").innerHTML="R"+(document.totalcost);
	if(document.getElementById('cframe').contentWindow.location.href.match(/order\.shtml/)) {
		document.getElementById('cframe').contentWindow.location.reload(true);
	}
}
function removefromcart(prodID) {
	document[prodID+"-q"]-=1;
	document.getElementById([prodID+"-q"]).innerHTML=document[prodID+"-q"];
	document.getElementById([prodID+"-p"]).innerHTML="R"+(document[prodID+"-c"])*(document[prodID+"-q"]);
	if (document[prodID+"-q"]<=0) {
		document.getElementById(prodID).style.display="none";
		document[prodID+"-q"]=0;
	}
	document.totalcost-=document[prodID+"-c"];
	document.getElementById("totalcost").innerHTML="R"+(document.totalcost);
	if (document.totalcost <= 0) {
		document.getElementById("shop").style.display="none";
		document.getElementById("shoptemp").style.display="block";
	}
	if(document.getElementById('cframe').contentWindow.location.href.match(/order\.shtml/)) {
		document.getElementById('cframe').contentWindow.location.reload(true);
	}
}
function buildgallery(gID, gQ) {
	document.getElementById("cframe").innerHTML="hello " + gQ;
}
