/*Form validation, and checkbox validation scripts
Original: wsabstract.com -- field validation
Original:  Colin Pc --checkbox validation 
Web Site:  http://www.insighteye.com/ 
This script and many more are available free online at 
The JavaScript Source!! http://javascript.internet.com */

function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,4)=="req_") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(4,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else

if (which.agree.checked == false )
{
alert('Please make sure that you agree with our terms and conditions.');
return false;
}else
return true;
}

/*Funcion en espanol*/

function checkrequired_es(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,4)=="req_") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(4,30).toUpperCase();
alert("Por favor, tiene que rellenar la casilla "+shortFieldName+".");
return false;
}
else

if (which.agree.checked == false )
{
alert('Por favor, tiene que aceptar las condiciones de reserva.');
return false;
}else
return true;
}

