	var oTimer=0;
	var bCoockie=navigator.cookieEnabled;
	var iQty=0;
	var embroid=false;

	function getLink(obj) {
		return;
	}
	
	function addToCart(id) {
		//////////////////////////
		if(!bCoockie) {
			alert("To use Shopping Cart please enable Cookie on your web browser");
			return;
		}
		//////////////////////////
		var strTxt="";
		var strMsg="";
		var qry="";
		var qty=document.getElementById("qty").value;
		var clr=document.getElementById("p_color").value;
		var sz=document.getElementById("p_size").value;
		if(qty<1)strMsg="Quantity may not be less than One";
		if(clr=="")strMsg="Please choose item COLOR";
		if(sz=="")strMsg="Please choose item SIZE";
		if(strMsg!="") {
			alert(strMsg);
		} else {
			qry="|"+id+"~"+curr_id+"~"+qty;
			if(embroid)
			qry=qry+"~1~"+document.getElementById("embroidery_txt").value;
			else
			qry=qry+"~0~";
			add_to_cart(qry);
		}
		window.location.reload(true);
	}

	function get_Item(sItem) {
		sItem=sItem+"=";
		var itmVal="";
		var itmLen=sItem.length;
		var str = document.cookie;
		if (str.length>0) {
			var frst=str.indexOf(sItem);
			if (frst!=-1) {
				var last=str.indexOf(";",frst);
				if (last==-1) last=str.length;
				itmVal = str.substring((frst+itmLen),(last));
			}
		}
		return itmVal;
	}
	function set_tem(sItem,sValue) {
		document.cookie=sItem+"="+sValue;
	}
	
	function add_to_cart(qry) {
		var str=get_Item("items");
		var r="";
		if(str!="") {
			if(str.indexOf(qry)<0) {
				r=str+qry;
			} else {
				r=str;
			}
		} else {
			r=qry;
		}
		set_tem("items",r);
		document.getElementById("msg").style.visibility='visible';
		oTimer = setTimeout("closeMsgBox()", 1000);
	}
	
	function closeMsgBox() {
		if(oTimer) clearTimeout(oTimer);
		document.getElementById("msg").style.visibility='hidden';
		updatecart();
	}

	function checkout() {
		if(bCoockie) {
			window.location="shopping_cart.php";
		} else {
			alert("To use Shopping Cart please enable Cookie on your web browser");
		}
	}

	function updatecart() {
		if(window.location.protocol=="https:") { 
			window.location.protocol="http:"; 
			return;
		}
		var i=0, ci=0;
		var sMsg = "0 items";
		var str="";
		if(bCoockie) {
			str=get_Item("items");
			if(str!="") i=str.split("|").length-1;
		}
		iQty=i;
		if(i>0) {
			sMsg=i+" items";
			if(i==1) sMsg=i+" item";
		}
		document.getElementById("myCart").innerHTML=sMsg;
	}
	
	function remove_item() {
		var str=get_Item("items");
		if(str) {
			str=str.replace(item_id,"");
			set_tem("items",str);
			window.location="shopping_cart.php";
		}
	}
	
	function removeitem(str) {
		item_id=str;
		document.getElementById("msg2").style.visibility='visible';
	}
	
	function hidemsgbx() {
		document.getElementById("msg2").style.visibility='hidden';
	}
	
	function show_picture(obj) {
		document.getElementById("big_img").src=obj.src;
	}

	function showbox() {
		document.getElementById("shadow1").style.visibility = "visible";
		document.getElementById("ppcont").style.visibility = "visible";
		document.getElementById("ppcont").style.top=10;
	}
	
	function hidebox() {
		document.getElementById("shadow1").style.visibility = "hidden";
		document.getElementById("ppcont").style.visibility = "hidden";
		document.getElementById("ppcont").style.top=-800;
	}
