$(document).ready(function(){
	
	$('#logo').removeClass("nojs").animate({left:"8px"}, 300, function(){
		    $(this).children(".slogan").animate({marginTop:"-38px"}, 300)
		
		});
	
	$('.social li').live('mouseover',function(){
				$(this).stop().animate({top:'-4px'},200,function(){$(this).animate({top:3},100, function(){$(this).animate({top:0},50)})})
			});
	$('.head_soc li a').live('mouseenter',function(){
				$(this).children('img').stop().animate({top:'-4px'},200);
				$(this).next('span').stop().animate({bottom:'-4px'},200);
			});
	$('.head_soc li a').live('mouseleave',function(){
				$(this).children('img').stop().animate({top:0},200);
				$(this).next('span').stop().animate({bottom:0},200);
			});
			
			
	$(".newsletterKommun").click(function()
	{
		$.post("mailbot.php", { email: $("#newsletterKommun").val(), subject: "Nyhetsbrev Kommun" });
		alert("ditt mail har skickats");

	});
	
	$(".newsletterVardhem").click(function()
	{
		$.post("mailbot.php", { email: $("#newsletterVardhem").val(), subject: "Nyhetsbrev vårdhem"});
		alert("ditt mail har skickats");

	});
	
	$("#contact").click(function()
	{
		
		$.post("/services.php", $("#contact_form").serialize());
		alert("ditt mail har skickats");
		
	});

	$(".email").focus(function()
	{
		var text = $(this).val();		
		if(text == "Din e-mail") $(this).val("");
	});
		
	$(".email").blur(function()
	{
		var text = $(this).val();
		if(text == "") $(this).val("Din e-mail");
	});

	$(".cbxMeta").click(function(){
		
		if(!$(this).attr("checked"))
		{
			$("#adminForm").append("<input type=\"hidden\" name=\""+$(this).attr("name")+"\" value=\"\" />");	
		}
	});
	$(".toggle").hide();
		
		$(".detailToggle").click(function() {
		  var next = $(this).closest("tbody").next();
		  next.toggle();
	  $(this).find("span").html( next.is(":visible") ? "-" : "+");
	$(".log").toggle(
	function(){
		$(this).css("height","20px");
		$(this).css("overflow","hidden");
		},
	function(){
		$(this).css("height","auto");
		$(this).css("overflow","visible");
	});
});

});
function log(text)
{
	$(".log").append("<p>"+text+"</p>");
}
