var diashow_obj = null;

jQuery(function($) {	
	if($(document).height() > $(window).height()) {
		oHeight = $(document).height()
	} else {
		oHeight = $(window).height();	
	}
	
	$('#doc-box').css({ height: oHeight});
	
	
	$("input[value!=''][type!='submit']").focus(function () { 
		if(!$(this).attr("startvalue")) {  
			$(this).attr("startvalue", $(this).val());
		} 
		if($(this).val() == $(this).attr("startvalue")) {
			$(this).val('');	
		}
	});
	$("input[value!='']").blur(function () { 
		if($(this).val() == '') {
			$(this).val($(this).attr("startvalue"));
		}
	});
	
	
	$('#faq dt a').click(function() {
		if($(this).parent().attr("open") != 1) {
			$('#faq dt[open=1]').attr("open",0)
			$('#faq dd[open=1]').attr("open",0).slideUp("slow"); 
			$(this).parent().attr("open",1);	
			$(this).parent().next().height(getHeight($(this).parent().next().html()));
			$(this).parent().next().attr("open",1);	
			$(this).parent().next().slideDown("slow");	
		} else {
			$(this).parent().attr("open",0);		
			$('#faq dd').slideUp("slow"); 
		}
	});
	
	if ($('a.bladertool').fancybox) {
		$('a.bladertool').fancybox({
			'width'				: 827,
			'height'			: 680,
			'autoScale'			: false,
			'autoDimensions'	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'scrolling'			: 'no',
			'type'				: 'iframe'
		});
	}
});

function sluit_popup() {
	if (parent.$.fancybox) {
		parent.$.fancybox.close();
	} else {
		window.close();
	}
}

function getHeight(content) {
	$('<div></div>').attr({ id: 'dd_height' })
		.css({
			position: 'absolute',
			top: -10000,
			left: -10000,
			width: '440px',
			zIndex: '9999',
			padding: '8px 10px'
		}).appendTo('body')
	$('#dd_height').html(content);
	oHeight = $('#dd_height').height();
	$('#dd_height').remove()
	return oHeight+16;
		
}

/*
 * Flash object ophalen (alle browsers)
 */ 
function get_flash_obj(movie_id) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movie_id] : document[movie_id];
}

function diashow_ga_naar(item) {
	if (diashow_obj == null) {
		diashow_obj = get_flash_obj('Stek_diashow_swf');
	}
	diashow_obj.ga_naar_dia(item);
}

$(document).ready(function(){
	var flashvars = {};
	var params = {};
	params.menu = "false";
	params.quality = "best";
	params.wmode = "transparent";
	params.bgcolor = "#FFFFFF";
	params.allowfullscreen = "false";
	params.allowscriptaccess = "sameDomain";
	flashvars.xml_file = '/xml/diashow.xml.php';
	var attributes = {};
	attributes.id = "Stek_diashow_swf";
	attributes.name = "Stek_diashow_swf";
	swfobject.embedSWF("/swf/Stek_diashow.swf", "diapresentatie", "370", "370", "8.0.0", "/swf/expressInstall.swf", flashvars, params, attributes);
});


function open_nieuwsbrief(nb_ovz_id) {
	myleft=(screen.width)?(screen.width-500)/2:100;
	mytop=(screen.height)?(screen.height-500)/2:100;
	
	window.open('/newsletters/newsletter_'+nb_ovz_id+'.html', 'nieuwsbrief', 'width=500,height=500,scrollbars=1,top='+mytop+',left='+myleft);
}

