// Homepage photo settings
numberOfPhotos = 12;
isItRandom = true; //true or false



// Button & Menu Options ---------------------------------//

// Use animation menus
// Requires scriptaculous
	var anim_menus = 0;

//Auto link buttons to overview pages
	var use_overview_pages = 0;

//Show sub-menus for current section( 0=no, 1=yes)
	var section_subs = 0;

//Other button definitions
//"btn_name,menu_name(|menu_direction),section_id,img_src,img_src_on"
//Ex. "ql_btn,ql_menu,0,uploaded/images/ql_btn.gif,uploaded/images/ql_btn.gif"
var otherBtns = new Array( );

// List other images that need to be pre-loaded
var otherImages = new Array();

//other JS functions to run onLoad
function loadJS(){

	document.fs_search.keywords.onfocus= function(){ if(this.value == "Search"){this.value=""};}
	document.fs_search.keywords.onblur= function(){ if(this.value == ""){this.value="Search"};}

	if(pageid==1){
		$j('#bg').after('<img id="bgHolder" src="" />');
		$j('#bgHolder').after('<img id="fg" src="" />');
		var i = isItRandom ? Math.ceil(Math.random() * numberOfPhotos) : 1;
		$j.get("uploaded/home_photos/photo" + i +".jpg");
		$j('#bgHolder').ajaxComplete(function(){
			$j('#bgHolder').attr('src',"uploaded/home_photos/photo" + i +".jpg");
			$j('#bgHolder').fadeIn('normal');
			});

		setInterval("swapPhotos();",8500);
		
		$j('#news_hdr').mouseenter(
			function(){
				$j('#mission').stop(true,true).hide(500);
				$j('#newscon').stop(true,true).show(500,function(){ $j('#newscon').css('filter','alpha(opacity=80)'); });
				$j('#news_btn').stop(true,true).animate({width:'398px'},500);
                         }
                );

		$j('#newscon').mouseleave(
			function(){
				$j('#newscon').stop(true,true).hide(500);
				$j('#mission').stop(true,true).show(500,function(){ $j('#mission').css('filter','alpha(opacity=80)')} );
				$j('#news_btn').stop(true,true).animate({width:'157px'},500);}
                );



		addCorners();
	
	}
}

function swapPhotos () {
	n = numberOfPhotos;
	var s = document.getElementById('bgHolder').src;
	var i = Number(s.replace(/[^0-9]/g,''));//get the number it's on now
	if(i==n){i=1;}else{i=i+1;} // set i to the next highest number, unless it's greater than the total number

	$j('#fg').hide();

	document.getElementById('fg').src = s.replace(/(photo)[\d]*(.jpg)/,"$1"+i+"$2");

	$j('#fg').fadeIn( 2500, function callback(){
		document.getElementById('bgHolder').src = s.replace(/(photo)[\d]*(.jpg)/,"$1"+i+"$2");
	});
}

function addCorners () {
	// this is to add corners to the mission and news boxes in IE	
	if(isIE){
		$j('#mission').prepend('<img src="uploaded/images2/home/mission_top.gif" id="missionTop">'
					).append('<img src="uploaded/images2/home/mission_bottom.gif" id="missionBottom">' );
		
		$j('#newscon').prepend('<div id="newsTop"><img src="uploaded/images2/home/news_top.gif"></div>'
					).append('<div  id="newsBottom"><img src="uploaded/images2/home/news_bottom.gif"></div>' );
	}
}





