$(document).ready(function(){
	//alert(photoFileName);
if($("img").hasClass("SectionPhoto")) {
	photoFilePath = $(".SectionPhoto").attr("src");
	photoFilePathArray = photoFilePath.split("/");
	photoFileName = photoFilePathArray[photoFilePathArray.length - 1];
	
	preloadSectionPhotoColor ();
	preloadSectionPhotoBW ();
	preloadSectionPhotoBig ();
	
	if($(".SectionPhoto").parent().hasClass("SectionPhotoBig")) {
		$('.SectionPhoto').click(function() {
			showSectionPhotoBig();
			return false;
		});
	
		$('.SectionPhotoBigContainer').click(function() {
			hideSectionPhotoBig();
		});
	}
	
	$('.SectionPhoto').mouseover(function() {
		loadSectionPhotoColor();
	});
	
	$('.SectionPhoto').mouseout(function() {
		loadSectionPhoto();
	});
	
	
}

setInterval('changeQuote ()', 10000);

});

function preloadSectionPhotoColor () {
	preloadImageColor = new Image();
	preloadImageColor.src = "/Graphics/SectionsPhotosColor/" + photoFileName;
}

function loadSectionPhotoColor () {
		$(".SectionPhoto").attr("src", preloadImageColor.src);
		
		if($(".SectionPhoto").parent().hasClass("SectionPhotoBig")) {
			$(".SectionPhoto").css({cursor: "pointer"});
		}
}

function preloadSectionPhotoBW () {
	preloadImageBW = new Image();
	preloadImageBW.src = "/Graphics/SectionsPhotos/" + photoFileName;
}

function loadSectionPhoto () {
	$(".SectionPhoto").attr("src", preloadImageBW.src);
}

function preloadSectionPhotoBig () {
	preloadImage = new Image();
	preloadImage.src = "/Graphics/SectionsPhotosBig/" + photoFileName;

	$(preloadImage).bind('load', function ()
	{
		var newPhoto = document.createElement('img');
		$(newPhoto).attr({src: preloadImage.src});
		$(newPhoto).css({position: 'relative', top: '0px', width: '127px', height: '190px'});
		$(newPhoto).appendTo(".SectionPhotoBigContainer");
	});
}

function showSectionPhotoBig () {
	$(".SectionPhotoBigContainer").css({display: 'block', cursor: 'pointer'});
	$(".SectionPhotoBigContainer").animate({opacity: '1.0'}, 800);
	$(".SectionPhotoBigContainer img").animate({height: preloadImage.height, width: preloadImage.width}, 800);
}

function hideSectionPhotoBig() {
	$(".SectionPhotoBigContainer").animate({opacity: '0.0'}, 800);
	$(".SectionPhotoBigContainer img").animate({height: '190px', width: '127px'}, 800);
	setTimeout("$(\".SectionPhotoBigContainer\").css({display: 'none'})", 800);
}

