// JavaScript Document



function calculate(x)

{



	k=0;



	if(x==1)



	{



		if ((document.getElementById("Width_Plotted_Viny").value) == "")



 			 { 



			 TWidth = 0;



 			 }



			else



 			 { 



			 TWidth = eval(document.getElementById("Width_Plotted_Viny").value);



 			 }



		if ((document.getElementById("Height_Plotted_Viny").value) == "")



  			{ 



			  THeight = 0;



 			 }



			else



 			 { 

			 

			 THeight = eval(document.getElementById("Height_Plotted_Viny").value);



 			 }



			Base = TWidth * THeight		



		    SBase = nextNearest(Base, .5);



			TQuantity = eval(document.getElementById("qtyTxt_Plotted_Viny").value); 



			price="";



			



			if(TQuantity <=249)



			{



			 price=0.03;	



			}



			else if( (TQuantity >249) && (TQuantity <=499))



			{



			price=0.025;	



			}



			else if( (TQuantity >499) && (TQuantity <=999))



			{



			price=0.022125;	



			}



			

			else if( (TQuantity >999) && (TQuantity <=2499))

			{



			price=0.02;	



			}



			else



			{



			 alert("Call Us");



			 k=1;



			}



			if(k==0)



			{



				if(TQuantity <=100)



				{



          		 Cost_Plotted_Viny=75;



				 each_Plotted_Viny=(75/TQuantity);



				}



				else



				{



					Cost_Plotted_Viny= (SBase*price*TQuantity);



					each_Plotted_Viny= SBase*price;



				}

                 //alert(SBase);

				 //alert(price);

                 //alert(TQuantity);

				 

				 /* Added by shadanad on 13-july-09 START */

				 

				

				if((Cost_Plotted_Viny < 75) || (each_Plotted_Viny<0.28))

				 {

					 price=0.28;

					 Cost_Plotted_Viny  = (price*TQuantity);

					 each_Plotted_Viny  = (Cost_Plotted_Viny / TQuantity);

					 //alert(each_Plotted_Viny);

				 }



				

				 /* Added by shadanad on 13-july-09 END */



				document.getElementById("Cost_Plotted_Viny").value=Cost_Plotted_Viny;



				document.getElementById("Each_Plotted_Viny").value=each_Plotted_Viny;



			}



	  }



	  



	  /* 2*/



	if(x==2)



	{



	



	 



	



	    k=0;



		if ((document.getElementById("Width_Full_Color_Die").value) == "")



 			 { 



			 TWidth = 0;



 			 }



			else



 			 { 



			 TWidth = eval(document.getElementById("Width_Full_Color_Die").value);



 			 }



		if ((document.getElementById("Height_Full_Color_Die").value) == "")



  			{ 



			  THeight = 0;



 			 }



			else



 			 { THeight = eval(document.getElementById("Height_Full_Color_Die").value);



 			 }



			Base = TWidth * THeight		



		   



		TQuantity = eval(document.getElementById("qtyTxt_Full_Color_Die").value); 



		SBase = nextNearest(Base, .5);



	    Volume=SBase*TQuantity;



		



		if(TQuantity >=1000 &&  TQuantity <=4000){



		 price=0.02275;



		}



		if(TQuantity >=5000 &&  TQuantity <=9000){



		 price=0.021;



		}



		if(TQuantity >=10000){



		 alert("Call Us");



		 k=1;



		}	



		



		DieCut = eval(document.getElementById("DieCut_Full_Color_Die").value); 



		HolePunch = eval(document.getElementById("HolePunch_Full_Color_Die").value); 



		KissCut= eval(document.getElementById("KissCut_Full_Color_Die").value); 



		



		if(k==0)



			{

                //alert(SBase);

				 //alert(price);

				 //alert(TQuantity);

				Cost_Full_Color_Die= (SBase*price*TQuantity)+(DieCut*TQuantity)+(HolePunch*TQuantity)+(KissCut*TQuantity);



				each_Full_Color_Die=  (SBase*price)+DieCut+HolePunch+KissCut;



				document.getElementById("Cost_Full_Color_Die").value=Cost_Full_Color_Die;



				document.getElementById("Each_Full_Color_Die").value=each_Full_Color_Die;



    		    return false;



			} 



	  } 



	  



	 /* x=3*/



	  if(x==3)



	{



	    k=0;



		



		if ((document.getElementById("Area_Uv_Coated").value) == "")



 			 { 



			 TArea = 0;



 			 }



			else



 			 { 



			 TArea = eval(document.getElementById("Area_Uv_Coated").value);



 			 }



			 



			



			TQuantity = eval(document.getElementById("qtyTxt_Uv_Coated").value); 



			if(k==0)



			{



          		Cost_Vinyl= SBase*price*TQuantity;



				each_Vinyl=  SBase*price;



				document.getElementById("Cost_Vinyl").value=Cost_Vinyl;



				document.getElementById("Each_Vinyl").value=each_Vinyl;



				return false;



		   }	



	  }



	 /* 4*/



	if(x==4)



	{



	    k=0;



		if ((document.getElementById("Width_Vinyl").value) == "")



 			 { 



			 TWidth = 0;



 			 }



			else



 			 { 



			 TWidth = eval(document.getElementById("Width_Vinyl").value);



 			 }



		if ((document.getElementById("Height_Vinyl").value) == "")



  			{ 



			  THeight = 0;



 			 }



			else



 			 { THeight = eval(document.getElementById("Height_Vinyl").value);



 			 }



			Base = TWidth * THeight		



		    SBase = nextNearest(Base, .5);



			



			TQuantity = eval(document.getElementById("qtyTxt_Vinyl").value); 

			if(TQuantity>0)

			{



				price=4.85;

	

				

	

				if(k==0)

				{

	

					Cost_Vinyl= SBase*price*TQuantity;

	

					each_Vinyl=  SBase*price;

	

					document.getElementById("Cost_Vinyl").value=Cost_Vinyl;

	

					document.getElementById("Each_Vinyl").value=each_Vinyl;

					document.getElementById("Vinyl_cost").innerHTML='';

					return false;

	

			   }	

			}

			else

			{

					document.getElementById("Vinyl_cost").innerHTML='Call US';

					return false;

			}



	  }



	 /*5 */



	 



	 if(x==5)



	{



	    k=0;



		if ((document.getElementById("Width_color_banner").value) == "")



 			 { 



			 TWidth = 0;



 			 }



			else



 			 { 



			 TWidth = eval(document.getElementById("Width_color_banner").value);



 			 }



		if ((document.getElementById("Height_color_banner").value) == "")



  			{ 



			  THeight = 0;



 			 }



			else



 			 { THeight = eval(document.getElementById("Height_color_banner").value);



 			 }



			Base = TWidth * THeight		



		    SBase = nextNearest(Base, .5);



			



			TBanner = eval(document.getElementById("banner_Type").value); 



			TQuantity = eval(document.getElementById("qtyTxt_color_banner").value); 



			if(document.getElementById("banner_Type").value==1)



			{



			price=0.04167;



			}



			if(document.getElementById("banner_Type").value==2)



			{



			price=0.0336805;



			}



				 



				 



				 if(k==0)



			{



          		Cost_color_banner= SBase*price*TQuantity;



				each_color_banner=  SBase*price;



				document.getElementById("Cost_color_banner").value=Cost_color_banner;



				document.getElementById("Each_color_banner").value=each_color_banner;



				return false;



		   }	



	  }



	  



	 



}



function nextNearest(value, number)



{



  var ceil = Math.ceil(value);



  var remainder = value % number;



  if (remainder > 0)



    value = value - remainder + number;



  return value;



}