<!--
	// initialize Msg rider qty variables
	totalMsgqty18 = 0;
	totalMsgqty24 = 0;
	totalMsgqty28 = 0;
	// buyItem - adds an item to the shopping basket

	function buyItem() {
		// set up variables for message riders

		var whichitem = "Message Riders - Bilingual"
		var qty = Msgqty;
		var size = "6x24";

		// reinit this hidden field
		document.Msgriderform.hidden_sizeMsg.value = null;		
		itemNo = parseInt(Msgvalue) + "LES";

		// hard codes color variables as message rider colors do not change
		color = "red";
		bgcolor = "white";
//alert(Msgcopy + '   line    22');
		// copy is static for Msgriders
		copy1 = Msgcopy;

		// copy2 variable is not used for Msgriders
		copy2 = ""

		// sets Msgqty counter for Msgrider prices
		setTotalMsgqty(qty, size);
		oldCart = getCookie('ShopCart');
		newCart = "["+itemNo+"|"+whichitem+"|"+size+"|"+color+"|"+bgcolor+"|"+copy1+"|"+copy2+"|"+qty+"]";
		cartFull = oldCart + newCart;
		setCookie('ShopCart',cartFull);
		self.location.href="shop_view_cart.htm"
	}
	
	// sets Msgqty cookie so prices can be calculated in view_cart

	function setTotalMsgqty(thisMsgqty,thisMsgsize)
	{
		if (thisMsgsize == "4x18")
		{
			thatMsgqty18 = getCookie('totalMsgqty18');
			if (thatMsgqty18)
			{	totalMsgqty18 = thatMsgqty18;
				totalMsgqty18 = (eval(parseInt(totalMsgqty18) + parseInt(thisMsgqty)));		
			} else {
				totalMsgqty18 = (eval(parseInt(totalMsgqty18) + parseInt(thisMsgqty))); 
				}
			setCookie('totalMsgqty18', totalMsgqty18);
		}
	
		if (thisMsgsize == "6x24")
		{
			thatMsgqty24 = getCookie('totalMsgqty24');
			if (thatMsgqty24)
			{	totalMsgqty24 = thatMsgqty24;
				totalMsgqty24 = (eval(parseInt(totalMsgqty24) + parseInt(thisMsgqty)));		
			} else
			{
				totalMsgqty24 = (eval(parseInt(totalMsgqty24) + parseInt(thisMsgqty))); 
			}
			setCookie('totalMsgqty24', totalMsgqty24);
		}

		if (thisMsgsize == "6x28")
		{
			thatMsgqty28 = getCookie('totalMsgqty28');
			if (thatMsgqty28)
			{	totalMsgqty28 = thatMsgqty28;
				totalMsgqty28 = (eval(parseInt(totalMsgqty28) + parseInt(thisMsgqty)));		
			} else
			{
				totalMsgqty28 = (eval(parseInt(totalMsgqty28) + parseInt(thisMsgqty))); 
			}
			setCookie('totalMsgqty28', totalMsgqty28);
		}
			
	}

	// updates hidden form variable for size
	function updateMsgriderSize(thisSize)
	{
		size =thisSize;
//		document.Msgriderform.hidden_sizeMsg.value = thisSize;
		return;
	}
	
	// updates rider copy
	function updateMsgriderCopy(which)
	{
		Msgcopy = null;
		Msgvalue = null;
		var MsgcopyLength = null;
		var Msgdivider = null;
		
		Msgvalue = document.Msgriderform.Msgrider_copy.options[which].value;
		MsgcopyLength = Msgvalue.length;
		Msgdivider = (Msgvalue.indexOf("/") +1);
		Msgcopy = Msgvalue.substring(Msgdivider,MsgcopyLength);
		displayRider(Msgvalue);
	}
	
	// shows message rider graphic on page
	function displayRider(thisPic)	{
		// check if users browser is compliant with image.src
		isImage = (document.images);
		if (isImage)
		{ 
		var P = new Array();
			P[158] = "158LES-ACREAGE";
			P[159] = "159LES-ACRES";
			P[138] = "138LES-APARTMENT";
			P[134] = "134LES-ARROW";
			P[112] = "112LES-ASSUMABLE";
			P[231] = "231LES-AVAILABLE";
			P[102] = "102LES-Bedroom";
			P[116] = "116LES-BELOW APPRAISAL";
			P[148] = "148LES-BUILT BY";
			P[147] = "147LES-BUILD TO SUIT";
			P[163] = "163LES-COMMERCIAL";
			P[149] = "149LES-CUSTOM HOME";
			P[109] = "109LES-EXCLUSIVE";
			P[121] = "121LES-FARM";
			P[186] = "186LES-FIREPLACE";
			P[125] = "125LES-FOR LEASE";
			P[124] = "124LES-FOR RENT";
			P[122] = "122LES-FOR SALE";
			P[150] = "150LES-HOME OFFICE";
			P[108] = "108LES-IMMEDIATE OCCUPANCY";
			P[160] = "160LES-LAND";
			P[130] = "130LES-LAND FOR SALE";
			P[126] = "126LES-LEASE PURCHASE";
			P[222] = "222LES-LOTS FOR SALE";

			P[157] = "157LES-LOTS FOR SALE";
			P[113] = "113LES-LOW DOWN";
			P[156] = "156LES-MLS- MULTIPLE LISTING SERVICE";
			P[165] = "165LES-MOBILE HOME LOT";
			P[151] = "151LES-MODEL";
			P[155] = "155LES-MODEL HOME IN ARROW";
			P[117] = "117LES-NO QUALIFYING";
			P[137] = "137LES-OFFICE";
			P[139] = "139LES-OPEN IN ARROW";
			P[142] = "142LES-OPEN HOUSE IN ARROW";
			P[101] = "101LES-Open House";
			P[218] = "218LES-OPEN SATURDAY";

			P[128] = "128LES-OWNER AGENT";
			P[127] = "127LES-OWNER BROKER";
			P[176] = "176LES-OWNER FINANCING";
			P[190] = "190LES-POOL SPA";
			P[115] = "115LES-PRICE REDUCED";
			P[111] = "111LES-PRICED TO SELL";
			P[177] = "177LES-RANCH";
			P[153] = "153LES-REMODELED";
			P[164] = "164LES-RESIDENTIAL LOT";
			P[136] = "136LES-rv SPACE";
			P[178] = "178LES-SALE OR LEASE";
			P[129] = "129LES-SALE PENDING";
			P[179] = "179LES-SALE OR TRADE";
			P[133] = "133LES-SHOWN BY APPOINTMENT";
			P[131] = "131LES-SOLD";
			P[132] = "132LES-SOLD";
			P[180] = "180LES-SOLD";
			P[184] = "184LES-SOLD WE CAN SELL YOURS";
			P[196] = "196LES-SOLD WE HAVE OTHERS";
			P[119] = "119LES-SPECIAL TERMS";
			P[166] = "166LES-SWIMMING POOL";
			P[123] = "123LES-TERMS AVAILABLE";
			P[154] = "154LES-TOWNHOUSE";
			P[120] = "120LES-UNDER CONTRACT";
			P[183] = "183LES-WARRANTY";
			P[110] = "110LES-WILL TRADE";
			P[135] = "135LES-ZONING";

			P[301] = "301LES-AQUÍ SE HABLA ESPAÑOL";			
			P[302] = "302LES-HABLAMOS ESPAÑOL";
			P[303] = "303LES-HABLO ESPAÑO";
			P[304] = "304LES-SE HABLA ESPAÑOL";

			
		picNo = parseInt(thisPic);
		document.images["pic"].src = "images/bilingual/"+P[picNo]+".jpg";
	} else return
	}
	
	// validates form fields and adds rider info
	function addRider() {

		Msgqty = document.Msgriderform.Msgrider_qty.value;
		
		if (document.Msgriderform.Msgrider_copy.options.selectedIndex == 0) { alert('Please Select bilingual Rider Copy.');
		return;
		}
		 
		// validates Msgrider size
//		if ((document.Msgriderform.hidden_sizeMsg.value == 'null') || (document.Msgriderform.hidden_sizeMsg.value == ""))
//		{
//			alert('Please select a size.');
//			return;
//		} 

		// validates Msg rider size available for riders 218 and 219
	 	if ((parseInt(Msgvalue) == 218) || (parseInt(Msgvalue) == 219))
	 	{
	 		if (document.Msgriderform.hidden_sizeMsg.value == "4x18")
	 		{
	 			alert('Message Riders 218 and 219 are not available in size 4x18');
	 			return;
	 		}
	 	} 

		// validates Msgqty
		if (Msgqty == "" || Msgqty == " ")
		{
			alert('Please enter a quantity.');
			document.Msgriderform.Msgrider_qty.focus();
			return;
		}
		
		isNo = chkForNum(Msgqty);
		if (!isNo)	{
			alert('Please enter only numeric values');
			document.Msgriderform.Msgrider_qty.focus();
			return;
		}
		// adds rider info into cart
		buyItem()
	}
	
	// used in conjunction with button for debugging
	
	function loseCookies()
	{
		delCookie('totalMsgqty18');
		delCookie('totalMsgqty24');
		delCookie('totalMsgqty28');		
	}
	
// -->	