//opens a new window just above centre of screen
function newWindow(mypage, myname, w, h, scrol) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2.5;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrol+',resizable';
win = window.open(mypage, myname, winprops);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//opens a new page in the browser
//function open_new_window(url) {
//    var NewWindow=window.open(url);
//}

function open_new_window(url) {
	config='width=775,height=550,top=20,left=20,screenx=20,screeny=20,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes,status=yes';
    NewWindow=window.open(url,'newpage',config);
}

//opens a popup window at position 30x, 30y
var popup = '';
function showpopup(page,w,h,scrol) {
    winprops='width='+w+',height='+h+',top=30,left=30,screenx=30,screeny=30,scrollbars='+scrol+',resizable';
    msgWindow=window.open(page,'windowname',winprops);
    msgWindow.document.close();
}

//closes the popup window
function closepopup() {
    if (!msgWindow.closed)
        msgWindow.close();
}

//brings popup to front if focus is lost
var timer = '';
function blurred() {
    timer = setTimeout('self.focus()',500);
}

//clears the timer
function focused() {
    if (timer != '')
        clearTimeout(timer);
}

//preloads images for rollovers etc
function preloadImages() {
var d=document; if(d.images) {if (!d.p) d.p=new Array();
var i,j=d.p.length,a=preloadImages.arguments;
for(i=0; i<a.length; i++)
if(a[i].indexOf('#')!=0) { d.p[j]=new Image; d.p[j++].src=a[i]; }}
}
