var currentComicId;
var currentComicTitle;

function deleteLogo() {
	
	if(confirm("Are you sure you want to delete this logo?")) {
		document.location = 'logo.php?delete=true';
	}
		
}

function deleteComic(comicId) {

	if(confirm("Are you sure you want to delete this comic?")) {
		document.location = 'comics.php?delete=' + comicId;
	}
	
}

function deleteComicComment(comicId, comicCommentId) {
	
	if(confirm("Are you sure you want to delete this comic comment?")) {
		document.location = 'comics_comments.php?comic_id= ' + comicId + '&delete=' + comicCommentId;
	}
	
}

function testNewFont(new_font_value, test_new_font_id) {
	
	$('#' + test_new_font_id).css("font-family", new_font_value);
	$('#' + test_new_font_id).html('This is what that font looks like');
		
}

function submitComment() {
	
	var postName = document.forms.comments.name.value;
	var postComment = document.forms.comments.comment.value;
	
	if(removeWhitespace(postName) == '') {
		alert('You must enter your name');
		return false;
	} else if(removeWhitespace(postComment) == '') {
		alert('You must enter a comment');
		return false;
	} else {
		document.forms.comments.submit();
	}
}

function removeWhitespace(value) {
	return value.replace(/^\s*|\s*$/g,'');
}

function share(type) {
	
	var url = "";
	var facebookUrl = "http://www.facebook.com/sharer.php?u=<url>&t=Gallery%20Girls<title>";
	var twitterUrl = "http://twitter.com/home?status=Check%20out%20Gallery%20Girls<title>:%20<url>";
	if(type == "facebook") {
		url = facebookUrl;
	} else if(type == "twitter") {
		url = twitterUrl;
	}
	
	if(currentComicId != null) {
		
		url = url.replace("<url>", "http://www.ceceliawestgallery.com/comic.php?comic_id=" + currentComicId).replace("<title>", escape(" \"" + currentComicTitle + "\""));
		window.open(url);
		
	} else {
		
		url = url.replace("<url>", escape(window.location)).replace("<title>", "");
		window.open(url);
		
	}
	
}
