/*
	CUSTOM BBCODE
*/
function editor(code) {
	var pretext = document.form.message.value;
	this.code = code;
	document.form.message.value = pretext + code;
}

/*
	DELETE ALERT
*/
function confirmDelete(delUrl) {
	if (confirm("Are you sure you want to delete?")) {
		document.location = delUrl;
	}
}

/*
	DELETE & SPAM
*/
$(document).ready(function() {
	$('a.talk-delete').click(function(e) {
		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=talk',
			data: 'ajax=1&talk-delete=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
$(document).ready(function() {
	$('a.talk-spam').click(function(e) {
		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=talk',
			data: 'ajax=1&talk-spam=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
$(document).ready(function() {
	$('a.com-spam').click(function(e) {
		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=post',
			data: 'ajax=1&com-spam=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
$(document).ready(function() {
	$('a.com-delete').click(function(e) {
		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=post',
			data: 'ajax=1&com-delete=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
$(document).ready(function() {
	$('a.rcom-spam').click(function(e) {

		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=post',
			data: 'ajax=1&rcom-spam=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
$(document).ready(function() {
	$('a.rcom-delete').click(function(e) {
		e.preventDefault();
		var parent = $(this).parent("span").parent("div").parent("div");
		$.ajax({
			type: 'post',
			url: '/index.php?page=post',
			data: 'ajax=1&rcom-delete=' + parent.attr('id').replace('record-',''),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.slideUp(300,function() {
					parent.remove();
				});
			}
		});
	});
});
// SHOW / HIDE REPLY
// basic show and hide
function toggle_visibility(id) {
	var e = document.getElementById(id);
	if(e.style.display == 'block')
		e.style.display = 'none';
	else
		e.style.display = 'block';
}


