// JavaScript Document



// show hidden layer on content-print
function showHiddenTables(){
	d=document;
	el=d.getElementsByTagName('table');
	for(i=0;i<el.length;i++){
		el[i].visibility == "visible";
		el[i].position == "relative";
	}
}
//-------------------------------------------


// Show Hide Layer
	function aLs(layerID){
		var isIE = false;
		var isOther = false;
		var isNS4 = false;
		var isNS6 = false;
		if(document.getElementById){
			if(!document.all){
				isNS6=true;
			}
			if(document.all){
				isIE=true;
			}
		}else{
			if(document.layers){
				isNS4=true;
			}else{
				isOther=true;
			}
		}
		var returnLayer;
			if(isIE){
				returnLayer = eval("document.all." + layerID + ".style");
			}
			if(isNS6){
				returnLayer = eval("document.getElementById('" + layerID + "').style");
			}
			if(isNS4){
				returnLayer = eval("document." + layerID);
			}
			if(isOther){
				returnLayer = "null";
				alert("-[Error]-\nDue to your browser you will probably not\nbe able to view all of the following page\nas it was designed to be viewed. We regret\nthis error sincerely.");
			}
		return returnLayer;
	}
	function HideShow(ID){
		/*
		if((aLs(ID).visibility == "visible") || (aLs(ID).visibility == "")){
			aLs(ID).visibility = "hidden";
			aLs(ID).position = "absolute";
			SetCookie(ID,'closed',null,'/');
		}else if(aLs(ID).visibility == "hidden"){
			aLs(ID).visibility = "visible";
			aLs(ID).position = "relative";
			SetCookie(ID,'opened',null,'/');
		}
		*/
		if((aLs(ID).display == "block") || (aLs(ID).display == "")){
			aLs(ID).display = "none";
			SetCookie(ID,'closed',null,'/');
			getDocHeight('afterPostLayer');
		}else if(aLs(ID).display == "none"){
			aLs(ID).display = "block";
			SetCookie(ID,'opened',null,'/');
			getDocHeight('afterPostLayer');
		}
	}
	function HideShowAbsolute(ID){
		if((aLs(ID).visibility == "visible") || (aLs(ID).visibility == "")){
			aLs(ID).visibility = "hidden";
			aLs(ID).position = "absolute";
		}else if(aLs(ID).visibility == "hidden"){
			aLs(ID).visibility = "visible";
			aLs(ID).position = "absolute";
		}
	}
//------------------------------------------------------------------------------------------

// base64 funktionen
	var base64_keyStr = "ABCDEFGHIJKLMNOP" +
				 "QRSTUVWXYZabcdef" +
				 "ghijklmnopqrstuv" +
				 "wxyz0123456789+/" +
				 "=";

	function base64_encode(input) {
		var output = "";
		var chr1, chr2, chr3 = "";
		var enc1, enc2, enc3, enc4 = "";
		var i = 0;

		do {
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output + 
			base64_keyStr.charAt(enc1) + 
			base64_keyStr.charAt(enc2) + 
			base64_keyStr.charAt(enc3) + 
			base64_keyStr.charAt(enc4);
			chr1 = chr2 = chr3 = "";
			enc1 = enc2 = enc3 = enc4 = "";
		}
		while (i < input.length);
		return output;
	}

	function base64_decode(input) {
		var output = "";
		var chr1, chr2, chr3 = "";
		var enc1, enc2, enc3, enc4 = "";
		var i = 0;

		// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
		var base64test = /[^A-Za-z0-9\+\/\=]/g;
		if (base64test.exec(input)) {
		alert("There were invalid base64 characters in the input text.\n" +
			  "Valid base64 characters are A-Z, a-z, 0-9, '+', '/', and '='\n" +
			  "Expect errors in decoding.");
		}
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		do {
			enc1 = base64_keyStr.indexOf(input.charAt(i++));
			enc2 = base64_keyStr.indexOf(input.charAt(i++));
			enc3 = base64_keyStr.indexOf(input.charAt(i++));
			enc4 = base64_keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

			chr1 = chr2 = chr3 = "";
			enc1 = enc2 = enc3 = enc4 = "";

		}
		while (i < input.length);
		return output;
	}
//------------------------------------------------------------------------------------------

// Cookie Funktionen
	function getCookieVal (offset) { 
		var endstr = document.cookie.indexOf (";", offset); 
		if (endstr == -1) 
		endstr = document.cookie.length; 
		return unescape(document.cookie.substring(offset, endstr));
	}
	function GetCookie (name) { 
		var arg = name + "="; 
		var alen = arg.length; 
		var clen = document.cookie.length; 
		var i = 0; 
		while (i < clen) { 
		var j = i + alen; 
		if (document.cookie.substring(i, j) == arg) 
		return getCookieVal (j); 
		i = document.cookie.indexOf(" ", i) + 1; 
		if (i == 0) break; 
		} 
		return null;
	}
	function SetCookie (name, value) { 
		var argv = SetCookie.arguments; 
		var argc = SetCookie.arguments.length; 
		var expires = (argc > 2) ? argv[2] : null; 
		var path = (argc > 3) ? argv[3] : null; 
		var domain = (argc > 4) ? argv[4] : null; 
		var secure = (argc > 5) ? argv[5] : false; 
		document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) + 
		((domain == null) ? "" : ("; domain=" + domain)) + 
		((secure == true) ? "; secure" : "");
	}
	function DeleteCookie (name) { 
		var exp = new Date(); 
		exp.setTime (exp.getTime() - 1); 
		var cval = GetCookie (name); 
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}
//------------------------------------------------------------------------------------------
