
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var browser = navigator.appName;
var version = navigator.appVersion.substring(0,1);
var newwin;
version = Number(version);

function openWin(theURL,winname,features,maxBreite,maxHoehe,maxAufloesung) 
{
	if(screen.availWidth > maxBreite && maxAufloesung > 0) {
		var breite = screen.availWidth;
		var hoehe = screen.availHeight;
		var randLinks = 0;
		var randOben = 0;
	}
	else if(maxAufloesung == 0) {
		var hoehe = maxHoehe;
		var breite = maxBreite;
		var randLinks = (screen.availWidth-breite)/2;
		var randOben = 10
		window.moveTo(randLinks,0);
	}
	else {
		var hoehe = screen.availHeight-35;
		var breite = hoehe*(maxBreite/maxHoehe);
		var randLinks = (screen.availWidth-breite)/2;
		var randOben = 0
		window.moveTo(randLinks,0);
	}
	
	if(browser=="Netscape" && version>=4) {
		features += ',left='+randLinks+',top='+randOben+',width='+breite+',height='+hoehe;
		newwin = window.open(theURL,winname,features);
		if(screen.availWidth < maxAufloesung) {
			newwin.innerWidth = breite;
			newwin.innerHeight = hoehe;
		}
	}
	else {
		features += ',left='+randLinks+',top='+randOben+',width='+ breite +',height='+ hoehe;
		newwin = window.open(theURL,winname,features);
		newwin.resizeTo(breite,hoehe);
	}
	setTimeout('newwin.focus();',250);
}

function show_finish() {
	setTimeout('window.open("finish.htm","_self");',30000);
}

function savePic() {
	this.focus();
    	frames.download.document.execCommand("SaveAs");
}
function warten() {
	warten = window.open("wait.htm","warten","width=150,height=100");
}
function close() {
	warten.close();
}



var ok = false;

function openWindow(winURL,winName,features,fullScreen,breite,hoehe) 
{
	if(fullScreen) 
	{
		var breite = screen.availWidth;
		var hoehe = screen.availHeight;
		var randLinks = 0;
		var randOben = 0;
	}
	else 
	{
		var breite = breite;
		var hoehe = hoehe;
		var randLinks = (screen.availWidth-breite)/2;
		var randOben = (screen.availHeight-hoehe)/2;
	}

	features += ',left='+randLinks+',top='+randOben+',width='+breite+',height='+hoehe;

	newWin = window.open(winURL,winName,features);
	newWin.resizeTo(breite,hoehe);
	newWin.location.href = winURL;
	
	return "ok";
}


//urlPopup: 	URL, die geladen wird im Popup
//urlNopopup: 	URL, die im startfenster geladen wird, wenn popups bockiert werden.
//		wenn leerer String übergeben wird, wird eine Fehlermeldung ausgegeben, wenn popups blockiert werden.
//features:	für popupwindow. z.B. status, resizable usw...
//fullScreen:	true oder false, je nachdem, ob das neue popup-Fenster den ganzen Bildschirm ausfüllen soll, oder nur die Größe von breite und hoehe hat.
//breite + hoehe: größe des popups, wenn es nicht FullScreen geöffnet wird.

function popupWindow(urlPopup,urlNopopup,features,fullScreen,breite,hoehe) {
	setTimeout("check('"+urlPopup+"','"+urlNopopup+"');",3500);

	if(fullScreen) {
		var breite = screen.availWidth;
		var hoehe = screen.availHeight;
		var randLinks = 0;
		var randOben = 0;
	}
	else {
		var breite = breite;
		var hoehe = hoehe;
		var randLinks = (screen.availWidth-breite)/2;
		var randOben = (screen.availHeight-hoehe)/2;
	}

	features += ',left='+randLinks+',top='+randOben+',width='+breite+',height='+hoehe;

	newWin = window.open("popupcheck.php","workidpopu",features);
	newWin.resizeTo(breite,hoehe);
}

function check(urlPopup,urlNopopup) {
	if (ok==true) {
		// Browser laesst PopUps zu.
		newWin.location.href = urlPopup;
	}
	else {
		// Browser laesst PopUps NICHT zu.
		if(urlNopopup != "") {
			this.moveTo(0,0);
			this.resizeTo(screen.availWidth,screen.availHeight);
			this.location.href = urlNopopup;
		}
		else {
			alert("Ihr Browser blockiert Popups!\nBitte überprüfen Sie Ihre Popup-Blocker Einstellungen\nund ob Sie JavaScript deaktiviert haben.");
		}
	}
}


function insertFlashVersion( flashVersion, rightVersion, sessId )
{
	//alert( flashVersion );
	var sVersion = flashVersion;
	var bRightVersion = rightVersion;
	var sSessID = sessId;
	if( flashVersion != "" )
	{
		while( sVersion.indexOf(",") > -1 )
		{
				sVersion = sVersion.replace(/,/, ".");
		}
		
		if( bRightVersion )
		{
			var x = new Image( );
			x.src = "_flash.php?FlashVersion=" + sVersion;
		}
		else
		{
			var x = new Image( );
			x.src = "_noflash.php?FlashVersion=" + sVersion;
		}
		
	}
	else
	{
		var x = new Image( );
		x.src = "_noflash.php?FlashVersion=false";
	}
}


function triggerLog( sCat, sValue )
{
	var x = new Image( );
	x.src = "_triggerlog.php?cat=" + sCat + "&val=" + sValue;
}
