// JavaScript Document

//POP UP PARA LA VENTANA DE AYUDA
function open_help (){
	window.open('http://www.igotgaming.com/help/index.html','HELP','width=559px,height=365px,scrollbars=yes');
}

function open_help_detail (url){
	window.open(url,'HELP','width=559px,height=365px,scrollbars=yes');
}

// SUBMENUS DE NAVEGACION
function muestre(aquien){
	if(document.getElementById && document.createElement){
		quien = document.getElementById(aquien);
		if(quien.style.display == "none"){
			quien.style.display = "";
		}
		else{
			quien.style.display = "none";
		}
	}
}


// HIPERVINCULOS DE LOS ITEMES DEL RSS

function init() {
	hoverHome();
}

function gotoURL(location) {
	document.location=location;
}


// HOVERS DEL RSS DEL HOME
function hoverHome() {
	var divs = document.getElementsByTagName("div");
	for(var q = 0; q < divs.length; q++) {
		if(divs[q].className == "news one") {divs[q].onmouseover = function() {this.className = "newsH oneH";}; divs[q].onmouseout = function() {this.className = "news one";};}
		if(divs[q].className == "news two") {divs[q].onmouseover = function() {this.className = "newsH twoH";}; divs[q].onmouseout = function() {this.className = "news two";};}
		if(divs[q].className == "news three") {divs[q].onmouseover = function() {this.className = "newsH threeH";}; divs[q].onmouseout = function() {this.className = "news three";};}
		if(divs[q].className == "news four") {divs[q].onmouseover = function() {this.className = "newsH fourH";}; divs[q].onmouseout = function() {this.className = "news four";};}
		if(divs[q].className == "news five") {divs[q].onmouseover = function() {this.className = "newsH fiveH";}; divs[q].onmouseout = function() {this.className = "news five";};}
	}
}

window.onload = init;


// Glossary Scroll ----------->

var ScrollWin = {
	w3c : document.getElementById,
	iex : document.all,
	scrollLoop : false, 
	scrollInterval : null, // setInterval id
	currentBlock : null,   // object reference
	getWindowHeight : function(){
		if(this.iex) return (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
		else return window.innerHeight;
	},
	getScrollLeft : function(){
		if(this.iex) return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		else return window.pageXOffset;
	},
	getScrollTop : function(){
		if(this.iex) return (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		else return window.pageYOffset;
	},
	getElementYpos : function(el){
		var y = 0;
		while(el.offsetParent){
			y += el.offsetTop
			el = el.offsetParent;
		}
		return y;
	},
	scroll : function(num){
		if(!this.w3c){
			location.href = "#"+this.anchorName+num;
			return;
		}
		if(this.scrollLoop){
			clearInterval(this.scrollInterval);
			this.scrollLoop = false;
			this.scrollInterval = null;
		}
		if(this.currentBlock != null) this.currentBlock.className = this.offClassName;
		this.currentBlock = document.getElementById(this.blockName+num);
		this.currentBlock.className = this.onClassName;
		var doc = document.getElementById(this.containerName);
		var documentHeight = this.getElementYpos(doc) + doc.offsetHeight;
		var windowHeight = this.getWindowHeight();
		var ypos = this.getElementYpos(this.currentBlock);
		if(ypos > documentHeight - windowHeight) ypos = documentHeight - windowHeight;
		this.scrollTo(0,ypos);
	},
	scrollTo : function(x,y){
		if(this.scrollLoop){
			var left = this.getScrollLeft();
			var top = this.getScrollTop();
			if(Math.abs(left-x) <= 1 && Math.abs(top-y) <= 1){
				window.scrollTo(x,y);
				clearInterval(this.scrollInterval);
				this.scrollLoop = false;
				this.scrollInterval = null;
			}else{
				window.scrollTo(left+(x-left)/2, top+(y-top)/2);
			}
		}else{
			this.scrollInterval = setInterval("ScrollWin.scrollTo("+x+","+y+")",100);
			this.scrollLoop = true;
		}
	}
};

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/*
using the following line, IE/PC returns an incorrect number when getting the document height.
var document_height = document.all ? document.body.offsetHeight : window.document.height;
To fix this problem, a container div is wrapped around the content so the correct height 
can be determined.
*/

// Edit these variables

ScrollWin.containerName = "Glosary"; // The id name of the div containing the content
ScrollWin.anchorName    = "a_";    // The alpha portion of the anchor names
ScrollWin.blockName     = "b_";     // The alpha portion of the content blocks
ScrollWin.onClassName   = "active";    // The CSS class name for the 'on' state
ScrollWin.offClassName  = "visited";   // The CSS class name for the 'off' state

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

// Change Schedules

function changetime()
{
var NewDate = new Date();
for( i=0; i < document.myform.hiddentime.length; i++)
{
NewDate.setTime( Date.parse( "January 10,1980 " + document.myform.hiddentime[i].value ) );
NewDate.setHours( NewDate.getHours() + Number( document.myform.timezone.value ) );
document.myform.time[i].value = doubledigit( NewDate.getHours() ) + ":" + doubledigit( NewDate.getMinutes() );
}
}

function doubledigit( pDigits )
{
if(pDigits<10) return( "0" + pDigits) 
else  return pDigits
}

// -------------->