param_width = "239";param_height = "330";param_i = 22467;param_style = "notification_feed";param_colorscheme = "light"; param_slide = "on"; param_separator = "EEEEEE"; param_comment = "on"; param_cnlogo = "off"; server_path = "http://widget.citizennet.com/app/widget/";







/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/* UBLOCK JS */
;(function($){if(/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery)||/^1.1/.test($.fn.jquery)){alert('blockUI requires jQuery v1.2.3 or later!  You are using v'+$.fn.jquery);return}$.fn._fadeIn=$.fn.fadeIn;var setExpr=(function(){if(!$.browser.msie)return false;var div=document.createElement('div');try{div.style.setExpression('width','0+0')}catch(e){return false}return true})();$.blockUI=function(opts){install(window,opts)};$.unblockUI=function(opts){remove(window,opts)};$.growlUI=function(title,message,timeout,onClose){var $m=$('<div class="growlUI"></div>');if(title)$m.append('<h1>'+title+'</h1>');if(message)$m.append('<h2>'+message+'</h2>');if(timeout==undefined)timeout=3000;$.blockUI({message:$m,fadeIn:700,fadeOut:1000,centerY:false,timeout:timeout,showOverlay:false,onUnblock:onClose,css:$.blockUI.defaults.growlCSS})};$.fn.block=function(opts){return this.unblock({fadeOut:0}).each(function(){if($.css(this,'position')=='static')this.style.position='relative';if($.browser.msie)this.style.zoom=1;install(this,opts)})};$.fn.unblock=function(opts){return this.each(function(){remove(this,opts)})};$.blockUI.version=2.20;$.blockUI.defaults={message:'<h1>Please wait...</h1>',css:{padding:0,margin:0,top:'20%',left:'5%',textAlign:'center',color:'#000',border:'3px solid #aaa',backgroundColor:'#fff'},overlayCSS:{backgroundColor:'#000',opacity:0.6},growlCSS:{width:'350px',top:'10px',left:'',right:'10px',border:'none',padding:'5px',opacity:0.6,cursor:null,color:'#fff',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px'},iframeSrc:/^https/i.test(window.location.href||'')?'javascript:false':'about:blank',forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var ie6=$.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);var pageBlock=null;var pageBlockEls=[];function install(el,opts){var full=(el==window);var msg=opts&&opts.message!==undefined?opts.message:undefined;opts=$.extend({},$.blockUI.defaults,opts||{});opts.overlayCSS=$.extend({},$.blockUI.defaults.overlayCSS,opts.overlayCSS||{});var css=$.extend({},$.blockUI.defaults.css,opts.css||{});msg=msg===undefined?opts.message:msg;if(full&&pageBlock)remove(window,{fadeOut:0});if(msg&&typeof msg!='string'&&(msg.parentNode||msg.jquery)){var node=msg.jquery?msg[0]:msg;var data={};$(el).data('blockUI.history',data);data.el=node;data.parent=node.parentNode;data.display=node.style.display;data.position=node.style.position;if(data.parent)data.parent.removeChild(node)}var z=opts.baseZ;var lyr1=($.browser.msie||opts.forceIframe)?$('<iframe class="blockUI" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'):$('<div class="blockUI" style="display:none"></div>');var lyr2=$('<div class="blockUI blockOverlay" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var lyr3=full?$('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>'):$('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');if(msg)lyr3.css(css);if(!opts.applyPlatformOpacityRules||!($.browser.mozilla&&/Linux/.test(navigator.platform)))lyr2.css(opts.overlayCSS);lyr2.css('position',full?'fixed':'absolute');if($.browser.msie||opts.forceIframe)lyr1.css('opacity',0.0);$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full?'body':el);var expr=$.browser.msie&&($.browser.version<8||!$.boxModel)&&(!$.boxModel||$('object,embed',full?null:el).length>0);if(ie6||(expr&&setExpr)){if(full&&opts.allowBodyStretch&&$.boxModel)$('html,body').css('height','100%');if((ie6||!$.boxModel)&&!full){var t=sz(el,'borderTopWidth'),l=sz(el,'borderLeftWidth');var fixT=t?'(0 - '+t+')':0;var fixL=l?'(0 - '+l+')':0}$.each([lyr1,lyr2,lyr3],function(i,o){var s=o[0].style;s.position='absolute';if(i<2){full?s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'):s.setExpression('height','this.parentNode.offsetHeight + "px"');full?s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):s.setExpression('width','this.parentNode.offsetWidth + "px"');if(fixL)s.setExpression('left',fixL);if(fixT)s.setExpression('top',fixT)}else if(opts.centerY){if(full)s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');s.marginTop=0}else if(!opts.centerY&&full){var top=(opts.css&&opts.css.top)?parseInt(opts.css.top):0;var expression='((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';s.setExpression('top',expression)}})}if(msg){lyr3.append(msg);if(msg.jquery||msg.nodeType)$(msg).show()}if(($.browser.msie||opts.forceIframe)&&opts.showOverlay)lyr1.show();if(opts.fadeIn){if(opts.showOverlay)lyr2._fadeIn(opts.fadeIn);if(msg)lyr3.fadeIn(opts.fadeIn)}else{if(opts.showOverlay)lyr2.show();if(msg)lyr3.show()}bind(1,el,opts);if(full){pageBlock=lyr3[0];pageBlockEls=$(':input:enabled:visible',pageBlock);if(opts.focusInput)setTimeout(focus,20)}else center(lyr3[0],opts.centerX,opts.centerY);if(opts.timeout){var to=setTimeout(function(){full?$.unblockUI(opts):$(el).unblock(opts)},opts.timeout);$(el).data('blockUI.timeout',to)}};function remove(el,opts){var full=el==window;var $el=$(el);var data=$el.data('blockUI.history');var to=$el.data('blockUI.timeout');if(to){clearTimeout(to);$el.removeData('blockUI.timeout')}opts=$.extend({},$.blockUI.defaults,opts||{});bind(0,el,opts);var els=full?$('body').children().filter('.blockUI'):$('.blockUI',el);if(full)pageBlock=pageBlockEls=null;if(opts.fadeOut){els.fadeOut(opts.fadeOut);setTimeout(function(){reset(els,data,opts,el)},opts.fadeOut)}else reset(els,data,opts,el)};function reset(els,data,opts,el){els.each(function(i,o){if(this.parentNode)this.parentNode.removeChild(this)});if(data&&data.el){data.el.style.display=data.display;data.el.style.position=data.position;if(data.parent)data.parent.appendChild(data.el);$(data.el).removeData('blockUI.history')}if(typeof opts.onUnblock=='function')opts.onUnblock(el,opts)};function bind(b,el,opts){var full=el==window,$el=$(el);if(!b&&(full&&!pageBlock||!full&&!$el.data('blockUI.isBlocked')))return;if(!full)$el.data('blockUI.isBlocked',b);if(!opts.bindEvents||(b&&!opts.showOverlay))return;var events='mousedown mouseup keydown keypress';b?$(document).bind(events,opts,handler):$(document).unbind(events,handler)};function handler(e){if(e.keyCode&&e.keyCode==9){if(pageBlock&&e.data.constrainTabKey){var els=pageBlockEls;var fwd=!e.shiftKey&&e.target==els[els.length-1];var back=e.shiftKey&&e.target==els[0];if(fwd||back){setTimeout(function(){focus(back)},10);return false}}}if($(e.target).parents('div.blockMsg').length>0)return true;return $(e.target).parents().children().filter('div.blockUI').length==0};function focus(back){if(!pageBlockEls)return;var e=pageBlockEls[back===true?pageBlockEls.length-1:0];if(e)e.focus()};function center(el,x,y){var p=el.parentNode,s=el.style;var l=((p.offsetWidth-el.offsetWidth)/2)-sz(p,'borderLeftWidth');var t=((p.offsetHeight-el.offsetHeight)/2)-sz(p,'borderTopWidth');if(x)s.left=l>0?(l+'px'):'0';if(y)s.top=t>0?(t+'px'):'0'};function sz(el,p){return parseInt($.css(el,p))||0}})(jQuery);

/* ELASTIC JS */
(function($){$.fn.extend({elastic:function(){var mimics=new Array('paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight');return this.each(function(){if(this.type!='textarea')return false;var $textarea=$(this);var lineHeight=parseInt($textarea.css('lineHeight'),10)||parseInt($textarea.css('fontSize'),'10');var minheight=parseInt($textarea.css('height'),10)||lineHeight*3;var maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE;var goalheight=0;var twin=null;var first=true;if(!twin){$twin=$('<div />').css({'position':'absolute','display':'none'}).appendTo($textarea.parent());$.each(mimics,function(){$twin.css(this.toString(),$textarea.css(this.toString()))})};function setHeight(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow})}}function update(){var textareaContent=$textarea.val().replace(/<|>/g,' ').replace(/\n/g,'<br />').replace(/&/g,"&amp;");var twinContent=$twin.html();if(textareaContent+'&nbsp;'!=twinContent){$twin.html(textareaContent+'&nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight)setHeight(maxheight,'auto');else if(goalheight<=minheight)setHeight(minheight,'hidden');else setHeight(goalheight,'hidden');if(first){temp=$textarea.val();$textarea.val('');setTimeout(function(){$textarea.val(temp)},1);first=false}}}}$textarea.css({'overflow':'hidden'}).bind('focus',function(){self.periodicalUpdater=window.setInterval(function(){update()},50)}).bind('blur',function(){clearInterval(self.periodicalUpdater)});update()})}})})(jQuery);

/* PIWIK JS */
if(typeof(param_piwik)=='undefined'||(typeof(param_piwik)!='undefined'&&(param_piwik=='on'||param_piwik==1))){var Piwik,piwik_log,piwik_track;if(!this.Piwik){Piwik=(function(){var expireDateTime,plugins={},documentAlias=document,navigatorAlias=navigator,screenAlias=screen,windowAlias=window,hasLoaded=false,registeredOnLoadHandlers=[];function isDefined(property){return typeof property!=='undefined'}function addEventListener(element,eventType,eventHandler,useCapture){if(element.addEventListener){element.addEventListener(eventType,eventHandler,useCapture);return true}else if(element.attachEvent){return element.attachEvent('on'+eventType,eventHandler)}element['on'+eventType]=eventHandler}function executePluginMethod(methodName,callback){var result='',i,pluginMethod;for(i in plugins){pluginMethod=plugins[i][methodName];if(typeof pluginMethod==='function'){result+=pluginMethod(callback)}}return result}function beforeUnloadHandler(unloadEvent){if(isDefined(expireDateTime)){var now=new Date();while(now.getTime()<expireDateTime){now=new Date()}}executePluginMethod('unload')}function loadHandler(loadEvent){if(!hasLoaded){hasLoaded=true;executePluginMethod('load');for(var i=0;i<registeredOnLoadHandlers.length;i++){registeredOnLoadHandlers[i]()}}return true}function addReadyListener(){if(documentAlias.addEventListener){addEventListener(documentAlias,"DOMContentLoaded",function(){documentAlias.removeEventListener("DOMContentLoaded",arguments.callee,false);loadHandler()})}else if(documentAlias.attachEvent){documentAlias.attachEvent("onreadystatechange",function(){if(documentAlias.readyState==="complete"){documentAlias.detachEvent("onreadystatechange",arguments.callee);loadHandler()}});if(documentAlias.documentElement.doScroll&&windowAlias==windowAlias.top){(function(){if(hasLoaded){return}try{documentAlias.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return}loadHandler()}())}}addEventListener(windowAlias,'load',loadHandler,false)}function Tracker(trackerUrl,siteId){var configTrackerUrl=trackerUrl||'',configTrackerSiteId=siteId||'',configTitle='',configDownloadExtensions='7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd||xls|xml|z|zip',configHostsAlias=[windowAlias.location.hostname],configIgnoreClasses=[],configDownloadClasses=[],configLinkClasses=[],configTrackerPause=500,configCustomData,browserHasCookies='0',pageReferrer,pluginMap={pdf:['pdf','application/pdf','0'],quicktime:['qt','video/quicktime','0'],realplayer:['realp','audio/x-pn-realaudio-plugin','0'],wma:['wma','application/x-mplayer2','0'],director:['dir','application/x-director','0'],flash:['fla','application/x-shockwave-flash','0'],java:['java','application/x-java-vm','0'],gears:['gears','application/x-googlegears','0'],silverlight:['ag','application/x-silverlight','0']},linkTrackingInstalled=false,escapeWrapper=windowAlias.encodeURIComponent||escape,unescapeWrapper=windowAlias.decodeURIComponent||unescape,stringify=function(value){var escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function f(n){return n<10?'0'+n:n}function str(key,holder){var i,k,v,partial,value=holder[key];if(value===null){return'null'}if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key)}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':partial=[];if(value instanceof Array){for(i=0;i<value.length;i++){partial[i]=str(i,value)||'null'}v=partial.length===0?'[]':'['+partial.join(',')+']';return v}if(value instanceof Date){return quote(value.getUTCFullYear()+'-'+f(value.getUTCMonth()+1)+'-'+f(value.getUTCDate())+'T'+f(value.getUTCHours())+':'+f(value.getUTCMinutes())+':'+f(value.getUTCSeconds())+'Z')}for(k in value){v=str(k,value);if(v){partial[partial.length]=quote(k)+':'+v}}v=partial.length===0?'{}':'{'+partial.join(',')+'}';return v}}return str('',{'':value})},registeredHooks={};function setCookie(cookieName,value,daysToExpire,path,domain,secure){var expiryDate;if(daysToExpire){expiryDate=new Date();expiryDate.setTime(expiryDate.getTime()+daysToExpire*8.64e7)}documentAlias.cookie=cookieName+'='+escapeWrapper(value)+(daysToExpire?';expires='+expiryDate.toGMTString():'')+';path='+(path?path:'/')+(domain?';domain='+domain:'')+(secure?';secure':'')}function getCookie(cookieName,path,domain){var cookiePattern=new RegExp('(^|;)[ ]*'+cookieName+'=([^;]*)'+(path?'(;[ ]*expires=[^;]*)?;[ ]*path='+path.replace('/','\\/')+'':'')+(domain?';[ ]*domain='+domain+'(;|$)':'')),cookieMatch=cookiePattern.exec(documentAlias.cookie);return cookieMatch?unescapeWrapper(cookieMatch[2]):0}function getImage(url,delay){var now=new Date(),image=new Image(1,1);expireDateTime=now.getTime()+delay;image.onLoad=function(){};image.src=url}function detectBrowserPlugins(){var i,mimeType;if(typeof navigatorAlias.javaEnabled!=='undefined'&&navigatorAlias.javaEnabled()){pluginMap.java[2]='1'}if(typeof windowAlias.GearsFactory==='function'){pluginMap.gears[2]='1'}if(navigatorAlias.mimeTypes&&navigatorAlias.mimeTypes.length){for(i in pluginMap){mimeType=navigatorAlias.mimeTypes[pluginMap[i][1]];if(mimeType&&mimeType.enabledPlugin){pluginMap[i][2]='1'}}}}function getReferrer(){var referrer='';try{referrer=top.document.referrer}catch(e){if(parent){try{referrer=parent.document.referrer}catch(e2){referrer=''}}}if(referrer===''){referrer=documentAlias.referrer}return referrer}function hasCookies(){var testCookieName='_pk_testcookie';if(!isDefined(navigatorAlias.cookieEnabled)){setCookie(testCookieName,'1');return getCookie(testCookieName)=='1'?'1':'0'}return navigatorAlias.cookieEnabled?'1':'0'}function getRequest(){var i,now,request;now=new Date();request='idsite='+configTrackerSiteId+'&url='+escapeWrapper(documentAlias.location.href)+'&res='+screenAlias.width+'x'+screenAlias.height+'&h='+now.getHours()+'&m='+now.getMinutes()+'&s='+now.getSeconds()+'&cookie='+browserHasCookies+'&urlref='+escapeWrapper(pageReferrer)+'&rand='+Math.random();for(i in pluginMap){request+='&'+pluginMap[i][0]+'='+pluginMap[i][2]}request=configTrackerUrl+'?'+request;return request}function getWebBug(){var request=getRequest();request+='&action_name='+escapeWrapper(configTitle);if(isDefined(configCustomData)){request+='&data='+escapeWrapper(stringify(configCustomData))}request+=executePluginMethod('log');getImage(request,configTrackerPause)}function logGoal(idGoal,customRevenue,customData){var request=getRequest();request+='&idgoal='+idGoal;if(isDefined(customRevenue)&&customRevenue!==null){request+='&revenue='+customRevenue}if(isDefined(customData)){if(customData!==null){request+='&data='+escapeWrapper(stringify(customData))}}else if(isDefined(configCustomData)){request+='&data='+escapeWrapper(stringify(configCustomData))}request+=executePluginMethod('goal');getImage(request,configTrackerPause)}function logClick(url,linkType,customData){var request;request='idsite='+configTrackerSiteId+'&'+linkType+'='+escapeWrapper(url)+'&rand='+Math.random()+'&redirect=0';if(isDefined(customData)){if(customData!==null){request+='&data='+escapeWrapper(stringify(customData))}}else if(isDefined(configCustomData)){request+='&data='+escapeWrapper(stringify(configCustomData))}request+=executePluginMethod('click');request=configTrackerUrl+'?'+request;getImage(request,configTrackerPause)}function isSiteHostName(hostName){var i,alias,offset;for(i=0;i<configHostsAlias.length;i++){alias=configHostsAlias[i];if(hostName==alias){return true}if(alias.substr(0,2)=='*.'){if((hostName)==alias.substr(2)){return true}offset=hostName.length-alias.length+1;if((offset>0)&&(hostName.substr(offset)==alias.substr(1))){return true}}}return false}function getClassesRegExp(configClasses,defaultClass){var i,classesRegExp='(^| )(piwik_'+defaultClass;if(isDefined(configClasses)){for(i=0;i<configClasses.length;i++){classesRegExp+='|'+configClasses[i]}}classesRegExp+=')( |$)';return new RegExp(classesRegExp)}function getLinkType(className,href,isInLink){if(!isInLink){return'link'}var downloadPattern=getClassesRegExp(configDownloadClasses,'download'),linkPattern=getClassesRegExp(configLinkClasses,'link'),downloadExtensionsPattern=new RegExp('\\.('+configDownloadExtensions+')$','i');return linkPattern.test(className)?'link':(downloadPattern.test(className)||downloadExtensionsPattern.test(href)?'download':0)}function clickHandler(clickEvent){var sourceElement,parentElement,tag,linkType;if(!isDefined(clickEvent)){clickEvent=windowAlias.event}if(isDefined(clickEvent.target)){sourceElement=clickEvent.target}else if(isDefined(clickEvent.srcElement)){sourceElement=clickEvent.srcElement}else{return}while((parentElement=sourceElement.parentNode)&&((tag=sourceElement.tagName)!='A'&&tag!='AREA')){sourceElement=parentElement}if(isDefined(sourceElement.href)){var originalSourceHostName=sourceElement.hostname,sourceHostName=originalSourceHostName.toLowerCase(),sourceHref=sourceElement.href.replace(originalSourceHostName,sourceHostName),scriptProtocol=/^(javascript|vbscript|jscript|mocha|livescript|ecmascript): */i;if(!scriptProtocol.test(sourceHref)){linkType=getLinkType(sourceElement.className,sourceHref,isSiteHostName(sourceHostName));if(linkType){logClick(sourceHref,linkType)}}}}function addClickListener(element){addEventListener(element,'click',clickHandler,false)}function addClickListeners(){if(!linkTrackingInstalled){linkTrackingInstalled=true;var i,ignorePattern=getClassesRegExp(configIgnoreClasses,'ignore'),linkElements=documentAlias.links;if(linkElements){for(i=0;i<linkElements.length;i++){if(!ignorePattern.test(linkElements[i].className)){addClickListener(linkElements[i])}}}}}function registerHook(hookName,userHook){var hookObj=null;if(typeof hookName=='string'&&!isDefined(registeredHooks[hookName])){if(typeof userHook=='object'){hookObj=userHook}else if(typeof userHook=='string'){try{eval('hookObj ='+userHook)}catch(e){}}registeredHooks[hookName]=hookObj}return hookObj}pageReferrer=getReferrer();browserHasCookies=hasCookies();detectBrowserPlugins();executePluginMethod('run',registerHook);return{hook:registeredHooks,getHook:function(hookName){return registeredHooks[hookName]},setTrackerUrl:function(trackerUrl){if(isDefined(trackerUrl)){configTrackerUrl=trackerUrl}},setSiteId:function(siteId){if(isDefined(siteId)){configTrackerSiteId=siteId}},setCustomData:function(customData){if(isDefined(customData)){configCustomData=customData}},setLinkTrackingTimer:function(delay){if(isDefined(delay)){configTrackerPause=delay}},setDownloadExtensions:function(extensions){if(isDefined(extensions)){configDownloadExtensions=extensions}},addDownloadExtensions:function(extensions){if(isDefined(extensions)){configDownloadExtensions+='|'+extensions}},setDomains:function(hostsAlias){if(typeof hostsAlias=='object'&&hostsAlias instanceof Array){configHostsAlias=hostsAlias;configHostsAlias[configHostsAlias.length]=windowAlias.location.hostname}else if(typeof hostsAlias=='string'){configHostsAlias=[hostsAlias,windowAlias.location.hostname]}},setIgnoreClasses:function(ignoreClasses){if(typeof ignoreClasses=='object'&&ignoreClasses instanceof Array){configIgnoreClasses=ignoreClasses}else if(typeof ignoreClasses=='string'){configIgnoreClasses=[ignoreClasses]}},setDocumentTitle:function(title){if(isDefined(title)){configTitle=title}},setDownloadClasses:function(downloadClasses){if(typeof downloadClasses=='object'&&downloadClasses instanceof Array){configDownloadClasses=downloadClasses}else if(typeof downloadClasses=='string'){configDownloadClasses=[downloadClasses]}},setDownloadClass:function(className){if(typeof className=='string'){configDownloadClasses=[className]}},setLinkClasses:function(linkClasses){if(typeof linkClasses=='object'&&linkClasses instanceof Array){configLinkClasses=linkClasses}else if(typeof linkClasses=='string'){configLinkClasses=[linkClasses]}},setLinkClass:function(className){if(typeof className=='string'){configLinkClasses=[className]}},addListener:function(element){if(isDefined(element)){addClickListener(element)}},enableLinkTracking:function(){if(hasLoaded){addClickListeners()}else{registeredOnLoadHandlers[registeredOnLoadHandlers.length]=function(){addClickListeners()}}},trackGoal:function(idGoal,customRevenue,customData){logGoal(idGoal,customRevenue,customData)},trackLink:function(sourceUrl,linkType,customData){logClick(sourceUrl,linkType,customData)},trackPageView:function(){getWebBug()}}}addEventListener(windowAlias,'beforeunload',beforeUnloadHandler,false);addReadyListener();return{addPlugin:function(pluginName,pluginObj){plugins[pluginName]=pluginObj},getTracker:function(piwikUrl,siteId){return new Tracker(piwikUrl,siteId)}}}())}}

/* SERVICES JS */
//GEA-custom
//$cnj = jQuery.noConflict();
if (typeof(cn_is_embed) == 'undefined') cn_is_embed = 1;
if (typeof(server_path) == 'undefined') server_path = 'http://widget.citizennet.com/app/widget/';
if (cn_is_embed == 1) {
    if (typeof(param_width) == 'undefined' || param_width < 10) param_width = -1;
    if (typeof(param_height) == 'undefined' || param_height < 150) param_height = 150;
    if (typeof(param_style) == 'undefined') param_style = '';
    if (typeof(param_colorscheme) == 'undefined') param_colorscheme = '';
    if (typeof(param_i) == 'undefined') param_i = '';
    if (typeof(param_crawl) == 'undefined') param_crawl = '';
    if (typeof(param_u) == 'undefined') param_u = '';
    if (typeof(param_query) == 'undefined') param_query = '';
    if (typeof(param_canvascolor) == 'undefined') param_canvascolor = '';
    if (typeof(param_regulartext) == 'undefined') param_regulartext = '';
    if (typeof(param_highlighttext) == 'undefined') param_highlighttext = '';
    if (typeof(param_lighttext) == 'undefined') param_lighttext = '';
    if (typeof(param_person) == 'undefined') param_person = '';
    if (typeof(param_friend) == 'undefined') param_friend = '';
    if (typeof(param_sponsored) == 'undefined') param_sponsored = '';
    if (typeof(param_admin) == 'undefined') param_admin = '';
    if (typeof(param_aggregate) == 'undefined') param_aggregate = '';
    if (typeof(param_new) == 'undefined') param_new = '';
    if (typeof(param_notification) == 'undefined') param_notification = '';
    if (typeof(param_accordion_bar) == 'undefined') param_accordion_bar = '';
    if (typeof(param_accordion_bar_text) == 'undefined') param_accordion_bar_text = '';
    if (typeof(param_slide) == 'undefined') param_slide = '';
    if (typeof(param_noise) == 'undefined') param_noise = '';
    if (typeof(param_filterlink) == 'undefined') param_filterlink = '';
    if (typeof(param_separator) == 'undefined') param_separator = '';
    if (typeof(param_comment) == 'undefined') param_comment = 'on';
    if (typeof(param_cnlogo) == 'undefined') param_cnlogo = 'on';
    if (typeof(param_piwik) == 'undefined') param_piwik = 'on';
    if (typeof(param_loading) == 'undefined') param_loading = 'on';
    var params_str = '?renderwidget=1&width=' + param_width + '&height=' + param_height + '&widget_style=' + param_style + '&widget_i=' + param_i + '&widget_colorscheme=' + param_colorscheme + '&widget_crawl=' + param_crawl + '&widget_u=' + param_u + '&widget_query=' + param_query + '&widget_canvascolor=' + param_canvascolor + '&widget_highlighttext=' + param_highlighttext + '&widget_lighttext=' + param_lighttext + '&widget_person=' + param_person + '&widget_friend=' + param_friend + '&widget_sponsored=' + param_sponsored + '&widget_admin=' + param_admin + '&widget_aggregate=' + param_aggregate + '&widget_new=' + param_new + '&widget_notification=' + param_notification + '&widget_accordion_bar=' + param_accordion_bar + '&widget_accordion_bar_text=' + param_accordion_bar_text + '&widget_slide=' + param_slide + '&widget_noise=' + param_noise + '&widget_filterlink=' + param_filterlink + '&widget_separator=' + param_separator + '&widget_comment=' + param_comment + '&widget_piwik=' + param_piwik + '&stamp=' + new Date().getTime().toString()
}
var json_param = "&tagmode=any&format=json&jsoncallback=?";
var ajax_loader_path = 'http://widget.citizennet.com/app/assets/images/widget/CN_rotator_v01.gif';
var cn_piwik_site_url = 'http://piwik.citizennet.com/';

function textCounter(elem, box_numb) {
    var maxlimit = 140;
    var remaining = maxlimit - elem.value.length;
    if (remaining < 0) {
        $('#msg_dv_' + box_numb).css({
            'display': 'block',
            'color': 'red'
        });
        $('#msg_dv_' + box_numb).html('<b>Over the maximum limit of characters</b>')
    } else if (remaining < 2) {
        $('#msg_dv_' + box_numb).css('display', 'none')
    } else {
        $('#msg_dv_' + box_numb).css('display', 'none')
    }
    $('#chars_counter_' + box_numb).html((remaining) + ' left');
    if (remaining == 140) {
        $('#post_tweet_' + box_numb).attr('disabled', 'disabled')
    } else if (remaining < 0) {
        $('#post_tweet_' + box_numb).attr('disabled', 'disabled')
    } else {
        $('#post_tweet_' + box_numb).removeAttr('disabled')
    }
}
function PostIt(index, tweet_id, tweet_user_id, current_instance_id, tweet_user_name) {
    var status_text = $('#status_text_' + index).val();
    if (status_text != '') {
        $.getJSON(server_path + "ajax_post.php?status=" + encodeURIComponent(status_text) + '&tweet_id=' + tweet_id + '&type=1&tweet_user_id=' + tweet_user_id + '&current_instance_id=' + current_instance_id + '&tweet_user_name=' + tweet_user_name + '&tweet_end=' + tweet_end + '&tweet_url=' + tweet_url + '&eid=' + instance_engage_id + json_param, function (data) {
            if (data == 'FAILURE') {
                hideModalDialog(index);
                box_number = index;
                window.open(server_path + 'auth.php', '', 'width=775,height=558,left=10,top=10,resizable,scrollbars')
            } else {
                var arr_tokens = data.split('||||');
                if (arr_tokens && arr_tokens.length > 1) {
                    status_text = arr_tokens[1]
                }
                createData(index, tweet_id, status_text, 'twitter');
                hideModalDialog(index)
            }
        })
    }
}
function createData(index, tweet_id, status_text, service_type) {
    var name_link = '';
    if (service_type != 'facebook') {
        name_link = escape('http://twitter.com/' + twitter_user_name)
    } else {
        name_link = escape('http://www.facebook.com/profile.php?id=' + fb_user_id)
    }
    if ($('#user_comment_' + tweet_id) && $('#user_comment_' + tweet_id).css('display') == 'none') $('#user_comment_' + tweet_id).css('display', '');
    var div = document.getElementById('user_comment_' + tweet_id);
    var new_div = document.createElement('div');
    new_div.style.marginBottom = '3px';
    reply_box = '<div style="padding:0;width:12px" class="cn-fleft">&nbsp;</div>';
    reply_box += '<div class="cn-fleft" style="padding:5px; width:' + (width - (cn_is_ff ? 61 : 62)) + 'px;background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + ');">';
    reply_box += '<div class="cn-fleft" style="width:35px;">';
    reply_box += '<a class="cn-lucida_fm user_screenname_class" href="javascript:void(0);" onclick="javascript:openUrl(\'' + name_link + '\', 0, ' + tweet_id + ');"><img height="32px" width="32px" src="' + ((service_type == 'facebook') ? fb_user_image : twitter_user_image) + '" /></a>';
    reply_box += '</div>';
    reply_box += '<div class="cn-text-left cn-fleft" style="padding-left:0px; width:' + (width - (cn_is_ff ? 98 : 99)) + 'px;">';
    reply_box += '<div id="reply_contents_' + index + '" class="cn-lucida_fm cn-fsize11 cn-w100-percent" style="color:#' + widget_regulartext + '">';
    reply_box += '<a class="cn-lucida_fm cn-text-none cn-fsize11 ' + ((cn_is_embed == 1) ? 'user_screenname_class' : '') + '" href="javascript:;" onclick="javascript:openUrl(\'' + name_link + '\', 0, ' + tweet_id + ');" style="color:#' + widget_regulartext + ';"><b>' + ((service_type == 'facebook') ? fb_user_name : twitter_user_name) + '</b></a>&nbsp;';
    reply_box += '<span class="cn-lucida_fm cn-fsize11 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '" ' + ((cn_is_embed == 1) ? '' : 'style="color:#' + widget_regulartext + ';"') + '>' + status_text + '</span>';
    reply_box += '</div>';
    reply_box += '</div>';
    reply_box += '</div>';
    reply_box += '<div class="cn-cboth"></div>';
    new_div.innerHTML = reply_box;
    div.appendChild(new_div);
    $('#replies_tb_' + index).css('display', '');
    $('#comments_count_' + index).css('display', '');
    $('#comments_count_' + index).html(parseInt($('#comments_count_' + index).html()) + 1)
}
function PostMessage(index, current_instance_id) {
    var status_text = $('#status_text_' + index).val();
    if (status_text != '' && status_text != 'Enter your message here') {
        $('#status_text_' + index).val('');
        $('#status_text_' + index).html('');
        $('#chars_counter_' + index).html('140 left');
        $.getJSON(server_path + "ajax_post.php?status=" + encodeURIComponent(status_text) + '&type=0&current_instance_id=' + current_instance_id + '&tweet_end=' + tweet_end + '&tweet_url=' + tweet_url + '&eid=' + instance_engage_id + json_param, function (data) {
            if (data == 'FAILURE') {
                hideModalDialog(index);
                box_number = index;
                window.open(server_path + 'auth.php', '', 'width=775,height=558,left=10,top=10,resizable,scrollbars')
            } else {
                var arr_tokens = data.split('||||');
                if (arr_tokens && arr_tokens.length > 1) {
                    status_text = arr_tokens[1]
                }
                createMessageBox(status_text, ((typeof(arr_tokens[4]) != 'undefined') ? arr_tokens[4] : 0))
            }
        })
    }
}
var message_index = 0;
var messages_array = new Array();

function createMessageBox(status_text, tweet_id) {
    messages_array[message_index] = status_text;
    createMessageData(status_text, 'twitter', tweet_id);
    message_index++
}
function createMessageData(status_text, service_type, tweet_id) {
    var avatar_link = '';
    if (service_type != 'facebook') {
        avatar_link = escape('http://twitter.com/' + twitter_user_name)
    } else {
        avatar_link = escape('http://www.facebook.com/profile.php?id=' + fb_user_id)
    }
    if ($('#user_messages_div').css('display') == 'none') $('#user_messages_div').css('display', '');
    var parentDiv = document.getElementById('user_messages_div');
    var box = opacity = tweet_box_class = '';
    if (cn_is_embed == 1) {
        opacity = 'opacity:1.0;';
        color = 'transparent !important';
        tweet_box_class = 'tweet_box'
    } else {
        color = widget_person
    }
    var newDiv = document.createElement('div');
    newDiv.className = 'cn-tweet-box ' + tweet_box_class;
    newDiv.style.width = (width - (cn_is_ff ? 22 : (cn_is_ie ? 23 : (cn_is_chrome ? 23 : 19)))) + 'px';
    try {
        newDiv.style.color = '#' + cn_font_color
    } catch (e) {}
    if (widget_separator != '') {
        newDiv.style.marginTop = '0px';
        newDiv.style.borderBottom = '1px dashed #' + widget_separator
    }
    box += '<div class="inner-box" ' + (cn_is_ie ? 'style="width:' + (width - 23) + 'px"' : '') + '>';
    box += '<a href="javascript:;" class="cn-profile-image cn-fleft" onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + tweet_id + ');">' + ((service_type == 'facebook') ? FB_imageHTML(fb_user_image) : '<img src="' + twitter_user_image + '" border="0"  height="48" width="48" class="cn-mr2"/>') + '</a>';
    box += '<div style="color:#' + cn_font_color + ';">';
    box += '<div class="cn-small cn-lucida_fm" align="left" style="padding-left:5px; font-size:' + cn_font_size + 'px; color:#' + widget_regulartext + '; ' + opacity + '">';
    box += '<a class="cn-text-none cn-fsize13 ' + ((cn_is_embed == 1) ? 'user_screenname_class' : '') + '" href="javascript:;" ' + ((cn_is_embed == 1) ? '' : 'style="color:#' + widget_regulartext + '";') + ' onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + tweet_id + ');"><b>' + ((service_type == 'facebook') ? fb_user_name : twitter_user_name) + '</b></a>&nbsp;';
    box += '<span class="cn-lucida_fm cn-fsize13 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">' + status_text + '</span>';
    box += '<div class="cn-time-padd cn-text-right ' + ((cn_is_embed == 1) ? 'tweet_time_class' : '') + '" style="background-color:' + color + '; color:#' + widget_highlighttext + '; font-size:' + cn_highlight_text_font + 'px">right now</div>';
    box += '</div>';
    box += '<div class="cn-cboth"></div>';
    box += '</div>';
    box += '</div>';
    box += '<div class="cn-cboth"></div>';
    newDiv.innerHTML = box;
    parentDiv.insertBefore(newDiv, parentDiv.firstChild);
    $('#msg_dv_0').css('display', 'none');
    updateStatusBox(service_type)
}
function updateStatusBox(service_type) {
    $('#status_text_0').css({
        'width': (width - 163) + 'px',
        'height': '40px'
    });
    $('#community_publishercontents').css('width', (width - 78) + 'px');
    $('#div_current_user_image').html(((service_type == 'facebook') ? FB_imageHTML(fb_user_image) : '<img height=\'48\' width=\'48\' id=\'twitter_user_image\' border=\'0\' alt=\'\' src=\'' + twitter_user_image + '\'/>'));
    $('#div_current_user_image').css({
        'width': '48px',
        'display': ''
    })
}
function CN_URLEncode(clearString) {
    var output = '';
    var x = 0;
    clearString = clearString.toString();
    var regex = /(^[a-zA-Z0-9_.]*)/;
    while (x < clearString.length) {
        var match = regex.exec(clearString.substr(x));
        if (match != null && match.length > 1 && match[1] != '') {
            output += match[1];
            x += match[1].length
        } else {
            if (clearString[x] == ' ') output += '+';
            else {
                var charCode = clearString.charCodeAt(x);
                var hexVal = charCode.toString(16);
                output += '%' + (hexVal.length < 2 ? '0' : '') + hexVal.toUpperCase()
            }
            x++
        }
    }
    return output
}
function CN_includeLibrary(libraryName) {
    try {
        document.write('<script type="text/javascript" src="' + libraryName + '"><\/script>')
    } catch (e) {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = libraryName;
        document.getElementsByTagName('head')[0].appendChild(script)
    }
}
function dec2hex(value) {
    if (value.indexOf('#') > -1) {
        value = value.replace('#', '')
    } else if (value.indexOf('rgb') > -1) {
        var keys = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
        value = value.replace(/\s+/, '').replace('rgb(', '').replace(')', '');
        var tokens = value.split(',');
        if (tokens && tokens.length == 3) {
            value = '';
            for (var i = 0; i < tokens.length; i++) {
                value += keys[Math.floor((tokens[i]) / 16)] + keys[(tokens[i]) % 16]
            }
        }
    }
    return value
}
function in_array(needle, haystack) {
    var key = '';
    for (key in haystack) {
        if (haystack[key] == needle) {
            return true
        }
    }
    return false
}
//GEA-custom
/*if (cn_is_embed == 1) CN_LoadWidget();*/
var open_media_count = 0,
    min_width = 200;
var interval_handle = blind_interval = records_html = header_html = '',
    globalResponse = cn_top_username = cn_prizes = cn_scores = '';
var cn_font_color = '',
    cn_logo = '',
    cn_widget_notification = '',
    user_contest_points = '';
var cn_latest_feed_date = cn_new_records_count = cn_has_token = js_time_updater = cn_current_tab = 0;
var cn_font_size = 11,
    cn_highlight_text_font = 9,
    cn_add_js = 1;
var cn_is_chrome = (navigator.userAgent.indexOf('Chrome') > -1) ? true : false;
var cn_is_ff = (navigator.userAgent.indexOf('Firefox') > -1) ? true : false;
var cn_is_ie = (navigator.userAgent.indexOf('MSIE') > -1) ? true : false;

function CN_LoadWidget() {
        //GEA-custom
        /*document.write('<div id="ajax_div" class="tweet_text_class">' + (param_loading == 'on' ? '<img class="cn-border-none" src="' + ajax_loader_path + '" />' : '') + '</div>');
        document.write('<div id="cn_default_vars">&nbsp;</div>');
        document.write('<div id="piwik_tracking_code">&nbsp;</div>');*/
        $('div#citizennet-inner').html("<div id=\"ajax_div\" class=\"tweet_text_class\">' + (param_loading == 'on' ? '<img class=\"cn-border-none\" src=\"' + ajax_loader_path + '\" />' : '') + '</div><div id=\"cn_default_vars\">&nbsp;</div><div id=\"piwik_tracking_code\">&nbsp;</div>");
        FB_verifySession(0, null);
        param_regulartext = dec2hex($('#ajax_div').css('color'));
        params_str += '&widget_regulartext=' + param_regulartext;
        $.getJSON(server_path + "embedfeeds.php" + params_str + json_param, function (response) {
        	//console.log(response);
            if (typeof(response[0].error) != 'undefined') {
                $("#ajax_div").html('');
                return false
            }
            globalResponse = response;
            $('#cn_default_vars').html(globalResponse[0].default_js_vars);
		        tm.resize();
            return false
        })
    }
function loadJsonResponse() {
        var contents = '';
        cn_contest = globalResponse[0].contest;
        user_contest_points = globalResponse[0].user_contest_points;
        cn_new_recods_count = globalResponse[0].new_recods_count;
        cn_latest_feed_date = globalResponse[0].latest_feed_date;
        cn_has_token = globalResponse[0].has_token;
        cn_widget_notification = globalResponse[0].widget_notif;
        if (cn_is_embed == 1) {
            widget_canvascolor = 'transparent'
        }
        if (width < 0) {
            param_width = $('#ajax_div').width();
            if (param_width == $('body').width()) param_width -= 20;
            width = param_width - 4
        }
        var xml_arr = globalResponse[0].xml_data;
        for (var i = 0; i < xml_arr.length; i++) {
            contents += CN_MaketheLiveTwitterBox(xml_arr[i], (i + 1), false)
        }
        cn_font_color = (widget_color_scheme == 'dark' ? 'F0F0F0' : '000000');
        cn_logo = (widget_color_scheme == 'dark' ? 'logoWhite.png' : 'logoBlack.png');
        contents = CN_feedsMainHTML(contents);
        contents = CN_addFeedsInMainContainer(contents);
        $("#ajax_div").html(contents);
        if (widget_piwik == 1 || widget_piwik == 'on') {
            var cn_piwik_sites = (typeof(globalResponse[0].track_site) != 'undefined' && globalResponse[0].track_site != '') ? globalResponse[0].track_site.toString().split('_') : false;
            if (cn_piwik_sites && typeof(cn_piwik_sites.length) != 'undefined' && cn_piwik_sites.length > 0) {
                CN_makePiwikCode(cn_piwik_sites, globalResponse[0].req_referer)
            }
        }
        setTimeout(function () {
            unfadeDivs(200)
        }, 2000);
        setTimeout(function () {
            initiateTimer()
        }, 30000)
    }
function CN_makePiwikCode(cn_piwik_sites, cn_req_referer) {
        try {
            var pkBaseURL = (("https:" == document.location.protocol) ? cn_piwik_site_url.replace('http', 'https') : cn_piwik_site_url);
            var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", cn_piwik_sites[0]);
            piwikTracker.setDocumentTitle(cn_req_referer);
            piwikTracker.trackPageView();
            var tracker_code = '<noscript><p><img src="' + cn_piwik_site_url + 'piwik.php?idsite=' + cn_piwik_sites[0] + '" style="border:0" alt=""/>';
            if (cn_piwik_sites.length > 1) {
                var piwikTracker1 = Piwik.getTracker(pkBaseURL + "piwik.php", cn_piwik_sites[1]);
                piwikTracker1.setDocumentTitle(cn_req_referer);
                piwikTracker1.trackPageView();
                tracker_code += '<img src="' + cn_piwik_site_url + 'piwik.php?idsite=' + cn_piwik_sites[1] + '" style="border:0" alt=""/>'
            }
            tracker_code += '</p></noscript>';
            $('#piwik_tracking_code').html(tracker_code)
        } catch (err) {}
    }
function CN_getAutoPlayValues(source) {
        autoplay = '&autoplay=1';
        if (source.indexOf('myspace') > -1) {
            if (source.indexOf('ap=1') > -1) {
                autoplay = ''
            } else {
                autoplay = '&ap=1'
            }
        }
        return autoplay
    }
function CN_isAnyReplyMsgExists(data) {
        var relpy_msg_count = retweet_count = 0;
        var count = ((typeof(data.childmessages) != 'undefined' && data.childmessages.length > 0) ? data.childmessages.length : 0);
        for (i = 0; i < count; i++) {
            if (typeof(data.childmessages[i]) != 'undefined') {
                childtype = data.childmessages[i].childtype;
                if (childtype == 'retweet_text' || childtype == 'retweet_search' || childtype == 'retweet_api') retweet_count++;
                else if (childtype == 'userreply' || childtype == 'messagereply') relpy_msg_count++
            }
        }
        return Array(relpy_msg_count, retweet_count)
    }
function CN_MaketheLiveTwitterBox(data, index, color) {
        var fb_login_true = (typeof(show_fb_connect) != 'undefined' && parseInt(show_fb_connect) == 1 && fb_user_id && fb_user_id != '') ? true : false;
        if (data.service == 'facebook') {
            var func_call = 'FB_verifyLogin(' + index + ', function(){openModalBox(' + index + ', \'facebook\');});'
        } else {
            var func_call = 'javascript:getOathToken(' + index + '); return false;';
            if (cn_has_token == 1) {
                func_call = 'javascript:openModalBox(' + index + ', \'twitter\'); return false;'
            }
        }
        var box = autoplay = display = extra_style = profile_image = '';
        if (typeof(data.profile_image_url) != 'undefined' && data.profile_image_url != '') profile_image = data.profile_image_url;
        else if (typeof(data.user.profile_image_url) != 'undefined' && data.user.profile_image_url != '') profile_image = data.user.profile_image_url;
        if (data.service == 'facebook') {
            profile_image = FB_imageHTML(profile_image)
        } else {
            profile_image = '<img src="' + profile_image + '" border="0"  height="48" width="48" class="cn-mr2 cn-cursor"/><br/>'
        }
        var avatar_link = '';
        if (profile_image && profile_image != '') {
            if (data.service != 'facebook') {
                avatar_link = CN_URLEncode('http://twitter.com/' + ((typeof(data.user.screen_name) != 'undefined') ? unescape(data.user.screen_name) : ''))
            } else {
                avatar_link = CN_URLEncode('http://www.facebook.com/profile.php?id=' + ((typeof(data.user.id) != 'undefined') ? data.user.id : ''))
            }
        }
        if (color == false) {
            color = widget_canvascolor;
            if (index <= (cn_new_recods_count + messages_sum)) {
                if (cn_add_js != 1 && widget_slide == 'on' && index > 10) {} else {
                    color = new_entries_color
                }
            }
        }
        if (typeof(data.media) != 'undefined' && typeof(data.media.source) != 'undefined') {
            autoplay = CN_getAutoPlayValues(data.media.source)
        }
        var shares_count = 1;
        if (index > 1 && widget_separator != '') {
            extra_style = ' margin-top:0px; border-top:1px dashed #' + widget_separator + ';'
        }
        var ret_data = CN_isAnyReplyMsgExists(data);
        var reply_msg_count = ret_data[0];
        var retweets_count = ret_data[1];
        var opacity = '';
        var tweet_box_class = '';
        if (cn_is_embed == 1) {
            opacity = 'opacity:1.0;';
            color = 'transparent !important';
            tweet_box_class = 'tweet_box'
        }
        var can_reply_it = (parseInt(data.messageid) != 0) ? true : false;
        box += '<div id="box_' + index + '" class="cn-tweet-box ' + tweet_box_class + '" style="width:' + (width - (cn_is_ff ? 22 : (cn_is_ie ? 23 : (cn_is_chrome ? 23 : 19)))) + 'px; color:#' + cn_font_color + '; ' + extra_style + '">';
        box += '<div class="inner-box" ' + (cn_is_ie ? 'style="width:' + (width - 23) + 'px"' : '') + '>';
        box += '<div class="cn-fleft cn-text-center cn-profile-image"><a href="javascript:;" class="cn-mb3" onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + data.messageid + ');">' + profile_image + '</a> ' + ((can_reply_it && parseInt(widget_comment) == 1) ? '<span style="color:#' + widget_lighttext + '; font-size:' + cn_font_size + 'px;"><a class="reply_link_' + data.service + ' cn-text-none ' + ((cn_is_embed == 1) ? 'reply_text_class' : '') + '" style="color:#' + widget_lighttext + '; font-size:' + cn_font_size + 'px; ' + (((hasToken && data.service == 'twitter') || (fb_login_true && data.service == 'facebook')) ? '' : 'display:none') + '" href="javascript:;" onClick = "' + func_call + '" >Reply</a></span>' : '') + CN_getUserPoints(data.user.screen_name) + '</div>';
        box += '<div style="color:#' + cn_font_color + ';width:' + (width - (cn_is_ff ? 79 : ((cn_is_ie || cn_is_chrome) ? 80 : 76))) + 'px;" class="cn-fleft">';
        box += '<div class="cn-small cn-lucida_fm" id="text_div_' + index + '" align="left" style="padding-left:5px; font-size:' + cn_font_size + 'px; color:#' + widget_regulartext + '; ' + opacity + '">';
        box += '<a class="cn-text-none cn-fsize13 ' + ((cn_is_embed == 1) ? 'user_screenname_class' : '') + '" href="javascript:;" ' + ((cn_is_embed == 1) ? '' : 'style="color:#' + widget_regulartext + '";') + ' onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + data.messageid + ');"><b>' + unescape(data.user.screen_name) + '</b></a> ';
        box += '<span class="cn-lucida_fm cn-fsize13 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">' + ((typeof(data.contents) != 'undefined') ? data.contents : '') + '</span>';
        box += '<div class="cn-time-padd cn-text-right ' + ((cn_is_embed == 1) ? 'tweet_time_class' : '') + '" id="time_div_' + data.id + '" style="background-color:' + color + '; color:#' + widget_highlighttext + '; font-size:' + cn_highlight_text_font + 'px">' + ((data.tweet_time != '') ? getTweetTime(data.tweet_time) : '') + '</div>';
        box += '</div>';
        box += '<div class="cn-cboth"></div>';
        box += '</div>';
        box += '</div>';
        box += '<div class="cn-cboth"></div>';
        if (can_reply_it && parseInt(widget_comment) == 1) box += '<div id="status_dialog_' + index + '" style="width:' + (width - (cn_is_ff ? 56 : ((cn_is_chrome || cn_is_ie) ? 57 : 53))) + 'px;display:none;margin:0 5px 3px 27px; padding:5px 0 5px 5px; background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + ');">' + CN_getStatusDialogBox(index, data) + '</div>';
        box += '</div>';
        if (can_reply_it) box += '<div id="msg_dv_' + index + '" style="display:none; font-size:' + cn_font_size + 'px;" align="center">&nbsp;</div>';
        if (typeof(data.media) != 'undefined' && typeof(data.media.media_type) != 'undefined' && data.media.media_type == 'application/x-shockwave-flash') {
            box += CN_getVideoBox(data, index, color, opacity)
        } else if (typeof(data.media) != 'undefined' && typeof(data.media.media_type) != 'undefined' && data.media.media_type == 'image') {
            box += CN_getSingleImageBox(data, index, color, opacity)
        }
        if (!can_reply_it) {
            return box
        }
        if (retweets_count > 0) {
            box += '<table cellpadding="0" cellspacing="0" class="cn-text-left cn-fsize12 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '" style="' + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext + ';') + 'margin:0 0 3px 30px" width="' + (width - (cn_is_ff ? 51 : 52)) + '">';
            box += '<tr style="line-height:0;height:12px"><td valign="bottom"><img class="cn-vertical-top cn-border-none" src="' + server_path + 'triangle.php?color=' + cn_transparent_bg + '" /></td></tr><tr><td style="padding:0 0 0 5px;background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + ')"><img src="' + server_path + 'images/retweet_small.png" align="absmiddle" onclick="CN_showTweetsReplies(\'retweet\', ' + data.id + ',0)" class="cn-cursor cn-border-none" /> <span ' + ((retweets_count == 0) ? 'style="display:none"' : '') + '>' + retweets_count + '</span> ReTweet' + ((retweets_count > 1) ? 's' : '') + ' ' + ((retweets_count > 4) ? '<span id="show_retweet_' + data.id + '"><a href="javascript:;" onclick="CN_showTweetsReplies(\'retweet\', ' + data.id + ',1)">Show All</a> <img src="' + server_path + 'images/show.png" style="float:none" align="bottom" class="cn-border-none" /></span> <span id="hide_retweet_' + data.id + '" style="display:none"><a href="javascript:;" onclick="CN_showTweetsReplies(\'retweet\', ' + data.id + ',0)">Hide All</a> <img src="' + server_path + 'images/hide.png" style="float:none" align="bottom" class="cn-border-none" /></span>' : '') + '</td></tr>';
            box += '</table>';
            box += '<div class="cn-retweet-container cn-text-left" style="padding:0 15px 5px 9px; margin-bottom:3px; width:' + (width - (cn_is_ff ? 75 : 76)) + 'px; background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + '); color:#' + cn_font_color + ';" id="user_retweet_' + data.id + '" >';
            box += CN_getReplyMsgBoxes(data, index, color, 1, retweets_count);
            box += '</div>'
        }
        box += '<table id="replies_tb_' + index + '" cellpadding="0" cellspacing="0" class="cn-text-left cn-fsize12 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '" style="' + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext + ';') + 'margin:0 0 ' + ((cn_is_ff) ? '0' : '3px') + ' 30px; ' + ((reply_msg_count == 0) ? 'display:none' : '') + '" width="' + (width - (cn_is_ff ? 51 : 52)) + '">';
        box += '<tr ' + ((retweets_count == 0) ? 'style="line-height:0;height:12px"' : '') + '>' + ((retweets_count == 0) ? '<td valign="bottom"><img class="cn-vertical-top cn-border-none" src="' + server_path + 'triangle.php?color=' + cn_transparent_bg + '" /></td></tr><tr>' : '') + '<td style="padding:0 0 0 5px;background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + ')"><img src="' + server_path + 'images/comments.png" align="' + ((cn_is_chrome) ? 'top' : 'absmiddle') + '" onclick="CN_showTweetsReplies(\'comment\', ' + data.id + ',0)" class="cn-cursor cn-border-none" /> <span id="comments_count_' + index + '" ' + ((reply_msg_count == 0) ? 'style="display:none"' : '') + '>' + reply_msg_count + '</span> Comment' + ((reply_msg_count > 1) ? 's' : '') + ' ' + ((reply_msg_count > 2) ? '<span id="show_comment_' + data.id + '"><a href="javascript:;" onclick="CN_showTweetsReplies(\'comment\',' + data.id + ',1)">Show All</a> <img src="' + server_path + 'images/show.png" style="float:none" align="bottom" class="cn-border-none" /></span> <span id="hide_comment_' + data.id + '" style="display:none"><a href="javascript:;" onclick="CN_showTweetsReplies(\'comment\', ' + data.id + ',0)">Hide All</a> <img src="' + server_path + 'images/hide.png"  style="float:none" align="bottom" class="cn-border-none" /></span>' : '') + '</td></tr>';
        box += '</table>';
        box += '<div class="cn-retweet-container cn-text-left" style="margin:0 0 0 18px; width:' + (width - (cn_is_ff ? 39 : 40)) + 'px;" id="user_comment_' + data.id + '">';
        if (reply_msg_count > 0) {
            box += CN_getReplyMsgBoxes(data, index, color, 0, reply_msg_count)
        }
        box += '</div>';
        return box
    }
function CN_showTweetsReplies(type, id, flag) {
        var display = 'none',
            limit = 4;
        if (flag == 1) {
                $('#show_' + type + '_' + id).css('display', 'none');
                $('#hide_' + type + '_' + id).css('display', '');
                display = (type != 'comment') ? 'inline-block' : ''
            } else {
                $('#show_' + type + '_' + id).css('display', '');
                $('#hide_' + type + '_' + id).css('display', 'none')
            }
        if (type == 'comment') {
                limit = 2
            }
        if ($('#user_' + type + '_' + id) != 'undefined') {
                var node_type = (type == 'comment') ? 'div' : 'span';
                var kids = document.getElementById('user_' + type + '_' + id).childNodes;
                if (typeof(kids.length) != 'undefined') {
                    if (type == 'comment') {
                        limit = (parseInt(kids.length) > 2) ? (kids.length - 2) : limit;
                        for (var i = 0; i < kids.length; i++) {
                            if (display == 'none' && i >= limit) {
                                continue
                            }
                            kids[i].style.display = display
                        }
                    } else {
                        for (var i = 0; i < kids.length; i++) {
                            if (display == 'none' && i < limit) {
                                continue
                            }
                            kids[i].style.display = display
                        }
                    }
                }
            }
    }
function CN_getReplyMsgBoxes(data, index, color, type, total_msg) {
        if (typeof(data.childmessages) == 'undefined') return '';
        var fb_login_true = (typeof(show_fb_connect) != 'undefined' && parseInt(show_fb_connect) == 1 && fb_user_id && fb_user_id != '') ? true : false;
        var reply_msg_count = data.childmessages.length;
        var reply_box = '',
            replies = 0;
        for (var m = 0; m < reply_msg_count; m++) {
                if (typeof(data.childmessages[m].user.screen_name) != 'undefined' && data.childmessages[m].user.screen_name != '' && typeof(data.childmessages[m].contents) != 'undefined' && data.childmessages[m].contents != '') {
                    childtype = data.childmessages[m].childtype;
                    if ((childtype != 'messagereply' && childtype != 'userreply') && type == 0) continue;
                    if ((childtype != 'retweet_text' && childtype != 'retweet_search' && childtype != 'retweet_api') && type == 1) continue;
                    var avatar_link = '';
                    if (data.childmessages[m].service != 'facebook') {
                        avatar_link = CN_URLEncode('http://twitter.com/' + ((typeof(data.childmessages[m].user.screen_name) != 'undefined') ? unescape(data.childmessages[m].user.screen_name) : ''))
                    } else {
                        avatar_link = CN_URLEncode('http://www.facebook.com/profile.php?id=' + ((typeof(data.childmessages[m].user.id) != 'undefined') ? data.childmessages[m].user.id : ''))
                    }
                    var profile_image = '';
                    if ((typeof(data.childmessages[m].user.profile_image_url) != 'undefined' && data.childmessages[m].user.profile_image_url != '')) {
                        profile_image = data.childmessages[m].user.profile_image_url
                    } else if ((typeof(data.childmessages[m].profile_image_url) != 'undefined' && data.childmessages[m].profile_image_url != '')) {
                        profile_image = data.childmessages[m].profile_image_url
                    }
                    replies++;
                    if (type == 0) {
                        reply_box += '<div style="margin-bottom:3px;' + ((parseInt(replies) < parseInt(total_msg) - 1) ? 'display:none' : '') + '">';
                        reply_box += '<div style="padding:0;width:12px" class="cn-fleft">&nbsp;</div>';
                        reply_box += '<div class="cn-fleft" style="padding:5px; width:' + (width - (cn_is_ff ? 61 : 62)) + 'px;background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + ');">';
                        reply_box += '<div class="cn-fleft" style="width:35px;">';
                        reply_box += '<img onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + data.childmessages[m].id + ');" height="32px" width="32px" src="' + profile_image + '" class="cn-cursor" />';
                        reply_box += '</div>';
                        reply_box += '<div class="cn-text-left cn-fleft" style="padding-left:0px; width:' + (width - (cn_is_ff ? 98 : 99)) + 'px;">';
                        reply_box += '<div id="reply_contents_' + index + '" class="cn-lucida_fm cn-fsize11 cn-w100-percent ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '" ' + ((cn_is_embed == 1) ? '' : 'style="color:#' + widget_regulartext + ';"') + '>';
                        reply_box += '<a class="cn-lucida_fm cn-text-none cn-fsize11 ' + ((cn_is_embed == 1) ? 'user_screenname_class' : '') + '" href="javascript:;" onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + data.childmessages[m].id + ');" style="color:#' + widget_regulartext + ';"><b>' + unescape(data.childmessages[m].user.screen_name) + '</b></a> ';
                        reply_box += ((typeof(data.childmessages[m].contents) != 'undefined') ? data.childmessages[m].contents : '');
                        reply_box += '</div>';
                        reply_box += '<div style="color:#' + widget_highlighttext + ';" class="cn-text-right cn-pt5 cn-fsize9 ' + ((cn_is_embed == 1) ? 'tweet_time_class cn-lucida_fm' : 'cn-lucida_fm') + '" id="time_div_' + data.id + '_' + data.childmessages[m].id + '">' + ((data.childmessages[m].tweet_time != '') ? getTweetTime(data.childmessages[m].tweet_time) : '') + '</div>';
                        reply_box += '</div>';
                        reply_box += '</div>';
                        reply_box += '<div class="cn-cboth"></div>';
                        reply_box += '</div>'
                    } else {
                        reply_box += '<span class="cn-pl6" style="' + ((replies > 4) ? 'display:none;' : 'display:inline-block;') + 'padding-top:5px;">';
                        reply_box += '<img title="' + unescape(data.childmessages[m].user.screen_name) + '" onclick="javascript:openUrl(\'' + avatar_link + '\', 0, ' + data.childmessages[m].id + ');" height="32px" width="32px" src="' + profile_image + '" class="cn-cursor" />';
                        reply_box += '</span>'
                    }
                }
            }
        return reply_box
    }
function CN_getVideoBox(data, index, color, opacity) {
        var box = '';
        var shares_count = 1;
        var autoplay = CN_getAutoPlayValues(data.media.source);
        var play_video_onclick = "onClick='playVideo(\"" + ((typeof(data.media.source) != 'undefined' && data.media.source != '') ? data.media.source : '') + "\"," + (cn_embed_width) + "," + (cn_embed_height) + ", \"" + autoplay + "\"," + index + ", 1,1, " + data.messageid + ");return false;'";
        var hide_video_onclick = "onclick='hideShareBox(" + index + "); return false;'";
        var video_icon = "<a class='cn-tweet_link' href='javascript:;' " + play_video_onclick + " class='cn-cursor'>enlarge video</a> <span " + play_video_onclick + " id='enlarge_video_" + index + "' style='cursor:pointer; font-size:10pt;'><img id='enlarge_image' src='" + cn_images_path + "enlarge.png' /></span>";
        var thumb_width = 62;
        var thumb_height = 62;
        box += '<table class="cn-p3" cellpadding="0" cellspacing="0" width="' + (width - (cn_is_ff ? 13 : (cn_is_chrome ? 24 : (cn_is_ie ? 24 : 21)))) + '" id="video_box_' + index + '" border="0" style="background-color:' + color + '; color:#' + cn_font_color + '; ' + opacity + '">';
        box += '<tr>';
        box += '<td width="52" valign="top" class="cn-pl25">';
        box += '<img width="48" id="play_video_dv_' + index + '" onClick="playVideo(\'' + ((typeof(data.media.source) != 'undefined' && data.media.source != '') ? data.media.source : '') + '\',' + (cn_embed_width) + ',' + (cn_embed_height) + ', \'' + autoplay + '\',' + index + ', 1,0, ' + data.messageid + ');return false;" class="cn-cursor" src="' + data.media.thumbnail + '" />';
        box += '</td>';
        box += '<td id="backshadow_' + index + '" valign="top" class="cn-text-left cn-pl4" style="font-size:' + cn_font_size + 'px; color:#' + cn_font_color + '">';
        box += '<div class="cn-fleft">';
        box += '<div class="cn-p0 cn-fsize10" style="color:#' + widget_regulartext + '">' + video_icon + '</div>';
        box += '</div>';
        box += '<div class="cn-cboth">&nbsp;</div>';
        box += '</td>';
        box += '</tr>';
        box += '</table>';
        box += '<div id="swfContainer_' + index + '" class="cn-large-video" style="background-color:' + color + '; width:' + (width - (cn_is_ff ? 22 : (cn_is_chrome ? 27 : (cn_is_ie ? 27 : 24)))) + 'px; display:none;">';
        box += '<div class="cn-text-center cn-cursor cn-fsize10"><a ' + hide_video_onclick + ' href="javascript:;" class="cn-tweet_link cn-lucida_fm">hide video</a></div>';
        box += '<div id="embed_' + index + '" class="cn-text-center"></div>';
        box += '</div>';
        return box
    }
function CN_getSingleImageBox(data, index, color, opacity) {
        var box = '';
        var play_photo_onclick = "onClick='showSingleImage(" + index + ", " + data.messageid + "); return false;'";
        var hide_photo_onclick = "onclick='hideSingleImageShareBox(" + index + "); return false;'";
        var photo_icon = "<a class='cn-tweet_link cn-cursor' href='javascript:;' " + play_photo_onclick + ">enlarge photo</a> <span onClick='showSingleImage(" + index + ", " + data.messageid + "); return false;'  id='enlarge_photo_" + index + "' class='cn-cursor'><img id='enlarge_image' src='" + cn_images_path + "enlarge.png' /></span>";
        box += '<table cellpadding="0" cellspacing="0" class="cn-image-thumb-container" width="' + (width - (cn_is_ie ? 24 : (cn_is_chrome ? 24 : (cn_is_ff ? 13 : 21)))) + '" id="thumb_single_image_' + index + '" border="0" style="background-color:' + color + '; color:#' + cn_font_color + '; ' + opacity + '">';
        box += '<tr>';
        box += '<td valign="top" width="50" class="cn-pl25"><img width="48" class="cn-image-thumb cn-pointer" onClick="showSingleImage(' + index + ', ' + data.messageid + '); return false;" id="image_thumbnail_' + index + '" src="' + data.media.thumbnail + '" /></td>';
        box += '<td id="single_image_title_' + index + '" valign="top" class="cn-text-left cn-pl4" style="font-size:' + cn_font_size + 'px; color:#' + cn_font_color + ';">';
        box += '<div class="cn-fleft">';
        box += '<div class="cn-p0 cn-fsize10" style="color:#' + widget_regulartext + '">' + photo_icon + '</div>';
        box += '</div>';
        box += '<div class="cn-cboth">&nbsp;</div>';
        box += '</td>';
        box += '</tr>';
        box += '</table>';
        box += '<div class="cn-large-image" id="single_big_image_' + index + '" style="width:' + (width - (cn_is_ie ? 32 : (cn_is_chrome ? 32 : (cn_is_ff ? 27 : 29)))) + 'px; display:none; background-color:' + color + '; color:#' + cn_font_color + '">';
        box += '<div class="cn-text-center cn-cursor cn-fsize10"><a ' + hide_photo_onclick + ' href="javascript:;" class="cn-tweet_link cn-lucida_fm">hide photo</a></div>';
        box += '<img width="' + (parseInt(width) * 0.75) + '" src="' + data.media.source + '" />';
        box += '</div>';
        return box
    }
function CN_getStatusDialogBox(index, data) {
        var tweet_user_id = (typeof(data.user.id) != 'undefined' && data.user.id != '') ? data.user.id : '';
        if (data.service == 'facebook') {
            var func_call = 'FB_postReply(' + index + ', ' + data.id + ', ' + data.user.id + ');'
        } else {
            var func_call = 'PostIt(' + index + ', ' + data.id + ', ' + tweet_user_id + ', ' + token + ', \'' + data.user.screen_name + '\');'
        }
        var close_function = 'hideModalDialog(' + index + ');';
        var box = '';
        box += '<div class="cn-fleft cn-cursor" style="padding: 1px 7px 0 0;">';
        box += '<img width="32" height="32" id="profile_image_' + index + '" name="profile_image_' + index + '" src=""/>';
        box += '</div>';
        box += '<div class="cn-fleft cn-text-left">';
        box += '<textarea class="cn-reply-input" onKeyUp="textCounter(this, ' + index + ');" onKeyDown="textCounter(this, ' + index + ');" name="status_text_' + index + '" id="status_text_' + index + '" style="height:' + (cn_is_ie ? 27 : 32) + 'px; width: ' + (width - ((width > min_width) ? 172 : 108)) + 'px" ></textarea>';
        box += '<br/><a href="javascript:;" onclick="openModalBox(' + index + ', \'' + data.service + '\')">cancel</a>';
        box += '</div>';
        box += '<div class="cn-fleft cn-pl6">';
        box += '<input id="post_tweet_' + index + '" onclick="' + func_call + '" type="button" name="Comment" value="Share" class="cn-vertical-top"/>';
        box += '<div id="chars_counter_' + index + '" class="cn-text-center" style="color:#' + grey_color + ';">140 left</div>';
        box += '</div>';
        box += '<div class="cn-cboth"></div>';
        box += '<div id="msg_dv_' + index + '" style="display:none; font-size:' + cn_font_size + 'px;" align="center">&nbsp;</div>';
        return box
    }
function CN_getShareBox(color) {
        var fb_login_true = (typeof(show_fb_connect) != 'undefined' && parseInt(show_fb_connect) == 1 && fb_user_id && fb_user_id != '') ? true : false;
        var share_box = '';
        share_box += '<div id="div_current_user_image" class="cn-fleft" style="width:48px; margin:' + (cn_is_ie ? 0 : 1) + 'px 4px 0 0; ' + ((hasToken || fb_login_true) ? '' : 'display:none') + '">';
        share_box += ((hasToken) ? '<img height="48" width="48" id="current_user_image" border="0" alt="" src="' + twitter_user_image + '" />' : FB_imageHTML(fb_user_image));
        share_box += '</div>';
        var txt_width = (width - ((hasToken || fb_login_true) ? ((width <= min_width) ? 95 : 165) : ((width <= min_width) ? 50 : 113)));
        txt_width += (cn_is_chrome) ? 12 : ((cn_is_ie || cn_is_ff) ? 9 : 6);
        share_box += '<div id="community_publishercontents" class="cn-fleft" style="width:' + ((width - ((hasToken || fb_login_true) ? (cn_is_ie ? 63 : (cn_is_ff ? 62 : 59)) : 10)) - ((cn_is_chrome || cn_is_ie) ? 17 : (cn_is_ff ? 13 : 20))) + 'px;">';
        share_box += '<div id="Publisher_prayer" class="cn-fleft">';
        share_box += '<textarea class="cn-share-input" style="height: ' + (cn_is_ie ? '39px' : '40px') + '; width: ' + txt_width + 'px"  onKeyUp="textCounter(this, 0);" onKeyDown="textCounter(this, 0);" name="status_text_0" id="status_text_0" onblur="javascript:make_default_text(this);" onfocus="javascript:remove_default_text(this);" >Enter your message here</textarea>';
        share_box += '<script>$("#status_text_0").elastic();</script>';
        share_box += '</div>';
        share_box += '<div class="cn-fleft cn-pl6 cn-right-justify">';
        share_box += '<div id="share_status_button"><input type="button" style="margin:0;" id="post_tweet_0" value="Share" onclick="validateStatus(function(){' + ((hasToken) ? 'PostMessage(0, ' + token + ');' : 'FB_verifyLogin(0, function(){FB_postStatus();});') + ';}); return false;" /></div>';
        share_box += '<div id="chars_counter_0" class="cn-chars-left" style="color:#' + grey_color + ';">140 left</div>';
        share_box += '<div class="cn-cboth"></div>';
        share_box += '</div>';
        share_box += '<div class="cn-cboth"></div>';
        share_box += '<div id="msg_dv_0" class="cn-pt5" style="display:none; font-size:' + cn_font_size + 'px;" align="center">&nbsp;</div>';
        share_box += '</div>';
        share_box += '<div class="cn-cboth"></div>';
        return share_box
    }
function remove_default_text(obj) {
        if (obj.value == "Enter your message here") {
            obj.value = "";
            obj.style.color = "#000000"
        }
    }
function make_default_text(obj) {
        if (obj.value == "") {
            obj.value = "Enter your message here";
            obj.style.color = "#B6BBC3"
        }
    }
function CN_getWidgetHtml(contents, id) {
        var widget_box = '';
        widget_box += '<table id="' + id + '" cellpadding="0" cellspacing="0" width="' + (width - (cn_is_chrome ? 19 : 16)) + '" style="background-color:' + widget_canvascolor + ';" class="cn-mr0 cn-ml0">';
        widget_box += '<tr>';
        widget_box += '<td>';
        widget_box += '<div style="width:' + (width - (cn_is_ie ? 23 : 24)) + '; ">' + contents + '</div>';
        widget_box += '</td>';
        widget_box += '</tr>';
        widget_box += '</table>';
        return widget_box
    }
function CN_feedsMainHTML(contents) {
        var box = '';
        box += '<div class="container-box" id="container_box" style="position:relative; ' + ((cn_is_embed == 0) ? 'display:none;' : '') + 'height:' + (height - ((param_cnlogo == 'on' || param_cnlogo == 1) ? 35 : 15)) + 'px; width:' + (parseInt(width) + (cn_is_ie ? 0 : (cn_is_ff ? 4 : (cn_is_chrome ? 0 : 4)))) + 'px; overflow-x:hidden; overflow-y:auto; padding:0px; border:0px; background-color:#' + widget_canvascolor + '; color:#' + cn_font_color + '; ">';
        box += '<div id="viewer" style="' + (cn_is_ie ? 'margin-bottom:3px;' : '') + ' width:' + (width - (cn_is_ie ? 20 : (cn_is_chrome ? 13 : 11))) + '" class="cn-overflow-hidden">';
        box += '<div id="refresh_counter_1" onClick="reloadPage(); return false;" class="cn-refresh-feed cn-text-center cn-cursor" style="width:' + (width - (cn_is_ie ? 22 : (cn_is_ff ? 22 : 20))) + 'px;  background-color:#' + cn_widget_notification + '; font-size:' + cn_font_size + 'px; display:none">&nbsp;&nbsp;<img src="../../assets/images/widget/notification feed_r17_c20.png" /></div>';
        box += '<div class="cn-cboth"></div>';
        if (parseInt(widget_comment) == 1) box += '<div id="status_share_box" class="cn-share-box-container" style="margin-left:3px; width:' + (width - (cn_is_ie ? 28 : (cn_is_ff ? 23 : 24))) + 'px;' + ((cn_is_embed == 1) ? '' : 'background-color:' + color + ';') + '">' + CN_getShareBox(widget_canvascolor) + '</div>';
        box += '<div id="contest_container">' + CN_contestMenu() + '</div>';
        box += '<div style="width:' + (width - (cn_is_ff ? 25 : 26)) + 'px;background-color:#' + widget_canvascolor + '; color:#' + cn_font_color + '; display:none;" id="user_messages_div" class="cn-user-messages"></div>';
        box += '<div id="unfade_messages_dv">';
        box += CN_getWidgetHtml(contents, 'live') + '<input type="hidden" id="highlighted_boxes" value="' + (cn_new_records_count + messages_sum) + '" />';
        box += '</div>';
        box += '</div>';
        box += '<div class="cn-cboth" ' + (cn_is_ie ? '' : 'style="height:3px"') + '></div>';
        box += '</div>';
        return box
    }
function CN_addFeedsInMainContainer(contents) {
        var box = '';
        box += '<div class="cn-wrap" style="width:' + (parseInt(width) + 4) + 'px;">';
        box += '<div class="toggler" id="live_toggler" style="width:' + (parseInt(width) + 4) + 'px">';
        box += '<div style="width:' + width + 'px;">';
        box += '<div class="live_bar_text_class cn-fleft"></div>';
        box += '<div id="refresh_counter" class="live_bar_counter_class cn-fleft" style="display:none">&nbsp;</div>';
        box += '<div class="cn-cboth"></div>';
        box += '</div>';
        box += '</div>';
        box += '<div class="accordion" id="accordion_live_div" style="width:' + (parseInt(width) + 4) + 'px; height:' + (height - ((param_cnlogo == 'on' || param_cnlogo == 1) ? 30 : 15)) + 'px">' + contents + '</div>';
        if (param_cnlogo == 'on' || param_cnlogo == 1) {
            box += '<div style="width:' + (parseInt(width) + 4) + 'px" class="cn-pt3 cn-text-left">';
            box += '<a href="http://www.citizennet.com" target="_blank" class="cn-text-none">';
            box += '<img class="cn-border-none" src="http://widget.citizennet.com/app/assets/images/widget/' + cn_logo + '" height="15" align="top"/>';
            box += '</a>';
            box += '</div>'
        }
        box += '</div>';
        return box
    }
function validateStatus(callback) {
        if ($('#status_text_0').val() != '' && $('#status_text_0').val().toLowerCase() != 'enter your message here') {
            callback()
        }
    }
function logTheRequest(url, track_url, viewType, messageid) {
        if (open_in_new == 1) window.open(server_url + '?flag=' + viewType + '&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwik);
        else top.location.href = server_url + '?flag=' + viewType + '&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwikk
    }
function openUrl(url, linkType, messageid) {
        if (open_in_new == 1) window.open(server_url + '?flag=' + linkType + '&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwik);
        else top.location.href = server_url + '?flag=' + linkType + '&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwik
    }
function trackPiwikUrl(url, viewType) {
        try {
            piwikTracker.trackLink(url, viewType, '');
            if (parent_domain_id != -1) piwikTracker1.trackLink(url, viewType, '')
        } catch (err) {}
    }
function openTwitterUserUrl(url, messageid) {
        if (open_in_new == 1) window.open(server_url + '?flag=0&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwik);
        else top.location.href = server_url + '?flag=0&url=' + url + '&pi=' + pi + '&messageid=' + messageid + '&piwik=' + widget_piwik
    }
function getLatestFeedCount() {
        var url = '?latest_date=' + latest_date + '&from=live_twitter_ajax&widget_i=' + token + '&width=' + width;
        url += '&height=' + height + '&widget_style=' + widget_style + '&widget_colorscheme=' + widget_color_scheme + '&prev_faded=' + messages_sum;
        url += '&widget_notification=' + notification_color + '&widget_new=' + new_entries_color + '&widget_canvascolor=' + widget_canvascolor;
        url += '&widget_regulartext=' + widget_regulartext + '&widget_highlighttext=' + widget_highlighttext + '&widget_lighttext=' + widget_lighttext;
        url += '&widget_person=' + widget_person + '&widget_friend=' + widget_friend + '&widget_sponsored=' + widget_sponsored + '&widget_admin=' + widget_admin;
        url += '&widget_aggregate=' + widget_aggregate + '&widget_slide=' + widget_slide + '&widget_noise=' + widget_noise + '&widget_filterlink=' + widget_filterlink;
        url += '&widget_separator=' + widget_separator + '&widget_comment=' + widget_comment + '&sid=' + Math.random() + '&is_embed=' + cn_is_embed + '&compare_date=' + cn_compare_date + '&contest=' + ((typeof(cn_contest.id) == 'undefined') ? 0 : cn_contest.id);
        var contents = contents_new = contents_old = '';
        $.getJSON(server_path + 'embedfeeds.php' + url + json_param, function (response) {
            if (typeof(response[0].error) != 'undefined') {
                return false
            }
            cn_contest = response[0].contest;
            user_contest_points = response[0].user_contest_points;
            $('#contest_container').html(CN_contestMenu(1));
            if (typeof(response[0].xml_data) != 'undefined' && response[0].xml_data == '') {
                js_time_updater++;
                if (js_time_updater >= 2) {
                    updateFeedsTime();
                    js_time_updater = 0
                }
                return false
            }
            js_time_updater = 0;
            globalResponse = response;
            cn_new_recods_count = response[0].new_recods_count;
            cn_latest_feed_date = response[0].latest_feed_date;
            cn_compare_date = response[0].compare_date;
            cn_has_token = response[0].has_token;
            messages_sum = parseInt(cn_new_recods_count);
            latest_date = cn_latest_feed_date;
            var xml_arr = response[0].xml_data;
            for (var i = 0; i < xml_arr.length; i++) {
                color = widget_person;
                if (i < parseInt(messages_sum) && cn_is_embed == 0) {
                    if (widget_slide != 'on' || (widget_slide == 'on' && i < 10)) {
                        color = new_entries_color
                    }
                    contents_new += CN_MaketheLiveTwitterBox(xml_arr[i], (i + 1), color)
                } else {
                    contents_old += CN_MaketheLiveTwitterBox(xml_arr[i], (i + 1), color)
                }
            }
            if (contents_new != '') {
                contents = '<div id="live_new_msgs_dv" style="display:none">' + contents_new + '</div>'
            }
            contents += contents_old;
            contents = CN_getWidgetHtml(contents, 'live');
            removeShareMsgsTableInnerHTML();
            $("#unfade_messages_dv").html(contents);
            if (parseInt(messages_sum) > 0) {
                $('#highlighted_boxes').val(messages_sum);
                messages_sum = 0;
                if (cn_is_embed != 1) {
                    CN_frameBlindDownNewMessages()
                } else {
                    clearInterval(blind_interval);
                    blindDownNewMessages()
                }
            }
            return false
        })
    }
function CN_frameBlindDownNewMessages() {
        highlighted_count = $('#highlighted_boxes').val();
        var interval_speed = 0;
        var blind_count = highlighted_count;
        var slide_down_speed = 7.0;
        if (blind_count < 3) slide_down_speed = 3.0;
        else if (blind_count < 7) slide_down_speed = 4.0;
        Effect.SlideDown('box_1', {
            duration: 1.0
        });
        Effect.SlideDown('live_new_msgs_dv', {
            duration: slide_down_speed
        });
        setTimeout(function () {
            CN_frameUnfadeDivs()
        }, 3000)
    }
function reloadPage() {
        if (records_html != '') {
            removeShareMsgsTableInnerHTML();
            $('#unfade_messages_dv').html(records_html);
            messages_sum = 0;
            records_html = '';
            $('#refresh_counter').html('');
            $('#refresh_counter').css('display', 'none');
            clearInterval(blind_interval);
            blindDownNewMessages()
        }
    }
function removeShareMsgsTableInnerHTML() {
        $('#user_messages_div').html('')
    }
function blindDownNewMessages() {
        if (document.getElementById('highlighted_boxes')) {
            var highlighted_count = $('#highlighted_boxes').val();
            var slide_speed = 3000;
            if (highlighted_count > 3) slide_speed = 6000;
            $('#live_new_msgs_dv').slideDown(slide_speed);
            setTimeout(function () {
                unfadeDivs(400)
            }, 3000)
        }
    }
function unfadeDivs(fade_speed) {
        var color = '';
        if (document.getElementById('highlighted_boxes')) {
            var highlighted_count = $('#highlighted_boxes').val();
            var j = 1;
            if (highlighted_count >= 1) {
                blind_interval = setInterval(function () {
                    if (j <= highlighted_count) {
                        if (apply_alternate_colors == 1) {
                            color = (j % 2 == 0 ? color1 : color2);
                            color = '#' + color
                        } else {}
                        $('#text_div_' + j).fadeTo('slow', 1.0);
                        if ($('#video_box_' + j)) $('#video_box_' + j).fadeTo('slow', 1.0);
                        if ($('#thumb_single_image_' + j)) $('#thumb_single_image_' + j).fadeTo('slow', 1.0);
                        if ($('#time_div_' + j)) $('#time_div_' + j).fadeTo('slow', 1.0);
                        if ($('#reply_contents_' + j)) $('#reply_contents_' + j).fadeTo('slow', 1.0);
                        j++
                    } else {
                        clearInterval(blind_interval)
                    }
                }, fade_speed)
            }
        }
    }
function updateOathTStatus(twitid, twitname, twitimage) {
        twitter_user_id = twitid;
        twitter_user_name = twitname;
        twitter_user_image = twitimage;
        $('#div_current_user_image').html('<img height=\'48\' width=\'48\' id=\'twitter_user_image\' border=\'0\' alt=\'\' src=\'' + twitter_user_image + '\'/>');
        $('#div_current_user_image').css({
            'width': '48px',
            'display': ''
        });
        $('#status_text_0').css('width', (width - 163) + 'px');
        $('#community_publishercontents').css('width', (width - 78) + 'px');
        hideLoginOptions();
        $('#status_share_box').css('display', '');
        hasToken = true;
        showReplyLinks('twitter');
        CN_getUserContestLink();
        openModalBox(box_number, 'twitter');
        box_number = 0;
        postTwitterHeader()
    }
function hideLoginOptions() {
        if (cn_is_embed == 0) $('#login_buttons').css('display', 'none');
        $('#share_status_button').css('display', '');
        var html = '<input type="button" style="margin-bottom: 1px;" id="post_tweet_0" value="Share" onclick="validateStatus(function(){' + ((hasToken) ? 'PostMessage(0, ' + token + ');' : ((typeof(show_fb_connect) != 'undefined' && parseInt(show_fb_connect) == 1 && typeof(fb_user_id) != 'undefined' && fb_user_id) ? 'FB_verifyLogin(0, function(){FB_postStatus();});' : 'getOathToken(0);')) + '});return false;" />';
        $('#share_status_button').html(html)
    }
function getOathToken(index) {
        box_number = index;
        if (hasToken == false) {
            window.open(server_path + 'auth.php', '', 'width=775,height=558,left=10,top=10,resizable,scrollbars');
            twitter_session_handler = setInterval('getTwitterSeesionInfo()', 4000)
        } else {
            openModalBox(index, 'twitter')
        }
    }
function openModalBox(index, service_type) {
        hideLoginOptions();
        if (index == 0) {
            PostMessage(0, token)
        } else {
            if (index == -1 || index == -2) {
                if (index == -1) CN_getUserContestLink();
                return false
            }
            if ($('#status_dialog_' + index) != 'undefined' && ($('#status_dialog_' + index).css('display') == '' || $('#status_dialog_' + index).css('display') == 'block')) {
                hideModalDialog(index)
            } else {
                open_media_count++;
                stopTimer();
                $('#status_text_' + index).val('');
                $('#status_dialog_' + index).css('display', '');
                var image_src = ((service_type == 'facebook') ? fb_user_image : twitter_user_image);
                if (image_src != '') {
                    document.getElementById('profile_image_' + index).src = image_src;
                    $('#profile_image_' + index).css('display', '')
                }
                jQuery('#status_text_' + index).elastic()
            }
        }
    }
function hideModalDialog(index) {
        open_media_count--;
        startTimer();
        if (index != 0) {
            $('#status_dialog_' + index).css('display', 'none')
        }
        $('#status_text_' + index).val('');
        $('#chars_counter_' + index).html('140 left')
    }
function updateTwitterheader() {
        if (twitter_title_text != '' && $('#twitter_header_div') != 'undefined') {
            var params = '?from=theader&token=' + token + '&title_text=' + encodeURIComponent(twitter_title_text);
            $.getJSON(server_path + 'ajax_post.php' + params + json_param, function (data) {
                if (parseInt(data) != 0) {
                    if (data == 1) $('#t_follow_td').html('');
                    else if (data == 2) $('#t_bkgrnd_chk_td').html('');
                    showPopUpHeaderBox()
                }
            })
        }
    }
function getTwitterSeesionInfo() {
        var params = '?from=getseesion';
        $.getJSON(server_path + 'ajax_post.php' + params + json_param, function (data) {
            if (parseInt(data) != 0) {
                clearInterval(twitter_session_handler);
                var tokens = data.split('|||||');
                twitter_user_id = tokens[1];
                twitter_user_name = tokens[2];
                twitter_user_image = tokens[3];
                $('#div_current_user_image').html('<img height=\'48\' width=\'48\' id=\'current_user_image\' border=\'0\' alt=\'\' src=\'' + twitter_user_image + '\'/>');
                $('#div_current_user_image').css({
                    'width': '48px',
                    'display': ''
                });
                $('#status_share_box').css('display', '');
                $('#status_text_0').css('width', (width - 163) + 'px');
                $('#community_publishercontents').css('width', (width - 78) + 'px');
                hasToken = true;
                showReplyLinks('twitter');
                CN_getUserContestLink();
                openModalBox(box_number, 'twitter');
                postTwitterHeader()
            }
        })
    }
function initiateTimer() {
        getLatestFeedCount();
        interval_handle = setInterval('getLatestFeedCount()', 30000)
    }
function startTimer() {
        if (open_media_count == 0) initiateTimer()
    }
function stopTimer() {
        clearInterval(interval_handle)
    }
function trackInstanceLinkStats(visited_url, type_flag, messageid) {
        var stats_params = '?pi=' + pi + '&url=' + escape(visited_url) + '&flag=' + type_flag + '&stats_ajax=1&messageid=' + messageid + '&piwik=' + widget_piwik;
        $.getJSON(server_path + 'log.php' + stats_params + json_param, function (data) {
            return false
        })
    }
function playVideo(videoSrc, playerWidth, palyerHeigt, isAutoplay, index, playvideo, is_arrow, messageid) {
        open_media_count++;
        stopTimer();
        if (add_piwik_code == 1) {
            track_url = videoSrc;
            trackPiwikUrl(track_url, 'video view');
            trackInstanceLinkStats(videoSrc, 3, messageid)
        }
        $('#video_box_' + index).css('display', 'none');
        $('#swfContainer_' + index).css('display', 'block');
        if (document.getElementById('share_box_' + index)) {
            $('#share_box_' + index).css('display', 'block')
        }
        videoSrc = videoSrc + isAutoplay;
        var so = new SWFObject(videoSrc, 'swfplayer_' + index, playerWidth, palyerHeigt, '9');
        so.addParam('allowscriptaccess', 'always');
        so.addParam('wmode', 'transparent');
        so.addParam('autoplay', 1);
        so.write('embed_' + index)
    }
function hideShareBox(index) {
        open_media_count--;
        startTimer();
        $('#swfContainer_' + index).css('display', 'none');
        $('#embed_' + index).html('');
        if (document.getElementById('share_box_' + index)) {
            $('#share_box_' + index).css('display', 'none')
        }
        $('#video_box_' + index).css('display', 'block')
    }
function showSingleImage(box_numb, messageid) {
        if (add_piwik_code == 1) {
            track_url = document.getElementById('image_thumbnail_' + box_numb).src;
            trackPiwikUrl(track_url, 'view photo click');
            trackInstanceLinkStats(track_url, 2, messageid)
        }
        open_media_count++;
        stopTimer();
        $('#single_image_title_' + box_numb).css('display', 'none');
        $('#thumb_single_image_' + box_numb).css('display', 'none');
        $('#single_big_image_' + box_numb).css('display', 'block');
        if (document.getElementById('share_box_' + box_numb)) {
            $('#share_box_' + box_numb).css('display', 'block')
        }
    }
function hideSingleImageShareBox(box_numb) {
        open_media_count--;
        startTimer();
        $('#thumb_single_image_' + box_numb).css('display', 'block');
        $('#single_big_image_' + box_numb).css('display', 'none');
        $('#single_image_title_' + box_numb).css('display', 'block');
        if (document.getElementById('share_box_' + box_numb)) {
            $('#share_box_' + box_numb).css('display', 'none')
        }
    }
function CN_frameUnfadeDivs() {
        var color = '';
        highlighted_count = $('#highlighted_boxes').val();
        color = widget_person;
        $('live_new_msgs_dv').show();
        for (var j = 1; j <= highlighted_count; j++) {
            new Effect.Highlight('box_' + j, {
                startcolor: '#' + new_entries_color,
                endcolor: '#' + color,
                restorecolor: '#' + color,
                duration: 2
            });
            if ($('video_box_' + j)) {
                new Effect.Highlight('video_box_' + j, {
                    startcolor: '#' + new_entries_color,
                    endcolor: '#' + color,
                    restorecolor: '#' + color,
                    duration: 2
                });
                if ($('swfContainer_' + j)) {
                    $('swfContainer_' + j).style.backgroundColor = '#' + color
                }
            }
            if ($('thumb_single_image_' + j)) {
                new Effect.Highlight('thumb_single_image_' + j, {
                    startcolor: '#' + new_entries_color,
                    endcolor: '#' + color,
                    restorecolor: '#' + color,
                    duration: 2
                });
                if ($('single_imageshare_title_' + j)) {
                    $('single_imageshare_title_' + j).style.backgroundColor = '#' + color
                }
                if ($('single_big_image_' + j)) {
                    $('single_big_image_' + j).style.backgroundColor = '#' + color
                }
            }
            if ($('time_div_' + j)) new Effect.Highlight('time_div_' + j, {
                startcolor: '#' + new_entries_color,
                endcolor: '#' + color,
                restorecolor: '#' + color,
                duration: 2
            });
            if ($('share_box_' + j)) $('share_box_' + j).style.backgroundColor = '#' + color
        }
    }
function showReplyLinks(type) {
        var reply_boxes = $('.reply_link_' + type);
        if (reply_boxes != 'undefined' && reply_boxes.length > 0) {
            for (var i = 0; i < reply_boxes.length; i++) reply_boxes[i].style.display = ''
        }
    }
function strtotime(str, now) {
        str = str.replace(/\s{2,}|^\s|\s$/g, ' ');
        str = str.replace(/[\t\r\n]/g, '');
        if (str == 'now') return (new Date()).getTime();
        else if (!isNaN(parse = Date.parse(str))) return parse;
        else if (now) now = new Date(now);
        else now = new Date();
        str = str.toLowerCase();
        var __is = {
            day: {
                'sun': 0,
                'mon': 1,
                'tue': 2,
                'wed': 3,
                'thu': 4,
                'fri': 5,
                'sat': 6
            },
            mon: {
                'jan': 0,
                'feb': 1,
                'mar': 2,
                'apr': 3,
                'may': 4,
                'jun': 5,
                'jul': 6,
                'aug': 7,
                'sep': 8,
                'oct': 9,
                'nov': 10,
                'dec': 11
            }
        };
        var match = str.match(/^(\d{2,4}-\d{2}-\d{2})(\s\d{1,2}:\d{1,2}(:\d{1,2})?)?$/);
        if (match != null) {
            if (!match[2]) match[2] = '00:00:00';
            else if (!match[3]) match[2] += ':00';
            var s = match[1].split(/-/g);
            for (var i in __is.mon) if (__is.mon[i] == s[1] - 1) s[1] = i;
            return strtotime(s[2] + ' ' + s[1] + ' ' + s[0] + ' ' + match[2])
        }
        var regex = '([+-]?\\d+\\s' + '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?' + '|sun\.?|sunday|mon\.?|monday|tue\.?|tuesday|wed\.?|wednesday' + '|thu\.?|thursday|fri\.?|friday|sat\.?|saturday)' + '|(last|next)\\s' + '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?' + '|sun\.?|sunday|mon\.?|monday|tue\.?|tuesday|wed\.?|wednesday' + '|thu\.?|thursday|fri\.?|friday|sat\.?|saturday))' + '(\\sago)?';
        match = str.match(new RegExp(regex, 'g'));
        if (match == null) {
            return false
        }
        for (var i in match) {
            if (!process(match[i].split(' '))) {
                return false
            }
        }
        return now;

        function process(m) {
            var ago = (m[2] && m[2] == 'ago');
            var num = (num = m[0] == 'last' ? -1 : 1) * (ago ? -1 : 1);
            switch (m[0]) {
            case 'last':
            case 'next':
                switch (m[1].substring(0, 3)) {
                case 'yea':
                    now.setFullYear(now.getFullYear() + num);
                    break;
                case 'mon':
                    now.setMonth(now.getMonth() + num);
                    break;
                case 'wee':
                    now.setDate(now.getDate() + (num * 7));
                    break;
                case 'day':
                    now.setDate(now.getDate() + num);
                    break;
                case 'hou':
                    now.setHours(now.getHours() + num);
                    break;
                case 'min':
                    now.setMinutes(now.getMinutes() + num);
                    break;
                case 'sec':
                    now.setSeconds(now.getSeconds() + num);
                    break;
                default:
                    var day;
                    if (typeof(day = __is_day[m[1].substring(0, 3)]) != 'undefined') {
                        var diff = day - now.getDay();
                        if (diff == 0) {
                            diff = 7 * num
                        } else if (diff > 0) {
                            if (m[0] == 'last') diff -= 7
                        } else {
                            if (m[0] == 'next') diff += 7
                        }
                        now.setDate(now.getDate() + diff)
                    }
                }
                break;
            default:
                if (/\d+/.test(m[0])) {
                    num *= parseInt(m[0]);
                    switch (m[1].substring(0, 3)) {
                    case 'yea':
                        now.setFullYear(now.getFullYear() + num);
                        break;
                    case 'mon':
                        now.setMonth(now.getMonth() + num);
                        break;
                    case 'wee':
                        now.setDate(now.getDate() + (num * 7));
                        break;
                    case 'day':
                        now.setDate(now.getDate() + num);
                        break;
                    case 'hou':
                        now.setHours(now.getHours() + num);
                        break;
                    case 'min':
                        now.setMinutes(now.getMinutes() + num);
                        break;
                    case 'sec':
                        now.setSeconds(now.getSeconds() + num);
                        break
                    }
                } else {
                    return false
                }
                break
            }
            return true
        }
    }
function paddZero(val) {
        return ((val < 10) ? '0' : '') + val
    }
function gmdate(offset, flag) {
        d = new Date();
        utc = d.getTime() + (d.getTimezoneOffset() * 60000);
        if (flag == 1) {
            return Math.round(utc / 1000)
        }
        nd = new Date(utc + (3600000 * offset));
        return (nd.getYear() + 1900) + '-' + paddZero(nd.getMonth() + 1) + '-' + paddZero(nd.getDay()) + ' ' + paddZero(nd.getHours()) + ':' + paddZero(nd.getMinutes()) + ':' + paddZero(nd.getSeconds())
    }
function getTweetTime(timestamp) {
        feedtime = Math.round(strtotime(timestamp) / 1000);
        current = gmdate('0', 1);
        diff = (current - feedtime);
        days = parseInt(diff / (3600 * 24));
        hours = parseInt(diff / (3600));
        mins = parseInt(diff / (60));
        if (days > 0) {
            return days + ' day' + ((days == 1) ? '' : 's') + ' ago'
        } else if (hours > 0) {
            return hours + ' hour' + ((hours == 1) ? '' : 's') + ' ago'
        } else {
            return mins + ' min' + ((mins == 1) ? '' : 's') + ' ago'
        }
    }
function updateFeedsTime() {
        if (typeof(globalResponse[0]) == 'undefined' || (typeof(globalResponse[0].xml_data) != 'undefined' && globalResponse[0].xml_data == '')) return false;
        var xml_arr = globalResponse[0].xml_data;
        if (typeof(globalResponse[0].xml_data) != '' && globalResponse[0].xml_data != '' && globalResponse[0].xml_data.length > 0 && typeof(globalResponse[0].xml_data[0].tweet_time) != 'undefined' && globalResponse[0].xml_data[0].tweet_time != '') {
            for (var i = 0; i < xml_arr.length; i++) {
                if ($('#time_div_' + xml_arr[i].id) != 'undefined' && xml_arr[i].tweet_time != '') $('#time_div_' + xml_arr[i].id).html(getTweetTime(xml_arr[i].tweet_time));
                if (typeof(xml_arr[i].childmessages) != 'undefined' && xml_arr[i].childmessages.length > 0) {
                    for (var m = 0; m < xml_arr[i].childmessages.length; m++) {
                        if ($('#time_div_' + xml_arr[i].id + '_' + xml_arr[i].childmessages[m].id) != 'undefined' && xml_arr[i].childmessages[m].tweet_time != '') $('#time_div_' + xml_arr[i].id + '_' + xml_arr[i].childmessages[m].id).html(getTweetTime(xml_arr[i].childmessages[m].tweet_time))
                    }
                }
            }
        }
    }
function postTwitterHeader() {
        var params = '?from=upload&token=' + token + '&t_follow=' + ((twitter_to_follow != '') ? 1 : 0) + '&background=0';
        $.getJSON(server_path + 'ajax_post.php' + params + json_param, function (data) {})
    }
function CN_topUser() {
        var box = opacity = class_ = '';
        if (cn_is_embed == 1) {
            opacity = 'opacity:1.0;';
            color = 'transparent !important';
            class_ = 'tweet_box'
        } else {
            color = widget_person
        }
        var cn_top_user = cn_contest.top_user;
        cn_top_username = cn_scores[0].twit_username;
        var avatar_link = escape('http://twitter.com/' + cn_scores[0].twit_username);
        box = '<div class="cn-tweet-box ' + class_ + '" style="width:' + (width - ((cn_is_ie || cn_is_chrome) ? 23 : 19)) + 'px; background-color:#' + color + '; color:#' + cn_font_color + '">';
        box += '<div class="cn-inner-box">';
        box += '<div class="cn-fleft cn-text-center cn-profile-image"><a href="javascript:;" onclick="javascript:openUrl(\'' + avatar_link + '\', 0, 0);"><img src="' + cn_scores[0].image + '" border="0"  height="48" width="48" class="cn-mr2"/></a><p style="margin:2px 0 0;' + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '" class="cn-w48 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">' + ((typeof(cn_top_user.index) != 'undefined') ? '<img style="margin-top:3px" src="' + cn_prize_images + cn_prizes[cn_top_user.index].image + '" width="48" align="left" />' : '') + cn_scores[0].points + '</p></div>';
        box += '<div style="color:#' + cn_font_color + ';width:' + (width - (cn_is_ff ? 79 : ((cn_is_ie || cn_is_chrome) ? 80 : 76))) + 'px;" class="cn-fleft">';
        box += '<div class="cn-small cn-lucida_fm" align="left" style="padding-left:5px; font-size:' + cn_font_size + 'px; color:#' + widget_regulartext + '; ' + opacity + '">';
        box += '<span class="cn-lucida_fm cn-fsize13 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">' + cn_top_user.status + '</span>';
        box += '<p style="margin:10px 0"><a class="cn-text-none cn-fsize13 ' + ((cn_is_embed == 1) ? 'user_screenname_class' : '') + '" href="javascript:;" ' + ((cn_is_embed == 1) ? '' : 'style="color:#' + widget_regulartext + '";') + ' onclick="javascript:openUrl(\'' + avatar_link + '\', 0, 0);"><b>see ' + cn_scores[0].twit_username + '\'s twitter account</b></a></p>';
        box += '<div class="cn-time-padd cn-text-right ' + ((cn_is_embed == 1) ? 'tweet_time_class' : '') + '" style="background-color:' + color + '; color:#' + widget_highlighttext + '; font-size:' + cn_highlight_text_font + 'px">' + getTweetTime(cn_top_user.created_at) + '</div>';
        box += '</div>';
        box += '<div class="cn-cboth"></div>';
        box += '</div>';
        box += '</div>';
        box += '<div class="cn-cboth"></div>';
        box += '</div>';
        return box
    }
function CN_menuTabs(tab) {
        var arr = ['unfade_messages_dv', 'cn_score_tab', 'cn_prize_tab', 'cn_play_tab'];
        var menu = $('.cn-contest-menu li');
        for (var i = 0; i < menu.length; i++) {
            menu[i].className = (i == tab) ? 'cn-current' : '';
            $('#' + arr[i]).css('display', ((i == tab) ? '' : 'none'))
        }
        $('#user_messages_div').css('display', ((tab == 0) ? '' : 'none'));
        cn_current_tab = tab
    }
function CN_contestMenu(updateFirstTab) {
        if (cn_contest && typeof(cn_contest.prize) != 'undefined') {
            cn_prizes = cn_contest.prize;
            cn_scores = (typeof(cn_contest.high_scores) != 'undefined') ? cn_contest.high_scores : '';
            var box = '<style>.cn-contest-menu{margin-top:5px}.cn-contest-menu ul .cn-current{background-color:#' + cn_transparent_bg + ';color:#000}.cn-contest-menu ul{text-align:center;margin:0;padding:0;border-bottom:1px solid #000}.cn-contest-menu li{font-size:12px;background:url(' + server_path + 'transparent.php?color=' + cn_transparent_bg + '); color:#' + cn_transparent_bg + ';cursor:pointer;list-style:none;display:inline-block;margin:0;padding:3px 7px;border-left:1px solid #000;border-top:1px solid #000;' + ((parseInt(width) <= min_width) ? 'border-bottom:1px solid #000;border-right:1px solid #000' : '') + '} #play_twit_post{font-weight:bold;color:green}</style>';
            box += '<div id="cn_top_user">' + ((typeof(cn_contest.top_user) != 'undefined') ? CN_topUser() : '') + '</div>';
            box += '<div class="cn-text-center cn-fsize13 cn-lucida_fm ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '" id="cn_menu_header" style="padding:10px 8px 0;' + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '">To get your Tweets featured here, play our challenge!</div>';
            box += '<div class="cn-text-center cn-contest-menu"><ul><li onclick="CN_menuTabs(0)" ' + ((cn_current_tab == 0) ? 'class="cn-current"' : '') + '>Posts</li><li onclick="CN_menuTabs(1)" ' + ((cn_current_tab == 1) ? 'class="cn-current"' : '') + '>High scores</li><li onclick="CN_menuTabs(2)" ' + ((cn_current_tab == 2) ? 'class="cn-current"' : '') + '>Prizes</li><li onclick="CN_menuTabs(3)" ' + ((cn_current_tab == 3) ? 'class="cn-current"' : '') + ' style="border-right:1px solid #000">Play!</li></ul></div>';
            box += CN_playBox(updateFirstTab) + CN_prizeBox(updateFirstTab) + CN_highScoreBox();
            return box
        }
        return ''
    }
function CN_playBox(updateFirstTab) {
        var box = '<div id="cn_play_tab" style="margin:20px 10px;' + ((cn_current_tab == 3) ? '' : 'display:none;') + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '" class="cn-text-left cn-fsize13 cn-lucida_fm ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">';
        if (updateFirstTab) {
            return box + $('#cn_play_tab').html() + '</div>'
        }
        box += cn_contest.contest_desc;
        if (cn_contest.participant == 0) box += '<div class="cn-text-center" style="margin-top:10px" id="play_twit_btn"><img src="' + server_path + 'images/twitter.gif" style="margin-top:10px" class="cn-cursor" onclick="getOathToken(-1);" /></div>';
        box += '<div id="cn_viral_msg" style="margin-top:10px" >' + ((cn_contest.participant == 1) ? CN_playTabDesc(cn_contest.url) : '') + '</div>';
        box += '</div>';
        return box
    }
function CN_prizeBox(updateFirstTab) {
        var box = '<div id="cn_prize_tab" style="margin:20px 10px;' + ((cn_current_tab == 2) ? '' : 'display:none;') + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '" class="cn-text-left cn-fsize13 cn-lucida_fm ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">';
        if (updateFirstTab) {
            return box + $('#cn_prize_tab').html() + '</div>'
        }
        if (cn_prizes != '') {
            for (var i = 0; i < cn_prizes.length; i++) {
                box += '<div class="cn-contest-prizes" style="margin-top:10px">';
                box += '<label style="display:inline-block;margin-right:5px; width:67px; vertical-align:top">' + cn_prizes[i].points + ' points</label>';
                box += '<img style="margin:2px 5px 0 0" src="' + cn_prize_images + cn_prizes[i].image + '" width="48" align="top" />';
                box += '<label style="display:inline-block; vertical-align:top; width:' + (width - ((parseInt(width) > min_width) ? 158 : 22)) + 'px">' + cn_prizes[i].description + '</label>';
                box += '</div>'
            }
            box += '<div style="margin-top:20px">Play our Twitter game and earn a spot at the top of this feed and get these cool prizes by your name.' + ((cn_contest.participant == 0) ? '<p class="cn-text-center" id="prize_play_link"><a href="javascript:;" onclick="CN_menuTabs(3);">Start playing today!</a></p>' : '') + '</div>'
        }
        box += '</div>';
        return box
    }
function CN_highScoreBox() {
        var box = '<div id="cn_score_tab" style="margin:20px 10px;' + ((cn_current_tab == 1) ? '' : 'display:none;') + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '" class="cn-text-center cn-fsize13 cn-lucida_fm ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">';
        if (cn_scores != '') {
            box += '<table cellpadding="0" cellspacing="0" align="center">';
            for (var i = 0; i < cn_scores.length; i++) {
                box += '<tr style="vertical-align:middle">';
                box += '<td style="padding-right:10px;"><strong>' + (i + 1) + '.</strong></label>';
                box += '<td style="padding-right:15px;">' + (cn_scores[i].image != '' ? '<a href="http://www.twitter.com/' + cn_scores[i].twit_username + '"><img src="' + cn_scores[i].image + '" width="48" align="top" /></a>' : '&nbsp;') + '</td>';
                box += '<td style="padding-right:15px;">';
                for (var j = 0; j < cn_prizes.length; j++) {
                    if (typeof(cn_prizes[j].image) != 'undefined' && cn_prizes[j].image != '' && parseInt(cn_scores[i].points) >= parseInt(cn_prizes[j].points)) {
                        box += '<img src="' + cn_prize_images + cn_prizes[j].image + '" width="48" />';
                        break
                    }
                }
                box += '</td>';
                box += '<td>' + cn_scores[i].points + '</td>';
                box += '</tr>';
                box += '<tr class="cn-reply-separator" style="height:8px"><td colspan="4"></td></tr>'
            }
            box += '</table>';
            if (cn_contest.participant == 0) box += '<div style="margin-top:20px" class="text-center" id="score_play_link"><a href="javascript:;" onclick="CN_menuTabs(3);">Start playing today!</a></div>'
        }
        box += '</div>';
        return box
    }
function CN_getUserContestLink() {
        if ($('#cn_menu_header') == 'undefined') return false;
        if (box_number == -2) {
            CN_postContestOnTwitter()
        } else {
            $.getJSON(server_path + "ajax_post.php?from=contest&token=" + token + '&cid=' + cn_contest.id + '&tweet_url=' + tweet_url + json_param, function (response) {
                if (parseInt(response) != 0 && response != '') {
                    $('#cn_viral_msg').html(CN_playTabDesc(response));
                    $('#play_twit_btn').css('display', 'none');
                    if ($('#score_play_link') != 'undefined') {
                        $('#score_play_link').css('display', 'none');
                        $('#prize_play_link').css('display', 'none')
                    }
                }
                return false
            })
        }
    }
function CN_matchTopUser() {
        if (cn_top_username == twitter_user_name) {
            if (parseInt(cn_prizes[0].points) > cn_scores[0].points) $('#cn_menu_header').html('Hey ' + twitter_user_name + '! you only need ' + (cn_prizes[0].points - cn_scores[0].points) + ' points to reach the next prize');
            else $('#cn_menu_header').html('Hey ' + twitter_user_name + '!')
        }
    }
function CN_playTabDesc(response) {
        var html = '<div class="cn-fleft" ' + ((parseInt(width) >= min_width) ? 'style="width:' + (width - 124) + 'px"' : '') + ' id="play_tweet_text">' + cn_contest.viral_message + ((cn_contest.viral_message != '') ? ' ' : '') + response + '</div><div class="cn-fright"><input type="button" value="Post to Twitter" onclick="CN_postContestOnTwitter()"/><br/><span id="play_twit_post"></span></div><div class="cn-cboth"></div>';
        html += '<div style="margin-top:10px">Just get your friends to retweet this message and click on the link ' + response + '. Each retweet is worth ' + cn_contest.retweet_points + ' points, each person that clicks on the link is worth ' + cn_contest.unique_click_points + ' points.</div>';
        return html
    }
function CN_postContestOnTwitter() {
        var text = $('#play_tweet_text').html();
        if (text != '') {
            $.getJSON(server_path + "ajax_post.php?from=contest&status=" + escape(text) + '&current_instance_id=' + token + json_param, function (data) {
                if (parseInt(data) == 0) {
                    hasToken = false;
                    getOathToken(-2)
                } else {
                    $('#play_twit_post').html('Posted')
                }
            })
        }
    }
function CN_getUserPoints(screen_name) {
        var box = '';
        if (cn_contest && typeof(cn_contest.prize) != 'undefined') {
            if (user_contest_points && user_contest_points.length > 0) {
                for (var i = 0; i < user_contest_points.length; i++) {
                    if (screen_name == user_contest_points[i].twit_username) {
                        for (var j = 0; j < cn_prizes.length; j++) {
                            if (parseInt(user_contest_points[i].points) >= parseInt(cn_prizes[j].points)) {
                                box = '<img src="' + cn_prize_images + cn_prizes[j].image + '" width="48" />'
                            }
                        }
                        box = '<p style="margin:2px 0 0 0;' + ((cn_is_embed == 1) ? '' : 'color:#' + widget_regulartext) + '" class="cn-w48 ' + ((cn_is_embed == 1) ? 'tweet_text_class' : '') + '">' + box + user_contest_points[i].points + '</p>'
                    }
                }
            }
        }
        return box
    }

/* FB JS */
var is_initialized=false,FB_has_token=false;var pageUrl=window.location.host;var fb_interval_handle=fb_user_name=fb_user_image=fb_user_id=fb_session_handler=fb_session_ok=fb_popup_handler='';function ensure_init(callback){if(window.is_initialized){if(callback)callback()}else{FB_RequireFeatures(["XFBML","CanvasUtil","Api"],function(){FB.FBDebug.logLevel=4;FB.FBDebug.isEnabled=true;var fb_key=(server_path.indexOf('widget.citizennet.com')==-1)?'c3884c84d6e01c5b300f245fc7eb78e5':'942b7d868ce032f2c942316909adf5b2';FB.Facebook.init(fb_key,server_path+"xd_receiver.htm");window.is_initialized=true;if(callback)callback();else{IamSecureButOnNonSecurePage();IamSecureButOnNonSecurePage()}})}}function verifyPermissions(flag,callback){try{FB.Facebook.apiClient.users_hasAppPermission("publish_stream",function(c){if(c==null||c==0){ensure_init(function(){if(typeof(resizeWin)!='undefined')resizeWin('fbclick');FB.Connect.showPermissionDialog('publish_stream',function(perms){callback()})})}else{callback()}})}catch(b){if(flag==1){callback()}}}function FB_postReply(index,stream_index,actor_id){if($('#status_text_'+index).val()!=''){FB_publishStream(index,stream_index,actor_id)}}function FB_postStatus(){if($('#status_text_0').val()!=''&&$('#status_text_0').val().toLowerCase()!='enter your message here'){FB_publishStatus()}}function IamSecureButOnNonSecurePage(){FB.Facebook.get_sessionState().waitUntilReady(function(){var user=FB.Facebook.apiClient.get_session()?FB.Facebook.apiClient.get_session().uid:null;FB_has_token=(!user)?false:true})}function resetStatusBox(index,error_msg){if(error_msg!=''){$('#msg_dv_'+index).css({'display':'block','color':'red'});$('#msg_dv_'+index).html('<b>'+error_msg+'</b>')}$('#status_text_'+index).val('');$('#chars_counter_'+index).html('140 left')}function FB_publishStream(index,stream_index,actor_id){var post_params='actor_id='+actor_id+'&status='+encodeURIComponent($('#status_text_'+index).val())+'&stream_index='+stream_index+'&type=1&current_instance_id='+token+'&service=fb&fb_user_name='+encodeURIComponent(fb_user_name)+'&fb_user_image='+encodeURIComponent(fb_user_image);$.getJSON(server_path+'ajax_post.php?'+post_params+'&tweet_end='+tweet_end+'&tweet_url='+tweet_url+'&eid='+instance_engage_id+json_param,function(response){if(parseInt(response)!=0){var arr_tokens=response.split('||||');if(arr_tokens&&arr_tokens.length==6){if(arr_tokens[5]=='ERROR'){resetStatusBox(index,'Session expired. Please login again');return false}else{showReplyLinks('facebook');fb_user_name=arr_tokens[2];fb_user_image=arr_tokens[3];if(arr_tokens[5]=='OVER'){resetStatusBox(index,'Facebook feed limit reached')}else if(arr_tokens[5]=='NOP'){resetStatusBox(index,"You don't have permissions.")}else{var status_text=arr_tokens[1];createData(index,arr_tokens[4],status_text,'facebook');hideModalDialog(index)}hideLoginOptions()}}return false}})}function FB_publishStatus(){var post_params='status='+encodeURIComponent($('#status_text_0').val())+'&type=0&current_instance_id='+token+'&service=fb&fb_user_name='+encodeURIComponent(fb_user_name)+'&fb_user_image='+encodeURIComponent(fb_user_image);$.getJSON(server_path+'ajax_post.php?'+post_params+'&tweet_end='+tweet_end+'&tweet_url='+tweet_url+'&eid='+instance_engage_id+json_param,function(response){if(parseInt(response)!=0){var arr_tokens=response.split('||||');if(arr_tokens&&arr_tokens.length==6){if(arr_tokens[5]=='ERROR'){resetStatusBox(0,'Session expired. Please login again');return false}else{showReplyLinks('facebook');fb_user_name=arr_tokens[2];fb_user_image=arr_tokens[3];if(arr_tokens[5]=='OVER'){resetStatusBox(0,'Facebook feed limit reached');updateStatusBox('facebook')}else{var status_text=arr_tokens[1];createMessageData(status_text,'facebook',arr_tokens[4]);resetStatusBox(0,'')}hideLoginOptions()}}return false}})}function FB_fetchUserInfo(){try{FB.Facebook.apiClient.fql_query('SELECT first_name, last_name, pic_square FROM user WHERE uid='+fb_user_id,function(rows){if(rows&&rows.length>0){fb_user_name=rows[0].first_name+' '+rows[0].last_name;fb_user_image=(rows[0].pic_square&&rows[0].pic_square!='')?rows[0].pic_square:'http://static.ak.fbcdn.net/pics/q_silhouette.gif'}})}catch(e){}}function getCurrentUser(){var user=FB.Facebook.apiClient.get_session()?FB.Facebook.apiClient.get_session().uid:null;return user}function FB_imageHTML(img_src){img_src=(img_src=='')?'http://static.ak.fbcdn.net/pics/q_silhouette.gif':img_src;return'<div class="cn-pos-relative cn-w48"><img src="'+img_src+'" class="cn-w48 cn-h48"/><div class="cn-fb-connect-button cn-fb-connect-button-small cn-fb-small-overlay"></div></div>'}function FB_verifyLogin(index,callback){box_number=index;if((index==0&&$('#status_text_'+index).val()!=''&&$('#status_text_'+index).val().toLowerCase()!='enter your message here')||index>0){if(fb_session_ok==false){var w=document.body.clientWidth;h=document.body.clientHeight,x=1,y=1;if(typeof(window.screenTop)!='undefined'){x=window.screenTop;y=window.screenLeft}var tok=(twitter_to_follow&&twitter_to_follow!='')?twitter_to_follow.toString().split(','):'';var popW=450,popH=310+(tok.length>1?15:0);var leftPos=((w-popW)/2)+y,topPos=(((h-popH)/2)+x)-40;fb_popup_handler=window.open(server_path+'fbauth.php?follow='+twitter_to_follow+'&title_text='+encodeURIComponent(twitter_title_text)+'&fb_page_id='+fb_page_id,'Login','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',resizable,scrollbars');fb_session_handler=setInterval(function(){FB_verifySession(1,callback)},5000)}else{callback()}}}function FB_verifySession(call_flag,callback_func){$.getJSON(server_path+'fbauth.php?getsession=1&call_type='+call_flag+json_param,function(response){if(call_flag==1){if(response=='TWIT'){clearInterval(fb_session_handler);if(hasToken==false){twitter_session_handler=setInterval('getTwitterSeesionInfo()',4000)}return false}else if(response=='WAIT'){return false}}if(response!='FALSE'&&response!='ERROR'&&response!='PERMS'){if(response&&typeof(response.status)!='undefined'&&response.status=='TRUE'){if(call_flag==1)clearInterval(fb_session_handler);fb_session_ok=true;fb_user_id=response.uid;fb_user_name=response.name;fb_user_image=response.image;if(callback_func!=null)callback_func();return false}}})}















































/*@cc_on
  (function(f){
   window.setTimeout =f(window.setTimeout);
   window.setInterval =f(window.setInterval);
  })(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
  @*/


var tnc = {
	prepTNC : function() {
		$('li.padlock a').each(function(index) {
		  $(this).click(function() {
				$('#privacy-terms').slideDown();
				return false;
			});
		});
		
		$('#closeTnC').each(function(index) {
		  $(this).click(function() {
				$('#privacy-terms').slideUp();
				window.location = "http://timmcgraw.com/#";
				return false;
			});
		});
	}
}

$(document).ready(function() {
	tnc.prepTNC();
});




var mouse_x=0;var tweening=false;var over_left=false;var over_right=false;var tweenObj=null;var should_animate_bg=false;var over=false;var current_category=null;var anim_count=0;function checkAudio(current){testing_audio=document.getElementById("current_song");testing_audio=$(testing_audio);the_song=testing_audio.text();if(jQuery.trim(the_song)!=jQuery.trim(current)){return jQuery.trim(the_song);}
return"";}
function pageload(hash){if(hash){if($.browser.msie){hash=encodeURIComponent(hash);}
tm.ajaxPage(hash);}else{}}
var tm={consts:{bottomOffset:248},load:function(page){if(jQuery.trim(page)!=''){tm.ajaxPage(page);}
return false;},_init:function(){$.historyInit(pageload, "");tm.prepLinks();tm.prepResize();tm.prepScrollers();tm.prepGridView();tm.prepContentLinks();tm.prepAnimationTimer();window.setTimeout(tm.prepPromos,4000);tm.prepDiscography();tm._refreshInterface();tm.setupForm();},setupForm:function(){$('#getEMails').ajaxForm(function(){$($('#getEMails').parent().get(0)).html("<span style='font-size: 0.7em; color: #878787; margin-top: 4px; display: block;'>THANK YOU</span>");});},
_refreshInterface:function(){
	var page=jQuery.trim($('#page').text());$('div#loading').css('display','none');tm.prepResize();tm.prepScrollers();tm.prepGridView();tm.prepContentLinks();Cufon.replace('h1.sub');Cufon.replace('h2.sub');if(page=='home_page'){tm.prepAnimationTimer();window.setTimeout(tm.prepPromos,4000);}
	$("div.thumbs").hover(function(){$(".title-"+$(this).attr('id')).css({'display':'block'});},function(){$(".title-"+$(this).attr('id')).css({'display':'none'});});hs.updateAnchors();var audio='';if(page=='home_page'){audio='audio_player_home'}else{audio='audio_player'}
	$('.audio').get(0).id=audio;
	
},loadPage:function(){$('body').removeClass();document.body.id=jQuery.trim($('#page').text());},prepDiscoScrollers:function(){$('.scrollpane').each(function(){var divi=$(this);var which=$('.lyrics:first');var which2=$('.tracks:first');var which3=$('.buylinks:first');var which4=$('div#causes_content .area:first');$(this).children('.up').each(function(){$(this).click(function(){return false;})})
$(this).children('.up').each(function(){$(this).mouseup(function(){which.scrollTo('-=232px',600);which2.scrollTo('-=232px',600);which3.scrollTo('-=232px',600);which4.scrollTo('-=232px',600);})})
$(this).children('.down').each(function(){$(this).click(function(){return false;})})
$(this).children('.down').each(function(){$(this).mouseup(function(){which.scrollTo('+=232px',600);which2.scrollTo('+=232px',600);which3.scrollTo('+=232px',600);which4.scrollTo('+=232px',600);})})})},prepDancehallScrollers:function(){$('.scrollpane').each(function(){var divi=$(this);var which=$('.bio_inner:first');$(this).children('.up').each(function(){$(this).click(function(){return false;})})
$(this).children('.up').each(function(){$(this).mouseup(function(){which.scrollTo('-=232px',600);})})
$(this).children('.down').each(function(){$(this).click(function(){return false;})})
$(this).children('.down').each(function(){$(this).mouseup(function(){which=$(this).parent().siblings('.display').children('.bio').children('.bio_inner');which.scrollTo('+=232px',600);})})})},prepLinks:function(){$('ul#nav_list li a').click(function(){if(!$(this).hasClass('up')&&!$(this).hasClass('down')&&!$(this).hasClass('highslide')&&!$(this).hasClass('close')&&!$(this).hasClass('prev')&&!$(this).hasClass('next')){if($(this).attr('href').indexOf('http')<0){$.historyLoad($(this).attr('href').replace(the_base,''));return false;}}})},prepSubNav:function(){$('ul#sub_nav_list li a').click(function(){if(!$(this).hasClass('up')&&!$(this).hasClass('down')&&!$(this).hasClass('highslide')&&!$(this).hasClass('close')&&!$(this).hasClass('prev')&&!$(this).hasClass('next')){if($(this).attr('href').indexOf('http')<0){$.historyLoad($(this).attr('href').replace(the_base,''));return false;}}})},prepContentLinks:function(){$('div#content a').click(function(){if(!$(this).hasClass('up')&&!$(this).hasClass('down')&&!$(this).hasClass('highslide')&&!$(this).hasClass('close')&&!$(this).hasClass('prev')&&!$(this).hasClass('next')){if($(this).attr('href').indexOf('http')<0){$.historyLoad($(this).attr('href').replace(the_base,''));return false;}else{if(document.all){$(this).click(function(){window.open($(this).attr('href'));return false;})}else{$(this).attr({target:'_blank'});}}}})},ajaxPage:function(url){$('div#bg_inner').fadeOut('slow',function(){$('div#bg').html("<img src='assets/images/1pxgrey.jpg' style='width: 100%; height: 100%' />");})
$('#sub_nav_list').remove();$('#content_inner').remove();$('div#loading').css('display','block');$('#page').load(url+' #page',tm.loadPage);$('#bg').load(url+' #bg_inner');$('#content').load(url+' #content_inner',tm._refreshInterface);$('#sub_nav').load(url+' #sub_nav div.inner',tm.prepSubNav);return false;},prepResize:function(){tm.resize();$(window).resize(tm.resize);},prepScrollers:function(){var mouse_down_down=false;var mouse_up_down=false;$('.scrollpane').each(function(){var divi=$(this);var which=$('.area:first');$(this).children('.up').each(function(){$(this).click(function(){return false;})})
$(this).children('.up').each(function(){$(this).mouseup(function(){which.scrollTo('-=232px',600);})})
$(this).children('.down').each(function(){$(this).click(function(){return false;})})
$(this).children('.down').each(function(){$(this).mouseup(function(){which.scrollTo('+=232px',600);})})})},prepGridView:function(){setHeight=$("#imageset").height();thumbs=$("div#main div.thumbs");the_length=Math.round(thumbs.length/2);the_length_real=thumbs.length;if(the_length>0){first_thumb=$("div#main div.thumbs").get(0);first_thumb=$(first_thumb);width=first_thumb.width();height=$(thumbs.get(0)).height();setWidth=(the_length*width);if(($("div#imageset").height()/height)==2){setWidth=(the_length*width);}else if($('div#singles').length>0){setWidth=((the_length_real/4)*width)+78}else{setWidth=the_length_real*width;}
$("#imageset_inner").css("height",setHeight);$("#imageset_inner").css("width",setWidth);formula=$("div#main div.thumbs").width()*-1;$('#gallery').each(function(){var divi=$(this);var mask=$('div#imageset');var which=$('div#imageset_inner');$(this).children('.more-left').children('.arrow_left').each(function(){$(this).click(function(){return false;})})
$(this).children('.more-left').children('.arrow_left').each(function(){$(this).mouseup(function(){var destination=parseInt($(which).css('left'))+($("div#main div.thumbs").width()*3);if(destination>0){destination=0;}
which.animate({left:destination+'px'},600);})})
$(this).children('.more-right').children('.arrow_right').each(function(){$(this).click(function(){return false;})})
$(this).children('.more-right').children('.arrow_right').each(function(){$(this).mouseup(function(){left=$(which).css('left');if($(which).css('left')=='auto'){left=0;}
var destination=parseInt(left)-($("div#main div.thumbs").width()*3);if(((destination+$(which).width())-930)<0){destination=mask.width()-which.width();}
which.animate({left:destination+'px'},600);})})})}},prepDiscography:function(){$('a.linear_notes').each(function(){$(this).click(function(){var parent=$(this).parent().get(0);$(parent).siblings('div').css('display','none');var liner_notes=$(parent).siblings('div.credits');$(liner_notes).css('display','block');})})
$('a.buy_album').each(function(){$(this).click(function(){var parent=$(this).parent().get(0);$(parent).siblings('div').css('display','none');var liner_notes=$(parent).siblings('div.buylinks');$(liner_notes).css('display','block');})})
$('a.tracklistings').each(function(){$(this).click(function(){var parent=$(this).parent().get(0);$(parent).siblings('div').css('display','none');var liner_notes=$(parent).siblings('div.tracks');$(liner_notes).css('display','block');$('div.lyric').css('display','none');})})},prepAnimationTimer:function(){$(document).everyTime(6000,function(e){anim_count=anim_count+1;if(anim_count%3==0){if(anim_count%6!=0){$('promo_inner').css('top','-100px');}else{}}});},prepPromos:function(){$('#bg_inner').cycle({fx:'scrollLeft',easing:'easeInOutQuint',delay:'-300',speed:300,timeout:6000,width:'100%',height:'100%'});$('#promo_text').cycle({fx:'fade',speed:600,timeout:6000});$('#promo1_list').cycle({fx:'fade',speed:600,timeout:6000});$('#promo2_list').cycle({fx:'fade',speed:600,timeout:6000});$('#promo3_list').cycle({fx:'fade',speed:600,timeout:6000});$('#promo4_list').cycle({fx:'fade',speed:600,timeout:6000});$('#promo5_list').cycle({fx:'fade',speed:600,timeout:6000});$('#promo6_list').cycle({fx:'fade',speed:600,timeout:6000});},prepHorizontalNav:function(selector){$('div#timeline div.item').hover(function(){over=true;tm.clearVertical();var item=$(this);current_thumb=this.id;winWidth=windowWidth();container=item.parent();container.css({width:(container.children().length*134)+'px'});containerWidth=container.width();containerPos=$(container).offset().left;itemPos=item.offset().left;itemVar=(winWidth/2)-itemPos;var destination=$('#timeline_inner').offset().left+itemVar;if(destination>0){destination=0;}
if(-(destination)>(containerWidth-winWidth)){destination=-(containerWidth-winWidth);}
tweenObj=new Tween(document.getElementById('timeline_inner').style,'left',Tween.regularEaseOut,$('#timeline_inner').offset().left,destination,1.4,'px');tweenObj.start();var i=setInterval(function(which){if(current_thumb==which){if(over){var vert_name=which.replace(/item/,'vert');var vert=$(document.getElementById(vert_name));var item=$('div#'+which);$(vert).css('left',item.offset().left);$(vert).css('bottom','-539px');$(vert).css('display','block');tm.clearVertical();$(vert).animate({bottom:'77px',opacity:1},300)}}
clearInterval(i);},1500,current_thumb);},function(){over=false;if(tweenObj){tweenObj.stop();}})},openVerticalItem:function(which){if(current_thumb==which){if(over){var vert_name=which.replace(/item/,'vert');var vert=$(document.getElementById(vert_name));var item=$('div#'+which);$(vert).css('left',item.offset().left);$(vert).css('bottom','-539px');$(vert).css('display','block');tm.clearVertical();$(vert).animate({bottom:'77px',opacity:1},300)}}},prepVerticalNav:function(selector){$('div.vert div.item').each(function(){$(this).click(function(){current_category=indexInArray(categories,$(this).attr('alt'));tm.clearVertical();tm.prepMediaWall($(this).attr('alt'));})})},clearVertical:function(){$('div.vert').css({bottom:'-539px'});},prepMediaWall:function(id){tm.clearVertical();tm.fadeContent();$('div.audio').css({display:'none'});$('div#bg').html("<div id=\"bg_inner\"><img alt=\"contact background\" id=\"contact\" src=\"assets/images/backgrounds/contact_bg.jpg\"/></div>");$('div#timeline_nav').css({display:'block'});$('div#timeline_mask').css({display:'block'});document.getElementById('temp_inner').innerHTML="<a id='timeline_opener' href='time-line.html?category_name="+id.replace("&","~")+"' onclick=\"javascript: hs.htmlExpand(this, { objectType: 'ajax', wrapperClassName: 'media_wall', align: 'center', height: 584, dimmingOpacity: 0.75, fadeInOut: true }); return false;\">test</a>";var clicker=document.getElementById('timeline_opener');if(document.all){clicker.click();}else{clicker.onclick();}},fadeContent:function(){var content=$('div#content');content.animate({opacity:0})},fadeContentIn:function(){var content=$('div#content');content.animate({opacity:100})},windowHeight:function(){var myHeight=0;if(typeof(window.innerWidth)=='number'){myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myHeight=document.body.clientHeight;}
return myHeight;},resize:function(){height=tm.windowHeight()-tm.consts.bottomOffset;$(".panel").css('height',height);
	if ($("div#main").length > 0 && $("div#citizennet-widget").length > 0) {
		var cnwidgetheight = $("div#main").css("height").replace("px", "") - 200;
		$("div#accordion_live_div,div#container_box").css("height", cnwidgetheight + "px");
		return false;
	}
}}
$(function(){window.setTimeout(function(){if($('div#promo_inner div.promo_item').length>3){$(document).everyTime(18000,function(e){if(parseInt($('div#promo_inner').css('left'))<0){$('div#promo_inner').animate({left:'0px'},200);}else{$('div#promo_inner').animate({left:'-170px'},200);}});}},4000);tm._init();tm.prepHorizontalNav();tm.prepVerticalNav();hs.Expander.prototype.onAfterExpand=function(sender){Cufon.replace('h1.sub');Cufon.replace('h2.sub');if(document.body.id=='discography'){tm.prepDiscography();tm.prepDiscoScrollers();}
if(document.body.id=='dancehall-doctors'){tm.prepDancehallScrollers();}}
audio=document.getElementById('the_audio');$(document).pngFix();});function tween(over,direction){var magic=0;magic=$('#timeline_inner').width()-windowWidth();end_point=0;if(direction==-1){end_point=end_point-magic}
speed=magic/142;speed=speed/2;if(over&&!tweening){tweening=true;tweenObj=new Tween(document.getElementById('timeline_inner').style,'left',Tween.regularEaseOut,$('#timeline_inner').offset().left,end_point,speed,'px');tweenObj.start();window.setTimeout(done_tweening,speed*1000);}}
function done_tweening(tween_obj){tweening=false;}
function windowWidth(){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;}
return myWidth;}
function closeTimeline(){$('div#timeline_nav').css({display:'none'});$('div#timeline_mask').css({display:'none'});jQuery.each(hs.expanders,function(){if(this!=window){this.close();}
hs.close(this);});tm.fadeContentIn();}
function openPopupView(url){var link=document.createElement('a');url=url.replace('&','-');url=url.replace('-index=','&index=');link.setAttribute('href',url);hs.htmlExpand(link,{objectType:'ajax',wrapperClassName:'media_wall_popup',align:'center',width:660,height:(570+62),dimmingOpacity:0.75,fadeInOut:true})}
function previousPopupItem(index){hs.close();openPopupView($('div#mediawall_inner div#category_inner'+current_category+' div#category'+current_category+'link_holder'+index+' a').attr('href'));}
function nextPopupItem(index){hs.close();var linker=$('div#mediawall_inner div#category_inner'+current_category+' div#category'+current_category+'link_holder'+index+' a');if(linker.length==0){linker=$('div#mediawall_inner div#category_inner'+(current_category-1)+' div#category'+current_category+'link_holder'+index+' a');}
openPopupView(linker.attr('href'));}
function scrollGridLeft(mask,which){var destination=parseInt($(which).css('left'))+(310*3);if(destination>0){destination=0;}
which.animate({left:destination+'px'},600);}
function scrollGridRight(mask,which){var alltheway=true;left=which.css('left');if(which.css('left')=='auto'){left=0;}
var destination=parseInt(left)-(310*3);which.animate({left:destination+'px'},600);if(alltheway){var last_item=$('div#category_inner'+current_category+' div.item');var offset=0;if(last_item.hasClass('last')){if($('div#category_inner'+current_category+' div.new').length>0){offset=$('div#category_inner'+current_category+' div.new:last').attr('id').replace(/item/,'');}
current_category++;}else{offset=$('div#category_inner'+current_category+' div.item:last').attr('id').replace(/item/,'');}
if(current_category==categories.length){current_category=0;}
$('div#temp_load').load('/time-line.html?category_name='+escape(categories[current_category])+'&offset='+offset+' #mediawall_inner div.category_inner',null,function(){$('div#temp_load div.category_inner').each(function(){$(this).appendTo('div#category0');updateWidth();});});}}
function browseToCategory(mask,which,category){hs.close();var alltheway=true;left=which.css('left');if(which.css('left')=='auto'){left=0;}
var destination=parseInt(left)-(310*3);which.animate({left:destination+'px'},600);if(alltheway){current_category++;if(current_category==categories.length){current_category=0;}
$('div#temp_load').load('/time-line.html?category_name='+escape(categories[indexInArray(categories,category)])+' #mediawall_inner #category_inner',null,function(){$('div#temp_load div#category_inner').each(function(){$(this).appendTo('div#category0');updateWidth();});});}}
function updateWidth(){$('div#mediawall_inner').css('width',parseInt($('div#mediawall_inner').css('width'))+2000);$('div#category0').css('width',parseInt($('div#category0').css('width'))+2000);}
function indexInArray(arr,val){for(var i=0;i<arr.length;i++)if(arr[i]==val)return i;return-1;}
$('div.vert').hover(function(){},function(){tm.clearVertical();})
function changeTheAudio(songURL) {
  var songName = songURL.replace('~', '').replace("'", "\'").replace('assets/_files/_audio/', '').replace('http://timmcgraw.com//assets/_files/_audio/', '').replace('http://timmcgraw.com/assets/_files/_audio/', '').replace('.mp3', '').replace(/[0-9]* /, '');
  var flash = document.getElementById('the_audio');
  flash.changeFlashSong(songURL, songName);
}

