varqty=1;
varlength=0;
vardepth=0;
varsinks=1;
varfaucet=0;
varsplashb=1;
varsplashl=0;
varsplashr=0;
varvanityprice=0;
varshipping=0;
vardiscountprice=varvanityprice*.95;
varsplashprice=0;
varsplashprice2=0;
varsplashX=0;
varzip=0;
varcolor="text"
varedge="E1"
varsample="A"



function currency(anynum) {
   anynum=eval(anynum)
   workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
   if (workStr.indexOf(".")==-1){workStr+=".00"}
   dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
   pStr=workStr.substr(workStr.indexOf("."))
   while (pStr.length<3){pStr+="0"}

   //--- Adds comma in thousands place.
   if (dNum>=1000) {
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
   }

   //-- Adds comma in millions place.
   if (dNum>=1000000) {
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
   }
   retval = dStr + pStr 
   //-- Put numbers in parentheses if negative.
   if (anynum<0) {retval="("+retval+")"}
   return "$"+retval
}

//----------------------------------------------------------------------------------

function calculate(){

	varsplashl=document.CALC.splashl.value;
	varsplashr=document.CALC.splashr.value;
	varlength=document.CALC.length.value;
	vardepth=document.CALC.depth.value;
	varsinks=document.CALC.sinks.value;
	varfaucet=document.CALC.faucet.value;
	varsplashb=document.CALC.splashb.value;
	varzip=document.CALC.zip.value;
	varedge=document.CALC.edge.value;
	varsample=document.CALC.sample.value;
	varedgeprice=0;
	
	var intl=varsplashl;
	var intr=varsplashr;
	
	varsplashX=(intl+intr);
	
	

	varvanityprice=varlength*9.5;
	varshipping=0;
	vardiscountprice=varvanityprice*.95;
	//document.write(varsplashX);
	if (varzip < 50000){
		varshipping=150;
	} else{
		if (varzip >=50000){
			if (varzip <= 70000){
			varshipping=150;
			}
			else {
			varshipping=150;
			}		
		}

	}
	
switch (varedge) 
{ 
   case "E1" : 
      varedgeprice=0;
      break   
   case "E2" : 
      varedgeprice=(varlength*1.90); 
      break; 
   case "E3" : 
      varedgeprice=(varlength*3.53); 
      break; 

   default : 
      varedgeprice=0; 
} 

if (varsplashX==10){

	switch (varedge) 
	{ 
	   case "E1" : 
	      varedgeprice=varedgeprice+35;
	      break; 
	   case "E2" : 
	      varedgeprice=varedgeprice+(22*1.90); 
	      break; 
	   case "E3" : 
	      varedgeprice=varedgeprice+(22*3.50); 
	      break; 
	      
	   default : 
	      varedgeprice=varedgeprice+0; 
	} 
	
}

if (varsplashX==11){
varedgeprice=varedgeprice+70;
}

if (varsplashX==01){

	switch (varedge) 
	{ 
	   case "E1" : 
	      varedgeprice=varedgeprice+35;
	      break; 
	   case "E2" : 
	      varedgeprice=varedgeprice+(22*1.90); 
	      break; 
	   case "E3" : 
	      varedgeprice=varedgeprice+(22*3.50); 
	      break; 
	      
	   default : 
	      varedgeprice=varedgeprice+0; 
	} 
}

if (varsplashX==00){

	switch (varedge) 
	{ 
	   case "E1" : 
	      varedgeprice=varedgeprice+0;
	      break; 
	   case "E2" : 
	      varedgeprice=varedgeprice+2*(22*1.90); 
	      break; 
	   case "E3" : 
	      varedgeprice=varedgeprice+2*(22*3.50); 
	      break; 

	   default : 
	      varedgeprice=varedgeprice+0; 
	} 

}
	
switch (varsample) 
{ 
   case "A" : 
      varsampleprice=0;
      break;
   case "B" : 
      varsampleprice=0;
      break; 
   case "C" : 
      varsampleprice=(varlength*2); 
      break; 
   case "D" : 
      varsampleprice=(varlength*2); 
      break; 
    
   default : 
      varsampleprice=0;  
} 

if (varsplashX==10){

	switch (varsample) 
	{ 
	   case "A" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "B" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "C" : 
	      varsampleprice=varsampleprice+(22*2); 
	      break; 
	   case "D" : 
	      varsampleprice=varsampleprice+(22*2); 
	      break; 
	      
	   default : 
	      varsampleprice=varsampleprice+0; 
	} 
	
}

if (varsplashX==11){
varsampleprice=varsampleprice+70;
}

if (varsplashX==01){

	switch (varsample) 
	{ 
	   case "A" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "B" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "C" : 
	      varsampleprice=varsampleprice+(22*2); 
	      break; 
	   case "D" : 
	      varsampleprice=varsampleprice+(22*2); 
	      break; 

	   default : 
	      varsampleprice=varsampleprice+0; 
	} 
}

if (varsplashX==00){

	switch (varsample) 
	{ 
	   case "A" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "B" : 
	      varsampleprice=varsampleprice+0;
	      break; 
	   case "C" : 
	      varsampleprice=varsampleprice+2*(22*2); 
	      break; 
	   case "D" : 
	     varsampleprice=varsampleprice+2*(22*2); 
	      break; 
	      
	   default : 
	      varsampleprice=varsampleprice+0; 
	} 

}
	
	varvanityprice=(varlength*9.5)+varshipping+varedgeprice+varsampleprice;
	
	
	if (varsinks==2){
	varvanityprice+=0;
	}
	
	//-- OUTPUT SECTION ------
	
	vardiscountprice=varvanityprice*.95;
	varvanityprice=currency(varvanityprice);
	vardiscountprice=currency(vardiscountprice);
	document.CALC.vanityprice.value=varvanityprice;
	document.CALC.discountprice.value=vardiscountprice;
}
