
function getTotal() 
{
	if (ns==1 && ie==0) {
		var total = (document.cont.document.calcForm.lngth.value * document.cont.document.calcForm.width.value);
		fttotal = Math.round(total + (total * .10));
		document.cont.document.calcForm.fttotal.value = fttotal;
		ydtotal = Math.ceil(fttotal/9);
		document.cont.document.calcForm.ydtotal.value = ydtotal;
		document.cont.document.calcForm.subCarpetCalc.disabled = false;
	}
	else {
	 	if(ns==6 && ie==6 && document.getElementById){
	 		var width=document.forms[1].elements[1].value
			var lngth=document.forms[1].elements[0].value
			var total = (lngth * width)
			fttotal = Math.round(total + (total * .10));
			document.forms[1].elements[3].value = fttotal;
			ydtotal = Math.ceil(fttotal/9);
			document.forms[1].elements[2].value = ydtotal;
			document.forms[1].elements[4].disabled = false;
	 	}
		else{
			var total = (document.all.cont.document.calcForm.lngth.value * document.all.cont.document.calcForm.width.value);
			fttotal = Math.round(total + (total * .10));
			document.all.cont.document.calcForm.fttotal.value = fttotal;
			ydtotal = Math.ceil(fttotal/9);
			document.all.cont.document.calcForm.ydtotal.value = ydtotal;
			document.all.cont.document.calcForm.subCarpetCalc.disabled = false;
		}
	}
	
}
		
function roundMe1() 
{
	if(ns==1 && ie==0){
	   if(isNaN(document.cont.document.calcForm.lngth.value)) {
		alert("You must enter a numeric value into this field.");
		document.cont.document.calcForm.lngth.value = "";
		document.cont.document.calcForm.lngth.focus();
	   }
	   else {
		document.cont.document.calcForm.lngth.value = 
						Math.ceil(document.cont.document.calcForm.lngth.value);
	   }
	}
	else {
		if(ns==6 && ie==6 && document.getElementById){
			if(isNaN(document.forms[1].elements[0].value)) {
				alert("You must enter a numeric value into this field.");
				document.forms[1].elements[0].value = "";
				document.forms[1].elements[0].focus();
	 		}
	   		else {
		 		document.forms[1].elements[0].value = 
						Math.ceil(document.forms[1].elements[0].value)
			}
		}	
		else{
			if(isNaN(document.all.cont.document.calcForm.lngth.value)) {
				alert("You must enter a numeric value into this field.");
				document.all.cont.document.calcForm.lngth.value = "";
				document.all.cont.document.calcForm.lngth.focus();
	 		}
	   		else {
				document.all.cont.document.calcForm.lngth.value = 
					Math.ceil(document.all.cont.document.calcForm.lngth.value);
				}
		}
	}
}


function roundMe2() {
    if(ns==1 && ie==0){
    	if(isNaN(document.cont.document.calcForm.width.value)) {
		alert("You must enter a numeric value into this field.");
		document.cont.document.calcForm.width.value = "";
		document.cont.document.calcForm.width.focus();
	}
	else {
        document.cont.document.calcForm.width.value = Math.ceil(document.cont.document.calcForm.width.value);
	}
    }
    else {
        if(ns==6 && ie==6 && document.getElementById){
	    if(isNaN(document.forms[1].elements[1].value)) {
		alert("You must enter a numeric value into this field.");
		document.forms[1].elements[1].value = "";
		document.forms[1].elements[1].focus();
	   }
	   else {
            document.forms[1].elements[1].value =
Math.ceil(document.forms[1].elements[1].value)
         }
        }
        else{
	   	if(isNaN(document.all.cont.document.calcForm.width.value)) {
			alert("You must enter a numeric value into this field.");
			document.all.cont.document.calcForm.width.value = "";
			document.all.cont.document.calcForm.width.focus();
	   	}
	   	else {
            document.all.cont.document.calcForm.width.value =Math.ceil(document.all.cont.document.calcForm.width.value);
		}
        }
    }
}

function popWin(fileToOpen, theForm) {
var newWindow2 = window.open(fileToOpen,"newWindow2","height=200,width=275");
theForm.submit();
}                                                                            

function initSPB() {
	if (document.images) {
        a1_on = new Image(94, 103);
        a1_on.src = '/images/bs/sm_bs_sp_br2_r.gif';
        a1_off = new Image(94, 103);
        a1_off.src = '/images/bs/sm_bs_sp_br2_i.gif';

        a2_on = new Image(92, 103);
        a2_on.src = '/images/bs/sm_bs_sp_br3_r.gif';
        a2_off = new Image(92, 103);
        a2_off.src = '/images/bs/sm_bs_sp_br3_i.gif';

        a3_on = new Image(91, 103);
        a3_on.src = '/images/bs/sm_bs_sp_br4_r.gif';
        a3_off = new Image(91, 103);
        a3_off.src = '/images/bs/sm_bs_sp_br4_i.gif';

        a4_on = new Image(92, 103);
        a4_on.src = '/images/bs/sm_bs_sp_br5_r.gif';
        a4_off = new Image(92, 103);
        a4_off.src = '/images/bs/sm_bs_sp_br5_i.gif';

        a5_on = new Image(99, 103);
        a5_on.src = '/images/bs/sm_bs_sp_br6_r.gif';
        a5_off = new Image(99, 103);
        a5_off.src = '/images/bs/sm_bs_sp_br6_i.gif';
	}
}

function verifyForm() {

	if(ns==1 && ie==0){ 
	   if(!(document.cont.document.forms[0].elements[1].value = "")) {
		alert(document.cont.document.forms[0].elements[1].value);
		document.cont.document.forms[0].submit();
	   }
	   else {
	   	alert("You must enter a valid value for this field.");
		document.cont.document.forms[0].elements[1].value = "";
		document.cont.document.forms[0].elements[1].focus();
		
	   }
	}
	else {
		if(ns==6 && ie==6 && document.getElementById){
			if(document.forms[0].elements[1].value = " ") {
				alert("You must enter a valid value for this field.");
				document.forms[0].elements[1].value = " ";
				document.forms[0].elements[1].focus();
	 		}
	   		else {
		 		document.forms[0].submit();
			}
		}	
		else{
			if(document.all.cont.document.forms[0].elements[1].value = " ") {
				alert("You must enter a valid value for this field.");
				document.all.cont.document.forms[0].elements[1].value = " ";
				document.all.cont.document.forms[0].elements[1].focus();
	 		}
	   		else {
				document.all.cont.document.forms[0].submit();
				}
		}
	}
}
                                                               

