jQuery.preloadImages = function()
{
  //http://www.mattfarina.com/2007/02/01/preloading_images_with_jquery
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
function addLoadEvent(func) {
  //http://www.sitepoint.com/blogs/2004/05/26/closures-and-executing-javascript-on-page-load/
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      //oldonload();
      func();
    }
  }
}
function page_tags(slide_ID){
	$.post("page_tags.php", {ID:slide_ID}, function(data){
		if(data.length >0) {
			$('#page_tags').html(data);
		}
	});
}
function show_slide(slide_ID){
	$.post("show_slide.php", {ID:slide_ID}, function(data){
		if(data.length >0) {
			$('#slide_info').fadeOut('normal');
			setTimeout(function(){$('#slide_info').html(data);},500);
			setTimeout(function(){$('#slide_info').fadeIn('normal');},1000);
		}
	});
}
addLoadEvent(function() {
	$.preloadImages("images/gallery_home_hover.jpg","images/contact_hover.jpg","images/statement_hover.jpg","images/show_all_hover.jpg","images/show_for_sale_hover.jpg");
	$("#gallery_home").hover(function(){this.src = this.src.replace("home","home_hover");},function(){this.src = this.src.replace("home_hover","home");});
	$("#contact").hover(function(){this.src = this.src.replace("contact","contact_hover");},function(){this.src = this.src.replace("contact_hover","contact");});
	$("#statement").hover(function(){this.src = this.src.replace("statement","statement_hover");},function(){this.src = this.src.replace("statement_hover","statement");});
	$("#fs_image").hover(function(){this.src = this.src.replace(".jpg","_hover.jpg");},function(){this.src = this.src.replace("_hover.jpg",".jpg");});
});

