
    function perform_update(source_url, element_to_update) {
        
        source_url = "/ajax/" + source_url;
        
        new Ajax.Updater(element_to_update, source_url, {
        
        evalScripts: true
        
        });
        
    }

    var eval_param;

    function perform_action(action) {           
                                                         
        if (perform_action.arguments[3] != "") var post_params = perform_action.arguments[3];
            
        if ( perform_action.arguments.length >= 2 && perform_action.arguments[1] != "") {
            
            var element_to_update = perform_action.arguments[1];
            var source_url = perform_action.arguments[2];
            
            if (perform_action.arguments[6]) {
            
                var source_url_add_eval = perform_action.arguments[6];
                                
            }
            
            if (perform_action.arguments[4]) {
                
                eval_param = perform_action.arguments[4];
                
                var updater_options = {
                    
                    onComplete: function() {
                        
                        eval(eval_param);
                        
                    }
                    
                };
                
            } else var updater_options = "";
            
            if (perform_action.arguments[5]) {
                
                var eval_on_first_success = perform_action.arguments[4];
                
            }
                
        } 
             
        if (!post_params) var used_method = "get";
        else var used_method = "post";
        
        if (!post_params) post_params = "";
        
        new Ajax.Request( action, {
        
            method:         used_method,
            parameters:        post_params,
            
            onComplete:    function(update_element) {
                
                if ($('response_inspector')) $('response_inspector').innerHTML = update_element.responseText;
                
                if (eval_on_first_success) {
                    
                    var eval_converted = eval_on_first_success.replace(/use_response_text/,update_element.responseText);
                                 
                    if ( !eval_converted ) eval_converted = eval_on_first_success;
                    
                    eval(eval_converted);
                    
                    updater_options = null;
                                        
                    if (source_url_add_eval) source_url += eval(source_url_add_eval) + "/";
                    
                }
                
                if (element_to_update && source_url) new Ajax.Updater(element_to_update, source_url, updater_options);
                if (stacked_actions.length > 0) process_next_action();
                
            }
            
        });
        
    }
             
    function build_request(form_id) {
        
        var form_obj = $(form_id);
        var current_attrib;
        
        for ( var field_c = 0; field_c < document.forms[form_id].elements.length; field_c++ ) {
            
            if (document.forms[form_id].elements[field_c].disabled) document.forms[form_id].elements[field_c].disabled = false;
            
            for ( var attrib_c = 0; attrib_c < document.forms[form_id].elements[field_c].attributes.length; attrib_c++ ) {
                
                current_attrib = document.forms[form_id].elements[field_c].attributes[attrib_c];
                
            }
                
        }
        
        return Form.serialize(form_obj, true);
        
    }
                       
    var current_hover_img = null;
     
    var page_loaded = false;
                           
    function page_has_loaded() {
    
        page_loaded = true
    
    }
                           
    function init_preview(filename, target_id) {
    
        if (!page_loaded) return false;
               
        if ( filename == "tpl_frame_empty.png" ) return;
                       
        $("img_preview").src = "/img/dynamic/preview/" + filename;
        $("div_preview").className = "div-preview-b";
        
        $("progress_indicator_a").show();
            
        current_target_id = target_id;
        current_hover_img = filename;
                           
    }
                
    function reset_preview(filename) {
    
        $("img_preview").src = "/img/x.gif";
        $("img_preview").className = "image-preview";
        $("div_preview").className = "div-preview-a";
        
        $("progress_indicator_a").hide();
        
        current_hover_img = null;
                  
    }
         
    function onload_preview() {
    
        $('progress_indicator_a').hide();
                                                  
        if ( $("img_preview").src.search(/x.gif/) == -1 ) $("img_preview").className = "image-preview-b";
        
    }
    
    function select_zone() {
    
        location.replace("/do/select_zone/" + current_zone_id + "/");
    
    }
         
    function browse_to(new_url, replace) {
    
        if ( replace ) location.replace(new_url);
        else location.href = new_url;
    
    }
                   
    var cust_upload_progress;    
             
    function submit_upload_form(form_name, upload_id) {
    
        if ( document.forms[form_name].elements['img_upload'].value.length > 1 ) {
                                                                    
            if (upload_id) launch_cust_progress_indicator('ic_progress','/do/get_upload_progress/' + upload_id);
        
            document.forms[form_name].submit();
            
        } else alert('Bitte zuerst eine Datei auswählen!');
    
    }
    
    
    function launch_cust_progress_indicator(progress_div, source_url) {
    
        $('cust-progress-outer').show();
        
        update_cust_progress("0");
    
        cust_upload_progress = new Ajax.PeriodicalUpdater(progress_div, source_url, {
                                                                         
            method: 'get', frequency: 1, decay: 1, onComplete: undefined, insertion: function(zero_void,response){
                                                      
                var resp = response.split(":");
            
                update_cust_progress(resp[0],resp[1]);
                
                if ( resp[0] == "100" ) {
                                                                          
                    this.updater.stop();
                    
                }
            
            }
        
        });
    
    }
                                            
    function update_cust_progress(perc, filename) {
                                                     
        if ( perc == 100 ) {
            
            _wait();
            
            browse_to("/do/browse_subnav/cut/");
            
        }
                                                     
        f_ind = Math.round(perc);
        
        if ( isNaN(f_ind) ) f_ind = "0";
                                                                               
        $('ic_progress').value = perc + "%";
        
    }
               
    function _wait() {
    
        for(sl=0;sl<document.getElementsByTagName("select").length;sl++) {
            
            document.getElementsByTagName("select")[sl].style.visibility = "hidden";
                    
        }
    
        $("global-overlay").show();
    
    }           
                         
    function hover_button(ref_object, reset_button) {
        
        var c_count = Number(ref_object.childNodes.length);
        
        for (var i_c = 0; i_c < c_count; i_c++) {
        
            if (!reset_button) {
                
                switch(ref_object.childNodes[i_c].className) {
                
                    case "content-button-l":    ref_object.childNodes[i_c].className = "content-button-l-on"; 
                    
                                                break;

                    case "content-button-r":    ref_object.childNodes[i_c].className = "content-button-r-on"; 
                    
                                                break;
                                                
                    case "content-button-title": 
                    
                                                ref_object.childNodes[i_c].className = "content-button-title-on"; 
                    
                                                break;
                                                
                
                }
                
            } else {
                            
                switch(ref_object.childNodes[i_c].className) {
                
                    case "content-button-l-on": ref_object.childNodes[i_c].className = "content-button-l"; 
                    
                                                break;

                    case "content-button-r-on": ref_object.childNodes[i_c].className = "content-button-r"; 
                    
                                                break;
                                                      
                    case "content-button-title-on": 
                    
                                                ref_object.childNodes[i_c].className = "content-button-title"; 
                    
                                                break;
                                                
                
                }
                
            }
        
        }
    
    }         
                    
