var last						="none";
var last						="none";
var finishedScriptLoad 			= false;
var comma						=",";
var plus						="+";
var and 						="&";
var equals						="=";
var under						="_";
var global_seas					=0;
var month;
var day;
var year;
var theDate 					= new Date();
var url;
var selectBox					="";

function Checkdatum(dateString,dateType) {
	var now = new Date();
	var today = new Date(now.getFullYear(),now.getMonth(),now.getDate());
	if (dateType == 1) {
		var date = new Date(dateString.substring(0,4),
		dateString.substring(4,6)-1,
		dateString.substring(6,8));
	} else if (dateType == 2) {
		var date = new Date(dateString.substring(0,2),
		dateString.substring(2,4)-1,
		dateString.substring(4,6));
	} else if (dateType == 3) {
		var date = new Date(dateString.substring(6,10),
		dateString.substring(3,5)-1,
		dateString.substring(0,2));
	} else if (dateType == 4) {
		var date = new Date(dateString.substring(6,8),
		dateString.substring(3,5)-1,
		dateString.substring(0,2));
	} else {
		return false;
	}

	if (Date.parse(date) < Date.parse(today)) {
		return false;
	} else {
		return true;
	}
}

function CloseLoading()
{
	processing.close();

}  // CloseLoading

function Zoek()
{
}
function Zoek_hotel()
{
	if(isNaN(document.form.Hotelcode.value) == true){
	show_iframe();
	document.form.action = '/phpscripts/search_engine.php';
//	document.form.action = '/phpscripts/search_hotel/zoek.php';
//	show_loading();
	processing = window.open("/bepages/"+lng_dir_marker+"/loading.htm","processing","top=300,left=450,width=300,height=200,toolbar=0, status=0");
	document.form.submit();
	setTimeout("parent.resizeCaller()",150);
	}else{
	Zoek();
	}
}
function Zoek_auto(what)
{
	//what == 1 == auto
	//what == 2 == dichtbij
		if(what == '1'){
		show_iframe();
		parent.resultaat.document.location.href='/phpscripts/search_auto/index.php';
		}else if(what == '2'){
		show_iframe();
		parent.resultaat.document.location.href='/phpscripts/search_dicht/index.php';
		}else if(what == '3'){
		show_iframe();
		parent.resultaat.document.location.href='/phpscripts/search_city/index.php';
		}else if(what == '4'){
		show_iframe();
		parent.resultaat.document.location.href='/phpscripts/search_sneeuw/index.php';
		}else if(what == 'zoek'){
//			if(deel != 'disney' && location.href.indexOf("bepages") == "-1"){			
			if(location.href.indexOf("bepages") == "-1"){			
				if(document.form.resort.value != ''){
					if(deel == 'disney'){
					var regio_info		= "Disneyland@ResortParis";
					var dest_resort		= "FRA_DNP";
					}else{
					var regio_info		= document.form.dest_resort.options[document.form.dest_resort.options.selectedIndex].text.replace(/\s+/,"");
					var dest_resort		= document.form.dest_resort.value.substr(2,document.form.dest_resort.value.length);
					}
					var DepartDay		= document.form.DepartDay.value;
					var DepartMonth		= document.form.DepartMonth.value;
					var DepartYear		= document.form.DepartYear.value;
				top.location.href	='/'+get_deelURL(deel,lng)+'/resort_'+replace_url(regio_info)+'_'+dest_resort+".htm?"+get_parameters();
				}
			}else{
				show_iframe();
				document.form.action = '/phpscripts/search_engine.php';
				document.form.submit();	
				}
		}else{
			if(parent.resultaat.document.form){
				try{
				parent.resultaat.Searching();	
				}catch(excp){
				show_iframe();
				document.form.action = '/phpscripts/search_engine.php';
				document.form.submit();
				}
			}else{
				show_iframe();
				document.form.action = '/phpscripts/search_engine.php';
				document.form.submit();
			}
		}
		setTimeout("parent.resizeCaller()",150);
}
function Zoek_promo()
{
	try{
		if(document.form.landen){
				show_iframe();
				document.form.action = '/phpscripts/promotions_auto.php';
				document.form.target = 'resultaat';
				document.form.submit();
		}
	}catch(sexp){}
}
function open_search()
{
	height = document.form.img_height.value;
	document.getElementById('table_').style.display='none';
	document.getElementById('table1').style.display='';

	user = document.form.User.value;
	user = user.substr(0,1);
	if(user == 'A')	{
		parent.resultaat.location.href='/phpscripts/search_auto/index.php?ttc=1&lng_S=1&boek=1';
	}
	if(user == 'C')	{
		parent.resultaat.location.href='/phpscripts/search_city/index.php?ttc=1&lng_S=1&boek=1';
	}
	if(user == 'S')	{
		parent.resultaat.location.href='/phpscripts/search_sneeuw/index.php?ttc=1&lng_S=1&boek=1';
	}
	if(user == 'K')	{
		parent.resultaat.location.href='/phpscripts/search_dichtbij/index.php?ttc=1&lng_S=1&boek=1';
	}
}

function selectDate ( day, month, year ) {
	url = "./"+lng_dir_marker+"/datesel.php?form=form&day=" + day + "&month=" + month + "&year=" + year;
	url += '&date=' + document.form.DepartYear.value + document.form.DepartMonth.value + document.form.DepartDay.value;
	window.open( url, "DateSelection","width=250,height=200,resizable=no,scrollbars=no" );
}

function SwitchMap()
{
	var menuNum		=document.form.destination.selectedIndex;
	var place		=document.form.destination.value;
	var region		=document.form.resort.value;
	var resort		=document.form.resort.value;
	var vr			=document.form.vr.value;
	var str1 		= document.form.User.value;
	var user		=str1.substr(0,1);
	var seas		=global_seas;
	if(!parent.document.getElementById('deel')){
	Zoek();
	}

	
	if(vr != '1') {
		if (place!="" || (user == 'C' && region!="")) {
			if (region!="") {
				if(user == 'C' || (user == 'G')) {
				} else {
				}
			} else {
			}
		} else {
			try{
				var User_search = document.form.User.value;
				var Destination_search = document.form.destination.value;
				var Region_search = document.form.resort.value;

				if(search == 'auto') {
				url = "/phpscripts/search_auto/zoek.php?Prijs_max=Prijs_max&Prijs_min=Prijs_min&BRO_I=F&boek=1&var2=XXX&year_1=106&hiddens=18&User_search="+User_search+"&Destination_search=default&Region_search="+Region_search+"&Resort_search=default";
				} else if(search == 'promo') {
				url = '/phpscripts/promo_auto.php?Brochure='+seas+user+'&lng='+lng_dir_marker;
				} else {
				url = "";
				}
				if(parent.resultaat && url != ''){
				parent.resultaat.location.href = url;
				}
			}catch(exp){
			}
		}
	}
	selectBox = '';
}

function CheckEnter(key_code)
{
	if ( key_code == 13 ) {
		Zoek();
	}

}  // CheckEnter

function exclusief()
{
	user = document.form.User.value;
	user = user.substr(0,1);

	if(user == 'A')	{
		parent.resultaat.location.href='/phpscripts/exclusief.php?boek=1';
	}
	if(user == 'C')	{
		parent.resultaat.location.href='/phpscripts/exclusief.php?city=C1&boek=1';
	}
	if(user == 'S')	{
		parent.resultaat.location.href='/phpscripts/exclusief.php?boek=1';
	}
	if(user == 'K')	{
		parent.resultaat.location.href='/phpscripts/exclusief.php?boek=1';
	}
}
function Goback()
{
	top.location.href=("/bepages/"+lng_dir_marker+"/criteria7.php");
}
function wissen()
{
	var sURL = unescape(top.window.location.pathname);
	top.window.location.href = sURL;
}
function aanbod(regio)
{
	parent.vulin.document.form.resort.value = regio;
	parent.vulin.Zoek();
}
function changeDestOrResort(el) //javascript die ervoor zorgt dat er na een onchange een bestemmings tekst of regio tekst verschijnt
{
	var What	 		= el.value.substr(0,1);
	if(What == 'D'){
		var DestOrResort 				= el.value.substr(1);
		document.form.Hotelcode.value	= "";
		document.form.destination.value = DestOrResort;
		document.form.resort.value 		= "";
		SwitchMap();
		if(document.form.region){
			getRegion();
		}
	}else if(What == 'R'){
		var DestOrResort 				= el.value.substr(1).split("_");
		var Dest						= DestOrResort[0];
		var Resort						= DestOrResort[1];
		document.form.Hotelcode.value	= "";
		document.form.destination.value = Dest;
		document.form.resort.value 		= Resort;
		SwitchMap();
		if(document.form.region){
			getRegion();
		}
	}else{
		document.form.destination.value = "";
		document.form.resort.value 		= "";
		if(location.href.indexOf('search_') == '-1'){
		hide_iframe();
		}
	}
}
function hide_select(what)
{
	if(what == '1'){
		display = 'none';
	}else{
		display = '';
	}

	document.form.Pax.style.display 	= display;
	document.form.Child.style.display 	= display;
	document.form.landen.style.display 	= display;
	if(document.form.var2){
	document.form.var2.style.display 	= display;
	document.form.var3.style.display 	= display;
	document.form.var4.style.display 	= display;
	}
}
