function Dimension(wnd) { this.window = new Object; this.desktop = new Object; if(!wnd) { //alert("no window object!"); wnd = window; } if(wnd.innerWidth && parseInt(wnd.innerWidth) > 0) { this.window.w = parseInt(wnd.innerWidth); this.window.h = parseInt(wnd.innerHeight); } else if(wnd.document.body.offsetWidth && parseInt(wnd.document.body.offsetWidth) > 0) { this.window.w = parseInt(wnd.document.body.offsetWidth); this.window.h = parseInt(wnd.document.body.offsetHeight); } else { this.w = 0; this.h = 0; } if(wnd.screenX != undefined && parseInt(wnd.screenX) != 'NaN') { this.cancenter = 1 this.window.x = wnd.screenX; this.window.y = wnd.screenY; } else { this.cancenter = 0 this.window.x = 0; this.window.y = 0; } if(screen && parseInt(screen.availWidth) > 0) { this.desktop.w = parseInt(screen.availWidth); this.desktop.h = parseInt(screen.availHeight); } else { this.desktop.w = 0; this.desktop.h = 0; } if(screen && screen.availLeft) { this.desktop.x = parseInt(screen.availLeft); this.desktop.y = parseInt(screen.availTop); } else { this.desktop.x = 0; this.desktop.y = 0; } } function myErrorHandler(errorMessage,url,line) { return true; } function openWindow(urlstr,name,width,height) { var dim = new Dimension; if(dim.cancenter && dim.window.w >= width && dim.window.h >= height) { x = parseInt(dim.window.x + (dim.window.w/2 - width/2)); y = parseInt(dim.window.y + (dim.window.h/2 - height/2)); } else if(dim.desktop.w > 0) { x = parseInt(((dim.desktop.w/2) - (width/2)) + dim.desktop.x); y = parseInt(((dim.desktop.h/2) - (height/2)) + dim.desktop.y); } //alert('y: ' + y + '\nx: ' + x + '\nwindow.w: ' + dim.window.w + '\nwindow.h:' + dim.window.h + '\nwindow.x:' + dim.window.x + '\nwindow.y: ' + dim.window.y + '\nscreen.w: ' + dim.desktop.w + '\nscreen.h:' + dim.desktop.h + '\nscreen.x:' + dim.desktop.x + '\nscreen.y: ' + dim.desktop.y) bwindow = window.open(urlstr, 'Basket', "width="+width+",height="+height+",top=" + y + ",left=" + x + ",toolbar=0,menubar=0,dependant=1,scrollbars=1,resizable=1"); onerror = myErrorHandler; if(window.focus) { bwindow.focus(); } } function openWindowNoScroll(urlstr,name,width,height) { var dim = new Dimension; if(dim.cancenter && dim.window.w >= width && dim.window.h >= height) { x = parseInt(dim.window.x + (dim.window.w/2 - width/2)); y = parseInt(dim.window.y + (dim.window.h/2 - height/2)); } else if(dim.desktop.w > 0) { x = parseInt(((dim.desktop.w/2) - (width/2)) + dim.desktop.x); y = parseInt(((dim.desktop.h/2) - (height/2)) + dim.desktop.y); } //alert('y: ' + y + '\nx: ' + x + '\nwindow.w: ' + dim.window.w + '\nwindow.h:' + dim.window.h + '\nwindow.x:' + dim.window.x + '\nwindow.y: ' + dim.window.y + '\nscreen.w: ' + dim.desktop.w + '\nscreen.h:' + dim.desktop.h + '\nscreen.x:' + dim.desktop.x + '\nscreen.y: ' + dim.desktop.y) bwindow = window.open(urlstr, 'Basket', "width="+width+",height="+height+",top=" + y + ",left=" + x + ",toolbar=0,menubar=0,dependant=1,scrollbars=0,resizable=0"); onerror = myErrorHandler; if(window.focus) { bwindow.focus(); } } /* function getSelection(cb,width,height, filter) { if(filter) { url = "http://www.aaks.no/Eydehavn/selector?selector_filter=" + escape(filter) + "&cb=" +cb; } else { url = "http://www.aaks.no/Eydehavn/selector?cb=" + cb; } openWindow(url, 'selector', width, height); } */