// JavaScript Document
$(document).ready(function() {
		$.fn.clearForm = function() {
		  return this.each(function() {
		 var type = this.type, tag = this.tagName.toLowerCase();
		 if (tag == 'form')
		   return $(':input',this).clearForm();
		 if (type == 'text' || type == 'password' || tag == 'textarea')
		   this.value = '';
		 else if (type == 'checkbox' || type == 'radio')
		   this.checked = false;
		 else if (tag == 'select')
		   this.selectedIndex = -1;
		  });
		};
		
		$('#select').change(function() {
		var item = $('#select').val();
		var appname = $('#app').val();
		$.post("site/process", { item: item , appname: appname },
		  function(data){
			alert(data.result); // John
			$('#textarea').val(data.result);
		  }, "json");
	});
		
		$("#likeitID").click(function() {
					var cookie = $('#cookie').val();var domain = $('#domainNAME').val();
					$.ajax({
					  url: domain+'addFeedLikeIt',
					  data: 'userid='+cookie,
					  dataType: 'json',
					  type: 'post',
					  success: function (j) {
						if(j.ok) {
							$('#afterClick').html(j.msg);
						}
					  }
					});
		});
		
});
