// JavaScript Document




function changeCopyrightDate(){
	var captionElement = document.getElementById("copyrightDate");
	var now = new Date;
	var year = now.getFullYear();
	captionElement.innerHTML = year;
}


function switchDiv(showDiv, hideDiv, lnk){
	if(showDiv != ""){
		if(showDiv == "serviceLinkIcon"){
			if(lnk != "undefined"){
				topPosition = Math.round(document.getElementById(lnk).offsetTop + (document.getElementById(lnk).offsetHeight/2 - 7));
				
				document.getElementById(showDiv).style.top = topPosition+"px";
				document.getElementById(showDiv).style.left = "125px";
			}
		}
		
		document.getElementById(showDiv).style.display = "block";
	}
	if(hideDiv != ""){
		document.getElementById(hideDiv).style.display = "none";
	}
}


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", "");
				}
			}
		}
	}
}

//global variable to indicate if page has been loaded yet
var newPageLoad = 0;

function imgInit(){
	if(newPageLoad != 0){
		fadeImgs(1);
	}
	newPageLoad = 1;
}

function fadeImgs(currPromo){
		var totalImgs = 4;
		var showPromo = "mainPromoPhoto" + currPromo;
	
		//hide all
		for (i=1; i<=totalImgs; i++){
			var imgDiv = "mainPromoPhoto" + i;
				$(imgDiv).style.display = "none";
		}
		
		//fade in the current
		Effect.Appear(showPromo);
		
		newPageLoad = 1;
}

function randomStory(currDiv,Num) {
	
	var ranNum= Math.ceil(Math.random() * Num);
	var displayStory = currDiv + ranNum;
	
	document.getElementById(displayStory).style.display="block";
	//alert(displayStory);
	
}