function popup(url, title, width, height, scroll) {
	var s = 'menubar=no,toolbar=no,location=no,resizable=yes,status=yes'
	s += ',scrollbars=' + scroll
	s += ',width=' + width + ',height=' + height;
	s += ',top=' + (screen.availHeight - height) / 2 + ',left=' + (screen.availWidth - width) / 2;

	//close existing window
	if (navigator.newwindow) navigator.newwindow.close();
	
	//save new window object in navigator object and activate
	navigator.newwindow = self.open(url, title, s);
	navigator.newwindow.focus();
	
	return false;
}

function popupLogoInfo() {
	return popup('', 'LogoInfo', 400, 300, 'yes')
}

function popupImage(nType, nSubType) {
	var a;
	switch(nType) {
	case 1:  a = [600, 264]; break; //Layout
	case 2:  a = [600, 440]; break; //Map
	case 30: a = [360, 574]; break; //Photo - portrait
	case 31: a = [600, 434]; break; //Photo - landscape
	case 4:  a = [350, 440]; break; //Weather chart
	}
	return popup('', 'Image', a[0], a[1], 'no')
}

function CloseWindow() {
	window.close();
	if (window.opener)
		if (!window.opener.closed)
			window.opener.focus();
}

function addPopupEvents() {
	document.onkeydown = KeyDown;
}

function KeyDown(e) {
	if (e && e.which == 27) CloseWindow(); //Netscape
	else if (event && event.keyCode == 27) CloseWindow(); //IE
}


function addBookmark(title,url) {
if (window.sidebar) 
{
	window.sidebar.addPanel(title, url,"");
} 
else if( document.all ) 
{
	window.external.AddFavorite( url, title);
} 
else if( window.opera && window.print ) 
{
	return true;
}
}
