var server;
server = 'http://www.litoralnorte.com.br/maresias/';

function hospin(valor,tipo){

if (valor=='zera'){
	if(confirm('Deseja limpa a lista de hospedagens?') == true){
		barra_hospedagens_zera();
		if (tipo == 1) {
			loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor,1);
		}else{
			loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor);
		}
	}
}else if (valor=='todos'){
	barra_hospedagens();
	if (tipo == 1) {
		loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor,1);
	}else{
		loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor);
	}
}else{	
	if (tipo == 1) {
		barra_hospedagens(1);
		loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor,1);
		if (window.parent.document.getElementById('pousada_'+valor) !=null){
			window.parent.document.getElementById('pousada_'+valor).setAttribute("style", "background-color:#FDF7A2;border: 1px solid #FF6600");
		}
	}else{
		barra_hospedagens();
		loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codin='+valor);
		if (window.parent.maresias.document.getElementById('pousada_'+valor) !=null){
			window.parent.maresias.document.getElementById('pousada_'+valor).setAttribute("style", "background-color:#FDF7A2;border: 1px solid #FF6600");
		}
	}

}

}

function hospout(valor,tipo){
if (tipo == 1){
	barra_hospedagens(1);
	loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codout='+valor,1);
	//alert (document.getElementById('pousada_'+valor));
	if (window.parent.document.getElementById('pousada_'+valor) != null){
		window.parent.document.getElementById('pousada_'+valor).setAttribute("style", "background-color:#E6E7FF;border: 1px solid #E6E7FF");
	}
}else{
	barra_hospedagens();
	loadXMLBarraHosp(server + 'configs/include/barra_hospedagem.asp?codout='+valor);
	//alert (document.getElementById('pousada_'+valor));
	if (window.parent.maresias.document.getElementById('pousada_'+valor) != null){
		window.parent.maresias.document.getElementById('pousada_'+valor).setAttribute("style", "background-color:#E6E7FF;border: 1px solid #E6E7FF");
	}

}	
}

function barra_hospedagens(tipo){
if (tipo == 1){
window.parent.document.getElementById('div_barra_hospedagens').style.display='block';
window.parent.document.getElementById("div_faixaSeguranca").setAttribute("class", "faixaSeguranca2");
}else{
window.parent.maresias.document.getElementById('div_barra_hospedagens').style.display='block';
window.parent.maresias.document.getElementById("div_faixaSeguranca").setAttribute("class", "faixaSeguranca2");
}

}

function barra_hospedagens_zera(){
limpar_chek()
window.parent.maresias.document.getElementById('div_barra_hospedagens').style.display='none';
window.parent.maresias.document.getElementById("div_faixaSeguranca").setAttribute("class", "faixaSeguranca");
}

function on_bot_mail(){

document.getElementById('envia_email').src= server + 'images/barra_hospedagem/enviar_email2.png';
}

function out_bot_mail(){

document.getElementById('envia_email').src= server + 'images/barra_hospedagem/enviar_email.png';
}

function email(valor,tipo){

if (tipo == null) {

	if (window.parent.maresias.document.formulario['email_'+valor] != null){
		if (window.parent.maresias.document.formulario['email_'+valor].disabled == false){
	
		if (window.parent.maresias.document.formulario['email_'+valor].checked == false){
			window.parent.maresias.document.formulario['email_'+valor].checked = true;
			hospin(valor);
		}else{
			window.parent.maresias.document.formulario['email_'+valor].checked = false;
			hospout(valor);
		}
		}
	}else{
		if (tipo == 1) {
		hospin(valor);
		}else{
		hospout(valor);
		}
	}
}else{
	if (window.parent.document.formulario['email_'+valor] != null){
		if (window.parent.document.formulario['email_'+valor].disabled == false){
	
		if (window.parent.document.formulario['email_'+valor].checked == false){
			window.parent.document.formulario['email_'+valor].checked = true;
			hospin(valor,1);
		}else{
			window.parent.document.formulario['email_'+valor].checked = false;
			hospout(valor,1);
		}
		}
	}else{
		if (tipo == 1) {
		hospin(valor,1);
		}else{
		hospout(valor,1);
		}
	}
	
}


}

function email_chec(valor){
if (document.formulario['email_'+valor].checked == false){
	hospout(valor);
}else{
	hospin(valor);
}}

function limpar_chek() {

    var formInputs = document.getElementsByTagName('input');
    for (var i = 0; i < formInputs.length; i++) {
        var theInput = formInputs[i];
        if (theInput.type == 'checkbox') {
        	theInput.disabled = false; 
            theInput.checked = false; 
            hospout(theInput.alt);
        }
    }
   
}

function todos_chek2() {
	hospin('todos');
}	

function todos_chek() {
	

    var formInputs = document.getElementsByTagName('input');

    for (var i = 1; i < formInputs.length; i++) {        
        var theInput = formInputs[i];
        if (theInput.type == 'checkbox') {
        	theInput.disabled = true; 
            theInput.checked = true; 
            hospin(theInput.alt);
        }
    }
 hospin('todos');
}

function MOSTRA_DESCRI(){
if (document.getElementById('descricao_local').style.display=='none'){
document.getElementById('descricao_local').style.display='block';
}else{
document.getElementById('descricao_local').style.display='none';
}
}
