var fcms_js_included = new Array();

function fcms_include(params, key) {
    if (!params) {
        return false;
    }

    var arr = new Array();
    var jsindex = 0;

    var arr = params.split(',');

    var inline, js;
    for (jsindex=0; jsindex<arr.length; jsindex++) {
        inline = false;
        js = "";
        switch (arr[jsindex]) {
            case "js":    js = "/_/scripts/js.js";
                break;
            case "md5":   js = "/_/scripts/md5.js";   
                break;
            case "nav":   js = "/_/scripts/navi.js";   
                break;
            case "aj_po": js = "/_/scripts/ajax/prototype.js";
                break;
            case "aj_sc": js = "/_/scripts/ajax/scriptaculous.js";
                break;
            case "aj_sc_gl": js = "/_/scripts/ajax/glider.js";
                break;
            
            case 'aj_builder': js = '/_/scripts/ajax/builder.js';
                break;
            case 'aj_effects': js = '/_/scripts/ajax/effects.js';
                break;
            case 'aj_dragdrop': js = '/_/scripts/ajax/dragdrop.js';
                break;
            case 'aj_controls': js = '/_/scripts/ajax/controls.js';
                break;
            case 'aj_slider': js = '/_/scripts/ajax/slider.js';
                break;
            case 'aj_sound': js = '/_/scripts/ajax/sound.js';
                break;
            
            case "aj_sc_sl":
                js = "/_/scripts/fcmsslideshow.js";
              break;              
            case "sndmngr": js = "/_/scripts/fsndmngr1.js";
                break;
            case "swfup":
                js = '/_/scripts/swfupload/swfupload.js';
            break;
            case "swfupobj":
                js = '/_/scripts/swfupload/swfupload.swfobject.js';
            break;
            case "fswfupqu":
                js = '/_/scripts/swfupload/fcmsswfupload.queue.js';
            break;
            case "fswffile":
                js = '/_/scripts/swfupload/fcmsfileprogress.js';
            break;
            case "fswfhand":
                js = '/_/scripts/swfupload/fcmshandlers.js';
            break;
            case "google":
                if (key) {
                    js = "http://www.google.com/jsapi?key="+key;
                }
                break;
            case "gmaps":
                google.load("maps", "2");
                break;
            case "fcms": 
                js = "/_/scripts/fcms.js";
                break;
            case "fcmsmaps":
                js = "/_/scripts/fcmsmap.js";
                break;
            case "fcmspie":
                js = "/_/scripts/fcmspicedit.js";
                break;
            case "fcmscompn":
                js = "/_/scripts/fcmscompn.js";
                break;
            case "fcmsshoutbox":
                js = "/_/scripts/fcmsshoutbox.js";
                break;
            case "ltbox":
                js = "/_/scripts/ltbox.js";
                break;
            case "stat":
                js = "/_/scripts/ajax/stathandler.js";
                break;
            case 'swf':
                js = "/_/scripts/swfobject.js";
                break;
            case 'antzrubriksuche':
                js = "/_/scripts/fcmsuser/antzrubriksuche.js";
                break;
            case 'aj_epaper':
                js = '/_/scripts/ajax/epaper.js';
                break;
            case 'fcmscust':
                js = "/_/scripts/fcmscustomer.js";
                break;
            case 'fcmsorte':
                js = "/_/scripts/fcmsOrte.js";
                break;
            case 'group_editor':
                js = '/_/scripts/fcmsuser/group/editor.js';
                break;
            case 'group_membershipadministration':
                js = '/_/scripts/fcmsuser/group/membershipadministration.js';
                break;
            case 'club_editor':
                js = '/_/scripts/fcmsuser/group/club/editor.js';
                break;
            case 'club_membershipadministration':
                js = '/_/scripts/fcmsuser/group/club/membershipadministration.js';
                break;
            case 'interest_editor':
                js = '/_/scripts/fcmsuser/group/interest/editor.js';
                break;
            case 'interest_membershipadministration':
                js = '/_/scripts/fcmsuser/group/interest/membershipadministration.js';
                break;
            case 'fcmsclub':
                js = '/_/scripts/fcmsuser/clubsuche.js';
            break;
            case 'fcmsinterest':
                js = '/_/scripts/fcmsuser/interestsuche.js';
            break;
            case 'fcmsuser':
                js = '/_/scripts/fcmsUser.js';
            break;
            case 'builder':
                js = '/_/scripts/ajax/builder.js';
            break;
            case 'customer_membershipadministration':
                js = '/_/scripts/fcmsuser/customer/membershipadministration.js';
                break;
            case 'customer_club_membershipadministration':
                js = '/_/scripts/fcmsuser/customer/club/membershipadministration.js';
                break;
            case 'customer_interest_membershipadministration':
                js = '/_/scripts/fcmsuser/customer/interest/membershipadministration.js';
                break;
            case 'customer_membershipongroup':
                js = '/_/scripts/fcmsuser/customer/membershipongroup.js';
                break;
            case 'customer_club_membershipongroup':
                js = '/_/scripts/fcmsuser/customer/club/membershipongroup.js';
                break;
            case 'customer_interest_membershipongroup':
                js = '/_/scripts/fcmsuser/customer/interest/membershipongroup.js';
                break;                
            case 'group_membership_editor':
                js = '/_/scripts/fcmsuser/group/membership/editor.js';
                break;
            case 'group_club_membership_editor':
                js = '/_/scripts/fcmsuser/group/club/membership/editor.js';
                break;
            case 'group_interest_membership_editor':
                js = '/_/scripts/fcmsuser/group/interest/membership/editor.js';
                break;
            case 'user':
                js = '/_/scripts/ajax/user/user.js';
            break;
            case 'user_fontsize':
                js = '/_/scripts/ajax/user/fontsize.js';
            break;
            case 'voting_voting':
                js = '/_/scripts/fcmsuser/voting/voting.js';
            break;
            case 'globalsearch':
                js = '/_/scripts/fcmsuser/globalsearch.js';
            break;
            case 'fcmssuche':
                js = '/_/scripts/fcmssuche.js';
            break;
            case 'flowplayerjs':
                js = '/_/scripts/flowplayer/flowplayer-3.1.2.min.js';
            break;
    }
    if (js && !fcms_js_included[arr[jsindex]]) {
        fcms_js_included[arr[jsindex]] = arr[jsindex];
        if (inline) {
            document.writeln("<script type=\"text\/javascript\">"+js+"<\/script>");
        } else {
            document.writeln('<script type=\"text/javascript\" language=\"javascript\" src=\"'+js+'\"></script>');
        }
    }
  }
}

function check_popup_messages() { return true; }

/*
function check_popup_messages() {

    var handler = "/_/tools/ajax_handler.html";
    setTimeout("check_sound()", 2000);
    var myAjax = new Ajax.Request(
        handler, {
            method:
                'post',
            parameters:
                "type=com_popup_messages",
            onComplete:
                function(transport) {
                    var data = eval(transport.responseText);
                    if (data[1]) {
                        mw = window.open('/_/tools/disp_popup_messages.html'+data[0],'fCMSPopup','width=300,height=400,scrollbars=yes,resizable=no');
                        mw.focus();
                    }
                }
        }
    );
    setTimeout("check_popup_messages()", 60000);
}


function check_sound() {

    var handler = "/_/tools/ajax_handler.html";
    var myAjax = new Ajax.Request(
        handler, {
            method:
                'post',
            parameters:
                "type=com_sounds",
            onComplete:
                function(transport) {
                    snddata_string = transport.responseText;
                    aSoundIDs = null;
                    aSoundIDs = snddata_string.split(",");
                    fsndSetStartUpInterval(1500, 200);
                    fsndSetStartUpSounds(aSoundIDs);
                }
        }
    );
}
*/
