/* (c)2000-2006 NordicBots */
var nb_unload_confirm = false;

var nb_config = new Array();
nb_config['keepAlive_Enabled'] = false;
nb_config['keepAlive_ID'] = "keepAlive";
nb_config['keepAlive_URL'] = "keepalive.php?";
nb_config['keepAlive_Randomize'] = true;
nb_config['keepAlive_Interval'] = 120;

function showmsg() {
	window.open( "newpm.php", "Message", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,width=200,height=140,top=80,left=80");
}

window.defaultStatus = '#NordicBots - A QuakeNet IRC Service'

function PopWin(url,h,w) { 
	 popupWin = window.open(url, 'source', 'scrollbars,height=' + h + ',width=' + w + ',top=50,left=50') 
} 

function BigPicture(d) {
	url = "gallery.php?no_check=1&big=";
	if (navigator.appName == "Netscape") {
		screenres = screen.outerwidth
	} else if (navigator.appName == "Microsoft Internet Explorer") {
		screenres = screen.width
	} else {
		screenres = 800;
	}
	switch (screenres) {
		case 640:
			window.open(url + d, "gallery", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=632,height=420,top=0,left=0");
		break;
		case 800:
			window.open(url + d, "gallery", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=792,height=540,top=0,left=0");
		break;
		case 1024:
			window.open(url + d, "gallery", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=1016,height=710,top=0,left=0");
		break;
		default:
			window.open(url + d, "gallery", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=792,height=540,top=0,left=0");
		break;
	}
}
function MyFile(file) {
	addform.location.value = file;
}
function MyFileName(file) {
	addform.filename.value = file;
}
function MyFilePath(file) {
	addform.location.value = file;
}

function nb_init() {
	if (nb_config['keepAlive_Enabled'])	{
		document.write('<iframe height="1" width="1" style="visibility: hidden; display: none" src="" id="' + nb_config['keepAlive_ID'] + '">Your browser doesn\'t support IFRAME</iframe>');
		nb_keepAlive();
	}

	if (nb_config['unload_askSave'] == true)
	{
		  nb_unload_confirm = true;
		  window.onbeforeunload = nb_unload;
	}
}

function nb_unload() {
	if (nb_unload_confirm) {
		return "Any changes you have made have not been saved yet.\nIf you proceed, all your changes will be lost.";
	}
}

function nb_keepAlive() {
	obj = document.getElementById(nb_config['keepAlive_ID']);
	if (nb_config['keepAlive_Enabled'] && !obj) return;
	url = nb_config['keepAlive_URL'];
	if (nb_config['keepAlive_Randomize']) { url += nb_random(9999); }
	obj.src = url;
	interval = (nb_config['keepAlive_Interval'] * 1000);
	setTimeout("nb_keepAlive()", interval);
}

function nb_random(max) {
	return Math.round(Math.random() * max);
}