	function check_date(data){
		if (data.length!=10){return false;}
		else {return true;}
	}

	function check_num(data){
		if (parseInt(data, "10")==data){
			return true;
		} else {
			return false;
		}
	}

	function check_form(){
		var f=document.holiday_search_form;
		if (f.type.value=="x"){
			alert("Kérem válasszon kereséshez tipust");
			f.type.focus();
			return false;
		}
		if (!f.time_from.disabled){
			if (!check_date(f.time_from.value)){
				alert("Hibás kezdő dátum");
				f.time_from.focus();
				return false;
			}
			if (!check_date(f.time_to.value)){
				alert("Hibás befejező dátum");
				f.time_to.focus();
				return false;
			}
			if (f.time_from.value>f.time_to.value){
				alert("A befejező dátum a kezdő dátum előtt van");
				f.time_to.focus();
				return false;
			}
		}
		if ((!check_num(f.persons.value))&&(!f.persons.disabled)){
			alert("Hibás a személyek száma");
			f.persons.focus();
			return false;
		}
		if ((!check_num(f.price.value))&&(!f.price.disabled)){
			alert("Hibás ár");
			f.price.focus();
			return false;
		}
		if (f.type.value==14){
			f.start_place_text.value=f.start_place[f.start_place.selectedIndex].text;
			f.end_place_text.value=f.end_place[f.end_place.selectedIndex].text;
		}
	}

	function tip_chg(data){
		var vanmit=false;
		vanmit=false;
		var reg = document.holiday_search_form.region;
		reg.length = 0;
		for (i=0; i<document.holiday_search_form.region_full.length; i++){
			var value=document.holiday_search_form.region_full.options[i].value;
			var text=document.holiday_search_form.region_full.options[i].text;
			if (value.substr(0,value.indexOf("_",0))==data){
				vanmit=true;
				reg.options[reg.length]=new Option(text,value,true,true);
			}
		}
		if (vanmit){
			on_off('holiday_region',true);
			document.holiday_search_form.region.selectedIndex=0;
			document.holiday_search_form.region.focus();
		} else {
			on_off('holiday_region',false);
		}
		vanmit=false;
		var countr = document.holiday_search_form.country;
		countr.length = 0;
		for (i=0; i<document.holiday_search_form.country_full.length; i++){
			var value=document.holiday_search_form.country_full.options[i].value;
			var text=document.holiday_search_form.country_full.options[i].text;
			if (value.substr(0,value.indexOf("_",0))==data){
				vanmit=true;
				countr.options[countr.length]=new Option(text,value,true,true);
			}
		}
		if (vanmit){
			on_off('holiday_country',true);
			document.holiday_search_form.country.selectedIndex=0;
		} else {
			on_off('holiday_country',false);
		}
		vanmit=false;
		var cat = document.holiday_search_form.category;
		cat.length = 0;
		for (i=0; i<document.holiday_search_form.category_full.length; i++){
			var value=document.holiday_search_form.category_full.options[i].value;
			var text=document.holiday_search_form.category_full.options[i].text;
			if (value.substr(0,value.indexOf("_",0))==data){
				vanmit=true;
				cat.options[cat.length]=new Option(text,value,true,true);
			}
		}
		if (vanmit){
			on_off('holiday_category',true);
			document.holiday_search_form.category.selectedIndex=0;
		} else {
			on_off('holiday_category',false);
		}
		if ((data=='x')||(data==2)||(data==4)||(data==5)||(data==6)||(data==8)||(data==9)||(data==11)||(data==12)||(data==14)||(data==15)){
			document.holiday_search_form.price.disabled=true;
			on_off('holiday_price',false);
		} else {
			on_off('holiday_price',true);
			document.holiday_search_form.price.disabled=false;
		}
		if (data==7){
			on_off('holiday_pasp7',true);
			document.holiday_search_form.h_target.disabled=false;
			document.holiday_search_form.h_islands.disabled=false;
			document.holiday_search_form.h_house.disabled=false;
			select_region();
		} else {
			on_off('holiday_pasp7',false);
			document.holiday_search_form.h_target.disabled=true;
			document.holiday_search_form.h_islands.disabled=true;
			document.holiday_search_form.h_house.disabled=true;
		}
		if ((data=='x')||(data==6)||(data==8)||(data==12)||(data==14)||(data==15)){
			on_off('holiday_persons',false);
			document.holiday_search_form.persons.disabled=true;
		} else {
			on_off('holiday_persons',true);
			document.holiday_search_form.persons.disabled=false;
		}
		if (data==8){
			on_off('holiday_word',true);
			document.holiday_search_form.code.disabled=false;
		} else {
			on_off('holiday_word',false);
			document.holiday_search_form.code.disabled=true;
		}
		if ((data=='x')||(data==6)||(data==8)||(data==12)||(data==15)){
			on_off('holiday_time',false);
			document.holiday_search_form.time_from.disabled=true;
			document.holiday_search_form.time_to.disabled=true;
		} else {
			on_off('holiday_time',true);
			document.holiday_search_form.time_from.disabled=false;
			document.holiday_search_form.time_to.disabled=false;
		}
		if (data==14){
			on_off('holiday_hour_minute_start',true);
			on_off('holiday_hour_minute_end',true);
			on_off('holiday_start_place',true);
			on_off('holiday_end_place',true);
			document.holiday_search_form.start_ora.disabled=false;
			document.holiday_search_form.start_perc.disabled=false;
			document.holiday_search_form.end_ora.disabled=false;
			document.holiday_search_form.end_perc.disabled=false;
			document.holiday_search_form.start_place.disabled=false;
			document.holiday_search_form.end_place.disabled=false;
			document.holiday_search_form.start_place_text.disabled=false;
			document.holiday_search_form.end_place_text.disabled=false;
		} else {
			on_off('holiday_hour_minute_start',false);
			on_off('holiday_hour_minute_end',false);
			on_off('holiday_start_place',false);
			on_off('holiday_end_place',false);
			document.holiday_search_form.start_ora.disabled=true;
			document.holiday_search_form.start_perc.disabled=true;
			document.holiday_search_form.end_ora.disabled=true;
			document.holiday_search_form.end_perc.disabled=true;
			document.holiday_search_form.start_place.disabled=true;
			document.holiday_search_form.end_place.disabled=true;
			document.holiday_search_form.start_place_text.disabled=true;
			document.holiday_search_form.end_place_text.disabled=true;
		}
	}//end of function tip_chg

	function next_week(data){
		if (data!=''){
			var d = new Date();
			dstr=data;
			d.setFullYear(dstr.substr(0,4),dstr.substr(5,2)-1,dstr.substr(8,2));
			d.setDate(d.getDate()+7);
			return (d.getUTCFullYear()+'/'+(d.getMonth()<9?'0'+(d.getMonth()+1):(d.getMonth()+1))+'/'+(d.getDate()<10?'0':'')+d.getDate());
		} else {
			return '';
		}
	}

	function mychange_plusdate(ujertek,inputobj){
		inputobj.value=ujertek;
		if (document.holiday_search_form.time_to.value==''){
			document.holiday_search_form.time_to.value=next_week(inputobj.value);
		}
		document.holiday_search_form.type.focus();
	}

	function select_region(){
		var p;
		var m;
		var i;
		p=document.holiday_search_form.region.options[document.holiday_search_form.region.selectedIndex].value.substr(2);
		for (i=0; i<document.holiday_search_form.h_target.options.length; i++){
			m=document.holiday_search_form.h_target.options[i].value;
			if (p==m){
				document.holiday_search_form.h_target.selectedIndex=i;
				return;
			}
		}
	}

	function on_off(data,showed){
		document.getElementById(data).style.display=(showed?'block':'none');
	}

