function popupImageWindow(width,height) {

	height = height + 20;
	width = width;

	window.open('','image_popup','width=' + width + ',height=' + height);
}

function confirmCommentDelete() {

	return confirm('Are you sure you want to delete this comment?');
}

function showElement(id) {
	document.getElementById(id).style.display = 'block';	
}

function hideElement(id) {
	document.getElementById(id).style.display = 'none';
}

function showCommentEditBox(comment_id) {

	showElement('comment_edit_' + comment_id);
	hideElement('comment_view_' + comment_id);
	hideElement('comment_edit_button_' + comment_id);
	//showElement('comment_save_button_' + comment_id);
	hideElement('comment_options_' + comment_id);

	// stop link being followed
	return false;
}

/* setup events to be run on page load */
function setupEvents() {

	/* highlight currently anchored comment (if any), e.g. #comment_25 */
	var location_href_parts = document.location.href.split('#');
	
	// is there an anchor in the URL
	if(location_href_parts[1] != undefined) {
	
		var anchor_name = location_href_parts[1].toString();

		if(anchor_name.length > 0) {
			document.getElementById(anchor_name).className += ' comment-selected';
		}
	}
}

window.onload = setupEvents;