﻿var pathBookingS=""
var pathBookingR=""
var pathBooking=""

function ajax_box_open(){
    var prima=true;
    if(prima){
        document.getElementById("ajax_box_overlay").style.height=(getPageSize()[1]).toString()+"px"
        document.getElementById("ajax_box").style.top=(50+getScrollY()).toString()+"px"
    }
    prima=false;
    document.getElementById("ajax_box").style.display="block"
    document.getElementById("ajax_box_overlay").style.display="block"
    document.getElementById("gallery").style.visibility="hidden"
}
function ajax_box_close(){
    document.getElementById("gallery").style.visibility="visible"
    document.getElementById("ajax_box").style.display="none"
    document.getElementById("ajax_box_overlay").style.display="none"
    document.getElementById("cartina").style.display="none"
    document.getElementById("promozione").style.display="none";
}

function open_map(){
    var str="<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"560\" height=\"550\" align=\"middle\" id=\"Mappa\" name=\"Mappa\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ><param name=\"movie\" value=\"Mappa.swf\" /><embed src=\"Mappa.swf\" type=\"application/x-shockwave-flash\" width=\"560\" height=\"550\"></embed> </object>"
    document.getElementById("ajax_box_container_titolo").innerHTML=aj_title_cartina;
    document.getElementById("cartina").innerHTML=str
    document.getElementById("cartina").style.display="block";
    ajax_box_open()
}

function open_promozione(){
    document.getElementById("promozione").style.display="block";
    document.getElementById("ajax_box_container_titolo").innerHTML=document.getElementById("promozione_titolo").innerHTML
    
    ajax_box_open()
}

function map_sel(codice){
    document.location="elenco_strutture"+lingua_codice_path+".aspx?zona="+codice;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}



function Booking(codice,tipo,age,pro,azione){
    if(tipo=="P"){
    }
    else{
        var path=pathBookingS
        if(tipo=="R")
            path=pathBookingR       
        path=path+"&CdR="+codice
        if(age!="")
            path=path+"&age="+age
        if(pro!="")
            path=path+"&pro="+pro
        if(azione!="")
            path=path+"&azione="+azione
        var winBooking=window.open(path,"_blank")
    }
}

function modPrezzi(tipo){
    document.getElementById("ctl00_ContentPlaceHolder1_hidTipoListino").value=tipo
}

/* Guestbook    */
function VerTrattamenti(source, arguments){
	arguments.IsValid = document.getElementById("ctl00_ContentPlaceHolder1_chkTrattamentoDati").checked	
}
function VerPrivacy(source, arguments){
	arguments.IsValid = document.getElementById("ctl00_ContentPlaceHolder1_chkPrivacy").checked	
}
function AllegaFoto(Lingua){
	var winAllega=window.open("guestbook_upload"+Lingua+".aspx?Nome="+document.getElementById("ctl00_ContentPlaceHolder1_hidNomeFoto").value,"Upload","top=300,left=250,width=400,height=350,toolbars=no,scrollbars=no")
	winAllega.focus();
}
function Allegato(Nome){
	document.getElementById("livNomeFile").innerText=" "+Nome
	document.getElementById("livAllegato").style.visibility="visible"
}
function Zoom(Id,altezza,Lingua){
	altezza=altezza+65;
	var winZoom=window.open("guestbook_zoom"+Lingua+".aspx?Id="+Id,"Zoom","scrollbars=yes,resizable=yes,top=20, left=20, width=440,height="+altezza+",status=no,location=no,toolbar=no")
	winZoom.resizeTo(470,altezza+55)
	winZoom.focus()
}
function GoToArea(cod){
    document.location="elenco_strutture"+lingua+".aspx?zona="+cod
}