var EffectSpeed = 500;

//--Als er op het input veld geklikt wordt, zal de tekst die erin staat verdwijnen, als je er uit gaat en er is nog steeds een tekst ingegeven, dan komt het vorige woord terug.
(function($)
{
	$.fn.emptyInputField = function(options)
	{
		var strValue =  $(this).attr("value");

		$(this).focus(function()
		{
			if($(this).attr("value") == strValue && strValue != "")
			{
				$(this).attr("value","");
			}
		});

		$(this).blur(function()
		{
			if($(this).attr("value") == "")
			{
				$(this).attr("value", strValue);
			}
		})

	};
})(jQuery);



//fancybox
jQuery(document).ready(function() {

	$("a.fancy").fancybox({'titlePosition'  : 'inside'});
});


function html_entity_decode(str)
{
	try
	{
		var  tarea=document.createElement('textarea');
		tarea.innerHTML = str;
		return tarea.value;
		tarea.parentNode.removeChild(tarea);
	}
	catch(e)
	{
		//for IE add<div id="htmlconverter" style="display:none;"></div> to the page
		document.getElementById("htmlconverter").innerHTML = '<textarea id="innerConverter">' + str + '</textarea>';
		var content = document.getElementById("innerConverter").value;
		document.getElementById("htmlconverter").innerHTML = "";
		return content;
	}
}

/*function html_entity_decode(str)
{
var ta = document.createElement("textarea");
//console.log(str);
	ta.innerHTML = str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
	//console.log(ta.innerHTML);
	//console.log(ta.value);
	return ta.value;
}*/


/**
*	Functie wordt gebruikt om eenzelfde animatie te gebruiken om elementen te animeren.
*/
function ChangeValue(strId,strValue)
{
	if($("#" + strId).text() != strValue)
	{
		$("#" + strId).fadeOut(EffectSpeed,function()
		{
			$(this).text(strValue);
			$(this).fadeIn();
		});
	}
}

/**
*	Functie wordt gebruikt om eenzelfde animatie te gebruiken om elementen te animeren.
*/
function ChangeValueHtml(strId,strValue)
{
	if($("#" + strId).text() != strValue)
	{
		$("#" + strId).fadeOut(EffectSpeed,function()
		{
			$(this).html(strValue);
			$(this).fadeIn();
		});
	}
}


/**
*	Standaard alle links met # false laten returnen zodat er niet naar boven gegaan wordt
*/

$(document).ready(function()
{
	$("a[href=#]").click(function()
	{
		return false;
	})

	$("a[rel=external]").click(function()
	{
		$(this).attr("target", "_blank");
	})
});


//-- Fake Anchor link with jquery
function goToByScroll(id)
{  
     $('html,body').animate({scrollTop: $("#"+id).offset().top},'fast');  
} 


//you tube filmpjes
function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<div style="width:100%;text-align:center;"><object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<param name="wmode" value="opaque">';
	h += '<embed  wmode="opaque" type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object></div>';

	document.write(h);
}

