function fCenterWindow(intWidth,intHeight)
{
   var strOutput = "";

	// Middle Point Of Screen
   intWidth  = (screen.availWidth / 2) - (intWidth / 2) ;
   intHeight = ((screen.availHeight-20) / 2) - (intHeight / 2) ;
   
   // Netscape 4.7
   strOutput += ",screenx=" + intWidth;
   strOutput += ",screeny=" + intHeight;
   
   // Internet Explorer 4.0
   strOutput += ",left=" 	+ intWidth ;
   strOutput += ",top=" 	+ intHeight;
 
   return strOutput;

}

function fLeftWindow(intHeight)
{
   var strOutput = "";

   intHeight = screen.availHeight - (20 + intHeight) ;
   
   // Netscape 4.7
   strOutput += ",screenx=0" ;
   strOutput += ",screeny=" + intHeight;
   
   // Internet Explorer 4.0
   strOutput += ",left=0";
   strOutput += ",left=0,top=" 	+ intHeight;
 
   return strOutput;

}

function fOpenHtmlWindow(strURL, strName, nWidth, nHeight, nScreenX, nScreenY)
{
	//SecondFenster();
   	var win = window.open(strURL, strName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+nWidth+",height="+nHeight+", screenx=" + nScreenX + ", screeny=" + nScreenY + " ");
	win.focus();
}

function fOpenCenteredWindow(strURL, nWidth, nHeight)
{
	//SecondFenster();
	var str = fCenterWindow(nWidth,nHeight);
   	var win = window.open(strURL, "CenteredWindow","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=auto,resizable=no, width="+nWidth+", height="+nHeight+" " + str + " ");
	win.focus();
}
	
function fOpenImagePopup(strHtmlCode, strHtmlTitle, intWidth, intHeight) 
{
	var strOutput = "";
	var strFileName = "";
	strOutput = '<table border="0" cellspacing="0" cellpadding="0">'+"\n";
	strOutput += '<tr>'+"\n";
	strOutput += '	<td><img';
	strOutput += ' src="' 	+ strHtmlCode + '" ';
	strOutput += ' alt="'	+ strHtmlTitle + '" ';
	strOutput += ' width="'	+ intWidth + '" ';
	strOutput += ' height="' + intHeight + '" ';
	strOutput += ' border="0"></td>'+"\n";
	strOutput += '</tr>'+"\n";
	strOutput += '</table>'+"\n";
	intWidth = intWidth-4; 
	intHeight = intHeight-4; 
	strHtmlCode = strOutput;
		
	var win = window.open(strFileName,  strHtmlTitle,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+intWidth+",height=" + intHeight + fCenterWindow(intWidth,intHeight));

	// Format HTML
	strOutput = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'+"\n";
	strOutput += '<HTML>'+"\n";
	strOutput += '<HEAD>'+"\n";
	// Title
	strOutput += '<TITLE>'+strHtmlTitle+'</TITLE>'+"\n";
	strOutput += '<META http-equiv="content-type" content="text/html;charset=windows-1251">'+"\n";
	strOutput += '</HEAD>'+"\n";
	strOutput += '<BODY bgcolor="#ffffff" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style=" border: 0">'+"\n";
	// Html Code
	strOutput += strHtmlCode;
	strOutput += '</BODY></HTML>'+"\n";
	// Edit Window (Put HTML
	win.document.open("text/html");	
	win.document.write(strOutput);
	win.document.close();
	win.focus();
}
var strCurrentLanguage="";

function openGallery(intId){
	if(strCurrentLanguage == ""){
		var strUrl = "/de/gallery.shtml";
	}else{
		var strUrl = "/"+strCurrentLanguage+"/gallery.shtml";
	}
	strUrl += "?intId="+intId;
	var nWidth = "780";
	var nHeight = "700";
	fOpenCenteredWindow(strUrl, nWidth, nHeight);
}

function openMediaPopup(intId){
	if(strCurrentLanguage == ""){
		var strUrl = "/de/popup.shtml";
	}else{
		var strUrl = "/"+strCurrentLanguage+"/popup.shtml";
	}
	strUrl += "?intId="+intId;
	var nWidth = "780";
	var nHeight = "700";
	fOpenCenteredWindow(strUrl, nWidth, nHeight);
}