        var bColorPreviewImageAvailable = false;
	function openWindow(iWhich){
		var sUrl;
		var oMfr = document.getElementById("lstMfr");
		switch (parseInt(iWhich)){
			case 1:
				sUrl = "/colorcrossref.asp?mfr=" + oMfr.options[oMfr.selectedIndex].value;
			break;
			case 2:
				sUrl = "/colorcrossref.asp?mfr=" + oMfr.options[oMfr.selectedIndex].value;
			break;
		}

		var myWindow = window.open(sUrl, "crossref", 'width=550,height=600');
	} 
	function getList(iWhich)
	{
	//this function get the list on the file from the server and populates the
	//corresponding list box, based off what list box had been changed.
		var oVehicle = document.getElementById("lstVehicle");
		var oMfr = document.getElementById("lstMfr");
		var oModel = document.getElementById("lstModel");
		var oYear = document.getElementById("lstYear");
		var oMfrColor = document.getElementById("lstMfrColor");

		var oImgDesign = document.getElementById("imgDesign");
		var oPrimary = document.getElementById("lstPrimary");
		var oSecondary = document.getElementById("lstSecondary");
		var oThird = document.getElementById("lstThird");
		var oFourth = document.getElementById("lstFourth");

		var oPrimaryDesc = document.getElementById("spanPrimary");
		var oSecondaryDesc = document.getElementById("spanSecondary");
		var oThirdDesc = document.getElementById("spanThird");
		var oFourthDesc = document.getElementById("spanFourth");

		var box;
		var j=0;
		var oHttp;
		var sUrl = '/getlist-step1.asp?w=' + iWhich;
		var iSelectedIndex=0;
		switch (iWhich) {
			case 1:
			//vehicle was changed get list for mfr
				iSelectedIndex=oVehicle.selectedIndex
				sUrl = sUrl + '&v=' + oVehicle.options[oVehicle.selectedIndex].value;
				box = oMfr;
				box.options.length=0;
				box.options[j++]= new Option ('Select Manufacturer',-1);
				oModel.options.length=1;
				oYear.options.length=1;
				oMfrColor.options.length=1;
				oModel.options[0].selected=true;
				oYear.options[0].selected=true;
				oMfrColor.options[0].selected=true;
				oImgDesign.src = "/images/genericdesignholder.jpg";
				//disable other boxes
				oModel.disabled=true;
				oYear.disabled=true;
				oMfrColor.disabled=true;
			break;
			case 2:
			//mfr was changed get list for model
				iSelectedIndex=oMfr.selectedIndex
				sUrl  = sUrl +   '&v=' + oVehicle.options[oVehicle.selectedIndex].value + '&mfr=' + oMfr.options[oMfr.selectedIndex].value;
				box = oModel;
				box.options.length=0;
				box.options[j++]= new Option ('Select Model',-1);
				oYear.options.length=1;
				oMfrColor.options.length=1;
				oYear.options[0].selected=true;
				oMfrColor.options[0].selected=true;
				oImgDesign.src = "/images/genericdesignholder.jpg";
				//disable other boxes
				oYear.disabled=true;
				oMfrColor.disabled=true;
			break;
			case 3:
			//model was changed get list for Year
				iSelectedIndex=oModel.selectedIndex
				sUrl  = sUrl +  '&v=' +  oVehicle.options[oVehicle.selectedIndex].value + '&mfr=' + oMfr.options[oMfr.selectedIndex].value + '&model=' + oModel.options[oModel.selectedIndex].value;
				box = oYear;
				box.options.length=0;
				box.options[j++]= new Option ('Select Year',-1);
				oMfrColor.options.length=1;
				oMfrColor.options[0].selected=true;
				oImgDesign.src = "/images/genericdesignholder.jpg";
				//disable other boxes
				oMfrColor.disabled=true;
			break;
			case 4:
			//year was changed get list for mfr color
				iSelectedIndex=oYear.selectedIndex
				box = oMfrColor;
				sUrl  = sUrl +  '&v=' + oVehicle.options[oVehicle.selectedIndex].value + '&mfr=' + oMfr.options[oMfr.selectedIndex].value + '&model=' + oModel.options[oModel.selectedIndex].value + '&year=' + oYear.options[oYear.selectedIndex].value; 				box = oMfrColor;
				box.options.length=0;
				box.options[j++]= new Option ('Select Manufacturer Color',-1);
			break;
		}
		//no matter what must always zero out the colors and the design image.
		oPrimary.options[0].selected=true;
		oSecondary.options[0].selected=true;
		oThird.options[0].selected=true;
		oFourth.options[0].selected=true;
		
		oPrimary.disabled=true;
		oSecondary.disabled=true;
		oThird.disabled=true;
		oFourth.disabled=true;
		oPrimaryDesc.innerHTML = 'Not Applicable on this model';
		oSecondaryDesc.innerHTML= 'Not Applicable on this model';
		oThirdDesc.innerHTML= 'Not Applicable on this model';
		oFourthDesc.innerHTML= 'Not Applicable on this model';
		
		setColorBox(1,0);
		setColorBox(2,0);
		setColorBox(3,0);
		setColorBox(4,0);

		//now lets retrieve the data
		if (window.XMLHttpRequest) {		
	      oHttp = new XMLHttpRequest();
			oHttp.open("GET", sUrl, false);
			oHttp.send(null);
	    } 
		 else if (window.ActiveXObject) {
  	    // branch for IE/Windows ActiveX version
	        	oHttp = new ActiveXObject("Microsoft.XMLHTTP");
			  	oHttp.open("GET", sUrl, false);
				oHttp.send();
	    }
		//Could have used XML, yes but it can be a pain with special characters.
		//records are defined inbetween ^
		//Fields in a record are defined as inbetween |
		var sInfo = oHttp.responseText;
		var aInfo = sInfo.split("^");
		if (iWhich>1 && aInfo.length>1){
			oImgDesign.src = '/webpages/' + aInfo[0];
			setupColorPreview(aInfo[0]);
		} else {
			setupColorPreview('');
		}
		if (aInfo.length>0){
			var items;
			for (var i=1; i< aInfo.length; i++){
				items  = aInfo[i].split("|");
				box.options[j]= new Option (items[1],items[0]);
				j++;
			}
		}
		box.options[0].selected=-1;
		box.disabled=iSelectedIndex < 1;
		oHttp = null;
		return true;
	}
	function getMfrColor()
	{
	//this function get the list on the file from the server and populates the
	//corresponding list box, based off what list box had been changed.
		var oVehicle = document.getElementById("lstVehicle");
		var oMfr = document.getElementById("lstMfr");
		var oModel = document.getElementById("lstModel");
		var oYear = document.getElementById("lstYear");
		var oMfrColor = document.getElementById("lstMfrColor");
		


		var oPrimaryNA = document.getElementById("imgPrimaryNA");
		var oSecondaryNA = document.getElementById("imgSecondaryNA");
		var oThirdNA = document.getElementById("imgThirdNA");
		var oFourthNA = document.getElementById("imgFourthNA");

		var oPrimary = document.getElementById("lstPrimary");
		var oSecondary = document.getElementById("lstSecondary");
		var oThird = document.getElementById("lstThird");
		var oFourth = document.getElementById("lstFourth");

		var oPrimaryImg = document.getElementById("imgPrimary");
		var oSecondaryImg = document.getElementById("imgSecondary");
		var oThirdImg = document.getElementById("imgThird");
		var oFourthImg = document.getElementById("imgFourth");

		var oPrimaryPreviewImg = document.getElementById("imgColorPreview01");
		var oSecondaryPreviewImg = document.getElementById("imgColorPreview02");
		var oThirdPreviewImg = document.getElementById("imgColorPreview03");
		var oFourthPreviewImg = document.getElementById("imgColorPreview04");

		var oPrimaryDesc = document.getElementById("spanPrimary");
		var oSecondaryDesc = document.getElementById("spanSecondary");
		var oThirdDesc = document.getElementById("spanThird");
		var oFourthDesc = document.getElementById("spanFourth");

		var oImgDesign = document.getElementById("imgDesign");
		
		var box;
		var j=0;
		var oHttp;
		var sUrl = '/getmfrcolor-step1.asp?';
		sUrl  = sUrl +  'v=' + oVehicle.options[oVehicle.selectedIndex].value + '&mfr=' 
		sUrl = sUrl + oMfr.options[oMfr.selectedIndex].value + '&model=' + oModel.options[oModel.selectedIndex].value 
		sUrl = sUrl + '&year=' + oYear.options[oYear.selectedIndex].value;
		sUrl = sUrl + '&mfrcolor=' + oMfrColor.options[oMfrColor.selectedIndex].value;
		//now lets retrieve the data
		if (window.XMLHttpRequest) {		
	      oHttp = new XMLHttpRequest();
			oHttp.open("GET", sUrl, false);
			oHttp.send(null);
	    } 
		 else if (window.ActiveXObject) {
  	    // branch for IE/Windows ActiveX version
	        	oHttp = new ActiveXObject("Microsoft.XMLHTTP");
			  	oHttp.open("GET", sUrl, false);
				oHttp.send();
	    }
		//Could have used XML, yes but it can be a pain with special characters.
		//Fields in a record are defined as inbetween |
		var sInfo = oHttp.responseText;
		var aInfo = sInfo.split("^");
		var items;
		if (sInfo.length>0){
			items  = aInfo[0].split("|");
			if (oMfrColor.options[oMfrColor.selectedIndex].value!=-1){
				oImgDesign.src = '/webpages/' + items[13];
				setupColorPreview(items[13]);
			}		
			else{
				setupColorPreview('');
				oImgDesign.src = "/images/genericdesignholder.jpg"
				oPrimaryDesc.innerHTML = 'Not Applicable on this model';
				oPrimaryNA.innerHTML = "N/A";
				oPrimaryNA.style.display = 'Block';
				oPrimaryImg.style.display = 'None';
				oPrimary.disabled = false;
				setColorList(1, -1);
	
				oSecondaryDesc.innerHTML = 'Not Applicable on this model';
				oSecondaryNA.innerHTML = "N/A";
				oSecondaryNA.style.display = 'Block';
				oSecondaryImg.style.display = 'None';
				oSecondary.disabled = false;
				setColorList(2, -1);
	
				oThirdDesc.innerHTML = 'Not Applicable on this model';
				oThirdNA.innerHTML = "N/A";
				oThirdNA.style.display = 'Block';
				oThirdImg.style.display = 'None';
				oThird.disabled = false;
				setColorList(3, -1);
	
				oFourthDesc.innerHTML = 'Not Applicable on this model';
				oFourthNA.innerHTML = "N/A";
				oFourthNA.style.display = 'Block';
				oFourthImg.style.display = 'None';
				oFourth.disabled = false;
				setColorList(4, -1);
			}
			if (items[0]!=''){
				oPrimaryDesc.innerHTML = items[0];
				if (parseInt(items[4])==-1) {
				//Custom selection
					oPrimary.disabled = false;
					oPrimaryNA.style.display = 'Block';
					oPrimaryNA.innerHTML = "&nbsp;?";
					oPrimaryImg.style.display = 'None';
					oPrimaryPreviewImg.style.display = 'None';
					setColorList(1, -1);
				}
				else{
				//predefined color
					oPrimary.disabled = true;
					oPrimaryNA.innerHTML = "&nbsp;?";
					oPrimaryNA.style.display = 'None';
					oPrimaryImg.style.display = 'Block';
					oPrimaryImg.style.backgroundColor = items[5];
					oPrimaryPreviewImg.style.display = 'Block';
					setColorList(1, items[9]);
				}
			}
			else{
			//No primary color specified.  Therefore not Applicable.
				oPrimaryDesc.innerHTML = 'Not Applicable on this model';
				oPrimaryNA.innerHTML = "N/A";
				oPrimaryNA.style.display = 'Block';
				oPrimaryImg.style.display = 'None';
				oPrimaryPreviewImg.style.display = 'None';
				oPrimary.disabled = true;
				setColorList(1, -1);
			}
			if (items[1]!=''){
				oSecondaryDesc.innerHTML = items[1];
				if (items[4]==-1) {
					oSecondary.disabled = false;
					oSecondaryNA.innerHTML = "&nbsp;?";
					oSecondaryNA.style.display = 'Block';
					oSecondaryImg.style.display = 'None';
					oSecondaryPreviewImg.style.display = 'None';
					setColorList(2, -1);
				}
				else{
					oSecondary.disabled = true;
					oSecondaryNA.style.display = 'None';
					oSecondaryNA.innerHTML = "&nbsp;?";
					oSecondaryImg.style.display = 'Block';
					oSecondaryImg.style.backgroundColor = items[6];
					oSecondaryPreviewImg.style.display = 'Block';
					setColorList(2, items[10]);
				}
			}
			else{
				oSecondaryDesc.innerHTML = 'Not Applicable on this model';
				oSecondaryNA.innerHTML = "N/A";
				oSecondaryNA.style.display = 'Block';
				oSecondaryImg.style.display = 'None';
				oSecondaryPreviewImg.style.display = 'None';
				oSecondary.disabled = true;
				setColorList(2, -1);
			}
			if (items[2]!=''){
				oThirdDesc.innerHTML = items[2];
				if (items[4]==-1) {
					oThird.disabled = false;
					oThirdNA.innerHTML = "&nbsp;?";
					oThirdNA.style.display = 'Block';
					oThirdImg.style.display = 'None';
					oThirdPreviewImg.style.display = 'None';
					setColorList(3, -1);
				}
				else{
					oThird.disabled = true;
					oThirdNA.innerHTML = "&nbsp;?";
					oThirdNA.style.display = 'None';
					oThirdImg.style.display = 'Block';
					oThirdImg.style.backgroundColor = items[7];
					oThirdPreviewImg.style.display = 'Block';
					setColorList(3, items[11]);
				}
			}
			else{
				oThirdDesc.innerHTML = 'Not Applicable on this model';
				oThirdNA.innerHTML = "N/A";
				oThirdNA.style.display = 'Block';
				oThirdImg.style.display = 'None';
				oThirdPreviewImg.style.display = 'None';
				oThird.disabled = true;
				setColorList(3, -1);
			}
			if (items[3]!=''){
				oFourthDesc.innerHTML = items[3];
				if (items[4]==-1) {				
					oFourth.disabled = false;
					oFourthNA.innerHTML = "&nbsp;?";
					oFourthNA.style.display = 'Block';
					oFourthImg.style.display = 'None';
					oFourthPreviewImg.style.display = 'None';
					setColorList(4, -1);
				}
				else{
					oFourth.disabled = true;
					oFourthNA.innerHTML = "&nbsp;?";
					oFourthNA.style.display = 'None';
					oFourthImg.style.display = 'Block';
					oFourthImg.style.backgroundColor = items[8];
					oFourthPreviewImg.style.display = 'Block';
					setColorList(4, items[12]);
				}
			}
			else{
				oFourthDesc.innerHTML = 'Not Applicable on this model';
				oFourthNA.innerHTML = "N/A";
				oFourthNA.style.display = 'Block';
				oFourthImg.style.display = 'None';
				oFourthPreviewImg.style.display = 'None';
				oFourth.disabled = true;
				setColorList(4, -1);
			}
		}
		return true;
	}
	function setColorList(iWhich, iValue){
	//Sets the selectedvalue of the list to the value passed into the function
		var oList;
		var oHid;
		switch (iWhich) {
			case 1:
			//Primary
				oList = document.getElementById("lstPrimary");
				oHid =  document.getElementById("hidPrimary");
			break;
			case 2:
			//Secondary
				oList = document.getElementById("lstSecondary");
				oHid =  document.getElementById("hidSecondary");
			break;
			case 3:
			//third
				oList = document.getElementById("lstThird");
				oHid =  document.getElementById("hidThird");

			break;
			case 4:
			//Fourth
				oList = document.getElementById("lstFourth");
				oHid =  document.getElementById("hidFourth");
			break;
		}
		var i=0;
		var items;

		for (i=0; i<oList.length; i++){
			items  = oList.options[i].value.split(",");
			if (items[0]==iValue) {
				oList.options[i].selected=true;
				oHid.value = iValue;
				if (iValue != -1) {
					setPreviewColor(iWhich, items[1]);
				}
			}
		}
	}
	function setupColorPreview(sImgUrl) {
		if (sImgUrl=='') {
        		bColorPreviewImageAvailable = false;
		} else {
			var sUrl = getColorPreviewImageFolder() + 'base.jpg';
 			var oHttp;
			if (window.XMLHttpRequest) {		
				oHttp = new XMLHttpRequest();
				oHttp.open("HEAD", sUrl, false);
				oHttp.send(null);
			} 
			else if (window.ActiveXObject) {
			// branch for IE/Windows ActiveX version
				oHttp = new ActiveXObject("Microsoft.XMLHTTP");
				oHttp.open("HEAD", sUrl, false);
				oHttp.send();
			}
        		bColorPreviewImageAvailable = oHttp.status == 200 && oHttp.getResponseHeader('Content-Type') == 'image/jpeg';
			oHttp = null;
			if (bColorPreviewImageAvailable) {
				document.getElementById("imgColorPreview").src = sUrl;
			}
		}
		if (!bColorPreviewImageAvailable) {
			document.getElementById("imgColorPreview").src = "/images/bike_unavailable.gif";
			document.getElementById("imgColorPreview01").style.display = "None";
			document.getElementById("imgColorPreview02").style.display = "None";
			document.getElementById("imgColorPreview03").style.display = "None";
			document.getElementById("imgColorPreview04").style.display = "None";
		}
		document.getElementById("imgColorPreview01").src = "images/spacer.gif";
		document.getElementById("imgColorPreview02").src = "images/spacer.gif";
		document.getElementById("imgColorPreview03").src = "images/spacer.gif";
		document.getElementById("imgColorPreview04").src = "images/spacer.gif";
	}
	function setPreviewColor(iWhich, sColor) {
		if (bColorPreviewImageAvailable) {
			var oImgPreviewColor = document.getElementById("imgColorPreview0" + iWhich);
			var sColorNumber = sColor.split("#");
			if (sColorNumber != null && sColorNumber[1] != null) {
				oImgPreviewColor.src = getColorPreviewImageFolder() + "0" + iWhich + "_" + sColorNumber[1].toUpperCase() + ".gif";
				oImgPreviewColor.style.display = "Block";
			} else {
				oImgPreviewColor.style.display = "None";
				oImgPreviewColor.src = "images/spacer.gif";
			}
		}
	}
	function getColorPreviewImageFolder() {
		var rMatch = document.getElementById("imgDesign").src.match(/\/images\/(\w+)\/(\w+)-([-\w]+)\.\w+$/);
		if (rMatch == null) {
			return "/webpages/images/";
		}
		var sSubdirectory = rMatch[1];
		var sMake = rMatch[2];
		var sDesignBaseName = rMatch[3];
		return "/webpages/images/colorpreview/" + sSubdirectory + "/" + sMake + "/" + sMake + "-" + sDesignBaseName + "/colors/";
	}
	function setColorBox(iWhich, iType){
	//Sets the selectedvalue of the list to the value passed into the function
		var oList;
		var oImg;
		var oImgNA; 
		var oHid;
		switch (iWhich) {
			case 1:
			//Primary
				oList = document.getElementById("lstPrimary");
				oImg = document.getElementById("imgPrimary");
				oImgNA = document.getElementById("imgPrimaryNA");
				oHid =  document.getElementById("hidPrimary");
			break;
			case 2:
			//Secondary
				oList = document.getElementById("lstSecondary");
				oImg = document.getElementById("imgSecondary");				
				oImgNA = document.getElementById("imgSecondaryNA");
				oHid =  document.getElementById("hidSecondary");
			break;
			case 3:
			//third
				oList = document.getElementById("lstThird");
				oImg = document.getElementById("imgThird");
				oImgNA = document.getElementById("imgThirdNA");
				oHid =  document.getElementById("hidThird");
			break;
			case 4:
			//Fourth
				oList = document.getElementById("lstFourth");
				oImg = document.getElementById("imgFourth");
				oImgNA = document.getElementById("imgFourthNA");
				oHid =  document.getElementById("hidFourth");
			break;
		}
		var sValue = oList.options[oList.selectedIndex].value;
		var items  = sValue.split(",");
		if (iType==1){
			oImg.style.backgroundColor = items[1];
			oHid.value = items[0];
			oImgNA.style.display = "None";
			oImg.style.display = "Block";
			setPreviewColor(iWhich, items[1]);
		}
		else {
			oHid.value=0;
			oImgNA.innerHTML = "&nbsp;?";
			oImgNA.style.display = 'Block';
			oImg.style.display = 'None';
		}
	}
	function dvDesignInfo(){
		var oVehicle = document.getElementById("lstVehicle");
		var oMfr = document.getElementById("lstMfr");
		var oModel = document.getElementById("lstModel");
		var oYear = document.getElementById("lstYear");
		var oMfrColor = document.getElementById("lstMfrColor");
		var oPrimary = document.getElementById("lstPrimary");
		var oSecondary = document.getElementById("lstSecondary");
		var oThird = document.getElementById("lstThird");
		var oFourth = document.getElementById("lstFourth");
		
		var sMsg='';
		if (oVehicle.value==-1){
			sMsg=sMsg + '** Vehicle missing\n';
		}
		if (oMfr.value==-1){
			sMsg=sMsg + '** Mfr missing\n';
		}
		if (oModel.value==-1){
			sMsg=sMsg + '** Model missing\n';
		}
		if (oYear.value==-1){
			sMsg=sMsg + '** Year missing\n';
		}
		if (oMfrColor.value==-1){
			sMsg=sMsg + '** Mfr Color missing\n';
		}
		if (oMfrColor.value!=-1){
			if (!oPrimary.disabled && oPrimary.value.indexOf('-1,')!=-1)
				sMsg=sMsg + '** Primary Color missing\n';
			if (!oSecondary.disabled && oSecondary.value.indexOf('-1,')!=-1)
				sMsg=sMsg + '** Secondary Color missing\n';
			if (!oThird.disabled && oThird.value.indexOf('-1,')!=-1)
				sMsg=sMsg + '** Third Color missing\n';
			if (!oFourth.disabled && oFourth.value.indexOf('-1,')!=-1)
				sMsg=sMsg + '** Fourth Color missing\n';
		}
		if (sMsg!='') {
			sMsg =  "Please answer the following selections before continuing:\n\n" + sMsg + "\n";
			alert(sMsg);
			return false;
		}
		else{
			return true;
		}
	}
	function IsEmpty (str){
	/* used to validate the str is not empty  form.txt_fSearchText.value && (!IsEmpty (form.txt_fZipCode.value) || form.lstMiles.value!='-1')*/
		var intLoop=0;
		var bResult=true;
		for (intLoop=0; intLoop<str.length; intLoop++){
			if (str.charAt(intLoop)!=" ") bResult = false;
		}
		return bResult;
	}
	function addText(){
		var oLine1 = document.getElementById("txtLine1");
		var oLine2 = document.getElementById("txtLine2");
		var oLine3 = document.getElementById("txtLine3");
		var oPrice = document.getElementById("txtTextPrice");
		var iLines = 0;
		if (!IsEmpty(oLine1.value))
			iLines= iLines + 1;
		if (!IsEmpty(oLine2.value))
			iLines= iLines + 1;
		if (!IsEmpty(oLine3.value))
			iLines= iLines + 1;
		switch(iLines) {
			case 1: oPrice.value = '3.50'; break;
			case 2: oPrice.value = '7.00'; break;
			case 3: oPrice.value = '10.50'; break;
			default: oPrice.value = '0.00';
		}
	}
	function dvTextInfo(){
		var oLstLine1 = document.getElementById("lstStyle1");
		var oLstLine2 = document.getElementById("lstStyle2");
		var oLstLine3 = document.getElementById("lstStyle3");
		var oLine1 = document.getElementById("txtLine1");
		var oLine2 = document.getElementById("txtLine2");
		var oLine3 = document.getElementById("txtLine3");
		
		var sMsg='';
		if (oLstLine1.value!=-1 && IsEmpty(oLine1.value)){
			sMsg=sMsg + '** Line 1 Text \n';
		}
		if (oLstLine1.value==-1 && !IsEmpty(oLine1.value)){
			sMsg=sMsg + '** Line 1 Text Style \n';
		}
		if (oLstLine2.value!=-1 && IsEmpty(oLine2.value)){
			sMsg=sMsg + '** Line 2 Text \n';
		}
		if (oLstLine2.value==-1 && !IsEmpty(oLine2.value)){
			sMsg=sMsg + '** Line 2 Text Style \n';
		}
		if (oLstLine3.value!=-1 && IsEmpty(oLine3.value)){
			sMsg=sMsg + '** Line 3 Text \n';
		}
		if (oLstLine3.value==-1 && !IsEmpty(oLine3.value)){
			sMsg=sMsg + '** Line 3 Text Style \n';
		}
		if (sMsg!='') {
			sMsg =  "Please answer the following selections before continuing:\n\n" + sMsg + "\n";
			alert(sMsg);
			return false;
		}
		else{
			return true;
		}
	}
	function dvApparelInfo(){
		var oType = document.getElementById("lstApparelTypes");
		var oStyle = document.getElementById("lstApparelStyles");
		var oSize = document.getElementById("lstApparelSizes");
		var oColor = document.getElementById("lstApparelColors");
		
		var sMsg='';
		if (oType.value==-1){
			sMsg=sMsg + '** Apparel Type missing\n';
		}
		if (oStyle.value==-1){
			sMsg=sMsg + '** Apparel Style missing\n';
		}
		if (oSize.value==-1){
			sMsg=sMsg + '** Apparel Size missing\n';
		}
		if (oColor.value==-1){
			sMsg=sMsg + '** Apparel Color missing\n';
		}
		if (sMsg!='') {
			sMsg =  "Please answer the following selections before continuing:\n\n" + sMsg + "\n";
			alert(sMsg);
			return false;
		}
		else{
			return true;
		}
	}
	function changeDisplay(iWhich)
	{
		var oStep1 = document.getElementById('divStep1');
		var oStep2 = document.getElementById('divStep2');
		var oStep3 = document.getElementById('divStep3');
		var oStep4 = document.getElementById('divStep4');
		var oStep1Color = document.getElementById('tdStep1');
		var oStep2Color = document.getElementById('tdStep2');
		var oStep3Color = document.getElementById('tdStep3');
		var oStep4Color = document.getElementById('tdStep4');
		switch (iWhich){
			case 1:
				oStep1.style.display='block';
				oStep2.style.display='none';
				oStep3.style.display='none';
				oStep4.style.display='none';
				oStep1Color.style.color='#A52A2A';
				oStep2Color.style.color='#A9A9A9';
				oStep3Color.style.color='#A9A9A9';
				oStep4Color.style.color='#A9A9A9';
			break;
			case 2:
				if (dvDesignInfo()){
					oStep1.style.display='none';
					oStep2.style.display='block';
					oStep3.style.display='none';
					oStep4.style.display='none';
					oStep1Color.style.color='#A9A9A9';
					oStep2Color.style.color='#A52A2A';
					oStep3Color.style.color='#A9A9A9';
					oStep4Color.style.color='#A9A9A9';
				}
			break;
			case 3:
				if (dvApparelInfo()){
					oStep1.style.display='none';
					oStep2.style.display='none';
					oStep3.style.display='block';
					oStep4.style.display='none';
					oStep1Color.style.color='#A9A9A9';
					oStep2Color.style.color='#A9A9A9';
					oStep3Color.style.color='#A52A2A';
					oStep4Color.style.color='#A9A9A9';
				}
			break;
			case 4:
				if (dvTextInfo()){
					oStep1.style.display='none';
					oStep2.style.display='none';
					oStep3.style.display='none';
					oStep4.style.display='block';
					oStep1Color.style.color='#A9A9A9';
					oStep2Color.style.color='#A9A9A9';
					oStep3Color.style.color='#A9A9A9';
					oStep4Color.style.color='#A52A2A';
					popReview();
				}
			break;
		}
		return false;
	}
	function getApparelList(iWhich)
	{
	//this function get the list on the file from the server and populates the
	//corresponding list box, based off what list box had been changed.
		var oApparelTypes = document.getElementById("lstApparelTypes");
		var oApparelStyles = document.getElementById("lstApparelStyles");
		var oApparelSizes = document.getElementById("lstApparelSizes");
		var oApparelColors= document.getElementById("lstApparelColors");
		var oApparelPrice = document.getElementById("txtApparelPrice");
		var oImgApparel= document.getElementById("imgApparel");
		var oBtnSizes= document.getElementById("btnSizes");
		var oBtnColors= document.getElementById("btnColors");
		var oAllowText = document.getElementById("divAllowText");
		var oAllowTextNo = document.getElementById("divAllowTextNo");

		var box;
		var j=0;
		var oHttp;
		var sUrl = '/getlist-step3.asp?w=' + iWhich;

		switch (iWhich) {
			case 1:
			//types was changed get list for Styles
				sUrl = sUrl + '&t=' + oApparelTypes.options[oApparelTypes.selectedIndex].value;
				box = oApparelStyles;
				box.options.length=0;
				box.options[j++]= new Option ('Select Apparel Style',-1);

				oApparelSizes.options.length=1;
				oApparelColors.options.length=1;
				oApparelSizes.options[0].selected=true;
				oApparelColors.options[0].selected=true;

				//no matter what must always zero out the Sizes, Colors and the appparel image.
				oImgApparel.src = "/images/genericapparelholder.jpg";
				oApparelSizes.options[0].selected=true;
				oApparelColors.options[0].selected=true;
				
				sZoomPath='';
				iGarmentId=0;
				oApparelPrice.value='0.00';
			break;
			case 2:
			//Style was changed get list for Sizes
				sUrl  = sUrl +   '&st=' + oApparelStyles.options[oApparelStyles.selectedIndex].value;
				box = oApparelSizes;
				box.options.length=0;
				box.options[j++]= new Option ('Select Apparel Size',-1);
				oApparelColors.options.length=1;
				oApparelColors.options[0].selected=true;

				//no matter what must always zero out the colors and the appparel image.
				sZoomColor = '/apparelzoom.asp?sZoomPath=/webpages/' + getApparel();
				sZoomSize = '/measurements.asp?garment=' + oApparelStyles.options[oApparelStyles.selectedIndex].value;

				oApparelColors.options[0].selected=true;
				oApparelPrice.value='0.00';

			break;
			case 3:
			//Size was changed get list for Colors
			   var iLocation = oApparelSizes.options[oApparelSizes.selectedIndex].value.indexOf(",");
				var sTemp = oApparelSizes.options[oApparelSizes.selectedIndex].value.substring(0,iLocation);
				sUrl  = sUrl +  '&st=' + oApparelStyles.options[oApparelStyles.selectedIndex].value + '&sz=' + sTemp;;
				box = oApparelColors;
				box.options.length=0;
				box.options[j++]= new Option ('Select Apparel Color',-1);

			   var iLocation = oApparelSizes.options[oApparelSizes.selectedIndex].value.indexOf(",");
				var sTemp = oApparelSizes.options[oApparelSizes.selectedIndex].value.substring(iLocation+1,oApparelSizes.options[oApparelSizes.selectedIndex].value.length);

				oApparelPrice.value = sTemp;				

			break;
		}

		//now lets retrieve the data
		if (window.XMLHttpRequest) {		
	      oHttp = new XMLHttpRequest();
			oHttp.open("GET", sUrl, false);
			oHttp.send(null);
	    } 
		 else if (window.ActiveXObject) {
  	    // branch for IE/Windows ActiveX version
	        	oHttp = new ActiveXObject("Microsoft.XMLHTTP");
			  	oHttp.open("GET", sUrl, false);
				oHttp.send();
	    }
		//Could have used XML, yes but it can be a pain with special characters.
		//records are defined inbetween ^
		//Fields in a record are defined as inbetween |
		var sInfo = oHttp.responseText;
		var aInfo = sInfo.split("^");
		var aRec;
		if (iWhich==2 && aInfo.length>0){
			iAllowText=aInfo[0];
			aRec = aInfo[1].split("|");
			if (iAllowText==1) {
				oAllowText.style.display="block";
				oAllowTextNo.style.display="none";
			}
			else{
				defaultCustomText();
				oAllowText.style.display="none";
				oAllowTextNo.style.display="block";
			}
		}
		if (iWhich!=2 && aInfo.length>0){
			aRec = aInfo[0].split("|");
		}
		if (aInfo.length>0){
			var items;
			for (var i=1; i<aInfo.length; i++){
				items  = aInfo[i].split("|");
				box.options[j]= new Option (items[1],items[0]);
				j++;
			}
		}
		box.options[0].selected=-1;
		oHttp = null;
		return true;
	}
	function defaultCustomText()
	{
		var oPrice = document.getElementById("txtTextPrice");
		var oLstLine1 = document.getElementById("lstStyle1");
		var oLstLine2 = document.getElementById("lstStyle2");
		var oLstLine3 = document.getElementById("lstStyle3");
		var oLine1 = document.getElementById("txtLine1");
		var oLine2 = document.getElementById("txtLine2");
		var oLine3 = document.getElementById("txtLine3");

		oLstLine1.value=-1
		oLstLine2.value=-1
		oLstLine3.value=-1
		oLine1.value='';
		oLine2.value='';
		oLine3.value='';
		oPrice.value="0.00";
	}
	function openWindow(sUrl,iWhich){
		var oWindow;
		if (iWhich==1)
			oWindow = window.open (sUrl,"autumnriders",'scrollbars=1,resizable,height=375,width=425');
		else
			oWindow = window.open (sUrl,"autumnriders",'scrollbars=1,resizable,height=350,width=500');
		
	}
	function getApparel()
	{
	//this function get the list on the file from the server and populates the
	//corresponding list box, based off what list box had been changed.
		var oApparelStyles = document.getElementById("lstApparelStyles");
		var oImgApparel= document.getElementById("imgApparel");
		var oApparelDesc = document.getElementById("divApparelDesc");
		
		var j=0;
		var oHttp;
		var sUrl = '/getstyleinfo-step3.asp?';
		sUrl  = sUrl +  'st=' + oApparelStyles.options[oApparelStyles.selectedIndex].value;
		//now lets retrieve the data
		if (window.XMLHttpRequest) {		
	      oHttp = new XMLHttpRequest();
			oHttp.open("GET", sUrl, false);
			oHttp.send(null);
	    } 
		 else if (window.ActiveXObject) {
  	    // branch for IE/Windows ActiveX version
	        	oHttp = new ActiveXObject("Microsoft.XMLHTTP");
			  	oHttp.open("GET", sUrl, false);
				oHttp.send();
	    }
		//Could have used XML, yes but it can be a pain with special characters.
		//Fields in a record are defined as inbetween |
		var sInfo = oHttp.responseText;
		var aInfo = sInfo.split("^");
		var items;
		if (sInfo.length>0){
			items  = aInfo[0].split("|");
			if (items[0]!=''){
				oApparelDesc.innerHTML = items[0];
			}
			else
				oApparelDesc.innerHTML = '';
			if (items[1]!=''){
				oImgApparel.src = '/webpages/' + items[1];
			}
			else
				oImgApparel.src = "/images/genericapparelholder.jpg";
		}
		return items[2];
	}
function popReview(){
		var oApparelTypes = document.getElementById("lstApparelTypes");
		var oApparelStyles = document.getElementById("lstApparelStyles");
		var oApparelSizes = document.getElementById("lstApparelSizes");
		var oApparelColors= document.getElementById("lstApparelColors");
		var oApparelPrice = document.getElementById("txtApparelPrice");

		var oVehicle = document.getElementById("lstVehicle");
		var oMfr = document.getElementById("lstMfr");
		var oModel = document.getElementById("lstModel");
		var oYear = document.getElementById("lstYear");
		var oMfrColor = document.getElementById("lstMfrColor");

		var oPrimary = document.getElementById("lstPrimary");
		var oSecondary = document.getElementById("lstSecondary");
		var oThird = document.getElementById("lstThird");
		var oFourth = document.getElementById("lstFourth");

		var oLstLine1 = document.getElementById("lstStyle1");
		var oLstLine2 = document.getElementById("lstStyle2");
		var oLstLine3 = document.getElementById("lstStyle3");
		var oLine1 = document.getElementById("txtLine1");
		var oLine2 = document.getElementById("txtLine2");
		var oLine3 = document.getElementById("txtLine3");

		var oTxtApparelPrice = document.getElementById("txtApparelPrice");
		var oTxtTextPrice = document.getElementById("txtTextPrice");


		var oDesign = document.getElementById("tdDesign");
		var oApparel = document.getElementById("tdApparel");
		var oText = document.getElementById("tdText");
		var oTextPrice = document.getElementById("tdTextPrice");
		var oApparelPrice = document.getElementById("tdApparelPrice");
		var oSubTotalPrice = document.getElementById("tdSubtotal");
		var oQuantity = document.getElementById("txtQuantity");
		
		var sDesign='';
		var sApparel='';
		var sText='';
		var sTextPrice=0;
		var sApparelPrice=0;
		var sQuantity=0;
		var sSubTotal=0;
		var sSize='';
	   var iLocation = oApparelStyles.options[oApparelStyles.selectedIndex].text.indexOf("(");
		var sTemp= oApparelStyles.options[oApparelStyles.selectedIndex].text.substring(0,iLocation);
		sApparel = sTemp + ' - ' + oApparelSizes.options[oApparelSizes.selectedIndex].text;
		sApparel = sApparel + '/' + oApparelColors.options[oApparelColors.selectedIndex].text;

		sDesign = oMfr.options[oMfr.selectedIndex].text + ' '  + oYear.options[oYear.selectedIndex].text + ' - ';
		sDesign = sDesign + oModel.options[oModel.selectedIndex].text + '<BR>';
		sDesign = sDesign + oMfrColor.options[oMfrColor.selectedIndex].text + '(';

		if (oPrimary.options[oPrimary.selectedIndex].value!='-1, #FFFFFF'){
			sDesign = sDesign + oPrimary.options[oPrimary.selectedIndex].text;
		}
		if (oSecondary.options[oSecondary.selectedIndex].value!='-1, #FFFFFF'){
				sDesign = sDesign + '/' + oSecondary.options[oSecondary.selectedIndex].text;
		}
		if (oThird.options[oThird.selectedIndex].value!='-1, #FFFFFF'){
			sDesign = sDesign + '/' + oThird.options[oThird.selectedIndex].text;
		}
		if (oFourth.options[oFourth.selectedIndex].value!='-1, #FFFFFF'){
			sDesign = sDesign + '/' + oFourth.options[oFourth.selectedIndex].text;
		}
		sDesign = sDesign + ')';
		sText = 'Line 1, ' + oLstLine1.options[oLstLine1.selectedIndex].text + ' = '  + oLine1.value;
		sText = sText + '<BR>' + 'Line 2, ' + oLstLine2.options[oLstLine2.selectedIndex].text + ' = '  + oLine2.value;
		sText = sText + '<BR>' + 'Line 3, ' + oLstLine3.options[oLstLine3.selectedIndex].text + ' = '  + oLine3.value;
		
		sTextPrice = parseFloat(oTxtTextPrice.value);
		sApparelPrice = parseFloat(oTxtApparelPrice.value);
		sQuantity = parseFloat(oQuantity.value);
		sSubTotal=(sTextPrice + sApparelPrice)*sQuantity;
		
		oDesign.innerHTML = sDesign;
		oApparel.innerHTML = sApparel;
		oText.innerHTML = sText;
		oTextPrice.innerHTML = sTextPrice + '.00' ;
		oApparelPrice.innerHTML = sApparelPrice;
		oSubTotalPrice.innerHTML = sSubTotal.toFixed(2);
}
function dvQuantity(){
	var oQuantity = document.getElementById("txtQuantity");
	if ((!isNaN(oQuantity.value) || oQuantity.value==0) && !IsEmpty(oQuantity.value)) {
		return true;
	}
	else{
		alert("Quantity must be greater than 0.\nPlease fill in the quantity before continuing.");
		return false;
	}
}

function changeQuantity(){
	var oTextPrice = document.getElementById("tdTextPrice");
	var oApparelPrice = document.getElementById("tdApparelPrice");
	var oSubTotalPrice = document.getElementById("tdSubTotal");
	var oQuantity = document.getElementById("txtQuantity");

	var oTxtApparelPrice = document.getElementById("txtApparelPrice");
	var oTxtTextPrice = document.getElementById("txtTextPrice");
   if (!IsEmpty(oQuantity.value) && !isNaN(oQuantity.value)) {
		sQuantity = parseFloat(oQuantity.value);
	}
	else
		sQuantity=0;
		
	sTextPrice = parseFloat(oTxtTextPrice.value);
	sApparelPrice = parseFloat(oTxtApparelPrice.value);
	sSubTotal = (sTextPrice + sApparelPrice)*sQuantity;
	
	oTextPrice.innerHTML = '$' + sTextPrice + '.00' ;
	oApparelPrice.innerHTML = '$' + sApparelPrice;
	oSubTotalPrice.innerHTML ='$' +  sSubTotal.toFixed(2);
}
function openRef(){
	var oVehicle = document.getElementById("lstVehicle");
	var oMfr = document.getElementById("lstMfr");
	var sUrl = '/colorcrossref.asp?v=' + oVehicle.options[oVehicle.selectedIndex].value + '&mfr=' + oMfr.options[oMfr.selectedIndex].value;
	openWindow(sUrl,2);
}
function test4cookie() {
 // is there a cookie
  if (document.cookie == '') { // if cookie NOT found...
    document.location.href='/javascript.asp';
  } 
}

