//
// Philip Bailey
// 22 January 2001
//
// Purpose:
//  This file contains common JavaScript that is used to insert common
//  features into all Intranet pages.
//
// Modifications:
//					18 Oct 2001 - Philip added new title sections
//                   5 nov 2004 Ken Fries fixed "getyear" to getfullyear
/////////////////////////////////////////////////////////////////////////////////////////
//
var arrMonths = new Array();
arrMonths[0]  = "Jan";
arrMonths[1]  = "Feb";
arrMonths[2]  = "Mar";
arrMonths[3]  = "Apr";
arrMonths[4]  = "May";
arrMonths[5]  = "Jun";
arrMonths[6]  = "Jul";
arrMonths[7]  = "Aug";
arrMonths[8]  = "Sep";
arrMonths[9]  = "Oct";
arrMonths[10] = "Nov";
arrMonths[11] = "Dec";
//
// This array is used to build the array of form rollover buttons
//
var offImgArray = new Array();
var onImgArray  = new Array();
var namesArray  = new Array();

namesArray[0]  = "";
namesArray[1]  = "";
namesArray[2]  = "";
namesArray[3]  = "";
namesArray[4]  = "Products.jpg";
namesArray[5]  = "Measure.jpg";
namesArray[6]  = "ThreeWays.jpg";
namesArray[7]  = "WhyWind.jpg";
namesArray[8]  = "AboutHalus.jpg";

//
// Populate the two image arrays
//
for (i = 0; i < namesArray.length; i++)
{
	onImgArray[i]  = new Image(156, 25);
	offImgArray[i] = new Image(156, 25);

	j = namesArray[i].length;
	onImgArray[i].src =  "/Images/" + namesArray[i].substr(0, j - 4) + "A" + namesArray[i].substr(j - 4);
	offImgArray[i].src = "/Images/" + namesArray[i].substr(0, j - 4) + namesArray[i].substr(j - 4);
}
//
// Populate the roll over text for the three navigation images.
// NOTE: The sequence of these items must match the first three items in the image arrays
//
var navTextArray = new Array();
navTextArray[0] = new String("Home");
navTextArray[1] = new String("Contact Us");
navTextArray[2] = new String("Site Index");
navTextArray[3] = new String("Links");
//
/////////////////////////////////////////////////////////////////////////////////////////
// Functions available to all pages
/////////////////////////////////////////////////////////////////////////////////////////
//
// Function to format date variables. Used throughout site
//
function ParseDate()
{
	var theDate = document.lastModified;
	//document.writeln(theDate);

	if (typeof(theDate) != "string")
	{
		return 0;
	}
	
	strMonth = theDate.substr(0, 2);
	strDay   = theDate.substr(3, 2);
	strYear  = theDate.substr(6, 4);

	document.write('Last Modified: ' + arrMonths[parseInt(strMonth) - 1] + ' ' + strDay + ', ' + strYear);
	//document.writeln(arrMonths[strMonth]);
}

function GetTodaysDate()
{
	var today = new Date();	
	return (today.getDate() + ' ' + arrMonths[today.getMonth()] + ', ' + today.getFullYear());
}
//
// Image On and Off RollOver functions
//            
function imageOver(theObject)
{
	if (theObject)
	{
		i = theObject.id.substr(3);
		if (i < 4)
		{
			document.all.NavText.innerText = navTextArray[i];
		}
		else
		{
			theObject.src = onImgArray[i].src;
		}
	}
	
}  
          
function imageOut(theObject)
{
	if (theObject)
	{
		i = theObject.id.substr(3);	
		if (i > 3)
		{
			theObject.src = offImgArray[i].src;
		}
	}
	document.all.NavText.innerText = GetTodaysDate();
}

//
// Insert the "Go to top of page" image"
//
function ShowTop(strAlign)
{
	if (!strAlign)
	{
		strAlign = "right";
	}
	document.writeln('<A href="#top"><IMG align=' + strAlign + ' src="/Images/top.jpg" alt="Top of Page" border="0" height=16 width=15></A>');
}

function ShowPopUp(sFile)
{
	if (sFile)
	{
		if (sFile.length > 0)
		{
			sFile = '/thumbnails/' + sFile + '.htm';
			window.open(sFile, 'HalusImage', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=400,height=500');
		}
	}
}

function CloseWindow()
{
	window.close();
}
//
// End of File

