Ext.namespace('Yft.MenuRollovers');
Yft.MenuRollovers = function(config) {}
CURRENT_PROTO = Yft.MenuRollovers.prototype;

CURRENT_PROTO.init = function(config) {
    Ext.each([
        'menu-software-solutions',
        'menu-web-app',
        'menu-prototype',
        'menu-web-design',
        'menu-web-redesign',
        'menu-web-assessment',
        'menu-about-us',
        'menu-portfolio',
        'menu-blogs',
        'menu-contact-us',
	'menu-infrastructure',
	'menu-websites',
	'menu-software-apps',
	'menu-virtualization',
 	'menu-workflow-appliance',
 	'menu-voip'
        ], this._attach_rollover, this);    
}

CURRENT_PROTO._attach_rollover=function(menu_id) {
    var menu = Ext.get(menu_id);
    if(!menu)
        return;
    var array = menu.select('img');
    if(!array || !array.elements || array.elements.length == 0)
        return;
    var img = array.elements[0];
    var src = img.getAttribute('src').replace(/-on.gif/,'.gif').replace(/-ro.gif/,'.gif');

    var base = menu_id.replace(/^menu-/,'');
    if(g_current_page && g_current_page == base) {
        img.setAttribute('src', src.replace(/\.gif$/,'-on.gif'));
        return;
    }

    menu.on('mouseover', function() {
        img.setAttribute('src', src.replace(/\.gif$/,'-ro.gif'));
    },this);
    menu.on('mouseout', function() {
        img.setAttribute('src', src);
    },this);
}
