﻿function newWindow(sPage) {
  window.name="main";
  window.open(sPage, "newWin", "height=300,width=400,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0", "");
  void(0);
  return false;
}

function newWindow2(sPage,winH,winW) {
  window.name="main";
  window.open(sPage, "newWin", "height="+winH+",width="+winW+",menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0", "");
  void(0);
  return false;
}

function openGlossary(sPage) {
	window.name="main";
	window.open("/Glossary.aspx/id="+sPage,"newWin","height=450,width=350,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0","");
	void(0);
}

function submitConnectLogin(usrname, passwd)
{
	document.connectLogin.uname.value=usrname;
	document.connectLogin.pword.value=passwd;

	document.connectLogin.submit();


}

function submitSearchForm(searchtext)
{
	if (searchtext == ''){
		window.alert("Please enter a search term.");
	}
	else
	{
		document.location="/search.aspx?searchtext=" + searchtext;
	}
}


function doPostBack(element) {
	setTimeout('__doPostBack(\'' + element.name + '\',\'\')', 500);
}

function numbersOnly(evt,element) {
	var unicode=evt.which ? evt.which : evt.keyCode;
	if (unicode!=8){ //backspace key
		if (unicode < 48 || unicode >57) 
		{ //trap the key press
			if (unicode == 13) {
				setTimeout('__doPostBack(\'' + element.name + '\',\'\')',0);
			} 
			else {
				return false;
			}
		}
	}	
	return true;
}

function closeZipBox() {
	self.parent.location.reload(true);
	
}

function changeType(element)
{
//in order to change the type in IE we have to create a new object and replace the old.
	var newElement = document.createElement('input');

	if (element.type == 'text') { 
		newElement.type = 'password'; 
	}
	else { 
		newElement.type = 'text'; 
	}	

	if (element.size) { newElement.size = element.size;}
	if (element.value){ newElement.value = element.value;}
	if (element.name) { newElement.name = element.name;}
	if (element.id) { newElement.id = element.id;}
//	if (element.onfocus) { newElement.onfocus = element.onfocus;}
//	if (element.onblur) { newelement.onblur = element.onblur;}
//	if (element.class) { newelement.class = element.class;}
	
	element.parentNode.replaceChild(newElement, element);
	return newElement;

}