// GERA SWF
function GerarSWF($arquivo,$largura,$altura,$id,$flashvar1){
	document.writeln('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ $largura +'" height="'+ $altura +'" id="'+ $id +'" name="'+ $id +'">');
	document.writeln('	<param name="movie" value="' + $arquivo + '"/>');
	document.writeln('	<param name="FlashVars" value="flashvar1='+ $flashvar1 +'"/>');
	document.writeln('	<param name="AllowScriptAccess" value="always" />');
	document.writeln('	<param name="menu" value="false" />');
	document.writeln('	<param name="quality" value="high" />');
	document.writeln('	<param name="scale" value="showall" />');	
	document.writeln('	<param name="wmode" value="transparent" />');
	document.writeln('	<embed id="globalnav-embed" src="' + $arquivo + '" FlashVars="flashvar1='+ $flashvar1 +'" AllowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" scale="showall" menu="false" quality="high" id="home" width="'+ $largura +'" height="'+ $altura +'"></embed>');
	document.writeln('</object>');
	//alert($arquivo)	
}

function GerarSWF_clickTAG($arquivo,$largura,$altura,$id,$upload){
document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ $largura +'" height="'+ $altura +'" id="'+ $id +'" align="middle">')
document.writeln('	<param name="allowScriptAccess" value="sameDomain" />')
document.writeln('	<param name="movie" value="' + $arquivo + '" />')
document.writeln('	<param name="movie" value="' + $upload + '" />')
document.writeln('	<param name="quality" value="best" />')
document.writeln('	<param name="wmode" value="transparent" />')
document.writeln('	<param name="bgcolor" value="#ffffff" />')
document.writeln('	<embed src="' + $arquivo + '" quality="best" wmode="transparent" bgcolor="#ffffff" width="'+ $largura +'" height="'+ $altura +'" name="'+ $id +'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
document.writeln('</object>')
}


//HOTEL & RESORTS
function ender_site(str_site){
codigo = document.login.codigo_hotel.value
	document.login.action = str_site +"&codigo_hotel="+ codigo
}
function envio(){
	if(document.login.username.value == ""){
			alert('Digite o seu login.');
			document.login.username.focus();
			return false;
		}
	else if(document.login.senha.value == ""){
 
			alert('Digite a sua senha.');
			document.login.senha.focus();
			return false;
		}
	else
	 if((document.login.tipo_login[0].checked == false)&&(document.login.tipo_login[1].checked == false)&&(document.login.tipo_login[2].checked == false)){
		alert('Escolha abaixo o tipo de cliente que você é, clicando em: agência, empresa ou particular.');
		document.login.tipo_login[0].focus();
		return false;
	}
	else{
	
		return true;
	}
 
}
 
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('Preencha todos os campos');
  document.MM_returnValue = (errors == '');
}
//-->
 
 
function redeHotel () {
	 
	  var idHotel 	= document.forms['reservas'].mandar_h.value; 
	  var dia 		= document.forms['reservas'].dia.value; 
	  var mes 		= document.forms['reservas'].mes.value;
	  var ano		= document.forms['reservas'].ano.value;
	  var dia_saida = document.forms['reservas'].dia_saida.value;
	  var mes_saida = document.forms['reservas'].mes_saida.value;
	  var ano_saida = document.forms['reservas'].ano_saida.value;
	  var adultos 	= document.forms['reservas'].adultos.value;
	  var rooms 	= document.forms['reservas'].criancas.value;
	 
	  
//VALIDACAO DO FORM
	if (idHotel == '') {	
		alert('Selecione um hotel');
		document.forms['reservas'].mandar_h.focus();
		return false;	
		}
		
		
	if (dia == '') {			
		alert('Informe o dia de chegada');
		document.forms['reservas'].dia.focus();
		return false;	
		}
		
	if (mes == '') {	
		alert('Informe o mes de chegada');
		document.forms['reservas'].mes.focus();
		return false;	
		}
 
	if (ano == '') {	
		alert('Informe o ano de chegada');
		document.forms['reservas'].ano.focus();
		return false;	
		}
		
	if (dia_saida == '') {	
		alert('Informe o dia de partida');
		document.forms['reservas'].dia_saida.focus();
		return false;	
		}
		
	if (mes_saida == '') {	
		alert('Informe o mês de partida');
		document.forms['reservas'].mes_saida.focus();
		return false;	
		}
		
	if (ano_saida == '') {	
		alert('Informe o ano de partida');
		document.forms['reservas'].ano_saida.focus();
		return false;	
		}
		
	if (adultos == '') {	
		alert('Informe a quantidade de adultos');
		document.forms['reservas'].adultos.focus();
		return false;	
		}
		
	if (rooms == '') {	
		romms = 1
		}
	  
	  
//INICIO DA CONULTA DA REDE DE HOTEIS
	  document.forms['formRedeHotel'].InDateDay.value =  dia;
      document.forms['formRedeHotel'].inDateMonth.value = mes;
      document.forms['formRedeHotel'].InDateYear.value = ano;
      document.forms['formRedeHotel'].OutDateDay.value = dia_saida;
      document.forms['formRedeHotel'].OutDateMonth.value = mes_saida;
      document.forms['formRedeHotel'].OutDateYear.value = ano_saida;
      document.forms['formRedeHotel'].NumAdults.value = adultos;
      document.forms['formRedeHotel'].NumRooms.value = rooms;

alert(idHotel)

//Iate Plaza Hotel
	if (idHotel == '000010798') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;61483';
		document.forms['formRedeHotel'].action = 'http://www.iateplazahotel.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
//Tullip Saint Martin		
	if (idHotel == '000014446') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;061667';
		document.forms['formRedeHotel'].action = 'http://www.saintmartinhotel.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
			
//Golden Tulip Interatlantico
	if (idHotel == '000014450') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;061679';
		document.forms['formRedeHotel'].action = 'http://www.interatlantico.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
//Tulip Inn Potengi
	if (idHotel == '000014451') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;61501';
		document.forms['formRedeHotel'].action = 'http://www.potengiflat.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
//Tulip Inn Batel
	if (idHotel == '000044916') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044916';
		document.forms['formRedeHotel'].action = 'http://www.tulipinnbatel.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
//Tulip Inn Campo Largo
	if (idHotel == '000044919') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044919';
		document.forms['formRedeHotel'].action = 'http://www.tulipinncampolargo.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
//Tulip Inn Santa Felicidade
	if (idHotel == '000044918') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044918';
		document.forms['formRedeHotel'].action = 'http://www.tulipinnsantafelicidade.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
//Tulip Inn São José dos Pinhais
	if (idHotel == '000044917') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044917';
		document.forms['formRedeHotel'].action = 'http://www.tulipinnsaojosedospinhais.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
//PEGAR O PROPCODE REAL ---- SITE NAO TEM O SITEMA DA REDE
// Golden Tulip Golden Beach 
//	if (idHotel == '000014440') {	
		//document.forms['formRedeHotel'].Propcode.value = 'GT;044917';
		//document.forms['formRedeHotel'].action = 'http://www.goldenbeach-pe.com.br/goldres/pt/RatePlan.asp'
		//document.forms['reservas'].submit(); 		
	//	}
 
// Tulip Inn Recife
	if (idHotel == '000014447') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;61500';
		document.forms['formRedeHotel'].action = 'http://www.recifeflat.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
// Golden Tulip Regente
	if (idHotel == '000015396') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044703';
		document.forms['formRedeHotel'].action = 'http://www.goldentulipregente.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 	  
 
// Golden Tulip Continental
	if (idHotel == '000015397') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044705';
		document.forms['formRedeHotel'].action = 'http://www.goldentulipcontinental.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 		
 
//Tulip Inn Copacabana
	if (idHotel == '000015398') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044704';
		document.forms['formRedeHotel'].action = 'http://www.tulipinncopacabana.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}		
 
//Golden Tulip Paulista Plaza
	if (idHotel == '000014437') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;28267';
		document.forms['formRedeHotel'].action = 'http://www.paulistaplaza.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
 
//Golden Tulip Belas Artes
	if (idHotel == '000010099') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;044763';
		document.forms['formRedeHotel'].action = 'http://www.goldentulipbelasartes.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
//Golden Tulip Park Plaza
	if (idHotel == '000014436') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;60894';
		document.forms['formRedeHotel'].action = 'http://www.parkplaza.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
		
	
//Tulip Inn Interative
	if (idHotel == '000014442') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;61485';
		document.forms['formRedeHotel'].action = 'http://www.interativeflat.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
 
 
// Tulip Inn Paulista Convention
	if (idHotel == '000014443') {	
		document.forms['formRedeHotel'].Propcode.value = 'GT;61484';
		document.forms['formRedeHotel'].action = 'http://www.paulistaconventionflat.com.br/goldres/pt/RatePlan.asp'
		document.forms['formRedeHotel'].submit(); 		
		}
	
	
// SUBMETER FORM PARA HOTEIS QUE NAO SAO DA REDE	
 	if	((idHotel == "000014449")  || (idHotel == "000014444")  || (idHotel == "000014445")  || (idHotel == "000014441") || (idHotel == "000014510") || (idHotel == "000014440")) {
		document.forms['reservas'].submit(); 	
	}
	
	}


function mandar(){
	//tomo el valor del select del pais elegido
	//var pais
	//pais = openner.formulario.id_subcanais[document.formulario.id_subcanais.selectedIndex].value
	pais = document.getElementById('mandar_h')[document.getElementById('mandar_h').selectedIndex].value
	if ((pais == "000014449")  || (pais == "000014444")  || (pais == "000014445")  || (pais == "000014441")  || (pais == "000014510")  || (pais == "000014440")){
		document.login.codigo_hotel.value = pais;
		document.reservas.codigo_hotel.value = pais;
		document.getElementById("cliente_cadastrado").style.display='block'
		document.getElementById("pessoas").style.display='none'
		document.getElementById("rooms").style.display='none'
		document.getElementById("adultos").style.display='block'
		document.getElementById("criancas").style.display='block'
	
	}else{
	document.login.codigo_hotel.value ='';
	document.reservas.codigo_hotel.value ='';
	document.getElementById("cliente_cadastrado").style.display='none'
	document.getElementById("pessoas").style.display='block'
	document.getElementById("rooms").style.display='block'
	document.getElementById("adultos").style.display='none'
	document.getElementById("criancas").style.display='none'
	}
	
}



///Form de hot site de hotel
function Valida_HotSitesHotel(){
	if(valSelect('selGrupoHotel','','um hotel!')==false) return false;
}


