/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.0 (051123)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .current class to the <a> and its parent   *
 *   <li> that is contained in the element with id="primarynav" and points*
 *   to the current URL                                                   *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
 
 /* modified by Dayyan Lord */
function extractPageName(hrefString)
{
	var arr = hrefString.split('.');
	arr = arr[arr.length-2].split('/');
	return arr[arr.length-1].toLowerCase();		
}

function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
	{
	if(arr[i].className != "none")
		if(extractPageName(arr[i].href) == crtPage)
		{
			//arr[i].className = "current";
			//arr[i].parentNode.className = "current";
						
			//set style instead of class to prevent overriding multiple attributes			
			arr[i].style.color = "maroon";
			arr[i].parentNode.style.color = "maroon";
		}
	} // end for
}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("left_content")!=null) 	 
     	setActiveMenu(document.getElementById("left_content").getElementsByTagName("a"), extractPageName(hrefString));
	
	//do for all links
	//setActiveMenu(document.getElementsByTagName("a"), extractPageName(hrefString));
}

function roll_over(img_name, img_src)
   {
   document[img_name].src = img_src;
   }

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
     
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText   	 	   
	   //if (myImage.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
	   imgTitle = "";
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\">"
				  + "</span>"
				  
	   
	/*
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
		  + " style=\"" + "width:" + myImage.width 
		  + "px; height:" + myImage.height 
		  + "px;" + imgStyle 
		  //+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		  + "><img src='../common/browse.gif', sizingMethod='scale'\>"
		  + "</span>"   
		*/ 
		 
		  
	   myImage.outerHTML = strNewHTML	  
    }
}

function sfHover(){
    try
    {
	var sfEls = document.getElementById("nav").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"), "");
	  }
	 }	
	} // try catch
	catch(ex)
	{
	//alert(ex);
	}
	
}