//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=")+8, this.query.indexOf("&"));
}

if (searchID == "cart") {
	formLine = '<form name="art_form" onsubmit="return validate(this)">';
	textLine = 'Enter the full name of the Contemporary Art piece to search below.';
	submitLine = '<a href="javascript:document.art_form.submit()" onClick="return validate(art_form)"><img src="../images/all/spacer.gif" width="115" height="30" border="0" /></a>';
	showGenDiv = 0;
}
else {
	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 = 1;
}

//Form Validation
function validate(thisForm) 
{
	
	if (!thisForm.searchEntry.value.trim())
	{
		alert("A search entry is required.");
		thisForm.searchEntry.focus();	
		return false;
	}
if (showGenDiv == 1) {
//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 Contemporary Art Entry Value to Lower Case	
	var cArtValue = thisForm.searchEntry.value.toLowerCase();

//Set Window Location Based On Search Entry Value	
	switch (cArtValue)
{
case 'sa diaspora' :
	window.location = "cArt.shtml?item=1";
	return false;
  	break
default: 
	alert("That Contemporary Art piece 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,'');
}