/*
doSearchValidation()
inputs: frmSearch.txtSearch, string
outputs: strError, alert

description:
uses an image input element to pass the value
of the search field.

note:
I'm only validating for an empty search field. This 
function should up updated or replaced with a more 
robust validation algorithm.
*/
function doSearchValidation(){
	var strError = "";
		if(document.frmSearch.txtSearch.value == ""){
			strError += "Please enter a seach string\n";
		}
	
	if(strError == ""){
		document.frmSearch.Submit();
	}else{
		alert(strError);
	}
	
}

function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;

}

//<a href="javascript:openWin('/Projects/9802/Build/v28/pem/help.asp?id=2', 'winGame', '450', '300');"></a>
function openWin(strLocation, windowName, width, height) {
  myRemote = launch(strLocation, windowName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,alwaysRaised=yes,width=" + width + ",height=" + height + ",left=25,top=25","parentWin");
}
function openWinWithToolbar(strLocation, windowName, width, height) {
  myRemote = launch(strLocation, windowName,"toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,alwaysRaised=yes,width=" + width + ",height=" + height + ",left=25,top=25","parentWin");
}

function poppic(img)
{
	var image = img;
	openWin('../poppic.htm?img=' + image, 'winBio', '403', '277')
}



function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function displayItem(key){
	if(queryString(key)=='false') 
	{
	document.write("you didn't enter a ?name=value querystring item.");
	}else{
		return queryString(key);
	}
}

/*
<body onload="displayItem('name');">


<input type="text" name="txtName" id="txtName">Name<br> 
<input type="text" name="txtEmail" id="txtEmail">Email<BR> 
<input type="button" value="Submit" onclick="getURL(txtName.value, txtEmail.value);">
<script>
function getURL(sName, sEmail){
window.location ="http://www.eggheadcafe.com/articles/querystringjs.htm?name="+sName+"&email="+sEmail;
}
</script>
*/