
var fireOn = Window.ie ? 'load' : 'domready';

var switchColor = new Class({
	object: null,
	color: 'blue',
	
	initialize: function(object){
		this.object = object;
		this.changeColor.periodical(4000, this);
	},
	
	changeColor: function(){
		if(this.color == 'blue'){
			this.object.setStyle('color', '#ffffff');
			this.color = 'red';
		}else{
			this.object.setStyle('color', '#d50714');
			this.color = 'blue';
		}
	}
});

window.addEvent(fireOn, function(){
	
	/* Functie om de berichten te laten flikkeren als het er meer zijn
	 */
	if($('amountMsg')){
		var amount = $('amountMsg').innerHTML;
		
		if(amount > 0){
			new switchColor($('msgid'));
		}
	}	

	if($('amountVip')){
		var amount = $('amountVip').innerHTML;
		
		if(amount < 2){
			new switchColor($('vipid'));
		}
	}
	
});

var Timer = new Class({
	time: null,
	
	initialize: function(timeString){
		this.currenttime = timeString;
		this.serverdate = new Date(timeString);
		this.displaytime.periodical(1000, this);
	},
	
	padlength: function(what){ 
		var output = (what.toString().length ==1 )? "0"+what : what 
		return output;
	},
	
	displaytime: function(){
		this.serverdate.setSeconds(this.serverdate.getSeconds()+1) 
		var timestring = this.padlength(this.serverdate.getHours())+ ":" + this.padlength(this.serverdate.getMinutes()) + ":"+this.padlength(this.serverdate.getSeconds());
		$('klok').innerHTML = timestring;
	} 

});

/* oude brol */

function loguit()
{
	var checkConfirm = confirm("Weet u het zeker om af te melden?");
	if(checkConfirm == true)
	{
		var goTo = "/logout.php";
		window.location = goTo;
	}
}


function AddText(text) {
	 document.bericht.bericht.value += text;
}

function happy() {
	AddTxt=" :D";
	AddText(AddTxt);
}

function smile() {
	AddTxt=" :)";
	AddText(AddTxt);
}

function sad() {
	AddTxt=" :(";
	AddText(AddTxt);
}

function surprised() {
	AddTxt=" :o";
	AddText(AddTxt);
}

function shock(){
	AddTxt=" :shock:";
	AddText(AddTxt);
}

function confused() {
	AddTxt=" :?";
	AddText(AddTxt);
}

function cool() {
	AddTxt=" 8)";
	AddText(AddTxt);
}

function lol() {
	AddTxt=" :lol:";
	AddText(AddTxt);
}

function mad() {
	AddTxt=" :x";
	AddText(AddTxt);
}

function razz() {
	AddTxt=" :P";
	AddText(AddTxt);
}

function embarassed() {
	AddTxt=" :$";
	AddText(AddTxt);
}

function crying() {
	AddTxt=" :*( ";
	AddText(AddTxt);
}

function evil() {
	AddTxt=" :evil:";
	AddText(AddTxt);
}

function twisted() {
	AddTxt=" :twisted:";
	AddText(AddTxt);
}

function roll() {
	AddTxt=" :roll:";
	AddText(AddTxt);
}

function wink() {
	AddTxt=" ;)";
	AddText(AddTxt);
}

function exclaim() {
        AddTxt=" :!:";
        AddText(AddTxt);
}
function question() {
        AddTxt=" :question:";
        AddText(AddTxt);
}
function idea() {
        AddTxt=" :idea:";
        AddText(AddTxt);
}

function gangster() {
        AddTxt=" :gangster:";
        AddText(AddTxt);
}
function love() {
        AddTxt=" :love:";
        AddText(AddTxt);
}

function kiss() {
        AddTxt=" :kiss:";
        AddText(AddTxt);
}

function del_topic(forumid)
{
	var del = confirm("Weet je zeker dat je deze topic wilt verwijderen??");
	if (del == true){
		var loc="forum.php?del=" + forumid;
		window.location=loc;
	}
}	

function wijzig(forumid)
{
	var del = confirm("Weet je zeker dat je je topic wilt wijzigen??");
	if (del == true){
		var loc="forum_wijzig.php?wijzig=" + forumid;
		window.location=loc;
	}
}	

function verwijderreactie(reactieid)
{
	var del = confirm("Weet je zeker dat je je reactie wilt verwijderen??");
	if (del == true){
		var loc="forum_verwijderr.php?id=" + reactieid;
		window.location=loc;
	}
}	


function showEmoticons(){
	if((navigator.appName == "Netscape" && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == "Opera" && navigator.appVersion.charAt(0) >= 4)) {
	
	
		document.write("<a href=javascript:happy()><img src='/design/images/smilies/icon_biggrin.gif' align=bottom alt='Very Happy' border='0'></a> ");
		document.write("<a href=javascript:smile()><img src='/design/images/smilies/icon_smile.gif' align=bottom alt='Smile' border='0'></a> ");
		document.write("<a href=javascript:love()><img src='/design/images/smilies/love.gif' align=bottom alt='love' border='0'></a> ");
		document.write("<a href=javascript:kiss()><img src='/design/images/smilies/kiss.gif' align=bottom alt='love' border='0'></a> ");
		document.write("<a href=javascript:sad()><img src='/design/images/smilies/icon_sad.gif' align=bottom alt='Sad' border='0'></a> ");
		document.write("<a href=javascript:surprised()><img src='/design/images/smilies/icon_surprised.gif' align=bottom alt='Surprised' border='0'></a> ");
		document.write("<a href=javascript:shock()><img src='/design/images/smilies/icon_eek.gif' align=bottom alt='Shocked' border='0'></a> ");
		document.write("<a href=javascript:confused()><img src='/design/images/smilies/icon_confused.gif'' align=bottom alt='Confused' border='0'></a> ");
		document.write("<a href=javascript:cool()><img src='/design/images/smilies/icon_cool.gif' align=bottom alt='Cool' border='0'></a> ");
		document.write("<a href=javascript:lol()><img src='/design/images/smilies/icon_lol.gif' align=bottom alt='Laughing' border='0'></a> ");
		document.write("<a href=javascript:mad()><img src='/design/images/smilies/icon_mad.gif' align=bottom alt='Mad' border='0'></a> ");
		document.write("<a href=javascript:razz()><img src='/design/images/smilies/icon_razz.gif' align=bottom alt='Razz' border='0'></a> ");
		document.write("<a href=javascript:embarassed()><img src='/design/images/smilies/icon_redface.gif' align=bottom alt='Embarassed' border='0'></a> ");
		document.write("<a href=javascript:crying()><img src='/design/images/smilies/icon_cry.gif' align=bottom alt='Crying / Sad' border='0'></a> ");
		document.write("<a href=javascript:evil()><img src='/design/images/smilies/icon_evil.gif' align=bottom alt='Evil' border='0'></a> ");
		document.write("<a href=javascript:twisted()><img src='/design/images/smilies/icon_twisted.gif' align=bottom alt='Twisted Evil' border='0'></a> ");
		document.write("<a href=javascript:roll()><img src='/design/images/smilies/icon_rolleyes.gif' align=bottom alt='Rolling Eyes' border='0'></a> ");
	
		document.write("<a href=javascript:wink()><img src='/design/images/smilies/icon_wink.gif' align=bottom alt='Wink' border='0'></a> ");
		document.write("<a href=javascript:exclaim()><img src='/design/images/smilies/icon_exclaim.gif' align=bottom alt='Exclamation' border='0'></a> ");
		document.write("<a href=javascript:question()><img src='/design/images/smilies/icon_question.gif' align=bottom alt='Question' border='0'></a> ");
		document.write("<a href=javascript:idea()><img src='/design/images/smilies/icon_idea.gif' align=bottom alt='Idea' border='0'></a> ");
		document.write("<a href=javascript:gangster()><img src='/design/images/smilies/g_shoot.gif' align=bottom alt='gangster' border='0'></a> ");
	
	}	
}