if (!DT_EFFECTS) { var DT_EFFECTS = new Object(); }

DT_EFFECTS.menu = {
    slideIn         : function(element) {
        new Effect.MoveBy( element.parentNode, 185, 0 );
        element.onclick = function(event) { 
            DT_EFFECTS.menu.slideOut(element); 
        }
        
        return false;
    },
    slideOut        : function(element) {       
        new Effect.MoveBy( element.parentNode, -185, 0 );
        element.onclick = function(event) { 
            DT_EFFECTS.menu.slideIn(element); 
        }
        return false;
    }
}






/**
*   object FORMS
*
**/
if (!FORMS) { var FORMS = new Object(); }



FORMS.control = {
    
    is_valid        : false,
    objForm         : null,
    sForm           : "",
    sType           : "",
    sMsgSuccess     : "<h2>Uw vraag werd bewaard!</h2><p>Een mail werd verzonden.</a>",
    
    // private methods
    call            : function(t) {
        
        alert("Global Error: "+t.status+" - "+t.statusText);
        
    }, 
    // public methods
    send            : function(p_form, p_type) {
    
        FORMS.control.objForm       = p_form;
        
        FORMS.control.sForm         = p_type;       
        
        if(formChecker.checkForm(FORMS.control.objForm)) {
        
        
            FORMS.control.is_valid = true;
            
            var postBody = Form.serialize(FORMS.control.objForm) + "&action="+$F('form_action');
            
            new Ajax.Request(window.location,
                    {
                        method      : "post",
                        postBody    : postBody,
                        onSuccess   : function(t) {                         
                            FORMS.control.doExecute(t.responseText);
                        },
                        onFailure   : function(t) {
                            alert("Error:\n"+t.status+" - "+t.statusText);
                        }
                    }
            );
            
        } 
        
    },
    
    doExecute           : function(responseText) {

        var json    = responseText.parseJSON();     
        
        if (json.status.code == "success") {        
            
            new Insertion.Top(FORMS.control.objForm, "<p style=\"background-color: #77AA37; color: #ffffff; padding-left: 10px;\">Saved</p>");
            
            FORMS.control.objForm.reset();
            
        } else {
            
            alert(json.status.text);
            
        }
        
    },
    
    redirect            : function() {
            
            FORMS.control.objForm.parent.innerHTML = FORMS.control.sSuccess;
            
    }
    
}


function popperdepop(url) {
    var width  = 783;
    var height = 591;
    var left   = (screen.width  - width)/2;
    var top    = (screen.height - height)/2;
    window.open(url, "Title", "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + "");
}


