// Copyright Acro Media Inc. 1998-2006, www.acromediainc.com

function onOver(){
	this.src = imgOvers[this.number].src;
}
function onOut(){
	this.src = imgOuts[this.number].src;
}

function copyrightYear(){
	var d=new Date();
	if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = d.getFullYear();
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
 }
 //added so Constant Contact Form will popup in a new window
 if(document.getElementById('newsletterForm')) document.getElementById('newsletterForm').target = "_blank";
 if(document.getElementById('downloadBook')) document.getElementById('downloadBook').target = "_blank";
}

//Checks to see if safari is on, boolean
var detect = navigator.userAgent.toLowerCase();
var safStatus,thestring;
function checkSafari(){	
	if (checkIt('safari')) safStatus = true;
	else safStatus = false;
	function checkIt(string){
		place = detect.indexOf(string) + 1;
		return place;
	}
}

//Input fields clearing
function clearInput(element) {
  if (element.defaultValue==element.value) element.value = ""
}

// Popup Window Script
var newWin;
var popup = {
	open : function(windowURL, windowWidth, windowHeight, imageFile){
	  var topPos = "";
	  var leftPos = "";
	  if(!windowWidth || windowWidth == 0){
	    (screen) ? windowWidth = screen.availWidth -10 : windowWidth = 790;
	    leftPos = ",left=0";
		 
	  }
	  if(!windowHeight || windowHeight == 0){
	    (screen) ? windowHeight = screen.availHeight -30 :windowHeight = 790;
	    topPos = ",top=0";
	  }
		if(screen.availWidth) leftPos = ",left="+(screen.availWidth / 2 - windowWidth / 2);
		if(screen.availHeight) topPos = ",top="+(screen.availHeight / 2 - windowHeight / 2);
		newWin = window.open(windowURL+"?JS_photo="+imageFile,"camphotos","toolbar=no,menubar=0,width="+windowWidth+",height="+windowHeight+topPos+leftPos+",scrollbars=no,resizable=no");
		setTimeout('newWin.focus();',100);
	}
}

window.onload = function (){
	checkSafari();
	copyrightYear();
	externalLinks();
}

