//Philipp Moor
//08.04.2008
//

var http_request = null;

function erzhttp_request(){
	http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
 		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
            }
		} else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
		}
	}

		if (!http_request) {
			alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
			return false;
		}
		
	return http_request;	
}

http_request = erzhttp_request();


function show_picture(id, path) {
	document.getElementById(id).src = path;
}

var oldid = "none";

function show_div(id){
	if(oldid != "none"){
	document.getElementById(oldid).style.display = "none";
	}
	document.getElementById(id).style.display = "block";
	oldid = id;
}

/* dieses Script habe ich von folgender URL 
http://ssdesigns.proboards15.com/index.cgi?board=open&action=display&thread=1028
der Eintrag den ich verwendet habe stammt von Peter vom 16.01.2006
*/
if(location.search.substring(1) != ""){ //macht nur sinn wenn die anfrage nicht leer ist!
	var $_GET = new Object();
	var $qry_str = location.search.substring(1);
	var $k;
	var get = 1;
	
		do {
	    	$_GET[$qry_str.split("=")[0].replace(/&/, "")] = $qry_str.split("=")[1].split(/&|$/)[0];
	    	$qry_str = $qry_str.split($qry_str.split("=")[1].split(/&|$/)[0])[1];
	    	$k ++;
		} 
		while($k < (location.search.split("=").length - 1));
			for(key in $_GET){
	    		if(key = 'sheet'){get = $_GET[key];
	    		} else {get = 1;}
	    	}
}	
//Ende des Scripts

window.onload = function()
{
	if(document.getElementById("home")){
		advice_navbar();
	}
	if(document.getElementById("imageflow")){
		loadimageflow();
	}
}

function advice_navbar(){
	if (get==1){window.setTimeout("show_picture('navHotels', '../images/icon-an_18.png')", 500);
		window.setTimeout("show_picture('navHotels', '../images/icon-aus_18.png')", 1500);
		window.setTimeout("show_picture('navImmobilien', '../images/icon-an_19.png')", 1600);
		window.setTimeout("show_picture('navImmobilien', '../images/icon-aus_19.png')", 2600);
		window.setTimeout("show_picture('navUrlaub', '../images/icon-an_20.png')", 2700);
		window.setTimeout("show_picture('navUrlaub', '../images/icon-aus_20.png')", 3700);
		window.setTimeout("show_picture('navEntertain', '../images/icon-an_21.png')", 3800);
		window.setTimeout("show_picture('navEntertain', '../images/icon-aus_21.png')", 4800);		
		window.setTimeout("show_picture('navHotels', '../images/icon-an_18.png')", 4900);
		window.setTimeout("show_picture('navHotels', '../images/icon-aus_18.png')", 5900);
		window.setTimeout("show_picture('navImmobilien', '../images/icon-an_19.png')", 4900);
		window.setTimeout("show_picture('navImmobilien', '../images/icon-aus_19.png')", 5900);
		window.setTimeout("show_picture('navUrlaub', '../images/icon-an_20.png')", 4900);
		window.setTimeout("show_picture('navUrlaub', '../images/icon-aus_20.png')", 5900);
		window.setTimeout("show_picture('navEntertain', '../images/icon-an_21.png')", 4900);
		window.setTimeout("show_picture('navEntertain', '../images/icon-aus_21.png')", 5900);}
	//else if (get==2){window.setTimeout("show_picture('navHotels', '../images/icon-an_18.jpg')", 4800);}
	//else if (get==3){window.setTimeout("show_picture('navImmobilien', '../images/icon-an_19.jpg')", 4800);}
	//else if (get==4){window.setTimeout("show_picture('navUrlaub', '../images/icon-an_20.jpg')", 4800);}
}

function page(url, getstring) {
//alert("jetzt? " + url );
//|| url == "php/picturepages.php"
		if(url == "php/hauptsitz.php" ){
//alert("jetzt!");
			url = "index.php?" +getstring + "&java=0";
			window.location.href=url;
		}

		getstring = getstring + "&java=1";		
		url = url + "?" +getstring;
		http_request.open('GET', url, true);
//		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //falls ich mit POST arbeiten will

		http_request.onreadystatechange = ausgabe;
		http_request.send(null);
}

function ausgabe() {
//alert("in der ausgabe");
	if (http_request.readyState == 4) {
			$('content').innerHTML = 'Seite wird geladen ...';
		}
		//alert(http_request.status);
		if(http_request.readyState == 4 && http_request.status == 200) {
			$('content').innerHTML = http_request.responseText;
			if(document.getElementById("imageflow")){
				//window.setTimeout("loadimageflow()",3000);
				window.setTimeout("hide(conf_loading)",1000);
				window.setTimeout("refresh(true)",1000);
				window.setTimeout("show(conf_images)",1000);
				window.setTimeout("show(conf_scrollbar)",1000);
				window.setTimeout("initMouseWheel()",1000);
				window.setTimeout("initMouseDrag()",1000);
			}
		}
}

