/******* BuySell Code ***************/
(function(){
	var bsa = document.createElement('script');
	bsa.type = 'text/javascript';
	bsa.async = true;
	bsa.src = '//s3.buysellads.com/ac/bsa.js';
	(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
})();



/***************** start Google *********************/
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-6489443-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
/***************** end Google *********************/



/************* Google+ button **********/
document.write('<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>');




/***************** Start of StatCounter Code ****************/
var sc_project=4063801; 
var sc_invisible=1; 
var sc_partition=50; 
var sc_click_stat=1; 
var sc_security="6707d6aa"; 

document.write('<script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script>' +
	'<noscript><div class="statcounter"><a title="web counter" href="http://www.statcounter.com/" target="_blank">' +
	'<img class="statcounter" src="http://c.statcounter.com/4063801/0/6707d6aa/1/" alt="web counter"></a></div></noscript>');
/***************** end of StatCounter Code ****************/


/***************** Start of Social Login ****************/
function updateParam(a, k, v) {
   var re = new RegExp("([?|&])" + k + "=.*?(&|$)", "i"),
   separator = a.indexOf('?') !== -1 ? "&" : "?";
   if (a.match(re))
     return a.replace(re, '$1' + k + "=" + v + '$2');
   else
     return a + separator + k + "=" + v;
}
 
jQuery(document).ready(function(){
  jQuery('#facebook-login').click(function(event){
    jQuery(this).fadeOut();
    event.preventDefault();
    
    FB.login(function(response) {
      if (response.status == 'connected') {
        location.href = updateParam(social_login_comment_callback_url, 'fb_token', response.authResponse.accessToken) + '#commentform';
      } else {
        jQuery('#facebook-login').fadeIn();
      }
    }, {scope: 'user_about_me,email'});
  });
  
  if (twitter_detail_show) {
    jQuery.colorbox({
      inline:true,
      href: '#twitter-complete-detail',
      escKey: false,
      overlayClose: false,
      onComplete: function(){
        jQuery('#cboxClose').remove();
      }
    });
  }
});
/***************** end of Social Login ****************/

