<!--
var count = 0;
var count2 = 0;



//
//	This function is called BEFORE enumerating
//	all wars. Use it to start a table etc
//
function cbjsWarPast_Start()
{
	document.write('<table cellpadding="5" cellspacing="1" class="resultstable">');
	document.write('<tr class="head">');
	document.write('<td>Date</td>');
	document.write('<td>Clan</td>');
	document.write('<td colspan="2" align="center">Score</td>');
	document.write('<td>Game</td>');
	document.write('</tr>');
}

//
//	This function is called AFTER enumerating
//	all wars. Use it to start end table etc
//
function cbjsWarPast_End()
{
	document.write('</table>');
}

//
//	This function is called for each war
//
function cbjsWarPast_Each(wid,clan,cid,lid,date,score1,score2,level1,level2,
game,subgame,forfeit,type,hasdemo)
{
	if(count >= 100)
		return;

	//skip rtcw matches
	//if (game=='Wolfenstein')
	//	return;

	//shorten game names
	if (game=='Wolfenstein')
 		game="RTCW";
	if (game=='En. Territory')
 		game="ET";

	//	Only official matches
	if(type!=0)
		return;
	//	Skip forfeit wins
	if(forfeit=='Y')
		return;
	//	score1 is our score
	//	(an interesting usage would we: if(score1 < score2) return; !
	if(score1 > score2)
		document.write('<tr class="win">');
	else
	if(score1 < score2)
		document.write('<tr class="lose">');
	else
		document.write('<tr class="draw">');
	document.write('<td>'+date+'</td>');
	document.write('<td class="enemy"><a href="http://www.clanbase.com/claninfo.php?cid='+cid+'">'+clan+'</a></td>');
	document.write('<td>'+score1+'</td>');
	document.write('<td>'+score2+'</td>');
	document.write('<td>'+game+'</td>');

		//document.write(" ");
	//document.write('</td>');
	document.write('</tr>');
	count++;
}


function cbjsWarUpcoming_Start()
{
//	Do nothing !
}

function cbjsWarUpcoming_End()
{
//	Do nothing !
}

function cbjsWarUpcoming_Each(wid,clan,cid,lid,date,level1,level2,game,subgame,type)
{
	//	Only show first match
	if(count2)
		return;
	//	Note: the date is GMT
	//	Converting this date to localtime is left as an excercise for the reader :-)


	document.write('<h3>Next War:<br /><img src="_gfx/fodder.gif" height="50" width="150" alt="&lt;FODDER&gt;" /><br />VS<br />');
	document.write('<a href="http://www.clanbase.com/claninfo.php?cid='+cid+'">'+clan+'</a></h3>');
	document.write('<p>'+date+' GMT');
	document.write('<BR />| <a href="http://www.clanbase.com/warinfo.php?wid='+wid+'">Details</a> |');
	document.write(' <a href="http://www.clanbase.com/rating.php?lid='+lid+'">Ladder</a> |</p>');

	count2++;
}

//-->
