
// function navin() & navout()
var aktiv;



//no rotation
if (screen.width > 1024) {
	
	// function promo
	var aktiv2;
	var ie = navigator.userAgent.search(/MSIE/);
	var pos3 = document.cookie.indexOf("rot=");
	var rot  = document.cookie.substring(pos3 + 4, pos3 + 5);
	var startseite_de = "/promotion_1.html"; 
	var startseite_fr = "/promo_1_f.html";



	if (ie == -1) {
	
		if (window.location.pathname == startseite_fr || window.location.pathname == startseite_de || window.location.pathname == "/") {
			aktiv2 = window.setInterval("promo()", 10000);
			rot = 0;
			document.cookie = "rot=0";
		}
	
	}

	if (ie != -1) {
	
		if (window.location.pathname == startseite_fr || window.location.pathname == startseite_de || window.location.pathname == "/") {
			aktiv2 = window.setInterval("promo()", 10000);
			rot = 0;
			document.cookie = "rot=0";
		}
	
	}

	if (window.location.hash == "#n" || window.location.hash == "" || window.location.hash == " ") {
		aktiv2 = window.setInterval("promo()", 10000);
		//rot = 0;
		//document.cookie = "rot=0";
	}
	
	if (rot == 1 || window.location.hash == "#m" || window.location.hash == "#s") {
		window.clearTimeout(aktiv2);
		rot = 1;
		document.cookie = "rot=1";
	}
} //end of no rotation



function promo() {
	sprache = document.getElementsByTagName("html");
	
	if(sprache[0].lang == "de" && window.location.hash != "#m" && window.location.hash != "#s") {
		if (window.location.pathname == startseite_de || window.location.pathname == "/") {
			document.location = "promotion_2.html";
		}
		if (window.location.pathname == "/promotion_2.html") {
			document.location = "promotion_3.html";
		}
		if (window.location.pathname == "/promotion_3.html") {
			document.location = startseite_de;
		}
		//if (window.location.pathname == "/promotion_4.html") {
		//	document.location = "promotion_5.html";
		//}
		//if (window.location.pathname == "/promotion_5.html") {
		//	document.location = startseite_de;
		//}
	}

	if(sprache[0].lang == "fr" && window.location.hash != "#m" && window.location.hash != "#s") {
		if (window.location.pathname == startseite_fr || window.location.pathname == "/") {
			document.location = "promo_2_f.html";
		}
		//if (window.location.pathname == "/promo_2_f.html") {
		//	document.location = "promo_3_f.html";
		//}
		if (window.location.pathname == "/promo_2_f.html") {
			document.location = "promo_4_f.html";
		}
		//if (window.location.pathname == "/promo_4_f.html") {
		//	document.location = "promo_5_f.html";
		//}
		if (window.location.pathname == "/promo_4_f.html") {
			document.location = startseite_fr;
		}
	}

} //end of function



function rotstop() {

	window.clearTimeout(aktiv2);
	rot = 1;
	document.cookie = "rot=1";
	
} //end of function



function sliderhome(promosite,reserve) {
	sprache = document.getElementsByTagName("html");
	window.clearTimeout(aktiv2);
	rot = 1;
	document.cookie = "rot=1";
	
	if(sprache[0].lang == "de") {
		document.location = "promotion_" + promosite + ".html" + window.location.hash;
	}
	
	if(sprache[0].lang == "fr") {
		document.location = "promo_" + promosite + "_f.html" + window.location.hash;
	}
	
} //end of function



function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};



function contopen(zustand) {
	var rows = document.getElementsByTagName("div");
	var zaehler = 0;
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].className == "ce_text block") {
			zaehler++;
		}
	} //end of for
	
	if (zustand == "yes" || (window.location.hash == "#m" && zaehler > 1)) {
		document.getElementById("main").style.width = "995px";
		document.getElementById("main").style.clip = "rect(0px, 995px, 509px, 0px)";
	}
	
	if (window.location.hash == "#m" && zaehler <= 1) {
		var rows2 = document.getElementsByTagName("a");	
	
		for (var i=0; i < rows2.length; i++) {
			if (rows2[i].className == "slidein") {
				rows2[i].href = window.location.pathname + "#m";
				window.location.pathname = window.location.pathname + "#w";
			}
		} //end of for	

		pfeilslide(0);
	}
	
} //end of function



function pfeilstart() {
	
	if (window.location.hash == "#m"){
		pfeilslide(0);
	}	
	
	if (window.location.hash != "#m"){
		pfeilslide(1);
	}	
	
	pfeilmod();

} //end of function



function pfeil() {
	
	if (window.location.hash != "#m"){
		pfeilslide(0);
	}
	if (window.location.hash == "#m"){
		pfeilslide(1);
	}	
	
	pfeilmod();

} //end of function



function pfeilmod() {
	var rows = document.getElementsByTagName("a");
	var hash = window.location.hash;
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].className == "slidein" && window.location.hash == "#m") {
			rows[i].href = window.location.pathname + "#w";
		}
		if (rows[i].className == "slidein" && (window.location.hash == "#w" || hash.length < 2)) {
			rows[i].href = window.location.pathname + "#m";
		}
	} //end of for	
	
} //end of function



function pfeilslide(modus) {
	var rows = document.getElementsByTagName("a");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].className == "slider" && modus == 0) {
			url = rows[i].href;
			pos = url.indexOf("#");
			row = url.substr(0, pos);
			
			if (pos == -1){
				rows[i].href = rows[i].href + "#m";
			}	
		}
		
		if (rows[i].className == "slider" && modus == 1) {
			url2 = rows[i].href;
			pos2 = url2.indexOf("#");
			row2 = url2.substr(0, pos2);
			
			if (pos2 != -1){
				rows[i].href = row2;
			}	
		}
		
	} //end of for
	
} //end of function



function navcheck() {
	var rows = document.getElementsByTagName("div");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].style.visibility == "visible" && window.location.hash != "#n") {
			rows[i].style.visibility = "hidden";
		} 
	} //end of for
		
} //end of function



function navcheck2() {
	var rows = document.getElementsByTagName("div");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].style.visibility == "visible") {
			rows[i].style.visibility = "hidden";
		} 
	} //end of for
		
	rotstop();
		
} //end of function



function navin34() {
	var rows = document.getElementsByTagName("div");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].style.visibility == "hidden" && (rows[i].className == "level_3" || rows[i].className == "level_4")) {
			rows[i].style.visibility = "visible";
		} 
	} //end of for	
	
} //end of function



function navout34() {
	var rows = document.getElementsByTagName("div");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].style.visibility == "visible" && (rows[i].className == "level_3" || rows[i].className == "level_4")) {
			rows[i].style.visibility = "hidden";
		} 
	} //end of for
		
} //end of function



function navin(id,eb) {
	window.clearTimeout(aktiv);
	navin2();

	if (eb == 1 && document.getElementById(id).style.zIndex == 10){
		navin34();
	}
		
	if(id != "" || id != " "){
		document.getElementById(id).style.visibility = "visible";
	}
		
} //end of function



function navin2() {
	var rows = document.getElementsByTagName("div");
	
	for (var i=0; i < rows.length; i++) {
		if (rows[i].style.visibility == "visible") {
			rows[i].style.visibility = "hidden";
		} 
	} //end of for
	
} //end of function



function navout(id) {
	document.getElementById(id).style.visibility = 'hidden';
	navout34();
} //end of function



function navout2(id) {
	aktiv = window.setTimeout("navout(" + id + ")", 333);
} //end of function



