// JavaScript Document

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function InitialisePage(targ, MenuName, CookieName, DefaultFeedID){ //v3.0
//  var newsfeedpath;
  //if (GetCookieParameter(FeedPathCookieName))
    //newsfeedpath = GetCookieParameter(FeedPathCookieName);
  //else
    //newsfeedpath = DefaultPath; // default value
	
  //eval(targ+".location='"+newsfeedpath+"?"+"time="+year+monthno+date+hours+mins+secs+msecs+"'");
  
  
  var FeedID;
  if (GetCookieParameter(CookieName))
    FeedID = GetCookieParameter(CookieName);
  else
    FeedID = DefaultFeedID; // default value
    
  var selObj = MM_findObj(MenuName);
    
  // Determine correct value for Jump Menu box based on cookie value
  var x = 0;
  while (x < 100) // stops infinite loop
  {	  
	  if (selObj.options[x].id == FeedID)
	  {
	    selObj.selectedIndex = x; // Change menu jump box to correct item
		FeedPath = selObj.options[selObj.selectedIndex].value;
		break;
	  }
	  x++;
  }
  
  
  var symbol;
  if (selObj.options[selObj.selectedIndex].value.indexOf("?") == -1) // true if url does not already contain a "?"
  	symbol = "?";
  else
	symbol = "&";
											
  // load correct feed
  eval(targ+".location='"+FeedPath+symbol+"time="+year+monthno+date+hours+mins+secs+msecs+"'");
  
}


function MM_jumpMenu(targ, selObj, restore, cache){ //v3.0
  var symbol;
  if (selObj.options[selObj.selectedIndex].value.indexOf("?") == -1) // true if url does not already contain a "?"
  	symbol = "?";
  else
	symbol = "&";
	
  if (cache == "cache")
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");  // Allow selection to be cached
  else
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+symbol+"time="+year+monthno+date+hours+mins+secs+msecs+"'"); // Default: do not allow selection to be cached
	
  if (restore) selObj.selectedIndex=0;
}

function MM_Remember(MenuName, CookieName){
  var selObj = MM_findObj(MenuName);
  //var newsfeedpath = selObj.options[selObj.selectedIndex].value;
  var FeedID = selObj.options[selObj.selectedIndex].id;
  SetCookieParameter(CookieName, FeedID, 36500, '/', '', '');    
}

function GetCookieName(CookieName, DefaultFeed)
{
	if (GetCookieParameter(CookieName))
		return GetCookieParameter(CookieName);
	else
		return DefaultFeed;
}

