/*
var logout = function() { 
var xhr = new XMLHttpRequest; 
xhr.open("GET","/logout/",false); xhr.send(null); 
}; 

window.onload = function() { 

var winNumber = parseInt(IGS.Bakery.getCookie("winNumber"), 10) || 0; IGS.Bakery.setCookie("winNumber", winNumber + 1); 
}; 

window.onunload = function() { 

var winNumber = parseInt(IGS.Bakery.getCookie("winNumber"), 10) || 0; IGS.Bakery.setCookie("winNumber", winNumber - 1); 

	if (winNumber === 1) { logout(); } };
	
	var showCookies = function() { 
	alert(IGS.Bakery.getCookie("winNumber")); }; 
    
*/

$(function() {
  var moveLeft = 20;
  var moveDown = 10;

  $('a#show-trigger').hover(function(e) {
    $('div#show-pop-up').show();
      //.css('top', e.pageY + moveDown)
      //.css('left', e.pageX + moveLeft)
      //.appendTo('body');
  }, function() {
    $('div#show-pop-up').hide();
  });

  $('a#show-trigger').mousemove(function(e) {
    $("div#show-pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
  });


  $('a#nextshowpopup').hover(function(e) {
    $('div#nextshowpopup').show();
      //.css('top', e.pageY + moveDown)
      //.css('left', e.pageX + moveLeft)
      //.appendTo('body');
  }, function() {
    $('div#nextshowpopup').hide();
  });

  $('a#nextshowpopup').mousemove(function(e) {
    $("div#nextshowpopup").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
  });

});

$(document).ready(function() {					   	
	$(".tab_content").hide();
	$("ul.tabs li:first").addClass("active").show();
	$(".tab_content:first").show();

	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active");
		$(this).addClass("active");
		$(".tab_content").hide();
		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn();
		return false;
	});
});

function Show(element){	  		
	$('#'+element+'').show();	
}	

function Hide(element){
	$('#'+element+'').hide();	
}

function ShowFadeId(element){
	$('#'+element+'').fadeIn('slow', function() { } );
}

function ShowFadeOut(element){
	$('#'+element+'').fadeOut('slow', function() { } );
}

function remove(element){
	$('#'+element+'').remove();
}

function GoTo(url)
{
	self.location.href = url;
}

function OpenPopup(url,width,height) {
 fenster = window.open(url, "flash", "width="+width+",height="+height+",resizable=yes");
 fenster.focus();
 return false;
}

function popupwmp (url) {
 fenster = window.open(url, "WMP", "width=800,height=600,resizable=yes");
 fenster.focus();
 return false;
}

function popupflash (url) {
 fenster = window.open(url, "flash", "width=800,height=600,resizable=yes");
 fenster.focus();
 return false;
}

var win=null;
onerror = stopError;
function stopError(){
	return true;
}

function openpokePopup(){
	myleft=0;
	mytop=0;
	settings="width=500,height=150,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("/poke/","BassControlFMPoke",settings);
	win.focus();
}

$(function() {
 $('a[@rel*=lightbox]').lightBox();
});


/*Status*/

function open_status() {
		document.getElementById('status_open').style.visibility = "visible";
		status();	
	}
function hide_status() {
		document.getElementById('status_open').style.visibility = "hidden";
		status();
	}
	
	/*Status UPDATE*/
	
function update_online() {
	$.post("/index.php?s=status&mode=ststusonline", { ststusonline: "1"} );
	document.getElementById('status_open').style.visibility = "hidden";
	status();
    }

function update_offline() {
	$.post("/index.php?s=status&mode=ststusoffline", { ststusoffline: "2"} );
	document.getElementById('status_open').style.visibility = "hidden";
	status();
	}
    
function update_afk() {
	$.post("/index.php?s=status&mode=ststusafk", { ststusafk: "3"} );
	document.getElementById('status_open').style.visibility = "hidden";
	status();
	}
    
function update_unsichtbar() {
	$.post("/index.php?s=status&mode=ststusunsichtbar", { ststusunsichtbar: "4"} );
	document.getElementById('status_open').style.visibility = "hidden";
	status();
	} 
		
/*Status ENDE*/
	
    $('#subheader_close').click(function() {
  $('#subheader_all').slideToggle('slow', function() {
    
  });
});


/*Chat*/

function move_chat(){
	var wid = document.getElementById('chat_hidden').style.width=window.innerWidth-235;
	var hei = document.getElementById('chat_hidden').style.top=window.innerHeight-70;
	document.getElementById('hei').textContent = "Hei: "+hei;
	document.getElementById('wid').textContent = "Wid: "+wid;
	document.getElementById('chat_hidden').style.top=hei+"px";
	document.getElementById('chat_hidden').style.left=wid+"px";
	var wid = document.getElementById('chat_open').style.width=window.innerWidth-235;
	var hei = document.getElementById('chat_open').style.top=window.innerHeight-415;
	document.getElementById('chat_open').style.top=hei+"px";
	document.getElementById('chat_open').style.left=wid+"px";
}
function open_chat() {
		document.getElementById('chat_open').style.visibility = "visible";
		move_chat();
	}
function hide_chat() {
		document.getElementById('chat_open').style.visibility = "hidden";
		move_chat();
	}
/*Chat ENDE*/	
