// JavaScript Document
function validateBanner(theForm){var sqftArray = new Array(4);sqftArray[0] = 4.5;sqftArray[1] = 5.25;sqftArray[2] = 5.75;sqftArray[3] = 6.0;var mapArray = new Array(3);for ( var i=0; i <= 3; i++ )mapArray[i] = new Array(4);mapArray[0][0] = 0;mapArray[0][1] = 0;mapArray[0][2] = 0;mapArray[0][3] = 0;mapArray[1][0] = 8;mapArray[1][1] = 10;mapArray[1][2] = 18;mapArray[1][3] = 35;mapArray[2][0] = 8;mapArray[2][1] = 19;mapArray[2][2] = 38;mapArray[2][3] = 75;var theQty = theForm.Qty.value;var heightBox = theForm.bannerHeight;var widthBox = theForm.bannerWidth;var thePrice = theForm.Price; intMapRow=0;var sqftLabel = document.getElementById('sqftLabel');var eachLabel = document.getElementById('eachLabel');var errorLabel = document.getElementById('errorLabel');switch(theQty){case "1":intColumn = 3;break;case "2":case "3":intColumn = 2;break;case "4":case "5":case "6":case "7":intColumn = 1;break;default:intColumn = 0;}switch (theForm.p2.value){case "No Photo/Map" :intMapRow = 0;break;case "Personal Photo" :intMapRow = 1;break;case "Map or Property Photo" :intMapRow = 2;break;}widthBox.value = widthBox.value.replace(/\s$/g, '');heightBox.value = heightBox.value.replace(/\s$/g, ''); if(isNaN(widthBox.value)) {widthBox.value=0;}if(isNaN(heightBox.value)) {heightBox.value=0;}if(heightBox.value>4) {heightBox.value = 4;errorLabel.innerHTML='<br>Height must not exceed 4 feet.<br>';}else {errorLabel.innerHTML='';}var regex = /^[\d]*\.?\d{0,2}$/;var yesNo = regex.test(widthBox.value); if(!yesNo){widthBox.value=0;}var yesNo = regex.test(heightBox.value);if(!yesNo){heightBox.value=0;}if(isNaN(theQty)) {theForm.Qty.value=1;}var sqft =  ((heightBox.value) * (widthBox.value));var price = 0;sqftLabel.innerHTML =  sqft.toFixed(2);if(sqft<=8) {price="40.00";}else if(sqft>=16 && sqft<=23) {price=(4.50*sqft).toFixed(2);}else if(sqft>=24 && sqft<=31) {price=(3.75*sqft).toFixed(2);}else if(sqft>=32 && sqft<=59) {price=(3.50*sqft).toFixed(2);}else if(sqft>=60) {price=(3*sqft).toFixed(2);}else{price=(5*sqft).toFixed(2);}eachLabel.innerHTML = price;thePrice.value = price;theForm.t1.value = "m-Banner;33;3";theForm.p1.value = heightBox.value + "ft. X " + widthBox.value + "ft.";theForm.t2.value = "d-Photo/Map;"+theForm.p2.value+":price=+"+mapArray[intMapRow][intColumn];}function makeFormsUnique(){var p7s = document.getElementsByName('p7');for(i=0;i<p7s.length;i++){var date = new Date();p7s[i].value = date.getTime();}}function screenopt1(){myform1.f3.style.display='none';}function thick(){}function mypopups(popname, popheight, popwidth, ptop, pleft, pfire){mypop = document.getElementById('pop32');mypop.src=popname;mypop.style.visibility='visible';mypop.style.height=popheight;mypop.style.width=popwidth;mypop.style.top=ptop;mypop.style.marginLeft=pleft;var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;if (is_firefox==true)mypop.style.marginLeft=pfire;}function closeIframe(){document.getElementById('pop32').style.visibility='hidden';}function SelectedColor1(SColor, SerialNoColor){var SelColor;var SNoColor;var len;var i;var CurSNo;var z;z=0;var x=0;x=document.getElementById("cpno").value;var txt=new Array();txt[1]="txt1";txt[2]="txt2";txt[3]="txt3";txt[4]="txt4";txt[5]="txt5";txt[6]="txt6";txt[7]="txt7";txt[8]="txt8";txt[9]="txt9";SelColor = document.getElementById(txt[x]).value;SNoColor = SerialNoColor;if((SelColor == "") || (SelColor == null)){SelColor = SColor;}else{SelColor = SelColor + "," + SColor;SNoColor = SNoColor + document.getElementById("temptext").value;}len = SNoColor.length;for(i=1; i<=len;i++){CurSNo = SNoColor.substr(i,1);if(SerialNoColor == CurSNo){alert("This color has already been selected.");z=1;}}if(z==0){document.getElementById('temptext').value=SNoColor;document.getElementById(txt[x]).value = SelColor;}}function doClear(theText){if (theText.value == theText.defaultValue){theText.value = ""}}