// JavaScript Document
var nicHomepage = jQuery.noConflict();
nicHomepage(document).ready(function(){
	nicHomepage("ul.thumb li").hover(function() {
		nicHomepage(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 

		var mainImage = nicHomepage(this).find('img').attr("src"); //Find Image Name and replace with the "over" image
		overImage = "images/over_"+mainImage.substring(mainImage.lastIndexOf("/")+1);	
		//alert(overImage);
		nicHomepage(this).find('img').attr({ src: overImage });

		nicHomepage(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
			.animate({
				marginTop: '-110px', /* The next 4 lines will vertically align this image */ 
				marginLeft: '-110px',
				top: '50%',
				left: '50%',
				width: '255px', /* Set new width */
				height: '170px', /* Set new height */
				padding: '20px'
			}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
	
		} , function() {
		nicHomepage(this).css({'z-index' : '0'}); /* Set z-index back to 0 */

		var overImage = nicHomepage(this).find('img').attr("src"); //Find Image Name and set back to the original image
		mainImage = "images/"+overImage.substring(overImage.lastIndexOf("over_")+5);
//alert(mainImage);
		nicHomepage(this).find('img').attr({ src: mainImage });

		nicHomepage(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
			.animate({
				marginTop: '0', /* Set alignment back to default */
				marginLeft: '0',
				top: '0',
				left: '0',
				width: '126px', /* Set width back to default */
				height: '90px', /* Set height back to default */
				padding: '5px'
			}, 400);
	});
});

//Carousel Script
var flashvars = {};
flashvars.settingsXML = "settings.xml";
var params = {};
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("carousel.swf", "CarouselDiv", "500", "160", "9.0.0", false, flashvars, params, attributes);

//preload home page mouseover images
if (document.images)
{
  pic1= new Image(126,90); 
  pic1.src="images/over_thumb1.png"; 
  pic2= new Image(126,90); 
  pic2.src="images/over_thumb2.png";  
  pic3= new Image(126,90); 
  pic3.src="images/over_thumb3.png"; 
  pic4= new Image(126,90); 
  pic4.src="images/over_thumb4.png"; 
  pic5= new Image(126,90); 
  pic5.src="images/over_thumb5.png"; 
  pic6= new Image(126,90); 
  pic6.src="images/over_thumb6.png";     
}
