﻿//The page where to navigate
var next_url;

//Play effect and go to another page
function goToURL(url) {
    next_url = url;
    effect_pageExit();
}

//Once transition is complete
function onTransitionComplete() {
    window.location.href = next_url;
}

//Effect for loaded page
function effect_pageEnter() {
    $('#wrapper').fadeIn(800);
}

//Effect for page leaving
function effect_pageExit() {

    $('#wrapper').fadeOut(800, onTransitionComplete);
}

//Play effect and set click listeners to the links
$(document).ready(function () {

    //Play effect
    effect_pageEnter();

    //Find links and set listeners

    $("a").not("dt.gallery-icon a, li.item_holder a,#casestudies_media a,#casestudies_files a,.general_pagetext a,.callback_confirm,.signup_confirm").click(function () {

        //Check if this is internal link
        var href = $(this).attr("href");
        if ($(this).attr("target") == "_blank") {
            return truel
        }
        if (href.charAt(0) == '#') {
            return true;
        }

        goToURL(href);
        return false;
    });
});



