// JavaScript Document
function toggleBox(szDivID, iState) {// 1 visible, 0 hidden

    if(document.layers) {  //NN4+
			document.layers[szDivID].visibility = iState ? "show" : "hide";
			document.layers[szDivID].display = iState ? "" : "none";
    } else if(document.getElementById) {	  //gecko(NN6) + IE 5+

			var obj = document.getElementById(szDivID);
			if (obj) {
				obj.style.visibility = iState ? "visible" : "hidden";
				obj.style.display = iState ? "" : "none";
			}
    } else if(document.all) {	// IE 4
			document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
			document.all[szDivID].style.display = iState ? "" : "none";
    }
} 

function OLcmdExT1() {
	//nSuggestLoad = 0;
	return overlib(OLresponseAJAX, WIDTH, 300, STICKY, NOCLOSE);
}

function CustomizeIt(sImageName) {
	sImg = escape(sImageName.replace(/prodimages\//g,'')).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
	location="../cgi-bin/DS4_start.asp?FGPH3=S_pt1_"+sImg+"&BGPH3=S_pt1_"+sImg;
}

	var ns4, ie4, ie5, moz;
	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false 
	ie5 = (document.getElementByID && document.all)? true:false
	moz = (document.getElementById)?true:false

	function toggleBox2(szDivID, iState) {// 1 visible, 0 hidden
	
			if(document.layers) {  //NN4+
				document.layers[szDivID].visibility = iState ? "visible" : "hidden";
			} else if(document.getElementById) {	  //gecko(NN6) + IE 5+
	
				var obj = document.getElementById(szDivID);
				if (obj) {
					obj.style.visibility = iState ? "visible" : "hidden";
				}
			} else if(document.all) {	// IE 4
				document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
			}
	}

	function bcolor(bcol, cel) {
		if (document.all) {
			var thestyle = eval ('document.all.'+cel+'.style');
			thestyle.backgroundColor=bcol;
		} else {
			document.getElementById(cel).style.backgroundColor = bcol
		}
	}


	function FixIMG1(sImgsrc, sDiv, max_x, max_y, ImagePath, posx, posy) {
		var imgPreview = new Image();
		imgPreview.onload = function(){eval("FixIMG2('"+sImgsrc+"', '"+sDiv+"', this.width, this.height, "+max_x+", "+max_y+", '"+ImagePath+"', "+posx+", "+posy+");");};
		imgPreview.src = ImagePath;	//oImgsrc.src;
		if (imgPreview.width > 0 ) {
			FixIMG2(sImgsrc, sDiv, imgPreview.width, imgPreview.height, max_x, max_y, ImagePath, posx, posy)
		}
	}

	function FixIMG2(sImgsrc, sDiv, nx2, ny2, max_x, max_y, ImagePath, posx, posy) {
		if (nx2>max_x) {ny2=Math.round(ny2/(nx2/max_x)); nx2=max_x}
		if (ny2>max_y) {nx2=Math.round(nx2/(ny2/max_y)); ny2=max_y;}
		if (posx == -1) {
			posx = 175 - Math.round(nx2/2);			//Center X
		} else {
			posx = posx + Math.round((175-nx2)/2)+8;
		}
		if (posy == -1) {
			posy = 175 - Math.round(ny2/2);			//Center Y
		} else {
			nVadj = ((parseInt(10*nx2/ny2)-10))
			if (nVadj < 0) nVadj = 0;
			posy = posy + Math.round(((175-ny2)/2)-nVadj);
		}

		//alert("posx="+posx+", posy="+posy);
		if (isNaN(posx)) {
			//alert("Position is Not a Number");
		} else {

			if (document.getElementById) {
				eval("oDiv=document.getElementById('"+sDiv+"')");
			} else {
				eval ('oDiv = document.all.'+sDiv+'.style');
			}
	
			//oDiv.style.position="relative";
			oDiv.style.width=nx2+"px";
			oDiv.style.height=ny2+"px";
			oDiv.style.left=posx+"px";
			oDiv.style.top=posy+"px";
			eval("oImgsrc = document."+sImgsrc);
			oImgsrc.height=ny2;
			oImgsrc.width=nx2;
			oImgsrc.src = ImagePath;
			//alert("New Div.Width="+oDiv.style.width);
			if ((browser.isIE55 || browser.isIE6up) && browser.isWin32 && oImgsrc.src.match(/.*\.png.*/i) != null) {
				oImgsrc.style.width=nx2+'px'; 
				oImgsrc.style.height=ny2+'px';
				oImgsrc.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ ImagePath +"', sizingMethod='scale')";
				oImgsrc.src='/images/clear.gif';
			}
		}
	}


	function BlankBkgnd(divIDobj) {
			if ((browser.isIE55 || browser.isIE6up) && browser.isWin32 ) {
				divIDobj.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";
			}
			divIDobj.background = "";
	}
	
	function formatIMG(arg, nIMG, x, y) {
		if (nIMG != "detailimg") nIMG = "es"+nIMG;
		sWidth=	"";
		sHeight="";
		if (x > 0) sWidth = " width="+x;
		if (y > 0) sHeight=" height="+y;
		return "<img border='0' src=\""+arg+"\" id=\""+nIMG+"\""+ sWidth + sHeight +" name=\"UserDesign"+nIMG+"\" >";	}
	
	function formatIMG2(arg, nIMG, x, y, sDivName) {
		var curdate = new Date();
		return "<img border='0' src=\""+arg+"?"+curdate.getTime()+"\" id=\"img_"+nIMG+"\" style=\"cursor:hand; visibility: hidden;\" onLoad=\"FixPNGs(document.getElementById('img_"+nIMG+"'), "+x+", "+y+", '"+arg+"'); toggleBox2('img_"+nIMG+"', 1);\">";
	}

	function layerWrite(id,nestref,text) {
		if (ie4) {
			document.all[id].innerHTML = text
		}
		if (ns4) {
			var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
			lyr.open()
			lyr.write(text)
			lyr.close()
		}
		if (moz) {
			document.getElementById(id).innerHTML = text;
		}
	}
	
	<!--REMOVED JS-->
function LoadTopic(appID, sDivID, nType) {
   if (!Sarissa || !document.getElementsByTagName) return;
 /* Set up the request */
   var xmlhttp =  new XMLHttpRequest();

   xmlhttp.open('POST', '../cgi-bin/ajax_content.asp', true);
   //toggleBox(sLoading, 1);						//Show loading timer
	sRestoreBkgndColor = SetBkgndColor(sDivID, '#CCCCCC');	//
    /* The callback function */
    xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if (xmlhttp.status == 200) {
				display_content(xmlhttp, sDivID, sRestoreBkgndColor);
			} //else
				//target.submit();
		}
	}
	sIDType="pt_app_lookup";
	if (nType==1) sIDType="pt_app_lookup";
	if (nType==2) sIDType="app_lookup";
   /* Send the POST request */
   xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   xmlhttp.send('topic='+ sIDType +'&id='+ appID);
}

function SetBkgndColor(divID, newcolor) {
	sPreviousColor = '';
	if(document.layers) { // browser="NN4";
		sPreviousColor = document.layers[divID].bgColor;
		document.layers[divID].bgColor = newcolor;
	}
	if(document.all) { // browser="IE";
		eval("sPreviousColor = document.all."+divID+".style.backgroundColor;");
		eval("document.all."+divID+".style.backgroundColor = newcolor;");
	}
	if(!document.all && document.getElementById) { // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff";
		sPreviousColor = document.getElementById(divID).style.backgroundColor;
		document.getElementById(divID).style.backgroundColor = newcolor;
	}
	return sPreviousColor;
}

function alterContent(sID, theText) {
	var bvalid = document.all||document.getElementById||document.layers
	if (!bvalid) return false;
	if (document.all||document.getElementById) {
		//if (!document.getElementById) return false;
		if (!document.getElementById(sID)) return false;
		document.getElementById(sID).innerHTML = theText;
	} else {
		if (document.layers) {
			sID.document.write(theText);		//Where sID is the layer object not the id name.
			sID.document.close();
		} else
			return false;
	}
} 


function display_content(oXMLDoc, sDivName, sRestoreBkgndColor) {
	oXML=oXMLDoc.responseXML
	var sAltAppTypes = "";
	var Features = "";
	sContent = "";
	if (!oXML.getElementsByTagName('ERROR_STATUS')[0]) return;
	if (oXML.getElementsByTagName('ERROR_STATUS')[0].firstChild.data!='OK') return;

	nCounter = 0;
	var items = oXML.getElementsByTagName("RECORD");
	for (var i = 0 ; i < items.length ; i++) {
		// get one item after another
		var item = items[i];
		if (item.getElementsByTagName("PID")[0].firstChild)
			var pID = item.getElementsByTagName("PID")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("TITLE")[0].firstChild)
			var nameid = item.getElementsByTagName("TITLE")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("APPTYPE")[0].firstChild)
			var ApparelType = item.getElementsByTagName("APPTYPE")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("MARKETINGTEXT")[0].firstChild)
			var MarketingText = item.getElementsByTagName("MARKETINGTEXT")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("FABRICTYPE")[0].firstChild)
			var FabricType = item.getElementsByTagName("FABRICTYPE")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("FABRICWEIGHT")[0].firstChild)
			var FabricWeight = item.getElementsByTagName("FABRICWEIGHT")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("BRAND")[0].firstChild)
			var BrandName = item.getElementsByTagName("BRAND")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("BRANDLOGOURL")[0].firstChild)
			var BrandLogoURL = item.getElementsByTagName("BRANDLOGOURL")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("MODEL")[0].firstChild)
			var ModelNumber = item.getElementsByTagName("MODEL")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("FEATURES")[0].firstChild)
			Features = item.getElementsByTagName("FEATURES")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("SIZES")[0].firstChild)
			var Sizes = item.getElementsByTagName("SIZES")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("MICROIMGMURL")[0].firstChild)
			var MicroImgURL = item.getElementsByTagName("MICROIMGMURL")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("SMLIMGMURL")[0].firstChild)
			var SmlImgURL = item.getElementsByTagName("SMLIMGMURL")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("MEDIMGMURL")[0].firstChild)
			var MedImgURL = item.getElementsByTagName("MEDIMGMURL")[0].firstChild.nodeValue;
		if (item.getElementsByTagName("LRGIMGMURL")[0].firstChild)
			var LargeImgURL = item.getElementsByTagName("LRGIMGMURL")[0].firstChild.nodeValue;
		
		/*****************************************************
		The following section is where you add the calls to all
		modules on the page.  A module must first be positioned
		in the default page formatting, then have a formatting 
		subroutine added to this file, and then be called in 
		this function.
		******************************************************/
		if (nCounter==0) {
			alterContent("nameid", nameid);
			if (!MarketingText || MarketingText=="") MarketingText = "We only choose the highest quality garments for your apparel.  Not only are these durable and guaranteed, but we only use well-known brands that have a reputation of meeting our high standards."
//alert(MarketingText);
			alterContent("marketingtext", MarketingText);
			if (!BrandLogoURL || BrandLogoURL=="") {
				alterContent("brandlogourl", "");
				toggleBox("prodrow", 0);
			} else {
				alterContent("brandlogourl", "<img src=\""+ BrandLogoURL +"\" style=\"border: 1px solid #CCCCCC\" title=\""+ BrandName +"\"/>");
				toggleBox("prodrow", 1);
			}
			alterContent("modelnumber", "<b>Model:</b> "+ ModelNumber);
			alterContent("fabricweight", "FABRIC WEIGHT<br />"+ FabricWeight +" "+ FabricType);
			fWeight = parseFloat(FabricWeight);
			if (!FabricWeight || FabricWeight=="varies" || fWeight==0 || FabricWeight=="") {
				alterContent("fabricweightscale", "");
				toggleBox("fabricrow", 0);
			} else {	
				sImg = "";
				if (fWeight < 4.5) sImg="scale_42";
				if (fWeight >= 4.5 && fWeight < 5.2)  sImg="scale_50";
				if (fWeight >= 5.2 && fWeight < 5.8)  sImg="scale_55";
				if (fWeight >= 5.8 && fWeight < 6.2)  sImg="scale_61";
				if (fWeight >= 6.2 && fWeight < 6.7)  sImg="scale_65";
				if (fWeight >= 6.7 && fWeight < 7.2)  sImg="scale_70";
				if (fWeight >= 7.2 && fWeight < 7.8)  sImg="scale_75";
				if (fWeight >= 7.8 && fWeight < 8.5)  sImg="scale_80";
				if (fWeight >= 8.5 && fWeight < 9.2)  sImg="scale_90";
				if (fWeight >= 9.2 && fWeight < 9.8)  sImg="scale_95";
				if (fWeight >= 9.8 && fWeight < 10.4)  sImg="scale_100";
				if (fWeight >= 10.4)  sImg="scale_110";
				if (sImg != "") {
					alterContent("fabricweightscale", "<img src=\"../images/ds/apparel/"+ sImg +".gif\" width=\"60\" height=\"60\" style=\"border: 0px solid #CCCCCC\" />");
					toggleBox("fabricrow", 1);
				}
			}
			Features = Features.replace(/\&bull;/g, "");
			Features = Features.replace(/\r\n/g, "<br /> &bull; ");
			Features = Features.replace(/\n/g, "<br /> &bull; ");
			if (!Features || Features=="") {
				alterContent("features", "&nbsp;");
				toggleBox("featurerow", 0);
			} else {
				toggleBox("featurerow", 1);
				alterContent("features", "&bull; "+Features);
			}
			if (MedImgURL && MedImgURL != "") {
				alterContent("smlimgurl", "<img src=\""+ MedImgURL +"\" style=\"border: 1px solid #C0C0C0\" />");
				toggleBox("imagerow1", 1);
				toggleBox("imagerow2", 1);	
			} else {
				toggleBox("imagerow1", 0);
				toggleBox("imagerow2", 0);	
				alterContent("smlimgurl", "&nbsp;");
			}
			sAltAppTypes = " <a href=\"javascript: LoadTopic("+ pID +", 'appareldetails', 2); void(0);\">"+ BrandName +"</a>,"
		} else {
			//create the other apparels links.
			sAltAppTypes = " <a href=\"javascript: LoadTopic("+ pID +", 'appareldetails', 2); void(0);\">"+ BrandName +"</a>," + sAltAppTypes
		}
		nCounter++;
	}
	if (nCounter > 1) {
		sAltAppTypes = "<BR /><b>Other possible brands used:</b><br />" + sAltAppTypes;
		sAltAppTypes = sAltAppTypes.substring(0,sAltAppTypes.length-2);
		alterContent("altappid", sAltAppTypes);
	} else {
		alterContent("altappid", "");
	}
	
	SetBkgndColor(sDivName, sRestoreBkgndColor);
}

function pricechecker(i){
	for(var index=0;index<aPC.length;index++){
		if(aPI[index]==i)
			return(aPC[index]);
	}
	return(0);
}

function openEFWindow(id) {
  popupWin = window.open('emailfriend.asp?id='+id,'email_friend','menubar=no, scrollbars=no, width=400, height=500, directories=no,location=no,resizable=yes,status=no,toolbar=no')
}


function FindSize(sFormName, i) {
	var objApp, objColor, objSize;
	eval("objApp=document."+ sFormName +".cboApp"+i+";");
	eval("objColor=document."+ sFormName +".cboClr"+i+";");
	eval("objSize=document."+ sFormName +".cboSize"+i+";");

	//code for dropdown color change
	if (objSize) {
		objSize.focus();
		objSize.style.background='#cc3300';
		objSize.style.color='#FFFFFF';
	}
	
	//assign 0 for SizePrine
	sPrice=0;
	var tempColor;
	//assign 0 for color price
	cPrice=0;

	//from here code for color price
	if (objColor) {
		tempColor = objColor.value;
		var strColor;
		eval("strColor=document."+ sFormName +".hidClr"+i+".value;");
		partsColor=strColor.split(",");
		var priceFirst=new Array();
		priceFirst[0]=new Array();
		priceFirst[1]=new Array();
		var x=0;
		var y=0;
		while (x<partsColor.length)	{
			priceFirst[0][y]=partsColor[x+1];	//ColorID
			priceFirst[1][y]=partsColor[x+4];	//ColorPrice
			y++;
			x+=6;		
		}
//alert(".");	
		for(t=0; t<y; t++) {
//alert("Selected: "+tempColor+"  Cur Loop: "+priceFirst[0][t]+ " $"+priceFirst[1][t]);
			if(priceFirst[0][t] == tempColor) {
					cPrice=priceFirst[1][t];
			}
		}
	}
	if (objSize) {
		var str;
		eval("str=document."+ sFormName +".hidSize"+i+".value;");
		objSize.length=0;
		var k=0;
		parts=str.split(",");
	
		first=new Array();
		first[0]=new Array();
		first[1]=new Array();
		first[2]=new Array();
		first[3]=new Array();
		first[4]=new Array();
		var nI=0;

		while (nI<parts.length) {
			first[0][k]=parts[nI];//Parent colorID
			first[1][k]=parts[nI+1];//SizeID
			first[2][k]=parts[nI+2];//Size Type
			first[3][k]=parts[nI+3];//Size Name
			first[4][k]=parts[nI+4];//Price Diff
			nI+=5;
			k++;
		}
		matchvalue = ""
		if (objColor)
			matchvalue = objColor.value;
		else { if (objApp)
			matchvalue = objApp.value;
		}

		var m=0;
		var p=0;
		temp="Select "+first[2][0].toLowerCase();
		objSize.length=0;
		objSize.options[0]=new Option(temp,"0");
		while (m<k)	{
			if(matchvalue==first[0][m] || matchvalue=="") {
				sOptionName = first[3][m];

				if (first[4][m] != 0) {
					sSign=" (+";
					if (first[4][m] < 0)
						sSign = " (-";
					sOptionName = sOptionName + sSign + formatprice(Math.round(Math.abs(first[4][m])*100.0)/100.0) + ")";
				}

				temp=first[3][m];
				val=first[1][m];
				objSize.options[p+1]=new Option(sOptionName,val);
				p++;
			}
			m++;
		}	//While
	}	//objSize
//alert("1:"+cPrice);
	//CalculateTotPrice(sFormName, i);
//alert("2:"+cPrice);
}// end of function

function CalSizePrice(sFormName, i) {
	var objSize;
	eval("objSize=document."+ sFormName +".cboSize"+i+";");
	
	objSize.style.background='#FFFFFF';
	objSize.style.color='Black';
	sPrice=0;
	var str;
	eval("str=document."+ sFormName +".hidSize"+i+".value;");
	var parts=str.split(",");
	var arrprice=new Array();
	arrprice[0]=new Array();
	arrprice[1]=new Array();
	var x=0;
	var y=0;
	while (x<parts.length) {
		arrprice[0][y]=parts[x+1];//sizeID
		arrprice[1][y]=parts[x+4];//sizePrice
		y++;
		x+=5;
	}
	var k;
	for(k=0;k<y;k++) {
		str = objSize.value;
		if(str == arrprice[0][k]) {
			sPrice=arrprice[1][k];
		}
	}//end of for
	CalculateTotPrice(sFormName, i);
}//end of function

//(nPrice?nPrice:0)
function CalculateTotPrice(sFormName, i) {
	var nBaseVal=0;
	var pDiv;
	eval("nBaseVal=document."+ sFormName +".hidBase"+i+".value;");
	tPrice=Number( (nPrice?nPrice:0) )+Number( (cPrice?cPrice:0) )+Number( (sPrice?sPrice:0) )+Number( (nBaseVal?nBaseVal:0) );
	tPrice=tPrice.toFixed(2);

	if(!isW3) return;
	eval("pDiv = document.getElementById('pricediv"+i+"');");
	pDiv.innerHTML=formatprice(Math.round(tPrice*100.0)/100.0);
}//end of function

function BlankSelection(oForm, sType, nIndex) {
	if (sType=="color") {
		eval("sliderwidth"+nIndex+"=150;");
		eval("alterContent(\"conveyour"+nIndex+"\", writeconveyour"+nIndex+"());");
		eval("setOptions"+nIndex+"(999, document.tForm0.hidClr0, 6, 3, 4, 5, \"blank\");");
		eval("fillup"+nIndex+"();");
		document.tForm0.cboClr0.value="";
		cPrice="0";
		CalculateTotPrice("tForm0", 0);
	} else {
		document.tForm0.cboSize0.options.length=0;
		oForm.options[0]=new Option('Select a size','0');
		sPrice="0";
		CalculateTotPrice("tForm0", 0);
	}
}

<!--\REMOVED-->
