// JavaScript Document

$(function(){

		$('#colorBlocks img, #header').mouseover(function() {
			if($('#colorBlocks img').height() > 15) {
				 $('#colorBlocks img').delay(1000).animate({'height': 15, 'top': 540}, 'slow');
				 $('#subNav').delay(1000).show('fast');
				 $('#subnav li:nth-child(1) a').css({'color':'#333'})
				 $('#recentMixedMedia').show();
				 return false;
			}
			
		});
		//main JS below
		   
		$('#subNav').hide();
		$('h1').css({'z-index':4000});
		$('#introPainting').css({'z-index': 3000});
		$('#colorBlocks').css({'z-index': 2000});
		$('.thumbnails').css({'z-index':1000});
		
		/*handle main navigation - show/hide subnav ---------------------*/
			
		$('#paintingsLink').click(function() {
			if($('#paintingsLink').height() > 50) {
				 $('#subNav').hide('fast');
			}
			else {
			$('#subNav').show('fast');
			}
		});
		
				
		//handle subnavigation - show painting thumbnails
		$('#colorBlocks img').css({'position': 'relative'});
		$('#introPainting img').css({'position': 'relative'});

		//$('#colorBlocks img').delay(500).animate({'height':15, 'top':485}, 'slow');
		
		/* overlay function ---------------------------------------------*/
		$("a[rel]").overlay({
			mask: '#000',
			effect: 'default',
			loadSpeed: 100,
			top: 140,
			
			closeOnClick: false,

			onBeforeLoad: function() {
					// grab wrapper element inside content
					var wrap = this.getOverlay().find(".contentWrap");

					// load the page specified in the trigger
					wrap.load(this.getTrigger().attr("href"));
				}, 
				onClose: function() {
					this.getOverlay().find(".contentWrap").empty();
					$('.error').css({display: 'none'});
				}
		});
		
		//$("#myform").validator();
});
