/*-----FORM ENTER SUBMIT-------*/
function addInputSubmitEvent(form, input) {
    input.onkeydown = function(e) {
        e = e || window.event;
        if (e.keyCode == 13) {
            form.submit();
            return false;
        }
    };
}
var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
            || this.searchVersion(navigator.appVersion)
            || "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i=0;i<data.length;i++)    {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
        {
            string: navigator.userAgent,
            subString: "Chrome",
            identity: "Chrome"
        },
        {     string: navigator.userAgent,
            subString: "OmniWeb",
            versionSearch: "OmniWeb/",
            identity: "OmniWeb"
        },
        {
            string: navigator.vendor,
            subString: "Apple",
            identity: "Safari",
            versionSearch: "Version"
        },
        {
            prop: window.opera,
            identity: "Opera"
        },
        {
            string: navigator.vendor,
            subString: "iCab",
            identity: "iCab"
        },
        {
            string: navigator.vendor,
            subString: "KDE",
            identity: "Konqueror"
        },
        {
            string: navigator.userAgent,
            subString: "Firefox",
            identity: "Firefox"
        },
        {
            string: navigator.vendor,
            subString: "Camino",
            identity: "Camino"
        },
        {        // for newer Netscapes (6+)
            string: navigator.userAgent,
            subString: "Netscape",
            identity: "Netscape"
        },
        {
            string: navigator.userAgent,
            subString: "MSIE",
            identity: "Explorer",
            versionSearch: "MSIE"
        },
        {
            string: navigator.userAgent,
            subString: "Gecko",
            identity: "Mozilla",
            versionSearch: "rv"
        },
        {         // for older Netscapes (4-)
            string: navigator.userAgent,
            subString: "Mozilla",
            identity: "Netscape",
            versionSearch: "Mozilla"
        }
    ],
    dataOS : [
        {
            string: navigator.platform,
            subString: "Win",
            identity: "Windows"
        },
        {
            string: navigator.platform,
            subString: "Mac",
            identity: "Mac"
        },
        {
            string: navigator.platform,
            subString: "Linux",
            identity: "Linux"
        }
    ]

};
function NoticeIEBug() {
    BrowserDetect.init();
    if( BrowserDetect.browser == 'Explorer' ) {
        addNotice(NOTICE_INFO, CW_JS_LANG[20], CW_JS_LANG[21]);
    }
}

function AllowKeySubmit() {
    var forms = document.getElementsByTagName('form');
    for (var i=0;i < forms.length;i++) {
        var inputs = forms[i].getElementsByTagName('input');

        for (var j=0;j < inputs.length;j++)
            addInputSubmitEvent(forms[i], inputs[j]);
    }
};


var HideFormSubmitBut=0;
function HFSB(button) {
    if (!HideFormSubmitBut) {
        HideFormSubmitBut=1;
        button.style.display = 'none';
        button.value = '';
        return true;
    }
    return false;
}



var timer=new Object();
var m=new Object();
var l=new Object();
var V=A();
var O=0;
var auto_reload=0;
var F=new Object();


function Q(){
    return new Date().getTime();
};


function A(){
    return Math.round(Q()/1000);
};


function ZZZ(c){
    p=c.innerHTML.split(":");
    aY=p[0]*3600+p[1]*60+p[2]*1;
    return aY;
};


function aa(s){
    if(s> -2){
        az=Math.floor(s/3600);
        an=Math.floor(s/60)%60;
        af=s%60;t=az+":";
        if(an<10){t+="0";}
        t+=an+":";
        if(af<10){t+="0";}
        t+=af;
    }else{
        t="00:00:00";
    }
    return t;
};
        
        
function ak(){
    for(i=1;;i++){
        c=document.getElementById("timer"+i);
        if(c!=null){
            l[i]=new Object();
            l[i].ad=c;
            l[i].D=ZZZ(c);
        }else{
            break;
        }
    }

    J();
};
    
    
    
function J(){
    for(i in m){
        o=A()-V;
        U=aa(m[i].D+o);
        m[i].ad.innerHTML=U;
    }
    for(i in l){
        o=A()-V;
        ae=l[i].D-o;
        if(O==0&&ae<1){
            O=1;
            if(auto_reload==1){
                window.document.location="netwerken-gevangenis.php";
            }else
            if(auto_reload==0){
            }
        }else{}
        U=aa(ae);
        l[i].ad.innerHTML=U;
    }
    if(O==0){window.setTimeout("J()",1000);}
};
    
    
    
function G(f){c=document.getElementById(f);if(c!=null){F[f]=new Object();am=c.innerHTML.split("/");R=parseInt(am[0]);K=parseInt(am[1]);r=c.title;if(r!=0){aq=Q();timer[f]=new Object();timer[f].start=aq;timer[f].ar=r;timer[f].R=R;timer[f].K=K;timer[f].aM=3600000/r;H=100;if(timer[f].aM<H){timer[f].aM=H;}timer[f].ad=c;P(f);}}};

function P(f){
    o=Q()-timer[f].start;
    if(o>=0){
        T=Math.round(timer[f].R+o*(timer[f].ar/3600000));
        if(T>=timer[f].K){
            T=timer[f].K;
        }else{
            window.setTimeout("P('"+f+"')",timer[f].aM);
        }
        
        F[f].value=T;
        timer[f].ad.innerHTML=T+'/'+timer[f].K;
    }
};














/*-----GLOBAL VARIABLES-----*/
var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera") != -1);


/*-----JAVASCRIPT EXTENSIONS-----*/
Array.prototype.indexOf = function(obj) {
    var result = -1;
    for(var i=0;i<this.length;i++) {
        if(this[i] == obj) {
            result = i;
            break;
        }
    }
    return result;
}

Array.prototype.contains = function(obj) {
    return (this.indexOf(obj) >=0);    
}

Array.prototype.append = function(obj,nodup) {
    if(!(nodup && this.contains(obj))) {
        this[this.length] = obj;
    }
}

Array.prototype.remove = function(obj) {    
    var loc = this.indexOf(obj);
    if(loc >= 0) {
        this[loc] = null;
    }
}



//END JAVASCRIPT EXTENSIONS

function removeAllChildNodes(node) {
    if (node && node.hasChildNodes && node.removeChild) {
        while (node.hasChildNodes()) {
            node.removeChild(node.firstChild);
        }
    }
} // removeAllChildNodes()


///FUNCTION TO REMOVE px AND GET A NUMBER FROM STYLESHEET VALUES
function getPosInt(strPos) {
    var intPos = 0;
    if(strPos) {
        intPos = strPos.replace("px","");    
        intPos = Number(intPos);
    }
    return intPos;
}




 /*
This is a comment saying who wrote the code. Please do not remove it.

Script by RoBorg
RoBorg@geniusbug.com
http://javascript.geniusbug.com | http://www.roborg.co.uk
Please do not remove or edit this message
Please link to this website if you use this script!

 
The getElementValue function allows you to get the value of a form element.
It will return a string normally, although for certain elements it will return a boolean.
A multiple select is special, in that it will return an array of booleans.
*/
function getElementValue(formElement)
{
    if(formElement.length != null && formElement[0]) var type = formElement[0].type;
    if((typeof(type) == 'undefined') || (type == 0)) var type = formElement.type;
    
    var val = null;
    
    switch(type)
    {
        case 'undefined': return;
        case 'radio':
            for(var x=0; x < formElement.length; x++) 
                if(formElement[x].checked == true)
            val = formElement[x].value;break;

        case 'select-multiple':
            var myArray = new Array();
            for(var x=0; x < formElement.length; x++) 
                if(formElement[x].selected == true)
                    myArray[myArray.length] = formElement[x].value;
            val = myArray;break;

        case 'checkbox': val = formElement.checked;break;
        default: val = formElement.value;break;
    }
    
    return val;
}
/*
This function can be used to set the value of any type of form element.
It uses switch to decide how to set the value of each different type of element.
To use it, simply pass the form element as an object, and the value.
Note that some types of element require special types of value! These are: 
A radio and checkbox, which require a boolean value (true or false). 
A select, which requires the number of the item to be selected (these start at 0, so to select the first item on the list, the value would be 0, to select the second, the value would be 1 and so on) 
A select that allows multiple selections. This requires that you pass an array of boolean values. The array should be the same size (have the same number of items) as the select. Where the array is true, the list item will be selected, and where false, deselected. 
*/
function setElementValue(formElement, value)
{
    switch(formElement.type)
    {
        case 'undefined': return;
        case 'radio': formElement.checked = value; break;
        case 'checkbox': formElement.checked = value; break;
        case 'select-one': {
            for(var x=0;x<formElement.length;x++) {
                if(formElement[x].value == value) {
                    formElement.selectedIndex = x;
                }
            } 
            break;
        }
        case 'select-multiple': {
            for(var x=0; x < formElement.length; x++) {
                if(formElement[x].value == value) {
                    formElement[x].selected = value[x];
                }
            }
            break;
        }
        default: formElement.value = value; break;
    }
}
 




/*-----WINDOW.ONLOAD MANAGER-----*/
window.onLoadListeners = new Array();
window.addOnLoadListener = function(listener) {
    window.onLoadListeners[window.onLoadListeners.length] = listener;
}
window.onload=function() {
    for(var i=0;i<window.onLoadListeners.length;i++) {
        var func = window.onLoadListeners[i];
        func.call();
    }
}


//END WINDOW.ONLOAD MANAGER

/*-----EVENT MANAGER-----*/
var mmEvent = [];
mmEvent.EventRouter = function(el,eventType) {
    this.lsnrs = [];
    this.el = el;
    el.eventRouter = this;
    el[eventType] = mmEvent.EventRouter.callback;
}

mmEvent.EventRouter.prototype.addListener = function(lsnr) {
    this.lsnrs.append(lsnr, true);
}

mmEvent.EventRouter.prototype.removeListener = function(lsnr) {
    this.lsnrs.remove(lsnr);    
}

mmEvent.EventRouter.prototype.notify = function(e) {
    var lsnrs = this.lsnrs;
    for(var i=0;i<lsnrs.length;i++) {
        var lsnr = lsnrs[i];
        lsnr(e);
    }
}

mmEvent.EventRouter.callback = function(event) {
    var e = event || window.event;
    var router = this.eventRouter;
    router.notify(e);
}
//END EVENTMANAGER

//GLOBAL EVENTS 
var mmMouseUp = new mmEvent.EventRouter(document,'onmouseup');

//END GLOBAL EVENTS


/*-----DEBUGGER-----*/
var mmDebug;
addOnLoadListener(initDebugger);
function initDebugger() {
    mmDebug = new Debug();
    mmDebug.hide();
}

function echoDebug(strText) {
    if(mmDebug) {
        mmDebug.addLine(strText);
    }
}

function Debug() {
    this.lines = null;
    this.debugDiv = null;
    this.ready = false;
    this.init();
}
Debug.prototype.init = function () {
    var d = document.getElementById('debugger');
    if(d) {
        this.debugDiv = d;
        this.lines = 0;
        this.ready = true;
    }
}
Debug.prototype.hide = function() {
    if(this.ready) {
        this.debugDiv.style.display = 'none';    
    }
}
Debug.prototype.addLine = function(strText) {
    if(this.ready) {
        this.debugDiv.innerHTML += this.lines + ': ' + strText + '<br />';
        this.debugDiv.scrollTop = this.debugDiv.scrollHeight
        this.lines++;
    }
}
//END DEBUGGER





/*-----AJAX MANAGER-----*/
//function for backward compatibility
function getXMLHttpRequest() {
    var xRequest = null;
    if(window.XMLHttpRequest) {
        //Mozilla / Safari
        xRequest = new XMLHttpRequest();
    } else if(typeof ActiveXObject != "undefined") {
        //IE
        xRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }   
    return xRequest;
}




/*
net = namespace
net.ContentLoader = object {
    .req             = Crossbrowser XML object
    .onload         = onload functie
    .onerror         = onerror functie (bij null = standaarderror)
    .loadXMLDoc     = functie(ServiceUrl, 'POST|GET', 'x=1&y=2', ContentType)    -> ContentType is niet verplicht
    
    
    Gebruik:
    var loader1 = new net.ContentLoader('Service.php', ReadyHandlerFunctie, ErrorHandlerFunctie, "POST", 'parameter1=waarde1&parameter2=waarde2');
}

*/
var net=new Object();

net.READY_STATE_UNINITIALIZED=0;
net.READY_STATE_LOADING=1;
net.READY_STATE_LOADED=2;
net.READY_STATE_INTERACTIVE=3;
net.READY_STATE_COMPLETE=4;

net.ContentLoader=function(url,onload,onerror,method,params,contentType){
    this.req=null;
    this.onload=onload;
    this.onerror=(onerror) ? onerror : this.defaultError;
    this.loadXMLDoc(url,method,params,contentType);
}

net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){
    if (!method){
        method="GET";
    }
    
    if (!contentType && method=="POST"){
        contentType='application/x-www-form-urlencoded';
    }
    
    if (window.XMLHttpRequest){
        this.req=new XMLHttpRequest();
    } else if (window.ActiveXObject){
        this.req=new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    if (this.req){
        try{
            var loader=this;
            this.req.onreadystatechange=function(){
                net.ContentLoader.onReadyState.call(loader);
            }
            
            this.req.open(method,url,true);
            
            if (contentType){
                this.req.setRequestHeader('Content-Type', contentType);
            }
            
            this.req.send(params);
        } catch (err){
            this.onerror.call(this);
        }
    }
}


net.ContentLoader.onReadyState=function(){
    var req = this.req;
    var ready = req.readyState;
    if (ready == net.READY_STATE_COMPLETE){
        var httpStatus = req.status;
        if (httpStatus == 200 || httpStatus == 0){
            this.onload.call(this);
        } else {
            this.onerror.call(this);
        }
    }
}

net.ContentLoader.prototype.defaultError=function(){
  alert(CW_JS_LANG[22]+"\n--------------------------------------\n"
      +CW_JS_LANG[23]+"\n"
      +CW_JS_LANG[24]+"\n\n"
    +CW_JS_LANG[25]+"\n"
    +CW_JS_LANG[26]+"\n"
    +CW_JS_LANG[27]+"\n"
    +CW_JS_LANG[28]+"\n\n"
      +CW_JS_LANG[29]+"\n"
    +CW_JS_LANG[30]+"\n"
      +CW_JS_LANG[31]+"\n"
      +CW_JS_LANG[32]+"\n"
      +"--------------------------------------\n"
    );
}





//END AJAX MANAGER


/*-----NOTICE MANAGER-----*/
var NoticeManager = null;

var NOTICE_ERROR = 0;
var NOTICE_SUCCES = 1;
var NOTICE_INFO = 2;
var NOTICE_LOCKED = 3;

addOnLoadListener(initNoticeManager);
function initNoticeManager() {
    NoticeManager = new Notices();    
}

//global functie addNotice
function addNotice(type, title, notice) {
    if(this.NoticeManager) {
        this.NoticeManager.addNotice(type, title, notice);
    }
}



function Notices() {
    this.noticeContainerDiv = null;
    this.noticeCounter = null;
    this.ready = false;
    
    this.init();
}

Notices.prototype.init = function() {
    this.noticeContainerDiv = document.getElementById('notice_container');        
    if (this.noticeContainerDiv) {
        
        typeof(SERVER_NOTICE_COUNT) != 'undefined' ? this.noticeCounter = SERVER_NOTICE_COUNT : this.noticeCounter = 0;
        this.ready = true;    
    }
}

Notices.prototype.remove = function(number) {
    if (this.ready) {
        var ng = document.getElementById('notice_group');
        var n = document.getElementById('notice'+number);
        
        
        if(ng && n) {
            /*
            JAVASCRIPT TEST
            */
            this.noticeCounter--;
            var nSlide = new Fx.Slide('notice'+number, {onComplete : function() {NoticeManager.clearIfEmpty();}});
            nSlide.slideOut(); 
                    
            /*
            JAVASCRIPT TEST
            */
            
            //ng.removeChild(n);
        }
    }
}

Notices.prototype.clearIfEmpty = function() {
    if(this.noticeCounter <= 0) {
        removeAllChildNodes(this.noticeContainerDiv);
    }
}
//Notices.prototype.reallyRemoveNotice = function(id) {
//    if (this.ready) {
//        removeAllChildNodes(this.noticeContainerDiv);
//    }    
//}

Notices.prototype.createGroup = function() {
    var newdiv = document.createElement('div');
    var divClass = 'notice_group';
    newdiv.id = divClass;
    newdiv.className = divClass;
    this.noticeContainerDiv.appendChild(newdiv);
}

Notices.prototype.addNotice = function(type, title, notice) {
    var ng;
    var id = 0;
    
    if (this.ready) {
    //notice group laden
        if (this.noticeContainerDiv.childNodes.length == 0) {
            //notice group bestaat niet, nieuwe toevoegen
            this.createGroup();
            ng = document.getElementById('notice_group');
        } else {
            //removeAllChildNodes(this.noticeContainerDiv);
            //this.createGroup();
            ng = document.getElementById('notice_group');
        }
        
        if (ng) {
            var newNotice = createNotice(type,title,notice,this.noticeCounter)
            ng.appendChild(newNotice);
            this.noticeCounter++;
            window.document.location.href = "#";
        }
    }
}

function createNotice(type,title,notice,number) {
    var nDiv = document.createElement('div');
    var hDiv = document.createElement('div');
    var iDiv = document.createElement('div');
    var i = document.createElement('img');
    var hmDiv = document.createElement('div');
    var mDiv = document.createElement('div');
    var cDiv = document.createElement('div');
    
    cDiv.className = "clear";
    
//    nDiv.setAttribute('class','notice');
    nDiv.className = "notice";
    hmDiv.className = "notice_header";
    iDiv.className = "icon";
//    hDiv.setAttribute('class','header_error');
switch(type) {
    case 0 : hDiv.className = "header_error";i.src=LAYOUT_PATH + "images/icons/error_26x24.png";break;
    case 1 : hDiv.className = "header_succes";i.src=LAYOUT_PATH + "images/icons/arrow_green_26x24.png";break;
    case 2 : hDiv.className = "header_info";i.src=LAYOUT_PATH + "images/icons/world_26x24.png";break;
    case 3 : hDiv.className = "header_locked";i.src=LAYOUT_PATH + "images/icons/lock_26x24.png";break;
}
//    mDiv.setAttribute('class','melding');
    hmDiv.innerHTML = title;
    mDiv.className = "melding";    
    iDiv.appendChild(i);
    hDiv.appendChild(iDiv);
    hDiv.appendChild(hmDiv);
    
    mDiv.innerHTML = notice;
    
    nDiv.appendChild(hDiv);
    nDiv.appendChild(mDiv);
    nDiv.appendChild(cDiv);


    nDiv.id = "notice" + number;
    var nDivHandler = new mmEvent.EventRouter(nDiv,"onclick");
    nDivHandler.addListener(function() {NoticeManager.remove(eval(number))});
    return nDiv;
}


//END NOTICE MANAGER






























     



xLibrary={version:'4.17',license:'GNU LGPL',url:'http://cross-browser.com/'};function xCamelize(cssPropStr){var i,c,a=cssPropStr.split('-');var s=a[0];for(i=1;i<a.length;++i){c=a[i].charAt(0);s+=a[i].replace(c,c.toUpperCase());}return s;}function xClientHeight(){var v=0,d=document,w=window;if((!d.compatMode||d.compatMode=='CSS1Compat')&&!w.opera&&d.documentElement&&d.documentElement.clientHeight){v=d.documentElement.clientHeight;}else if(d.body&&d.body.clientHeight){v=d.body.clientHeight;}else if(xDef(w.innerWidth,w.innerHeight,d.width)){v=w.innerHeight;if(d.width>w.innerWidth)v-=16;}return v;}function xClientWidth(){var v=0,d=document,w=window;if((!d.compatMode||d.compatMode=='CSS1Compat')&&!w.opera&&d.documentElement&&d.documentElement.clientWidth){v=d.documentElement.clientWidth;}else if(d.body&&d.body.clientWidth){v=d.body.clientWidth;}else if(xDef(w.innerWidth,w.innerHeight,d.height)){v=w.innerWidth;if(d.height>w.innerHeight)v-=16;}return v;}function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}return true;}function xGetComputedStyle(e,p,i){if(!(e=xGetElementById(e)))return null;var s,v='undefined',dv=document.defaultView;if(dv&&dv.getComputedStyle){s=dv.getComputedStyle(e,'');if(s)v=s.getPropertyValue(p);}else if(e.currentStyle){v=e.currentStyle[xCamelize(p)];}else return null;return i?(parseInt(v)||0):v;}function xGetElementById(e){if(typeof(e)=='string'){if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;}return e;}function xGetElementsByClassName(c,p,t,f){var r=new Array();var re=new RegExp("(^|\\s)"+c+"(\\s|$)");var e=xGetElementsByTagName(t,p);for(var i=0;i<e.length;++i){if(re.test(e[i].className)){r[r.length]=e[i];if(f)f(e[i]);}}return r;}function xGetElementsByTagName(t,p){var list=null;t=t||'*';p=p||document;if(typeof p.getElementsByTagName!='undefined'){list=p.getElementsByTagName(t);if(t=='*'&&(!list||!list.length))list=p.all;}else{if(t=='*')list=p.all;else if(p.all&&p.all.tags)list=p.all.tags(t);}return list||new Array();}function xHasPoint(e,x,y,t,r,b,l){if(!xNum(t)){t=r=b=l=0;}else if(!xNum(r)){r=b=l=t;}else if(!xNum(b)){l=r;b=t;}var eX=xPageX(e),eY=xPageY(e);return(x>=eX+l&&x<=eX+xWidth(e)-r&&y>=eY+t&&y<=eY+xHeight(e)-b);}function xHeight(e,h){if(!(e=xGetElementById(e)))return 0;if(xNum(h)){if(h<0)h=0;else h=Math.round(h);}else h=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){h=xClientHeight();}else if(css&&xDef(e.offsetHeight)&&xStr(e.style.height)){if(h>=0){var pt=0,pb=0,bt=0,bb=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pt=gcs(e,'padding-top',1);if(pt!==null){pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0)return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css&&xDef(e.style.pixelHeight)){if(h>=0)e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}function xLeft(e,iX){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.left)){if(xNum(iX))e.style.left=iX+'px';else{iX=parseInt(e.style.left);if(isNaN(iX))iX=xGetComputedStyle(e,'left',1);if(isNaN(iX))iX=0;}}else if(css&&xDef(e.style.pixelLeft)){if(xNum(iX))e.style.pixelLeft=iX;else iX=e.style.pixelLeft;}return iX;}function xMoveTo(e,x,y){xLeft(e,x);xTop(e,y);}function xNum(){for(var i=0;i<arguments.length;++i){if(isNaN(arguments[i])||typeof(arguments[i])!='number')return false;}return true;}function xOpacity(e,o){var set=xDef(o);if(!(e=xGetElementById(e)))return 2;if(xStr(e.style.opacity)){if(set)e.style.opacity=o+'';else o=parseFloat(e.style.opacity);}else if(xStr(e.style.filter)){if(set)e.style.filter='alpha(opacity='+(100*o)+')';else if(e.filters&&e.filters.alpha){o=e.filters.alpha.opacity/100;}}else if(xStr(e.style.MozOpacity)){if(set)e.style.MozOpacity=o+'';else o=parseFloat(e.style.MozOpacity);}else if(xStr(e.style.KhtmlOpacity)){if(set)e.style.KhtmlOpacity=o+'';else o=parseFloat(e.style.KhtmlOpacity);}return isNaN(o)?1:o;}function xPageX(e){var x=0;e=xGetElementById(e);while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null;}return x;}function xPageY(e){var y=0;e=xGetElementById(e);while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null;}return y;}function xResizeTo(e,w,h){xWidth(e,w);xHeight(e,h);}function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body&&xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft;}else{e=xGetElementById(e);if(e&&xNum(e.scrollLeft))offset=e.scrollLeft;}return offset;}function xScrollTop(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body&&xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop;}else{e=xGetElementById(e);if(e&&xNum(e.scrollTop))offset=e.scrollTop;}return offset;}function xStr(s){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false;}return true;}function xStyle(sProp,sVal){var i,e;for(i=2;i<arguments.length;++i){e=xGetElementById(arguments[i]);if(e.style){try{e.style[sProp]=sVal;}catch(err){e.style[sProp]='';}}}}function xTop(e,iY){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.top)){if(xNum(iY))e.style.top=iY+'px';else{iY=parseInt(e.style.top);if(isNaN(iY))iY=xGetComputedStyle(e,'top',1);if(isNaN(iY))iY=0;}}else if(css&&xDef(e.style.pixelTop)){if(xNum(iY))e.style.pixelTop=iY;else iY=e.style.pixelTop;}return iY;}function xWidth(e,w){if(!(e=xGetElementById(e)))return 0;if(xNum(w)){if(w<0)w=0;else w=Math.round(w);}else w=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){w=xClientWidth();}else if(css&&xDef(e.offsetWidth)&&xStr(e.style.width)){if(w>=0){var pl=0,pr=0,bl=0,br=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pl=gcs(e,'padding-left',1);if(pl!==null){pr=gcs(e,'padding-right',1);bl=gcs(e,'border-left-width',1);br=gcs(e,'border-right-width',1);}else if(xDef(e.offsetWidth,e.style.width)){e.style.width=w+'px';pl=e.offsetWidth-w;}}w-=(pl+pr+bl+br);if(isNaN(w)||w<0)return;else e.style.width=w+'px';}w=e.offsetWidth;}else if(css&&xDef(e.style.pixelWidth)){if(w>=0)e.style.pixelWidth=w;w=e.style.pixelWidth;}return w;}



// xOffsetTop r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xOffsetTop(e)
{
  if (!(e=xGetElementById(e))) return 0;
  if (xDef(e.offsetTop)) return e.offsetTop;
  else return 0;
}

// xOffsetLeft r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xOffsetLeft(e)
{
  if (!(e=xGetElementById(e))) return 0;
  if (xDef(e.offsetLeft)) return e.offsetLeft;
  else return 0;
}

// xCardinalPosition r3, Copyright 2004-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xCardinalPosition(e, cp, margin, outside)
{
  if(!(e=xGetElementById(e))) return;
  if (typeof(cp)!='string'){window.status='xCardinalPosition error: cp=' + cp + ', id=' + e.id; return;}
  var x=xLeft(e), y=xTop(e), w=xWidth(e), h=xHeight(e);
  var pw,ph,p = e.offsetParent;
  if (p == document || p.nodeName.toLowerCase() == 'html') {pw = xClientWidth(); ph = xClientHeight();}
  else {pw=xWidth(p); ph=xHeight(p);}
  var sx=xScrollLeft(p), sy=xScrollTop(p);
  var right=sx + pw, bottom=sy + ph;
  var cenLeft=sx + Math.floor((pw-w)/2), cenTop=sy + Math.floor((ph-h)/2);
  if (!margin) margin=0;
  else{
    if (outside) margin=-margin;
    sx +=margin; sy +=margin; right -=margin; bottom -=margin;
  }
  switch (cp.toLowerCase()){
    case 'n': x=cenLeft; if (outside) y=sy - h; else y=sy; break;
    case 'ne': if (outside){x=right; y=sy - h;}else{x=right - w; y=sy;}break;
    case 'e': y=cenTop; if (outside) x=right; else x=right - w; break;
    case 'se': if (outside){x=right; y=bottom;}else{x=right - w; y=bottom - h}break;
    case 's': x=cenLeft; if (outside) y=sy - h; else y=bottom - h; break;
    case 'sw': if (outside){x=sx - w; y=bottom;}else{x=sx; y=bottom - h;}break;
    case 'w': y=cenTop; if (outside) x=sx - w; else x=sx; break;
    case 'nw': if (outside){x=sx - w; y=sy - h;}else{x=sx; y=sy;}break;
    case 'cen': x=cenLeft; y=cenTop; break;
    case 'cenh': x=cenLeft; break;
    case 'cenv': y=cenTop; break;
  }
  var o = new Object();
  o.x = x; o.y = y;
  return o;
}


// xDisplay r3, Copyright 2003-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

// This was alternative 1:

function xDisplay(e,s)
{
  if ((e=xGetElementById(e)) && e.style && xDef(e.style.display)) {
    if (xStr(s)) {
      try { e.style.display = s; }
      catch (ex) { e.style.display = ''; } // Will this make IE use a default value
    }                                      // appropriate for the element?
    return e.style.display;
  }
  return null;
}

// xEvent r11, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xEvent(evt) // object prototype
{
  var e = evt || window.event;
  if (!e) return;
  this.type = e.type;
  this.target = e.target || e.srcElement;
  this.relatedTarget = e.relatedTarget;
  /*@cc_on if (e.type == 'mouseover') this.relatedTarget = e.fromElement;
  else if (e.type == 'mouseout') this.relatedTarget = e.toElement; @*/
  if (xDef(e.pageX)) { this.pageX = e.pageX; this.pageY = e.pageY; }
  else if (xDef(e.clientX)) { this.pageX = e.clientX + xScrollLeft(); this.pageY = e.clientY + xScrollTop(); }
  if (xDef(e.offsetX)) { this.offsetX = e.offsetX; this.offsetY = e.offsetY; }
  else if (xDef(e.layerX)) { this.offsetX = e.layerX; this.offsetY = e.layerY; }
  else { this.offsetX = this.pageX - xPageX(this.target); this.offsetY = this.pageY - xPageY(this.target); }
  this.keyCode = e.keyCode || e.which || 0;
  this.shiftKey = e.shiftKey; this.ctrlKey = e.ctrlKey; this.altKey = e.altKey;
  if (typeof e.type == 'string') {
    if (e.type.indexOf('click') != -1) {this.button = 0;}
    else if (e.type.indexOf('mouse') != -1) {
      this.button = e.button;
      /*@cc_on if (e.button & 1) this.button = 0;
      else if (e.button & 4) this.button = 1;
      else if (e.button & 2) this.button = 2; @*/
    }
  }
}

// xVisibility r1, Copyright 2003-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xVisibility(e, bShow)
{
  if(!(e=xGetElementById(e))) return null;
  if(e.style && xDef(e.style.visibility)) {
    if (xDef(bShow)) e.style.visibility = bShow ? 'visible' : 'hidden';
    return e.style.visibility;
  }
  return null;
}

//function xVisibility(e,s)
//{
//  if(!(e=xGetElementById(e))) return null;
//  var v = 'visible', h = 'hidden';
//  if(e.style && xDef(e.style.visibility)) {
//    if (xDef(s)) {
//      // try to maintain backwards compatibility (???)
//      if (xStr(s)) e.style.visibility = s;
//      else e.style.visibility = s ? v : h;
//    }
//    return e.style.visibility;
//    // or...
//    // if (e.style.visibility.length) return e.style.visibility;
//    // else return xGetComputedStyle(e, 'visibility');
//  }
//  else if (xDef(e.visibility)) { // NN4
//    if (xDef(s)) {
//      // try to maintain backwards compatibility
//      if (xStr(s)) e.visibility = (s == v) ? 'show' : 'hide';
//      else e.visibility = s ? v : h;
//    }
//    return (e.visibility == 'show') ? v : h;
//  }
//  return null;
//}


// xFirstChild r4, Copyright 2004-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xFirstChild(e,t)
{
  e = xGetElementById(e);
  var c = e ? e.firstChild : null;
  while (c) {
    if (c.nodeType == 1 && (!t || c.nodeName.toLowerCase() == t.toLowerCase())){break;}
    c = c.nextSibling;
  }
  return c;
}

// xNextSib r4, Copyright 2005-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xNextSib(e,t)
{
  e = xGetElementById(e);
  var s = e ? e.nextSibling : null;
  while (s) {
    if (s.nodeType == 1 && (!t || s.nodeName.toLowerCase() == t.toLowerCase())){break;}
    s = s.nextSibling;
  }
  return s;
}

// xPrevSib r4, Copyright 2005-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xPrevSib(e,t)
{
  e = xGetElementById(e);
  var s = e ? e.previousSibling : null;
  while (s) {
    if (s.nodeType == 1 && (!t || s.nodeName.toLowerCase() == t.toLowerCase())){break;}
    s = s.previousSibling;
  }
  return s;
}



// xWalkTree r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xWalkTree(n, f)
{
  f(n);
  for (var c = n.firstChild; c; c = c.nextSibling) {
    if (c.nodeType == 1) xWalkTree(c, f);
  }
}

// xEnableDrag r8, Copyright 2002-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xEnableDrag(id,fS,fD,fE)
{
  var mx = 0, my = 0, el = xGetElementById(id);
  if (el) {
    el.xDragEnabled = true;
    xAddEventListener(el, 'mousedown', dragStart, false);
  }
  // Private Functions
  function dragStart(e)
  {
    if (el.xDragEnabled) {
      var ev = new xEvent(e);
      xPreventDefault(e);
      mx = ev.pageX;
      my = ev.pageY;
      xAddEventListener(document, 'mousemove', drag, false);
      xAddEventListener(document, 'mouseup', dragEnd, false);
      if (fS) {
        fS(el, ev.pageX, ev.pageY, ev);
      }
    }
  }
  function drag(e)
  {
    var ev, dx, dy;
    xPreventDefault(e);
    ev = new xEvent(e);
    dx = ev.pageX - mx;
    dy = ev.pageY - my;
    mx = ev.pageX;
    my = ev.pageY;
    if (fD) {
      fD(el, dx, dy, ev);
    }
    else {
      xMoveTo(el, xLeft(el) + dx, xTop(el) + dy);
    }
  }
  function dragEnd(e)
  {
    var ev = new xEvent(e);
    xPreventDefault(e);
    xRemoveEventListener(document, 'mouseup', dragEnd, false);
    xRemoveEventListener(document, 'mousemove', drag, false);
    if (fE) {
      fE(el, ev.pageX, ev.pageY, ev);
    }
    if (xEnableDrag.drop) {
      xEnableDrag.drop(el, ev);
    }
  }
}

xEnableDrag.drops = []; // static property
// xAddEventListener r8, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xAddEventListener(e,eT,eL,cap)
{
  if(!(e=xGetElementById(e)))return;
  eT=eT.toLowerCase();
  if(e.addEventListener)e.addEventListener(eT,eL,cap||false);
  else if(e.attachEvent)e.attachEvent('on'+eT,eL);
  else {
    var o=e['on'+eT];
    e['on'+eT]=typeof o=='function' ? function(v){o(v);eL(v);} : eL;
  }
}
// xRemoveEventListener r6, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xRemoveEventListener(e,eT,eL,cap)
{
  if(!(e=xGetElementById(e)))return;
  eT=eT.toLowerCase();
  if(e.removeEventListener)e.removeEventListener(eT,eL,cap||false);
  else if(e.detachEvent)e.detachEvent('on'+eT,eL);
  else e['on'+eT]=null;
}
// xPreventDefault r1, Copyright 2004-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xPreventDefault(e)
{
  if (e && e.preventDefault) e.preventDefault();
  else if (window.event) window.event.returnValue = false;
}

// xAddEventListener r8, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xAddEventListener(e,eT,eL,cap)
{
  if(!(e=xGetElementById(e)))return;
  eT=eT.toLowerCase();
  if(e.addEventListener)e.addEventListener(eT,eL,cap||false);
  else if(e.attachEvent)e.attachEvent('on'+eT,eL);
  else {
    var o=e['on'+eT];
    e['on'+eT]=typeof o=='function' ? function(v){o(v);eL(v);} : eL;
  }
}



















StartCWE = function() {
    CWEcheckFBLayout(); // Facebook Frame?
    StartCWETimers();
    LoadingToggle('off');
    if( MINI_MODUS == 1 ) { /*window.location.href="#menu";*/ }
    if( LOGGED_IN == 1 ) {
        if(VISUAL_UPDATES == 1) document.getElementById('VVDP_SCRIPT_BASE').innerHTML = '<div class="menu_block"><div class="menu_header">'+CW_JS_LANG[33]+'</div><div class="menu_items" id="mb_news"><ul>'+VVDP_ITEMS_STRING+'</ul></div></div>'; 
        if(VIPMDATA[0]>1 && VISUAL_UPDATES == 1){loadVipMenu(VIPMDATA);}
    }
}
StopCWE = function() {
    Loading1Sec();
}

function loadVipMenu() {
    if( VIPMDATA[10] > 0 ) {
        var EMAIL_BLINK_DIV = '<div class="emailblink" onClick="window.location.href=\'http://'+HOSTNAME+'/user/email.php?read='+VIPMDATA[10]+'&blinkoff\'"><img src="'+LAYOUT_PATH+'images/vip/mailblink.gif" alt="'+CW_JS_LANG[34]+'" title="'+CW_JS_LANG[34]+'" /></div';
    } else {
        var EMAIL_BLINK_DIV = '';
    }
    
    var VIP_CONTAINER = document.getElementById('VIP_MENU_BASE');
    var Z = '<div class="search"><form method="get" name="SEARCH_CRIMINAL" action="/intranet/criminalbrowser/"><input type="hidden" name="page" value="1" /><input type="hidden" name="lt" value="0" /><input type="text" class="textfield" style="width: 115px; height:12px;" name="l" value="'+CW_JS_LANG[35]+'" onFocus="javascript:this.value=\'\';" /><input type="submit" class="invisble_button" style="height:1px;" name="SUBMIT_SEARCH" value="" /></form></div>'
            +'<div class="cash" onClick="window.location.href=\'http://'+HOSTNAME+'/user/cash.php\'">&euro; '+VIPMDATA[9]+'</div>'
            +'<div id="vip_pb">'
                +getProgessBar('rang', VIPMDATA[1])
                +getProgessBar('health', VIPMDATA[2])
                +getProgessBar('business', VIPMDATA[3])
                +getProgessBar('driver', VIPMDATA[4])
                +getProgessBar('kill', VIPMDATA[5])
            +'</div>'
            +'<div class="email" onClick="window.location.href=\'http://'+HOSTNAME+'/user/email.php\'">&nbsp;</div>'
            +'<div class="link1" onClick="window.location.href=\'http://'+HOSTNAME+''+VIPMDATA[6]+'\'">&nbsp;</div>'
            +'<div class="link2" onClick="window.location.href=\'http://'+HOSTNAME+''+VIPMDATA[7]+'\'">&nbsp;</div>'
            +'<div class="lockdown" onClick="window.location.href=\'http://'+HOSTNAME+'/sys/lockdown.php\'">&nbsp;</div>'
            +EMAIL_BLINK_DIV;
    VIP_CONTAINER.innerHTML = Z;
}

function getProgessBar(type, percent) {
    if( percent > 50 ) { bar_type = 'pbg'; } else if( percent > 25 ) { bar_type = 'pbo'; } else { bar_type = 'pbr'; }
    width = Math.round((percent / 100) * 86);
    percent = Math.round(percent);
    var percentclass = type+'percent';
    return '<div class="'+bar_type+' '+type+'" style="width: '+width+'px;"></div><div class="'+type+'percent">'+percent+'%</div>';
}


function LoadingToggle(loading_state, duration) {
    switch( loading_state ) {
        case 'on' : LoadingStart(); break;
        case 'off' : LoadingStop(); break;
    }
}
var Loading1Second;
function Loading1Sec(){LoadingStart();Loading1Second = setTimeout(LoadingStop,"1000");}
function LoadingStart(){
    if(VISUAL_UPDATES == 1) document.getElementById('loading_img').innerHTML = '<a href="/doc/faq/?word=cwe"><img src="' + LAYOUT_PATH + 'images/layout/mb_loading.gif" alt="Camorra World Engine \nStatus: Loading..." border="0" /></a>';
}
function LoadingStop(){
    if( LOGGED_IN == 1 ) {
        if(VISUAL_UPDATES == 1) document.getElementById('loading_img').innerHTML = '<a href="/doc/faq/?word=cwe"><img src="' + LAYOUT_PATH + 'images/layout/mb_loaded.gif" alt="Camorra World Engine \nStatus: Online & Chilling..." border="0" /></a>';
    } else {
        if(VISUAL_UPDATES == 1) document.getElementById('loading_img').innerHTML = '<a href="#"><img src="' + LAYOUT_PATH + 'images/layout/mb_loaded.gif" onClick="javascript:document.login.submit();" alt="Login!" border="0" /></a>';
    }
}


var CWETimerOnlineInt;
var CWETimerLockAccountInt;
var CWETimerVipMenuInt;


function StartCWETimers() {
    
    if( LOGGED_IN == 1 ) {
        
        OUIMS = ONLINEUPDATE_INTERVAL * 750; //ms (900 = 90%)
        CWETimerOnlineInt = setInterval(CWETimerOnline, OUIMS);
    
        if( LOCKDOWN_INTERVAL != "OFF" ) {
            if( LOCKDOWN_INTERVAL > 1 ) {
                LOCKDOWN_MS = LOCKDOWN_INTERVAL * 60000;                
                CWETimerLockAccountInt = setTimeout(CWETimerLockAccount, LOCKDOWN_MS);
            }
        }
        
        VIPMENU_INTERVAL = 30*1000;
        if( VIPMDATA[0] != 0 ) {
            if(VISUAL_UPDATES == 1) CWETimerVipMenuInt = setInterval(CWErefreshVipMenu, VIPMENU_INTERVAL);
        }
    }
}
function CWETimerLockAccountRestart() {
    clearTimeout(CWETimerLockAccountInt);
    if( LOCKDOWN_INTERVAL != "OFF" ) {
        if( LOCKDOWN_INTERVAL > 1 ) {
            LOCKDOWN_MS = LOCKDOWN_INTERVAL * 60000;
            /*alert(LOCKDOWN_MS);*/
            CWETimerLockAccountInt = setTimeout(CWETimerLockAccount, LOCKDOWN_MS);
        }
    }
}
function CWETimerOnline() {
    Loading1Sec();
    AskCWE("OnlineUpdate");
    //initTimer(CWETimerTest());
}
var LOCKDOWN_STOP = "NO";
function CWETimerLockAccount() {
    if( LOCKDOWN_STOP == "NO" ) {
        LoadingToggle("on");
        window.location.href = "/sys/lockdown.php";
        LoadingToggle("off");
    }
}
function CWETimerLockAccountStop() {
    LOCKDOWN_STOP = "YES";
    clearTimeout(CWETimerLockAccountInt);
    
}




var AB = new Object();
AB.Start = function(base, target) {
    this.Container = document.getElementById(base);
    this.Target = document.getElementById(target);
    
    if( this.Opened != 1 ) {
        
        this.Container.style.display = "block";
        this.Container.style.overflow = "auto";
        
        this.Open();
    }
    
    this.Opened = 1;
}
AB.Open = function() {
    CWEgetAB();
}
AB.Fill = function(Content) {
    if( this.Filled != 1 ) {
        this.FillContent = '<div style="text-align: right; float: right;"><a href="javascript:AB.Close()">'+CW_JS_LANG[36]+'</a></div><div style="padding: 5px;">'+Content+'</div></div>';
        this.Container.innerHTML = this.FillContent;
        this.Filled = 1;
    } else {
        this.Container.innerHTML = this.FillContent;
    }
}
AB.Close = function() {
    this.Container.innerHTML = '';
    this.Container.style.display = "none";
    this.Opened = 0;
}
AB.Add = function(Contact) {
    if( this.Target.value == '' ) {
        this.Target.value = Contact;
    } else {
        this.Target.value = this.Target.value + ', ' + Contact;
    }
}



function ShowTicket(ticket) {
    var ticketdiv = "tdetail" + ticket;
    document.getElementById(ticketdiv).style.display = "block";
}



function CWEstartMailBox() {
    CWEshowMailBox("INBOX");
}

function CWEshowMailBox(box) {
    CWEsetET(box);
    CWEshowXmlTable(box);
    CWETimerLockAccountRestart();
}
var cwET = {
    "INBOX":{id:"ETinbox",c:"m tf",ca:"m taf"},
    "SENT":{id:"ETsent",c:"m t",ca:"m ta"},
    "SAVED":{id:"ETsaved",c:"m t",ca:"m ta"},
    "COMPOSE":{id:"ETcompose",c:"m t",ca:"m ta"},
    "SMS":{id:"ETsms",c:"m tl",ca:"m tal"}
};
function CWEsetET(q){
    for( var x in cwET ) { 
        if( x == q ) {
            var t = document.getElementById(cwET[x].id);
            t.className = cwET[x].ca;
        } else {
            var t = document.getElementById(cwET[x].id);
            t.className = cwET[x].c;
        }
    }
}
function CWEloadEmail() {
    // Id komt binnen via loadlistener
    //alert(typeof(document.getElementById("EMAIL")));
    CWEshowEmail(EMAILid);
}
function CWEshowEmail(EMAILid) {
    var EMAILid = EMAILid;
    document.getElementById("EMAIL").innerHTML = "";
    document.getElementById("EMAIL").style.display = "block";
    CWEemailGet(EMAILid);
}
function CWEshowSavedEmail(EMAILid) {
    var EMAILid = EMAILid;
    document.getElementById("EMAIL").innerHTML = "";
    document.getElementById("EMAIL").style.display = "block";
    CWEemailSavedGet(EMAILid);
}
function CWEreplyEmail() {
    CWEshowMailBox("COMPOSE");
    document.getElementById("receivers").value = document.getElementById("EMAILREPLYTO").innerHTML;
    
    var tempsub = document.getElementById("EMAILREPLYSUBJECT").innerHTML;
    if( tempsub != '' ) {
        tempsub = CWEstr_replace("RE: ", "", tempsub);
        document.getElementById("subject").value = 'RE: ' + tempsub;
    }
}
function CWEformatAJAXString(gstring) {
    var a = htmlentities(gstring);
    return encodeURIComponent(a);
}
function htmlentities (string, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
 
    var histogram = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}
function get_html_translation_table(table, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco
    // +   bugfixed by: madipta
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // %          note: Table from http://www.the-art-of-web.com/html/character-codes/
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
    
    // Map numbers to strings for compatibilty with PHP constants
    if (!isNaN(useTable)) {
        useTable = constMappingTable[useTable];
    }
    if (!isNaN(useQuoteStyle)) {
        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
    }
 
    if (useTable == 'HTML_SPECIALCHARS') {
        // ascii decimals for better compatibility
        entities['38'] = '&amp;';
        if (useQuoteStyle != 'ENT_NOQUOTES') {
            entities['34'] = '&quot;';
        }
        if (useQuoteStyle == 'ENT_QUOTES') {
            entities['39'] = '&#039;';
        }
        entities['60'] = '&lt;';
        entities['62'] = '&gt;';
    } else if (useTable == 'HTML_ENTITIES') {
        // ascii decimals for better compatibility
      entities['38']  = '&amp;';
        if (useQuoteStyle != 'ENT_NOQUOTES') {
            entities['34'] = '&quot;';
        }
        if (useQuoteStyle == 'ENT_QUOTES') {
            entities['39'] = '&#039;';
        }
      entities['60']  = '&lt;';
      entities['62']  = '&gt;';
      entities['160'] = '&nbsp;';
      entities['161'] = '&iexcl;';
      entities['162'] = '&cent;';
      entities['163'] = '&pound;';
      entities['164'] = '&curren;';
      entities['165'] = '&yen;';
      entities['166'] = '&brvbar;';
      entities['167'] = '&sect;';
      entities['168'] = '&uml;';
      entities['169'] = '&copy;';
      entities['170'] = '&ordf;';
      entities['171'] = '&laquo;';
      entities['172'] = '&not;';
      entities['173'] = '&shy;';
      entities['174'] = '&reg;';
      entities['175'] = '&macr;';
      entities['176'] = '&deg;';
      entities['177'] = '&plusmn;';
      entities['178'] = '&sup2;';
      entities['179'] = '&sup3;';
      entities['180'] = '&acute;';
      entities['181'] = '&micro;';
      entities['182'] = '&para;';
      entities['183'] = '&middot;';
      entities['184'] = '&cedil;';
      entities['185'] = '&sup1;';
      entities['186'] = '&ordm;';
      entities['187'] = '&raquo;';
      entities['188'] = '&frac14;';
      entities['189'] = '&frac12;';
      entities['190'] = '&frac34;';
      entities['191'] = '&iquest;';
      entities['192'] = '&Agrave;';
      entities['193'] = '&Aacute;';
      entities['194'] = '&Acirc;';
      entities['195'] = '&Atilde;';
      entities['196'] = '&Auml;';
      entities['197'] = '&Aring;';
      entities['198'] = '&AElig;';
      entities['199'] = '&Ccedil;';
      entities['200'] = '&Egrave;';
      entities['201'] = '&Eacute;';
      entities['202'] = '&Ecirc;';
      entities['203'] = '&Euml;';
      entities['204'] = '&Igrave;';
      entities['205'] = '&Iacute;';
      entities['206'] = '&Icirc;';
      entities['207'] = '&Iuml;';
      entities['208'] = '&ETH;';
      entities['209'] = '&Ntilde;';
      entities['210'] = '&Ograve;';
      entities['211'] = '&Oacute;';
      entities['212'] = '&Ocirc;';
      entities['213'] = '&Otilde;';
      entities['214'] = '&Ouml;';
      entities['215'] = '&times;';
      entities['216'] = '&Oslash;';
      entities['217'] = '&Ugrave;';
      entities['218'] = '&Uacute;';
      entities['219'] = '&Ucirc;';
      entities['220'] = '&Uuml;';
      entities['221'] = '&Yacute;';
      entities['222'] = '&THORN;';
      entities['223'] = '&szlig;';
      entities['224'] = '&agrave;';
      entities['225'] = '&aacute;';
      entities['226'] = '&acirc;';
      entities['227'] = '&atilde;';
      entities['228'] = '&auml;';
      entities['229'] = '&aring;';
      entities['230'] = '&aelig;';
      entities['231'] = '&ccedil;';
      entities['232'] = '&egrave;';
      entities['233'] = '&eacute;';
      entities['234'] = '&ecirc;';
      entities['235'] = '&euml;';
      entities['236'] = '&igrave;';
      entities['237'] = '&iacute;';
      entities['238'] = '&icirc;';
      entities['239'] = '&iuml;';
      entities['240'] = '&eth;';
      entities['241'] = '&ntilde;';
      entities['242'] = '&ograve;';
      entities['243'] = '&oacute;';
      entities['244'] = '&ocirc;';
      entities['245'] = '&otilde;';
      entities['246'] = '&ouml;';
      entities['247'] = '&divide;';
      entities['248'] = '&oslash;';
      entities['249'] = '&ugrave;';
      entities['250'] = '&uacute;';
      entities['251'] = '&ucirc;';
      entities['252'] = '&uuml;';
      entities['253'] = '&yacute;';
      entities['254'] = '&thorn;';
      entities['255'] = '&yuml;';
    } else {
        throw Error("Table: "+useTable+' not supported');
        return false;
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal);
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}
function CWEstr_replace(search, replace, target) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'
 
    var f = search, r = replace, s = target;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
 
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
 
    return sa ? s : s[0];
}




var cwext = {
    "INBOX":{s:"/sys/CWE/cwe.xml.emailtables.php?type=inbox",l:"0",v:"0",t:"InboxList",c:"INBOX",o:""},
    "COMPOSE":{s:"",l:"0",v:"0",t:"",c:"COMPOSE",o:""},
    "SAVED":{s:"/sys/CWE/cwe.xml.emailtables.php?type=saved",l:"0",v:"0",t:"SavedList",c:"SAVED",o:""},
    "SENT":{s:"/sys/CWE/cwe.xml.emailtables.php?type=sent",l:"0",v:"0",t:"SentList",c:"SENT",o:""},
    "SMS":{s:"",l:"0",v:"0",t:"",c:"SMS",o:""},
    "EMAIL":{s:"",l:"0",v:"0",t:"",c:"EMAIL",o:""}
};
function CWEshowXmlTable(q){
    for( var x in cwext ) { 
        if( x == q ) {
            if( cwext[x].l == 0 && cwext[x].s != "" ) {
                HtmlBlockShow(cwext[x].c);
                cwext[x].o = new dhtmlXGridObject(cwext[x].t); 
                cwext[x].o.loadXML(cwext[x].s);
                cwext[x].l = 1;
                cwext[x].v = 1;
            }
            else if( cwext[x].l == 0 ) {
                HtmlBlockShow(cwext[x].c);
                cwext[x].l = 1;
                cwext[x].v = 1;
            }
            if( cwext[x].v == 0 ) {
                HtmlBlockShow(cwext[x].c);
                cwext[x].v = 1;
            }
        } else {
            if( cwext[x].v == 1 ) { HtmlBlockHide(cwext[x].c); cwext[x].v = 0; }
        }
    }
}
function CWEloadXmlTable(q){
    for( var x in cwext ) {
        if( x == q ) {
            if( cwext[x].l == 0 ) {
                cwext[x].o = new dhtmlXGridObject(cwext[x].t); 
                cwext[x].o.loadXML(cwext[x].s + "&CWEid="+(new Date()).valueOf());
            }
        }
    }
}
function CWErefreshXmlTable(q){
    for( var x in cwext ) {
        if( x == q ) {
            if( cwext[x].l == 1 ) {
                cwext[x].o.updateFromXML(cwext[x].s);
            }
        }
    }
}

function CWEselectallXmlTable(q){
    for( var x in cwext ) {
        if( x == q ) {
            cwext[x].o.forEachRow(function(id){
                 cwext[x].o.cells(id,4).changeState();
            })
        }
    }
}



var mb_admin = 0;
var mb_help = 1;
var mb_crimes = 0;
var mb_murder = 0;
var mb_business = 0;
var mb_casino = 0;
var mb_vastgoed = 0;
var mb_netwerk = 0;
var mb_news = 0;
var mb_new = 1;

function HtmlBlockHide(block) {
    document.getElementById(block).style.display = "none";
}
function HtmlBlockShow(block) {
    document.getElementById(block).style.display = "block";
}

function ToggleMenu(menu) {
    switch( menu ) {
        case 'admin'     : if( mb_admin == 1 ) { HtmlBlockHide("mb_admin");            mb_admin = 0;         } else {     HtmlBlockShow("mb_admin");        mb_admin = 1;} break;
        case 'help'     : if( mb_help == 1 ) { HtmlBlockHide("mb_help");            mb_help = 0;         } else {     HtmlBlockShow("mb_help");        mb_help = 1;} break;
        case 'crimes'     : if( mb_crimes == 1 ) { HtmlBlockHide("mb_crimes");        mb_crimes = 0;         } else {     HtmlBlockShow("mb_crimes");        mb_crimes = 1;} break;
        case 'murder'     : if( mb_murder == 1 ) { HtmlBlockHide("mb_murder");        mb_murder = 0;         } else {     HtmlBlockShow("mb_murder");        mb_murder = 1;} break;
        case 'business' : if( mb_business == 1 ) { HtmlBlockHide("mb_business");    mb_business = 0;     } else {     HtmlBlockShow("mb_business");    mb_business = 1;} break;
        case 'casino'     : if( mb_casino == 1 ) { HtmlBlockHide("mb_casino");        mb_casino = 0;         } else {     HtmlBlockShow("mb_casino");        mb_casino = 1;} break;
        case 'vastgoed'    : if( mb_vastgoed == 1 ) { HtmlBlockHide("mb_vastgoed");    mb_vastgoed = 0;     } else {     HtmlBlockShow("mb_vastgoed");    mb_vastgoed = 1;} break;
        case 'netwerk'     : if( mb_netwerk == 1 ) { HtmlBlockHide("mb_netwerk");        mb_netwerk = 0;     } else {     HtmlBlockShow("mb_netwerk");    mb_netwerk = 1;} break;
        case 'news'     : if( mb_news == 1 ) { HtmlBlockHide("mb_news");            mb_news = 0;         } else {     HtmlBlockShow("mb_news");        mb_news = 1;} break;
        case 'new'         : if( mb_new == 1 ) { HtmlBlockHide("mb_new");                mb_new = 0;         } else {     HtmlBlockShow("mb_new");        mb_new = 1;} break;
    }
}



function CWEloadForumTopic() {
    // Id komt binnen via loadlistener
    //alert(typeof(document.getElementById("EMAIL")));
    CWEshowForumTopic(TopicID, 1);
}
function CWEshowForumTopic(Topic, Page) {
    FORUMPAGE = Page;
    CWEfillTopic(Topic, Page);
    CWETimerLockAccountRestart();
    window.document.location.href = "#menu";
}
function CloseTopic() {
    HtmlBlockShow('ForumBoardContent');
    HtmlBlockHide('ForumTopic');
    HtmlBlockHide("ForumNewPost");
    CWETimerLockAccountRestart();
}
function CancelPost() {
    HtmlBlockShow('ForumTopic');
    HtmlBlockHide('ForumNewPost');
}


function CWEpagingSelectedPage() {
    var List = xGetElementById("PageSelect");
    var SelectedPage = List.selectedIndex + 1;
    return SelectedPage;
}

function CWEselectGoToValue(SelectBox, Url) {
    var SelectBox;
    var Url;
    redirect = Url + document.getElementById(SelectBox).value;
    document.location.href = redirect;
}













var CriminalBrowser;
var CriminalBrowserStatus = "off";
var CriminalBook = "/sys/CWE/cwe.xml.criminalbrowser.php";
function CriminalBrowserStart(){
Loading1Sec();
if( CriminalBrowserStatus == "off" ) {
CriminalBrowserStatus = "on";
document.getElementById("CriminalBrowser").style.visibility = "visible";
document.getElementById("CBRefreshLink").style.visibility = "visible";
CriminalBrowser = new dhtmlXGridObject('CBList'); 
CriminalBrowser.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
CriminalBrowser.setSkin("modern");
CriminalBrowser.setHeader(CW_JS_LANG[37]+",#cspan,#cspan,"+CW_JS_LANG[38]+","+CW_JS_LANG[39]+","+CW_JS_LANG[40]+","+CW_JS_LANG[41]);
CriminalBrowser.setInitWidths("13,40,*,*,*,58,40"); 
CriminalBrowser.setColAlign("left,left,left,left,left,left,left"); 
CriminalBrowser.setColSorting("na,na,na,server,server,server,server"); 
CriminalBrowser.setColTypes("ro,ro,ro,ro,ro,ro,ro"); 
CriminalBrowser.setPagingWTMode("true");
CriminalBrowser.enablePaging(true,100,13,"CBPageLinks");
CriminalBrowser.enableRowsHover(true, "grid_hover");
CriminalBrowser.init();
CriminalBrowser.setPagingSkin("bricks");
CriminalBrowser.loadXML(CriminalBook);}}; 
function CriminalBrowserRefresh(){CriminalBrowser.updateFromXML(CriminalBook)
}



function CloseStatBooks(O) {
    document.getElementById("StatContCountry").style.display = "none";
    document.getElementById("StatContDrugsWeapons").style.display = "none";
    document.getElementById("StatContAmmo").style.display = "none";
    document.getElementById("StatContCarTune").style.display = "none";
    document.getElementById("StatContFactories").style.display = "none";
    document.getElementById("StatContRoulette").style.display = "none";
    document.getElementById("StatContBJ").style.display = "none";
    document.getElementById("StatContSpinner").style.display = "none";
    document.getElementById("StatContNumber").style.display = "none";   
    document.getElementById("StatContSteenps").style.display = "none";   
    document.getElementById("StatContCW").style.display = "none";
    document.getElementById(O).style.display = "block";
}


var StatsBookCountry;
var StatsBookCountryStatus = "off";
var StatsBookCountrySource = "/sys/CWE/cwe.xml.stats.php?stat=country";
function StatBookCountryStart(){
CloseStatBooks("StatContCountry");
Loading1Sec();
if( StatsBookCountryStatus == "off" ) {
StatsBookCountryStatus = "on";
StatsBookCountry = new dhtmlXGridObject('StatsListCountry'); 
StatsBookCountry.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookCountry.setSkin("modern");
StatsBookCountry.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[43]+","+CW_JS_LANG[44]+","+CW_JS_LANG[45]+","+CW_JS_LANG[46]+","+CW_JS_LANG[47]+","+CW_JS_LANG[48]+","+CW_JS_LANG[49]+","+CW_JS_LANG[50]);
StatsBookCountry.setInitWidths("80,30,30,30,110,90,45,45,*"); 
StatsBookCountry.setColAlign("left,center,center,center,right,right,right,right,right"); 
StatsBookCountry.setColSorting("str,int,int,int,int,int,int,int,str"); 
StatsBookCountry.setColTypes("link,ron,ron,ron,price,price,ron,ron,link"); 
StatsBookCountry.enableRowsHover(true, "grid_hover");
/*StatsBookCountry.enableBlockSelection();*/

StatsBookCountry.init();
StatsBookCountry.loadXML(StatsBookCountrySource);
}
}; 
function StatBookCountryRefresh() {
StatsBookCountry.updateFromXML(StatsBookCountrySource)
}


var StatsBookDrugsWeapons;
var StatsBookDrugsWeaponsStatus = "off";
var StatsBookDrugsWeaponsSource = "/sys/CWE/cwe.xml.stats.php?stat=drugsweapons";
function StatsBookDrugsWeaponsStart(){
Loading1Sec();
CloseStatBooks("StatContDrugsWeapons");
if( StatsBookDrugsWeaponsStatus == "off" ) {
StatsBookDrugsWeaponsStatus = "on";
StatsBookDrugsWeapons = new dhtmlXGridObject('StatsListDrugsWeapons'); 
StatsBookDrugsWeapons.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookDrugsWeapons.setSkin("modern");
StatsBookDrugsWeapons.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[51]+","+CW_JS_LANG[52]+","+CW_JS_LANG[53]+","+CW_JS_LANG[54]+","+CW_JS_LANG[55]+","+CW_JS_LANG[56]);
StatsBookDrugsWeapons.setInitWidths("80,*,*,*,*,*,*"); 
StatsBookDrugsWeapons.setColAlign("left,right,right,right,right,right,right"); 
StatsBookDrugsWeapons.setColSorting("str,int,int,int,int,int,int"); 
StatsBookDrugsWeapons.setColTypes("link,price,price,price,price,price,price"); 
StatsBookDrugsWeapons.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookDrugsWeapons.init();
StatsBookDrugsWeapons.loadXML(StatsBookDrugsWeaponsSource);
}
}; 
function StatsBookDrugsWeaponsRefresh() {
StatsBookDrugsWeapons.updateFromXML(StatsBookDrugsWeaponsSource)
}

var StatsBookAmmo;
var StatsBookAmmoStatus = "off";
var StatsBookAmmoSource = "/sys/CWE/cwe.xml.stats.php?stat=ammo";
function StatsBookAmmoStart(){
Loading1Sec();
CloseStatBooks("StatContAmmo");
if( StatsBookAmmoStatus == "off" ) {
StatsBookAmmoStatus = "on";
StatsBookAmmo = new dhtmlXGridObject('StatsListAmmo'); 
StatsBookAmmo.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookAmmo.setSkin("modern");
StatsBookAmmo.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[58]+","+CW_JS_LANG[59]+","+CW_JS_LANG[60]+","+CW_JS_LANG[61]);
StatsBookAmmo.setInitWidths("95,120,*,*,*,*"); 
StatsBookAmmo.setColAlign("left,left,right,right,right,right"); 
StatsBookAmmo.setColSorting("str,str,int,int,int,int"); 
StatsBookAmmo.setColTypes("link,link,price,ron,price,ron"); 
StatsBookAmmo.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookAmmo.init();
StatsBookAmmo.loadXML(StatsBookAmmoSource);
}
}; 
function StatsBookAmmoRefresh() {
StatsBookAmmo.updateFromXML(StatsBookAmmoSource)
}

var StatsBookCokeFactories;
var StatsBookCokeFactoriesStatus = "off";
var StatsBookCokeFactoriesSource = "/sys/CWE/cwe.xml.stats.php?stat=cokefactories";
function StatsBookCokeFactoriesStart(){
Loading1Sec();
CloseStatBooks("StatContFactories");
if( StatsBookCokeFactoriesStatus == "off" ) {
StatsBookCokeFactoriesStatus = "on";
StatsBookCokeFactories = new dhtmlXGridObject('StatsListCokeFactories'); 
StatsBookCokeFactories.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookCokeFactories.setSkin("modern");
StatsBookCokeFactories.setHeader(CW_JS_LANG[62]+","+CW_JS_LANG[57]+","+CW_JS_LANG[42]+","+CW_JS_LANG[63]+","+CW_JS_LANG[64]+","+CW_JS_LANG[65]+","+CW_JS_LANG[66]);
StatsBookCokeFactories.setInitWidths("120,120,80,*,*,*,*"); 
StatsBookCokeFactories.setColAlign("left,left,left,right,right,right,right"); 
StatsBookCokeFactories.setColSorting("str,str,str,int,int,int,int"); 
StatsBookCokeFactories.setColTypes("link,link,link,ron,ron,price,ron");
StatsBookCokeFactories.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookCokeFactories.init();
StatsBookCokeFactories.loadXML(StatsBookCokeFactoriesSource);
}
}; 
function StatsBookCokeFactoriesRefresh() {
StatsBookCokeFactories.updateFromXML(StatsBookCokeFactoriesSource)
}



var StatsBookCarTune;
var StatsBookCarTuneStatus = "off";
var StatsBookCarTuneSource = "/sys/CWE/cwe.xml.stats.php?stat=cartune";
function StatsBookCarTuneStart(){
Loading1Sec();
CloseStatBooks("StatContCarTune");
if( StatsBookCarTuneStatus == "off" ) {
StatsBookCarTuneStatus = "on";
StatsBookCarTune = new dhtmlXGridObject('StatsListCarTune'); 
StatsBookCarTune.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookCarTune.setSkin("modern");
StatsBookCarTune.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[67]+","+CW_JS_LANG[68]+","+CW_JS_LANG[69]+","+CW_JS_LANG[70]);
StatsBookCarTune.setInitWidths("120,120,*,*,*,*"); 
StatsBookCarTune.setColAlign("left,left,center,center,center,center"); 
StatsBookCarTune.setColSorting("str,str,int,int,int,int"); 
StatsBookCarTune.setColTypes("link,link,ron,ron,ron,ron"); 
StatsBookCarTune.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookCarTune.init();
StatsBookCarTune.loadXML(StatsBookCarTuneSource);
}
}; 
function StatsBookCarTuneRefresh() {
StatsBookCarTune.updateFromXML(StatsBookCarTuneSource)
}


var StatsBookServers;
var StatsBookServersStatus = "off";
var StatsBookServersSource = "/sys/CWE/cwe.xml.stats.php?stat=servers";
function StatsBookServersStart(){
Loading1Sec();
if( StatsBookServersStatus == "off" ) {
StatsBookServersStatus = "on";
StatsBookServers = new dhtmlXGridObject('StatsListServers'); 
StatsBookServers.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookServers.setSkin("modern");
StatsBookServers.setHeader(CW_JS_LANG[71]+","+CW_JS_LANG[72]+","+CW_JS_LANG[73]);
StatsBookServers.setInitWidths("200,*,*"); 
StatsBookServers.setColAlign("left,left,left"); 
StatsBookServers.setColSorting("str,na,int"); 
StatsBookServers.setColTypes("ro,ro,ro"); 
StatsBookServers.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookServers.init();
StatsBookServers.loadXML(StatsBookServersSource);
}
}; 
function StatsBookServersRefresh() {
StatsBookServers.updateFromXML(StatsBookServersSource)
}



var StatsBookCW;
var StatsBookCWStatus = "off";
var StatsBookCWSource = "/sys/CWE/cwe.xml.stats.php?stat=cw";
function StatsBookCWStart(){
Loading1Sec();
CloseStatBooks("StatContCW");
if( StatsBookCWStatus == "off" ) {
StatsBookCWStatus = "on";
StatsBookCW = new dhtmlXGridObject('StatsListCW'); 
StatsBookCW.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
StatsBookCW.setSkin("modern");
StatsBookCW.setHeader(CW_JS_LANG[74]+",#cspan");
StatsBookCW.setInitWidths("*,120"); 
StatsBookCW.setColAlign("left,right"); 
StatsBookCW.setColSorting("na,na"); 
StatsBookCW.setColTypes("ro,ro"); 
StatsBookCW.enableRowsHover(true, "grid_hover");
/*StatsBookDrugsWeapons.enableBlockSelection();*/
StatsBookCW.init();
StatsBookCW.loadXML(StatsBookCWSource);
}
}; 
function StatsBookCWRefresh() {
StatsBookCW.updateFromXML(StatsBookCWSource)
}





var StatsBookCasinoR = "off";
var StatsBookCasinoB = "off";
var StatsBookCasinoS = "off";
var StatsBookCasinoN = "off";  
var StatsBookCasinoRPS = "off";  
var StatsBookCasinoStatus = "off";
var StatsBookCasinoSource = "/sys/CWE/cwe.xml.stats.php?stat=casino&type=";
var StatsBookCasinoTypes = new Array("roulette", "blackjack", "spinner", "number","steenps");
function StatsBookCasinoStart(Casino){
    Loading1Sec();

    if( Casino == "R" ) {            
        CloseStatBooks("StatContRoulette");
        /*ROULETE*/
        if( StatsBookCasinoR == "off" ) {
            StatsBookCasinoR = new dhtmlXGridObject('StatsListCasinoT' + StatsBookCasinoTypes[0]); 
            StatsBookCasinoR.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
            StatsBookCasinoR.setSkin("modern");
            StatsBookCasinoR.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[75]+","+CW_JS_LANG[76]);
            StatsBookCasinoR.setInitWidths("120,120,*,*"); 
            StatsBookCasinoR.setColAlign("left,left,left,left"); 
            StatsBookCasinoR.setColSorting("str,str,int,int"); 
            StatsBookCasinoR.setColTypes("link,link,ron,ron");
            StatsBookCasinoR.setNumberFormat("0,000",2,",",".");
            StatsBookCasinoR.setNumberFormat("0,000",3,",",".");
            /*StatsBookCasinoR.setNumberFormat("0.000.000.000",0);*/
            StatsBookCasinoR.enableRowsHover(true, "grid_hover");
            /*StatsBookDrugsWeapons.enableBlockSelection();*/
            StatsBookCasinoR.init();
            StatsBookCasinoR.loadXML(StatsBookCasinoSource + StatsBookCasinoTypes[0]);
        }
        StatsBookCasinoR = "on";
        
        

    }
    if( Casino == "B" ) {            
        CloseStatBooks("StatContBJ");
        /*BLACKJACK*/
        if( StatsBookCasinoB == "off" ) {
            StatsBookCasinoB = new dhtmlXGridObject('StatsListCasinoT' + StatsBookCasinoTypes[1]); 
            StatsBookCasinoB.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
            StatsBookCasinoB.setSkin("modern");
            StatsBookCasinoB.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[75]+","+CW_JS_LANG[76]);
            StatsBookCasinoB.setInitWidths("120,120,*,*"); 
            StatsBookCasinoB.setColAlign("left,left,left,left"); 
            StatsBookCasinoB.setColSorting("str,str,int,int"); 
            StatsBookCasinoB.setColTypes("link,link,ron,ron");
            StatsBookCasinoB.setNumberFormat("0,000",2,",",".");
            StatsBookCasinoB.setNumberFormat("0,000",3,",",".");
            StatsBookCasinoB.enableRowsHover(true, "grid_hover");
            /*StatsBookDrugsWeapons.enableBlockSelection();*/
            StatsBookCasinoB.init();
            StatsBookCasinoB.loadXML(StatsBookCasinoSource + StatsBookCasinoTypes[1]);
        }
        StatsBookCasinoB = "on";
    }
    if( Casino == "S" ) {                
        CloseStatBooks("StatContSpinner");
        /*SPINNER*/
        if( StatsBookCasinoS == "off" ) {
            StatsBookCasinoS = new dhtmlXGridObject('StatsListCasinoT' + StatsBookCasinoTypes[2]); 
            StatsBookCasinoS.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
            StatsBookCasinoS.setSkin("modern");
            StatsBookCasinoS.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[75]+","+CW_JS_LANG[76]);
            StatsBookCasinoS.setInitWidths("120,120,*,*"); 
            StatsBookCasinoS.setColAlign("left,left,left,left"); 
            StatsBookCasinoS.setColSorting("str,str,int,int"); 
            StatsBookCasinoS.setColTypes("link,link,ron,ron");
            StatsBookCasinoS.setNumberFormat("0,000",2,",",".");
            StatsBookCasinoS.setNumberFormat("0,000",3,",",".");
            StatsBookCasinoS.enableRowsHover(true, "grid_hover");
            /*StatsBookDrugsWeapons.enableBlockSelection();*/
            StatsBookCasinoS.init();
            StatsBookCasinoS.loadXML(StatsBookCasinoSource + StatsBookCasinoTypes[2]);
        }
        StatsBookCasinoS = "on";
    }
    if( Casino == "N" ) {                
        CloseStatBooks("StatContNumber");
        /*NUMBER*/
        if( StatsBookCasinoN == "off" ) {
            StatsBookCasinoN = new dhtmlXGridObject('StatsListCasinoT' + StatsBookCasinoTypes[3]); 
            StatsBookCasinoN.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
            StatsBookCasinoN.setSkin("modern");
            StatsBookCasinoN.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[75]+","+CW_JS_LANG[76]);
            StatsBookCasinoN.setInitWidths("120,120,*,*"); 
            StatsBookCasinoN.setColAlign("left,left,left,left"); 
            StatsBookCasinoN.setColSorting("str,str,int,int"); 
            StatsBookCasinoN.setColTypes("link,link,ron,ron");
            StatsBookCasinoN.setNumberFormat("0,000",2,",",".");
            StatsBookCasinoN.setNumberFormat("0,000",3,",",".");
            StatsBookCasinoN.enableRowsHover(true, "grid_hover");
            /*StatsBookDrugsWeapons.enableBlockSelection();*/
            StatsBookCasinoN.init();
            StatsBookCasinoN.loadXML(StatsBookCasinoSource + StatsBookCasinoTypes[3]);
        }
        StatsBookCasinoN = "on";
    }
    if( Casino == "RPS" ) {                
        CloseStatBooks("StatContSteenps");
        /*ROCKPAPERSCISSORS*/
        if( StatsBookCasinoRPS == "off" ) {
            StatsBookCasinoRPS = new dhtmlXGridObject('StatsListCasinoT' + StatsBookCasinoTypes[4]); 
            StatsBookCasinoRPS.setImagePath(LAYOUT_PATH + "dhtmlx/imgs/"); 
            StatsBookCasinoRPS.setSkin("modern");
            StatsBookCasinoRPS.setHeader(CW_JS_LANG[42]+","+CW_JS_LANG[57]+","+CW_JS_LANG[75]+","+CW_JS_LANG[76]);
            StatsBookCasinoRPS.setInitWidths("120,120,*,*"); 
            StatsBookCasinoRPS.setColAlign("left,left,left,left"); 
            StatsBookCasinoRPS.setColSorting("str,str,int,int"); 
            StatsBookCasinoRPS.setColTypes("link,link,ron,ron");
            StatsBookCasinoRPS.setNumberFormat("0,000",2,",",".");
            StatsBookCasinoRPS.setNumberFormat("0,000",3,",",".");
            StatsBookCasinoRPS.enableRowsHover(true, "grid_hover");
            /*StatsBookDrugsWeapons.enableBlockSelection();*/
            StatsBookCasinoRPS.init();
            StatsBookCasinoRPS.loadXML(StatsBookCasinoSource + StatsBookCasinoTypes[4]);
        }
        StatsBookCasinoRPS = "on";
    }
}



function countdownsteel() 
{    tellermisdaad = tellermisdaad - 1;    if (tellermisdaad < 1) { document.WAITTIMES_BOARD.countdownsteel.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellermisdaad;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownsteel.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownsteel.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownsteel.value = sec + "s";
        
}    }
function countdownauto() 
{    tellerauto = tellerauto - 1;    if (tellerauto < 1) { document.WAITTIMES_BOARD.countdownauto.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerauto;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownauto.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownauto.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownauto.value = sec + "s";
}    }
function countdownSingle() 
{    tellersingle = tellersingle - 1;    if (tellersingle < 1) { document.WAITTIMES_BOARD.countdownSingle.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellersingle;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownSingle.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownSingle.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownSingle.value = sec + "s";
}    }
function countdownDuo() 
{    tellerduo = tellerduo - 1;    if (tellerduo < 1) { document.WAITTIMES_BOARD.countdownDuo.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerduo;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownDuo.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownDuo.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownDuo.value = sec + "s";
}    }
function countdownmulti() 
{    tellermulti = tellermulti - 1;    if (tellermulti < 1) { document.WAITTIMES_BOARD.countdownMulti.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellermulti;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownMulti.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownMulti.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownMulti.value = sec + "s";
}    }
function countdownFli() 
{    tellerflight = tellerflight - 1;    if (tellerflight < 1) { document.WAITTIMES_BOARD.countdownFli.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerflight;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownFli.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownFli.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownFli.value = sec + "s";
}    }
function countdownAm() 
{    tellerammo = tellerammo - 1;    if (tellerammo < 1) { document.WAITTIMES_BOARD.countdownAm.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerammo;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownAm.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownAm.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownAm.value = sec + "s";
}    }
function countdownK() 
{    tellerkill = tellerkill - 1;    if (tellerkill < 1) { document.WAITTIMES_BOARD.countdownK.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerkill;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownK.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownK.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownK.value = sec + "s";
}    }
function countdowncoke() 
{    tellercoke = tellercoke - 1;    if (tellercoke < 1) { document.WAITTIMES_BOARD.countdowncoke.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellercoke;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdowncoke.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdowncoke.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdowncoke.value = sec + "s";
}    }
function countdownP() 
{    tellerP = tellerP - 1;    if (tellerP < 1) { document.WAITTIMES_BOARD.countdownP.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerP;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownP.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownP.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownP.value = sec + "s";
}    }
function countdownRi() 
{    tellerRi = tellerRi - 1;    if (tellerRi < 1) { document.WAITTIMES_BOARD.countdownRi.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerRi;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownRi.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownRi.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownRi.value = sec + "s";
}    }
function countdownPo() 
{    tellerPo = tellerPo - 1;    if (tellerPo < 1) { document.WAITTIMES_BOARD.countdownPo.value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellerPo;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.countdownPo.value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.countdownPo.value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.countdownPo.value = sec + "s";
}    }
function countdownJunk() 
{    
    if( HOSTNAME != 'www.camorraworld.nl' ) { 
        tellerJunk = tellerJunk - 1;    if (tellerJunk < 1) { document.WAITTIMES_BOARD.countdownJunk.value = CW_JS_LANG[77]; } else 
        {
            var tijde = tellerJunk;
            var uur = parseInt(tijde / 3600);
            tijde = tijde - uur * 3600;
            var min = parseInt(tijde / 60);
            tijde = tijde - min * 60;
            var sec = tijde;
            if(uur > 0)
            document.WAITTIMES_BOARD.countdownJunk.value = uur +"h "+ min +"m "+ sec + "s";
            else if(min > 0)
            document.WAITTIMES_BOARD.countdownJunk.value = min +"m "+ sec + "s";
            else
            document.WAITTIMES_BOARD.countdownJunk.value = sec + "s";
        }
    }    
}
function StartWaitCountdowns() {
    setInterval("countdownsteel()",1000);
    setInterval("countdownauto()",1000);
    setInterval("countdownSingle()",1000);
    setInterval("countdownDuo()",1000);
    setInterval("countdownmulti()",1000);
    setInterval("countdownFli()",1000);
    setInterval("countdownAm()",1000);
    setInterval("countdownK()",1000);
    setInterval("countdowncoke()",1000);
    setInterval("countdownP()",1000);
    setInterval("countdownRi()",1000);
    setInterval("countdownPo()",1000); 
    setInterval("countdownJunk()",1000); 
}

function countdownnonvip() 
{    tellernonvip = tellernonvip - 1;    if (tellernonvip < 1) { document.WAITTIMES_BOARD.elements[0].value = CW_JS_LANG[77]; } else 
    {
        var tijde = tellernonvip;
        var uur = parseInt(tijde / 3600);
        tijde = tijde - uur * 3600;
        var min = parseInt(tijde / 60);
        tijde = tijde - min * 60;
        var sec = tijde;
        if(uur > 0)
        document.WAITTIMES_BOARD.elements[0].value = uur +"h "+ min +"m "+ sec + "s";
        else if(min > 0)
        document.WAITTIMES_BOARD.elements[0].value = min +"m "+ sec + "s";
        else
        document.WAITTIMES_BOARD.elements[0].value = sec + "s";
        
}    }
function StartWaitCountdownNonVip() {
    setInterval("countdownnonvip()",1000);
}
function CWEreverseCheckBoxes(Form, CheckBox)
{
    var objCheckBoxes = document.forms[Form].elements[CheckBox];
    var countCheckBoxes = objCheckBoxes.length;

    for(var i = 0; i < countCheckBoxes; i++)
        if (objCheckBoxes[i].checked == true) { objCheckBoxes[i].checked = false; } else {objCheckBoxes[i].checked = true; }
}
function CWEemailOpen(Vars)
{
    location.href = location.href.split("?")[0]+Vars;
}
function CWErecpAdd(Contact) {
    
    Target = document.getElementById('receivers');
    
    if( Target.value == '' ) {
        Target.value = Contact;
    } else {
        Target.value = Target.value + ', ' + Contact;
    }
}

/*-----FACEOOK FRAME CHECKER-----*/

function FBstartVipLoader() {
    /*document.getElementById('vipmenu_fb_loader').style.display = 'block';*/
}
is_on_fb = 1;

function FBCPart1() {
    if(parent.location != '') {
        is_on_fb = 0;
    }
}

function FBCPart2() {
    if(is_on_fb == 1) {
        self.location = '/user/settings.php?DoLayout=3&facebook=1';    
    }
}


function CWEcheckFBLayout() {
    setTimeout("FBCPart1()",100); 
    setTimeout("FBCPart2()",200);  
}
//END FACEOOK FRAME CHECKER  

