
function Zhuyo(options,theme){var $ct=null;var gTwtId=null;this.timer=window.setInterval('zy_1.check(false)',300);this.init=function(callback){this.callback=callback;this.loadEx('http://'+options['site']+'/stylesheets/widget.css','ct_w_css');this.loadEx('http://'+options['site']+'/stylesheets/themes/'+theme+'/jquery-ui-1.7.2.custom.css','ct_t_css');if(typeof(jQuery)=='undefined')
this.loadEx('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js','ct_jq_js',function(){return typeof(jQuery)!='undefined';},function(){$ct=jQuery.noConflict();zy_1.bind();if(callback)callback();});else{$ct=jQuery;zy_1.bind();if(callback){callback();}}};this.bind=function(){$ct('.ct-signin').click(function(){zy_1.signin();return false;});if($ct('.ct-updates').height()>300){$ct('.ct-updates').css('height','300px').css('overflow','auto');}
$ct('.tweethis').click(function(){var _url='/tweet?url='+encodeURIComponent(location.href)+'&title='+(document.title?encodeURIComponent(document.title.replace(/^\s*|\s*$/g,"")):"");zy_1.openWin(800,430,_url,'ct_tweet');return false;});$ct('.ct-signout').click(function(){zy_1.signout();return false;});$ct(".fg-button:not(.ui-state-disabled)").hover(function(){$ct(this).addClass("ui-state-hover");},function(){$ct(this).removeClass("ui-state-hover");}).mousedown(function(){$ct(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");if($ct(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active')){$(this).removeClass("ui-state-active");}
else{$ct(this).addClass("ui-state-active");}}).mouseup(function(){if(!$ct(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button')){$ct(this).removeClass("ui-state-active");}});$ct(".ct-page").click(function(){zy_1.toggleLoading().renderFollowers($ct(this).attr('page'));return false;});};this.toggleLoading=function(){$ct(".ct-loading").toggle();$ct(".ct-paging").toggle();return this;};this.check=function(force){if(this.signinWindow&&this.signinWindow.closed){this.signinWindow=null;$ct.getJSON('http://'+options['site']+'/embed/follow/'+options['account_id']+"?callback=?",{url:window.location.href,title:document.title},function(){zy_1.callback();});}
else if(force){this.callback();}};this.loadEx=function(url,id,validate,callback){var d=document;var h=d.getElementsByTagName('head')[0];if(id=='ct_t_css'&&this.$(id)!=null){h.removeChild(this.$(id));}
if(!this.$(id)){if(url.indexOf('.css')>0){var el=this.ce('link');el.rel='stylesheet';el.media='screen';el.type='text/css';el.href=url;el.id=id;h.appendChild(el);if(callback)callback();}
else{var el=this.ce('script');el.src=url;el.id=id;var done=false;var timer=setInterval(function()
{try{done=validate.call();}catch(ex){}
if(done)
{clearInterval(timer);if(callback)callback();}},100);h.appendChild(el);}}};this.$=function(id){return document.getElementById(id);};this.ce=function(type){return document.createElement(type);};this.renderFollowers=function(page){var el=$ct('#'+options.id);var limit=Math.floor((el.width()-6)/(32+6))*options['rows'];if(page==null)page=1;$ct.getJSON('http://'+options['site']+'/embed/followers/'+options['account_id']+"?callback=?",{follow_text:options['follow'],updates:options['updates'],tweethis:options['tweethis'],no_default:options['no_default'],per_page:limit,page:page},function(data){$ct('#'+options.id).addClass('ct-widget ui-widget').html(data.html);zy_1.toggleLoading().bind();});};this.openWin=function(w,h,url,id){var l=(screen.width-w)/2;var t=(screen.height-h)/2;var wpos='width='+w+', height='+h+', left='+l+', top='+t;var win=window.open('http://'+options['site']+url,id,wpos);return win;};this.signin=function(params)
{if(!gTwtId)
{this.signinWindow=this.openWin(800,400,'/users/oauth?do=follow&newwindow=1&account_id='+options['account_id'],'ct_signin');}
return false;};this.signout=function(){$ct.getJSON('http://'+options['site']+'/embed/signout?callback=?',{},function(data){zy_1.check(true);});}}