var ditTal;
var timeHandle;
var popup  = window.createPopup();
var popupBody = popup.document.body;
var tekst = "";


function fbs_click() {
u=location.href;t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}


function popbesked(input) {

input=input+"";
len = input.length;
type = input.substring(0,1);

if (type==0) {tekst=input.substring(2,len);} 
if (type==1) {tekst="Der er aktivitet på chatten !";}
if (type==2) {tekst="Du har modtaget en privat chatbesked";}
if (type==3) {tekst="Et eller flere af dine indlæg er besvaret !";}
if (type==4) {tekst="Antal nye indlæg siden sidste login: "+input.substring(2,len);}


popupBody.innerHTML = '<div style="height:61px; width:320px; padding:5px; background:#4294CE; color:white; border: 1px solid black;"><table border=0 cellspacing=0 width=100% height=100% bgcolor=#4294CE><tr><td width=100% valign=top><font color="#FFFFFF" face="Arial" size="1">Besked fra Golf2.dk:</font></td></tr><tr><td width=100%><p align=center valign="middle"><font color=#FFFFFF face=Arial size=2><b>'+tekst+'</b></font></td></tr></center><tr><td width=100% valign=bottom><p align=right><img border=0 src=gfx/logolille.gif></td></tr></table>';


if (type==2) {
popupBody.innerHTML = '<div style="height:61px; width:320px; padding:5px; background:#00FF00; color:white; border: 1px solid black;"><table border=0 cellspacing=0 width=100% height=100% bgcolor=#00FF00><tr><td width=100% valign=top><font color="#FFFFFF" face="Arial" size="1">Besked fra Golf2.dk:</font></td></tr><tr><td width=100%><p align=center valign="middle"><font color=#FFFFFF face=Arial size=2><b>'+tekst+'</b></font></td></tr></center><tr><td width=100% valign=bottom><p align=right><img border=0 src=gfx/logolille.gif></td></tr></table>';
}

clearTimeout( timeHandle );
ditTal = 1;
if (tekst != "") {visBesked();}
};




function visBesked() {
    ditTal += 1;
    popup.show(screen.availWidth-320,screen.availHeight-ditTal,320,ditTal);
    if ( ditTal <= 60 ) {timeHandle = setTimeout( "visBesked()", 20 );};
    else
      { 
        clearTimeout( timeHandle );
        ditTal=1;
        timeHandle = setTimeout( "lukBesked()", 10000 );
      };
};




function lukBesked() {
    popup.show(screen.availWidth-100,screen.availHeight-ditTal,300,0);
};


