// JavaScript Document
var s = jQuery.noConflict();
s(function() {
    // alert("hiii");
    var el = s('.RLWeddingWrapper');
    //var imgwt = el.find('img.img_lt').width();
    //var imght = el.find('img.img_lt').height();
    //var padtitl = imgwt + 15;
    s(el).each(function() {
        if (s(this).children().is('img')) {
            s(this).find('a.clone').remove().clone().insertAfter(s(this).find('.img_lt'));
            //s(this).find('.readon').css({ top: '180px', left: padtitl, position:'absolute' });
            //el.height(imght);
        }
    })

    var rlimg = s('.G-quotes');    
    if (s('#mainimage').hasClass('frontImg')) {

        s('.rlwService').css({ top: 400 });
    }




    if (s('ul.gallery').children().is('li')) {
        if ($("ul.gallery li").length >= 4) {
            s('.rlgallery').wrap('<div class="splashMenu" />').wrap('<div class="scrollHold" />');
            s('.rlgallery').removeClass('rlgallery').addClass('gal_hold');
            s('.splashMenu').append('<div class="prev disabled"></div><div class="next"></div>')
        }
    }
    var withoutPromo = s('.mainCnt');
    if (withoutPromo.hasClass('G-quotes')) {
        s(this).find('p').css({ width: '100%' });
        s('blockquote').each(function() {
            $("<span class='rt-quotes'></span>").appendTo(this);
        })
    }

    s('#mainCnt').find('#mainimage').parent().css({ paddingTop: '400px' });
    
    s('.ft_menu_rt li a:first-child').css({ fontWeight: 'bold', cursor: 'hand', paddingBottom: '10px' }).hover(function() { s(this).css({ textDecoration: 'none' }); }, function() { s(this).css({ textDecoration: 'none' }); });
    s(menus);
    var $DropdownMenu = $(".menu");
    s('ul.menu li').find('ul').addClass('submenu');
    s('ul.menu li:last-child').find('.submenu').css({ right: '0' });
    var $DivSubNav = $DropdownMenu.find(".submenu");
    var $MenuHover = $DivSubNav.find("a");

    s('.submenu').each(function() {

        s(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');
            }
        });
    });


    s('.scrollHold').before("<br class='clearit'>");

    if (s('div').hasClass('splashMenu')) {

        s('.scrollHold').scrollable({ size: 3 });
        var scroll = s(".scrollHold").data("scrollable");

        var size = 3;
        scroll.onSeek(function(event, index) {
            if (this.getIndex() >= this.getSize() - size) {
                s(".next").addClass("disabled");
            }
        });
        scroll.onBeforeSeek(function(event, index) {
            if (this.getIndex() >= this.getSize() - size) {
                if (index > this.getIndex()) {
                    return false;
                }
            }
        });
    }

});

function menus(){s.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)}};



