jQuery(document).ready(function(){var formObj=jQuery('#cl_post_title').parents('form');var urlObj=cl_settings['urlObj']=jQuery("input[name='"+cl_settings['url']+"']",formObj);var comObj=cl_settings['comObj']=jQuery("textarea[name='"+cl_settings['comment']+"']",formObj);var autObj=jQuery("input[name='"+cl_settings['name']+"']",formObj);var emaObj=jQuery("input[name='"+cl_settings['email']+"']",formObj);cl_settings['url_value']=urlObj.val();cl_settings['fired']='no';comObj.focus(function(){cl_dostuff();});jQuery('#doluv').click(function(){jQuery('#lastposts').hide();if(jQuery(this).is(":checked")){jQuery('#mylastpost').fadeTo("fast",1);cl_settings['fired']='no';cl_dostuff();}else{jQuery('input[name="cl_post_title"]').val("");jQuery('input[name="cl_post_url"]').val("");jQuery('#mylastpost').fadeTo("slow",0.3);jQuery('#lastposts').empty();}});jQuery('.cluv a').click(function(){var data=jQuery(this).attr('class').split(' ');jQuery.ajax({url:cl_settings['api_url'],type:'POST',data:{'action':'cl_ajax','cid':data[1],'nonce':data[0],'cl_prem':jQuery(this).hasClass('p'),'url':jQuery(this).attr('href'),'do':'click'}});jQuery(this).attr('target','_blank');return true;});if(cl_settings['infopanel']=="on"){jQuery('.heart_tip_box').mouseenter(heart_big);}
jQuery(document.body).click(function(){if(cl_settings['lastposts']=='showing'){jQuery('#lastposts').slideUp('',function(){cl_settings['lastposts']='not'});}});jQuery('#showmorespan img').click(function(){if(cl_settings['lastposts']=='not'){jQuery('#lastposts').slideDown('',function(){cl_settings['lastposts']='showing'});}});jQuery('#cl_post_title,#cl_post_url,#cl_prem').val('');jQuery(document).click(heart_small);jQuery("body").append('<span id="heart_tip_big" style="display: none;position:absolute; z-index: 1001; background-color: '+cl_settings['infoback']+'; color: '+cl_settings['infotext']+'; width: 62px;"></span>');});function cl_docheck(){if(!jQuery('#doluv').is(':checked')){return'not checked';}
var url=cl_settings['urlObj'];var msg=jQuery('#cl_messages');msg.empty();url.removeClass('cl_error');var nourlmessage=cl_settings['no_url_message'];if(cl_settings['logged_in']=='1'){nourlmessage=cl_settings['no_url_logged_in_message'];}else{if(!cl_settings['urlObj'].is(':visible')&&typeof FB!='undefined'){var invisurl=cl_settings['urlObj'].remove();var invismsg=jQuery('#cl_messages').remove();cl_settings['comObj'].after('<br><span id="invisurl">').after(invismsg);jQuery('#invisurl').append('URL ').after(invisurl).append('</span>');}}
if(url.val().length>1){if(url.val().toLowerCase()=='http://'){url.addClass('cl_error');cl_message(nourlmessage);return;}
if(url.val().toLowerCase().substring(0,7)!='http://'){url.addClass('cl_error');cl_message(cl_settings['no_http_message']);return;}}else{url.addClass('cl_error');cl_message(nourlmessage);return;}
return'ok';}
function cl_dostuff(){if(cl_docheck()!='ok'){return;}
var url=cl_settings['urlObj'];if(cl_settings['fired']=='yes'){if(url.val()==cl_settings['url_value']){return;}
jQuery('#lastposts,#mylastpost').empty();}
jQuery('#cl_messages').append('<img src="'+cl_settings['images']+'loader.gif'+'"/>').show();jQuery.ajax({url:cl_settings['api_url'],type:'post',dataType:'json',data:{'url':url.val(),'action':'cl_ajax','do':'fetch','_ajax_nonce':cl_settings._fetch},success:function(data){if(data.error==''){jQuery('#cl_messages').empty().hide();jQuery.each(data.items,function(j,item){var title=item.title;var link=item.link;var count='';jQuery('#lastposts').append('<span id="'+item.link+'" class="choosepost '+item.type+'">'+title+'</span>');});jQuery('#mylastpost').html('<a href="'+data.items[0].link+'"> '+data.items[0]['title']+'</a>').fadeIn(1000);jQuery('#cl_post_title').val(data.items[0].title);jQuery('#cl_post_url').val(data.items[0].link);jQuery('#cl_prem').val(data.items[0].p);jQuery('span.message').css({'backgroundColor':'#efefef','color':'black'});jQuery('#showmorespan img').show();if(cl_settings['comObj'].width()>jQuery('#commentluv').width()){var dropdownwidth=jQuery('#commentluv').width();}else{var dropdownwidth=jQuery(cl_settings['comObj']).width();}
jQuery('#lastposts').css('width',dropdownwidth).slideDown('',function(){cl_settings['lastposts']='showing'});jQuery('.choosepost:not(.message)').click(function(){jQuery('#cl_post_title').val(jQuery(this).text());jQuery('#cl_post_url').val(jQuery(this).attr('id'));jQuery('#mylastpost').html('<a href="'+jQuery(this).attr('id')+'"> '+jQuery(this).text()+'</a>').fadeIn(1000);});}else{cl_message(data.error);}},error:function(x,e){jQuery('#cl_messages img').remove();if(x.status==0){if(cl_settings['api_url'].indexOf('https')==0){cl_message('This blog has set the api url to use https , the commentluv technical settings need to be changed for the API url to use http');}else{cl_message('It appears that you are offline or another error occured contacting the API url, have you set it to use www or missed the www off the api url?? check the technical settings and add or remove www from the api url.');}}else if(x.status==404){cl_message('API URL not found.');}else if(x.status==500){cl_message('Internal Server Error.'+x.responseText);}else if(e=='parsererror'){cl_message('Error.\nParsing JSON Request failed.'+x.responseText);}else if(e=='timeout'){cl_message('Request Time out.');}else{cl_message('Unknow Error. '+x.statusText+' '+x.responseText);}}});cl_settings['fired']='yes';cl_settings['url_value']=url.val();}
function cl_message(message){jQuery('#cl_messages').empty().hide().text(message).slideDown();}
function heart_big(e){linkspan=jQuery(this).parents(".cluv");var link=jQuery(linkspan).find("a:first").attr("href");var linkdata=jQuery('img',this).attr('class').split(' ');var url=cl_settings['api_url'];var data={'action':'cl_ajax','cid':linkdata[2],'cl_prem':linkdata[1],'link':link,'do':'info','_ajax_nonce':cl_settings._info};cl_prem=linkdata[1];var position=jQuery(this).offset();var windowwidth=jQuery(window).width();windowheight=jQuery(window).height();var xpos=position.left;ypos=position.top;if(xpos+350>windowwidth){xpos=windowwidth-370;if(xpos<0)xpos=0;}
jQuery('#heart_tip_big').empty().css({'left':xpos+"px",'top':ypos+"px"});jQuery('#heart_tip_big').css("width","350px");jQuery('#heart_tip_big').addClass("finalbig").show().addClass('cl_ajax');if(typeof cl_settings[linkdata[2]]!='undefined'){fill_panel(cl_settings[linkdata[2]]);return;}
jQuery.ajax({url:cl_settings['api_url'],type:'post',data:data,dataType:'json',success:function(data){if(typeof(data)=='object'&&jQuery('#heart_tip_big').is(':visible')){cl_settings[linkdata[2]]=data.panel;fill_panel(data.panel);}else{jQuery('#heart_tip_big').removeClass('cl_ajax').html(cl_settings['no_info_message']);}
jQuery('#heart_tip_big').mouseleave(heart_small);}});}
function fill_panel(html){jQuery('#heart_tip_big').removeClass('cl_ajax').html(html).show();if(cl_prem=='p'){jQuery('#heart_tip_big p.cl_title').css('backgroundColor',cl_settings['infoback']);}
var ely=ypos-jQuery(document).scrollTop();var poph=jQuery('#heart_tip_big').height()+20;if(ely+poph>windowheight){var invis=poph-(windowheight-ely);ypos-=invis;if(ypos<0)ypos=0;jQuery('#heart_tip_big').css('top',ypos);}
return;}
function heart_small(){if(!jQuery('body').find('.cl_ajax').is(':visible')){jQuery("body").find("#heart_tip_big").empty().hide();}}
function do_nowt(){return;};(function($){$(function(){function selectProviderFromListItem($li_a){var $li=$li_a.parents('li');if(!$li.length)return false;var $provider=$($li_a.attr('href'));if(!$provider.length)return false;var $oldText=$(".selected-comment-provider textarea:visible");$('.comment-provider, ul#all-comment-providers li').each(function(){$(this).removeClass('selected-comment-provider');});$provider.addClass('selected-comment-provider');$li.addClass('selected-comment-provider');var $text=$provider.find("textarea");if($text.length&&$oldText.length)$text.val($oldText.val());var $box=$('.comment-provider p.subscribe-to-comments');if(!$box.length)return true;if($text.length&&!$provider.attr('id').match(/twitter/)&&!$provider.attr('id').match(/wordpress/))$provider.append($box);else if($provider.attr('id').match(/wordpress/))$provider.find('form').append($box);return true;}
function getCommentId($li){return parseInt($li.attr('id').replace(/^.*comment-/,''));}
$("a.comment-reply-link").unbind('click').after('<a class="comment-plus-reply-link" href="#comments-plus-form">Reply</a>');$("a.comment-reply-link").remove();$('.no-instructions p.form-allowed-tags').remove();$("a.comment-plus-reply-link").click(function(){var $li=$(this).parents('li');var parentId=getCommentId($li);if(!parentId)return false;var $providers=$("#comment-providers");$(this).parents('li').first().append($providers);$("#comment-providers").find('#comment_parent').val(parentId);if(!$providers.find(".comments-plus-reply-cancel").length)$providers.append('<a class="comments-plus-reply-cancel" href="#">Cancel reply</a>');$("#comment-providers").find('textarea:visible').focus();return false;});$(".comments-plus-reply-cancel").live('click',function(){$(this).remove();var $providers=$("#comment-providers");$("#comment-providers").find('#comment_parent').val(0);$(".commentlist").after($providers);return false;});$("#all-comment-providers li a").live('click',function(){selectProviderFromListItem($(this));return false;});$(".comment-provider-login-button a").live('click',function(){var $parent=$(this).parents(".comment-provider-login-button");if(!$parent.length)return false;var provider=$parent.attr('id').replace(/login-with-/,'');if(!provider)return false;$(document).trigger('wdcp_'+provider+'_login_attempt');return false;});$(document).bind('wdcp_logged_in',function(e,provider){var $parent=$("#login-with-"+provider).parents('.comment-provider');$("#login-with-"+provider).remove();if(!$parent.find(".comment-provider-waiting-response").length)$parent.append('<div class="comment-provider-waiting-response"></div>');$.post(_wdcp_ajax_url,{"action":"wdcp_get_form","provider":provider,"page":window.location.href},function(data){if(!data)return false;$parent.empty().html(data.html);var $login=$("#comment-provider-"+provider+" .connected-as");if(!$login.length)return false;$("#comment-provider-"+provider+"-link span").html($login.text());selectProviderFromListItem($("#comment-provider-"+provider+"-link"));});});selectProviderFromListItem($("#all-comment-providers li a:first"));if($(".connected-as").length){var $item=$(".connected-as").first().parents('div.comment-provider');if($item.length)selectProviderFromListItem($('#'+$item.attr('id')+'-link'));}});})(jQuery);;(function($){$(function(){$(document).bind('wdcp_twitter_login_attempt',function(){var url=$("#login-with-twitter a").attr('href');var twLogin=window.open('https://api.twitter.com',"twitter_login","scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,height=400,width=600");$.post(_wdcp_ajax_url,{"action":"wdcp_twitter_auth_url","url":url},function(data){var href=data.url;twLogin.location=href;var tTimer=setInterval(function(){try{if(twLogin.location.hostname==window.location.hostname){clearInterval(tTimer);twLogin.close();$(document).trigger('wdcp_logged_in',['twitter']);}}catch(e){}},300);return false;});});$("#comment-provider-twitter a.comment-provider-logout").live('click',function(){$.post(_wdcp_ajax_url,{"action":"wdcp_twitter_logout"},function(data){window.location.reload();});return false;});$("#send-twitter-comment").live('click',function(){var comment=$("#twitter-comment").val();var repost=$("#post-on-twitter").is(":checked")?1:0;var commentParent=$('#comment_parent').val();$(this).parents(".comment-provider").empty().append('<div class="comment-provider-waiting-response"></div>');$.post(_wdcp_ajax_url,{"action":"wdcp_post_twitter_comment","post_id":_wdcp_post_id,"post_on_twitter":repost,"comment_parent":commentParent,"comment":comment},function(data){window.location.reload();});return false;});});})(jQuery);;(function($){$(function(){$(document).bind('wdcp_facebook_login_attempt',function(){FB.login(function(resp){if(resp.session)$(document).trigger('wdcp_logged_in',['facebook']);},{perms:'read_stream,publish_stream,email'});});if($("#login-with-facebook").length){FB.getLoginStatus(function(resp){if(resp.session)$(document).trigger('wdcp_logged_in',['facebook']);});}
$("#comment-provider-facebook a.comment-provider-logout").live('click',function(){var href=$(this).attr('href');$.post(_wdcp_ajax_url,{"action":"wdcp_facebook_logout"},function(data){FB.logout(function(resp){window.location.reload();});});return false;});$("#send-facebook-comment").live('click',function(){var comment=$("#facebook-comment").val();var repost=$("#post-on-facebook").is(":checked")?1:0;var commentParent=$('#comment_parent').val();var subscribe=($("#subscribe").length&&$("#subscribe").is(":checked"))?'subscribe':'';$(this).parents(".comment-provider").empty().append('<div class="comment-provider-waiting-response"></div>');$.post(_wdcp_ajax_url,{"action":"wdcp_post_facebook_comment","post_id":_wdcp_post_id,"post_on_facebook":repost,"comment_parent":commentParent,"subscribe":subscribe,"comment":comment},function(data){window.location.reload();});return false;});});})(jQuery);;(function($){$(function(){$(document).bind('wdcp_google_login_attempt',function(){var url=$("#login-with-google a").attr('href');var googleLogin=window.open('https://www.google.com/accounts',"google_login","scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,height=400,width=600");$.post(_wdcp_ajax_url,{"action":"wdcp_google_auth_url","url":url},function(data){var href=data.url;googleLogin.location=href;var gTimer=setInterval(function(){try{if(googleLogin.location.hostname==window.location.hostname){clearInterval(gTimer);googleLogin.close();$(document).trigger('wdcp_logged_in',['google']);}}catch(e){}},300);return false;});});$("#comment-provider-google a.comment-provider-logout").live('click',function(){$.post(_wdcp_ajax_url,{"action":"wdcp_google_logout"},function(data){window.location.reload();});return false;});$("#send-google-comment").live('click',function(){var comment=$("#google-comment").val();var commentParent=$('#comment_parent').val();var subscribe=($("#subscribe").length&&$("#subscribe").is(":checked"))?'subscribe':'';$(this).parents(".comment-provider").empty().append('<div class="comment-provider-waiting-response"></div>');$.post(_wdcp_ajax_url,{"action":"wdcp_post_google_comment","post_id":_wdcp_post_id,"comment_parent":commentParent,"subscribe":subscribe,"comment":comment},function(data){window.location.reload();});return false;});});})(jQuery);;var wpgb_cookie_exp=365;function wpgb_get_cookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function wpgb_set_cookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+";path="+"/"+
((expiredays==null)?"":";expires="+exdate.toGMTString());}
function wpgb_delete_cookie(c_name)
{var now=new Date();now.setTime(now.getTime()-1);document.cookie=c_name+="=; expires="+now.toGMTString();}
function wpgb_get_delta(ref){var visit_delta;var visit_last=wpgb_get_cookie("wpgb_visit_last-"+ref);if(visit_last==null||visit_last==""){visit_delta=-1;}
else{visit_last=new Date(visit_last);visit_delta=Math.round((new Date()-visit_last)/(1000*60));}
return visit_delta;}
function wpgb_get_closed(ref){var closed=wpgb_get_cookie("wpgb_closed-"+ref);if(closed==null||closed==""){return""}
else{return"true"}}
function wpgb_get_logged_in(){var logged_in=wpgb_get_cookie("wpgb_logged_in");if(logged_in==null||logged_in==""){return""}
else{return"true"}};jQuery(document).ready(function($){var ref="default";if(document.referrer){ref=document.referrer;m=ref.match(/^(http:\/\/[^\/]+)/i);if(m){ref=m[1].replace(".","_");}}
$.ajax({type:"GET",url:"index.php",data:"wpgb_public_action=query&visit_delta="+wpgb_get_delta(ref)+"&closed="+wpgb_get_closed(ref)+"&logged_in="+wpgb_get_logged_in()+"&referrer="+encodeURIComponent(document.referrer)+"&url="+encodeURIComponent(document.location)+"&title="+encodeURIComponent(document.title),dataType:"html",success:function(resp){if(resp!=''){$("#greet_block").hide().html(resp).fadeIn("def");$("#greet_block_close").click(function(event){event.preventDefault();wpgb_set_cookie("wpgb_closed-"+ref,new Date(),wpgb_cookie_exp);wpgb_set_cookie("wpgb_closed-"+ref,new Date(),wpgb_cookie_exp);$("#greet_block").fadeOut("def");});$("#greet_search_link").click(function(){action=$(this).attr("action");if(action=="show"){$("#greet_search_results").slideDown();$(this).attr("action","hide");$("#greet_search_link_text_show").hide();$("#greet_search_link_text_hide").show();$("#greet_search_text_show").hide();$("#greet_search_text_hide").show();}
else if(action=="hide"){$("#greet_search_results").slideUp("fast");$(this).attr("action","show");$("#greet_search_link_text_show").show();$("#greet_search_link_text_hide").hide();$("#greet_search_text_show").show();$("#greet_search_text_hide").hide();}});}}});wpgb_set_cookie("wpgb_visit_last-"+ref,new Date(),wpgb_cookie_exp);});;var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
var trueheight;trueheight=myHeight;var truewidth;truewidth=myWidth;function showFollowMe()
{document.getElementById('FollowMeBubble').style.visibility='visible';document.getElementById('FollowMeBubbleBG').style.visibility='visible';document.getElementById("FollowMeBubbleBG").style.height=trueheight+"px";document.getElementById("FollowMeBubbleBG").style.width=truewidth+"px";}
function hideFollowMe()
{document.getElementById('FollowMeBubble').style.visibility='hidden';document.getElementById('FollowMeBubbleBG').style.visibility='hidden';};var poll_id=0,poll_answer_id="",is_being_voted=false;pollsL10n.show_loading=parseInt(pollsL10n.show_loading);pollsL10n.show_fading=parseInt(pollsL10n.show_fading);function poll_vote(a){if(is_being_voted)alert(pollsL10n.text_wait);else{set_is_being_voted(true);poll_id=a;poll_answer_id="";poll_multiple_ans_count=poll_multiple_ans=0;if(jQuery("#poll_multiple_ans_"+poll_id).length)poll_multiple_ans=parseInt(jQuery("#poll_multiple_ans_"+poll_id).val());jQuery("#polls_form_"+poll_id+" input:checkbox, #polls_form_"+poll_id+" input:radio").each(function(){if(jQuery(this).is(":checked"))if(poll_multiple_ans>0){poll_answer_id=jQuery(this).val()+","+poll_answer_id;poll_multiple_ans_count++}else poll_answer_id=parseInt(jQuery(this).val())});if(poll_multiple_ans>0)if(poll_multiple_ans_count>0&&poll_multiple_ans_count<=poll_multiple_ans){poll_answer_id=poll_answer_id.substring(0,poll_answer_id.length-1);poll_process()}else if(poll_multiple_ans_count==0){set_is_being_voted(false);alert(pollsL10n.text_valid)}else{set_is_being_voted(false);alert(pollsL10n.text_multiple+" "+poll_multiple_ans)}else if(poll_answer_id>0)poll_process();else{set_is_being_voted(false);alert(pollsL10n.text_valid)}}}
function poll_process(){if(pollsL10n.show_fading)jQuery("#polls-"+poll_id).fadeTo("def",0,function(){pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"POST",url:pollsL10n.ajax_url,data:"vote=true&poll_id="+poll_id+"&poll_"+poll_id+"="+poll_answer_id,cache:false,success:poll_process_success})});else{pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"POST",url:pollsL10n.ajax_url,data:"vote=true&poll_id="+poll_id+"&poll_"+poll_id+"="+poll_answer_id,cache:false,success:poll_process_success})}}
function poll_result(a){if(is_being_voted)alert(pollsL10n.text_wait);else{set_is_being_voted(true);poll_id=a;if(pollsL10n.show_fading)jQuery("#polls-"+poll_id).fadeTo("def",0,function(){pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollresult="+poll_id,cache:false,success:poll_process_success})});else{pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollresult="+
poll_id,cache:false,success:poll_process_success})}}}
function poll_booth(a){if(is_being_voted)alert(pollsL10n.text_wait);else{set_is_being_voted(true);poll_id=a;if(pollsL10n.show_fading)jQuery("#polls-"+poll_id).fadeTo("def",0,function(){pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollbooth="+poll_id,cache:false,success:poll_process_success})});else{pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollbooth="+
poll_id,cache:false,success:poll_process_success})}}}function poll_process_success(a){jQuery("#polls-"+poll_id).replaceWith(a);pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").hide();pollsL10n.show_fading?jQuery("#polls-"+poll_id).fadeTo("def",1,function(){set_is_being_voted(false)}):set_is_being_voted(false)}function set_is_being_voted(a){is_being_voted=a};
