
function showcat(a){	//alert('show='+a)
	document.getElementById(a).style.display='block'
}
function hidedrop(a){	//alert('hide='+a)
	document.getElementById(a).style.display='none'
}






///////////////////////////////////////navigation.js//////////////////////////////////////////////////
function ranking(val)
{
if(val==1)
	{
document.getElementById('rankCon2').style.display="none";
document.getElementById('rankCon1').style.display="block";
document.getElementById('rankCon3').style.display="none";

document.getElementById('li2').className = "";
document.getElementById('li1').className = "active";
document.getElementById('li3').className = "";
	}
else if(val==2)
	{
document.getElementById('rankCon1').style.display="none";
document.getElementById('rankCon2').style.display="block";
document.getElementById('rankCon3').style.display="none";

document.getElementById('li1').className = "";
document.getElementById('li2').className = "active";
document.getElementById('li3').className = "";

	}
else
	{
document.getElementById('rankCon1').style.display="none";
document.getElementById('rankCon3').style.display="block";
document.getElementById('rankCon2').style.display="none";

document.getElementById('li1').className = "";
document.getElementById('li3').className = "active";
document.getElementById('li2').className = "";
	}


}

function changeTopVideo( name, arg, total_arg){
	for (var i=1;i <= total_arg;i++){
		if(i == arg ){
			document.getElementById( name+i+"_0").style.display="block";
			document.getElementById( name+i+"_1").style.display="none";
		}
		else{
			document.getElementById( name+i+"_0").style.display="none";
			document.getElementById( name+i+"_1").style.display="block";
		}
	}
}

function funcMouseMove( name, arg, total_arg){
	for (var i=1;i <= total_arg;i++){
		if(i == arg )
		  document.getElementById( name+i).style.display="block";
		else
	  	  document.getElementById( name+i).style.display="none";

	}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//open new window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

///////////////////////////////stats_homepage.js/////////////////////////////////////////////////////////////////////////////////////////////
function tab_search(search)
{
if(search==1)
{
	path="/stats1/searchplayer.php";
document.getElementById("searchp").innerHTML="<li class='active' style='margin-left:3px;'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Year</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
}
else if (search==2)
{
	path="/stats1/searchteam.php";
document.getElementById("searchp").innerHTML="<li class='active' style='margin-left:3px;'><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></span></li><li class='active'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Year</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
} 
else if(search==3)
{
path="/stats1/searchoffical.php";
document.getElementById("searchp").innerHTML="<li class='active' style='margin-left:3px;'><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Year</a></span></li><li class='active'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
}
else if(search==4)
{
path="/stats1/searchground.php";
document.getElementById("searchp").innerHTML="<li class='active' style='margin-left:3px;'><span><a href='#' onclick='javascript:tab_search(1);'>Player</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Year</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></span></li><li class='active'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li>";
}
document.getElementById("searchform").action=path;

}

function righttab_search(search)
	{
		if(search==1)
		{
			path="/stats1/searchplayer.php";
		//document.getElementById("searchp").innerHTML="<li class='active' style='margin-left:3px;'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Team</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
		document.getElementById("rightsearchul").innerHTML="<li class='active' style='margin-left:3px;'><div><a style = 'cursor:pointer;' onclick='javascript:righttab_search(1);'>Stats</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(2);'>News</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(3);'>Videos</a></span></li>";
		document.getElementById("searchby").style.display="block";
		document.getElementById("rightsearchtextbox").style.width=130+"px";
		}
		else if (search==2)
		{
			path="/search/searchnews.php";
		document.getElementById("rightsearchul").innerHTML="<li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(1);'>Stats</a></span></li><li class='active' style='margin-left:3px;'><div><a style = 'cursor:pointer;' onclick='javascript:righttab_search(2);'>News</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(3);'>Videos</a></span></li>";
		document.getElementById("searchby").style.display="none";
		document.getElementById("rightsearchtextbox").style.width=230+"px";
		}
		else if(search==3)
		{
		path="/search/searchvideos.php";
		//document.getElementById("rightsearchul").innerHTML="<li class='active' style='margin-left:3px;'><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Team</a></span></li><li class='active'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
		document.getElementById("rightsearchul").innerHTML="<li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(1);'>Stats</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:righttab_search(2);'>News</a></span></li><li class='active' style='margin-left:3px;'><div><a style = 'cursor:pointer;' onclick='javascript:righttab_search(3);'>Videos</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li>";
		document.getElementById("searchby").style.display="none";
		document.getElementById("rightsearchtextbox").style.width=230+"px";

		
		}

document.getElementById("rightsearch").action=path;



	}


function article_statstab(search)
	{
		if(search==1)
		{
		path="/stats1/searchplayer.php";
		document.getElementById("rightarticlesearchul").innerHTML="<li class='active' style='margin-left:3px;'><div><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(1);'>Player</a></div><p align='center'><img src='/pix/web3/greyarrow.gif' border='0' /></p></li><li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(2);'>Year</a></span></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(3);'>Offical</a></span></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(4);'>Ground</a></span></li>";
	
		}
		else if (search==2)
		{
		path="/stats1/searchteam.php";
		document.getElementById("rightarticlesearchul").innerHTML="<li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(1);'>Player</a></span></li><li class='active' style='margin-left:3px;'><div><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(2);'>Year</a></div><p align='center'><img src='/pix/web3/greyarrow.gif' border='0' /></p></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(3);'>Offical</a></span></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(4);'>Ground</a></span></li>";
	
		}
		else if(search==3)
		{
		path="/stats1/searchoffical.php";
		//document.getElementById("rightsearchul").innerHTML="<li class='active' style='margin-left:3px;'><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(1);'>Player</a></span></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(2);'>Team</a></span></li><li class='active'><div><a style = 'cursor:pointer;' onclick='javascript:tab_search(3);'>Offical</a></div><p align='center'><img src='/pix/web3/whitearrow.gif' alt='' title='' border='0' /></p></li><li><span><a style = 'cursor:pointer;' onclick='javascript:tab_search(4);'>Ground</a></span></li>";
		document.getElementById("rightarticlesearchul").innerHTML="<li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(1);'>Player</a></span></li><li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(2);'>Year</a></span></li><li  class='active' style='margin-left:3px;'><div><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(3);'>Offical</a></div><p align='center'><img src='/pix/web3/greyarrow.gif' border='0' /></p></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(4);'>Ground</a></span></li>";
			
		}
		else if(search==4)
		{
		path="/stats1/searchground.php";
		document.getElementById("rightarticlesearchul").innerHTML="<li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(1);'>Player</a></span></li><li><span><a  style = 'cursor:pointer;' onclick='javascript:article_statstab(2);'>Year</a></span></li><li><span><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(3);'>Offical</a></span></li><li class='active' style='margin-left:3px;'><div><a   style = 'cursor:pointer;' onclick='javascript:article_statstab(4);'>Ground</a></div><p align='center'><img src='/pix/web3/greyarrow.gif' border='0' /></p></li>";
			
		}

document.getElementById("articlerightsearch").action=path;



	}
	
////////////////////////////////////////////js/stats/stats-oct2008.js/////////////////////////////////////////////
function clearStatsInput(e)
{
if(e.value=='by keywords')e.value="";
}
function TestDataCheck()
{

	if(document.searchform.q.value == '' || document.searchform.q.value == 'by keywords')
	{
		alert("Please enter the keywords")
			return false;
		
	}
}

function includefile3(pURL2) {
	
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
      xmlhttp3=new XMLHttpRequest();
      xmlhttp3.onreadystatechange=postFileReady3;
      xmlhttp3.open("GET", pURL2, true);
      xmlhttp3.send(null);
   } else if (window.ActiveXObject) { //IE
      xmlhttp3=new ActiveXObject('Microsoft.XMLHTTP');
      if (xmlhttp3) {
         xmlhttp3.onreadystatechange=postFileReady3;
         xmlhttp3.open('GET', pURL2, true);
         xmlhttp3.send();
      }
   }
}

// function to handle asynchronous call
function postFileReady3() {
   if (xmlhttp3.readyState==4) {
      if (xmlhttp3.status==200) {
         document.getElementById('theDivToLoad3').innerHTML=xmlhttp3.responseText;
      }
   }
}

 function changeAction(aForm,aValue)
{
	
if(aValue=="")
return;
aForm.setAttribute("action",aValue);
}
////////////////////////////////////////dynamic_write.js/////////////////////////////////////////////////
function includefile(pURL) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=postFileReady;
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
   } else if (window.ActiveXObject) { //IE
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
      if (xmlhttp) {
         xmlhttp.onreadystatechange=postFileReady;
         xmlhttp.open('GET', pURL, true);
         xmlhttp.send();
      }
   }
}
function postFileReady() {
   if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
         document.getElementById('theDivToLoad').innerHTML=xmlhttp.responseText;
      }
   }
}

function includefile2(pURL2) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
      xmlhttp2=new XMLHttpRequest();
      xmlhttp2.onreadystatechange=postFileReady2;
      xmlhttp2.open("GET", pURL2, true);
      xmlhttp2.send(null);
   } else if (window.ActiveXObject) { //IE
      xmlhttp2=new ActiveXObject('Microsoft.XMLHTTP');
      if (xmlhttp2) {
         xmlhttp2.onreadystatechange=postFileReady2;
         xmlhttp2.open('GET', pURL2, true);
         xmlhttp2.send();
      }
   }
}

function postFileReady2() {
   if (xmlhttp2.readyState==4) {
      if (xmlhttp2.status==200) {
         document.getElementById('theDivToLoad2').innerHTML=xmlhttp2.responseText;
      }
   }
}
/////////////////////////////////////////tab1.js////////////////////////////////////////////////
//// For the Login Box 
if (self.screen) {     // for NN4 and IE4
        width = screen.width
        height = screen.height
// Testing this first prevents firing the slow Java of NN4
}
else if (self.java) {   // for NN3 with enabled Java
       var jkit = java.awt.Toolkit.getDefaultToolkit();
       var scrsize = jkit.getScreenSize();       
       width = scrsize.width; 
       height = scrsize.height; 
}
else{
 width = height = '?' // N2, E3, N3 w/Java off, probably Opera and WebTV

}

if ( width <= 1024  ) width = width - 280;
if ( (width > 1024) && (width <= 1280)  ) width = width - 400;
if ( width > 1280  ) width = width - 490;

///// End of Manipulation of Login box

function funcOpenLoginBox ( div_name, action )
{
	if ( action == 'close')
		window.parent.document.getElementById('apDiv2').style.display = "none";
	else if ( action == 'show')
		window.parent.document.getElementById('apDiv2').style.display = "block";

}

/////////////////////////////////////////////////////////////////////////////////////////
function replace_plus(text)
	{
        return text.replace('+',' ');
	}	
	
	
function get_cookie(Name) 
	{
		
		var search = Name+"="	
		var returnvalue = "";
		//alert(document.cookie.length);
		if (document.cookie.length > 0) {
			offset = document.cookie.indexOf(search)
			// if cookie exists //
			//alert(offset);
			if (offset != -1) {
				offset += search.length
				// set index of beginning of value
				end = document.cookie.indexOf(";", offset);
				// set index of end of cookie value
				if (end == -1) end = document.cookie.length;
				returnvalue=unescape(document.cookie.substring(offset, end));
				
					var a 	=returnvalue.length;
					for(i=0;i<a;i++)
					{
						returnvalue=replace_plus(returnvalue);
					}
			}
		}
		
		return returnvalue;
	}
function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function delCookie(name) {
//document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
	setcookie(name, "", time() - 3600 , "/", "ibnlive.com");
} 
function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function Get_Cookie1( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}

function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie1( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function validate_frm_login()
{
	
	if(document.frmregistration.login.value=='')
	{
		alert('Please enter username');
		return false;
	}
	if(document.frmregistration.password.value=='')
	{
		alert('Please enter password');
		return false;
	}
}
function get_cookie_variable(str,pos)
{
	var arr_cookie=str.split("**");
	var name=arr_cookie[pos];
	return name;
}


function Trim1(str)
{
  return RTrim(LTrim(str));
}

function Trim(str) {
	str =Trim1(str);
    return str.replace(/(^\s+)([^\s]*)(\s+$)/, '$2');
}

function LTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
   var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;
    s = s.substring(j, i);
  }
  return s;
}
function RTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
   var i = s.length - 1;       // Get length of string
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;
    s = s.substring(0, i+1);
  }

  return s;
}	
//////////////////////////////////////////////////////////////////////////////////////
function enableTooltips(id)
{

	var links,i,h;
	if(!document.getElementById || !document.getElementsByTagName) return;
	AddCss();
	h=document.createElement("span");
	h.id="btc";
	h.setAttribute("id","btc");
//	h.setAttribute("style","z-index:99");
	h.style.position="absolute";
	h.style.zIndex = "1";
	document.getElementsByTagName("body")[0].appendChild(h);
	if(id==null) links=document.getElementsByTagName("a");
	else links=document.getElementById(id).getElementsByTagName("a");
	for(i=0;i<links.length;i++)
	{
		Prepare(links[i]);
	}
}

function Prepare(el)
{
	var tooltip,t,b,s,l, img;

	t=el.getAttribute("title");
	link=el.getAttribute("link");
	width = el.getAttribute("rel");
	height =el.getAttribute("rev");


	if(t==null || t.length==0) t="link:";

	el.removeAttribute("title");

	img=el.getAttribute("name");
	var newimg = document.createElement('img');
	newimg.src = img;
	newimg.alt = t;
	newimg.width = width;
	newimg.height = height;

	if(img==null || img.length==0)
	{
		img = "";
		el.removeAttribute("name");
	}
	else
	{
		tooltip=CreateEl("span","tooltip");

		imgdisplay=CreateEl("span", "top");
		imgdisplay.appendChild(newimg);
		tooltip.appendChild(imgdisplay);

		b=CreateEl("b","bottom");
		tooltip.appendChild(b);
		setOpacity(tooltip);
		el.tooltip=tooltip;
		el.onmouseover=showTooltip;
		el.onmouseout=hideTooltip;
		el.onmousemove=Locate;
	}
}

function showTooltip(e){
document.getElementById("btc").appendChild(this.tooltip);
Locate(e);
}

function hideTooltip(e){
var d=document.getElementById("btc");
if(d.childNodes.length>0) d.removeChild(d.firstChild);
}

function setOpacity(el){
el.style.filter="alpha(opacity:95)";
el.style.KHTMLOpacity="0.95";
el.style.MozOpacity="0.95";
el.style.opacity="0.95";
}

function CreateEl(t,c){
var x=document.createElement(t);
x.className=c;
x.style.display="block";
return(x);
}

function AddCss(){
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","/css/web2/tooltips1.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}

function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
    posx=e.pageX; posy=e.pageY;
    }
else if(e.clientX || e.clientY){
    if(document.documentElement.scrollTop){
        posx=e.clientX+document.documentElement.scrollLeft;
        posy=e.clientY+document.documentElement.scrollTop;
        }
    else{
        posx=e.clientX+document.body.scrollLeft;
        posy=e.clientY+document.body.scrollTop;
        }
    }
document.getElementById("btc").style.top=(posy+5)+"px";
document.getElementById("btc").style.left=(posx-80)+"px";
}

///////////////////////////////////////////////////////////////////////////////////////
function createObject() 
{ 
var objXmlHttp=null 

if (navigator.userAgent.indexOf("Opera")>=0) 
   { 
    alert("This example doesn't work in Opera") 
    return  objXmlHttp;
   } 
if (navigator.userAgent.indexOf("MSIE")>=0) 
   { 
   var strName="Msxml2.XMLHTTP" 
   if (navigator.appVersion.indexOf("MSIE 5.5")>=0) 
      { 
      strName="Microsoft.XMLHTTP" 
      } 
   try 
      { 
      objXmlHttp=new ActiveXObject(strName) 
      return objXmlHttp 
      } 
   catch(e) 
      { 
      alert("Error. Scripting for ActiveX might be disabled") 
      return 
      } 
    } 
if (navigator.userAgent.indexOf("Mozilla")>=0) 
   { 
   objXmlHttp=new XMLHttpRequest() 
   return objXmlHttp 
   } 
} 
///////////////////////////////////////////////////////////////////////////////////////////////
function updateDiv(div,pURL) 
{
	var file_div=createObject();
	file_div.onreadystatechange=function()
	{
		if (file_div.readyState==4) 
		{
		   if (file_div.status==200) 
			{
			  document.getElementById(div).innerHTML=file_div.responseText;
			}
		}
	}
       file_div.open("GET",pURL,true);
	file_div.send(null);
}





////////////////////////////////////////////////////////////////////////////////////////

// JavaScript Document
