/*-----------------------------------------------------------+
 | addLoadEvent: Add event handler to body when window loads |
 +-----------------------------------------------------------*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}
	
/*------------------------------------+
 | Functions to run when window loads |
 +------------------------------------*/
addLoadEvent(function () {
	initChecklist();
	HighlightWord.onPageLoad();
	ElementManager.onLoad();
});

/*---------------------------------------------------------------+
 | addUnloadEvent: Add event handler to body when window unloads |
 +---------------------------------------------------------------*/
function addUnloadEvent(func) {
	var oldonload = window.onunload;
	
	if (typeof window.onunload != "function") {
		window.onunload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}
	
/*--------------------------------------+
 | Functions to run when window unloads |
 +--------------------------------------*/
addUnloadEvent(function () {
		MapsManager.onUnload();
});


/*----------------------------------------------------------+
 | initChecklist: Add :hover functionality on labels for IE |
 +----------------------------------------------------------*/
function initChecklist() {
	if (document.all && document.getElementById) {
		// Get all unordered lists
		var lists = document.getElementsByTagName("ul");

		for (i = 0; i < lists.length; i++) {
			var theList = lists[i];
			
			// Only work with those having the class "checklist"
			if (theList.className.indexOf("checkList") > -1) {
				var labels = theList.getElementsByTagName("label");
					
				// Assign event handlers to labels within
				for (var j = 0; j < labels.length; j++) {
					var theLabel = labels[j];
					theLabel.onmouseover = function() { this.className += " hover"; };
					theLabel.onmouseout = function() { this.className = this.className.replace(" hover", ""); };
				}
			}
		}
	}
}


String.prototype.trim = function() { 
	return this.replace(/^\s+|\s+$/, ''); 
};

// replace xml chars by &entities;
String.prototype.escapeXML = function()
{
  var s = this.replace( /&/g, "&amp;" );
  s = s.replace( /</g, "&lt;" );
  s = s.replace( />/g, "&gt;" );
  return s;
}
/**
 ** 280 ZebraTable
 ** Color odd/even rows of table differently
 ** 1) odd rows get css class odd (ref. jspwiki.css )
 **   %%zebra-table ... %%
 **
 ** 2) odd rows get css style='background=<color>'
 ** %%zebra-<odd-color> ... %%  
 **
 ** 3) odd rows get odd-color, even rows get even-color
 ** %%zebra-<odd-color>-<even-color> ... %%
 **
 ** colors are specified in HEX (without #) format or html color names (red, lime, ...)
 **
 **/
var ZebraTable = {
	print: function(elementID) {
	  var table = document.getElementById(elementID);
	  $A(table.getElementsByTagName("tr")).each(function(row,i){
	    if ( i % 2 == 1 ) {
	      Element.addClassName( row, "odd" );
	    }		
	  });
        }
}


/**
 ** 290 Highlight Word
 **
 ** Inspired by http://www.kryogenix.org/code/browser/searchhi/ 
 ** Modified 20021006 to fix query string parsing and add case insensitivity 
 ** Modified 20030227 by sgala@hisitech.com to skip words 
 **                   with "-" and cut %2B (+) preceding pages 
 ** Refactored for JSPWiki -- now based on regexp, by D.Frederickx. Nov 2005
 **
 **/
var HighlightWord = new Object();
HighlightWord.ClassName = "searchword";
HighlightWord.ClassNameMatch = "<span class='"+HighlightWord.ClassName+"' >$1</span>" ;
HighlightWord.ReQuery = new RegExp( "(?:\\?|&)(?:q|query)=([^&]*)", "g" );

HighlightWord.onPageLoad = function () 
{

  if( !this.ReQuery.test( document.URL ) ) return;
  //alert("[" + document.URL +"]");
  var words = decodeURIComponent(RegExp.$1);
  words = words.replace( /\+/g, " " );
  words = words.replace( /\s+-\S+/g, "" );
  words = words.replace( /([\(\[\{\\\^\$\|\)\?\*\.\+])/g, "\\$1" ); //escape metachars
  words = words.trim();
  words = words.split(/\s+/).join("|");
  this.reMatch = new RegExp( "(" + words + ")" , "gi");
  //alert(this.reMatch);
  
  var node = document.getElementById("contentBox");
  this.walkDomTree( node );
}

// recursive tree walk matching all text nodes
HighlightWord.walkDomTree = function( node )
{
  if(!node) return;
  var nn = null; 
  for( var n = node.firstChild; n ; n = nn )
  {
    nn = n. nextSibling; /* prefetch nextSibling cause the tree will be modified */
    this.walkDomTree( n );
  }
  
  // continue on text-nodes, not yet highlighted, with a word match
  if( node.nodeType != 3 ) return; 
  if( node.parentNode.className == this.ClassName ) return;
  var s = node.nodeValue;
  s = s.escapeXML(); /* bugfix - nodeValue apparently unescapes the xml entities ?! */
  if( !this.reMatch.test( s ) ) return;
  
  var tmp = document.createElement("span");
  tmp.innerHTML = s.replace( this.reMatch, this.ClassNameMatch );

  var f = document.createDocumentFragment();
  while( tmp.firstChild ) f.appendChild( tmp.firstChild );

  node.parentNode.replaceChild( f, node );  
}


/**
 ** 130 GraphBar Object : also used on the findpage
 ** %%graphBars ... %%
 ** convert numbers inside %%gBar ... %% tags to graphic horizontal bars
 ** no img needed.
 ** supported parameters: bar-color and bar-maxsize
 ** e.g. %%graphBars-e0e0e0 ... %%  use color #e0e0e0, default size 120
 ** e.g. %%graphBars-red-40 ... %%  use color red, maxsize 40 chars
 **/
var GraphBar = {
	print: function(elementID) {
        	var container = document.getElementById(elementID);
		var gBarD = [];
        	var maxValue = Number.MIN_VALUE; minValue = Number.MAX_VALUE;   	
		var gBars = $(container).select("[class=gBar]");
		$A(gBars).each(function(row,i){
			var k = parseInt($(row).innerHTML,10 );
	        	maxValue = Math.max( maxValue, k ); 
      			minValue = Math.min( minValue, k );
      			gBarD[i] = k;
		});
		$A(gBars).each(function(row,i){
			$(row).innerHTML = " <span style='border-left:" + (gBarD[i] * 3) + "px solid #ff9933;'> &nbsp;" + gBarD[i] +"</div>"; 
		});
	}
}

function changeLanguage(country) {
	var url = document.URL;
	if(url.indexOf("?") == -1) {
		document.location.replace(document.URL + "?locale=" + country);
	} else {
		document.location.replace(document.URL + "&locale=" + country);
	}
}

function changeLayout(styleSize) {
	document.webSiteLayout.style.value=styleSize;
	document.webSiteLayout.url.value=document.URL;
	document.webSiteLayout.submit();
}

String.prototype.startsWith = function(s) { return this.indexOf(s)==0; }

/**
* Bindet die Google-Maps-API an
*
*/
var MapsManager = {
	geocoder: null,
	map: null,
	showMap: function(elementID, address, markerContent) {
	        if (GBrowserIsCompatible()) {
	         	if(!this.geocoder) {
	         		this.geocoder = new GClientGeocoder();
	         	}
			this.map = new GMap2($(elementID));
			this.map.addControl(new GSmallMapControl());
			this.geocoder.getLatLng(
			    address,
			    function(point) {
				      if (!point) {
					        alert(address + " not found");
				      } else {
					        this.map.setCenter(point, 13);
					        var marker = new GMarker(point);
					        this.map.addOverlay(marker);
					        marker.openInfoWindowHtml(markerContent);
      				}
    			}
			 );
		} else {
			alert("We are sorry for inconvencience, but your browser is not able to display these maps");
		}	
	},
	showMap: function(elementID, latitude, longitude, markerContent) {
	        if (GBrowserIsCompatible()) {		
			var point = new GLatLng(latitude, longitude);			
			this.map = new GMap2($(elementID));
			this.map.setCenter(point, 13);
			this.map.addControl(new GSmallMapControl());
		        var marker = new GMarker(point);
		        this.map.addOverlay(marker);
		        marker.openInfoWindowHtml(markerContent);

		} else {
			alert("We are sorry for inconvencience, but your browser is not able to display these maps");
		}
	},
	onUnload: function() {
		try{
		        if (GBrowserIsCompatible()){
				GUnload();
			}
		}catch(e) {}
	}
}

var CookieManager = {
	cookieJar:null,
	putSessionCookie: function(cookieName, cookieValue) {
		this.getCookie().put(cookieName, cookieValue);
	},
	getSessionCookie: function(cookieName) {
		return this.getCookie().get(cookieName);
	},
	getCookie: function() {
		if(!this.cookieJar) {
			this.cookieJar = new CookieJar({path:'/'});
		}
		return this.cookieJar;
	},
	getKeys: function() {
		return this.getCookie().getKeys();
	},
	cookiesEnabled: function() {
		document.cookie = "M24CookieTest=M24CookieTest";
		if(document.cookie.length == 0) {
			return false;
		}
		return document.cookie.indexOf("M24CookieTest") != -1;
	}
}

var WindowUtils = {
	getWindowWidth: function(){
				return (self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0);
	},
	getWindowHeight: function(){
				return (self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0);
	},
	getDocumentWidth: function(){
				return Math.max(document.body.scrollWidth,this.getWindowWidth());
	},
	getDocumentHeight: function(){
			return Math.max(document.body.scrollHeight,this.getWindowHeight());
	}
}




var CatalogUtils = {
	displayCatalog: function(catalogURL, catalogTitle, newletterURL) {
		this.displayOverlay(catalogTitle);			
		this.showCatalog(catalogURL, newletterURL);
	},
	showCatalog: function(catalogURL, newletterURL) {
			var newCatalogURL = catalogURL.replace('/catalogs//catalogs/', '/catalogs/');
			//alert("[" + newCatalogURL +"]");
			var dimensions = this.getCatalogDimensions();
			var so = new SWFObject(this.getCatalogFlash(), "{application}", dimensions.width -20, dimensions.height -40, FlashUtils.getFlashMajorVersion(), "#d9ecff");
			so.addParam("scale", "noscale");
			so.addVariable("xmlUrl", newCatalogURL);
			so.addVariable("newsletterUrl", newletterURL);
			so.addVariable("newsletterTarget", "_self");			
			so.write(this.getContentName());
	},
	closeCatalog: function() {
		if($(this.getOverlayName())) {
			$(this.getOverlayName()).hide();
		}
		if($(this.getDetailName())){
			$(this.getDetailName()).hide();
		}
	},
	displayOverlay: function(catalogTitle) {
		var overlay = $(this.getOverlayName());
		if(!overlay) {
			Element.insert(document.body,'<div id="' + this.getOverlayName() + '" style="display:none;"></div>');
			Element.insert(document.body,'<div id="' + this.getDetailName() + '" style="display:none;">');

			Element.insert($(this.getDetailName()), '<div id="' + this.getHeaderName() + '" class="storeDetailTop"><span class="wikiBoxTitle" id="' + this.getTitleID() + '">' + catalogTitle + '</span></div>');
			Element.insert($(this.getDetailName()), '<div id="' + this.getContentName() +'">Zum Betrachten dieser Seite benoetigen Sie den Macromedia Flash Player. <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Hier</a> kann der Flash-Player heruntergeladen werden.	</div>');
		} else {
			Element.update($(this.getTitleID()), catalogTitle);
		}

		var was = $(this.getOverlayName());
		was.style.position = 'absolute';
		was.style.width = WindowUtils.getWindowWidth()+'px';
		was.style.height = WindowUtils.getDocumentHeight() +'px';
		was.style.top = '0px';
		was.style.left = '0px';
		$(was).show();


		var catalog = $(this.getDetailName());
		var dimensions = this.getCatalogDimensions();

		catalog.style.position = 'absolute';
		catalog.style.width = (dimensions.width - 10) + 'px';
		catalog.style.height = (dimensions.height - 10) + 'px';
		catalog.style.top = '20px';
		catalog.style.left = ((WindowUtils.getWindowWidth() - dimensions.width) / 2) + 'px';
		$(catalog).show();
		
		Event.observe(this.getOverlayName(), 'click', function(event) {
			CatalogUtils.closeCatalog();
		});

		Event.observe(this.getHeaderName(), 'click', function(event) {
			CatalogUtils.closeCatalog();
		});
	},
	getCatalogDimensions: function() {
		var dimensions = $(this.getContentName()).getDimensions();
		dimensions.height = dimensions.height < 650 ? 650:dimensions.height;
		dimensions.width = dimensions.width < 880 ? 880:dimensions.width;
		return dimensions;
	},
	getOverlayName: function() {
		return "modal_overlay";
	},
	getDetailName: function() {
		return "catalog_Detail";
	},
	getHeaderName: function() {
		return "catalog_Header";	
	},
	getContentName: function() {
		return "catalog_Content";
	},
	getTitleID: function() {
		return "wikiBoxTitle_" + this.getHeaderName();
	},
	getCatalogFlash: function() {
		if(FlashUtils.getFlashMajorVersion() == 9) {
			return "/catalogs/Katalog_9.swf";
		} else {
			return "/catalogs/Katalog_7.swf";		
		}
	}
}


var FlashUtils = {
		hasFlash: function() {
			var playerVersion = deconcept.SWFObjectUtil.getPlayerVersion(); 
			//alert("major=[" + playerVersion.major +"]minor=[" + playerVersion.minor +"]rev=[" + playerVersion.rev +"] valid=[" + playerVersion.versionIsValid(new deconcept.PlayerVersion([0,0,0])) +"]");
			return playerVersion.versionIsValid(new deconcept.PlayerVersion([0,0,0]));
		},
		getFlashMajorVersion: function() {
			if(!this.hasFlash()) {
				return -1;
			}
			return deconcept.SWFObjectUtil.getPlayerVersion().major; 
		},
		embedFlash: function(url, elementName, width, height, noFlashImage) {
			if(!this.hasFlash() && noFlashImage) {
				var divEl = $(this.getDivElementName(elementName));
				$A(divEl.childNodes).each(function(node) { divEl.removeChild(node) });
				$A(this.getImageElement(noFlashImage).childNodes).each(function(node) { divEl.appendChild(node) });
				return;
			}
			var so = new SWFObject(url, this.getMovieElementName(elementName), width, height,7);
			so.addParam("wmode", "transparent");	
			so.write(this.getDivElementName(elementName));
			return so;
		},
		embedFlashVideo: function(url, elementName, width, height, noFlashImage) {
			if(!this.hasFlash() && noFlashImage) {
				var divEl = $(this.getDivElementName(elementName));
				$A(divEl.childNodes).each(function(node) { divEl.removeChild(node) });
				$A(this.getImageElement(noFlashImage).childNodes).each(function(node) { divEl.appendChild(node) });
				return;
			}
			var so = new SWFObject(this.getVideoFlash(), this.getMovieElementName(elementName), width, height,7);
			so.addParam("wmode", "transparent");	
			so.addParam("movie", this.getVideoFlash());
			so.addVariable("flv",url);
			so.addVariable("autoplay", "1");
			so.addVariable("autoload", "1");			
			so.addVariable("buffer", "20");
			so.addVariable("width",width);			
			so.addVariable("height",height);
			so.write(this.getDivElementName(elementName));
			return so;
		},		
		getImageElement: function(noFlashImage) {
			var element = document.createElement('span');
			var imgElement = document.createElement('img');
			imgElement.src = noFlashImage;
			element.appendChild(imgElement);
			return element;
		},
		getMovieElementName: function(elementName) {
			return elementName +  '_movie';
		},
		getDivElementName: function(elementName) {
			return elementName + '_div';
		},
		getVideoFlash: function() {
			return "/catalogs/player_flv.swf";
		}
}


var Password = {
	calculatePasswordQuality: function(passwd, stopWords) {		
		if (passwd.length == 0) return 0;
		
		stopWords = stopWords || [];

		var tmp = passwd.toLowerCase().strip();
		for (var i = 0; i < stopWords.length; i++) {
			var sw = stopWords[i].toLowerCase().strip();
			if (tmp == sw) return 0;
		}

		var score = 0
		
		if (passwd.length < 5) {
			score += 3;
		}
		else if (passwd.length < 8) {
			score += 6;
		}
		else if (passwd.length < 10) {
			score += 12;
		}
		else {
			score += 18;
		}
		
		var lowerCaseChars = (passwd != passwd.toUpperCase());
		if (lowerCaseChars) {
			score += 1;
		}

		var upperCaseChars = (passwd != passwd.toLowerCase());
		if (upperCaseChars) {
			score += 5;
		}
		
		var chars = (upperCaseChars || lowerCaseChars);
		
		var digits = (passwd.match(/\d/g) || []).length;
		if (digits > 0) {
			score += 5;
		}
		
		if (digits > 2) {
			score += 5;
		}
		
		var specialChars = (passwd.match(/[@!#$%^&*?_~]/g) || []).length;
		if (specialChars > 0) {
			score += 5;
		}
		
		if (specialChars > 1) {
			score += 5;
		}
		
		if (upperCaseChars && lowerCaseChars) {
			score += 2;
		}
		
		if (chars && digits) {
			score += 2;
		}
		
		if (chars && digits && specialChars) {
			score += 2;
		}

		return score / 50;
	}
};

var ElementManager = {
	showElement: function(elementID) {
		Element.show($(elementID));
		CookieManager.putSessionCookie("em_" + elementID, 'show');
		
	},
	hideElement: function(elementID) {
		Element.hide($(elementID));
		CookieManager.putSessionCookie("em_" + elementID, 'hide');
	},
	onLoad: function() {
		var keys = CookieManager.getKeys();
		$A(keys).each(function(cookieName){
			if(cookieName.startsWith('em_')) {
				key = cookieName.substring(3, cookieName.length);
				var state = CookieManager.getSessionCookie(cookieName);
				if(state == 'show') {
					ElementManager.showElement(key);
				} 
				if(state == 'hide') {
					ElementManager.hideElement(key);
				} 
			}	
		});
	},
	toggleElement: function(elementID) {
		Element.toggle($(elementID));
	}
};

var StringUtils = {
	hasText: function(elementID) {
		var ele = $(elementID);
		if(!ele) {
			return false;
		}
		if(!ele.value) {
			return false;
		}
		return (ele.value.trim().length != 0);
	},
	hasStopWord: function(elementID, stopWord) {
		if(!this.hasText(elementID)) {
			return false;
		}
		return $(elementID).value.indexOf(stopWord) != -1;
	},
	getLength: function(elementID) {
		if(!this.hasText(elementID)) {
			return -1;
		}
		return $(elementID).value.length;
	}
}

var URLUtils = {
	httpsScheme: 'https://',
	httpScheme: 'http://',
	checkScheme: function(urlToCheck) {
		var currentURL = document.URL;
		var retVal = urlToCheck;
		if(currentURL.startsWith(this.httpsScheme) && urlToCheck.startsWith(this.httpScheme)) {
			retVal = this.httpsScheme + urlToCheck.substring(this.httpScheme.length);
		}
		if(currentURL.startsWith(this.httpScheme) && urlToCheck.startsWith(this.httpsScheme)) {
			retVal = this.httpScheme + urlToCheck.substring(this.httpsScheme.length);
		}
		return retVal;
	},
	isInternalLink: function(linkSrc) {
		var hostName = top.location.host;
		if(!linkSrc || linkSrc.trim().length == 0) {
			return false;
		}
		return  linkSrc.indexOf(hostName) != -1;
	}
}

var FieldUtils = {
	toInt: function(fieldValue) {
		return parseInt(fieldValue, 10);
	},
	toFloat: function(fieldValue) {
		return parseFloat(fieldValue, 10);
	},
	hasValue: function(elementID) {
		return StringUtils.hasText(elementID);
	},
	setValue: function(elementID, value) {
		$(elementID).value = value;
	},
	getValue: function(elementID) {
		return $(elementID).value;
	},
	setInt: function(elementID) {
		$(elementID).value = this.toInt($(elementID).value);
	},
	setFloat: function(elementID) {
		$(elementID).value = this.toFloat($(elementID).value);
	},
	isNumeric: function(elementID) {
		var val = $(elementID).value;
		return !isNaN(val);
	},
	checkNumeric: function(elementID, alertMessage) {
		if(!this.isNumeric(elementID)) {
			alert(alertMessage);
			this.setValue(elementID,'');
			return false;
		}
		return true;
	},
	checkZipCode: function(elementID) {
		if(!this.hasValue(elementID)) {
			return;
		}
		var val = $(elementID).value;
		$(elementID).value = val.replace(/\D/g,""); //Ersetze alle Alphas durch NICHTS
		val = $(elementID).value;
		if(val.length != 5) {
			alert("Bitte geben Sie eine gueltige 5-Stellige Postleitzahl an");
			return false;
		}
		return true;
	}
}

var CaptchaManager = {
	reloadCaptcha: function(elementID, requestURL) {
		var reload = new Date();
		reload = "?"+reload.getTime()
		$(elementID).src=requestURL + reload;
	}
}

AdImageSlider = Class.create();
AdImageSlider.prototype = {
	initialize: function(elementID, interval) {
		this.pictures = [];
		this.pictureIndex = -1;
		this.elementID = elementID;
		this.interval = interval;
	},
	add: function (image, link) {
		var pic = new AdImageSlider.Picture(image, link);
		this.pictures.push(pic);
	}, 
	showPictures: function() {
		var pic = this.getNextPicture();
		this.displayPicture(pic);
	},
	getNextPicture: function() {
		this.pictureIndex++;
		if(this.pictureIndex >= this.pictures.length) {
			this.pictureIndex = 0;
		}
		return this.pictures[this.pictureIndex];
	},
	displayPicture: function(picture) {
		var el = $(this.elementID);
		$A(el.childNodes).each(function(node) { el.removeChild(node) });
		$A(picture.getElement().childNodes).each(function(node) { el.appendChild(node) });
	}

}

AdImageSlider.Picture = Class.create();
AdImageSlider.Picture.prototype = {
  initialize: function(src, link, options) {
    this.options = options || {};
    this.setup(src, link);
    this.html = '';
  },
  setup: function(src, link) {
    var element = document.createElement('span');
    var imgElement = document.createElement('img');
    imgElement.src = src;
    if(!link || link.trim().length == 0) {
	    element.appendChild(imgElement);
    } else {
	var anchor = document.createElement('a');
	anchor.href = link;
	//Externe Links 
	if(!URLUtils.isInternalLink(link)) {
		anchor.target='_blank';
	}
	anchor.appendChild(imgElement);
	element.appendChild(anchor);
    }
    this.element = element;
  },
  getElement: function() {
    return this.element.cloneNode(true);
  }
}


/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
	
Thank you!
	
Updated:	April, 6th 2006, Using iframe in IE in order to make the tooltip cover select boxes.
	
www.dhtmlgoodies.com
Alf Magne Kalleland
	
************************************************************************************************************/	
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 showTooltip(e,tooltipTxt) {
		
	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.style.display='none';
	dhtmlgoodies_tooltipShadow.style.display='none';		
	if(tooltip_is_msie)dhtmlgoodies_iframe.style.display='none';		
}


