$(document).ready(function() {
	$("li#wines_btn").mouseover(
	function() {
		$("#wines_menu").show();
	});
	$("li#wines_btn").mouseout(function() {
		$("#wines_menu").hide();
	});
	
	$("li#news_btn").mouseover(
	function() {
		$("#news_menu").show();
	});
	$("li#news_btn").mouseout(function() {
		$("#news_menu").hide();
	});
	
	$("li#gallery_btn").mouseover(
	function() {
		$("#gallery_menu").show();
	});
	$("li#gallery_btn").mouseout(function() {
		$("#gallery_menu").hide();
	});
	
	$("li#agents_btn").mouseover(
	function() {
		$("#agents_menu").show();
	});
	$("li#agents_btn").mouseout(function() {
		$("#agents_menu").hide();
	});
	
	//---------------------------------------------------------
	$("#add_gallery_section").click(function(e) {
		if($("#gallery_section_id").is(":visible")) {
			$("#gallery_section_id").hide();
			$("#gallery_section_text_id").show();
			$("#add_gallery_section").html("Cancel");
		}
		else {
			$("#gallery_section_id").show();
			$("#gallery_section_text_id").attr("value", "");
			$("#gallery_section_text_id").hide();
			$("#add_gallery_section").html("Add New");
		}
		e.preventDefault();
	});
	
	//---------------------------------------------------------
	
	$("#add_news_category").click(function(e) {
	
		if($("#news_category_id").is(":visible")) {
			$("#news_category_id").hide();
			$("#news_category_text").show();
			$("#add_news_category").html("Cancel");
		}
		else {
			$("#news_category_id").show();
			$("#news_category_text").hide();
			$("#news_category_text").attr("value", "");
			$("#add_news_category").html("Add New");
		}
		
		e.preventDefault();
	});
	
	
	function correctPaths(rootdir) {
		$('img').each(function() {
			src = $(this).attr('src');
			if(src.substr(0, rootdir.length) != rootdir)
				$(this).attr('src', rootdir + $(this).attr('src'));
		});
	}
	//correctPaths('/');
	

});
