// JavaScript Document
function validar()
{
var error = false;
var mensaje="The following fields are required:\n\n";

if (document.autoSumFormShik.totalprice.value=="") 
{
mensaje=mensaje + "» No producto seleccionado.Por favor especifique cantidad.\n";
error=true;
}


if (document.autoSumFormShik.company.value=="") 
{
mensaje=mensaje + "» Por favor escribe nombre de la empresa.\n";
error=true;
}

if (document.autoSumFormShik.bill.value=="") 
{
mensaje=mensaje + "» Por favor escriba a quien va dirigida la cuenta.\n";
error=true;
}

if (document.autoSumFormShik.method.options[document.autoSumFormShik.method.selectedIndex].value=="")
{
mensaje=mensaje + "» Por favor especifique modo de pago.\n";
error=true;
}

if (document.autoSumFormShik.bname.value=="") 
{
mensaje=mensaje + "» Por favor escriba Nombre de la Empresa.\n";
error=true;
}

if (document.autoSumFormShik.badress.value=="") 
{
mensaje=mensaje + "» Por favor escriba la direccion  de la Empresa.\n";
error=true;
}

if (document.autoSumFormShik.bcity.value=="") 
{
mensaje=mensaje + "» Por favor escriba la ciudad,estado,codigo postal.de la Empresa.\n";
error=true;
}

if (document.autoSumFormShik.bphone.value=="") 
{
mensaje=mensaje + "» Por favor escriba el telefono.\n";
error=true;
}

if (document.autoSumFormShik.sname.value=="") 
{
mensaje=mensaje + "» Por favor escribe el nombre de la persona para el envio.\n";
error=true;
}

if (document.autoSumFormShik.sadress.value=="") 
{
mensaje=mensaje + "» Por favor escribe la direccion del envio.\n";
error=true;
}

if (document.autoSumFormShik.scity.value=="") 
{
mensaje=mensaje + "» Por favor escriba la Ciudad,Codigo Postal del envio.\n";
error=true;
}

if (document.autoSumFormShik.sphone.value=="") 
{
mensaje=mensaje + "» Por favor escribe el telefono.\n";
error=true;
}

if (error)
{
mensaje=mensaje+"\n Please click OK and enter the required data in-order to send your order.";
alert(mensaje);
return false;
}

}

/*if (document.autoSumFormShik.product1.options[document.autoSumFormShik.product1.selectedIndex].value=="")
{
mensaje=mensaje + "»  has not selected the product to adquire...\n";
error=true;
}

if (document.autoSumFormShik.quantity1.value=="") 
{
mensaje=mensaje + "» It has not entered the quantity.\n";
error=true;
}*/
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jim Stiles | www.jdstiles.com */
/*
function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  one = document.autoSumForm.firstBox.value;
  two = document.autoSumForm.secondBox.value; 
  document.autoSumForm.thirdBox.value = (one * 1) + (two * 1);
}
function stopCalc(){
  clearInterval(interval);
}*/

/*
Modified By: Shikma Yacobson | VisionNETWorks | www.vnetcorp.com
*/
function startCalcShik(trownum){
  var getthenum = trownum;
  intervalShik = setInterval("calcShik("+getthenum+")",1);
}
function sumAllShik(){
	totalNum = 0;
	for(i=1;i<=16 ;i++){
		var totBox = "to" + i;
		//alert(totBox);
		var lookupNum = document.autoSumFormShik[totBox].value;
		//alert(lookupNum);
		totalNum = (totalNum * 1) + (lookupNum * 1); 
		
	}
	return totalNum;
}
function calcShik(sentnum){
  trownumShik = sentnum;
  var firstBox = "pr" + trownumShik;
  var secondBox = "qt" + trownumShik;
  var thirdBox = "to" + trownumShik;
  oneShik = document.autoSumFormShik[firstBox].value;
  twoShik = document.autoSumFormShik[secondBox].value; 
  totalShik = document.autoSumFormShik[secondBox].value
  if( twoShik == ''){
	  twoShik = 1;
  }
  document.autoSumFormShik[thirdBox].value = (oneShik * 1) * (twoShik * 1);
  document.autoSumFormShik.totalprice.value = sumAllShik();
}

function stopCalcShik(){
  clearInterval(intervalShik);
}

function sameInfo(){
	 if(document.autoSumFormShik.slikeBilling.checked){
		 document.autoSumFormShik.sname.value =  document.autoSumFormShik.bname.value;
		 document.autoSumFormShik.sadress.value =  document.autoSumFormShik.badress.value;
		 document.autoSumFormShik.scity.value =  document.autoSumFormShik.bcity.value;
		 document.autoSumFormShik.sphone.value =  document.autoSumFormShik.bphone.value;
		 document.autoSumFormShik.sfax.value =  document.autoSumFormShik.bfax.value;
	 }else{
	 	document.autoSumFormShik.sname.value =  '';
		 document.autoSumFormShik.sadress.value =  '';
		 document.autoSumFormShik.scity.value =  '';
		 document.autoSumFormShik.sphone.value =  '';
		 document.autoSumFormShik.sfax.value =  '';
	 }
}
