$(function(){
    $('.north').tipsy({
        gravity: 'n'
    });
    $('.south').tipsy({
        gravity: 's'
    });
    $('.east').tipsy({
        gravity: 'e'
    });
    $('.west').tipsy({
        gravity: 'w'
    });
});

function dialogBoxes(){
    //select all the a tag with name equal to modal
    $('body').append('<div id="mask"></div>');
    $('a[name=modal]').click(function(e){
        //Cancel the link behavior
        e.preventDefault();
        //Get the A tag
        var id = $(this).attr('href');
        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(document).width();
        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({
            'width': maskWidth,
            'height': maskHeight
        });
        //transition effect
        $('#mask').fadeIn(1000);
        $('#mask').fadeTo("slow", 0.8);
        //Get the window height and width
        var winH = $(document).height();
        var winW = $(document).width();

        var holderW = $('.contentHolder').width();
        var contentW = $('#wrapper').width();

        $(id).css('top', '50px');
        $(id).css('left', (contentW/2) - ($(this)/2));

        //transition effect
        $(id).fadeIn('200');
    });
    //if close button is clicked
    $('.window .close').click(function(e){
        //Cancel the link behavior
        e.preventDefault();
        $('#mask').hide();
        $('.window').hide();
    });
    //if mask is clicked
    $('#mask').click(function(){
        $(this).hide();
        $('.window').hide();
    });
}

//------This is plug directly in the home page in case it needs to be updated---------//

//$(document).ready(function(){
    //    clickSlideShow();
    //    dialogBoxes();
    //    setSlideBottomText();
//    });

//function setSlideBottomText(){
//    $('#slideNavigation a').click(function(){
//        $('#slideshow').cycle('pause');
//        replaceNumbersBack();
//        var selectedSlide = $('.activeSlide').text();
//        if (selectedSlide == 1) {
//            $(this).text(' Learn More > ').addClass('activeSlide');
//        }
//        if (selectedSlide == 2) {
//            $(this).text(' < Achieve Their Missions > ').addClass('activeSlide');
//        }
//        if (selectedSlide == 3) {
//            $(this).text(' < For Foundations >').addClass('activeSlide');
//        }
//        if (selectedSlide == 4) {
//            $(this).text(' < For IT Professionals ').addClass('activeSlide');
//        }
//    });
//}
//
//function replaceNumbersBack(){
//    $('#slideNavigation a:contains("Learn More")').text('1');
//    $('#slideNavigation a:contains("Achieve Their Missions")').text('2');
//    $('#slideNavigation a:contains("For Foundations")').text('3');
//    $('#slideNavigation a:contains("For IT Professionals")').text('4');
//}
//
//function clickSlideShow(){
//    $('#slideshow').cycle({
//        fx: 'fade',
//        speed: 'slow',
//        timeout: 8000,
//        pager: '#slideNavigation'
//    });
//}

