$(document).ready(function() {
	
	function showDropdown(elem) {
		var dropdown = $(elem).find('.dropdown');
		$('.dropdown').not(dropdown).each(function(){
			$(this).hide(300);
		});
		dropdown.show(300);
	}
	$('#bioHover').click(function(){
		showDropdown(this);
	});
	$('#artworkHover').click(function(){
		showDropdown(this);
	});
	
	$('#contactHover').hover(function(){
		$('#contactDropdown').show(300);
	}, function(){
		$('#contactDropdown').hide(300);
	});
	
	// Luis : This only works for a single selector, navArtwork when content_box is present.
	// $('.navArtwork').click(function() {
		// var art_html 	= $('#art_bio').html();
		
		// if ($('#content_box:hidden').size()) {
			// $('#content_box').html(art_html);
			// $('#content_box').load(art_html);
			// $('#content_box').fadeIn('slow', function(){
				// $(this).mCustomScrollbar("vertical",400,"easeOutCirc",1,"auto","yes","yes",10);
			// });
		// } else {
			// $('#content_box').fadeOut('slow', function(){
				// $(this).html(art_html).fadeIn('slow', function(){
					// $('#content_box').mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","yes",1);
				// });
			// });
		// }
		// $('#mcs_header').hide();
		// LoadNewContent("php_includes/art_bio.html");
	// });
	
	
	// New Selectors : 
	// jQuery.exists = function(selector) {return ($(selector).length > 0);}
	// if ($.exists(selector)) { }
	
	$('.navArtwork').click(function() {
		var art_html 	= $('#art_bio').html();
		
		// Homepage :Populate the context #content_box with Art Bio
		if ($('#content_box').length ) {
			// var art_html = "content_box EXSITS";
			
			if ($('#content_box:hidden').size()) {
				$('#content_box').html(art_html);
			
				$('#content_box').fadeIn('slow', function(){
					$(this).mCustomScrollbar("vertical",400,"easeOutCirc",1,"auto","yes","yes",10);
				});
			} else {
				$('#content_box').fadeOut('slow', function(){
					$(this).html(art_html).fadeIn('slow', function(){
						$('#content_box').mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","yes",1);
					});
				});
			}			
		}		
		// Gallary : On the gallary section, populate the #content_box_gallary with Art Bio		
		if ($('#content_box_gallary').length ) {			
			// $('#content_box_gallary').html("content_box_gallary EXSITS");
			if ($('#content_box_gallary:hidden').size()) {
				$('#content_box_gallary').html(art_html);
			
				$('#content_box_gallary').fadeIn('slow', function(){
					$(this).mCustomScrollbar("vertical",400,"easeOutCirc",1,"auto","yes","yes",10);
				});
			} else {
				$('#content_box_gallary').fadeOut('slow', function(){
					$(this).html(art_html).fadeIn('slow', function(){
						$('#content_box_gallary').mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","yes",1);
					});
				});
			}
		}
		// Bio : On the about 'Bio' section, populate the #content_box_about with Art Bio	
		if ($('#content_box_about').length ) {			
			// $('#content_box_about').html("content_box_ABOUT EXSITS");
			if ($('#content_box_about:hidden').size()) {
				$('#content_box_about').html(art_html);
			
				$('#content_box_about').fadeIn('slow', function(){
					$(this).mCustomScrollbar("vertical",400,"easeOutCirc",1,"auto","yes","yes",10);
				});
			} else {
				$('#content_box_about').fadeOut('slow', function(){
					$(this).html(art_html).fadeIn('slow', function(){
						$('#content_box_about').mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","yes",1);
					});
				});
			}		
		}		
		// if ($('#content_box').length ) {  
		// }
		// if ($('#content_box_gallary').length ) {
			// if ($('#content_box_gallary:hidden').size()) {
				// $('#content_box_gallary').html(art_html);
				// $('#content_box_gallary').load(art_html);
				// $('#content_box_gallary').fadeIn('slow', function(){
					// $(this).mCustomScrollbar("vertical",400,"easeOutCirc",1,"auto","yes","yes",10);
				// });
			// } else {
				// $('#content_box_gallary').fadeOut('slow', function(){
					// $(this).html(art_html).fadeIn('slow', function(){
						// $('#content_box_gallary').mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","yes",1);
					// });
				// });
			// }
		// }
	});

	$('.navBtn').hover(function(){
		$(this).siblings('.navLine').stop().animate({width: 150},200);
	}, function(){
		$(this).siblings('.navLine').stop().animate({width: 110},200);
	});
	
	$('.subNav').hover(function(){
		$(this).find('.subBtn').stop().animate({width: 260},200);
	}, function(){
		$(this).find('.subBtn').stop().animate({width: 224},200);
	});
});



