﻿var capaGeneral='TabContainer1_TabPanel1_';
var capaGeneral2='TabContainer1_TabPanel3_';
var codigoProducto="";
var color=0;

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-5445664-2");
pageTracker._trackPageview();
} catch(err) {}

function ayuda()
{
document.getElementById("ayuda").style.zIndex=1;
document.getElementById("ayuda").style.visibility='visible';

}
function endayuda()
{
document.getElementById("ayuda").style.zIndex=-1;
document.getElementById("ayuda").style.visibility='hidden';

}
function getParameters()
{
var arg = new Object();
var href = document.location.href;

if ( href.indexOf( "?") != -1)
{
var params = href.split( "?")[1];
var param = params.split("&");

for (var i = 0; i < param.length; ++i)
{
var name = param[i].split( "=")[0];
var value = param[i].split( "=")[1];

arg[name] = value;
}
}
return arg;
}
function atras()
{

}

function muestra(elemento){

    document.getElementById(""+elemento).style.visibility="visible";
  
}

function oculta(elemento){


	document.getElementById(""+elemento).style.visibility="hidden";
	
}


function ocultaHoteles(capa) {
 var nieve="";
 var total=6;
        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve";
        total=4
        } 
       else if (capa=='TabContainer1_TabPanel2_')
        {
        nieve="salud";
        } 
          else if (capa=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad";
        } 
         else if (capa=='TabContainer1_TabPanel1_')
        {
        total=4;
        } 
    for(h=1;h<total;h++){
    
            oculta(capa+"lblHab"+h+nieve);
            oculta(capa+"ddOcupaHab"+h+nieve);
            oculta(capa+"ddEdad1Hab"+h+nieve);
            oculta(capa+"ddEdad2Hab"+h+nieve);
	} 
}

function ocultaHoteles3(capa) {
 var nieve="";
        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve";
        } 
       else if (capa=='TabContainer1_TabPanel2_')
        {
        nieve="salud";
        } 
          else if (capa=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad";
        } 
    for(h=1;h<4;h++){
    
            oculta(capa+"lblHab"+h+nieve);
            oculta(capa+"ddOcupaHab"+h+nieve);
            oculta(capa+"ddEdad1Hab"+h+nieve);
            oculta(capa+"ddEdad2Hab"+h+nieve);
	} 
}

function ocultaApartamentos(capa)
{ 
var nieve="";
var total=6;
        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve";
        total=4;
        } 
        if (capa=='TabContainer1_TabPanel1_')
        {
        total=4
        } 
    for(h=1;h<total;h++){
            oculta(capa+"ddOcupaApt"+h+nieve);
	}    
}

function muestraHabitacionesCircuitos(capa)
{


  var numHab=document.getElementById(capa+'ddHabitaciones0').value;

 for(h=6;h<11;h++){
   
            if(h>parseInt(numHab)) {
         
                oculta(capa+"lblHab"+h);
                oculta(capa+"ddOcupaHab"+h);
                oculta(capa+"ddEdad1Hab"+h);
                oculta(capa+"ddEdad2Hab"+h);
            } else {
            
                muestra(capa+"lblHab"+h);
                 var n=h-5;
                document.getElementById(capa+"lblHab"+h).innerHTML="Hab."+n;
               
                muestra(capa+"ddOcupaHab"+h);
               
                muestraEdades(capa,h);
              
            }
	    }

}
function muestraHabitaciones(capa, hotelApto) 
{

if (capa=="")
{
hotelApto= document.getElementById('hotelApartamento').value;


}else if(capa=="ficha")
{
capa="";
}
var total=6;
  
   var nieve="";
  
        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve"
        total=4;
       
        } 
        else if (capa=='TabContainer1_TabPanel2_')
        {
        nieve="salud"
       
        } 
        else if (capa=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad"
       
        }
        if (capa=='TabContainer1_TabPanel1_')
        {
        //nieve="Nieve"
        total=4;
       
        }  
    hotapt = hotelApto;
  
    capaGeneral=capa;
    
    var formu=document.form1;
  
    var numHab=document.getElementById(capa+'ddHabitaciones'+nieve).value;
 
    
    var cde = $find(capa+'AutoCompleteExtender1');
    if(cde!=null) {
        cde.set_contextKey(hotelApto);
    }  
    
    if (hotelApto=='H') {
        if (capa!=''&& capa!='TabContainer1_TabPanel2_'&& capa!='TabContainer1_TabPane6_') {
        
        muestra(capa+'lblCategoria'+nieve);
        muestra(capa+'ddlCategoria'+nieve);
        }
      
        if(capa!='TabContainer1_TabPanel2_'&& capa!='TabContainer1_TabPane6_')
        {
         document.getElementById(capa+'lblHotApt'+nieve).innerHTML='Nº Hab.';
        ocultaApartamentos(capa);
        }
        
      
          for(h=1;h<total;h++){
        
            if(h>numHab) {
                oculta(capa+"lblHab"+h+nieve);
                oculta(capa+"ddOcupaHab"+h+nieve);
                oculta(capa+"ddEdad1Hab"+h+nieve);
                oculta(capa+"ddEdad2Hab"+h+nieve);
            } else {
                muestra(capa+"lblHab"+h+nieve);
                document.getElementById(capa+"lblHab"+h+nieve).innerHTML="Hab."+h;
                muestra(capa+"ddOcupaHab"+h+nieve);
                muestraEdades(capa,h);
            }
	    }
    }
      if(capa!='TabContainer1_TabPanel2_'&& capa!='TabContainer1_TabPane6_')
        {
    if (hotelApto=='A') {
        if (capa!='') {
            oculta(capa+'lblCategoria'+nieve);
            oculta(capa+'ddlCategoria'+nieve);
            document.getElementById(capa+'ddlCategoria'+nieve).value='0';
        }
        document.getElementById(capa+'lblHotApt'+nieve).innerHTML='Apt.';
        ocultaHoteles(capa);
        for(h=1;h<total;h++){
            if(h>numHab) {
                oculta(capa+"lblHab"+h+nieve);
                oculta(capa+"ddOcupaApt"+h+nieve);
            } else {
                muestra(capa+"lblHab"+h+nieve);
                muestra(capa+"ddOcupaApt"+h+nieve);
                document.getElementById(capa+"lblHab"+h+nieve).innerHTML="Hab."+h;
            }
	    }
    }
    }
}


function muestraEdades(capa, habitacion) {
 var nieve="";
        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve"
        } 
       else  if (capa=='TabContainer1_TabPanel2_')
        {
        nieve="salud"
        } 
         else  if (capa=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad"
        } 
    edad = document.getElementById(capa+'ddOcupaHab'+habitacion+nieve).value.substr(1,1);
    
    if (edad=="0"){
       oculta(capa+"ddEdad1Hab"+habitacion+nieve);
       oculta(capa+"ddEdad2Hab"+habitacion+nieve);
    }
    if (edad=="1"){
       muestra(capa+"ddEdad1Hab"+habitacion+nieve);
       oculta(capa+"ddEdad2Hab"+habitacion+nieve);
    }
    if (edad=="2"){
       muestra(capa+"ddEdad1Hab"+habitacion+nieve);
       muestra(capa+"ddEdad2Hab"+habitacion+nieve);
    }
}

function modificaNoches() {

var nieve="";
        if (capaGeneral=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve"
        }
       else if (capaGeneral=='TabContainer1_TabPanel2_')
        {
        nieve="salud"
        }
         else if (capaGeneral=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad"
        }
    var desde = fecha(document.getElementById(capaGeneral+"tbDesde"+nieve).value);
    var hasta = fecha(document.getElementById(capaGeneral+"tbHasta"+nieve).value);
     var noches = parseInt(document.getElementById(capaGeneral+"ddlNoches"+nieve).value);


    var diferencia = diferenciaFechasDias(hasta, desde);
    if (diferencia<1)
    {
    hasta=incrementaDias(desde,noches)
       $find(capaGeneral+'CalendarExtender2'+nieve).set_selectedDate(hasta); 
    alert("fecha hasta tiene que ser mayor que fecha desde");
  
    }else if (diferencia>60)
    {
     hasta=incrementaDias(desde,noches)
       $find(capaGeneral+'CalendarExtender2'+nieve).set_selectedDate(hasta); 
    alert("El numero de noches no puede ser mayor de 30");
    }
    else
    {
       document.getElementById(capaGeneral+"ddlNoches"+nieve).value=diferencia;
    }
   var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0);  

  if (!isIE)
  {

  document.getElementById(capaGeneral+"LfechaDesde"+nieve).textContent= dameDiaSemana(desde);
   document.getElementById(capaGeneral+"LfechaHasta"+nieve).textContent=dameDiaSemana(hasta);
  }else{

   document.getElementById(capaGeneral+"LfechaDesde"+nieve).innerText= dameDiaSemana(desde);
   document.getElementById(capaGeneral+"LfechaHasta"+nieve).innerText=dameDiaSemana(hasta);
   }
   
}
function modificaHasta() {
  var nieve="";
        if (capaGeneral=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve"
        }
        else if (capaGeneral=='TabContainer1_TabPanel2_')
        {
        nieve="salud"
        }
          else if (capaGeneral=='TabContainer1_TabPane6_')
        {
        nieve="Ciudad"
        }
    var desde = fecha(document.getElementById(capaGeneral+"tbDesde"+nieve).value);
    var noches = parseInt(document.getElementById(capaGeneral+"ddlNoches"+nieve).value);
    var hasta = incrementaDias(desde, noches); 
   
    $find(capaGeneral+'CalendarExtender2'+nieve).set_selectedDate(hasta); 

    var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0);  

  if (!isIE)
  {
    document.getElementById(capaGeneral+"LfechaDesde"+nieve).textContent= dameDiaSemana(desde);
    document.getElementById(capaGeneral+"LfechaHasta"+nieve).textContent=dameDiaSemana(hasta);
  }else{
   document.getElementById(capaGeneral+"LfechaDesde"+nieve).innerText= dameDiaSemana(desde);
   document.getElementById(capaGeneral+"LfechaHasta"+nieve).innerText=dameDiaSemana(hasta);
   }
}


function modificaHastadesde() {
var nieve="";
       if (codigoProducto=="5")
       // if (capaGeneral=='TabContainer1_TabPanel5_')
        {
        capaGeneral='TabContainer1_TabPanel5_'
        nieve="Nieve"
        }
       else if (codigoProducto=="2")
       // if (capaGeneral=='TabContainer1_TabPanel5_')
        {
        capaGeneral='TabContainer1_TabPanel2_'
        nieve="salud"
        }
          else if (codigoProducto=="6")
       // if (capaGeneral=='TabContainer1_TabPanel5_')
        {
        capaGeneral='TabContainer1_TabPane6_'
        nieve="Ciudad"
        }

    var fechahoy= obtiene_fecha(1);


    var desde = fecha(document.getElementById(capaGeneral+"tbDesde"+nieve).value);
    fechaDesde=document.getElementById(capaGeneral+"tbDesde"+nieve).value;
   
   var compare=comparafechasActual(fechahoy,fechaDesde);

  
     if (compare==0)
     { 
     var creditoDias=parseInt(document.getElementById("HiddenCredito").value);
     if(creditoDias>3)
     {
     
     alert("Tiene que realizar la reserva como minimo con 5 a la fecha actual");
     }else
     {
      alert("la fecha desde no puede ser menor que la actual");
     }
     fechahoy=obtiene_fecha(2);

     var desde=fecha(fechahoy);
    $find(capaGeneral+'CalendarExtender1'+nieve).set_selectedDate(desde); 
  
     }
    var noches = parseInt(document.getElementById(capaGeneral+"ddlNoches"+nieve).value);
          
    var hasta = incrementaDias(desde, noches); 
  
    
    // document.getElementById("TabContainer1_TabPanel1_tbHasta").value = fechaStr(hasta);
    $find(capaGeneral+'CalendarExtender2'+nieve).set_selectedDate(hasta); 

var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0);  

  if (!isIE)
  {

  document.getElementById(capaGeneral+"LfechaDesde"+nieve).textContent= dameDiaSemana(desde);
   document.getElementById(capaGeneral+"LfechaHasta"+nieve).textContent=dameDiaSemana(hasta);
  }else{

   document.getElementById(capaGeneral+"LfechaDesde"+nieve).innerText= dameDiaSemana(desde);
   document.getElementById(capaGeneral+"LfechaHasta"+nieve).innerText=dameDiaSemana(hasta);
   }
}


function comparafechasActual(strfechalimite, strfecha)
{
    var aux1;
    var aux2;
    var fechalimite;
    var fecha;

    aux2 = strfecha.split("/");

    fecha = aux2[2] + aux2[1] + aux2[0]
 
 

    if(strfechalimite > fecha){
   
 
       
            //alert(str);
             return 0;
        
    }
    else{
  
        return 1; 
    }
}

function obtiene_fecha(tipo) {   
       
    var fecha_actual = new Date()   
    var dia 
    var reloj=new Date(); 
var str=""; 

var creditoDias=parseInt(document.getElementById("HiddenCredito").value)
    
    if (reloj.getHours()<15)
    {
    if(creditoDias>3)
    {
    
    dia=fecha_actual.getDate()+creditoDias;
    }else{
    
        dia  = fecha_actual.getDate();
        }
    }
    else
    {
    if(creditoDias>3)
    {
    
    dia=fecha_actual.getDate()+creditoDias+1;
    }else{
    
        dia= fecha_actual.getDate()+1;
        }
       
    }
    var mes = fecha_actual.getMonth() + 1   
    var anio = fecha_actual.getFullYear()   
  
    mes = (mes<10 ? '0':'')+ mes;
    dia = (dia<10 ? '0':'')+ dia;
   // dia=dia+parseInt(document.getElementById("HiddenCredito").value);
    
    if (tipo==1){
        return (anio+  mes  + dia);  
    }else 
        return(dia+"/"+mes+"/"+anio);
}   


function modificaHasta1(capa) {
var nieve="";

        if (capa=='TabContainer1_TabPanel5_')
        {
        nieve="Nieve"
        }
        else if (capa=='TabContainer1_TabPanel2_')
        {
        nieve="salud"
        }
         else if (capa=='TabContainer1_TabPane6_')
        {
        
        nieve="Ciudad"
        }
        
    var desde = fecha(document.getElementById(capa+"tbDesde"+nieve).value);
    var noches = parseInt(document.getElementById(capa+"ddlNoches"+nieve).value);
    var hasta = incrementaDias(desde, noches); 
  
    var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0);  
    
    if (!isIE)
    {
        document.getElementById(capa+"LfechaDesde"+nieve).textContent= dameDiaSemana(desde);
        document.getElementById(capa+"LfechaHasta"+nieve).textContent=dameDiaSemana(hasta);
    }else{
        document.getElementById(capa+"LfechaDesde"+nieve).innerText= dameDiaSemana(desde);
        document.getElementById(capa+"LfechaHasta"+nieve).innerText=dameDiaSemana(hasta);
    }
    var i=0;
  
    if (capa=='TabContainer1_TabPanel2_'|| capa=='TabContainer1_TabPane6_')
    {
    
     muestraHabitaciones(capa,"H");
    }
    
    else if(capa!="")
    {
    var hotApt=document.getElementById(capa+"rblHotelesApartamentos"+nieve+"_"+i.toString());
    if(hotApt!=null)
    {
   if (hotApt.checked)
   { 
       
    muestraHabitaciones(capa,hotApt.value);
    }
    else 
    {
    i=1;
       hotApt=document.getElementById(capa+"rblHotelesApartamentos_"+i.toString()+nieve);
           
            muestraHabitaciones(capa,hotApt.value);
      }
      }else
      {
       muestraHabitaciones(capa,"H");
      }
      }else
      {
    
        var args = getParameters();
         muestraHabitaciones('',args['hotapt']);
         
      
      }
     
}
function calcularDias(fila,valor)
{

sumaDias=valor;
calcular(fila)

}
var nombreDiasLargos=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"];

function dameDiaSemana(fecha){
    var dia = fecha.getDay();
    var diaSemana = nombreDiasLargos[dia];
	return diaSemana;
}







//COMPARA DOS FECHAS (DATE) Y DEVUELVE "menor" "mayor" "igual". 
function comparaFechas(fecha1, fecha2 ) {
	var result;
	var diferencia = fecha1.getTime() - fecha2.getTime();
	var dias = Math.floor(diferencia / (1000 * 60 * 60 * 24))
	if (dias<-1){// Si la fecha2 es menor que fecha1
    	result="menor";
	} else if(dias==-1) {
		result="igual";
	} else {
		result="mayor";
   }
   return result;
}



function fecha( cadena ) {
   //Separador para la introduccion de las fechas
   var separador = "/"
   //Separa por dia, mes y a?o
   if ( cadena.indexOf( separador ) != -1 ) {
        var posi1 = 0
        var posi2 = cadena.indexOf( separador, posi1 + 1 )
        var posi3 = cadena.indexOf( separador, posi2 + 1 )
        dia = cadena.substring( posi1, posi2 )
        // El formato Date de javascript enero=0, por lo que al mes le restamos 1.
        mes = eval(cadena.substring( posi2 + 1, posi3 ) - 1);
        anio = cadena.substring( posi3 + 1, cadena.length );

        return new Date(anio, mes, dia);
        
   } else {
        return new Date();
        /*
        this.dia = 0
        this.mes = 0
        this.anio = 0   
        */
   }
}
//FUNCION INCREMENTADIAS: incrementa una fecha en base a un numero de dias
//RECIBE: fecha (Date), dias (intenger)
//DEVUELVE: fechaFinal (Date)

function incrementaDias (fecha, dias){
	//Obtenemos las variables de la fecha
	// dia de la fecha	
	var dia = fecha.getDate();
	// a?o de la fecha 
	var anyo = fecha.getFullYear();
	// mes de la fecha
	var mes = fecha.getMonth();
	//Obtenemos los dias del mes
	var diasMes=0;
	if (mes==0 || mes==2 || mes==4 || mes==6 || mes==7 || mes==9 || mes==11){
		diasMes=31;
	}else if (mes==3 || mes==5 || mes==8 || mes==10){
		diasMes=30;
	//}else if (anyoBisiesto(anyo)){
		//diasMes=29;
	}
	else{
		diasMes=28;
	}
	//Incrementamos los dias
	dia = dia + dias;
	if (dia>diasMes){
		dia=dia-diasMes;
		mes = mes + 1;
		if (mes==12){
			mes = 0;
			anyo = anyo + 1;
		}
	}
	//creamos la nueva fecha
	var fechaFinal = new Date (anyo,mes,dia);
	return fechaFinal;
}


//COMPARA DOS FECHAS (DATE) Y DEVUELVE LOS DIAS DE DIFERENCIA. 
function diferenciaFechasDias(fecha1, fecha2 ) {
	var result;
	var diferencia = fecha1.getTime() - fecha2.getTime();
	var dias = Math.round(diferencia / (1000 * 60 * 60 * 24));
	return dias;
}


     
         function abrirCalendario(dias,titulo)
        {
          var h=0;
          var dateArray = new Array();
        var fechas=dias.split("]");
        var n;
        
                 var title = '<table width=300><tr><td>' +
                    titulo + '</td></tr><tr><td align="center">pulse fuera del calendario para cerrar</td></tr></table>';  


         C1WebCalendar1_Client.SelectedDates = new DateCollection([]);
         C1WebCalendar1_Client.DisabledDates = new DateCollection([]);
         C1WebCalendar1_Client.CustomDays = new CalendarDayCollection();
        
        C1WebCalendar1_Client.MonthCols = 3;
        C1WebCalendar1_Client.MonthRows = 2;
        
//fechas.length
        for (n = 0; n < fechas.length; n++)
        {
        var intervalo=fechas[n].split(",");
        
        var formato=intervalo[0].split("/");
       
            var startDate=new Date(formato[1]+"/"+formato[0]+"/20"+formato[2]);
             var formato2=intervalo[1].split("/");
            var endDate=new Date(formato2[1]+"/"+formato2[0]+"/20"+formato2[2]);
           
        
             
            var diferencia= diferenciaFechasDias(endDate,startDate);
            if (diferencia==0)
            {
            diferencia=1;
            }

            var i;
           
            for (i=0;i<=diferencia;i++) {
                var color = 'background-color:#15a501;color:Blue;';
                dateArray[h]=startDate.c1_AddDays(i);
                C1WebCalendar1_Client.CustomDays.Add(new CalendarDay(startDate.c1_AddDays(i)), new CalendarCellStyle('', color, '', ''), '');
                h++;
            }
        }
        C1WebCalendar1_Client.CalendarTitle = titulo;
      
       
       C1WebCalendar1_Client.SelectedDates=new DateCollection(dateArray);
        C1WebCalendar1_Client.PopupSetting.Top="40px";
        C1WebCalendar1_Client.PopupSetting.Dock = c1_dock_bottomleft;
        C1WebCalendar1_Client.PopupBeside(document.getElementById("Text1"));
        
        }    
        
         function fechaActual(fecha)
        {
        
        var formato3=fecha.toString().split("/");
           if (formato3[1].length==1)
           {
           formato3[1]="0"+formato3[1];
           }
             if (formato3[2].length==1)
           {
           formato3[2]="0"+formato3[2];
           }
           return formato3[0]+formato3[1]+formato3[2];
        
        }       

                
        function abrirPlanning(fecha, planning, titulo, estanciaInicio, estanciaFin)
        {
          
         var formato=fecha.split("/");
         var title = '<table width=450><tr><td bgcolor="#15a501">Disponible</td><td bgcolor="Yellow">En peticion</td><td bgcolor="Red">No disponible</td></tr><tr><td colspan=3>' +
                    titulo + '</td></tr><tr><td align="center">pulse fuera del calendario para cerrar</td></tr></table>';  

         C1WebCalendar1_Client.SelectedDates = new DateCollection([]);
         C1WebCalendar1_Client.DisabledDates = new DateCollection([]);
         C1WebCalendar1_Client.CustomDays = new CalendarDayCollection();
         C1WebCalendar1_Client.MonthCols = 3;
         C1WebCalendar1_Client.MonthRows = 2;

         var startDate=new Date(formato[1]+"/"+formato[0]+"/"+formato[2]);
        
         var formatoInicio=estanciaInicio.split("/"); 
            
         var startDate1=formatoInicio[2]+formatoInicio[1]+formatoInicio[0];
         var formatoFin=estanciaFin.split("/");
         var endDate= formatoFin[2]+formatoFin[1]+formatoFin[0];


         for(i=0;i<planning.length;i++)
         {
            var fondo=planning.charAt(i);
            var fechaDate= fechaActual(startDate.c1_AddDays(i));
            var color = "";

            if(fondo=="V"){
                if (fechaDate>=startDate1 && fechaDate<=endDate)
                {
              
                 color = 'background-color:#15a501;color:Blue;';
                }else
                {
                    color = 'background-color:#15a501;';
                }
            } else if (fondo == "R") {
                if (fechaDate>=startDate1 && fechaDate<=endDate)
                {
                    color ='background-color:Red;;color:Blue;';
                }else{
         	        color = 'background-color:Red;';
                }
            }else{
                if (fechaDate>=startDate1 && fechaDate<=endDate)
                {
                    color = 'background-color:Yellow;;color:Blue;';
                }else{
        	        color = 'background-color:Yellow;';
                }
            }
            C1WebCalendar1_Client.CustomDays.Add(new CalendarDay(startDate.c1_AddDays(i), new CalendarCellStyle('', color, '', ''), ''));
        }
        C1WebCalendar1_Client.CalendarTitle = title;
        C1WebCalendar1_Client.PopupSetting.Top="40px";
        C1WebCalendar1_Client.PopupSetting.Dock = c1_dock_bottomleft;
        C1WebCalendar1_Client.PopupBeside(document.getElementById("Text1"));

     } 
     
  
    

//function registrar(importe,importe2,checked,idSuplemento,conforme)
//{

//var estado=document.getElementById("HIDDENconforme").value;
//var estadoSuplementos=document.getElementById("HiddenEstadoSuplementos").value;
//var estadoOrigina=document.getElementById("HiddenEstadoOriginal").value;
//if (estado=="S")
//{
//document.getElementById("HIDDENconforme").value=conforme;
//estado=conforme;
//}
//idSuplemento = padleft(idSuplemento,'0',3);
//var sup =document.getElementById("HIDDENIDSuplemento").value;
//var precio =document.getElementById("Totalprecio").value;
// precio= precio.replace(",",".");
////importe=importe.toString().replace(",",".");  
//importe=importe+"."+importe2;
//var totalesSuplementos=document.getElementById("HiddenSuplementosPrecio").value;

//calculaPrecio(importe,checked);
//if (checked)
//{
//totalesSuplementos=parseFloat(totalesSuplementos)+parseFloat(importe);
//sup= sup+","+idSuplemento;
//}
//else
//{
//totalesSuplementos=parseFloat(totalesSuplementos)-parseFloat(importe);

//var suple=","+idSuplemento;
//sup=sup.replace(suple,"");
//}
//document.getElementById("HiddenSuplementosPrecio").value=totalesSuplementos;
//document.getElementById("HIDDENIDSuplemento").value=sup;
// var est= document.getElementById("HiddenPeticion").value;
// 
// if (sup==" "||sup=="")
//{

//estado="S";
//document.getElementById("HIDDENconforme").value="S";

//if (estadoOrigina=="C")
//{

// document.getElementById("conforme").style.visibility='visible';
//           document.getElementById("peticion").style.visibility='hidden';
//           }
//           

//}

//if (est!="P"&&estado!="S")
//{
//if (sup!=" "||sup!="")
//{

//             document.getElementById("peticion").style.visibility='visible';
//             document.getElementById("conforme").style.visibility='hidden';
// 
//}else
//           {
//           document.getElementById("conforme").style.visibility='visible';
//           document.getElementById("peticion").style.visibility='hidden';
//           
//}
//}
////alert(document.getElementById("HIDDENIDSuplemento").value);
//}
function registrar(importe,importe2,checked,idSuplemento,conforme)
{

var estado=document.getElementById("HIDDENconforme").value;
var estadoSuplementos=document.getElementById("HiddenEstadoSuplementos").value;
var estadoOrigina=document.getElementById("HiddenEstadoOriginal").value;
if (estado=="S")
{
document.getElementById("HIDDENconforme").value=conforme;
estado=conforme;
}
idSuplemento = padleft(idSuplemento,'0',3);
var sup =document.getElementById("HIDDENIDSuplemento").value;
var precio =document.getElementById("Totalprecio").value;
//precio=precio.replace(".","&");
 precio= precio.replace(",",".");
 //precio=precio.replace("&",",");
//importe=importe.toString().replace(",",".");  
importe=importe.toString().replace(".","");
importe=importe+"."+importe2;

var totalesSuplementos=document.getElementById("HiddenSuplementosPrecio").value;

calculaPrecio(importe,checked);
if (checked)
{
totalesSuplementos=parseFloat(totalesSuplementos)+parseFloat(importe);
sup= sup+","+idSuplemento;
}
else
{
totalesSuplementos=parseFloat(totalesSuplementos)-parseFloat(importe);

var suple=","+idSuplemento;
sup=sup.replace(suple,"");
}
document.getElementById("HiddenSuplementosPrecio").value=totalesSuplementos;
document.getElementById("HIDDENIDSuplemento").value=sup;
 var est= document.getElementById("HiddenPeticion").value;
 
 if (sup==" "||sup=="")
{

estado="S";
document.getElementById("HIDDENconforme").value="S";

if (estadoOrigina=="C")
{

 document.getElementById("conforme").style.visibility='visible';
           document.getElementById("peticion").style.visibility='hidden';
           }
           

}

if (est!="P"&&estado!="S")
{
if (sup!=" "||sup!="")
{

             document.getElementById("peticion").style.visibility='visible';
             document.getElementById("conforme").style.visibility='hidden';
 
}else
           {
           document.getElementById("conforme").style.visibility='visible';
           document.getElementById("peticion").style.visibility='hidden';
           
}
}
//alert(document.getElementById("HIDDENIDSuplemento").value);
}
function registrarSeguroAsistencia(checked,fila)
{




//importe=importe.toString().replace(",",".");  

if (checked)
{

document.getElementById("hidenNpersonasAseguradas").value="0";
document.getElementById("ddPersonas"+fila).disabled="";
document.getElementById("tx"+fila).style.visibility='visible';
for (i=0; i < 7; i++)
{


if (i!=fila)
{
document.getElementById("Checkbox"+i).disabled="true";

}
}
}
else
{
document.getElementById("hidenNpersonasAseguradas").value=document.getElementById("HiddenPersonas").value
document.getElementById("tx"+fila).style.visibility='hidden';
document.getElementById("tx"+fila).value="0";

document.getElementById("HiddenPrecioSeguro").value="0"
document.getElementById("txPrecioSeguro").value="0";
 document.getElementById("ddPersonas"+fila).selectedIndex =0;
document.getElementById("ddPersonas"+fila).disabled="true";

var precioSeguroAnterior=document.getElementById("HidenprecioSeguroAnterio").value.replace(",",".");

var precio=document.getElementById("Totalprecio").value.replace(",",".");
var importes=parseFloat(precio) -parseFloat(precioSeguroAnterior);
importes=redondear(importes,2);
document.getElementById("Totalprecio").value=importes.toString().replace(".",",")
document.getElementById("HidenprecioSeguroAnterio").value="0";
importes=redondear(importes,2);
for (i=0; i < 7; i++)
{

document.getElementById("Checkbox"+i).disabled="";


}

}


//alert(document.getElementById("HIDDENseguro").value);

}


function registrarSeguroNieve(importe,importe2,checked,codigo,fila)
{



var sup =document.getElementById("HIDDENseguro").value;

//importe=importe.toString().replace(",",".");  
importe=importe+"."+importe2;


if (checked)
{
    if(codigo=="2")
    {
        var totales=document.getElementById("HiddenPrecioOriginal").value;
        var servicioEstra=document.getElementById("txPrecioExtra").value;

        var importe1=(parseFloat(totales.replace(",","."))+parseFloat(servicioEstra.replace(",",".")))*0.09;
        importe1=redondear(importe1,2);

        importe=importe1.toString();
        document.getElementById("HidenprecioSeguroAnterio").value=importe;
        calculaPrecio(importe,checked);
        document.getElementById("tx"+fila).value=importe.replace(".",",");
        if (document.getElementById("HiddenActivado").value=="1")
         {

         
          document.getElementById("Reservar").disabled="";
         
         
         }



    }
    else
    {
    calculaPrecio(importe,checked);
    }

    document.getElementById("tx"+fila).style.visibility='visible';

    document.getElementById("HiddenCodigoSeguro").value=codigo;
    sup=importe.replace(".",",");
    document.getElementById("txPrecioSeguro").value=sup;
    document.getElementById("HiddenPrecioSeguro").value=sup;
    for (i=0; i < 7; i++)
    {
    if (i!=fila)
    {
    document.getElementById("Checkbox"+i).disabled="true";

    }
    }
}
else
{
 if(codigo=="2")
    {
        var totales=document.getElementById("HiddenPrecioOriginal").value;
        var servicioEstra=document.getElementById("txPrecioExtra").value;

        var importe1=(parseFloat(totales.replace(",","."))+parseFloat(servicioEstra.replace(",",".")))*0.09;
        importe1=redondear(importe1,2);

        importe=importe1.toString();
        document.getElementById("HidenprecioSeguroAnterio").value=importe;
        calculaPrecio(importe,checked);
        document.getElementById("tx"+fila).value=importe.replace(".",",");
        }
        else
        {
         var totales=document.getElementById("HiddenPrecioOriginal").value;
        var servicioEstra=document.getElementById("txPrecioExtra").value;
          var importe1=(parseFloat(totales.replace(",","."))+parseFloat(servicioEstra.replace(",",".")));
        importe1=redondear(importe1,2);

        importe=importe1.toString();
        
        document.getElementById("Totalprecio").value=importe.toString().replace(".",",");
        }
if (document.getElementById("HiddenActivado").value=="1")
 {
 
  document.getElementById("Reservar").disabled="";
 
 
 }

document.getElementById("tx"+fila).style.visibility='hidden';
document.getElementById("HiddenCodigoSeguro").value="0";
document.getElementById("txPrecioSeguro").value="0";
document.getElementById("HiddenPrecioSeguro").value="0"
for (i=0; i < 7; i++)
{

document.getElementById("Checkbox"+i).disabled="";


}
document.getElementById("HiddenCodigoSeguro").value="";
sup="0";
}

document.getElementById("HIDDENseguro").value=sup;
//alert(document.getElementById("HIDDENseguro").value);

}

    var form_dialog;
    
    
     function abrirVentana(dialogo, url)
     {
        form_dialog = dialogo.control;
        form_dialog.setUrl(url);
        form_dialog.show();
     }        

     
function padleft(val, ch, num) {
    var re = new RegExp(".{" + num + "}$");
    var pad = "";
    if (!ch) ch = " ";
    do  {
        pad += ch;
    }while(pad.length < num);
    return re.exec(pad + val);
}

function padright(val, ch, num){
    var re = new RegExp("^.{" + num + "}");
    var pad = "";
    if (!ch) ch = " ";
    do {
        pad += ch;
    } while (pad.length < num);
    return re.exec(val + pad);
}

       
 function muestraParques() 
    {    
  
        if (GBrowserIsCompatible()) 
        {   
            var latitudCentro = 39.909736;
            var longitudCentro = -3.691406;
            var map = new GMap2(document.getElementById("map_canvas"));        
            map.setCenter(new GLatLng(latitudCentro, longitudCentro), 5); 
            map.disableDoubleClickZoom();
//            map.disableDragging();
            var icono_pl = new GIcon(G_DEFAULT_ICON);
            icono_pl.image = "http://www.primeralinea.com/fotos/recursos/estaticos/pincho.png";
//            icono_pl.iconSize = new GSize(32, 34);  
            markerOptions = { icon:icono_pl };          
            function createMarker(point, nombre, html) 
            {  
                //var marker = new GMarker(point);  
                var marker = new GMarker(point, markerOptions);  
//                marker.value = number;  
                GEvent.addListener(marker, "click", 
                    function() 
                    {    
                        var myHtml = html; 
                      
                        map.openInfoWindowHtml(point, myHtml);  
                    }
                );  
                
                GEvent.addListener(map, "infowindowclose",
                    function() 
                    {    
                        map.setCenter(new GLatLng(latitudCentro, longitudCentro), 5);
                    }
                );  
                
                return marker;
            }
            

            var totalFilas = document.getElementById("HiddenField1").value;
            puntos = new Array(totalFilas);
            
            var nombre;
            var latitud;
            var longitud;
            var numero=parseInt(totalFilas)+2;          
            for (var i=2;i<numero;i++)
            {
          
                nombre = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbNombre").value;
                html = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbHtml").value;
               
                latitud = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbLatitud").value;
                longitud = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbLongitud").value;
            
                
                puntos[i-2] = new GLatLng(latitud,longitud);
                map.addOverlay(createMarker(puntos[i-2], nombre, html));
                
            }
            
        }    
    }   
  function abrirVentanal(dialogo, url)
     {
        form_dialog = dialogo.control;
//        var sesion = document.getElementById("HIDDENsesion").value;
//        var url = "informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
//        form_dialog.setUrl(url);
        form_dialog.show();
     } 
     function abrirVentanalCircuitos(dialogo, url)
     {  var poss=700;
     var tam=TamVentana();
   
     if((parseInt(tam[0])-996)>0)
     {
    
     poss=(parseInt(tam[0])-996)/2+700;
     }
 

    
      var uno=document.getElementById("HiddenMicrosite").value;
   if (uno!="S")
     {
      document.getElementById("dialog").style.left=poss;
   document.getElementById("dialog").style.top=350;
   }else
   {
   poss=500;
   document.getElementById("dialog").style.left=poss;
    document.getElementById("dialog").style.top=70;
   }
 
        form_dialog = dialogo.control;
//        var sesion = document.getElementById("HIDDENsesion").value;
//        var url = "informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
//        form_dialog.setUrl(url);
        form_dialog.show();
     } 
       function abrirVentanalDispo(dialogo, url)
     {  var poss=700;
     var tam=TamVentana();
   
     if((parseInt(tam[0])-996)>0)
     {
    
     poss=(parseInt(tam[0])-996)/2+700;
     }
 

     
      var uno=document.getElementById("HiddenMicrosite").value;
     if (uno!="S")
     {
     document.getElementById("dialog").style.left=poss;
   document.getElementById("dialog").style.top=350;
   }else
   {
   poss=500;
   document.getElementById("dialog").style.left=poss;
    document.getElementById("dialog").style.top=70;
   }
 
        form_dialog = dialogo.control;
//        var sesion = document.getElementById("HIDDENsesion").value;
//        var url = "informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
//        form_dialog.setUrl(url);
        form_dialog.show();
     } 
    
     function abrirVentanalBuscador(dialogo, url, capa)
     {
     var uno=document.getElementById("HiddenMicrosite").value;
     if (uno!="S")
     {
     var poss=395;
     var tam=TamVentana();
   
     if((parseInt(tam[0])-996)>0)
     {
    
     poss=(parseInt(tam[0])-996)/2+395;
     }
 

     document.getElementById(capa).style.left=poss;
    
   document.getElementById(capa).style.top=210;
 
       
        }else
        {
         document.getElementById(capa).style.top=20;
         document.getElementById(capa).style.left=390;
        }
         form_dialog = dialogo.control;
//        var sesion = document.getElementById("HIDDENsesion").value;
//        var url = "informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
//        form_dialog.setUrl(url);
        form_dialog.show();
     } 
      function abrirVentanalBuscadorMinorista(dialogo, url, capa)
     {
    // var poss=395;
     //var tam=TamVentana();
   
     //if((parseInt(tam[0])-996)>0)
     //{
    
     //poss=(parseInt(tam[0])-996)/2+395;
    // }
 

     //document.getElementById(capa).style.left=poss;
    
   document.getElementById(capa).style.top=20;
 
        form_dialog = dialogo.control;
//        var sesion = document.getElementById("HIDDENsesion").value;
//        var url = "informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
//        form_dialog.setUrl(url);
        form_dialog.show();
     } 
     function asignaPoblacion2(poblacion,capa)
        {
            document.getElementById(capa+'tbPoblacionSalida').value=poblacion;
            document.getElementById('Hiddenlocalidad').value=poblacion;  
            $get(capa+'C1WebDialog3').control.hide();
            // document.getElementById('C1WebGridA1').style.visibility = "hidden";
        }  
      
 function añadir()
        {
        var nombre="";
        var Apellido="";
        if (color>0)
        {
        if (document.getElementById('txtNombrePasajero').value!=""&&document.getElementById('txtApellidosPasajeros').value!="")
            {        var myTable = document.getElementById('myTable');
                var oRow = myTable.insertRow();
                
                if (color%2==0)
                {oRow.style.backgroundColor="#D1DDF1" ;
                }
                else{
                oRow.style.backgroundColor="White" ;
                }
                color++;
                var nombres= document.getElementById('HiddenNombreClientes').value;

 
nombres=nombres+','+ document.getElementById('txtApellidosPasajeros').value+'/'+document.getElementById('txtNombrePasajero').value;
nombre=document.getElementById('txtNombrePasajero').value;
Apellido=document.getElementById('txtApellidosPasajeros').value;
document.getElementById('txtApellidosPasajeros').value="";
document.getElementById('txtNombrePasajero').value="";
var oCell0=oRow.insertCell();
var oCell = oRow.insertCell();
var oCell2 = oRow.insertCell();
oCell0.innerHTML=color;
 oCell.innerHTML = nombre;
 oCell2.innerHTML =Apellido;


}
}
else
{
if (document.getElementById('tbnombreCliente').value!=""&&document.getElementById('tbApellidoCliente').value!="")
            {        var myTable = document.getElementById('myTable');
                var oRow = myTable.insertRow();
                
                oRow.style.backgroundColor="#D1DDF1" ;
              
                color++;
                var nombres= document.getElementById('HiddenNombreClientes').value;
                 nombre = document.getElementById('tbnombreCliente').value;
Apellido= document.getElementById('tbApellidoCliente').value;

 
nombres=nombres+','+ document.getElementById('tbApellidoCliente').value+'/'+document.getElementById('tbnombreCliente').value;
var oCell0=oRow.insertCell();
var oCell = oRow.insertCell();
var oCell2 = oRow.insertCell();
oCell0.innerHTML=color;
 oCell.innerHTML = nombre;
 oCell2.innerHTML =Apellido;
  document.getElementById('txtNombrePasajero').disabled="";
 document.getElementById('txtApellidosPasajeros').disabled="";
  document.getElementById('tbApellidoCliente').disabled="true";
 document.getElementById('tbnombreCliente').disabled="true";

}
}

document.getElementById('HiddenNombreClientes').value=nombres;


if(color==parseInt(document.getElementById('HiddenPasajeros').value))
{

   document.getElementById('txtNombrePasajero').disabled="true";
 document.getElementById('txtApellidosPasajeros').disabled="true";

 document.getElementById('Reservar').disabled="";
}
 }
  
     function abrirVentana2(dialogo, url)
     {
        form_dialog = dialogo.control;
        form_dialog.setUrl(url);
        form_dialog.show();
     } 
     function abrirVentanaCondiciones(dialogo)
     {
     url=document.getElementById('HiddenCondicionesGenerales').value;
        form_dialog = dialogo.control;
        form_dialog.setUrl(url);
        form_dialog.show();
     }       
     function abrirVentanaCondicionesCancelacion(dialogo)
     {
    // url=document.getElementById('HiddenCondicionesGenerales').value;
        form_dialog = dialogo.control;
        //form_dialog.setUrl(url);
        form_dialog.show();
     }    
     function abrirVentana(dialogo)
     {
    
        form_dialog = dialogo.control;
        var sesion = document.getElementById("HIDDENsesion").value;
        var localizador=document.getElementById("HIDDENlocata").value;
       
        var url = "http://62.81.189.40/envioConfirmacion/informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe=confirmacion.rpt";
        form_dialog.setUrl(url);
        form_dialog.show();
     }            
     function abrirVentanaReserva(dialogo)
     {
    
        form_dialog = dialogo.control;
        var sesion = document.getElementById("HIDDENsesion").value;
        var localizador=document.getElementById("HIDDENlocata").value;
       var report =document.getElementById("HIDDENReport").value;
        var url = "http://62.81.189.40/envioConfirmacion/informes.aspx?sesion=" + sesion + "&localizador=" + localizador + "&informe="+report+".rpt";
        form_dialog.setUrl(url);
        form_dialog.show();
     }     
     
function padleft(val, ch, num) {
    var re = new RegExp(".{" + num + "}$");
    var pad = "";
    if (!ch) ch = " ";
    do  {
        pad += ch;
    }while(pad.length < num);
    return re.exec(pad + val);
}

function padright(val, ch, num){
    var re = new RegExp("^.{" + num + "}");
    var pad = "";
    if (!ch) ch = " ";
    do {
        pad += ch;
    } while (pad.length < num);
    return re.exec(val + pad);
}

    

    
function redondear(cantidad, decimales) {
var cantidad = parseFloat(cantidad);
var decimales = parseFloat(decimales);
decimales = (!decimales ? 2 : decimales);
return Math.round(cantidad * Math.pow(10, decimales)) / Math.pow(10, decimales);
} 
function calculaPrecio(importe,checked)
{
var precio=document.getElementById("Totalprecio").value;

 // precio= precio.replace(".","");
 
precio=precio.replace(".","");
 precio= precio.replace(",",".");
 


if (checked)
{

var importes=parseFloat(precio) +parseFloat(importe);

}
else
{

var importes=parseFloat(precio) -parseFloat(importe);
 
}
importes=redondear(importes,2);



// var imp = numFormat(importes,2,false);
document.getElementById("Totalprecio").value=importes.toString().replace(".",",");
// document.getElementById("Totalprecio").value=imp;
}



function calcularSeguroAsistencia(importe,importe2,personas,codigo,fila)
{
document.getElementById("hidenNpersonasAseguradas").value=personas.toString();
var precioSeguroAnterior=document.getElementById("HidenprecioSeguroAnterio").value.replace(",",".");
var precio=document.getElementById("Totalprecio").value.replace(",",".");
var importes=parseFloat(precio) -parseFloat(precioSeguroAnterior);

if (personas=="0")
{
document.getElementById("HiddenCodigoSeguro").value="";
}
else
{
document.getElementById("HiddenCodigoSeguro").value=codigo;
}
var sup =document.getElementById("HIDDENseguro").value;

//importe=importe.toString().replace(",",".");  
importe=importe+"."+importe2;
var totSeguro=parseFloat(importe) *parseFloat(personas);

var precTotal=parseFloat(importes) +parseFloat(totSeguro);
importes=redondear(precTotal,2);



// var imp = numFormat(importes,2,false);
document.getElementById("Totalprecio").value=importes.toString().replace(".",",");
//calculaPrecio(importe,checked);
totSeguro=redondear(totSeguro,2);

sup=totSeguro.toString().replace(".",",");
document.getElementById("HidenprecioSeguroAnterio").value=sup;

document.getElementById("HIDDENseguro").value=sup;
document.getElementById("tx"+fila).value=sup;
document.getElementById("txPrecioSeguro").value=sup;
document.getElementById("HiddenPrecioSeguro").value=sup;

}



function registrarSeguro(importe,importe2,checked)
{
var sup =document.getElementById("HIDDENseguro").value;

//importe=importe.toString().replace(",",".");  
importe=importe+"."+importe2;

calculaPrecio(importe,checked);
if (checked)
{
sup=importe.replace(".",",");
}
else
{
sup="0";
}

document.getElementById("HIDDENseguro").value=sup;


}

 function crearCapa(producto)
        {
       var flash='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"'
            +'width="500" height="350">'
            +'<param name="movie" value="espera_3.swf?numero='+producto+'&tipo=2">'
            +'<param name="quality" value="high">'
            +'<embed src="espera_3.swf?numero='+producto+'&tipo=2" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"'
             +'   type="application/x-shockwave-flash" width="500" height="350">'
        +'</embed>'
        +'</object>';
            //var myFlash =  new ("espera.swf");
       document.getElementById("cargando").innerHTML=flash;     
       // document.write(flash);
      
        
        
        }
          
        
        function TamVentana() {
  var Tamanyo = [0, 0];
  if (typeof window.innerWidth != 'undefined')
  {
    Tamanyo = [
        window.innerWidth,
        window.innerHeight
    ];
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth !=
      'undefined' && document.documentElement.clientWidth != 0)
  {
 Tamanyo = [
        document.documentElement.clientWidth,
        document.documentElement.clientHeight
    ];
  }
  else   {
    Tamanyo = [
        document.getElementsByTagName('body')[0].clientWidth,
        document.getElementsByTagName('body')[0].clientHeight
    ];
  }
  return Tamanyo;
}
 function ModificarCapa(capa)
 {
 capaGeneral=capa;
 
 }      
 
 
 
 
 
 
 
 
 //servicios Nieve
 

    var campo="";
    var fila="";
    var niños="";
    var adultos="";
    var senior="";
    var discapacitados="";
    
    function limpiar2()
{ 

var filas=parseInt(document.getElementById("txtTotalFilas").value);
     
for(f=2;f<filas+2;f++)
       
      
       {  
       var numfila = padleft(f,'0',2);
               document.getElementById("ddNEntradasNiños"+numfila).selectedIndex=0;
              document.getElementById("ddNEntradasAdultos"+numfila).selectedIndex=0;
             document.getElementById("ddNEntradasSenior"+numfila).selectedIndex=0
            document.getElementById("ddNEntradasDiscapacitados"+numfila).selectedIndex=0;
            document.getElementById("GridTarifaEntradas_ctl"+numfila+"_Total").value=0;
      
       
       
         
     
        }

  
   
       campo="";
  fila="";
   niños="";
   adultos="";
   senior="";
   discapacitados="";
      
        
           document.getElementById("txtEntradas").value="";
            document.getElementById("txtCodigos").value="";
             document.getElementById("txtposicion").value="";
             document.getElementById("txtTotalEntradas").value="0";
        document.getElementById("Hiddenniños").value="";
         document.getElementById("HiddenAdultos").value="";
          document.getElementById("Hiddendiscapacitados").value="";
           document.getElementById("Hiddensenior").value="";
           document.getElementById("Hiddendiscapacitados").value="";
           document.getElementById("Hiddensenior").value="";
        document.getElementById("HiddenFechastotales").value="0";
         document.getElementById("HiddenFilasTotales").value="0";
       compboton();
            

}
    function compboton()
      {
     
      if ( document.getElementById("txtTotalEntradas").value=="0")
      {
   
      document.getElementById("Reservar").disabled="disabled";
      }
      else
      {
     
       document.getElementById("Reservar").disabled="";
      }
      
      } 
      var codiTarifas="";
      var temporadastotal="";
      var impninos="";
      var impadultos="";
      var impsenior="";
      var impdiscapacitados="";
      var temporadasServicio="";
      var fechainicio;
      var numeroFila=0;
      var tempodadasplanning;
      var impninos2="";
       function abrirFechas(fecha, planning, temporadas,fila,codTarifa,tottemporadas,importeniños,importeniños_2,importeAdultos,importeSenior,importediscapacitados,estanciaInicio,estanciaFin)
       {
    
         
       temporadasServicio=tottemporadas;
       impninos=importeniños;
       impninos2=importeniños_2;
       impadultos=importeAdultos;
      impdiscapacitados=importediscapacitados;
       impsenior=importeSenior;
       codiTarifas=codTarifa;
       temporadastotal=temporadas;
       tempodadasplanning=planning;
      
    
      // fila=filas;
       //niños=niñoss;
       //adultos=adultoss;
       //senior=seniors;
       //discapacitados=discapacitadoss;
       
        var formatoInicio=estanciaInicio.split("/"); 
            
         var startDate1=formatoInicio[2]+formatoInicio[1]+formatoInicio[0];
         
         var formatoFin=estanciaFin.split("/");
         var endDate= formatoFin[2]+formatoFin[1]+formatoFin[0];
       
                  campo="fechaEntradas"+fila;
                 
                  numeroFila=fila;
                  
         var formato=fecha.split("/");
         var title =  '<table width=450><tr><td align="center">'+'</td></tr><tr><td align="center" colspan="2">pulse la fecha que desee comprar la entrada</td></tr><tr><td  style="background-color:#15a501;">Conforme</td><td style="background-color:#FF0000;">Petición</td></tr></table>';  
        C1WebCalendar1_Client.SelectedDate= document.getElementById(campo).value;
         C1WebCalendar1_Client.SelectedDates = new DateCollection([]);
         C1WebCalendar1_Client.DisabledDates = new DateCollection([]);
         C1WebCalendar1_Client.CustomDays = new CalendarDayCollection();
         C1WebCalendar1_Client.MonthCols = 2;
         C1WebCalendar1_Client.MonthRows = 2;
        //C1WebCalendar1_Client.MaxDate = new Date("1/28/2010");
        var numero=formato[1]+formato[0];
        var startDate;
     
        //if (numero<1130)
        //{
           
           
        // startDate=new Date(12+"/"+01+"/"+"20"+formato[2]);
        
        //}
        //else
       // {
        startDate=new Date(formato[1]+"/"+formato[0]+"/"+"20"+formato[2]);
        //}
     fechainicio=startDate;
  
        // var startDate=new Date(formato[1]+"/"+formato[0]+"/"+"20"+formato[2]);
           C1WebCalendar1_Client.MinDate = startDate;
         //var formatoInicio=estanciaInicio.split("/"); 
            var diasdisabled= new DateCollection([]);
         //var startDate1=formatoInicio[2]+formatoInicio[1]+formatoInicio[0];
         //var formatoFin=estanciaFin.split("/");
         //var endDate= formatoFin[2]+formatoFin[1]+formatoFin[0];
         var diasdisabled = new Array() 

         var u=0;
   var fechadisabled="";

         for(i=0;i<planning.length;i++)
         {
         
            var fondo=planning.charAt(i);
            var temporada=temporadas.charAt(i);
            var fechaDate= fechaActual(startDate.c1_AddDays(i));
            var dia=fechaDate.substring(6)
            
            var color = "";
         if (temporada=="S")
                {
                temporada="T.SuperExtra";
                }else if (temporada=="O")
                {
                temporada="T.Oferta";
                }else if (temporada=="P")
                {
                temporada="T.Promoción";
                }else if (temporada=="B")
                {
                temporada="T.Baja";
                }else if (temporada=="M")
                {
                temporada="T.Media";
                }else if (temporada=="A")
                {
                temporada="T.Alta";
                }else if (temporada=="E")
                {
                temporada="T.Extra";
                }else if(tempora="U")
                {
                temporada="T.Unica";
                }else{}
            
            if(fondo=="C"){
            
                //if (fechaDate>=startDate1 && fechaDate<=endDate)
                //{
              
                // color = 'background-color:#15a501;color:Blue;';
                //}else
                //{
                if (dia.charAt(0)=="0")
                {
                dia=dia.charAt(1);
                }
                
            var x=dia+'</BR>'+temporada;
         
           if (fechaDate>=startDate1 && fechaDate<=endDate)
                {
              
                 color = 'background-color:#15a501;;color:White;';
                }else
                {
                      color = 'background-color:#15a501;';
                }     
                   
                //}            
//             }else if (color=="R"){
//                if (fechaDate>=startDate1 && fechaDate<=endDate)
//                {
//                    color ='background-color:Red;;color:Blue;';
//                }else{
//         	        color = 'background-color:Red;';
//                }

                C1WebCalendar1_Client.CustomDays.Add(new CalendarDay(startDate.c1_AddDays(i), new CalendarCellStyle('', color, '', ''), x));
            }
            else if(fondo=="P"){
            if (dia.charAt(0)=="0")
                {
                dia=dia.charAt(1);
                }
             var x=dia+' '+temporada;
               if (fechaDate>=startDate1 && fechaDate<=endDate)
                {
              
                 color = 'background-color:#FF0000;color:White;';
                }else
                {
                     color = 'background-color:#FF0000;';
                }        
           
            C1WebCalendar1_Client.CustomDays.Add(new CalendarDay(startDate.c1_AddDays(i), new CalendarCellStyle('', color, '', ''), x));
            
            }
            else{
               //var dias=startDate.c1_AddDays(i);
            // alert(dias);
           // Hiddenfecha
       //var uno="no";
       //C1WebCalendar1_Client.DisabledDate=  startDate.c1_AddDays(i); 
      
              document.getElementById("Hiddenfecha").value=startDate.c1_AddDays(i);
//              var dias=document.getElementById("Hiddenfecha").value;
//             
//               var dia=dias.split('/');
//             var dia1=startDate.c1_AddDays(i);//'"'+dia[1]+'/'+dia[2]+'/'+dia[0]+'"';
            diasdisabled[u]=startDate.c1_AddDays(i);
           
             u++
            
//               fechadisabled=+'"'+dia1+'"'+','+fechadisabled;
//        	        color = 'background-color:Yellow;';
        	        
                
                }
                
               
            
          
          
        }
        //alert(i);
        //C1WebCalendar1_Client.MinDate=new Date(12+"/"+1+"/"+"20"+formato[2]);
        C1WebCalendar1_Client.MaxDate = startDate.c1_AddDays(i);
       
       // var callection= new DateCollection([fechadisabled]); 
       // alert(callection);
   // C1WebCalendar1_Client.DisabledDates=  callection; 
    C1WebCalendar1_Client.DisableDates =new DateCollection(diasdisabled);
     
        C1WebCalendar1_Client.CalendarTitle = title;
        C1WebCalendar1_Client.PopupSetting.Top="40px";
        C1WebCalendar1_Client.PopupSetting.Dock = c1_dock_bottomleft;
       
        C1WebCalendar1_Client.PopupBeside(document.getElementById(campo));
         
        


     } 
     function anadir()
     {
     var entradas=document.getElementById("Hiddenvalor").value
   
     if (entradas=="")
     {
     var nombre=document.getElementById("txNombre").value;
     var apellido=document.getElementById("txApellidos").value;
      
     if (nombre!=""&&apellido!="")
     {
     document.getElementById("HiddenNumeroDeDias").value=sumaDias;
     
     var precioNinos=document.getElementById("importesNinos"+0).value;
      var precioNinos2=document.getElementById("importesNinos2"+0).value;
     var precioAdultos=document.getElementById("importesAdultos"+0).value;
     var precioSenior=document.getElementById("importesSenior"+0).value;
     var precioDiscapacitados=document.getElementById("importesDiscapacitados"+0).value;
     var valorNinos=document.getElementById("ddNEntradasNiños"+0).selectedIndex;
     var valorNinos2=document.getElementById("ddNEntradasNiños2"+0).selectedIndex;
     var valorAdultos=document.getElementById("ddNEntradasAdultos"+0).selectedIndex;
     var valorSenior=document.getElementById("ddNEntradasSenior"+0).selectedIndex;
     var valorDiscapacitados=document.getElementById("ddNEntradasDiscapacitados"+0).selectedIndex;
     var fecha=document.getElementById("fechaEntradas"+0).value;
    var peticion= document.getElementById("HiddenPeticion").value;
    document.getElementById("Hiddenfecha").value=fecha;
    document.getElementById("HiddenimporteNinos").value=precioNinos;
    document.getElementById("HiddenEntradasNinos").value=valorNinos;
     document.getElementById("HiddenimporteNinos2").value=precioNinos2;
    document.getElementById("HiddenEntradasNinos2").value=valorNinos2;
    document.getElementById("HiddenimporteAdultos").value=precioAdultos;
    document.getElementById("HiddenEntradasAdultos").value=valorAdultos;
    document.getElementById("HiddenimporteSenior").value=precioSenior;
    document.getElementById("HiddenEntradasSenior").value=valorSenior;
    document.getElementById("HiddenimporteDiscapacitados").value=precioDiscapacitados;
    document.getElementById("HiddenEntradasDiscapacitados").value=valorDiscapacitados;
     document.getElementById("HiddenPeticion").value=peticion;
     document.getElementById("HiddenMostrarCalendario").value="N";
    return true;
    }else
    {
    alert("Es necesario introducir nombre y apellidos para este servicio");
    return false;
    }
    
   }else
   {
   var precioNinos=document.getElementById("importesNinos"+0).value;
      var precioNinos2=document.getElementById("importesNinos2"+0).value;
     var precioAdultos=document.getElementById("importesAdultos"+0).value;
     var precioSenior=document.getElementById("importesSenior"+0).value;
     var precioDiscapacitados=document.getElementById("importesDiscapacitados"+0).value;
     var valorNinos=document.getElementById("ddNEntradasNiños"+0).selectedIndex;
    
     
     var valorNinos2=document.getElementById("ddNEntradasNiños2"+0).selectedIndex;
     var valorAdultos=document.getElementById("ddNEntradasAdultos"+0).selectedIndex;
     var valorSenior=document.getElementById("ddNEntradasSenior"+0).selectedIndex;
     var valorDiscapacitados=document.getElementById("ddNEntradasDiscapacitados"+0).selectedIndex;
     var fecha=document.getElementById("fechaEntradas"+0).value;
     if (fecha!="")
     {
     if (valorNinos!="0"||valorNinos2!="0"||valorAdultos!="0"||valorSenior!="0"||valorDiscapacitados!="0")
     {
   
    var peticion= document.getElementById("HiddenPeticion").value;
    document.getElementById("Hiddenfecha").value=fecha;
    document.getElementById("HiddenimporteNinos").value=precioNinos;
    document.getElementById("HiddenEntradasNinos").value=valorNinos;
     document.getElementById("HiddenimporteNinos2").value=precioNinos2;
    document.getElementById("HiddenEntradasNinos2").value=valorNinos2;
    document.getElementById("HiddenimporteAdultos").value=precioAdultos;
    document.getElementById("HiddenEntradasAdultos").value=valorAdultos;
    document.getElementById("HiddenimporteSenior").value=precioSenior;
    document.getElementById("HiddenEntradasSenior").value=valorSenior;
    document.getElementById("HiddenimporteDiscapacitados").value=precioDiscapacitados;
    document.getElementById("HiddenEntradasDiscapacitados").value=valorDiscapacitados;
     document.getElementById("HiddenPeticion").value=peticion;
      document.getElementById("HiddenMostrarCalendario").value="N";
    return true;
    
    }
    else
    { alert("seleccione las entradas deseadas");
    return false;
    }
    
    }
    else
    {
    alert("seleccione la fecha deseada");
    return false;
    }
   
   }
   
    
    
     }
    
     var sumaDias=1; 
       var capaNieve=""; 
 function Calendar_OnClose(calendar)

{

    if (calendar)
    {
    var dias="";
    var fecha1="";
      var estado="";
    var selected=calendar.SelectedDate;

 var tipoCalculo=document.getElementById(capaNieve+"HiddenCalculo").value;
 if(tipoCalculo=="H")
 
 
 {
  document.getElementById("ddNdias0").style.visibility="visible";
 
  document.getElementById("textoDias0").style.visibility="visible";
 
 }
 sumaDias=1
       if (selected!="")
       {
     
     document.getElementById("Hiddenfecha").value=calendar.SelectedDate;
         dias= document.getElementById("Hiddenfecha").value;
         
          var diaSeleccionado= dias.split('/');
        var di = diaSeleccionado[2]+diaSeleccionado[1]+diaSeleccionado[0];
         
       for(i=0;i<temporadastotal.length;i++)
         {
           document.getElementById("Hiddenfecha").value= fechainicio.c1_AddDays(i);
         var fecha1= document.getElementById("Hiddenfecha").value;
       
            var fecha1Seleccionado= fecha1.split('/');
        var fechadi = fecha1Seleccionado[2]+fecha1Seleccionado[1]+fecha1Seleccionado[0];
         
           
          
           
           if(fechadi==di)
            {
            estado= tempodadasplanning.charAt(i)
            var temporada="T"+temporadastotal.charAt(i);
          
            
            i=temporadastotal.length;
            }
            }
       
        
        var vectorTemporadas=temporadasServicio.split('|');
        var vectorimporteNinos=impninos.split('|');
        var vectorimporteNinos2=impninos2.split('|');
        var vectorimporteAdultos=impadultos.split('|');
        var vectorSenior=impsenior.split('|');
        var vectorimporteDiscapacitados=impdiscapacitados.split('|')
        var temporadaSeleccionada;
        
        for (a=0;a<vectorTemporadas.length;a++)
        {
       
        if (vectorTemporadas[a]==temporada)
        {
       
        temporadaSeleccionada=a;
        a=vectorTemporadas.length;
        }
        
        
        }
         
    
      if(temporadaSeleccionada!="undefined")
      {
       
        if (vectorimporteNinos[temporadaSeleccionada]!="0")
        {
       
       
       document.getElementById("ddNEntradasNiños"+numeroFila).style.visibility="visible";
        document.getElementById("importesNinos"+numeroFila).style.visibility="visible";
        document.getElementById("importesNinos"+numeroFila).value=vectorimporteNinos[temporadaSeleccionada];
      
        
        }
         if (vectorimporteNinos2[temporadaSeleccionada]!="0")
        {
       
       
       document.getElementById("ddNEntradasNiños2"+numeroFila).style.visibility="visible";
        document.getElementById("importesNinos2"+numeroFila).style.visibility="visible";
        document.getElementById("importesNinos2"+numeroFila).value=vectorimporteNinos2[temporadaSeleccionada];
         
        
        }
        if (vectorSenior[temporadaSeleccionada]!="0")
        {
        
         
         document.getElementById("ddNEntradasSenior"+numeroFila).style.visibility="visible";
       document.getElementById("importesSenior"+numeroFila).style.visibility="visible";
        document.getElementById("importesSenior"+numeroFila).value=vectorSenior[temporadaSeleccionada];
        
         
        }
        if (vectorimporteAdultos[temporadaSeleccionada]!="0")
        {
       
        
        document.getElementById("ddNEntradasAdultos"+numeroFila).style.visibility="visible";
       document.getElementById("importesAdultos"+numeroFila).style.visibility="visible";
        document.getElementById("importesAdultos"+numeroFila).value=vectorimporteAdultos[temporadaSeleccionada];
        
        
        }
        if (vectorimporteDiscapacitados[temporadaSeleccionada]!="0")
        {
        
        document.getElementById("ddNEntradasDiscapacitados"+numeroFila).style.visibility="visible";
        document.getElementById("importesDiscapacitados"+numeroFila).style.visibility="visible";
        document.getElementById("importesDiscapacitados"+numeroFila).value=vectorimporteDiscapacitados[temporadaSeleccionada];
         
        
        }
        var temporada1="";
         if (temporada=="TS")
                {
                temporada1="T.SuperExtra";
                }else if (temporada=="O")
                {
                temporada1="T.Oferta";
                }else if (temporada=="TP")
                {
                temporada1="T.Promoción";
                }else if (temporada=="TB")
                {
                temporada1="T.Baja";
                }else if (temporada=="TM")
                {
                temporada1="T.Media";
                }else if (temporada=="TA")
                {
                temporada1="T.Alta";
                }else if (temporada=="TE")
                {
                temporada1="T.Extra";
                }else if(tempora="TU")
                {
                temporada1="T.Unica";
                }else{}
                
                 document.getElementById("temporada"+numeroFila).style.visibility="visible";
         document.getElementById("temporada"+numeroFila).value=temporada1;
        
         if (estado=="C")
         {
         color = '#98FB98';
          document.getElementById("HiddenPeticion").value="C";
         }
         else if (estado=="P")
         {
         document.getElementById("HiddenPeticion").value="P";
          color = '#FF0000';
         }
         else
         {
         }
         
         
                  document.getElementById("temporada"+numeroFila).style.backgroundColor=color;
     document.getElementById("Hiddenfecha").value=calendar.SelectedDate;
         dias= document.getElementById("Hiddenfecha").value;
       
       
       
       
       
               dia= dias.split('/');
        document.getElementById(campo).value = dia[2]+"/"+dia[1]+"/"+dia[0];
        //calendar.SelectedDate;
        
        
      
        if (document.getElementById(campo).value!="")
        {
       
        var fechasInicio=document.getElementById("HidenFechaInicio").value
        fechasInicio+=";"+ document.getElementById(campo).value;
        document.getElementById("HidenFechaInicio").value=fechasInicio;
        var codTar=document.getElementById("HiddenCodTarifa").value
       codTar+=";"+codiTarifas;
            document.getElementById("HiddenCodTarifa").value=codTar; 
           
//        if (niños!="")
//        {   document.getElementById("ddNEntradasNiños"+fila).style.visibility="visible";}
//        if(adultos!="")
//        
//        {document.getElementById("ddNEntradasAdultos"+fila).style.visibility="visible";}
//        if(senior!="")
//        {document.getElementById("ddNEntradasSenior"+fila).style.visibility="visible";}
//        if(discapacitados!="")
//        {document.getElementById("ddNEntradasDiscapacitados"+fila).style.visibility="visible";}
        
        }
        }
        
        }
        }

}

  
   function calculaImporte(precios,txtTotal)
{
//var precio=document.getElementById("Totalprecio").value;
  

//var precios=parseFloat(importe) *parseFloat(entradas);

//var ant=document.getElementById(txtTotal).value
//ant=ant.replace(",",".");

precios=redondear(precios,2);
var totalDelPrecio=parseFloat(precios);

document.getElementById(txtTotal).value=totalDelPrecio.toString().replace(".",",");


}  

function calcular(fila)
{

var precioNinos=document.getElementById("importesNinos"+fila).value;
var precioNinos2=document.getElementById("importesNinos2"+fila).value;
var precioAdultos=document.getElementById("importesAdultos"+fila).value;
var precioSenior=document.getElementById("importesSenior"+fila).value;
var precioDiscapacitados=document.getElementById("importesDiscapacitados"+fila).value;
var precios=0;

             
if (precioNinos!="")
{

var valor=document.getElementById("ddNEntradasNiños"+fila).selectedIndex;
importe=precioNinos.replace(",",".");
precios=precios+(parseFloat(importe)*parseFloat(valor))*parseFloat(sumaDias);
}
if (precioNinos2!="")
{

var valor=document.getElementById("ddNEntradasNiños2"+fila).selectedIndex;
importe=precioNinos2.replace(",",".");
precios=precios+(parseFloat(importe)*parseFloat(valor)*parseFloat(sumaDias));
}
if (precioAdultos!="")
{
var valor=document.getElementById("ddNEntradasAdultos"+fila).selectedIndex;
importe=precioAdultos.replace(",",".");
precios=precios+(parseFloat(importe)*parseFloat(valor)*parseFloat(sumaDias));
}
if (precioSenior!="")
{
var valor=document.getElementById("ddNEntradasSenior"+fila).selectedIndex;
importe=precioSenior.replace(",",".");
precios=precios+(parseFloat(importe)*parseFloat(valor)*parseFloat(sumaDias));
}
if (precioDiscapacitados!="")
{
var valor=document.getElementById("ddNEntradasDiscapacitados"+fila).selectedIndex;
importe=precioDiscapacitados.replace(",",".");
precios=precios+(parseFloat(importe)*parseFloat(valor)*parseFloat(sumaDias));
}


    precios=redondear(precios,2);
var totalDelPrecio=parseFloat(precios);

document.getElementById("total"+fila).value=totalDelPrecio.toString().replace(".",",");    



}
    

     
        
   


     function abrirVentanaParques(dialogo)
     {
     var valor=document.getElementById("hiddencodigo").value
     var url="images/parques/"+valor+".jpg";
    
        form_dialog = dialogo.control;
        form_dialog.setUrl(url);
        form_dialog.show();
     } 
     
 
      function anadirReserva()
     {
    var nombre=document.getElementById("ctl13_txNombreServicios").value;
     var apellido=document.getElementById("ctl13_txApellidosServicios").value;
     //alert(nombre);
     //alert(apellido);
  if (nombre!=""&&apellido!="")
  {
   document.getElementById("ctl13_HiddenNumeroDeDias").value=sumaDias;
     var precioNinos=document.getElementById("importesNinos"+0).value;
      var precioNinos2=document.getElementById("importesNinos2"+0).value;
     var precioAdultos=document.getElementById("importesAdultos"+0).value;
     var precioSenior=document.getElementById("importesSenior"+0).value;
     var precioDiscapacitados=document.getElementById("importesDiscapacitados"+0).value;
     var valorNinos=document.getElementById("ddNEntradasNiños"+0).selectedIndex;
     var valorNinos2=document.getElementById("ddNEntradasNiños2"+0).selectedIndex;
     var valorAdultos=document.getElementById("ddNEntradasAdultos"+0).selectedIndex;
     var valorSenior=document.getElementById("ddNEntradasSenior"+0).selectedIndex;
     var valorDiscapacitados=document.getElementById("ddNEntradasDiscapacitados"+0).selectedIndex;
     var fecha=document.getElementById("fechaEntradas"+0).value;
    var peticion= document.getElementById("HiddenPeticion").value;
    if (valorNinos!="0"||valorNinos2!="0"||valorAdultos!="0"||valorSenior!="0"||valorDiscapacitados!="0")
    {
     document.getElementById("HiddenCargarDatos").value=0;
    document.getElementById("ctl13_UpdatePanel1").style.visibility="hidden";
    document.getElementById("importesNinos"+0).style.visibility="hidden";
    document.getElementById("importesNinos2"+0).style.visibility="hidden";
    document.getElementById("importesAdultos"+0).style.visibility="hidden";
    document.getElementById("importesSenior"+0).style.visibility="hidden";
    document.getElementById("importesDiscapacitados"+0).style.visibility="hidden";
    document.getElementById("ddNEntradasNiños"+0).style.visibility="hidden";
    document.getElementById("ddNEntradasNiños2"+0).style.visibility="hidden";
    document.getElementById("ddNEntradasAdultos"+0).style.visibility="hidden";
    document.getElementById("ddNEntradasSenior"+0).style.visibility="hidden";
    document.getElementById("ddNEntradasDiscapacitados"+0).style.visibility="hidden";
    document.getElementById("fechaEntradas"+0).style.visibility="hidden";
   document.getElementById("temporada"+0).style.visibility="hidden";
    
    
    document.getElementById("Hiddenfecha").value=fecha;
    document.getElementById("HiddenimporteNinos").value=precioNinos;
    document.getElementById("HiddenEntradasNinos").value=valorNinos;
     document.getElementById("HiddenimporteNinos2").value=precioNinos2;
    document.getElementById("HiddenEntradasNinos2").value=valorNinos2;
    document.getElementById("HiddenimporteAdultos").value=precioAdultos;
    document.getElementById("HiddenEntradasAdultos").value=valorAdultos;
    document.getElementById("HiddenimporteSenior").value=precioSenior;
    document.getElementById("HiddenEntradasSenior").value=valorSenior;
    document.getElementById("HiddenimporteDiscapacitados").value=precioDiscapacitados;
    document.getElementById("HiddenEntradasDiscapacitados").value=valorDiscapacitados;
     document.getElementById("HiddenPeticion").value=peticion;
     var codigoSeguro=document.getElementById("HiddenCodigoSeguro").value;
     var precioFila= document.getElementById("total0").value;
     var precioSumado=document.getElementById("txPrecioExtra").value;
   
     var precios=parseFloat(precioFila.replace(",","."))+parseFloat(precioSumado);
     var precioSeguro=document.getElementById("txPrecioSeguro").value;
     precioSeguro=precioSeguro.replace(",",".");
     var totalReserva=document.getElementById("HiddenPrecioOriginal").value;
     if (codigoSeguro=="2")
     {
     precioSeguro=(parseFloat(totalReserva.replace(",","."))+precios)*0.09;
     var seguro=redondear(precioSeguro,2);
     
     document.getElementById("tx"+6).value=seguro.toString().replace(".",",");
     
     }
     var suplementoSeleccionado=document.getElementById("HiddenSuplementosPrecio").value;
     var totales=parseFloat(precioSeguro)+parseFloat(totalReserva)+parseFloat(precios)+parseFloat(suplementoSeleccionado);
     var  extra=redondear(precios,2);
     document.getElementById("txPrecioExtra").value=extra.toString().replace(".",",");
     var precioSeguro=redondear(precioSeguro,2);
     document.getElementById("txPrecioSeguro").value=precioSeguro.toString().replace(".",",");
     var tot=redondear(totales,2)
     document.getElementById("Totalprecio").value=tot.toString().replace(".",",");;
     
     
     
    return true;
    }else
    {
    document.getElementById("HiddenCargarDatos").value=1;
    alert("Es necesario Indircar numero de personas");
    return false;
    }
    
  }
   
   
    
     }
     function atras()
     {
    
     history.go(-3);
     }
         
         
         
         //funciones modificacion
         function incrementaDias1 (fecha, dias)
  {
   //Obtenemos las variables de la fecha
   // dia de la fecha  
   milisegundos=parseInt(parseInt(dias)*24*60*60*1000);
   
   var dia = fecha.getDate();
    var  tiempo=fecha.getTime();
   total=fecha.setTime(parseInt(tiempo+milisegundos));
   dia1=padleft(fecha.getDate(),"0",2);
   mes=padleft(fecha.getMonth()+1,"0",2);
   anio=fecha.getYear();

   // a?o de la fecha 
    var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0); 
    if(isIE)
    {
   
   return mes+"/"+dia1+"/"+anio;
   }else
   {
      
   
   anio=new Date().getFullYear();
   return mes+"/"+dia1+"/"+anio;
   }
}

function decrementoDias1 (fecha, dias)
  {
   //Obtenemos las variables de la fecha
   // dia de la fecha  
   milisegundos=parseInt(parseInt(dias)*24*60*60*1000);
   
   var dia = fecha.getDate();
    var  tiempo=fecha.getTime();
total=fecha.setTime(parseInt(tiempo-milisegundos));
dia1=padleft(fecha.getDate()+1,"0",2);
mes=padleft(fecha.getMonth()+1,"0",2);
anio=fecha.getYear();

   // a?o de la fecha 
    var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0); 
    if(isIE)
    {
   
   return mes+"/"+dia1+"/"+anio;
   }else
   {
      
   
   anio=new Date().getFullYear();
   return mes+"/"+dia1+"/"+anio;
   }
}

function fechaHastaChange()
      {
     var capa="";
  
      //Object calendario;
      //calendario=;
     
      // var startDate=new Date(09+"/"+10+"/"+"2009");
  
      var numNoches=document.getElementById(capa+'DDN').value;
      var diaMinimoSalida=CC1_Client.SelectedDate;
     
     
      var diaEntrada=CC1_Client.SelectedDate;
      var  diaSalida=incrementaDias1(diaEntrada,numNoches);
 
    // CC2_Client.SelectedDate=startDate;
     C1WebDateEdit2Obj.set_Text(diaSalida);
       // CC2_Client.MinDate = startDate;
  
   var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0); 
    if(isIE)
    
    {
    var minimoDias=decrementoDias1(diaEntrada,numNoches);

     CC2_Client.MinDate= new Date(minimoDias);
    
    }
    else{
    
   CC2_Client.MinDate =CC1_Client.SelectedDate;
    }
  
  
  }
 
  function fechaHastaDias()
  {
   var capa="";
  var diferencia = C1WebDateEdit2Obj.get_Date() - C1WebDateEdit1Obj.get_Date() ;  
 var dias = Math.floor(diferencia /(1000 * 60 * 60 * 24))  ;
 document.getElementById(capa+'DDN').value=dias;

//  alert(C1T1_CP1_C1WebDateEdit2Obj.get_Date());
  
  }


try {
var pageTracker = _gat._getTracker("UA-5445664-2");
pageTracker._trackPageview();
} catch(err) {}
         //fin funciones modificacion
         
         
         
         
         
         
         
           function muestraParquesB() 
    {    
  
        if (GBrowserIsCompatible()) 
        {   
            var latitudCentro = 39.909736;
            var longitudCentro = -3.691406;
            var map = new GMap2(document.getElementById("map_canvas"));        
            map.setCenter(new GLatLng(latitudCentro, longitudCentro), 5); 
            map.disableDoubleClickZoom();
//            map.disableDragging();
            var icono_pl = new GIcon(G_DEFAULT_ICON);
            icono_pl.image = "http://www.primeralinea.com/fotos/recursos/estaticos/pincho.png";
//            icono_pl.iconSize = new GSize(32, 34);  
            markerOptions = { icon:icono_pl };          
            function createMarker(point, nombre, html) 
            {  
                //var marker = new GMarker(point);  
                var marker = new GMarker(point, markerOptions);  
//                marker.value = number;  
                GEvent.addListener(marker, "click", 
                    function() 
                    {    
                        var myHtml = html; 
                      
                        map.openInfoWindowHtml(point, myHtml);  
                    }
                );  
                
                GEvent.addListener(map, "infowindowclose",
                    function() 
                    {    
                        map.setCenter(new GLatLng(latitudCentro, longitudCentro), 5);
                    }
                );  
                
                return marker;
            }
            

            var totalFilas = document.getElementById("HiddenField1").value;
            puntos = new Array(totalFilas);
            
            var nombre;
            var latitud;
            var longitud;
            var numero=parseInt(totalFilas)+2;          
            for (var i=2;i<numero;i++)
            {
          
                nombre = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbNombre").value;
                html = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbHtml").value;
               
                
                
                var parque=html.indexOf("parque",40);
                var href=html.indexOf("href",40);
                var string=html.substring(href+6,parque+7); 
                var separador=html.substring(href+6,parque+7); 
               //var codigo=html.substring(parque+7,parque+11);
              var split=html.split(separador);
               for (var h=1;h<split.length;h++)
            {
            var contenido=split[h];
            
            var codigo=contenido.substring(0,4);
            var string2=string+codigo;
               html= html.replace(string2,"Javascript:redireccionar2('"+codigo+"')");
               
               }
               
            
                latitud = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbLatitud").value;
                longitud = document.getElementById("GridView1_ctl" + padleft(i,'0',2) + "_tbLongitud").value;
            
                
                puntos[i-2] = new GLatLng(latitud,longitud);
                map.addOverlay(createMarker(puntos[i-2], nombre, html));
                
            }
            
        }    
    }  
    
      function redireccionar2(parque)
{
parent.document.getElementById("ResultadosBusqueda").src="entradas.aspx?sesion=&parque="+parque
 parent.document.getElementById("divBuscar").style.zIndex=-100 ;
    parent.document.getElementById("divBuscar").style.visibility="hidden";
   parent.document.getElementById("divBuscar").style.position="absolute";
 parent.document.getElementById("TabContainer1").style.zIndex=-100 ;
   // document.getElementById("TabContainer1").style.visibility="hidden";
   parent.document.getElementById("TabContainer1").style.position="absolute";  
   parent.document.getElementById("ctrPdf").style.visibility="hidden";
    // document.getElementById("TabContainer1").style.width="0px";
//document.getElementById("TabContainer1").style.height ="0px";
parent.document.getElementById("TabContainer1").style.top ="30px";
   parent.document.getElementById("TabContainer1").style.left ="120px"; 
  parent.document.getElementById("TabContainer1").style.visibility="hidden";
   // parent.document.getElementById("IParques").style.height="0px";
//parent.document.getElementById("iframe").style.height ="700px";
   //document.getElementById("TabContainer1").style.left ="120px";
  // document.getElementById("divBuscar").style.height ="0px";
//document.getElementById("divBuscar").style.width ="0px";
   parent.document.getElementById("divBuscar").style.top ="0px";
   parent.document.getElementById("divBuscar").style.left ="40px"; 
parent.document.getElementById("ResultadosBusqueda").style.width="975px";
parent.document.getElementById("ResultadosBusqueda").style.height ="600px";
parent.document.getElementById("ResultadosBusqueda").style.visibility="visible";
//parent.document.getElementById("marco").style.scroll="auto";
}