(function($) {
  var cache = [];
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

jQuery.preLoadImages("home-off.png", "home-off.png");
jQuery.preLoadImages("home-on.png", "home-on.png");
jQuery.preLoadImages("about-off.png", "about-off.png");
jQuery.preLoadImages("about-on.png", "about-on.png");
jQuery.preLoadImages("portfolio-off.png", "portfolio-off.png");
jQuery.preLoadImages("portfolio-on.png", "portfolio-on.png");
jQuery.preLoadImages("contact-off.png", "contact-off.png");
jQuery.preLoadImages("contact-on.png", "contact-on.png");
jQuery.preLoadImages("uniballhq.png", "uniballhq.png");
jQuery.preLoadImages("visagehosting.png", "visagehosting.png");
jQuery.preLoadImages("juxtaposing.png", "juxtaposing.png");
jQuery.preLoadImages("ucl.png", "ucl.png");

$(document).ready(function() {
	$("#home").mouseover(function() {
		$(this).css('cursor','pointer');
		$(this).css('cursor','hand');
	});
	$("#about").mouseover(function() {
		$(this).css('cursor','pointer');
		$(this).css('cursor','hand');
	});
	$("#portfolio").mouseover(function() {
		$(this).css('cursor','pointer');
		$(this).css('cursor','hand');
	});
	$("#contact").mouseover(function() {
		$(this).css('cursor','pointer');
		$(this).css('cursor','hand');
	});
	$("#content-body").slideDown("slow");
});

function imageFlip(image) {
	if ($("#"+image).attr("src") == image+"-on.png") {
		$("#"+image).attr("src", image+"-off.png");
	} else {
		$("#"+image).attr("src", image+"-on.png");
	}
}

function loadContent(content) {
	if (content != "home") {
		$("#home").attr("src", "home-on.png");
	}
	if (content != "about") {
		$("#about").attr("src", "about-on.png");
	}
	if (content != "portfolio") {
		$("#portfolio").attr("src", "portfolio-on.png");
	}
	if (content != "contact") {
		$("#contact").attr("src", "contact-on.png");
	}
	$("#content-body").slideUp("slow", function() { window.location = content+".php" });
	//$("#content-body-mid").load(content+".php");
	//$("#content-body").slideDown("fast");
}

function portfolioRemove(content) {
	$("#"+content+"-info").slideUp("slow");
	$("#"+content).attr("class", content+"-normal");
}

function portfolioLoad(content) {
	if (content != "uniballhq") {
		portfolioRemove("uniballhq");
	}
	if (content != "visagehosting") {
		portfolioRemove("visagehosting");
	}
	if (content != "juxtaposing") {
		portfolioRemove("juxtaposing");
	}
	if (content != "ucl") {
		portfolioRemove("ucl");
	}
	
	$("#"+content+"-info").slideDown("slow");
	$("#"+content).attr("class", content+"-selected");
	
	$("#portfolio-preview").slideUp("fast", function() {
		$("#portfolio-preview").css("background-image", "url('"+content+".png')");
		$("#portfolio-preview").slideDown("fast");
		}
	);
}

