function ClearPromptText(Textbox)
{										/*	clear text and undefine itself to avoid erasing user entry */
  Textbox.value = '';
  Textbox.onfocus = null;
}

function goToURLFirstBlank(form) {	
/*	dereference URL specified by 'selected' element in specified form */
    var myindex=form.dropdownmenu.selectedIndex;
	
    if(!myindex=="")
        window.location.href=form.dropdownmenu.options[myindex].value;
}

function goToURL(form)
{										/*	dereference URL specified by 'selected' element in specified form */
    var myindex=form.dropdownmenu.selectedIndex;
	
    window.location.href=form.dropdownmenu.options[myindex].value;
}

function insertAtCursor(myField, myValue)
{
	if (document.selection)
	{									/*	text selected in Internet Explorer						*/
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	else if (myField.selectionStart || myField.selectionStart == '0')
	{									/*	text selected in Mozilla or Netscape					*/
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		
		myField.value = myField.value.substring(0, startPos)+ myValue
			+ myField.value.substring(endPos, myField.value.length);
	}
	else								/*	no text selected - append								*/
		myField.value += myValue;
}

function SetPromptText(ID, Text)
{										/*	set value of textbox 'ID' to 'text' (if empty), clear text on first focus */
  var Textbox = document.getElementById(ID);

  if (Textbox.value == '')
    Textbox.value = Text;

  else if (Textbox.value != Text)
    return;

  Textbox.onfocus = function() { ClearPromptText(Textbox) };
}

function toggleFilter()
{
	var		aClearFilter=document.getElementById("clearFilter");
	var		aPageLink=document.getElementsByName("pageLink");
	var		aSortLink=document.getElementsByName("sortLink");
	var		divFilter=document.getElementById("filters");
	var		iSearch=document.getElementsByName("showSearch");
	var		intPos,strShow,strText,strVal;
	
	if (divFilter.style.display!="block")
	{									/*	currently hidden, show									*/
		divFilter.style.display="block";
		strShow="true"
		strText="Hide";
	}
	else
	{									/*	currently shown, hide									*/
		divFilter.style.display="none";
		strShow="false"
		strText="Show";
	}
	
	document.getElementById("toggle").innerHTML=strText+" Filter"; /* update anchor text			*/
	
	if (aClearFilter!=undefined)
	{									/*	'Clear Filter' only exists if a filter is active		*/
										/*	get 'Clear Filter' string without showSearch value		*/
		strVal=aClearFilter.href.substr(0,aClearFilter.href.indexOf("?showSearch=")+12);
	
		aClearFilter.href=strVal+strShow; /* update 'Clear Filter' string							*/
	}
	
	for ( i=0 ; i<aPageLink.length ; i++ )
	{									/*	update all visible 'previous' and 'next' links			*/
		strVal=aPageLink[i].href.substr(0,aPageLink[i].href.indexOf("&showSearch=")+12);
		
		aPageLink[i].href=strVal+strShow; /* update link href										*/
	}
	
	for ( i=0 ; i<aSortLink.length ; i++ )
	{									/*	update all visible sort links			*/
		strVal=aSortLink[i].href.substr(0,aSortLink[i].href.indexOf("&showSearch=")+12);
		
		aSortLink[i].href=strVal+strShow; /* update link href										*/
	}

	for ( i=0 ; i<iSearch.length ; i++ )
	{									/*	update hidden input field for 'jump to page'			*/
		if (iSearch[i].parentNode.parentNode.name=="navigation") /* correct input field			*/
			iSearch[i].value=strShow;	/*	update field value										*/
	}
}

function updateMD5() {
	var str = document.getElementById("password").value.replace(/(^\s*|\s*$)/, "");
	var target = document.getElementById("md5");
	if (str == "") {
		target.value = "";
	} else {
		target.value = hex_md5(str);
		// target.select();
	}
}

function getCookie(c_name) {
// get value of a cookie
	if (document.cookie.length>0) {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1) {
		c_start=c_start + c_name.length+1;
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
	  }
	}
return "";
}

function checkMyFilter() {
// document.write(getCookie('myFilters'));
// set filter to hidden if cookie dictates
	if (getCookie('myFilters') == "FALSE") {
		document.rd
		getElementById("filters").style.display="none"; /* hide filter block */
		document.getElementById("toggle").innerHTML="Show Filter"; /* update anchor text			*/
	}
}

/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
		
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("helpbox")){
dropmenuobj=document.getElementById("helpbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhelpbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "helpbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhelpbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhelpbox)
else if (document.getElementById)
window.onload=createhelpbox
