$(function() {    
    
    if (gal_page == "show") {

        //        var cntmenu = $('.cnt_menuHold');
        //        if (cntmenu.next('1').is('.gallerylist'))
        $('#mainCnt').css({ width: '670px', padding: '0 0 0 30px' });
        $('.dsp2, p').css({ marginLeft: '0px' });
    }
    else {
        $('.gallerylist').css({ marginLeft: '10px' });
    }

    //alert("hiii");

    $(menus);
    var $DropdownMenu = $(".menu");
    $('ul.menu li').find('ul').addClass('submenu');
    $('ul.menu li:nth-child(5)').find('.submenu').css({ right: '118px' });
    $('ul.menu li:nth-child(2)').find('.submenu').css({ left: '50px' });
    var $DivSubNav = $DropdownMenu.find(".submenu");
    var $MenuHover = $DivSubNav.find("a");

    $('.submenu').each(function() {

        $(this).parent().eq(0).hoverIntent({
            timeout: 200, over: function() {
                var current = $(".submenu:eq(0)", this); current.show();
                current.parent().find('a').addClass('act');
            }, out: function() {
                var current = $(".submenu:eq(0)", this); current.hide();
                current.parent().find('a').removeClass('act');
            }
        });
    });
});

function menus() { $.fn.hoverIntent = function(f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function(ev) { cX = ev.pageX; cY = ev.pageY }; var compare = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]) } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function() { compare(ev, ob) }, cfg.interval) } }; var delay = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]) }; var handleHover = function(e) { var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t) } if (e.type == "mouseenter") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function() { compare(ev, ob) }, cfg.interval) } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function() { delay(ev, ob) }, cfg.timeout) } } }; return this.bind('mouseenter', handleHover).bind('mouseleave', handleHover) } };
