jQuery(document).ready(function() {
	jQuery("#thumbs").jcarousel({
		itemVisible: 4,
		itemScroll: 4
	});
});
$(document).ready(function() {
/*$.fn.image = function(src, f){ 
 return this.each(function(){ 
     var imagestring = '<img src="'+src+'" alt="slideshow image"/>';
    $(this).html(imagestring);
  }); 
 } */
$.fn.image = function(src, f){
    return this.each(function(){
      
      imgPreloader = new Image();
      imgPreloader.onload = function(){    
      imgPreloader.onload = null;
      var imageWidth = imgPreloader.width;
      var imageHeight = imgPreloader.height;
      $("#slide").empty();
			$("#slide").append('<img id="slideimg" src="'+src+'" width="'+imageWidth+'" height="'+imageHeight+'"/>');     
			$("#slideimg").hide().fadeIn("slow");
      $("#slide").css({display:"block"}); //for safari using css instead of show
      };
      imgPreloader.src = src;
    });
 }
 
	$('a').each(function() {
		if (this.getAttribute('href') && (this.getAttribute('rel') == 'slide')) {
			this.onclick = function () {
				$("#slide").toggle();
				$("#slide").image( this.href,
					function() {
					$("#slide").fadeIn("slow");
				});
				return false;
			}
		}
	});
});