function bookmark()
{
        window.external.AddFavorite('http://www.kejelhejel.de','Die Kejelhejel');
}

function openwindow(url, name, boxwidth, boxheight, docenter)
{
        var wwidth = boxwidth;
        var wheight = boxheight;
        var wleft = (screen.width - wwidth) / 2;
        var wtop = (screen.height - wheight) / 3;

        winprops = 'height='+wheight+',width='+wwidth;

        if (docenter)
                winprops = winprops+',top='+wtop+',left='+wleft;

        window.open (url, name,"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,"+winprops);
}

function mOvr(src, clrOver)
{
                src.style.cursor = 'hand';
                src.style.backgroundColor = clrOver;
                src.bgColor = clrOver;
}

function mOut(src, clrOut)
{
                src.style.cursor = 'default';
                src.style.backgroundColor = clrOut;
}

function mClk(src)
{
        if(event.srcElement.tagName=='TD')
                src.children.tags('A')[0].click();
}

function navclk(src)
{
        document.location.href = src;
}

function setsmilie(formname, field, chars)
{
    var f = eval("document."+formname+"."+field);
    f.value += chars + " ";
    f.focus();
}

function changeImage(name, src)
{
        document.images[name].src = src;
}

function checkMessage()
{
        document.all.messages.innerHTML = "";

        var htmlString = '<object data="checkMessage.php" type="text/html" width="0" height="0"></object>';
        document.all.messages.innerHTML = htmlString;

        setTimeout ("checkMessage()", 60 * 1000);
}

function showUserProfil(uid)
{
        openwindow("user.php?op=showUserdetails&uid="+uid+"&raw=2","Userdetails",500,350,true);
}

function insertTags(formname, field, tag)
{
	var text="";
	var src="";

	//var f = eval("document."+formname+"."+field);
	var f = eval("document."+formname+".elements["+field+"]");
	
	if(tag == "br")
	{
		f.value += "<br>";
	}
	else if(tag == "image")
	{
		while(src == "")
		{
			src = prompt("Gib hier die Bildquelle an:", "images\/");
		}
		f.value += " <img src=\""+src+"\" border=\"0\">"+text+" ";
	}
	else if(tag == "link")
	{
		var target="";
		while(text == "")
		{
			text = prompt("Gib hier den Namen des Links an:", "");
		}
		while(src == "")
		{
			src = prompt("Gib hier die URL des Link an:", "http:\/\/");
		}
		while(target == "")
		{
			target = prompt("Target (_self, _blank)?:", "_blank");
		}
		f.value += " <a href=\""+src+"\" target=\""+target+"\">"+text+"<\/a> ";
	}
	else
	{
		while(text == "")
		{
			text = prompt("Gib hier den Text ein, der formatiert werden soll:", "");
		}
		f.value += " <"+tag+">"+text+"<\/"+tag+"> ";
	}
}

function selectAllMessages(theform)
{
    if (theform)
    {
		var len = theform.msgID.length;
		var c = 0;
		
		if (theform.checkall.checked)
		    c = 1;

		if (typeof(len) == "undefined")
		{
		    theform.msgID.checked = c;
		}		
		else
       	{
            for (var i = 0; i < len; i++)
  	            theform.msgID[i].checked = c;
		}
    }
}

function showImage(Path)
{
	if(Path != "")
	{
		var url = "showImage.php?ImagePath=" + Path;
		openwindow(url,"Image",200,200,false);	
	}
}
