/*
 * DO NOT REMOVE THIS NOTICE
 *
 * PROJECT:   mygosuMenu
 * VERSION:   1.1.3
 * COPYRIGHT: (c) 2003,2004 Cezary Tomczak
 * LINK:      http://gosu.pl/software/mygosumenu.html
 * LICENSE:   BSD (revised)
 */



var menuTimeout = 400;
var menuOffsetWidth = 0;
var menuOffsetHeight = -1;

var menuId = 'menu';
var menuTree = new Array();
var menuSections = new Array();
var menuSectionsCountHide = new Array();
var menuSectionsVisible = new Array();

var menuBrowser = navigator.userAgent.toLowerCase();
var menuBrowserIsOpera = menuBrowser.indexOf('opera') != -1;
var menuBrowserIsIE = menuBrowser.indexOf('msie') != -1 && !menuBrowserIsOpera;
//alert(navigator.userAgent);
    
function menuInit() {
    menuMakeIds(document.getElementById(menuId).childNodes, menuTree, menuId, 0, 0, 0);
    for (var i = 0; i < menuSections.length; i++) {
        menuSectionsCountHide[menuSections[i]] = 0;
    }
    for (var i = 0; i < menuSections.length; i++) {
        menuInitSection(menuSections[i], menuGetTreeById(menuSections[i]));
    }
}

function menuMakeIds(nodes, tree, id, lastOW, lastBLW, lastBRW) {
    for (var i = 0; i < nodes.length; i++) {
        switch (nodes[i].className) {
            case "top":
            case "box-right":
                id = id + "-" + tree.length;
                nodes[i].id = id;
                if (menuBrowserIsIE && document.compatMode && document.compatMode != "BackCompat") {
                    if (nodes[i].className == "box-right" && nodes[i].currentStyle) {
                        var tmp;
                        tmp = lastBLW + lastBRW;
                        if (tmp) {
                            tmp = Math.floor(tmp / 2) + 1;
                        }
                        nodes[i].style.width = lastOW - ( parseInt(nodes[i].currentStyle.paddingLeft) + parseInt(nodes[i].currentStyle.paddingRight) ) - tmp;
                    }
                }
                tree[tree.length] = new Array();
                tree = tree[tree.length - 1];
                break;
            case "box":
                nodes[i].id = id + "-" + tree.length;
                tree[tree.length] = new Array();
                break;
        }
        var className = new String(nodes[i].className);
        if (menuBrowserIsIE && !(document.compatMode && document.compatMode != "BackCompat")) {
            if (className == "box" || className == "box-hover") {
                nodes[i].style.width = "100%";
            }
        }
        if (className == "section") {
            if (!menuBrowserIsIE) {
                nodes[i].style.width = "100%";
            }
            nodes[i].style.left = (lastOW + menuOffsetWidth) + "px";
            nodes[i].style.top = menuOffsetHeight + "px";
        }
        if (className.substr(0, 7) == "section") {
            menuSections[menuSections.length] = id;
            nodes[i].id = id + "-section";
            lastOW = nodes[i].offsetWidth;
            if (nodes[i].currentStyle) {
                lastBLW = parseInt(nodes[i].currentStyle.borderLeftWidth);
                lastBRW = parseInt(nodes[i].currentStyle.borderRightWidth);
            }
        }
        if (nodes[i].childNodes) {
            menuMakeIds(nodes[i].childNodes, tree, id, lastOW, lastBLW, lastBRW);
        }
    }
}

function menuInitSection(id_section, tree) {
    eval("document.getElementById('"+id_section+"').onmouseover = function() {"+
        "menuShow('"+id_section+"');"+
        "if (document.getElementById('"+id_section+"').className == 'box-right') {"+
            "document.getElementById('"+id_section+"').className = 'box-right-hover';"+
        "}"+
    "}");
    eval("document.getElementById('"+id_section+"').onmouseout = function() {"+
        "setTimeout(\"menuTryHide('"+id_section+"', \"+menuSectionsCountHide['"+id_section+"']+\")\", menuTimeout);"+
        "if (document.getElementById('"+id_section+"').className == 'box-right-hover') {"+
            "document.getElementById('"+id_section+"').className = 'box-right';"+
        "}"+
    "}");
    for (var i = 0; i < tree.length; i++) {
        var id = id_section + "-" + i;
        if (tree[i].length == 0) {
            eval("document.getElementById('"+id+"').onmouseover = function() {"+
                "menuShow('"+id_section+"');"+
                "document.getElementById('"+id+"').className = 'box-hover';"+
            "}");
            eval("document.getElementById('"+id+"').onmouseout = function() {"+
                "setTimeout(\"menuTryHide('"+id_section+"', \"+menuSectionsCountHide['"+id_section+"']+\")\", menuTimeout);"+
                "document.getElementById('"+id+"').className = 'box';"+
            "}");
        }
    }
}

function menuShow(id_section) {
    var sections = menuGetIdParentsArrById(id_section, true);
    for (var i = 0; i < sections.length; i++) {
        menuSectionsCountHide[sections[i]]++;
    }
    for (var i = 0; i < menuSectionsVisible.length; i++) {
        if (!menuArrayContains(sections, menuSectionsVisible[i])) {
            menuHide(menuSectionsVisible[i]);
        }
    }
    document.getElementById(id_section + "-section").style.zIndex = 2599;
    document.getElementById(id_section + "-section").style.visibility = 'visible';
    menuSectionsVisible = sections;
}

function menuTryHide(id_section, count) {
    if (count == menuSectionsCountHide[id_section]) {
        var sections = menuGetIdParentsArrById(id_section, true);
        if (menuArraysEqual(sections, menuSectionsVisible)) {
            for (var i = 0; i < sections.length; i++) {
                menuHide(sections[i]);
            }
        } else {
            menuHide(id_section);
        }
    }
}

function menuHide(id_section) {
    document.getElementById(id_section + "-section").style.visibility = 'hidden';
    document.getElementById(id_section + "-section").style.zIndex = -1;
}

function menuGetTreeById(id) {
    var a = id.split("-");
    a.shift();
    var s = "";
    for (var i = 0; i < a.length; i++) {
        s += ("[" + a[i] + "]");
    }
    return eval("menuTree" + s);
}

function menuGetIdParentsArrById(id, includeSelf) {
    var a = id.split("-");
    var ret = new Array();
    if (includeSelf) {
        ret[ret.length] = id;
    }
    while (a.length > 2) {
        a.pop();
        ret[ret.length] = a.join("-");
    }
    return ret;
}

function menuArrayContains(a, s) {
    var found = false;
    for (var i = 0; i < a.length; i++) {
        if (a[i] == s) {
            found = true;
            break;
        }
    }
    return found;
}

function menuArraysEqual(a1, a2) {
    if (a1.length != a2.length) {
        return false;
    }
    for (var i = 0; i < a1.length; i++) {
        if (a1[i] != a2[i]) {
            return false;
        }
    }
    return true;
}




//ncm smooth transition slideshow with randomizer
//ver 2.0, (c) stevi
//allgemeine einstellungen:
var rSlideShowSpeed = 5000;
var rCrossFadeDuration = 3;

// so lassen
var zuf = true;
var rPic = new Array()
var rRandom = new Array();
var rImages = new Array();
var rPreLoad = new Array();
var rNum, rT, rJ = 0;
var i,y,z;
var duplicate=false;
var cat = "";

function init(category) {
	init(category, false);
}

function init(category, zufall) {
	zuf = zufall;
	cat = category;
	switch (category) {
		case 'start':	rPic[0]='1.jpg'; rPic[1]='2.jpg'; rPic[2]='3.jpg'; rPic[3]='4.jpg'; rPic[4]='5.jpg'; rPic[5]='6.jpg'; rPic[6]='7.jpg'; rPic[7]='8.jpg'; break;
	}
	rNum = rPic.length;
	randomize();
	for (i = 0; i < rImages.length; i++){
	   rPreLoad[i] = new Image()
	   rPreLoad[i].src = rImages[i]
	}
	document.write("<img src='" + rImages[0] + "' width='670' height='282' name='rSlide'>");
}

function randomize(){
	z=0;
	while (z!=(rNum)){
		y=Math.floor(Math.random()*(rNum));
		for(i=0;i<rRandom.length;i++){	if (y==rRandom[i]){	duplicate=true;	}
	}
	if (duplicate==true){ duplicate=false;	continue; }
	else
		if (duplicate==false){	rRandom[z] = y;	z+=1;	}
	}
	if(zuf) { 
		for(i=0; i<rRandom.length; i++) { rImages[i] = "http://www.s-hotels.com/images/" + cat + "/"  + rPic[rRandom[i]]; }	//hier korrekten pfad zu unterverzeichnis der slideshow eintragen
	}
	else {
		for(i=0; i<rPic.length; i++) { rImages[i] = "http://www.s-hotels.com/images/" + cat + "/"  + rPic[i]; }	//hier	
	}
}

function runRandomSlideShow(){
   if (document.all){
      document.images.rSlide.style.filter='blendTrans(duration='+rCrossFadeDuration+')'
      document.images.rSlide.filters.blendTrans.Apply()      
   }
   document.images.rSlide.src = rPreLoad[rJ].src
   if (document.all){
      document.images.rSlide.filters.blendTrans.Play()
   }
   rJ = rJ + 1
   if (rJ > (rImages.length-1)) rJ=0
   rT = setTimeout('runRandomSlideShow()', rSlideShowSpeed)
}




function expandcontent(cid){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}


function gallery(id,cat,imgs,lang){
	url = "/gallery.php?id="+id+"&cat="+cat+"&imgs="+imgs+"&lang="+lang;
	width = "600";
	height = "450";
	name = "";
	window.open(url,name,'height='+height+',width='+width);
}



function sh(id,action){
	if (action=="show"){document.getElementById(id).style.display="block";} 
	else {document.getElementById(id).style.display="none";}
}


function chstyle(id,c){
	if (document.getElementById(id)){
		document.getElementById(id).className=c;
	}
}

function startSlideShow(object, path, imgarr){
	object.imgarr = imgarr;
	object.path = path;
	object.aktpic = Math.round(Math.random()*imgarr.length);
	setTimeout('runSlideShow("' + object.id + '")', 4000);
}
function runSlideShow(objectid){
	object = document.getElementById(objectid);
	if (document.all){
		object.style.filter='blendTrans(duration='+'1,5'+')';
		object.filters.blendTrans.Apply();   
	}
	zw = Math.round(Math.random()*object.imgarr.length);
	while(zw==object.aktpic && object.imgarr.length>1 || !object.imgarr[zw]){
		zw = Math.round(Math.random()*object.imgarr.length);
	}
	object.aktpic=zw;
	object.src = object.path + object.imgarr[object.aktpic];
	if (document.all){
		object.filters.blendTrans.Play();
	}
	setTimeout('runSlideShow("' + objectid + '")', 4000);
}

