<!--
/* This function should be used for all image rollover effects */

function changeImage(imageName,newImageSource) {
	if (document.images) {
		document.images[imageName].src = newImageSource;
	}
}

/* This function should be used for the quicklinks */

function quickJump() {
	var jumpURL = document.qlinks.qsection.options[document.qlinks.qsection.selectedIndex].value;
	if (jumpURL != "") {
		top.document.location = document.qlinks.qsection.options[document.qlinks.qsection.selectedIndex].value;
	}
	return false;
}	

/*
* This function is used when you want to have browsers that do not 
* have flash player installed write an image file instead 
*/

function writeFlashOrImage(FlashName,ImageName,Width,Height,Alt,FlashVersion) {
	// first, write the opening object tag  

	strObjectTag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	strObjectTag = strObjectTag + ' width="' + Width + '" height="' + Height + '" ';
	strObjectTag = strObjectTag + 'codebase="http://active.macromedia.com/flash5/cabs/swflash.cab#version=';
	strObjectTag = strObjectTag + FlashVersion + '">';
	strMovieParam = '<param name="movie" value="' + FlashName + '">';
	document.write(strObjectTag);
	document.write(strMovieParam);
	document.write('<param name=\"play\" value=\"true\">');
	document.write('<param name=\"loop\" value=\"true\">');
	document.write('<param name=\"quality\" value=\"high\">');

	// if the Flash Plug-in is installed and a browser than user plug-ins is the browser, write an embed tag
	plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
		strImageTag = '<image src="' + ImageName + '" width="' + Width + '" height="' + Height + '" ';
		strImageTag = strImageTag + ' border="0" alt="' + Alt + '">';
	if ( plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4 )
		{
		strEmbedTag = '<embed src="' + FlashName + '" width="' + Width + '" height="' + Height + '" ';
		strEmbedTag = strEmbedTag + 'play="true" loop="true" quality="high" ';
		strEmbedTag = strEmbedTag + 'pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
		document.write(strEmbedTag);
		document.write('</embed>');
		}
	// otherwise, then write an image tag.
	else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
		document.write(strImageTag);
		}
	
	//finally, write the closing object tag
	document.write('</object>');
}

/* Use this function to open new windows in a browser */

function openNewWindow(URL,windowName,optionList) {
	/* Opens a new window based on following parameters
		URL: A full URL to the site or file you wish to open
		windowName: The name of the Window that JS assigns when creating
		optionList: (Optional)--list of options for the pop-up window
	*/
	optionListValue = optionList;
	// Assign a Default Set of Parameters if the optionList does not exist
	if ((optionListValue == '') || (optionList == null)) {
		optionListValue = 'scrollbars=yes,location=yes,menubar=yes,toolbar=yes,resizable=yes,status=yes,locationbar=yes';
	}
	winOpener = window.open(URL,windowName,optionListValue);
	winOpener.focus();
}

function loadTopFrame(URL) {
	top.document.location = URL
}

function popupWindow(URL,windowName,optionList) {
	/* Opens a new window based on following parameters
		URL: A full URL to the site or file you wish to open
		windowName: The name of the Window that JS assigns when creating
		optionList: (Optional)--list of options for the pop-up window
	*/
	optionListValue = optionList;
	// Assign a Default Set of Parameters if the optionList does not exist
	if ((optionListValue == '') || (optionList == null)) {
		optionListValue = 'height=300,width=270,scrollbars,location=no,menubar,toolbar=no,resizable=no,status=no,locationbar=no';
	}
	winOpener = window.open(URL,windowName,optionListValue);
	winOpener.focus();
}

function loadTopFrame(URL) {
	top.document.location = URL
}


function getAge(yr, mon, day, unit, decimal, round)
{
	// Sample usage
	// getAge(1997, 11, 24, "years", 0, "rounddown")
	// getAge (year, month, day, unit, decimals, rounding)
	// Unit can be "years", "months", or "days"
	// Decimals specifies demical places to round to (ie: 2)
	// Rounding can be "roundup" or "rounddown"

	var one_day=1000*60*60*24
	var one_month=1000*60*60*24*30
	var one_year=1000*60*60*24*30*12

	today=new Date()
	var pastdate=new Date(yr, mon-1, day)

	var countunit=unit
	var decimals=decimal
	var rounding=round

	finalunit=(countunit=="days")? one_day : (countunit=="months")? one_month : one_year
	decimals=(decimals<=0)? 1 : decimals*10

	if (unit!="years"){
		if (rounding=="rounddown")
			return Math.floor((today.getTime()-pastdate.getTime())/(finalunit)*decimals)/decimals;
		else
			return Math.ceil((today.getTime()-pastdate.getTime())/(finalunit)*decimals)/decimals;
	}
	else{
		yearspast=today.getFullYear()-yr-1
		tail=(today.getMonth()>mon-1 || today.getMonth()==mon-1 && today.getDate()>=day)? 1 : 0
		pastdate.setFullYear(today.getFullYear())
		pastdate2=new Date(today.getFullYear()-1, mon-1, day)
		tail=(tail==1)? tail+Math.floor((today.getTime()-pastdate.getTime())/(finalunit)*decimals)/decimals : Math.floor((today.getTime()-pastdate2.getTime())/(finalunit)*decimals)/decimals
		return yearspast+tail;
	}
}

function updateAge(y, m, d)
{
	document.getElementById('age').innerHTML = getAge(y, m, d, 'years', 0, 'rounddown');
}


//-->
