function bookmarkOver(text) {
	if (text == '') {
		text = '&nbsp;';
	} else {
		text='&nbsp;<strong>'+text+'</strong>';
	}
	return true;
	/*document.getElementById('bookmarkText').innerHTML=text;*/
}


function bookmarkGo(gotoURL) {
	sburl=encodeURIComponent(location.href);
	sbtitle=encodeURIComponent(document.title);
	switch(gotoURL) {		
		case 'delicious':
			window.open('http://del.icio.us/post?url='+sburl+'&title='+sbtitle);
			break;
		case 'wong':
			window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+sburl+'&bm_description='+sbtitle);
			break;
		case 'blinkList':
			window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+sburl+'&Title='+sbtitle);
			break;
		case 'yahoo':
			window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+sburl+'&t='+sbtitle);
			break;
		case 'yigg':
			window.open('http://yigg.de/neu?exturl='+sburl+'&exttitle='+sbtitle);
			break;	
		case 'furl':
			window.open('http://www.furl.net/storeIt.jsp?u='+sburl+'&t='+sbtitle);
			break;
		case 'oneview':
			window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+sburl+'&title='+sbtitle);			
			break;
		case 'folkd':
			window.open('http://www.folkd.com/submit/page/'+sburl);
			break;
		case 'linkarena':	
			window.open('http://linkarena.com/bookmarks/addlink/?url='+sburl+'&title='+sbtitle+'&desc=&tags=');
			break;
		case 'google': 		
			window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+sburl+'&title='+sbtitle);
			break;
		case 'webnews': 		
			window.open('http://www.webnews.de/einstellen?url='+sburl+'&title='+sbtitle);
			break;
	}
	return false;
}

/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}




/*function displayCard(){
	cardElement = document.getElementById("UserCard");
	if (cardElement && doShow){
		cardElement.style.display='block';
	}
}

function showUserCard(username){
	cardElement = document.getElementById("UserCard");
	if (username != ''){
		new Ajax.Request('/user/show_user_card/'+username, {asynchronous:false, evalScripts:true});	
		doShow = true;
		setUserCard(cardElement);
	}
}

function setUserCard(node) {
	var x,y;
	
	if(window.innerWidth) {
		x = (window.pageXOffset+window.innerWidth);
		y = (window.pageYOffset+window.innerHeight);
	}
	else {
		x = (document.body.scrollLeft+document.body.offsetWidth);
		y = (document.body.scrollTop+document.body.offsetHeight);
	}
	
	node.style.top = ((y-node.offsetHeight)/2)+'px';
	node.style.left = ((x-node.offsetWidth)/2)+'px';
	displayCard();
}*/



var showUsername = '';
var uc = false;
var ct = false;
var inCard = false;

function activateCard(username){
	if (ct) clearTimeout(ct);
	cardElement = document.getElementById("UserCard");
	if (showUsername != username){
		if (uc) clearTimeout(uc);
		cardElement.style.display='none';
		showUsername = username;
		uc = setTimeout('getUserCard()',450);
	}
}




function deactivateCard(){
	if (uc) clearTimeout(uc);
	ct = setTimeout('hideCard()',1000);
}

function hideCard(){	
	if (!inCard){
		cardElement = document.getElementById("UserCard");
		cardElement.style.display='none';
		showUsername='';
	}
}


function getUserCard(){
	cardElement = document.getElementById("UserCard");
	username = showUsername;
	if (username != ''){
		new Ajax.Request('/user/show_user_card/'+username, {asynchronous:false, evalScripts:true});	
	}
	if (username == showUsername) displayCard();
}

function displayCard(){
	cardElement = document.getElementById("UserCard");
	screenHeight=window.innerHeight?window.innerHeight:screen.height;
	screenWidth=window.innerWidth?window.innerWidth:document.body.clientWidth;
	posX=mouseX>(screenWidth/2)?mouseX-450:mouseX;
	posY=mouseY>(screenHeight/2)?mouseY-200:mouseY;
	cardElement.style.left=posX+"px";
	cardElement.style.top=posY+"px";
	cardElement.style.display='block';
}

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var mouseX = 0;
var mouseY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
mouseX = event.clientX + document.body.scrollLeft;
mouseY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
mouseX = e.pageX;
mouseY = e.pageY;
}  
if (mouseX < 0){mouseX = 0;}
if (mouseY < 0){mouseY = 0;}  
return true;
}



var ActiveNavi = 0;

function switchNavi(element, nr){
	element.className='active';
	old_navi = document.getElementById('subnavigation_'+ActiveNavi);
	if (old_navi){
		old_main = document.getElementById('main_nav_link_'+ActiveNavi);
		old_navi.style.display = 'none';
		if (old_main){
			old_main.className='inactive';
		}
	}
	new_navi = document.getElementById('subnavigation_'+nr);
	if (new_navi){
		new_navi.style.display = 'block';
		ActiveNavi = nr;
	}
	else{
		ActiveNavi = 0;
	}
}

function set_active_navigation(nr){
	ActiveNavi = nr;
}

function init_chat_reload(){
	setTimeout('reload_chat()','5000');
}

function reload_chat(){
	new Ajax.Updater('chat_container', '/chat/reload', {asynchronous:false, evalScripts:true}); 
	init_chat_reload()
	return false;
}










	