﻿var popUpWin = null;
function MM_openBrWindow(theURL, winName, features) {
    //    window.open(theURL, winName, features);
    if (typeof (popupWin) != "object") {
        popupWin = window.open(theURL, winName, features);
    } else {
        if (!popupWin.closed) {
            popupWin.location.href = theURL;
        } else {
            popupWin = window.open(theURL, winName, features);
        }
    }
    popupWin.focus();
}
function windowOpener(url, name, args) {
    if (typeof (popupWin) != "object") {
        popupWin = window.open(url, name, args);
    } else {
        if (!popupWin.closed) {
            popupWin.location.href = url;
        } else {
            popupWin = window.open(url, name, args);
        }
    }
    popupWin.focus();
}





function wopen(url, name, w, h) {
    if (popUpWin) {
        if (!popUpWin.closed) popUpWin.close();
    }
   
    wleft = (screen.width - w) / 2; wtop = (screen.height - h) / 2; if (wleft < 0) { w = screen.width; wleft = 0; }
    if (wtop < 0) { h = screen.height; wtop = 0; }
    popUpWin = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=no');
//    popUpWin.resizeTo(w, h);
//    popUpWin.moveTo(wleft, wtop);
    //popUpWin.focus();
}
function popUpWindow(URLStr, left, top, width, height) {
    if (popUpWin) {
        if (!popUpWin.closed) popUpWin.close();
    }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
}

//MM_openBrWindow('http://www.magramcs.com/RateCalc_BLANK.aspx?mcscustno=314','TitleInsuranceCalculator','scrollbars=yes,width=650,height=500')
