// JavaScript Document

function switchPics(pic1,pictext){
	var img = new Image();
	img.onload = function() { document.getElementById('slideshow3').style.backgroundImage = 'url(' + img.src + ')';  
		$("#slideshow2").animate( {  opacity: 0 }, 1000, function(){finishPic(pic1,pictext);});
	};
	img.src = 'homepage/'+pic1+'.jpg';
}//creates img object and binds onload event to fade the picture in front out then calls finishPic to reset the slideshow div

function finishPic(pic1,pictext){
	var dotdotdot='';
	if(pictext.length >= 79){
		dotdotdot='...';	
	}
	
	document.getElementById('maintext').innerHTML=pictext.substring(0,79) + dotdotdot;
	document.getElementById('slideshow2').style.backgroundImage = 'url(homepage/'+pic1+'.jpg)';
	$("#slideshow2").animate( {  opacity: 1 }, 1000);
}//reset the background images for the slideshow divs


//code to scroll news, link, and other elements on the homepage
$(document).ready(function(){
   
    var tarray=$('.minipic');
	
	//"background-image", "url(/myimage.jpg)"
	
	$.each(tarray,
		   	function(){
				var bimage=$(this).attr("id");
				var imgSrc = "url('" + bimage + "')";
				$(this).css('background-image', imgSrc);
				$(this).css('backgroundPosition','-80px -20px');
			}
	);
});
//bind events for the up and down buttons for the scroll plugin. Requires an id for the scroll items, link for ajax, and current record num
