function findPos(obj) { //Finds precise position for an element
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);
	return [curleft,curtop];
	}
}
//------------------------------
function showGC(user,elem,tag){ //Used to show XBL gamercards and Avatars
	
	var posing = findPos(elem); //Find the position of the element, next lines find the dimensions
	var wide=elem.width;
	var tall=elem.height;
	var targ=document.getElementById(user+'GCDIV'); //Define the gamercard and avatar divs
	var avatarg=document.getElementById(user+'xblavatar');
	
	//This lines retrieve the gamercard and avatar from MS's site
	document.getElementById(user+'GCIF').src = "http://gamercard.xbox.com/"+tag+".card";
	avatarg.src = "http://avatar.xboxlive.com/avatar/"+tag+"/avatar-body.png";
	
	//Put the stuff where it goes
	targ.style.left=posing[0]+(wide/2)+'px';
	targ.style.top=posing[1]+(tall/2)+'px';
	avatarg.style.left=0+125+'px';
	avatarg.style.top=0-155+'px';

	//Show it
	targ.style.visibility='visible';
}
//-----------------------------
function hideGC(elem){ //Hide XBL stuff
	elem.parentNode.parentNode.style.visibility='hidden';
}
//------------------------------
function toggleSpoiler(spoiler) { //hide/show spoiler
	var vis = spoiler.nextSibling; //Get the one we want to toggle
	//alert(vis.style.visibility);
	if (vis.style.visibility=="hidden") vis.style.visibility="visible";
	else vis.style.visibility="hidden";
	//alert(vis.style.visibility);
}


