/**
 * default client page functions
 *
 * Diese Datei enth�lt die Scripte f�r die clientseitigen Standard-Ansteuerungen
 *
 * @category common
 * @package main
 * @subpackage javascript
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @filesource
 **/


// globale Variablen
var int_rollOutTimer = null;
var obj_lastRollOut	 = null;
// var int_footerbarRotation = 0;
var boo_rollOut = true;
var boo_discardWCH 	= true;
var int_footerBarSpaceOriginalHeight = 0;
var boo_isNS4 			= (document.layers)?1:0;
var boo_isDom 			= (document.getElementById && !document.all);
var boo_isIE4 			= (document.all)?1:0;
var boo_isOpera 		= navigator.userAgent.indexOf("Opera");
var boo_isMozilla 	= navigator.appName=="Netscape" && navigator.appCodeName=="Mozilla" && !document.all;
var boo_isMac 			= navigator.userAgent.indexOf("Mac")!= -1;
var boo_isIE				= navigator.appName=="Microsoft Internet Explorer";




/**
 * Creates an enumarator object.
 * Usage:
 *   enum = new Enum('system', 'user', 'usergroup');
 *   alert(enum.system);
 *   alert(enum.user);
 *   alert(enum.usergroup);
 *
 * @author Matthias Ptaszynski
 * @copyright 2006 - KP3 Medien GmbH, Berlin
 */
function Enum()
{
	var arr_argv = Enum.arguments;
	var int_argc = Enum.arguments.length;
	if(int_argc){
		int_count = 0;
		for(i=0; i<int_argc; ++i){
			if(isArray(arr_argv[i])){
				var int_length = arr_argv[i].length;
				for(k=0; k<int_length; ++k){
					eval("this."+arr_argv[i][k]+" = "+int_count);
					++int_count;
				}
			}
			else{
				//eval("this."+arr_enum[i]+" = "+(i+1));
				eval("this."+arr_argv[i]+" = "+int_count);
				++int_count;
			}
		}
	}
}



function cls_000_enum()
{
	var arr_argv = Enum.arguments;
	var int_argc = Enum.arguments.length;
	if(int_argc){
		int_count = 0;
		for(i=0; i<int_argc; ++i){
			if(isArray(arr_argv[i])){
				var int_length = arr_argv[i].length;
				for(k=0; k<int_length; ++k){
					eval("this."+arr_argv[i][k]+" = "+int_count);
					++int_count;
				}
			}
			else{
				//eval("this."+arr_enum[i]+" = "+(i+1));
				eval("this."+arr_argv[i]+" = "+int_count);
				++int_count;
			}
		}
	}
}



/**
 * this function handles the blocking and unblocking of buttons
 *
 * Die Funktion sperrt und entsperrt die Buttonfunktionen
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param optional boolean true|false set page to sent or not sent, default is sent
 **/

function setPageAlreadySent() {

	if (arguments.length > 0) {
		if (arguments[0] == true)
			boo_pageAlreadySent = true;
		else
			boo_pageAlreadySent = false;
	}
	else {
		boo_pageAlreadySent = true;
	}
}


/**
 * this function handles the explode-Button of the Debug-Message
 *
 * Diese Funktion schalten zwischen kleiner und gro�er Ansicht des
 * Debug-Divs um
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @return boolean false
 **/

function resizeDebugMessage() {
	if (obj_debugMessage = document.getElementById('debugMessage')) {
		if (obj_debugMessage.style.height) {
			obj_debugMessage.style.height = null;
		} else {
			obj_debugMessage.style.overflow = 'hidden';
			obj_debugMessage.style.height 	= '20px';
		}
	}
	return false;
}


/**
 * this function changes the display-Mode of an object
 *
 * Die Funktion �ndert den display-Modus eines Objekts
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 * @param string str_value display value to set
 **/

function setDisplayMode(id, str_value) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.display = str_value;
	}
}

function setDisplayModeCategory(id, str_value) {
	if(boo_rollOut){
		if (document.getElementById(id)) {
			document.getElementById(id).style.display = str_value;
		}
	}
}

/**
 * this function changes the style class of an object
 *
 * Die Funktion �ndert die style klasse eines Objekts
 *
 * @author Martin Specht Dennis Klein
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 * @param string str_value display value to set
 **/

function setStyleClassName(id, str_value) {
	if (document.getElementById(id)) {
		document.getElementById(id).className = str_value;
	}
}


/**
 * this function explodes hidden menu-Divs
 *
 * Die Funktion blendet verborgene Men�-Divs ein. Ein bereits
 * ge�ffnetes Div wird ausgeblendet
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 **/

function explodeRollOut(id) {

	if (document.getElementById(id)) {
		obj_rollOut = document.getElementById(id);

		if ((obj_lastRollOut != null) && (obj_rollOut.id != obj_lastRollOut.id)) {
			setDisplayMode(obj_lastRollOut.id, 'none');
		}

		window.clearTimeout(int_rollOutTimer);

		setDisplayMode(id, 'block');
		obj_lastRollOut 	= obj_rollOut;
	}

	return false;
}

// BSC 21.10.06
//function explodeRollOut(id) {
//
//	if (document.getElementById(id)) {
//		obj_rollOut = document.getElementById(id);
//
//		if ((obj_lastRollOut != null) && (obj_rollOut.id != obj_lastRollOut.id)) {
//			setDisplayMode(obj_lastRollOut.id, 'none');
//		}
//
//		window.clearTimeout(int_rollOutTimer);
//
//		setDisplayMode(id, 'block');
//		obj_lastRollOut 	= obj_rollOut;
//	}
//
//	return false;
//}

/**
 * this function explodes hidden menu-Divs
 *
 * Die Funktion blendet verborgene Men�-Divs ein. Ein bereits
 * ge�ffnetes Div wird ausgeblendet
 *
 * @author Martin Specht, Benjamin Schulz
 * @copyright 2006 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 **/

function explodeRollOutDelay(id) {
	if (document.getElementById(id)) {
		obj_rollOut = document.getElementById(id);

//		if ((obj_lastRollOut != null) && (obj_rollOut.id != obj_lastRollOut.id)) {
//			setDisplayMode(obj_lastRollOut.id, 'none');
//		}

		window.clearTimeout(int_rollOutTimer);

		var int_position 	= id.search(/_/);
		var str_prefix 		= id.substr(0,int_position+1);
		var int_number 		= id.substr(int_position+1);
		var int_check 		= int_number;

		var int_counter = 0;

		if((int_check++) >-1){
			while(document.getElementById(str_prefix+int_counter)){
				if(int_counter != int_number){
					window.setTimeout('setDisplayMode(\''+str_prefix+int_counter+'\', \'none\');', int_varconMenuOpenTime);
//					obj_rollOut2 = document.getElementById(str_prefix+int_counter);
//					window.setTimeout('WCH.Discard(\''+obj_rollOut2.id+'\', \''+obj_rollOut2.parentNode.id+'\');', int_varconMenuHoldTime);
				}
				int_counter++;
			}
			window.setTimeout('setDisplayModeCategory(\''+id+'\', \'block\');', int_varconMenuOpenTime);
			if(boo_browserIsIE){
				window.setTimeout('WCH.Apply(\''+obj_rollOut.id+'\', \''+obj_rollOut.parentNode.id+'\', \''+true+'\');', int_varconMenuOpenTime);
			}
		}
//		else{
//			setDisplayMode(id, 'block');
//		}
//		if((typeof obj_lastRollOut) == 'object' & obj_lastRollOut != null){
//			if(obj_lastRollOut.id != obj_rollOut.id){
				boo_discardWCH = false;
//				if(((typeof obj_lastRollOut) == 'object' & obj_lastRollOut != null) & obj_lastRollOut.id == obj_rollOut.id){
//					window.setTimeout('boo_discardWCH = true;', int_varconMenuHoldTime);
//			}
//		}
		obj_lastRollOut 	= obj_rollOut;
	}
	return false;
}


/**
 * this function implodes hidden menu-Divs
 *
 * Die Funktion blendet Men�-Divs aus.
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 **/

function implodeRollOut(id) {
	int_rollOutTimer 	= window.setTimeout('setDisplayMode(\''+id+'\', \'none\')', int_varconMenuHoldTime);
}

// BSC 21.10.06
//function implodeRollOut(id) {
//	int_rollOutTimer 	= window.setTimeout('setDisplayMode(\''+id+'\', \'none\')', int_varconMenuHoldTime);
//}

/**
 * this function implodes hidden menu-Divs
 *
 * Die Funktion blendet Menue-Divs aus.
 *
 * @author Martin Specht, Benjamin Schulz
 * @copyright 2006 - KP3 Medien GmbH, Berlin
 * @param string id id of the object
 **/

function implodeRollOutDelay(id) {
	if (document.getElementById(id)) {
		var int_position 	= id.search(/_/);
		var str_prefix = id.substr(0,int_position+1);
		var int_number = id.substr(int_position+1);
		var int_counter = 0;
		var int_check = int_number;
		obj_rollOut = document.getElementById(id);
		boo_rollOut = false;
		boo_discardWCH = true;

		if((int_check++) >-1){
			while(document.getElementById(str_prefix+int_counter)){
				if(int_counter != int_number){
	 				window.setTimeout('setDisplayMode(\''+str_prefix+int_counter+'\', \'none\');', int_varconMenuOpenTime);
//	 				v = document.getElementById(str_prefix+int_counter);
//	 				window.setTimeout('WCH.Discard(\''+v.id+'\', \''+v.parentNode.id+'\');', 0);
				}
				int_counter++;
			}
		}
//		window.setTimeout('WCH.Discard(\''+obj_rollOut.id+'\', \''+obj_rollOut.parentNode.id+'\');', int_varconMenuHoldTime);
		window.setTimeout('boo_rollOut = true;', int_varconMenuOpenTime);

		if(boo_browserIsIE){
				window.setTimeout("discardWCH('"+id+"')", int_varconMenuHoldTime);
//			window.setTimeout('WCH.Discard(\''+obj_rollOut.id+'\', \''+obj_rollOut.parentNode.id+'\');', int_varconMenuHoldTime);
		}
		int_rollOutTimer 	= window.setTimeout('setDisplayMode(\''+id+'\', \'none\');', int_varconMenuHoldTime);
//		if(obj_lastRollOut.id != obj_rollOut.id){
//			window.setTimeout('WCH.Discard(\''+v.id+'\', \''+v.parentNode.id+'\');', 0);
//		}
//		if(obj_rollOut.hasChildNodes()){
//			obj_childNodes = obj_rollOut.childNodes
//			for(int_a = 0; int_a < obj_childNodes.length; int_a++){
//				window.setTimeout('WCH.Apply(\''+obj_childNodes[int_a].id+'\', \''+obj_childNodes[int_a].parentNode.id+'\', \''+true+'\');', int_varconMenuOpenTime);
//			}
//		}
	}
}

function discardWCH(id){
	if(document.getElementById(id)){
		obj = document.getElementById(id);
//		alert(obj.id);
		if(boo_discardWCH){
//			alert(obj.id);

//			WCH.Discard(obj.id, obj.parentNode.id);
				window.setTimeout('WCH.Discard(\''+obj.id+'\', \''+obj.parentNode.id+'\');', int_varconMenuHoldTime);
//			window.setTimeout('boo_discardWCH = true;', int_varconMenuOpenTime);
		}
	}
}

/**
 * this function returns the position of an block element
 *
 * Diese Funktion ermittelt die Position eines Block-Elements
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param object obj_target object to solve
 * @return boolean false
 **/

function getElementPosition(obj_target) {

	var arr_position 	= new Array();

	if (obj_target != null) {

		function absLeft(obj_target) {
	    return (obj_target.offsetParent) ? obj_target.offsetLeft+absLeft(obj_target.offsetParent) : obj_target.offsetLeft;
	  }

	  function absTop(obj_target) {
	     return (obj_target.offsetParent) ? obj_target.offsetTop+absTop(obj_target.offsetParent) : obj_target.offsetTop;
	  }

		arr_position['int_x']	= absLeft(obj_target);
		arr_position['int_y']	= absTop(obj_target);

	}
	else {
		arr_position['int_x']	= 0;
		arr_position['int_y']	= 0;
	}

	return arr_position;

}

/**
 * showProperty
 *
 * Diese Funktion f�hrt ein Debugging des �bergebenden Elementes durch
 *
 * @author Dirk Franzky
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param misc msc_property element to debug
 **/
function showMultiProperty(msc_property, boo_walkArray) {

	if (boo_debug == true) {

		function generateShowPropertyHtml(str_text) {
				var hiddenHTML = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
				hiddenHTML +=	"<html>\n";
				hiddenHTML += "	<head>\n";
				hiddenHTML += "		<meta http-equiv='Content-Type' content='text/html; charset="+ this.str_encoding +"' />\n";
				hiddenHTML += "		<meta http-equiv='Content-Language' content='"+ this.str_language +"' />\n";
				hiddenHTML += "		<meta http-equiv='Content-Style-Type' content='text/css' />\n";
				hiddenHTML += "		<meta http-equiv='imagetoolbar' content='no' />\n";
				hiddenHTML += "		<title>Resize Frame</title>\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/frame.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/collection.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/style.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/edit3.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/sysstyle.css' media='screen, print' />\n";
				hiddenHTML += '		<style type="text/css">'+ "\n";
				//hiddenHTML += '			body {margin:10px 10px 10px 10px; font-family: courier new; font-size:12px; color: black; background-color: lightgray; }' + "\n";
				hiddenHTML += '			hr {color: red; background-color: red; border:1px solid red;}' + "\n";
				hiddenHTML += '		<\/style>' + "\n";
				hiddenHTML += "	<\/head>\n";
				hiddenHTML += "	<body>\n";
				hiddenHTML += "		<div><button onclick='window.print();'>Fensterinhalt Drucken</button><\/div>\n";
				hiddenHTML += "		<div>" + str_text + "<\/div>\n";
				hiddenHTML += "	<\/body>\n";
				hiddenHTML += "<\/html>";

				return hiddenHTML;
		}

		try{

			obj_debug = msc_property;
			xwin 			= window.open('http://'+document.location.host+'/blank.html', 'DEBUG_WINDOW', 'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=480');

			if((obj_debug.constructor == Array ||  obj_debug.constructor == '[NodeList]') && boo_walkArray == true) {

				var str_output = '';

				for(i=0; i<obj_debug.length;i++){
					str_output += '<hr><b>DEBUG SCREEN ' + i + ' => ' +obj_debug[i]+'</b><hr>';
					for(var str_property in obj_debug[i]) {
						try {
							str_output += str_property+': '+obj_debug[i][str_property]+'<br>';
						} catch(e) {
							str_output += str_property+': (verweigert)<br>';
						}

					}
				}

			} else {

				var str_output = '';

				if(typeof(obj_debug) == 'string') {
					str_output = '<hr><b>DEBUG SCREEN</b><hr>';
					str_output += msc_property + '<br>';
				} else if (typeof(obj_debug) == 'object'){
					str_output = '<hr><b>DEBUG SCREEN</b><hr>';
					for(var str_property in obj_debug) {
						try {
							str_output += str_property+': '+obj_debug[str_property]+'<br>';
						} catch(e) {
							str_output += str_property+': (verweigert)<br>';
						}

					}
				} else {
					str_output = '<hr><b>UNDEFINIED INPUT</b><hr>';
					str_output += msc_property + '<br>';
				}
			}

			xwin.document.open();
			xwin.document.write(generateShowPropertyHtml(str_output));
			xwin.document.close();

		} catch (e) {
				showProperty(e);
		}
	}
}

/**
 * showProperty
 *
 * Diese Funktion f�hrt ein Debugging des �bergebenden Elementes durch
 *
 * @author Dirk Franzky
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param misc msc_property element to debug
 **/
function showProperty(msc_property, str_message) {

	if (boo_debug == true) {

		function generateShowPropertyHtml(str_text) {
				var hiddenHTML = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
				hiddenHTML +=	"<html>\n";
				hiddenHTML += "	<head>\n";
				hiddenHTML += "		<meta http-equiv='Content-Type' content='text/html; charset="+ this.str_encoding +"' />\n";
				hiddenHTML += "		<meta http-equiv='Content-Language' content='"+ this.str_language +"' />\n";
				hiddenHTML += "		<meta http-equiv='Content-Style-Type' content='text/css' />\n";
				hiddenHTML += "		<meta http-equiv='imagetoolbar' content='no' />\n";
				hiddenHTML += "		<title>Resize Frame</title>\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/frame.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/collection.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/style.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/edit3.css' media='screen, print' />\n";
				hiddenHTML += "		<link rel='stylesheet' type='text/css' href='css/000/win_st_x.x.x/chn_001/sysstyle.css' media='screen, print' />\n";
				hiddenHTML += '		<style type="text/css">'+ "\n";
				//hiddenHTML += '			body {margin:10px 10px 10px 10px; font-family: courier new; font-size:12px; color: black; background-color: lightgray; }' + "\n";
				hiddenHTML += '			hr {color: red; background-color: red; border:1px solid red;}' + "\n";
				hiddenHTML += '		<\/style>' + "\n";
				hiddenHTML += "	<\/head>\n";
				hiddenHTML += "	<body>\n";
				hiddenHTML += "		<div style='@print disply:none;'><button onclick='window.print();'>Fensterinhalt Drucken</button><\/div>\n";
				hiddenHTML += "		<div>" + str_text + "<\/div>\n";
				hiddenHTML += "	<\/body>\n";
				hiddenHTML += "<\/html>";

				return hiddenHTML;
		}

		try{

			obj_debug = msc_property;
			xwin 			= window.open('http://'+document.location.host+'/blank.html', 'DEBUG_WINDOW', 'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=480');

			var str_output = '';

			if(typeof(obj_debug) == 'string') {
				str_output = '<hr><b>DEBUG SCREEN</b><hr>';
				if(str_message) str_output += '<hr><b>'+str_message+'</b><hr>';
				str_output += msc_property + '<br>';
			} else if (typeof(obj_debug) == 'object'){
				str_output = '<hr><b>DEBUG SCREEN</b><hr>';
				if(str_message) str_output += '<hr><b>'+str_message+'</b><hr>';
				for(var str_property in obj_debug) {
					try {
						str_output += str_property+': '+obj_debug[str_property]+'<br>';
					} catch(e) {
						str_output += str_property+': (verweigert)<br>';
					}

				}
			} else {
				str_output = '<hr><b>UNDEFINIED INPUT</b><hr>';
				str_output += msc_property + '<br>';
			}

			xwin.document.open();
			xwin.document.write(generateShowPropertyHtml(str_output));
			xwin.document.close();

		} catch (e) {
				showProperty(e);
		}
	}
}

/**
 * this function returns the innerSize of an Frame
 *
 * Diese Funktion berechnet browserabhängig die Größe
 * des Fensters (innerSize)
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @return boolean false
 **/

function getFrameInnerSize() {

	var arr_return = new Array();

	if (self.innerHeight && !boo_isIE) {
		// alle außer IE
		arr_return['int_width'] 	= self.innerWidth;
		arr_return['int_height'] 	= self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// IE >= 6.0

		arr_return['int_width'] 	= document.documentElement.clientWidth;
		arr_return['int_height'] 	= document.documentElement.clientHeight;
	} else if (document.body) {
		// IE Rest
		arr_return['int_width'] 	= document.body.clientWidth;
		arr_return['int_height'] 	= document.body.clientHeight;
	}
	return arr_return;

}


/**
 * gets the scroll Position of a page
 *
 * Diese Funktionliefert die aktuelle Scrollposition
 * browserabhängig
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @return boolean false
 **/

function getFrameScrollOffset() {

	var arr_return = new Array();

	if (self.pageYOffset) {
		// alle außer IE
		arr_return['int_left'] 	= self.pageXOffset;
		arr_return['int_top'] 	= self.pageYOffset;
	}	else if (document.documentElement && document.documentElement.scrollTop) {
		// IE >= 6.0
		arr_return['int_left'] 	= document.documentElement.scrollLeft;
		arr_return['int_top'] 	= document.documentElement.scrollTop;
	}	else if (document.body) {
		// alle anderen IE
		arr_return['int_left'] 	= document.body.scrollLeft;
		arr_return['int_top'] 	= document.body.scrollTop;
	}
	return arr_return;
}

/**
 *
 *
 *
 *
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

function getDivHeight() {

	var int_divHeight = 0;

	for(var i=0; i < arguments.length; i++) {
		if (document.getElementById(arguments[i])) {
			int_divHeight += document.getElementById(arguments[i]).offsetHeight;
		}
	}
	return int_divHeight;
}


/**
 *
 *
 *
 *
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

var obj_initFooterPositionTimeout;

function initFooterPosition() {

	window.clearTimeout(obj_initFooterPositionTimeout);

	// if there are yet unsized images reload this function all 500 ms
	var boo_allImageComplete = false;

	if (document.getElementsByTagName) {
		arr_imgList = document.getElementsByTagName('img');
		boo_allImageComplete = true;
		for (var int_imageCount = 0; int_imageCount < arr_imgList.length; int_imageCount++) {
			boo_allImageComplete = boo_allImageComplete && arr_imgList[int_imageCount].complete;
			// set attributes width and height only if agent is IE
			if ((arr_imgList[int_imageCount].complete == true) && (boo_isIE == true)) {
				arr_imgList[int_imageCount].style.height = arr_imgList[int_imageCount].height + 'px';
				arr_imgList[int_imageCount].style.width = arr_imgList[int_imageCount].width + 'px';
			}
		}
	}

	if (boo_allImageComplete == true) {

		var str_hash = document.location.hash;

		int_deltaBrowser = -1; //(boo_isMozilla) ? -1: 0;

		if ((document.location.search.lastIndexOf('window') == -1) || (document.location.search.lastIndexOf('window=win_main') > -1)) {
			boo_popup = false;
		} else {
			boo_popup = true;
		}

		if (!boo_popup) {

			// no popup
			if (arr_varconContentDiv && arr_varconContentDiv.length) {

				int_contentHeight = 0;

				for(i = 0; i < arr_varconContentDiv.length; i++) {
					int_contentHeight += getDivHeight(arr_varconContentDiv[i]);
				}
			} else {
				int_contentHeight = getDivHeight('logoExclusionZone', 'upperExclusionZone', 'contentContainer');
			}

			if (arr_varconNavigationDiv && arr_varconNavigationDiv.length) {
				int_menuHeight = 0;
				for(j = 0; j < arr_varconNavigationDiv.length; j++) {
					int_menuHeight += getDivHeight(arr_varconNavigationDiv[j]);
				}
			} else {
				int_menuHeight = getDivHeight('logoExclusionZone', 'upperExclusionZone', 'mainNavigation');
			}

			int_windowInnerHeight	= getFrameInnerSize()['int_height'];
			int_footerHeight			= getDivHeight('footerbar');

			if (int_footerBarSpaceOriginalHeight == 0) {
				int_footerBarSpaceOriginalHeight = getDivHeight('footerbarSpace') ;
			} else {
				document.getElementById('footerbarSpace').style.height = int_footerBarSpaceOriginalHeight + 'px';
				int_footerHeight									= getDivHeight('footerbar');
			}


			int_bodyHeight										= (int_contentHeight > int_menuHeight) ? int_contentHeight + int_footerHeight : int_menuHeight + int_footerHeight;
			int_bodyOriginalHeight						= (int_contentHeight > int_menuHeight) ? int_contentHeight + int_footerBarSpaceOriginalHeight : int_menuHeight + int_footerBarSpaceOriginalHeight;
			int_deltaSpacer 	 								= (int_contentHeight > int_menuHeight) ? 0 : int_menuHeight - int_contentHeight;

			if (int_bodyOriginalHeight < int_windowInnerHeight) {
				int_deltaSpacer += int_windowInnerHeight - int_bodyOriginalHeight;
			}

			int_newHeight = int_footerbar_main_correction	+ int_deltaSpacer + int_deltaBrowser - int_footerHeight + int_footerBarSpaceOriginalHeight;
			if (int_newHeight > 0) {
				document.getElementById('footerbarSpace').style.height =  int_newHeight + 'px';
			}

		} else {

			// popup

			if (int_footerBarSpaceOriginalHeight <= 0) {
				int_footerBarSpaceOriginalHeight 	= getDivHeight('footerbarSpace');
			} else {
				document.getElementById('footerbarSpace').style.height = int_footerBarSpaceOriginalHeight + 'px';
			}
			int_contentHeight 								= getDivHeight('sysPopupContainer');
			arr_frameSize 										= getFrameInnerSize();
			int_windowInnerHeight							= arr_frameSize['int_height'];
			if (int_windowInnerHeight > int_contentHeight) {
				int_deltaSpacer = int_windowInnerHeight - int_contentHeight
				if(document.getElementById('footerbarSpace')) {
					document.getElementById('footerbarSpace').style.height = (int_footerbar_popup_correction+int_deltaSpacer+int_deltaBrowser) + 'px';
				}
			}
		}

		// set position of all container- and collectionMenu(s)
		arr_divList = document.getElementsByTagName('div');
		for (i = 0; i < arr_divList.length; i++) {
			if (arr_divList[i].className == 'edit3CollectionMenuRow' || arr_divList[i].className == 'edit3ContainerMenu') {
				var str_innerHtml = arr_divList[i].innerHTML;
				arr_divList[i].innerHTML = str_innerHtml;
			}
		}

	} else {
		// int_footerbarRotation++;
		obj_initFooterPositionTimeout = window.setTimeout('initFooterPosition()', 1500);

	}
//	if(boo_browserIsIE){
		rebuildDisableMenuPosition();
//	}
}

function scrollToObject(obj_target) {

	// if there are yet unsized images reload this function all 500 ms
	var boo_allImageComplete = false;

	if (document.getElementsByTagName) {
		arr_imgList = document.getElementsByTagName('img');
		boo_allImageComplete = true;
		for (i = 0; i < arr_imgList.length; i++) {
			boo_allImageComplete = boo_allImageComplete && arr_imgList[i].complete;
		}
	}

	if (boo_allImageComplete == true) {
			var arr_position = getElementPosition(obj_target)
			window.scrollTo(arr_position['int_x'], parseInt(arr_position['int_y'])-50);
	}
	else {
		window.setTimeout('scrollToObject(document.getElementById(\''+obj_target.id+'\'))', 500);
	}
}


/**
 * gets called on event "onbeforeunload"
 * used to cancel active ajax-requests
 *
 * @author Stefan Schramm
 * @copyright 2006 - KP3 Medien GmbH, Berlin
 **/

function onBeforeUnload() {

	// if object exists, set onreadystatechange = null
	if (obj_http) {
		obj_http.onreadystatechange = function () {};
		obj_http.abort();
	}

}



/**
 * setOverallDiv()
 *
 * Die Funktion erzeugt ein transparentes div-Element und spannt dieses über
 * den relevanten Bereich des dargestellten Browserfensters auf.
 * Somit werden darunterliegende Funktionen (Links, Buttons) deaktiviert.
 *
 * @author Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

function setOverallDiv(){

	//***************************************************//
	// 											Variablen                    //
	//																									 //
	// Namen des Objektes: 															 //
	var overallDivId 			= 'overallDiv';								 //
	//																									 //
	// Namen des Orientierungsobjektes  für die Höhe:		 //
	var useThisForHeight 	= 'footerbar';								 //
	//																									 //
	// Namen des Orientierungsobjektes für die Breite:	 //
	var useThisForWidth 	= 'upperExclusionZone';				 //
	//																									 //
	//  									Variablen ende               	 //
	//***************************************************//

	var ifObjectNotValid 					= 'body';

	if(!document.getElementById(overallDivId)){

		// Wenn das Objekt noch nicht existiert
		// erzeuge ein solches
		var newDiv 									= document.createElement('div');
		newDiv.id 									= overallDivId;

		// Positionierung

		if(document.getElementById(useThisForHeight)){
			var obj_useThisForHeight 	= document.getElementById(useThisForHeight);
			var position 							= getElementPosition(obj_useThisForHeight);
			newDiv.style.height 			= position['int_y']+'px';
		}else{
			if(document.getElementsByTagName(ifObjectNotValid)){
				var contentBody 				= document.getElementsByTagName(ifObjectNotValid)[0];
				newDiv.style.height 		= contentBody.clientHeight+'px';
			}
		}
		if(document.getElementById(useThisForWidth)){
			newDiv.style.width 				= document.getElementById(useThisForWidth).clientWidth+'px';
		}else{
			var contentBody = document.getElementsByTagName(ifObjectNotValid)[0];
			newDiv.style.width = (contentBody.offsetWidth-100)+'px';
		}

		// Style-Attribute
		// zum festlegen des Aussehens

		newDiv.style.display 	 			= 'block';
		newDiv.style.background 		= '#FFFFEE';
		newDiv.style.position   		= 'absolute';
		newDiv.style.left  		 			= '0px';
		newDiv.style.top 			 			= '0px';
		newDiv.style.zIndex 	 			= 9998;

		if(boo_browserIsIE){
			if(boo_debug & boo_sysadmin){

				// Objekt wird im Debug-Modus zur Kontrolle sichtbar gemacht
				newDiv.style.paddingLeft = '10px';
				newDiv.style.border			="solid thin red";
				newDiv.style.borderWidth= '1px';
				newDiv.style.filter			=	'Alpha(opacity=10,finishopacity=20, style=2)';
				newDiv.style.paddingTop = '100px';
				newDiv.innerHTML 				= '*debug mode*<br> id: '+newDiv.id+'<br>dimensions: '+newDiv.style.width+' * '+newDiv.style.height;
			}else{
				newDiv.style.filter			=	'Alpha(opacity=0,finishopacity=0, style=2)';
			}
		}else{
			if(boo_debug & boo_sysadmin){

				// Objekt wird im Debug-Modus zur Kontrolle sichtbar gemacht
				newDiv.style.paddingLeft = '10px';
				newDiv.style.paddingTop = window.pageYOffset+(window.innerHeight/2)+"px";
				newDiv.style.border			="solid thin red";
				newDiv.style.opacity 	 	= 0.4;
				newDiv.innerHTML 				= '*debug mode*<br> id: '+newDiv.id+'<br>dimensions: '+newDiv.style.width+' * '+newDiv.style.height;
			}else{
				newDiv.style.opacity 	 	= 0;
			}
		}

		// Das Objekt wird in die DOM-Struktur eingefügt

		document.body.appendChild(newDiv);

	}else{

		// Objekt exsistiert

		var overallDiv 							= document.getElementById(overallDivId);

		// Positioniere es neu

		if(document.getElementById(useThisForHeight)){
			var footerbar 						= document.getElementById(useThisForHeight);
			var position 							= getElementPosition(footerbar);
			overallDiv.style.height 	= position['int_y']+'px';
		}else{
			if(document.getElementsByTagName(ifObjectNotValid)){
				var contentBody 				= document.getElementsByTagName(ifObjectNotValid)[0];
				overallDiv.style.height = contentBody.clientHeight+'px';
			}
		}
		overallDiv.style.display 		= 'block';
		if(boo_debug & boo_sysadmin){
			overallDiv.style.paddingTop = (boo_browserIsIE)?(document.documentElement.scrollTop + (document.documentElement.clientHeight)/2):(window.pageYOffset+(window.innerHeight/2)+"px");
			overallDiv.style.paddingLeft = '10px';
			overallDiv.innerHTML 			= '*debug mode*<br> id: '+overallDiv.id+'<br>dimensions: '+overallDiv.style.width+' * '+overallDiv.style.height;
		}
	}
}


/**
 * setWaitingDiv()
 *
 * Die Funktion blendet die Warte-Animation ('Eieruhr') ein.
 * Ebenfalls wird die Funktion setOverallDiv() aufgerufen,
 * um die Funktionen im Hintergrund zu deaktivieren.
 *
 * @author Martin Specht, Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

function setWaitingDiv() {

	//***************************************************//
	// 											Variablen                    //
	//																									 //
	// Namen des Objektes: 															 //
	var waitingDivId 				= 'waitingDiv';							 //
	//																									 //
	// In Pixel für die Höhe:		 												 //
	var takeThisForHeight 	= '32px';			  			 			 //
	//																									 //
	// In Pixel für die Breite:	 												 //
	var takeThisForWidth 		= '32px';				 						 //
	//																									 //
	// Name für den Hintergrund-Layer  									 //
	// (muss mit dem Namen in setOverallDiv() 				   //
	// identisch sein)																	 //
	var backgroundDivName 	= 'overallDiv';							 //
	//																									 //
	//  									Variablen ende               	 //
	//***************************************************//

	if(document.getElementById(waitingDivId)){

		// Objekt exsistiert

		waitingdiv = document.getElementById(waitingDivId);

		if(waitingdiv.style.display != 'block'){

			// Wenn Objekt unsichtbar, mache es sichtbar

			// Setze den Hintergrund-Layer

			setOverallDiv();

			// Style-Attribute
			// zum festlegen des Aussehens

			waitingdiv.firstChild.style.height 	 	= takeThisForHeight;
			waitingdiv.firstChild.style.width 		= takeThisForWidth;
			waitingdiv.style.display 	 						= 'block';
			waitingdiv.style.height 	 						= waitingdiv.firstChild.style.height;
			waitingdiv.style.width 		 						= waitingdiv.firstChild.style.width;
			waitingdiv.style.background 					= 'none transparent scroll repeat 0% 0%';
			waitingdiv.style.position   					= 'absolute';
			waitingdiv.style.zIndex 	 						= 9999;

			if(boo_debug & boo_sysadmin){

				// Objekt wird im Debug-Modus zur Kontrolle sichtbar gemacht
//				waitingdiv.innerHTML 								= '*debug mode*<br> id: '+waitingdiv.id+'<br>dimensions: '+waitingdiv.style.width+' * '+waitingdiv.style.height;
				waitingdiv.style.border							= 'solid thin red';
				waitingdiv.style.borderWidth 				= '1px';
			}

			// Positionierung
//			alert(str_myBrowser);
			if(boo_browserIsIE){
				waitingdiv.style.left  		 					= document.documentElement.scrollLeft + (document.documentElement.clientWidth)/2;
				waitingdiv.style.top 			 					= document.documentElement.scrollTop + (document.documentElement.clientHeight)/2;
				waitingdiv.style.filter							=	'Alpha(opacity=100,finishopacity=100, style=2)';

				// Objekt bei der WCH-Klasse registriert, näheres s. WCH-Klasse

				WCH.Apply(waitingdiv.id, waitingdiv.parentNode.id, true);
			}else{
				waitingdiv.style.left  		 					= window.pageXOffset+(window.innerWidth/2)+"px";
				waitingdiv.style.top 			 					= window.pageYOffset+(window.innerHeight/2)+"px";
				waitingdiv.style.opacity 	 					= 1.0;
			}
//			window.setTimeout("setWaitingDiv()", 10000);
		}else{

			// Objekt ist sichtbar, mache es unsichtbar

			if(boo_browserIsIE){

				// Objekt wird bei der WCH-Klasse abgemeldet, näheres s. WCH-Klasse

				WCH.Discard(waitingdiv.id, waitingdiv.parentNode.id);
			}
			waitingdiv.style.display 															 	 = 'none';
			document.getElementById(backgroundDivName).style.display = 'none';
		}
	}
}


/**
 *
 *
 *
 *
 *
 * @author Martin Specht
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

function hideWaitingDiv() {

		setDisplayMode('waitingDiv', 'none');

}


/**
 * rebuildDisableMenuPosition()
 *
 *
 *
 *
 * @author Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param
 * @return
 **/

function rebuildDisableMenuPosition(){
	var newDivPrefix = 'disable_';
	for(int_i = 0; int_i < arr_varconMenuName.length; int_i++){
		if(document.getElementById(newDivPrefix+arr_varconMenuName[int_i])){
			var disableDiv	 				= document.getElementById(newDivPrefix+arr_varconMenuName[int_i]);
			var divToDisable 				= document.getElementById(arr_varconMenuName[int_i]);
			var position 		 				= getElementPosition(divToDisable);

			disableDiv.style.width 	= divToDisable.clientWidth+'px';
			disableDiv.style.height	= divToDisable.clientHeight+'px';
			disableDiv.style.top 		= position['int_y']+'px';
			disableDiv.style.left 	= position['int_x']+'px';
		}
	}
}


/**
 * createDisableMenu()
 *
 * erzeugt dynamisch Div-Elemente.
 * Wird von disableMenu() aufgerufen => bitte disableMenu() zum starten benutzen.
 *
 * @author Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param divname
 **/

function createDisableMenu(divname){

	// Variablen

	var newDivPrefix = 'disable_';
	var newDivZindex = 9999;

	if(divname != ''){
		if(document.getElementById(divname)){

			// Wenn das auszublendende Objekt existiert

			if(!document.getElementById(newDivPrefix+divname)){

				// Wenn das ausblendende Objekt noch nicht existiert,
				// erstelle ein Neues

				var divToDisable 				= document.getElementById(divname);
				var newDiv 							= document.createElement('div');
				var position 						= getElementPosition(divToDisable);

				newDiv.id						 		= newDivPrefix+divname;

				// Style-Attribute zum festlegen des Aussehens
				// Der cursor-Style hand existiert nicht beim FF <= v2!

				newDiv.style.display 		= 'block';
				newDiv.style.cursor 		= (boo_browserIsIE)?'hand':'text';
				newDiv.style.width 			= divToDisable.clientWidth+'px';
				newDiv.style.height 		= divToDisable.clientHeight+'px';
				newDiv.style.top 				= position['int_y']+'px';
				newDiv.style.left 			= position['int_x']+'px';
				newDiv.style.position		= 'absolute';
				newDiv.style.background = '#FFFFFF';
				newDiv.style.zIndex 		= newDivZindex;

				if(boo_browserIsGecko){
					if(boo_debug & boo_sysadmin){

						// Objekt wird im Debug-Modus zur Kontrolle sichtbar gemacht

						newDiv.style.opacity 	= 0.4;
						newDiv.style.border		= 'solid thin red';
						newDiv.style.color 		= 'red';
						newDiv.innerHTML 			= '*debug mode*<br> id: '+newDivPrefix+divname+'<br>dimensions: '+newDiv.style.width+' * '+newDiv.style.height;
					}else{
						newDiv.style.opacity 	= 0;
					}
				}

				if(boo_browserIsIE){
					if(boo_debug & boo_sysadmin){

						// Objekt wird im Debug-Modus zur Kontrolle sichtbar gemacht

						newDiv.style.filter				=	'Alpha(opacity=20, finishopacity=30, style=2)';
						newDiv.style.border				= 'solid thin red';
						newDiv.style.borderWidth	= '1px';
						newDiv.innerHTML 					= '*debug mode*<br> id: '+newDivPrefix+divname+'<br>dimensions: '+newDiv.style.width+' * '+newDiv.style.height;
					}else{
						newDiv.style.filter				=	'Alpha(opacity=0, finishopacity=0, style=2)';
					}
				}

				// Dem Objekt wird eine onClick-Event hinzugefügt.
				newDiv.onclick = function (){

					// Es wird die Methode openModalDialog() aufgerufen, welche ein Popup-Fenster öffnet

					openModalDialog('index.php?id_navigation=711&window=win_popup', arr_varconWindowSize['m']['int_width']+int_varconWindowDeltaWidth, arr_varconWindowSize['m']['int_height']+int_varconWindowDeltaHeight,'enableMenu','');
				};

				// Der Dokument wird das aktuelle Objekt hinzugefügt

				document.body.appendChild(newDiv);

				// ...und in der DOM-Struktur vor dem auszublendenen Objekt positioniert

				divToDisable.parentNode.insertBefore(newDiv, divToDisable);

				if(boo_browserIsIE){

					// Falls Browser ein IE ist, muss das erzeugte Objekt erneut positioniert werden

					window.setTimeout("rebuildDisableMenuPosition()", 2000);
				}
			}
		}
	}
}


/**
 * enableMenu()
 *
 * Löscht die mit createDisableMenu() erzeugten Objekte aus dem DOM.
 * Wird aufgerufen, wenn im openModalDialog das Abbrechen bejaht wurde.
 *
 *
 * @author Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param divname String
 **/

function enableMenu(divname){
	var newDivPrefix = 'disable_';
	if(divname == 'all'){

		// Alle Objekte, definiert in der varcon.inc.php, werden gelöscht.

		for(int_i = 0; int_i < arr_varconMenuName.length; int_i++){
			if(document.getElementById(newDivPrefix+arr_varconMenuName[int_i])){
				disableDiv 								= document.getElementById(newDivPrefix+arr_varconMenuName[int_i]);
				disableDiv.style.display 	= 'none';
				disableDiv.parentNode.removeChild(disableDiv);
			}
		}
	}else{
		if(divname != ''){

			// Lösche Objekt gemäß Übergabeparameter

			if(document.getElementById(newDivPrefix+divname)){
				disableDiv 								= document.getElementById(newDivPrefix+divname);
				disableDiv.style.display 	= 'none';
				disableDiv.parentNode.removeChild(disableDiv);
			}else{
				if(boo_debug & divname != null){

					// Fehlerausgabe im Debug-Modus bei nicht vorhandenen Objekten

					alert('function enableMenu(\''+divname+'\'):\n\nCannot process \''+newDivPrefix+divname+'\':\nObject not found.');
				}
			}
		}else{
			if(boo_debug){

				// Fehlerausgabe im Debug-Modus bei leerem Übergabeparameter

				alert('No params given.\nCannot execute empty string');
			}
		}
	}

	// Wenn Funktion vom modalDialogWindow aufgerufen wurde
	// und die Anweisung zum Schließen kam, wird die Shutdown-Funktion wiederum aufgerufen

	if(obj_modalDialogWindow.msc_returnValue > 0){
		fct_001_submitPageAfterRteShutdown();
	}
}


/**
 * disableMenu()
 *
 * Diese Funktion erstellt dynamisch transparente Layer und legt diese
 * über definierte Objekte, um die Benutzung derer zu verhindern.
 *
 * Anwedung findet die Funktion im CMS beim editieren von Inhalten,
 * um das versehentliche Verlassen des Redaktionsmodus zu verhindern.
 *
 * @author Benjamin Schulz
 * @copyright 2005 - KP3 Medien GmbH, Berlin
 * @param divname => 'all' übernimmt festgelegte Werte in aus der varcon.inc.php
  **/

function disableMenu(divname){
	var int_timeout	= (boo_browserIsIE)? 1000 : 1000;
	if(divname == 'all'){
		for(int_i = 0; int_i < arr_varconMenuName.length; int_i++){
			window.setTimeout("createDisableMenu('"+arr_varconMenuName[int_i]+"')", int_timeout);
		}
	}else{
		window.setTimeout("createDisableMenu('"+divname+"')", int_timeout);
	}
}


/**
 *
 * call function on enter (keypress)
 *
 * Beispiel fuer Benutzung in einem Inputfield:
 * onfocus="document.onkeydown = function (obj_event) { fct_000_doFunctionOnEvent(obj_event, 'doBeforeSubmit(\&#039;005_mst_2\&#039;, Array());'); }" onblur="document.onkeydown = null;"
 *
 * @author Stefan Schramm
 * @copyright 2006 - KP3 Medien GmbH, Berlin
 * @param str_function Name of function that should be called
 * @return
 **/
function fct_000_doFunctionOnEvent(obj_event, str_function) {
	if ( ! obj_event) {
		obj_event = window.event;
	}
	if (obj_event.keyCode == 13) {
		eval(str_function);
	}
}