jssm.settings.titleseparator = ' | ';

jssm.functions.pageload = function(hash) {
    if (hash) {
        jssm.functions.load(hash);
    }
}

jssm.functions.beforeload = function(hash) {

}

jssm.functions.load = function(hash) {
    var currentPath = jssm.getCurrentPath() + '/' + hash;
    $j('#loading').show();
//    $j('div.primaryContent-content').load(currentPath.replace(/\/{2,}/g, '/'), {only_content: 1}, function(responseText, textStatus) {
    $j.get(currentPath.replace(/\/{2,}/g, '/'), {only_content: 1}, function(responseText, textStatus) {
        $j('#primaryContent').queue(function () {
            responseText = responseText.split('<ajaxSplitter />');
            $j('div.primaryContent-content').html($j('<div/>').append(responseText[1].replace(/<script(.|\s)*?\/script>/g, "")));
            $j('a[rel!=notAjax]', this).jssm('click');
//            $j('form', this).jssm('submit');
            // Set page title based upon the response
            responseText = JSON.parse(responseText[0]);
            $j('#heading').html(responseText.pagetitle);
            $j('#loading').hide();
            $j('#primaryContent').dequeue();
        });
    });
}

jssm.functions.afterload = function(hash) {

}

jssm.functions.beforeunload = function(hash) {

}

jssm.functions.unload = function(hash) {
    //	$('.wrapper').queue(function () {
    //		$(this).fadeOut(500);
    //		$(this).dequeue();
    //	});
}

jssm.functions.afterunload = function(hash) {

}

