var rootdir = '/';

function popUp(id) {
if(id != 'undefined' && id != '' && id != userid && id != null)
{
var number=Math.floor(Math.random()*30);
number = number + 10;
var URL = "/msg.php?id="+id;
//alert(URL);
eval("var page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=380,left = "+number+",top = "+number+"');");
}

}

function InstantMessage(id)
{
popUp(id);
}

var global_update_CG = true;

function UpdateCyberGamer()
{

var xmlHttp = new_connection();
if(xmlHttp)
{
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
var i=xmlHttp.responseText;
if(i == '' || i == null || i == 'undefined' || i == false)
{
return;
}
var cga=i.split('|"|');
popupmessages(cga[0]);
updatechattotals(cga[1]);
handle_pugs(cga[2]);
//handlept(cga[3]);
}
}
var url="/xml/global.php?platform="+platform+"&game="+global_game;
url=url+"?chk="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
global_updatetimermain = global_updatetimermain + 2000;
if(global_update_CG == true)
{
var up=setTimeout("UpdateCyberGamer()", global_updatetimermain);
}
}
}
var upcg=setTimeout("UpdateCyberGamer()",90000);


function popupmessages(nmid)
{
nmid = trim(nmid);
var length = nmid.length;
if(nmid != '' && length < 10)
{
javascript:popUp(nmid)
}
}

function handle_pugs(val)
{
//alert(val);
val = trim(val);
if(val == '' || val == null || val == false || val == 'undefined')
{
return;
}
var par=val.split(' ');
if(par[0] == '1')
{
document.getElementById('csspug').innerHTML='<a href="/css/pug/" title="Click To Join!">PUG Starting Soon...</a>';
makehidden('csschat');
makevisible('csspug');
}
else if(par[0] == '2')
{
document.getElementById('csspug').innerHTML='<a href="/css/pug/" title="Click To Join Queue!">PUG in Progress!</a>';
makehidden('csschat');
makevisible('csspug');
}
else
{
document.getElementById('csspug').innerHTML='';
makehidden('csspug');
makevisible('csschat');
}

if(par[3] == '1')
{
document.getElementById('codpug').innerHTML='<a href="/cod4/pug/" title="Click To Join!">COD4 PUG Starting...</a>';
makehidden('codchat');
makevisible('codpug');
}
else if(par[3] == '2')
{
document.getElementById('codpug').innerHTML='<a href="/cod4/pug/" title="Click To Join Queue!">COD4 PUG in Progress</a>';
makehidden('codchat');
makevisible('codpug');
}
else if(par[1] == '1')
{
document.getElementById('codpug').innerHTML='<a href="/cod/pug/" title="Click To Join!">COD2 PUG Starting...</a>';
makehidden('codchat');
makevisible('codpug');
}
else if(par[1] == '2')
{
document.getElementById('codpug').innerHTML='<a href="/cod/pug/" title="Click To Join Queue!">COD2 PUG in Progress</a>';
makehidden('codchat');
makevisible('codpug');
}
else
{
document.getElementById('codpug').innerHTML='';
makehidden('codpug');
makevisible('codchat');
}

if(document.getElementById('sofpug'))
{
if(par[4] == '1')
{
document.getElementById('sofpug').innerHTML='<a href="/sof/pug/" title="Click To Join!">PUG Starting Soon...</a>';
makehidden('sofchat');
makevisible('sofpug');
}
else if(par[4] == '2')
{
document.getElementById('sofpug').innerHTML='<a href="/sof/pug/" title="Click To Join Queue!">PUG in Progress!</a>';
makehidden('sofchat');
makevisible('sofpug');
}
else
{
document.getElementById('sofpug').innerHTML='';
makehidden('sofpug');
makevisible('sofchat');
}
}
}

var anim_done = 0;
function AnimateNewAction(newPMmsg, max_display)
{
if(document.getElementById('login_area_username'))
{
var length = newPMmsg.length;
var what = '';
var cur = 0;
var curtimer = 0;
var time_inbet = 100;
var whatnew = '';
while(cur < length)
{
whatnew = newPMmsg.substr(cur, 1);
if(whatnew == '>')
{
whatnew = '&gt;';
}
what = what + whatnew;
if(whatnew != '' && whatnew != ' ')
{
curtimer = curtimer + time_inbet;
setTimeout("AnimateNewPMSet('"+what+"')",curtimer);
}
cur++;
}
}


anim_done++;
curtimer = curtimer + 1000;
if(anim_done < max_display)
{
setTimeout("AnimateNewAction('"+newPMmsg+"', "+max_display+");",curtimer);
}
else
{
curtimer = curtimer + 3000;
setTimeout("AnimateNewPMSet('"+username+"')",curtimer);
anim_done = 0;
}

}


function AnimateNewPMSet(what)
{
document.getElementById('login_area_username').innerHTML=what
}


function updatechattotals(ar)
{
if(ar == '' || ar == null || ar == false || ar == 'undefined')
{
return;
}
var nar=ar.split(' ');
if(document.getElementById('cssct'))
{
document.getElementById('cssct').innerHTML=nar[0];
}
if(document.getElementById('codct'))
{
document.getElementById('codct').innerHTML=nar[1];
}
if(document.getElementById('csct'))
{
document.getElementById('csct').innerHTML=nar[2];
}
if(document.getElementById('cohct'))
{
document.getElementById('cohct').innerHTML=nar[3];
}
if(document.getElementById('sofct'))
{
document.getElementById('sofct').innerHTML=nar[4];
}

if(document.getElementById('cssbt'))
{
document.getElementById('cssbt').innerHTML=nar[5];
}
if(document.getElementById('codbt'))
{
document.getElementById('codbt').innerHTML=nar[6];
}
if(document.getElementById('csbt'))
{
document.getElementById('csbt').innerHTML=nar[7];
}
if(document.getElementById('cohbt'))
{
document.getElementById('cohbt').innerHTML=nar[8];
}
if(document.getElementById('sofbt'))
{
document.getElementById('sofbt').innerHTML=nar[9];
}
if(document.getElementById('myinboxcount') && document.getElementById('myinboxcount').innerHTML != nar[10])
{

document.getElementById('myinboxcount').innerHTML=nar[10];
	if(nar[10] > 0 && nar[10] != '')
	{
		if(document.getElementById('useremail'))
		{
		document.getElementById('useremail').setAttribute("id", "useremailoffline");
		AnimateNewAction('New PM Received >>', 4);
		}
	}
	if(document.getElementById('userlogged'))
	{
		if(nar[10] == 0)
		{
			if(document.getElementById('useremailoffline'))
			{
			document.getElementById('useremailoffline').setAttribute("id", "useremail");
			}
		}

	}
}
}

function handlept(val)
{
if(val == '' || val == null || val == false || val == 'undefined')
{
return;
}
	if(val != ' ')
	{
		var todo = val.split(' ');
		var z = 0;
		for (z=0; z < todo.length; z++)
		{
			if(todo[z] != '')
			{
				handleptoutput(todo[z]);
			}
		}
	}
}

function handleptoutput(work)
{
var stuff = work.split('_');
var ida = stuff[0];
var idb = ida+'F';
if(document.getElementById(ida) && document.getElementById(ida).innerHTML!=stuff[1])
{
document.getElementById(ida).innerHTML=stuff[1];
}
if(document.getElementById(idb) && document.getElementById(idb).innerHTML!=stuff[1])
{
document.getElementById(idb).innerHTML=stuff[1];
}
}

function new_connection() {

var A;

try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();

return A;
}

function timenow()
{
return globaltimenow;
}
function updateglobaltimer()
{
globaltimenow = globaltimenow + 1;
var CGzor=setTimeout("updateglobaltimer()",1000);
}
var CGzorb=setTimeout("updateglobaltimer()",1000);

function increasetime()
{
globaltimeamountval = globaltimeamountval + 60;
var b=setTimeout("increasetime()",60000);
}
var c=setTimeout("increasetime()",60000);

function time()
{

// Now check that it is set
if (servertimeOBJ != null){
	var myscriptTime = servertimeOBJ;

}

else{
	var myscriptTime = new Date();
}
	var Hours;
	var Mins;
	var Time;
	Hours = myscriptTime.getHours();
	if (Hours >= 12) {
	Time = "pm";
	}
	else {
	Time = "am";
	}

	if (Hours > 12) {
	Hours -= 12;
	}

	if (Hours == 0) {
	Hours = 12;
	}

	Mins = myscriptTime.getMinutes();

	if (Mins < 10) {
	Mins = "0" + Mins;
	}

	var thetime = Hours + ":" + Mins + Time;
return thetime;
	}

function trim(str)
{
return str.replace(/^\s+|\s+$/g,'');
}
function clearme(val, text)
{
if(val.value == text)
{
val.value='';
val.focus();
}
}

function submitchange(value, urlpart)
{
var xmlHttpch = new_connection();
if(xmlHttpch)
{
    xmlHttpch.onreadystatechange=function()
      {
      if(xmlHttpch.readyState==4)
        {
var ret = xmlHttpch.responseText;
if(ret == '' || ret == null || ret == 'undefined' || ret == false)
{
return;
}
if(ret.substr(0,8) == 'display_')
{
AnimateNewAction(ret.substr(8), 1);
return;
}


document.getElementById('leftcolumn').innerHTML=ret;
        }
      }
var url="/xml/c.php"+urlpart+value;
url=url+"&chk="+Math.random();
    xmlHttpch.open("GET",url,true);
    xmlHttpch.send(null);
}
    return false;
}

function onoffstatus(status)
{
offline = status;
if(status == 1)
{
document.getElementById('userlogged').setAttribute("id", "userloggedoffline");
	if(document.getElementById('useremail'))
	{
	document.getElementById('useremail').setAttribute("id", "useremailoffline");
	}
document.getElementById('options').setAttribute("id", "optionsoffline");
}
else
{
document.getElementById('userloggedoffline').setAttribute("id", "userlogged");
var emailtotal = document.getElementById('myinboxcount').innerHTML;
	if(document.getElementById('useremailoffline'))
	{
	if(emailtotal == 0)
	{
	document.getElementById('useremailoffline').setAttribute("id", "useremail");
	}
	}
document.getElementById('optionsoffline').setAttribute("id", "options");
}
document.getElementById('optionsdropdown').style.visibility = "hidden";
document.getElementById('optionsimage').setAttribute('src', '/images/optionsarrow.jpg');
var xmlHttpch = new_connection();
if(xmlHttpch)
{
var url="/xml/s.php?do="+status;
url=url+"&chk="+Math.random();
    xmlHttpch.open("GET",url,true);
    xmlHttpch.send(null);
}
    return false;
}

function vote(poll_id, answer_id)
{
var ggg = 0;
if(username == '')
{
ggg = 1;
}
var maxa = 0;
if(document.getElementById("pmaxpollstatus"+poll_id))
{
	maxa = document.getElementById("pmaxpollstatus"+poll_id).style.width;
	var max_checker = maxa.substr(2);
	if(max_checker == "px")
	{
	maxa = maxa.substr(0,2);
	}
	else
	{
	maxa = maxa.substr(0,1);
	}
}

var mcount;
var mcount2;
var ansid;
var testa;
var testb;
var res;
var toin;
mcount = 0;
mcount2 = 1;
var xmlHttpch = new_connection();
    xmlHttpch.onreadystatechange=function()
      {
      if(xmlHttpch.readyState==4)
        {
var retarray = xmlHttpch.responseText;
if(retarray == '' || retarray == null || retarray == 'undefined')
{
return;
}

if(retarray == 'cannot')
{
alert('You cannot vote in this poll');
return;
}

var array=retarray.split(' ');
var totpoll = array[0];
document.getElementById("pt"+poll_id).innerHTML=totpoll;
		var ret;
	while(mcount < maxa)
	{
		mcount++;
		toin=-1;
		if(array[mcount])
		{
		toin = array[mcount];
		}
		if(document.getElementById("ps"+poll_id+"ps"+mcount))
		{
		document.getElementById("ps"+poll_id+"ps"+mcount).style.width=toin+"%";
		document.getElementById("pss"+poll_id+"pss"+mcount).innerHTML=toin+'%';
		ansid = document.getElementById("pa"+poll_id+"pa"+mcount).innerHTML;
		testa = ansid.substr(0,3);
		if(testa == '<b>' || testa == '<B>')
		{
		ret = ansid.substr(3);
		var len = ret.length;
		len = len - 4;
		ret = ret.substr(0, len);
		document.getElementById("pa"+poll_id+"pa"+mcount).innerHTML=ret;
		}

}
	}
	var cur = document.getElementById("pa"+poll_id+"pa"+answer_id).innerHTML;
	cur = '<b>'+cur+'</b>';
	document.getElementById("pa"+poll_id+"pa"+answer_id).innerHTML=cur;
	document.getElementById("pollstatus"+poll_id).innerHTML='You <b>have</b> voted in this poll.';
        }
      }
var url="/xml/vote.php?id="+poll_id+"&a="+answer_id+"&g="+ggg;
url=url+"&chk="+Math.random();
    xmlHttpch.open("GET",url,true);
    xmlHttpch.send(null);





    return false;
}

function ptexpand(what, id)
{
	var c = 0;
	var vid;

if(what.getAttribute('name') == 'b')
{
	what.setAttribute('src', '/images/minimise.jpg');
	what.setAttribute('name', 'a');
	while(c < 65)
	{
	c++;
	vid = 'h'+id+'pr'+c;
	unhidept(vid);
	}
}
else
{
	what.setAttribute('src', '/images/maximise.jpg');
	what.setAttribute('name', 'b');
	while(c < 65)
	{
	c++;
	vid = 'h'+id+'pr'+c;
	hidept(vid);
	}
}


}

function unhidept(id)
{

if(document.getElementById(id))
{

var variable = document.getElementById(id);
variable.setAttribute('class', 'nothidden');
		variable.style.visibility = "visible";
		variable.style.position = "relative";
 if(navigator.appName == "Microsoft Internet Explorer")
{
		variable.style.display = "block";

}
else
{
		variable.style.display = "table-row";
		}



}
}

function hidept(id)
{

if(document.getElementById(id))
{
var variable = document.getElementById(id);
variable.setAttribute('class', 'hidden');
		variable.style.visibility = "hidden";
		variable.style.display = "none";
		variable.style._visibility = "hidden";
		variable.style._position = "absolute";
}
}

function makevisible(x) 
{
if(document.getElementById(x))
{
var variable = document.getElementById(x);

variable.style.visibility = "visible";
variable.style.position = "relative";
}
}


function makehidden(x) 
{
if(document.getElementById(x))
{
var variable = document.getElementById(x);

variable.style.visibility = "hidden";
variable.style.position = "absolute";
variable.style.top = "0px";
variable.style.left= "0px";
}
}

function update_id_with(id, what)
{
if(document.getElementById(id))
{
document.getElementById(id).innerHTML=what;
}
}

function rand ( num )
{
return ( Math.floor ( Math.random ( ) * num + 1 ) );
}

function switchimage(x, y) {
	var wut = document.getElementById(y).style.visibility;
	if(wut == "hidden") {	
		x.setAttribute('src', '/images/maximiseforums.jpg');
	}
	else {
		x.setAttribute('src', '/images/minimiseforums.jpg');
	}
}


function preload(url)
{
var xmlHttp = new_connection();
if(xmlHttp)
{
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}

function substr( f_string, f_start, f_length ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Martijn Wieringa
    // *         example 1: substr('abcdef', 0, -1);
    // *         returns 1: 'abcde'
 
    if(f_start < 0) {
        f_start += f_string.length;
    }
 
    if(f_length == undefined) {
        f_length = f_string.length;
    } else if(f_length < 0){
        f_length += f_string.length;
    } else {
        f_length += f_start;
    }
 
    if(f_length < f_start) {
        f_length = f_start;
    }
 
    return f_string.substring(f_start, f_length);
}

function strpos( haystack, needle, offset){
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
    // *     returns 1: 14
 
    var i = haystack.indexOf( needle, offset ); // returns -1
    return i >= 0 ? i : false;
}

function addslashes(str) {
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
//str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');
return str;
}


function gethashhrefval()
	{
var cur = location.href;
if(cur == '')
		{
return false;
		}
var pos = strpos(cur, '#');
if(pos === false)
		{
return false;
		}
else
		{
pos++;
return substr(cur, pos);
		}
	}


function urlencode( str ) {
var ret = str;
ret = ret.toString();
ret = encodeURIComponent(ret);
ret = ret.replace(/%20/g, '+');
return ret;
}

function searchclearer(val)
{
if(val == 1)
{
	if(document.getElementById('searchtext').value == 'Search:')
	{
	document.getElementById('searchtext').value='';
	}
}
else
{
	if(document.getElementById('searchtext').value == '')
	{
	document.getElementById('searchtext').value='Search:';
	}
}
}

function search()
{
var search = document.getElementById('searchtext').value;
if(search.length == 0)
{
alert('Enter something to search...');
}
else if(search.length < 3)
{
alert('Please enter atleast 3 letters for your search');
document.getElementById('searchtext').focus();
}
else
{
search = urlencode(search);
search = search.replace(/%2f/gi, '%252F');
window.location='/search/'+search+'/';
}
return false;
}

function d_enter(e){
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode == 13)
	{
setTimeout("search();", 50);
return false;
	}
	return true;
}

function isset(  ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: FremyCompany
    // *     example 1: isset( undefined, true);
    // *     returns 1: false
    // *     example 2: isset( 'Kevin van Zonneveld' );
    // *     returns 2: true
    var a=arguments; var l=a.length; var i=0;
    while ( i!=l ) {
        if (typeof(a[i])=='undefined') { 
            return false; 
        } else { 
            i++; 
        }
    }
    return true;
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


// www.snapfx.com.au //



var even = new Array("#bbe5fc","#c6eafd","#d4effe","#e1f4fe","#edf8fe","#f9fcfe","#ffffff");
var odd = new Array("#bbe5fc","#c6eafd","#d4effd","#e6f5fd");
var grey = new Array("#999999","#888888","#777777","#666666");
var dark = new Array("black","#111111","#222222","#333333");

var kk;
//SUBMENUS//
function dropEvents() {
	var listItems = document.getElementsByTagName("li");
	var foundSubs = "";
	for(i = 0; i < listItems.length; i++) {
		if(listItems[i].getElementsByTagName("ul").length > 0) {
			var uls = listItems[i].getElementsByTagName("ul");
			for(x = 0; x < uls.length; x++) {
				var thisNav = uls[x];
				var ulEvent = new ullisteners(thisNav)
			}
		}
	}
}
//TOP NAV //
function topnav() {
	var ul = document.getElementById("top_nav_menu");
	var subul = ul.getElementsByTagName("ul");
	var subulno = subul.length;
	
	for(i = 0; i < subulno; i++) {
		var tar_a = subul[i].getElementsByTagName("a");
		var a_no = tar_a.length;
		
		for(y = 0; y < a_no; y++) {
			var linky = tar_a[y];
			var newAlistener = new aListener(linky,linky,even);
		}
	}
		
}

function ullisteners(thisOne) {
	var t;
	var tt;
	thisOne.parentNode.onmouseover = function() {
		clearTimeout(tt);
		thisOne.style.zIndex=2000;
		t = setTimeout(function() {thisOne.style.display="block"},200)
	}
	thisOne.parentNode.onmouseout = function() {
		clearTimeout(t);
		thisOne.style.zIndex=1000;
		tt = setTimeout(function() {thisOne.style.display="none"},200);
	}
}

function aListener(myLink,myTarget,colourArray) {
	var thisLink = myLink;
	var thisTarget = myTarget;
	var interval;
	
	thisLink.onmouseover = function() {
		clearTimeout(interval);
		thisTarget.style.background=colourArray[0];
	}
	
	thisLink.onmouseout = function() {
		fadeOut(0);
	}
	
	function fadeOut(colour) {
		var myColour = colourArray[colour];
		thisTarget.style.background=myColour;
		if(colour < colourArray.length-1) {
			var newColour = colour + 1;
			interval = setTimeout(function() {fadeOut(newColour)},50);
		 }
		
	}
}
//END TOP NAV//

//LEFT NAV//
function leftNav(menu) {
	var myMenu = document.getElementById(menu);
	if(myMenu.style.display == "" || myMenu.style.display == null) {
		myMenu.style.display="block";
	}
	else {
		myMenu.style.display="";
	}
}
//END LEFT NAV//

//TABLES//
function tables() {
	var tableArray = document.getElementsByTagName("table");
	var tableNo = tableArray.length;
	
	for(i = 0; i < tableNo; i++) {
		if(tableArray[i].className == "flagged") {
			var linksArray = tableArray[i].getElementsByTagName("a");
			var linksNo = linksArray.length;
			for(y = 0; y < linksNo; y++) {
				var linky = linksArray[y];
				var target = linky.parentNode.parentNode;
				oddOrEven(linky,target);
			}
		}
	}
}

function oddOrEven(linky,target) {
		if(target.className != "flodd") {
			var newAlistenerEven = new aListener(linky,target,even);
		}
		else {
			var newAlistenerOdd = new aListener(linky,target,odd);
		}
}
//END TABLES//

//LISTS//
function lists() {
	var listsArray = document.getElementsByTagName("ul");
	var listsNo = listsArray.length;
	for(i = 0;i < listsNo; i++) {
		if(listsArray[i].className == "frontpagelist" || listsArray[i].className == "modlist") {
			var linkArray = listsArray[i].getElementsByTagName("a");
			var linkNo = linkArray.length;
			for(y = 0; y < linkNo; y++) {
				var linky = linkArray[y];
				oddOrEven(linky,linky);
			}
		}
		else if(listsArray[i].className == "series_nav_menu") {
			var linkArray = listsArray[i].getElementsByTagName("a");
			var linkNo = linkArray.length;
			for(z = 0; z < linkNo; z++) {
				var linky = linkArray[z];
				var newLinkListener = new aListener(linky,linky,grey);
			}
		}
		else if(listsArray[i].className == "series_nav_menu_sub") {
			var linkArray = listsArray[i].getElementsByTagName("a");
			var linkNo = linkArray.length;
			for(z = 0; z < linkNo; z++) {
				var linky = linkArray[z];
				var newLinkListener = new aListener(linky,linky,dark);
			}
		}
	}
}
//END LISTS//

//END EVENTS//

//OLD OLD SHIZZLE//
function modo(x) {
	x.getElementsByTagName('ul')[0].style.visibility="visible";
}
function modx(x) {
	x.getElementsByTagName('ul')[0].style.visibility="hidden";
}



function openclose(x) {

	var variable = document.getElementById(x);

	if(variable.style.visibility != "hidden") {

		variable.style.visibility = "hidden";

		variable.style.position = "absolute";

		variable.style.top = "0px";

		variable.style.left= "0px";

	}

	else {

		variable.style.visibility = "visible";

		variable.style.position = "relative";

	}

}



function forummini(x,y) {

	openclose(y);

	var wut = document.getElementById(y).style.visibility;

	if(wut == "hidden") {	

		x.setAttribute('src', '/images/maximiseforums.jpg');

	}

	else {

		x.setAttribute('src', '/images/minimiseforums.jpg');

	}

}



function show(x,y) {

	

	var variable = document.getElementById(y);

	

	

	if(variable.style.visibility != "hidden") {

		variable.style.visibility = "hidden";

		x.setAttribute('src', '/images/optionsarrow.jpg');

		

		

	}

	else {

		variable.style.visibility = "visible";

		x.setAttribute('src', '/images/minimiseforums.jpg');

	}

}



function over(x) {

	document.getElementById(x).style.visibility="visible";

}



function out(x) {

	document.getElementById(x).style.visibility="hidden";

}



function tooltipover(x) {

	var words = x.firstChild.innerHTML;

	myDiv = document.createElement("div");

	myDiv.setAttribute('class', 'tooltip');

	myDiv.setAttribute('id', 'thetip');

	myDiv.innerHTML = words;

	x.appendChild(myDiv);

}



function tooltipout(x) {

	x.removeChild(myDiv);

}



function loadcomment(x) {

	var target = x.parentNode.getElementsByTagName('div')[0];

	

	if(target.style.visibility != "hidden") {

		target.style.visibility = "hidden";

		x.setAttribute('src', '/images/commentbutton.gif');

	}

	else {

		target.style.visibility = "visible";

		x.setAttribute('src', '/images/closebutton.gif');

	}

}



function dropme(x) {

	var string = x.parentNode.getElementsByTagName('div')[0];

	if (string.style.visibility != "visible") {

		string.style.visibility = "visible";

	}

	else {

		string.style.visibility = "hidden";

	}

}







function makevisible(x) 

{

if(document.getElementById(x))

{

var variable = document.getElementById(x);



variable.style.visibility = "visible";

variable.style.position = "relative";

}

}





function makehidden(x) 

{

if(document.getElementById(x))

{

var variable = document.getElementById(x);



variable.style.visibility = "hidden";

variable.style.position = "absolute";

variable.style.top = "0px";

variable.style.left= "0px";

}

}









var polls = new Array;

polls[0] = 59;

polls[1] = 63;

polls[2] = 101;

polls[3] = 23;



function pollOnload() {

	var noArrays = polls.length;

	for(i = 0; i < noArrays; i++) {

		var width = numberCrunch(polls[i]);

		myArray = document.createElement("div");

		myArray.setAttribute('class', 'pollbar');

		myArray.style.width = width + "%";

		myArray.innerHTML = width + "%";

		document.getElementById('pollshere').appendChild(myArray);

	}

}



function numberCrunch(x) {

	var noArrays = polls.length;

	var totalVotes = 0;

		for (b = 0; b < noArrays; b++) {

			totalVotes = totalVotes + polls[b];

		}

	var targetDecimal = x/totalVotes;

	var targetPercent = targetDecimal*100;

	targetPercent= Math.floor(targetPercent, 0);

	return targetPercent;

}



function hideFade(x) {

	x.style.display="none";

}



function hidePop(x) {

	x.getElementsByTagName('div')[0].style.visibility="hidden";

}



function showPop(x) {

	x.getElementsByTagName('div')[0].style.visibility="visible";
}

function CG_Tail() // same as onload - but frees up the real onload to be used on specific pages etc. - Runs once the page has fully loaded.
{

}


function CG_TopNav() // loads as soon as the top nav bar has been loaded.
{

}

window.onload=function() {
dropEvents(); 
topnav(); 
tables();
lists(); 

}


