$(document).ready(function(){$("#preview_comment").hide();$("#c_submit").click(function(){$("#mycommentspan").html('<img src="'+TemplateP+'/images/ajax-loader.gif" alt="Loading" id="loading" />').show();var userId=$("#c_user_id").val();var videoId=$("#c_vid").val();var commentTxt=$("#c_comment_txt").val();var uName=$("#c_username").val();var captchaCode=$("#captcha").val();if(userId==0)
{$.post(MELODYURL2+"/comment.php",{username:uName,captcha:captchaCode,vid:videoId,user_id:userId,comment_txt:commentTxt},function(data){if(data.cond==true)
{$("#myform").slideUp("normal",function(){$("#mycommentspan").html(data.msg).show();if(data.preview==true)
{$comment=data.html;$comment=$comment.replace(/\n/g,"<br />").replace(/\n\n+/g,'<br /><br />');$("#be_the_first").hide();$("#preview_comment").html($comment).fadeIn(700);}});}
else if(data.cond==false)
{$("#c_submit").show();$("#mycommentspan").html(data.msg).show();}},"json");}
else if(userId>0)
{$.post(MELODYURL2+"/comment.php",{vid:videoId,user_id:userId,comment_txt:commentTxt},function(data){if(data.cond==true)
{$("#myform").slideUp("normal",function(){$("#mycommentspan").html(data.msg).show();if(data.preview==true)
{$("#be_the_first").hide();$("#preview_comment").html(data.html).fadeIn(700);}});}
else if(data.cond==false)
{$("#c_submit").show();$("#mycommentspan").html(data.msg).show();}},"json");}
return false;});});
