// JavaScript Document

m = null;

function hovshow(wid)
{
	var o = document.getElementById(wid);
	if (!(o)) return;
	o.style.display = 'block';
	m = o;
	hovmove();
}
function popUp(URL, wt, ht, tp, lft) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+wt+",height="+ht+",left ="+lft+",top ="+tp+"');");
}

function hovhide(wid)
{
	m = null;
	var o = document.getElementById(wid);
	if (!(o)) return;
	o.style.display = 'none';
}
function hovmove(e)
{
	if (m)
	{
		if (document.all)
		{
			mouseX = event.clientX + document.documentElement.scrollLeft;
			mouseY = event.clientY + document.documentElement.scrollTop;
		}
		else if (e)
		{
			mouseX = e.pageX;
			mouseY = e.pageY;
		}
		else
		{
			mouseX = 220;
			mouseY = 160;
		}
		
		mouseY+=20;
		mouseX+= -44;
		
		m.style.top = mouseY + 'px';
		m.style.left = mouseX + 'px';
	}
}
document.onmousemove = hovmove;

sfHover = function() {

      var sfEls = document.getElementById("navlist").getElementsByTagName("LI");

      for (var i=0; i<sfEls.length; i++) {

            sfEls[i].onmouseover=function() {

                  this.className+=" sfhover";

            }

            sfEls[i].onmouseout=function() {

                  this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

            }

      }

}

if (window.attachEvent) window.attachEvent("onload", sfHover);

function SetClicked(idName){ 
	var elem = document.getElementById(idName);
	alert(elem.className);
	elem.className = 'active';
	//alert(elem.className);
	elem.style.color = '#A7202E';
//document.getElementsByClassName = function ( idName )
//	{
//	  var elements = new Array ();
//	  var children = document.getElementsByTagName( "*" );
//	  for ( var a = 0; a < children.length; a++ )
//	  {
//		 if ( children[a].hasClass ( idName ) ) elements.push ( children[a] );
//	  }
//	  return elements;
//	}
} 



//

function checkCookie(){
	
	//alert('testing for cookies');

	document.cookie = "CookieTest=Enabled";

	var allcookies = document.cookie;
	var pos = allcookies.indexOf("CookieTest=");

	//alert(allcookies);
	//alert(pos);

	if (pos != -1) {
	
		var start = pos + 11;
		
		var end = allcookies.indexOf(";", start);
		
		if (end == -1) end = allcookies.length;
		
		var value = allcookies.substring(start,end);
		
		value = unescape(value);

		if (value != "Enabled") {
			alert("You must have cookies enabled to use the Allotz.com System.");
			location.href = "/enable-cookies.php"
		}

	}else{
	
		alert("You must have cookies enabled to use the Allotz.com System.");
		location.href = "/enable-cookies.php"
	
	}

}

function news_image(img, width, height, title)
{
	if(!title)
	{
		var title = '';
	}
	var leftPos = 50;
	var topPos = 50;
	var w = parseInt(width);
	var h = parseInt(height);
	w += 20;
	h += 26;
	
	if(screen)
	{
		if(screen.width > w)
		{
			leftPos = Math.floor((screen.width/2) - (w/2));
		}
		else
		{
			w = 770;
		}
		if(screen.height > h)
		{
			topPos = Math.floor((screen.height/2) - (h/2));
			if (topPos > 15)
			{
				topPos -= 15;
			}
		}
		else
		{
			h = 560;
		}
	}
	
	img_window = window.open('', 'news_window', 'status=yes, toolbar=no, location=no, scrollbars=yes, resizable=yes, width='+ w +', height='+ h +', left='+ leftPos +', top='+ topPos);
	
	img_window.document.write('<html><head><title>'+ title +'<\/title><style type="text\/css">body { margin: 0; padding: 0; color: #000; } a { text-decoration: none; } .sbody, .sbody:link, .sbody:visited { font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif; font-size: 8pt; color: #a7202e; } .sbody:hover, .sbody:active { color: #e5826d; } <\/style><\/head><body><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" height="100%" align="center" valign="middle"><img src="'+ img +'" border="1"><br /><a href="#" onClick="self.close();" class="sbody">&laquo;Close Window&raquo;<\/a><\/td><\/tr><\/table><\/body><\/html>');
	
	img_window.document.close();
	img_window.focus();
}


