$(document).ready(function(){
	$("form#comment-form").submit(function() {
 
	var message_wall = $('#message_wall').attr('value');
 	var subm = $('#submit').attr('value');
	var fid = $('#fid').attr('value');
	var text = $('#commenttext').attr('value');
		$.ajax({
			type: "POST",
			url: "http://www.txtmate.com/postit.php",
			data: "submit="+ subm + "&fid=" + fid + "&text=" + text,
			success: function(msg){
				$("ul#wall").prepend("<li style='display:none; list-style-type: none'>"+msg+"</li>");
				$("ul#wall li:first").show();
				$('form').clearForms2();
			}
		});
	return false;
	});
	
	$("form#forum-comment").submit(function() {
 
	var message_wall = $('#message_wall').attr('value');
 	var subm = $('#submit').attr('value');
	var fid = $('#did').attr('value');
	var text = $('#text').attr('value');
		$.ajax({
			type: "POST",
			url: "http://www.txtmate.com/disc-post-comment2.php",
			data: "submit="+ subm + "&did=" + fid + "&text=" + text,
			success: function(msg){
				$("ul#wall").prepend("<li style='display:none; list-style-type: none'>"+msg+"</li>");
				$("ul#wall li:first").fadeIn();
				$("form#forum-comment").clearForms2();
			}
		});
	return false;
	});
	
});

function del_comment(div,id) {
         // Set up request varible
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
         //Show page is loading
         document.getElementById(div).innerHTML = '<img src="nt_images/loading.gif" />';
      		
			 //scroll to top
			 
			 //scroll(0,0);
			 xmlhttp.open('GET', 'http://www.txtmate.com/delete_comments.php?action=delete&rid=' + id);	
			    xmlhttp.onreadystatechange = function(){
                 //Check page is completed and there were no problems.
                
				 if (xmlhttp.readyState == 4) {
					 if (xmlhttp.status == 200) {
							document.getElementById(div).innerHTML = xmlhttp.responseText;							
						//}
					 } else {
						alert('There was a problem with the request.');
					 }
				  }
					 }
			 //send data
			  		
			  xmlhttp.send(null); 
			  return false ;
		/* }*/
}

function delete_comment(div,id) {
         // Set up request varible
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
         //Show page is loading
         document.getElementById(div).innerHTML = '<img src="http://www.txtmate.com/nt_images/loading.gif" />';
      		
			 //scroll to top
			 
			 //scroll(0,0);
			 xmlhttp.open('GET', 'http://www.txtmate.com/delete_comments.php?action=dis_delete&rid=' + id);	
			    xmlhttp.onreadystatechange = function(){
                 //Check page is completed and there were no problems.
                
				 if (xmlhttp.readyState == 4) {
					 if (xmlhttp.status == 200) {
							document.getElementById(div).innerHTML = xmlhttp.responseText;							
						//}
					 } else {
						alert('There was a problem with the request.');
					 }
				  }
					 }
			 //send data
			  		
			  xmlhttp.send(null); 
			  return false ;
		/* }*/
}





