function GetXmlHttpObject()
{ 
	var objXMLHttp1=null

	if (window.XMLHttpRequest)
	{
		objXMLHttp1=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp1=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp1
}

function exibepg(pg,cor,destino,id,gb)
{	
	xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?cor="+cor+"&destino="+destino+"&id="+id+"&gb="+gb+"&rand="+new Date().getTime()+Math.random();
	//alert (url);
	xmlHttp1.onreadystatechange=stateChanged
	xmlHttp1.open("GET",url,true)
	xmlHttp1.send(null)
}

function stateChanged() 
{ 
	
    if (xmlHttp1.readyState == 4) 
	{
      
        	if (xmlHttp1.status == 200) 
			{
              	document.getElementById('ajdiv').innerHTML = xmlHttp1.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1.statusText);
       		}
    }
	else
	{
		//document.getElementById('ajdiv').innerHTML='<p align="center"><br><br><img src="js/carregador.gif"></p>';
	}		
}

function exiberot(pg,id)
{	
	xmlHttp1r=GetXmlHttpObject()
	if (xmlHttp1r==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?id="+id+"&rand="+new Date().getTime()+Math.random();
	//alert (url);
	xmlHttp1r.onreadystatechange=stateChangedr
	xmlHttp1r.open("GET",url,true)
	xmlHttp1r.send(null)
}

function stateChangedr() 
{ 
	
    if (xmlHttp1r.readyState == 4) 
	{
      
        	if (xmlHttp1r.status == 200) 
			{
              	document.getElementById('rot').innerHTML = xmlHttp1r.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1r.statusText);
       		}
    }
	else
	{
//		document.getElementById('ajdiv').innerHTML='<p align="center"><br><br><img src="js/carregador.gif"></p>';
	}		
}


function exibedestino(pg,vl)
{	
	xmlHttp1rd=GetXmlHttpObject()
	if (xmlHttp1rd==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?vl="+vl+"&rand="+new Date().getTime()+Math.random();
	//alert (url);
	xmlHttp1rd.onreadystatechange=stateChangedrd
	xmlHttp1rd.open("GET",url,true)
	xmlHttp1rd.send(null)
}

function stateChangedrd() 
{ 
	
    if (xmlHttp1rd.readyState == 4) 
	{
      
        	if (xmlHttp1rd.status == 200) 
			{
              	document.getElementById('destino').innerHTML = xmlHttp1rd.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1rd.statusText);
       		}
    }
	else
	{
		document.getElementById('ajdiv').innerHTML='<p align="center"><br><br><img src="js/carregador.gif"></p>';
	}		
}

function exibecompanhia(pg,vl,dest)
{	
	xmlHttp1rdc=GetXmlHttpObject()
	if (xmlHttp1rdc==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?vl="+vl+"&dest="+dest+"&rand="+new Date().getTime()+Math.random();
	//alert (url); 
	xmlHttp1rdc.onreadystatechange=stateChangedrdc
	xmlHttp1rdc.open("GET",url,true)
	xmlHttp1rdc.send(null)
}

function stateChangedrdc() 
{ 
	
    if (xmlHttp1rdc.readyState == 4) 
	{
      
        	if (xmlHttp1rdc.status == 200) 
			{
              	document.getElementById('companhia').innerHTML = xmlHttp1rdc.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1rdc.statusText);
       		}
    }
	else
	{
		document.getElementById('ajdiv').innerHTML='<p align="center"><br><br><img src="js/carregador.gif"></p>';
	}		
}


function Atualizahoteis(estado)

{	
	xmlHttp1a=GetXmlHttpObject()
	if (xmlHttp1a==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 

	var url='atualiza.php?rand='+new Date().getTime()+'&estado='+estado+'&'+Math.random();
	//alert (url);  
	xmlHttp1a.onreadystatechange=stateChangeda
	xmlHttp1a.open("GET",url,true)
	xmlHttp1a.send(null)
}



function stateChangeda() 
{ 
    if (xmlHttp1a.readyState == 4) 
	{
        	if (xmlHttp1a.status == 200) 
			{
					document.getElementById('atualiza').innerHTML = xmlHttp1a.responseText;
			}
    }
}

function ajaxestado(destino,estado)

{	
	xmlHttp1aes=GetXmlHttpObject()
	if (xmlHttp1aes==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 

	var url='ajax_estado.php?destino='+destino+'&estado='+estado+'&'+Math.random()+'&rand='+new Date().getTime();
	//alert (url);  
	xmlHttp1aes.onreadystatechange=stateChangedaes
	xmlHttp1aes.open("GET",url,true)
	xmlHttp1aes.send(null)
}



function stateChangedaes() 
{ 
    if (xmlHttp1aes.readyState == 4) 
	{
        	if (xmlHttp1aes.status == 200) 
			{
					document.getElementById('atualizaestado').innerHTML = xmlHttp1aes.responseText;
			}
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1aes.statusText);
       		}
    }
	else
	{
		document.getElementById('atualizaestado').innerHTML='<p align="center"><img src="js/ajax-loader.gif"></p>';
	}	
}

function exibebsc(pg,destino,destinonavio,companhia)
{	
	xmlHttp1bsc=GetXmlHttpObject()
	if (xmlHttp1bsc==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?destino="+destino+"&destinonavio="+destinonavio+"&companhia="+companhia+"&rand="+new Date().getTime()+Math.random();
	//alert (url); 
	
	xmlHttp1bsc.onreadystatechange=stateChangedbsc
	xmlHttp1bsc.open("GET",url,true)
	
	xmlHttp1bsc.send(null)
}

function stateChangedbsc() 
{ 
    if (xmlHttp1bsc.readyState == 4) 
	{
        	if (xmlHttp1bsc.status == 200) 
			{
              	
				document.getElementById('ajbscc').innerHTML = "";
				//document.getElementById('ajnavio').innerHTML = "";
				//document.getElementById('ajbscc').style.display="none";
				//document.getElementById('ajnavio').style.display="none";
				document.getElementById('ajbsc').innerHTML = xmlHttp1bsc.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1bsc.statusText);
       		}
    }
	else
	{
		document.getElementById('ajbsc').innerHTML='<img src="js/ajax-loader.gif">';
	}		
}

function exibecomp(pg,destino,destinonavio,companhia,navio) 
{	
	xmlHttp1bscc=GetXmlHttpObject()
	if (xmlHttp1bscc==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?destino="+destino+"&destinonavio="+destinonavio+"&companhia="+companhia+"&naviobsc="+navio+"&rand="+new Date().getTime()+Math.random();
	//alert (url); 
	xmlHttp1bscc.onreadystatechange=stateChangedbscc
	xmlHttp1bscc.open("GET",url,true)
	xmlHttp1bscc.send(null)
}

function stateChangedbscc() 
{ 
    if (xmlHttp1bscc.readyState == 4) 
	{
        	if (xmlHttp1bscc.status == 200) 
			{
				document.getElementById('ajbscc').style.display="block";
				document.getElementById('ajbscc').innerHTML = xmlHttp1bscc.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1bscc.statusText);
       		}
    }
	else
	{
		document.getElementById('ajbscc').innerHTML='<img src="js/ajax-loader.gif">';
	}		
}
function exibenavio(pg,destino,destinonavio,companhia,navio)
{	
	xmlHttp1nav=GetXmlHttpObject()
	if (xmlHttp1nav==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?destino="+destino+"&destinonavio="+destinonavio+"&companhia="+companhia+"&naviobsc="+navio+"&rand="+new Date().getTime()+Math.random();
	//alert (url);
	xmlHttp1nav.onreadystatechange=stateChangednav
	xmlHttp1nav.open("GET",url,true)
	xmlHttp1nav.send(null)
}

function stateChangednav() 
{ 
    if (xmlHttp1nav.readyState == 4) 
	{
        	if (xmlHttp1nav.status == 200) 
			{
				document.getElementById('ajnavio').style.display="block";
				document.getElementById('ajnavio').innerHTML = xmlHttp1nav.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1nav.statusText);
       		}
    }
	else
	{
		document.getElementById('ajnavio').innerHTML='<img src="js/ajax-loader.gif">';
	}		
}


function ajaxestado2(tipo,localizacao,estado)

{	
	xmlHttp1aes2=GetXmlHttpObject()
	if (xmlHttp1aes2==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 

	var url='ajax_estado2.php?tipo='+tipo+'&localizacao='+localizacao+'&estado='+estado+'&'+Math.random()+'&rand='+new Date().getTime();
	//alert (url);  
	xmlHttp1aes2.onreadystatechange=stateChangedaes2
	xmlHttp1aes2.open("GET",url,true)
	xmlHttp1aes2.send(null)
}



function stateChangedaes2() 
{ 
    if (xmlHttp1aes2.readyState == 4) 
	{
        	if (xmlHttp1aes2.status == 200) 
			{
					document.getElementById('atualizaestado2').innerHTML = xmlHttp1aes2.responseText;
			}
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1aes2.statusText);
       		}
    }
	else
	{
		document.getElementById('atualizaestado2').innerHTML='<p align="center"><img src="js/ajax-loader.gif"></p>';
	}	
}

function ajaxcidade(tipo,localizacao, estado, cidade)

{	
	xmlHttp1aes2c=GetXmlHttpObject()
	if (xmlHttp1aes2c==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 

	var url='ajax_cidade.php?tipo='+tipo+'&localizacao='+localizacao+'&estado='+estado+'&cidade='+cidade+'&'+Math.random()+'&rand='+new Date().getTime();
	//alert (url);  
	xmlHttp1aes2c.onreadystatechange=stateChangedaes2c
	xmlHttp1aes2c.open("GET",url,true)
	xmlHttp1aes2c.send(null)
}



function stateChangedaes2c() 
{ 
    if (xmlHttp1aes2c.readyState == 4) 
	{
        	if (xmlHttp1aes2c.status == 200) 
			{
					document.getElementById('atualizacidade').innerHTML = xmlHttp1aes2c.responseText;
			}
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1aes2c.statusText);
       		}
    }
	else
	{
		document.getElementById('atualizacidade').innerHTML='<p align="center"><img src="js/ajax-loader.gif"></p>';
	}	
}

function exibeIniBusca(pg,oqp)
{	
	if(oqp=='C')
	{
		document.getElementById('formbsc').action="index_viagens.php?pg=cruzeiros";	
	}
	if(oqp=='S')
	{
		document.getElementById('formbsc').action="index.php?pg=spa&tipo=1";	 
	}
	if(oqp=='R')
	{
		document.getElementById('formbsc').action="index.php?pg=resort&destino=3";	
	}
	if(oqp=='H')
	{
		document.getElementById('formbsc').action="index.php?pg=resort&destino=3";	
	}	
	if(oqp=='P')
	{
		document.getElementById('formbsc').action="index.php?pg=resort&destino=3";	
	}
	xmlHttp1ib=GetXmlHttpObject()
	if (xmlHttp1ib==null)
	{
		alert ("Sem suporte a HTTP Request")
		return
	} 
	var url=pg+"?oqp="+oqp+"&rand="+new Date().getTime()+Math.random();
	//alert (url);
	xmlHttp1ib.onreadystatechange=stateChangedib
	xmlHttp1ib.open("GET",url,true)
	xmlHttp1ib.send(null)
}

function stateChangedib() 
{ 
	
    if (xmlHttp1ib.readyState == 4) 
	{
      
        	if (xmlHttp1ib.status == 200) 
			{
              	document.getElementById('div_ini_busca').innerHTML = xmlHttp1ib.responseText;
			}
			
			else 
			{
            	alert("Houve um problema ao obter os dados:\n" + xmlHttp1ib.statusText);
       		}
    }
	else
	{
		//document.getElementById('ajdiv').innerHTML='<p align="center"><br><br><img src="js/carregador.gif"></p>';
	}		
}





