																																					function addProductToCart(gsiID, qty) {	var frm0 = document.forms[0];	var frm1 = document.forms[1];	jsSystemID = gsiID;	jsQty = qty;	sessionCartID = readCartCookie() ;	if (sessionCartID == "" || sessionCartID == null) {// generate a cart ID for a new order and set the cookie		todayDate = new Date();		thisMonth = todayDate.getMonth() + ""  ;		thisDay = todayDate.getDate() + ""  ;		thisTime = todayDate.getTime() + ""  ;		rndNumber = Math.random()  ;		rndNumberText = rndNumber + "" ;		rndNumberText = rndNumberText.substring(12) ;		thisTime = thisTime.substring(6) ;		sessionCartID = "CRT" + thisTime  + rndNumberText;		setCartCookie(sessionCartID) ;	}	// Now immediatly try to read the cooke to see if cookies are enabled.	//If not, warn the user to enable them.	tempSessionID = readCartCookie();	if (tempSessionID == "" || tempSessionID == null) {		var cookie_msg1 = "";		cookie_msg1 += "NOTE !!\n";		cookie_msg1 += "_________________________________________________\n\n";		cookie_msg1 += "We use cookies to keep track of the ordering process.\n";		cookie_msg1 += "You'll need to enable cookies in your browser to continue.\n";		cookie_msg1 += "If you aren't sure how to do this, check through the browser\n";		cookie_msg1 += "help, or search online.\n";		cookie_msg1 += "_________________________________________________\n";		alert(cookie_msg1) ;		return ;	}	frm0.addToCartSessionID.value = sessionCartID ;	frm0.addToCartGSISystemID.value = jsSystemID ;	frm0.actionType.value = "AddLine" ;	frm0.submit() ;	//setXMLAddToCart (sessionCartID, jsSystemID, jsQty)}function displayCartItems() {	sessionCartID = readCartCookie() ;	if (sessionCartID == "" || sessionCartID == null) {		msg = "Your cart appears to be empty" ;		alert(msg) ;		return ;	}else {		// extend the cart cookie		setCartCookie(sessionCartID) ;		fullOpenCommand = GNServerPath + "/fORDCart?OpenForm&cartID=" +sessionCartID;		window.location.replace(fullOpenCommand) ;	}}function enterCustInfo() {	sessionCartID = readCartCookie() ;	if (sessionCartID == "" || sessionCartID == null) {		msg = "Your cart appears to be empty" ;		alert(msg) ;		return ;	}else {		// extend the cart cookie		setCartCookie(sessionCartID) ;		fullOpenCommand = GNServerPath + "/fORDCustInfo?OpenForm&cartID=" +sessionCartID;		window.location.replace(fullOpenCommand) ;	}}function checkoutCartItems() {	sessionCartID = readCartCookie()  ;	if (sessionCartID == "" || sessionCartID == null) {		msg = "Your cart appears to be empty" ;		alert(msg) ;		return ;	} else {		// get the cookie		sessionCartID = readCartCookie()  ;		// reset the cookie to expire immediately		expireCartCookie(sessionCartID) ;		fullOpenCommand = jsSSLPath + "/fAPOrderCC" + SiteLayoutStyle + "?OpenForm&cartID=" +sessionCartID + "&replicaid=" + jsReplicaID +  "&referrer=" + GNServerPath;		window.location.replace(fullOpenCommand) ;	}}function updateCart() {	var frm = document.forms[0];	frm ["actionType"].value = "UpdateCart" ;	frm.submit() ;}function changeQuantity(lineID) {	choice = document.forms[0] [ lineID ].selectedIndex;	textChoice = document.forms[0] [ lineID ].options[choice].text;}function changeQuantities(lineNumber) {// add some checking here to verify a quantity	var frm0 = document.forms[0];	var frm1 = document.forms[1];	jsLineNumber = lineNumber;	var frm = document.forms[0];	qtyScreenFieldName = "Qty" + jsLineNumber;	qtySaveFieldName = "SQty" + jsLineNumber;	qtyvalue= frm1 [ qtyScreenFieldName ].value;	if ( qtyvalue == "" ) {		qtyvalue = "0";		frm1 [ qtyScreenFieldName ].value = qtyvalue;	} 	if ( isNaN( qtyvalue ) ) {		alert( "Quantities must be whole numeric");		qtyvalue= frm [ qtySaveFieldName ].value;		frm1 [ qtyScreenFieldName ].value = qtyvalue;		return;	}	frm0 [ qtySaveFieldName ].value = qtyvalue;}function removeItem(lineNumber) {	var frm0 = document.forms[0];	var frm1 = document.forms[1];	frm0 ["LineToRemoveText"].value = lineNumber ;	frm0.actionType.value = "RemoveLine" ;	frm0.submit() ;}function cancelOrder() {	var frm = document.forms[0];	var confirm_msg1 = "";	confirm_msg1 += "WARNING !!\n";	confirm_msg1 += "_________________________________________________\n\n";	confirm_msg1 += "The complete order will be deleted immediately.\n";	confirm_msg1 += "Are you sure you wish to continue?\n";	confirm_msg1 += "_________________________________________________\n";		if (confirm(confirm_msg1) == true) {		frm.actionType.value = "CancelOrder"		frm.OrderStatus.value = "Cancelled"		// get the cookie		sessionCartID = readCartCookie()  ;		// reset the cookie to expire immediately		expireCartCookie(sessionCartID) ;			frm.submit();	} else {		return;	}	}function readCartCookie() {	cookieValue = getCookie("sessionCartID");	return cookieValue ;}function getCookie(name) {         var dc = document.cookie;         var prefix = name + "=";         var begin = dc.indexOf("; " + prefix);         if (begin == -1) {           begin = dc.indexOf(prefix);           if (begin != 0) return null;         } else           begin += 2;         var end = document.cookie.indexOf(";", begin);         if (end == -1)           end = dc.length;         return unescape(dc.substring(begin + prefix.length, end));       }function setCartCookie(value) {	formValue = value;	var now = new Date();	fixDate(now);// 365 days in a year// 24 hours in a day// 60 minutes in an hour// 60 seconds in a minute// 1000 milliseconds in a second	 now.setTime(now.getTime() + 60 * 60 * 1000);// cookie expires in one hour;  60 mins * 60 secs * 1000 ticks     setCookie("sessionCartID", formValue, now, "/");     }function expireCartCookie(value) {	formValue = value;	var now = new Date();	fixDate(now);// 365 days in a year// 24 hours in a day// 60 minutes in an hour// 60 seconds in a minute// 1000 milliseconds in a second	 now.setTime(now.getTime() - 1 * 1 * 1000);// cookie expires in one second;  1 mins * 1 secs * 1000 ticks     setCookie("sessionCartID", formValue, now, "/");     }function setCookie(name, value, expires, path, domain, secure) {         var curCookie = name + "=" + escape(value) +             ((expires) ? "; expires=" + expires.toGMTString() : "") +             ((path) ? "; path=" + path : "") +             ((domain) ? "; domain=" + domain : "") +             ((secure) ? "; secure" : "");         document.cookie = curCookie;       }function fixDate(date) {	var base = new Date(0);	var skew = base.getTime();	if (skew > 0) {		date.setTime(date.getTime() - skew);	}}
