//$(document).ready(function() {
//	$('#main_nav > li').mouseover(function () {
//			$(this).toggleClass('hover');
//		}).mouseout(function() {
//			$(this).toggleClass('hover');
//		});
//});

if(typeof Array.prototype.copy=='undefined')
    Array.prototype.copy=function(a){
        var
            i=0,
            b=[];
        for(i;i<this.length;i++)
            b[i]=(typeof this[i].copy!='undefined')?
                this[i].copy():
                this[i];
        return b
    };
	
if(typeof Array.prototype.slice=='undefined')
    Array.prototype.slice=function(a,c){
        var
            i=0,
            b,
            d=[];
        if(!c)
            c=this.length;
        if(c<0)
            c=this.length+c;
        if(a<0)
            a=this.length-a;
        if(c<a){
            b=a;
            a=c;
            c=b
        }
        for(i;i<c-a;i++)
            d[i]=this[a+i];
        return d
    };
	
if(typeof Array.prototype.splice=='undefined')
    Array.prototype.splice=function(a,c){
        var
            i=0,
            e=arguments,
            d=this.copy(),
            f=a;
        if(!c)
            c=this.length-a;
        for(i;i<e.length-2;i++)
            this[a+i]=e[i+2];
        for(a;a<this.length-c;a++)
            this[a+e.length-2]=d[a-c];
        this.length-=c-e.length+2;
        return d.slice(f,f+c)
    };
	


function inArray(strClass, array) {
	var strClassUpper = strClass.toUpperCase();
	for ( var i = 0; i < array.length; i++ )
		if ( array[i].toUpperCase() == strClassUpper) {
			return i;
		}
	return -1;
}

function AddClassName(objElement, strClass) {
	if ( objElement.className ) {
		var arrList = objElement.className.split(' ');
		arrList[arrList.length] = strClass;
		objElement.className = arrList.join(' ');	
	} else {
		objElement.className = strClass;
	}
}

function RemoveClassName(objElement, strClass) {
	
	if ( objElement.className ) {
		var arrList = objElement.className.split(' ');
			if (inArray(strClass, arrList) != -1) {
				var i = inArray(strClass, arrList);
				arrList.splice(i, 1);
			}
		objElement.className = arrList.join(' ');
	}
}

function setClass(over, where) {
	var hoverStr = 'hover';
	if (over) {
		AddClassName(where, hoverStr);
	} else {
		RemoveClassName(where, hoverStr);
	}
}

function adaptLis() {
	var lis = "";
	lis = document.getElementById('main_nav').getElementsByTagName('li');
	if (lis != "" /*&& lis != undefined*/ && lis != null) {
		for (i = 0; i < lis.length; i++) {
			li = lis[i];

			li.onmouseover = function() {
				setClass(true, this);
			}
			li.onmouseout = function() {
				setClass(false, this);
			}
		}
	}
}

