var popAddress = '';
var popWidth = '';
var popHeight = '';
var popScrollbars = 'yes';
var popResizable = 'yes';


function popMaster(name,type,queryString) {

    if (type == 'default') {
    
        if (name == 'arsCategories') {
            popAddress = 'categories.html';
            popWidth = '525';
            popHeight = '475';
        }    
        
        if (name == 'arsText') {
            popAddress = 'tips.html';
            popWidth = '525';
            popHeight = '325';
        }    
    }
    
    //window.open(popAddress,name,'toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+popWidth+',height='+popHeight);
    if (typeof queryString != 'undefined') {
        popAddress += "?" + queryString;
    }
    window.open(popAddress,name,'toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars='+popScrollbars+',resizable='+popResizable+',width='+popWidth+',height='+popHeight);
}

function popWindow(address,name,scroll,resize,width,height) { 
       var detWindow="" 
       //set defaults for width and height
       width = (width=="")?'1026':width;
       height = (height=="")?'880':height;
       detWindow=window.open(address,name,'toolbar=no,location=0,directories=no,status=no,menubar=0,scrollbars=' + scroll + ',resizable=' + resize +',width=' + width + ',height=' +height);
}


/*  Exit Popup
    ---------- */
var boardsLink = false;
var noPopFlag = false;
var monitorPage = "/scripts/exitPopMonitor.html";
function goToBoards() {
    boardsLink = true;
    return;
}
// Google|Partner safe - no popup if pathname includes "partner"
var partnerURIpath = location.pathname;
var partnerURI = partnerURIpath.indexOf("partner");
var allcookies = document.cookie;
var stopFlag = allcookies.indexOf("exitpop=");
function exitPopTerror() { if (boardsLink != true) launchMonitor(); }
if (stopFlag == -1 && partnerURI == -1){  
    if( getAgent() == 'mac_safari'){
        window.onbeforeunload = exitPopTerror;
    }else{
        window.onunload = exitPopTerror;
    }
}
function launchMonitor(){
    if (!noPopFlag){
        var ext = "";
        var width = 1;
        var height = 1;
        ext = window.open(monitorPage,"ext","toolbar=no,menubar=no,status=no,directories=no,location=no,scrollbars=no,resizable=no,width=" + width +",height=" + height + ",left=10000,top=10000,screenX=10000,screenY=10000");
        self.focus(); 
    }
}
function condenet_noPop(value){ noPopFlag = value; }
/*end Exit Popup*/