$(document).ready(function () {	
  $("#comment_add").click(function () {
		$("#commentWindowOld").show();
		$("#commentWindow").css("z-index","1000");
		$("#commentWindow").css("background","#ccc");
		$("#commentWindow").css("visibility","visible");
		
		$("#comment_close").show();
		$("#comment_add").hide();
		$("#comment_img").hide();
    $("#comment_msg").html('');;
    return false;
  });

  $("#comment_close").click(function () {
		$("#commentWindowOld").hide();
		$("#comment_close").hide();
		$("#comment_add").show();
		$("#comment_img").show();
		$("#comment_subject").html('');
		$("#comment_text").html('');
    $("#comment_msg").html('');
     return false;
  });

	$('#comment_send').click(function () {
     $("#comment_msg").html('');
     
     $.ajax({
		          type: "POST",
		          data: {
                     action: 'sendComment',
                     id: id,
                     type: contenttype,
                     title: $("#comment_subject").val(),
                     description: $("#comment_text").val(),
                     name: $("#comment_name").val(),
                     captcha: $("#comment_captcha").val()
                    },
		          url: 'data.php',
		          dataType: 'json',
		          timeout: 602222,
		          global: 'false',
		          success: function(json) {
		          
                   if (json.Result>0){
                      $("#comment_msg").html(json.Text);
                      $("#commentWindow").hide();
            		      $("#comment_close").hide();
            		      $("#comment_add").show();
                  }else{
                      $("#comment_msg").html(json.Text);
         		          $("#comment_msg").css("color","#990000");
    
                  }
             }    
          });  
  });


});	