// DATA - ÍNICIO
function data(){

	mdata      = new Date()
	mhora      = mdata.getHours()
	mminuto    = mdata.getMinutes()
	msegundos  = mdata.getSeconds()
	mdia       = mdata.getDate()
	mdiasemana = mdata.getDay()
	mmes       = mdata.getMonth()
	mano       = mdata.getFullYear()

if(mdiasemana == 0)
	document.write("'Domingo, ");
		else if(mdiasemana == 1)
			document.write("Segunda Feira, ");
		else if(mdiasemana == 2)
			document.write("Ter&ccedil;a Feira, ");
		else if(mdiasemana == 3)
			document.write("Quarta Feira, ");
		else if(mdiasemana == 4)
			document.write("Quinta Feira, ");
		else if(mdiasemana == 5)
			document.write("Sexta Feira, ");
		else if(mdiasemana == 6)
			document.write("S&aacute;bado, ");

			document.write(+mdia+' de ');
if(mmes == 0)
	document.write("Janeiro de ");
		else if(mmes == 1)
			document.write("Fevereiro de ");
		else if(mmes == 2)
			document.write("Mar&ccedil;o de ");
		else if(mmes == 3)
			document.write("Abril de ");
		else if(mmes == 4)
			document.write("Maio de ");
		else if(mmes == 5)
			document.write("Junho de ");
		else if(mmes == 6)
			document.write("Julho de ");
		else if(mmes == 7)
			document.write("Agosto de ");
		else if(mmes == 8)
			document.write("Setembro de ");
		else if(mmes == 9)
			 document.write("Outubro de ");
		else if(mmes == 10)
			 document.write("Novembro de ");
		else if(mmes == 11)
			 document.write("Dezembro de ");
			 document.write(mano);
}
// DATA - FIM

// POPUP - ÍNICIO
function popup(theURL,width,height,features) { 
	if(window.screen){
		per_ancho=(width/screen.width)*100;
		per_alto=(height/width)*100;
		win_ancho=(screen.width*per_ancho)/100;
		win_alto=(win_ancho*per_alto)/100;
		x=(screen.width-win_ancho)/2;
		y=(screen.height-win_alto)/2;
	}else{
		x=0;
		y=0;
		win_ancho=w;
		win_alto=y;
	}
	winfeatures=("top="+y+",left="+x+",scrollbars=auto, width="+win_ancho+",height="+win_alto+","+features);
	window.open(theURL,'',winfeatures);
}
// POPUP - FIM

// MENU - ÍNICIO
function abrir(obj){
	elemento = document.getElementById(obj);
	if (elemento.style.display == "none"){
		elemento.style.display = "";	
	}
	else {
		elemento.style.display = "none";
	}
}
// MENU - FIM

// LIMITA - ÍNICIO
function limita(obj, n)
{
	var tamanho = obj.value.length;
	var tex=obj.value;
	if (tamanho>=n) {
		obj.value=tex.substring(0,n-1);
	}
	return true;
}

function nada() {
   return;
}
// LIMITA - FIM

function check_all()
{
	ok=false;
	frm=document.form1;

     for (var i=0;i<frm.elements.length;i++) {
		var x = frm.elements[i];
		if (x.name == 'chk') {
			x.checked = frm.chkall.checked;
		}
	}
}

function execSubmit(page, acao)
{
	
	frm=document.form1;
	frm.action=page;
	frm.acao.value=acao;	
	frm.submit();
}

function masc_dat(obj, e)
{
var nasc= obj.value;

    if (nasc.length == 02) {
        nasc = obj.value + '/';
		//alert(nasc)
       obj.value = nasc;
    }
    if (nasc.length == 05) {
        nasc = obj.value + '/';
       obj.value = nasc;
    }
	
	return IsNumeric(obj, e);
}


// IS NUMERIC
//onKeyPress="return(IsNumeric(this,event))"
function IsNumeric(fld, e){
	var strCheck = '0123456789.,';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
}

//LAYER
<!--
function MM_findObj(n, d){ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers(){ //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3){
		if ((obj=MM_findObj(args[i]))!=null){
			v=args[i+2];
			if (obj.style){
				obj=obj.style;
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
			}
			if (obj.visibility=='hidden'){
				obj.visibility='visible';
			}
			else{
				obj.visibility='hidden';
			}
			
		}
	}
}


function dataUniversal(DateValue){
	//Coverte dd/mm/yyyy para yyyymmdd
	var checkstr = "0123456789";
	var DateTemp = "";
	var seperator = "/";
	var day;
	var month;
	var year;
	var leap = 0;
	var err = 0;
	var i;
	err = 0;
	
	/* Delete all chars except 0..9 */
	for (i = 0; i < DateValue.length; i++)
	{
    	if (checkstr.indexOf(DateValue.substr(i,1)) >= 0){   
			DateTemp = DateTemp + DateValue.substr(i,1);
		}
		else{ //Converte data d/m/yyyy para dd/mm/yyyy
			if (DateTemp.length==1) DateTemp='0'+DateTemp;
			else if (DateTemp.length==3) DateTemp=DateTemp.substr(0,2)+'0'+DateTemp.substr(2,1);
		}
	}

	 //Converte ddmmyyyy para yyyymmdd
	 DateTemp=DateTemp.substr(4,4)+DateTemp.substr(2,2)+DateTemp.substr(0,2)
	 return DateTemp	
}

function check_date(field)
{
	var checkstr = "0123456789";
	var DateField = field;
	var Datevalue = "";
	var DateTemp = "";
	var seperator = "/";
	var day;
	var month;
	var year;
	var leap = 0;
	var err = 0;
	var i;
	err = 0;
	
	DateValue = DateField.value;
	
	/* Delete all chars except 0..9 */
	for (i = 0; i < DateValue.length; i++)
	{
    	if (checkstr.indexOf(DateValue.substr(i,1)) >= 0){   
			DateTemp = DateTemp + DateValue.substr(i,1);
		}
		else{ //Converte data d/m/yyyy para dd/mm/yyyy
			if (DateTemp.length==1) DateTemp='0'+DateTemp;
			else if (DateTemp.length==3) DateTemp=DateTemp.substr(0,2)+'0'+DateTemp.substr(2,1);
		}
	}

	DateValue = DateTemp;

	/* Always change date to 8 digits - string*/
	/* if year is entered as 2-digit / always assume 20xx */
	if (DateValue.length == 6){
		DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2);
	}
	if (DateValue.length != 8){
		err = 19;
	}
		
	/* year is wrong if year = 0000 */
	year = DateValue.substr(4,4);
	if (year == 0){
		err = 20;
	}
	
	/* Validation of month*/
	month = DateValue.substr(2,2);
	if ((month < 1) || (month > 12)){
		err = 21;
	}
	
	/* Validation of day*/
	day = DateValue.substr(0,2);
	if (day < 1){
		err = 22;
	}
	
	/* Validation leap-year / february / day */
	if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
		leap = 1;
	}
	if ((month == 2) && (leap == 1) && (day > 29)) {
		err = 23;
	}
	if ((month == 2) && (leap != 1) && (day > 28)) {
		err = 24;
	}
		
	/* Validation of other months */
	if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
		err = 25;
	}
	if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
		err = 26;
	}
	
	/* if 00 ist entered, no error, deleting the entry */
	if ((day == 0) && (month == 0) && (year == 00)){
		err = 0; day = ""; month = ""; year = ""; seperator = "";
	}
	
	/* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
	
	if 	(DateValue=='' || DateValue=='00000000'){
		err = 27;
	}

	if (err == 0) {
		DateField.value = day + seperator + month + seperator + year;
	}
	/* Error-message if err != 0 */
	else{
		alert("A data está incorreta, favor verificar novamente.");
		DateField.select();
		DateField.focus();
		return false;
	}
	return true;	
}

function Delete(page, acao, field)
{
	frm=document.form1;
	tot=0;
	sql='';
    frm.numero.value='';

	for (var i=0;i<frm.elements.length;i++){
		var x = frm.elements[i];
		if (x.name == 'chk'){   
			if (x.checked==true){
				sql= sql+x.value+' OR '+ field +'=';
				tot++;
			}
		}
	}

	if (tot==0){
		alert("Selecione os Conteúdos a serem apagados e clique aqui novamente");
	}
	else{ 
         frm.numero.value = sql.substring(0,sql.length-(4+field.length+1)); // "' OR '+field+'='"
 	     sql='';
 	     if (tot==1){
			msg = "Deseja realmente apagar este conteúdo selecionado?";
		} 
		else{
			msg = "Deseja realmente apagar os "+tot+" conteúdos selecionados?";
		}
		
		if (confirm(msg)){
			execSubmit(page, acao);
		}
	}
}

function goDown(fnc)
{
	var whichCode = (window.Event) ? event.which : event.keyCode;
	if (whichCode == 13){
		return fnc();
	}
}

function copiar(texto){
	if (window.clipboardData) 
	{
		// the IE-manier
		//window.clipboardData.setData("Text", texto + " - IE");
		window.clipboardData.setData("Text", texto);
		// waarschijnlijk niet de beste manier om Moz/NS te detecteren;
		// het is mij echter onbekend vanaf welke versie dit precies werkt:
	}
	else if (window.netscape) 
	{  
				
		alert("Esta opção está habilitada somente para\no navegador Microsoft Internet Explorer !!!\n");
		return false;
	}
	alert("O texto do roteiro foi copiado !!!");
	return false;
}

function carrega(id,tipo){
	document.getElementById('frmframe').src = "frame.asp?id="+ id +"&tipo="+ tipo;
}

function imprimir(){
	document.getElementById("frmframe").contentWindow.focus();	
	document.getElementById("frmframe").contentWindow.print();
}
//
function copiaRoteiro(){
	var texto = document.getElementById('conteudo').innerText;
	if (texto.length == 0){
		alert('Não há texto para ser copiado !!!');
		return false;
	}
	return copiar(texto);
	
}
// VALIDAÇÃO FORMULÁRIO FALE CONOSCO - ÍNICIO
function formFaleConosco()
{
	frm=document.form1;
	if (frm.nome.value.length==0){
		alert('Preencha o campo "Nome" !!!');
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert('Preencha o campo "e-mail" !!!');
		frm.email.focus();
		return false;
	}
	if (frm.ddd.value.length==0){
		alert('Preencha o campo "DDD" !!!');
		frm.ddd.focus();
		return false;
	}
	if (frm.telefone.value.length==0){
		alert('Preencha o campo "Telefone" !!!');
		frm.telefone.focus();
		return false;
	}
	if (frm.comentarios.value.length==0){
		alert('Preencha o campo "Comentários" !!!');
		frm.comentarios.focus();
		return false;
	}
	frm.submit();
}
// VALIDAÇÃO FORMULÁRIO FALE CONOSCO - FIM

// VALIDAÇÃO FORMULÁRIO RESERVA HOTEL - ÍNICIO
function formReservaHotel()
{
	frm=document.form1;
	if (frm.nome.value.length==0){
		alert('Preencha o campo "Nome" !!!');
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert('Preencha o campo "e-mail" !!!');
		frm.email.focus();
		return false;
	}
		if (frm.ddd.value.length==0){
		alert('Preencha o campo "DDD" !!!');
		frm.ddd.focus();
		return false;
	}
	if (frm.telefone.value.length==0){
		alert('Preencha o campo "Telefone" !!!');
		frm.telefone.focus();
		return false;
	}
	if (frm.tipo.value==0){
		alert('Selecione um Tipo de Apartamento" !!!');
		frm.tipo.focus();
		return false;
	}
	if (frm.numero.value.length==0){
		alert('Preencha o campo "Número de hóspedes" !!!');
		frm.numero.focus();
		return false;
	}
	if (frm.dataInicio.value=="dd/mm/aaaa"){
		alert('Preencha o campo "Período" !!!');
		frm.dataInicio.focus();
		return false;
	}
	if (frm.dataFim.value=="dd/mm/aaaa"){
		alert('Preencha o campo "Período" !!!');
		frm.dataFim.focus();
		return false;
	}
	frm.submit();
}
// VALIDAÇÃO FORMULÁRIO RESERVA HOTEL - FIM


// VALIDAÇÃO FORMULÁRIO RESERVA VIAGENS - ÍNICIO
function formReservaViagens()
{
	var frm=document.form1;
	var chk = false;
	
	if (frm.nome.value.length==0){
		alert('Preencha o campo "Nome" !!!');
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert('Preencha o campo "e-mail" !!!');
		frm.email.focus();
		return false;
	}
		if (frm.ddd.value.length==0){
		alert('Preencha o campo "DDD" !!!');
		frm.ddd.focus();
		return false;
	}
	if (frm.telefone.value.length==0){
		alert('Preencha o campo "Telefone" !!!');
		frm.telefone.focus();
		return false;
	}
	
	if (frm.cbArgentina.checked) chk = true;
	if (frm.cbBolivia.checked) chk = true;
	if (frm.cbChile.checked) chk = true;
	if (frm.cbEquador.checked) chk = true;
	if (frm.cbPeru.checked) chk = true;
	if (frm.cbUruguai.checked) chk = true;
	
	if (chk == false){
		alert('Selecione pelo menos um "Destino de seu interesse" !!!');
		return false;
	}
	
	if (frm.comentarios.value.length==0){
		alert('Preencha o campo "Faça sua reserva: " !!!');
		frm.comentarios.focus();
		return false;
	}
	frm.submit();
}
// VALIDAÇÃO FORMULÁRIO RESERVA VIAGENS - FIM


// VALIDAÇÃO FORMULÁRIO RESERVA QUERANDI - ÍNICIO
function formReservaQuerandi()
{
	var frm=document.form1;
	var chk = false;
	
	if (frm.nome.value.length==0){
		alert('Preencha o campo "Nome" !!!');
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert('Preencha o campo "E-mail" !!!');
		frm.email.focus();
		return false;
	}
		if (frm.ddd.value.length==0){
		alert('Preencha o campo "DDD" !!!');
		frm.ddd.focus();
		return false;
	}
	if (frm.telefone.value.length==0){
		alert('Preencha o campo "Telefone" !!!');
		frm.telefone.focus();
		return false;
	}
	
	if (frm.cena[0].checked) chk = true;
	if (frm.cena[1].checked) chk = true;

	
	if (chk == false){
		alert('Selecione um tipo de "Cena" !!!');
		return false;
	}
	
	if (frm.expectadores.value.length==0){
		alert('Preencha o campo "N° de expectadores" !!!');
		frm.expectadores.focus();
		return false;
	}
	
	if (frm.dataShow.value.length==0){
		alert('Preencha o campo "Data do show" !!!');
		frm.dataShow.focus();
		return false;
	}
	
	if (frm.hotel.value.length==0){
		alert('Preencha o campo "Hotel que está hospedado" !!!');
		frm.hotel.focus();
		return false;
	}
	
	if (frm.dataChegada.value.length==0){
		alert('Preencha o campo "Data da sua chegada" !!!');
		frm.dataChegada.focus();
		return false;
	}
	
	if (frm.comentarios.value.length==0){
		alert('Preencha o campo "Comentários" !!!');
		frm.comentarios.focus();
		return false;
	}
	frm.submit();
}
// VALIDAÇÃO FORMULÁRIO RESERVA VIAGENS - FIM


/*
function display()
{
	window.status='Antarky';
	//setTimeout("display()",0);
}
display();
*/
//document.captureEvents(Event.MOUSEMOVE|Event.MOUSEOUT|Event.MOUSEOVER);

function hidestatus(){
	window.status='Antarky'
	return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hidestatus
document.onmouseout=hidestatus

//FLASH
function flash(versao, largura, altura, nome, modo, cor)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="'+versao+',0,0,0" width="'+largura+'" height="'+altura+'>\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="'+nome+'" />\n');
	document.write('<param name="wmode" value="'+modo+'" />\n');
	document.write('<param name="bgcolor" value="'+cor+'" />\n');
	document.write('<embed src="'+nome+'" wmode="'+modo+'" bgcolor="'+cor+'" width="'+largura+'" height="'+altura+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}
/*
versao = 8 .................. <- Versão do player
largura = 200px ............. <- Largura do SWF
altura = 200px .............. <- Altura do SWF
nome = arquivo.swf .......... <- Caminho do SWF, essa opção não pode ser vazia
modo = transparent/opaque ... <- Flash transparente ou opaco / pode ser vazia
cor = #ffffff ............... <- Cor de fundo
*/

// THUMBS

var w = 1;
var h = 1;
if (document.getElementById || document.all) {
	document.write('<div id="thumbsImage" style="z-index:100"><img id="ttimg" src="http://www.antarky.com.br/site/_images/spacer.gif" /></div>');
}
function gettrailobj() {
	if (document.getElementById) {
		return document.getElementById("thumbsImage").style;
	} else if (document.all) {
		return document.all.trailimagid.style;
	}
}
function truebody() {
	return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}
function hideImage() {
	document.getElementById('frmImage').style.display = "none";
	document.getElementById('frmImage').style.left = "-1000";
	document.getElementById('frmImage').style.top = "-1000";
	
	document.onmousemove = "";
	document.getElementById('ttimg').src = 'http://www.antarky.com.br/site/_images/spacer.gif';
	gettrailobj().visibility = "hidden";
	gettrailobj().left = -1000;
	gettrailobj().top = 0;
}
function showImage(width, height, file) {
	if (navigator.userAgent.toLowerCase().indexOf('opera') == -1 && navigator.userAgent.toLowerCase().indexOf('safari') == -1) {
		w = width;
		h = height;
		// followmouse()
		gettrailobj().visibility = "visible";
		document.getElementById('thumbsImage').style.height = h;
		document.getElementById('thumbsImage').style.width = w;

		document.getElementById('frmImage').style.display = "block";
		document.getElementById('frmImage').style.width = w;
		document.getElementById('frmImage').style.height = h;
		
		document.getElementById('ttimg').src = file;
		document.onmousemove = followmouse;
	}
}
function followmouse(e) {
	if (navigator.userAgent.toLowerCase().indexOf('opera') == -1 && navigator.userAgent.toLowerCase().indexOf('safari') == -1) {
		var xcoord = 20;
		var ycoord = 20;
		if (typeof e != "undefined") {
			xcoord += e.pageX;
			ycoord += e.pageY;
		} else if (typeof window.event != "undefined") {
			xcoord += truebody().scrollLeft+event.clientX;
			ycoord += truebody().scrollTop+event.clientY;
		}
		var docwidth = document.all ? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
		var docheight = document.all ? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);
		if (xcoord+w+3>docwidth) {
			xcoord = xcoord-w-(20*2);
		}
		if (ycoord-truebody().scrollTop+h>truebody().clientHeight) {
			ycoord = ycoord-h-20;
		}
		gettrailobj().left = xcoord+"px";
		gettrailobj().top = ycoord+"px";
		
		document.getElementById('frmImage').style.left = gettrailobj().left;
		document.getElementById('frmImage').style.top = gettrailobj().top;
		
	}
}
//MENU
var anterior,subAnterior;

function menuShow(div){
	document.getElementById(div).style.display = ("none" == document.getElementById(div).style.display)  ? "block" : "none";
	
	if((anterior) && (anterior !=div)){
		document.getElementById(anterior).style.display = 'none';
	}
	 anterior = div;
}

//MENU SUB
function menuSubShow(div){
	document.getElementById(div).style.display = ("none" == document.getElementById(div).style.display)  ? "block" : "none";
	
	if((subAnterior) && (subAnterior !=div)){
		document.getElementById(subAnterior).style.display = 'none';
	}
	 subAnterior = div;
}
//Função que altera o mês do check Out
function AlterarMes(){
    var mesIn=document.getElementById("ddlMesIn").value;
    document.getElementById("ddlMesOut").value=mesIn;
}

//Função que altera o dia e mês do check Out
function AlterarDia(){
    var diaIn=document.getElementById("ddlDiaIn").value;
    diaIn=((diaIn*1)+1);
    if (diaIn==32){
        document.getElementById("ddlDiaOut").value=1;
        var mesIn=document.getElementById("ddlMesIn").value;
        var mesOut=((mesIn*1)+1);
        if (mesOut==13){
            document.getElementById("ddlMesOut").value=1;
        }
        else{
            document.getElementById("ddlMesOut").value=mesOut;
        }
    }
    else{
        var mesIn=document.getElementById("ddlMesIn").value;
        document.getElementById("ddlMesOut").value=mesIn;

        document.getElementById("ddlDiaOut").value=diaIn;
    }
}
//FORMATA O CNPJ
function FormataCNPJ(Campo, teclapres){

   if(window.event){
    var tecla = teclapres.keyCode;
   }else  tecla = teclapres.which;

   var vr = new String(Campo.value);
   vr = vr.replace(".", "");
   vr = vr.replace(".", "");
   vr = vr.replace("/", "");
   vr = vr.replace("-", "");

   tam = vr.length + 1;

   
   if (tecla != 9 && tecla != 8){
      if (tam > 2 && tam < 6)
         Campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
      if (tam >= 6 && tam < 9)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
      if (tam >= 9 && tam < 13)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
      if (tam >= 13 && tam < 15)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
      }
}

function showHidePopup(modo){
	document.getElementById("txtRoteiro").value = '';
	if (modo == 'abre'){
		document.getElementById("conteudo").innerHTML = "carregando...";
		document.getElementById("base").style.display = "block";
		document.getElementById("conteudo").style.display = "block";
		document.getElementById("menuReserva").style.display = "none";
}
	else{
		document.getElementById("base").style.display = "none";
		document.getElementById("conteudo").style.display = "none";
		document.getElementById("menuReserva").style.display = "block";
	}
}
//################# RESERVA ################//
//VALIDA DATA
/*DIA*/
function Dia(Data_DDMMYYYY) {
	string_data = Data_DDMMYYYY.toString();
	posicao_barra = string_data.indexOf("/");
	if (posicao_barra != -1) {
		dia = string_data.substring(0, posicao_barra);
		return dia;
	} else {
		return false;
	}
}

/*MÊS*/
function Mes(Data_DDMMYYYY) {
	string_data = Data_DDMMYYYY.toString();
	posicao_barra = string_data.indexOf("/");
	if (posicao_barra != -1) {
		dia = string_data.substring(0, posicao_barra);
		string_mes = string_data.substring(posicao_barra+1, string_data.length);
		posicao_barra = string_mes.indexOf("/");
		if (posicao_barra != -1) {
			mes = string_mes.substring(0, posicao_barra);
			mes = Math.floor(mes);
			return mes;
		} else {
			return false;
		}
	} else {
		return false;
	}
}

/*ANO*/
function Ano(Data_DDMMYYYY) {
	string_data = Data_DDMMYYYY.toString();
	posicao_barra = string_data.indexOf("/");
	if (posicao_barra != -1) {
		dia = string_data.substring(0, posicao_barra);
		string_mes = string_data.substring(posicao_barra+1, string_data.length);
		posicao_barra = string_mes.indexOf("/");
		if (posicao_barra != -1) {
			mes = string_mes.substring(0, posicao_barra);
			mes = Math.floor(mes);
			ano = string_mes.substring(posicao_barra+1, string_mes.length);
			return ano;
		} else {
			return false;
		}
	} else {
		return false;
	}
}

/*FUNÇÃO DO CÁLCULO DE DIAS*/
function Calcula_Dias(chkIn_DDMMYYYY, chkOut_DDMMYYYY) {
	Var_Dia1 = Dia(chkIn_DDMMYYYY);
	Var_Mes1 = Mes(chkIn_DDMMYYYY);
	Var_Mes1 = Math.floor(Var_Mes1)-1;
	Var_Ano1 = Ano(chkIn_DDMMYYYY);
	var chkIn = new Date(Var_Ano1, Var_Mes1, Var_Dia1);
	Var_Dia2 = Dia(chkOut_DDMMYYYY);
	Var_Mes2 = Mes(chkOut_DDMMYYYY);
	Var_Mes2 = Math.floor(Var_Mes2)-1;
	Var_Ano2 = Ano(chkOut_DDMMYYYY);
	var chkOut = new Date(Var_Ano2, Var_Mes2, Var_Dia2);
	var diferenca = chkOut.getTime()-chkIn.getTime();
	var diferenca = Math.floor(diferenca/(1000*60*60*24));
	if ((diferenca<=30) && (diferenca>0)){
		document.getElementById("frmBuscaRapida").submit();
	}else{
		alert("Os dias entre o ChekIn e o ChekOut não podem ultrapassar 30 dias.");
	}
}
//MENU
var anterior,subAnterior;

function menuShow(div){
	document.getElementById(div).style.display = ("none" == document.getElementById(div).style.display)  ? "block" : "none";
	
	if((anterior) && (anterior !=div)){
		document.getElementById(anterior).style.display = 'none';
	}
	 anterior = div;
}

//MENU SUB
function menuSubShow(div){
	document.getElementById(div).style.display = ("none" == document.getElementById(div).style.display)  ? "block" : "none";
	
	if((subAnterior) && (subAnterior !=div)){
		document.getElementById(subAnterior).style.display = 'none';
	}
	 subAnterior = div;
}

//VALIDAÇÃO DA DATA 
function VerificaData(digData){
	if (digData){
		var bissexto = 0;
		var data = digData; 
		var tam = data.length;
		if (tam == 10) 
		{
			var dia = data.substr(0,2)
			var mes = data.substr(3,2)
			var ano = data.substr(6,4)
			if ((ano > 1900)||(ano < 2100))
			{
				switch (mes) 
				{
					case '01':
					case '03':
					case '05':
					case '07':
					case '08':
					case '10':
					case '12':
						if  (dia <= 31) 
						{
							return true;
						}
						break
					
					case '04':        
					case '06':
					case '09':
					case '11':
						if  (dia <= 30) 
						{
							return true;
						}
						break
					case '02':
						/* Validando ano Bissexto / fevereiro / dia */ 
						if ((ano % 4 == 0) || (ano % 100 == 0) || (ano % 400 == 0)) 
						{ 
							bissexto = 1; 
						} 
						if ((bissexto == 1) && (dia <= 29)) 
						{ 
							return true;                 
						} 
						if ((bissexto != 1) && (dia <= 28)) 
						{ 
							return true; 
						}            
						break                        
				}
			}
		}    
		alert("A Data "+data+" é inválida!");
		return false;
	}
}
