if (typeof(Sohomint) == 'undefined') {
    Sohomint = {};
}
//document.writeln("");
document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/lib/jquery.js\"><\/script>");
document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/lib/interface/iutil.js\"><\/script>");
document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/lib/interface/idrag.js\"><\/script>");
document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/lib/interface/idrop.js\"><\/script>");

//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/util.js\"><\/script>");

HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
	   var r = this.ownerDocument.createRange();
	   r.setStartBefore(this);
	   var df = r.createContextualFragment(sHTML);
	   this.parentNode.replaceChild(df, this);
	});

	function basicTrim(str) {
	    return (str.replace(/\s+$/,"").replace(/^\s+/,""));
	};

	String.prototype.leftTrim = function () {
	    return (this.replace(/^\s+/,""));
	 };
	String.prototype.rightTrim = function () {
	    return (this.replace(/\s+$/,""));
	  };
	// kombiniert "leftTrim" und "rightTrim";
	  String.prototype.basicTrim = function () {
	    return (this.replace(/\s+$/,"").replace(/^\s+/,""));
	  };
	// dampft leerzeichen(-sequenzen) innerhalb einer zeichenkette auf ein einzelnes
	// "space" ein;
	  String.prototype.superTrim = function () {
	    return(this.replace(/\s+/g," ").replace(/\s+$/,"").replace(/^\s+/,""));
	  };

	// zugabe: entfernt alle leerzeichen aus einer zeichenkette;
	  String.prototype.removeWhiteSpaces = function () {
	    return (this.replace(/\s+/g,""));
	  };
	  
	  function insertX(aTag, eTag,inputId) {
	  insert(aTag, eTag,inputId);
	  };
	  

	 function insert(aTag, eTag,inputId) {
	  var input = document.getElementById(inputId);
	  var _link = "";
	  if (aTag == "[url]") {
	    linkinput = document.getElementById(inputId + "_link");
	  	_link = basicTrim(linkinput.value);
	  	if (_link == "") {
	  		return;
	  	}
	  	aTag = "[url=" + _link + "]";
	  }

	  // var input = //document.forms['textForm'].elements['text'];
	  input.focus();
	  /* fÃ¼r Internet Explorer */
	  if(typeof document.selection != 'undefined') {
	    /* EinfÃ¼gen des Formatierungscodes */
	    var range = document.selection.createRange();
	    var insText = range.text;
	    range.text = aTag + insText + eTag;
	    /* Anpassen der Cursorposition */
	    range = document.selection.createRange();
	    if (insText.length == 0) {
	      range.move('character', -eTag.length);
	    } else {
	      range.moveStart('character', aTag.length + insText.length + eTag.length);      
	    }
	    range.select();
	  }
	  /* fÃ¼r neuere auf Gecko basierende Browser */
	  else if(typeof input.selectionStart != 'undefined')
	  {
	    /* EinfÃ¼gen des Formatierungscodes */
	    var start = input.selectionStart;
	    var end = input.selectionEnd;
	    var insText = input.value.substring(start, end);
	    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
	    /* Anpassen der Cursorposition */
	    var pos;
	    if (insText.length == 0) {
	      pos = start + aTag.length;
	    } else {
	      pos = start + aTag.length + insText.length + eTag.length;
	    }
	    input.selectionStart = pos;
	    input.selectionEnd = pos;
	  }
	  /* fÃ¼r die Ã¼brigen Browser */
	  else
	  {
	    /* Abfrage der EinfÃ¼geposition */
	    var pos;
	    var re = new RegExp('^[0-9]{0,3}$');
	    while(!re.test(pos)) {
	      pos = prompt("EinfÃ¼gen an Position (0.." + input.value.length + "):", "0");
	    }
	    if(pos > input.value.length) {
	      pos = input.value.length;
	    }
	    /* EinfÃ¼gen des Formatierungscodes */
	    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
	    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
	  }
	};

	function wordAndCharacterCounter(textAreaId) {
		wordCounter(textAreaId);
		characterCounter(textAreaId);
	};

	function toggleDivDisplay( id ) {
		var value = document.getElementById(id).style.display; 
		if ( value == "none") {
			document.getElementById( id ).style.display = 'block';
		} else {
			document.getElementById( id ).style.display = 'none';
		}
	}


	function wordCounter(textAreaId) {
		
		var text = document.getElementById(textAreaId).value.replace(/[#+-.,´`?=)(/&%$§"!^°;:_'*<>|~]/g," ");
		// var text =
		// document.getElementById(textAreaId).value.replace(/[^a-zA-Z0-9&auml;]/g,"
		// ");
		// var text = document.getElementById(textAreaId).value;
		var text1 = text.replace(/\s+/g," ");
		var woerter = text1.split(" ");
		var anzahlWoerter = woerter.length;
		if (woerter.length > 0 && woerter[0]=="")anzahlWoerter = anzahlWoerter -1;
		if (woerter.length > 0 && woerter[woerter.length-1]=="") anzahlWoerter = Math.max(0,anzahlWoerter -1);
	    document.getElementById(textAreaId+'_wordCounter').value = anzahlWoerter;
	};


	function characterCounter(textAreaId) {
		
		var text = document.getElementById(textAreaId).value;
	    document.getElementById(textAreaId+'_characterCounter').value = text.length;
		
	};

	function remainingCharacterCounter(textAreaId,maxTextLength) {
		
		var text = document.getElementById(textAreaId).value;
		var remaining = maxTextLength-text.length;
		
		document.getElementById(textAreaId+'_remainingCharacterCounter').value = remaining;
		
	};  

	function remainingCharacterCounterInnerHTML(textAreaId,maxTextLength) {
		
		var text = document.getElementById(textAreaId).value;
		var remaining = maxTextLength-text.length;
		
		document.getElementById(textAreaId+'_remainingCharacterCounter').innerHTML = remaining;
		
	};

	SM_getWindow = function () {
		var d = document, v = window, w, h, l, t;

		if( typeof v.innerWidth==='number' ) {
			w = v.innerWidth;
			h = v.innerHeight;
			l = v.pageXOffset;
			t = v.pageYOffset;
		} else if( ( v = d.documentElement ) &&    
					typeof v.clientWidth==='number' &&    
					v.clientWidth !== 0 
					|| ( v = d.body ) ) {   
			w = v.clientWidth;
			h = v.clientHeight;
			l = v.scrollLeft;
			t = v.scrollTop;
		}
		return {w: w, h: h, l: l, t: t};
	}  

	SM_getMouse = function ( e ) {
		e = e || window.event || {};
		var moux, 
			mouy,
			w = SM_getWindow(),
			minx = w.l,
			miny = w.t,
			maxx = w.w + w.l,
			maxy = w.h + w.t;
		if( typeof e.pageX==='number' ) {
			moux = e.pageX;
			mouy = e.pageY;
		} else {
			moux = e.x + w.l;
			mouy = e.y + w.t;
		}
		
			
		return new Array(moux,mouy,minx,miny,maxx,maxy);
		// document.forms.f.elements.t.value = 'mouse x =\t' + moux + '\nmouse y
		// =\t' + mouy + '\n' + 'min. x =\t' + minx + '\nmin. y =\t' + miny + '\n' +
		// 'max. x =\t' + maxx + '\nmax. y =\t' + maxy;
	}


	function openInNewWindow(url) {
		newWin = window.open();
		newWin.location.href=url;
	}


	function bm(val){
		elt = document.getElementById('bmsystem'); elt.value=val;
		elt = document.getElementById('bmname'); elt.value=document.title;
		elt = document.getElementById('bmForm'); elt.submit();
	}

	// if( window.captureEvents ) {
	// window.captureEvents( Event.MOUSEMOVE );
	// }

	// window.onscroll = getmouse;
	// window.onresize = getmouse;
	// window.document.onmousemove = getmouse;


	function be_insertTag(fieldId,tag, addFieldId,newPage,pageId) {
		aTag = "<"+tag+">";
		eTag = "</"+tag+">";
		
		var newPageCheckBox = document.getElementById(newPage);
		// alert(newPageCheckBox);
		var target = "";
		// alert(newPageCheckBox.checked+newPageCheckBox.value);
		if (newPageCheckBox.checked) {
			target = ' target="_blank"';
		}
		
	  var _link = "";
	  if (aTag == "<a>") {
	    if (!pageId) {
		  	var element = document.getElementById(addFieldId);
		  	_link = element.value.basicTrim();
	    } else {
		    var element = document.getElementById(addFieldId);
		  	_link = element.value.basicTrim();
	    	_link = "/[|smo:page["+_link+"].fullFilename|]";
	    }
	  	if (_link == "") {
	  		return;
	  	}
	  	aTag = "<a href=\"" + _link + "\"" + target + ">";
	  }

	  var input = document.getElementById(fieldId);
	  input.focus();
	  /* für Internet Explorer */
	  if(typeof document.selection != 'undefined') {
	    /* Einfügen des Formatierungscodes */
	    var range = document.selection.createRange();
	    var insText = range.text;
	    range.text = aTag + insText + eTag;
	    /* Anpassen der Cursorposition */
	    range = document.selection.createRange();
	    if (insText.length == 0) {
	      range.move('character', -eTag.length);
	    } else {
	      range.moveStart('character', aTag.length + insText.length + eTag.length);      
	    }
	    range.select();
	  }
	  /* für neuere auf Gecko basierende Browser */
	  else if(typeof input.selectionStart != 'undefined')
	  {
	    /* Einfügen des Formatierungscodes */
	    var start = input.selectionStart;
	    var end = input.selectionEnd;
	    var insText = input.value.substring(start, end);
	    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
	    /* Anpassen der Cursorposition */
	    var pos;
	    if (insText.length == 0) {
	      pos = start + aTag.length;
	    } else {
	      pos = start + aTag.length + insText.length + eTag.length;
	    }
	    input.selectionStart = pos;
	    input.selectionEnd = pos;
	  }
	  /* für die übrigen Browser */
	  else
	  {
	    /* Abfrage der Einfügeposition */
	    var pos;
	    var re = new RegExp('^[0-9]{0,3}$');
	    while(!re.test(pos)) {
	      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
	    }
	    if(pos > input.value.length) {
	      pos = input.value.length;
	    }
	    /* Einfügen des Formatierungscodes */
	    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
	    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
	  }
	}
	function getRandom( min, max ) {
		if( min > max ) {
			return( -1 );
		}
		if( min == max ) {
	    	return( min );
		}
		var r = parseInt( Math.random() * ( max+1 ) );
	    return( r + min <= max ? r + min : r );
	}


	/* Konstanten Bolck fuer das Logging */
	var SM_LOGLEVEL_DEBUG = 0;
	var SM_LOGLEVEL_INFO = 1;
	var SM_LOGLEVEL_NOTICE = 2;
	var SM_LOGLEVEL_WARNING = 3;
	var SM_LOGLEVEL_ERROR = 4;
	var SM_LOGLEVEL_FATAL = 5;
	/* Ende Konstantenblock fuer das Logging */
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/log_const.js\"><\/script>");

	var SM_LOG = "true";
	var SM_LOGLEVEL = SM_LOGLEVEL_DEBUG;
	
	if (typeof(Sohomint.Logging) == 'undefined') {
	    Sohomint.Logging = {};
	}
	Sohomint.Logging.active = SM_LOG;

	Sohomint.Logging.logLevel = SM_LOGLEVEL;	

	Sohomint.Logging.Logger = function () {};

	Sohomint.Logging.Logger.prototype = {
		isInit:	false,

		init:	function	()	{
			if (Sohomint.Logging.active == "true") {
				document.write("<div id=\"sm_debugoutput\" style=\"\"><font color=\"red\">AJAX_LOG:</font> (<a href=\"#\" onClick=\"javascript:sMLog.clear();\">clear</a>)<br/></div>");
				this.isInit = true;
			}
		},
		
		clear:	function	() {
			if (Sohomint.Logging.active == "true" && this.isInit) {
				var debugbOutputDiv = document.getElementById("sm_debugoutput");
				debugbOutputDiv.innerHTML = "<font color=\"red\">AJAX_LOG:</font> (<a href=\"#\" onClick=\"javascript:sMLog.clear();\">clear</a>)<br/>";
			}
		},	
		
		newLine:	function	(/*int*/level) {
			if (Sohomint.Logging.logLevel <= level && Sohomint.Logging.active == "true" && this.isInit) {
				this._append("");
			}
		},
		
		append:	function	(/*String*/debug,/*int*/level) {
			if (Sohomint.Logging.active == "true" && this.isInit) {
				if (Sohomint.Logging.logLevel <= level) {
					switch (level) {
						case SM_LOGLEVEL_DEBUG:
							debug = "<b>DEBUG:</b> " + debug;
							break;
						case SM_LOGLEVEL_INFO:
							debug = "<b>INFO:</b> " + debug;
							break;
						case SM_LOGLEVEL_NOTICE:
							debug = "<b>NOTICE:</b> " + debug;
							break;
						case SM_LOGLEVEL_WARNING:
							debug = "<b><font color=\"orange\">WARNING:</font></b> " + debug;
							break;
						case SM_LOGLEVEL_ERROR:
							debug = "<b><font color=\"red\">ERROR:</font></b> " + debug;
							break;
						case SM_LOGLEVEL_FATAL:
							debug = "<b><font size=\"+1\" color=\"red\">FATAL:</font></b> " + debug;
							break;
					}
					this._append(debug);
				}
			}
		},
		
		_append:	function(/*String*/debug) {
			if (Sohomint.Logging.active == "true" && this.isInit) {
				var debugbOutputDiv = document.getElementById("sm_debugoutput");
				debugbOutputDiv.innerHTML = debugbOutputDiv.innerHTML + debug + "<br/>";
			}
		}
	};
							
	var sMLog = new Sohomint.Logging.Logger;

	function initSMLog() {
		sMLog.init();
	}

	if (typeof(Sohomint.AjaxRequest) == 'undefined') {
	    Sohomint.AjaxRequest = {};
	}

	Sohomint.AjaxRequest.Request = function () {
		this.done = false;
	};

	Sohomint.AjaxRequest.Request.prototype = {
		setUrl:	function	(/*String*/url) {
			this.url = url;
			this.req = null;
			if (window.XMLHttpRequest) {     // firefox etc.
				sMLog.append("Using XMLHttpRequest",SM_LOGLEVEL_DEBUG);
				this.req = new XMLHttpRequest();
				this.req.overrideMimeType('text/xml; charset=ISO-8859-1');
			} else if (window.ActiveXObject) { // internet explorer
				sMLog.append("Using ActiveXObject",SM_LOGLEVEL_DEBUG);
				this.req = new ActiveXObject("Microsoft.XMLHTTP");
				alert('Please use a browser with XMLHttpRequest i.e FireFox');
			}
		},
		
		setParams:	function	(/*String*/params) {
			this.params = params;
		},
		
		send:	function	() {
			if (this.params != '' && typeof this.params != 'undefined') {
				this.url += "&"+this.params;
			}
			this.req.onreadystatechange = this.processResponse;
			this.req.open("POST", '/sohomint/', false);
			this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			this.req.setRequestHeader('Content-Length',  this.url.length);  
			this.req.send(this.url);  
			
		},
		
		isDone:	function	()	{
			return this.done;
		},
		
		getContent:	function	()	{
			return this.req.responseText;
		},
		
		getStatus:	function	()	{
			return this.req.status;
		},
		
		processResponse: function	() {
			//if (this.req.readyState == 4) {
			//	if (this.req.status == 200) { 
					this.done = true;
			//	}
			//}
		}
		
	};

	
	var updateCounter = 0;


	function ajaxAction(fire,update,script,params,isWaitingLayer,async) {

		if (typeof isWaitingLayer == 'undefined' ) {
			if (typeof params == 'undefined' ) {
				isWaitingLayer = false;
				params = script;
				script = null;
			} else {
				isWaitingLayer = params;
				params = script;
				script = null;
			}
		}
		

		if (typeof async == 'undefined' ) {
			async = isWaitingLayer;
		}

		sMLog.append("ajaxAction('"+fire+"','"+update+"','"+script+"','"+params+"',"+isWaitingLayer+","+async+")",SM_LOGLEVEL_DEBUG);
		
		var backendSet = false;
		if (typeof fire != 'undefined' && fire != null) {
			if ( fire.indexOf(',') != -1) {
				while (fire != "") {
					var fireField = fire;
					if ( fire.indexOf(',') != -1) {
						fireField = fire.substr(0,fire.indexOf(','));
						fire = fire.substr(fire.indexOf(',')+1);
					} else {
						fire = "";
					}
					if(fireField.indexOf(':') != -1) {
						servletName = fireField.substr(0,fireField.indexOf(':'));
						if (servletName.substr(0,7) == "backend") {
							backendSet = true;
						}
						fireField = fireField.substr(fireField.indexOf(':') + 1);
					}
					ajaxFire(servletName,fireField,params);
				}
			} else {
				if(fire.indexOf(':') != -1) {
						servletName = fire.substr(0,fire.indexOf(':'));
						if (servletName.substr(0,7) == "backend") {
							backendSet = true;
						}
						fire = fire.substr(fire.indexOf(':') + 1);
						ajaxFire(servletName,fire,params);
				} else {
					sMLog.append("No servletName set for fire: \"" + fire + "\"",SM_LOGLEVEL_FATAL);
				}
			}
		} else {
			sMLog.append("fire undefined",SM_LOGLEVEL_DEBUG);
		}
		
		if (isWaitingLayer) {
			waitingLayer = new Sohomint.AjaxLayer.WaitingLayer();
		}
		
		var scriptFollows = false;
		if (typeof script != 'undefined' && script != null ) {
			scriptFollows = true;
			async = false;
		}
		
		if (typeof update == 'Array') {
			for (var i = 0 ; i <update.length; i++) {
				var updateField = update[i];
				if(updateField.indexOf(':') != -1) {
					var contentId  = null;
					var servletName = updateField.substr(0,updateField.indexOf(':'));
					if (servletName.substr(0,7) == "backend") {
						backendSet = true;
					}
					updateField = updateField.substr(updateField.indexOf(':') + 1);
					if (isWaitingLayer) {
						waitingLayer.addWaitingLayerRequest();
					}
					updateCounter++;
					ajaxUpdate(servletName,updateField,params,async);
				} else {
					sMLog.append("No servletName set for update: \"" + updateField + "\"",SM_LOGLEVEL_FATAL);
				}
			}
		} else if (typeof update != 'undefined' && update != null ) {
			if ( update.indexOf(',') != -1) {
				while (update != "") {
					var updateField = update;
					if ( update.indexOf(',') != -1) {
						updateField = update.substr(0,update.indexOf(','));
						update = update.substr(update.indexOf(',')+1);
					} else {
						update = "";
					}
					if(updateField.indexOf(':') != -1) {
						var contentId  = null;
						var servletName = updateField.substr(0,updateField.indexOf(':'));
						if (servletName.substr(0,7) == "backend") {
							backendSet = true;
						}
						updateField = updateField.substr(updateField.indexOf(':') + 1);
						if (updateField.indexOf(':') != -1) {
							updateField_ = updateField.substr(0,updateField.indexOf(':'));
							contentId = updateField.substr(updateField.indexOf(':') + 1);
							updateField = updateField_;
						}
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						updateCounter++;
						ajaxUpdate(servletName,updateField,params,contentId,async);
					}
				}
			} else {
				if(update.indexOf(':') != -1) {
						var contentId  = null;
						var servletName = update.substr(0,update.indexOf(':'));
						if (servletName.substr(0,7) == "backend") {
							backendSet = true;
						}
						update = update.substr(update.indexOf(':') + 1);
						if (update.indexOf(':') != -1) {
							update_ = update.substr(0,update.indexOf(':'));
							contentId = update.substr(update.indexOf(':') + 1);
							update = update_;
						}
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						updateCounter++;
						ajaxUpdate(servletName,update,params,contentId,async);
				} else {
					sMLog.append("No servletName set for update: \"" + update + "\"",SM_LOGLEVEL_FATAL);
				}
			}
		} else {
			sMLog.append("update undefined",SM_LOGLEVEL_DEBUG);
		}
		if (backendSet) {
			ajaxUpdate("backend/Error","error","","errorContainer",false);
			ajaxUpdate("backend/Error","info","","infoContainer",false);
		}
		
		if ( scriptFollows ) {
			if ( script.indexOf(',') != -1) {
				while (script != "") {
					var scriptField = script;
					if ( script.indexOf(',') != -1) {
						scriptField = script.substr(0,script.indexOf(','));
						script = script.substr(script.indexOf(',')+1);
					} else {
						script = "";
					}
					if(scriptField.indexOf(':') != -1) {
						servletName = scriptField.substr(0,scriptField.indexOf(':'));
						scriptField = scriptField.substr(scriptField.indexOf(':') + 1);
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						ajaxScript(servletName,scriptField,params);
					}
				}
			} else {
				if(script.indexOf(':') != -1) {
						servletName = script.substr(0,script.indexOf(':'));
						script = script.substr(script.indexOf(':') + 1);
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						ajaxScript(servletName,script,params);
				} else {
					sMLog.append("No servletName set for script: \"" + script + "\"",SM_LOGLEVEL_FATAL);
				}
			}
		} else {
			sMLog.append("script undefined",SM_LOGLEVEL_DEBUG);
		}
		
		errorHtml = document.getElementById('errorContainer').innerHTML;
		infoHtml = document.getElementById('infoContainer').innerHTML;
		if (errorHtml != "") {
			document.getElementById('body').className='red';
			document.getElementById('col1').className='red';
			document.getElementById('col1_content').className='red';
			document.getElementById('col2').className='red';
			document.getElementById('col2_content').className='red';
			document.getElementById('col3').className='red';
			document.getElementById('col3_content').className='red';
		} else if (infoHtml != "") {
			document.getElementById('body').className='yellow';
			document.getElementById('col1').className='yellow';
			document.getElementById('col1_content').className='yellow';
			document.getElementById('col2').className='yellow';
			document.getElementById('col2_content').className='yellow';
			document.getElementById('col3').className='yellow';
			document.getElementById('col3_content').className='yellow';
		} else {
			document.getElementById('body').className='white';
			document.getElementById('col1').className='white';
			document.getElementById('col1_content').className='white';
			document.getElementById('col2').className='white';
			document.getElementById('col2_content').className='white';
			document.getElementById('col3').className='white';
			document.getElementById('col3_content').className='white';
		}

	}
			

	function formField(formField,fire,update,params,isWaitingLayer) {
		sMLog.append("formField("+formField+",'"+fire+"','"+update+"','"+params+"',"+isWaitingLayer+")",SM_LOGLEVEL_DEBUG);

		if (typeof params == 'undefined' || params == null) {
			params = "";
		}

		if (typeof formField != 'undefined' && formField != null) {
			value = formField.value;
			if (value == "______NOT_SET______") {
				sMLog.append("Sorry. Ajax Error no value found.",SM_LOGLEVEL_FATAL);
				return;
			} else {
				sMLog.append("Value \""+ value + "\" found .",SM_LOGLEVEL_DEBUG);
				if (params != "") {
					params += "&";
				}
				
				//params += "formFieldValue="+ escape(value);
				value = value.replace(/\&/g,"%26");
				value = value.replace(/\%/g,"%25");
				value = value.replace(/\[/g,"%5b");
				value = value.replace(/\]/g,"%5d");
				value = value.replace(/\+/g,"%2b");
				params += "formFieldValue="+ value;
			}
		}
		
		ajaxAction(fire,update,null,params,isWaitingLayer);

		
	}


	function ajaxFire(servletName,fire,params) {
		sMLog.append("<b>ajaxFire</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("fire ist: " + fire,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		
		var url = "/sohomint/";
		var data = "backend=true&ajax=true&action=fire&fire="+fire+"&servlet="+servletName;
		if (params != '' && params != null && typeof params != 'undefined') {
				data += "&"+params;
		}
		
		sMLog.append("URL ist: " + url + data,SM_LOGLEVEL_DEBUG);
		
		$.ajax({
			type: "POST",
			url: url,
			async: false,
			data: data,
			contentType: "application/x-www-form-urlencoded",
//			contentType: "text/xml; charset=UTF-8",
			beforeSend: function (xmlReq) {
					//if (xmlReq.objectType == ) {
					if( xmlReq.overrideMimeType ) {
						//xmlReq.overrideMimeType('text/xml; charset=ISO-8859-1');
						//xmlReq.overrideMimeType('text/xml; charset=UTF-8');
					} else {
						
					}
					//}
			},
			success: function(){
				sMLog.append("FireAction Done: " + url + "?"+ data ,SM_LOGLEVEL_INFO);
			}
		});
		sMLog.newLine(SM_LOGLEVEL_INFO);
		
	}
	function ajaxUpdate(servletName,update,params,contentId,async) {
		if ( typeof contentId == 'undefined' || contentId == null) {
			contentId = update;
		}
		async = false;
		sMLog.append("<b>ajaxUpdate</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("update ist: " + update,SM_LOGLEVEL_INFO);
		sMLog.append("contentId ist: " + contentId,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		var url = "/sohomint/";
		var data = "backend=true&ajax=true&action=update&update="+update+"&servlet="+servletName;
		if (params != '' && typeof params != 'undefined') {
				data += "&"+params;
		}
		
		sMLog.append("URL ist: " + url + data,SM_LOGLEVEL_DEBUG);

		var response = $.ajax({
			type: "POST",
			url: url,
			async: async,
			ifModified: true,
			data: data,
			contentType: "application/x-www-form-urlencoded",
//			contentType: "text/xml; charset=UTF-8",
			beforeSend: function (xmlReq) {
					//if (xmlReq.objectType == ) {
					if( xmlReq.overrideMimeType ) {
						//xmlReq.overrideMimeType('text/xml; charset=ISO-8859-1');
						//xmlReq.overrideMimeType('text/xml; charset=UTF-8');
					} else {
						
					}
					//}
			},
			
			success: function(response){
				if (response != "<noChange/>") {				
					document.getElementById (contentId). innerHTML = response;			
	 				//document.getElementById (contentId). outerHTML = response;			
	 				sMLog.append("Getted Response.",SM_LOGLEVEL_INFO);
				} else {
					sMLog.append("No Update required.",SM_LOGLEVEL_INFO);
				}
				sMLog.newLine(SM_LOGLEVEL_INFO);
			
				//document.getElementById (update).innerHTML	= response;
				sMLog.append("Update Done: " + url + "?"+ data ,SM_LOGLEVEL_INFO);
			},
			
			complete:	function	() {
				if (waitingLayer) {
					waitingLayer.removeWaitingLayerRequest();
					
				}
				updateCounter--;
			}
		});
		
		
	}

	function ajaxScript(servletName,script,params) {
		sMLog.append("<b>ajaxScript</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("script ist: " + script,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		var url = "/sohomint/";
		url += "?backend=true&ajax=true&action=script&script="+script+"&servlet="+servletName;
		
		if (params != '' && params != null && typeof params != 'undefined') {
				url += "&"+params;
		}
		sMLog.append("URL ist: " + url ,SM_LOGLEVEL_DEBUG);

		$.getScript( url,function () {});
		
	}


	var updateCounterG3 = 0;


	function ajaxActionG3(fire,update,script,params,isWaitingLayer,async) {

		if (typeof isWaitingLayer == 'undefined' ) {
			if (typeof params == 'undefined' ) {
				isWaitingLayer = false;
				params = script;
				script = null;
			} else {
				isWaitingLayer = params;
				params = script;
				script = null;
			}
		}
		

		if (typeof async == 'undefined' ) {
			async = isWaitingLayer;
		}

		sMLog.append("ajaxActionG3('"+fire+"','"+update+"','"+script+"','"+params+"',"+isWaitingLayer+","+async+")",SM_LOGLEVEL_DEBUG);
		
		var backendSet = false;
		if (typeof fire != 'undefined' && fire != null) {
			if ( fire.indexOf(',') != -1) {
				while (fire != "") {
					var fireField = fire;
					if ( fire.indexOf(',') != -1) {
						fireField = fire.substr(0,fire.indexOf(','));
						fire = fire.substr(fire.indexOf(',')+1);
					} else {
						fire = "";
					}
//					if(fireField.indexOf(':') != -1) {
//						servletName = fireField.substr(0,fireField.indexOf(':'));
//						if (servletName.substr(0,7) == "backend") {
//							backendSet = true;
//						}
//						fireField = fireField.substr(fireField.indexOf(':') + 1);
//					}
					ajaxFireG3(servletName,fireField,params);
				}
			} else {
//				if(fire.indexOf(':') != -1) {
//						servletName = fire.substr(0,fire.indexOf(':'));
//						if (servletName.substr(0,7) == "backend") {
//							backendSet = true;
//						}
//						fire = fire.substr(fire.indexOf(':') + 1);
						ajaxFireG3(servletName,fire,params);
//				} else {
//					sMLog.append("No servletName set for fire: \"" + fire + "\"",SM_LOGLEVEL_FATAL);
//				}
			}
		} else {
			sMLog.append("fire undefined",SM_LOGLEVEL_DEBUG);
		}
		
		if (isWaitingLayer) {
			waitingLayer = new Sohomint.AjaxLayer.WaitingLayer();
		}
		
		var scriptFollows = false;
		if (typeof script != 'undefined' && script != null ) {
			scriptFollows = true;
			async = false;
		}
		var servletName = "";
		if (typeof update == 'Array') {
			for (var i = 0 ; i <update.length; i++) {
				var updateField = update[i];
//				if(updateField.indexOf(':') != -1) {
//					var contentId  = null;
//					var servletName = updateField.substr(0,updateField.indexOf(':'));
//					if (servletName.substr(0,7) == "backend") {
//						backendSet = true;
//					}
//					updateField = updateField.substr(updateField.indexOf(':') + 1);
					if (isWaitingLayer) {
						waitingLayer.addWaitingLayerRequest();
					}
					updateCounterG3++;
					ajaxUpdateG3(servletName,updateField,params,async);
//				} else {
//					sMLog.append("No servletName set for update: \"" + updateField + "\"",SM_LOGLEVEL_FATAL);
//				}
			}
		} else if (typeof update != 'undefined' && update != null ) {
			if ( update.indexOf(',') != -1) {
				while (update != "") {
					var updateField = update;
					if ( update.indexOf(',') != -1) {
						updateField = update.substr(0,update.indexOf(','));
						update = update.substr(update.indexOf(',')+1);
					} else {
						update = "";
					}
//					if(updateField.indexOf(':') != -1) {
						var contentId  = null;
//						var servletName = updateField.substr(0,updateField.indexOf(':'));
//						if (servletName.substr(0,7) == "backend") {
//							backendSet = true;
//						}
//						updateField = updateField.substr(updateField.indexOf(':') + 1);
						if (updateField.indexOf(':') != -1) {
							updateField_ = updateField.substr(0,updateField.indexOf(':'));
							contentId = updateField.substr(updateField.indexOf(':') + 1);
							updateField = updateField_;
						}
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						updateCounterG3++;
						ajaxUpdateG3(servletName,updateField,params,contentId,async);
//					}
				}
			} else {
//				if(update.indexOf(':') != -1) {
						var contentId  = null;
//						var servletName = update.substr(0,update.indexOf(':'));
//						if (servletName.substr(0,7) == "backend") {
//							backendSet = true;
//						}
//						update = update.substr(update.indexOf(':') + 1);
						if (update.indexOf(':') != -1) {
							update_ = update.substr(0,update.indexOf(':'));
							contentId = update.substr(update.indexOf(':') + 1);
							update = update_;
						}
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						updateCounterG3++;
						ajaxUpdateG3(servletName,update,params,contentId,async);
//				} else {
//					sMLog.append("No servletName set for update: \"" + update + "\"",SM_LOGLEVEL_FATAL);
//				}
			}
		} else {
			sMLog.append("update undefined",SM_LOGLEVEL_DEBUG);
		}
		backendSet = true;
		if (backendSet) {
			ajaxUpdate("backend/Error","error","","errorContainer",false);
			ajaxUpdate("backend/Error","info","","infoContainer",false);
		}
		
		if ( scriptFollows ) {
			if ( script.indexOf(',') != -1) {
				while (script != "") {
					var scriptField = script;
					if ( script.indexOf(',') != -1) {
						scriptField = script.substr(0,script.indexOf(','));
						script = script.substr(script.indexOf(',')+1);
					} else {
						script = "";
					}
//					if(scriptField.indexOf(':') != -1) {
//						servletName = scriptField.substr(0,scriptField.indexOf(':'));
						scriptField = scriptField.substr(scriptField.indexOf(':') + 1);
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						ajaxScriptG3(servletName,scriptField,params);
//					}
				}
			} else {
//				if(script.indexOf(':') != -1) {
//						servletName = script.substr(0,script.indexOf(':'));
//						script = script.substr(script.indexOf(':') + 1);
						if (isWaitingLayer) {
							waitingLayer.addWaitingLayerRequest();
						}
						ajaxScriptG3(servletName,script,params);
//				} else {
//					sMLog.append("No servletName set for script: \"" + script + "\"",SM_LOGLEVEL_FATAL);
//				}
			}
		} else {
			sMLog.append("script undefined",SM_LOGLEVEL_DEBUG);
		}
		
		errorHtml = document.getElementById('errorContainer').innerHTML;
		infoHtml = document.getElementById('infoContainer').innerHTML;
		if (errorHtml != "") {
			document.getElementById('body').className='red';
			document.getElementById('col1').className='red';
			document.getElementById('col1_content').className='red';
			document.getElementById('col2').className='red';
			document.getElementById('col2_content').className='red';
			document.getElementById('col3').className='red';
			document.getElementById('col3_content').className='red';
		} else if (infoHtml != "") {
			document.getElementById('body').className='yellow';
			document.getElementById('col1').className='yellow';
			document.getElementById('col1_content').className='yellow';
			document.getElementById('col2').className='yellow';
			document.getElementById('col2_content').className='yellow';
			document.getElementById('col3').className='yellow';
			document.getElementById('col3_content').className='yellow';
		} else {
			document.getElementById('body').className='white';
			document.getElementById('col1').className='white';
			document.getElementById('col1_content').className='white';
			document.getElementById('col2').className='white';
			document.getElementById('col2_content').className='white';
			document.getElementById('col3').className='white';
			document.getElementById('col3_content').className='white';
		}

	}
			

	function formFieldG3(formField,fire,update,params,isWaitingLayer) {
		sMLog.append("formFieldG3("+formField+",'"+fire+"','"+update+"','"+params+"',"+isWaitingLayer+")",SM_LOGLEVEL_DEBUG);

		if (typeof params == 'undefined' || params == null) {
			params = "";
		}

		if (typeof formField != 'undefined' && formField != null) {
			value = formField.value;
			if (value == "______NOT_SET______") {
				sMLog.append("Sorry. Ajax Error no value found.",SM_LOGLEVEL_FATAL);
				return;
			} else {
				sMLog.append("Value \""+ value + "\" found .",SM_LOGLEVEL_DEBUG);
				if (params != "") {
					params += "&";
				}
				
				//params += "formFieldValue="+ escape(value);
				value = value.replace(/\&/g,"%26");
				value = value.replace(/\%/g,"%25");
				value = value.replace(/\[/g,"%5b");
				value = value.replace(/\]/g,"%5d");
				value = value.replace(/\+/g,"%2b");
				params += "formFieldValue="+ value;
			}
		}
		
		ajaxActionG3(fire,update,null,params,isWaitingLayer);

		
	}


	function ajaxFireG3(servletName,fire,params) {
		sMLog.append("<b>ajaxFireG3</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("fire ist: " + fire,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		
		var url = "/sohomint/";
		var data = "backend=true&ajax=true&action=fire&fire="+fire+"&servlet=backend/Component";
		if (params != '' && params != null && typeof params != 'undefined') {
				data += "&"+params;
		}
		
		sMLog.append("URL ist: " + url + data,SM_LOGLEVEL_DEBUG);
		 
		$.ajax({
			type: "POST",
			url: url,
			async: false,
			data: data,
			contentType: "application/x-www-form-urlencoded",
//			contentType: "text/xml; charset=UTF-8",
			beforeSend: function (xmlReq) {
					//if (xmlReq.objectType == ) {
					if( xmlReq.overrideMimeType ) {
						//xmlReq.overrideMimeType('text/xml; charset=ISO-8859-1');
						//xmlReq.overrideMimeType('text/xml; charset=UTF-8');
					} else {
						
					}
					//}
			},
			success: function(){
				sMLog.append("FireAction Done: " + url + "?"+ data ,SM_LOGLEVEL_INFO);
			}
		});
		sMLog.newLine(SM_LOGLEVEL_INFO);
		
	}
	function ajaxUpdateG3(servletName,update,params,contentId,async) {
		if ( typeof contentId == 'undefined' || contentId == null) {
			contentId = update;
		}
		async = false;
		sMLog.append("<b>ajaxUpdateG3</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("update ist: " + update,SM_LOGLEVEL_INFO);
		sMLog.append("contentId ist: " + contentId,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		var url = "/sohomint/";
		var data = "backend=true&ajax=true&action=update&update="+update+"&servlet=backend/Component";
		if (params != '' && typeof params != 'undefined') {
				data += "&"+params;
		}
		
		sMLog.append("URL ist: " + url + data,SM_LOGLEVEL_DEBUG);
		
		var response = $.ajax({
			type: "POST",
			url: url,
			async: async,
			ifModified: true,
			data: data,
			contentType: "application/x-www-form-urlencoded",
//			contentType: "text/xml; charset=UTF-8",
			beforeSend: function (xmlReq) {
					//if (xmlReq.objectType == ) {
					if( xmlReq.overrideMimeType ) {
						//xmlReq.overrideMimeType('text/xml; charset=ISO-8859-1');
						//xmlReq.overrideMimeType('text/xml; charset=UTF-8');
					} else {
						
					}
					//}
			},
			
			success: function(response){
				if (response != "<noChange/>") {				
					//document.getElementById (contentId). innerHTML = response;			
	 				document.getElementById (contentId). outerHTML = response;			
	 				sMLog.append("Getted Response.",SM_LOGLEVEL_INFO);
				} else {
					sMLog.append("No Update required.",SM_LOGLEVEL_INFO);
				}
				sMLog.newLine(SM_LOGLEVEL_INFO);
			
				//document.getElementById (update).innerHTML	= response;
				sMLog.append("Update Done: " + url + "?"+ data ,SM_LOGLEVEL_INFO);
			},
			
			complete:	function	() {
				if (waitingLayer) {
					waitingLayer.removeWaitingLayerRequest();
					
				}
				updateCounterG3--;
			}
		});
		
		
	}

	function ajaxScriptG3(servletName,script,params) {
		sMLog.append("<b>ajaxScriptG3</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("servletName ist: " + servletName,SM_LOGLEVEL_INFO);
		sMLog.append("script ist: " + script,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		var url = "/sohomint/";
		url += "?backend=true&ajax=true&action=script&script="+script+"&servlet=backend/Component";
		
		if (params != '' && params != null && typeof params != 'undefined') {
				url += "&"+params;
		}
		sMLog.append("URL ist: " + url ,SM_LOGLEVEL_DEBUG);

		$.getScript( url,function () {});
		
	}

	function ajaxColUpdateG3(update,params,contentId) {
		if ( typeof contentId == 'undefined' || contentId == null) {
			contentId = update;
		}
		async = true;
		sMLog.append("<b>ajaxUpdateG3</b>:",SM_LOGLEVEL_INFO);
		sMLog.append("update ist: " + update,SM_LOGLEVEL_INFO);
		sMLog.append("contentId ist: " + contentId,SM_LOGLEVEL_INFO);
		sMLog.append("params ist: " + params,SM_LOGLEVEL_INFO);
		var url = "/sohomint/";
		var data = "backend=true&ajax=true&action=update&update="+update+"&servlet=backend/Component";
		if (params != '' && typeof params != 'undefined') {
				data += "&"+params;
		}
		
		sMLog.append("URL ist: " + url + data,SM_LOGLEVEL_DEBUG);
		
		
		
		var response = $.ajax({
			type: "POST",
			url: url,
			async: async,
			ifModified: true,
			data: data,
			contentType: "application/x-www-form-urlencoded",
//			contentType: "text/xml; charset=UTF-8",
			beforeSend: function (xmlReq) {
					//if (xmlReq.objectType == ) {
					if( xmlReq.overrideMimeType ) {
						//xmlReq.overrideMimeType('text/xml; charset=ISO-8859-1');
						//xmlReq.overrideMimeType('text/xml; charset=UTF-8');
					} else {
						
					}
					//}
			},
			
			success: function(response){
				if (response != "<noChange/>") {				
					//document.getElementById (contentId). innerHTML = response;			
					document.getElementById (contentId). outerHTML = response;			
	 				sMLog.append("Getted Response.",SM_LOGLEVEL_INFO);
				} else {
					sMLog.append("No Update required.",SM_LOGLEVEL_INFO);
				}
				sMLog.newLine(SM_LOGLEVEL_INFO);
			
				//document.getElementById (update).innerHTML	= response;
				sMLog.append("Update Done: " + url + "?"+ data ,SM_LOGLEVEL_INFO);
			},
			
			complete:	function	() {
//				document.getElementById (contentId). outerHTML = tmp;
			}
		});
		
		
	}

	
	var SM_WIDTH =300;
	var SM_HEIGHT =300;

	if (typeof(Sohomint.AjaxLayer) == 'undefined') {
	    Sohomint.AjaxLayer = {};
	}

	Sohomint.AjaxLayer.Layer = function () {
	};


	Sohomint.AjaxLayer.Layer.prototype = {

		_setWidth:	function	(width)	{
			this.width = width;
		},

		_setHeight:	function	(height)	{
			this.height = height;
		},


		_showLayer:	function	() {
			sMLog.append(this.prefix,SM_LOGLEVEL_INFO);
			
			$("body").append("<iframe id='SM_HideSelect'></iframe><div id='SM_overlay'></div><div id='SM_window'></div>");
//			$(window).scroll(function () {
//				var pagesize = this._getPageSize();	
//				var arrayPageScroll = this._getPageScrollTop();
//				var style = {width: this.width, left: (arrayPageScroll[0] + (pagesize[0] - this.width)/2), top: (arrayPageScroll[1] + (pagesize[1]-this.height)/2)};
//				$("#SM_window").css(style);
//			});
			this._set_overlaySize();
				
		
			$("body").append("<div id='SM_load'><img src='/image/ajax/loadingAnimation.gif' /></div>");
			this._set_load_position();
		
			
		},
		
		_removeAllLayers:	function	() {
			//$("#SM_overlay").unbind("click");
			$("#SM_window").fadeOut("slow",function(){$('#SM_window').remove();});
			$("#SM_overlay").fadeOut("slow",function(){$('#SM_overlay').remove();});
			$("#SM_HideSelect").fadeOut("slow",function(){$('#SM_HideSelect').remove();});
			$("#SM_load").remove();
			return false;
		},
		
		_set_load_position:	function	() {
			var pagesize = this._getPageSize();
			var arrayPageScroll = this._getPageScrollTop();
			$("#SM_load")
			.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2), top: (arrayPageScroll[1] + ((pagesize[1]-100)/2)) })
			.css({display:"block"}).fadeIn("slow");
		},
		
		_set_overlaySize:	function	() {
			if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {	
				yScroll = window.innerHeight + window.scrollMaxY;
					xScroll = window.innerWidth + window.scrollMaxX;
				var deff = document.documentElement;
				var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
				var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
				xScroll -= (window.innerWidth - wff);
				yScroll -= (window.innerHeight - hff);
			} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
				yScroll = document.body.scrollHeight;
				xScroll = document.body.scrollWidth;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				yScroll = document.body.offsetHeight;
				xScroll = document.body.offsetWidth;
		  	}
		  	//arrayOverlay = new Array(xScroll,yScroll)
		  	//if (yScroll < 5000) {
			 // 	yScroll = 5000;
		  	//}
		  	//return arrayOverlay;
			$("#SM_overlay").css({"height": yScroll, "width": xScroll});//.fadeIn("slow");
			$("#SM_HideSelect").css({"height": yScroll,"width": xScroll});//.fadeIn("slow");
		},
		
		_getPageScrollTop:	function	() {
			var yScrolltop;
			var xScrollleft;
			if (self.pageYOffset || self.pageXOffset) {
				yScrolltop = self.pageYOffset;
				xScrollleft = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict
				yScrolltop = document.documentElement.scrollTop;
				xScrollleft = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScrolltop = document.body.scrollTop;
				xScrollleft = document.body.scrollLeft;
			}
			arrayPageScroll = new Array(xScrollleft,yScrolltop) 
			return arrayPageScroll;
		},
		
		_getPageSize:	function	() {
			var de = document.documentElement;
			var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
			var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
			arrayPageSize = new Array(w,h) 
			return arrayPageSize;
		},
		
		_position:	function () {
			var pagesize = this._getPageSize();	
			var arrayPageScroll = this._getPageScrollTop();
			var style = {width: this.width, left: (arrayPageScroll[0] + (pagesize[0] - this.width)/2), top: (arrayPageScroll[1] + (pagesize[1]-this.height)/2)};
			$("#SM_window").css(style);
		}
		
	}

	Sohomint.AjaxLayer.WaitingLayer = function () {
		this.counter= 0;
		this.width = SM_WIDTH;
		this.height = SM_HEIGHT;
		this.prefix = "waiting";
	};

	Sohomint.AjaxLayer.WaitingLayer.prototype = new Sohomint.AjaxLayer.Layer("waiting");
	Sohomint.AjaxLayer.WaitingLayer.prototype.addWaitingLayerRequest = function	() {
			sMLog.append("<b>++ WaitingLayer is Counter:</b>:" + this.counter,SM_LOGLEVEL_INFO);
			if (this.counter == 0) {
				this._showLayer();
			}
			this.counter++;
		}
	Sohomint.AjaxLayer.WaitingLayer.prototype.removeWaitingLayerRequest =	function	() {
		this.counter--;
		sMLog.append("<b>-- WaitingLayer is Counter:</b>:" + this.counter,SM_LOGLEVEL_INFO);
		if (this.counter == 0) {
			this._removeAllLayers();
		}
	}
		
		
		
	//function showContentLayer(url,param,width,height) {
//		showContentLayer(url,param,width,height,"Titel");
	//}

	function showContentLayer(url,param,width,height,title) {
		contentLayer = new Sohomint.AjaxLayer.ContentLayer("content");
		contentLayer._setWidth(width);
		contentLayer._setHeight(height);
		if (typeof title == 'undefined' || title == null ) {
			title = "Titel";
		}
		contentLayer.loadContent(url,param,title);
	}


	Sohomint.AjaxLayer.ContentLayer = function () {
		this.width = SM_WIDTH;
		this.height = SM_HEIGHT;
		this.prefix = "content";
	};
	Sohomint.AjaxLayer.ContentLayer.prototype = new Sohomint.AjaxLayer.Layer();
	Sohomint.AjaxLayer.ContentLayer.prototype.loadContent = function (url,param,title) {
		//if (typeof update != 'undefined' ) {
			//update += ":SM_window";
			if (typeof param == 'undefined' || param == null ) {
				param = "";
			}
			
			
			this._showLayer();
			
			$("#SM_window").append("<div id='SM_title'><div id='SM_ajaxWindowTitle'>" + title + "</div><div id='SM_closeAjaxWindow'><a href='#' id='SM_closeWindowButton' title='Close'>Schlie&szlig;en</a></div></div><iframe frameborder='0' hspace='0' src='" + url + "?" + param + "' id='SM_iframeContent' name='SM_iframeContent' style='width:"+(this.width-1)+"px;height:"+(this.height -28)+"px;'> </iframe>");
			
			sMLog.append("URL: " + url + "?" + param ,SM_LOGLEVEL_DEBUG);			
			
			//ajaxAction(fire,update,script,param,false,true);
			this._position();
			$("#SM_load").remove();
			$("#SM_window").css({display:"block"}); 	
			
			$("#SM_closeWindowButton").click(function () {
				$("#SM_window").fadeOut("slow",function(){$('#SM_window').remove();});
				$("#SM_overlay").fadeOut("slow",function(){$('#SM_overlay').remove();});
				$("#SM_HideSelect").fadeOut("slow",function(){$('#SM_HideSelect').remove();});
			});
					
		//} else {
		//	sMLog.append("<b>Nothing to update</b>",SM_LOGLEVEL_ERROR);
		//}
		
	}


	function hi() {
		 alert("hohoho");
	}




	Sohomint.AjaxLayer.OnMouseLayer = function (content) {
		this.showId = "main";
		this.removeId = "main";
		this.content = content;
	};

	Sohomint.AjaxLayer.OnMouseLayer.prototype = {
		
		showOnMouseLayer:	function	(e)	{
			$("body").append("<div id='SM_OnMouseLayer'></div>");
			this._setLayerPosistion(e);
		},
		
		_setLayerPosistion:	function	(e)	{
			
			var mouse = SM_getMouse(e);
			var x = mouse[0];
			var y = mouse[1];
			//alert(x + y);
			$("#SM_OnMouseLayer").css("z-index","100")
								.css("position","absolute")
								.css("top",y)
								.css("left",x)
								.css("background-color","#aaa").end();
								//.fadeIn("fast");
								//.fadeIn("slow");
			$("#SM_OnMouseLayer").append("<div id=\"SM_OnMouseLayer_inner\">"+this.content+"</div>").end();
			$("#SM_OnMouseLayer").css({display:"block"}).end()
			$("#SM_OnMouseLayer_inner").hover( function(){},function () {
												$("#SM_OnMouseLayer").remove();
											});
			
		}
		
		
	};

	//$(document).ready(function(){
//		$("#main").click( function(e) { 
//			oml = new Sohomint.AjaxLayer.OnMouseLayer("<div style=\"padding:2px;\">Tach auch</div><div style=\"padding:2px;\">2Tach auch</div><div style=\"padding:2px;\">3Tach auch</div>"); 
//			oml.showOnMouseLayer(e);
//		} );
	//});


	var waitingLayer = null;



	
	
	var countS = 0; 

	function doUpdateAfterClose(targetname,updateId,parameter,openWin) {
		if (openWin) {
			loadingWin = window.open(null,targetname);
			loadingWin.focus();
		}
		if (!loadingWin.closed) {
			window.setTimeout("doUpdateAfterClose('"+targetname+"','"+updateId+"','"+parameter+"',false)",1000);
			return;
		}
		
		ajaxActionG3(null,updateId,parameter,null);
//		alert("EndeEndeEndeEnde:" +targetname + "\n" + updateId + "\n" +parameter);
	}


	function gup( name )
	{
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null )
	    return "";
	  else
	    return results[1];
	}

	function getCookie(c_name)
	{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
	}

	function setCookie(c_name,value,expiredays)
	{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}

	function setServerId(value) {
		setCookie("ServerID",value,2);
	}


	// Utility function for checking if an element (e) is a member of CSS class (c).
	function hasClass(e, c) {

	// If we passed the function a string, then get the element with that id.
		if (typeof e == "string") e = document.getElementById(e);

	// Declare the variable "classes" as the text value of our element's CSS classes.
		var classes = e.className;

	// If our element doesn't have any CSS classes assigned to it, return false.
		if (!classes) return false;

	// If our element has exactly one class and that class is (c), return true.
		if (classes == c) return true;

	// If our element has multiple classes and one of them is (c), return true.
		return e.className.search("\\b" + c + "\\b") != -1;
	};

	function affiliateLinks(){
		
		var theURL, theAnchorText, theTitle;
		var spans = document.getElementsByTagName('span');

		for (var i = 0; i<spans.length; i++){

			if (hasClass(spans[i], 'jl')){

				theAnchorText = spans[i].innerHTML;
				theTitle = spans[i].title.toLowerCase().replace(/^\s+|\s+$/g,"");

				theURL = '/jl.include?jId=' + theTitle;
				spans[i].innerHTML = '<a href="' + theURL + '" class="' + spans[i].className + '" target=\"_blank\" rel=\"noFollow\">' + theAnchorText + '</a>';
				spans[i].removeAttribute('title');
			}
		}
	}

	window.onload = function(){
		affiliateLinks();
	}

	//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/conf.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/log_ajax.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/core_ajax_request.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/core_ajax.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/core_ajaxG3.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/core_layer.js\"><\/script>");
//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/core/core_misc.js\"><\/script>");

//document.writeln("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/js/jl/jl.js\"><\/script>");
