// JavaScript Document
$(document).ready(function(){
						   
	$(".tabs").tabs();
	
  $("#visKontaktinformasjon").click(function(){		
    $("#kontaktinformasjon").toggle("show");
  });
		
  $("#kontaktinformasjonLukk").click(function(){
	$("#kontaktinformasjon").hide("slow");
  });
		
  //anchor.init();
});

function facebook_share() {
	url=location.href;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url),'sharer','toolbar=0,status=0,width=600,height=400');
	return false;
}

function nettby_share(){
  url=location.href;
	window.open('http://www.nettby.no/user/edit_link.php?url=encodeURIComponent(url)','sharer','toolbar=0,status=0,width=450,height=430');
	return false;
	
}

function tooltip(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

anchor = {
	init : function()  {
		$("a.anchorLink").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
		  	return false;
		})
	}
}

open_new = {
  init: function(){
   	//$("a[@href^='http']").click(function(){window.open(this.href); return false;});
  }	
}
