//<!--

var picWin = null;
var returnVal = true;
var leftPosition = 0;
var topPosition = 0;
var scrollValue = "no";	
var resizableValue = "no";
var winWidth = 0;
var winHeight = 0;


function popWindow(page, popUpWidth, popUpHeight, scrollValue) {
	returnVal = true;
	
	if(scrollValue == "yes") resizableValue = "yes";
	else resizableValue = "no";
	leftPosition = 0; topPosition = 0;
	needResize = false;
	
	winWidth = popUpWidth; winHeight = popUpHeight;
	
	if(!is_ie4) closePopUp();
	
	needResize = testAvailableSpace();
	
	settings =  'height='+winHeight+',width='+winWidth+',top='+topPosition+',left='+leftPosition+',resizable='+resizableValue+',scrollbars='+scrollValue;
	picWin = window.open(page,'',settings);
		
	if(needResize) maximizeWindow(winWidth, winHeight, picWin);	
	if(!is_ie4) picWin.focus(); 
	returnVal = false;	
}


//Schließt ein von einer Seite geöffnetes Popup nicht wieder
function popWindowStayOpen(page, popUpWidth, popUpHeight, scrollValue) {
	returnVal = true;
	
	if(scrollValue == "yes") resizableValue = "yes";
	else resizableValue = "no";
	leftPosition = 0; topPosition = 0;
	needResize = false;
	
	winWidth = popUpWidth; winHeight = popUpHeight;
	
	needResize = testAvailableSpace();
	
	settings =  'height='+winHeight+',width='+winWidth+',top='+topPosition+',left='+leftPosition+',resizable='+resizableValue+',scrollbars='+scrollValue;
	stayWin = window.open(page,"stay",settings);
	
	if(needResize) maximizeWindow(winWidth, winHeight, stayWin);	
	if(!is_ie4) stayWin.focus(); 
	returnVal = false;	
}


function testAvailableSpace() {
	needResizeVal = false;
	
	if(is_ie || is_nav || is_gecko) {	
		leftPosition = (screen.width) ? (screen.width-winWidth)/2 : 0;
		topPosition = (screen.height) ? (screen.height-winHeight-66)/2 : 0;
		if(topPosition < 0) topPosition = 0;
		
		if(screen.availWidth < winWidth) {
			scrollValue = "yes"; resizableValue = "yes";
			winWidth = screen.availWidth;
			needResizeVal = true;
		}
		if(screen.availHeight < winHeight) {
			scrollValue = "yes"; resizableValue = "yes";
			winHeight = screen.availHeight;
			needResizeVal = true;
		}
	}
	else {
		if(window.innerWidth < winWidth) {
			scrollValue = "yes"; resizableValue = "yes";
			winWidth = window.innerWidth;			
		}
		if(window.innerHeight < winHeight) {
			scrollValue = "yes"; resizableValue = "yes";
			winHeight = window.innerHeight;			
		}
	}
	
	return needResizeVal;
}


function maximizeWindow(winWidth, winHeight, winReference) {
	if(winWidth == screen.availWidth && winHeight == screen.availHeight) winReference.moveTo(0,0);
	else if(winWidth == screen.availWidth) {
		topPos = (screen.height-winHeight-66)/2; if(topPos<0) topPos = 0;
		winReference.moveTo(0,topPos);
	}
	else if(winHeight == screen.availHeight) {
		winReference.moveTo((screen.width-winWidth)/2,0);
		winWidth = winWidth + 16;
	}
	
	if(is_nav || is_gecko) {				
		winReference.outerWidth = winWidth;
		winReference.outerHeight = winHeight;
	}	
	else {
		winReference.resizeTo(winWidth, winHeight);		
	}
}


function closePopUp() {
	if(is_nav4) {	
		if(picWin != null && !picWin.closed) picWin.close();		
	}
	else if(picWin != null){
		picWin.close();
		picWin = null;
	}	
}
	
//--> 