
function confirmDeletion(text) {
	(text) ? text = "'"+text+"'" : text = 'this object';
	return confirm("Are you sure you wish to delete "+text+" ?");
}




function refreshAfterDelete(content,contentid,itemclass,itemid) {
	if (confirmDeletion()) {}
	else {return false;}

	var url = '?content='+content;
	var pars = 'action=delete&c='+itemclass+'&o='+itemid+'&id='+contentid;

	var myAjax = new Ajax.Request(url,{method: 'post',parameters: pars,onComplete: showComment});

	return false;
}

/*
function getPoll(request) {
	var pars	= 'content='+site_id+'_poll&'+request;
	var url 	= '?xml=true&amp;';

	var myAjax = new Ajax.Request(url,{method: 'get',parameters: pars,onLoading: loadingPoll,onComplete: processPoll});

	return false;
}
*/


function loadingPoll() {
	new Effect.Opacity('pollblock', {duration:0.5, from:1.0, to:0.0});
}

function processPoll(originalRequest) {
//	alert(originalRequest.responseText);
	processActions(originalRequest);
	processErrors(originalRequest);

	var polls = originalRequest.responseXML.getElementsByTagName("poll");
	new Effect.Opacity('pollblock', {duration:0.5, from:0.0, to:1.0});
	$('pollblock').innerHTML = kloonhtml(polls[0]);

//	Effect.DropOut('kalender');
//	Effect.BlindDown('kalender', {scaleX: true, scaleY: false, duration:3});
}



function showPostingComplete(originalRequest) {
//	alert(originalRequest.responseText);
	$('guestentry_posting').hide();
	$('guestentry_successposting').show();

	var posts		= originalRequest.responseXML.getElementsByTagName("post");
	var text		= posts[0].childNodes[0].firstChild.nodeValue;
	var creator		= posts[0].childNodes[1].firstChild.nodeValue;
	var datetime	= posts[0].childNodes[2].firstChild.nodeValue;
	var blogid		= posts[0].childNodes[3].firstChild.nodeValue;

	$('base_creator').update(creator);
	$('base_text').update(text);
	$('base_date').update(datetime);

	var html = $('baseEntry').innerHTML;
	new Insertion.Top('BlogEntries'+blogid,html);

	setTimeout("$('guestentry_successposting').hide",1500);
}

function showPostingActivity(originalRequest) {
	$('guestentry_posting').show();
}


function sendPost(form) {
	var pars	= 'as=true&amp;'+Form.serialize(form);

	form.reset();
	$('BlogAddComment'+form.elements.Blogitem_topic_id.value).style.display='none';
//	var url = './xml.php?content={site_id}_send_message';
	var url = '?content='+site_id+'_send_message';

	var myAjax = new Ajax.Request(url,{method: 'post',parameters: pars,onLoading: showPostingActivity,onComplete: showPostingComplete});

	return true;
}

function sendComment(form) {
	var pars	= Form.serialize(form);
	form.reset();
	var url = '?content='+site_id+'_photocomments';
		
	var myAjax = new Ajax.Request(url,{method: 'post',parameters: pars,onComplete: showComment});

	return true;
}

function showComment(originalRequest) {
	processActions(originalRequest);

	photoid = originalRequest.responseXML.getElementsByTagName('photoid');
	comments = originalRequest.responseXML.getElementsByTagName('photocomments');

	html = $('comments'+photoid[0].firstChild.nodeValue);
	html.innerHTML = '';
	html.innerHTML = kloonhtml(comments[0]);
}
