function include(file)
{
	var element = document.createElement('SCRIPT');
	$(element).attr('type','text/javascript');
	$(element).attr('src',file);	
	$('head').append(element); 
}
function includeCss(file)
{
	var element = document.createElement('LINK');
	$(element).attr('type','text/css');
	$(element).attr('rel','stylesheet');
	$(element).attr('href',file);	
	$('head').append(element); 
}
function startFile()
{
	if (local()) var title = window.location.pathname.substr(20);
	else if (local()) var title = window.location.pathname.substr(1);
	var index = inArray(title,labels['titles'].split(','));
	if (!index) index = 0;
	var file = labels['files'].split(',')[index];
	return file;
}
function send(modul,data,data2) // modul = function, data = data send by ajax, data2 = parameters as an object for javascript function
{
	if (!modul) return;
	var param = 'ajax=true';
	
	if (isObject(modul)){ // more functions
		for (var i=0; i<modul.length; i++) param += '&modul'+i+'='+modul[i];
		param += '&modulNumber='+modul.length;
	}	
	else param += '&modul='+modul;
	
	if (data) $.each(data, function(key,value){ param += '&'+key+'='+escape(nl2br(asci(value))); });

	$.ajax({
		type: 'POST',
		url: phpFile,
		dataType: 'json',
		data: param,
		success: function (answer){ answerAjax(answer,modul,data2); },
		error:answerError
	});
}
function answerFunction(modul,answer,data)
{
	if (!answer.success) return;
	if (window[modul+'Answer']) window[modul+'Answer'](answer,data);
	else if (window[modul]) window[modul](answer,data);
}
function answerError()
{
	write('error');
}
function answerAjax(answer,modul,data)
{
	if (!answer){ answerError(); return; }
	answer = decodeObject(answer);
	
	if (answer.modul) modul = answer.modul;
	if (answer.mail) write(answer.mail.message);
	var error = answer.error; if (error) for (var i=0; i<error.length; i+=2) write(error[i+1]);
	var info = answer.info; if (info) for (var i=0; i<info.length; i+=2) write(info[i+1]);
				
	// request array
	if (isObject(modul)) for (var i=0; i<modul.length; i++){		
		if (data && data[modul[i]]) window[modul[i]](answer,data[modul[i]]);	
		else answerFunction(modul[i],answer);
	}	
	// normal request
	else answerFunction(modul,answer,data);
}
function answerPHP(json)
{
	var answer = eval('(' + json + ')');
	answerAjax(answer,answer.modul);
}
function phpVariable(variable,json)
{
	window[variable] = eval('(' + json + ')');
}
function sendEvt(element,data)
{
	if (isObject(data)){
		modul = data[0];
		send(modul,data[1],data[2]);
	} 
	else send(data);
}
function write(text,element)
{
	if (element){ $(element).siblings('.info').html(text); return; } 
	
	var cont = createPopup('info',labels.info);
	createText(cont,'','',text); createBreak(cont,2);		
	createLink(cont,'','button','Ok','popupClose');
}
function popupClose()
{
	$('.popup').remove();
}
function show(cont,type)
{
	if (type == 'fade') fade($(cont).children()[0]);
	else slide($(cont).children()[0]);
	
	function fade(element)
	{
		$(element).fadeIn('slow',function(){ 
			var next = $(this).next()[0]; if (!next) return;
			if (next.tagName == 'BR') next = $(this).next().next()[0];
			fade(next); 		
		});
	}
	function slide(element)
	{
		$(element).slideDown('slow',function(){ 
			var next = $(this).next()[0]; if (!next) return;
			if (next.tagName == 'BR') next = $(this).next().next()[0];
			slide(next); 		
		});
	}
}
function positionSet(element,cont,left,top)
{
	var newLeft = positionLeft(element);
	var newTop = positionTop(element);
	
	if (left) newLeft += left;
	if (top) newTop += top;	
	//if ($.browser.msie || newTop+100 > window.outerHeight) newTop -= 100; // IE doesn't support window.outerHeight
	//else newTop += 50; // so it won't be hidden in the bottom
	
	cont.style.left = newLeft + 'px';
	cont.style.top = newTop + 'px';
}
function positionLeft(inputObj)
{
	var returnValue = inputObj.offsetLeft;
	while((inputObj = inputObj.offsetParent) != null){
		if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
	}
	return returnValue;
}
function positionTop(inputObj)
{		
	var returnValue = inputObj.offsetTop;
	while((inputObj = inputObj.offsetParent) != null){
		if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
	}
	return returnValue;
}
function evtOver(element)
{
	if (substring(element.className,-5) != '_over') element.className += '_over';
}
function evtOut(element)
{
	element.className = element.className.split('_')[0];
}
function shadowText(id)
{
	$('#'+id).html(labels[id]);		
	var shadow = createText(false,'shadow','',labels[id]); $('#'+id).html(shadow);
	var text = createText(false,'pressed','',labels[id]); 
	$(text).css('margin-left','-'+($('#'+id).width()));	$('#'+id).append(text);	
}
function shadow(element)
{
	var cont1 = createContainer(false,'','shadow1','shadow');
	var cont2 = createContainer(cont1,'','shadow4','shadow');
	var cont3 = createContainer(cont2,'','shadow5','shadow');
	$(element).wrap(cont1);
}
function refresh()
{
	location.reload();
}
function link(element,href)
{
	window.open(href);
}
function link2(element,href)
{
	document.location.href = href;
}
function isArray(obj) 
{
   if (obj.constructor.toString().indexOf("Array") == -1) return false;
   else return true;
}
function isObject(variable)
{
	if (typeof variable == 'object') return true;
	else return false;
}
function isEmpty(object){
	for(var i in object) if(object.hasOwnProperty(i)) return false;
	return true;
}
function isPicture(address)
{
	var element = document.createElement('IMG');
	element.src = address;
	element.alt = '';
	document.body.appendChild(element);
	var width = $(element).width();
	$(element).remove();
	if (width == 0 || width == 24) return false;
	else return true;
}
function substring(string,start,end)
{	
	if (start < 0) start = string.length + start;
	if (end < 0) end = string.length + end;
	if (end) return string.substr(start,end);
	return string.substr(start);
}
function removeChildren(element,leaveFirst)
{
	var children = element.childNodes;
	for (var i = children.length - 1; i >= 0; i--) { // start with the last
		if (leaveFirst && i == 0) continue;
		element.removeChild(children[i]);
	}
}
function obj(id)
{
	return document.getElementById(id);
}
function objEmpty(id,leaveFirst)
{
	var cont = document.getElementById(id);
	if (!cont) return;
	removeChildren(cont,leaveFirst);
	return cont;
}
function pValid()
{
	var path = window.location.pathname;
	var index = path.lastIndexOf('/')+1;
	if (path.substr(index) != '') return true;
	return false;
}
function pValue()
{
	var path = window.location.pathname;
	var index = path.lastIndexOf('/')+1;
	return path.substr(index);
}
function hValid()
{
	if (window.location.hash) return true;
	return false;
}
function hValue()
{
	var hash = asci(window.location.hash);
	return hash.substr(1);
}
function gValid(string)
{
	if (!string){ if (window.location.search) return true; else return false; } 
	if (window.location.search.substr(1,string.length) == string) return true;
	return false;
}
function gValue(string)
{
	return window.location.search.substr(string.length+2);
}
function value(id)
{
	return document.getElementById(id).value;
}
function cValue(id)
{
	var element = obj(id);
	if (!element) return false;
	return element.checked;
}
function cgValue(id) // checkgroup
{
	var value = '';	
	$('input[@name='+id+']').each(function(i){
		if (this.checked){
			value += $(this).next().html();
			var next = $(this).next().next().next()[0];
			if (next.className == 'selection') value += ' ('+rValue(next.id)+')';
			value += ', ';
		} 
	});	
	if (value.length != 0) value = substring(value,0,-2);
	return value;
}
function sValue(element)
{
	var index = element.options.selectedIndex;
	var value = element.options[index].value;
	if (!value) value = element.options[index].innerHTML;
	return value;
}
function rValue(id)
{
	var value;
	$('#'+id).children().each(function(i){ if (this.checked) value = $(this).next().html(); });	
	if (!value) return '';
	return value;
}
function lValue(id)
{
	return labels[id];
}
function xValue(id,value) // -x-xxxx
{
	var fields = labels[id+'_fields'];
	if (!fields) return;
	var spots = value.split('');	
	var texts = fields.split(',');
	var result = new Array();
	
	for (var i=0; i<spots.length; i++)	if (spots[i] == 'x') result.push(texts[i]);
	return result.join(', ');
}
function oValue(id,value) // object0
{
	var fields = labels[id+'_fields'];
	if (!fields) return;
	var texts = fields.split(',');
	var index = value.substr(id.length);
	return texts[index];
}
function month(number)
{
	var month = Array();
	month['01'] = 'Januar';
	month['02'] = 'Februar';
	month['03'] = 'März';
	month['04'] = 'April';
	month['05'] = 'Mai';
	month['06'] = 'Juni';
	month['07'] = 'Juli';
	month['08'] = 'August';
	month['09'] = 'September';
	month['10'] = 'Oktober';
	month['11'] = 'November';
	month['13'] = 'Dezember';
	
	return month[number];
}
function cookieSave(varArray)
{
	var expires = 'Sat, 31 Dec 2050 20:00:00 GMT';

	document.cookie = 'name='+labels['title']+'; expires=' + expires + ';'; // add expires to every single variable
    for (var i=0; i<varArray.length; i++) document.cookie = varArray[i]+'='+value(varArray[i])+'; expires='+expires+';';	 
}
function cookieLoad(fields)
{
	var content = new Object();	
	for (var i=0; i<fields.length; i++){
				
		var field = fields[i];
		var start = document.cookie.indexOf(field);
		if (start == -1) continue;
		start = start + field.length + 1;
		var value = document.cookie.substr(start);
		var end = value.indexOf(';');
		if (end != -1) content[field] = value.substr(0,end);
		else content[field] = value.substr(0);
	}
	content.cookiePushed = 'true';	
	return content;
}
function cookieExists(fields)
{
	if(!document.cookie) return false;
	for (var i=0; i<fields.length; i++)	if (document.cookie.indexOf(fields[i]) == -1) return false;
	return true;
}
function cookieDelete(fields)
{
	var expires = 'Fri, 02 Jan 1970 00:00:00 UTC;';
	document.cookie = 'name=; expires=' + expires + ';';
	for (var i=0; i<fields.length; i++)	document.cookie = fields[i]+'=; expires=' + expires + ';';
}
function iframe(element,file)
{
	menuOver(element.id);
	var cont = objEmpty('content');
	createIFrame(cont,'','iframe',file);
}
function browserAlign(element,width)
{
	var browserWidth = window.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
	var margin = (browserWidth-width)/2;
	if (margin < 0) margin = 0;
	element.style.marginLeft = margin+'px';
	element.style.width = width+'px';
	window.onresize = function(){browserAlign(element,width)};
	
	window.browserWidth = browserWidth;
}
function browserValign(element,height)
{
	var browserHeight = window.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);
	var margin = (browserHeight-height)/2;
	if (margin < 0) margin = 0;
	element.style.marginTop = margin+'px';
	element.style.height = height+'px';
}
function align(element)
{	
	var parent = element.parentNode; if (!parent) return;
	var widthParent = parent.clientWidth;
	var width = element.clientWidth;
	var margin = (widthParent-width)/2;
	element.style.marginLeft = margin+'px';
}
function valign(element)
{
	var height = $(element).height();
	var heightParent = $(element).parent().height();
	var margin = (heightParent-height)/2;
	$(element).css('margin-top',margin);
}
function ucfirst(str)
{
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1, str.length-1);
}
function submitForm(element,formId)
{
	var data = new Object();
	
	if (isObject(formId)){
		var modul = formId[1];
		var children = obj(formId[0]).childNodes;
		data.id = formId[0];
	}
	else if (formId){
		var modul = formId;
		var children = obj(formId).childNodes;
	}
	else{
		var modul = element.parentNode.id;
		var children = element.parentNode.childNodes;
	}
	
	// get the values of the textfields
	for (var i=0; i<children.length; i++){
		
		//if (formId){ // two container in between
			var children2 = children[i].childNodes;
			for (var j=0; j<children2.length; j++) data = submitElement(data,children2[j]);
		//} 
		data = submitElement(data,children[i]);
	} 
	
	// false input?
	if (data.error) write(labels.error.uncomplete,element);
	else send(modul,data,$(element).parent().children('.submit')[0]);
}
function submitField(element,fieldId)
{
	if (fieldId) var element = obj(fieldId);
	$(element).trigger('blur');
	if (!element.value || element.name == 'error') return;
	send(element.id,object(element.id,element.value));
}
function submitUpload(element,param)
{
	var form = param.form; delete param.form;
	$.each(param,function(id,value){ form.action += '&'+id+'='+value; });
	form.submit();
}
function submitElement(data,element)
{
	// trigger the check event	
	if (element.tagName == 'INPUT' && element.type != 'submit' && element.type != 'radio') $(element).trigger('blur');
	else if (element.tagName == 'TEXTAREA') $(element).trigger('keyup');
	else if (element.tagName == 'SELECT') $(element).trigger('change',['check']);	
	else if (element.className == 'selection') $(element).trigger('click');	
	else return data; // no form field
	
	// get the data or an error
	if (element.name == 'error') data.error = true; // error
	else if (element.type == 'checkbox'){
		if (element.name == 'mandatory' && !element.checked) data.error = true;
		else if (element.name) data[element.name] = cgValue(element.name);
		else data[element.id] = element.checked;	
	}
	else if (element.className == 'selection') data[element.id] = rValue(element.id);
	else if (element.tagName == 'SELECT') data[element.id] = sValue(element);
	else if (element.tagName == 'TEXTAREA') data[element.id] = asci(element.value);
	else data[element.id] = element.value;
	return data;
}
function checkElement(element,param)
{
	var result = false;
	var type = param[0];
	var optional = param[1];	
	if (optional != 'second' && optional && element.value == '') return;
	
	if (optional == 'second'){
		var first = obj(substring(element.id,0,-1)); // delete the 2 in the end of id
		if (element.value == first.value) result = true;
		else result = false;
	}
	else if (type == 'selection'){ if (rValue(element.id)) result = true; } // radio
	else if (type == 'selectbox'){ if (element.options.selectedIndex != 0) result = true; }
	else result = check(element.value,type); 
	if (type == 'logon' && !result) result = check(element.value,'mail'); 
	
	if (result){
		element.style.borderColor = 'blue';
		element.name = '';
		$('#'+element.id+'_error').hide();
		if (type == 'selection' || type == 'selectbox') return true;
		$(element).unbind('keyup');
		return true;
	}
	else if (element.name != 'error'){ // not if it's wrong already
	
		element.style.borderColor = 'red';
		element.name = 'error';
		//$('#'+element.id+'_error').show();
		$('#'+element.id+'_error').css('display','inline-block');
		if (type == 'selection' || type == 'selectbox') return false;
		eventBind(element,'checkElement','keyup',param); // now not just blur
		return false;
	}	
}
function check(text,type)
{
	var reg;
	switch(type)
	{	
		case 'mail':		reg = eval('/^([a-zA-Z0-9_\.\-])+[\@]([a-zA-Z0-9\-])+[\.]+[a-zA-Z0-9]{2,4}$/'); break;
		case 'website':		reg = eval('/^(([a-zA-Z0-9\-])+[\.])+[a-zA-Z0-9]{2,4}$/'); break;
		case 'password':	reg = eval('/^[a-zA-Z0-9§(\x20-\x7E)]{3,20}[^\"\']$/i'); break; // x20-x7E special characters, without stringbreaker
		case 'number':		reg = eval('/^[0-9]{1,20}$/i'); break;
		case 'postcode':	reg = eval('/^[0-9]{5}$/i'); break;
		case 'date':		reg = eval('/^[0-9]{1,2}[\.][0-9]{1,2}[\.][0-9]{4,4}$/i'); break;
		case 'birthdate':	reg = eval('/^[0-9]{1,2}[\.][0-9]{1,2}[\.][0-9]{4,4}$/i'); break;
		case 'message':		reg = eval('/^.{1,300}$/i'); break;
		case 'tags':		reg = eval('/^[a-z0-9\-äöüß ]{1,300}$/i'); break;
		case 'user':		reg = eval('/^[a-z0-9\-\.äöüß ]{3,10}$/i'); break;
		default:			reg = eval('/^[a-zA-Z0-9äöüß§(\x20-\x7E)]{0,100}[^\"\']$/i'); break;
	}

	if (type == 'message') text = nl2br(text);
	result = reg.test(text);
	if (type == 'birthdate' && result) result = checkDate(text);
	return result;
}
function checkDate(date)
{
	date = date.split('.');
	if (date[0] == 0 || date[0] > 31) return false;
	if (date[1] == 0 || date[1] > 12) return false;
	var now = new Date().getFullYear();
	if (date[2] < 1900 || date[2] > now-16) return false;
	return true;
}
function wrong(element)
{
	if (element.style.borderBottomColor == 'red') return true;
	return false;
}
function asci(string)
{
	while (string.search(/ä/) != -1) string = string.replace(/ä/,'&auml;');
	while (string.search(/Ä/) != -1) string = string.replace(/Ä/,'&Auml;');
	while (string.search(/ö/) != -1) string = string.replace(/ö/,'&ouml;');
	while (string.search(/Ö/) != -1) string = string.replace(/Ö/,'&Ouml;');
	while (string.search(/ü/) != -1) string = string.replace(/ü/,'&uuml;');
	while (string.search(/Ü/) != -1) string = string.replace(/Ü/,'&Uuml;');
	while (string.search(/ß/) != -1) string = string.replace(/ß/,'&szlig;');
	return string;
}
function decodeAsci(string)
{
	if (!string) return;
	while (string.search(/&auml;/) != -1) string = string.replace(/&auml;/,'ä');
	while (string.search(/&Auml;/) != -1) string = string.replace(/&Auml;/,'Ä');
	while (string.search(/&ouml;/) != -1) string = string.replace(/&ouml;/,'ö');
	while (string.search(/&Ouml;/) != -1) string = string.replace(/&Ouml;/,'Ö');
	while (string.search(/&uuml;/) != -1) string = string.replace(/&uuml;/,'ü');
	while (string.search(/&Uuml;/) != -1) string = string.replace(/&Uuml;/,'Ü');
	while (string.search(/&szlig;/) != -1) string = string.replace(/&szlig;/,'ß');
	return string;
}
function decodeUrl(str)
{
	var histogram = {}, histogram_r = {}, code = 0, str_tmp = [];
	var ret = str.toString();
	
	var replacer = function(search, replace, str){
		var tmp_arr = [];
		tmp_arr = str.split(search);
		return tmp_arr.join(replace);
	};
	
	// The histogram is identical to the one in urlencode.
	histogram['!'] = '%21';
	histogram['%20'] = '+';
	
	for (replace in histogram) {
		search = histogram[replace]; // Switch order when decoding
		ret = replacer(search, replace, ret) // Custom replace. No regexing   
	}
	
	// End with decodeURIComponent, which most resembles PHP's encoding functions
	//ret = decodeURIComponent(ret); // just utf-8
	ret = unescape(ret); // also iso but obsolet
	ret = ret.replace(/\\n/g,'\n');
	while (ret.search(/&amp;amp;/) != -1) ret = ret.replace(/&amp;amp;/,'&');
	while (ret.search(/&amp;/) != -1) ret = ret.replace(/&amp;/,'&');
	
	return ret;
}
function display(element,id)
{
	$('#'+id).toggle('slow');
}
function decodeObject(answer)
{
	$.each(answer,function(field1,value1){
		
		if (isObject(value1)) $.each(value1,function(field2,value2){
			if (isObject(value2)) $.each(value2,function(field3,value3){			
				if (isObject(value3)) $.each(value3,function(field4,value4){
					if (isObject(value4)) $.each(value4,function(field5,value5){
						if (isObject(value5)) $.each(value5,function(field6,value6){
							if (isObject(value6)) $.each(value5,function(field7,value7){
								answer[field1][field2][field3][field4][field5][field6][field7] = decodeUrl(value7);
							});
							else answer[field1][field2][field3][field4][field5][field6] = decodeUrl(value6);
						});
						else answer[field1][field2][field3][field4][field5] = decodeUrl(value5);
					});
					else answer[field1][field2][field3][field4] = decodeUrl(value4);
				});
				else answer[field1][field2][field3] = decodeUrl(value3);
			});
			else answer[field1][field2] = decodeUrl(value2);
		});
		else answer[field1] = decodeUrl(value1);		
	});
	
	return answer;
}
function nl2br(str) 
{
    return (str + '').replace(/([^>]?)\n/g, '$1<br>');
}
function thickboxAfterClose(id)
{
	if (id == 'menuContact') removeChildren(obj(id));
}
function thickboxClose()
{
	tb_remove();
}
function object(key1,value1,key2,value2,key3,value3,key4,value4,key5,value5)
{
	var object = new Object();
	object[key1] = value1;
	if (key2) object[key2] = value2;
	if (key3) object[key3] = value3;
	if (key4) object[key4] = value4;
	if (key5) object[key5] = value5;
	return object;
}
function local()
{
	if (document.location.host == 'localhost') return true;
	return false;
}
function history(id)
{
//	if (pValid() || gValid()) return;
	var hash = decodeAsci(labels[id]); if (!hash) hash = id; hashes[hash] = id; 
	if (pValue() == hash) return;
	window.location.href = '#'+hash;
	clearInterval(window.interval);
	if ($.browser.msie) window.frames.historyFrame.window.location.search = "?" + hash;
	
	// check all the time if it's changed
	window.interval = setInterval(function(){ if (hValue() != hash) $('#'+hashes[hValue()]).trigger('click'); },100);	
}
function historyIE(hash) // from iframe history.html
{
	if (hValue() != hash) $('#'+hashes[hValue()]).trigger('click');
}
function inArray(needle,haystack,strict){

    var strict = !!strict;

    for(var key in haystack){
        if( (strict && haystack[key] === needle) || (!strict && haystack[key] == needle) ){
            return key;
        }
    }
 
    return false;
}
Array.prototype.remove = function(s){
	var index = this.indexOf(s);
	if (this.indexOf(s) != -1) this.splice(index, 1);
}

var dhtmlgoodies_tooltip = false;
var dhtmlgoodies_tooltipShadow = false;
var dhtmlgoodies_shadowSize = 4;
var dhtmlgoodies_tooltipMaxWidth = 200;
var dhtmlgoodies_tooltipMinWidth = 100;
var dhtmlgoodies_iframe = false;
var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;

function tooltip(element,text)
{
	if (!text) return;
	$(element).bind('mouseover', function(event){ showTooltip(event,text,this); });
	$(element).bind('mouseout', hideTooltip);
	$(element).bind('mousedown', hideTooltip);
}
function showTooltip(e,tooltipTxt,element)
{
	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;

	if(!dhtmlgoodies_tooltip){
		dhtmlgoodies_tooltip = document.createElement('DIV');
		dhtmlgoodies_tooltip.id = 'dhtmlgoodies_tooltip';
		dhtmlgoodies_tooltipShadow = document.createElement('DIV');
		dhtmlgoodies_tooltipShadow.id = 'dhtmlgoodies_tooltipShadow';
		
		document.body.appendChild(dhtmlgoodies_tooltip);
		document.body.appendChild(dhtmlgoodies_tooltipShadow);	
		
		if(tooltip_is_msie){
			dhtmlgoodies_iframe = document.createElement('IFRAME');
			dhtmlgoodies_iframe.frameborder='5';
			dhtmlgoodies_iframe.style.backgroundColor='#FFFFFF';
			dhtmlgoodies_iframe.src = '#'; 	
			dhtmlgoodies_iframe.style.zIndex = 100;
			dhtmlgoodies_iframe.style.position = 'absolute';
			document.body.appendChild(dhtmlgoodies_iframe);
		}
		
	}
	
	dhtmlgoodies_tooltip.style.display='block';
	dhtmlgoodies_tooltipShadow.style.display='block';
	if(tooltip_is_msie)dhtmlgoodies_iframe.style.display='block';
	
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX + 10;
	
	dhtmlgoodies_tooltip.style.width = null;	// Reset style width if it's set 
	dhtmlgoodies_tooltip.innerHTML = tooltipTxt;
	dhtmlgoodies_tooltip.style.left = leftPos + 'px';
	dhtmlgoodies_tooltip.style.top = e.clientY + 10 + st + 'px';

	
	dhtmlgoodies_tooltipShadow.style.left =  leftPos + dhtmlgoodies_shadowSize + 'px';
	dhtmlgoodies_tooltipShadow.style.top = e.clientY + 10 + st + dhtmlgoodies_shadowSize + 'px';
	
	if(dhtmlgoodies_tooltip.offsetWidth>dhtmlgoodies_tooltipMaxWidth){	/* Exceeding max width of tooltip ? */
		dhtmlgoodies_tooltip.style.width = dhtmlgoodies_tooltipMaxWidth + 'px';
	}
	
	var tooltipWidth = dhtmlgoodies_tooltip.offsetWidth;		
	if(tooltipWidth<dhtmlgoodies_tooltipMinWidth)tooltipWidth = dhtmlgoodies_tooltipMinWidth;
	
	
	dhtmlgoodies_tooltip.style.width = tooltipWidth + 'px';
	dhtmlgoodies_tooltipShadow.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
	dhtmlgoodies_tooltipShadow.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';		
	
	if((leftPos + tooltipWidth)>bodyWidth){
		dhtmlgoodies_tooltip.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
		dhtmlgoodies_tooltipShadow.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + dhtmlgoodies_shadowSize) + 'px';
	}
	
	if(tooltip_is_msie){
		dhtmlgoodies_iframe.style.left = dhtmlgoodies_tooltip.style.left;
		dhtmlgoodies_iframe.style.top = dhtmlgoodies_tooltip.style.top;
		dhtmlgoodies_iframe.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
		dhtmlgoodies_iframe.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';	
	}		
}	
function hideTooltip()
{
	$(dhtmlgoodies_tooltip).hide();
	$(dhtmlgoodies_tooltipShadow).hide();
	if(tooltip_is_msie) $(dhtmlgoodies_iframe).hide();		
}
