// JavaScript Document
function startList(thisDiv) {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById(thisDiv);
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

///don't forget <body onload="startList('navRowOne'); startList('navRowTwo');">


function copyrightDate(){
	var d = new Date();
	var curr_year = d.getFullYear();
	var dateString = "&copy;" + " " + curr_year + " ";
	//return dateString
	document.write(dateString);
}



NumberOfImagesToRotate = 5;

FirstPart = '<img src="images/image_random';
LastPart = '.jpg">';

function printImage() {
	var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
	document.write(FirstPart + r + LastPart);
}

function getTarget(targetRef) {
	if(typeof targetRef == 'string') {
		targetRef = document.getElementById(targetRef);
	}
	return targetRef;
}

function exists(target) {
	var target = getTarget(target);
	if (target) return target;
	return false;
}

function secNavHighlight(){
	//get the page URL
	locationStr = document.location.pathname.toString();
	a = locationStr.split("/");
	aPos = a.length-1;

	//get the div, then get all the a tags out of it
	var navContainer = document.getElementById('secNav');
	var aTags = navContainer.getElementsByTagName('a');
	
	//loop over the a tags
	for(var y = 0, aTag; aTag= aTags[y]; y++ ) {
		//get the href from the a tags
		var hrefVal = aTag.href.split("/");;
		var hrefValPos = hrefVal.length-1;
		//page name
		var thisLinksHref = hrefVal[hrefValPos].toLowerCase();
		
			//alert(aTag.parentNode.parentNode.id);
			//var temp = aTag.parentNode.parentNode.id;
			
			//compare href value to page URL
			if(thisLinksHref == a[aPos].toLowerCase()){
				aTag.style.color = "#F5821B";
			}
	}	
}


//derived from http://newsourcemedia.com/art.117.flash_activex_workaround_.php
function embedFlash(swfName, swfHeight, swfWidth){
	var swfPath;
	swfPath = "swf/" + swfName + ".swf";
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + swfWidth + ' " height="' + swfHeight + '" id="' + swfName + '">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="opaque" />');
	document.write('<param name="movie" value="' + swfPath + '" /><param name="quality" value="high" />');
	document.write('<embed src="' + swfPath + '" allowScriptAccess="sameDomain" wmode="opaque" quality="high" width="' + swfWidth + '" height="' + swfHeight + '" wmode="opaque" name="' + swfName + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function imgRand(){
	
	var rand1 = Math.ceil(Math.random() * 12);
	var rand2 = Math.ceil(Math.random() * 12);
	var rand3 = Math.ceil(Math.random() * 12);
	
	if(rand1 == rand2){
		while (rand1 == rand2) {
			var rand2 = Math.ceil(Math.random() * 12);
			}
		}
		
	if(rand1 == rand3 || rand2 == rand3){
		while (rand1 == rand3 || rand2 == rand3) {
			var rand3 = Math.ceil(Math.random() * 12);
			}
		}	
	
	document.getElementById('randImg1').src = "images/random/img" + rand1 + ".jpg";
	document.getElementById('randImg2').src = "images/random/img" + rand2 + ".jpg";
	document.getElementById('randImg3').src = "images/random/img" + rand3 + ".jpg";
}

