
$("#stars-wrapper2").stars({inputType:"select",oneVoteOnly:true,disabled:rating_disabled,callback:function(ui,type,value)
{$.ajax({type:"POST",url:SITE_URL+"pdf_rating",data:"permalink="+permalink+"&value="+value,success:function(rdata){eval('data='+rdata);if(data['status']==0){alert(data['msg']);}
else{$('.cast').html(data['msg']);$.facebox('<div class="rating_pop_content"><p><b>Thank you for your rating.</b></p><p>Do you have anything to say about this document? You can leave a comment below, or click close button at the bottom right corner to close this window.</p><div class="add"><textarea id="cmsg2">Type your comment here.</textarea><br /><input type="text" class="name" value="Name" id="cname2" /><input type="text" class="email" value="Email" id="cemail2" /><input type="text" class="url" value="Website (Optional)" id="curl2" /><br /><div id="recaptcha" class="recaptcha"><img src="'+SITE_URL+'img/loading.gif" alt="" style="margin-top: 40px;" /></div><input type="submit" class="submit" value="Post Comment" id="csubmit2" /></div></div>');Recaptcha.create(recaptcha_publickey,"recaptcha",{theme:"white",callback:function(){$('#recaptcha_response_field').keypress(function(e){if(e.which==13){$('#csubmit2').click();}});}});rating_pop_event();$('#csubmit2').click(function(){rating_comment_submit();});}},error:function(XMLHttpRequest,textStatus,errorThrown){alert('Ajax: '+textStatus+'. Please try again later. If this error persists, please contact admin@pdfcast.org.');}});}});rating_pop_event=function(){$('.rating_pop_content input.name').focus(function(){if($('.rating_pop_content input.name').val()=='Name'){$('.rating_pop_content input.name').val('').css({color:'#000'});}});$('.rating_pop_content input.name').blur(function(){if($('.rating_pop_content input.name').val()==''){$('.rating_pop_content input.name').val('Name').css({color:'#aaa'});}});$('.rating_pop_content input.email').focus(function(){if($('.rating_pop_content input.email').val()=='Email'){$('.rating_pop_content input.email').val('').css({color:'#000'});}});$('.rating_pop_content input.email').blur(function(){if($('.rating_pop_content input.email').val()==''){$('.rating_pop_content input.email').val('Email').css({color:'#aaa'});}});$('.rating_pop_content input.url').focus(function(){if($('.rating_pop_content input.url').val()=='Website (Optional)'){$('.rating_pop_content input.url').val('http://').css({color:'#000'});}});$('.rating_pop_content input.url').blur(function(){if($('.rating_pop_content input.url').val()==''||$('.rating_pop_content input.url').val()=='http://'){$('.rating_pop_content input.url').val('Website (Optional)').css({color:'#aaa'});}});$('.rating_pop_content textarea').focus(function(){if($('.rating_pop_content textarea').val()=='Type your comment here.'){$('.rating_pop_content textarea').val('').css({color:'#000'});}});$('.rating_pop_content textarea').blur(function(){if($('.rating_pop_content textarea').val()==''){$('.rating_pop_content textarea').val('Type your comment here.').css({color:'#aaa'});}});$('.rating_pop_content input').keypress(function(e){if(e.which==13){$('#csubmit2').click();return false;}});}
rating_comment_submit=function(){if($('#submit2').attr('disabled')=='disabled')return false;$('#csubmit2').val('loading').attr('disabled','disabled');$('#submit2').after('<img src="'+SITE_URL+'img/loading2.gif" alt="" class="lj" />').hide();$.ajax({type:"POST",url:SITE_URL+"pdf_comment",data:"permalink="+permalink+"&cmsg="+escape($('#cmsg2').val())+"&cname="+escape($('#cname2').val())+"&curl="+$('#curl2').val()+"&cemail="+$('#cemail2').val()+"&recaptcha_challenge_field="+$('#recaptcha_challenge_field').val()+"&recaptcha_response_field="+escape($('#recaptcha_response_field').val()),success:function(rdata){eval('data='+rdata);if(data['status']==0){alert(data['msg']);$('#csubmit2').val('Post Comment').attr('disabled','').show();$('.lj').remove();Recaptcha.reload();}
else if(data['status']==1){alert(data['msg']);window.location=pdf_permalink;}
else{alert('Error. Please try again later. If this error persists, please contact admin@pdfcast.org.');}},error:function(XMLHttpRequest,textStatus,errorThrown){alert('Ajax: '+textStatus+'. Please try again later. If this error persists, please contact admin@pdfcast.org.');}});}
