img1 = new Image;
img1.src="./images/rect_corner_normal.gif";

img2 = new Image;
img2.src="./images/rect_corner_w_diagonal.gif";

img3 = new Image;
img3.src="./images/rect_corner_diagonal.gif";

img4 = new Image;
img4.src="./images/rect_corner_crowded.gif";

function valid(fieldName, fieldValue,msg) {
decallowed = 2;  // how many decimals are allowed?
if (isNaN(fieldValue) || fieldValue == "")
{
	alert("Please enter a valid decimal number for "+msg+".");
	return false;
}
else
{
	if (fieldValue.indexOf('.') == -1) fieldValue += ".";
	dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
	if (dectext.length > decallowed)
	{
		alert ("Please enter a valid decimal number up to " + decallowed + " decimal places for "+msg+".");
		return false;
	}
}
}
//  End -->
var allowradio =0;
function FormVal(form,IDm, matcount)
{
	allowradio==0;
//	'IDm = IDm.substring(1);
//	'var mid = IDm.split(",");
	obj = form.all("rectID[]");
	for (var i=0; i<obj.length; i++)
	{
		if (obj[i].checked==true)
		{
			allowradio=1;
			break;
		}
	}
	if(allowradio==0)
	{
		alert("Please Select a Mat");
		return false;
	}
	if(valid("SpringLength", document.Form.SpringLength.value,"Spring Length")==false)
	{
		document.Form.SpringLength.focus();
		return false;
	}
	document.Form.uvProtection1[0].disabled=false;
	document.Form.uvProtection1[1].disabled=false;
}
function showUVP(mode)
{
	obj = document.Form.uvProtection1;
	for(l = 0; l < obj.length; l++)
	{
		if(mode=='0')
			document.Form.uvProtection1[l].disabled=true;
		else
			document.Form.uvProtection1[l].disabled=false;

	}
}
function instructions()
{
     window.open ('springlen_advice.php','Instructions','HEIGHT=340,WIDTH=450,screenX=20,screenY=5,status=no,scrollbars=no,toolbar=no,directories=no,menubar=no,location=no,left=150,top=75');
}

function popUp(filename)
{
     window.open (filename,'Instructions','HEIGHT=450,WIDTH=470,screenX=20,screenY=5,status=no,scrollbars=yes,toolbar=no,directories=no,menubar=no,location=no,left=150,top=75');
}
function calCost(pPrice)
{
	if (pPrice=="0")
	{
		document.Form.txtPrice.value="(Select a Mat)";
		alert("Please select a Mat");
	}
	else
	{
		optProd = new Array(2);
		optProd["sunShield"]=29.95;
		optProd["none"]=0;

		document.Form.pPriceHidden.value=pPrice;

		var totPrice = pPrice;
		var toAdd = 0;

		if (document.Form.uvProtection1[0].checked==true)
		{
			toAdd = optProd["none"];
		}
		if (document.Form.uvProtection1[1].checked==true)
		{
			toAdd = optProd["sunShield"];
		}
		if (document.Form.uvProtection1[2].checked==true)
		{
			toAdd = optProd["sunShield"];
		}
		if (document.Form.uvProtection1[3].checked==true)
		{
			toAdd = optProd["sunShield"];
		}
		totPrice =(parseFloat(totPrice)+parseFloat(toAdd));
		totPrice = Math.round(totPrice*100)/100;
		document.Form.txtPrice.value=totPrice;
	}
 }
 /*
function submitOpener()
{
        window.opener.document.Form.brandname.value=window.document.frm.brandname.value;
        window.opener.document.Form.modelnumber.value=window.document.frm.modelnumber.value;
        window.opener.document.Form.yearpurchased.value=window.document.frm.yearpurchased.value;
        window.opener.document.Form.storepurchased.value=window.document.frm.storepurchased.value;
        window.opener.document.Form.submit();
        window.close();
}
*/