// JavaScript Document
var $j = jQuery.noConflict();
$j(document).ready(function(){
	$j(".siteselector li").hover(
	  function () {
		$j(this).children(".title").stop(true, false).animate({"backgroundColor": "#ffffff"}, 300);
		$j(this).children("ul").stop(true, false).animate({"height": "200"}, 300);
	  }, 
	  function () {
		$j(this).children(".title").stop(true, false).animate({"backgroundColor": "#e4e4e4"}, 300);
		$j(this).children("ul").stop(true, false).animate({"height": "0"}, 300);
	  }
	);
	/* set the sidebar the right height */
	var sidebarH = $j("#sidebar .upper").height();
	$j("#sidebar").height(sidebarH+359);
	
	$j("#header").animate({"top": "+=50px"}, "slow");
	$j(".homepage .cycle").cycle();
	$j(".search-results .faq-question:last").addClass("faq-question-last");
	$j(".referenties .item,.seopage-inschrijven,.page .right .teaserblock,.home .teaser,.buttonbox").corner();		

	/* fancyboxes */
	$j(".faq-link").click(function(){
		var boxUrl = $j(this).attr("href");
		window.location="#"+boxUrl;
		$j.fancybox({
			'overlayShow' : true,
			'titleShow'	: false,
			'overlayColor' : '#000000',
			'overlayOpacity' : 0.2,
			'speedIn' : 500,
			'speedOut' : 0,
			'href' : boxUrl
		});
		return false;
	});
	var popHash = window.location.hash;
	if(popHash){
		var boxToOpen = popHash.replace("#","");
		$j.fancybox({
			'overlayShow' : true,
			'titleShow'	: false,
			'overlayColor' : '#000000',
			'overlayOpacity' : 0.2,
			'speedIn' : 500,
			'speedOut' : 0,
			'href' : boxToOpen
		});	
	}		
	$j(".ov-link").fancybox({
		'overlayShow' : true,
		'titleShow'	: false,
		'overlayColor' : '#000000',
		'overlayOpacity' : 0.2,
		'speedIn' : 500,
		'speedOut' : 0,
		'type' : 'iframe',
		'width' : 396,
		'height' : 526
	});
	$j('#tabs').tabs();
	$j('#tabs #ouders .item:last').addClass('last');
	$j('#tabs #docenten .item:last').addClass('last');
	$j('#tabs #studenten .item:last').addClass('last');
	//$j('#tabs ul li a').click(function () {location.hash = "";}); // disable the #hash functionlity in the url because it's fighting with the popHash (FAQ) function
	
	$j(".pagephotocycle").cycle({ 
		speed:  3500,
		timeout: 3500,
		autostop: 3
	});

});
