var rightTitleClassNameClick
var rightTitleClassNameOther

function displayText(thisContent, textToShow)
{
	//alert(thisContent.innerText)
//displays text in divs based on rightBody Title selection
	var numberOfDivs = thisContent.parentNode.parentNode.children.length
	
	//alert(numberOfDivs)
	//alert(thisContent.parentElement.children[0].className)
	
	//Do not include the first 2 Div (i=2) or the Comment at the end (-1) - left body content
	for (i=2; i<numberOfDivs - 1; i++)
	{
		//Hide all of the Left Body content
		var divToHide = thisContent.parentNode.parentNode.children[i]
		divToHide.className = "leftBody"
		//alert(i)
		if (i==textToShow) 
		{
			//Display the selected left Body element
			divToHide.className="leftBodyVisible"
		}
	}

//Change color of the right body Title
	var rightBodyStatements = document.getElementById("rightBody")
	var rightBodyCount = rightBodyStatements.children.length
	//alert(rightBodyCount)
	//var numberOfSpans = 0
	//var spanToUse = textToShow - 1
	//alert(spanToUse)
		
	//When new item is clicked make sure the text of all other items is back to the base color
	for (h=0; h<rightBodyCount; h++)
	{
		// Make the color of the selected item a new color
		if (rightBodyStatements.children[h].tagName=="SPAN")
		{	
			if (thisContent.innerHTML == rightBodyStatements.children[h].innerHTML)
			{
				rightBodyStatements.children[h].className=rightTitleClassNameClick
				savedRightItem = thisContent
				//alert(savedRightItem.innerText)
				//alert(rightTitleClassNameClick)
			}
			else
			{
				//rightBodyStatements.children[h].className="bodyTitleWhite"
				rightBodyStatements.children[h].className=rightTitleClassNameOther
			}
		}
	}
			
	// Make the color of the selected item a new color
	//thisContent.className=rightTitleClassNameClick
	//savedRightItem = thisContent
	
	// Change the content of the second line of the body header to the selected Text
	document.getElementById("headerText2").innerHTML = thisContent.innerHTML
	
}

var mouseoverColor
var mouseoutColor
var thisScreenColor
var savedNavItem
var savedRightItem

function changeColor(navLine, which, thisclass)
{
	
	if (thisclass=="yes")
	{
		
			if (navLine==savedNavItem || navLine==savedRightItem)
			{
				//alert("do not change color")
			}
			else
			{
				//navigation mouseover mouseout color 1
				if (which == 1)
				{
					navLine.className=rightTitleClassNameClick
					//alert(navLine.className)
				}
			
				//navigation  mouseover mouseout color 2
				if (which == 2)
				{
					navLine.className=rightTitleClassNameOther
				}
				
			}
	}
else
	{
		if (navLine==savedNavItem || navLine==savedRightItem)
		{
			//alert("do not change color")
		}
		else
		{
			//navigation mouseover color
			if (which == 1)
			{
				navLine.style.color=mouseoverColor
			}
			//navigation mouseout color
			if (which == 2)
			{
				navLine.style.color=mouseoutColor
			}
			//navigation this screen color (current page)
			if (which == 3)
			{
				navLine.style.color=thisScreenColor
			}
		}
	}
}

function pageColors(bodyBackgroundColor, navTitles, mouseover, mouseout, thisScreen, rightTitleClick, rightTitleOther,  headerText1Color, headerText2Color, navItem, siteMap)
{

//Parameters are: Body background color
//		  					ClassName for Nav Titles, 
//                Mouse over color, Mouse out color, This screen item color
//                ClassName for right titles on click, ClassName for right titles others 
//                Header Line 1 color, Header Line 2 color
//		  					Nav text to look for to highlight
//                className for Site Map and Guest Book Nav Items,

//Change background color - this works

	//document.getElementById("bodyID").style.background=bodyBackgroundColor

	 
//Set the Color by ClassName for the Navigation Titles 
	var navigationElements = document.getElementById("leftNavText")
	var navDivLength = navigationElements.children.length
	//skip over the First Div (search)
	for (i=1; i<navDivLength; i++)
	{
		//Set color for the Navigation Titles - 1st and 2nd child are Site Map and Guest Book 3rd is Home - 7th is Contact Us
		if (i == 1 || i == 2 ||  i == 3 || i == 8)
		//if (i == 1)
		{
			navigationElements.children[i].children[0].children[0].className=navTitles
			//navigationElements.children[i].children[0].children[0].className=siteMap
		}
	else
		{
			navigationElements.children[i].children[0].className=navTitles
		}
	}

//Set the color for the navigation bar - mouseover and mouseout and this screen
	mouseoverColor=mouseover
	mouseoutColor=mouseout
	thisScreenColor=thisScreen
	var navigationElements = document.getElementById("leftNavText")
	var navDivLength = navigationElements.children.length
	//skip over the First Div (search) 
	for (i=1; i<navDivLength; i++)
	{
		var navTextLength = navigationElements.children[i].children.length
		//Set color for the links
		for (j=0; j<navTextLength; j++)
		{	

			if (navigationElements.children[i].children[j].tagName=="A")
			{
			//alert(navigationElements.children[i].children[j].innerText)
			//Highlight current page in left navigation bar
				if  (navigationElements.children[i].children[j].innerText==navItem)
				{
					
					var thisNavItem = navigationElements.children[i].children[j]
					changeColor(thisNavItem,3)
					savedNavItem = thisNavItem
					thisNavItem.style.cursor = "default"
				}
				else
				{
					var thisNavItem = navigationElements.children[i].children[j]
					changeColor(thisNavItem,2)
				}
			}
		}
	}

//Set the color for the right body titles - click and other
	rightTitleClassNameClick=rightTitleClick
	rightTitleClassNameOther=rightTitleOther

	var rightBodyElements = document.getElementById("rightBody")
	var countSpans = 0
	var rightBodyLength = rightBodyElements.children.length

	for (i=0; i<rightBodyLength; i++)
	{
		//Set right titles to default colors - first title different than rest
		if (rightBodyElements.children[i].tagName=="SPAN")
		{
			countSpans= countSpans +1
			if (countSpans==1)
			{
			rightBodyElements.children[i].className=rightTitleClassNameClick
			savedRightItem = rightBodyElements.children[i]
			}
			else
			{
			rightBodyElements.children[i].className=rightTitleClassNameOther
			}
		}
	}
	

//Set Body Header Text colors
	document.getElementById("headerText1").style.color=headerText1Color
	document.getElementById("headerText2").style.color=headerText2Color

}

var message="Right Click function has been disabled."
if (document.layers)
{
	document.captureEvents(Event.MOUSEDOWN);
	
}

function MM_openBrWindow(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}



function popupwindow(myImage,myWidth,myHeight,origLeft,origTop)
{
myHeight += 24;
myWidth += 24;
TheImgWin = window.open(myImage,'image','height=' +
myHeight + ',width=' + myWidth +
',toolbar=no,directories=no,status=no,' +
'menubar=no,scrollbars=no,resizable=no');

TheImgWin.resizeTo(myWidth+2,myHeight+30);
TheImgWin.moveTo(origLeft,origTop);
TheImgWin.focus();

}

function newWindow(paintingImg, paintingName)
{
	//paintingWindow = window.open(paintingImg, "paintWin", "resizable=yes,left=300,top=50,width=600,height=575")
	//paintingWindow = window.open("", "paintWin", "scrollbars=yes,resizable=yes,left=200,top=0,width=655,height=700")
	paintingWindow = window.open("", "paintWin", "scrollbars=yes,resizable=yes,left=200,top=0,width=800,height=700")
alert("open")
	paintingWindow.document.write("<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\">")
	paintingWindow.document.write("<html><head>")
	paintingWindow.document.write("<link rel=\"stylesheet\" TYPE=\"Text\/CSS\" href=\"styles\/gordonAllen.css\">")
	paintingWindow.document.write("<script src=\"scripts\/gaBodyScript.js\" language=\"javascript\" type=\"text\/javascript\"><\/script>")
	paintingWindow.document.write("<\/head><body>")
	paintingWindow.document.write("<script language=\"javascript\" type=\"text\/javascript\">document.onmousedown=captureMousedown<\/script>")
alert("script")
alert(paintingName)
docstring = "<div class='indent5'><div class='windowHeader'>"
docstring = docstring + paintingName + " &copy;</div><br>"
docstring = docstring + "<img src='" + paintingImg + "' Alt='" + paintingName + "' border='0'>"
	//paintingWindow.document.write('<div class=\"indent5\"><div class=\"windowHeader\">')
alert("div1")
	//paintingWindow.document.write(paintingName + " &copy;<\/div><br>")
alert("div")
alert(paintingImg)
	content ="<img src='" + paintingImg + "' Alt='" + paintingName + "' border='0'>"
	alert (content)
	//paintingWindow.document.write("<img src='" + paintingImg + "' Alt='" + paintingName + "' border='0'>")
	paintingWindow.document.write(docstring)
alert("img")
	paintingWindow.document.write("<br><br><span class=\"copyrightTextBold\">&copy;1991 and forward through 2008 Rev Dr. G. Gordon Allen US and international rights reserved.<br>&copy;Original art and digital images copyrights inclusive by Rev Dr. G. Gordon Allen Contact at 1 206 527 4500 US.<\/span>")
alert("text")
	paintingWindow.document.write("<\/div><\/body><\/html>")
alert("end")
	paintingWindow.document.close()
alert("close")
	setTimeout("paintingWindow.focus()",1000)

	
	//paintingWindow.document.write("<div styles=\"font-size:18pt;font-weight:bold;font-style:italic;\"> " + paintingName + " &copy;<\/div><br\/>")
	//paintingWindow.document.write("<img src=\"" + paintingImg + "\" Alt=\"" + paintingName + "\" border=\"0\">")
	//paintingWindow.document.write("<br><br><span styles=\"font-size:8pt;font-weight:bold;font-style:italic;\">&copy;1991 and forward through 2007 Rev Dr. G. Gordon Allen US and international rights reserved.<br>&copy;Original art and digital images copyrights inclusive by Rev Dr. G. Gordon Allen Contact at 1 206 527 4500 US.<\/span>")
	//paintingWindow.document.write("<div class='indent5'><div class='windowHeader'> " + paintingName + " &copy;<\/div><br\/>")
}

function captureMousedown(evt)
{
	if (evt)
	{
		mouseClick = evt.which
	}
	else
	{
		mouseClick = window.event.button
	}
	if(mouseClick==2 || mouseClick == 3)
	{
		alert(message)
		return false
	}
}

function daysLeft(endDate)
{
	alert(endDate)
	alert(Now)
	daysLeft = DateDiff("d", Now, endDate)
	alert(daysLeft)
}

function changeImage(idName, newImage)
{
		idName.src = newImage
}		

