function isEmailValid(email) {
			invalidChars = " /:,;"
			if (email == "") { // cannot be empty
				return false
			}
			for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1) // there must be one "@" symbol
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) { // and at least one "." after the "@"
				return false
			}
			if (periodPos+3 > email.length)	{ // must be at least 2 characters after the "."
				return false
			}
			return true
		}
		
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function isFormValid(myForm){
	if (myForm.First_Name.value==""){
	alert("Please tell us your FIRST NAME");
	myForm.First_Name.focus();
	return false;
	}
	if (myForm.Last_Name.value==""){
	alert("Please tell us your LAST NAME");
	myForm.Last_Name.focus();
	return false;
	}
	if (!isEmailValid(myForm.Email.value)){
	alert("Please check your EMAIL ADDRESS");
	myForm.Email.focus();
	return false;
	}

return true;
}

function isDiveFormValid(myForm){
	if (myForm.First_Name.value==""){
	alert("Please tell us your First Name");
	myForm.First_Name.focus();
	return false;
	}
	if (myForm.Last_Name.value==""){
	alert("Please tell us your Last Name");
	myForm.Last_Name.focus();
	return false;
	}
	if (!isEmailValid(myForm.Email.value)){
	alert("Please check your Email Address");
	myForm.Email.focus();
	return false;
	}
	if (myForm.phone_home.value=="" && myForm.phone_business.value==""){
	alert("Please tell us your Contact Phone Number");
	myForm.phone_business.focus();
	return false;
	}

return true;
}


function isPhFormValid(phoneform){
	if (phoneform.Phone_No.value==""){
	alert("Please enter the Phone Number");
	phoneform.Phone_No.focus();
	return false;
	}
	
return true;
}

function is1000FormValid(myForm){
		quest1 = -1
			for (i=0; i<myForm.TypeofTravel.length; i++) {
				if (myForm.TypeofTravel[i].checked) {
					quest1 = i
				}
			}
			if (quest1 == -1) {
				alert("Please choose your Type of Travel")
				return false;
			}
	if (myForm.First_Name.value==""){
	alert("Please tell us your FIRST NAME");
	myForm.First_Name.focus();
	return false;
	}
	if (myForm.Last_Name.value==""){
	alert("Please tell us your LAST NAME");
	myForm.Last_Name.focus();
	return false;
	}
	if (!isEmailValid(myForm.Email.value)){
	alert("Please check your EMAIL ADDRESS");
	myForm.Email.focus();
	return false;
	}

return true;
}

function adCost(form) {
var ok = 0;
var basepackage = eval(form.basepackage.value);
var insurance = eval(form.insurance.value);
var accommodation = eval(form.accommodation.value);
var airfare = eval(form.airfare.value);
var taxes = eval(form.taxes.value);
var total = form.total.value;
form.total.value = basepackage + insurance + accommodation + airfare + taxes;
}

function showLgePic(pic,winName,winAttributes) { 
  window.open(pic,winName,winAttributes);
}

function Zoom(imgName,imgWidth,imgHeight) { 

var count = 0; 

zoomWindow = window.open('', 'zoomWin', 'width='+imgWidth+',height='+imgHeight+'top=0,left=0,toolbar=0,menubar=0,location=0,scrollbars=yes') 

zoomWindow.document.write("<html><head><title>Please Wait...<\/title><\/head><body background='popupbacking.gif' leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text='",imgWidth,imgHeight,"' onBlur='close();'><center><a href='#' onClick =javascript:window.close()><img src='",imgName,"' alt='Click to Close' border='0'><\/a><\/center><\/body><\/html>") 
zoomWindow.focus() 
zoomWindow.window.resizeTo(imgWidth+8, imgHeight+29); 
zoomWindow.document.title = "Dive Fish Snow Travel" 
} 

function Enlarge(imgName,imgWidth,imgHeight) { 

var count = 0; 

zoomWindow = window.open('', 'zoomWin', 'width='+800+',height='+600+'top=0,left=0,toolbar=0,menubar=0,location=0,scrollbars=yes') 

zoomWindow.document.write("<html><head><title>Please Wait...<\/title><\/head><body background='/images/popupbacking.gif' leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text='",imgWidth,imgHeight,"' onBlur='close();'><a href='#' onClick =javascript:window.close()>[x close]<\/a><br><center><img src='",imgName,"'border='0'><\/center><\/body><\/html>") 
zoomWindow.focus() 
//zoomWindow.window.resizeTo(imgWidth+8, imgHeight+29); 
zoomWindow.document.title = "Dive Fish Snow Travel" 
if(!NS){self.moveTo(5,5);}
	else{self.moveTo(5,5);}
	self.focus(); 
} 

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
 
function addtofav(title, url){
alert(title)
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}