var customiseShow;
var editsigShow;

function showPostCustomse () {
	if (customiseShow=='yes') {
		return;
	}
	if (editsigShow == 'yes') {
		editsigShow='no';
		Effect.BlindUp('editSignature');
	}
	customiseShow='yes';
	Effect.BlindDown('customisePost', {queue: 'end'});
}

function showEditSignature () {
	if (editsigShow=='yes') {
		return;
	}
	if (customiseShow=='yes') {
		customiseShow='no';
		Effect.BlindUp('customisePost');
	}
	editsigShow='yes';
	Effect.BlindDown('editSignature', {queue: 'end'});
}

///////////////////\\\\\\\\\\\\\\\

function savePostCustomisation () {
	var font = $F('font');
	var colour = $F('fontColour');
	var align = $F('align');
	var size = $F('size');
	var ignore = $F('ignore');
	var obj = $('customiseSaveButton');
	obj.innerHTML="<img SRC=\""+imagesurl+"/forums/loading.gif\" align=\"absmiddle\"> <span style=\"font-size: 10px;\">Saving</span>";
	var R = new Ajax.Request(site_url+"/forums.php?act=customiseUpdate", {parameters: 'ignore='+ignore+'&font='+font+'&align='+align+'&size='+size+'&colour='+colour, onSuccess: postCustomise_response, onFailure: ajaxError});
}

function postCustomise_response (r) {
	var result = r.responseText;
	if (result == 'true') {
		resetCustomisationSaveButton();
	} else {
		alert("Couldn't save your post customization settings - "+result);
		resetCustomisationSaveButton();
	}
}

function resetCustomisationSaveButton () {
	var obj = $('customiseSaveButton');
	obj.innerHTML='<input type="submit" value="save" onClick="return savePostCustomisation();" style="vertical-align: middle;">';
}

///////////////////\\\\\\\\\\\\\\\\

function saveSig () {
	var signature = $('signature').value;
	var obj = $('saveSignatureButton');
	obj.innerHTML="<img SRC=\""+imagesurl+"/forums/loading.gif\" align=\"absmiddle\"> <span style=\"font-size: 10px;\">Saving</span>";
	var R = new Ajax.Request(site_url+"/forums.php?act=changeSig", {parameters: 'signature='+signature, onSuccess: saveSig_response, onFailure: ajaxError});
}

function saveSig_response (r) {
	var result = r.responseText;
	if (result == 'true') {
		resetSigSaveButton();
	} else {
		alert("Couldn't save your signature changes - "+result);
		resetSigSaveButton();
	}
}

function resetSigSaveButton () {
	var obj = $('saveSignatureButton');
	obj.innerHTML='<input type="submit" value="save" onClick="return saveSig();" style="vertical-align: middle;">';
}

///////////////////\\\\\\\\\\\\\\\\

function showPost (postid) {
	if ($('post_'+postid+'_hidbyuser')) new Effect.SlideUp('post_'+postid+'_hidbyuser');
	if ($('post_'+postid+'_hidbyrating')) new Effect.SlideUp('post_'+postid+'_hidbyrating');
	new Effect.SlideDown('post_'+postid+'_show', {queue: 'end'});
	return true;
}

function negativeRating (postid) {
	var R = new Ajax.Request(site_url+"/forums.php?act=rate_post&postid="+postid+"&rating=3");
	new Effect.SlideUp('post_'+postid+'_show');
	new Effect.SlideDown('post_'+postid+'_hidbyuser', {queue: 'end'});
	$('thumbs_'+postid).innerHTML='<img SRC="'+imagesurl+'/thumbs/thumbupgray.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbopengray.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbdown.png" border="0">';
	return true;
}

function neutralRating (postid) {
	var R = new Ajax.Request(site_url+"/forums.php?act=rate_post&postid="+postid+"&rating=2");
	$('thumbs_'+postid).innerHTML='<img SRC="'+imagesurl+'/thumbs/thumbupgray.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbopen.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbdowngray.png" border="0">';
	return true;
}

function positiveRating (postid) {
	var R = new Ajax.Request(site_url+"/forums.php?act=rate_post&postid="+postid+"&rating=1");
	$('thumbs_'+postid).innerHTML='<img SRC="'+imagesurl+'/thumbs/thumbup.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbopengray.png" border="0"><img SRC="'+imagesurl+'/thumbs/thumbdowngray.png" border="0">';
	return true;
}

