var Dajaxice = {
    
        webcms: {
    
            
    
      
    
        module: {
    
            
    
      
    
        web: {
    
            widget_create: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_create', callback_function, argv);
            },
    
            widget_update: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_update', callback_function, argv);
            },
    
            widget_update_process: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_update_process', callback_function, argv);
            },
    
            widget_sort: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_sort', callback_function, argv);
            },
    
            widget_remove: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_remove', callback_function, argv);
            },
    
            widget_remove_process: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_remove_process', callback_function, argv);
            },
    
            widget_info: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.widget_info', callback_function, argv);
            },
    
            page_move: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_move', callback_function, argv);
            },
    
            page_create: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_create', callback_function, argv);
            },
    
            page_update: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_update', callback_function, argv);
            },
    
            page_update_process: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_update_process', callback_function, argv);
            },
    
            page_simple_update: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_simple_update', callback_function, argv);
            },
    
            page_simple_update_process: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.page_simple_update_process', callback_function, argv);
            },
    
            get_site_structure: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.get_site_structure', callback_function, argv);
            },
    
            site_update: function(callback_function, argv){
                Dajaxice.call('webcms.module.web.site_update', callback_function, argv);
            }
    
            
    
        }
    
    
    
        }
    
    
    
        }
        ,
    
    get_cookie: function(name)
    {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = cookies[i].toString().replace(/^\s+/, "").replace(/\s+$/, "");
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    },
            
    call: function(dajaxice_function, dajaxice_callback, argv)
    {
        var send_data = [];
        is_callback_a_function = (typeof(dajaxice_callback) == 'function');
        
        if (!is_callback_a_function){
            /* Backward compatibility for old callback as string usage. */
            send_data.push('callback='+dajaxice_callback);
        }
        
        send_data.push('argv='+encodeURIComponent(JSON.stringify(argv)));
        send_data = send_data.join('&');
        var oXMLHttpRequest = new XMLHttpRequest;
        oXMLHttpRequest.open('POST', '/dajaxice/'+dajaxice_function+'/');
        oXMLHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        oXMLHttpRequest.setRequestHeader("X-CSRFToken",Dajaxice.get_cookie('csrftoken'));
        oXMLHttpRequest.onreadystatechange = function() {
            if (this.readyState == XMLHttpRequest.DONE) {
                if (is_callback_a_function){
                    try{
                        dajaxice_callback(JSON.parse(this.responseText));
                    }
                    catch(exception){
                        dajaxice_callback(this.responseText);
                    }
                }
                else{
                    /* Backward compatibility for old callback as string usage. */
                    eval(this.responseText);
                }
            }
        }
        oXMLHttpRequest.send(send_data);
    }
};
Dajaxice.EXCEPTION = "DAJAXICE_EXCEPTION";
window['Dajaxice'] = Dajaxice;



(function(){function b(){this._object=i?new i:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function k(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:false,cancelable:false,timeStamp:new Date+0})}function p(a){var c=a.responseXML,d=a.responseText;if(h&&d&&c&&!c.documentElement&&a.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){c=new window.ActiveXObject("Microsoft.XMLDOM");c.async=false;c.validateOnParse=false;
c.loadXML(d)}if(c)if(h&&c.parseError!=0||!c.documentElement||c.documentElement&&c.documentElement.tagName=="parsererror")return null;return c}function o(a){try{a.responseText=a._object.responseText}catch(c){}try{a.responseXML=p(a._object)}catch(d){}try{a.status=a._object.status}catch(g){}try{a.statusText=a._object.statusText}catch(e){}}function l(a){a._object.onreadystatechange=new window.Function}var i=window.XMLHttpRequest,j=!!window.controllers,h=window.document.all&&!window.opera;if(j&&i.wrapped)b.wrapped=
i.wrapped;b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,c,d,g,e){delete this._headers;if(arguments.length<3)d=true;this._async=d;var f=this,m=this.readyState,n;if(h&&d){n=function(){if(m!=b.DONE){l(f);f.abort()}};window.attachEvent("onunload",
n)}b.onopen&&b.onopen.apply(this,arguments);if(arguments.length>4)this._object.open(a,c,d,g,e);else arguments.length>3?this._object.open(a,c,d,g):this._object.open(a,c,d);if(!j&&!h){this.readyState=b.OPENED;k(this)}this._object.onreadystatechange=function(){if(!(j&&!d)){f.readyState=f._object.readyState;o(f);if(f._aborted)f.readyState=b.UNSENT;else{if(f.readyState==b.DONE){l(f);h&&d&&window.detachEvent("onunload",n)}m!=f.readyState&&k(f);m=f.readyState}}}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this,
arguments);if(a&&a.nodeType){a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(a);if(j&&!this._async){this.readyState=b.OPENED;for(o(this);this.readyState<b.DONE;){this.readyState++;k(this);if(this._aborted)return}}};b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);if(this.readyState>b.UNSENT)this._aborted=true;this._object.abort();l(this)};
b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,c){if(!this._headers)this._headers={};this._headers[a]=c;return this._object.setRequestHeader(a,c)};b.prototype.addEventListener=function(a,c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)return;this._listeners.push([a,c,d])};b.prototype.removeEventListener=function(a,
c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)break;e&&this._listeners.splice(g,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};if(a.type=="readystatechange"&&this.onreadystatechange)(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var c=0,d;d=
this._listeners[c];c++)if(d[0]==a.type&&!d[2])(d[1].handleEvent||d[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply)window.Function.prototype.apply=function(a,c){c||(c=[]);a.__func=this;a.__func(c[0],c[1],c[2],c[3],c[4]);delete a.__func};window.XMLHttpRequest=b})();




