ns=((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)>=4));

ie=((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4));

var glossarFenster;

// ---------------------------------------------------------------------------------

function encodeDocumentURL(value) {
    newValue = "";
    for (i = 0; i < value.length; i++) {
    	z = value.charAt(i);
    	if (z == " ") {
    		newValue += "%20";
    	}
    	else {
    		newValue += z;
    	}
    }
    return newValue;
}

// --------------------------------------------------------------------------------

function openGlossar(value) {
		var optionen = 'toolbar=no,width=450,height=450,directories=no,status=no,scrollbars=no,resize=no,menubar=no,top=20,left=80';
		var url = 'templates/glossar.html?value=' + value;
		if (document.all) {
			glossarFenster = open(url,'glossarFenster',optionen);
			// Verzoegerung, da IE eine Fehelermeldung abgibt, wenn ein gerade geoeffnetes Fenster fokussiert wird
 			setTimeout('glossarFenster.focus();',250);
		}
		else {
			glossarFenster = open(url,'glossarFenster',optionen);
			glossarFenster.focus();
		}
}

// ---------------------------------------------------------------------------------

function openDocument(value) {
		var optionen = 'toolbar=no,width=640,height=480,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,top=20,left=80';
		var url = encodeDocumentURL(value);
		
		if (document.all) {
			dokumentFenster = window.open(url,'dokumentFenster',optionen)
			// Verzoegerung, da IE eine Fehelermeldung abgibt, wenn ein gerade geoeffnetes Fenster fokussiert wird
 			setTimeout('dokumentFenster.focus();',250);
		}
		else {
			dokumentFenster = open(url,'dokumentFenster',optionen);
			dokumentFenster.focus();
		}
 }


// ---------------------------------------------------------------------------------

function PassFlash(){
    window.document.movie.SetVariable("text", "hello");
}

	

// ---------------------------------------------------------------------------------

function showFullscreen() {
		if (isFullscreen() == false) {
			// WBT aus dem aufrufenden Fenster loeschen 
			top.window.location ='menu.html';
			// Fullscreen Fenster oeffnen		
			var url = 'fullscreen.html';
			if (ns) {
				// debug();
				// Netscape Pseudo Fullscreen
				// var optionen = 'top=0,left=0,resizable=0,width=' + screen.width + ',height=' + screen.height + 'directories=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0';
				var optionen = 'top=0,left=0,resizable=1,width=' + (screen.availWidth-10) + ',height=' + (screen.availHeight);
				fullscreenFenster = open(url,'FullscreenWBT',optionen);
			}
			if (ie) {
				// IE Real Fullscreen
				var optionen = 'screenX=0,screenY=0,directories=0,channelmode=0,fullscreen=1,location=0,menubar=0,scrollbars=0,status=0,toolbar=0';
				glossarFenster = open(url,'FullscreenWBT',optionen);
			}	
		} else {
			// nothing
			killFullscreen();
		}
	}
	

// ---------------------------------------------------------------------------------

function killFullscreen() {
		// wbt neu laden in das urspruengliche browserfenster
		parent.opener.window.location = 'menu.html';
		// fullscreen-Fenster abschiessen
		setTimeout('parent.close();',250);
}

// ---------------------------------------------------------------------------------

function isFullscreen() {
	if (parent.window.name == "FullscreenWBT") {
		return true;
	} else {
		return false;	
	}
}

// ---------------------------------------------------------------------------------

function exitWBT() {
	if (isFullscreen() == true) {
		parent.close();
	} else {
		top.window.location ='menu.html';
	}
}

// ---------------------------------------------------------------------------------

function debug() {
	var debugString;
	debugString = "screen.availWidth: " + screen.availWidth + "\n";
	debugString += "screen.availHeight: " + screen.availHeight + "\n";
	debugString += "screen.width: " + screen.width + "\n";
	debugString += "screen.height: " + screen.height + "\n";
	debugString += "NS --> screen.availLeft: " + screen.availLeft + "\n";
	debugString += "NS --> screen.availTop: " + screen.availTop + "\n";
	alert(debugString);
}

function getHttpParameter(paramName) {
	query = location.search;
	a = query.indexOf(paramName);
	k = query.substring(a);
	b = k.indexOf("&");
	if (b == -1) b = k.length;
	mypar = k.substring(0, b);
	mypar = mypar.substring(mypar.indexOf("=") + 1);
	return mypar;
}

