//top link onderaan
/*
$(document).ready(function(){
	$(".top").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();

		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;

		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];

		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;

		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});
*/

function LoadNLPopup()
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("/windows/buitenland-NL.html").slideDown();
}
function LoadBEPopup()
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("/windows/buitenland-BE.html").slideDown();
}


// Sluiten
function sluiten()
{
	$("#windowCntr").fadeOut().remove();
}

// Laad voorwaarden
function voorwaarden(ID)
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("windows/voorwaarden.php?id="+ID).slideDown();
}

// Laad registratie
function registratie()
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("windows/registreren.php").slideDown();
}

function loginform()
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("windows/login.php").slideDown();
}


function resetPassword()
{
	$("#windowCntr").remove();
	$("<div></div>").appendTo("#mainCntr").load("windows/resetpassword.php").slideDown();
}

$(document).ready(function()
{  
	// RSS menu
	$(".topBox li a.rss").click(function(){
		if($(this).hasClass("showing"))
		{
			$(this).removeClass("showing");
			$(".topBox li.rss ul").hide();
		}
		else
		{
			$(this).addClass("showing");
			$(".topBox li.rss ul").show();
		}
		
		return false;
	});
	
	// Toon alles
	//$(".watBox p a.all, .linkBox p a.all, .mijnBox p a.all").click(function(){
	$(".watBox p a.all, .linkBox p a.all, .mijnBox p a.all, .checkBox p a.all").click(function(){
		if($(this).hasClass("showing"))
		{
			$(this).removeClass("showing");
			$(this).text("Toon alles");
			//$(this).parent().parent().find("ul.hide").hide();
			$(this).parent().parent().find("ul.hide").slideToggle("slow");
		}
		else
		{
			$(this).addClass("showing");
			$(this).text("Verbergen");
			$(this).parent().parent().find("ul.hide").slideToggle("slow");
			//$(this).parent().parent().find("ul.hide").show();
		}
		return false;
	});
	

	// Login scherm
	$(".topBox li.login a").click(function(){
		$("#windowCntr").remove();
		$("<div></div>").appendTo("#mainCntr").load("windows/login.php").slideDown();
		
		return false;
	});
	$(".LoginLink").click(function(){
		///////////scrol naar boven
		$('html, body').animate({scrollTop:0}, 500);
		
		$("#windowCntr").remove();
		$("<div></div>").appendTo("#mainCntr").load("windows/login.php").slideDown();
		return false;
	});
	
	// Registratie scherm
	$(".topBox li.reg a").click(function(){
		$("#windowCntr").remove();
		$("<div></div>").appendTo("#mainCntr").load("windows/registreren.php").slideDown();
		
		return false;
	});
	
	// Tab menu
	$(".tabBox ul.tabs li a").click(function(){
		if($(this).hasClass("selected"))
		{
			return false;
		}
		else
		{
			if($(this).parent().attr("class") == "gratis")
			{
				$(".tabBox div.spel").hide();
				$(".tabBox ul.tabs li a").removeClass("selected");
				
				$(this).addClass("selected");
				$(".tabBox div.gratis").show();
			}
			else
			{
				$(".tabBox div.gratis").hide();
				$(".tabBox ul.tabs li a").removeClass("selected");

				$(this).addClass("selected");
				$(".tabBox div.spel").show();
			}
			
			return false;
		}
	});
/*
	// Intro uitklap
	$(".introBox p.close a").click(function(){
		//$(".introBox p.close").hide();
		//$(".introBox p.open").show();
		$(".introBox p.close").slideToggle("slow");
		$(".introBox p.open").slideToggle("slow");
		return false;
	});
	
	$(".introBox p.open a").click(function(){
		//$(".introBox p.open").hide();
		//$(".introBox p.close").show();
		$(".introBox p.close").slideToggle("slow");
		$(".introBox p.open").slideToggle("slow");
		return false;
	});

*/
	// Intro uitklap
	$(".introBox p.close span.meer a").click(function(){
		//$(".introBox p.close").hide();
		//$(".introBox p.open").show();
		$(".introBox span.meer").hide();
		$(".introBox span.open").show();
		//$(".introBox span.open").slideToggle("slow");
		return false;
	});
	
	$(".introBox p.close span.open span.minder a").click(function(){
		//$(".introBox p.open").hide();
		//$(".introBox p.close").show();
		$(".introBox span.meer").show();
		$(".introBox span.open").slideToggle("slow");
		return false;
	});






// 18+ tooltip
	$("span.age").hover(function(){
		/*$(this).append("<em>Voor deze prijsvraag moet je min. 18 jaar zijn.<br />Vraag een volwassene om je te helpen.</em>");*/
		$(this).append("<em>Voor deze prijsvraag moet je min. 18 jaar zijn.</em>");
	},function(){
		$("span.age em").remove();
	});
	
	// URL tooltip
	$(".prijsBox td a, .popBox td a, .resBox td a").hover(function(){
		if($(this).attr("rel") != "")
		{
			$(this).append("<span class='tooltip'><span>" + $(this).attr("rel") + "</span></span>");
		}
	},function(){
		$("table td a span.tooltip").remove();
	});
});
