﻿// JScript File

sfHoverMainMenu = function()
{
    var sfEls = document.getElementById("ext_main_menu").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"), "");
        }
    }
    
    sfEls = document.getElementById("ext_main_menu").getElementsByTagName("UL");    
    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"), "");
        }
    }
    
}



// JScript File
function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	} 
	else
	{
	   window.onload = function()
	   {
		 if (oldonload) 
		 {
			 oldonload();
		 }
		 func();
	   }
	}
}



//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRolloverMainMenu() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domrollmainmenu')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domrollmainmenu (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domrollmainmenu (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domrollmainmenu (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}


addLoadEvent(function() {
	   sfHoverMainMenu();
})


addLoadEvent(function() {
	   domRolloverMainMenu();
})

