function postMessage(){
	new Ajax.Request(url+'post_comment.php',{parameters:$H($('postform').serialize(true)).toQueryString()+'&item_id='+id+'&q='+n+'&k='+k,onComplete:function(r){
		if(Number(r.responseText)==r.responseText){
			document.location.reload();
		} else {
			alert(r.responseText);
		}
	}});
};
function submitSearch(kw){
	document.location.replace('/?q=zoeken&kw='+escape(kw));
};
function detectEnter(e,func){
	var characterCode;
	if(e && e.which){
		e = e;
		characterCode = e.which;
	}
	else {
		e = event;
		characterCode = e.keyCode;
	}
	if (characterCode == 13) func();
};
var num13 = 0;
function loadCover(id,index,color){
	if(num13!=id){
		num13 = id;
		new Ajax.Updater('image',url+'get_cover_image.php?id='+id);
		$('num').style.backgroundColor = color;
		$('num').innerHTML = index;
	}
};
function fadeThumb(elem,fadeIn){
	Element.setOpacity(Element.extend(elem),(!fadeIn?1.0:0.5));
};
function contactAuthor(id){
	var dialog_html = '<table class="contact"><tr><th>Naam</th><td><input type="text" name="name" /></td></tr>';
	dialog_html += '<tr><th>Email</th><td><input type="text" name="email" /></td></tr>';
	dialog_html += '<tr><th>Bericht</th><td><textarea name="message"></textarea></td></tr></table>';
	
	var d = new Dialog('Bericht verzenden aan auteur',{html:dialog_html});
	d.addButton({label:'Verzenden',callback:function(){
		var data 	= this.getInputData();
		data.k 		= k;
		data.u		= id;
		
		this.showProgress();
		this.disableControls();
		new Ajax.Request(url+'email.php?type=1',{parameters:$H(data).toQueryString(),onComplete:function(r){
			d.hideProgress();
			d.enableControls();
			if(!r.responseText){
				alert('Het bericht is succesvol verzonden.\nU krijgt spoedig een reactie.');
				d.close();
			} else {
				alert(r.responseText);
			}
		}});
	},id:'btn_submit'});
	d.show();
};
function showPrivacy(){
	new Ajax.Request(url+'privacy.html',{onComplete:function(req){
		new Dialog('Privacy',{html:req.responseText}).show();
	}});
};
function showPolicy(){
	new Ajax.Request(url+'gebruiksvoorwaarden.html',{onComplete:function(req){
		new Dialog('Gebruiksvoorwaarden',{html:req.responseText}).show();
	}});
};
function sendLink(id){
	var dialog_html = '<table class="contact send_link"><tr><th>Mijn naam</th><td><input type="text" name="my_name" /></td></tr>';
	dialog_html += '<tr><th>Mijn email</th><td><input type="text" name="my_email" /></td></tr>';
	dialog_html += '<tr><th>Naam ontvanger</th><td><input type="text" name="his_name" /></td></tr>';
	dialog_html += '<tr><th>Email ontvanger</th><td><input type="text" name="his_email" /></td></tr></table>';
	
	var d = new Dialog('Link versturen',{width:330,html:dialog_html});
	d.addButton({label:'Verzenden',callback:function(){
		var data 	= this.getInputData();
		data.k 		= k;
		data.u		= id;
		
		this.showProgress();
		this.disableControls();
		new Ajax.Request(url+'email.php?type=2',{parameters:$H(data).toQueryString(),onComplete:function(r){
			d.hideProgress();
			d.enableControls();
			if(!r.responseText){
				alert('Het bericht is succesvol verzonden.');
				d.close();
			} else {
				alert(r.responseText);
			}
		}});
	},id:'btn_submit'});
	d.show();
};
function popup(u,width,height){
	var sw = screen.availWidth;	
	var sh = screen.availHeight;
	var l = (sw-width)/2;
	var t = (sh-height)/2;
	var win = window.open(u,'popwin','width='+width+',height='+height+',left='+l+',top='+t+',resizable=yes,scrollbars=no,location=no,status=no,screenX='+l+',screenY='+t+',');
	win.focus();
};
