//Examine URL String
this.query = location.search;

//Look For Search ID		
searchID = this.query.substring(this.query.indexOf("?search=")+8);

//Parse String If & Occurs		
if (searchID.indexOf("&")!= -1) {
	searchID = this.query.substring(this.query.indexOf("?search=")+6, this.query.indexOf("&"));
}

if (searchID == "manuscripts") {
	formLine = '<form name="manuscripts_form" onsubmit="return validate(this)">';
	textLine = 'Enter the full name of the Manuscript to search below.';
	submitLine = '<a href="javascript:document.manuscripts_form.submit()" onClick="return validate(manuscripts_form)"><img src="../images/all/spacer.gif" width="115" height="30" border="0" /></a>';
	showGenDiv = 0;
}
else {
	formLine = '<form name="search_form" onsubmit="return validate(this)">';
	textLine = 'Enter the full name of the file to search below.';
	submitLine = '<a href="javascript:document.search_form.submit()" onClick="return validate(search_form)"><img src="../images/all/spacer.gif" width="115" height="30" border="0" /></a>';
	showGenDiv = 1;
}

//Form Validation
function validate(thisForm) 
{
	
	if (!thisForm.searchEntry.value.trim())
	{
		alert("A search entry is required.");
		thisForm.searchEntry.focus();	
		return false;
	}
if (showGenDiv == 0) {
//Set Manuscripts Entry Value to Lower Case	
	var manuscriptsValue = thisForm.searchEntry.value.toLowerCase();

//Set Window Location Based On Search Entry Value	
	switch (manuscriptsValue)
{
case 'rd monastery' :
	window.location = "manuscripts.shtml?item=3";
	return false;
  	break
default: 
	alert("That Manuscript was not found. Please check the spelling and try again.");
	thisForm.searchEntry.focus();	
	return false;
	break  
}	
}
	
//Set Search Entry Value to Lower Case	
	var searchValue = thisForm.searchEntry.value.toLowerCase();

//Set Window Location Based On Search Entry Value	
	switch (searchValue)
{
case 'gitelman family tree' :
	window.location = "geneology.shtml?item=5";
	return false;
  	break
case 'flying man' :
	window.location = "archive.shtml?item=1";
	return false;
  	break
case 'man vs. beast' :
	window.location = "archive.shtml?item=2";
	return false;
  	break
case 'homecoming' :
	window.location = "archive.shtml?item=3";
	return false;
  	break
case 'niki' :
	window.location = "archive.shtml?item=4";
	return false;
  	break
case 'jessica' :
	window.location = "archive.shtml?item=5";
	return false;
  	break
case 'inevitable part 1' :
	window.location = "archive.shtml?item=6";
	return false;
  	break
case 'inevitable part 2' :
	window.location = "archive.shtml?item=7";
	return false;
  	break
case 'inevitable part 3' :
	window.location = "archive.shtml?item=8";
	return false;
  	break
case 'inevitable part 4' :
	window.location = "archive.shtml?item=9";
	return false;
  	break
case 'inevitable part 5' :
	window.location = "archive.shtml?item=10";
	return false;
  	break
case 'saying goodbye' :
	window.location = "archive.shtml?item=11";
	return false;
  	break
case 'car explosion' :
	window.location = "archive.shtml?item=12";
	return false;
  	break
case 'a waitress with spunk' :
	window.location = "archive.shtml?item=13";
	return false;
  	break
case 'waitress with spunk' :
	window.location = "archive.shtml?item=13";
	return false;
  	break
case 'empty downtown street' :
	window.location = "archive.shtml?item=14";
	return false;
  	break
case 'blurry cab' :
	window.location = "archive.shtml?item=15";
	return false;
  	break
case 'crushed cab' :
	window.location = "archive.shtml?item=16";
	return false;
  	break
case 'a rooftop wish' :
	window.location = "archive.shtml?item=17";
	return false;
  	break
case 'rooftop wish' :
	window.location = "archive.shtml?item=17";
	return false;
  	break
case 'rooftop view' :
	window.location = "archive.shtml?item=18";
	return false;
  	break
case 'pigeon coop' :
	window.location = "archive.shtml?item=19";
	return false;
  	break
case 'cheerleader on staircase' :
	window.location = "archive.shtml?item=20";
	return false;
  	break
case 'a long shadow' :
	window.location = "archive.shtml?item=21";
	return false;
  	break
case 'long shadow' :
	window.location = "archive.shtml?item=21";
	return false;
  	break
case 'cheerleader reaching out' :
	window.location = "archive.shtml?item=22";
	return false;
  	break
case 'a hero in trouble' :
	window.location = "archive.shtml?item=23";
	return false;
  	break
case 'hero in trouble' :
	window.location = "archive.shtml?item=23";
	return false;
  	break
case 'godsend' :
	window.location = "archive.shtml?item=24";
	return false;
  	break						
case 'uluru' :
	window.location = "archive.shtml?item=25";
	return false;
  	break	
case 'silhouette with briefcase' :
	window.location = "archive.shtml?item=26";
	return false;
  	break		
case 'takezo kensei' :
	window.location = "archive.shtml?item=27";
	return false;
  	break	
case 'samurai sword' :
	window.location = "archive.shtml?item=27";
	return false;
  	break	
case 'tourists' :
	window.location = "archive.shtml?item=28";
	return false;
  	break	
case 'unknown man' :
	window.location = "archive.shtml?item=29";
	return false;
  	break	
case 'japanese tapestry' :
	window.location = "archive.shtml?item=30";
	return false;
  	break	
case 'tapestry' :
	window.location = "archive.shtml?item=30";
	return false;
  	break	
case 'girl on autopsy table' :
	window.location = "archive.shtml?item=31";
	return false;
  	break		
case 'the president stands alone' :
	window.location = "archive.shtml?item=32";
	return false;
  	break	
case 'president stands alone' :
	window.location = "archive.shtml?item=32";
	return false;
  	break	
case 'the mirror has two faces' :
	window.location = "archive.shtml?item=33";
	return false;
  	break	
case 'mirror has two faces' :
	window.location = "archive.shtml?item=33";
	return false;
  	break		
default: 
	alert("That file was not found. Please check the spelling and try again.");
	thisForm.searchEntry.focus();	
	return false;
	break  
}
	
	thisForm.btn_submit.disabled = true;
	return true;
}

String.prototype.trim = function()
{
	return this.replace(/^\s*|\s*$/g,'');
}
