﻿
//Contact Me Methods

function ProcessSendEmail(name, email, website, comment) {
        $("#divContactForm").hide();
        $("#divThrobber").show();

		$.ajax({
    		type: "POST",
    		url: "/WebServices/ContactMe.asmx/SendMeAnEmail",
    		contentType: "application/json; charset=utf-8",
    		data: "{'name': '" + name + "','email':'" + email + "','webaddress':'" + website + "','comment':'" + comment + "'}",
    		dataType: "json",
    		success: function(msg) {
    		var results = (typeof msg.d) == 'string' ? eval('(' + msg.d + ')') : eval(msg);

    		if (results = "true") {
    			$("#divThrobber").hide();
    				$("#divThankyou").animate({ top: "show", opacity: "show" }, 500);
    			}
    			else {
    				$("#divThrobber").hide();
    				$("#divContactForm").show();
    				alert("There was an error while trying to send your comment, \nplease try again\nafter");
    			}
    		},
    		error: function() {
    			alert("There was an error while attempting to post your comment, \nplease try again\nbefore");
    		}
			});
	return false;
}

//Blog Page Methods

function ProcessCommentAddition(name, email, website, comment, blogID) {
    $("#newpostcomment").animate({ top: "hide", opacity: "hide" }, 500, function(){
		$("#divThrobber").show();

		$.ajax({
    		type: "POST",
    		url: "/WebServices/BlogComments.asmx/SubmitComment",
    		contentType: "application/json; charset=utf-8",
    		data: "{'name': '" + name + "','email':'" + email + "','webaddress':'" + website + "','comment':'" + comment + "','blogID':'" + blogID + "'}",
    		dataType: "json",
    		success: function(msg) {
    		var results = (typeof msg.d) == 'string' ? eval('(' + msg.d + ')') : eval(msg);

    		if (results="true") {
    				$("#divThrobber").hide();
    				$("#divThankyou").animate({ top: "show", opacity: "show" }, 500);
    			}
    			else {
    				$("#divThrobber").hide();
    				$("#newpostcomment").show();
    				alert("There was an error while trying to send your comment, \nplease try again\nafter");
    			}
    		},
    		error: function() {
    			alert("There was an error while attempting to post your comment, \nplease try again\nbefore");
    		}
		});
   });

           	
        //add google event tracking
}

window.scrollTo = function() { }


