<!--
// JavaScript Document

function checkClear(){
	if(document.getElementById('searchBox').value == "SEARCH"){
		document.getElementById('searchBox').value = "";
	}
}

function checkFill(){
	if(document.getElementById('searchBox').value == ""){
		document.getElementById('searchBox').value = "SEARCH";
	}
}

function checkClearLogin(){
	if(document.getElementById('loginEmail').value == "Email"){
		document.getElementById('loginEmail').value = "";
	}
}

function checkClearPass(){
	if(document.getElementById('loginPass').value == "Password"){
		document.getElementById('loginPass').value = "";
		changeInputType(document.getElementById('loginPass'),'text','Password',false,true);
	}
}

function cClear(element,value){
	if(document.getElementById(element).value == value){
		document.getElementById(element).value = "";	
	}
}

function cFill(element,value){
	if(document.getElementById(element).value == ""){
		document.getElementById(element).value = value;	
	}
}

// Example 2 (JS part 1)
function changeInputType(
  oldElm, // a reference to the input element
  iType, // value of the type property: 'text' or 'password'
  iValue, // the default value, set to 'password' in the demo
  blankValue, // true if the value should be empty, false otherwise
  noFocus) {  // set to true if the element should not be given focus
  if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
    !document.getElementById || !document.createElement) return;
  var newElm = document.createElement('input');
  newElm.type = iType;
  if(oldElm.name) newElm.name = oldElm.name;
  if(oldElm.id) newElm.id = oldElm.id;
  if(oldElm.className) newElm.className = oldElm.className;
  if(oldElm.size) newElm.size = oldElm.size;
  if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex;
  if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey;
  newElm.onfocus = function(){return function(){
    if(this.hasFocus) return;
    var newElm = changeInputType(this,'password',iValue,
      (this.value.toLowerCase()==iValue.toLowerCase())?true:false);
    if(newElm) newElm.hasFocus=true;
  }}();
  newElm.onblur = function(){return function(){
    if(this.hasFocus)
    if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) {
      changeInputType(this,'text',iValue,false,true);
    }
  }}();
 // hasFocus is to prevent a loop where onfocus is triggered over and over again
  newElm.hasFocus=false;
  oldElm.parentNode.replaceChild(newElm,oldElm);
  if(!blankValue) newElm.value = iValue;
  if(!noFocus || typeof(noFocus)=='undefined') {
    window.tempElm = newElm;
    setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
  }
  return newElm;
}

function toggleEmailer(){
	var c = document.getElementById('emailer').style.visibility;
	if(c!="visible"){vis('emailer');c="visible";}else{invis('emailer');c="hidden"}
}

function vis(element){
	imageId = element;
	image = document.getElementById(imageId);
	image.style.display = 'block';
	setOpacity(image, 0);
	image.style.visibility = 'visible';
	fadeIn(imageId,0);
}

function invis(element){
	imageId = element;
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	fadeOut(imageId,0);
	image.style.visibility = 'hidden';
	image.style.display = 'none';
}


function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 15;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity > 0) {
      setOpacity(obj, opacity);
      opacity -= 10;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
    }
  }
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}



function ValidateInput(theForm) {
	if (theForm.firstName.value == "") {
		alert("Please tell us your first name.");
		theForm.firstName.focus();
		return (false);
	}
	
	if (theForm.lastName.value == "") {
		alert("Please tell us your last name.");
		theForm.lastName.focus();
		return (false);
	}
	
	if (theForm.middleInitial.value == "") {
		alert("Please tell us your middle initial.");
		theForm.middleInitial.focus();
		return (false);
	}
	
	if (theForm.email.value == "") {
		alert("Please tell us your email address.");
		theForm.email.focus();
		return (false);
	}
	
	if (theForm.password.value == "") {
		alert("Please enter a password.");
		theForm.password.focus();
		return (false);
	}
	
	if (theForm.password.value != theForm.password2.value) {
		alert("Passwords do not match.");
		theForm.password2.focus();
		return (false);
	}
	
	if (theForm.address.value == "") {
		alert("Please tell us your address.");
		theForm.address.focus();
		return (false);
	}
	
	if (theForm.city.value == "") {
		alert("Please tell us your city.");
		theForm.city.focus();
		return (false);
	}
	
	if (theForm.state.value == "") {
		alert("Please tell us your state.");
		theForm.state.focus();
		return (false);
	}
	
	if (theForm.zip.value == "") {
		alert("Please tell us your zip code.");
		theForm.zip.focus();
		return (false);
	}
	
	if (theForm.phone.value == "") {
		alert("Please tell us your phone number.");
		theForm.phone.focus();
		return (false);
	}
	
	return (true);
}

function emailAlert(){
	alert("Email Sent!");	
}

// Function to create flash banners
function doFlashBanner(src,width,height) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="'+src+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="#000000" />\n');
	document.write('<param name="wmode" value="transparent">\n');
	document.write('<embed src="'+src+'" wmode="transparent" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}

//========================================
//*			Image Rotator
//========================================
function rotateImages(x){
	var images=new Array();
	var links=new Array();
	
	// Set your images here
	images[0] = '/images/banners/mystory_pavy.jpg';
	images[1] = '/images/banners/mystory_swim.jpg';
	images[2] = '/images/banners/mystory_lowders.jpg';
	images[3] = '/images/banners/mystory_kinsers.jpg';
	
	//Links for the images
	links[0] = '/default.asp?PageIndex=399'
	links[1] = '/default.asp?PageIndex=401'
	links[2] = '/default.asp?viewNews=125&PageIndex=55'
	links[3] = '/default.asp?viewNews=126&PageIndex=55'
	
	var delay = 8000; //Delay in miliseconds between rotations
	var container = "bannerImage";  // ID of div where you want images to go

	if(x!=1){document.getElementById(container).innerHTML = '<a href="'+links[0]+'"><img border="0" src="'+images[0]+'" /></a>';images.shift();links.shift();}
	for(i=0;i<images.length;i++){
		var z = setTimeout("changeTo('"+images[i]+"','"+container+"','"+links[i]+"')",(i+1)*delay)	
	}
	setTimeout("rotateImages(1);",images.length * delay);
}

function changeTo(image,container,link){	
	var f = setTimeout("document.getElementById('"+container+"').innerHTML = '<a href=\""+link+"\"><img border=\"0\" src=\""+image+"\" /></a>'",100);
	var j = new Effect.Opacity(container,{from:0,to:1, duration: 1});return false;
}

//-->	