// Novels JavaScript Document

var showGenDiv;

//Examine URL String
this.query = location.search;

//Look For Novel ID		
itemID = this.query.substring(this.query.indexOf("?item=")+6);

//Parse String If & Occurs		
if (itemID.indexOf("&")!= -1) {
	itemID = this.query.substring(this.query.indexOf("?item=")+6, this.query.indexOf("&"));
}

//Turn String Into Number
itemNum = Number(itemID);

//Set Max Item Value
maxItemNum = 33;

//Set Item Case Value
itemCase = maxItemNum - (itemNum - 1);

//Set Hack Div
showDiv = 0;

//Switch Content Based on Novel String Passed To Page
switch (itemCase)
{
case 33 :
	itemImg = "../images/archive/archive_photo125.jpg";
	itemText = "\"Flying Man\" - Isaac Mendez - oil on canvas";
	showDiv = 1;
  	break
case 32 :
	itemImg = "../images/archive/archive_photo126.jpg";
	itemText = "\"Man Vs. Beast\" - Isaac Mendez - oil on canvas";
  	break
case 31 :
	itemImg = "../images/archive/archive_photo127.jpg";
	itemText = "\"Homecoming\" - Isaac Mendez - oil on canvas";
  	break	
case 30 :
	itemImg = "../images/archive/archive_photo123.jpg";
	itemText = "\"Niki\" - Isaac Mendez - oil on canvas";
  	break
case 29 :
	itemImg = "../images/archive/archive_photo124.jpg";
	itemText = "\"Jessica\" - Isaac Mendez - oil on canvas";
  	break
case 28 :
	itemImg = "../images/archive/archive_photo118.jpg";
	itemText = "\"Inevitable Part 1\" - Isaac Mendez - oil on canvas";
  	break
case 27 :
	itemImg = "../images/archive/archive_photo119.jpg";
	itemText = "\"Inevitable Part 2\" - Isaac Mendez - oil on canvas";
  	break
case 26 :
	itemImg = "../images/archive/archive_photo120.jpg";
	itemText = "\"Inevitable Part 3\" - Isaac Mendez - oil on canvas";
  	break
case 25 :
	itemImg = "../images/archive/archive_photo121.jpg";
	itemText = "\"Inevitable Part 4\" - Isaac Mendez - oil on canvas";
  	break
case 24 :
	itemImg = "../images/archive/archive_photo122.jpg";
	itemText = "\"Inevitable Part 5\" - Isaac Mendez - oil on canvas";
  	break
case 23 :
	itemImg = "../images/archive/archive_photo115.jpg";
	itemText = "\"Saying Goodbye\" - Isaac Mendez - oil on canvas";
  	break
case 22 :
	itemImg = "../images/archive/archive_photo116.jpg";
	itemText = "\"Car Explosion\" - Isaac Mendez - oil on canvas";
  	break
case 21 :
	itemImg = "../images/archive/archive_photo117.jpg";
	itemText = "\"A Waitress with Spunk\" - Isaac Mendez - oil on canvas";
  	break
case 20 :
	itemImg = "../images/archive/archive_photo109.jpg";
	itemText = "\"Empty Downtown Street\" - Isaac Mendez - oil on canvas";
  	break
case 19 :
	itemImg = "../images/archive/archive_photo110.jpg";
	itemText = "\"Blurry Cab\" - Isaac Mendez - oil on canvas";
  	break
case 18 :
	itemImg = "../images/archive/archive_photo111.jpg";
	itemText = "\"Crushed Cab\" - Isaac Mendez - oil on canvas";
  	break
case 17 :
	itemImg = "../images/archive/archive_photo112.jpg";
	itemText = "\"A Rooftop Wish\" - Isaac Mendez - oil on canvas";
  	break
case 16 :
	itemImg = "../images/archive/archive_photo113.jpg";
	itemText = "\"Rooftop View\" - Isaac Mendez - oil on canvas";
  	break
case 15 :
	itemImg = "../images/archive/archive_photo114.jpg";
	itemText = "\"Pigeon Coop\" - Isaac Mendez - oil on canvas";
  	break	
case 14 :
	itemImg = "../images/archive/archive_photo105.jpg";
	itemText = "\"Cheerleader on Staircase\" - Isaac Mendez - oil on canvas";
  	break
case 13 :
	itemImg = "../images/archive/archive_photo106.jpg";
	itemText = "\"A Long Shadow\" - Isaac Mendez - watercolor on paper";
  	break
case 12 :
	itemImg = "../images/archive/archive_photo107.jpg";
	itemText = "\"Cheerleader Reaching Out\" - Isaac Mendez - acrylic on paper";
  	break
case 11 :
	itemImg = "../images/archive/archive_photo108.jpg";
	itemText = "\"A Hero in Trouble\" - Isaac Mendez - watercolor on canvas";
  	break
case 10 :
	itemImg = "../images/archive/archive_photo101.jpg";
	itemText = "\"Godsend\" - Isaac Mendez - acrylic on paper";
  	break
case 9 :
	itemImg = "../images/archive/archive_photo103.jpg";
	itemText = "\"Uluru\" - Isaac Mendez - acrylic on paper";
  	break
case 8 :
	itemImg = "../images/archive/archive_photo104.jpg";
	itemText = "\"Silhouette with Briefcase\" - Isaac Mendez - oil on canvas";
  	break
case 7 :
	itemImg = "../images/archive/archive_photo1.jpg";
	itemText = "Samurai sword allegedly owned by Takezo Kensei - leather, steel and wood with decorative markings - circa 1580";
  	break
case 6 :
	itemImg = "../images/archive/archive_photo6.jpg";
	itemText = "\"Tourists\" - Isaac Mendez - oil on canvas";
  	break
case 5 :
	itemImg = "../images/archive/archive_photo7.jpg";
	itemText = "\"Unknown Man\" - Isaac Mendez - oil on canvas";
  	break
case 4 :
	itemImg = "../images/archive/archive_photo2.jpg";
	itemText = "Japanese tapestry depicting Takezo Kensei - artist unknown - watercolor on silk, stretched over wood panel, circa 1595";
  	break
case 3 :
	itemImg = "../images/archive/archive_photo3.jpg";
	itemText = "\"Girl On Autopsy Table\" - Isaac Mendez - oil on canvas";
  	break
case 2 :
	itemImg = "../images/archive/archive_photo4.jpg";
	itemText = "\"The President Stands Alone\" - Isaac Mendez - oil on canvas";
  	break
case 1 :
	itemImg = "../images/archive/archive_photo5.jpg";
	itemText = "\"The Mirror Has Two Faces\" - Isaac Mendez - oil on canvas";
  	break
default: 
	itemImg = "../images/archive/archive_photo125.jpg";
	itemText = "\"Flying Man\" - Isaac Mendez - oil on canvas";
	itemNum = 1;
	showDiv = 1;
	break  
}

//Set NextPage Value
if (itemNum == maxItemNum) {
	nextPage = 1;
}
else {
	nextPage = (itemNum + 1);
}

//Set PreviousPage Value
if (itemNum == 1) {
	previousPage = maxItemNum;
}
else {
	previousPage = (itemNum - 1)
}

//Form Validation
function validate(thisForm) 
{
	
	if (!thisForm.searchEntry.value.trim())
	{
		alert("A search entry is required.");
		thisForm.searchEntry.focus();	
		return false;
	}
	
//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,'');
}

