function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
        $('<img/>')[0].src = this;
    });
}

var images = baseurl + "images/frontend/";

$(document).ready(function() {
	$(".nav-space").hover(
		function()
	{
		this.src = this.src.replace("01","02");
	},
	function()
	{
		this.src = this.src.replace("02","01");
	});
	
	
	preload([
		images + "artists-portfolio02.png",
		images + "latest-news02.png",
		images + "submissions02.png",
		images + "contact02.png",
		images + "link02.png",
		images + "art-for-sale02.png",
	]);
	

	// submission and artforsale

	$("#purchase-button").click(function(e){
		$("#artforsale-content").toggle("slow");
		e.preventDefault();
	});
	$("#submissions-button").click(function(e){
		$("#submissions-content").toggle("slow");
		e.preventDefault();
	});
	
	$("#submissions-close").click(function(e){
		$("#submissions-content").hide("slow");
		e.preventDefault();
	});
	
	$("#artforsale-close").click(function(e){
		$("#artforsale-content").hide("slow");
		e.preventDefault();
	});
	
	
	
	// search
	
	$("#category-search").change(function(){
		var val = this.value;
		if(val != "")
		window.location = baseurl + "search/" + val;
	 });	 
});
