/* 
Author: Brian Dausman
URL:	mybridgepoint.com
 */
jQuery.noConflict();


///////////////////////////////
//blog rss feed
///////////////////////////////

jQuery(document).ready(function(){
    jQuery('#blog').rssfeed('http://blog.candosagency.com/feed/rss', {
        limit: 2
    });
});

//////////////////////////////////
//round "home" button
//////////////////////////////////
jQuery(document).ready(function () {
    jQuery('.TopMenu:first a').css({ 'border-top-left-radius' : 5 });
});

//////////////////////////////////
//select current page
//////////////////////////////////
jQuery(document).ready(function () {
    var page = window.location.pathname;

    if (page == '/') {
        page = '/Home';
    }

    jQuery('nav ul li a').each(function () {
        var href = '/' + jQuery(this).attr('href');

        if (href == page) {
            jQuery(this).addClass('selected');
        } else {
            jQuery(this).removeClass('selected');
        }
    });

});
//////////////////////////////////
//get quote dropdown
//////////////////////////////////
jQuery(document).ready(function () {
    jQuery('.getQuote').click(function () {
        jQuery(this).find('ul').toggle();
    });
});

//////////////////////////////////
//navigation functionality
//////////////////////////////////
jQuery(document).ready(function () {
    //nav dropdowns
    jQuery(document).ready(function () {
        //on hover of main nav item
        jQuery('nav ul li').hover(function () {
            jQuery(this).find('.children').stop(false, true).fadeIn('fast');
        }, function () {
            jQuery(this).find('.children').stop(false, true).fadeOut('fast');
        });

        //on hover of first child
        jQuery('.children ul li').hover(function () {
            jQuery(this).find('ul').stop(false, true).stop(false, true).fadeIn('fast');
        }, function () {
            jQuery(this).stop(false, true).find('ul').fadeOut('fast');
        });

        //remove border from last child
        jQuery('.children ul li:last-child').css('border', 'none');

        //remove border from 1st half col
        jQuery('.half-col:first').css('border', 'none');

        //if screen is too small move dropdown the other direction
        if ((jQuery(window).width() <= 1100)) {
            jQuery('nav ul li:last-child .children').find('ul').css('margin-left', '-135px');
            jQuery('nav ul li:last-child .children ul li ul').css('left', '-183px');
        }
        if ((jQuery(window).width() <= 800)) {
            jQuery('nav ul li .children ul li ul').css('left', '-183px');
        }
    });

    jQuery('nav ul li:first').css('border-left', 'none');

    //////////////////////////////////
    //quote rotator
    //////////////////////////////////
    jQuery('.quotes_rotator img:not(:first)').hide();
    jQuery('.quotes_rotator').cycle({
        fx: 'fade',
        speed: 'fast',
        timeout: 4000,
        pause: 0
    });
});



///////////////////////////////////
///////please Upgrade ie///////////
///////////////////////////////////
jQuery(document).ready(function () {
    /*check if internet explorer*/
    if (jQuery.browser.msie && jQuery.browser.version.substr(0, 1) < 8) {

        //please upgrade
        jQuery('#upgrade').show();

        jQuery('#upgrade').animate({ right: "10", opacity: ".4" }, "slow");

        jQuery('#upgrade').hover(function () {
            jQuery(this).stop(true, true).animate({ opacity: "1", height: "100" }, "slow");
        }, function () {
            jQuery(this).stop(true, true).animate({ opacity: ".2", height: "20" }, "slow");
        }); //end upgrade

        jQuery('#closeUpgrade').click(function () {
            jQuery('#upgrade').css({ top: '-9300' });
        });
    } //end if ie
});

































