function init()
{
	tinyMCE.init({
		mode : "exact",
		elements : "desc",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,insertdate,inserttime,",
	theme_advanced_buttons3 : "tablecontrols,|,hr,visualaid,|,sub,sup,|,charmap,advhr,|,forecolor,backcolor,code",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_resizing : false,
	document_base_url : "http://www.gkci.nl",
    relative_urls : false 
	//extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	//file_browser_callback : 'myFileBrowser'
	});
}

 function myFileBrowser (field_name, url, type, win) {

     alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing

    /* If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
       the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
       These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */

    var cmsURL = window.location.toString();    // script URL - use an absolute path!
    if (cmsURL.indexOf("?") < 0) {
        //add the type as the only query parameter
        cmsURL = cmsURL + "?type=" + type;
    }
    else {
        //add the type as an additional query parameter
        // (PHP session ID is now included if there is one at all)
        cmsURL = cmsURL + "&type=" + type;
    }

    tinyMCE.activeEditor.windowManager.open({
        file : cmsURL,
        title : 'My File Browser',
        width : 420,  // Your dimensions may differ - toy around with them!
        height : 400,
        resizable : "yes",
        inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous : "no"
    }, {
        window : win,
        input : field_name
    });
    return false;
  }


function gotoAlbum(album)
{
	var url = "index.php?page=6&id="+album;

	document.location.href = url;
}

function checkForm()
{
	var error;
	var gekeurd;
		
	error = "";
		
		if (!nieuwsbrief.ontvangen.checked) {
			error = error + 'U dient aan te vinken dat u de nieuwsbrief wilt ontvangen\r\n';
			nieuwsbrief.ontvangen.focus();
			gekeurd = 0;
		}
		if ((nieuwsbrief.naam.value =='')) {

			error = error + 'U heeft geen naam ingevuld\r\n';
			nieuwsbrief.naam.focus();
			gekeurd = 0;
		}

		if ((nieuwsbrief.email.value =='')) {

			error = error + 'U heeft geen e-mailadres ingevuld\r\n';
			nieuwsbrief.email.focus();
			gekeurd = 0;

		}
		
		if(gekeurd == 0)
		{
			alert(error);
		}
		else
		{
			nieuwsbrief.submit();
		}
}

/*function checkFormGuestbook()
{
	var error;
	var gekeurd;
		
	error = "";
		
		if ((guestbook.naam.value =='')) {

			error = error + 'U heeft geen naam ingevuld\r\n';
			guestbook.naam.focus();
			gekeurd = 0;
		}

		if ((guestbook.bericht.innerHTML =='')) {

			error = error + 'U heeft geen bericht ingevuld\r\n';
			guestbook.email.focus();
			gekeurd = 0;

		}
		
		if(gekeurd == 0)
		{
			alert(error);
		}
		else
		{
			guestbook.submit();
		}
}*/

function showEditor()
{
	var content = document.getElementById("desc_ifr").contentWindow.document.body.innerHTML;
	
	objViewer = document.getElementById("viewer");
	if(objViewer.style.display == "block")
	{
		objViewer.innerHTML = "";
		objViewer.style.display = "none";
	}
	else
	{
		objViewer.innerHTML = content;
		objViewer.style.display = "block";
	}
}