function preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
var i,j=0,x,a=swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var selectedtablink="";
var tcischecked=false;

function handlelinknew(aobject, frameNum){
selectedtablink=aobject.href
tcischecked=(document.tabcontrol && document.tabcontrol.tabcheck.checked)? true : false
if (document.getElementById && !tcischecked){
document.getElementById("tab0").className="";
document.getElementById("tab1").className="";
document.getElementById("tab2").className="";
document.getElementById("tabright0").className="";
document.getElementById("tabright1").className="";
document.getElementById("tabright2").className="";
document.getElementById("tab" + frameNum).className="act";
document.getElementById("tabright" + frameNum).className="act2";

dispFrames=document.getElementsByTagName('iframe');
for (i = 0; i < dispFrames.length; i++)
if(dispFrames[i].className=='tabcurrent')
dispFrames[i].className='tabbkgrnd'
document.getElementById("tabiframe"+frameNum).className='tabcurrent'
if (document.getElementById("tabiframe"+frameNum).src==''||document.getElementById("tabiframe"+frameNum).src==location.href)
document.getElementById("tabiframe"+frameNum).src=selectedtablink
return false
}
else
return true
}

function handlelink(aobject, frameNum){
selectedtablink=aobject.href
tcischecked=(document.tabcontrol && document.tabcontrol.tabcheck.checked)? true : false
if (document.getElementById && !tcischecked){
var tabobj=document.getElementById("tablist")
var tabobjlinks=tabobj.getElementsByTagName("A")
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
aobject.className="current"
dispFrames=document.getElementsByTagName('iframe');
for (i = 0; i < dispFrames.length; i++)
if(dispFrames[i].className=='tabcurrent')
dispFrames[i].className='tabbkgrnd'
document.getElementById("tabiframe"+frameNum).className='tabcurrent'
if (document.getElementById("tabiframe"+frameNum).src==''||document.getElementById("tabiframe"+frameNum).src==location.href)
document.getElementById("tabiframe"+frameNum).src=selectedtablink
return false
}
else
return true
}

function handleview(){
tcischecked=document.tabcontrol.tabcheck.checked
if (document.getElementById && tcischecked){
if (selectedtablink!="")
window.location=selectedtablink
}
}

// ADS SCRIPT

// obtain cookie values via js
function getCookieVal (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			var endstr = document.cookie.indexOf (";", j);
			if (endstr == -1)
				endstr = document.cookie.length;
			return unescape(document.cookie.substring(j, endstr));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return "";
}

// from: seg=?;seg=?;
function getSegmentStr() {
    var cookieValue = getCookieVal("bolt-segments")
    //alert(cookieValue);
    var arrSids = cookieValue.split(":");
    var finalStr = "";
    for(var i=0;i<arrSids.length;i++) {
        if ( (arrSids[i] == 69) || (arrSids[i] == 70) ){
            finalStr = finalStr + "seg=" + arrSids[i] + ";";
        } 
        /* else if (arrSids[i] == 95) { finalStr = finalStr + "age=" + arrSids[i] + "&"; } */
    }
    /*
    if (finalStr.length > 0) {
        finalStr = finalStr.substring(0,finalStr.length - 1);
    }
    */
    // alert(finalStr);
    return finalStr;
}


var axel = Math.random() + "";
var ord = axel * 1000000000000000000;

// size can be 300x250
function showAd(sz) {
	// global categoryName: subdomain.pagename
	// spit pieces
	var catArray		= categoryName.split('.');
	var dimArray		= sz.split('x');
	// needed data for ads
	var subDomain		= catArray[0];
	if(subDomain != "bolt") subDomain = subDomain + ".";
	else subDomain = "";
	var category		= catArray[1];
	
	// alert(subDomain+category);
	
	var width			= dimArray[0];
	var height			= dimArray[1];
	 
	var seg 			= getSegmentStr();
	
	// extra querystring args
	var xtraTop;
	var xtraBottom;
	if(width=='728') {
		xtraTop 	= 'ptile=1;dcopt=ist;';
		xtraBottom 	= 'ptile=1;';
	}
	else {
		xtraTop 	= 'ptile=2;';
		xtraBottom 	= 'ptile=2;';
	}
	document.write('<scr'+'ipt language="Javas'+'cript1.1" src="http://ad.doubleclick.net/adj/' + subDomain + 'bolt.tmus/' + category + ';' + seg + xtraTop + 'abr=!webtv;sz=' + sz + ';ord=' + ord + '?"></scr'+'ipt>');
	if ((!document.images && navigator.userAgent.indexOf('Mozilla/2.') >= 0) || navigator.userAgent.indexOf("WebTV") >= 0) {
		document.write('<a href="http://ad.doubleclick.net/jump/' + subDomain + 'bolt.tmus/' + category + ';' + seg + xtraBottom + 'sz=' + sz + ';ord=' + ord + '?" target="_top">');
		document.write('<img src="http://ad.doubleclick.net/ad/' + subDomain + 'bolt.tmus/' + category + ';' + seg + xtraBottom + 'sz=' + sz + ';ord=' + ord + '?" width="' + width + '" height="' + height + '" border="0"></a>');
	}
}
// AD SCRIPT


function open_screen_window(url) {
awindow = window.open(url,"GameRevolutionScreenshots","toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=0,resizable=0,width=815,height=660");
}

function open_video_window(url) {
awindow = window.open(url,"GameRevolutionVideos","toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=0,resizable=0,width=400,height=400");
}

function open_gametrailer_window(url) {
awindow = window.open(url,"GameRevolutionVideos","toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=0,resizable=0,width=800,height=620");
}

//# SYN {
function pop_window(title,url,width,height,screenx,screeny)
{
awindow = window.open(url,title,"toolbar=0,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+width+",height="+height+",screenX="+screenx+",screenY="+screeny);
}

function checkAll(setValue){
	var ele = document.frmFaqApprove;
	var formName = ele.name;
	var eleCount = ele.length;
	var eleName = '';
	var j = 0;
	//alert(eleCount);

	for (i = 0;i < eleCount; i++) {
		if (ele.elements[i].type == 'radio' && ele.elements[i].name != 'faqaction'){
			//alert(ele.elements[i].name+' '+ele.elements[i].value);
			if (ele.elements[i].value == setValue){
				ele.elements[i].checked = true;
			}
		}
	}
}

function setFileField(frm){
	frm.fileName.value = frm.add_faq.value;
}
//# SYN }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function focusClear(inputObject)
{
	var hasBeenFocused = inputObject.getAttribute("hasBeenFocused") != null;

	if (!hasBeenFocused)
	{
		inputObject.setAttribute("hasBeenFocused", "true");
		inputObject.style.color = "#000000";
		inputObject.value = "";
		var thisForm = inputObject.form;
		for (ii = 0;  ii < thisForm.elements.length; ii++)
		{
			if (thisForm.elements[ii].type == "submit")
			{
				thisForm.elements[ii].disabled = false;
			}
		}
	}                                
}

function checkSearchValue(thisForm)
{
	if (thisForm.keyword.value=="Search GR" || thisForm.keyword.value == "")
		return false;
	else
		return true;
}

function checkLoginValues(thisForm)
{
	if (thisForm.username.value=="USERNAME" || thisForm.username.value == "" || thisForm.password.value=="PASSWORD" || thisForm.password.value == "")
		return false;
	else
		return true;
}

function display_stars(star_num)
{
        var i;
        for( i=1; i<=5; i++ )
        {
                if ( document.getElementById('star'+i) )
                {
                        if ( i <= star_num )
                                document.getElementById('star'+i).src="/style/structure/rating/star_on.gif";
                        else
                                document.getElementById('star'+i).src="/style/structure/rating/star_off.gif";
                }
        }
}
function show_rating(rating)
{
   if ( rating > 0 && rating < 6 )
   {
	   var rating_text = "<b>Your Rating:</b> <img border=\"0\" style=\"vertical-align: middle;\" src=\"/style/structure/rating/"+rating+".gif\"></img>";
	   document.getElementById('rating_div').innerHTML=rating_text;
   }
}
function rate_review(article_id, rating)
{
		show_rating(rating);
        rate_page = "/article/rate_review.php?article_id="+article_id+"&rating="+rating;
        if ( rating > 0 )
        {
	       window.location.href = rate_page;
        }
}

function rate_blog(article_id, rating, gr_score)
{
		show_rating(rating);
        rate_page = "/blog/rate_blog.php?article_id="+article_id+"&rating="+rating+"&gr_score="+gr_score;
        if ( rating > 0 )
        {
	       window.location.href = rate_page;
        }
}


function showHideLoginWindow() {
	var obj=document.getElementById('loginbox');
	if (obj.style.display=='block') { obj.style.display='none'; } else { obj.style.display='block'; }
	return true;
}
function showHideConsoles() {
	var obj=document.getElementById('consolebox');
	if (obj.style.display=='block') { obj.style.display='none'; } else { obj.style.display='block'; }
	return false;
}



function autosave_load() {
	window.open('/admin/autosave_load.php?autosave_id='+autosave_id, 'loginWindow', 'width=430,height=460,resizable=yes,scrollbars=no');
}

function autosave_set(value) {
	CKEDITOR.instances[autosave_field].setData( unescape(value), function() { document.getElementById('lastsaved').innerHTML = "Draft loaded..."; });
}

function autosave() {
   if (!autosave_id) { return false; }
   
   var t = setTimeout("autosave()", 60000);
   var d = new Date();
   
   var content = CKEDITOR.instances[autosave_field].getData();
   if (content.length > 30)
   {
   new Ajax.Request('/admin/autosave.php', {
	method: 'post',
	parameters: { autosave_id: autosave_id, content: content },
	onSuccess: function(transport) {
		var mins = d.getMinutes(); if (mins<10) { mins = "0" + mins; }
		var secs = d.getSeconds(); if (secs<10) { secs = "0" + secs; }
		document.getElementById('lastsaved').innerHTML = "Last saved at: " + d.getHours() + ":" + mins + ":" + secs;
		//alert(transport.responseText);
		}
	});
   }
}


function swapRows(aRow,bRow){
	if (aRow>bRow) { var tmp=aRow; aRow=bRow; bRow=tmp; }
	
	var flipRow = nRows[aRow].cloneNode(true);
	var flopRow = nRows[bRow].cloneNode(true);
	tblBody.insertBefore(flipRow,nRows[bRow]);
	nRows[aRow].parentNode.removeChild(nRows[aRow]);
	tblBody.insertBefore(flopRow,nRows[aRow]);		
	nRows[bRow+1].parentNode.removeChild(nRows[bRow+1]);
	}
	
function moveRows(from, to){
	var move = -1;
	if (from<to) { move = 1; to--; }
	for (var i=from; i!=to; i+=move) {
		swapRows(i,i+move);
		}
	}
	
function changeType(value) {
	var reg = new RegExp('<a ([^<]*)href="javascript:void\\(0\\);" onclick="javascript:changeType\\(\'' + value + '\'\\)">([^<]+)</a>');
	var rep = '<span $1 class="act">$2</span>';
	$('homepage_nav_inner').update(innNav.replace(reg, rep));

	var moreText = new Array();
	moreText['all']='<a href="javascript:void(0);" onclick="read_many_more();">Read More</a>';
	moreText['news']='Read <a href="/news">more news</a>';
	moreText['review']='Read <a href="/review">more reviews</a> and <a href="/preview">previews</a>';
	moreText['feature']='Read <a href="/features">more features</a>';
	moreText['manifesto']='Read <a href="/manifesto">more manifesto posts</a>';
	$('moreFeatures').update(moreText[value]);

	var cnt = 0;
	$$('tr[class^=tr-]').each(function(s) {
		if ((s.id.indexOf(value) != 0 && value != 'all') || ((value == 'all' && cnt >= cntElementsInAll) || (value != 'all' && cnt > 14))) {
			s.hide();
			} else {
			//if (cnt==3) { third_row = s.id; }
			cnt++;
			s.show();
			if (cnt%2==1) {
				s.removeClassName('singlepostalt');
				s.addClassName('singlepost');
				} else {
				s.removeClassName('singlepost');
				s.addClassName('singlepostalt');
				}
			}
		});
/*
	var tblBody = document.getElementById('tblAllFeatures').getElementsByTagName('tbody')[0];
	var nRows = tblBody.getElementsByTagName('tr');	

	for (var i=0; i<nRows.length; i++) {
		if (nRows[i].id=='topgamestr') { var activeRow=i; }
		if (nRows[i].id==third_row) { var moveTo=i; }
		}

	moveRows(activeRow, moveTo);
*/
	}
	
var cntElementsInAll = 15;
var manyMorePages = 0;
var freeForManyMore = true;

function read_many_more () {
	if (freeForManyMore) {
		freeForManyMore = false;
		xmlHttp = new XMLHttpRequest();
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
			xmlHttp.open("GET", "/system/get_many_more.php?todate="+document.getElementById('timeStampMore').innerHTML);
			xmlHttp.onreadystatechange = function() {
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
					manyMorePages++;
					eval (xmlHttp.responseText);
					freeForManyMore = true;
					}
				};
			xmlHttp.send(null);
			}
		}
	}

function add_another_item(id, content, timestamp) {
	var elementsToShow = 15 + manyMorePages*15;

	if (cntElementsInAll < elementsToShow) {
		var elemInAll = document.getElementById(id);
		if (elemInAll != null) {								// check if we already have that item -- if so just show it, otherwise add it
			elemInAll.show();
			} else {
			Element.insert('tblAllFeatures', content);
			elemInAll = document.getElementById(id);			// get reference to this element after insert
			}
		cntElementsInAll++;
		if (cntElementsInAll%2==1) {
			elemInAll.removeClassName('singlepostalt');
			elemInAll.addClassName('singlepost');
			} else {
			elemInAll.removeClassName('singlepost');
			elemInAll.addClassName('singlepostalt');
			}

		if (cntElementsInAll == elementsToShow) {				// limit reached; set timestamp
			document.getElementById('timeStampMore').innerHTML = timestamp;
			}
		}
	}

	

	

var showLiveResultsID;
var activeLiveLink;
var lastSearch;

function showLiveResults(str) {
	if (showLiveResultsID) { clearTimeout(showLiveResultsID); }
	if (str.length<3) {
		document.getElementById("livesearchresults").innerHTML="";
		document.getElementById("livesearchresults").style.display = "none";
		return;
		} else {
		document.getElementById("livesearchresults").style.display = "block";
		showLiveResultsID = setTimeout(function() { showLiveResults_do(str); },400);
		}
	}
	
function showLiveResults_do(str) {
	xmlHttp = new XMLHttpRequest();
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
		if (lastSearch == str) { return false; } else { lastSearch = str; }		// happens sometimes; easy way to prevent
		xmlHttp.open("GET", "/game/live_search.php?r="+screen.height+"&q="+escape(str),true);
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
				if (str==document.getElementById('searchbutton').value) {
					var rac = xmlHttp.responseText;
					document.getElementById("livesearchresults").innerHTML=xmlHttp.responseText;
					document.getElementById("searchbutton").onkeydown=processKeyPress;
					$$('#livesearchresults a').each( function (s) { s.onkeydown=processKeyPress2; });
					reset_live_list();
					}
				}
			};
		xmlHttp.send(null);
		}
	return false;
	}

processKeyPress = function(e) {
	var whichKey = (document.all)?event.keyCode:e.keyCode; 
	if (whichKey==40) { goto_live_list_tab(0); return false; }
	};

processKeyPress2 = function(e) {
	var whichKey = (document.all)?event.keyCode:e.keyCode; 
	if (whichKey==38) { goto_live_list_tab('prev'); return false;}
	if (whichKey==40) { goto_live_list_tab('next'); return false;}
	if (whichKey==13) { window.location = document.getElementById("livelink_"+activeLiveLink).href; return false;}
	document.getElementById("searchbutton").focus();
	};

function reset_live_list() {
	activeLiveLink = -1;
	document.getElementById("searchbutton").focus();
	$$('#livesearchresults a').each( function (s) { s.removeClassName('livesearchresultshover'); });
	}

function goto_live_list_tab(pos) {
	if (pos == 'prev') {					// if prev/next are used calculate position
		if (activeLiveLink>0) {
			pos = activeLiveLink-1;
			} else {
			reset_live_list();
			return false;
			}
	} else if (pos == 'next') {
		if (document.getElementById("livelink_" + (activeLiveLink+1))!= null) {
			pos = activeLiveLink+1;
			} else {
			return false;
			}
	}
	activeLiveLink = pos;
	$$('#livesearchresults a').each( function (s) { s.removeClassName('livesearchresultshover'); });
	$('livelink_'+activeLiveLink).addClassName('livesearchresultshover');
	document.getElementById("livelink_"+pos).focus();
	}

//$$('#livesearchresults a').each( function (s) { s.onkeydown=processKeyPress2; });
//document.getElementById("searchbutton").onkeydown=processKeyPress;

function vote_updown(comment) {
	xmlHttp = new XMLHttpRequest();
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
		xmlHttp.open("GET", "/system/vote_updown.php?id="+comment.id);
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
				var response = xmlHttp.responseText.split(':');
				if (response[0]=='ERROR') { comment.parentNode.innerHTML = response[1]; }
				if (response[0]=='OK') { comment.innerHTML = parseInt(comment.innerHTML) + 1; }
				}
			};
		xmlHttp.send(null);
		}
	return false;
	}

function show_comment(aelem, id) {
	aelem.parentNode.style.display = 'none';
	//document.getElementById(id).style.display = 'block';	
	//Effect.BlindUp(aelem.parentNode, { duration: 0.3 });
	Effect.BlindDown(id, { duration: 0.2 });
	}
	
function set_reply(id, author) {
	document.getElementById('replyto').value = id;
	if (author!=0) {
		document.getElementById('replytotext').innerHTML = "You're replying to <b>" + author + "</b>'s comment. <a href=\"javascript:void(0)\" onclick=\"set_reply(0,0)\">Discard this reply</a>.";
		document.getElementById('replytotext').style.display = 'block';
		document.getElementById('commenttextarea').focus();
		} else {
		document.getElementById('replytotext').style.display = 'none';
		}
	}

	
function load_all_news_for_a_game(code_name) {
	if (freeForManyMore) {
		freeForManyMore = false;
		xmlHttp = new XMLHttpRequest();
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
			xmlHttp.open("GET", "/system/get_all_game_news.php?gamecode="+code_name);
			xmlHttp.onreadystatechange = function() {
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
					document.getElementById('newssection').innerHTML = xmlHttp.responseText;
					}
				};
			xmlHttp.send(null);
			}
		}
	}
	
	
	
// ---------------------------- From add-event.js -------------------------------------
function addEvent(elm, evType, fn, useCapture){if(elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true;}else if (elm.attachEvent){var r = elm.attachEvent('on' + evType, fn);return r;}else{elm['on' + evType] = fn;}}


// ---------------------------- This section is used to create popups from links that have rel="popup" (comics, faqs, chat, videos) -------------------------------------
var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
		
	type = type.toLowerCase();
	
	if (type == "fullscreen"){
		strWidth = screen.availWidth;
		strHeight = screen.availHeight;
	}
	var tools="";
	if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "mp3") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console" || type == "fullscreen") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=30,top=30";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function doPopUp(e)
{
var t = "standard";									//set defaults - if nothing in rel attrib, these will be used
var w = "780";
var h = "580";
attribs = this.rel.split(" ");						//look for parameters
if (attribs[1]!=null) {t = attribs[1];}
if (attribs[2]!=null) {w = attribs[2];}
if (attribs[3]!=null) {h = attribs[3];}
popUpWin(this.href,t,w,h);							//call the popup script
if (window.event) 									//cancel the default link action if pop-up activated
	{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	} else if (e) 
	{
	e.stopPropagation();
	e.preventDefault();
	}
}

function findPopUps()
{
var popups = document.getElementsByTagName("a");
for (i=0;i<popups.length;i++)
	{
	if (popups[i].rel.indexOf("popup")!=-1)
		{
		popups[i].onclick = doPopUp;				// attach popup behaviour
		if (popups[i].rel.indexOf("noicon")==-1)	// add popup indicator
			{
			popups[i].style.backgroundImage = "url(pop-up.gif)";
			popups[i].style.backgroundPosition = "0 center";
			popups[i].style.backgroundRepeat = "no-repeat";
			popups[i].style.paddingLeft = "15px";
			}
		popups[i].title = popups[i].title + " [Opens in pop-up window]";
		}
	}
}


function setPlatformImageOnHP()
{
var requestUri = document.location.href.substr(document.location.href.indexOf('gamerevolution.com')+18);
if (requestUri=='/xbox360') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_xbox360.png">';
	} else if (requestUri=='/ps3') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_ps3.png">';
	} else if (requestUri=='/wii') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_wii.png">';
	} else if (requestUri=='/ds') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_ds.png">';
	} else if (requestUri=='/psp') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_psp.png">';
	} else if (requestUri=='/pc') {
	document.getElementById('topplatform').innerHTML='<img src="/style/structure/top_pc.png">';
	}
}

addEvent(window, 'load', findPopUps, false);
addEvent(window, 'load', setPlatformImageOnHP, false);
