/****************************************************
 * File:		optimize.js
 * Author:		zero (ws1)
 * Created:		25-07-2004
 * Description:	Keeps our nice optimizations .js
 *              functions.
 ***************************************************/

 var d = document;
 var comments = 1;
 var URL='http://www.counter-strike.nl/';

/*
 * Headline (menu) functions:
 */

 function headlineheadleft(text) {
	 d.write('<tr><td class="headlineheadleft"><img src="'+URL+'gfx/menu/headlineheaddot.gif" alt=""> '+text+'</td></tr>');
 }

 function headlineheadright(text) {
	 d.write('<tr><td class="headlineheadright">'+text+' <img src="'+URL+'gfx/menu/headlineheaddot.gif" alt=""></td></tr>');
 }

 function headlinenormal(text) {
	 d.write('<tr><td class="headline">&nbsp;&nbsp;<img src="'+URL+'gfx/misc/driehoek.gif">&nbsp;'+text+'</td></tr>');
 }

 function headlinenews(id, time, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="'+title+'"><td>'+time+'</td><td><div class="newsheadlinenowrap"><a href="'+URL+'news/'+id+'">'+title+'</a></div></td></tr></table></td></tr>');
 }

 function headlinearticle(id, date, cat, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="'+((cat != '') ? cat+': ' : '')+title+'"><td>'+date+'</td><td><div class="newsheadlinenowrap"><a href="'+URL+'article/'+id+'">'+((cat != '') ? cat+': ' : '')+title+'</a></div></td></tr></table></td></tr>');
 }

 function headlinecomment(id, commentid, time, by, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="Laatste reactie op \''+title+'\' door '+by+'"><td>'+time+'</td><td><div class="newsheadlinenowrap"><a href="'+URL+'news/'+id+'#last">'+title+'</a></div></td></tr></table></td></tr>');
 }

function headlinethread(id, time, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="'+title+'"><td>'+time+'</td><td><div class="newsheadlinenowrap"><a href="http://forum.counter-strike.nl/showthread.php?t='+id+'" target="_blank">'+title+'</a></div></td></tr></table></td></tr>');
 }

 function headlinefile(id, date, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="'+title+'"><td>'+date+'</td><td><div class="newsheadlinenowrap"><a href="'+URL+'file/'+id+'">'+title+'</a></div></td></tr></table></td></tr>');
 }
 
 function headlineservers(ip, players, title, steamapp) {
	 d.write('<tr><td class="headlineservers"><table class="serversheadline" cellspacing="0"><tr><td>'+players+'<br>IP:</td><td><div class="newsheadlinenowrap"><a href=\'steam: \"-applaunch '+steamapp+'\" +connect '+ip+'\'>'+title+'</a><br>'+ip+'</div></td></tr></table></td></tr>'); }
  
 function headlinepollquestion(question) {
	 d.write('<tr><td class="headlinebig">'+question+'</td></tr>');
 }

 function headlinepollitem(itemid, title) {
	 d.write('<tr><td class="headlinebig"><input type="radio" name="option" value="'+itemid+'" onClick="document.forms.poll.submit();" class="radiobutton"> '+title+'</td></tr>');
 }
 
 function headlinepollitemvoted(title, votes, useroption) {
 	if (useroption == 1)
 		d.write('<tr><td class="headlinebig"><font color="#808080">'+title+'</font> ('+votes+')</td></tr>');
	else
		d.write('<tr><td class="headlinebig">'+title+' ('+votes+')</td></tr>');
 }
 
 function headlinepollcomments(comments) {
 	d.write('<tr><td class="headlinebig"><a href="'+URL+'poll">'+comments+' comment');
 	if (comments != 1) d.write('s');
 	d.write('</td></tr>');
 }
 
 function headlinehltv(id, time, team1, team2, ip) {
	 d.write('<tr><td class="headlineservers"><table class="serversheadline" cellspacing="0"><tr><td>'+time+'<br>IP:</td><td><div class="newsheadlinenowrap"><a href="'+URL+'hltv/'+id+'">'+team1+' VS '+team2+'</a><br>'+ip+'</div></td></tr></table></td></tr>');
 }
 
 function headlinemember(id, date, title) {
	 d.write('<tr><td class="headline"><table class="newsheadline" cellspacing="0"><tr title="'+title+'"><td>'+date+'</td><td><div class="newsheadlinenowrap"><a href="'+URL+'user/'+id+'">'+title+'</a></div></td></tr></table></td></tr>');
 }

/*
 * Comment/poster functions:
 */
 
 function posted(userid, username, date, time) {
 	if (userid == 0)
 		d.write('Gepost op '+date+' - '+time+' ');
	else
		d.write('Gepost door <a class="normal" href="'+URL+'user/'+userid+'">'+username+'</a> - '+date+' - '+time+' ');
 }
 
 function posted_message(userid, username, date, time) {
 	if (userid == 0)
 		d.write('Verstuurd op '+date+' - '+time+' ');
	else
		d.write('Verstuurd door <a class="normal" href="'+URL+'user/'+userid+'">'+username+'</a> - '+date+' - '+time+' ');
 }
 
 function posted_send_message(userid, username, date, time) {
 	if (userid == 0)
 		d.write('Verstuurd op '+date+' - '+time+' ');
	else
		d.write('Verstuurd naar <a class="normal" href="'+URL+'user/'+userid+'">'+username+'</a> - '+date+' - '+time+' ');
 }

 function postedcomment(userid, username, date, time) {
 	if (userid == 0)
 		d.write('Gepost op '+date+' - '+time+' ');
	else
		d.write('Gepost door <b><a class="commentn" href="'+URL+'user/'+userid+'">'+username+'</a></b> - '+date+' - '+time+' ');
 }
 
 function source(sourcename,sourceurl,submitname,submituserid,newsid,admin) {
 	d.write('<h6>');
 	if (sourcename != '') {
		 if (sourceurl != '') {
			 d.write(' - Bron: <a href="'+sourceurl+'" target="_blank" class="normal">'+sourcename+'</a>');
		 } else {
			 d.write(' - Bron: '+sourcename);
		 }
	 }
	 if (submitname != '') {
		 if (submituserid != '') {
			 d.write('<br /> - Submitter: <a href="'+URL+'user/'+submituserid+'" class="normal">'+submitname+'</a>');
		 } else {
			 d.write('<br /> - Submitter: '+submitname);
		 }
	 }
	 if (admin == 1) {
	 	if (newsid != '') {
	 		d.write('<br /> - Admin: <a href="'+URL+'admincp/news/edit/'+newsid+'" class="normal">Edit</a> - <a href="'+URL+'admincp/news/delete/'+newsid+'" class="normal">Delete</a>');
	 	}
	 }
	 d.write('</h6>');
 } 	

 function comment(commentid, userid, username, date, time, text, edit, admin, loggedin, edittext) {
 	if (edittext != '') {
 		var text = text+'<br /><h6>'+edittext+'</h6>';
 	}
 	d.write('<a name="'+commentid+'" />');
 	d.write('<table class="commenttable" cellspacing="1">');
 	d.write('<tr><td class="commentby">');
 	postedcomment(userid, username, date, time, '', '', '', '');
 	if (userid == 0) {
		d.write('</td></tr><tr><td bgcolor="white"><div class="contentcomment">'+text+'<br /><hr size="1" color="#000" width="480"></div></td></tr>');
 	} else {
	       if (edit == 1) {
	       	  d.write('</td></tr><tr><td bgcolor="white"><div class="contentcomment">'+text+'<br><hr size="1" color="#000" width="480"></div><div align="right"><table border="0"><tr><td class="buttomcomment"><a class="buttonlink" href="'+URL+'editcomment/'+commentid+'">Edit</a></td><td class="buttomcomment"><a class="buttonlink" href="'+URL+'deletecomment/'+commentid+'">Delete</a></td><td class="buttomcomment"><a class="buttonlink" href="'+URL+'quote/'+commentid+'">Quote</a></td></tr></table></div></td></tr>');
		} else {
			d.write('</td></tr><tr><td bgcolor="white"><div class="contentcomment">'+text+'<br><hr size="1" color="#000" width="480"></div><div align="right"><table border="0"><tr><td class="buttomcomment"><a class="buttonlink" href="'+URL+'user/'+userid+'">Profile</a></td>');
			if (loggedin == 1) {
				d.write('<td class="buttomcomment"><a class="buttonlink" href="'+URL+'message/'+userid+'">Message</a></td><td class="buttomcomment"><a class="buttonlink" href="'+URL+'addfriend/'+userid+'">Add Friend</a></td><td class="buttomcomment"><a class="buttonlink" href="'+URL+'quote/'+commentid+'">Quote</a></td>');
			}
		  	if (admin == 1) {
		  		d.write('<td class="buttomcomment"><a class="buttonlink" href="'+URL+'editcomment/'+commentid+'">Edit</a></td><td class="buttomcomment"><a class="buttonlink" href="'+URL+'deletecomment/'+commentid+'">Delete</a></td></tr>');
		  	}
		  	d.write('</tr></table></div></td></tr>');
	        }
	}
	d.write('</table>');
	comments++;
 }
 
 function usernote(commentid, userid, username, date, time, text) {
 	d.write('<a name="'+commentid+'" />');
 	d.write('<table class="commenttable" cellspacing="0">');
 	d.write('<tr><td class="commentby">');
 	postedcomment(userid, username, date, time, '', '', '', '');
	d.write('</td></tr><tr><td bgcolor="white"><div class="contentcomment">'+text+'<br><hr size="1" color="#000" width="480"></div></td></tr>');
	d.write('</table>');
	comments++;
 }
 
/*
 * Frontpage functions:
 */ 
 function headlinefrontpage1(id, time, title, category_short, category_long, comments) {
	d.write('<tr bgcolor="#EFEFEF" title="'+title+'"><td class="imgcatagorie">');
	if (category_short == '') {
		d.write('&nbsp;');
	} else {
		d.write('<img src="'+URL+'gfx/frontpage/'+category_short+'.gif" alt="'+category_long+'">');
	}
	d.write('</td><td class="newsdate">'+time+'</td><td class="newstitle"><a href="'+URL+'news/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
 
 function headlinefrontpage2(id, time, title, category_short, category_long, comments) {
	d.write('<tr title="'+title+'"><td class="imgcatagorie">');
	if (category_short == '') {
		d.write('&nbsp;');
	} else {
		d.write('<img src="'+URL+'gfx/frontpage/'+category_short+'.gif" alt="'+category_long+'">');
	}
	d.write('</td><td class="newsdate">'+time+'</td><td class="newstitle"><a href="'+URL+'news/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
 
 function headlinepoll1(id, title, comments) {
	d.write('<tr bgcolor="#EFEFEF" title="'+title+'"><td class="newstitle"><a href="'+URL+'poll/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
 
 function headlinepoll2(id, title, comments) {
	d.write('<tr title="'+title+'"><td class="newstitle"><a href="'+URL+'poll/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
  
 function usersfrontpage(id, name, country, date) {
  	d.write('<tr><td class="usercountryfp"><img src="'+URL+'gfx/landen/'+country+'.gif"></td><td class="usernamefp"><h5><a href="'+URL+'user/'+id+'" class="news">'+name+'</a></td><td class="userdatefp"><h6>'+date+'</h6></td></tr>');
 }
 
 function useroftheday(id, nickname, country, name, clan, age, web) {
  	d.write('<tr><td><h5><b>Nickname:</b> '+nickname+'<br><b>Country:</b><img src="'+URL+'gfx/landen/'+country+'.gif"><br><b>Name:</b> '+name+'<br><b>Clan:</b> '+clan+'<br><b>Age:</b> '+age+'<br><b>Site:</b> <a href="'+web+'">Click</a></h5></td></tr>');
 }
 
 function featurefrontpage(id, title, text, imageurl, width, height) {
  	d.write('<table cellspacing="1" class="frontpagetables" height="150"><tr><td class="newstop">'+title+'</td></tr><tr><td class="featuretext" valign="top"><a href="'+URL+'feature/'+id+'" class="news"><img class="featureimage" border="0" align="right" src="');
	if (imageurl=="")
		d.write(URL+'gfx/misc/source.jpg');
	else
		d.write(imageurl+'" width="'+width+'" heigth="'+height);
	d.write('"></a>'+text+'</td></tr><tr><td valign="bottom"><a href="'+URL+'feature/'+id+'" class="news"><font class="readmore">Read More...</font></a></td></tr></table>');
 }
 
 function newsfrontpage(id, title, text, cat, comments) {
  	d.write('<tr><td border="0" width="100%"><table cellspacing="1" class="frontpagetables"><tr><td class="newstop" colspan="2">'+title+'</td></tr><tr><td class="newstextfrontpage">'+text+' </td><td class="newsimage">');
  	if (cat == "") {
  		d.write('<a href="'+URL+'news/'+id+'"><img src="'+URL+'gfx/cat/other.jpg" border="0"></a>');
  	} else {
  		d.write('<a href="'+URL+'news/'+id+'"><img src="'+URL+'gfx/cat/'+cat+'.jpg" border="0"></a>');
  	}
  	d.write('</td></tr><tr><td class="readmore"><a href="'+URL+'news/'+id+'" class="news">Read More...</a></td><td align="right" class="readmore">'+comments+' Comment');
  	if (comments != 1)
		d.write('s');
        d.write('</td></tr></table></td></tr>');
 }
 
 function useroftheday(id, nickname, name, age, birthday, city, country, clan, website, comments, registered, pic) {
 	d.write('<td class="info2">'+nickname+'<br>'+name+'<br>'+age+'<br>'+birthday+'<br>'+city+'<br><img src="'+URL+'gfx/landen/'+country+'.gif"><br>'+clan+'<br><a href="'+website+'">Click</a><br>'+comments+'<br>'+registered+'</td><td class="userpic"><img border="1" width="80" height="80" src="'+pic+'"></td></tr><tr><td class="newsmore" colspan="4"><div align="right"><a href="'+URL+'user/'+id+'" class="news">Profile</a> <a href="'+URL+'addfriend/'+id+'" class="news">Add Friend</a> <a href="'+URL+'/message/'+id+'" class="news">Message</a></div></td></tr>');
 }
  
 function lastanchor() {
 	d.write('<a name="last" />');
 }

/*
 * Misc functions
 */
 function printsmalltable(header1, header2, content, footer) {
 	d.write('<table cellspacing="0" class="contenttable"><tr><td class="newstop"><font color="#4980ad">'+header1+'</font> '+header2+'</td></tr><tr><td class="contentcsnl"><h7>'+content+'</h7></td></tr></table>');
 }
 
 function newsarchiveline1(id, time, title, categorie, comments) {
	d.write('<tr bgcolor="#EFEFEF" title="'+title+'"><td class="imgcatagorie"><img src="'+URL+'gfx/frontpage/'+categorie+'.gif"></td><td class="newsdate">'+time+'</td><td class="newstitle"><a href="'+URL+'news/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
 
 function newsarchiveline2(id, time, title, categorie, comments) {
	d.write('<tr title="'+title+'"><td class="imgcatagorie"><img src="'+URL+'gfx/frontpage/'+categorie+'.gif"></td><td class="newsdate">'+time+'</td><td class="newstitle"><a href="'+URL+'news/'+id+'" class="news">'+title+'</a><td class="newscomments"><i>'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</i></td></tr>');
 }
 
 function articlearchiveline(id, time, title, comments) {
	d.write('<tr title="'+title+'"><td class="newsdate">'+time+'</td><td class="newstitle"><a href="'+URL+'article/'+id+'" class="news">'+title+'</a><td class="newscomments">'+comments+' comment');
	if (comments != 1)
		d.write('s');
	d.write('</td></tr>');
 }
 
 function addreactioncode(code, spaces) {
 	if (spaces == 1)
 		d.reactionform.comments.value += ' '+code+' ';
 	else 
 		d.reactionform.comments.value += code;
 	d.reactionform.comments.focus();
 }


 function namedlink() {
 	var linktext = prompt("Beschrijving (optioneel):");
	var linkurl = prompt("Vul de URL van de link in", "http://");
	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != "")) {
			d.reactionform.comments.value += "[url=" + linkurl + "]" + linktext + "[/url]";
			d.reactionform.comments.focus();
		} else {
			d.reactionform.comments.value += "[url]" + linkurl + "[/url]";
			d.reactionform.comments.focus();
		}
	}
 }

 function addreactionnews(code, spaces) {
 	if (spaces == 1)
 		d.reactionform.text.value += ' '+code+' ';
 	else 
 		d.reactionform.text.value += code;
 	d.reactionform.text.focus();
 }

 function namedlinknews() {
 	var linktext = prompt("Beschrijving (optioneel):");
	var linkurl = prompt("Vul de URL van de link in", "http://");
	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != "")) {
			d.reactionform.text.value += "[url=" + linkurl + "]" + linktext + "[/url]";
			d.reactionform.text.focus();
		} else {
			d.reactionform.text.value += "[url]" + linkurl + "[/url]";
			d.reactionform.text.focus();
		}
	}
 }

 function listflag(id, name, width, height) {
	win = window.open('about:blank', 'vlaggen', 'width='+(width+30)+', height='+(height+30));
	d = win.document;
	d.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	d.write('<html><head><title>Vlaggen</title><link rel="stylesheet" href="'+URL+'lib/css/frontpage.css" type="text/css"></head>');
	d.write('<body bgcolor="#6D97B9"><div align="center" valign="middle"><table cellspacing="0" width="100"><tr><td class="newstop"><font color="#4980ad">Select</font> FLAG</td></tr>');
	d.write('<tr><td class="userpicmaincell" valign="center" align="center">');
	d.write('<a href="#" onClick="self.close()">');
	d.write('<img src='+URL+'gfx/landen/wo.gif border="0"/>');
	d.write('</a></td></tr></table></div></body></html>');
 }	


 function userpic(id, name, width, height) {
	win = window.open('about:blank', 'userpic', 'width='+(width+30)+', height='+(height+30));
	d = win.document;
	d.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	d.write('<html><head><title>Gebruiker: '+name+'</title><link rel="stylesheet" href="'+URL+'lib/css/frontpage.css" type="text/css"></head>');
	d.write('<body bgcolor="#6D97B9"><div align="center" valign="middle"><table cellspacing="0" width="100"><tr><td class="newstop"><font color="#4980ad">'+name+'</font> PHOTO</td></tr>');
	d.write('<tr><td class="userpicmaincell" valign="center" align="center">');
	d.write('<a href="#" onClick="self.close()">');
	d.write('<img src='+URL+'userfiles/pic/'+id+'.jpg border="0" id="userpic" name="userpic" />');
	d.write('</a></td></tr></table></div></body></html>');
 }
 
 function clanpic(id, name, width, height) {
	win = window.open('about:blank', 'userpic', 'width='+(width+30)+', height='+(height+30));
	d = win.document;
	d.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	d.write('<html><head><title>Clan: '+name+'</title><link rel="stylesheet" href="'+URL+'lib/css/frontpage.css" type="text/css"></head>');
	d.write('<body bgcolor="#6D97B9"><div align="center" valign="middle"><table cellspacing="0" width="100"><tr><td class="newstop"><font color="#4980ad">'+name+'</font> LOGO</td></tr>');
	d.write('<tr><td class="userpicmaincell" valign="center" align="center">');
	d.write('<a href="#" onClick="self.close()">');
	d.write('<img src='+URL+'clanfiles/pic/'+id+'.jpg border="0" id="userpic" name="userpic" />');
	d.write('</a></td></tr></table></div></body></html>');
 }
 
 function writeemail(front, domain) {
 	d.write('<a href="mailto:'+front+'@'+domain+'" class="normal">'+front+'@'+domain+'</a>');
 }
 
 function commentpic(href, name, comment, width, height) {
	win = window.open('about:blank', 'userpic', 'width='+(width+30)+', height='+(height+40));
	d = win.document;
	d.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	d.write('<html><head><title>Picture: '+name+'</title><link rel="stylesheet" href="'+URL+'lib/css/frontpage.css" type="text/css"><link rel="stylesheet" href="'+URL+'lib/css/main.css" type="text/css"></head>');
	d.write('<body bgcolor="#6D97B9"><table cellspacing="0" cellpadding="0" width="100%"><tr><td id="top"><table id="toptable"><tr><td>Counter-Strike.NL</td><td align="right"><a href="http://www.hostingdiscounter.nl/index.php?cmp=SPC-CSNLBA1501" target="_blank">POWERED BY HostingDiscounter</a></td></tr></table></td></tr></table><font size="1"><br></font>');
	d.write('<div align="center" valign="middle"><table cellspacing="0" width="100"><tr><td class="newstop">'+name+'</td></tr>');
	d.write('<tr><td class="userpicmaincell" valign="center" align="center">');
	d.write('<a href="#" onClick="self.close()">');
	d.write('<img src='+URL+''+href+' border="0" id="userpic" name="userpic" />');
	d.write('</a><br>'+comment+'');
	d.write('</td></tr></table></div></body></html>');
 }
 
 function pageheader(name) {
 	d.write('<table width="100%" cellspacing="0" cellpadding="0"><tr><td class="contentdot">&nbsp;&nbsp;</td><td class="contenthead">'+name+'</td></tr></table>');
 }
 
 function userpagecomment1(id, module, moduleid, title) {
 	d.write('      <tr>');
 	d.write('       <td class="usercommenta">');
 	d.write('<a href="'+URL+module+'/'+moduleid+'#'+id+'" class="news">'+title+'</a>');
 	d.write('       </td>');
 	d.write('      </tr>');
 }
 
 function userpagecomment2(id, module, moduleid, title) {
 	d.write('      <tr>');
 	d.write('       <td class="usercommentb">');
 	d.write('<a href="'+URL+module+'/'+moduleid+'#'+id+'" class="news">'+title+'</a>');
 	d.write('       </td>');
 	d.write('      </tr>');
 }
 
 function userpagefriend1(id, country, username, online) {
 	d.write('      <tr>');
 	d.write('       <td class="userfrienda">');
 	d.write('<img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+id+'" class="news">'+username+'</a></td><td class="userfriendaon" align="right">');
 	if (online == 1) {
 		d.write('<img align="right" src="'+URL+'gfx/misc/user_online.gif">');
 	} else {
 		d.write('<img align="right" src="'+URL+'gfx/misc/user_offline.gif">');
 	}
 	d.write('       </td>');
 	d.write('      </tr>');
 }
 
 function userpagefriend2(id, country, username, online) {
 	d.write('      <tr>');
 	d.write('       <td class="userfriendb">');
 	d.write('<img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+id+'" class="news">'+username+'</a></td><td class="userfriendbon" align="right">');
 	if (online == 1) {
 		d.write('<img align="right" src="'+URL+'gfx/misc/user_online.gif">');
 	} else {
 		d.write('<img align="right" src="'+URL+'gfx/misc/user_offline.gif">');
 	}
 	d.write('       </td>');
 	d.write('      </tr>');
 }
 
 function tonewsitem(id) {
 	d.location.href=URL+'news/'+id;
 }
 
 function inboxline1(id, time, title, username, userid, read) {
	d.write('<tr bgcolor="#EFEFEF" title="'+title+'">');
	d.write('<td class="inbox" width="5%">');
	if (read == 0) {
		d.write('<img src="'+URL+'gfx/misc/msg_new.gif">');
	} else {
		d.write('<img src="'+URL+'gfx/misc/msg_old.gif">');
	}
	d.write('</td><td class="inbox" width="55%">');
	if (read == 0) {
		d.write('<a href="'+URL+'inbox/'+id+'" class="news">'+title+'</a>');
	} else {
		d.write('<a href="'+URL+'inbox/'+id+'" class="normal">'+title+'</a>');
	}
	d.write('</td><td class="inbox" width="25%"><a href="'+URL+'user/'+userid+'" class="normal">'+username+'</a></td><td class="inbox" width="10%">'+time+'</td><td class="inbox" width="5%"><input type="checkbox" name="delete'+id+'"></td>');
	d.write('</tr>');
 }
 
 function inboxline2(id, time, title, username, userid, read) {
	d.write('<tr title="'+title+'">');
	d.write('<td class="inbox" width="5%">');
	if (read == 0) {
		d.write('<img src="'+URL+'gfx/misc/msg_new.gif">');
	} else {
		d.write('<img src="'+URL+'gfx/misc/msg_old.gif">');
	}
	d.write('</td><td class="inbox" width="55%">');
	if (read == 0) {
		d.write('<a href="'+URL+'inbox/'+id+'" class="news">'+title+'</a>');
	} else {
		d.write('<a href="'+URL+'inbox/'+id+'" class="normal">'+title+'</a>');
	}
	d.write('</td><td class="inbox" width="25%"><a href="'+URL+'user/'+userid+'" class="normal">'+username+'</a></td><td class="inbox" width="10%">'+time+'</td><td class="inbox" width="5%"><input type="checkbox" name="delete'+id+'"></td>');
	d.write('</tr>');
 }
 
 function outboxline1(id, time, title, username, userid) {
	d.write('<tr bgcolor="#EFEFEF" title="'+title+'">');
	d.write('<td class="inbox" width="55%"><a href="'+URL+'outbox/'+id+'" class="normal">'+title+'</a></td><td class="inbox" width="25%"><a href="'+URL+'user/'+userid+'" class="normal">'+username+'</a></td><td class="inbox" width="10%">'+time+'</td><td class="inbox" width="5%"><input type="checkbox" name="delete'+id+'"></td>');
	d.write('</tr>');
 }
 
 function outboxline2(id, time, title, username, userid) {
	d.write('<tr title="'+title+'">');
	d.write('<td class="inbox" width="55%"><a href="'+URL+'outbox/'+id+'" class="normal">'+title+'</a></td><td class="inbox" width="25%"><a href="'+URL+'user/'+userid+'" class="normal">'+username+'</a></td><td class="inbox" width="10%">'+time+'</td><td class="inbox" width="5%"><input type="checkbox" name="delete'+id+'"></td>');
	d.write('</tr>');
 }
 
 function clanplayer1(id, name, country, rank) {
 	if (rank != 1) {
	 	d.write('      <tr>');
	 	d.write('       <td class="usercommenta">');
	 	d.write('<img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+id+'" class="news">'+name+'</a>');
	 	if (rank == 4) {
	 		d.write(' <i>(Clanleader)</i>');
	 	}
	 	if (rank == 3) {
	 		d.write(' <i>(Trustee)</i>');
	 	}
	 	d.write('       </td>');
	 	d.write('      </tr>');
	 }
 }
 
 function clanplayer2(id, name, country, rank) {
 	if (rank != 1) {
	 	d.write('      <tr>');
	 	d.write('       <td class="usercommentb">');
	 	d.write('<img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+id+'" class="news">'+name+'</a>');
	 	if (rank == 4) {
	 		d.write(' <i>(Clanleader)</i>');
	 	}
	 	if (rank == 3) {
	 		d.write(' <i>(Trustee)</i>');
	 	}
	 	d.write('       </td>');
	 	d.write('      </tr>');
	 }
 }
 
 function friendline1(userid, country, username, clanid, clanname, online) {
	d.write('<tr bgcolor="#EFEFEF" title="'+username+'">');
	d.write('<td class="inbox" width="5%" align="center">');
	if (online == 1) {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_online.gif">');
	} else {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_offline.gif">');
	}
	d.write('</td><td class="inbox" width="55%"><img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td><td class="inbox" width="25%"><a href="'+URL+'clan/'+clanid+'" class="normal">'+clanname+'</a></td><td class="inbox" width="10%"><a href="'+URL+'message/'+userid+'" class="normal">Message</a></td><td class="inbox" width="5%"><input type="checkbox" name="delete'+userid+'"></td>');
	d.write('</tr>');
 }
 
 function friendline2(userid, country, username, clanid, clanname, online) {
	d.write('<tr title="'+username+'">');
	d.write('<td class="inbox" width="5%" align="center">');
	if (online == 1) {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_online.gif">');
	} else {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_offline.gif">');
	}
	d.write('</td><td class="inbox" width="55%"><img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td><td class="inbox" width="25%"><a href="'+URL+'clan/'+clanid+'" class="normal">'+clanname+'</a></td><td class="inbox" width="10%"><a href="'+URL+'message/'+userid+'" class="normal">Message</a></td><td class="inbox" width="5%"><input type="checkbox" name="delete'+userid+'"></td>');
	d.write('</tr>');
 }
 
 function wfriendline1(userid, country, username, clanid, clanname, online, id) {
	d.write('<tr bgcolor="#EFEFEF" title="'+username+'">');
	d.write('<td class="inbox" width="5%" align="center">');
	if (online == 1) {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_online.gif">');
	} else {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_offline.gif">');
	}
	d.write('</td><td class="inbox" width="40%"><img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td><td class="inbox" width="25%"><a href="'+URL+'clan/'+clanid+'" class="normal">'+clanname+'</a></td><td class="inbox" width="25%"><a href="'+URL+'acceptfriend/'+id+'" class="normal">Accept/Not Accept</a></td>');
	d.write('</tr>');
 }
 
 function wfriendline2(userid, country, username, clanid, clanname, online, id) {
	d.write('<tr title="'+username+'">');
	d.write('<td class="inbox" width="5%" align="center">');
	if (online == 1) {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_online.gif">');
	} else {
		d.write('<img align="center" src="'+URL+'gfx/misc/user_offline.gif">');
	}
	d.write('</td><td class="inbox" width="40%"><img src="'+URL+'gfx/landen/'+country+'"> <a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td><td class="inbox" width="25%"><a href="'+URL+'clan/'+clanid+'" class="normal">'+clanname+'</a></td><td class="inbox" width="25%"><a href="'+URL+'acceptfriend/'+id+'" class="normal">Accept/Not Accept</a></td>');
	d.write('</tr>');
 }

function wmembersline1(userid, country, username, clanid, clanname, regdate, online) {
	d.write('<tr><td class="online2" width="35%" title="'+username+'">');
	d.write('<img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
	d.write('<a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td>');
	d.write('<td class="online2" width="35%">');
	if (clanid == 0) {
		d.write('&nbsp;');
	} else {
		d.write('<a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a>');
	}
	d.write('</td><td class="online2" width="30%">'+regdate+'</td></tr>');
}

function wmembersline2(userid, country, username, clanid, clanname, regdate, online) {
	d.write('<tr><td class="online1" width="35%" title="'+username+'">');
	d.write('<img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
	d.write('<a href="'+URL+'user/'+userid+'" class="news">'+username+'</a></td>');
	d.write('<td class="online1" width="35%">');
	if (clanid == 0) {
		d.write('&nbsp;');
	} else {
		d.write('<a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a>');
	}
	d.write('</td><td class="online1" width="30%">'+regdate+'</td></tr>');
}

function wclanline1(clanid, country, clanname, userid, username, regdate) {
	d.write('<tr><td class="online2" width="35%" title="'+clanname+'">');
	d.write('<img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
	d.write('<a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
	d.write('<td class="online2" width="35%"><a href="'+URL+'user/'+userid+'" class="news">');
	d.write(username+'</a></td>');
	d.write('<td class="online2" width="30%">'+regdate+'</td></tr>');
}

function wclanline2(clanid, country, clanname, userid, username, regdate) {
	d.write('<tr><td class="online1" width="35%" title="'+clanname+'">');
	d.write('<img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
	d.write('<a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
	d.write('<td class="online1" width="35%"><a href="'+URL+'user/'+userid+'" class="news">');
	d.write(username+'</a></td>');
	d.write('<td class="online1" width="30%">'+regdate+'</td></tr>');
}

function wdownloadline1(downloadid, downloadname, downloadcatshort, downloadcatlong, size) {
	d.write('<tr><td class="online1" width="35%" title="'+downloadname+'">');
	d.write('<a href="'+URL+'file/'+downloadid+'" class="news">'+downloadname+'</a></td>');
	d.write('<td class="online1" width="35%">'+size+'</td>');
	d.write('<td class="online1" width="30%">');
	d.write('<a href="'+URL+'downloads/'+downloadcatshort+'" class="news">');
	d.write(downloadcatlong+'</a></td></tr>');
}

function wdownloadline2(downloadid, downloadname, downloadcatshort, downloadcatlong, size) {
	d.write('<tr><td class="online2" width="35%" title="'+downloadname+'">');
	d.write('<a href="'+URL+'file/'+downloadid+'" class="news">'+downloadname+'</a></td>');
	d.write('<td class="online2" width="35%">'+size+'</td>');
	d.write('<td class="online2" width="30%">');
	d.write('<a href="'+URL+'downloads/'+downloadcatshort+'" class="news">');
	d.write(downloadcatlong+'</a></td></tr>');
}

function articlefrontpage(id, title, text, comments, imageurl, width, height) {
	d.write('<tr><td border="0" width="100%">');
	d.write('<table cellspacing="1" class="frontpagetables"><tr>');
	d.write('<td class="newstop" colspan="2">'+title+'</td></tr><tr>');
	d.write('<td class="newstextfrontpage">'+text+'</td>');
	d.write('<td class="newsimage"><a href="'+URL+'article/'+id+'">');
	d.write('<img src="');
	if (imageurl=="")
		d.write(URL+'gfx/misc/source.jpg');
	else
		d.write(imageurl);
	d.write('" width="'+width+'" height="'+height+'" border="0" alt="'+title+'">');
	d.write('</a></td></tr>');
	d.write('<tr><td class="readmore"><a href="'+URL+'article/'+id+'" class="news">');
	d.write('Read More...</a></td><td align="right" class="readmore">');
	d.write(comments+' Comment');
	if (comments != 1)
		d.write('s');
	d.write('</td></tr></table></td></tr>');
 }
 
 function pcwline1(id, clanid, country, clanname, userid, username, Date, time) {
 	d.write('<tr><td class="online2"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
 	d.write('<a href="'+URL+'pcwrequest/'+id+'" class="news">'+clanname+'</a></td>');
 	d.write('<td class="online2"><a href="'+URL+'user/'+userid+'" class="news">');
	d.write(username+'</a></td>');
	d.write('<td class="online2">'+Date+' - '+time+'</td></tr>');
 }
 
  function pcwline2(id, clanid, country, clanname, userid, username, Date, time) {
 	d.write('<tr><td class="online1"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> ');
 	d.write('<a href="'+URL+'pcwrequest/'+id+'" class="news">'+clanname+'</a></td>');
 	d.write('<td class="online1"><a href="'+URL+'user/'+userid+'" class="news">');
	d.write(username+'</a></td>');
	d.write('<td class="online1">'+Date+' - '+time+'</td></tr>');
 }
 
  function acceptclancup1(id, clanid, clanname, country) {
  	d.write('<tr bgcolor="#EFEFEF" title="'+clanname+'">');
  	d.write('<td width="95%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="5%" class="inbox"><input type="checkbox" name="accept'+clanid+'" /></td></tr>');
  }
  
  function acceptclancup2(id, clanid, clanname, country) {
  	d.write('<tr title="'+clanname+'">');
  	d.write('<td width="95%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="5%" class="inbox"><input type="checkbox" name="accept'+clanid+'" /></td></tr>');
  }
  
  function acceptedclancup1(id, clanid, clanname, country) {
  	d.write('<tr bgcolor="#EFEFEF" title="'+clanname+'">');
  	d.write('<td width="80%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="20%" class="inbox"><a href="'+URL+'replaceclan/'+id+'" class="normal">Replace</a></td></tr>');
  }
  
  function acceptedclancup2(id, clanid, clanname, country) {
  	d.write('<tr title="'+clanname+'">');
  	d.write('<td width="80%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="20%" class="inbox"><a href="'+URL+'replaceclan/'+id+'" class="normal">Replace</a></td></tr>');
  }
  
  function pouleline1(clanid, clanname, country, matches, points, roundswon, roundslost) {
  	d.write('<tr bgcolor="#EFEFEF" title="'+clanname+'">');
  	d.write('<td width="45%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="10%" class="inbox">'+matches+'</td><td width="15%" class="inbox">'+points+'</td><td width="15%" class="inbox">'+roundswon+'</td><td width="15%" class="inbox">'+roundslost+'</td></tr>');
  }
  
  function pouleline2(clanid, clanname, country, matches, points, roundswon, roundslost) {
  	d.write('<tr title="'+clanname+'">');
  	d.write('<td width="45%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="10%" class="inbox">'+matches+'</td><td width="15%" class="inbox">'+points+'</td><td width="15%" class="inbox">'+roundswon+'</td><td width="15%" class="inbox">'+roundslost+'</td></tr>');
  }
   
  function cupcpmatchline1 (cupid, pageid, id, clanid1, clanname1, country1, score1, clanid2, clanname2, country2, score2, ronde, map, Date) {
  	d.write('<tr bgcolor="#EFEFEF">');
  	d.write('<td class="inbox" width="50%"><img src="'+URL+'gfx/landen/'+country1+'.gif" alt="'+country1+'"> <a href="'+URL+'cupcp/'+cupid+'/'+pageid+'/'+id+'" class="news">'+clanname1+'</a> - <img src="'+URL+'gfx/landen/'+country2+'.gif" alt="'+country2+'"> <a href="'+URL+'cupcp/'+cupid+'/'+pageid+'/'+id+'" class="news">'+clanname2+'</a></td>');
  	d.write('<td class="inbox"width="5%">'+ronde+'</td><td class="inbox"width="10%">'+map+'</td><td class="inbox" width="20%">'+Date+'</td><td class="inbox" width="15%">');
  	if (score1<score2) {
  		d.write('<font color="red">'+score1+'</font> - <font color="green">'+score2+'</font>');
	} else if (score1>score2) {
		d.write('<font color="green">'+score1+'</font> - <font color="red">'+score2+'</font>');
	} else {
		d.write(score1+' - '+score2);
	}
	d.write('</td></tr>');
  }
  
  function cupcpmatchline2 (cupid, pageid, id, clanid1, clanname1, country1, score1, clanid2, clanname2, country2, score2, ronde, map, Date, time) {
  	d.write('<tr>');
  	d.write('<td class="inbox" width="50%"><img src="'+URL+'gfx/landen/'+country1+'.gif" alt="'+country1+'"> <a href="'+URL+'cupcp/'+cupid+'/'+pageid+'/'+id+'" class="news">'+clanname1+'</a> - <img src="'+URL+'gfx/landen/'+country2+'.gif" alt="'+country2+'"> <a href="'+URL+'cupcp/'+cupid+'/'+pageid+'/'+id+'" class="news">'+clanname2+'</a></td>');
  	d.write('<td class="inbox"width="5%">'+ronde+'</td><td class="inbox"width="10%">'+map+'</td><td class="inbox" width="20%">'+Date+'</td><td class="inbox" width="15%">');
  	if (score1<score2) {
  		d.write('<font color="red">'+score1+'</font> - <font color="green">'+score2+'</font>');
	} else if (score1>score2) {
		d.write('<font color="green">'+score1+'</font> - <font color="red">'+score2+'</font>');
	} else {
		d.write(score1+' - '+score2);
	}
	d.write('</td></tr>');
  }
  
  function knockoutline1 (id, clanid, clanname, country, poule) {
  	d.write('<tr bgcolor="#EFEFEF" title="'+clanname+'">');
  	d.write('<td width="70%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="30%" class="inbox">Poule '+poule+'</td></tr>');
  }
  
  function knockoutline2 (id, clanid, clanname, country, poule) {
  	d.write('<tr title="'+clanname+'">');
  	d.write('<td width="70%" class="inbox"><img src="'+URL+'gfx/landen/'+country+'.gif" alt="'+country+'"> <a href="'+URL+'clan/'+clanid+'" class="news">'+clanname+'</a></td>');
  	d.write('<td width="30%" class="inbox">Poule '+poule+'</td></tr>');
  }
 

/*function gallerycell(id, views, photo, width, Height) {
 	 d.write('<td class="gallerycell"><a href="'+URL+'image/'+id+'" target="nieuw" onclick="'+NieuwVenster(URL+'image/'+id); return false;+'" class="news"><img src="'+photo+'" width="'+width+'" height="'+Height+'"></a>');
 	 d.write('<h8><br />'+views+' view');
 	 if(views !=1) {
 	 	d.write('s');
 	 }
 	 d.write('</h8></td>');
  }*/

 function headlinematch(id, date, clan1, clan2, hltv, gamecode) {
	 d.write('<tr><td class="headlineservers"><table class="serversheadline" cellspacing="0"><tr><td>'+date);
	 if (hltv.length)
		 d.write('<br>IP:');
	 d.write('</td><td><div class="newsheadlinenowrap"><a href="'+URL+'match/'+id+'">'+clan1+' vs '+clan2+'</a>');
	 if (hltv.length)
		 d.write('<br><a href=\'steam: \"-applaunch '+gamecode+'\" +connect '+hltv+'\'>'+hltv+'</a>');
	 d.write('</div></td></tr></table></td></tr>'); 
}


function submitloginform(e) {
	var keynum;

	if (window.event) { // IE
		keynum = e.keyCode;
	} else {
		keynum = e.which;
	}

	if (keynum == 13) {
		document.forms.loginform.submit();
	}
}
