function ch_travel_type(id){
	travel_type=document.search.travel_type.value;
	destination=document.search.destination;
	var destination_sel=(id)?id:destination.options[destination.selectedIndex].value;
	destination.options.length = 1;
	if(travel_type=='rest'){
		for(i=0;i<rest_countrys.length;i++){
			destination.options[i+1] = new Option(rest_countrys[i],rest_countrys_codes[i]);
		}
	}
	if(travel_type=='know'){
		for(i=0;i<know_countrys.length;i++){
			destination.options[i+1] = new Option(know_countrys[i],know_countrys_codes[i]);
		}
	}
	if(travel_type=='rest_know'){
		for(i=0;i<rest_know_countrys.length;i++){
			destination.options[i+1] = new Option(rest_know_countrys[i],rest_know_countrys_codes[i]);
		}
	}
	if(travel_type=='far'){
		for(i=0;i<far_countrys.length;i++){
			destination.options[i+1] = new Option(far_countrys[i],far_countrys_codes[i]);
		}
	}
	for(i=0;i<destination.options.length;i++){
		if(destination.options[i].value==destination_sel)destination.options[i].selected=true;
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function show(ob){
	o=document.getElementById(ob);
	o.style.display="block";
}
function hide(ob){
	o=document.getElementById(ob);
	o.style.display="none";
}

function getPage(thePage,wt,ht){ 
if(wt=="")wt=300;
if(ht=="")wt=300;
leftPos= (screen.width-wt)/2 
topPos = (screen.height-ht)/2
rnd = Math.round(1000*Math.random());
newWin1 = window.open(thePage,'popup'+rnd,'toolbars=no,resizable=yes,scrollbars=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

function getMap(thePage,wt,ht){ 
if(wt=="")wt=300;
if(ht=="")wt=300;
leftPos= (screen.width-wt)/2 
topPos = (screen.height-ht)/2
rnd = Math.round(1000*Math.random());
newWin1 = window.open(thePage,'popup'+rnd,'toolbars=no,resizable=yes,scrollbars=no,status=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

function popImg(thePage,wt,ht){ 
if(!wt)wt=300;
if(!ht)ht=300;
//leftPos= (screen.width-wt)/2 
//topPos = (screen.height-ht)/2 
leftPos=100;
topPos =100;
newWin1 = window.open("view_image.php?src="+thePage,'aWin2','toolbars=no,resizable=yes,scrollbars=no,status=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

// prevents IE from flickering background images
try {  document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

function doPrint(id) {
	newwindow2=window.open('','printWindow','height=500,width=700,resizable=yes,scrollbars=yes');
	var tmp = newwindow2.document;
	tmp.write('<html><head><title>Printeaza</title>');
	tmp.write('<link rel="stylesheet" href="css/style.css">');
	tmp.write('</head><body onload="window.focus();window.print();window.close();">');
	tmp.write('<table bgcolor="#FFFFFF"><tr><td width="725" align="left" valign="top" class="lent_content">');
	tmp.write(document.getElementById(id).innerHTML);
	tmp.write('</td></tr></table></body></html>');
	tmp.close();
}

function doPrintTravel(id) {
	newwindow2=window.open('','printWindow','height=500,width=700,resizable=yes,scrollbars=yes');
	var tmp = newwindow2.document;
	tmp.write('<html><head><title>Printeaza</title>');
	tmp.write('<link rel="stylesheet" href="css/top.css">');
	tmp.write('<link rel="stylesheet" href="css/inner.css">');
	tmp.write('</head><body onload="window.focus();window.print();window.close();">');
	tmp.write('<table bgcolor="#FFFFFF"><tr><td width="725" align="left" valign="top" class="lent_content">');
	tmp.write(document.getElementById(id).innerHTML);
	tmp.write('</td></tr></table></body></html>');
	tmp.close();
}


function chDate(){
	date_f=document.search.date_f.value;
	date_t=document.search.date_t.value;
	if(date_t=="" || date_t.replace(/-/g, "")<date_f.replace(/-/g, "")){
		document.search.date_t.value=document.search.date_f.value;
	}
}

var home;
var search;
function show(ob)
{	
	o=document.getElementById(ob);
	o.style.display="block";
	
	// START FIX IE6 bug
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1 && search){
		if(document.getElementById('nav_destination').style.display=="block" 
		){
			hidden(document.getElementById('travel_type'));
		}
		if(document.getElementById('nav_know').style.display=="block" 
			|| document.getElementById('nav_far').style.display=="block"
		){
			hidden(document.getElementById('travel_type'));
			hidden(document.getElementById('destination'));
		}
		if(document.getElementById('nav_info').style.display=="block" 
		){
			hidden(document.getElementById('child3'));
		}
	}
	// END FIX IE6 bug

}
function hide(ob){
	o=document.getElementById(ob);
	o.style.display="none";

	// START FIX IE6 bug
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1 && search){
		if(
			 document.getElementById('nav_destination').style.display=="none" 
			&& document.getElementById('nav_know').style.display=="none" 
			&& document.getElementById('nav_far').style.display=="none"){
			visible(document.getElementById('travel_type'));
			visible(document.getElementById('destination'));
		}
		if(
			 document.getElementById('nav_destination').style.display=="none" 
			&& document.getElementById('nav_know').style.display=="none" 
			&& document.getElementById('nav_far').style.display=="none"){
			visible(document.getElementById('travel_type'));
			visible(document.getElementById('destination'));
		}
		if(document.getElementById('nav_info').style.display=="none" 
		){
			visible(document.getElementById('child3'));
		}
	}
	// END FIX IE6 bug

}


function show2(ob)
{	
	o=document.getElementById(ob);
	if(o)	o.style.display="block";
	
	// START FIX IE6 bug
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1 && !home){
		if(document.getElementById('nav_theme').style.display=="block" || document.getElementById('nav_destination').style.display=="block")
			hidden(document.getElementById('travel_type'));
		if(document.getElementById('nav_theme').style.display=="block")
			hidden(document.getElementById('destination'));
		if(document.getElementById('nav_block_1').style.display=="block"){
			hidden(document.getElementById('child1'));
			hidden(document.getElementById('child2'));
			hidden(document.getElementById('child3'));
		}
	}
	// END FIX IE6 bug

}
function hide2(ob){
	o=document.getElementById(ob);
	if(o)	o.style.display="none";

	// START FIX IE6 bug
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1 && !home){
		if(document.getElementById('nav_theme').style.display=="none" && document.getElementById('nav_destination').style.display=="none")
			visible(document.getElementById('travel_type'));
		if(document.getElementById('nav_theme').style.display=="none")
			visible(document.getElementById('destination'));
		if(document.getElementById('nav_block_1').style.display=="none"){
			visible(document.getElementById('child1'));
			visible(document.getElementById('child2'));
			visible(document.getElementById('child3'));
		}
	}
	// END FIX IE6 bug

}

function hidden(f){
	if(f){
		f.style.visibility = 'hidden';
	}
}
function visible(f){
	if(f){
		f.style.visibility = 'visible';
	}
}

function offersOption(o){
	if(!home) return
	var offers=document.getElementById('offers');
	if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){				
		if(o=='disable'){
			offers.style.zIndex=-1;
		}else{
			offers.style.zIndex=0;
		}
	}
}

//AjaxReq("/xml/recommendOffers.php?group="+group,'RecommendOffersCallback(xmlHttp)');
function AjaxReq(url,callback)
{
	var xmlHttp;
	xmlHttp = false;
  // branch for native XMLHttpRequest object
	if(window.XMLHttpRequest && !(window.ActiveXObject)) {
		try {
			xmlHttp = new XMLHttpRequest();
		} catch(e) {
			xmlHttp = false;
		}
	// branch for IE/Windows ActiveX version
	} else if(window.ActiveXObject) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xmlHttp = false;
			}
		}
	}
	if(xmlHttp) {
		xmlHttp.onreadystatechange = function() { eval(callback); }
		//prenumerataCallback(xmlHttp);
		xmlHttp.open("GET", url, true);
		xmlHttp.send("");
	}
}

function handler_submit_button(value)
{
	if (document.getElementById("reg_form_accept").checked == true)
	{
		document.getElementById("reg_on").style.display = 'block';
		document.getElementById("reg_off").style.display = 'none';
	}
	else
	{
		document.getElementById("reg_off").style.display = 'block';
		document.getElementById("reg_on").style.display = 'none';
	}
}
