2009-03-06 03:20:46 +00:00
|
|
|
function extractPageName(hrefString)
|
|
|
|
{
|
|
|
|
var arr = hrefString.split('/');
|
2010-06-24 14:41:40 +00:00
|
|
|
var result=(arr.length<3) ? hrefString : arr[3].toLowerCase();
|
2014-09-02 05:20:24 +00:00
|
|
|
if (result=='search' || result=='water' || result=='heihe' || result=='glacier' || result=='yrnmr' || result=='hiwater') result='data';
|
2011-10-12 04:51:17 +00:00
|
|
|
if (result=='admin' && arr.length>=4) result+="/"+arr[4];
|
2010-06-24 14:41:40 +00:00
|
|
|
return result;
|
2009-03-06 03:20:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function setActiveMenu(arr, crtPage)
|
|
|
|
{
|
|
|
|
for (var i=0; i<arr.length; i++)
|
|
|
|
{
|
|
|
|
if(extractPageName(arr[i].href) == crtPage)
|
|
|
|
{
|
|
|
|
if (arr[i].parentNode.tagName != "DIV")
|
|
|
|
{
|
2013-03-26 14:22:40 +00:00
|
|
|
arr[i].className = "active";
|
|
|
|
arr[i].parentNode.className = "active";
|
2009-03-06 03:20:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPage()
|
|
|
|
{
|
|
|
|
hrefString = document.location.href ? document.location.href : document.location;
|
|
|
|
|
2013-03-26 14:22:40 +00:00
|
|
|
if (document.getElementById("mainmenu")!=null)
|
|
|
|
setActiveMenu(document.getElementById("mainmenu").getElementsByTagName("a"), extractPageName(hrefString));
|
2009-03-06 03:20:46 +00:00
|
|
|
}
|