function getPosition(element) {
	var elem =element, tagname="", x=0, y=0;
	while (typeof(elem) == "object" && typeof(elem.tagName) != "undefined") {
		y += elem.offsetTop;
		x += elem.offsetLeft;
		tagname = elem.tagName.toUpperCase();

		if (tagname == "BODY") 
			elem = 0;

		if (typeof(elem) == "object" && typeof(elem.offsetParent) == "object")
			elem = elem.offsetParent;
	}

	position = new Object();
	position.x = x;
	position.y = y;
	return position;
}

function showHelp(flashid, xOffset, yOffset, headline, text) {
	
	yOffset += 5;
	
	var flash = document.getElementById(flashid);			
	var helptip = document.getElementById('helptip');
	if (!flash || !helptip) return;
	
	var position = getPosition(flash);
	
	helptip.innerHTML = '';			
	helptip.innerHTML = '<div><h1 class="clearfix"><span>' + headline + '</span><a class="closetip" href="javascript:hideHelp();"><span>Schließen</span></a></h1><p>' + text + '</p></div>';			
	 
	var helptipWidth = 200;		
		
	var screenWidth;
	if (self.innerHeight) { // all except Explorer
		screenWidth = self.innerWidth;		 
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		screenWidth = document.documentElement.clientWidth;		
	} else if (document.body) { // other Explorers
		screenWidth = document.body.clientWidth;		
	}
	
	var offsetLeft = position.x + xOffset - (helptipWidth / 2);
	if (offsetLeft + helptipWidth > screenWidth - 20) {
		offsetLeft = screenWidth - helptipWidth - 20;
		helptip.style.backgroundPosition = (position.x+xOffset-offsetLeft-5)+"px 0px";	
	} else {
		helptip.style.backgroundPosition = "95px 0px";	
	}

	helptip.style.left = offsetLeft + "px";
	helptip.style.top = (position.y + yOffset) +"px";
	helptip.style.display = 'block';	;						
}	

function hideHelp() {
	var helptip = document.getElementById('helptip');
	if (helptip) {				
		helptip.style.display = 'none';				
	}
}

function doLogon(username, password) {
	document.forms['logonform'].username.value = username;
	document.forms['logonform'].password.value = password;
	document.forms['logonform'].submit();
}

function doSearch(query) {
	document.forms['searchform'].search.value = query;
	document.forms['searchform'].submit();
}

function doShopSearch(country, shop, article) {
	document.forms['shopform'].country.value = country;
	document.forms['shopform'].shop.value = shop;
	document.forms['shopform'].article.value = article;
	document.forms['shopform'].submit();
}

function bind(obj, method) {
	return function() { return method.apply(obj, arguments); }
}

function jump(id) {
	if(id != 'false') {
		window.location.href = id;
	}
}
function anchorJump(id) {
	if(id != 'false') { 
		window.location.hash = id;
	} 
	else {
		void(0);
	}
 }
function hiliteImage(id,newImg) {
	myImage = document.getElementById(id);
	myImage.src = newImg;
}
