Gl_TopMenuTime=0;
Gl_TopStoriesTime=0;
Gl_TopStoriesCurrentPad=-1;

Menu_Autodir="L";
Menu_Userclicked="NO";
	function PopWindow(URL,height,width)
	{
		hWindow = window.open(URL,height+width,"width="+width+",height="+height+",resize=no,resizable=no,scrollbars=yes,menubar=no,status=no");
		hWindow.focus();
	}
	function PopWindowNoScroll(URL,height,width)
	{
		hWindow = window.open(URL,height+width,"width="+width+",height="+height+",resize=no,resizable=no,scrollbars=no,menubar=no,status=no");
		hWindow.focus();
	}

	function PopUnderWindow(URL,height,width)
	{
		hWindow = window.open(URL,height+width,"width="+width+",height="+height+",resize=no,resizable=no,scrollbars=no,menubar=no,status=no");
	}

	function PopOnlyURL(URL)
	{
		hWindow = window.open(URL);
	}

		function ObjSwitcher(objname)
		{
		 myobject=document.getElementById("Mp_"+objname);
		 Chkitems=document.getElementById("Mp_UsrItems");
		 DataChkitems=Chkitems.value;
		 if (myobject.style.display=="none")
		 {
		   myobject.style.visibility="visible";
		   myobject.style.display="";
		   Chkitems.value=DataChkitems.replace(objname+"-","")+objname+"-";
		 }
		else
		 {
		   myobject.style.visibility="hidden";
		   myobject.style.display="none";
		   Chkitems.value=DataChkitems.replace(objname+"-","")
		 }
		}
		function ElementSwitcher(objhandle,objname)
		{
		 myobject=document.getElementById("El_"+objname);
		 if (myobject.style.display=="none")
		 {
		   myobject.style.visibility="visible";
		   myobject.style.display="";
		   objhandle.src="images/site/minimise.gif";
		 }
		else
		 {
		   myobject.style.visibility="hidden";
		   myobject.style.display="none";
		   objhandle.src="images/site/restore.gif";
		 }
		}
		function ClosedSwitcher(objname)
		{
		 myobject=document.getElementById("Mp_"+objname);
		 myobject.style.visibility="hidden";
		 myobject.style.display="none";
		 Chkitems=document.getElementById("Mp_UsrItems");
		 DataChkitems=Chkitems.value;
		 Chkitems.value=DataChkitems.replace(objname+"-","")
		}

		function Imageswapper(objname)
		{
		 	myobject=document.getElementById("Img_"+objname);
			myobject.src="images/site/mynews_interactive1.gif";
		}


 


 function ScrollMenu(direc)
 {
   myObj=window.document.getElementById("MenuRow");
   MyStr=""
   if (direc==1)
   {
        Diff=MenuCount-ShowItems;
        MenuLeft=MenuLeft+18;
        //ShowItems=Diff;
        if (MenuLeft>Diff) { MenuLeft=MenuCount-18; Menu_Autodir="R";}
   }
   else
   {
	MenuLeft=MenuLeft-18;
	if (MenuLeft<0) { MenuLeft=0; Menu_Autodir="L"; }
   }
   myObj=window.document.getElementById("MenuRow");
   MyStr=""
   for (ui=0;ui<ShowItems;ui++)
   {
      CurrItem=(MenuLeft+ui);
      CurrItemdata=MenuItems[CurrItem];
      if (CurrItemdata.length>2)
      {
	      if (ui>0) { MyStr=MyStr+" | "; }
	      ItemCaption=Left(CurrItemdata,CurrItemdata.indexOf("*"))
	      ItemLinkTip=CurrItemdata.replace(ItemCaption+"*"," ")
	      MyStr=MyStr+"<a href='" + MenuLinks[CurrItem] + "' title='" + ItemLinkTip + "' class='mainlink'";
	      if (Left(ItemCaption,1)=="~")
	      {
	           MyStr=MyStr+" target='_blank'"
	      }
	      MyStr=MyStr+" >"
	      MyStr=MyStr+ItemCaption.replace("~","");
	      MyStr=MyStr+"</a>"
      }
   }
   myObj.innerHTML=MyStr;
}

  function Left(str, n){
  	if (n <= 0)
  	    return "";
  	else if (n > String(str).length)
  	    return str;
  	else
  	    return String(str).substring(0,n);
  }
  function Right(str, n){
      if (n <= 0)
         return "";
      else if (n > String(str).length)
         return str;
      else {
         var iLen = String(str).length;
         return String(str).substring(iLen, iLen - n);
      }
  }



//*****************************-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function InitTopPad(CurrentTopPad)
{
	Gl_TopStoriesCurrentPad=CurrentTopPad;
	document.getElementById("TopPad_img").src=Topdata[CurrentTopPad][0];
	document.getElementById("TopPad_img").alt=Topdata[CurrentTopPad][7];
	document.getElementById("TopPad_slug").innerHTML=Topdata[CurrentTopPad][1];

	
}
/////**********************************************************



function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

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 eraseCookie(name) {
	createCookie(name,"",-1);
}

 function ScrollMenuSingle(direc)
 {
   myObj=window.document.getElementById("MenuRow");
   MyStr=""
   if (direc==1)  {
        Diff=MenuCount-ShowItems;
	MenuLeft=MenuLeft+8;
	if (MenuLeft>Diff) { MenuLeft=MenuCount-16; Menu_Autodir="R";}
   }
   else
   {
	MenuLeft=MenuLeft-8;
	if (MenuLeft<0) { MenuLeft=0; Menu_Autodir="L"; }
   }
   myObj=window.document.getElementById("MenuRow");
   MyStr=""
   for (ui=0;ui<ShowItems;ui++)
   {
      CurrItem=(MenuLeft+ui);
      CurrItemdata=MenuItems[CurrItem];
      if (CurrItemdata.length>2)
      {
	      if (ui>0) { MyStr=MyStr+" | "; }
	      ItemCaption=Left(CurrItemdata,CurrItemdata.indexOf("*"))
	      ItemLinkTip=CurrItemdata.replace(ItemCaption+"*"," ")
	      MyStr=MyStr+"<a href='" + MenuLinks[CurrItem] + "' title='" + ItemLinkTip + "' class='mainlink'";
	      if (Left(ItemCaption,1)=="~")
	      {
	           MyStr=MyStr+" target='_blank'"
	      }
	      MyStr=MyStr+" >"
	      MyStr=MyStr+ItemCaption.replace("~","");
	      MyStr=MyStr+"</a>"
      }
   }
   myObj.innerHTML=MyStr;
}

function Move_TopStoriesPad()
{
 if (Gl_TopStoriesCurrentPad>-1)
    {
     window.status=Gl_TopStoriesCurrentPad;
     InitTopPad(Gl_TopStoriesCurrentPad);
     Gl_TopStoriesCurrentPad++;
     if (Gl_TopStoriesCurrentPad>1) {  Gl_TopStoriesCurrentPad=0;}
    }
 if (Gl_TopStoriesTime!=0) {clearTimeout(Gl_TopStoriesTime);}
  Gl_TopStoriesTime=setTimeout("Move_TopStoriesPad();",15000);
}


function Move_TopMenu5()
{
	if (Menu_Autodir=="L")
	   {
		   ScrollMenuSingle(1);
	    }
        else
	    {
	    	if (Menu_Autodir=="R") ScrollMenuSingle(0);
	    }
	if (Gl_TopMenuTime!=0) {clearTimeout(Gl_TopMenuTime);}
	Gl_TopMenuTime=setTimeout("Move_TopMenu5();",10000);
}

//////////////////////////////////////////////





/////////////////////////////////////////////
