$(function () {

    // Demo popup windows
    $('.screenshot a').overlay({
        top: 220
    });

    // Scroll page
    $('#mainmenu a').click(function () {
        var linkID = $(this).parent().attr('id');
        var linkClass = '.' + linkID;
        $.scrollTo(linkClass, 500, { margin: true });
    });

    $('span#compare a').click(function () {
        $.scrollTo('.product', 1000, { margin: true });
    });
    $('span#whodrives a').click(function () {
        $.scrollTo('.about', 1000, { margin: true });
    });
    $('span#getstarted a').click(function () {
        $.scrollTo('.partner', 1000, { margin: true });
    });
    $('span#backtotop a').click(function () {
        $.scrollTo('.welcome', 1000, { margin: true });
    });
    $('span#partnertoday a').click(function () {
        $.scrollTo('#contact_wrap', 1000, { margin: true });
    });

    // initialize scrollable for staff bios
    $(".scrollable").scrollable();

    $('a#icora').tooltip({
        effect: 'slide',
        tip: '#icora-name',
        position: 'top center',
        offset: [30, 0]
    });

    //staff Bio tooltips 1-4
    $('a#allison').tooltip({
        effect: 'slide',
        tip: '#allison-bio',
        position: 'top right',
        offset: [50, -200]
    });
    $('a#avery').tooltip({
        effect: 'slide',
        tip: '#avery-bio',
        position: 'top center',
        offset: [50, 125]
    });
    $('a#brian').tooltip({
        effect: 'slide',
        tip: '#brian-bio',
        position: 'top center',
        offset: [50, -125]
    });
    $('a#cody').tooltip({
        effect: 'slide',
        tip: '#cody-bio',
        position: 'top left',
        offset: [50, 200]
    });

    //staff Bio tooltips 5-8
    $('a#hari').tooltip({
        effect: 'slide',
        tip: '#hari-bio',
        position: 'top right',
        offset: [50, -200]
    });
    $('a#john').tooltip({
        effect: 'slide',
        tip: '#john-bio',
        position: 'top center',
        offset: [50, 125]
    });
    $('a#matt').tooltip({
        effect: 'slide',
        tip: '#matt-bio',
        position: 'top center',
        offset: [50, -125]
    });
    $('a#paul').tooltip({
        effect: 'slide',
        tip: '#paul-bio',
        position: 'top left',
        offset: [50, 200]
    });

    //staff Bio tooltips 8-12
    $('a#rich').tooltip({
        effect: 'slide',
        tip: '#rich-bio',
        position: 'top right',
        offset: [50, -200]
    });

    $('.hero_callouts li').hover(function () {
        $(this).animate({ marginTop: '0px' }, 250);
        $(this).children('p').fadeToggle();

    }, function () {
        $(this).animate({ marginTop: '10px' }, 250);
        $(this).children('p').fadeToggle();
    });
})
