			 var NewWin=null;
 function launchLink(sURL,windowname,theScrollbars,theResizable,theWidth,theHeight){
	 if(!NewWin){NewWin=window.open(sURL,windowname,"top=10,left=10,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+theWidth+",height="+theHeight);}	
		else{if(!NewWin.closed){NewWin.close();}NewWin=window.open(sURL,windowname,"top=10,left=10,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+theWidth+",height="+theHeight);}}
 var NewWin=null;
 function NewWindow(sURL,windowname,theScrollbars,theResizable,theWidth,theHeight){
	 if(!NewWin){NewWin=window.open(sURL,windowname,"top=10,left=10,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+theScrollbars+",resizable="+theResizable+",width="+theWidth+",height="+theHeight);}	
		else{if(!NewWin.closed){NewWin.close();			
			}NewWin=window.open(sURL,windowname,"top=10,left=10,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+theScrollbars+",resizable="+theResizable+",width="+theWidth+",height="+theHeight);}}
function goUrl(s){var d = s.options[s.selectedIndex].value;window.self.location.href = d;s.selectedIndex=0;}
 var NewsSign=null;

// EMAIL VALIDATION BEGIN
function validEmail(email) {
	invalidChars = " /:,#%\"'()[]{}^"						
	if (email == "") {return false;}
	for (i=0; i<invalidChars.length; i++) {	badChar = invalidChars.charAt(i)
		if ( email.indexOf(badChar) != -1 ){return false}
	}
// declares that dot after @ is illegal
	dotAfterPos = email.indexOf("@");
	dotAfterChar = email.charAt(dotAfterPos + 1);
	if (dotAfterChar == ".") {return false;}

// declares that a dot after the dot (after the @) is illegal
	dotDotPos = email.indexOf(".",dotAfterPos);
	dotDotChar = email.charAt(dotDotPos + 1);
	if (dotDotChar == ".") {
		return false;
	}

// declares that if there's a dot at the end of the email string, it is illegal
	endPos = email.length - 1;
	endChar = email.charAt(endPos);
	if (endChar == ".") {return false;}

	atPos = email.indexOf("@",1)
	if (atPos == -1) {return false;}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {return false;}
	if (periodPos+3 > email.length){return false;}
	if ( email.indexOf(";") == -1 ){
	if (email.indexOf("@",atPos+1) != -1) {return false;}
	} return true;
}
// EMAIL VALIDATION END

function checkNews(form) {if (!validEmail(document.newsLetter.login.value)) {alert("Please enter valid  email address");
	document.newsLetter.login.focus();return false;}
	// already used action='thank_you.jhtml' in the form
	//launchLink('/thank_you.jhtml','description',1,0,320,200);
	return true;
}

function setRes(){
	changeSelects(document.tripSearch.regions.options[document.tripSearch.regions.selectedIndex].value);
}
 
function setMaritzRes(){
	changeSelects(document.tripSearch.regions.options[document.tripSearch.regions.selectedIndex].value);
}
 
function setTrpSearch(){
  document.tripSearch.activities.value = "0";document.tripSearch.regions.value = "0"; document.tripSearch.countries.value = "0";
  document.tripSearch.prall.checked = true;document.tripSearch.pr1.checked = false; document.tripSearch.pr12.checked = false;document.tripSearch.pr23.checked = false;document.tripSearch.pr34.checked = false; document.tripSearch.pr45.checked = false;document.tripSearch.pr5.checked = false;
  document.tripSearch.From.value = "0";document.tripSearch.To.value = "0";document.tripSearch.TripLength.value = "-1";
  document.tripSearch.pna.checked = true;document.tripSearch.p1.checked = false;document.tripSearch.p2.checked = false;document.tripSearch.p3.checked = false;document.tripSearch.p4.checked = false;document.tripSearch.p5.checked = false;
  document.tripSearch.mna.checked = true;document.tripSearch.m1.checked = false;document.tripSearch.m2.checked = false;document.tripSearch.m3.checked = false;document.tripSearch.m4.checked = false;document.tripSearch.m5.checked = false;
  document.tripSearch.tna.checked = true;document.tripSearch.t1.checked = false;document.tripSearch.t2.checked = false;document.tripSearch.t3.checked = false;document.tripSearch.t4.checked = false;document.tripSearch.t5.checked = false;
  document.tripSearch.ona.checked = true;document.tripSearch.o1.checked = false;document.tripSearch.o2.checked = false;document.tripSearch.o3.checked = false;document.tripSearch.o4.checked = false;document.tripSearch.o5.checked = false;
  document.tripSearch.sna.checked = true;document.tripSearch.s1.checked = false;document.tripSearch.s2.checked = false;document.tripSearch.s3.checked = false;document.tripSearch.s4.checked = false;document.tripSearch.s5.checked = false;
  document.tripSearch.cna.checked = true;document.tripSearch.c1.checked = false;document.tripSearch.c2.checked = false;document.tripSearch.c3.checked = false;document.tripSearch.c4.checked = false;document.tripSearch.c5.checked = false;
  document.tripSearch.Max_Group.value = "0";
}
function setMaritzTrpSearch(){
  document.tripSearch.activities.value = "0";document.tripSearch.regions.value = "0"; document.tripSearch.countries.value = "0";
  document.tripSearch.prall.checked = true;document.tripSearch.mp10l.checked = false; document.tripSearch.mp1015.checked = false;document.tripSearch.mp1520.checked = false;document.tripSearch.mp2025.checked = false; document.tripSearch.mp2530.checked = false;document.tripSearch.mpm30.checked = false;
  document.tripSearch.TripLength.value = "-1";
}
function setHomeForm(){
 if (navigator.appName=="Microsoft Internet Explorer"){
   //document.newsLetter.login.value = "";
   document.tripSearch.regions.value = "0";
   document.tripSearch.countries.value = "0";
   document.tripSearch.activities.value = "0";
   //document.tripSearch.sort_order.value="DESC";
   //document.tripSearch.by_satisfaction.checked=true;
   //document.tripSearch.by_price.checked=false;
  }
   //else{document.newsLetter.login.value = "";}
 }
 
function setMaritzHomeForm(){
	if (navigator.appName=="Microsoft Internet Explorer"){
		document.tripSearch.regions.value = "0";
		document.tripSearch.countries.value = "0";
		document.tripSearch.priceRange.value = "0";
	}
	else {
		document.newsLetter.login.value = "";
	}
}

 function setHomeSearch(){
 if (navigator.appName=="Microsoft Internet Explorer"){
   document.tripSearch.regions.value = "0";
   document.tripSearch.countries.value = "0";
   document.tripSearch.activities.value = "0";
     }
 }
function setNewsLetter(){
document.newsLetter.login.value = "";}
function loadAdvtwoForm(){
  document.tripSearch.tourName.value = "";
  document.tripSearch.tourID.value = "";
  document.tripSearch.activities.selectedIndex = 0;
  document.tripSearch.regions.selectedIndex = 0;
  document.tripSearch.countries.selectedIndex = 0;
  document.tripSearch.prall.checked = true;
  document.tripSearch.pr1.checked = false;
  document.tripSearch.pr12.checked = false;
  document.tripSearch.pr23.checked = false;
  document.tripSearch.pr34.checked = false;
  document.tripSearch.pr45.checked = false;
  document.tripSearch.pr5.checked = false;
  document.tripSearch.From.selectedIndex = 0;
  document.tripSearch.To.selectedIndex = 0;
  document.tripSearch.TripLength.options[document.tripSearch.TripLength.selectedIndex].text ="Any Length";
  document.tripSearch.Max_Group.selectedIndex = 0;
}
function clearCard(){
document.paymentGC.cardnumber.value = "";
document.paymentGC.cardtype.selectedIndex = 0;
document.paymentGC.expmonth.selectedIndex = 0;
document.paymentGC.expyear.selectedIndex = 0;
}
function clearMonitor(){
document.tripSearch.tName.value = "";
document.tripSearch.tName1.value = "";
document.tripSearch.tName2.value = "";
}

// embeds flash movies! yay!

function flash(flashURL,flashID,divName,noFlashImage,noFlashURL,noFlashTitle,width,height,bgColor) {
// <![CDATA[
	document.write("<div id=\""+divName+"\" style=\"width:"+width+";height:"+height+";background-image: url("+noFlashImage+"); background-repeat: no-repeat; cursor: pointer;\"></div>");
			
	var fo = new FlashObject(flashURL, flashID, width, height, "7", bgColor);
	fo.write(divName);
			
// ]]>
}


// this function encrypts form code so spam spiders/bots can's see it //
function makeForm(code) {
	
	r="";
	i=0;
	
	while (i<code.length) {
		r+="%"+code.charAt(i++)+code.charAt(i++);
	}
	if (code.length*3==r.length*2) {
		document.write(unescape(r));
	}
}
