var LoadingBlock;
var CurElem;
var ProductLoop=0;

$(document).ready(function() {	
	$('#SendComment').click(
		function(){		
			SendComment()			
		}
	)
	
	$('.AddComment').click(
		function(){
			OpenCommentWindow(BlogID);
		}
	);
});

function SendComment(){
	var Question=$('#Question').val();
	var Name=encodeURIComponent($('#Name').val());
	var Email=$('#Email').val();
	var BlogID=$('#BID').val();
	var PostData='Name='+Name+'&Email='+Email+'&Comment='+encodeURIComponent(Question)+'&BlogID='+BlogID;
	AjaxPost('/Includes/AJAX-Calls/AJAX-SendComment.asp',PostData,'HandleSendComment','');	
}

function HandleSendComment(){
	var CData=CheckStatus();
	if(CData){
		var IncomingLength=CData.incoming.response.length;
		if (IncomingLength>0) {
			if  (CData.incoming.response[0].status=='Ok'){
				parent.$.jGrowl("Your comment was successfully sent. We will email you when your comment goes live.", { header: '<img src="/images/icons/growl_Ok.gif" align="absmiddle"/> COMMENT SENT' });
				CloseWindow();
			}
			else{
				parent.$.jGrowl("Your comment failed to send. Please check your information and try again.", { header: '<img src="/images/icons/growl_Fail.gif" align="absmiddle"/> COMMENT SEND FAILED' });
			}
		}
		else{
			parent.$.jGrowl("There was a serious error. Please try again.", { header: '<img src="/images/icons/growl_Ok.gif" align="absmiddle"/> ERROR' });
		}
	}
}


