jQuery(document).ready(function () {

	// Target blank
	$('a[class^="external"]').click(function () {
		this.target = "_blank"
	});
	
   //toggle
  $(".hideaway1").hide();
	$(".hideaway2").hide();
	$(".hideaway3").hide();
	$(".hideaway4").hide();
	$(".hideaway5").hide();
	$(".hideaway6").hide();
	
  $('h3.title_faq1').click(function() {
		
    	$(this).parent().children('div.hideaway1').toggle(300);

    	return false;
  	});
  	
  	$('h3.title_faq2').click(function() {
		
    	$(this).parent().children('div.hideaway2').toggle(300);

    	return false;
  	});
  	
  	$('h3.title_faq3').click(function() {
		
    	$(this).parent().children('div.hideaway3').toggle(300);

    	return false;
  	});
  	
  	$('h3.title_faq4').click(function() {
		
    	$(this).parent().children('div.hideaway4').toggle(300);

    	return false;
  	});
  	
  	$('h3.title_faq5').click(function() {
		
    	$(this).parent().children('div.hideaway5').toggle(300);

    	return false;
  	});
  	
  	$('h3.title_faq6').click(function() {
		
    	$(this).parent().children('div.hideaway6').toggle(300);

    	return false;
  	});
  	
  $("div.hideaway").hide();
  $("h3.title.faq").click(function(){
    $(this).parent().next("span").toggle();
    return false;
  });
  
  $("dd.content").hide();
  $("dt.toggle a").click(function(){
    $(this).parent().next("dd").toggle();
    return false;
  });
	
	$('a[class="iframehyp"]').each(
	function (i) {
		$(this).replaceWith("<iframe src='" + this.getAttribute("href") + "' frameborder='0' scrolling='no' width='525' height='700'></iframe>");
	});
	

		
		$("#rentetable, #rentetable2, #rentetable3, #rentetable4").tablesorter({
		  widgets: ['zebra'],
		  sortList: [[1,1]]
		}); 

		$('#ss_rentetool_settings .select_all').click(function(){
			var $status = $(this).attr('checked');
			if ($status){
				$('input[class*=organisationcheckbox]').attr('checked', 'checked');
			}
			else {
				$('input[class*=organisationcheckbox]').removeAttr('checked');
			}
		});

			  $('#ss_rentetool_settings .select_hypotheekvorm').click(function(){
			    $('#form_hypotheekvorm p').toggle();
			  });

		//sorteren van rentetool spotlight
		$('.sorteer th').click(function(){
			var $sortcol  = $(this).attr('id');
			var $sortdir  = $(this).attr('class');

			$('#input_sortcol').attr('value',$sortcol);
			$('#input_sortdir').attr('value',$sortdir);
			$('#form_hypotheekvorm').submit();
		});

	
	
	
	
});



	
// Tab Slideout
$(function()
{
	$('.slide-out-div').tabSlideOut(
	{
		tabHandle: '.handle',                                   //class of the element that will be your tab
		pathToTabImage: '/interactive/images/ff/showcases.png', //path to the image for the tab (optionaly can be set using css)
		imageHeight: '175px',                                   //height of tab image
		imageWidth: '45px',                                     //width of tab image
		tabLocation: 'left',                                    //side of screen where tab lives, top, right, bottom, or left
		speed: 400,                                             //speed of animation
		action: 'click',                                        //options: 'click' or 'hover', action to trigger animation
		topPos: '120px',                                        //position from the top
		fixedPosition: true                                     //options: true makes it stick(fixed position) on scroll
	});
});

//Darkness
function fadetoblack()
{
	if(document.getElementById('lights-out').className == 'darkness')
	{
		document.getElementById('lights-out').className = '';
	}
	else
	{
		document.getElementById('lights-out').className = 'darkness';
	}
}
