// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26522533-1']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

// Modal Login
$(function() {	

    //select all the a tag with name equal to modal
    $('#open-client-header,#open-client-footer').click(function(e) {
        
        // Scroll to top
        $.scrollTo(0,'fast');
        
        //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 = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //transition effect		
        $('#mask').fadeIn(500);	
        //$('#mask').fadeTo("slow",0.8);	

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect
        $(id).fadeIn(500); 

    });

    //if close button is clicked
    $('#modal-close a').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').hide();
        $('.window').hide();
    });		

    //if mask is clicked
    $('#mask').click(function () {
        $(this).hide();
        $('.window').hide();
    });			

});

// Office Map Tabs
$(function() {
    // Default
    $("#map-tabs li:first").addClass("current");
});


