/* Funktion zum Oeffnen eines Popup-Fensters, oeffnet sich zentriert */
function popup(url,name,param) {
	var sizeX = 0;
	var sizeY = 0;
	var winX=screen.availWidth;
	var winY=screen.availHeight;
	
	var tmpArray = param.split(",");
	
	for(i=0;i<tmpArray.length;i++) {
		if(tmpArray[i].indexOf("width") != -1) { tmpArray2 = tmpArray[i].split("="); sizeX = tmpArray2[1];}
		if(tmpArray[i].indexOf("height") != -1) { tmpArray2 = tmpArray[i].split("="); sizeY = tmpArray2[1];}
	}
	
	var centerX=eval(winX/2-sizeX/2);
	var centerY=eval(winY/2-sizeY/2);
	
	param +=',top='+centerY+',left='+centerX;
	var winChild = window.open(url,name,param+',dependent=yes');
	winChild.focus();
}

function getWindowWidth(win) {   
	     if (win == undefined) win = window;   
	     if (win.innerWidth) {   
	         return win.innerWidth;   
	     }   
	     else {   
	         if (win.document.documentElement &&   
	             win.document.documentElement.clientWidth) {   
	             return win.document.documentElement.clientWidth;   
	         }   
	         return win.document.body.offsetWidth;   
	     }   
}   

function hideScandis() {
	//document.getElementById("scandi_01").style.display = "none";
	
	var el = document.getElementById("scandi_02")
	if ((el != null) && (el != 'undefined'))
		el.style.display = "none";

}

function checkWidth() {
	
	
	if(getWindowWidth() < 1145) {
		hideScandis();
	} else {
		showScandis();
	}
	
}



function showScandis() {
	//document.getElementById("scandi_01").style.display = "block";
	var el = document.getElementById("scandi_02")
	if ((el != null) && (el != 'undefined'))
		el.style.display = "block";

}

window.onDomReady = initReady;

// Initialize event depending on browser
function initReady(fn)
{
	//W3C-compliant browser
	if(document.addEventListener) {
    document.addEventListener("DOMContentLoaded", fn, false);
  }
	//IE
	else {
    document.onreadystatechange = function(){readyState(fn)}
  }
}

//IE execute function
function readyState(func)
{
	// DOM is ready
	if(document.readyState == "interactive" || document.readyState == "complete")
	{
		func();
	}
}

//execute as soon as DOM is loaded
window.onDomReady(onReady);
 
window.onresize = checkWidth;
//do when DOM is ready
function onReady()
{
	
	checkWidth();
}
