
/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated Oct 21st, 2003.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined")
revivecontent()
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate




//aaa#################

 function PopupImage(img) {
 titolo="image";
 w=open("",'image','width=20,height=20,toolbar=no,scrollbars=no,resizable=yes,top=0,left=0');
 w.document.write("<HTML><HEAD><TITLE>"+titolo+"</TITLE><META HTTP-EQUIV='imagetoolbar' CONTENT='no'></HEAD>");
 w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
 w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
 w.document.write("");
 w.document.write("</BODY></HTML>");
 w.document.close();
 }

      function GoTo(lg)  { 
         var url = window.location.pathname;
         var host_string = window.location.host;
         if (host_string.indexOf('www') != -1)  {    

            if (window.location.pathname.indexOf('/reservation/')==-1) { 
                     var queryObj = buildQueryObj(document.location.search);
                     queryObj['lg'] = lg;
                     url += buildQueryStr(queryObj);
                } 
            else  {
               var queryObj = buildQueryObj(document.location.search);
               var path = String(window.location.pathname);
               path = path.replace(/^(\/[a-z]{2,2}\/reservation\/)/i,"/"+lg+"/reservation/");
               url = 'http://www.' + path;
               url += buildQueryStr(queryObj);

            } 
          } 
         else {     // *******  SEO static link  ********

              url = host_string + url;
              url = url.substring(2, url.length);
              url = lg+url;
              url = 'http://'+url;
              var queryObj = buildQueryObj(document.location.search);
              queryObj['lg'] = lg;
              url += buildQueryStr(queryObj);

          } 




          location.href = url;
         return void 0;
       } 

function lib_bwcheck(){
   this.ver=navigator.appVersion
   this.agent=navigator.userAgent
   this.dom=document.getElementById?1:0
   this.opera5=this.agent.indexOf("Opera 5")>-1
   this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
   this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
   this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
   this.ie=this.ie4||this.ie5||this.ie6
   this.mac=this.agent.indexOf("Mac")>-1
   this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
   this.ns4=(document.layers && !this.dom)?1:0;
   this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
   return this
}
var bw=new lib_bwcheck()

if(document.layers){ //NS4 resize fix...
   scrX= innerWidth; scrY= innerHeight;
   onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}

function makeChangeTextObj(obj){
      this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;
      this.writeref = bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj].document:0;
   this.writeIt = b_writeIt;
}

//ChangeText object constructor
function b_writeIt(text,num,div_num){
   this.writeref.innerHTML = text
}

//for userrating
function makeChangeTextObj_userrating(obj){
      this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;
      this.writeref = bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj].document:0;
   this.writeIt = b_writeIt_userrating;
}
function b_writeIt_userrating(text){
   this.writeref.innerHTML = text

}

if (bw.bw){
   //Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
   bw.opera5 = (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?true:false
   if (bw.opera5) bw.ns6 = 0
}

/****
Variables to set
****/
img=new Array()
title_img=new Array()
text_title=new Array()
mytext=new Array()
size=new Array()
max_size=new Array()









/**
 *
 * Can show a tooltip over an element
 * Content of tooltip is the title attribute value of the element
 * copyright 2004 Laurent Jouanneau. http://ljouanneau.com/soft/javascript
 * release under LGPL Licence
 * works with dom2 compliance browser, and IE6. perhaps IE5 or IE4.. not Nestcape 4
 *
 * To use it :
 * 1.include this script on your page
 * 2.insert this element somewhere in your page
 *       <div id="tooltip"></div>
 * 3. style it in your CSS stylesheet (set color, background etc..). You must set
 * this two style too :
 *     div#tooltip { position:absolute; visibility:hidden; ... }
 * 4.the end. test it ! :-)
 *
 */


// create the tooltip object
function tooltip(){}

// setup properties of tooltip object
tooltip.id="tooltip";
tooltip.offsetx = 10;
tooltip.offsety = 10;
tooltip.x = 0;
tooltip.y = 0;
tooltip.snow = 0;
tooltip.tooltipElement=null;
tooltip.title_saved='';
tooltip.saveonmouseover=null;
tooltip.ie4 = (document.all)? true:false;		// check if ie4
tooltip.ie5 = false;
if(tooltip.ie4) tooltip.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0 || navigator.userAgent.indexOf('MSIE 6')>0);
tooltip.dom2 = ((document.getElementById) && !(tooltip.ie4||tooltip.ie5))? true:false; // check the W3C DOM level2 compliance. ie4, ie5, ns4 are not dom level2 compliance !! grrrr >:-(


/**
* Open ToolTip. The title attribute of the htmlelement is the text of the tooltip
* Call this method on the mouseover event on your htmlelement
* ex :  <div id="myHtmlElement" onmouseover="tooltip.show(this)"...></div>
*/
tooltip.show = function (htmlelement) {

   if ( this.ie4 || this.dom2 ) {
      // we save text of title attribute to avoid the showing of tooltip generated by browser
      text=htmlelement.getAttribute("title");
      this.title_saved=text;
      htmlelement.setAttribute("title","");
   }
	if(this.dom2){
		this.tooltipElement = document.getElementById(this.id);
      this.saveonmouseover=document.onmousemove;
		document.onmousemove = this.mouseMove;
	}else if ( this.ie4 ) {
      this.tooltipElement = document.all[this.id].style;
      this.saveonmouseover=document.onmousemove;
      document.onmousemove = this.mouseMove;
	}

   if ( this.ie4 || this.dom2 ) {
      if(this.ie4) document.all[this.id].innerHTML = text;
      else if(this.dom2) document.getElementById(this.id).innerHTML=text;

      this.moveTo(this.x + this.offsetx , this.y + this.offsety);

      if(this.ie4) this.tooltipElement.visibility = "visible";
      else if(this.dom2) this.tooltipElement.style.visibility ="visible";
   }
   return false;
}

/**
* hide tooltip
* call this method on the mouseout event of the html element
* ex : <div id="myHtmlElement" ... onmouseout="tooltip.hide(this)"></div>
*/
tooltip.hide = function (htmlelement) {
	if ( this.ie4 || this.dom2 ) {
      htmlelement.setAttribute("title",this.title_saved);
      this.title_saved="";

		if(this.ie4) this.tooltipElement.visibility = "hidden";
      else if(this.dom2) this.tooltipElement.style.visibility = "hidden";

      document.onmousemove=this.saveonmouseover;
	}
}



// Moves the tooltip element
tooltip.mouseMove = function (e) {
   // we don't use "this", but tooltip because this method is assign to an event of document
   // and so is dreferenced

   if(tooltip.ie4 || tooltip.dom2){

      if(tooltip.dom2){
         tooltip.x = e.pageX;
         tooltip.y = e.pageY;
      }else{
         if(tooltip.ie4) { tooltip.x = event.x; tooltip.y = event.y; }
         if(tooltip.ie5) { tooltip.x = event.x + document.body.scrollLeft;
               tooltip.y = event.y + document.body.scrollTop; }
      }
      tooltip.moveTo( tooltip.x +tooltip.offsetx , tooltip.y + tooltip.offsety);
   }
}

// Move the tooltip element
tooltip.moveTo = function (xL,yL) {
	if(this.dom2){
		this.tooltipElement.style.left = xL +"px";
      this.tooltipElement.style.top = yL +"px";
	}else if(this.ie4){
      this.tooltipElement.left = xL;
      this.tooltipElement.top = yL;
   }
}
