I cannot perform any testing right now, but perhaps this can help.
Running the script through a beautifier (to make it easier to read) gives us
function PopupCenter(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
function dimension_test() {
var width = screen.width;
var res = (((!(640 - width)) * 1) + ((!(800 - width)) * 2) + ((!(1024 - width)) * 3) + ((!(1152 - width)) * 4) + ((!(1280 - width)) * 5) + ((!(1600 - width)) * 6));
if (!(res)) {
res = 1;
}
if (res == '1') {
PopupCenter('http://www.meta.projectmio.com/640.html', 'MyWindow', 640, 411);
}
if (res == '2') {
PopupCenter('http://www.meta.projectmio.com/800.html', 'MyWindow', 800, 531);
}
if (res == '3') {
window.location = 'http://www.1024+.com/1024_768.html';
}
if (res != '1' && res != '2' && res != '3') {
PopupCenter('http://www.meta.projectmio.com/800.html', 'MyWindow', 800, 531);
}
}
Then, using jslint.com to help remove issues, I have refactored the script to the following:
function popupCenter(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
window.open(pageURL, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + w + ',height=' + h + ',top=' + top + ',left=' + left);
}
function dimension_test() {
var width = screen.width;
switch (width) {
case 1024:
window.location = 'http://www.1024+.com/1024_768.html';
break;
case 1152:
// fall through
case 800:
popupCenter('http://www.meta.projectmio.com/800.html', 'MyWindow', 800, 531);
break;
default:
popupCenter('http://www.meta.projectmio.com/640.html', 'MyWindow', 640, 411);
break;
}
}