	function clickPublish(q){
		p=document.getElementById('publish');
		if(q.checked){
			p.style.visibility='visible';
			today=new Date();
			m=today.getMonth()+1;
			if(m<10)
				m='0'+m;
			d=today.getDate();
			if(d<10)
				d='0'+d;
			document.forms.weblogForm.publish_date.value=d+"-"+m+"-"+today.getFullYear();
		}else{
			p.style.visibility='hidden';
			document.forms.weblogForm.publish_date.value='00-00-0000';
		}
	}
	
	function clickArchive(q){
		p=document.getElementById('archive');
		if(q.checked){
			p.style.visibility='visible';
			today=new Date();
			m=today.getMonth()+1;
			if(m<10)
				m='0'+m;
			d=today.getDate();
			if(d<10)
				d='0'+d;
			document.forms.weblogForm.archive_date.value=d+"-"+m+"-"+today.getFullYear();
		}else{
			p.style.visibility='hidden';
			document.forms.weblogForm.archive_date.value='00-00-0000';
		}
	}

	function updateWeblog(){
		document.forms['weblogForm'].submit();
	}


	function selectImage(path,img){
		p=document.getElementById('weblogImage');
		p.src=path+'_thumbs/'+img;
		document.forms.weblogForm.image_url.value=path+img;
		disablePopup();
	}


	tinyMCE.init({
		editor_selector : "editor_body",
		mode : "textareas",
		theme : "advanced",
		plugins : "spellchecker,style,table,save,advhr,advimage,advlink,media,searchreplace,contextmenu,paste,filemanager",
		theme_advanced_buttons1_add : "print,forecolor,backcolor,fontsizeselect",
		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 : "spellchecker,media",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_default_background_color : "#000000",
		theme_advanced_default_text_color : "#fff",
		content_css: "/css/editorarea.css",		
		external_link_list_url : "artistlist.php",
		theme_advanced_styles : "Afbeelding links=leftimage;Afbeelding rechts=rightimage",
		external_link_list_url : "artistlist.php",
	    plugin_insertdate_dateFormat : "%d-%m-%Y",
	    plugin_insertdate_timeFormat : "%H:%M:%S",
		extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],p[lang]",
		theme_advanced_resize_horizontal : false,
		theme_advanced_resizing : true,
		apply_source_formatting : true,
		spellchecker_languages : "+Dutch=nl,English=en"
	});




/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){

	//LOADING POPUP
	//Click the button event!
	$("#button").click(function(event){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
		event.preventDefault()
	});
				
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

});