
tinyMCE.init({
	// General options
	mode : "specific_textareas",
	editor_selector : "mceEditor",
	theme : "advanced",
	plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,filemanager",

	// Theme options
	theme_advanced_buttons1_add_before : "save,newdocument,separator",
	theme_advanced_buttons1_add : "fontselect,fontsizeselect",
	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
	theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
	theme_advanced_buttons3_add_before : "tablecontrols,separator",
	theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile",

	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "none",
	theme_advanced_resizing : true,

	// Example content CSS (should be your site CSS)
	//content_css : "css/content.css",

	// Drop lists for link/image/media/template dialogs
	template_external_list_url : "lists/template_list.js",
	external_link_list_url : "lists/link_list.js",
	external_image_list_url : "lists/image_list.js",
	media_external_list_url : "lists/media_list.js",

	// Replace values for the template plugin
	template_replace_values : {
	username : "Some User",
	staffid : "991234"
	},

	forced_root_block : false,
	force_br_newlines : true,
	force_p_newlines : false         
});

function initialize()
{
	var browser = "";
	if (!document.all)
	{
		browser = navigator.appName + " " + navigator.userAgent;
	}
	else
	{
		var version=/MSIE \d+.\d+/
		browser = navigator.appName + " " + navigator.appVersion.match(version);
	}
	
	if(browser=="Microsoft Internet Explorer MSIE 6.0")
	{
		document.getElementById('reclame-top-left').innerHTML = '<img src="images/reclame-top-left.gif" width="8" height="8">';
		document.getElementById('reclame-top-right').innerHTML = '<img src="images/reclame-top-right.gif" width="8" height="8">';
		document.getElementById('reclame-bottom-left').innerHTML = '<img src="images/reclame-bottom-left.gif" width="8" height="8">';
		document.getElementById('reclame-bottom-right').innerHTML = '<img src="images/reclame-bottom-right.gif" width="8" height="8">';
	}
}

function uploadit(field,folder)
{
	venster=open(folder+"/form.asp?field="+field,"venster","height=160,width=300,scrollbars=no");
	venster.focus();
}

	function goodchars(e)
	{
		var key, keychar;
		key = getkey(e);
		if (key == null) return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		goods = goods.toLowerCase();
		if (goods.indexOf(keychar) != -1)
			return true;
		if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
			return true;
			return false;
	}

function maxsamenvatting()
{
	if(document.editForm.elements['samenvatting'].value.length<400)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function preview(field,folder)
{
	if(document.editForm.elements[field].value=='')
	{
		var temp = confirm('Er is nog geen bestand aanwezig.\nWilt u nu een bestand toevoegen?');
		if(temp)
		{
			uploadit(field,folder);
		}
	}
	else
	{
		venster2=open("preview.asp?folder="+folder+"&field="+document.editForm.elements[field].value,"venster2","height=100,width=100,scrollbars=no");
		venster2.focus();
	}
}

function check_editform()
{
	if(document.editForm.elements['naam'].value=='')
	{
		document.editForm.elements['naam'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['naam'].focus();
		return false;
	}
	else if(document.editForm.elements['email'].value=='')
	{
		document.editForm.elements['email'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['email'].focus();
		return false;
	}
	else if(document.editForm.elements['samenvatting'].value=='')
	{
		document.editForm.elements['samenvatting'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['samenvatting'].focus();
		return false;
	}
}

function forgotpassword(e)
{
	var IE = document.all?true:false;
	var tempX = 0;
	var tempY = 0;
	if (IE)
	{
	    tempX = event.clientX + document.body.scrollLeft;
   		tempY = event.clientY + document.body.scrollTop;
	}
	else
	{
	    tempX = e.pageX
    	tempY = e.pageY
	}
	
	if(document.getElementById('backgrounddiv')) {
		document.getElementById('backgrounddiv').style.width = document.body.clientWidth + 'px';
		document.getElementById('backgrounddiv').style.height = document.body.clientHeight + 'px';
		document.getElementById('backgrounddiv').style.filter = 'alpha(opacity=0)';
		document.getElementById('backgrounddiv').style.opacity = '0';
		document.getElementById('backgrounddiv').style.visibility = 'visible';
	}

	if(document.getElementById('forgotpassword')) {
		document.getElementById('forgotpassword').style.filter = 'alpha(opacity=80)';
		document.getElementById('forgotpassword').style.opacity = '.80';
		document.getElementById('forgotpassword').style.left = (tempX-230);
		document.getElementById('forgotpassword').style.top = tempY + 'px';
		document.getElementById('forgotpassword').style.height = '130';
		document.getElementById('forgotpassword').style.visibility = 'visible';
		document.forgotpasswordform.email.focus();
	}
}

function closelayers()
{
	if(document.getElementById('forgotpassword')) { document.getElementById('forgotpassword').style.visibility = 'hidden'; }
	if(document.getElementById('backgrounddiv')) { document.getElementById('backgrounddiv').style.visibility = 'hidden'; }
}

function check_contactform()
{
	if(document.editForm.elements['naam'].value=='')
	{
		document.editForm.elements['naam'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['naam'].focus();
		return false;
	}
	else if(document.editForm.elements['email'].value=='')
	{
		document.editForm.elements['email'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['email'].focus();
		return false;
	}
	else if(document.editForm.elements['bericht'].value=='')
	{
		document.editForm.elements['bericht'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['bericht'].focus();
		return false;
	}
	else if(document.editForm.elements['captcha'].value=='')
	{
		document.editForm.elements['captcha'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['captcha'].focus();
		return false;
	}
}

function check_subscribeform()
{
	if(document.editForm.elements['contactnaam'].value=='')
	{
		document.editForm.elements['contactnaam'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['contactnaam'].focus();
		return false;
	}
	else if(document.editForm.elements['contactvoornaam'].value=='')
	{
		document.editForm.elements['contactvoornaam'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['contactvoornaam'].focus();
		return false;
	}
	else if(document.editForm.elements['contactemail'].value=='')
	{
		document.editForm.elements['contactemail'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['contactemail'].focus();
		return false;
	}
	else if(document.editForm.elements['contacttelefoon'].value=='')
	{
		document.editForm.elements['contacttelefoon'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['contacttelefoon'].focus();
		return false;
	}
	else if(document.editForm.elements['url'].value=='')
	{
		document.editForm.elements['url'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['url'].focus();
		return false;
	}
	else if((document.editForm.elements['subcategorieid'].options[document.editForm.elements['subcategorieid'].selectedIndex].value=='')&&(document.editForm.elements['rubrieken'].value==''))
	{
		document.editForm.elements['subcategorieid'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['subcategorieid'].focus();
		return false;
	}
	else if(document.editForm.elements['naam'].value=='')
	{
		document.editForm.elements['naam'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['naam'].focus();
		return false;
	}
	else if(document.editForm.elements['email'].value=='')
	{
		document.editForm.elements['email'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['email'].focus();
		return false;
	}
	else if(document.editForm.elements['samenvatting'].value=='')
	{
		document.editForm.elements['samenvatting'].style.backgroundColor='#ff9f9f';
		document.editForm.elements['samenvatting'].focus();
		return false;
	}
	else if(document.editForm.elements['voorwaarden'].checked==0)
	{
		document.getElementById('voorwaardentekst').style.backgroundColor='#ff9f9f';
		return false;
	}
}

function checkurl(url)
{
	xmlDoc = createXMLHttpRequest();
	xmlDoc.onreadystatechange=function()
	{
		docheckurl(xmlDoc, url)
	}
	xmlDoc.open('GET', 'website.asp?url=' + url, true)
	xmlDoc.send(null)
}

function docheckurl(xmlDoc, url)
{
	if(xmlDoc.readyState==4)
	{
		free = xmlDoc.responseText*1;
		
		if((free==0)&&(document.editForm.url.value!=''))
		{
			document.editForm.url.value = '';
			alert('Deze website werd reeds aangemeld!');
		}
	}
}

function checkdomain(domain, ext)
{
	xmlDoc = createXMLHttpRequest();
	xmlDoc.onreadystatechange=function()
	{
		docheckdomain(xmlDoc, domain, ext)
	}
	xmlDoc.open('GET', 'domain.asp?domain=' + domain + '&ext=' + ext, true)
	xmlDoc.send(null)
}

function docheckdomain(xmlDoc, domain, ext)
{
	if(xmlDoc.readyState==4)
	{
		free = xmlDoc.responseText*1;
		
		if(free!=0)
		{
			document.getElementById('domainstatus').innerHTML = '<span class="free1">Dit domein is nog vrij!</span>';
			document.getElementById('domainstatus').style.visibility = 'visible';
		}
		else
		{
			document.getElementById('domainstatus').innerHTML = '<span class="free0">Dit domein is helaas bezet.</span>';
			document.getElementById('domainstatus').style.visibility = 'visible';
		}
	}
}

function createXMLHttpRequest()
{
	var xmlDoc = null;
	try
	{
		xmlDoc = new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			xmlDoc = new ActiveXObject("Msxml2.XMLHTTP");
		}

		catch(e)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlDoc;
}