$(document).ready(function() {
	$("div.nav ul li.account").hover(function() {
		if($("a",this).attr("class") == "signin") {} else {
		$(this).addClass('border');
		$("ul", this).fadeIn("fast"); }
	}, function() {
		$(this).removeClass('border');
		$("ul", this).fadeOut("fast");		
	});
	$("div.buttons img:first").hover(function() {
		$(this).attr("src", "/images/buttons/browse_directory_on.gif");
	},function() {
		$(this).attr("src", "/images/buttons/browse_directory.gif");
	});
	$("div.buttons img:last").hover(function() {
		$(this).attr("src", "/images/buttons/add_company_on.gif");
	},function() {
		$(this).attr("src", "/images/buttons/add_company.gif");
	});
});
var ProviderGeneralInfo = {
	initialize: function() {
		$("div.editable").each(function() {
			$(this).hide();
		});
		$('a#editInfo').click(function() {
			ProviderGeneralInfo.toggleForm();
		});
	},
	toggleForm: function() {
		$("div.editable").each(function() {
			$(this).toggle();
		});
		$("div.uneditable").each(function() {
			$(this).toggle();
		});
		if($("div.editable").css("display") != "none") {
			$("a#editInfo").html("Cancel edit");
		} else { $("a#editInfo").html("Update this"); }
	}
};
var ContentFunctions = {
	initialize: function() {
		
	},
	bookmarkPage: function(title, url) {
		$(".bookmark_page").click(function() {
			if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		  	window.external.AddFavorite(url,title);
		  } else if (navigator.appName == "Netscape") {
		    window.sidebar.addPanel(title,url,"");
		  } else {
		    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
		  }
		});
	}
};
var ProviderProfile = {
	initialize: function() {
		$("ul.star-rating li a").click(function() {
			$.ajax({ url: '/directory/rate_provider',
			  data: { 'id' : $("#provider_id").val(), 'rating_category_id' : $(this).parent().parent().attr("id"), 'rating' : $(this).html() },
			  type: 'post',
			  success: function (d) { $("#ratings").html(d);	}
			});
		});

	}
};