var xmlHttp
var xmlHttp2


function select_habitas_resultado(tothab){
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }			 
	var url="estaciones.php"
	url=url+"?tothab_resultado="+tothab
	url=url+"&sid="+Math.random()	
	xmlHttp.onreadystatechange=function(){ stateChanged_div('otras_habitas'); };
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)		
}

function select_habitas(tothab){
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
			 
	var url="estaciones.php"
	url=url+"?tothab="+tothab
	url=url+"&sid="+Math.random()	
	xmlHttp.onreadystatechange=function(){ stateChanged_div('otras_habitas'); };
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)		
}


function select_2_habitas(tothab){
xmlHttp2=GetXmlHttpObject()
	if (xmlHttp2==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
			 
	var url="estaciones.php"
	url=url+"?tothab2="+tothab
	url=url+"&sid="+Math.random()	
	xmlHttp2.onreadystatechange=function(){ stateChanged_div2('otras'); };
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)		
}

function stateChanged_div(div){
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){		

        document.getElementById(div).innerHTML=xmlHttp.responseText;

        //Si hi ha javascript a la resposta l'executem
        var searchElement = document.getElementById(div);
        searchElement.innerHTML=xmlHttp.responseText;
        var scripts = searchElement.getElementsByTagName('script');
        for (var i=0;i<scripts.length;i++) {
            eval(scripts[i].innerHTML);
        }
    }
}


function stateChanged_div2(div){
    if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete"){
        document.getElementById(div).innerHTML=xmlHttp2.responseText;

        //Si hi ha javascript a la resposta l'executem
        var searchElement = document.getElementById(div);
        searchElement.innerHTML=xmlHttp2.responseText;
        var scripts = searchElement.getElementsByTagName('script');
        for (var i=0;i<scripts.length;i++) {
            eval(scripts[i].innerHTML);
        }
    }
}

var xmlHttp2

function showEstaciones(str){ 
if(str==1){
location.href='http://nieve.venyviaja.com/Andorra';
}else{

//	if(str!=0){			

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)

 {

 alert ("Browser does not support HTTP Request")

 return

 }





//var url="http://www.venyviaja.com/nieve/estaciones.php"

var url="http://nieve.venyviaja.com/estaciones.php"

url=url+"?zona="+str

url=url+"&sid="+Math.random()

xmlHttp.onreadystatechange=stateChanged 

xmlHttp.open("GET",url,true)

xmlHttp.send(null)

}

//}

}


function showEstaciones22(str){ 
if((str==1)||(str==2)||(str==3)||(str==45)){
location.href='http://nieve.venyviaja.com/Andorra';
}else{

}

}



function showEstaciones2(str,str2){ 		

//	if(str!=0){			

xmlHttp2=GetXmlHttpObject()

if (xmlHttp2==null)

 {

 alert ("Browser does not support HTTP Request")

 return

 }



var url="http://nieve.venyviaja.com/estaciones.php"

url=url+"?zona="+str

url=url+"&sid="+Math.random()+"&paco="+str2

xmlHttp2.onreadystatechange=stateChanged2 

xmlHttp2.open("GET",url,true)

xmlHttp2.send(null)



//}

}





function stateChanged() 

{ 

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

 { 

 document.getElementById("txtHint").innerHTML=xmlHttp.responseText  

  } 

}



function stateChanged2() 

{ 

if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")

 { 

 document.getElementById("txtHint32").innerHTML=xmlHttp2.responseText  

  } 

}



function GetXmlHttpObject()

{

var xmlHttp=null;

try

 {

 // Firefox, Opera 8.0+, Safari

 xmlHttp=new XMLHttpRequest();

 }

catch (e)

 {

 //Internet Explorer

 try

  {

  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

  }

 catch (e)

  {

  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

 }

return xmlHttp;

}


