﻿// JScript File

// codi per deshabilitar boto dret.
//var message="Boton derecho deshabilitado.";
//function click(e) 
//{
//    if (document.all) if (event.button == 2){alert(message);return false;}    
//    if (document.layers) if (e.which == 3){alert(message);return false;}    
//}

//if (document.layers) document.captureEvents(Event.MOUSEDOWN);
//document.onmousedown=click;
// fi codi deshabilitar boto dret.

function clickIE() 
{
	if (document.all) { return false; }
} 
function clickNS(e)
{
	if (document.layers||(document.getElementById&&!document.all))
	{ 
		if (e.which==2||e.which==3) { return false; }
	}
} 
if (document.layers)
{
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
} 
else
{
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
} 
document.oncontextmenu=new Function("return false");


function checkEnlacesMapfre(lb) {
	//alert(lb.value);
	switch(lb.value) {
		case "1" :
			//document.location.href = "http://www.serhstourism.com";
			window.open("http://www.serhstourism.com");
			break;
		case "2" :
			// document.location.href = "http://www.serhs.es";
			window.open("http://www.serhs.es");
			break;		
		}
}

//Función MouseOver
function imgover(imgname, img){
	imgname.src = img
	parent.location.href
}
//Función MouseOut
function imgout(imgname, img){
	imgname.src = img
}

function imprimirPagina() 
{
    if (window.print)
		window.print();
	else
		alert("En su navegador no se puede ordenar imprimir documentos.");
}
function tancarPagina() 
{
    window.close();
}

function atras()
{
    history.back();
}

function Obre() {
    var url = "../b2b/descripcionAlojamiento.aspx";
    window.open(url,'Ficha','_blank','width=460,height=480,scrollbars=yes');
    
}
function ajustarTamany(horiz, vertic) {
    window.resizeTo(horiz, vertic);
    
}
function VerMenu(url)
{
   window.open(url,'Menu','width=380,height=382,scrollbars=yes'); 
}

function VerPista(url)
{   
    window.open(url,'Ficha','width=770,height=400,scrollbars=yes');
}

function VerFicha(H,P,VP)
{
    if(H.indexOf('(') == 0) H = H.substring(1,H.length-1);
    if(H.length != 6){VerCircuito(H);}else{window.open('../b2b/descripcionAlojamiento.aspx?Id='+H+'&Prov='+P+"&VP="+VP,'Ficha','width=615,height=477,scrollbars=yes');}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
 }
function ObreF1() 
{
    window.open('../img/destacados/MapaF1.htm','Cómo_llegar','width=705,height=490,scrollbars=no, toolbar=no,location=no, directories=no, status=no, menubar=no');    
}
function VerFichaPrint(H,P,VP)
{
    if(H.length == 3) {
        VerCircuito(H);        
    } else {
        window.open('../b2b/descripcionAlojamientoPrint.aspx?Id='+H+'&Prov='+P+"&VP="+VP,'Ficha','width=621,height=477,scrollbars=yes');
    }
}

function VerCircuito(C)
{
    window.open('../b2b/RoundtripInfo.aspx?master=MasterBlanca&roundtrip=' + C, 'Circuito', 'width=600, height=600, scrollbars=yes');
}

function VerPrecios(H, P, TA, O)
{
    url = "../b2b/frmAccommodationPrices.aspx?A=" + H + "&P=" + P + "&TA=" + TA + "&O=" + O;
    parent.opener.location.href=url;
    window.close();
}

 function mOvr(src,clrOver) {
 if (!src.contains(event.fromElement)) {
	 src.style.cursor = 'hand';
	 src.bgColor = clrOver;
	}
 }
 
 function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	 src.style.cursor = 'default';
	 src.bgColor = clrIn;
	}
 } 
 
 /**
 * retorna un element de formulari acabat en un nom.
 */
function getElement(frm2, name) {
	var i;
	var j;
	var s;
	var frm;
	for (i = 0; i < document.forms.length; i++) {
		frm = document.forms[i];
		for (j = 0; j < frm.length; j++) {
			s = frm.elements[j].name;
			if (s.search(name) != -1) {
				return frm.elements[j];
			}
		}
	}
}

/**
 * Llegeix el camp ocult amb la info de l'idioma
 */
function getCulture() {
	var hid;
	hid = getElement(document.forms[0], "hidCulture");
	if (hid != undefined) {
		return hid.value;
	} else {
		return "undefined";
	}
}

/**
 * Llegeix el camp ocult amb la data del servidor
 */
function getTodayStr() {
	var hid;
	hid = getElement(document.forms[0], "hidToday");
	if (hid != undefined) {
		return hid.value;
	} else {
		return "undefined";
	}
}


function prova (hotel){alert(hotel);}
 
var estat = 0;
function visible(capa)
{
    if (estat != 0 && estat != capa) document.getElementById(estat).style.display = 'none';
    if (document.getElementById(capa).style.display == 'none') document.getElementById(capa).style.display = 'block';
    else document.getElementById(capa).style.display = 'none';
    estat = capa;
}

function Obrepopup(url,params){window.open(url,'RSS','_blank',params);}

function disableControl(sender) 
{
    sender.disabled=true;
    return true;
}

function time()
{
   hoy = new Date();
   ann = hoy.getFullYear();
   mes = hoy.getMonth()+1;
   dia = hoy.getDate();
   hor = hoy.getHours();
   min = hoy.getMinutes();
   seg =  hoy.getSeconds();
  
   if (min < 10) min = "0"+min
   if (seg < 10) seg = "0"+seg

   window.status = dia+"/"+ mes+"/"+ ann+"  "+ hor+":"+ min+":"+ seg
   setTimeout('time()',1001);
}

function onLoad()
{
    history.go(1);
    time();
}
function confirmB2C(mailContacto){

    var strAlert = '¡¡¡ ATENCION - IMPORTANTE!!!\nSe va a conectar a un sistema de pago electrónico.\n'; 
    strAlert += 'Recuerde presionar el botón [Continuar] o [Cerrar] una vez realizado el pago de la reserva.\nSi no se ha podido realizar el pago correctamente presione el botón [Cerrar].\n'; 
    strAlert += 'El proceso de reserva finaliza en el momento de la aparición del número de reserva asignado.\n'; 
    strAlert += 'Para cualquier duda o problema contacte con: ' + mailContacto; 
    alert(strAlert);
    return true;
}
function Calendar_y2k(number) { return (number < 1000) ? number + 1900 : number; }

function Calendar_daysElapsed(date1,date2,nightsDays) {
    var difference = Date.UTC(Calendar_y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0) - Date.UTC(Calendar_y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);
    var returnValue = difference/1000/60/60/24;
    if (nightsDays && nightsDays=="d") returnValue++;
    
    return returnValue;
}