window.onload = ShowCookies;

function ShowCookies () {

	if (location.pathname.indexOf("Articles.asp") != -1) {
//			var outMsg = "";
//			
//			if(document.cookie == ""){
//				outMsg = "There are no cookies here";
//			}
//			else {
//				var thisCookie = document.cookie.split("; ");	
//				
//				for(var i = 0; i<thisCookie.length; i++) {
//					outMsg += "Cookie name is '" +thisCookie[i].split("=")[0];
//					outMsg += "' and the value is'" +
//					thisCookie[i].split("=")[1] + "'<br />";
//				}
//			}
//			document.getElementById("cookieData").innerHTML = outMsg;
		
		var prod_code = "";
		var prod_price = "";
		var prod_name = "";
		var quantity = "";
		if(document.cookie == ""){
				outMsg = "There are no cookies here";
			}
			else {
				var thisCookie = document.cookie.split("; ");	
				
				for(var i = 0; i<thisCookie.length; i++) {
					if(thisCookie[i].split("=")[0] == "productcode") {
						prod_code = thisCookie[i].split("=")[1];
					}
					if(thisCookie[i].split("=")[0] == "price") {
						prod_price = thisCookie[i].split("=")[1];
					}
					if(thisCookie[i].split("=")[0] == "productname") {
						prod_name = thisCookie[i].split("=")[1];
					}
					if(thisCookie[i].split("=")[0] == "quantity") {
						quantity = thisCookie[i].split("=")[1];
					}
				}
			}
			var prodcode = $("input[name*='ProductCode']");
			if(prodcode) {
				prodcode.val(prod_code);
			}
			var prodname = $("input[name*='ProductName']");
			if(prodname) {
				prodname.val(prod_name);
			}
			var prodprice = $("input[name*='OriginalPrice']");
			if(prodprice) {
				prodprice.val(prod_price);
			}
			//$("input[name*='ProductCode']").css("border","solid blue 3px");
			var cookdata = document.getElementById("cookieData");
			if(cookdata) {
				cookdata.getElementById("cookieData").innerHTML = prod_code +" " + prod_price + " " + prod_name + " " + quantity;
			}
			//document.getElementById("cookieData").innerHTML = prod_code +" " + prod_price + " " + prod_name + " " + quantity;
			
			
//			
			

	}
	else {

	
	}
	
	if (location.pathname.indexOf("p/widget") != -1) {
		//$(".productnamecolorLARGE").css("border","solid blue 3px");
		//$(".productnamecolorLARGE").html($(".colors_productprice").html().split("$")[1]);
		//$("input[name='QTY.WIDGET']").css("border","solid blue 3px");
	}
}








