// JavaScript Document
// Copyright (c) 2004 handStudio. $Revision: 1.00 $ 

// Rileva il tipo di browser utilizzato
// Questa stessa cosa è possibile anche tramite PHP
browserDescription = function () {
	this.appN = navigator.appName.toLowerCase();
	this.appV = parseInt(navigator.appVersion);
	this.ua = navigator.userAgent.toLowerCase();
	this.plt = navigator.platform.toLowerCase();
	
	// reset appV string incorrect user agent
	if (this.ua.indexOf('opera/7') != -1 || this.ua.indexOf('opera 7') != -1) {
		this.appV = 7;
	}
	
	return this;
}

// Evaluta la selezione in un TAG <SELECT>, dove value contiene un URL
function MM_jumpMenu(targ,selObj){ //v3.1
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}

// Apre una finestra al centro dello schermo
function popupWindow(url, tit, w, h, res, scr) {
 var lef = (screen.width - w) / 2;
 var top = (screen.height - h) / 2;
 window.open(url,tit,"left="+ lef +",top="+ top +",width="+w+",height="+h+",toolbar=0,scrollbars="+scr+",location=0,status=0,menubar=0,resizable="+res);
}

// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload() { 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++) {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

// Apre una popup Window per la stampa
function printPage() { // v1.0
 popupWindow("printpage.php","Printing",700,500,1,1);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages(fromPath) {
	if (document.images) {
		nav_home_sel = newImage(fromPath+"nav_home_sel.gif");
		nav_prenota_sel = newImage(fromPath+"nav_prenota_sel.gif");
		nav_hotel_sel = newImage(fromPath+"nav_hotel_sel.gif");
		nav_dovesiamo_sel = newImage(fromPath+"nav_dovesiamo_sel.gif");
		nav_contatti_sel = newImage(fromPath+"nav_contatti_sel.gif");
		preloadFlag = true;
	}
}
//
function preloadImagesSuite(fromPath) {
	if (document.images) {
		doppiadeluxe_sel = newImage(fromPath+"doppiadeluxe_sel.jpg");
		doppiastd_sel = newImage(fromPath+"doppiastd_sel.jpg");
		junior_sel = newImage(fromPath+"junior_sel.jpg");
		minisuite_sel = newImage(fromPath+"minisuite_sel.jpg");
		penthouse_sel = newImage(fromPath+"penthouse_sel.jpg");
		preloadFlag = true;
	}
}