/* Copyright Ben Sutcliffe 2008 
brgs.me.uk */

function allPagesOnload() {
	
	if(screen.width>1672) {
		var xaxis = "center";
	} else {
		var xaxis = "left";
	}
	
	if(screen.height>1200) {
		var yaxis = "top";
	} else {
		var yaxis = "top";
	}
	
	document.getElementById("imageLoader").style.display = "none";
	document.body.style.backgroundPosition = xaxis+" "+yaxis;
	document.getElementById("loadingScreen").style.display = "none";
	document.getElementById("loadingScreen").style.width = "0px";
	document.getElementById("loadingScreen").style.height = "0px";
	
	addAllPagesOnload();
};

function addAllPagesOnload() {
	
};

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function setOpacity(what, amount) {
obj = document.getElementById(what);
obj.style.MozOpacity = amount;
obj.style.opacity = amount/10;
obj.style.filter = 'alpha(opacity=\' + amount*10 + \')';
};

function fade(what,inout,next){
obj = document.getElementById(what); //Get the Element

if(inout=="out") {


 var alpha = 10; //Set the initial amountue of alpha to 10 (Opaque)
 function f(){ //Internal function

  alpha--; //Decrement the alpha amountue
  setOpacity(what, alpha); //Set the opacity of our element to the specified alpha

  if(alpha > -1){ //If alpha is still bigger than -1 then..
   setTimeout(f, 60); //..then call the function again after 100 milliseconds

  }else{ //otherwise..
   obj.style.display = 'none'; //..otherwise now that we cant see the element anyways, hide it
   if(next) fade(next,"in");

  }
}
setTimeout(f, 60); //This is where we call the f() function for the first time

} else {

setOpacity(what, 0);
	
 obj.style.display = 'block'; //Un-hide the object before its animation
 var alpha = 0; //Set the initial amountue of alpha to 0 (invisible)

 function a(){ //Internal function
  alpha++; //Increment alpha

  setOpacity(what, alpha); //Set the opacity of our element to the specified alpha
  if(alpha < 11)setTimeout(a, 60);
  if(alpha>9) { if(next) fade(next,"out"); };

/*Till alpha is 10, keep calling the
a() function after 100 milliseconds */
}
setTimeout(a, 60); //This is where we call the a() function for the first time

} 

};
