<!--
//============================================================
function clearme(FormField) {
	if (FormField.defaultValue==FormField.value) FormField.value=""
}//end function
//============================================================
function left(str, n){
	if (n <= 0) {
	    return "";
	} else if (n > String(str).length) {
	    return str;
	} else {
	    return String(str).substring(0,n);
	}//end if (n <= 0)
}//end function
//============================================================
function CheckMaxChars() {
	xRIBBONsize0=document.getElementById("xRIBBONsize0");
	xRIBBONsize1=document.getElementById("xRIBBONsize1");
	xRIBBONsize2=document.getElementById("xRIBBONsize2");
	xTEXTmessage=document.getElementById("xTEXTmessage");
	xSIDE2message=document.getElementById("xSIDE2message");
	xPRINT2message=document.getElementById("xPRINT2message");

	cxRIBBONsize0=xRIBBONsize0.checked;
	cxRIBBONsize1=xRIBBONsize1.checked;
	cxRIBBONsize2=xRIBBONsize2.checked;

	if (cxRIBBONsize0==true) {
		if (document.getElementById("xMAXchars")) {document.getElementById("xMAXchars").innerHTML="30"};
		if (document.getElementById("xMAXchars2")) {document.getElementById("xMAXchars2").innerHTML="30"};
		if (document.getElementById("xMAXchars3")) {document.getElementById("xMAXchars3").innerHTML="30"};
		if (xTEXTmessage) {xTEXTmessage.maxLength="90"};
		if (xTEXTmessage) {xTEXTmessage.value=left(xTEXTmessage.value, 90)};
		if (xSIDE2message) {xSIDE2message.maxLength="90"};
		if (xSIDE2message) {xSIDE2message.value=left(xSIDE2message.value, 90)};
		if (xPRINT2message) {xPRINT2message.maxLength="90"};
		if (xPRINT2message) {xPRINT2message.value=left(xPRINT2message.value, 90)};
}//end if (cxRIBBONsize0==true)

	if (cxRIBBONsize1==true) {
		if (document.getElementById("xMAXchars")) {document.getElementById("xMAXchars").innerHTML="50"};
		if (document.getElementById("xMAXchars2")) {document.getElementById("xMAXchars2").innerHTML="50"};
		if (document.getElementById("xMAXchars3")) {document.getElementById("xMAXchars3").innerHTML="50"};
		if (xTEXTmessage) {xTEXTmessage.maxLength="90"};
		if (xTEXTmessage) {xTEXTmessage.value=left(xTEXTmessage.value, 90)};
		if (xSIDE2message) {xSIDE2message.maxLength="90"};
		if (xSIDE2message) {xSIDE2message.value=left(xSIDE2message.value, 90)};
		if (xPRINT2message) {xPRINT2message.maxLength="90"};
		if (xPRINT2message) {xPRINT2message.value=left(xPRINT2message.value, 90)};
	}//end if (cxRIBBONsize1==true)

	if (cxRIBBONsize2==true) {
		if (document.getElementById("xMAXchars")) {document.getElementById("xMAXchars").innerHTML="75"};
		if (document.getElementById("xMAXchars2")) {document.getElementById("xMAXchars2").innerHTML="75"};
		if (document.getElementById("xMAXchars3")) {document.getElementById("xMAXchars3").innerHTML="75"};
		if (xTEXTmessage) {xTEXTmessage.maxLength="90"};
		if (xTEXTmessage) {xTEXTmessage.value=left(xTEXTmessage.value, 90)};
		if (xSIDE2message) {xSIDE2message.maxLength="90"};
		if (xSIDE2message) {xSIDE2message.value=left(xSIDE2message.value, 90)};
		if (xPRINT2message) {xPRINT2message.maxLength="90"};
		if (xPRINT2message) {xPRINT2message.value=left(xPRINT2message.value, 90)};
	}//end if (cxRIBBONsize2==true)
}//end function
//============================================================
function Check(MyRadio) {
	var xMyRadio=document.getElementById(MyRadio);
	xMyRadio.checked="checked";
	SetFocus();
}//end function
//============================================================
function SetFocus() {
	CheckMaxChars();
	UpdateButton=document.getElementById("UpdateButton");
	UpdateButton.focus();
}//end function
//============================================================
function UpdatePreviews() {
	xRIBBONsize0=document.getElementById("xRIBBONsize0");
	xRIBBONsize1=document.getElementById("xRIBBONsize1");
	xRIBBONsize2=document.getElementById("xRIBBONsize2");

	cxRIBBONsize0=xRIBBONsize0.checked;
	cxRIBBONsize1=xRIBBONsize1.checked;
	cxRIBBONsize2=xRIBBONsize2.checked;

	IMGxRIBBONsize0=document.getElementById("IMGxRIBBONsize0");
	IMGxRIBBONsize1=document.getElementById("IMGxRIBBONsize1");
	IMGxRIBBONsize2=document.getElementById("IMGxRIBBONsize2");
	
	xFOBcolour=document.getElementById("xFOBcolour");
	xRIBBONcolour=document.getElementById("xRIBBONcolour");
	xTRIMcolour=document.getElementById("xTRIMcolour");
	xTEXTcolour=document.getElementById("xTEXTcolour");
	xTEXTfont=document.getElementById("xTEXTfont");
	xTEXTweight=document.getElementById("xTEXTweight");
	xTEXTstyle=document.getElementById("xTEXTstyle");
	xFONTsize=document.getElementById("xFONTsize");
	xTEXTmessage=document.getElementById("xTEXTmessage").value;
	
	if (xTEXTmessage.indexOf("+")) {xTEXTmessage=xTEXTmessage.replace(/\+/gi, "[plus]")};



	xFOBcolour=xFOBcolour.options[xFOBcolour.selectedIndex].value;
	xRIBBONcolour=xRIBBONcolour.options[xRIBBONcolour.selectedIndex].value;
	xTRIMcolour=xTRIMcolour.options[xTRIMcolour.selectedIndex].value;
	xTEXTcolour=xTEXTcolour.options[xTEXTcolour.selectedIndex].value;
	xTEXTfont=xTEXTfont.options[xTEXTfont.selectedIndex].value;
	xTEXTweight=xTEXTweight.options[xTEXTweight.selectedIndex].value;
	xTEXTstyle=xTEXTstyle.options[xTEXTstyle.selectedIndex].value;
	xFONTsize=xFONTsize.options[xFONTsize.selectedIndex].value;
	
	xTEXTmessage=xTEXTmessage.replace("&", "[and]")
	xTEXTmessage=xTEXTmessage.replace("+", "[plus]")
	
	if (document.getElementById("buyfromcustom")) {
		cxADDlogoY=document.getElementById("xADDlogoY").checked;
		cxADD2sideY=document.getElementById("xADD2sideY").checked;
		cxADD2printY=document.getElementById("xADD2printY").checked;
		if (cxADDlogoY==true || cxADD2sideY==true || cxADD2printY==true) {
			document.getElementById("buyfromcustom").style.visibility="hidden";
			changeformtocustom();
		}else{
			document.getElementById("buyfromcustom").style.visibility="visible";
			changeformtobuy();
		}//end if (cxADDlogoY=="checked" || cxADD2sideY=="checked" || cxADD2printY=="checked")
		if (cxADD2sideY==true) {
			xTRIMcolour=xRIBBONcolour;
			OPTxTRIMcolour=document.getElementById("xTRIMcolour").options;
			for (i=1;i<OPTxTRIMcolour.length;i++) {
				thisOPTxTRIMcolour=OPTxTRIMcolour[i].value;
				if (thisOPTxTRIMcolour==xRIBBONcolour) {
					OPTxTRIMcolour.selectedIndex=i;
				}//end if (thisOPTxTRIMcolour==xRIBBONcolour)
			}//next i<OPTxTRIMcolour.length
			
		}//end if (cxADD2sideY==true)
	}//end if (document.getElementById("buyfromcustom"))
	if (cxRIBBONsize0==true) {
		IMGxRIBBONsize0.src="components/draw.asp?xRIBBONsize=min&xFOBcolour="+xFOBcolour+"&xRIBBONcolour="+xRIBBONcolour+"&xTRIMcolour="+xTRIMcolour+"&xTEXTcolour="+xTEXTcolour+"&xTEXTmessage="+xTEXTmessage+"&xTEXTweight="+xTEXTweight+"&xTEXTstyle="+xTEXTstyle+"&xTEXTfont="+xTEXTfont+"&xFONTsize="+xFONTsize;
		IMGxRIBBONsize1.src="components/draw.asp?xRIBBONsize=reg&xIMGopac="+5;
		IMGxRIBBONsize2.src="components/draw.asp?xRIBBONsize=jum&xIMGopac="+5;
	}//end if (cxRIBBONsize0==true)

	if (cxRIBBONsize1==true) {
		IMGxRIBBONsize0.src="components/draw.asp?xRIBBONsize=min&xIMGopac="+5;
		IMGxRIBBONsize1.src="components/draw.asp?xRIBBONsize=reg&xFOBcolour="+xFOBcolour+"&xRIBBONcolour="+xRIBBONcolour+"&xTRIMcolour="+xTRIMcolour+"&xTEXTcolour="+xTEXTcolour+"&xTEXTmessage="+xTEXTmessage+"&xTEXTweight="+xTEXTweight+"&xTEXTstyle="+xTEXTstyle+"&xTEXTfont="+xTEXTfont+"&xFONTsize="+xFONTsize;
		IMGxRIBBONsize2.src="components/draw.asp?xRIBBONsize=jum&xIMGopac="+5;
	}//end if (cxRIBBONsize1==true)

	if (cxRIBBONsize2==true) {
		IMGxRIBBONsize0.src="components/draw.asp?xRIBBONsize=min&xIMGopac="+5;
		IMGxRIBBONsize1.src="components/draw.asp?xRIBBONsize=reg&xIMGopac="+5;
		IMGxRIBBONsize2.src="components/draw.asp?xRIBBONsize=jum&xFOBcolour="+xFOBcolour+"&xRIBBONcolour="+xRIBBONcolour+"&xTRIMcolour="+xTRIMcolour+"&xTEXTcolour="+xTEXTcolour+"&xTEXTmessage="+xTEXTmessage+"&xTEXTweight="+xTEXTweight+"&xTEXTstyle="+xTEXTstyle+"&xTEXTfont="+xTEXTfont+"&xFONTsize="+xFONTsize;
	}//end if (cxRIBBONsize2==true)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}//end function
//============================================================
function ValidateStep1() {
	xFOBcolour=document.getElementById("xFOBcolour");
	xRIBBONcolour=document.getElementById("xRIBBONcolour");
	xTRIMcolour=document.getElementById("xTRIMcolour");
	xTEXTcolour=document.getElementById("xTEXTcolour");

	xFOBcolour=xFOBcolour.options[xFOBcolour.selectedIndex].value;
	xRIBBONcolour=xRIBBONcolour.options[xRIBBONcolour.selectedIndex].value;
	xTRIMcolour=xTRIMcolour.options[xTRIMcolour.selectedIndex].value;
	xTEXTcolour=xTEXTcolour.options[xTEXTcolour.selectedIndex].value;
	xTEXTmessage=document.getElementById("xTEXTmessage");

	if (xTEXTmessage.value==""||xTEXTmessage.value=="Your Message") {
		alert("please enter a message");
		return false;
	}//end if (xFOBcolour=="")

	if (xFOBcolour=="") {
		alert("please select a fob end colour");
		return false;
	}//end if (xFOBcolour=="")

	if (xRIBBONcolour=="") {
		alert("please select a ribbon colour");
		return false;
	}//end if (xRIBBONcolour=="")

	if (xTRIMcolour=="") {
		alert("please select a trim colour");
		return false;
	}//end if (xTRIMcolour=="")

	if (xTEXTcolour=="") {
		alert("please select a text colour");
		return false;
	}//end if (xTEXTcolour=="")

	if (xTEXTmessage=="") {
		alert("please enter a message");
		return false;
	}//end if (xTEXTmessage=="")

	else {
		return true;
	}//end else
}//end function
//============================================================
function changeformtocustom() {
//	document.form.enctype="multipart/form-data";
	document.form.action="custom.asp?xcase=prepost";
}//end function
//============================================================
function changeformtobuy() {
	document.form.action="buy.asp?xcase=addtocart2";
//	document.form.enctype="application/x-www-form-urlencoded";
}//end function
//============================================================
function changeformbacktocustom() {
	document.form.action="custom.asp?xcase=post";
	document.form.enctype="multipart/form-data";
}//end function
//============================================================
function Show(what) {
	what=document.getElementById(what);
	what.style.visibility="visible";
	SetFocus();
}//end function
function Hide(what) {
	what=document.getElementById(what);
	what.style.visibility="hidden";
	SetFocus();
}//end function
//============================================================
//============================================================
/*====================================================================================================*/
function SetDarkDiv() {
	xDARKdiv=document.getElementById("DarkDiv");
	if (!xDARKdiv) {
		xDARKdiv=document.createElement("div");
		xDARKdiv.setAttribute("id", "DarkDiv");
		document.body.appendChild(xDARKdiv);
	}//end if (!DarkDiv)
	xWinWidth=window.innerWidth;
	xWinHeight=window.innerHeight;
	if (!xWinWidth) {
		xWinWidth=document.documentElement.clientWidth;
		xWinHeight=document.documentElement.clientHeight;
	}//end if (!xWinWidth)
	for(i=0;i<=25; i++) { 
		setTimeout("SetDarkDivStyle("+i+","+xWinWidth+","+xWinHeight+")",i*20); 
	}//next i<=100
}//end function
/*====================================================================================================*/
function SetDarkDivStyle(MyOpacity, MyWidth, MyHeight) {
	xDARKdiv=document.getElementById("DarkDiv");
	xDARKdivStyle="position: absolute;";
	xDARKdivStyle+="background-color: #000000;";
	xDARKdivStyle+="width: "+MyWidth+"px;";
	xDARKdivStyle+="height: "+MyHeight+"px;";
	xDARKdivStyle+="top: 0px;";
	xDARKdivStyle+="left: 0px;";
	xDARKdivStyle+="bottom: 0px;";
	xDARKdivStyle+="filter: alpha(opacity="+MyOpacity+");";
	xDARKdivStyle+="opacity: "+MyOpacity/100+";";
	xDARKdiv.setAttribute("style", xDARKdivStyle);
	xDARKdiv.style.setAttribute("style", xDARKdivStyle);
	xDARKdiv.style.cssText=xDARKdivStyle;
}//end function
/*====================================================================================================*/
function SetLightDiv(xIMGsrc) {
	xLIGHTdiv=document.getElementById("LightDiv");
	if (!xLIGHTdiv) {
		xLIGHTdiv=document.createElement("div");
		xLIGHTdiv.setAttribute("id", "LightDiv");
		document.body.appendChild(xLIGHTdiv);
	}//end if (!xLIGHTdiv)
	xWinWidth=window.innerWidth;
	xWinHeight=window.innerHeight;
	if (!xWinWidth) {
		xWinWidth=document.documentElement.clientWidth;
		xWinHeight=document.documentElement.clientHeight;
	}//end if (!xWinWidth)
	for(i=0;i<=500; i++) {
		setTimeout("SetLightDivStyle('"+i+"', '100', '"+xWinWidth+"', '"+xWinHeight+"')",i); 
	}//next i<=500
	for(i=100;i<=370; i++) {
		setTimeout("SetLightDivStyle('500', '"+i+"', '"+xWinWidth+"', '"+xWinHeight+"')",i+500); 
	}//next i<=375
	xIMGhtml="<a ";
	xIMGhtml+=" href=\"javascript:unzoom();\"";
	xIMGhtml+=" style=\"color: #000000; text-decoration: none; font-family: Arial, Helvetica, sans-serif; font-size: small;\"";
	xIMGhtml+="><img ";
	xIMGhtml+=" src=\""+xIMGsrc+"\"";
	xIMGhtml+=" width=\"300\"";
	xIMGhtml+=" height=\"300\"";
	xIMGhtml+=" border=\"0\"";
	xIMGhtml+=" alt=\"zoomed image\"";
	xIMGhtml+=" />";
	xIMGhtml+="<br />click to close";
	xIMGhtml+="</a>";
	setTimeout("xLIGHTdiv.innerHTML=xIMGhtml", 870);
}//end function
/*====================================================================================================*/
function SetLightDivStyle(MyWidth, MyHeight, WinWidth, WinHeight) {
	xLIGHTdiv=document.getElementById("LightDiv");
	xLIGHTdivLeft=(WinWidth-MyWidth)/2;
	xLIGHTdivTop=(WinHeight-MyHeight)/2;
	xLIGHTdivStyle="position: absolute;";
	xLIGHTdivStyle+="background-color: #ffffff;";
	xLIGHTdivStyle+="width: "+MyWidth+"px;";
	xLIGHTdivStyle+="height: "+MyHeight+"px;";
	xLIGHTdivStyle+="padding: 10px;";
	xLIGHTdivStyle+="left: "+xLIGHTdivLeft+"px;";
	xLIGHTdivStyle+="top: "+xLIGHTdivTop+"px;";
	xLIGHTdivStyle+="text-align: center;";
	xLIGHTdiv.setAttribute("style", xLIGHTdivStyle);
	xLIGHTdiv.style.setAttribute("style", xLIGHTdivStyle);
	xLIGHTdiv.style.cssText=xLIGHTdivStyle;
}//end function
/*====================================================================================================*/
function zoom(xIMGsrc) {
	SetDarkDiv();
	setTimeout("SetLightDiv('"+xIMGsrc+"')", 500);
}//end function
/*====================================================================================================*/
function unzoom() {
	xDARKdiv=document.getElementById("DarkDiv");
	xLIGHTdiv=document.getElementById("LightDiv");
	xLIGHTdiv.innerHTML="";
	for(i=370;i>=100; i--) { 
		setTimeout("SetLightDivStyle('500', '"+i+"', '"+xWinWidth+"', '"+xWinHeight+"')",370-i); 
	}//next i<=375
	for(i=500;i>=0; i--) { 
		setTimeout("SetLightDivStyle('"+i+"', '100', '"+xWinWidth+"', '"+xWinHeight+"')",870-i); 
	}//next i>=0
	setTimeout("document.body.removeChild(xLIGHTdiv)", 870);
	for(i=25;i>=0; i--) { 
		setTimeout("SetDarkDivStyle("+i+","+xWinWidth+","+xWinHeight+")",((25-i)*20)+870); 
	}//next i<=100
	setTimeout("document.body.removeChild(xDARKdiv)", 1495);
}//end function
/*====================================================================================================*/
function CentreLightDiv() {
	xLIGHTdiv=document.getElementById("LightDiv");
	xDARKdiv=document.getElementById("DARKDiv");
	if (xLIGHTdiv) {
		xWinWidth=window.innerWidth;
		xWinHeight=window.innerHeight;
		if (!xWinWidth) {
			xWinWidth=document.documentElement.clientWidth;
			xWinHeight=document.documentElement.clientHeight;
		}//end if (!xWinWidth)
		SetLightDivStyle(500, 370, xWinWidth, xWinHeight);
		SetDarkDivStyle(25, xWinWidth, xWinHeight);
	}//end if (!xLIGHTdiv)
}//end function
/*====================================================================================================*/
window.onresize=function() {
	CentreLightDiv();
}//end function
/*====================================================================================================*/
-->