$(document).ready(function () {
	
   
    //set timeout
	var sTimerId = 0;
	var sTime = 300;
   
  //photo switch
   $(".iPhoto").mouseenter(function(){
									
			var thisImage = $(this).attr('href');
			var thisTarget =  $(this).attr('target');
			var targetHTML = $(thisTarget).html();
			var newHTML = '<img src="'+thisImage+'">';
			//alert("new :"+newHTML+" = old: "+targetHTML);
									
			sTimerId = setTimeout ( function(){
				if(newHTML != targetHTML)
				{
					$(thisTarget).animate({opacity: 0}, 'slow', changeIt);
				}
			}, sTime);
			function changeIt()
			{	
				$(thisTarget).html(newHTML);
				$(thisTarget).animate({opacity: 1}, 'slow');
			}
			return false;
	});
   
   $(".iPhoto").click(function(){
			return false;
	});
    $(".iPhoto").mouseleave(function(){
			clearTimeout ( sTimerId );
			return false;
	});
  /*
   //photo switch on click
    $(".iPhoto").click(function(){
									
			var thisImage = $(this).attr('href');
			var thisTarget =  $(this).attr('target');
			var targetHTML = $(thisTarget).html();
			var newHTML = '<img src="'+thisImage+'">';
			//alert("new :"+newHTML+" = old: "+targetHTML);
									
			sTimerId = setTimeout ( function(){
				if(newHTML != targetHTML)
				{
					$(thisTarget).animate({opacity: 0}, 'fast', switchOut);
				}
			}, sTime);
			function switchOut()
			{	
				$(thisTarget).html(newHTML);
				$(thisTarget).animate({opacity: 1}, 'fast');
			}
			return false;
	});
   
   $(".iPhoto").click(function(){
			return false;
	});
    $(".iPhoto").mouseleave(function(){
			clearTimeout ( sTimerId );
			return false;
	}); */
});