//############# choose travelpack #############
function getpage(param){
	var sURL = document.jump.travelpack.options[document.jump.travelpack.selectedIndex].value;
	if(sURL.substr(0,4)=="http"){//EXTERNAL URL -> OPEN IN NEW WINDOW
		window.open(sURL);
	}
	else{
		if(param=="parent"){
			top.location.href = sURL;
		}
		else{
			location.href = sURL;
		}
	}
}
// ###################################### WINOPEN ######################################
function get_wnd(path){
	window.open(path,'','width=550,height=550,scrollbars=yes,resizable=yes');
}
// #######################  ACTIONS  #######################
function win_close(lang){
	if (lang=='en'){
		document.write('<div align=right><a href=javascript:window.close(); class=content>Close</a></div>');
	}
	if (lang=='fr'){
		document.write('<div align=right><a href=javascript:window.close(); class=content>Fermer</a></div>');
	}
	if (lang=='nl'){
		document.write('<div align=right><a href=javascript:window.close(); class=content>Sluiten</a></div>');
	}
}

function fnBookmarkPage(){
	if (document.all){
		window.external.AddFavorite(document.location,document.title);
	}
}
function fnSetAsHomePage(){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(window.location);
	}
}
function fnChangeCountryCity(frm,obj,sPostTo,scrollTo){
	if(scrollTo!=""){
		location.href = sPostTo + obj.options[obj.selectedIndex].value + "#" + scrollTo;
	}
	else{
		location.href = sPostTo + obj.options[obj.selectedIndex].value;
	}
}

function fnOpenWindow(sURL,W,H) {
	var params = 'location=0,toolbar=0,menubar=0,scrollbars=1,resizable=1,status=0,width=' + W + ',height=' + H;
	window.open(sURL,'popWin',params);
}

var newsLetterClicked = false;
function fnOnClickNewsLetter(){
	if(! newsLetterClicked){
		document.frmNewsLetter.newsLetter.value = "";
		newsLetterClicked = true;
	}
}

function fnDoNewsLetter(sMsg){
	//var reg = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/;
	var eAddress = document.frmNewsLetter.newsLetter.value;
	
	if(echeck(eAddress,sMsg)){
		document.frmNewsLetter.submit();
	}
}

function echeck(str,msg) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(msg)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(msg)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(msg)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(msg)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(msg)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(msg)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(msg)
		    return false
		 }

 		 return true					
	}
