﻿
$(document).ready(function() {

    $('#struttura').load('pages/pag_struttura.htm', function() {

        $('#menu').load('service/srv_menu_hrz.ashx', function() {
            initmenu();
        });

        $('#divcarousel').load('service/srv_carousel.ashx', function() {
            $('#carousel').carouFredSel();
        });

        $('.lightbox').lightbox();

        var Keepalive = setInterval(timerMethod, 10000);
        timerMethod();

        pageinit();

    });

});

function timerMethod() {
    // timed ajax call to Keepalaive
    $('#keepalive').load('service/srv_keepalive.ashx', function() {


    });
};


function showpage(id) {
    // ajax load page into div
    $('#content').hide();
    $('#content').load('service/srv_ajaxpage.ashx?id=' + id, function() {
        $('#content').fadeIn();
    });
};


function pageinit() {
    // Different behavior for each page level one
    var zona = $('#fldzona').val();
    switch (zona) {
        case "HOME":
            homemenu();
            break;

        case "SERVIZIO":
            login();
            break;

        case "CATALOGO":
            catalog_show();
            break;

        default:
            break;
    }

};


function denyaccess() {
    // ajax load deny page
    $('#content').hide();
    $('#content').load('pages/pag_accessonegato.aspx', function() {
        $('#content').fadeIn();
    });
};


function wrkinprog() {
    // ajax load deny page
    $('#content').hide();
    $('#content').load('pages/pag_wrkinprog.aspx', function() {
        $('#content').fadeIn();
    });
};

