function rotate(id){
	$.getJSON("/scripts/ajax/rotator.asp?not="+id, 
		function(json){
			// safari is the king of browsers
			if($.browser.safari){ 
				$("#img_preview").hide().attr("src","/img/home/"+json.photo[0].id+".jpg").show();
			}else{
				$("#img_preview").hide().attr("src","/img/home/"+json.photo[0].id+".jpg").fadeIn("slow");
			}
			
			$("#words").html(json.photo[0].text);
			u=setTimeout("rotate("+json.photo[0].id+")",10000);
		});
}

$(document).ready(function(){
	
	u=setTimeout("rotate(1)",5000);
	
	$("img.thumb").css("cursor","help")
	.mouseover(function(){ 
		clearTimeout(u)
		
		pid=this.id.replace(/i/,'');
		
		if($.browser.safari){
			$("#img_preview").hide()
			.attr("src","/img/home/"+pid+".jpg")
			.show();
		}else{
			$("#img_preview").hide()
			.attr("src","/img/home/"+pid+".jpg")
			.fadeIn("slow");
		}
		
		$.get("/scripts/ajax/gettext.asp?id="+pid, 
		function(text){$("#words").html(text);});
		
	})
	.mouseout(function(){ 
		pid=this.id.replace(/i/,'');
		u=setTimeout("rotate("+pid+")",5000);
	})
	
});