
go_wp=function(){if($(this).attr('disabled')=='disabled')return false;wp_url=$('.popup .share input.wpurl').val();if(is_valid_url(wp_url)){$(this).val('loading').attr('disabled','disabled');$(this).after('<img src="'+SITE_URL+'img/loading2.gif" alt="" class="lj" />').hide();if(wp_url.substr(-1,1)!='/')wp_url=wp_url+'/';window.open(wp_url+'wp-admin/press-this.php?u='+escape(pdf_permalink)+'&t='+escape(pdf_title),'_blank','menubar=0,resizable=1,width=700,height=500');close_pop();}
else{alert('Please insert valid url!\nexample: http://myblog.wordpress.com/');}}
go_share=function(){$('.share .frame').css({marginLeft:0});$.facebox($('#share').html());$('.popup a.fb').click(function(){window.open('http://www.facebook.com/sharer.php?u='+escape(pdf_permalink)+'&t='+escape(pdf_title),"_blank");close_pop();return false;});$('.popup a.twitter').click(function(){window.open('http://twitter.com/home?status='+escape(pdf_permalink+': '+pdf_title),"_blank");close_pop();return false;});$('.popup a.wp').click(function(){$('.popup .share_2').html($('.wp2').html());share_prev_button();share_next(function(){$('.popup .share input.wpurl').focus();});$('.popup .share input.wpurl').keypress(function(e){if(e.which==13){go_wp();}
return false;});$('.popup #wpsubmit').click(function(){go_wp();});return false;});$('.popup a.blogger').click(function(){window.open('http://www.blogger.com/blog_this.pyra?t&u='+escape(pdf_permalink)+'&n='+escape(pdf_title),"_blank");close_pop();return false;});$('.popup a.email').click(function(){$('.share_2').html($('.email2').html());share_prev_button();share_next();$('.popup input.email_name').focus(function(){if($(this).val()=='Name'){$(this).css({textAlign:'left',color:'#000'}).val('');}});$('.popup input.email_email').focus(function(){if($(this).val()=='Email Address'){$(this).css({textAlign:'left',color:'#000'}).val('');}});$('.popup input.email_name').blur(function(){if($(this).val()==''){$(this).css({textAlign:'center',color:'#aaa'}).val('Name');}});$('.popup input.email_email').blur(function(){if($(this).val()==''){$(this).css({textAlign:'center',color:'#aaa'}).val('Email Address');}});$('.popup input.email_name, .popup input.email_email').keypress(function(e){if(e.which==13){$('.popup .emailsubmit').click();}});$('.emailsubmit').click(function(){fe=$('.popup .share .fe').val();fn=$('.popup .share .fn').val();te=$('.popup .share .te').val();tn=$('.popup .share .tn').val();if(fn==''||fn=='Name')alert('Sender\'s name is empty!');else if(fe==''||fe=='Email Address')alert('Sender\'s email is empty!');else if(tn==''||tn=='Name')alert('Recipient\'s name is empty!');else if(te==''||te=='Email Address')alert('Recipient\'s email is empty!');else if(!is_valid_email(fe))alert('Invalid sender\'s email format!');else if(!is_valid_email(te))alert('Invalid recipient\'s email format!');else{$('.popup .share_3').html($('.email3').html());$('.popup .share_3 .recaptcha_div').attr('id','recaptcha_div');share_prev_button();Recaptcha.create(recaptcha_publickey,"recaptcha_div",{theme:"white",callback:recaptcha_callback});$('.emailsend').click(function(){if($(this).attr('disabled')=='disabled')return false;$(this).val('loading').attr('disabled','disabled');$(this).after('<img src="'+SITE_URL+'img/loading2.gif" alt="" class="lj" />').hide();$.ajax({type:"POST",url:SITE_URL+"pdf_email",data:"permalink="+permalink+"&fe="+fe+"&fn="+escape(fn)+"&te="+te+"&tn="+escape(tn)+"&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']);$('.emailsend').val('SEND').attr('disabled','').show();$('.lj').remove();Recaptcha.reload();}
else if(data['status']==1){alert(data['msg']);close_pop();}
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.');}});});share_next();}});return false;});$('.popup a.html').click(function(){$('.popup .share_2').html($('.html2').html());$('.html_code').click(function(){$(this).select();});share_prev_button();share_next();$('.htmlclose').click(function(){close_pop();});return false;});return false;}
share_prev_button=function(){$('a.share_prev').click(function(){share_prev();return false;});}
share_next=function(event){$('.popup .share .frame').animate({marginLeft:parseInt($('.popup .share .frame').css('margin-left'))-370},event);}
share_prev=function(){$('.popup .share .frame').animate({marginLeft:parseInt($('.popup .share .frame').css('margin-left'))+370});}
close_pop=function(){$('.close .close_image').click();}
recaptcha_callback=function(){$('#recaptcha_response_field').focus();$('#recaptcha_response_field').keypress(function(e){if(e.which==13){$('.popup .emailsend').click();}});}
