var strNavegador;
//alert('appCodeName:'+navigator.appCodeName);
//alert('platform:'+navigator.platform);
//alert('userAgent:'+navigator.userAgent);
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) < 5)
{
	strReferenciaEstilo = "";
	strCapaVisible = "show";
	strNavegador = "Netscape";
}
else
{
	strReferenciaEstilo = "style.";
	strCapaVisible = "visible";
	strNavegador = "Explorer";
}

function ReferenciaCapa(strCapa)
{
	if(strNavegador == "Netscape" && parseInt(navigator.appVersion.charAt(0)) < 5)
	{

		return "document.layers['" + strCapa + "'].";
	}
	else
	{

		return "document.all['" + strCapa + "'].";
	}
}	
			
function MuestraCapa(Capa,mostrar)
{

	if (mostrar=="1")
	{
		if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) > 4)
		{
			eval("document.getElementById(Capa).style.display = 'block';");
		}
		else
		{
			eval(ReferenciaCapa(Capa) + strReferenciaEstilo + "display = 'block';");
		}
	}
	else
	{
		if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) > 4)
		{

			eval("document.getElementById(Capa).style.display = 'none';");
		}
		else
		{
			eval(ReferenciaCapa(Capa) + strReferenciaEstilo + "display = 'none';");
		}

	}
}

function DevuelveEstado(Capa)
{
	if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) > 4)
	{
		if (eval("document.getElementById(Capa).style.display == 'block';"))
			return true
		else
			return false
	}
	else
	{
		if (eval(ReferenciaCapa(Capa) + strReferenciaEstilo + "display == 'block';"))
			return true
		else
			return false
	}
}

function CalculaPosicion(Capa,x,y)
{
	if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) > 4)
	{
		document.getElementById(Capa).style.top = y
		document.getElementById(Capa).style.left = x
	}
	else
	{
		eval(ReferenciaCapa(Capa) + strReferenciaEstilo + "top =" + y);
		eval(ReferenciaCapa(Capa) + strReferenciaEstilo + "left =" + x);
	}
}

function PintaIframe ()
{
	//document.write ("<IFRAME STYLE='display:none;position:absolute;width:360;height:300;' name='DestFrec' ID='DestFrec' MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE FRAMEBORDER=0 SCROLLING=NO SRC='destinosfrecuentes.asp'></IFRAME>");
	document.write ("<IFRAME STYLE='display:none;position:absolute;top:190;left:190;;width:360;height:300;' name='DestFrec' ID='DestFrec' MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE FRAMEBORDER=0 SCROLLING=NO SRC='destinosfrecuentes.asp'></IFRAME>");
}
function PintaIframePagIntermedia ()
{
	document.write ("<IFRAME STYLE='display:none;position:absolute;width:349;height:240;' name='DestFrec' ID='DestFrec' MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE FRAMEBORDER=0 SCROLLING=NO SRC='paginaIntermedia.asp'></IFRAME>");
}
function controlaResidentes(residente)
{

	//cambiarPrecio(document.all('ResAdulto').value,document.all('ResNinio').value,document.all('ResNinio').value);
	if (residente == 'S'){
		MuestraCapa('residente',1);
	}else{
		MuestraCapa('residente',0);
		deseleccionaResidentes();
	}
}
function controlaResidentesPrecio(residente)
{

	//cambiarPrecio(document.all('ResAdulto').value,document.all('ResNinio').value,document.all('ResNinio').value);
	if (residente == 'S'){
		MuestraCapa('residente',1);
	}else{
		MuestraCapa('residente',0);
	}
}


/*******************************************************************************************
//Devuelve el ancho del navegador
*******************************************************************************************/
function dameAnchoNavegador (){
     var anchoNavegador = 0;   
     if (typeof window.innerWidth != 'undefined'){   
          anchoNavegador = window.innerWidth;   
     }else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){   
          anchoNavegador = document.documentElement.clientWidth;   
     }else{   
          anchoNavegador = document.getElementsByTagName('body')[0].clientWidth;   
     }   
     return anchoNavegador;   
}
/*******************************************************************************************
//Devuelve el alto del navegador
*******************************************************************************************/
function dameAltoNavegador (){
     var altoNavegador = 0;   
     if (typeof window.innerHeight != 'undefined'){   
          altoNavegador = window.innerHeight;   
     }else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0){   
          altoNavegador = document.documentElement.clientHeight;   
     }else{   
          altoNavegador = document.getElementsByTagName('body')[0].clientHeight;   
     }   
     return altoNavegador;   
}
/*******************************************************************************************
//Inserta un div para mostrar que se está realizando un trabajo por detrás en la página
*******************************************************************************************/
function MostrarCapaProcesando(sLiteral1, sLiteral2, sLiteral3, sLiteral4, sLiteral5){
     var altoDeLaPagina = document.body.scrollHeight;
     var posicionDelScroll = document.body.scrollTop;

     var sDivSuplementoDelegacion = '';
     var iAltoDelAviso = 160;
     var iAnchoDelAviso = 700;


     sDivSuplementoDelegacion += '<!-- Capa de confirmacion suplemento cargos de emision recogida en delegacion -->';
     sDivSuplementoDelegacion += '<div id="confirm_suplemento_delegacion" style="position:absolute;width:' + dameAnchoNavegador() + 'px;height:' + altoDeLaPagina + 'px;left:0px;top:0px;Z-INDEX:30">';
     sDivSuplementoDelegacion += '     <table background="../../VECI/PaquetesDinamicos/fondoProcesando.gif" border=0 cellspacing="0" cellpadding="0" style="table-layout:fixed;width:' + dameAnchoNavegador() + 'px;height:' + altoDeLaPagina + 'px;">';
     sDivSuplementoDelegacion += '          <tr height="' + ((parseInt((dameAltoNavegador() / 2),10) - (iAltoDelAviso/2)) + posicionDelScroll - 56) + 'px">';
     sDivSuplementoDelegacion += '               <td width="' + ((dameAnchoNavegador() / 2) - (iAnchoDelAviso/2)) + 'px" />';
     sDivSuplementoDelegacion += '               <td width="' + iAnchoDelAviso + 'px" />';
     sDivSuplementoDelegacion += '               <td width="' + ((dameAnchoNavegador() / 2) - (iAnchoDelAviso/2)) + 'px" />';
     sDivSuplementoDelegacion += '          </tr>';
     sDivSuplementoDelegacion += '          <tr height="' + iAltoDelAviso + 'px">';
     sDivSuplementoDelegacion += '               <td />';
     //sDivSuplementoDelegacion += '               <td style="border-left:solid 1px red;border-right:solid 1px red;border-top:solid 1px red;border-bottom:solid 1px red">';
     //sDivSuplementoDelegacion += '                    <table width="100%" height="100%" border="0" cellspacing="20" cellpadding="0"  style="background:white;">';
     sDivSuplementoDelegacion += '               <td>';
     sDivSuplementoDelegacion += '                    <table width="100%" height="100%" border="0" cellpadding="10" cellspacing="0" class="leyenda2">';
     sDivSuplementoDelegacion += '                         <tr><td colspan="2" align="center" class="fondoblanco"><span class="txtver10"><b>' + sLiteral1 + '</b></span></td></tr>';
     sDivSuplementoDelegacion += '                         <tr>';
     sDivSuplementoDelegacion += '                              <td width="50%" align="center" class="fondoblanco">';
     sDivSuplementoDelegacion += '                                   <table width="70px" border="0" cellspacing="1" cellpadding="2" class="fondoverde" onMouseOver="javascript:style.cursor=\'pointer\'" onClick="javascript:FinalizarProcesoReserva();">';
     sDivSuplementoDelegacion += '                                        <tr>';
     sDivSuplementoDelegacion += '                                             <td align="center" class="fondogris"><span class="txtver10"><font class="colorverdeoscuro"><b>' + sLiteral2 + '</b></font></span></td>';
     sDivSuplementoDelegacion += '                                        </tr>';
     sDivSuplementoDelegacion += '                                   </table>';
     sDivSuplementoDelegacion += '                              </td>';
     sDivSuplementoDelegacion += '                              <td width="50%" align="center" class="fondoblanco">';
     sDivSuplementoDelegacion += '                                   <table width="70px" border="0" cellspacing="1" cellpadding="2" class="fondoverde" onMouseOver="javascript:style.cursor=\'pointer\'" onClick="javascript:void(QuitarCapaProcesando())">';
     sDivSuplementoDelegacion += '                                        <tr>';
     sDivSuplementoDelegacion += '                                             <td align="center" class="fondogris"><span class="txtver10"><font class="colorverdeoscuro"><b>' + sLiteral4 + '</b></font></span></td>';
     sDivSuplementoDelegacion += '                                        </tr>';
     sDivSuplementoDelegacion += '                                   </table>';
     sDivSuplementoDelegacion += '                              </td>';
     sDivSuplementoDelegacion += '                         </tr>';
     sDivSuplementoDelegacion += '                         <tr>';
     sDivSuplementoDelegacion += '                              <td class="fondoblanco" align="center"><span class="txtver10">' + sLiteral3 + '</span></td>';
     sDivSuplementoDelegacion += '                              <td class="fondoblanco" align="center"><span class="txtver10">' + sLiteral5 + '</span></td>';
     sDivSuplementoDelegacion += '                         </tr>';
     sDivSuplementoDelegacion += '                    </table>';
     sDivSuplementoDelegacion += '               </td>';
     sDivSuplementoDelegacion += '               <td />';
     sDivSuplementoDelegacion += '          </tr>';
     sDivSuplementoDelegacion += '          <tr height="100%">';
     sDivSuplementoDelegacion += '               <td colspan="3" />';
     sDivSuplementoDelegacion += '          </tr>';
     sDivSuplementoDelegacion += '     </table>';
     sDivSuplementoDelegacion += '</div>';


     if(window.document.body.insertAdjacentHTML){ 
          window.document.body.insertAdjacentHTML("beforeEnd",sDivSuplementoDelegacion);
     }else{
          var range = document.createRange ();
          var docFragmentToInsert = range.createContextualFragment (sDivSuplementoDelegacion);
          window.document.body.appendChild (docFragmentToInsert);
     }

     /*if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){	
          HTMLElement.prototype.insertAdjacentElement = function(parsedNode){		
               this.appendChild(parsedNode);
          }	
          HTMLElement.prototype.insertAdjacentHTML = function(htmlStr){		
               var r = this.ownerDocument.createRange();		
               r.setStartBefore(this);		
               var parsedHTML = r.createContextualFragment(htmlStr);		
               this.insertAdjacentElement(where,parsedHTML)	
          } 	
          HTMLElement.prototype.insertAdjacentText = function(where,txtStr){		
               var parsedText = document.createTextNode(txtStr)		
               this.insertAdjacentElement(where,parsedText)	
          }
     } 
     var range = document.createRange();
alert (range);
     var docFragmentToInsert = range.createContextualFragment (sDivSuplementoDelegacion);
alert ("2");
     window.document.body.appendChild (docFragmentToInsert);
alert (sDivSuplementoDelegacion);*/
}
/*******************************************************************************************
//quita el div que muestra que se está realizando una acción en la página
*******************************************************************************************/
function QuitarCapaProcesando(){
     if (document.getElementById("confirm_suplemento_delegacion")!=null){
          window.document.body.removeChild(document.getElementById("confirm_suplemento_delegacion"));
     }
}


