function isMethodType(s) {
  return /\b(function|object)\b/i.test(s);
}

function getNextSibling(e) {
    var s = e;

    while((s = s.nextSibling)) {
        if(s.nodeType && s.nodeType == 1) {
            return s;
        }
    }

    return null;
}

function getParent(e) {
    if(e) {
        if(e.parentNode) {
            return e.parentNode;
        }
        
        if(e.parentElement) {
            return e.parentElement;
        }
    }
    
    return null;
}

function getChildren(e) {
    var r = [];
    
    if(e && e.childNodes) {
        for(var i = 0; i < e.childNodes.length; i++) {
            if(e.childNodes[i].nodeType == 1) {
                r.push(e.childNodes[i]);
            }
        }
    }
    
    return r;
}

function initNavigationImages() {
    if(document && isMethodType(document, 'getElementById')) {
        var navigation = document.getElementById('navigation');
        
        if(navigation) {
            var elements;
            
            if(isMethodType(navigation, 'getElementsByTagName')) {
                elements = navigation.getElementsByTagName('A');
                
                for(var i = 0; i < elements.length; i++) {
                    if(getParent(elements[i]).className.indexOf('l2') > -1) {
                        elements[i].onmouseover = function() {
                            if(this.firstChild && this.firstChild.src && this.firstChild.name && !this.firstChild.fixed) {
                                this.firstChild.src.replace(this.firstChild.name, this.firstChild.name + '.hover');
                            }
                        }
                        
                        elements[i].onmouseout = function() {
                            if(this.firstChild && this.firstChild.src && this.firstChild.name && !this.firstChild.fixed) {
                                this.firstChild.src.replace(this.firstChild.name + '.hover', this.firstChild.name);
                            }
                        }
                    }
                }
            } 
        } 
    }
}

(function() {
    var _onload;

    if(window.onload) {
        _onload = window.onload;
    }
    
    window.onload = function() {
        if(_onload) {
            _onload();
        }
        
        initNavigationImages();

		jQuery('#mycarousel').jcarousel({
			vertical: true,
			scroll: 1,
			buttonPrevEvent: 'click',
			buttonNextEvent: 'click'
		});
    }
})();
