/*
***** Created at 23.02.10, 09:42:42 by CYBERhouse Import/Update-Script*****
***** Revision: 155
*/

<!-- //


/**
 *	seso media group <www.seso.at>
 *
 *	$URL: http://seso1.unfuddle.com/svn/seso1_webbob/js/util.js $
 *	$Date: 2010-02-15 16:44:11 +0100 (Mo, 15 Feb 2010) $
 *	$Revision: 154 $
 *	$Author: simon $
 */



/** bob.at functionalities **/




/*******************************************************************************
	LOGGER
*******************************************************************************/

var BOOLEAN = 'boolean',
NUMBER = 'number',
STRING = 'string',
OBJECT = 'object';

var debug = false;


function log (msg, clear) {
	
	if (debug === true) {
	
		var logger = document.getElementById('logger');
		
		if (!logger) {
			
			logger = document.createElement('DIV');
			logger.id = 'logger';
			logger.className = 'logger';
			
			document.getElementsByTagName('BODY')[0].appendChild(logger);
			
			logger = document.getElementById('logger');
		}
		
		if (clear === true) logger.innerHTML = '';
		
		if (typeof msg == 'object') {
			
			for (m in msg) {
				
				logger.innerHTML += m + ' => ' + msg[m]+'<br>';
			}
		}
		
		else logger.innerHTML += msg+'<br>';
	}
}

function printError(e) {
 	
 	var r = "";

 	r += "<strong>"+e.name+"</strong>";
 	r += "<p>"+e.fileName + " ["+e.lineNumber+"]</p>";
 	r += "<p><b>"+e.message+"</b></p>";
 	r += "<pre>"+e.stack+"</pre><hr>";
 	
 	return r;
}



/*******************************************************************************
	UTIL
*******************************************************************************/

var utilFired = false;

function util() {
	
	/* CONFIG-PARAMETERS */
	
	this.config = {};
	this.config.speed = 30;
	this.config.frames = 10;
	this.config.doAnimation = true;
	
	/* IMAGE-PATHS */
	
	this.images = {};
	this.images.blank = "//www.bob.at/final/de/Images/Layout/imgs_layout_blank.gif";/**$$ABSOLUT_PATH$$**/ 
	this.images.printBtn = "//www.bob.at/final/de/Images/Layout/imgs_layout_btn_drucken.png";/**$$ABSOLUT_PATH$$**/ 
	this.images.global = "../";/**$$ABSOLUT_PATH$$**/ 
	this.images.loading = "//www.bob.at/final/de/Images/Layout/imgs_layout_loading_big.gif";/**$$ABSOLUT_PATH$$**/ 
	
	
	var self = this;

	this.init = function() {

		if (utilFired === false) {
			
			utilFired = true;
		
			try {
				
				util.fixPNGs(document.getElementsByTagName('DIV')[0], true);
			
				for (u in this) {
				
					if (u != 'init' && self[u]['init'])
						eval('util.'+u+'.init();');
				}
			}
			
			catch(e) {
	
				log(printError(e));
			}
		}
	};
	

	/*******************************************************************************
		PNG-FIX
	*******************************************************************************/

	this.fixPNGs = function(div, check, ie7) {
		
		if (env.browser == 'ie6' || (ie7 == true && env.browser == 'ie7') ) {
			
			var imgs = div.getElementsByTagName('IMG');
			
			for (var i=0; i<imgs.length; i++) {

				if (imgs[i].src.indexOf('.png') != -1 && (!check || imgs[i].className.indexOf("leapPNG") == -1)) {

					imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgs[i].src+"', sizingMethod='scale')";
					imgs[i].src = util.images.blank;
				}
			}
			
			/*
			var inp = div.getElementsByTagName('INPUT');
			
			for (var i=0; i<inp.length; i++) {

				if (inp[i].type == 'image' && inp[i].src.indexOf('.png') != -1 && (!check || inp[i].className.indexOf("leapPNG") == -1)) {

					inp[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+inp[i].src+"', sizingMethod='crop')";
					inp[i].src = util.images.blank;
				}
			}
			*/
		}
	};
	

	
};

/*******************************************************************************
	AJAX-BRIDGE
*******************************************************************************/

util.prototype.ajax = function() {
	
	var self = this;
	
	var request = null;
	var response = null;
	
	var followAction = null;
	var followTimeout = 0;
	
	var queue = [];
	
	var busy = false;
	var actReq = null;
	
	var method = 'get';



	this.setMethod = function(m) {
		
		method = m;
	}

	
  
	function createRequest() {
	
	  	if (window.XMLHttpRequest) {
	  		
	  		request = new XMLHttpRequest(); // Mozilla, Safari, Opera, IE7
	  	}
	  	
	  	else if (window.ActiveXObject) {
	  		
	  		try {
	  			
	  			request = new ActiveXObject('Msxml2.XMLHTTP'); // IE5
	  		}
	  		
	  		catch (e) {
	  			
	  			try {
	  				
	  				request = new ActiveXObject('Microsoft.XMLHTTP'); // IE6
	  			}
	  			
	  			catch (e) {

	  				return false;
	  			}
	  		}
	  	}

	  	if (request == null) {

	  		return false;
	  	}
	}



	function send(target, parameters) {
		
		setLoading(true);
 		
  		if (request === null) {
  		
  			createRequest();
  		}

	  	request.open(method, target, true);
	  	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	  	request.send(parameters);
	  	request.onreadystatechange = interpretRequest;
	}
	
	
	
	function interpretRequest() {

		/*
		 * 0 = uninitialized
    	 * 1 = loading
    	 * 2 = loaded
    	 * 3 = interactiv
    	 * 4 = complete
		 */
		 
		if (request.readyState == 4) {
				
			if (request.status == 200) {
			
				var type = request.getResponseHeader('Content-Type');
				
				var pos = type.lastIndexOf(';');
				
				responseType = (pos == -1) ? type : type.substr(0,pos);

				switch (responseType) {
					
					case 'text/xml':
					case 'application/xml':
						response = parseXML(request.responseXML);
						break;
					
					case 'text/html':
						response = request.responseText;
						break;
					
					default: 
						alert('unknown responseHeader: ' + type);
						stop();
						break;
				}
				
				actReq = setTimeout(followAction, followTimeout);
			}
			
			else {

				log('could not finish request: status ' + request.status + '\n' + request.responseText);
			}
		}
	}



  	this.sendRequest = function(target, parameters, action, timeout) {

  	 	if (!timeout) timeout = 0;

		if (busy == false) {
			
			busy = true;
			
			followAction = action;
			followTimeout = timeout;
			send(target, parameters);
		}
		
		else {
		
			var i = queue.length;
			
			queue[i] = {};
			queue[i].target = target;
			queue[i].parameters = parameters;
			queue[i].action = action;
			queue[i].timeout = timeout;
		}
  	}
  	 

  	
	this.getResponse = function() {
	  	
		clearTimeout(actReq);
		
		var r = response;
		
		var check = false;
		
		for (i=0; i<queue.length; i++) {
		
			if (queue[i] != null) {
				
				followAction = queue[i].action;
				followTimeout = queue[i].timeout;
				send(queue[i].target, queue[i].parameters);
				queue[i] = null;
				check = true;
				break;
			}
		}
		
		if (check == false) queue = new Array();
		
		busy = check;
		
		setLoading(false);
	  	
		return r;
	}
	
	
	
	function parseXML(xml) {

		var list = [];
		
		if (xml.firstChild.nodeType == 7) {

			xml = xml.firstChild.nextSibling.childNodes;
		}

		else xml = xml.firstChild.childNodes;

		for (var i=0; i<xml.length; i++) {
			
			if (xml[i].firstChild) {
			
				list.push(parseXMLObj(xml[i]));
			}
		}
		
		return list;
	}
	
	
	
	function parseXMLObj(xml) {

		var node = xml.firstChild;
		
		var obj = {};

		while (node) {

			if (node.firstChild) {
				
				if (node.firstChild.nodeValue) {

					obj[node.nodeName] = node.firstChild.nodeValue;
				}
				
				else if (node.firstChild.hasChildNodes()) {
					
					obj[node.nodeName] = parseXMLObj(node);
				}
			}
				
			else {
				
				obj[node.nodeName] = ' ';
			}
		
			node = node.nextSibling;
		}
		
		return obj;
	}
	
	
	function setLoading(flag) {
	
		// document.getElementById('loadingImg').style.display = (flag==true) ? 'block' : 'none';
	}
	


}

/*******************************************************************************
	Input field behaviour - login/gutschein/suche
*******************************************************************************/

function login (remove, decision) {

	var standard = "Benutzername";
	
	decision?remove.value==standard?remove.value='':remove.value:remove.value;!decision?remove.value==''?remove.value=standard:remove.value:remove.value;
}

function gutschein (remove, decision) {

	var standard = "Gutscheineingabe";
	
	decision?remove.value==standard?remove.value='':remove.value:remove.value;!decision?remove.value==''?remove.value=standard:remove.value:remove.value;
}

function suche (remove, decision) {

	var standard = "Suche";
	
	decision?remove.value==standard?remove.value='':remove.value:remove.value;!decision?remove.value==''?remove.value=standard:remove.value:remove.value;
}


/*******************************************************************************
	WARENKORB
*******************************************************************************/

var contor=0;
var delta=4;
var direction=1;
var maxHeight=0;

util.prototype.warenkorb = {

	init: function(){
	
		if (document.getElementById('warenkorb')) {
			
			document.getElementById('warenkorb_content').style.display = 'block';
			maxHeight = document.getElementById('warenkorb_content').offsetHeight;
			document.getElementById('warenkorb_content').style.display = 'none';
			
			
			if (env.isIE) {
			
				document.getElementById('warenkorb').attachEvent("onmouseover",  function(){eval("direction=1; util.warenkorb.expand();");} );
				document.getElementById('warenkorb').attachEvent("onmouseout",  function(){eval("direction=-1; util.warenkorb.collapse();");} );
			}
			
			else {
			
				document.getElementById('warenkorb').addEventListener("mouseover", function(){eval("direction=1; util.warenkorb.expand();");}, false);
				document.getElementById('warenkorb').addEventListener("mouseout",  function(){eval("direction=-1; util.warenkorb.collapse();");} , false);
			}
		}
	},

	expand: function(){
	
		document.getElementById('warenkorb_content').style.display = 'block';
		
		if(contor>maxHeight+5 || direction<0)
			return;
		
		contor+=delta;
		
		if (contor <= maxHeight+5) {
			document.getElementById('warenkorb_content').style.height = contor + 'px';
		}

		setTimeout(util.warenkorb.expand,10);	
	},
	
	collapse: function(){
		
		if(contor<0 || direction>0)
			return;
		
		contor-=delta;
		if (contor >= 0) {
			document.getElementById('warenkorb_content').style.height = contor + 'px';
		}
		else {
			document.getElementById('warenkorb_content').style.display = 'none';
		}
		
		setTimeout(util.warenkorb.collapse,20);	
	}

}


/*******************************************************************************
	Tarif w?en
*******************************************************************************/

var dummy;

util.prototype.selectTarif = {

	property: [],
	
	setProperty : function(key, value) {
		
		this.property[key] = value;
	},
	
	
	init : function() {
		
		if (this.property.choiceList) {

			if (choice.length > 0) {
				
				for (var i=0; i<choice.length; i++) {
	
					if (env.isIE) {
						
						document.getElementById(choice[i]).attachEvent("onclick", util.selectTarif.border);
						document.getElementById(choice[i]+'_expand').attachEvent("onclick", util.selectTarif.expand);
						document.getElementById(choice[i]+'_collapse').attachEvent("onclick", util.selectTarif.collapse);
					}
					
					else {
						
						document.getElementById(choice[i]).addEventListener("click", util.selectTarif.border, false);
						document.getElementById(choice[i]+'_expand').addEventListener("click", util.selectTarif.expand, false);
						document.getElementById(choice[i]+'_collapse').addEventListener("click", util.selectTarif.collapse, false);
					}
					
				}
				
			}
		}
		
		
	},
	
	
	expand : function(e){
	
		e = e.srcElement || e.target;
		
		if (e.nodeName == 'A') {
		
			var section = e.parentNode.parentNode.id.lastIndexOf('_');
			
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_content').style.display = 'block';
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_expand').style.display = 'none';
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_collapse').style.display = 'block';
		}
	},

	collapse : function(e) {

		e = e.srcElement || e.target;
		
		if (e.nodeName == 'A') {
			var section = e.parentNode.parentNode.id.lastIndexOf('_');
			
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_content').style.display = 'none';
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_expand').style.display = 'block';
			document.getElementById(e.parentNode.parentNode.id.substr(0, section) + '_collapse').style.display = 'none';
			
		}
	},
	
	border : function(e) {

		e = e.srcElement || e.target;		
		
		for (var b=0; b<choice.length; b++) {
			
			document.getElementById(choice[b]).parentNode.parentNode.className = "nullPoint tarif";
		}	
		
		if (e.parentNode.parentNode.nodeName == 'DIV') {
		
			e.parentNode.parentNode.className = "nullPoint green tarif";
		}
		
		
		//alle spans mit der Klasse 'chk' ausblenden
		
		var spans = document.getElementsByTagName('SPAN');
		
		for (var i = 0; i < spans.length; i++) {
		
			if (spans[i].className == "chk") {
				
				spans[i].style.display = "none";
			}
		
		}
		
		//ausgew?tes span mit der Klasse 'chk' einblenden
		
		var chk_span = e.parentNode.getElementsByTagName('SPAN');
		
		for (var j = 0; j < chk_span.length; j++) {
		
			if (chk_span[j].className == "chk") {
				
				chk_span[j].style.display = "inline";
			}
		
		}

		
	}
}



/*******************************************************************************
	TOOL-TIP
*******************************************************************************/

util.prototype.toolTip = {
	
	
	cache : [],
	property : [],
	activeBox : null,
	
	
	init : function(container) {
	
		util.toolTip.cache = [];
		
		// decorate links

		if (container) {
			
			 var spans = container.getElementsByTagName('SPAN');
		}
		
		else var spans = document.getElementsByTagName('SPAN');
		
		var base = false;
		
		for (var i=0; i<spans.length; i++) {

			if (spans[i].className == 'toolTip') {
				
				if (!base) {
					
					util.toolTip.createBaseContainer();
					base = true;
				}
				
				var item = spans[i];
				
				var id = item.getAttribute('id');
				
				if (item.firstChild.nodeName == 'IMG') {

					item.className = "";
					item.removeAttribute('id');
					item = item.firstChild;
					item.setAttribute('id', id);
				}
				
				// util.toolTip.createBox(id.split('_')[1]);
				util.toolTip.createBox(id.substring(id.indexOf('_')+1));
				 
				if (env.isIE) {
					
					item.attachEvent("onmouseover", util.toolTip.open);
					item.attachEvent("onmouseout", util.toolTip.close);
				}
					
				else {

					item.addEventListener("mouseover", util.toolTip.open, false);
					item.addEventListener("mouseout", util.toolTip.close, false);
				}
			}
		}
	},
	
	
	singleAdd : function(id) {
		
		var item = document.getElementById('toolTip_'+id);

		if (item.firstChild.nodeName == 'IMG') {

			item.className = "";
			item.removeAttribute('id');
			item = item.firstChild;
			item.setAttribute('id', id);
		}

		util.toolTip.createBox(id);
		 
		if (env.isIE) {
			
			item.attachEvent("onmouseover", util.toolTip.open);
			item.attachEvent("onmouseout", util.toolTip.close);
		}
			
		else {

			item.addEventListener("mouseover", util.toolTip.open, false);
			item.addEventListener("mouseout", util.toolTip.close, false);
		}
	},
	
	
	reset : function() {
		
		util.toolTip.cache = [];
		
		var base = document.getElementById('toolTipContainer');
		
		if (base) base.parentNode.removeChild(base);		
	},
	
	
	createBaseContainer : function() {
		
		var div = document.createElement('DIV');
			div.id = 'toolTipContainer';
		
		var divs = document.getElementsByTagName('DIV');
		
		for (var i=0; i<divs.length; i++) {
			
			if (divs[i].className == 'bob') {
				
				divs[i].appendChild(div);
				util.toolTip.property.container = div;
				break;
			}
		}
	},
	
	
	open : function(e) {

		e = e.srcElement || e.target;
		
		// id = e.getAttribute('id').split('_')[1];
		id = e.getAttribute('id').substring(e.getAttribute('id').indexOf('_')+1);

		var box = document.getElementById('toolTipContent_' + id);
		
		box.style.display = 'block';
		
		util.toolTip.activeBox = box;
		
		document.onmousemove = util.toolTip.move;
	},

	
	close : function(e) {
		
		util.toolTip.activeBox.style.display = 'none';
		
		util.toolTip.activeBox = null;
		
		document.onmousemove = null;
	},
	
	
	createBox : function(cid) {

		var dataDiv = document.getElementById('toolTipContent_' + cid);

		var div = document.createElement('DIV');
			div.className = 'toolTip';
		
		if (dataDiv) {
			
			div.innerHTML = dataDiv.innerHTML;
			dataDiv.parentNode.removeChild(dataDiv);
			
			var cl = dataDiv.className.split(' ');
			
			for (var i=1; i<cl.length; i++) {
				
				div.className += ' '+cl[i]; 
			}
		}
		
		else log("TOOL-TIP: couldn't load data - no source detected: " + cid);
		
		div.id = 'toolTipContent_'+cid;
		
		div.style.display = 'none';
		util.toolTip.property.container.appendChild(div);

		util.toolTip.cache[cid] = div;
	}, 
	
	

	move : function(e) {

		if (util.toolTip.activeBox !== null) {
		
			if (env.isIE) {
				
				var x = window.event.clientX;
				var y = window.event.clientY;
				
				y += document.documentElement.scrollTop;			
			}
			
			else {
				
				var x = e.pageX;
				var y = e.pageY;
			}
			
			var h = util.toolTip.activeBox.offsetHeight;
			var bw = document.getElementsByTagName('BODY')[0].offsetWidth;
			
			x += 7;
			y -= (h+5);
			
			var lim = (x+7+200+15);

			if (lim > bw) x -= lim-bw;

			util.toolTip.activeBox.style.top = y + 'px';
			util.toolTip.activeBox.style.left = x + 'px';
		}
	}

}



/*******************************************************************************
	EXPANDER
*******************************************************************************/

util.prototype.expander = {

	cache : [],
	

	init : function(divId) {
	
		if (divId) {
			
			var div = document.getElementById(divId) 
			
			if (div) {
				
				var divs = div.getElementsByTagName('DIV', 'H3');
				
				util.expander.renderPoints(divs, divId);
			}			
		}
		
		else if (this.cache.length > 0) {

			for (var i=0; i<this.cache.length; i++) {
	
				var divs = document.getElementById(this.cache[i]).getElementsByTagName('DIV', 'H3');
				
				util.expander.renderPoints(divs, this.cache[i]);
			}
		}
	},
	

	renderPoints : function(divs, mainId) {
		
		var open = false;
		
		var c = 0;
		
		for (var j=0; j<divs.length; j++) {

			if (divs[j].className.indexOf('pointHead') != -1) {
				
				++c;
				
				var open = (divs[j].className.indexOf('open') != -1);
				var white = (divs[j].innerHTML.toLowerCase().indexOf('<h3>') != -1);

				divs[j].className = (white) ? 'pointHead_w' : 'pointHead';

				if (open) {

					divs[j].className += (white) ? ' act_w' : ' act';
					
					divs[j].innerHTML = "<a href=\"javascript:util.expander.close('"+mainId+c+"');\" id='pointHead_"+mainId+c+"' onclick='this.blur();'>"+divs[j].innerHTML+"</a>";
				}
				
				else {

					divs[j].innerHTML = "<a href=\"javascript:util.expander.open('"+mainId+c+"');\" id='pointHead_"+mainId+c+"' onclick='this.blur();'>"+divs[j].innerHTML+"</a>";
				}

			}
			
			else if (divs[j].className == 'pointContent') {
				
				divs[j].setAttribute('id', 'pointContent_'+mainId+c);
				
				if (open) {
					
					divs[j].style.display = 'block';
					open = false;
				}
				
				else divs[j].style.display = 'none';
			}
		}
	},
	
	
	add : function(container) {
		
		this.cache.push(container);
	},
	
	
	reset : function() {
		
		this.cache = [];
	},
	
	
	open : function(id) {

		document.getElementById('pointContent_'+id).style.display = 'block';
		
		var link = document.getElementById('pointHead_'+id);
			
		if (link.innerHTML.toLowerCase().indexOf('<h3>') != -1){
			
			link.parentNode.className += " act_w";
		}
		
		else link.parentNode.className += " act";
		
		link.setAttribute('href', "javascript:util.expander.close('"+id+"');");
	}, 
	
	
	close : function(id) {

		document.getElementById('pointContent_'+id).style.display = 'none';
		
		var link = document.getElementById('pointHead_'+id);

		if (link.innerHTML.toLowerCase().indexOf('<h3>') != -1){
			
			link.parentNode.className = " pointHead_w";
		}
		
		else link.parentNode.className = "pointHead";
		
		link.setAttribute('href', "javascript:util.expander.open('"+id+"');");
	}
}




/*******************************************************************************
	MULTI-SELECT
*******************************************************************************/

util.prototype.multiSelect = {
	
	
	cache : [],
	property : [],
	actIndex : null,
	actLevel : 1,

	
	setProperty : function(key, value) {
		
		this.property[key] = value;		
	},
	
	
	init : function() {
		
		if (this.property.dataSource) {
		
			this.load(1);
			
			if (!this.property.selection) {
				
				this.select(1,1);
			}
						
			util.multiSelect.property.onLoadContent = true;
			
			document.onkeyup = util.multiSelect.catchKeyEvent;
		}
	},
	
	
	select : function(e, level) {

		if (typeof e == 'number') {
			
			var index = e;
			var item = document.getElementById(util.multiSelect.property.prefix+level+'_'+index);
		}
		
		else {

			var item = (e.srcElement) ? e.srcElement : e.target;
			
			var level = item.getAttribute('id').split('_')[1];
			var index = item.getAttribute('id').split('_')[2];
		}
		
		if (item) {
		
			util.multiSelect.actIndex = index;
			util.multiSelect.actLevel = level;
			
			if (util.multiSelect.cache[level]) {
				
				try {
				
					document.getElementById(util.multiSelect.property.prefix+level+'_'+util.multiSelect.cache[level].index).className = '';
				}
				catch (e) {}
			}
			
			item.className = 'act';
	
			util.multiSelect.cache[level] = {};
			util.multiSelect.cache[level].index = index;
			
			util.multiSelect.load(++level, index);
		}
	},
	
	
	load : function(level) {
		
		var data = util.multiSelect.getCacheData(level);
		
		var container = document.getElementById(util.multiSelect.property['contentContainer'])

		if (data.questions && util.multiSelect.property.onLoadContent !== false) {

			container.appendChild(util.multiSelect.drawContent(level));
								
			document.getElementById(util.multiSelect.property['headline']).innerHTML = data.label;
			
			var s = document.getElementById(util.multiSelect.property['select'+level]);
			
			if (s) while (s.hasChildNodes()) s.removeChild(s.firstChild);
		}
		
		else {
			
			util.multiSelect.loadSub(level);
		}

	},
	
	
	loadSub : function(level) {
		
		var data = util.multiSelect.getCacheData(level);
		
		var s = document.getElementById(util.multiSelect.property['select'+level]);
		
		// select
		
		if (s) {
		
			// reset
				
			while (s.hasChildNodes()) s.removeChild(s.firstChild);
			
			s.onchange = null;
			
			// load data
			
			if (data.sub) {
				
				if (this.property.selection) {
					
					var inx = this.property.selection.split(',')[level-1];
					
					if (inx) {
						
						util.multiSelect.cache[level] = {};
						util.multiSelect.cache[level].index = inx;
						
						util.multiSelect.load(level+1);
					}
				}
				
				var ul = document.createElement('UL');
			
				for (var i=1; i<data.sub.length; i++) {
						
					var li = document.createElement('LI');
						li.setAttribute('id', util.multiSelect.property.prefix+level+'_'+i);
						li.innerHTML = unescape(data.sub[i].label);
						
						if (inx == i) {
							
							li.className = 'act';
						}
						
						if (env.isIE) {
					
							li.attachEvent("onclick", util.multiSelect.select);
						}
						
						else {
							
							li.addEventListener("click", util.multiSelect.select, false);
						}
		
					ul.appendChild(li);
				}

				s.appendChild(ul);
				
				s.onchange = util.multiSelect.select;
			}
		}
		
		// expander
		
		else if (data.sub) {
			
			document.getElementById(util.multiSelect.property['headline']).innerHTML = data.label;

			var id = util.multiSelect.property.prefix+"expanderContainer";
			
			document.getElementById(util.multiSelect.property['contentContainer']).innerHTML = "";
			
			var container = document.createElement('DIV');
				container.setAttribute("id", id);
				container.className = "expander";
				
			var expOpen = null;
			
			if (util.multiSelect.property.selection) {
				
				expOpen = util.multiSelect.property.selection.split(',');
				expOpen = (expOpen[2]) ? expOpen[2] : null;
			}
				
			for (var i=1; i<data.sub.length; i++) {

				var h = document.createElement('DIV');
					h.className = "pointHead";
					h.innerHTML = data.sub[i].label;
					
					if (expOpen == i) h.className += " open";
					
				container.appendChild(h);
				
				var c = document.createElement('DIV');
					c.className = "pointContent";

					util.multiSelect.cache[level] = {};
					util.multiSelect.cache[level].index = i;
	
					c.appendChild(util.multiSelect.drawContent(level+1));
					
				container.appendChild(c);
			}
			
			document.getElementById(util.multiSelect.property['contentContainer']).appendChild(container);

			util.expander.reset();
			util.expander.add(id);
			util.expander.init();
		}

	},
	
	
	drawContent : function(level) {

		var data = util.multiSelect.getCacheData(level);

		document.getElementById(util.multiSelect.property['contentContainer']).innerHTML = "";
		
		var ul  = document.createElement('UL');
		
		if (data.questions) {

			for (var i=1; i<data.questions.length; i++) {
				
				var li  = document.createElement('LI');
				
				var a = document.createElement('A');
					a.href = data.questions[i].href;
					a.innerHTML = data.questions[i].content;
					a.setAttribute('answer', data.questions[i].answer);
					a.setAttribute('faqId', data.questions[i].faqId);
					
				li.appendChild(a);
				
				ul.appendChild(li);
			}
		}
		
		return ul;
	},
	
	
	getCacheData : function(level) {

		var d = bobdata[util.multiSelect.property['dataSource']];

		for (var i=1; i<level; i++) {

			d = d.sub[util.multiSelect.cache[i].index];
		}
		
		return d;	
	},
	
	
	catchKeyEvent : function(e) {
		
		if (!e) e = window.event;
		
		var key = (e.keyCode) ? e.keyCode : e.which;
		
		if (env.isIE) {
			
			e.cancelBubble = true;
			e.returnValue = false;
		}
		else {
			
			e.stopPropagation();
			e.preventDefault();
		}

		var act = parseInt(util.multiSelect.actIndex);
		var lev = parseInt(util.multiSelect.actLevel);
		
		var action = false;

		switch (key) {
			
			case 38:	// up
				act--;
				action = true;
				break;
				
			case 40:	// down
				act++;
				action = true;
				break;
				
			case 37:	// left
				lev--;
				act=1;
				action = true;
				break;
				
			case 39:	// right
				lev++;
				act=1;
				action = true;
				break;
				
			default: break;
		}

		if (action) util.multiSelect.select(act,lev);
	}

	
}



/*******************************************************************************
	DYNAMIC BREADCRUMB
*******************************************************************************/

util.prototype.breadcrumb = {

	cache : [],
	property : [],
	actItem : 0,
	
	
	setProperty : function(key, value) {
		
		this.property[key] = value;		
	},
	
		
	init : function() {
		
		if (util.breadcrumb.property.container) {

			var container = document.getElementById(util.breadcrumb.property.container);
			
			if (container) {
				
				util.breadcrumb.smallWith = '35px';
				util.breadcrumb.largeWith = '251px';
				
				if (env.isIE) {

					container.attachEvent("onmouseout", util.breadcrumb.reset);
				}
				
				else {

					container.addEventListener("mouseout", util.breadcrumb.reset, false);
				}
				
				var divs = container.getElementsByTagName('DIV');
				
				var c = 0;
				var act = false;
				
				for (var i=0; i<divs.length; i++) {
					
					if (divs[i].className == 'active') act = true;
					
					if (divs[i].className == 'crumb') {
						
						util.breadcrumb.cache[++c] = divs[i].innerHTML.split(' ')[1];
						
						if (act == false) {
							
							divs[i].innerHTML = c+'';
						}
						
						else {
							
							divs[i].style.width = util.breadcrumb.largeWith;
							util.breadcrumb.actItem = c;
							act = false; 
						}
						
						divs[i].setAttribute('id', 'crumb_'+c);
						
						if (env.isIE) {
							
							divs[i].attachEvent("onmouseover", util.breadcrumb.showCrumb);
							divs[i].attachEvent("onmouseout", util.breadcrumb.resetCrumb);
						}
						
						else {
				
							divs[i].addEventListener("mouseover", util.breadcrumb.showCrumb, false);
							divs[i].addEventListener("mouseout", util.breadcrumb.resetCrumb, false);
						}
					}
				}
			}			
		}
	},
	
	
	reset : function() {

		var label =  util.breadcrumb.cache[util.breadcrumb.actItem];
		
		var act = document.getElementById('crumb_'+util.breadcrumb.actItem);
			act.innerHTML = util.breadcrumb.actItem+' '+label;
			act.style.width = util.breadcrumb.largeWith;
		
	},
	
	
	showCrumb : function(e) {
		
		if (env.isIE) e.returnValue = false;
			else e.preventDefault();
	
		e = e.srcElement || e.target;
		
		var cid = e.getAttribute('id').split('crumb_')[1];
		
		var label = util.breadcrumb.cache[cid];
		
		e.innerHTML = cid+' '+label;
		e.style.width = util.breadcrumb.largeWith;
		
		if (cid != util.breadcrumb.actItem) {
		
			var act = document.getElementById('crumb_'+util.breadcrumb.actItem);
				act.innerHTML = util.breadcrumb.actItem+'';
				act.style.width = util.breadcrumb.smallWith;
		}
	},
	
	
	resetCrumb : function(e) {
		
		if (env.isIE) e.returnValue = false;
			else e.preventDefault();

		e = e.srcElement || e.target;
		
		var cid = e.getAttribute('id').split('crumb_')[1];
		
		e.innerHTML = cid+'';
		e.style.width = util.breadcrumb.smallWith;
	}
}



/*******************************************************************************
	PAYMENT OPTIONS
*******************************************************************************/

util.prototype.payment = {

	property : [],
	cache : [],

	
	setProperty : function(key, value) {
		
		this.property[key] = value;
	},
	
	
	init : function() {

		if (this.property.payment) {

			var del_node = document.getElementById(this.property.form_id);		
			del_node.removeChild(document.getElementById(this.property.noscript_id));

			
			//clearing div
			var div = document.createElement("DIV");
			div.className = "clear";
			
			//Zahlungsart dropdown erstellen
			var label = document.createElement("LABEL");
			label.htmlFor = "zahlungsart";
			
			var label_text = document.createTextNode("Zahlungsart*");
			
			label.appendChild(label_text);
			
			var select = document.createElement("SELECT");
			select.name = "zahlungsart";
			select.id = "zahlungsart";
	
			//Zahlungsart - Optionen
			var option1 = document.createElement("OPTION");
			option1.value ="paybox";
			var option1_text = document.createTextNode("Paybox");
			option1.appendChild(option1_text);
			
			if (document.getElementById("guthaben") == null) {
			
				var option2 = document.createElement("OPTION");
				option2.value = "nachname";
				var option2_text = document.createTextNode("Nachname");
				option2.appendChild(option2_text);
			
			}
	
			var option3 = document.createElement("OPTION");
			option3.value ="visa";
			var option3_text = document.createTextNode("VISA");
			option3.appendChild(option3_text);
				
			var option4 = document.createElement("OPTION");
			option4.value ="mastercard";
			var option4_text = document.createTextNode("Mastercard");
			option4.appendChild(option4_text);		
			
			select.appendChild(option1);
			
			if (document.getElementById("guthaben") == null) {
				select.appendChild(option2);
			}
			
			select.appendChild(option3);			
			select.appendChild(option4);
			
			document.getElementById(util.payment.property.payment_options).appendChild(label);
			document.getElementById(util.payment.property.payment_options).appendChild(select);
			
			
			/* initial wird die Zahlungsart Paybox angezeigt */
			var label_pb = document.createElement("LABEL");
			label_pb.htmlFor = "handy_nummer";
			
			var label_pb_text = document.createTextNode("Handynummer*");
			
			label_pb.appendChild(label_pb_text);
			
			var input = document.createElement("INPUT");
			input.type = "text";
			input.className = "textfield";
			input.name = "handy_nummer";
			input.id = "handy_nummer";

			
			var desc_text = '<span id="toolTip_nr" class="toolTip"><img src="'+util.images.global+'info.gif" alt="Weitere Informationen" width="16" height="16" /></span><div id="toolTipContent_nr" class="toolTipContent">Bitte geben Sie Ihre Telefonnummer im Format <strong>+436641111111</strong> an.</div>';
			
			document.getElementById(util.payment.property.form_id).appendChild(div);
			
			document.getElementById(util.payment.property.form_id).appendChild(label_pb);
			document.getElementById(util.payment.property.form_id).appendChild(input);
			
			document.getElementById(util.payment.property.form_id).innerHTML += desc_text;
			
			util.toolTip.init();
			
			var change = document.getElementById(this.property.payment);
			
			if (env.isIE) {
			
				change.attachEvent("onchange", util.payment.show);
			}
			
			else {
				
				change.addEventListener("change", util.payment.show, false);
			}
		
		}
	},
	
	show : function(e) {

		e = e.srcElement || e.target;
		
		//dynamischen Bereich leeren
		document.getElementById(util.payment.property.form_id).innerHTML = "";
		
		//clearing div
		var div = document.createElement("DIV");
		div.className = "clear";
		
		
		switch(e.options[e.selectedIndex].value) {
			
			case "paybox":
				
				var label = document.createElement("LABEL");
				label.htmlFor = "handy_nummer";
				
				var label_text = document.createTextNode("Handynummer*");
				
				label.appendChild(label_text);
				
				var input = document.createElement("INPUT");
				input.type = "text";
				input.className = "textfield";
				input.name = "handy_nummer";
				input.id = "handy_nummer";
				
				var desc_text = '<span id="toolTip_nr" class="toolTip"><img src="'+util.images.global+'info.gif" alt="Weitere Informationen" width="16" height="16" /></span><div id="toolTipContent_nr" class="toolTipContent">Bitte geben Sie Ihre Telefonnummer im Format <strong>+436641111111</strong> an.</div>';
				
				document.getElementById(util.payment.property.form_id).appendChild(div);
				
				document.getElementById(util.payment.property.form_id).appendChild(label);
				document.getElementById(util.payment.property.form_id).appendChild(input);
				
				document.getElementById(util.payment.property.form_id).innerHTML += desc_text;
				
				util.toolTip.init();
				
			break;
			
			case "nachname":
			
			// nothing to do
			
			break;
			
			case "visa": case "mastercard":
			
			document.getElementById(util.payment.property.form_id).innerHTML = ''+
				'<div class="clear"></div>'+
				'<img class="secured" src="'+util.images.global+'qenta.jpg" alt="secured" width="63" height="25" />'+
				'<div class="clear"></div>'+
				'<label for="kreditkartennummer">Kreditkartennummer*</label>'+
				'<input id="kreditkartennummer" name="kreditkartennummer" class="textfield" type="text"/>'+
				'<div class="clear"></div>'+
				'<label for="cvv">CVV-Code*</label>'+
				'<input id="cvv" name="cvv" class="textfield" type="text"/>'+
				'<span id="toolTip_cvv" class="toolTip"><img src="'+util.images.global+'info.gif" alt="Weitere Informationen" width="16" height="16" /></span><div id="toolTipContent_cvv" class="toolTipContent">Der CVV-Code befindet sich auf der <strong>R?eite</strong> Ihrer Kreditkarte. Im Unterschriftsstreifen sind die letzten 4 Stellen der Kartennummer und im Anschluss daran der <strong>dreistellige CVC 2-Code kursiv (links fallend)</strong> aufgedruckt.<br/><br/>Weitere Informationen bei Mastercard www.mastercard.at<br/><br/>Weitere Informationen bei VISA www.visa.at</div>'+
				'<div class="clear"></div>'+
					'<label for="ablaufdatum_monat">Ablaufdatum*</label>'+
					'<select class="width_half" name="ablaufdatum_monat" id="ablaufdatum_monat">'+
						'<option value="0">Monat</option>'+
						'<option value="1">J?er</option>'+
						'<option value="2">Februar</option>'+
						'<option value="3">M?</option>'+
						'<option value="4">April</option>'+
						'<option value="5">Mai</option>'+
						'<option value="6">Juni</option>'+
						'<option value="7">Juli</option>'+
						'<option value="8">August</option>'+
						'<option value="9">September</option>'+
						'<option value="10">Oktober</option>'+
						'<option value="11">November</option>'+
						'<option value="12">Dezember</option>'+
					'</select>'+
					'<label class="hide" for="ablaufdatum_jahr">Ablaufdatum (Jahr)</label>'+
					'<select class="width_half" name="ablaufdatum_jahr" id="ablaufdatum_jahr">'+
						'<option value="1">Jahr</option>'+
						'<option value="2">2009</option>'+
						'<option value="3">2010</option>'+
						'<option value="4">2011</option>'+
						'<option value="5">2012</option>'+
						'<option value="6">2013</option>'+
						'<option value="7">2014</option>'+
						'<option value="8">2015</option>'+
					'</select>'

				
				util.toolTip.init();
				
			break;

			default: break;
		}
		
		
	}
	
}


/*******************************************************************************
TAB-BOX
*******************************************************************************/

util.prototype.tabBox = {

	cache : [],
	property : [],
	
	
	setProperty : function(key, value) {
		
		this.property[key] = value;		
	},
	
	
	init : function() {
	
		if (this.cache.length > 0) {
			
			var d, a, bgl, bgr, bgm;
		
			for (var t=0; t<this.cache.length; t++) {
				
				d = document.createElement('DIV');
				d.className = "tabHead";
				d.id = "tabHead_"+t;
				
				bgl = document.createElement('SPAN');
				bgl.className = "bgl";
				
				d.appendChild(bgl);
	
				bgm = document.createElement('SPAN');
				bgm.className = "bgm";
				
				a = document.createElement('a');
				a.setAttribute("href", "javascript:util.tabBox.selectTab("+t+");");
				a.setAttribute("onclick", "this.blur();");
				
				var title = document.getElementById(this.cache[t].title);
				
				a.appendChild(document.createTextNode(title.firstChild.nodeValue));
				
				title.parentNode.removeChild(title);
				
				bgm.appendChild(a);
				
				d.appendChild(bgm);
	
				bgr = document.createElement('SPAN');
				bgr.className = "bgr";
				
				d.appendChild(bgr);
				
				document.getElementById(this.property['headContainer']).appendChild(d);
			}
			
			d = document.createElement('DIV');
			d.className = "clear";
			
			document.getElementById(this.property['headContainer']).appendChild(d);
			
			if (!this.property.activeTab || this.property.activeTab > this.cache.length) this.property.activeTab = 0;
			
			this.selectTab(this.property.activeTab);
		}
	},
	
	
	addTab : function(title, container) {
		
		var tab = {};
			tab.title = title;
			tab.container = container;
			
		this.cache.push(tab);
	},
	
	
	selectTab : function(index) {
	
		if (this.activeTab != undefined) {
	
			document.getElementById("tabHead_"+this.activeTab).className = "tabHead";
			
			document.getElementById(this.cache[this.activeTab].container).style.display = 'none';
			
		}
	
		document.getElementById("tabHead_"+index).className += " act";
		
		document.getElementById(this.cache[index].container).style.display = 'block';
		
		var tab = "tabHead_"+index;
		
		if(document.getElementById("produktdetails") != null) {
			
			if(tab == "tabHead_0") {
				document.getElementById("produktdetails").style.display = 'block';
			} else {
				document.getElementById("produktdetails").style.display = 'none';
			}
		
		}
		
		this.activeTab = index;
		
		try {
	
			setCurrentMap(index);
		}
	
		catch (e) {}
	}

}


/*******************************************************************************
	ANIMATION
*******************************************************************************/

util.prototype.animation = function(div) {

	div.actionBuffer = {};
	div.busy = false;
	div.stack = [];
	
	div.instance = createInstance(div);
	
	
	function createInstance(div) {
		
		if (env.isIE) {
			
			if (!div.style.filter) div.style.filter = "alpha(opacity=100);";
		}
		
		else {
			
			if (!div.style.opacity) div.style.opacity = 1;
		}
		
		div.actionBuffer.opacity = null;
		
		if (div.getAttribute('id')) {
			
			var id = div.getAttribute('id');
		}
		
		else {
			
			var now = new Date().getTime();  
			var id = now+''+Math.round(Math.random()*1000);
			div.setAttribute('id', id);
		}
		
		return "document.getElementById('"+id+"').";
	}
	
	
	div.reset = function() {
		
		div.stack = [];
	}
	
	
	div.finish = function() {
		
		div.busy = false;

		if (div.stack.length > 0) {
			
			for (i in div.stack) {
				
				var e = div.stack[i];
				delete(div.stack[i]);
				eval(e);
				break;
			}
		}
	};
	
	
	div.onFinish = function(action) {
		
		div.stack.push(action);
	};
	
	
	div.slide = function(align, value, force) {
		
		if (div.busy && force !== true) {
			
			div.stack.push(div.instance+"slide('"+align+"', "+value+")");
		}
		
		else {

			div.busy = true;
		
			var left = parseInt(div.style.left.split('px')[0]);
			if (!left) left = 0;
			
			div.actionBuffer.start = left;
			div.actionBuffer.align = align;
			div.actionBuffer.target = parseInt(left) + parseInt(value);
			div.actionBuffer.dist = value;
			div.actionBuffer.step = 0;
			div.actionBuffer.slide = setInterval(div.instance+"slideStep();", util.config.speed);
		}
	};
	
	
	div.slideStep = function() {
	
		div.actionBuffer.step++;
	
		if (div.actionBuffer.step <= util.config.frames) {
			
			var pos = Math.ceil(div.actionBuffer.dist * Math.sin(div.actionBuffer.step * 1.5 / util.config.frames));
				pos = div.actionBuffer.start + pos;
				
			div.style[div.actionBuffer.align] = pos + 'px';
		}
		
		else {
	
			clearInterval(div.actionBuffer.slide);
			div.actionBuffer.slide = null;
			
			div.style[div.actionBuffer.align] = div.actionBuffer.target + 'px';
			
			div.finish();
		}
	};
	
	
	div.getOptacity = function() {
		
		try {

			if (env.isIE) {
				
				var o = div.style.filter.split('=')[1];
				if (o) o = parseInt(o.split(')')[0]/10);
				return o;
			}
			
			else {
				
				return parseInt(div.style.opacity*10);
			}
		}
		
		catch (e) {
			
			return null;
		}
	};
	
	
	div.fadeIn = function(force, lim) {

		if (div.busy && force !== true) {
			
			div.stack.push(div.instance+"fadeIn(false,"+lim+")");
		}
		
		else {
			
			div.busy = true;
			
			if (div.actionBuffer.fade) {
				
				clearInterval(div.actionBuffer.fade);
				div.actionBuffer.fade = null;
			}

			div.actionBuffer.incStep = 2;
			div.actionBuffer.opacity = div.getOptacity() || 0;
			div.actionBuffer.limit = lim || 10;

			if (div.actionBuffer.opacity != div.actionBuffer.limit) {

				if (util.config.doAnimation) {

					if (env.isIE) div.style.filter = "alpha(opacity="+(div.actionBuffer.opacity*10)+");";
						else div.style.opacity = div.actionBuffer.opacity/10;
					
					div.actionBuffer.fade = setInterval(div.instance+"fadeStep();", util.config.speed);
				}
				
				else {

					if (env.isIE) div.style.filter = "alpha(opacity="+(div.actionBuffer.limit*10)+");";
						else div.style.opacity = div.actionBuffer.limit/10;
					
					div.style.display = 'block';

					div.finish();
				}
			}
		}
	};
	
	
	div.fadeOut = function(force, lim) {

		if (div.busy && force !== true) {

			div.stack.push(div.instance+"fadeOut(false,"+lim+")");
		}
		
		else {
			
			div.busy = true;
			
			if (div.actionBuffer.fade) {
				
				clearInterval(div.actionBuffer.fade);
				div.actionBuffer.fade = null;
			}

			div.actionBuffer.incStep = -2;
			div.actionBuffer.opacity = div.getOptacity() || 10;
			div.actionBuffer.limit = lim || 0;
			
			if (div.actionBuffer.opacity != div.actionBuffer.limit) {
			
				if (util.config.doAnimation) {

					if (env.isIE) div.style.filter = "alpha(opacity="+(div.actionBuffer.opacity*10)+");";
						else div.style.opacity = div.actionBuffer.opacity/10;
			
					div.actionBuffer.fade = setInterval(div.instance+"fadeStep();", util.config.speed);
				}
				
				else {
					
					if (env.isIE) div.style.filter = "alpha(opacity="+(div.actionBuffer.limit*10)+");";
						else div.style.opacity = div.actionBuffer.limit/10;
					
					div.style.display = 'none';
					
					div.finish();
				}
			}
		}
	};
	
	
	div.fadeStep = function() {

		if (div.actionBuffer.fade) {

			div.actionBuffer.opacity += div.actionBuffer.incStep;
				
			if (env.isIE) div.style.filter = "alpha(opacity="+(div.actionBuffer.opacity*10)+");";
				else div.style.opacity = (div.actionBuffer.opacity/10);

			if (div.actionBuffer.opacity == div.actionBuffer.limit) {
				
				clearInterval(div.actionBuffer.fade);
				div.actionBuffer.fade = null;
				
				setTimeout(div.instance+"finish();", util.config.speed*5);
			}
		}
	}
}


/*******************************************************************************
	SLIDER
*******************************************************************************/

util.prototype.slider = {

	property : [],
	actPosition : 1,

	
	setProperty : function(key, value) {
		
		this.property[key] = value;		
	},
	
	
	init : function() {
		
		var property = util.slider.property;
		
		if (property.container) {
		
			util.slider.property.container = document.getElementById(property.container);
			
			var view = document.createElement('DIV');
				view.className = 'sliderViewport';
				
			// create cache
			
			var divs = util.slider.property.container.getElementsByTagName('DIV');
			
			var count = 0;
			
			for (var i=0; i<divs.length; i++) {
				
				if (divs[i].className == 'sliderContent') {

					count++;
					util.slider.property.intv = divs[i].offsetWidth;
					
					view.appendChild(divs[i].cloneNode(true));
				}
			}

			util.slider.property.limit = count;

			view.style.width = util.slider.property.intv * util.slider.property.limit + 'px';
			util.slider.property.viewport = view;

			new util.animation(util.slider.property.viewport);
			
			var w = util.slider.property.intv * property.viewPortSize;
			
			util.slider.property.container.style.width = w + 'px';
			util.slider.property.container.style.left =  '50%';
			util.slider.property.container.style.marginLeft = Math.ceil(w/2)*(-1) + 'px';
			util.slider.property.container.innerHTML = '';
			util.slider.property.container.appendChild(view);
			
			util.fixPNGs(view, true, true);

			
			// decorate slider-links
			
			var a = document.getElementById(property.slideLeft);
			
			if (env.isIE) {
						
				a.attachEvent("onclick", util.slider.slideLeft);
			}
			
			else {
				
				a.addEventListener("click", util.slider.slideLeft, false);
			}
			
			var a = document.getElementById(property.slideRight);
			
			if (env.isIE) {
						
				a.attachEvent("onclick", util.slider.slideRight);
			}
			
			else {
				
				a.addEventListener("click", util.slider.slideRight, false);
			}
			
			util.slider.checkArrows();
		}
		
	},

	
	slideRight : function(e) {
		
		if (env.isIE) e.returnValue = false;
			else e.preventDefault();
			
		e = e.srcElement || e.target;

		e.parentNode.blur();
		
		var act = parseInt(util.slider.actPosition);
		
		var lim = util.slider.property.limit - util.slider.property.viewPortSize + 1;
		
		if ((act+1) <= lim) {

			util.slider.property.viewport.slide('left', parseInt(util.slider.property.intv)*(-1));
			
			util.slider.actPosition++;

			util.slider.checkArrows();
		}
	},

	
	slideLeft : function(e) {
		
		if (env.isIE) e.returnValue = false;
			else e.preventDefault();
			
		e = e.srcElement || e.target;
		
		e.parentNode.blur();
		
		var act = parseInt(util.slider.actPosition);

		if ((act-1) >= 1) {

			util.slider.property.viewport.slide('left', parseInt(util.slider.property.intv));

			util.slider.actPosition--;
			
			util.slider.checkArrows();
		}
	},
	
	
	checkArrows : function() {
		
		var act = parseInt(util.slider.actPosition);
		
		var lim = util.slider.property.limit - util.slider.property.viewPortSize + 1;
		
		if (act >= lim) {

			document.getElementById(util.slider.property.slideRight).style.display = 'none';
		
		}
		
		else {
			
			document.getElementById(util.slider.property.slideRight).style.display = 'block';
		}

		if (act <= 1) {

			document.getElementById(util.slider.property.slideLeft).style.display = 'none';
			
		}
		
		else {
			
			document.getElementById(util.slider.property.slideLeft).style.display = 'block';
		}
	}
	
}

/*******************************************************************************
	LIGHT-BOX
*******************************************************************************/

util.prototype.lightBox = {

		
	cache : [],
	property : bobdata.lightBox['property'],
	activeBox : null,
	dragInfo : [],
	ajax : null,
	actionBuffer : [],
	
	
	// action-consts - used for onOpen & onClose
	
	DELETE_CONTENT : "cache.box.innerHTML=''",
	RESET_CONTENT : "var cache = util.lightBox.cache[util.lightBox.activeBox]; cache.box.innerHTML=''; cache.box.innerHTML=cache.fallback; util.lightBox.resize();",
	

	
	setProperty : function(key, value) {
		
		this.property[key] = value;		
	},

	
	add : function(dataId, linkId, loadBehavior, config) {

		var box = {};
			box.dataId = dataId;
			box.linkId = linkId;
			box.loadBehavior = (loadBehavior) ? loadBehavior : 0;
			box.config = (config) ? config : null;
			
		if (typeof linkId === OBJECT) {
			
			box.config.multibleLink = true;
		}
			
		this.cache.push(box);
		
		return this.cache.length-1;
	},
	
	
	attachLinks : function(cid, links) {

		if (util.lightBox.cache[cid]) {
		
			var c = util.lightBox.cache.length;
			
			for (li in links) {
	
				var a = document.getElementById(links[li]);
				
				if (a) {
					
					a.setAttribute('id', 'lightBoxLink'+c+'_'+cid);
					c++;
					
					if (env.isIE) {
				
						a.attachEvent("onclick", util.lightBox.open);
					}
							
					else {
						
						a.addEventListener("click", util.lightBox.open, false);
					}
				}
			}
		}
	},
	
	
	reset : function() {

		util.lightBox.cache = [];
		util.lightBox.activeBox = null;
		util.lightBox.dragInfo = [];
		util.lightBox.ajax = null;
		util.lightBox.actionBuffer = [];
	},

		
	init : function() {
		
		if (this.cache.length > 0) {
		
			this.ajax = new util.ajax();
			
			// container
			
			var d = document.createElement('DIV');
			d.className = "lightBoxContainer";
			
			this.property.container = d;
			
			document.getElementsByTagName('BODY')[0].getElementsByTagName('DIV')[0].appendChild(d);
			
			// bgLayer
			
			util.lightBox.cache[-1] = {};
			util.lightBox.cache[-1].box = util.lightBox.createBgLayer();
			
			// cache
			
			for (var i = 0; i < this.cache.length; i++) {
			
				var cache = util.lightBox.cache[i];
				
				// load config
				
				var dataSet = bobdata.lightBox[cache.dataId];
				
				if (cache.config) {
				
					var tmpConf = cache.config;
					
					cache.config = [];
					
					for (g in tmpConf) {
					
						cache.config[g] = tmpConf[g];
					}
				}
				
				else 
					cache.config = [];
				
				for (conf in util.lightBox.property.config) {
				
					if (cache.config[conf] == undefined) {
					
						cache.config[conf] = (dataSet && dataSet.config && dataSet.config[conf] != undefined) ? dataSet.config[conf] : util.lightBox.property.config[conf];
					}
				}

				
				// Verhalten Lightbox Browserweiche

				switch (cache.config.loadLB) {
	
					case 0:	// keine LB anzeigen
	
						if (document.getElementById(cache.dataId)) {
							
							document.getElementById(cache.dataId).style.display = 'none';
						}
						
						return;
					
					case 1:	// nur im IE6 eine LB anzeigen
					
						if (env.browser != 'ie6') {
		
							if (document.getElementById(cache.dataId)) {
								
								document.getElementById(cache.dataId).style.display = 'none';
							}
							
							return;
						}
						
						else {
							
							break;
						}
					
					case 2:	// immer eine LB anzeigen (Defaultverhalten; also ohne Browserweiche)
					
						break;
					
					default:

						break;
				}


				
				if (env.browser == 'ie6') 
					cache.config['dragable'] = false;
				
				cache.ajaxFilled = false;
				var ajaxTarget = null;
				
				// decorate links
				
				if (cache.linkId) {
				
					if (cache.config.multibleLink) {
					
						for (li in cache.linkId) {
						
							var a = document.getElementById(cache.linkId[li]);
							
							if (a) {
							
								a.setAttribute('id', 'lightBoxLink' + li + '_' + i);
								ajaxTarget = a.getAttribute('href');
								
								if (env.isIE) {
								
									a.attachEvent("onclick", util.lightBox.open);
								}
								
								else {
								
									a.addEventListener("click", util.lightBox.open, false);
								}
								
							}
							else 
								log("LIGHTBOX-ERROR: link doesn't exists: " + cache.linkId[li]);
						}
					}
					
					else {
					
						var a = document.getElementById(cache.linkId);
						
						if (a) {
						
							a.setAttribute('id', 'lightBoxLink_' + i);
							
							if (env.isIE) {
							
								a.attachEvent("onclick", util.lightBox.open);
							}
							
							else {
							
								a.addEventListener("click", util.lightBox.open, false);
							}
							
							ajaxTarget = a.getAttribute('href');
							
						}
						else {
						
							ajaxTarget = cache.linkId;
						// log("LIGHTBOX-ERROR: link doesn't exists: "+cache.linkId);	
						}
					}
				}
				
				
				// open & close eventhandlers
				
				cache.openAction = [];
				cache.openTimeout = [];
				
				if (cache.config.onOpen) {
				
					cache.openAction.push(cache.config.onOpen);
					cache.openTimeout.push(0);
				}
				
				cache.closeAction = [];
				cache.closeTimeout = [];
				
				if (cache.config.onClose) {
				
					cache.closeAction.push(cache.config.onClose);
					cache.closeTimeout.push(0);
				}
				
				// load content
				
				var dataDiv = document.getElementById(cache.dataId);
				
				if (dataSet && dataSet.content) {
				
					cache.content = dataSet.content;
					util.lightBox.createBox(i, false);
				}
				
				else 
					if (dataDiv) {
					
						cache.content = dataDiv.innerHTML;
						dataDiv.parentNode.removeChild(dataDiv);
						util.lightBox.createBox(i, false);
					}
					
					else 
						if (ajaxTarget) {
						
							cache.ajaxFilled = true;
							
							if (cache.config.deferralLoading !== true) {
							
								util.lightBox.ajax.sendRequest(ajaxTarget, null, "util.lightBox.createBox(" + i + ",true)", 0);
							}
							
							else {
							
								cache.content = "<span class='loadingIcon'/>";
								cache.openAction.push("util.lightBox.ajax.sendRequest('" + ajaxTarget + "', null, 'util.lightBox.refreshContent(null,true)', 0);");
								cache.openTimeout.push(0);
								cache.closeAction.push(util.lightBox.RESET_CONTENT);
								cache.closeTimeout.push(0);
								util.lightBox.createBox(i);
							}
						}
						
						else 
							log("cannot load data - no source detected: " + i);
				
			} // end for
		} // end if
	},
	

	createBgLayer : function() {

		var bg = document.createElement('DIV');
			bg.id = "lightBoxBgLayer";

		util.lightBox.property.container.appendChild(bg);
		
		return bg;
	},
	

	
	parseAjaxLinks : function() {

		var cid = util.lightBox.activeBox;
		var cache = util.lightBox.cache[cid];
		
		var links = cache.box.getElementsByTagName('A');
		
		for (var i=0; i<links.length; i++) {
			
			if (links[i].getAttribute('target') == '_self') {

				if (env.isIE) {

					links[i].attachEvent("onclick", util.lightBox.reloadContent);
				}
					
				else {

					links[i].addEventListener("click", util.lightBox.reloadContent, false);
				}
			}
		}

		util.fixPNGs(cache.box);
	},
	
	
	
	reloadContent : function(e) {

		if (env.isIE) e.returnValue = false;
			else e.preventDefault();
		
		e = e.srcElement || e.target;
		
		if (e.nodeName == 'IMG') e = e.parentNode;
		
		var href = e.getAttribute('href');
		
		var cid = util.lightBox.activeBox;
		var cache = util.lightBox.cache[cid];
		
		var cDiv = util.lightBox.getContentDiv(cache.box);

		if (cDiv) {
		
			if (!cDiv.fadeOut) {
				
				util.animation(cDiv);
			}
			
			cDiv.fadeOut();
		}

		util.lightBox.ajax.sendRequest(href, null, 'util.lightBox.refreshContent(null,true)', util.config.speed*12);
	},
	
	
	
	refreshContent : function(content, ajaxResponse) {
		
		var cid = util.lightBox.activeBox;
		var cache = util.lightBox.cache[cid];
		
		if (ajaxResponse == true) {

			cache.content = util.lightBox.ajax.getResponse();
		}
		
		else if (content) {
			
			cache.content = content;
		}
		
		var cDiv = util.lightBox.getContentDiv(cache.box);

		if (cDiv) {
			
			util.animation(cDiv);
			cDiv.innerHTML = cache.content;
			
			// print-button
			
			if (cache.config['printBtn'] == true) {
				
				var pLink = document.createElement('A');
					pLink.href = "javascript:window.print();";
					pLink.title = "Drucken";
				
				var btn = document.createElement('IMG');
					btn.width = 91;
					btn.height = 26;
					btn.src = util.images.printBtn;
					btn.alt = "Drucken"
					btn.className = "printBtn";

					pLink.appendChild(btn);
				
				cDiv.appendChild(pLink);
			}
			
			
			cDiv.fadeIn();
			
			util.lightBox.parseAjaxLinks();
		}
	},
	
	
	getContentDiv : function(div) {
		
		var cDiv = null;
		
		var divs = div.getElementsByTagName('DIV');
		
		for (var i=0; i<divs.length; i++) {
			
			if (divs[i].className == 'contentLayer') {
				
				cDiv = divs[i];
			}
			
			if (divs[i].className == 'innerLayer') {
				
				cDiv = divs[i];
				break;
			}
		}
		
		return cDiv;		
	},

	
	createBox : function(cid, ajaxResponse) {

		var cache = util.lightBox.cache[cid];

		if (ajaxResponse == true) {

			cache.content = util.lightBox.ajax.getResponse();
		}

		var s = (cache.config.size) ?  cache.config.size : 'medium';

		// box
		
		var box = document.createElement('DIV');
			box.id = this.property['prefix'] + this.cache[cid].dataId;
			box.className = 'lightBox ' + s;
		
		if (cache.config['hasDesign'] == true) {

			// header
			
			var header = document.createElement('DIV');
				header.className = 'header';
				
			box.appendChild(header);
	
			// content
			
			var content = document.createElement('DIV');
				content.className = 'content';

			if (cache.config['contentHeight']) {

				content.style.height = cache.config['contentHeight'] + 'px';
			}

			box.appendChild(content);
				
			// footer
			
			var footer = document.createElement('DIV');
				footer.className = 'footer';
				
			box.appendChild(footer);
		
		} else {

			if (cache.config['contentHeight']) {

				box.style.height = parseInt(cache.config['contentHeight'])+50 + 'px';
			}
		}

		// layers
		
		var contentLayer = document.createElement('DIV');
			contentLayer.className = 'contentLayer';
			
		if (cache.config['hasDesign'] == false) {
			
			contentLayer.className += ' noLayout';
		}

		var innerLayer = document.createElement('DIV');
			innerLayer.innerHTML = cache.content;

		
		// print-button
		
		if (cache.config['printBtn'] == true && cache.ajaxFilled !== true) {
			
			var pLink = document.createElement('A');
				pLink.href = "javascript:window.print();";
				pLink.title = "Drucken";
			
			var btn = document.createElement('IMG');
				btn.width = 91;
				btn.height = 26;
				btn.src = util.images.printBtn;
				btn.alt = "Drucken"
				btn.className = "printBtn";

				pLink.appendChild(btn);
			
			innerLayer.appendChild(pLink);
		}

		// scroller	

		if (cache.config.contentHeight) {

			innerLayer.className = "innerLayer";
			
			var h2 = innerLayer.getElementsByTagName('H2')[0];
		
			if (h2) {

				contentLayer.appendChild(h2);
			}
			
			var scrollLayer = document.createElement('DIV');
				scrollLayer.style.height = cache.config.contentHeight + 'px';
				scrollLayer.className = "scrollLayer";

			scrollLayer.appendChild(innerLayer);
			
			contentLayer.appendChild(scrollLayer);
		}
		
		else {
			
			contentLayer.appendChild(innerLayer);
		}

		box.appendChild(contentLayer);
		
		
		// create buttons

		if (cache.config.buttons) {
			
			var buttonContainer = document.createElement('DIV');
				buttonContainer.className = 'buttonContainer';
				
			contentLayer.appendChild(buttonContainer);
			
			for (btn in cache.config.buttons) {
				
				buttonContainer.appendChild(util.lightBox.createBtn(cache.config.buttons[btn]));
			}
			
			var clear = document.createElement('DIV');
				clear.className = 'clear';
				
			contentLayer.appendChild(clear);
		}

		
		// closeIcon

		if (cache.config.closeable == true) {
			
			var cl = document.createElement('SPAN');
				cl.id = 'closeIcon';
				cl.className = 'closeIcon';
				cl.title = 'close';
				cl.innerHTML = " ";

			box.appendChild(cl);
		}

		util.lightBox.property.container.appendChild(box);

		cache.box = box;
		cache.fallback = cache.box.innerHTML;
		
		if (env.browser == 'ie6') util.fixPNGs(box);


		// check loadBehavior
		
		if (cache.loadBehavior > 0) {
			
			var cookieTime = cache.config.cookieTime || 30;
			
			var cName = util.lightBox.getCookieName(cid);
			
			var found = false;
			
			var cookies = document.cookie.split('; ');
			
			for (var j=0; j<cookies.length; j++) {
				
				if (cookies[j] == cName) {
					
					found = true;
					break;
				}
			}
			
			switch (cache.loadBehavior) {

				case 1:	// Emergency

					if (found == false) {
						
						util.lightBox.open(cid);
						
						var ablauf = new Date();
						var gueltigkeit = ablauf.getTime() + (cookieTime * 24 * 60 * 60 * 1000);
						ablauf.setTime(gueltigkeit);
							
						document.cookie = cName + "; expires=" + ablauf.toGMTString();
					}
					break;
				
				case 2:	// Survey
				
					if (found == false) {
						
						util.lightBox.open(cid);
					}
					break;
				
				case 3:	// Penetrant
				
					util.lightBox.open(cid);
					break;
				
				default:
					log("unkown loadBehavior: " + cache.loadBehavior);
					break;
			}
			
		} // end loadBehavior
	},
	
	
	
	createBtn : function(item) {
		
		var btn = document.createElement('DIV');
			btn.className = "button";
			
			if (item.highlight) btn.className += " highlight";

		var bgl = document.createElement('SPAN');
			bgl.className = 'bgl';
			btn.appendChild(bgl);
			
		var bgm = document.createElement('SPAN');
			bgm.className = 'bgm';
			btn.appendChild(bgm);
			
		var a = document.createElement('A');
			a.href = "javascript:"+item.action;
			a.title = item.label;
			a.innerHTML = item.label;
			bgm.appendChild(a);

		var bgr = document.createElement('SPAN');
			bgr.className = 'bgr';
			btn.appendChild(bgr);
			
		return btn;		
	},
		
	
	getCookieName : function(cid, value) {
		
		if (!value) value = 1;
		
		return "bob_"+util.lightBox.property.prefix+util.lightBox.cache[cid].dataId+"="+value;
	},
	
	
	
	getCacheId : function(dataId) {
		
		var cid = null;
		
		var cache = util.lightBox.cache;
		
		for (var i=0; i<cache.length; i++) {
			
			if (cache[i].dataId == dataId) {
				
				cid = i;
				break;
			}
		}
		
		return cid;
	},

	
	switchBox : function(dataId) {
		
		var cid = util.lightBox.getCacheId(dataId);
		
		var i = util.lightBox.cache[util.lightBox.activeBox].closeAction.push("util.lightBox.open("+cid+");")-1;
		util.lightBox.cache[util.lightBox.activeBox].closeTimeout.push(util.lightBox.property.speed*35);
		var open = "util.lightBox.cache["+util.lightBox.activeBox+"].closeAction["+i+"]=null; util.lightBox.cache["+util.lightBox.activeBox+"].closeTimeout["+i+"]=null;";
		
		util.lightBox.cache[cid].openAction.push(open);

		util.lightBox.close();
		
		return false;
	},
	
	
	resize : function() {
		
		var cid = util.lightBox.activeBox;
		
		if (cid != null && cid >= 0) {
		
			var cache = util.lightBox.cache[cid];
			
			// bgLayer
			
			if (cache.config.bgLayer) {
	
				var html = document.getElementsByTagName('HTML')[0],
					
					h = html.scrollHeight,
					w = html.scrollWidth;
					
					if (env.browser == 'safari') {
						
						h = document.body.scrollHeight;
					}
		
				util.lightBox.cache[-1].box.style.height = h + 'px';
				util.lightBox.cache[-1].box.style.width = w + 'px';
			}
			
			// adapt height

			cache.box.style.display = 'block';

			var cl = cache.box.getElementsByTagName('DIV')[3];

			if (cl) {

				var h = cache.config.contentHeight || cl.offsetHeight;

				if (cache.config.hasDesign && (!cache.config.contentHeight || cache.config.deferralLoading)) h -= (cache.config.size == 'small') ? 15 : 45;
				
				if (cache.config.buttons) h += 28;
				
				if (h<=0) h = 1;
	
				cache.box.getElementsByTagName('DIV')[1].style.height = h +'px';
			}
			
			else {
				
				var h = cache.box.getElementsByTagName('DIV')[1].offsetHeight;
				
				if (h) {
				
					if (env.isIE && cache.config.hasDesign == false) h += 35;
					
					cache.box.style.height = (h+32) +'px';
				}
			}

			// dimensions
			
			var body = (env.browser=='safari') ? document.getElementsByTagName('HTML')[0] : document.getElementsByTagName('BODY')[0];

			if (!cache.config.boxHeight) {

				cache.config.boxHeight = cache.box.offsetHeight;
			}
			
			if (!cache.config.boxWidth) {
				
				cache.config.boxWidth = cache.box.offsetWidth;
			}

			if (!cache.config.boxTop) {
				
				var height = (env.browser=='ie8') ? body.offsetHeight : body.scrollHeight;
				
				cache.config.boxTop = (height - cache.config.boxHeight) / 2;
			}
			
			if (!cache.config.boxLeft) {
				
				var left = (env.browser=='ie8') ? body.offsetWidth : body.scrollWidth;
				
				cache.config.boxLeft = (body.scrollWidth - cache.config.boxWidth) / 2;
			}
						
			var t = cache.config.boxTop;
			var l = cache.config.boxLeft;

			if (cache.config.vAlign == 'top') t -= (t/3)*2;
				else if (cache.config.vAlign == 'bottom') t += (t/3)*2;
			
			if (cache.config.hAlign == 'left') l -= (l/3)*2;
				else if (cache.config.hAlign == 'right') l += (l/3)*2;
						
			if (env.browser == 'ie6') {

				t += document.documentElement.scrollTop;
			}

			cache.box.style.top = Math.floor(t) + 'px';
			cache.box.style.left = Math.floor(l) + 'px';
		}
	},


	open : function(e) {

		var cid;

		if (typeof e == NUMBER) {
			
			cid = e;
		}

		else if (e) {

			elm = e.srcElement || e.target;

			var id = elm.getAttribute('id');

			if (id) {
				
				cid = id.split('_')[1];
			}
			
			else {

				cid = elm.parentNode.getAttribute('id').split('_')[1];
			}

			elm.blur();
			
			if (util.lightBox.cache[cid].config.followLink == false) {
			
				if (env.isIE) e.returnValue = false;
					else e.preventDefault();
			}
		}


		if (util.lightBox.activeBox == null) {

			util.lightBox.activeBox = cid;

			var cache = util.lightBox.cache[cid],
				spd = util.lightBox.property.speed;

			// flash-check
			
			if (!cache.config.flashVer || cache.config.flashVer <= env.flashVer) {
						
				// resize
	
				util.lightBox.resize();
				
				if (env.browser != 'ie6') {
					
					window.onresize = util.lightBox.resize;
				}

				// bgLayer
	
				if (cache.config.bgLayer == true) {
	
					// closeable
					
					if (cache.config.closeable == true) {
		
						if (env.isIE) {
						
							util.lightBox.cache[-1].box.attachEvent("onclick", util.lightBox.close);
						}
						
						else {
							
							util.lightBox.cache[-1].box.addEventListener("click", util.lightBox.close, false);
						}
					}
					
					util.lightBox.cache[-1].box.style.display = 'block';

					// fadeIn bg
					
					if (cache.config.fade == true) {
	
						util.lightBox.fadeIn(-1, (spd/2), 8);	
					}
					
					else util.lightBox.finish(-1, 1, 8);
				}
				
				
				// close-icon
				
				var close = null;
				
				var divs = cache.box.getElementsByTagName('SPAN');
					
				for (d in divs) {

					if (d && divs[d] && divs[d].className == 'closeIcon') {
						
						close = divs[d];
						break;
					}
				}

				if (close) {

					if (env.isIE) {
						
						close.attachEvent("onclick", util.lightBox.close);
					}
					
					else {
						
						close.addEventListener("click", util.lightBox.close, false);
					}
				}
				
	
				// dragable
				
				if (cache.config.dragable == true) {
					
					var head = cache.box.getElementsByTagName('DIV')[0];
					
					head.onmousedown = util.lightBox.startDrag;
					head.style.cursor = 'move';
	
					util.lightBox.initDrag();
				}
				
				var anm = false;
				
				// fadeIn
				
				if (cache.config.fade == true) {

					util.lightBox.fadeIn(cid, spd);
					anm = true;
				}
	
				// slideIn
				
				if (cache.config.slide !== false) {
					
					util.lightBox.slideIn(cid, spd);
					anm = true;
				}
				
				if (anm === false) util.lightBox.finish(cid, 1);
				
				
				// check autoClose
					
				if (cache.config.autoClose !== null) {
	
					cache.openAction.push("util.lightBox.close();");
					cache.openTimeout.push(cache.config.autoClose * 1000);
				}

				
				if (cache.ajaxFilled) {
	
					util.lightBox.parseAjaxLinks();
				}
				
	
				// hide selects
				
				if (env.browser == 'ie6') {
					
					var selects = document.getElementsByTagName('SELECT');
					
					for (var s=0; s<selects.length; s++) {
						
						selects[s].style.visibility = 'hidden';
					}
					
					var selects = util.lightBox.property.container.getElementsByTagName('SELECT');
					
					for (var s=0; s<selects.length; s++) {
						
						selects[s].style.visibility = 'visible';
					}
				}
			}
		}
	},


	close : function(e) {

		var commit = false;
		
		if (e === true) {
			
			commit = true;
		}

		else if (e) {
			
			if (env.isIE) e.returnValue = false;
				else e.preventDefault();
		}
		
		var cid = util.lightBox.activeBox;
		
		if (cid != null) {

			var cache = util.lightBox.cache[cid];

			// eventhandler

			if (cid > -1 && cache.closeAction.length > 0) {

				for (var j=0; j<cache.closeAction.length; j++) {
					
					if (cache.closeAction[j] === null) {
						continue;
					}
					
					if (!cache.closeTimeout[j]) cache.closeTimeout[j] = 0;

					util.lightBox.actionBuffer[j] = setTimeout(cache.closeAction[j], cache.closeTimeout[j]);
				}
			}
			
			// remove document-handlers
			
			document.onmousemove = null;
			document.onmouseup = null;
			
			var spd = util.lightBox.property.speed;

			// remove ddLayer
			
			if (cache.config.dragable == true) {
				
				cache.box.getElementsByTagName('DIV')[0].onmousedown = null;
			}
			
			// bgLayer
			
			if (cache.config.bgLayer == true) {

				if (env.isIE) {
				
					util.lightBox.cache[-1].box.detachEvent("onclick", util.lightBox.close);
				}
				
				else {
					
					util.lightBox.cache[-1].box.removeEventListener("click", util.lightBox.close, false);
				}

				if (cache.config.fade == true) {
					
					util.lightBox.fadeOut(-1, (spd/2), 8);
				}
				else util.lightBox.finish(-1, 0, 0);
			}
			
			// remove close-icon listner
			
			var close = null;
			
			var divs = cache.box.getElementsByTagName('SPAN');
				
			for (d in divs) {

				if (d && divs[d] && divs[d].className == 'closeIcon') {
					
					close = divs[d];
					break;
				}
			}

			if (close) {

				if (env.isIE) {
					
					close.detachEvent("onclick", util.lightBox.close);
				}
				
				else {
					
					close.removeEventListener("click", util.lightBox.close, false);
				}
			}

			// fadeOut
			
			var anm = false;

			if (cache.config.fade == true) {

				util.lightBox.fadeOut(cid, spd);
				anm = true;
			}
			
			// slideOut
			
			if (cache.config.slide !== false) {
				
				util.lightBox.slideOut(cid, spd);
				anm = true;
			}
			
			if (anm === false) {
				
				util.lightBox.finish(cid, 0);
			}

			
			// check loadBehavior
				
			if (cache.loadBehavior == 2 && commit == true) {

				document.cookie = util.lightBox.getCookieName(cid);
			}
			
			window.onresize = null;

			
			// show selects
			
			if (env.browser == 'ie6') {
				
				var selects = document.getElementsByTagName('SELECT');
				
				for (var s=0; s<selects.length; s++) {
					
					selects[s].style.visibility = 'visible';
				}
			}

			document.getElementsByTagName('BODY')[0].style.overflow = 'auto';
		}
	},
	

	/* DRAG & DROP */
	
	initDrag : function() {

		util.lightBox.stopDrag();

		document.onmousemove = util.lightBox.drag;
		document.onmouseup = util.lightBox.stopDrag;
	},
	
	drag: function(e) {

		util.lightBox.dragInfo['px'] = document.all ? window.event.clientX : e.pageX;
 		util.lightBox.dragInfo['py'] = document.all ? window.event.clientY : e.pageY;
		
		if (util.lightBox.dragInfo['obj'] != null) {
		    
		    var l = (util.lightBox.dragInfo['px'] - util.lightBox.dragInfo['dx']);
		    var t = (util.lightBox.dragInfo['py'] - util.lightBox.dragInfo['dy']);
			
			if (t<0) t = 0;
			else if (t>util.lightBox.dragInfo['maxH']) t = util.lightBox.dragInfo['maxH'];
				
			util.lightBox.dragInfo['obj'].style.top = t + "px";

			if (l<0) l = 0;
			else if (l>util.lightBox.dragInfo['maxW']) l = util.lightBox.dragInfo['maxW'];
				
			util.lightBox.dragInfo['obj'].style.left = l + "px";
		}
	},
	
	startDrag : function() {
		
		if (util.lightBox.activeBox != null) {
		
			util.lightBox.cache[util.lightBox.activeBox].box.style.right = 'auto';
			util.lightBox.cache[util.lightBox.activeBox].box.style.bottom = 'auto';
			
			var body = document.getElementsByTagName('BODY')[0];
				
			util.lightBox.dragInfo['maxH'] = body.scrollHeight - util.lightBox.cache[util.lightBox.activeBox].config.boxHeight;
			util.lightBox.dragInfo['maxW'] = body.scrollWidth - util.lightBox.cache[util.lightBox.activeBox].config.boxWidth;
	
			util.lightBox.dragInfo['obj'] = util.lightBox.cache[util.lightBox.activeBox].box;
			util.lightBox.dragInfo['dx'] = util.lightBox.dragInfo['px'] - util.lightBox.dragInfo['obj'].offsetLeft;
			util.lightBox.dragInfo['dy'] = util.lightBox.dragInfo['py'] - util.lightBox.dragInfo['obj'].offsetTop;
		}
	},

	stopDrag : function() {

		util.lightBox.dragInfo['obj'] = null;
		util.lightBox.dragInfo['dx'] = 0;
		util.lightBox.dragInfo['dy'] = 0;
		util.lightBox.dragInfo['px'] = 0;
		util.lightBox.dragInfo['py'] = 0;
	},



	/* FADE */
	
	finish : function(cid, typ, op) {

		var cache = util.lightBox.cache[cid];

		// position
		
		var body = document.getElementsByTagName('BODY')[0];

		if (cache.box.style.top == 'auto') {
			
			cache.box.style.top = cache.box.offsetTop + 'px';
		}
		
		if (cache.box.style.left == 'auto') {
			
			cache.box.style.left = cache.box.offsetLeft + 'px';
		}
		
		cache.box.style.right = 'auto';
		cache.box.style.bottom = 'auto';

		// opacity

		if (typ === 1) {

			if (!op) op = 10;
			
			cache.box.style.display = 'block';
			
			if (env.isIE) cache.box.style.filter = "alpha(opacity:"+(op*10)+");";
				else cache.box.style.opacity = (op/10);
				
			util.lightBox.activeBox = cid;
			
			// open eventhandler

			if (cid > -1 && cache.openAction.length > 0) {

				for (var j=0; j<cache.openAction.length; j++) {
					
					if (cache.openAction[j] === null) {
						continue;
					}

					if (!cache.openTimeout[j]) cache.openTimeout[j] = 0;

					util.lightBox.actionBuffer[j] = setTimeout(cache.openAction[j], cache.openTimeout[j]);
				}
			}
		}
		
		else {
			
			cache.box.style.display = 'none';
			
			if (env.isIE) cache.box.style.filter = "alpha(opacity:0);";
				else cache.box.style.opacity = 0;
				
			if (cid >= 0) util.lightBox.activeBox = null;
		}

		if (env.isIE) body.style.overflowY = 'auto';
	},
	
	
	fadeIn : function(cid, intv, lim) {

		lim = (!lim) ? 10 : lim;
		
		var cache = util.lightBox.cache[cid];
		
			cache.opacity = 0;
			
		if (env.isIE) cache.box.style.filter = "alpha(opacity:0);";
			else cache.box.style.opacity = 0;

		if (cache.fadeAction == null)
			cache.fadeAction = setInterval("util.lightBox.fadeInStep("+cid+","+lim+");", intv);
	},
	
	
	fadeInStep: function(cid, lim) {
		
		var cache = util.lightBox.cache[cid];
		
		if (cache.fadeAction) {
	
			cache.opacity += 2;	// (env.isIE) ? 2 : 1;
	
			if (env.isIE) cache.box.style.filter = "alpha(opacity:"+(cache.opacity*10)+");";
				else cache.box.style.opacity = (cache.opacity/10);
	
			if (cache.opacity > lim) {
				
				clearInterval(cache.fadeAction);
				cache.fadeAction = null;
	
				var op = (cid == -1) ? 8 : 0;

				util.lightBox.finish(cid, 1, op);
			}
		}
	},
	
	
	fadeOut : function(cid, intv, lim) {
		
		lim = (!lim) ? 10 : lim;
		
		var cache = util.lightBox.cache[cid];
			
			cache.opacity = lim;
			
		if (env.isIE) cache.box.style.filter = "alpha(opacity:"+(cache.opacity*10)+");";
			else cache.box.style.opacity = (cache.opacity/10);

		if (cache.fadeAction == null)
			cache.fadeAction = setInterval("util.lightBox.fadeOutStep("+cid+");", intv);
	},
	
	
	fadeOutStep: function(cid) {
		
		var cache = util.lightBox.cache[cid];
		
		if (cache.fadeAction) {

			cache.opacity -= 2;
	
			if (env.isIE) cache.box.style.filter = "alpha(opacity:"+(cache.opacity*10)+");";
				else cache.box.style.opacity = (cache.opacity/10);
			
			if (cache.opacity < 0) {

				clearInterval(cache.fadeAction);
				cache.fadeAction = null;
				util.lightBox.finish(cid, 0);
			}
		}
	},
	
	
	/* SLIDE */
	
	slideIn : function(cid, intv) {
		
		var cache = util.lightBox.cache[cid],
		
			body = document.getElementsByTagName('BODY')[0],
		
			t = parseInt(cache.box.style.top.split('px')[0]),
			l = parseInt(cache.box.style.left.split('px')[0]),

			w = cache.config.boxWidth,
			h = cache.config.boxHeight;
			
		if (env.isIE) body.style.overflowY = 'hidden';

		switch (cache.config.slide) {
			
			case 'top':
				cache.lim = t;
				cache.dist = h + t;
				cache.start = (0-h);
				cache.box.style.bottom = 'auto';
				break;
				
			case 'bottom':
				b = parseInt(body.scrollHeight - t);
				cache.lim = b;
				cache.dist = h + b;
				cache.start = (0-h);
				cache.box.style.top = 'auto';
				break;

			case 'left':
				cache.lim = l;
				cache.dist = w + l;
				cache.start = (0-w);
				cache.box.style.right = 'auto';
				break;
				
			case 'right':
				r = parseInt(body.scrollWidth - l);
				cache.lim = r;
				cache.dist = w + r;
				cache.start = (0-w);
				cache.box.style.left = 'auto';
				break;
				
			default: break;
		}
		
		if (cache.config.fade !== true) {

			if (env.isIE) cache.box.style.filter = "alpha(opacity:100);";
				else cache.box.style.opacity = 1;
		}
		
		cache.typ = 1;
		cache.step = 0;
		cache.box.style[cache.config.slide] = cache.start + 'px';

		if (cache.slideAction == null)
			cache.slideAction = setInterval("util.lightBox.slideStep("+cid+");", intv);
	},
	
	
	slideOut : function(cid, intv) {
		
		var cache = util.lightBox.cache[cid],
		
			body = document.getElementsByTagName('BODY')[0],
		
			t = parseInt(cache.box.style.top.split('px')[0]),
			l = parseInt(cache.box.style.left.split('px')[0]),

			w = cache.config.boxWidth,
			h = cache.config.boxHeight;
		
		switch (cache.config.slide) {
			
			case 'top':
				cache.lim = (0-h);
				cache.dist = h + t;
				cache.start = t;
				cache.box.style.bottom = 'auto';
				break;
				
			case 'bottom':
				
				bh = (env.browser == 'safari') ? html.scrollHeight : body.scrollHeight;
				b = parseInt(bh - cache.box.offsetTop - h);
				cache.lim = (0-h);
				cache.dist = h + b;
				cache.start = b;
				cache.box.style.top = 'auto';
				break;
						
			case 'left':
				cache.lim = (0-w);
				cache.dist = w + l;
				cache.start = l;
				cache.box.style.right = 'auto';
				break;
			
			case 'right': 
				r = parseInt(body.scrollWidth - cache.box.offsetLeft - w);
				cache.lim = (0-w);
				cache.dist = w + r;
				cache.start = r;
				cache.box.style.left = 'auto';
				break;
				
			default: break;
		}
		
		cache.typ = 0;
		cache.step = 0;
		cache.box.style[cache.config.slide] = cache.start + 'px';

		if (cache.slideAction == null)
			cache.slideAction = setInterval("util.lightBox.slideStep("+cid+");", intv);
	},


	slideStep : function(cid) {

		var cache = util.lightBox.cache[cid];
		
		cache.step++;

		if (cache.step <= util.lightBox.property.frames) {
			
			pos = Math.ceil(cache.dist * Math.sin(cache.step * 1.5 / util.lightBox.property.frames));

			if (cache.typ === 1) pos = cache.start + pos;
				else pos = cache.start - pos;

			cache.box.style[cache.config['slide']] = pos + 'px';
		}
		
		else {

			clearInterval(cache.slideAction);
			cache.slideAction = null;
			
			cache.box.style[cache.config['slide']] = cache.lim + 'px';

			util.lightBox.finish(cid, cache.typ);
		}
	}


}


/*******************************************************************************
	AJAX ANIMATION
*******************************************************************************/

util.prototype.ajaxanimation = {

	init : function() {
		
	},
	
	
	show : function() {
		
		var loading_icon = document.createElement('IMG');
			loading_icon.width = 32;
			loading_icon.height = 32;
			loading_icon.src = util.images.loading;
			loading_icon.alt = "wird geladen..."
			loading_icon.id = "loading_icon";
			loading_icon.className = "loading_icon";

		var op_bg = document.createElement('DIV');
			op_bg.id = "opacityLayer";
		
		var body = document.getElementsByTagName('BODY')[0];
			
			body.appendChild(op_bg);
			body.appendChild(loading_icon);

		var icon = document.getElementById('loading_icon');
		
		var pos_x = (document.body.scrollWidth / 2) - 16;
		var pos_y = (document.body.scrollHeight / 2) - 16;
		
			icon.style.top = pos_y + "px";
			icon.style.left = pos_x + "px";
			icon.style.display = "block";
			
			var html = document.getElementsByTagName('HTML')[0],
			
			w = html.scrollWidth;
			h = html.scrollHeight;
			
			document.getElementById('opacityLayer').style.width = w + "px";
			document.getElementById('opacityLayer').style.height = h + "px";
			
			document.getElementById('opacityLayer').style.display = "block";
			document.getElementById('loading_icon').style.display = "block";
			
			if (env.browser == 'ie6') {
			
				var selects = document.getElementsByTagName('SELECT');
				
				for (var s = 0; s < selects.length; s++) {
				
					selects[s].style.visibility = 'hidden';
				}
			}
			
			if (env.isIE) {
	
				document.getElementById('opacityLayer').style.filter = "alpha(opacity = 60)";
			}
			
			else {
	
				document.getElementById('opacityLayer').style.opacity = "0.6";
			}
	},
	
	
	hide : function(e) {
		
		try {
			
			document.getElementById('loading_icon').style.display = "none";
			document.getElementById('opacityLayer').style.display = "none";
			
			if (env.browser == 'ie6') {
			
				var selects = document.getElementsByTagName('SELECT');
				
				for (var s = 0; s < selects.length; s++) {
				
					selects[s].style.visibility = 'visible';
				}
			}
		}
		
		catch(e) {}
		
	}
	
}


/*******************************************************************************
	KONTAKTFORMULAR
*******************************************************************************/

var flag = 0;

util.prototype.contactForm = {
	
	property : [],
	
	
	setProperty : function(key, value) {
		
		this.property[key] = value;
	},
	
	
	init : function() {
		
		if (this.property.charsLeft) {
			
			var textfieldTemp = this.property.textfield;
			var textfield = document.getElementById(textfieldTemp)
			
			
			if (env.isIE) {
			
				textfield.attachEvent("onkeyup", util.contactForm.cutText);
				textfield.attachEvent("onkeydown", util.contactForm.cutText);
				textfield.attachEvent("onchange", util.contactForm.cutText);
				textfield.attachEvent("onfocus", util.contactForm.cutText);
			}
			
			else {

				textfield.addEventListener("keyup", util.contactForm.cutText, false);
				textfield.addEventListener("keydown", util.contactForm.cutText, false);
				textfield.addEventListener("change", util.contactForm.cutText, false);
				textfield.addEventListener("focus", util.contactForm.cutText, false);

			}

		}
	
	},
	
	
	cutText : function() {
		
		var textfieldTemp = util.contactForm.property.textfield;
		var textfield = document.getElementById(textfieldTemp);
		
		var charsLeftTemp = util.contactForm.property.charsLeft;
		var charsLeft = document.getElementById(charsLeftTemp);
		
		
		if (flag == 0) {
		
			textfield.value = '';
			flag = 2;
		}
		else {

			var len = textfield.value.length;
			var max = util.contactForm.property.maxChars;
			
			if (len > max) {
				textfield.value = textfield.value.substr(0, max);
			}
			else {
				charsLeft.innerHTML = max - len;
			}
		}
	}
	
	
}



var util = new util();

// -->