onerror = function(msg,url,line) { top.document.title = "Error: L#" + line + ": " + msg; return true; }
timerDelay=5000; //number of miliseconds between slides
autoStartSlideShow = 0;
useSlideTransition = 1; //set javascript var from PHP var to allow/prevent transitions
slideShowTitle = 'Brandywine Land - Approximately 4.5 Acres';  //used to display on first slide, and all slides if persiatent
slideShowTitlePersistant = 'y'; //used to preserve title across all slides in place of filenames or other captions 
maxImageHeight = 0;  //used by setImageSize() to limit slide height
 
//Initialize JavaScript Globals
slideShowRunningFlag = 0;  //used by slideTimer(), mainImageOnLoadItems(), updated by bodyOnLoadItems()
firstLoadFlag = 1;  //used by setImageCaption() to apply slide-show title in place of other caption
positionInArray = 0; //initialize var that determines the 'active' thumbnail. Updated by updateThumbnailInfo() after main image loads  
thumbnailCount = 1; //initialize count var. Updated by updateThumbnailInfo
thumbnails = 0;  //initialize var to hold array of images in thumbnail table
pausedFlag=0; //used to track if slide-show is paused by clicking on fact sheet button

function mainImageOnLoadItems(){ 
	
}

function bodyOnLoadItems(){  //this function handles the first load to make sure entire page is loaded before timer starts. Subsequent timers are started by mainImageLoadItems()
	if(firstLoadFlag == 1){ //
		//updateThumbnailInfo(); //update thumbnails position in array for setCaptions()
		//setImageCaption();
		//createMenuCategoryArrays();  //build array of all tour menus
		//createImageCategoryArrays();  //build array of div image arrays
		//createMenuContentArrays(); //build array of other content 
		//createFactSheetCategoryArrays() //build array of all factsheet sections
		//createFactSheetMenuCategoryArrays() //build array all factsheet menus
		parent.I1.focus();
		

		
		
		}
	if(autoStartSlideShow){
		toggleStartStopButton();  //update startStopButton labels
		slideShowRunningFlag = 1;
		autoStartSlideShow = 0;  //clear autoStart flag after first image load and rely on slide show running flag
		slideTimer();
		}
	
	revealHiddenItemsOnLoad(); //menu table and fact sheet hidden by style and displayed after document load to prevent premature clicking
	
	//if(targetPhoto != 'no') selectByNumber(targetPhoto);
	//if(autoplayOverride!= 'no') toggleStartStopButton();
	document.getElementById('factsheetdiv').style.filter="alpha(opacity=75)";
		
}

function toggleStartStopButton(caller){
	if(slideShowRunningFlag==0){  //if slide-show stopped
		document.all["startStopButton"].value = "    Click to Pause    ";  //update button labels
		nextButton.style.visibility="visible";
		backButton.style.visibility="visible";
		delay=timerDelay; //reset timer to default
	
		if(caller == 'startStopButton') {
			getNextPhoto(1); //immediately advance to next slide if show started by clicking startStopButton, but not if autoplay
			slideShowRunningFlag=1;  //then set the running flag to on
			}
		if(pausedFlag==1) {
			getNextPhoto(1); ////if slide-show stopped by clicking fact sheet button
			slideShowRunningFlag=1;  //then set the running flag to on
			pausedFlag=0;
			}
			
			
				
		}
	else {  //if slide-show already running
		slideShowRunningFlag=0;
		window.clearTimeout(slideTimerID); //cancel any running slide timers so pending slide change does not happen
		document.all["startStopButton"].value = "Click to Autoplay";
		nextButton.style.visibility="hidden";
		backButton.style.visibility="hidden";
	}
}

function slideTimer(){
		if(slideShowRunningFlag==1){
			window.clearTimeout(slideTimerID); //cancel any running slide timers - important if you click on thumbnail while slide-show running
			slideTimerID = window.setTimeout("getNextPhoto(1);", delay);
		}
}

function fadeIn(objId,opacity) {  //The fadeIn function is called by the main image's load event and uses a Timeout function to call itself every 'X' miliseconds with an object Id and an opacity. The opacity is specified as a percentage and increased 10% at a time. The loop stops once the opacity reaches 100%:
      document.pic.style.visibility = 'visible';
      if (opacity >= 99) {document.pic.style.filter='';} //clear filter after transition to remove distortion it creates/reveals in some images
      if (opacity <= 100) {
      setOpacity(document.pic, opacity);
      if(opacity > 0) opacity = opacity*1.222846;
      	else opacity += 20;
      fadeInTimerID = 0;
      var fadeInTimerID = window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 40);
    	}
	  if(slideShowRunningFlag) slideTimer(); //start timer once transition is complete
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  //obj.style.filter='progid:DXImageTransform.Microsoft.BasicImage(opacity="+opacity+")'; //try later
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function updateThumbnailInfo(){  //determines position of thumbnail coresponding to current main image and sets borders accordingly. Also sets positionInArray and thumbnailCount 
	
	if(thumbnails=thumbnailCell.getElementsByTagName("img")){  // Make sure thumbnail table download completed before relying on it to get size. Just playing it safe with this conditional
	 	thumbnailCount = thumbnails.length ; //count all thumbnail table images. If not downloaded yet, use defaults set in declarations
	 	//alert(thumbnailCount);
	 }
	currentThumbnailFileName = document.pic.src.replace('images', 'thumbnails')  //gets name of thumbnail version of current main photo
		for ( var i = 0; i < thumbnailCount; i++) {  //find current thumbnail's index in images array
			if (currentThumbnailFileName == thumbnails[i].src){
					positionInArray = i;
			}
	}
	for ( var i = 0; i < thumbnailCount; i++) {  //set all thumbnail borders to standard color to clear out any that have distinctive border color
		thumbnails[i].style.borderColor='#555555';	}
		
	thumbnails[positionInArray].style.borderColor='#ff0000';  //add distinctive border to current thumbnail
	preloadNextImage(positionInArray)
}

function selectPhoto(source)	{  //triggered by clicking on thumbnail image which sends its name as argument to this function
	document.pic.style.visibility = 'hidden';  //hide current photo
	document.pic.src=source.replace('thumbnails', 'images') ;  // sets main image equal to full-sized version of clicked thumbnail
	setImageSize(); //needed only in html version. Size update automatically in PHP
}

function selectByNumber(e)	{  //triggered by typing photo file number
		if(e=='Enter pic #'){
			alert("Please enter four-digit image number");
			}
			
		else {
			imageToFind=e + '.jpg';
			if(jsimagesarray[imageToFind]){  //associative array elements accessed directly - no looping needed
				document.pic.style.visibility = 'hidden';  //hide current photo
				document.pic.src='images/' + e +'.jpg';
				setImageSize();
				}
			else alert("Photo not found.")
		}
		
		typeImageNumber.value='Enter pic #'; 
		typeImageNumber.blur();
}

function getNextPhoto(direction) {	//called by clicking next or back buttons - if included, or on main photo itself which serves as next button. To add back button call this script with an argument of -1
	

	nextPhotoIndex = positionInArray + direction; //sets images array index of next photos thumbnail
	if(direction == 1 && positionInArray == thumbnailCount-1){nextPhotoIndex = 0};  //override nextPhotoIndex if end of list and direction is next
	if(direction == -1 && positionInArray == 0){nextPhotoIndex = thumbnailCount-1};	//override nextPhotoIndex if end of list and direction is back
	nextPhotoThumbnail = thumbnails[nextPhotoIndex].src  //gets full path name of next image's thumbnail
	document.pic.style.visibility = 'hidden'; //hide image to avoid strange transition. Visibility restored by image's OnLoadItems()
	document.pic.src=nextPhotoThumbnail.replace('thumbnails', 'images') ;  //set full sized image to full sized version of next images thumbnail
	setImageSize(); //needed only in html version. Size update automatically in PHP
}


function setImageSize(){  //called by selectPhoto() and getNextPhoto()
	source=document.pic.src;  //determine current image filename
			
	currentThumbnailFileName = source.replace('images', 'thumbnails') ;  //replace image folder with thumbnail folder name to get full pathname of current thumbnail
	
	startSplit=source.lastIndexOf("/") ;  //get location of the last slash in path of new main image
	endSplit=source.lastIndexOf(".") ;	//get location of the last dot preceeding file extension
	imageToLookup = source.substring(startSplit+1,endSplit+4); //extracts file name from full path to look up dimensions in js array
	//alert(imageToLookup);
	newDimensions=jsimagesarray[imageToLookup];  //finds current main image src in jsimagesarray and gets dimensions string
	
	startSplit=newDimensions.lastIndexOf("width") ;  //parse dimensions string for width
	endSplit=newDimensions.lastIndexOf("height") ; //find 'height' and back up	
	newWidth = newDimensions.substring(startSplit+7,endSplit-2); 
		
	startSplit=newDimensions.lastIndexOf("=") ;  //parse dimensions string for height
	endSplit=newDimensions.length ;	
	newHeight = newDimensions.substring(startSplit+2,endSplit-1);
	
	if(maxImageHeight > 0 && newHeight > maxImageHeight) {
		 newWidth = maxImageHeight/newHeight * newWidth;
		 newHeight = maxImageHeight;
		 }
		
	document.pic.width=newWidth; //apply dimensions of current jpg to documents main image
	document.pic.height=newHeight;
	
	//preloadNextImage();
	//preloadAllImages();
}

function preloadNextImage(positionInArray){ //called by updateThumbnailInfo, which passes positionInArray of current thumbnail
	nextPosition = positionInArray + 1; //sets images array index of next photo's thumbnail
	if(nextPosition > thumbnailCount-1){return;}  //return if end of list
	else {
		nextThumbnail = thumbnails[nextPosition].src;
		nextImage = nextThumbnail.replace('thumbnails', 'images')  //gets name of full-sized version of next thumbnail
 		var imageToPreload = "image" + 	nextPosition ; //create unique name
		imageToPreload = new Image();
		imageToPreload.src = nextImage;
		}
}


function setImageCaption(){
	source=document.pic.src;  //determine current image filename
	startSplit=source.lastIndexOf("/") ;  //get location of the last slash in path of current image
	endSplit=source.lastIndexOf(".") ;	//get location of the last dot preceeding file extension
	imageCaptionText = source.substring(endSplit-4,endSplit); //extracts short file name from full path to use as caption text
	imageCaptionText=imageCaptionText.replace('_', ' ');	//replace underscores with spaces
	
	if (thumbnails[positionInArray].name != 'EnterCaptionHere'){ //override caption text if a custom thumbnail caption has been added in place of the thumbnail's HTML default of 'EnterCaptionHere'
		imageCaptionText = thumbnails[positionInArray].name;
		}
		
	if(firstLoadFlag){
		firstLoadFlag=0; //clear flag that otherwise causes mainImageOnLoadItems() to use slide title in place of normal caption on first slide
		if(slideShowTitle) imageCaptionText = slideShowTitle ; // Override caption text with slide-show title/welcome text if welcome text exists and this is initial page load.
		}
	if(slideShowTitle && slideShowTitlePersistant == 'y') imageCaptionText = slideShowTitle ; // Override caption text with slide-show title/welcome text for all slides
	document.all["captionText"].innerHTML = imageCaptionText ;  //set caption equal to file name or custom caption if found in thumbnail name tag - use innerHTML instead of innerText for compatabilty with firefox
}	 	


toggleSpanTimedTimerID = 0;

function toggleSpanTimed(e){			//displays/hides span
	if (e.style.display == "none"){
		e.style.display = "";
		toggleSpanTimedTimerID = window.setTimeout("navigationTextMessage.style.display = 'none'", 7000);
	}
	else{
		e.style.display = "none";
	}
}

	
function checkKeycode(e) { //attached to body - onkeydown in myrules below
	if (!e) e = window.event;
	keycode = e.which || e.keyCode;
	//window.status = keycode;
		if(keycode==39){getNextPhoto(1)} //right arrow
		if(keycode==37){getNextPhoto(-1)} //left arrow
		if(keycode==32){getNextPhoto(1)} //spacebar to advance
		if(keycode==13){
			if(typeImageNumber.value != "Enter pic #") {selectByNumber(typeImageNumber.value);}  //select specific photo by number is enter pressed and non-default text in select photo box
			else {getNextPhoto(1)} //enter to advance
		}
			
		if(keycode==75){toggleSpanTimed(navigationTextMessage)} //K for keyboard shortcuts
		if(keycode==107){toggleSpanTimed(navigationTextMessage)} //k for keyboard shortcuts
			
		if(keycode==27 && slideShowRunningFlag == 1){toggleStartStopButton()} //escape to stop slideshow
		if(keycode==65 || keycode == 97){startStopButton.click()} // 'a' to toggle Autoplay
		if(keycode==83 || keycode == 115){startStopButton.click()} // 'S' to toggle Autoplay
			
		if(keycode==38 && slideShowRunningFlag == 1){document.all["nextButton"].click()} // cursor up to increase speed
		if(keycode==40 && slideShowRunningFlag == 1){document.all["backButton"].click()} // cursor down to decrease speed
	}


delay = timerDelay;  //timer uses this variable to preserve default timerDelay value
timerID0 = 0; //one for next and back buttons so their text reverts to standard label from slide speed independently of each other
timerID1 = 0;
slideTimerID = 0;
speedAdjustmentInterval = 500;  //number of miliseconds added/subtracted from slide internal when clicking on faster/slower buttons
maxSpeed = 500;  //this is the shortest interval allowed. 500 ms is one-half second. Smaller numbers represent faster speeds

function evalButton(e){
	if(e=='next') getNextPhoto(1);
	if(e=='back') getNextPhoto(-1);
	if(e=='pic') getNextPhoto(1);
	if(e=='backArrow') getNextPhoto(-1);
	if(e=='nextButton' && slideShowRunningFlag == 0) getNextPhoto(1);
	if(e=='backButton' && slideShowRunningFlag == 0) getNextPhoto(-1);
	if(e=='nextButton' && slideShowRunningFlag == 1) { //shorten delay and speed up
		if(delay - speedAdjustmentInterval >= maxSpeed) {delay = delay - speedAdjustmentInterval;} //shorten delay and speed up if not at max
		delayFriendly = Math.round(60000/delay) //round to whole numbers
		if(delayFriendly <10) {delayFriendly = Math.round(60000/delay*10)/10;} //add a decimal place when below 10
		document.all["nextButton"].value = delayFriendly + " FPM";
		if(delay <= maxSpeed) {document.all["nextButton"].value = "Maximum";}
		window.clearTimeout(timerID0); //reset timer so multiple instances aren't running
		timerID0=window.setTimeout("document.all['nextButton'].value = ' Faster '", 3000);
		}
	if(e=='backButton' && slideShowRunningFlag == 1){
		delay = delay + 500; 
		delayFriendly = Math.round(60000/delay) //round to whole numbers
		if (delayFriendly <10) {delayFriendly = Math.round(60000/delay*10)/10;} //add a decimal place when below 10
		document.all["backButton"].value = delayFriendly + " FPM";
		window.clearTimeout(timerID1); //reset timer so multiple instances aren't running
		timerID1=window.setTimeout("document.all['backButton'].value = ' Slower '", 3000);
		}
}


function viewLargeImage(){ //create popup window, add image, resize window to fit
	largeImage=document.pic.src.replace('images', 'originals')
	imageWindow=window.open('largeImage','newWin', 'width=150 height=150 toolbar=no,menubar=no,location=no,status=no,,,,resizable=yes,left=100,top=100');
	imageWindow.document.write("<html><head><Title>Click image to close window.</Title></head><body bgcolor='#2F3342' topmargin=0 leftmargin=0><img onclick='self.close()' border='1' onload='window.resizeTo(document.images[0].width,document.images[0].height)' src='"); 
	imageWindow.document.write(largeImage);
	imageWindow.document.write("'><p align='center'></p></body></html>")
	imageWindow.focus();
	imageWindow.document.close();
}

allStatusFlag=0; //used by updateMenu() - prevent onload event from firing if all was clicked.

function createImageCategoryArrays(){  //called by img on load items 
		categoryDivs=thumbnailCell.getElementsByTagName("div"); //create array of divs in thumbnail table
		categoryDivsCount = categoryDivs.length ; //count all thumbnail table divs
		//alert(categoryDivsCount)
	
		divImagesArray = new Array(); //creates multi-dim array of images within each category div array
	 		for ( var i = 0; i < categoryDivsCount ; i++) {  
				divImagesArray[i]=categoryDivs[i].getElementsByTagName("img");	
				}
}






function locateCurrentImageInCategoryArrays()	{  //called by image onload events
		category=0;  //initialize category as 0, the first category, in case a specific photo not in a category is requested via query string
		currentThumbnailFileName = document.pic.src.replace('images', 'thumbnails');  //gets name of thumbnail version of current main photo
		category=0;  //initialize category as 0, the first category, in case a specific photo not in a category is requested via query string
		for ( var i = 0; i < categoryDivsCount ; i++) {  //find current thumbnail's category and index within that category
			for (var j = 0; j < divImagesArray[i].length ; j++) { 
				if (currentThumbnailFileName == divImagesArray[i][j].src){
					category=i;
					sequence=j;
				}
			}
		}
	updateCategoryAndMenuDisplay(category,'function');  //caller used to distinguish between menuclick and autoadvance in called function
}

function updateCategoryAndMenuDisplay(e,caller){  //update menu color and thumbnail display when category changes called by menu click
				
		if(caller=='menuClick'){  //used to prevent reverting to overview when all clicked since first image in all is in first cat div
			//topIncludeDiv.style.display='none';  //hide factsheet include
			bottomcontent.style.display = '';
			imageSpan.style.display='';  //reveal image
			captionSpan.style.display='';
			//backArrow.style.display='';
			//nextArrow.style.display='';	
			//startStopButton.style.display='';
			//nextButton.style.display='';
			//backButton.style.display='';
			//navigationText.style.display='';
			//slideShowLabel.style.display='';
			if(pausedFlag==1){ //when restoring slide-show after viewing factsheets, restart it only if it was already running before
				toggleStartStopButton('menuclick');
				}
					
			if(e=='all') {allStatusFlag=1;}
			
			else {allStatusFlag=0;}
		}		
		
		for ( var i = 0; i < categoryDivsCount; i++) { //hide all category divs
			categoryDivs[i].style.display = "none";
			}
			
		for ( var i = 0; i < menuItemsCount; i++) {  //restore all menu items to white
			menuItems[i].style.color = '#ffffff';	
			}
			
		for ( var i = 0; i < menuContentItemsCount; i++) {  //restore all menu items to white
			menuContentItems[i].style.color = '#ffffff';	
			}
			   
				
		if (allStatusFlag==1){
			if(caller=='menuClick') {selectPhoto(divImagesArray[0][0].src.replace('thumbnails','images')) } //set active image to first member of all thumbnails category
			
			for ( var i = 0; i < categoryDivsCount; i++) { //reveal all divs
				categoryDivs[i].style.display = "";
			}
						
			menuItems.menuall.style.color = '#ff0000';	//make 'all' menu red	
		}
		
		//else{
			//if(caller=='menuClick') {selectPhoto(divImagesArray[e][0].src.replace('thumbnails','images')) } //set active image to first member of thumbnail category div
			//	categoryDivs[e].style.display = "";  //display current category div
			//	menuItems[e].style.color='#ff0000';
			//}
}

function createFactSheetCategoryArrays(){  //called by img on load items 
		 factSheetDivs=factSheetTable.getElementsByTagName("div"); //create array of divs in thumbnail table
		 factSheetDivsCount = factSheetDivs.length ; //count all thumbnail table divs
	
}

function createFactSheetMenuCategoryArrays(){  //called by img on load items to update menus color and tvisible category divs during auto-play
		 factSheetMenuItems=factSheetMenuTable.getElementsByTagName("input"); //create array of menu items in menu table
		 factSheetMenuItemsCount = factSheetMenuItems.length ; //count all members 
}

function updateFactSheetAndMenuDisplay(e,caller){  //update menu color and thumbnail display when category changes called by menu click
				
		//for ( var i = 0; i < factSheetDivsCount; i++) { //hide all category divs
		//	factSheetDivs[i].style.display = "none";
		//	}
			
		for ( var i = 0; i < factSheetMenuItemsCount; i++) {  //restore all menu items to white
			factSheetMenuItems[i].style.color = '#ffffff';	
			}
			   
				
		factSheetDivs[e].style.display = "";  //display current category div
		factSheetMenuItems[e].style.color='#ff0000';
		
}

function updateMapButtons(e){
	map1.style.color='#ffffff';
	map2.style.color='#ffffff';
	map3.style.color='#ffffff';
	e.style.color='#9AB2CF';
	}

function updateTopInclude(e){  //called by clicking on factsheet button
	topIncludeDiv.style.display='';
	imageSpan.style.display='none';  //hide image
	captionSpan.style.display='none';
	backArrow.style.display='none';
	nextArrow.style.display='none';
	startStopButton.style.display='none';
	nextButton.style.display='none';
	backButton.style.display='none';
	navigationText.style.display='none';
	//document.floorplanimg.src='graphics/floorplan.gif'; //replace low weight holder image in factsheet
	//mapHolder.background='graphics/pelicanmap1.gif';  //replace low weight holder image in factsheet
	//slideShowLabel.style.display='none';
	if(slideShowRunningFlag==1){
		toggleStartStopButton()
		pausedFlag=1};  //set so menu click function will only restart it if it was paused here
	bottomcontent.style.display = "none";
	
			

	
}

function revealHiddenItemsOnLoad(){
	//menudiv.style.display='';
	details.style.display='';
	//highlights.style.display='';
	//mapsButton.style.display='';
}
	
function menuButtonMouseOver(f) {
	//f.style.backgroundColor ='2f3342';
	f.style.textDecoration='underline';
	
	}

function menuButtonMouseOut(f) {
	//f.style.backgroundColor ='42475b';
	f.style.textDecoration='none';
	}
	
function contentButtonMouseOver(f) {
	//f.style.backgroundColor ='2f3342';
	//f.style.color ='ffff00';
	f.style.textDecoration='underline';
	
	}

function contentButtonMouseOut(f) {
	//f.style.backgroundColor ='42475b';
	//f.style.color ='ffffff';
	f.style.textDecoration='none';
	}
	

highlightstoggleState=1;
function toggleHighlights(){
	
	if(highlightstoggleState==1){
		highlightstoggleState=0;
		document.getElementById('viewhighlightstoggle').innerHTML='View Highlights';
		fadeOutHighlights(110)
		}

	else{
		highlightstoggleState=1;
		document.getElementById('viewhighlightstoggle').innerHTML='Hide Highlights';
		fadeInHighlights(20)
		}
}

function fadeOutHighlights(opacity) {  //The fadeIn function is called by the main image's load event and uses a Timeout function to call itself every 'X' miliseconds with an object Id and an opacity. The opacity is specified as a percentage and increased 10% at a time. The loop stops once the opacity reaches 100%:
      if(opacity > 2) opacity = opacity * .8;
      	else opacity=0;
      if (opacity > 0){
        setHighlightsOpacity(opacity);
      	window.setTimeout("fadeOutHighlights("+opacity+")", 40);
    	}
	} 


function fadeInHighlights(opacity) {  //The fadeIn function is called by the main image's load event and uses a Timeout function to call itself every 'X' miliseconds with an object Id and an opacity. The opacity is specified as a percentage and increased 10% at a time. The loop stops once the opacity reaches 100%:
      if (opacity <90)	opacity = opacity * 1.222846;
		else opacity = 100;
       	setHighlightsOpacity(opacity);
      	if(opacity<100) window.setTimeout("fadeInHighlights("+opacity+")", 40);
    }
      
 

function setHighlightsOpacity(opacity) {
   
  // IE/Win
  factsheetdiv.style.filter = "alpha(opacity:"+opacity+")";
  //obj.style.filter='progid:DXImageTransform.Microsoft.BasicImage(opacity="+opacity+")'; //try later
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  factsheetdiv.style.opacity = opacity/100;
}

function updateMenuColor(f) {
		menuContentItems=document.getElementById("menuTable").getElementsByTagName("a"); //create array of menu items in menu table
		menuContentItemsCount = menuContentItems.length ; //count all members 
		//alert(menuContentItemsCount);
				
			for ( var i = 0; i < menuContentItemsCount; i++) {  //restore all menu items to white
					menuContentItems[i].style.color = '#ffffff';	
			}
				f.style.color='#ff0000'; 
			
			return false;
			
		
		}

	
window.onload = bodyOnLoadItems;

var myrules = {
	'input.menubutton' : function(element){
		element.onmouseover = function(){
			menuButtonMouseOver(this);
		}
		element.onmouseout = function(){
			menuButtonMouseOut(this);
		}
		element.onclick = function(){
			updateCategoryAndMenuDisplay(this.getAttribute("inputNumber"),"menuClick");
		}
		element.onfocus = function(){
			this.hideFocus=true;
		}
	},
	
	'a.contentlink' : function(element){
		element.onmouseover = function(){
			contentButtonMouseOver(this);
		}
		element.onmouseout = function(){
			menuButtonMouseOut(this);
		}
		element.onclick = function(){
			updateMenuColor(this);
			
			if(this.name=='details') 		alert("Listing details will be available soon.");//{PopupWindow=window.open('factsheet.pdf', 'Popup', 'width = 785, height = 900, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			if(this.name=='neighborhood') 	{PopupWindow=window.open('report.pdf', 'Popup', 'width = 900, height = 900, toolbar=yes,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150'); PopupWindow.focus();return false;}
			if(this.name=='addldetails')	{PopupWindow=window.open('addldetails.pdf', 'Popup', 'width = 658, height = 796, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			if(this.name=='disclosure') 	{PopupWindow=window.open('disclosure.pdf', 'Popup', 'width = 800, height = 900, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			
			if(this.name=='livemap') 			{document.getElementById('mapframe').style.height='714px';parent.location.href ='http://www.DLAlexander.com?m=listings&p=properties/brandywineland/inline.php';return false;}
			
			if(this.name=='sitemap') 		{window.frames["mapframe"].location.href='plotplan.php';document.getElementById('mapframe').style.height='852px';}
			if(this.name=='elevation') 		{window.frames["mapframe"].location.href='elevation.php';document.getElementById('mapframe').style.height='852px';}
			
				if(this.name=='elevationlarge') 	{PopupWindow=window.open('maps/elevation.pdf', 'Popup', 'width = 1100, height = 700, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=50,top=75');PopupWindow.focus();return false;}
			
			
			if(this.name=='sitedevplan') 		{window.frames["mapframe"].location.href='sitedevplan.php';}

			if(this.name=='satellite') 	    {window.frames["mapframe"].location.href='satellite.php';document.getElementById('mapframe').style.height='952px';}
			
			if(this.name=='photos') 		{window.frames["mapframe"].location.href='photos.php';document.getElementById('mapframe').style.height='952px';}
			
			if(this.name=='map') 			{PopupWindow=window.open('http://maps.google.com/maps?q=http:%2F%2FDLAlexander.com%2Fmaps%2Fbrandywinemap6.kml&amp;ie=UTF8&amp;t=h&amp;ll=39.881544,-75.553612&amp;spn=0.002882,0.004292&amp;z=17&amp;source=embed', 'Popup', 'toolbar=1,menubar=1,location=1,status=1,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			if(this.name=='taxhistory') 	{PopupWindow=window.open('taxhistory.htm', 'Popup', 'width = 770, height = 800, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			
			if(this.name=='obeo') 			{PopupWindow=window.open('http://www.Obeo.com/470842', 'Popup', 'width = 780, height = 600, toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,,resizable=yes,left=150,top=150');PopupWindow.focus();return false;}
			
		
		}
	},

	
	'div.thumbs img' : function(element){
		element.onclick = function(){
			window.location='#top'; 
			selectPhoto(this.src);
		}

	},
	'body' : function(element){
	     if (document.all) element.onkeydown = checkKeycode; else { document.onkeypress = checkKeycode; }
        }


};
