
$(document).ready(function() { 

    var qs = parent.document.URL;
    if (qs.indexOf('?mod=5')>0) {
        var posDiez = qs.indexOf('#');
        var qslen = qs.length;
        var persDataPag = qs.substring(posDiez+1, qslen);
        if (persDataPag=='persData') {
            persDataLnkClick();
        }
        if (persDataPag=='persComenzi') {
            persComenziLnkClick();
        }
        if (persDataPag=='persFacturiFP') {
            persFacturiFPLnkClick();
        }
        if (persDataPag=='persFacturiFC') {
            persFacturiFCLnkClick();
        }
    }
   
    $('#persFizLnk').click(function() {
        $(this).addClass("persLnkON");
        $('#persJurLnk').removeClass("persLnkON");
        $('#persFizPanel').show();
        $('#persJurPanel').hide();
    });
    $('#persJurLnk').click(function() {
        $(this).addClass("persLnkON");
        $('#persFizLnk').removeClass("persLnkON");
        $('#persFizPanel').hide();
        $('#persJurPanel').show();
    });
    
    /* ------------------------------------------------------------- */
    
    function hidePersDataAll() {
        $('#persDataLnk').removeClass("persLnkON");
        $('#persComenziLnk').removeClass("persLnkON");
        $('#persFacturiFPLnk').removeClass("persLnkON");
        $('#persFacturiFCLnk').removeClass("persLnkON");
        $('#persDataPanel').hide();
        $('#persComenziPanel').hide();
        $('#persFacturiFPPanel').hide();
        $('#persFacturiFCPanel').hide();
    }
    
    $('#persDataLnk').click(function(){  persDataLnkClick() });
    
    function persDataLnkClick() {
        hidePersDataAll();
        //$(this).addClass("persLnkON");
        $('#persDataPanel').show();
    }

    $('#persComenziLnk').click(function(){ persComenziLnkClick() });
    
    function persComenziLnkClick() {
        hidePersDataAll();
        //$(this).addClass("persLnkON");
        $('#persComenziPanel').show();
    }
    
    $('#persFacturiFPLnk').click(function(){  persFacturiFPLnkClick() });

    function persFacturiFPLnkClick() {
        hidePersDataAll();
        //$(this).addClass("persLnkON");
        $('#persFacturiFPPanel').show();
    }
    
    $('#persFacturiFCLnk').click(function(){  persFacturiFCLnkClick() });
    
    function persFacturiFCLnkClick() {
        hidePersDataAll();
        //$(this).addClass("persLnkON");
        $('#persFacturiFCPanel').show();
    } 
    
});