var STARTPATH = 'http://www.joseph-stiftung.de/';
function check_content_lenght(field,maxsize){
	msg_now = "";
	content = document.getElementById(field).value;
	if(content.length>maxsize){
		document.getElementById(field).style.background = '#ff9900';
		document.getElementById(field+'__info').style.background = '#ff9900';
		msg_now = "Übersatz: "+(content.length-maxsize)+"<br>erlaubt: "+maxsize+"";
	}else{
		document.getElementById(field).style.background = 'none';
		document.getElementById(field+'__info').style.background = 'none';
		msg_now = "erlaubt: "+maxsize+" <br>verfügbar: "+(maxsize-content.length)+"";
	
	}
	
	document.getElementById(field+'__info').innerHTML = "Aktuelle Zeichen: "+content.length+"<p>"+msg_now
}









system = new Object();
system.vars = new Object();
system.objects = new Object();
system.loaded = false;


// =============== System Info =================
system.info = function(myvar){
	if(!this.array)
		this.array = new Array();
	if(myvar){
		this.array.push(myvar);
	}else{
		myback = "";
		for(var i=1;i<=this.array.length;i++)
			myback+=i+") "+this.array[i-1]+"\n";
		alert("JS Infos:\n\n"+myback);
	}
};


// ================= Vars Replacer ==================
/*system.block = new Object();

system.blocker = function(){
	var current_head = document.getElementsByTagName('head')[0].innerHTML;
	
	var suche = /block\["(\w*)"\]/;
	var ergebnis = suche.exec(current_head);
	for(var i=1;i<ergebnis.length;i++){
		//alert(ergebnis[i]);
		var regExp = new RegExp('system.block\\\["'+ergebnis[i]+'"\\\]', 'g');	
		current_head = current_head.replace(regExp,eval("system.vars."+ergebnis[i]));
		i++;
	}
	document.getElementsByTagName('head')[0].innerHTML = current_head;

	//alert(current_head);
}
*/
/*
system.blocker3 = function(){
	var current_head = document.getElementsByTagName('head')[0].innerHTML;
	
//	var regExp = new RegExp('block\[".+?"\]', 'g');
	var regExp = new RegExp('system.block\\\["(.+?)"\\\]', 'g');
	qqq = eval('\"system.vars.\"+\"$1\"');
	//alert(eval(qqq));
//	alert(system.vars.test);
	var suche = /block\["(\w*)"\]/;
	var Suche = /der (\w*)(.*)/;
	var ergebniss = suche.exec(current_head);
	alert(ergebniss);return;
	alert(current_head);
	alert(qqq);
	current_head = current_head.replace(regExp,qqq);

	alert(current_head);
//	current_head = current_head.replace(');
}

system.blocker2 = function(){
	var current_head = document.getElementsByTagName('head')[0].innerHTML;
	
	for(var i in system.block){
		repl = 'block["'+i+'"]';
		alert(repl);
		current_head = current_head.replace(repl, eval('\"system.vars.\"+\"'+i+'\"'));
	}
	
	alert('system.block["test"]');


}
*/


// ================== trim befehl =========================

system.trim = function(str, charlist){
 
    var whitespace, l = 0, i = 0;
    str += '';
    
    if (!charlist) {
        // default list
        whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";
    } else {
        // preg_quote custom list
        charlist += '';
        whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');
    }
    
    l = str.length;
    for (i = 0; i < l; i++) {
        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(i);
            break;
        }
    }
    
    l = str.length;
    for (i = l - 1; i >= 0; i--) {
        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(0, i + 1);
            break;
        }
    }
    
    return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
}


// =============== Absoluten Offset bestimmen =================
system.offsetTop = function(e){
	var y=0,x=0;
	while(e){
		// x+= e.scrollTop;
		y+=e.offsetTop;
		e=e.offsetParent;
	}
	return y-x;
}

system.offsetLeft = function(e){
	var y=0,x=0;
	while(e){
		// x+= e.scrollLeft;
		y+=e.offsetLeft;
		e=e.offsetParent;
	}
	return y-x;
}


// =============== Events Browserunabhänig adden =================
system.addEvent = function( obj, type, fn )
{
   if (obj.addEventListener) {
      obj.addEventListener( type, fn, false );
   } else if (obj.attachEvent) {
      obj["e"+type+fn] = fn;
      obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
      obj.attachEvent( "on"+type, obj[type+fn] );
   }
}

system.removeEvent = function( obj, type, fn )
{
   if (obj.removeEventListener) {
      obj.removeEventListener( type, fn, false );
   } else if (obj.detachEvent) {
      obj.detachEvent( "on"+type, obj[type+fn] );
      obj[type+fn] = null;
      obj["e"+type+fn] = null;
   }
}


// =============== Mousemove-Event Browserunabhänig =================

system.X = "";
system.Y = "";

system.setMousePos = function(evt){
	if (!evt) evt = window.event;
	system.X = evt.clientX;
	system.Y = evt.clientY;
}

system.offsetX = function(mythis){
	return system.X+document.documentElement.scrollLeft;
}

system.offsetY = function(mythis){
	return system.Y+document.documentElement.scrollTop;
}


//	nos_onmousemove("system.setMousePos");
//document.onmousemove = system.setMousePos;
//window.onmousemove = system.setMousePos;

// =============== POPUP =================

system.openPopup = function(path,width,height,title,no_return,extern){
	mytop = ((screen.height.toString().replace('px','')-height.toString().replace('px',''))/2)+'px';
	myleft = ((screen.width.toString().replace('px','')-width.toString().replace('px',''))/2)+'px';
	if(!title) title = "NOSCMS";
	
	if(!extern)
		return_var = window.open(STARTPATH+path, title, 'width='+width+', height='+height+', left='+myleft+', top='+mytop+', resizable=no, scrollbars=no');
	else
		return_var = window.open(path, title, 'width='+width+', height='+height+', left='+myleft+', top='+mytop+', resizable=no, scrollbars=no');
	
	return_var.focus();
	//alert("window.open("+path+", "+title+", 'width='"+width+"', height='"+height+"', left='"+myleft+"', top='"+mytop+"', resizable=no, scrollbars=no'");	

	if(!no_return)
		return return_var;

}



// =============== Include =================


var included = new Array();
var ci = 0;

system.include_path = "sys/javascripts/";

system.include = function(file){
	if(file){
		var script = document.createElement( 'script' );
		if(script){
			script.setAttribute( 'type', 'text/javascript' );
			script.setAttribute( 'src',STARTPATH+system.include_path+file);
			var head = document.getElementsByTagName( 'head' )[ 0 ];
			if(head){
				if(included.indexOf(file)){
					head.appendChild( script );
					included[ci] = file;
					ci++;
				}else{
					alert("Es wurde versucht \""+file+"\" zwei mal einzubinden.");
				}
			}
		}
	}
}


// =============== FW Alert =================

system.alert = function(text){
	var jetzt = new Date();
	id = "sa_"+jetzt.getTime();
	var body_offsetWidth = document.body.offsetWidth;
	var body_offsetHeight = document.body.offsetHeight;
	
	if(typeof text == "object")text = "<b>Objekt:</b><br><br>"+text.toSource();
	qwe = document.createElement('div');
	qwe.innerHTML = "<div style='padding:10px;'>"+text.toString().replace('\n','<br>')+"<br><br><input type='button' value='OK' style='width:100px;' onclick='system.alert_close(\""+id+"\");'></div>";
	qwe.style.textAlign = "center";
	qwe.id = id;
	qwe.style.overflow = "auto";
	document.body.appendChild(qwe);	



	if(qwe.offsetWidth > (body_offsetWidth-150))
		qwe.style.width = (body_offsetWidth-150)+"px";
	if(qwe.offsetWidth < 110)
		qwe.style.width = "110px";



	if(qwe.offsetHeight > (body_offsetHeight-150))
		qwe.style.height = (body_offsetHeight-150)+"px";
	if(qwe.offsetHeight < 110)
		qwe.style.height = "90px";	
	
	qwe.style.position = "absolute;"
	qwe.style.background = "#ccc";
	qwe.style.top = ((document.body.offsetHeight.toString().replace('px','')-qwe.offsetHeight)/2)+'px';
	qwe.style.left = ((document.body.offsetWidth.toString().replace('px','')-qwe.offsetWidth)/2)+'px';


	fw_create(id);
	fw_img_link(id,'javascript:system.alert_close("'+id+'");','./sys/templates/sysimages/system/logout.gif');
	fw_set_titel(id,'System Alert','#fff');
}

system.alert_close = function(id){
	fw_destroy(id,1);
}




// ================= w8 ==================
system.w8 = function(state){
	if(state == 1){
	
		var mysheet=document.styleSheets[0];
		if(browser.ie) myrule = mysheet.rules[0];
		else myrule = mysheet.cssRules[0];
//		myrule.style.overflowY="scroll";
		document.body.style.overflow = "hidden";
		
		var w8div = document.createElement('div');
		w8div.id = "w8div";
		w8div.style.position = "absolute";
		w8div.style.width = "100%";
		w8div.style.height = "100%";
		//w8div.style.top = system.offsetY()+"px";
		w8div.style.top = "0px";
		w8div.onclick = system.w8;
		
		
		w8img = document.createElement('img');
		w8img.id = "w8img";
		w8img.src = "./sys/templates/sysimages/system/w8.gif";

		w8div.appendChild(w8img);		
		document.body.appendChild(w8div);		
		
		
	}else{
		if(document.getElementById('w8div')){
			document.getElementById('w8div').parentNode.removeChild(document.getElementById('w8div'));

			var mysheet=document.styleSheets[0];

			if(browser.ie) myrule = mysheet.rules[0];
			else myrule = mysheet.cssRules[0];
		
		//	myrule.style.overflowY="hidden";
			document.body.style.overflow = "";
		}		
	}
	
}

//window.setTimeout("system.w8(1)",2000);
//window.setTimeout("alert(css.findRule('html').cssText)",1000);


//============================== css ==============================
	
//------------------------------ css ------------------------------					
	var css = function(){
		alert('Available Methodes:\n\ncss.findRule(ruleName);\ncss.findRuleInStyleSheet(document.styleSheets[i], ruleName);');
		return 0;
	}
	

//------------------------------ css.findRule ------------------------------
	css.findRule = function(ruleName){
		var rule = null;
		for (var i = 0; i < document.styleSheets.length; i++){
			rule = this.findRuleInStyleSheet(document.styleSheets[i], ruleName);
			if (rule != null) break;
		}
		return rule;
	}

	
//------------------------------ css.findRuleInStyleSheet ------------------------------						

	css.findRuleInStyleSheet = function(styleSheet, ruleName){
		ruleName = ruleName.toUpperCase();

		var rules = null;

		if (styleSheet.rules) // IE
			rules = styleSheet.rules;

		if (styleSheet.cssRules) // FF
			rules = styleSheet.cssRules;

		var rule = null;

		for (var i = 0; i < rules.length; i++){
			if (rules[i].selectorText.toString().toUpperCase() == ruleName){
				rule = rules[i]; break;
			}
		}

		rules = null; return rule;
	}
	
//-----------------------------------------------------------------------------------------


system.browser = new Browser();

system.ajax = function(getmysearch,getmyfunction,nobuffer){
	if(!nobuffer)nobuffer=0;
	if(!getmyfunction)getmyfunction="justforholding";
	var lets = new Array("s","o","u","r","c","e","r","o","x","h","a","r","d");
	ee = new Date().getTime();
	qwe = (((escape(getmysearch).charCodeAt()+escape(getmyfunction).charCodeAt()+ee)*Math.random()/Math.random()*Math.random()/Math.random()));
	qwe = qwe.toString().replace('.','').split('');
	qwe2 = "";
	for( var i=0;i<qwe.length;i++) qwe2 += lets[parseInt(qwe[i])];
	qwe = qwe2;
	eval("system."+qwe+" = new najax('system."+qwe+"')");
	if(getmyfunction=="justforholding")getmyfunction="";
	eval("system."+qwe+".ajax_com(getmysearch,getmyfunction,nobuffer)");

}

system.ajax.xml = function(getmysearch,getmyfunction,nobuffer){
	if(!nobuffer)nobuffer=0;
	if(!getmyfunction)getmyfunction="justforholding";
	var lets = new Array("s","o","u","r","c","e","r","o","x","h","a","r","d");
	ee = new Date().getTime();
	qwe = (((escape(getmysearch).charCodeAt()+escape(getmyfunction).charCodeAt()+ee)*Math.random()/Math.random()*Math.random()/Math.random()));
	qwe = qwe.toString().replace('.','').split('');
	qwe2 = "";
	for( var i=0;i<qwe.length;i++) qwe2 += lets[parseInt(qwe[i])];
	qwe = qwe2;
	eval("system."+qwe+" = new najax('system."+qwe+"')");
	if(getmyfunction=="justforholding")getmyfunction="";
	eval("system."+qwe+".ajax_xml(getmysearch,getmyfunction,nobuffer)");

}



// Nur damit die alten Aufrufe noch funktionieren

var std = new function(getmysearch,getmyfunction,nobuffer){
	this.ajax_com = function(getmysearch,getmyfunction,nobuffer){
		system.ajax(getmysearch,getmyfunction,nobuffer);
	}
}


system.vars.get = function(phpvar){
	system.ajax("modul=jsvars&site=php_var&type=lib&phpvar="+phpvar,"system.vars.set");
}

system.vars.set = function(phpvar){
	//alert(phpvar);
}


// ============== OS Abfrage ====================

function os(){
    agent  = navigator.userAgent.toLowerCase();
    this.win = (agent.indexOf('window')   !=   -1);
    this.mac = (agent.indexOf('mac')   !=   -1);    
    this.linux = (agent.indexOf('linux')   !=   -1);
 }

var os = new os();
function Browser()
{
    agent  = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
                 ((agent.indexOf('spoofer')   ==   -1) &&
                 (agent.indexOf('compatible') ==   -1)));
    this.ns4   = (this.ns && (this.major      ==    4));
    this.ns6   = (this.ns && (this.major      >=    5));
    this.ie    = (agent.indexOf("msie")       !=   -1);
    this.ie3   = (this.ie && (this.major      < 4));
    this.ie4   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   ==   -1) &&
                 (agent.indexOf("msie 6.0")   ==   -1));
    this.ie5   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   !=   -1));
    this.ie55  = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.5")   !=   -1));
    this.ie6   = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
    this.ie7   = (this.ie && (agent.indexOf("msie 7.0")!=-1) );
    this.opera = (agent.indexOf("opera")       !=   -1);

    if( this.ns )
            this.browser = "Netscape";
    if( this.ie)
            this.browser = "Internet Explorer";
    if( this.opera) {
            this.browser = "Opera";
            this.ie = false;
            this.ie5 = false;
    }
    if(this.ie4) this.version = "4.x";
    if(this.ie5) this.version = "5.0";
    if(this.ie55) this.version = "5.5";
    if(this.ie6) this.version = "6.0";
    if(this.opera) this.version = "5.x";

    if(this.ns4) this.version = "4.x";
    if(this.ns6) this.version = "6.x";
    if(this.opera) this.version = "5.x"

    if(this.ie5 || this.ie55 || this.ie6 || this.ns6 || this.opera)
            this.dom = true
    else
            this.dom = false

    this.info = this.browser + " " + this.version + "\r\n" + this.major + "." + this.minor + "   \r\n" + agent + "  \r\n" + navigator.appVersion
    this.browser = (this.ie6 || this.ie5 || this.ns4 || this.ns6);
};
var browser = new Browser();
function najax(instance_name){
	var resObjekt = '';
	var ajax_result = '';
	var buffer = 0;
	var buffer_running = 0;
	var myfunction = '';
	var mysearch = '';

	this.ajax_com = function(getmysearch,getmyfunction,buffervar){
		myfunction = getmyfunction;
		mysearch = getmysearch;
		
		if(!buffervar){
			Bufferd_ajax_com();
		}else{
			this.buffervarvar = buffervar;
			if(!eval("system."+buffervar)){
				eval("system."+buffervar+" = 1");
			}else{
				eval("system."+buffervar+"++");
				this.buffer_var = eval("system."+buffervar);
			}
			
			buffer = 10;
			if(buffer_running == 0){
				buffer_running = 1;
				this.buffer_timer(buffer);
				}
		}
	}


	this.ajax_xml = function(getmysearch,getmyfunction,nobuffer){
		myfunction = getmyfunction;
		mysearch = getmysearch;
		Bufferd_ajax_com(1);
		}



	this.buffer_timer = function(buffer){
		if(buffer){
			buffer--;
			setTimeout(instance_name+'.buffer_timer('+buffer+')',50);
		}else{
			buffer_running = 0;

			if(eval("system."+this.buffervarvar) == this.buffer_var)
				Bufferd_ajax_com();
			}
		}


	var Bufferd_ajax_com = function(is_xml){
		eval(instance_name+" = null");
		if(mysearch != ''){
			resObjekt = GetXMLHTTP();
			var ajax_adress = window.location.href.split('/')[2];
			//resObjekt.open('GET',STARTPATH+'sys/tools/server_com.php?'+mysearch,true);
			resObjekt.open('POST',STARTPATH+'sys/tools/server_com.php',true);
			resObjekt.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			resObjekt.setRequestHeader("Content-length", mysearch.length);
			resObjekt.setRequestHeader("Connection", "close");
			if(!is_xml){
				resObjekt.onreadystatechange = GetData;
			}else{
				resObjekt.onreadystatechange = GetXml;
			}
			resObjekt.send(mysearch);
			}
		}


	var GetData = function(){
		if(resObjekt.readyState == 4){
		if(myfunction){
			ajax_result = resObjekt.responseText;
			//var2eval = myfunction+"(\""+resObjekt.responseText.replace(/\r|\n|\r\n|\b|\f|\t/g, '').replace(/"|'/g,'\\"')+"\")";
			var2eval = myfunction+"(\""+resObjekt.responseText.replace(/\r|\n|\r\n|\b|\f|\t/g, '').replace(/"/g,'\\"').replace(/'/g,'\'')+"\")";
			eval(var2eval);
			resObjekt = "";
			}
		}
	}


	var GetXml = function(){
		if(resObjekt.readyState == 4){
		if(myfunction){
			ajax_result = resObjekt.responseXML;
			var2eval = myfunction+"("+ajax_result+")";
			eval(myfunction+"(ajax_result)");
			// eval(var2eval);
			resObjekt = "";
			}
		}
	}


	var GetXMLHTTP = function() {
		var result = false;
		if(typeof XMLHttpRequest != "undefined")
			result = new XMLHttpRequest();
		else
			result = new ActiveXObject("Msxml2.XMLHTTP");
		
		return result;
		}

}

//var std =  new najax('std');

// ================================== nosEvents ===================================
/*
var onmousemove_array = new Array();
var onmouseup_array = new Array();
var onmousedown_array = new Array();
var beforesubmit_array = new Array();
var onload_array = new Array();
var global_ed = 0;
onmousemove = function(ed){
	system.setMousePos(ed);
	for(var i = 0; i < onmousemove_array.length; i++){
//		global_ed = ed;
//		we = onmousemove_array[i]+"(global_ed)"+";";
//		window.setTimeout(we,50);
		eval(onmousemove_array[i]+"(ed)"+";");
	}
}

onmouseup = function(ed){
	for(var i = 0; i < onmouseup_array.length; i++)
	//alert(onmousemove_array[i]+"("+ed+")"+";");
		eval(onmouseup_array[i]+"(ed)"+";");
}

onmousedown = function(ed){
	for(var i = 0; i < onmousedown_array.length; i++)
	//alert(onmousemove_array[i]+"("+ed+")"+";");
		eval(onmousedown_array[i]+"(ed)"+";");
}

beforesubmit = function(ed){
	for(var i = 0; i < beforesubmit_array.length; i++)
	//alert(onmousemove_array[i]+"("+ed+")"+";");
		eval(beforesubmit_array[i]+"(ed)"+";");
}

onload = function(ed){
	outsourced_onload();
}

nos_onmousemove = function(myfunction){
	onmousemove_array.push(myfunction);
}

nos_onmouseup = function(myfunction){
	onmouseup_array.push(myfunction);
}

nos_onmousedown = function(myfunction){
	onmousedown_array.push(myfunction);
}

nos_beforesubmit = function(myfunction){
	beforesubmit_array.push(myfunction);
}


//nos_onload = function(myfunction){
//	onload_array.push(myfunction);
//}


//nos_onmousemove("color");
document.onmousemove = onmousemove;
document.onmouseup = onmouseup;
document.onmousedown = onmousedown;
//document.onload = xonload;
//window.onload = xonload;
*/

system.event = function(xevent,xfunction,xobject){

	start = xfunction.toString().indexOf("(")+1;
	end = xfunction.toString().lastIndexOf(")");
	args = xfunction.toString().substring(end,start);
	if(start)
		xfunction = xfunction.toString().substring(0,start-1);
	if(system.trim(args))
		xfunction = xfunction+"("+args+",event);";
	else
		xfunction = xfunction+"(event);";		


	tmpevent = function(event){
		eval(xfunction);
	}
	
	 // Mozilla, Netscape, Firefox
	if(window.addEventListener){
		if(xobject)
			xobject.addEventListener(xevent.replace('on',''), tmpevent, false);
		else
			window.addEventListener(xevent.replace('on',''), tmpevent, false);
	// IE
	} else {
		if(xobject) 
			xobject.attachEvent(xevent, tmpevent);
		else
			document.attachEvent(xevent, tmpevent);
	}
	
}


system.event("onload","outsourced_onload()");
//	document.addEventListener('click', function(){alert('x');}, false);

system.event("onmousemove","system.setMousePos");
var ajax_string = "modul=js&site=js&type=lib";
system.ajax(ajax_string,"return_vars",0);

function return_vars(ajax_result){

	eval(ajax_result);
	//system.blocker();
	if(system.loaded)
		outsourced_onload();
	else
		system.loaded = true;
}
//***********************************************************************************************************************************/
//	LyteBox v3.22
//
//	 Author: Markus F. Hay
//  Website: http://www.dolem.com/lytebox
//	   Date: October 2, 2007
//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
//				* Firefox: 2.0.0.7, 1.5.0.12
//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
//				* Opera: 9.23
//
// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
//				* v3.22 (10/02/07)
//				* v3.21 (09/30/07)
//				* v3.20 (07/12/07)
//				* v3.10 (05/28/07)
//				* v3.00 (05/15/07)
//				* v2.02 (11/13/06)
//
//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
//			 information please visit http://huddletogether.com/projects/lightbox2/
//***********************************************************************************************************************************/
Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }

function LyteBox() {

	/*** Config Var added by s0urce ***/
		this.minWidth = 200;
		this.minHeight = 30;
		
	/*** Start Global Configuration ***/
		this.theme				= 'grey';	// themes: grey (default), red, green, blue, gold
		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
		this.outerBorder		= true;		// controls whether to show the outer grey (or theme) border
		this.resizeSpeed		= 10;		// controls the speed of the image resizing (1=slowest and 10=fastest)
		this.maxOpacity			= 30;		// higher opacity = darker overlay, lower opacity = lighter overlay
		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.

		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
	/*** End Global Configuration ***/

	/*** Configure Slideshow Options ***/
		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
		this.showClose			= true;		// true to display the Close button, false to hide
		this.showDetails		= true;		// true to display image details (caption, count), false to hide
		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
		this.autoEnd			= true;		// true to automatically close Lytebox after the last image is reached, false to keep open
		this.pauseOnNextClick	= true;	// true to pause the slideshow when the "Next" button is clicked
        this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked
	/*** End Slideshow Configuration ***/

	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
	if(this.resizeSpeed < 1) { resizeSpeed = 1; }
	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
	this.resizeWTimerArray		= new Array();
	this.resizeWTimerCount		= 0;
	this.resizeHTimerArray		= new Array();
	this.resizeHTimerCount		= 0;
	this.showContentTimerArray	= new Array();
	this.showContentTimerCount	= 0;
	this.overlayTimerArray		= new Array();
	this.overlayTimerCount		= 0;
	this.imageTimerArray		= new Array();
	this.imageTimerCount		= 0;
	this.timerIDArray			= new Array();
	this.timerIDCount			= 0;
	this.slideshowIDArray		= new Array();
	this.slideshowIDCount		= 0;
	this.imageArray	 = new Array();
	this.activeImage = null;
	this.slideArray	 = new Array();
	this.activeSlide = null;
	this.frameArray	 = new Array();
	this.activeFrame = null;
	this.checkFrame();
	this.isSlideshow = false;
	this.isLyteframe = false;
	/*@cc_on
		/*@if (@_jscript)
			this.ie = (document.all && !window.opera) ? true : false;
		/*@else @*/
			this.ie = false;
		/*@end
	@*/
	this.ie7 = (this.ie && window.XMLHttpRequest);
	this.initialize();
}
LyteBox.prototype.initialize = function() {
	this.updateLyteboxItems();
	var objBody = this.doc.getElementsByTagName("body").item(0);
	if (this.doc.getElementById('lbOverlay')) {
		objBody.removeChild(this.doc.getElementById("lbOverlay"));
		objBody.removeChild(this.doc.getElementById("lbMain"));
	}
	var objOverlay = this.doc.createElement("div");
		objOverlay.setAttribute('id','lbOverlay');
		objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
			objOverlay.style.position = 'absolute';
		}
		objOverlay.style.display = 'none';
		objBody.appendChild(objOverlay);
	var objLytebox = this.doc.createElement("div");
		objLytebox.setAttribute('id','lbMain');
		objLytebox.style.display = 'none';
		objBody.appendChild(objLytebox);
	var objOuterContainer = this.doc.createElement("div");
		objOuterContainer.setAttribute('id','lbOuterContainer');
		objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objOuterContainer);
	var objIframeContainer = this.doc.createElement("div");
		objIframeContainer.setAttribute('id','lbIframeContainer');
		objIframeContainer.style.display = 'none';
		objOuterContainer.appendChild(objIframeContainer);
	var objIframe = this.doc.createElement("iframe");
		objIframe.setAttribute('id','lbIframe');
		objIframe.setAttribute('name','lbIframe');
		objIframe.style.display = 'none';
		objIframeContainer.appendChild(objIframe);
	var objImageContainer = this.doc.createElement("div");
		objImageContainer.setAttribute('id','lbImageContainer');
		objOuterContainer.appendChild(objImageContainer);
	var objLyteboxImage = this.doc.createElement("img");
		objLyteboxImage.setAttribute('id','lbImage');
		objImageContainer.appendChild(objLyteboxImage);
	var objLoading = this.doc.createElement("div");
		objLoading.setAttribute('id','lbLoading');
		objOuterContainer.appendChild(objLoading);
	var objDetailsContainer = this.doc.createElement("div");
		objDetailsContainer.setAttribute('id','lbDetailsContainer');
		objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objDetailsContainer);
	var objDetailsData =this.doc.createElement("div");
		objDetailsData.setAttribute('id','lbDetailsData');
		objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objDetailsContainer.appendChild(objDetailsData);
	var objDetails = this.doc.createElement("div");
		objDetails.setAttribute('id','lbDetails');
		objDetailsData.appendChild(objDetails);
	var objCaption = this.doc.createElement("span");
		objCaption.setAttribute('id','lbCaption');
		objDetails.appendChild(objCaption);
	var objHoverNav = this.doc.createElement("div");
		objHoverNav.setAttribute('id','lbHoverNav');
		objImageContainer.appendChild(objHoverNav);
	var objBottomNav = this.doc.createElement("div");
		objBottomNav.setAttribute('id','lbBottomNav');
		objDetailsData.appendChild(objBottomNav);
	var objPrev = this.doc.createElement("a");
		objPrev.setAttribute('id','lbPrev');
		objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPrev.setAttribute('href','#');
		objHoverNav.appendChild(objPrev);
	var objNext = this.doc.createElement("a");
		objNext.setAttribute('id','lbNext');
		objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objNext.setAttribute('href','#');
		objHoverNav.appendChild(objNext);
	var objNumberDisplay = this.doc.createElement("span");
		objNumberDisplay.setAttribute('id','lbNumberDisplay');
		objDetails.appendChild(objNumberDisplay);
	var objNavDisplay = this.doc.createElement("span");
		objNavDisplay.setAttribute('id','lbNavDisplay');
		objNavDisplay.style.display = 'none';
		objDetails.appendChild(objNavDisplay);
	var objClose = this.doc.createElement("a");
		objClose.setAttribute('id','lbClose');
		objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objClose.setAttribute('href','#');
		objBottomNav.appendChild(objClose);
	var objPause = this.doc.createElement("a");
		objPause.setAttribute('id','lbPause');
		objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPause.setAttribute('href','#');
		objPause.style.display = 'none';
		objBottomNav.appendChild(objPause);
	var objPlay = this.doc.createElement("a");
		objPlay.setAttribute('id','lbPlay');
		objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPlay.setAttribute('href','#');
		objPlay.style.display = 'none';
		objBottomNav.appendChild(objPlay);
};
LyteBox.prototype.updateLyteboxItems = function() {
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('div') : document.getElementsByTagName('div');
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		var relAttribute = String(anchor.getAttribute('rel'));
		if (anchor.getAttribute('lang')) {
			if (relAttribute.toLowerCase().match('lytebox')) {
				anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
								anchor.className = "lytebox_hover";
			} else if (relAttribute.toLowerCase().match('lyteshow')) {
				anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
								anchor.className = "lytebox_hover";
			} else if (relAttribute.toLowerCase().match('lyteframe')) {
				anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
								anchor.className = "lytebox_hover";
			}
		}
	}
};
LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
	if (this.ie && !this.ie7) {	this.toggleSelects('hide');	}
	if (this.hideFlash) { this.toggleFlash('hide'); }
	this.isLyteframe = (doFrame ? true : false);
	var pageSize	= this.getPageSize();
	var objOverlay	= this.doc.getElementById('lbOverlay');
	var objBody		= this.doc.getElementsByTagName("body").item(0);
	objOverlay.style.height = pageSize[1] + "px";
	objOverlay.style.display = '';
	this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('div') : document.getElementsByTagName('div');
	if (this.isLyteframe) {
		this.frameArray = [];
		this.frameNum = 0;
		if ((imageLink.getAttribute('rel') == 'lyteframe')) {
			var rev = imageLink.getAttribute('rev');
			this.frameArray.push(new Array(imageLink.getAttribute('lang'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						var rev = anchor.getAttribute('rev');
						this.frameArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
					}
				}
				this.frameArray.removeDuplicates();
				while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('lang')) { this.frameNum++; }
			}
		}
	} else {
		this.imageArray = [];
		this.imageNum = 0;
		this.slideArray = [];
		this.slideNum = 0;
		if ((imageLink.getAttribute('rel') == 'lytebox')) {
			this.imageArray.push(new Array(imageLink.getAttribute('lang'), imageLink.getAttribute('title')));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.imageArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title')));
					}
				}
				this.imageArray.removeDuplicates();
				while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('lang')) { this.imageNum++; }
			}
			if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.slideArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title')));
					}
				}
				this.slideArray.removeDuplicates();
				while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('lang')) { this.slideNum++; }
			}
		}
	}
	var object = this.doc.getElementById('lbMain');
		object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";
		object.style.display = '';
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbMain').onclick = function(e) {
		var e = e;
		if (!e) {
			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
				e = window.parent.window.event;
			} else {
				e = window.event;
			}
		}
		var id = (e.target ? e.target.id : e.srcElement.id);
		if (id == 'lbMain') { myLytebox.end(); return false; }
	}
	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }
	this.isSlideshow = doSlide;
	this.isPaused = (this.slideNum != 0 ? true : false);
	if (this.isSlideshow && this.showPlayPause && this.isPaused) {
		this.doc.getElementById('lbPlay').style.display = '';
		this.doc.getElementById('lbPause').style.display = 'none';
	}
	if (this.isLyteframe) {
		this.changeContent(this.frameNum);
	} else {
		if (this.isSlideshow) {
			this.changeContent(this.slideNum);
		} else {
			this.changeContent(this.imageNum);
		}
	}
};
LyteBox.prototype.changeContent = function(imageNum) {
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.activeImage = this.activeSlide = this.activeFrame = imageNum;
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbLoading').style.display = '';
	this.doc.getElementById('lbImage').style.display = 'none';
	this.doc.getElementById('lbIframe').style.display = 'none';
	this.doc.getElementById('lbPrev').style.display = 'none';
	this.doc.getElementById('lbNext').style.display = 'none';
	this.doc.getElementById('lbIframeContainer').style.display = 'none';
	this.doc.getElementById('lbDetailsContainer').style.display = 'none';
	this.doc.getElementById('lbNumberDisplay').style.display = 'none';
	if (this.navType == 2 || this.isLyteframe) {
		object = this.doc.getElementById('lbNavDisplay');
		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
		object.style.display = 'none';
	}
	if (this.isLyteframe) {
		var iframe = myLytebox.doc.getElementById('lbIframe');
		var styles = this.frameArray[this.activeFrame][2];
		var aStyles = styles.split(';');
		for (var i = 0; i < aStyles.length; i++) {
			if (aStyles[i].indexOf('width:') >= 0) {
				var w = aStyles[i].replace('width:', '');
				iframe.width = w.trim();
			} else if (aStyles[i].indexOf('height:') >= 0) {
				var h = aStyles[i].replace('height:', '');
				iframe.height = h.trim();
			} else if (aStyles[i].indexOf('scrolling:') >= 0) {
				var s = aStyles[i].replace('scrolling:', '');
				iframe.scrolling = s.trim();
			} else if (aStyles[i].indexOf('border:') >= 0) {
				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
				//var b = aStyles[i].replace('border:', '');
				//iframe.style.border = b.trim();
			}
		}
		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
	} else {
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (myLytebox.autoResize) {
				var pagesize = myLytebox.getPageSize();
				var x = pagesize[2] - 150;
				var y = pagesize[3] - 150;
				if (imageWidth > x) {
					imageHeight = Math.round(imageHeight * (x / imageWidth));
					imageWidth = x;
					if (imageHeight > y) {
						imageWidth = Math.round(imageWidth * (y / imageHeight));
						imageHeight = y;
					}
				} else if (imageHeight > y) {
					imageWidth = Math.round(imageWidth * (y / imageHeight));
					imageHeight = y;
					if (imageWidth > x) {
						imageHeight = Math.round(imageHeight * (x / imageWidth));
						imageWidth = x;
					}
				}
			}
			var lbImage = myLytebox.doc.getElementById('lbImage')
			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
			lbImage.width = imageWidth;
			lbImage.height = imageHeight;
			myLytebox.resizeContainer(imageWidth, imageHeight);
			imgPreloader.onload = function() {};
		}
		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
	}
};
LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
	if(this.minWidth && (imgWidth < this.minWidth))
		imgWidth = this.minWidth;
	
	if(this.minHeight && (imgHeight < this.minHeight))
		imgHeight = this.minHeight;	

	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;
	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
	if (!(hDiff == 0)) {
		this.hDone = false;
		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
	} else {
		this.hDone = true;
	}
	if (!(wDiff == 0)) {
		this.wDone = false;
		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
	} else {
		this.wDone = true;
	}
	if ((hDiff == 0) && (wDiff == 0)) {
		if (this.ie){ this.pause(250); } else { this.pause(100); }
	}
	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
	this.doc.getElementById('lbNext').style.height = imgHeight + "px";
	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
/*	if(this.doc.getElementById('lbDetailsContainer').style.width.replace('px','') < 250){
		this.doc.getElementById('lbDetailsContainer').style.width = "250px";
		this.doc.getElementById('lbOuterContainer').style.width = "250px";
	}
*/
	this.showContent();
};
LyteBox.prototype.showContent = function() {
	if (this.wDone && this.hDone) {
		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
		if (this.outerBorder) {
			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
		}
		this.doc.getElementById('lbLoading').style.display = 'none';
		if (this.isLyteframe) {
			this.doc.getElementById('lbIframe').style.display = '';
			this.appear('lbIframe', (this.doAnimations ? 0 : 100));
		} else {
			this.doc.getElementById('lbImage').style.display = '';
			this.appear('lbImage', (this.doAnimations ? 0 : 100));
			this.preloadNeighborImages();
		}
		if (this.isSlideshow) {
			if(this.activeSlide == (this.slideArray.length - 1)) {
				if (this.autoEnd) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
				}
			} else {
				if (!this.isPaused) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
				}
			}
			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
			this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
		} else {
			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
				this.doc.getElementById('lbNavDisplay').style.display = '';
			} else {
				this.doc.getElementById('lbNavDisplay').style.display = 'none';
			}
			this.doc.getElementById('lbClose').style.display = '';
			this.doc.getElementById('lbDetails').style.display = '';
			this.doc.getElementById('lbPause').style.display = 'none';
			this.doc.getElementById('lbPlay').style.display = 'none';
		}
		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
		try {
			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
		} catch(e) { }
	} else {
		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
	}
};
LyteBox.prototype.updateDetails = function() {
	var object = this.doc.getElementById('lbCaption');
	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
	object.style.display = '';
	object.innerHTML = (sTitle == null ? '' : sTitle);
	this.updateNav();
	this.doc.getElementById('lbDetailsContainer').style.display = '';
	object = this.doc.getElementById('lbNumberDisplay');
	if (this.isSlideshow && this.slideArray.length > 1) {
		object.style.display = '';
		// object.innerHTML = "<nobr>Bild " + eval(this.activeSlide + 1) + " von " + this.slideArray.length+"</nobr>";
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
	} else if (this.imageArray.length > 1 && !this.isLyteframe) {
		object.style.display = '';
		// object.innerHTML = "<nobr>Bild " + eval(this.activeImage + 1) + " von " + this.imageArray.length+"</nobr>";
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
	} else if (this.frameArray.length > 1 && this.isLyteframe) {
		object.style.display = '';
		object.innerHTML = "Seite " + eval(this.activeFrame + 1) + " von " + this.frameArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = '';
	} else {
		this.doc.getElementById('lbNavDisplay').style.display = 'none';
	}
	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
};
LyteBox.prototype.updateNav = function() {
	return;
	if (this.isSlideshow) {
		if (this.activeSlide != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if (this.activeSlide != (this.slideArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	} else if (this.isLyteframe) {
		if(this.activeFrame != 0) {
			var object = this.doc.getElementById('lbPrev2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
				}
		} else {
			this.doc.getElementById('lbPrev2_Off').style.display = '';
		}
		if(this.activeFrame != (this.frameArray.length - 1)) {
			var object = this.doc.getElementById('lbNext2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
				}
		} else {
			this.doc.getElementById('lbNext2_Off').style.display = '';
		}
	} else {
		if(this.activeImage != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if(this.activeImage != (this.imageArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	}
	this.enableKeyboardNav();
};
LyteBox.prototype.enableKeyboardNav = function() { /*document.onkeydown = this.keyboardAction;*/ };
LyteBox.prototype.disableKeyboardNav = function() { /*document.onkeydown = getkeycode;*/ };
LyteBox.prototype.keyboardAction = function(e) {
	var keycode = key = escape = null;
	keycode	= (e == null) ? event.keyCode : e.which;
	key		= String.fromCharCode(keycode).toLowerCase();
	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
	if ((key == 'x') || (key == 'c') || (keycode == escape)) {
		myLytebox.end();
	} else if ((key == 'p') || (keycode == 37)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide - 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame - 1);
			}
		} else {
			if(myLytebox.activeImage != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage - 1);
			}
		}
	} else if ((key == 'n') || (keycode == 39)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide + 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame + 1);
			}
		} else {
			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage + 1);
			}
		}
	}
};
LyteBox.prototype.preloadNeighborImages = function() {
	if (this.isSlideshow) {
		if ((this.slideArray.length - 1) > this.activeSlide) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
		}
		if(this.activeSlide > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
		}
	} else {
		if ((this.imageArray.length - 1) > this.activeImage) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
		}
		if(this.activeImage > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
		}
	}
};
LyteBox.prototype.togglePlayPause = function(hideID, showID) {
	if (this.isSlideshow && hideID == "lbPause") {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.doc.getElementById(hideID).style.display = 'none';
	this.doc.getElementById(showID).style.display = '';
	if (hideID == "lbPlay") {
		this.isPaused = false;
		if (this.activeSlide == (this.slideArray.length - 1)) {
			this.end();
		} else {
			this.changeContent(this.activeSlide + 1);
		}
	} else {
		this.isPaused = true;
	}
};
LyteBox.prototype.end = function(caller) {
	var closeClick = (caller == 'slideshow' ? false : true);
	if (this.isSlideshow && this.isPaused && !closeClick) { return; }
	this.disableKeyboardNav();
	this.doc.getElementById('lbMain').style.display = 'none';
	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
	this.toggleSelects('visible');
	if (this.hideFlash) { this.toggleFlash('visible'); }
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	if (this.isLyteframe) {
		 this.initialize();
	}
};
LyteBox.prototype.checkFrame = function() {
	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
		this.isFrame = true;
		this.lytebox = "window.parent." + window.name + ".myLytebox";
		this.doc = parent.document;
	} else {
		this.isFrame = false;
		this.lytebox = "myLytebox";
		this.doc = document;
	}
};
LyteBox.prototype.getPixelRate = function(cur, img) {
	var diff = (img > cur) ? img - cur : cur - img;
	if (diff >= 0 && diff <= 100) { return 10; }
	if (diff > 100 && diff <= 200) { return 15; }
	if (diff > 200 && diff <= 300) { return 20; }
	if (diff > 300 && diff <= 400) { return 25; }
	if (diff > 400 && diff <= 500) { return 30; }
	if (diff > 500 && diff <= 600) { return 35; }
	if (diff > 600 && diff <= 700) { return 40; }
	if (diff > 700) { return 45; }
};
LyteBox.prototype.appear = function(id, opacity) {
if (id != 'lbOverlay') // added by s0urce
	opacity = 100; // added by s0urce
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + (opacity + 10) + ")";

	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		this.updateDetails();
	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
		return;
	} else if (opacity >= 100 && id == 'lbDetailsContainer') {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
	} else {
		if (id == 'lbOverlay') {
			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+50) + ")", 1);
		} else {
			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+50) + ")", 1);
		}
	}
};
LyteBox.prototype.fade = function(id, opacity) {
opacity = 0;
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
	if (opacity <= 0) {
		try {
			object.display = 'none';
		} catch(err) { }
	} else if (id == 'lbOverlay') {
		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-100) + ")", 1);
	} else {
		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-100) + ")", 1);
	}
};
LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
	speed = 0; // added by s0urce
	pixelrate = pixelrate + 10; // added by s0urce
	if (!this.hDone) {
		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
		return;
	}
	var object = this.doc.getElementById(id);
	var timer = speed ? speed : (this.resizeDuration/2);
	var newW = (this.doAnimations ? curW : maxW);
	object.style.width = (newW) + "px";
	if (newW < maxW) {
		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
	} else if (newW > maxW) {
		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
	}
	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
	if (parseInt(object.style.width) == maxW) {
		this.wDone = true;
		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
	}
};
LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
	speed = 0; // added by s0urce
	pixelrate = pixelrate + 10; // added by s0urce
	var timer = speed ? speed : (this.resizeDuration/2);
	var object = this.doc.getElementById(id);
	var newH = (this.doAnimations ? curH : maxH);
	object.style.height = (newH) + "px";
	if (newH < maxH) {
		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
	} else if (newH > maxH) {
		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
	}
	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
	if (parseInt(object.style.height) == maxH) {
		this.hDone = true;
		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
	}
};
LyteBox.prototype.getPageScroll = function() {
	if (self.pageYOffset) {
		return this.isFrame ? parent.pageYOffset : self.pageYOffset;
	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
		return this.doc.documentElement.scrollTop;
	} else if (document.body) {
		return this.doc.body.scrollTop;
	}
};
LyteBox.prototype.getPageSize = function() {
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.doc.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
		xScroll = this.doc.body.scrollWidth;
		yScroll = this.doc.body.scrollHeight;
	} else {
		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
	}
	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.doc.documentElement.clientWidth;
		windowHeight = this.doc.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
	}
	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};
LyteBox.prototype.toggleFlash = function(state) {
	var objects = this.doc.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	var embeds = this.doc.getElementsByTagName("embed");
	for (var i = 0; i < embeds.length; i++) {
		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				objects = parent.frames[i].window.document.getElementsByTagName("object");
				for (var j = 0; j < objects.length; j++) {
					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
			try {
				embeds = parent.frames[i].window.document.getElementsByTagName("embed");
				for (var j = 0; j < embeds.length; j++) {
					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.toggleSelects = function(state) {
	var selects = this.doc.getElementsByTagName("select");
	for (var i = 0; i < selects.length; i++ ) {
		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				selects = parent.frames[i].window.document.getElementsByTagName("select");
				for (var j = 0; j < selects.length; j++) {
					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.pause = function(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) { return; }
	}
};
if (window.addEventListener) {
	window.addEventListener("load",initLytebox,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",initLytebox);
} else {
	window.onload = function() {initLytebox();}
}
function initLytebox() { myLytebox = new LyteBox(); }
/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
| Copyright (c) 2002-2003 Geir Landrö               |
|                                                   |
| This script can be used freely as long as all     |
| copyright messages are intact.                    |
|                                                   |
| Updated: 17.04.2003                               |
|--------------------------------------------------*/

// Node object
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
	this.id = id;
	this.pid = pid;
	this.name = name;
	this.url = url;
	this.title = title;
	this.target = target;
	this.icon = icon;
	this.iconOpen = iconOpen;
	this._io = open || false;
	this._is = false;
	this._ls = false;
	this._hc = false;
	this._ai = 0;
	this._p;
};

// Tree object
function dTree(objName) {
	this.config = {
		target					: null,
		folderLinks			: true,
		useSelection		: true,
		useCookies			: true,
		useLines				: true,
		useIcons				: true,
		useStatusText		: true,
		closeSameLevel	: false,
		inOrder					: false
	}
	this.icon = {
		root				: './sys/templates/sysimages/images/base.gif',
		folder			: './sys/templates/sysimages/images/folder.gif',
		folderOpen	: './sys/templates/sysimages/images/folderopen.gif',
//		node				: './sys/templates/sysimages/images/page.gif',
		node				: './sys/templates/sysimages/images/folder.gif',
		empty				: './sys/templates/sysimages/images/empty.gif',
		line				: './sys/templates/sysimages/images/line.gif',
		join				: './sys/templates/sysimages/images/join.gif',
		joinBottom	: './sys/templates/sysimages/images/joinbottom.gif',
		plus				: './sys/templates/sysimages/images/plus.gif',
		plusBottom	: './sys/templates/sysimages/images/plusbottom.gif',
		minus				: './sys/templates/sysimages/images/minus.gif',
		minusBottom	: './sys/templates/sysimages/images/minusbottom.gif',
		nlPlus			: './sys/templates/sysimages/images/nolines_plus.gif',
		nlMinus			: './sys/templates/sysimages/images/nolines_minus.gif'
	};
	this.obj = objName;
	this.aNodes = [];
	this.aIndent = [];
	this.root = new Node(-1);
	this.selectedNode = null;
	this.selectedFound = false;
	this.completed = false;
};

// Adds a new node to the node array
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
	this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
};

// Open/close all nodes
dTree.prototype.openAll = function() {
	this.oAll(true);
};
dTree.prototype.closeAll = function() {
	this.oAll(false);
};

// Outputs the tree to the page
dTree.prototype.toString = function() {
	var str = '<div class="dtree">\n';
	if (document.getElementById) {
		if (this.config.useCookies) this.selectedNode = this.getSelected();
		str += this.addNode(this.root);
	} else str += JS_WORDS["JS_WORDS:01010"];
	str += '</div>';
	if (!this.selectedFound) this.selectedNode = null;
	this.completed = true;
	return str;
};

// Creates the tree structure
dTree.prototype.addNode = function(pNode) {
	var str = '';
	var n=0;
	if (this.config.inOrder) n = pNode._ai;
	for (n; n<this.aNodes.length; n++) {
		if (this.aNodes[n].pid == pNode.id) {
			var cn = this.aNodes[n];
			cn._p = pNode;
			cn._ai = n;
			this.setCS(cn);
			if (!cn.target && this.config.target) cn.target = this.config.target;
			if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
			if (!this.config.folderLinks && cn._hc) cn.url = null;
			if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
					cn._is = true;
					this.selectedNode = n;
					this.selectedFound = true;
			}
			str += this.node(cn, n);
			if (cn._ls) break;
		}
	}
	return str;
};

// Creates the node icon, url and text
dTree.prototype.node = function(node, nodeId) {
	var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
	if (this.config.useIcons) {
		if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
		if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
		if (this.root.id == node.pid) {
			node.icon = this.icon.root;
			node.iconOpen = this.icon.root;
		}
		str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
	}
	if (node.url) {
		str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
		if (node.title) str += ' title="' + node.title + '"';
		if (node.target) str += ' target="' + node.target + '"';
		if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
		if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
			str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');" ondblclick="javascript: ' + this.obj + '.o(' + nodeId + ');"';
		str += '>';
	}
	else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
		str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
	str += node.name;
	if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
	str += '</div>';
	if (node._hc) {
		str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
		str += this.addNode(node);
		str += '</div>';
	}
	this.aIndent.pop();
	return str;
};

// Adds the empty and line icons
dTree.prototype.indent = function(node, nodeId) {
	var str = '';
	if (this.root.id != node.pid) {
		for (var n=0; n<this.aIndent.length; n++)
			str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
		(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
		if (node._hc) {
			str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
			if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
			else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
			str += '" alt="" /></a>';
		} else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
	}
	return str;
};

// Checks if a node has any children and if it is the last sibling
dTree.prototype.setCS = function(node) {
	var lastId;
	for (var n=0; n<this.aNodes.length; n++) {
		if (this.aNodes[n].pid == node.id) node._hc = true;
		if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
	}
	if (lastId==node.id) node._ls = true;
};

// Returns the selected node
dTree.prototype.getSelected = function() {
	var sn = this.getCookie('cs' + this.obj);
	return (sn) ? sn : null;
};

// Highlights the selected node
dTree.prototype.s = function(id) {
	//alert(id);
	wqe = "";
	for(var i=0;i<this.aNodes.length;i++)
		wqe += this.aNodes[i];
//	alert("Length :\n"+this.aNodes.length);
	if (!this.config.useSelection) return;
	var cn = this.aNodes[id];
	if (cn._hc && !this.config.folderLinks) return;
	if (this.selectedNode != id) {
		if (this.selectedNode || this.selectedNode==0) {
			eOld = document.getElementById("s" + this.obj + this.selectedNode);
			if(eOld)
				eOld.className = "node";
		}
		eNew = document.getElementById("s" + this.obj + id);
		eNew.className = "nodeSel";
		this.selectedNode = id;
		if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
	}
};

// Toggle Open or close
dTree.prototype.o = function(id) {
	var cn = this.aNodes[id];
	this.nodeStatus(!cn._io, id, cn._ls);
	cn._io = !cn._io;
	if (this.config.closeSameLevel) this.closeLevel(cn);
	if (this.config.useCookies) this.updateCookie();
};

// Open or close all nodes
dTree.prototype.oAll = function(status) {
	for (var n=0; n<this.aNodes.length; n++) {
		if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
			this.nodeStatus(status, n, this.aNodes[n]._ls)
			this.aNodes[n]._io = status;
		}
	}
	if (this.config.useCookies) this.updateCookie();
};

// Opens the tree to a specific node
dTree.prototype.openTo = function(nId, bSelect, bFirst) {
	if (!bFirst) {
		for (var n=0; n<this.aNodes.length; n++) {
			if (this.aNodes[n].id == nId) {
				nId=n;
				break;
			}
		}
	}
	var cn=this.aNodes[nId];
	if (cn.pid==this.root.id || !cn._p) return;
	cn._io = true;
	cn._is = bSelect;
	if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
	if (this.completed && bSelect) this.s(cn._ai);
	else if (bSelect) this._sn=cn._ai;
	this.openTo(cn._p._ai, false, true);
};

// Closes all nodes on the same level as certain node
dTree.prototype.closeLevel = function(node) {
	for (var n=0; n<this.aNodes.length; n++) {
		if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
			this.nodeStatus(false, n, this.aNodes[n]._ls);
			this.aNodes[n]._io = false;
			this.closeAllChildren(this.aNodes[n]);
		}
	}
}

// Closes all children of a node
dTree.prototype.closeAllChildren = function(node) {
	for (var n=0; n<this.aNodes.length; n++) {
		if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
			if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
			this.aNodes[n]._io = false;
			this.closeAllChildren(this.aNodes[n]);		
		}
	}
}

// Change the status of a node(open or closed)
dTree.prototype.nodeStatus = function(status, id, bottom) {
	eDiv	= document.getElementById('d' + this.obj + id);
	eJoin	= document.getElementById('j' + this.obj + id);
	if (this.config.useIcons) {
		eIcon	= document.getElementById('i' + this.obj + id);
		eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
	}
	if(eJoin){
		eJoin.src = (this.config.useLines)?
		((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
		((status)?this.icon.nlMinus:this.icon.nlPlus);
		eDiv.style.display = (status) ? 'block': 'none';
	}
};


// [Cookie] Clears a cookie
dTree.prototype.clearCookie = function() {
	var now = new Date();
	var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
	this.setCookie('co'+this.obj, 'cookieValue', yesterday);
	this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
};

// [Cookie] Sets value in a cookie
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie =
		escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
};

// [Cookie] Gets a value from a cookie
dTree.prototype.getCookie = function(cookieName) {
	var cookieValue = '';
	var posName = document.cookie.indexOf(escape(cookieName) + '=');
	if (posName != -1) {
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);
		if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
		else cookieValue = unescape(document.cookie.substring(posValue));
	}
	return (cookieValue);
};

// [Cookie] Returns ids of open nodes as a string
dTree.prototype.updateCookie = function() {
	var str = '';
	for (var n=0; n<this.aNodes.length; n++) {
		if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
			if (str) str += '.';
			str += this.aNodes[n].id;
		}
	}
	this.setCookie('co' + this.obj, str);
};

// [Cookie] Checks if a node id is in a cookie
dTree.prototype.isOpen = function(id) {
	var aOpen = this.getCookie('co' + this.obj).split('.');
	for (var n=0; n<aOpen.length; n++)
		if (aOpen[n] == id) return true;
	return false;
};

// If Push and pop is not implemented by the browser
if (!Array.prototype.push) {
	Array.prototype.push = function array_push() {
		for(var i=0;i<arguments.length;i++)
			this[this.length]=arguments[i];
		return this.length;
	}
};
if (!Array.prototype.pop) {
	Array.prototype.pop = function array_pop() {
		lastElement = this[this.length-1];
		this.length = Math.max(this.length-1,0);
		return lastElement;
	}
};
var includes = new Array();
var ci = 0;

var forbidden = "";

inc = new Object();

inc.path = "sys/javascripts/";

inc.add = function(file){

	for(var i = 0; i < includes.length; i++){
		if(includes[i]){
			if(includes[i].src.indexOf(file)>0){
				return;
			}
		}
	}
	
	var script = document.createElement( 'script' );
	script.setAttribute( 'type', 'text/javascript' );
	script.setAttribute( 'src',inc.path+file);
	includes[ci] = script;
	ci++;
}

inc.ban = function(pathnfile){
	var script = document.createElement( 'script' );
	script.setAttribute( 'type', 'text/javascript' );
	script.setAttribute( 'src',pathnfile);
	forbidden+=script.src;
}

inc.exec = function(){
	for(var i = 0; i < includes.length; i++){
		if(includes[i] && (forbidden.indexOf(includes[i].src)<0)){
			var head = document.getElementsByTagName('head')[0];
			if(head){
				head.appendChild(includes[i]);
			}
		}
	}
	includes = new Array();
}
//=============================================================================================================================================
/* Version 3.0, Datum 17.06.08, Author s0urce */

//--------------------------------
//			Settings	         |
//--------------------------------

var hpic_init_pic = "hoverpic";
var hpic_init_self = "hoverself";

var hpic_folder = "hoverpic/";

var hbroder = "1px solid #cccccc";
var hbackground = "white";
var hpadding = "10px";

var hclassName = "headline";



//=======================================================================================================
//=======================================================================================================


var hTop = 0;
var hLeft = 0;
var tmp_pic = new Array();
var hover_img = "";
var hidden_div = "";

var hoverisload = 1;


function show_hover(){
	var tmp_img = document.createElement('img');
	
	
	if(this.lang == hpic_init_self)
		tmp_img.src = this.src;
	else
		tmp_img.src = this.src.replace(this.src.split('/')[this.src.split('/').length-1],(hpic_folder.replace(/\//g,'')+"/"+this.src.split('/')[this.src.split('/').length-1]));
	
	
	if(this.complete){
		hidden_div.appendChild(tmp_img);
		hidden_div.style.display = "block";
	}else{
		tmp_img.onload = pic_loaded;
		var w8_img = document.createElement('img');
		w8_img.src = "./sys/templates/sysimages/system/w83.gif";
		hidden_div.appendChild(w8_img);
		hidden_div.style.display = "block";
	}
}


function pic_loaded(){
	hidden_div.innerHTML = "";
	hidden_div.appendChild(this);
}

function hide_hover(){
	hidden_div.style.display = "none";
	
//	hidden_div.removeChild(this.childNodes[0]);
	hidden_div.innerHTML = "";
}


function set_pic_pos(evt){
	if (!evt) evt = window.event;
	if(hidden_div && hidden_div.style){

		if(!document.all){
			myX = evt.clientX+window.pageXOffset;
			myY = evt.clientY+window.pageYOffset;	
		}else{
			myX = evt.clientX+document.documentElement.scrollLeft;
			myY = evt.clientY+document.documentElement.scrollTop;	
		}
		
		
		qwe  = hidden_div.offsetWidth/(document.body.offsetWidth/myX)
		hidden_div.style.left = myX-qwe+"px";
		
//		qwe  = hidden_div.offsetHeight/(screen.height/myY)
//		hidden_div.style.top = myY-qwe+10+"px";
		
		if(myY>(document.body.offsetHeight/2))
			hidden_div.style.top = myY-hidden_div.offsetHeight-10+"px";
		else
			hidden_div.style.top = myY+10+"px";

					
/*		if(myX>(screen.width/2))
			hidden_div.style.left = myX-+10+"px";
		else
			hidden_div.style.left = myX+10+"px";
	*/	
//		hidden_div.style.left = myX+10+"px";
//		hidden_div.style.top = myY+5+"px";
	}
}

function ident_pics(){
	hidden_div = document.createElement('div');
	hidden_div.style.border = hbroder;
	hidden_div.style.padding = hpadding;
	hidden_div.className = hclassName;
	hidden_div.style.display = "none";
	hidden_div.style.position = "absolute";
	hidden_div.style.zIndex = "9999";
	hidden_div.style.background = hbackground;
	
	document.body.appendChild(hidden_div);
	
	hover_img = document.getElementsByTagName('img');
	
	for(i=0;i < hover_img.length;i++){
	
		if((hover_img[i].lang == hpic_init_pic) || (hover_img[i].lang == hpic_init_self)){
	
			hover_img[i].onmouseover = show_hover;
			hover_img[i].onmouseout = hide_hover;

			//hover_img[i].lang = i;
		}
	}
}
//***********************************************************************************************************************************/
//	LyteBox v3.22
//
//	 Author: Markus F. Hay
//  Website: http://www.dolem.com/lytebox
//	   Date: October 2, 2007
//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
//				* Firefox: 2.0.0.7, 1.5.0.12
//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
//				* Opera: 9.23
//
// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
//				* v3.22 (10/02/07)
//				* v3.21 (09/30/07)
//				* v3.20 (07/12/07)
//				* v3.10 (05/28/07)
//				* v3.00 (05/15/07)
//				* v2.02 (11/13/06)
//
//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
//			 information please visit http://huddletogether.com/projects/lightbox2/
//***********************************************************************************************************************************/
Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }

function LyteBox() {

	/*** Config Var added by s0urce ***/
		this.minWidth = 200;
		this.minHeight = 30;
		
	/*** Start Global Configuration ***/
		this.theme				= 'grey';	// themes: grey (default), red, green, blue, gold
		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
		this.outerBorder		= true;		// controls whether to show the outer grey (or theme) border
		this.resizeSpeed		= 10;		// controls the speed of the image resizing (1=slowest and 10=fastest)
		this.maxOpacity			= 30;		// higher opacity = darker overlay, lower opacity = lighter overlay
		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.

		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
	/*** End Global Configuration ***/

	/*** Configure Slideshow Options ***/
		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
		this.showClose			= true;		// true to display the Close button, false to hide
		this.showDetails		= true;		// true to display image details (caption, count), false to hide
		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
		this.autoEnd			= true;		// true to automatically close Lytebox after the last image is reached, false to keep open
		this.pauseOnNextClick	= true;	// true to pause the slideshow when the "Next" button is clicked
        this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked
	/*** End Slideshow Configuration ***/

	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
	if(this.resizeSpeed < 1) { resizeSpeed = 1; }
	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
	this.resizeWTimerArray		= new Array();
	this.resizeWTimerCount		= 0;
	this.resizeHTimerArray		= new Array();
	this.resizeHTimerCount		= 0;
	this.showContentTimerArray	= new Array();
	this.showContentTimerCount	= 0;
	this.overlayTimerArray		= new Array();
	this.overlayTimerCount		= 0;
	this.imageTimerArray		= new Array();
	this.imageTimerCount		= 0;
	this.timerIDArray			= new Array();
	this.timerIDCount			= 0;
	this.slideshowIDArray		= new Array();
	this.slideshowIDCount		= 0;
	this.imageArray	 = new Array();
	this.activeImage = null;
	this.slideArray	 = new Array();
	this.activeSlide = null;
	this.frameArray	 = new Array();
	this.activeFrame = null;
	this.checkFrame();
	this.isSlideshow = false;
	this.isLyteframe = false;
	/*@cc_on
		/*@if (@_jscript)
			this.ie = (document.all && !window.opera) ? true : false;
		/*@else @*/
			this.ie = false;
		/*@end
	@*/
	this.ie7 = (this.ie && window.XMLHttpRequest);
	this.initialize();
}
LyteBox.prototype.initialize = function() {
	this.updateLyteboxItems();
	var objBody = this.doc.getElementsByTagName("body").item(0);
	if (this.doc.getElementById('lbOverlay')) {
		objBody.removeChild(this.doc.getElementById("lbOverlay"));
		objBody.removeChild(this.doc.getElementById("lbMain"));
	}
	var objOverlay = this.doc.createElement("div");
		objOverlay.setAttribute('id','lbOverlay');
		objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
			objOverlay.style.position = 'absolute';
		}
		objOverlay.style.display = 'none';
		objBody.appendChild(objOverlay);
	var objLytebox = this.doc.createElement("div");
		objLytebox.setAttribute('id','lbMain');
		objLytebox.style.display = 'none';
		objBody.appendChild(objLytebox);
	var objOuterContainer = this.doc.createElement("div");
		objOuterContainer.setAttribute('id','lbOuterContainer');
		objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objOuterContainer);
	var objIframeContainer = this.doc.createElement("div");
		objIframeContainer.setAttribute('id','lbIframeContainer');
		objIframeContainer.style.display = 'none';
		objOuterContainer.appendChild(objIframeContainer);
	var objIframe = this.doc.createElement("iframe");
		objIframe.setAttribute('id','lbIframe');
		objIframe.setAttribute('name','lbIframe');
		objIframe.style.display = 'none';
		objIframeContainer.appendChild(objIframe);
	var objImageContainer = this.doc.createElement("div");
		objImageContainer.setAttribute('id','lbImageContainer');
		objOuterContainer.appendChild(objImageContainer);
	var objLyteboxImage = this.doc.createElement("img");
		objLyteboxImage.setAttribute('id','lbImage');
		objImageContainer.appendChild(objLyteboxImage);
	var objLoading = this.doc.createElement("div");
		objLoading.setAttribute('id','lbLoading');
		objOuterContainer.appendChild(objLoading);
	var objDetailsContainer = this.doc.createElement("div");
		objDetailsContainer.setAttribute('id','lbDetailsContainer');
		objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objDetailsContainer);
	var objDetailsData =this.doc.createElement("div");
		objDetailsData.setAttribute('id','lbDetailsData');
		objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objDetailsContainer.appendChild(objDetailsData);
	var objDetails = this.doc.createElement("div");
		objDetails.setAttribute('id','lbDetails');
		objDetailsData.appendChild(objDetails);
	var objCaption = this.doc.createElement("span");
		objCaption.setAttribute('id','lbCaption');
		objDetails.appendChild(objCaption);
	var objHoverNav = this.doc.createElement("div");
		objHoverNav.setAttribute('id','lbHoverNav');
		objImageContainer.appendChild(objHoverNav);
	var objBottomNav = this.doc.createElement("div");
		objBottomNav.setAttribute('id','lbBottomNav');
		objDetailsData.appendChild(objBottomNav);
	var objPrev = this.doc.createElement("a");
		objPrev.setAttribute('id','lbPrev');
		objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPrev.setAttribute('href','#');
		objHoverNav.appendChild(objPrev);
	var objNext = this.doc.createElement("a");
		objNext.setAttribute('id','lbNext');
		objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objNext.setAttribute('href','#');
		objHoverNav.appendChild(objNext);
	var objNumberDisplay = this.doc.createElement("span");
		objNumberDisplay.setAttribute('id','lbNumberDisplay');
		objDetails.appendChild(objNumberDisplay);
	var objNavDisplay = this.doc.createElement("span");
		objNavDisplay.setAttribute('id','lbNavDisplay');
		objNavDisplay.style.display = 'none';
		objDetails.appendChild(objNavDisplay);
	var objClose = this.doc.createElement("a");
		objClose.setAttribute('id','lbClose');
		objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objClose.setAttribute('href','#');
		objBottomNav.appendChild(objClose);
	var objPause = this.doc.createElement("a");
		objPause.setAttribute('id','lbPause');
		objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPause.setAttribute('href','#');
		objPause.style.display = 'none';
		objBottomNav.appendChild(objPause);
	var objPlay = this.doc.createElement("a");
		objPlay.setAttribute('id','lbPlay');
		objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPlay.setAttribute('href','#');
		objPlay.style.display = 'none';
		objBottomNav.appendChild(objPlay);
};
LyteBox.prototype.updateLyteboxItems = function() {
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('div') : document.getElementsByTagName('div');
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		var relAttribute = String(anchor.getAttribute('rel'));
		if (anchor.getAttribute('lang')) {
			if (relAttribute.toLowerCase().match('lytebox')) {
				anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
								anchor.className = "lytebox_hover";
			} else if (relAttribute.toLowerCase().match('lyteshow')) {
				anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
								anchor.className = "lytebox_hover";
			} else if (relAttribute.toLowerCase().match('lyteframe')) {
				anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
								anchor.className = "lytebox_hover";
			}
		}
	}
};
LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
	if (this.ie && !this.ie7) {	this.toggleSelects('hide');	}
	if (this.hideFlash) { this.toggleFlash('hide'); }
	this.isLyteframe = (doFrame ? true : false);
	var pageSize	= this.getPageSize();
	var objOverlay	= this.doc.getElementById('lbOverlay');
	var objBody		= this.doc.getElementsByTagName("body").item(0);
	objOverlay.style.height = pageSize[1] + "px";
	objOverlay.style.display = '';
	this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('div') : document.getElementsByTagName('div');
	if (this.isLyteframe) {
		this.frameArray = [];
		this.frameNum = 0;
		if ((imageLink.getAttribute('rel') == 'lyteframe')) {
			var rev = imageLink.getAttribute('rev');
			this.frameArray.push(new Array(imageLink.getAttribute('lang'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						var rev = anchor.getAttribute('rev');
						this.frameArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
					}
				}
				this.frameArray.removeDuplicates();
				while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('lang')) { this.frameNum++; }
			}
		}
	} else {
		this.imageArray = [];
		this.imageNum = 0;
		this.slideArray = [];
		this.slideNum = 0;
		if ((imageLink.getAttribute('rel') == 'lytebox')) {
			this.imageArray.push(new Array(imageLink.getAttribute('lang'), imageLink.getAttribute('title')));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.imageArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title')));
					}
				}
				this.imageArray.removeDuplicates();
				while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('lang')) { this.imageNum++; }
			}
			if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('lang') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.slideArray.push(new Array(anchor.getAttribute('lang'), anchor.getAttribute('title')));
					}
				}
				this.slideArray.removeDuplicates();
				while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('lang')) { this.slideNum++; }
			}
		}
	}
	var object = this.doc.getElementById('lbMain');
		object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";
		object.style.display = '';
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbMain').onclick = function(e) {
		var e = e;
		if (!e) {
			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
				e = window.parent.window.event;
			} else {
				e = window.event;
			}
		}
		var id = (e.target ? e.target.id : e.srcElement.id);
		if (id == 'lbMain') { myLytebox.end(); return false; }
	}
	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }
	this.isSlideshow = doSlide;
	this.isPaused = (this.slideNum != 0 ? true : false);
	if (this.isSlideshow && this.showPlayPause && this.isPaused) {
		this.doc.getElementById('lbPlay').style.display = '';
		this.doc.getElementById('lbPause').style.display = 'none';
	}
	if (this.isLyteframe) {
		this.changeContent(this.frameNum);
	} else {
		if (this.isSlideshow) {
			this.changeContent(this.slideNum);
		} else {
			this.changeContent(this.imageNum);
		}
	}
};
LyteBox.prototype.changeContent = function(imageNum) {
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.activeImage = this.activeSlide = this.activeFrame = imageNum;
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbLoading').style.display = '';
	this.doc.getElementById('lbImage').style.display = 'none';
	this.doc.getElementById('lbIframe').style.display = 'none';
	this.doc.getElementById('lbPrev').style.display = 'none';
	this.doc.getElementById('lbNext').style.display = 'none';
	this.doc.getElementById('lbIframeContainer').style.display = 'none';
	this.doc.getElementById('lbDetailsContainer').style.display = 'none';
	this.doc.getElementById('lbNumberDisplay').style.display = 'none';
	if (this.navType == 2 || this.isLyteframe) {
		object = this.doc.getElementById('lbNavDisplay');
		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
		object.style.display = 'none';
	}
	if (this.isLyteframe) {
		var iframe = myLytebox.doc.getElementById('lbIframe');
		var styles = this.frameArray[this.activeFrame][2];
		var aStyles = styles.split(';');
		for (var i = 0; i < aStyles.length; i++) {
			if (aStyles[i].indexOf('width:') >= 0) {
				var w = aStyles[i].replace('width:', '');
				iframe.width = w.trim();
			} else if (aStyles[i].indexOf('height:') >= 0) {
				var h = aStyles[i].replace('height:', '');
				iframe.height = h.trim();
			} else if (aStyles[i].indexOf('scrolling:') >= 0) {
				var s = aStyles[i].replace('scrolling:', '');
				iframe.scrolling = s.trim();
			} else if (aStyles[i].indexOf('border:') >= 0) {
				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
				//var b = aStyles[i].replace('border:', '');
				//iframe.style.border = b.trim();
			}
		}
		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
	} else {
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (myLytebox.autoResize) {
				var pagesize = myLytebox.getPageSize();
				var x = pagesize[2] - 150;
				var y = pagesize[3] - 150;
				if (imageWidth > x) {
					imageHeight = Math.round(imageHeight * (x / imageWidth));
					imageWidth = x;
					if (imageHeight > y) {
						imageWidth = Math.round(imageWidth * (y / imageHeight));
						imageHeight = y;
					}
				} else if (imageHeight > y) {
					imageWidth = Math.round(imageWidth * (y / imageHeight));
					imageHeight = y;
					if (imageWidth > x) {
						imageHeight = Math.round(imageHeight * (x / imageWidth));
						imageWidth = x;
					}
				}
			}
			var lbImage = myLytebox.doc.getElementById('lbImage')
			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
			lbImage.width = imageWidth;
			lbImage.height = imageHeight;
			myLytebox.resizeContainer(imageWidth, imageHeight);
			imgPreloader.onload = function() {};
		}
		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
	}
};
LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
	if(this.minWidth && (imgWidth < this.minWidth))
		imgWidth = this.minWidth;
	
	if(this.minHeight && (imgHeight < this.minHeight))
		imgHeight = this.minHeight;	

	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;
	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
	if (!(hDiff == 0)) {
		this.hDone = false;
		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
	} else {
		this.hDone = true;
	}
	if (!(wDiff == 0)) {
		this.wDone = false;
		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
	} else {
		this.wDone = true;
	}
	if ((hDiff == 0) && (wDiff == 0)) {
		if (this.ie){ this.pause(250); } else { this.pause(100); }
	}
	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
	this.doc.getElementById('lbNext').style.height = imgHeight + "px";
	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
/*	if(this.doc.getElementById('lbDetailsContainer').style.width.replace('px','') < 250){
		this.doc.getElementById('lbDetailsContainer').style.width = "250px";
		this.doc.getElementById('lbOuterContainer').style.width = "250px";
	}
*/
	this.showContent();
};
LyteBox.prototype.showContent = function() {
	if (this.wDone && this.hDone) {
		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
		if (this.outerBorder) {
			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
		}
		this.doc.getElementById('lbLoading').style.display = 'none';
		if (this.isLyteframe) {
			this.doc.getElementById('lbIframe').style.display = '';
			this.appear('lbIframe', (this.doAnimations ? 0 : 100));
		} else {
			this.doc.getElementById('lbImage').style.display = '';
			this.appear('lbImage', (this.doAnimations ? 0 : 100));
			this.preloadNeighborImages();
		}
		if (this.isSlideshow) {
			if(this.activeSlide == (this.slideArray.length - 1)) {
				if (this.autoEnd) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
				}
			} else {
				if (!this.isPaused) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
				}
			}
			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
			this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
		} else {
			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
				this.doc.getElementById('lbNavDisplay').style.display = '';
			} else {
				this.doc.getElementById('lbNavDisplay').style.display = 'none';
			}
			this.doc.getElementById('lbClose').style.display = '';
			this.doc.getElementById('lbDetails').style.display = '';
			this.doc.getElementById('lbPause').style.display = 'none';
			this.doc.getElementById('lbPlay').style.display = 'none';
		}
		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
		try {
			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
		} catch(e) { }
	} else {
		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
	}
};
LyteBox.prototype.updateDetails = function() {
	var object = this.doc.getElementById('lbCaption');
	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
	object.style.display = '';
	object.innerHTML = (sTitle == null ? '' : sTitle);
	this.updateNav();
	this.doc.getElementById('lbDetailsContainer').style.display = '';
	object = this.doc.getElementById('lbNumberDisplay');
	if (this.isSlideshow && this.slideArray.length > 1) {
		object.style.display = '';
		// object.innerHTML = "<nobr>Bild " + eval(this.activeSlide + 1) + " von " + this.slideArray.length+"</nobr>";
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
	} else if (this.imageArray.length > 1 && !this.isLyteframe) {
		object.style.display = '';
		// object.innerHTML = "<nobr>Bild " + eval(this.activeImage + 1) + " von " + this.imageArray.length+"</nobr>";
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
	} else if (this.frameArray.length > 1 && this.isLyteframe) {
		object.style.display = '';
		object.innerHTML = "Seite " + eval(this.activeFrame + 1) + " von " + this.frameArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = '';
	} else {
		this.doc.getElementById('lbNavDisplay').style.display = 'none';
	}
	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
};
LyteBox.prototype.updateNav = function() {
	return;
	if (this.isSlideshow) {
		if (this.activeSlide != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if (this.activeSlide != (this.slideArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	} else if (this.isLyteframe) {
		if(this.activeFrame != 0) {
			var object = this.doc.getElementById('lbPrev2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
				}
		} else {
			this.doc.getElementById('lbPrev2_Off').style.display = '';
		}
		if(this.activeFrame != (this.frameArray.length - 1)) {
			var object = this.doc.getElementById('lbNext2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
				}
		} else {
			this.doc.getElementById('lbNext2_Off').style.display = '';
		}
	} else {
		if(this.activeImage != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if(this.activeImage != (this.imageArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	}
	this.enableKeyboardNav();
};
LyteBox.prototype.enableKeyboardNav = function() { /*document.onkeydown = this.keyboardAction;*/ };
LyteBox.prototype.disableKeyboardNav = function() { /*document.onkeydown = getkeycode;*/ };
LyteBox.prototype.keyboardAction = function(e) {
	var keycode = key = escape = null;
	keycode	= (e == null) ? event.keyCode : e.which;
	key		= String.fromCharCode(keycode).toLowerCase();
	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
	if ((key == 'x') || (key == 'c') || (keycode == escape)) {
		myLytebox.end();
	} else if ((key == 'p') || (keycode == 37)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide - 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame - 1);
			}
		} else {
			if(myLytebox.activeImage != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage - 1);
			}
		}
	} else if ((key == 'n') || (keycode == 39)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide + 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame + 1);
			}
		} else {
			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage + 1);
			}
		}
	}
};
LyteBox.prototype.preloadNeighborImages = function() {
	if (this.isSlideshow) {
		if ((this.slideArray.length - 1) > this.activeSlide) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
		}
		if(this.activeSlide > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
		}
	} else {
		if ((this.imageArray.length - 1) > this.activeImage) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
		}
		if(this.activeImage > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
		}
	}
};
LyteBox.prototype.togglePlayPause = function(hideID, showID) {
	if (this.isSlideshow && hideID == "lbPause") {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.doc.getElementById(hideID).style.display = 'none';
	this.doc.getElementById(showID).style.display = '';
	if (hideID == "lbPlay") {
		this.isPaused = false;
		if (this.activeSlide == (this.slideArray.length - 1)) {
			this.end();
		} else {
			this.changeContent(this.activeSlide + 1);
		}
	} else {
		this.isPaused = true;
	}
};
LyteBox.prototype.end = function(caller) {
	var closeClick = (caller == 'slideshow' ? false : true);
	if (this.isSlideshow && this.isPaused && !closeClick) { return; }
	this.disableKeyboardNav();
	this.doc.getElementById('lbMain').style.display = 'none';
	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
	this.toggleSelects('visible');
	if (this.hideFlash) { this.toggleFlash('visible'); }
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	if (this.isLyteframe) {
		 this.initialize();
	}
};
LyteBox.prototype.checkFrame = function() {
	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
		this.isFrame = true;
		this.lytebox = "window.parent." + window.name + ".myLytebox";
		this.doc = parent.document;
	} else {
		this.isFrame = false;
		this.lytebox = "myLytebox";
		this.doc = document;
	}
};
LyteBox.prototype.getPixelRate = function(cur, img) {
	var diff = (img > cur) ? img - cur : cur - img;
	if (diff >= 0 && diff <= 100) { return 10; }
	if (diff > 100 && diff <= 200) { return 15; }
	if (diff > 200 && diff <= 300) { return 20; }
	if (diff > 300 && diff <= 400) { return 25; }
	if (diff > 400 && diff <= 500) { return 30; }
	if (diff > 500 && diff <= 600) { return 35; }
	if (diff > 600 && diff <= 700) { return 40; }
	if (diff > 700) { return 45; }
};
LyteBox.prototype.appear = function(id, opacity) {
if (id != 'lbOverlay') // added by s0urce
	opacity = 100; // added by s0urce
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + (opacity + 10) + ")";

	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		this.updateDetails();
	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
		return;
	} else if (opacity >= 100 && id == 'lbDetailsContainer') {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
	} else {
		if (id == 'lbOverlay') {
			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+50) + ")", 1);
		} else {
			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+50) + ")", 1);
		}
	}
};
LyteBox.prototype.fade = function(id, opacity) {
opacity = 0;
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
	if (opacity <= 0) {
		try {
			object.display = 'none';
		} catch(err) { }
	} else if (id == 'lbOverlay') {
		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-100) + ")", 1);
	} else {
		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-100) + ")", 1);
	}
};
LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
	speed = 0; // added by s0urce
	pixelrate = pixelrate + 10; // added by s0urce
	if (!this.hDone) {
		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
		return;
	}
	var object = this.doc.getElementById(id);
	var timer = speed ? speed : (this.resizeDuration/2);
	var newW = (this.doAnimations ? curW : maxW);
	object.style.width = (newW) + "px";
	if (newW < maxW) {
		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
	} else if (newW > maxW) {
		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
	}
	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
	if (parseInt(object.style.width) == maxW) {
		this.wDone = true;
		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
	}
};
LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
	speed = 0; // added by s0urce
	pixelrate = pixelrate + 10; // added by s0urce
	var timer = speed ? speed : (this.resizeDuration/2);
	var object = this.doc.getElementById(id);
	var newH = (this.doAnimations ? curH : maxH);
	object.style.height = (newH) + "px";
	if (newH < maxH) {
		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
	} else if (newH > maxH) {
		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
	}
	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
	if (parseInt(object.style.height) == maxH) {
		this.hDone = true;
		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
	}
};
LyteBox.prototype.getPageScroll = function() {
	if (self.pageYOffset) {
		return this.isFrame ? parent.pageYOffset : self.pageYOffset;
	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
		return this.doc.documentElement.scrollTop;
	} else if (document.body) {
		return this.doc.body.scrollTop;
	}
};
LyteBox.prototype.getPageSize = function() {
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.doc.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
		xScroll = this.doc.body.scrollWidth;
		yScroll = this.doc.body.scrollHeight;
	} else {
		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
	}
	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.doc.documentElement.clientWidth;
		windowHeight = this.doc.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
	}
	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};
LyteBox.prototype.toggleFlash = function(state) {
	var objects = this.doc.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	var embeds = this.doc.getElementsByTagName("embed");
	for (var i = 0; i < embeds.length; i++) {
		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				objects = parent.frames[i].window.document.getElementsByTagName("object");
				for (var j = 0; j < objects.length; j++) {
					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
			try {
				embeds = parent.frames[i].window.document.getElementsByTagName("embed");
				for (var j = 0; j < embeds.length; j++) {
					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.toggleSelects = function(state) {
	var selects = this.doc.getElementsByTagName("select");
	for (var i = 0; i < selects.length; i++ ) {
		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				selects = parent.frames[i].window.document.getElementsByTagName("select");
				for (var j = 0; j < selects.length; j++) {
					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.pause = function(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) { return; }
	}
};
if (window.addEventListener) {
	window.addEventListener("load",initLytebox,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",initLytebox);
} else {
	window.onload = function() {initLytebox();}
}
function initLytebox() { myLytebox = new LyteBox(); }
function bcheck(){
 	agent  = navigator.userAgent.toLowerCase();
    ie7   = (agent.indexOf("msie 7")	!=	  -1);
    ie8   = (agent.indexOf("msie 8")	!=   -1);

    ff2	  = (agent.indexOf("firefox/2") !=   -1);
    ff3   = (agent.indexOf("firefox/3") !=   -1);
    
//alert(navigator.userAgent.toLowerCase()+"\n"+parseInt(navigator.appVersion));

	if((ie7 || ff2 || (self.location.toString().indexOf('localhost')>-1) || 1)){
		;
	}else if((ie8 || ff3)){
		self.location = "./sys/tools/browser/newversion.html";
	}else{
		self.location = "./sys/tools/browser/nosupport.html";
	}
}

bcheck();

fw = function(){
	this.create = function(div_id,win_title){
		// alert(div_id+","+win_title);
	}
}

system.fw = function(div_id,win_title){
	tmp = new fw();
	tmp.create(div_id,win_title);
	return tmp;
}

system.fw('content','Content');

fade = function(instance_name,fade_box_id){
	
	var this_this;
	var opacity = 10;
	var inwork = 0;
	
	this.it = function(current_this){
		if(inwork == 0){
			inwork = 1;
			opacity = 10;
			this_this = current_this;
			this.fade_out();
		}
	}
	
	
	this.fade_out = function(){
		opacity--;
		fade_do();
		if(opacity > -1)
			setTimeout(instance_name+'.fade_out()',50);
		else
			this.change();
	}
	
	this.fade_in = function(){
		opacity++;
		fade_do();
		if(opacity < 11)
			setTimeout(instance_name+'.fade_in()',50);
		else
			inwork = 0;
	}	
	
	this.change = function(){
		document.getElementById(fade_box_id).src = this_this;
		this.fade_in();
	}
	
	fade_do = function(){
		//alert(opacity);
		document.getElementById(fade_box_id).style.filter = "alpha(opacity="+(opacity*10)+")";
		document.getElementById(fade_box_id).style.MozOpacity = (opacity/10);
		document.getElementById(fade_box_id).style.opacity = (opacity/10);
	}
}
var site_change = false;



function fill_select_with_innerhtml(obj,content){
	if(content){
		content = content.replace(/\"/,"'");

		optionlist = content.split("/option><option");
		i_y = obj.length;
		for(i=0; i<i_y; i++) {
			obj.options[obj.length-1] = null;
		}
	
		i_x = 0;
		for (var i = 0; i < optionlist.length; i++){
			i_x++;
			var_for_content = optionlist[i];
			var_for_content = var_for_content.substr(var_for_content.indexOf(">")+1);
			var_for_content = var_for_content.substr(0,var_for_content.indexOf("<"));
		
		
			var_for_value = optionlist[i];
			var_for_value = var_for_value.substr(var_for_value.indexOf("'")+1);
			var_for_value = var_for_value.substr(0,var_for_value.indexOf("'"));
		
			if(optionlist[i].indexOf(' selected')>-1){
				selected_now = true;
			}else{
				selected_now = false;
			}
		
			obj.options[obj.options.length] = new Option(var_for_content, var_for_value,selected_now);
		}
	}
}



function show_raster(){
	if(document.getElementById('site_raster').style.display=="block"){
		document.getElementById('site_raster').style.display = 'none';
	}else{
		document.getElementById('site_raster').style.display = 'block';
	}
}



function submit_now(kind,current_form){
			
	//beforesubmit();
	if(!current_form) current_form = "form_tbs";
	if(current_form=="form_tbs"){

		document.form_tbs.action.value = kind;
		document.form_tbs.submit();
	}
	if(current_form=="form_tbs_login"){
		document.form_tbs_login.action.value = kind;
		document.form_tbs_login.submit();
	}
	if(current_form=="form_tbs_search_small"){
		document.form_tbs_search_small.action.value = kind;
		document.form_tbs_search_small.submit();
	}
	
}

function change_site(site_string){
	
	if(site_change){
		x_confirm = confirm('Bitte speichern Sie Ihre Einträge. \n\n-OK -> Meldung bestätigen \n-Abbrechen -> ohne speichern weiter');
		if(!x_confirm)
			parent.location.href = '?'+site_string;
	}else{
		parent.location.href = '?'+site_string;
	}
}


function print_page(){
	window_date = window.open('sys/tools/page_printer.php',"Druckansicht", 'width=1000, height=700, left=230, top=160, resizable=no, scrollbars=yes');
	}


function set_control_change(){
	site_change = true;
}

function set_control_fields(){
	if(document.form_tbs){
		for(i_now=0;i_now<document.getElementsByTagName('input').length;i_now++)
			document.getElementsByTagName('input')[i_now].onkeypress = set_control_change;
		for(i_now=0;i_now<document.getElementsByTagName('select').length;i_now++)
			document.getElementsByTagName('select')[i_now].onchange = set_control_change;
		}
}


function open_picmanager(){
	window_picmanager = window.open(STARTPATH+'/sys/tools/bildermanager/bildermanager.php', 'Bildermanager', 'width=810, height=556, left=230, top=100, resizable=no, scrollbars=yes');
}

function open_filemanager(){
	window_picmanager = window.open(STARTPATH+'/sys/tools/filemanager/filemanager.php', 'Dateimanager', 'width=810, height=556, left=230, top=100, resizable=no, scrollbars=yes');
}

// für Datum popup

var current_date_field = '';

function open_date(field_name){
	current_date_field = field_name;
	window_date = window.open(STARTPATH+'sys/tools/date_select.php', 'Details', 'width=320, height=280, left=530, top=260, resizable=no, scrollbars=yes');
}

function set_date_here(selected_date){
	if(current_date_field)
		document.getElementsByName(current_date_field)[0].value = selected_date;
}

// -- ende für datum

function set_onreturn(){
	tmp_inputs = document.getElementsByTagName('input');
	
	for(i=0;i<tmp_inputs.length;i++){
		if(tmp_inputs[i].lang.indexOf('onreturn')>-1){
			tmp_inputs[i].onkeyup = function(evt){
				if(!evt) evt = window.event;
				if(evt.keyCode == 13){
					eval(document.getElementById(this.lang.substr(9,this.lang.length-10)).href);
				}
			}
		}
	}
}

function show_help(){
	if(fw_exists('modul_help__msg')){
		javascript:fw_hide("modul_help__msg",0);
	}else{
		fw_create('modul_help__msg',1);
		fw_img_link('modul_help__msg','javascript:fw_hide("modul_help__msg",1);','sys/templates/sysimages/system/logout.gif');
		fw_set_titel('modul_help__msg','Hilfe','#fff');
	}
}



// =========================== last calls ==============================


//======================================================================
var state = 0;
var mywindow = 0;
var windowtomove = 0;
var window_left = 0;
var window_top = 0;
var tmp_window = 0;

//document.onmousemove=move_window;
system.event("onmousemove","move_window");

function fw_create(element_id){
if(typeof(element_id) == 'object'){
var child = element_id;
}else{
var child = document.getElementById(element_id);
}

// alert(color_now);
//alert(element_id);
//alert(child);
var parent = child.parentNode;

prepare_child(child);

if(Math.round(child.style.width.replace('px','')) < 200)
	child.style.width = '200px';

var title_border = document.createElement("div");
title_border.style.background = "#ffffff";
//title_border.style.position = "absolute";
title_border.style.height = "20px";
title_border.style.width = child.style.width;

var title = document.createElement("div");
title.style.position = "absolute";
//title.style.top = "-15px";
title.style.zIndex=3;
title.style.height = "21px";
title.style.width = child.style.width;
//title.setAttribute("src", "./title.jpg");
//title.style.backgroundImage = "url(title.jpg)";
title.style.background = "white";
title.style.opacity = 0.01;
title.style.filter = "alpha(opacity=01)";
title.onmousedown = set_down;
title.onmouseup = set_up;
//title.onmousemove = move_window;
//title.setAttribute("onmousemove","move_window(this);");

var title_img = document.createElement("img");
title_img.style.position = "absolute";
title_img.style.height = "21px";
title_img.style.zIndex=1;
title_img.style.width = child.style.width;
title_img.setAttribute("src", STARTPATH+"sys/templates/sysimages/system/flying_window_title.jpg");
// title_img.setAttribute("src", STARTPATH+"sys/templates/sysimages/menu.jpg");

mywindow = document.createElement("div");
mywindow.id = "container_"+child.id;
//mywindow.style.height = Math.round(child.style.height.replace('px',''))+15+'px';


mywindow.style.width = Math.round(child.style.width.replace('px',''))+'px';
mywindow.style.left = child.style.left;
mywindow.style.top = child.style.top;
mywindow.style.background = "#ffffff";

if(!browser.ie6) mywindow.style.position = "fixed";
else mywindow.style.position = "absolute";

mywindow.style.zIndex = 5;

clean_child(child);

mywindow.style.borderTop = "1px solid "+color_now_1;
mywindow.style.borderLeft = "1px solid "+color_now_1;
mywindow.style.borderBottom = "1px solid "+color_now_1;
mywindow.style.borderRight = "1px solid "+color_now_1;

title_border.appendChild(title);
// title_border.appendChild(title_img);
mywindow.appendChild(title_border);
mywindow.appendChild(child);
// document.form_tbs.appendChild(mywindow);
document.getElementById('content').appendChild(mywindow);


if (typeof parent.onselectstart!="undefined"){ //IE route
	mywindow.onselectstart=function(){return false}
}else if (typeof parent.style.MozUserSelect!="undefined"){ //Firefox route
	mywindow.style.MozUserSelect="none";
}else{ //All other route (ie: Opera)
	mywindow.onmousedown=function(){return false}
}

mywindow.style.cursor = "default"



//child.id = "windowed_"+child.id;
//child = document.getElementById(child.id);

}

function prepare_child(child){
	if(!child.style.width ){
		if (child.width){
			child.style.width = child.width+'px';
			child.removeAttribute("width");
		}else{
			child.style.width = child.offsetWidth+'px';
			}
	}

	if(!child.style.height ){
		if (child.height){
			child.style.height = child.height+'px';
			child.removeAttribute("height");
		}else{
			child.style.height = child.offsetHeight+'px';
			}
	}
	
	if (!child.style.left){
		child.style.left = child.offsetLeft+'px';
		}
	if (!child.style.top){
		child.style.top = child.offsetTop+'px';
	}
	
child.style.border='0';
child.border='0';
child.style.display = "block";
child.style.display = "block";
		//alert('ID: '+child.id);
		//alert('Style: '+child.style.height);
		//alert('Norm: '+child.height);
		//alert('Offset: '+child.offsetHeight);
		
		//alert('Style: '+child.style.width);
		//alert('Norm: '+child.width);
		//alert('Offset: '+child.offsetWidth);

/*child.style.width = child.offsetWidth+'px';
child.style.height = child.offsetHeight+'px';
child.style.left = child.offsetLeft+'px';
child.style.top = child.offsetTop+'px';*/

}

function clean_child(child){
child.style.position = "relative";
child.style.left = "0";
child.style.top = "0";
}



function set_down(ereignis){
	if (!ereignis)
		ereignis = window.event;

	windowtomove = this.parentNode.parentNode;


	tmp_window = document.createElement('div');

	tmp_window.style.position = "absolute";
	tmp_window.style.height = windowtomove.offsetHeight+"px";
	tmp_window.style.width = windowtomove.offsetWidth+"px";
	tmp_window.style.top = Math.round(windowtomove.style.top.replace('px',''))+document.documentElement.scrollTop+'px';
	tmp_window.style.left = windowtomove.style.left;
	tmp_window.style.zIndex = 11;
	tmp_window.onmouseup = set_up;

	tmp_window.style.border = "1px dotted black";

	tmp_window2 = document.createElement('div');
	tmp_window2.style.width = "100%";
	tmp_window2.style.height = "100%";
	tmp_window2.style.border = "1px dotted black";
	tmp_window.appendChild(tmp_window2);

	tmp_window3 = document.createElement('div');
	tmp_window3.style.width = "100%";
	tmp_window3.style.height = "100%";
	tmp_window3.style.background = "white";
	tmp_window3.style.opacity = 0.01;
	tmp_window3.style.filter = "alpha(opacity=01)";
	tmp_window2.appendChild(tmp_window3);

	windowtomove.parentNode.appendChild(tmp_window);

//	windowtomove.childNodes[1].style.display = 'none';
	window_left = system.X-windowtomove.style.left.replace('px','');
	window_top = system.Y-windowtomove.style.top.replace('px','');
	//window_top = 8;
	state = 1;
}

function set_up(){
	state = 0;
	windowtomove.style.left = system.X-window_left+'px';
	windowtomove.style.top = system.Y-window_top+'px';
	//windowtomove.childNodes[1].style.display = 'block';
	tmp_window.parentNode.removeChild(tmp_window);
}



function move_window(){
	if(state){
		tmp_window.style.left = system.X-window_left+'px';
		tmp_window.style.top = system.Y-window_top+document.documentElement.scrollTop+'px';

		//if(system.browser.ie) document.selection.empty();
		
		if(windowtomove.id == "container_theLayer1"){
			ajax_sting = "set_admin_menu_position="+(system.X-window_left)+"px,"+(system.Y-window_top)+"px";
			system.ajax(ajax_sting,"","fwxx");
		}

	}
}


function fw_moveto(element_id,top,left){	
	if(top&&left){
		to_top = top;
		to_left = left;
	}else{
		to_top = system.Y;
		to_left = system.X;
	}
	document.getElementById(element_id).parentNode.style.top = to_top+"px";
	document.getElementById(element_id).parentNode.style.left = to_left+"px";
}



function fw_destroy(element_id,mode){
	if(typeof(element_id) == 'object')
		var child = element_id;
	else
		var child = document.getElementById(element_id);
	var container = child .parentNode;
	var parent = child.parentNode.parentNode;
	if(container.id.split('_')[0] == 'container'){
		parent.removeChild(container);
		if(!mode){
			parent.appendChild(child);
			child.style.position = 'absolute';
			child.style.left = container.style.left;
			child.style.zIndex = container.style.zIndex;
			child.style.top = Math.round(container.style.top.replace('px','')-15)+'px';
		}
	}
}


function fw_hide(element_id,mode){
	if(typeof(element_id) == 'object')
		var child = element_id;
	else
		var child = document.getElementById(element_id);
	var container = child .parentNode;

	if(container.id.split('_')[0] == 'container'){
		if(mode)
			container.style.display = 'none';
		else
			container.style.display = 'block';
	}
}

function fw_exists(element_id){
	if(typeof(element_id) == 'object')
		var child = element_id;
	else
		var child = document.getElementById(element_id);
	var container = child .parentNode;

	if(container.id.split('_')[0] == 'container')
		return 1;
	else return 0;
}

function fw_text_link(element_id,btn_link,btn_text,btn_front_color,btn_back_color){
	if(typeof(element_id) == 'object'){
	var child = element_id;
	}else{
	var child = document.getElementById(element_id);
	}
	var parent = child.parentNode;
	
	var mybtn_div = document.createElement("div");
	mybtn_div.style.position = "absolute";
	mybtn_div.style.zIndex = 10;
	mybtn_div.style.fontFamily = "Times New Roman";
	
	var mybtn = document.createElement("a");
	mybtn.style.color = btn_front_color;
	mybtn.style.background = btn_back_color;
	mybtn.style.fontWeight = "bold";
	mybtn.style.fontFamily = "arial";

	mybtn.innerHTML = btn_text;
	mybtn.href = btn_link;


mybtn_div.appendChild(mybtn);
parent.childNodes[0].appendChild(mybtn_div);

mybtn_div.style.left = parent.offsetWidth - mybtn.offsetWidth - 5;
}

current_pic_fw_img_link = new Array();

function fw_img_link(element_id,btn_link,btn_src){
	if(!current_pic_fw_img_link[element_id])
		current_pic_fw_img_link[element_id] = 0;
		
	current_pic_fw_img_link[element_id]++;
	if(typeof(element_id) == 'object'){
	var child = element_id;
	}else{
	var child = document.getElementById(element_id);
	}
	var parent = child.parentNode;
	
	var mybtn_div = document.createElement("div");
	mybtn_div.style.position = "absolute";
	
	
	mybtn_div.style.zIndex = "10";

	if(!browser.ie6){
		mybtn_div.style.top = "2px";
		mybtn_div.style.right = "2px";
	}else{
		mybtn_div.style.top = "2px";
		mybtn_div.style.width = "10px";
	}
	
	
	mybtn_div.style.fontFamily = "Times New Roman";
	
	var mybtn = document.createElement("a");
	mybtn.href = btn_link;

	var myimg = document.createElement("img");
	myimg.src = btn_src;
	myimg.style.height = parent.childNodes[0].offsetHeight-5;
	myimg.style.paddingTop = "1px";
	myimg.style.position = 'absolute';
	myimg.style.height = '21px';
	myimg.style.top = '-4px';
	myimg.style.left = '-82px';
	
	if(current_pic_fw_img_link[element_id]==2){
		myimg.style.left = '-162px';
	}

	mybtn.appendChild(myimg);
	mybtn_div.appendChild(mybtn);
	parent.childNodes[0].appendChild(mybtn_div);

	mybtn_div.style.left = parent.offsetWidth - mybtn.offsetWidth - 4;
}

function fw_set_titel(element_id,titel_text,titel_color){
	if(typeof(element_id) == 'object'){
	var child = element_id;
	}else{
	var child = document.getElementById(element_id);
	}
	var parent = child.parentNode;
	
	var mytitel_div = document.createElement("div");
	mytitel_div.style.position = "absolute";
	mytitel_div.style.left = "3px";
	if(!browser.ie6)mytitel_div.style.top = "3px";
	else mytitel_div.style.top = "4.5px";
	mytitel_div.style.color = titel_color;
	mytitel_div.style.zIndex = "2";
	mytitel_div.innerHTML = "<span style='font-size:11px;font-weight:600;'>"+titel_text+"</p>";
	mytitel_div.style.height = parent.childNodes[0].offsetHeight;
	
parent.childNodes[0].appendChild(mytitel_div);

//mybtn_div.style.left = parent.offsetWidth - mybtn.offsetWidth - 4;
}
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================


/* SOURCE FILE: AnchorPosition.js */

/* 
AnchorPosition.js
Author: Matt Kruse
Last modified: 10/11/02

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition. 
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.
*/ 

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

/* SOURCE FILE: PopupWindow.js */

/* 
PopupWindow.js
Author: Matt Kruse
Last modified: 02/16/04

DESCRIPTION: This object allows you to easily and quickly popup a window
in a certain place. The window can either be a DIV or a separate browser
window.

COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 
window with <STYLE> tags may cause errors.

USAGE:
// Create an object for a WINDOW popup
var win = new PopupWindow(); 

// Create an object for a DIV window using the DIV named 'mydiv'
var win = new PopupWindow('mydiv'); 

// Set the window to automatically hide itself when the user clicks 
// anywhere else on the page except the popup
win.autoHide(); 

// Show the window relative to the anchor name passed in
win.showPopup(anchorname);

// Hide the popup
win.hidePopup();

// Set the size of the popup window (only applies to WINDOW popups
win.setSize(width,height);

// Populate the contents of the popup window that will be shown. If you 
// change the contents while it is displayed, you will need to refresh()
win.populate(string);

// set the URL of the window, rather than populating its contents
// manually
win.setUrl("http://www.site.com/");

// Refresh the contents of the popup
win.refresh();

// Specify how many pixels to the right of the anchor the popup will appear
win.offsetX = 50;

// Specify how many pixels below the anchor the popup will appear
win.offsetY = 100;

NOTES:
1) Requires the functions in AnchorPosition.js

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.

4) When a PopupWindow object is created, a handler for 'onmouseup' is
   attached to any event handler you may have already defined. Do NOT define
   an event handler for 'onmouseup' after you define a PopupWindow object or
   the autoHide() will not work correctly.
*/ 

// Set the position of the popup window based on the anchor
function PopupWindow_getXYPosition(anchorname) {
	var coordinates;
	if (this.type == "WINDOW") {
		coordinates = getAnchorWindowPosition(anchorname);
		}
	else {
		coordinates = getAnchorPosition(anchorname);
		}
	this.x = coordinates.x;
	this.y = coordinates.y;
	}
// Set width/height of DIV/popup window
function PopupWindow_setSize(width,height) {
	this.width = width;
	this.height = height;
	}
// Fill the window with contents
function PopupWindow_populate(contents) {
	this.contents = contents;
	this.populated = false;
	}
// Set the URL to go to
function PopupWindow_setUrl(url) {
	this.url = url;
	}
// Set the window popup properties
function PopupWindow_setWindowProperties(props) {
	this.windowProperties = props;
	}
// Refresh the displayed contents of the popup
function PopupWindow_refresh() {
	if (this.divName != null) {
		// refresh the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).innerHTML = this.contents;
			}
		else if (this.use_css) { 
			document.all[this.divName].innerHTML = this.contents;
			}
		else if (this.use_layers) { 
			var d = document.layers[this.divName]; 
			d.document.open();
			d.document.writeln(this.contents);
			d.document.close();
			}
		}
	else {
		if (this.popupWindow != null && !this.popupWindow.closed) {
			if (this.url!="") {
				this.popupWindow.location.href=this.url;
				}
			else {
				this.popupWindow.document.open();
				this.popupWindow.document.writeln(this.contents);
				this.popupWindow.document.close();
			}
			this.popupWindow.focus();
			}
		}
	}
// Position and show the popup, relative to an anchor object
function PopupWindow_showPopup(anchorname) {
	this.getXYPosition(anchorname);
	this.x += this.offsetX;
	this.y += this.offsetY;
	if (!this.populated && (this.contents != "")) {
		this.populated = true;
		this.refresh();
		}
	if (this.divName != null) {
		// Show the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).style.left = this.x + "px";
			document.getElementById(this.divName).style.top = this.y;
			document.getElementById(this.divName).style.visibility = "visible";
			}
		else if (this.use_css) {
			document.all[this.divName].style.left = this.x;
			document.all[this.divName].style.top = this.y;
			document.all[this.divName].style.visibility = "visible";
			}
		else if (this.use_layers) {
			document.layers[this.divName].left = this.x;
			document.layers[this.divName].top = this.y;
			document.layers[this.divName].visibility = "visible";
			}
		}
	else {
		if (this.popupWindow == null || this.popupWindow.closed) {
			// If the popup window will go off-screen, move it so it doesn't
			if (this.x<0) { this.x=0; }
			if (this.y<0) { this.y=0; }
			if (screen && screen.availHeight) {
				if ((this.y + this.height) > screen.availHeight) {
					this.y = screen.availHeight - this.height;
					}
				}
			if (screen && screen.availWidth) {
				if ((this.x + this.width) > screen.availWidth) {
					this.x = screen.availWidth - this.width;
					}
				}
			var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
			this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
			}
		this.refresh();
		}
	}
// Hide the popup
function PopupWindow_hidePopup() {
	if (this.divName != null) {
		if (this.use_gebi) {
			document.getElementById(this.divName).style.visibility = "hidden";
			}
		else if (this.use_css) {
			document.all[this.divName].style.visibility = "hidden";
			}
		else if (this.use_layers) {
			document.layers[this.divName].visibility = "hidden";
			}
		}
	else {
		if (this.popupWindow && !this.popupWindow.closed) {
			this.popupWindow.close();
			this.popupWindow = null;
			}
		}
	}
// Pass an event and return whether or not it was the popup DIV that was clicked
function PopupWindow_isClicked(e) {
	if (this.divName != null) {
		if (this.use_layers) {
			var clickX = e.pageX;
			var clickY = e.pageY;
			var t = document.layers[this.divName];
			if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
				return true;
				}
			else { return false; }
			}
		else if (document.all) { // Need to hard-code this to trap IE for error-handling
			var t = window.event.srcElement;
			while (t.parentElement != null) {
				if (t.id==this.divName) {
					return true;
					}
				t = t.parentElement;
				}
			return false;
			}
		else if (this.use_gebi && e) {
			var t = e.originalTarget;
			while (t.parentNode != null) {
				if (t.id==this.divName) {
					return true;
					}
				t = t.parentNode;
				}
			return false;
			}
		return false;
		}
	return false;
	}

// Check an onMouseDown event to see if we should hide
function PopupWindow_hideIfNotClicked(e) {
	if (this.autoHideEnabled && !this.isClicked(e)) {
		this.hidePopup();
		}
	}
// Call this to make the DIV disable automatically when mouse is clicked outside it
function PopupWindow_autoHide() {
	this.autoHideEnabled = true;
	}
// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
function PopupWindow_hidePopupWindows(e) {
	for (var i=0; i<popupWindowObjects.length; i++) {
		if (popupWindowObjects[i] != null) {
			var p = popupWindowObjects[i];
			p.hideIfNotClicked(e);
			}
		}
	}
// Run this immediately to attach the event listener
function PopupWindow_attachListener() {
	if (document.layers) {
		document.captureEvents(Event.MOUSEUP);
		}
	window.popupWindowOldEventListener = document.onmouseup;
	if (window.popupWindowOldEventListener != null) {
		document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
		}
	else {
		document.onmouseup = PopupWindow_hidePopupWindows;
		}
	}
// CONSTRUCTOR for the PopupWindow object
// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
function PopupWindow() {
	if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
	if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
	if (!window.listenerAttached) {
		window.listenerAttached = true;
		PopupWindow_attachListener();
		}
	this.index = popupWindowIndex++;
	popupWindowObjects[this.index] = this;
	this.divName = null;
	this.popupWindow = null;
	this.width=0;
	this.height=0;
	this.populated = false;
	this.visible = false;
	this.autoHideEnabled = false;
	
	this.contents = "";
	this.url="";
	this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
	if (arguments.length>0) {
		this.type="DIV";
		this.divName = arguments[0];
		}
	else {
		this.type="WINDOW";
		}
	this.use_gebi = false;
	this.use_css = false;
	this.use_layers = false;
	if (document.getElementById) { this.use_gebi = true; }
	else if (document.all) { this.use_css = true; }
	else if (document.layers) { this.use_layers = true; }
	else { this.type = "WINDOW"; }
	this.offsetX = 0;
	this.offsetY = 0;
	// Method mappings
	this.getXYPosition = PopupWindow_getXYPosition;
	this.populate = PopupWindow_populate;
	this.setUrl = PopupWindow_setUrl;
	this.setWindowProperties = PopupWindow_setWindowProperties;
	this.refresh = PopupWindow_refresh;
	this.showPopup = PopupWindow_showPopup;
	this.hidePopup = PopupWindow_hidePopup;
	this.setSize = PopupWindow_setSize;
	this.isClicked = PopupWindow_isClicked;
	this.autoHide = PopupWindow_autoHide;
	this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
	}

/* SOURCE FILE: ColorPicker2.js */

/* 
Last modified: 02/24/2003

DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB 
form. It uses a color "swatch" to display the standard 216-color web-safe 
palette. The user can then click on a color to select it.

COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js.
Only the latest DHTML-capable browsers will show the color and hex values
at the bottom as your mouse goes over them.

USAGE:
// Create a new ColorPicker object using DHTML popup
var cp = new ColorPicker();

// Create a new ColorPicker object using Window Popup
var cp = new ColorPicker('window');

// Add a link in your page to trigger the popup. For example:
<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>

// Or use the built-in "select" function to do the dirty work for you:
<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>

// If using DHTML popup, write out the required DIV tag near the bottom
// of your page.
<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>

// Write the 'pickColor' function that will be called when the user clicks
// a color and do something with the value. This is only required if you
// want to do something other than simply populate a form field, which is 
// what the 'select' function will give you.
function pickColor(color) {
	field.value = color;
	}

NOTES:
1) Requires the functions in AnchorPosition.js and PopupWindow.js

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.

4) When a ColorPicker object is created, a handler for 'onmouseup' is
   attached to any event handler you may have already defined. Do NOT define
   an event handler for 'onmouseup' after you define a ColorPicker object or
   the color picker will not hide itself correctly.
*/ 
ColorPicker_targetInput = null;
function ColorPicker_writeDiv() {
	document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
	}

function ColorPicker_show(anchorname) {
	this.showPopup(anchorname);
	}

function ColorPicker_pickColor(color,obj) {
	obj.hidePopup();
	pickColor(color);
	}

// A Default "pickColor" function to accept the color passed back from popup.
// User can over-ride this with their own function.
function pickColor(color) {
	if (ColorPicker_targetInput==null) {
		alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");
		return;
		}
	ColorPicker_targetInput.value = color;
	}

// This function is the easiest way to popup the window, select a color, and
// have the value populate a form field, which is what most people want to do.
function ColorPicker_select(inputobj,linkname) {
	if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { 
		alert("colorpicker.select: Input object passed is not a valid form input object"); 
		window.ColorPicker_targetInput=null;
		return;
		}
	window.ColorPicker_targetInput = inputobj;
	this.show(linkname);
	}
	
// This function runs when you move your mouse over a color block, if you have a newer browser
function ColorPicker_highlightColor(c) {
	var thedoc = (arguments.length>1)?arguments[1]:window.document;
	var d = thedoc.getElementById("colorPickerSelectedColor");
	d.style.backgroundColor = c;
	d = thedoc.getElementById("colorPickerSelectedColorValue");
	d.innerHTML = c;
	}

function ColorPicker() {
	var windowMode = false;
	// Create a new PopupWindow object
	if (arguments.length==0) {
		var divname = "colorPickerDiv";
		}
	else if (arguments[0] == "window") {
		var divname = '';
		windowMode = true;
		}
	else {
		var divname = arguments[0];
		}
	
	if (divname != "") {
		var cp = new PopupWindow(divname);
		}
	else {
		var cp = new PopupWindow();
		cp.setSize(225,250);
		}

	// Object variables
	cp.currentValue = "#FFFFFF";
	
	// Method Mappings
	cp.writeDiv = ColorPicker_writeDiv;
	cp.highlightColor = ColorPicker_highlightColor;
	cp.show = ColorPicker_show;
	cp.select = ColorPicker_select;

	// Code to populate color picker window
	var colors = new Array("#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC",
							"#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099",
							"#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066",
							"#FF0099","#FF00CC","#FF00FF","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333",
							"#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300",
							"#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF",
							"#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#006600","#006633","#006666","#006699","#0066CC",
							"#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699",
							"#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666",
							"#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#009900","#009933",
							"#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900",
							"#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF",
							"#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC",
							"#FF99FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99",
							"#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66",
							"#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33",
							"#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00",
							"#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF",
							"#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC",
							"#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF");
	var total = colors.length;
	var width = 18;
	var cp_contents = "";
	var windowRef = (windowMode)?"window.opener.":"";
	if (windowMode) {
		cp_contents += "<HTML><HEAD><TITLE>Select Color</TITLE></HEAD>";
		cp_contents += "<BODY MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0><CENTER>";
		}
	cp_contents += "<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=0>";
	var use_highlight = (document.getElementById || document.all)?true:false;
	for (var i=0; i<total; i++) {
		if ((i % width) == 0) { cp_contents += "<TR>"; }
		if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
		else { mo = ""; }
		cp_contents += '<TD BGCOLOR="'+colors[i]+'"><FONT SIZE="-3"><A HREF="#" onClick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+' STYLE="text-decoration:none;">&nbsp;&nbsp;&nbsp;</A></FONT></TD>';
		if ( ((i+1)>=total) || (((i+1) % width) == 0)) { 
			cp_contents += "</TR>";
			}
		}
	// If the browser supports dynamically changing TD cells, add the fancy stuff
	if (document.getElementById) {
		var width1 = Math.floor(width/2);
		var width2 = width = width1;
		cp_contents += "<TR><TD COLSPAN='"+width1+"' BGCOLOR='#ffffff' ID='colorPickerSelectedColor'>&nbsp;</TD><TD COLSPAN='"+width2+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>";
		}
	cp_contents += "</TABLE>";
	if (windowMode) {
		cp_contents += "</CENTER></BODY></HTML>";
		}
	// end populate code

	// Write the contents to the popup object
	cp.populate(cp_contents+"\n");
	// Move the table down a bit so you can see it
	cp.offsetY = 25;
	cp.autoHide();
	return cp;
	}

function outsourced_onload(){

	set_onreturn();
	
	//================================= system.js ==============================================
	system.w8();


	//================================= hoverpic.js ==============================================
	system.event("onmousemove","set_pic_pos");
	ident_pics();

	
}



data_selected_field = "";

function load_template(selected_field){
	data_selected_field = selected_field

	ajax_string = "modul=immo&site=immo_options";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	std.ajax_com(ajax_string,"load_template_2");

		
}


function load_template_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = "";
	fw_hide('div_text_selector',0);
	fw_moveto('div_text_selector',200,300);
	fill_select_with_innerhtml(document.getElementById('text_selector_select'),ajax_result)
}







function load_template_content(selected_template){
	ajax_string = "modul=immo&site=immo_options_content";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	ajax_string+= "&selected_immo_template="+selected_template;
	std.ajax_com(ajax_string,"load_template_content_2");

}


function load_template_content_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = ajax_result;
}



function insert_content(){
	current_content = document.getElementById('text_selector_preview').innerHTML;
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	document.getElementById('modul_immo_data__field_'+data_selected_field).innerHTML = current_content;
	check_content_lenght("modul_immo_data__field_"+data_selected_field,'2000');
	fw_hide('div_text_selector',1);
}




function set_immo_preferences(selected_immo_kind){
	document.getElementById('div_immo_preferences_kind_0').style.display = "none";
	document.getElementById('div_immo_preferences_kind_2').style.display = "none";
	document.getElementById('div_immo_preferences_kind_3').style.display = "none";
	document.getElementById('div_immo_preferences_kind_5').style.display = "none";
	
	document.getElementById('div_immo_preferences_kind_'+selected_immo_kind).style.display = "block";
}









function load_ansprechpartner(){
	fw_hide('div_ansprechpartner_selector',0);
}


function load_ansprechpartner_data(selected_ansprechpartner){
	ajax_string = "modul=immo&site=immo_ansprechpartner_content";
	ajax_string+= "&selected_ansprechpartner="+selected_ansprechpartner;
	std.ajax_com(ajax_string,"load_ansprechpartner_data_2");
	
}

function load_ansprechpartner_data_2(ajax_result){
	document.getElementById('ansprechpartner_selector_preview').innerHTML = ajax_result;
}


function insert_ansprechpartner(){
	if(document.getElementById('data_modul_immo_ref_ansprechpartner__anrede')){
		document.getElementById('modul_immo_data__field_17').value = document.getElementById('data_modul_immo_ref_ansprechpartner__anrede').innerHTML;
		document.getElementById('modul_immo_data__field_18').value = document.getElementById('data_modul_immo_ref_ansprechpartner__vorname').innerHTML;
		document.getElementById('modul_immo_data__field_19').value = document.getElementById('data_modul_immo_ref_ansprechpartner__nachname').innerHTML;

		document.getElementById('modul_immo_data__field_20').value = document.getElementById('data_modul_immo_ref_ansprechpartner__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_21').value = document.getElementById('data_modul_immo_ref_ansprechpartner__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_22').value = document.getElementById('data_modul_immo_ref_ansprechpartner__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_23').value = document.getElementById('data_modul_immo_ref_ansprechpartner__ort').innerHTML;
		document.getElementById('modul_immo_data__field_24').value = document.getElementById('data_modul_immo_ref_ansprechpartner__laenderkennzeichen').innerHTML;
		document.getElementById('modul_immo_data__field_25').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefon').innerHTML;
		document.getElementById('modul_immo_data__field_26').value = document.getElementById('data_modul_immo_ref_ansprechpartner__mobiltelefon').innerHTML;
		document.getElementById('modul_immo_data__field_27').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefax').innerHTML;
		document.getElementById('modul_immo_data__field_28').value = document.getElementById('data_modul_immo_ref_ansprechpartner__email').innerHTML;
		document.getElementById('modul_immo_data__field_29').value = document.getElementById('data_modul_immo_ref_ansprechpartner__homepage').innerHTML;

		fw_hide('div_ansprechpartner_selector',1);
	}else{
		alert('kein Ansprechpartner ausgewählt');
	}

}








function load_objektadresse(){
	fw_hide('div_objektadresse_selector',0);
}


function load_objektadresse_data(selected_objektadresse){
	ajax_string = "modul=immo&site=immo_objektadresse_content";
	ajax_string+= "&selected_objektadresse="+selected_objektadresse;
	std.ajax_com(ajax_string,"load_objektadresse_data_2");
	
}

function load_objektadresse_data_2(ajax_result){
	document.getElementById('objektadresse_selector_preview').innerHTML = ajax_result;
}


function insert_objektadresse(){
	if(document.getElementById('data_modul_immo_ref_objektadresse__strasse')){

		document.getElementById('modul_immo_data__field_51').value = document.getElementById('data_modul_immo_ref_objektadresse__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_52').value = document.getElementById('data_modul_immo_ref_objektadresse__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_53').value = document.getElementById('data_modul_immo_ref_objektadresse__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_54').value = document.getElementById('data_modul_immo_ref_objektadresse__ort').innerHTML;
		document.getElementById('modul_immo_data__field_55').value = document.getElementById('data_modul_immo_ref_objektadresse__laenderkennzeichen').innerHTML;
		
		fw_hide('div_objektadresse_selector',1);
	}else{
		alert('kein objektadresse ausgewählt');
	}

}



var gadress_block = "";
function load_google_map(google_adress,current_map){
	// gadress_block = google_adress;
	setTimeout("load_google_map2('"+google_adress+"','"+current_map+"')",1000);
}





function load_google_map2(google_adress,current_map){
	// document.getElementById('google_status').innerHTML = document.getElementById('google_status').innerHTML+"Status "+current_map+"<hr>";
	// google_adress = gadress_block;
	if (GBrowserIsCompatible()) {
		// alert(current_map);
		var map = new GMap2(document.getElementById("map_canvas_"+current_map));
		var geocoder = new GClientGeocoder();
		google_adress_array =  google_adress.split('|');

		var bounds = new GLatLngBounds;

		for(i=0;i<google_adress_array.length;i++){
			geocoder.getLatLng(google_adress_array[i],function(latlng) {
				if (!latlng) {
					//alert(address + ' not found');
					//document.getElementById('map_canvas').innerHTML = '<br>&nbsp;&nbsp;&nbsp;Leider wurde keine Lagenkarte gefunden.';
				} else {
					/*
					//Anzeige des Infofeldes 
					 var marker = new GMarker(latlng);
					 var html = '<div style="width:210px; padding-right:10px;">'+
					    '<a href="signup.html">Sign up</a> for a Google Maps API key'+
					    ', or <a href="documentation/index.html">read more about the'+
					    ' API</a>.</div>';
					var marker = new GMarker(latlng);
					map.addOverlay(marker);
					*/
					map.setCenter(latlng,12);
					var marker = new GMarker(latlng);
					bounds.extend(latlng);
					map.addOverlay(marker);
					map.addControl(new GOverviewMapControl());
					map.addControl(new GMapTypeControl());
					map.addControl(new GLargeMapControl());				
					map.setZoom(map.getBoundsZoomLevel(bounds)-1);
					map.setCenter(bounds.getCenter());
				}
			});
		}
	}
}







data_selected_field = "";

function load_template(selected_field){
	data_selected_field = selected_field

	ajax_string = "modul=immo&site=immo_options";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	std.ajax_com(ajax_string,"load_template_2");

		
}


function load_template_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = "";
	fw_hide('div_text_selector',0);
	fw_moveto('div_text_selector',200,300);
	fill_select_with_innerhtml(document.getElementById('text_selector_select'),ajax_result)
}







function load_template_content(selected_template){
	ajax_string = "modul=immo&site=immo_options_content";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	ajax_string+= "&selected_immo_template="+selected_template;
	std.ajax_com(ajax_string,"load_template_content_2");

}


function load_template_content_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = ajax_result;
}



function insert_content(){
	current_content = document.getElementById('text_selector_preview').innerHTML;
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	document.getElementById('modul_immo_data__field_'+data_selected_field).innerHTML = current_content;
	check_content_lenght("modul_immo_data__field_"+data_selected_field,'2000');
	fw_hide('div_text_selector',1);
}




function set_immo_preferences(selected_immo_kind){
	document.getElementById('div_immo_preferences_kind_0').style.display = "none";
	document.getElementById('div_immo_preferences_kind_2').style.display = "none";
	document.getElementById('div_immo_preferences_kind_3').style.display = "none";
	document.getElementById('div_immo_preferences_kind_5').style.display = "none";
	
	document.getElementById('div_immo_preferences_kind_'+selected_immo_kind).style.display = "block";
}









function load_ansprechpartner(){
	fw_hide('div_ansprechpartner_selector',0);
}


function load_ansprechpartner_data(selected_ansprechpartner){
	ajax_string = "modul=immo&site=immo_ansprechpartner_content";
	ajax_string+= "&selected_ansprechpartner="+selected_ansprechpartner;
	std.ajax_com(ajax_string,"load_ansprechpartner_data_2");
	
}

function load_ansprechpartner_data_2(ajax_result){
	document.getElementById('ansprechpartner_selector_preview').innerHTML = ajax_result;
}


function insert_ansprechpartner(){
	if(document.getElementById('data_modul_immo_ref_ansprechpartner__anrede')){
		document.getElementById('modul_immo_data__field_17').value = document.getElementById('data_modul_immo_ref_ansprechpartner__anrede').innerHTML;
		document.getElementById('modul_immo_data__field_18').value = document.getElementById('data_modul_immo_ref_ansprechpartner__vorname').innerHTML;
		document.getElementById('modul_immo_data__field_19').value = document.getElementById('data_modul_immo_ref_ansprechpartner__nachname').innerHTML;

		document.getElementById('modul_immo_data__field_20').value = document.getElementById('data_modul_immo_ref_ansprechpartner__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_21').value = document.getElementById('data_modul_immo_ref_ansprechpartner__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_22').value = document.getElementById('data_modul_immo_ref_ansprechpartner__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_23').value = document.getElementById('data_modul_immo_ref_ansprechpartner__ort').innerHTML;
		document.getElementById('modul_immo_data__field_24').value = document.getElementById('data_modul_immo_ref_ansprechpartner__laenderkennzeichen').innerHTML;
		document.getElementById('modul_immo_data__field_25').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefon').innerHTML;
		document.getElementById('modul_immo_data__field_26').value = document.getElementById('data_modul_immo_ref_ansprechpartner__mobiltelefon').innerHTML;
		document.getElementById('modul_immo_data__field_27').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefax').innerHTML;
		document.getElementById('modul_immo_data__field_28').value = document.getElementById('data_modul_immo_ref_ansprechpartner__email').innerHTML;
		document.getElementById('modul_immo_data__field_29').value = document.getElementById('data_modul_immo_ref_ansprechpartner__homepage').innerHTML;

		fw_hide('div_ansprechpartner_selector',1);
	}else{
		alert('kein Ansprechpartner ausgewählt');
	}

}








function load_objektadresse(){
	fw_hide('div_objektadresse_selector',0);
}


function load_objektadresse_data(selected_objektadresse){
	ajax_string = "modul=immo&site=immo_objektadresse_content";
	ajax_string+= "&selected_objektadresse="+selected_objektadresse;
	std.ajax_com(ajax_string,"load_objektadresse_data_2");
	
}

function load_objektadresse_data_2(ajax_result){
	document.getElementById('objektadresse_selector_preview').innerHTML = ajax_result;
}


function insert_objektadresse(){
	if(document.getElementById('data_modul_immo_ref_objektadresse__strasse')){

		document.getElementById('modul_immo_data__field_51').value = document.getElementById('data_modul_immo_ref_objektadresse__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_52').value = document.getElementById('data_modul_immo_ref_objektadresse__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_53').value = document.getElementById('data_modul_immo_ref_objektadresse__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_54').value = document.getElementById('data_modul_immo_ref_objektadresse__ort').innerHTML;
		document.getElementById('modul_immo_data__field_55').value = document.getElementById('data_modul_immo_ref_objektadresse__laenderkennzeichen').innerHTML;
		
		fw_hide('div_objektadresse_selector',1);
	}else{
		alert('kein objektadresse ausgewählt');
	}

}



var gadress_block = "";
function load_google_map(google_adress,current_map){
	// gadress_block = google_adress;
	setTimeout("load_google_map2('"+google_adress+"','"+current_map+"')",1000);
}





function load_google_map2(google_adress,current_map){
	// document.getElementById('google_status').innerHTML = document.getElementById('google_status').innerHTML+"Status "+current_map+"<hr>";
	// google_adress = gadress_block;
	if (GBrowserIsCompatible()) {
		// alert(current_map);
		var map = new GMap2(document.getElementById("map_canvas_"+current_map));
		var geocoder = new GClientGeocoder();
		google_adress_array =  google_adress.split('|');

		var bounds = new GLatLngBounds;

		for(i=0;i<google_adress_array.length;i++){
			geocoder.getLatLng(google_adress_array[i],function(latlng) {
				if (!latlng) {
					//alert(address + ' not found');
					//document.getElementById('map_canvas').innerHTML = '<br>&nbsp;&nbsp;&nbsp;Leider wurde keine Lagenkarte gefunden.';
				} else {
					/*
					//Anzeige des Infofeldes 
					 var marker = new GMarker(latlng);
					 var html = '<div style="width:210px; padding-right:10px;">'+
					    '<a href="signup.html">Sign up</a> for a Google Maps API key'+
					    ', or <a href="documentation/index.html">read more about the'+
					    ' API</a>.</div>';
					var marker = new GMarker(latlng);
					map.addOverlay(marker);
					*/
					map.setCenter(latlng,12);
					var marker = new GMarker(latlng);
					bounds.extend(latlng);
					map.addOverlay(marker);
					map.addControl(new GOverviewMapControl());
					map.addControl(new GMapTypeControl());
					map.addControl(new GLargeMapControl());				
					map.setZoom(map.getBoundsZoomLevel(bounds)-1);
					map.setCenter(bounds.getCenter());
				}
			});
		}
	}
}











data_selected_field = "";

function load_template(selected_field){
	data_selected_field = selected_field

	ajax_string = "modul=immo&site=immo_options";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	std.ajax_com(ajax_string,"load_template_2");

		
}


function load_template_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = "";
	fw_hide('div_text_selector',0);
	fw_moveto('div_text_selector',200,300);
	fill_select_with_innerhtml(document.getElementById('text_selector_select'),ajax_result)
}







function load_template_content(selected_template){
	ajax_string = "modul=immo&site=immo_options_content";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	ajax_string+= "&selected_immo_template="+selected_template;
	std.ajax_com(ajax_string,"load_template_content_2");

}


function load_template_content_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = ajax_result;
}



function insert_content(){
	current_content = document.getElementById('text_selector_preview').innerHTML;
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	document.getElementById('modul_immo_data__field_'+data_selected_field).innerHTML = current_content;
	check_content_lenght("modul_immo_data__field_"+data_selected_field,'2000');
	fw_hide('div_text_selector',1);
}




function set_immo_preferences(selected_immo_kind){
	document.getElementById('div_immo_preferences_kind_0').style.display = "none";
	document.getElementById('div_immo_preferences_kind_2').style.display = "none";
	document.getElementById('div_immo_preferences_kind_3').style.display = "none";
	document.getElementById('div_immo_preferences_kind_5').style.display = "none";
	
	document.getElementById('div_immo_preferences_kind_'+selected_immo_kind).style.display = "block";
}









function load_ansprechpartner(){
	fw_hide('div_ansprechpartner_selector',0);
}


function load_ansprechpartner_data(selected_ansprechpartner){
	ajax_string = "modul=immo&site=immo_ansprechpartner_content";
	ajax_string+= "&selected_ansprechpartner="+selected_ansprechpartner;
	std.ajax_com(ajax_string,"load_ansprechpartner_data_2");
	
}

function load_ansprechpartner_data_2(ajax_result){
	document.getElementById('ansprechpartner_selector_preview').innerHTML = ajax_result;
}


function insert_ansprechpartner(){
	if(document.getElementById('data_modul_immo_ref_ansprechpartner__anrede')){
		document.getElementById('modul_immo_data__field_17').value = document.getElementById('data_modul_immo_ref_ansprechpartner__anrede').innerHTML;
		document.getElementById('modul_immo_data__field_18').value = document.getElementById('data_modul_immo_ref_ansprechpartner__vorname').innerHTML;
		document.getElementById('modul_immo_data__field_19').value = document.getElementById('data_modul_immo_ref_ansprechpartner__nachname').innerHTML;

		document.getElementById('modul_immo_data__field_20').value = document.getElementById('data_modul_immo_ref_ansprechpartner__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_21').value = document.getElementById('data_modul_immo_ref_ansprechpartner__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_22').value = document.getElementById('data_modul_immo_ref_ansprechpartner__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_23').value = document.getElementById('data_modul_immo_ref_ansprechpartner__ort').innerHTML;
		document.getElementById('modul_immo_data__field_24').value = document.getElementById('data_modul_immo_ref_ansprechpartner__laenderkennzeichen').innerHTML;
		document.getElementById('modul_immo_data__field_25').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefon').innerHTML;
		document.getElementById('modul_immo_data__field_26').value = document.getElementById('data_modul_immo_ref_ansprechpartner__mobiltelefon').innerHTML;
		document.getElementById('modul_immo_data__field_27').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefax').innerHTML;
		document.getElementById('modul_immo_data__field_28').value = document.getElementById('data_modul_immo_ref_ansprechpartner__email').innerHTML;
		document.getElementById('modul_immo_data__field_29').value = document.getElementById('data_modul_immo_ref_ansprechpartner__homepage').innerHTML;

		fw_hide('div_ansprechpartner_selector',1);
	}else{
		alert('kein Ansprechpartner ausgewählt');
	}

}








function load_objektadresse(){
	fw_hide('div_objektadresse_selector',0);
}


function load_objektadresse_data(selected_objektadresse){
	ajax_string = "modul=immo&site=immo_objektadresse_content";
	ajax_string+= "&selected_objektadresse="+selected_objektadresse;
	std.ajax_com(ajax_string,"load_objektadresse_data_2");
	
}

function load_objektadresse_data_2(ajax_result){
	document.getElementById('objektadresse_selector_preview').innerHTML = ajax_result;
}


function insert_objektadresse(){
	if(document.getElementById('data_modul_immo_ref_objektadresse__strasse')){

		document.getElementById('modul_immo_data__field_51').value = document.getElementById('data_modul_immo_ref_objektadresse__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_52').value = document.getElementById('data_modul_immo_ref_objektadresse__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_53').value = document.getElementById('data_modul_immo_ref_objektadresse__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_54').value = document.getElementById('data_modul_immo_ref_objektadresse__ort').innerHTML;
		document.getElementById('modul_immo_data__field_55').value = document.getElementById('data_modul_immo_ref_objektadresse__laenderkennzeichen').innerHTML;
		
		fw_hide('div_objektadresse_selector',1);
	}else{
		alert('kein objektadresse ausgewählt');
	}

}



var gadress_block = "";
function load_google_map(google_adress,current_map){
	// gadress_block = google_adress;
	setTimeout("load_google_map2('"+google_adress+"','"+current_map+"')",1000);
}





function load_google_map2(google_adress,current_map){
	// document.getElementById('google_status').innerHTML = document.getElementById('google_status').innerHTML+"Status "+current_map+"<hr>";
	// google_adress = gadress_block;
	if (GBrowserIsCompatible()) {
		// alert(current_map);
		var map = new GMap2(document.getElementById("map_canvas_"+current_map));
		var geocoder = new GClientGeocoder();
		google_adress_array =  google_adress.split('|');

		var bounds = new GLatLngBounds;

		for(i=0;i<google_adress_array.length;i++){
			geocoder.getLatLng(google_adress_array[i],function(latlng) {
				if (!latlng) {
					//alert(address + ' not found');
					//document.getElementById('map_canvas').innerHTML = '<br>&nbsp;&nbsp;&nbsp;Leider wurde keine Lagenkarte gefunden.';
				} else {
					/*
					//Anzeige des Infofeldes 
					 var marker = new GMarker(latlng);
					 var html = '<div style="width:210px; padding-right:10px;">'+
					    '<a href="signup.html">Sign up</a> for a Google Maps API key'+
					    ', or <a href="documentation/index.html">read more about the'+
					    ' API</a>.</div>';
					var marker = new GMarker(latlng);
					map.addOverlay(marker);
					*/
					map.setCenter(latlng,12);
					var marker = new GMarker(latlng);
					bounds.extend(latlng);
					map.addOverlay(marker);
					map.addControl(new GOverviewMapControl());
					map.addControl(new GMapTypeControl());
					map.addControl(new GLargeMapControl());				
					map.setZoom(map.getBoundsZoomLevel(bounds)-1);
					map.setCenter(bounds.getCenter());
				}
			});
		}
	}
}





data_selected_field = "";

function load_template(selected_field){
	data_selected_field = selected_field

	ajax_string = "modul=immo&site=immo_options";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	std.ajax_com(ajax_string,"load_template_2");

		
}


function load_template_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = "";
	fw_hide('div_text_selector',0);
	fw_moveto('div_text_selector',200,300);
	fill_select_with_innerhtml(document.getElementById('text_selector_select'),ajax_result)
}







function load_template_content(selected_template){
	ajax_string = "modul=immo&site=immo_options_content";
	ajax_string+= "&selected_immo_field="+data_selected_field;
	ajax_string+= "&selected_immo_template="+selected_template;
	std.ajax_com(ajax_string,"load_template_content_2");

}


function load_template_content_2(ajax_result){
	document.getElementById('text_selector_preview').innerHTML = ajax_result;
}



function insert_content(){
	current_content = document.getElementById('text_selector_preview').innerHTML;
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	current_content = current_content.replace(/\<br>/,"\n");
	document.getElementById('modul_immo_data__field_'+data_selected_field).innerHTML = current_content;
	check_content_lenght("modul_immo_data__field_"+data_selected_field,'2000');
	fw_hide('div_text_selector',1);
}




function set_immo_preferences(selected_immo_kind){
	document.getElementById('div_immo_preferences_kind_0').style.display = "none";
	document.getElementById('div_immo_preferences_kind_2').style.display = "none";
	document.getElementById('div_immo_preferences_kind_3').style.display = "none";
	document.getElementById('div_immo_preferences_kind_5').style.display = "none";
	
	document.getElementById('div_immo_preferences_kind_'+selected_immo_kind).style.display = "block";
}









function load_ansprechpartner(){
	fw_hide('div_ansprechpartner_selector',0);
}


function load_ansprechpartner_data(selected_ansprechpartner){
	ajax_string = "modul=immo&site=immo_ansprechpartner_content";
	ajax_string+= "&selected_ansprechpartner="+selected_ansprechpartner;
	std.ajax_com(ajax_string,"load_ansprechpartner_data_2");
	
}

function load_ansprechpartner_data_2(ajax_result){
	document.getElementById('ansprechpartner_selector_preview').innerHTML = ajax_result;
}


function insert_ansprechpartner(){
	if(document.getElementById('data_modul_immo_ref_ansprechpartner__anrede')){
		document.getElementById('modul_immo_data__field_17').value = document.getElementById('data_modul_immo_ref_ansprechpartner__anrede').innerHTML;
		document.getElementById('modul_immo_data__field_18').value = document.getElementById('data_modul_immo_ref_ansprechpartner__vorname').innerHTML;
		document.getElementById('modul_immo_data__field_19').value = document.getElementById('data_modul_immo_ref_ansprechpartner__nachname').innerHTML;

		document.getElementById('modul_immo_data__field_20').value = document.getElementById('data_modul_immo_ref_ansprechpartner__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_21').value = document.getElementById('data_modul_immo_ref_ansprechpartner__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_22').value = document.getElementById('data_modul_immo_ref_ansprechpartner__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_23').value = document.getElementById('data_modul_immo_ref_ansprechpartner__ort').innerHTML;
		document.getElementById('modul_immo_data__field_24').value = document.getElementById('data_modul_immo_ref_ansprechpartner__laenderkennzeichen').innerHTML;
		document.getElementById('modul_immo_data__field_25').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefon').innerHTML;
		document.getElementById('modul_immo_data__field_26').value = document.getElementById('data_modul_immo_ref_ansprechpartner__mobiltelefon').innerHTML;
		document.getElementById('modul_immo_data__field_27').value = document.getElementById('data_modul_immo_ref_ansprechpartner__telefax').innerHTML;
		document.getElementById('modul_immo_data__field_28').value = document.getElementById('data_modul_immo_ref_ansprechpartner__email').innerHTML;
		document.getElementById('modul_immo_data__field_29').value = document.getElementById('data_modul_immo_ref_ansprechpartner__homepage').innerHTML;

		fw_hide('div_ansprechpartner_selector',1);
	}else{
		alert('kein Ansprechpartner ausgewählt');
	}

}








function load_objektadresse(){
	fw_hide('div_objektadresse_selector',0);
}


function load_objektadresse_data(selected_objektadresse){
	ajax_string = "modul=immo&site=immo_objektadresse_content";
	ajax_string+= "&selected_objektadresse="+selected_objektadresse;
	std.ajax_com(ajax_string,"load_objektadresse_data_2");
	
}

function load_objektadresse_data_2(ajax_result){
	document.getElementById('objektadresse_selector_preview').innerHTML = ajax_result;
}


function insert_objektadresse(){
	if(document.getElementById('data_modul_immo_ref_objektadresse__strasse')){

		document.getElementById('modul_immo_data__field_51').value = document.getElementById('data_modul_immo_ref_objektadresse__strasse').innerHTML;
		document.getElementById('modul_immo_data__field_52').value = document.getElementById('data_modul_immo_ref_objektadresse__hausnummer').innerHTML;
		document.getElementById('modul_immo_data__field_53').value = document.getElementById('data_modul_immo_ref_objektadresse__postleitzahl').innerHTML;
		document.getElementById('modul_immo_data__field_54').value = document.getElementById('data_modul_immo_ref_objektadresse__ort').innerHTML;
		document.getElementById('modul_immo_data__field_55').value = document.getElementById('data_modul_immo_ref_objektadresse__laenderkennzeichen').innerHTML;
		
		fw_hide('div_objektadresse_selector',1);
	}else{
		alert('kein objektadresse ausgewählt');
	}

}



var gadress_block = "";
function load_google_map(google_adress,current_map){
	// gadress_block = google_adress;
	setTimeout("load_google_map2('"+google_adress+"','"+current_map+"')",1000);
}





function load_google_map2(google_adress,current_map){
	// document.getElementById('google_status').innerHTML = document.getElementById('google_status').innerHTML+"Status "+current_map+"<hr>";
	// google_adress = gadress_block;
	if (GBrowserIsCompatible()) {
		// alert(current_map);
		var map = new GMap2(document.getElementById("map_canvas_"+current_map));
		var geocoder = new GClientGeocoder();
		google_adress_array =  google_adress.split('|');

		var bounds = new GLatLngBounds;

		for(i=0;i<google_adress_array.length;i++){
			geocoder.getLatLng(google_adress_array[i],function(latlng) {
				if (!latlng) {
					//alert(address + ' not found');
					//document.getElementById('map_canvas').innerHTML = '<br>&nbsp;&nbsp;&nbsp;Leider wurde keine Lagenkarte gefunden.';
				} else {
					/*
					//Anzeige des Infofeldes 
					 var marker = new GMarker(latlng);
					 var html = '<div style="width:210px; padding-right:10px;">'+
					    '<a href="signup.html">Sign up</a> for a Google Maps API key'+
					    ', or <a href="documentation/index.html">read more about the'+
					    ' API</a>.</div>';
					var marker = new GMarker(latlng);
					map.addOverlay(marker);
					*/
					map.setCenter(latlng,12);
					var marker = new GMarker(latlng);
					bounds.extend(latlng);
					map.addOverlay(marker);
					map.addControl(new GOverviewMapControl());
					map.addControl(new GMapTypeControl());
					map.addControl(new GLargeMapControl());				
					map.setZoom(map.getBoundsZoomLevel(bounds)-1);
					map.setCenter(bounds.getCenter());
				}
			});
		}
	}
}



