function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function nonevalidation(entered, alertbox)
{
with (entered)
{
if (value=="none")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function csvalidation(form) {
	with (form) {
	if (emptyvalidation(cs_username,"Please enter your EMAIL")==false) {cs_username.focus(); return false;};
	if (emptyvalidation(cs_password,"Please enter your PASSWORD")==false) {cs_password.focus(); return false;};
	
this.form.submit();
}
}

function staffvalidation(form) {
	with (form) {
	if (emptyvalidation(sc_username,"Please enter your USERNAME")==false) {sc_username.focus(); return false;};
	if (emptyvalidation(sc_password,"Please enter your PASSWORD")==false) {sc_password.focus(); return false;};
	
this.form.submit();
}
}

function brochurevalidation(form) {
	with (form) {
	if (emptyvalidation(f_name,"Please Enter a First Name")==false) {f_name.focus(); return false;};
	if (emptyvalidation(l_name,"Please Enter a Last Name")==false) {l_name.focus(); return false;};
	if (emptyvalidation(email,"Please Enter a valid email address")==false) {email.focus(); return false;};
this.form.submit();
}
}
function appvalidation(form) {
	with (form) {
	if (emptyvalidation(fname,"Please Enter a First Name")==false) {fname.focus(); return false;};
	if (emptyvalidation(lname,"Please Enter a Last Name")==false) {lname.focus(); return false;};
	if (emptyvalidation(email,"Please Enter a valid email address")==false) {email.focus(); return false;};
	if (nonevalidation(position,"Please Select the Position You Are Applying For")==false) {return false;};
this.form.submit();
}
}
function resvalidation(form) {
	with (form) {
	
	if (nonevalidation(costchoice,"Please Select the Package You Wish To Reserve")==false) {return false;};
this.form.submit();
}
}



function waivervalidation(form) {
	with (form) {
		if (emptyvalidation(conf,"Please Enter a Reservation Number")==false) {conf.focus(); return false;};
		if (emptyvalidation(org,"Please Enter Your Trip Organizer's Name")==false) {org.focus(); return false;};
	if (emptyvalidation(f_name,"Please Enter a First Name")==false) {f_name.focus(); return false;};
	if (emptyvalidation(l_name,"Please Enter a Last Name")==false) {l_name.focus(); return false;};
	if (emptyvalidation(address,"Please Enter Your Street Address")==false) {address.focus(); return false;};
	if (emptyvalidation(city,"Please Enter Your City")==false) {city.focus(); return false;};
	
	if (emptyvalidation(postal,"Please Enter Your Postal / Area Code")==false) {postal.focus(); return false;};
	if (emptyvalidation(w_phone,"Please Enter a Work Phone Number")==false) {w_phone.focus(); return false;};
	if (emptyvalidation(h_phone,"Please Enter a Home Phone Number")==false) {h_phone.focus(); return false;};
	if (emptyvalidation(dob,"Please Enter Your Date of Birth")==false) {dob.focus(); return false;};
	if (emptyvalidation(email,"Please Enter a Valid Email Address")==false) {email.focus(); return false;};
this.form.submit();
}
}

function go()
{
	box = document.forms[0].country;
	destination = box.options[box.selectedIndex].value;
	theurl = "misc.php?page_id=93&country="+destination;
	if (destination) location.href = theurl;
}
function go3()
{
	box = document.forms[0].country;
	destination = box.options[box.selectedIndex].value;
	theurl = "reservations.php?page_id=104&country="+destination;
	if (destination) location.href = theurl;
}

function goCC()
{
this.form.submit();
}


function validate_nums(string) {
    if (!string) return false;
    var nums = "0123456789";
    for (var n = 0; n < string.length; n++) {
       if (nums.indexOf(string.charAt(n)) == -1)
          return false;
    }
    return true;
}  
function validate_reslen(string) {
    if (!string) return false;
    if (string.length < 5) return false;
    
    return true;
}
function validate_letters(string) {
    if (!string) return false;
    string=string.toUpperCase(); 
    var chars = "QWERTYUIOPASDFGHJKLZXCVBNM";
    for (var m = 0; m < string.length; m++) {
       if (chars.indexOf(string.charAt(m)) == -1)
          return false;
    }
    return true;
}






function formvalidation(form) {
	with (form) {
	if (emptyvalidation(keyword,"Please Enter a Search word")==false) {keyword.focus(); return false;};

this.form.submit();
}
}


function openSesame(theURL) {
		leftPos = (screen.width / 2) - 200;
	topPos = (screen.height / 2) - 150;
  window.open(theURL,'vid','width=400,height=300,left='+leftPos+',top='+topPos+',innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
}
function openJoe()
{	
	leftPos = (screen.width / 2) - 200;
	topPos = (screen.height / 2) - 150;
	newwin = window.open('joe.php','joe','width=400,height=300,left='+leftPos+',top='+topPos+',innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
}


function paylogin_validation(form) {
	with (form) {
	if (emptyvalidation(conf_num,"Please Enter Your Reservation Number")==false) {conf_num.focus(); return false;};
	if (emptyvalidation(password,"Please Enter a Password")==false) {password.focus(); return false;};
	
this.form.submit();
}
}


function IsEmailValid(FormName,ElemName)
{
var EmailOk  = true
var Temp     = document.forms[FormName].elements[ElemName]
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   

if ((AtSym < 1) ||                    
    (Period <= AtSym+1) ||            
    (Period == Length ) ||          
    (Space  != -1))                  
   {  
      EmailOk = false
      alert("Please enter a valid e-mail address!");
      Temp.value="";
      Temp.focus()
   }
return EmailOk
}


function waiverfname_response(){

document.form.f_name.value = "";
document.form.f_name.focus();
alert('Letters Only Please');

}
function waiverlname_response(){

document.form.l_name.value = "";
document.form.l_name.focus();
alert('Letters Only Please');
}

function waivernums_response(){

document.form.conf.value = "";
document.form.conf.focus();
alert('Numbers Only Without Spaces Please');

}

function reslen_response(){

document.form.conf.value = "";
document.form.conf.focus();
alert('Reservation Numbers Cannot Be Less Than 5 Digits in Length');

}


function appfname_response(){

document.form.fname.value = "";
document.form.fname.focus();
alert('Letters Only Without Spaces Please');

}
function applname_response(){

document.form.lname.value = "";
document.form.lname.focus();
alert('Letters Only Without Spaces Please');
}

function brofname_response(){

document.form.f_name.value = "";
document.form.f_name.focus();
alert('Letters Only Without Spaces Please');

}
function brolname_response(){

document.form.l_name.value = "";
document.form.l_name.focus();
alert('Letters Only Without Spaces Please');
}

function openPagePrint(page_id) {	
	leftPos = (screen.width / 2) - 360;
	topPos = (screen.height / 2) - 270;
	newwin = window.open('print_page.php?page_id='+page_id+'','PrintPage','width=720,height=540,left='+leftPos+',top='+topPos+',innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=1');
}