// JavaScript Document
function openHelp (topic) {
	window.open("/help.php?topic=" + topic, "", "width=500,height=350,top=50,left=100,screeny=50,screenx=100,scrollbars=yes,toolbar=no,location=no,status=no,directories=no");
}

function checkSearch (formy) {
	if (formy.q.value.length<3 || formy.q.value=="Search PTS") {
		alert("Please enter a search term");
		return false;
	}
}

function hideFlash (way) {
	if (document.all) {
		if (way) document.all["flashContainer"].visibility = "hidden";
		else document.all["flashContainer"].visibility = "visible";
	}
	else {
		if (way) document.getElementById("flashContainer").visibility = "hidden";
		else document.getElementById("flashContainer").visibility = "visible";
	}
}

var menuStore = "";
var timer = false;
function menuDrop (menu, dir) {
	if (!menu) menu = menuStore;
	if (document.all) {
		if (dir) {
			if (menuStore) menuUp();
			document.all[menu].style.display = "block";
		}
		else timer = setTimeout("menuUp()", 600);
		menuStore = menu;
	}
}

function menuUp () {
	if (menuStore) document.all[menuStore].style.display = "none";
	menuHold();
}

function menuHold () {
	if (timer) clearTimeout(timer);
}


// Creates a popup window.
var windough=null;
function NewWindow(mypage, myname, w, h, scroll, pos, menubar, toolbar, location) {
   // EXAMPLE CALL: <a href="notes.php?num=3" onclick="NewWindow(this.href, 'captionPopup', '660', '200', 'yes', '0'); return false" onfocus="this.blur()">
   if(pos=="random"){      LeftPosition=(screen.availWidth)?Math.floor(Math.random()*(screen.availWidth-w)):0;TopPosition=(screen.availHeight)?Math.floor(Math.random()*((screen.availHeight-h)-75)):20;
   }
   if(pos=="center"){
      LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:0;TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:20;
   }
   if(pos=="default"){
      LeftPosition=0;
      TopPosition=68
   }else if((pos!="center" && pos!="random" && pos!="default") || pos==null){
      LeftPosition=0;
      TopPosition=20
   }

   if (!h)
   	h = (screen.availHeight - TopPosition - 122).toString();
   if (!w)
   	w = (screen.availWidth - 50).toString();

   if (!menubar)
   	menubar = 'no';
   if (!location)
   	location = 'yes';
   if (!toolbar)
   	toolbar = 'no';

   settings = 'width=' + w + ', height=' + h + ', top=' + TopPosition + ', left=' + LeftPosition + ', scrollbars=' + scroll + ', location=' + location + ', directories=no, status=no, menubar=' + menubar + ', toolbar=' + toolbar + ', resizable=yes';
   windough=window.open(mypage, myname, settings);
   if(windough.focus){
      windough.focus();
   }
}
