/*
By Kalle Väravas
www.iyfgaming.com
*/


x = 20;
y = 20;

function getScrollWidth()
{
var w = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
return w ? w : 0;
}
function getScrollHeight()
{
var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
return h ? h : 0;
}



function CurrentAction(curaction){
if(!window.disableProgressBar){
CurrentAction = document.getElementById("CurrentActionDiv");
document.getElementById('CurrentActionDiv').innerHTML = curaction;
CurrentAction.style.display = "inline";
CurrentAction.style.visibility = "visible";
CurrentAction.style.left = x + getScrollWidth() + 'px' ;
CurrentAction.style.top = y + getScrollHeight() + 'px' ;
}
}



function CurrentActionTimeout(curaction){
if(!window.disableProgressBar){
CurrentAction = document.getElementById("CurrentActionDiv");
document.getElementById('CurrentActionDiv').innerHTML = curaction;
CurrentAction.style.display = "inline";
CurrentAction.style.visibility = "visible";
CurrentAction.style.left = x + getScrollWidth() + 'px' ;
CurrentAction.style.top = y + getScrollHeight() + 'px' ;
setTimeout (DelCurrentAction, 1700);
}
}

function ChaCurrentAction(changeaction){
document.getElementById('CurrentActionDiv').innerHTML = changeaction;
}

function DelCurrentAction()
{
CurrentAction.style.visibility = "hidden";
}


function logout_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="60")';
	body_self[0].style.MozOpacity = '0.4';
	body_self[0].style.opacity = '0.4';

	if (confirm('You are about to log out. Continue?'))
	{
        ChaCurrentAction('Logging out..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}

}

function iyfleave_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	if (confirm('Your about to leave the IYF Clan. Continue?'))
	{
        ChaCurrentAction('Updating..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}
}


function onlyonceform(submitform){
if (document.all || document.getElementById){
for (i = 0; i < submitform.length; i++){
var tempob = submitform.elements[i]
if( tempob.type.toLowerCase() == "submit" || tempob.type.toLowerCase() == "reset")
tempob.disabled=true
}
}
}



function delete_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	if (confirm('Your about to delete this video. Continue?'))
	{
        ChaCurrentAction('Deleting..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}
}

function deletescreen_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	if (confirm('Your about to delete this screenshot. Continue?'))
	{
        ChaCurrentAction('Deleting..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}
}

function deletearticle_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	if (confirm('Your about to delete this article. Continue?'))
	{
        ChaCurrentAction('Deleting..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}
}



function removefriend_question()
{
    CurrentAction = document.getElementById("CurrentActionDiv");
    document.getElementById('CurrentActionDiv').innerHTML = "Standing by..";
    CurrentAction.style.display = "inline";
    CurrentAction.style.visibility = "visible";

	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	if (confirm('Your about to remove your friend. Continue?'))
	{
        ChaCurrentAction('Deleting..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return true;
	}
	else
	{
        CurrentActionTimeout('Canceled..');
		body_self[0].style.filter = 'Alpha(opacity="100")';
		body_self[0].style.MozOpacity = '1';
		body_self[0].style.opacity = '1';
		return false;
	}
}


/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/




//Contents for menu 1
var main=new Array()
main[0]='<div align="left"><a href="http://www.iyfgaming.com/community/search.php?search_id=egosearch" class="logmenu">My posts</a></div>'
main[1]='<div align="left"><a href="http://www.iyfgaming.com/community/search.php?search_id=watched" class="logmenu">My watched topics</a></div>'
main[2]='<div align="left"><a href="http://www.iyfgaming.com/p/40&view=mvids" class="logmenu">My videos</a></div>'
main[3]='<div align="left"><a href="http://www.iyfgaming.com/p/40&view=favs" class="logmenu">My favorite videos</a></div>'
main[4]='<div align="left"><a href="http://www.iyfgaming.com/p/41&a=mscns" class="logmenu">My screenshots</a></div>'
main[5]='<div align="left"><a href="http://www.iyfgaming.com/community/activity_favs.php" class="logmenu">My favorite PlayGames</a></div>'
main[6]='<div align="left"><a href="http://www.iyfgaming.com/clan" class="logmenu">My IYF Clan membership</a></div>'







var menuwidth='165px' //default menu width
var menubgcolor='#2C2C2C'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu



//Drop Down/ Overlapping Content: http://www.dynamicdrive.com
//**Updated: Dec 19th, 07': Added ability to dynamically populate a Drop Down content using an external file (Ajax feature)
//**Updated: Feb 29th, 08':
				//1) Added ability to reveal drop down content via "click" of anchor link (instead of default "mouseover")
				//2) Added ability to disable drop down content from auto hiding when mouse rolls out of it
				//3) Added hidediv(id) public function to directly hide drop down div dynamically

//**Updated: Sept 11th, 08': Fixed bug whereby drop down content isn't revealed onClick of anchor in Safari/ Google Chrome

var dropdowncontent={
	disableanchorlink: true, //when user clicks on anchor link, should link itself be disabled (always true if "revealbehavior" above set to "click")
 hidedivmouseout: false, //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]
	ajaxloadingmsg: "Loading content. Please wait...", //HTML to show while ajax page is being feched, if applicable
	ajaxbustcache: true, //Bust cache when fetching Ajax pages?

	getposOffset:function(what, offsettype){
		return (what.offsetParent)? what[offsettype]+this.getposOffset(what.offsetParent, offsettype) : what[offsettype]
	},

	isContained:function(m, e){
		var e=window.event || e
		var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
		while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
		if (c==m)
			return true
		else
			return false
	},

	show:function(anchorobj, subobj, e){
		if (!this.isContained(anchorobj, e) || (e && e.type=="click")){
			var e=window.event || e
			if (e.type=="click" && subobj.style.visibility=="visible"){
				subobj.style.visibility="hidden"
				return
			}
			var horizontaloffset=(subobj.dropposition[0]=="left")? -(subobj.offsetWidth-anchorobj.offsetWidth) : 0 //calculate user added horizontal offset
			var verticaloffset=(subobj.dropposition[1]=="top")? -subobj.offsetHeight : anchorobj.offsetHeight //calculate user added vertical offset
			subobj.style.left=this.getposOffset(anchorobj, "offsetLeft") + horizontaloffset + "px"
			subobj.style.top=this.getposOffset(anchorobj, "offsetTop")+verticaloffset+"px"
			subobj.style.clip=(subobj.dropposition[1]=="top")? "rect(auto auto auto 0)" : "rect(0 auto 0 0)" //hide drop down box initially via clipping
			subobj.style.visibility="visible"
			subobj.startTime=new Date().getTime()
			subobj.contentheight=parseInt(subobj.offsetHeight)
			if (typeof window["hidetimer_"+subobj.id]!="undefined") //clear timer that hides drop down box?
				clearTimeout(window["hidetimer_"+subobj.id])
			this.slideengine(subobj, (subobj.dropposition[1]=="top")? "up" : "down")
		}
	},

	curveincrement:function(percent){
		return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
	},

	slideengine:function(obj, direction){
		var elapsed=new Date().getTime()-obj.startTime //get time animation has run
		if (elapsed<obj.glidetime){ //if time run is less than specified length
			var distancepercent=(direction=="down")? this.curveincrement(elapsed/obj.glidetime) : 1-this.curveincrement(elapsed/obj.glidetime)
			var currentclip=(distancepercent*obj.contentheight)+"px"
			obj.style.clip=(direction=="down")? "rect(0 auto "+currentclip+" 0)" : "rect("+currentclip+" auto auto 0)"
			window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj, direction)}, 10)
		}
		else{ //if animation finished
			obj.style.clip="rect(0 auto auto 0)"
		}
	},

	hide:function(activeobj, subobj, e){
		if (!dropdowncontent.isContained(activeobj, e)){
			window["hidetimer_"+subobj.id]=setTimeout(function(){
				subobj.style.visibility="hidden"
				subobj.style.left=subobj.style.top=0
				clearTimeout(window["glidetimer_"+subobj.id])
			}, dropdowncontent.hidedivmouseout[1])
		}
	},

	hidediv:function(subobjid){
		document.getElementById(subobjid).style.visibility="hidden"
	},

	ajaxconnect:function(pageurl, divId){
		var page_request = false
		var bustcacheparameter=""
		if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
			page_request = new XMLHttpRequest()
		else if (window.ActiveXObject){ // if IE6 or below
			try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
			}
			catch (e){
				try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch (e){}
			}
		}
		else
			return false
		document.getElementById(divId).innerHTML=this.ajaxloadingmsg //Display "fetching page message"
		page_request.onreadystatechange=function(){dropdowncontent.loadpage(page_request, divId)}
		if (this.ajaxbustcache) //if bust caching of external page
			bustcacheparameter=(pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
		page_request.open('GET', pageurl+bustcacheparameter, true)
		page_request.send(null)
	},

	loadpage:function(page_request, divId){
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
			document.getElementById(divId).innerHTML=page_request.responseText
		}
	},

 init:function(anchorid, pos, glidetime, revealbehavior){
		var anchorobj=document.getElementById(anchorid)
		var subobj=document.getElementById(anchorobj.getAttribute("rel"))
		var subobjsource=anchorobj.getAttribute("rev")
		if (subobjsource!=null && subobjsource!="")
			this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel"))
		subobj.dropposition=pos.split("-")
		subobj.glidetime=glidetime || 1000
		subobj.style.left=subobj.style.top=0
		if (typeof revealbehavior=="undefined" || revealbehavior=="mouseover"){
			anchorobj.onmouseover=function(e){dropdowncontent.show(this, subobj, e)}
			anchorobj.onmouseout=function(e){dropdowncontent.hide(subobj, subobj, e)}
			if (this.disableanchorlink) anchorobj.onclick=function(){return false}
		}
		else
			anchorobj.onclick=function(e){dropdowncontent.show(this, subobj, e); return false}
		if (this.hidedivmouseout[0]==true) //hide drop down DIV when mouse rolls out of it?
			subobj.onmouseout=function(e){dropdowncontent.hide(this, subobj, e)}
	}
}



var xpersistclose=0 //set to 0 or 1. 1 meaxns once the bar is manually closed, it will remain closed for browser session
var xstartX = 20 //set x offset of bar in pixels
var xstartY = 20 //set y offset of bar in pixels
var xverticalpos="fromtop" //enter "fromtop" or "frombottom"

function xstaticbar(){
	xbarheight=document.getElementById("CurrentActionDiv").offsetHeight
	var xns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var xel=d.getElementById(id);
		if (!xpersistclose || xpersistclose && get_cookie("remainclosed")=="")
		xel.style.visibility="visible"
		if(d.layers)xel.style=xel;
		xel.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		xel.x = xstartX;
		if (xverticalpos=="fromtop")
		xel.y = xstartY;
		else{
		xel.y = xns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		xel.y -= xstartY;
		}
		return xel;
	}
	window.xstayTopLeft=function(){
		if (xverticalpos=="fromtop"){
		var xpY = xns ? pageYOffset : iecompattest().scrollTop;
		xftlObj.y += (xpY + xstartY - xftlObj.y)/8;
		}
		else{
		var xpY = xns ? pageYOffset + innerHeight - xbarheight: iecompattest().scrollTop + iecompattest().clientHeight - xbarheight;
		xftlObj.y += (xpY - xstartY - xftlObj.y)/8;
		}
		xftlObj.sP(xftlObj.x, xftlObj.y);
		setTimeout("xstayTopLeft()", 10);
	}
	xftlObj = ml("CurrentActionDiv");
	xstayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", xstaticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", xstaticbar)
else if (document.getElementById)
window.onload=xstaticbar








/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}