';insertHTML+=dude_link+' is following ';var keys=$H(dudes[dude_keys[i]].follow).keys();for(var j=0;j';insertHTML+=''+targets[keys[j]].username+'';if(jgroupsize){insertHTML+=' ...and '+(j-groupsize)+' other';insertHTML+=((j-groupsize)>1?'s':'');}
insertHTML+='
Make friends: Next time you see a comment that's brilliantly illuminating and life-changing, click the \"Follow Commenter\" icon next to it.
";if(src.length>0){src+='
';src+='';$(element_id).insert({'before':src});}}};dropFriendsActivity=function(friendsComments){var agent=new ActivityAgent();agent.initialize(friendsComments);agent.dropActivities();}
function swapBackground(element,classname){var sb=document.getElementById(element);sb.className=classname;}
function checkSearchForm(form){if($('term').value==''){ganjaShowMessage('error','Please provide a search phrase.','term');return false;}
form.action=form.action+'/'+$('term').value;if($('searchall').value==1){form.action=form.action+'/all';}}
function checkHelpMessageForm(){var emailFilter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;var retval=true;var msg="";$('emailmsg_submit').disabled=true;if($('useremail').value=='')
{ganjaShowMessage('error','Please enter a valid email address.','emailmsg');$('useremail').focus();retval=false;}
else if(!emailFilter.test($('useremail').value))
{ganjaShowMessage('error','Please enter a valid email address.','emailmsg');$('useremail').focus();retval=false;}
else if($('question').value=='')
{ganjaShowMessage('error','Please fill in the message field.','emailmsg');$('question').focus();retval=false;}
if(retval==true)
{ganjaShowMessage('error','Sending message...','emailmsg');}
else
{$('emailmsg_submit').disabled=false;}
return retval;}
function sendHelpMessage()
{if(checkHelpMessageForm())
{var req=new Ajax.Request('/index.php',{method:'post',parameters:$('userq').serialize(),evalJSON:true,onSuccess:function(transport)
{if(transport.headerJSON.success==true)
{helpMessageSuccess(transport.headerJSON);}
else
{helpMessageFailure(transport.headerJSON);}
$('emailmsg_submit').disabled=false;}});}
return false;}
function helpMessageSuccess(json)
{ganjaShowMessage('message',json.message,'emailmsg');setTimeout(function(){$('helpq').style.display=$('userq').style.display='none'},3000);}
function helpMessageFailure(json)
{ganjaShowMessage('message',json.message,'emailmsg');}
function OpenEmail(c){window.open(c,'email','width=500,height=315,scrollbars=yes,status=yes');}
function pf(a,b){window.status=a+' '+window.status;}
function searchSubmit()
{sf=$('search');if(sf.q.value=='')
{alert('Please provide a search keyword or a phrase.');return false;}
else
{lochref=sf.prefix.value+encodeURI(sf.q.value.replace(/\s/g,'+'))+'/';if(sf.bydate.value==1)
{lochref=lochref+'bydate/';}
document.location=lochref;return false;}}
function ajaxPost(link)
{var parameters=new Array();parameters.push('format=ajax');parameters=parameters.join('&');ganjaAjaxUpdater('Posts',link,parameters,false);}
function ganjaExtension(extName,argsArr)
{var containerId=Math.random();document.write('');var params=new Array();params.push(extName+'Id='+containerId);if(argsArr!=undefined&&argsArr!=null){for(var i=0;i');if(galleryTitle!=null)
{var header='
";this.report.style.display='block';this.report.innerHTML=reportContent;}},hide:function()
{this.report.style.display='none';Effect.BlindUp(this.shade,{duration:0.1});},displayNone:function(effect)
{effect.element.style.display='none';}}
var Cookie={set:function(name,value,daysToExpire,setPath){var expire='';if(daysToExpire!=undefined){var d=new Date();d.setTime(d.getTime()+(86400000*parseFloat(daysToExpire)));expire='; expires='+d.toGMTString();}
var path='';if(setPath!=undefined){path='; path='+setPath;}
return(document.cookie=escape(name)+'='+escape(value||'')+expire+path);},get:function(name){var cookie=document.cookie.match(new RegExp('(^|;)\\s*'+escape(name)+'=([^;\\s]*)'));return(cookie?unescape(cookie[2]):null);},erase:function(name,setPath){var path='';if(setPath!=undefined){path='; path='+setPath;}
var cookie=Cookie.get(name)||true;Cookie.set(name,'',-1,path);return cookie;},accept:function(){if(typeof navigator.cookieEnabled=='boolean'){return navigator.cookieEnabled;}
Cookie.set('_test','1');return(Cookie.erase('_test')==='1');}};function hideLeaderboard()
{if($('interruptor'))$('interruptor').hide();return false;}
function ganjaClip(postId,onoff,callerAnchor,messageId)
{var parameters=new Array();parameters.push('op=saveusertag');parameters.push('objectType=POST');parameters.push('objectId='+postId);parameters.push('messageId='+messageId);if(onoff==true)
{parameters.push('tagName=favorite');}
else
{parameters.push('unTagName=favorite')}
parameters=parameters.join('&');ganjaAjaxUpdater(callerAnchor,'/index.php',parameters);return false;}
function ganjaBuddy(userId,onoff,callerAnchor,anchorId,messageId)
{var parameters=new Array();parameters.push('op=saveusertag');parameters.push('objectType=USER');parameters.push('objectId='+userId);parameters.push('anchorId='+anchorId);parameters.push('messageId='+messageId);if(onoff==true)
{parameters.push('tagName=buddy');}
else
{parameters.push('unTagName=buddy')}
parameters=parameters.join('&');ganjaAjaxUpdater(callerAnchor,'/index.php',parameters);return false;}
function toggleBuddyStatus(buddyId,anchorId,messageId)
{if(!$('buddy_'+anchorId))
{location.href=location.href;return false;}
var buddy=$('buddy_'+anchorId);if(buddy.hasClassName('user-friend-follow'))
{buddy.removeClassName('user-friend-follow');buddy.addClassName('user-friend-remove');buddy.addClassName('commentToolRemove');buddy.removeClassName('commentToolAdd');buddy.alt="Click here to stop following this commenter";buddy.title="Click here to stop following this commenter";buddy.onclick=function(e){return ganjaBuddy(buddyId,false,'ganjaBuddyDiv',anchorId,messageId);};}
else
{buddy.addClassName('user-friend-follow');buddy.removeClassName('user-friend-remove');buddy.addClassName('commentToolAdd');buddy.removeClassName('commentToolRemove');buddy.alt="Click here to follow this commenter";buddy.title="Click here to follow this commenter";buddy.onclick=function(e){return ganjaBuddy(buddyId,true,'ganjaBuddyDiv',anchorId,messageId);};if(messageId=='own')
{var parentdiv=$('div_buddy_'+buddyId);if(parentdiv!=undefined)
{parentdiv.style.display="none";}}}
var buddy=$('buddytext_'+anchorId);if(buddy)
{if(buddy.hasClassName('user-friend-follow-textlink'))
{buddy.removeClassName('user-friend-follow-textlink');buddy.addClassName('user-friend-remove-textlink');buddy.alt="Click here to stop following this commenter";buddy.title="Click here to stop following this commenter";buddy.childNodes[0].nodeValue='stop following this commenter';buddy.onclick=function(e){return ganjaBuddy(buddyId,false,'ganjaBuddyDiv',anchorId,messageId);};}
else
{buddy.addClassName('user-friend-follow-textlink');buddy.removeClassName('user-friend-remove-textlink');buddy.alt="Follow this commenter";buddy.title="Follow this commenter";buddy.childNodes[0].nodeValue='follow this commenter';buddy.onclick=function(e){return ganjaBuddy(buddyId,true,'ganjaBuddyDiv',anchorId,messageId);};}}}
function changePostStatus(postId,state,realm,linkobj,needsConfirm)
{var skip=false;if(needsConfirm)
{if(!confirm('Delete post?'))
{skip=true;}}
if(!skip)
{var params=new Array;params.push('op=changepoststatus');params.push('id='+postId);params.push('publishStatus='+state);params.push('realm='+realm);new Ajax.Updater('postStatusResponse',"/index.php",{parameters:params.join('&'),evalScripts:true});}}
function changeTagpagecommentStatus(postId,state)
{var params=new Array;params.push('op=changetagcommentstatus');params.push('id='+postId);params.push('publishStatus='+state);new Ajax.Updater('postStatusResponse',"/index.php",{parameters:params.join('&'),evalScripts:true});}
function removeSiteTag(postId,postIssued)
{var params=new Array;params.push('op=removesitetag');params.push('postId='+postId);params.push('postIssued='+postIssued);new Ajax.Updater('postStatusResponse',"/index.php",{parameters:params.join('&'),evalScripts:true});}
function removePostFromPage(postId)
{$('id_'+postId).style.display='none';if($('hr_'+postId))$('hr_'+postId).style.display='none';if($('post_separator_'+postId.split('_')[0]))$('post_separator_'+postId.split('_')[0]).style.display='none';}
function toggleTagRemoveButton(postId,post_issued)
{if($('tagToggleLinkRemove'+postId).hasClassName('deleteButton'))
{$('tagToggleLinkRemove'+postId).removeClassName('deleteButton');$('tagToggleLinkRemove'+postId).addClassName('addButton');$('tagToggleLinkRemove'+postId).title='Add this crosspromoted post to this site';$('tagToggleLinkRemove'+postId).alt='Add this crosspromoted post to this site';}
else
{$('tagToggleLinkRemove'+postId).removeClassName('addButton');$('tagToggleLinkRemove'+postId).addClassName('deleteButton');$('tagToggleLinkRemove'+postId).title='Remove this crosspromoted post from this site';$('tagToggleLinkRemove'+postId).alt='Remove this crosspromoted post from this site';}}
function togglePostStatusButton(postId,state,realm)
{if($('statusToggleLinkPromote'+postId)!=undefined)var linkdiv=$('statusToggleLinkPromote'+postId);else if($('statusToggleLinkDemote'+postId)!=undefined)var linkdiv=$('statusToggleLinkDemote'+postId);switch(state)
{case'PUBLISHED':linkdiv.href="javascript:changePostStatus("+postId+",'REVIEWED', '"+realm+"', this)";linkdiv.className='deleteButton';ganjaShowMessage('info','Status changed to: '+state,'poststatusMessage_'+postId);break;default:linkdiv.href="javascript:changePostStatus("+postId+",'PUBLISHED', '"+realm+"', this)";linkdiv.className='addButton';ganjaShowMessage('info','Status changed to: '+state,'poststatusMessage_'+postId);break;}}
function jumpToComment(postId,commentDivClass,commentId,finaltry)
{if(commentId==undefined)
{commentId=document.location.hash;}
else
{var pos=commentId.lastIndexOf('#');if(pos>0)
{commentId=commentId.substr(pos);}}
var cId=parseInt(commentId.substr(2));if((commentId!='')&&(cId>0))
{commentDivClass='.'+commentDivClass;var comments=$$(commentDivClass);var found=false;for(var i=0;i');var containerId=Math.random();document.write('');var params=new Array();params.push('maxReturned='+num);params.push('parentId='+siteId);params.push('format=ajaxheadlines');params=params.join('&');var req=new Ajax.Updater('latestHeadlines'+containerId,'/',{method:'post',parameters:params,evalScripts:false,asynchronous:true});document.write('');}
function cssEditorWindow()
{win=new Window({className:"alphacube",title:"CSS Editor",width:400,destroyOnClose:true,recenterAuto:false});win.setAjaxContent('?op=csseditor','');win.showCenter();}
function setClassStyle(className,styleElement,value)
{var newStyle=new Array();newStyle[styleElement]=value;var classDivs=$$('.'+className);for(var i=0;i0)
{for(i=0;iFeedback
");}
for(i=0;i');document.write(''+google_ads[i].line1+''+' '+google_ads[i].line2+google_ads[i].line3+' '+google_ads[i].visible_url)+'';document.write('');}}
var mouseOverHandler=function(e){if((Event)&&Event.element){if(Event.element(e).hasClassName('super-permalink')||Event.element(e).up().hasClassName('super-permalink')){var postdiv=Event.element(e).up();while(!(postdiv.hasClassName('post')||postdiv.hasClassName('post-quicklinks'))){postdiv=postdiv.up();}
postdiv.addClassName('highlited');}}};var mouseOutHandler=function(e){if((Event)&&Event.element){if(Event.element(e).hasClassName('super-permalink')||Event.element(e).up().hasClassName('super-permalink')){var postdiv=Event.element(e).up();while(!(postdiv.hasClassName('post')||postdiv.hasClassName('post-quicklinks'))){postdiv=postdiv.up();}
postdiv.removeClassName('highlited');}}};var activateDynamicContent=function()
{var id;var method;var params;for(i=0;i','commentformMessage');retval=false;}else if($('commentBody').value==''){ganjaShowMessage('error','Please fill in the message field. ','commentformMessage');retval=false;}else{retval=true;}
return retval;}
function reloadPage(delay)
{var loc=location.href;if(loc.indexOf('#'))
{loc=loc.split('#').shift();}
setTimeout('location.href=\''+loc+'\';',delay);}
var GanjaNotifier=Class.create({initialize:function(msg){this.div_main_id='ganja_notifier';this.div_msg_id='ganja_notifier-msg';if(this.enabled()){return this.notify(msg);}},notify:function(msg){$(this.div_msg_id).update(msg);if(!$(this.div_main_id).visible()){Effect.BlindDown(this.div_main_id);}
return false;},enabled:function(){c=Cookie.get('ganja_notifier');if(c&&c.value=='disabled'){return false;}else{return true;}},disable:function(){Cookie.set('ganja_notifier','disabled',14);}});var messageTargetTimeouts=new Array();function ganjaShowMessage(type,msg,msgdivid,stable)
{if(msgdivid!=undefined)
{try
{var m=$(msgdivid);if(messageTargetTimeouts[msgdivid]>0)
{clearTimeout(messageTargetTimeouts[msgdivid]);}
if(stable!=true||stable!=undefined)
{if(m.nodeName=='INPUT'){m.value=msg;messageTargetTimeouts[msgdivid]=setTimeout(function(){$(msgdivid).value='';delete messageTargetTimeouts[msgdivid];if($('topnavbarHelp'))$('topnavbarHelp').style.display='inline';},3000);}else{m.innerHTML=msg;messageTargetTimeouts[msgdivid]=setTimeout(function(){$(msgdivid).innerHTML='';delete messageTargetTimeouts[msgdivid];if($('topnavbarHelp'))$('topnavbarHelp').style.display='inline';},3000);}}}
catch(e)
{}}
else
{var ganja_messages=$('ganja_messages');var msgdivid='ganja_message_'+(Math.floor(Math.random()*1000)+1);try
{var m=document.createElement('div');m.setAttribute("id",msgdivid);var excl=document.createElement('div');excl.setAttribute("class","exclamation");excl.setAttribute("className","exclamation");excl.innerHTML="";m.appendChild(excl);m.innerHTML+=msg;if(type=='failure'||type=='error')
{m.setAttribute("class","ganjaMessage error");m.setAttribute("className","ganjaMessage error");}
else if(type=='success')
{m.setAttribute("class","ganjaMessage success");m.setAttribute("className","ganjaMessage success");}
else if(type=='message')
{m.setAttribute("class","ganjaMessage info");m.setAttribute("className","ganjaMessage info");}
else
{m.setAttribute("class","ganjaMessage");m.setAttribute("className","ganjaMessage");}
var hT=$$('.ganjaMessage').length;m.style.top=30+(hT*58)+'px';if(document.selection)
{m.style.position='absolute';}
document.body.appendChild(m);setTimeout('ganjaHideMessage(\''+msgdivid+'\')',5000);}
catch(e)
{}}
return false;}
function ganjaHideMessage(id)
{var message=document.getElementById(id);try
{if(message)
{message.style.display='none';document.body.removeChild(message);}}
catch(e)
{}}
function ganjaAjaxUpdater(resultdiv,url,params,options)
{if((options!=undefined)&&(options['indicator']!=undefined))
{ganjaToggleIndicator(options['indicator'],'show');var ind=options['indicator'];options['onComplete']=function(){ganjaToggleIndicator(ind,'hide');};options['indicator']=undefined;}
if((options!=undefined)&&(options['inline_indicator']!=undefined))
{ganjaToggleInlineIndicator(options['inline_indicator'],'show');var ind=options['inline_indicator'];options['onComplete']=function(){ganjaToggleInlineIndicator(ind,'hide');};options['inline_indicator']=undefined;}
var opts={method:'post',parameters:params,evalScripts:true,asynchronous:true};if(options!=undefined)
{for(var key in options)
{opts[key]=options[key];}}
var req=new Ajax.Updater(resultdiv,url,opts);}
function switchView(viewtype)
{if(viewtype=='classic')
{Cookie.set('postlistView','classic',730,'/');}
else
{Cookie.set('postlistView','condensed',730,'/');}
location.reload();}
if(!Cookie.get('ganjaPostlistView'))
{Cookie.set('ganjaPostlistView',false,730,'/');}
function expandTopStories(){$('ad-300x250').style.display='none';if($('splashPosts')){$('splashPosts').style.width='1025px';}
$('moreTopStories').style.right='10px';return 0;}
function collapseSkyscraper(){$('skyscraper').style.display='none';$('skySpacer').style.marginTop='-1.5em';$('siteInfo').style.marginTop='10px';return 0;}
function changeSplashPosts(tagname,linkId)
{var cookievalue='default';if(linkId)
{var linkelement=$(linkId);}else{var linkelement=$(tagname+'Link');}
if(!linkelement)return false;var parameters=new Array();parameters.push('op=postlist');parameters.push('format=topstories');parameters.push('maxReturned=10');parameters.push('tagName='+tagname);parameters=parameters.join('&');if(tagname=='default'||linkelement.hasClassName('selected'))
{cookievalue='default';$('originalSplashposts').style.display='block';$('placeholderSplashposts').style.display='none';$$('#custom-menu-taglist a.selected').each(function(el){el.removeClassName('selected');});$('defaultLink').addClassName('selected');}
else
{cookievalue=tagname;$('originalSplashposts').style.display='none';$('placeholderSplashposts').style.display='none';$('loader').style.display='block';var options=new Array();ganjaToggleIndicator('loader','show');options['onComplete']=function(){ganjaToggleIndicator('loader','hide');$('placeholderSplashposts').style.display='block';};ganjaAjaxUpdater('placeholderSplashposts','/index.php',parameters,options);$$('#custom-menu-taglist a.selected').each(function(el){el.removeClassName('selected');});linkelement.addClassName('selected');}
var imgmy=new Image;imgmy.src="http://orion.eyereturn.com/iat.aspx?tokenID="+tokenID+"&actionID=431";Cookie.set('tmobile_splashtagname',cookievalue,31536000,'/');if(linkId)
{Cookie.set('tmobile_splashtagid',linkId,31536000,'/');}else{Cookie.set('tmobile_splashtagid',false,-1,'/');}
return false;}
window.onload=function(){try
{$('ad-300x250').descendants().each(function(el){if(el.readAttribute('src')!=undefined){if(el.readAttribute('src').match(/817-grey.gif/)){expandTopStories();}}});if($('ad-160x160-bottom')){$('ad-160x160-bottom').descendants().each(function(el){if(el.readAttribute('src')!=undefined){if(el.readAttribute('src').match(/817-grey.gif/)){$('ad-160x160-bottom').style.display='none';$('skySpacer').style.marginTop='-1.5em';$('skySpacer').style.borderTopWidth='0';}}});}
$('skyscraper').descendants().each(function(el){if(el.readAttribute('src')!=undefined){if(el.readAttribute('src').match(/817-grey.gif/)){collapseSkyscraper();}}});if($('interruptor')){$('interruptor').descendants().each(function(el){if(el.readAttribute('src')!=undefined){if(el.readAttribute('src').match(/817-grey.gif/)){$('interruptor').style.display='none';}}});}}catch(e){}};var lastopened=false;var menuout;var tmenuout;var menuin;function initMenu()
{$$('.menu li').each(function(menuitem){menuitem.onmouseover=function(){$$('.menu li.toplevelmenu').each(function(cmi){if(menuitem!=cmi&&!menuitem.descendantOf(cmi))
{cmi.select('ul').each(function(si){si.style.display='none';});cmi.removeClassName('selected');}});menuitem.addClassName('selected');menuitem.childElements().each(function(mitem){if(mitem.tagName.toLowerCase()=='ul')
{var mfunc=function(){mitem.style.display='block';}
clearTimeout(menuout);clearTimeout(tmenuout);menuin=setTimeout(mfunc,200);lastopened=mitem;}});}
menuitem.onmouseout=function(){if(menuitem.hasClassName('toplevelmenu'))
{var munselect=function(){menuitem.removeClassName('selected');}
tmenuout=setTimeout(munselect,200);}
else
{menuitem.removeClassName('selected');}
menuitem.select('ul').each(function(mitem){var mfuncout=function(){mitem.style.display='none';}
if(!mitem.descendantOf(lastopened))
{clearTimeout(menuin);menuout=setTimeout(mfuncout,200);}});}});}
var thumbnailsContentWidth;var thumbnailsHolderWidth;var scrollwidth=15;var scrolltimer;var totalimages;function initThumbnailPager()
{var images=$$('#galleryThumbsContent li img')
totalimages=images.length;images.each(function(item){item.observe('load',function(event){totalimages--;if(totalimages==0)
{initPager();}});});initPager();}
function initPager()
{thumbnailsContentWidth=$('galleryThumbsContent').getWidth();thumbnailsHolderWidth=$('galleryThumbnailsHolder').getWidth();if(thumbnailsHolderWidth>thumbnailsContentWidth)
{var lmargin=parseInt((thumbnailsHolderWidth-thumbnailsContentWidth)/2);$('galleryThumbsContent').setStyle({'marginLeft':lmargin+'px'});}
else if(thumbnailsHolderWidth0)nmargin=0;$('galleryThumbsContent').setStyle({'marginLeft':nmargin+'px'});}
function startLeftScroll()
{moveLeft();scrolltimer=setTimeout('startLeftScroll()',50);}
function startRightScroll()
{moveRight();scrolltimer=setTimeout('startRightScroll()',50);}
function stopScroll()
{clearTimeout(scrolltimer);}
function findWistsImages(anchor,custom_class_or_id){if(!document.getElementById)return;var container_classes=['entry','item','post','story','product'];var image_ignore_classes=['wistsignore'];if(custom_class_or_id&&typeof(custom_class_or_id=='string')){container_classes.push(custom_class_or_id);}else{custom_class_or_id="__NO_ID__";}
var container_class_regex=new RegExp('\\s('+container_classes.join("|")+')\\s',"i");var image_class_ignore_regex=new RegExp('\\s('+image_ignore_classes.join("|")+')\\s',"i");var container=anchor.parentNode;while(!container_class_regex.test(" "+container.className+" ")&&(container.id!=custom_class_or_id)&&(container.tagName.toLowerCase()!="body")){container=container.parentNode;}
if(container.tagName.toLowerCase()=="body"){return;}
var all_images=container.getElementsByTagName('img');var i=0;while(image_class_ignore_regex.test(" "+all_images[i].className+" ")&&(i0;i--)
{var post=posts[i-1];if(type=='comments')
{var postDiv=createCommentDiv(post);}
else
{var postDiv=createPostDiv(post);}
$(placeholder[type]).insertBefore(postDiv,$(placeholder[type]).firstChild);if(!firstRun[type])new Effect.SlideDown(postDiv,{duration:1});lastIssueDate[type]=post.issued;if($(placeholder[type]).childNodes.length>itemsOnPage[type])$(placeholder[type]).lastChild.remove(true);}
firstRun[type]=false;}
function createPostDiv(post)
{var postDiv=document.createElement('div');postDiv.className='postText';var postTextDiv=document.createElement('div');postTextDiv.className='postText';postTextDiv.innerHTML='
');}
function edShowExtra(){document.getElementById('ed_extra_show').style.visibility='hidden';document.getElementById('ed_extra_buttons').style.display='block';edSetCookie('js_quicktags_extra','show',new Date("December 31, 2100"));}
function edHideExtra(){document.getElementById('ed_extra_buttons').style.display='none';document.getElementById('ed_extra_show').style.visibility='visible';edSetCookie('js_quicktags_extra','hide',new Date("December 31, 2100"));}
function edInsertTag(myField,i){if(myField)
{if(document.selection){myField.focus();sel=document.selection.createRange();if(sel.text.length>0){sel.text=edButtons[i].tagStart+sel.text+edButtons[i].tagEnd;}
else{if(!edCheckOpenTags(i)||edButtons[i].tagEnd==''){sel.text=edButtons[i].tagStart;edAddTag(i);}
else{sel.text=edButtons[i].tagEnd;edRemoveTag(i);}}
myField.focus();}
else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;var cursorPos=endPos;var scrollTop=myField.scrollTop;if(startPos!=endPos){myField.value=myField.value.substring(0,startPos)
+edButtons[i].tagStart
+myField.value.substring(startPos,endPos)
+edButtons[i].tagEnd
+myField.value.substring(endPos,myField.value.length);cursorPos+=edButtons[i].tagStart.length+edButtons[i].tagEnd.length;}
else{if(!edCheckOpenTags(i)||edButtons[i].tagEnd==''){myField.value=myField.value.substring(0,startPos)
+edButtons[i].tagStart
+myField.value.substring(endPos,myField.value.length);edAddTag(i);cursorPos=startPos+edButtons[i].tagStart.length;}
else{myField.value=myField.value.substring(0,startPos)
+edButtons[i].tagEnd
+myField.value.substring(endPos,myField.value.length);edRemoveTag(i);cursorPos=startPos+edButtons[i].tagEnd.length;}}
myField.focus();myField.selectionStart=cursorPos;myField.selectionEnd=cursorPos;myField.scrollTop=scrollTop;}
else{if(!edCheckOpenTags(i)||edButtons[i].tagEnd==''){myField.value+=edButtons[i].tagStart;edAddTag(i);}
else{myField.value+=edButtons[i].tagEnd;edRemoveTag(i);}
myField.focus();}}}
function edInsertContent(myField,myValue){if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=myValue;myField.focus();}
else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;var scrollTop=myField.scrollTop;myField.value=myField.value.substring(0,startPos)
+myValue
+myField.value.substring(endPos,myField.value.length);myField.focus();myField.selectionStart=startPos+myValue.length;myField.selectionEnd=startPos+myValue.length;myField.scrollTop=scrollTop;}else{myField.value+=myValue;myField.focus();}}
function edInsertLink(myField,i,defaultValue){if(!defaultValue){defaultValue='http://';}
if(!edCheckOpenTags(i)){var URL=prompt('Enter the URL',defaultValue);if(URL){edButtons[i].tagStart='';edInsertTag(myField,i);}}
else{edInsertTag(myField,i);}}
function edInsertExtLink(myField,i,defaultValue){if(!defaultValue){defaultValue='http://';}
if(!edCheckOpenTags(i)){var URL=prompt('Enter the URL',defaultValue);if(URL){edButtons[i].tagStart='';edInsertTag(myField,i);}}
else{edInsertTag(myField,i);}}
function edInsertImage(myField){var myValue=prompt('Enter the URL of the image','http://');if(myValue){myValue='';edInsertContent(myField,myValue);}}
function edInsertFootnote(myField){var note=prompt('Enter the footnote:','');if(!note||note==''){return false;}
var now=new Date;var fnId='fn'+now.getTime();var fnStart=edCanvas.value.indexOf('');if(fnStart!=-1){var fnStr1=edCanvas.value.substring(0,fnStart)
var fnStr2=edCanvas.value.substring(fnStart,edCanvas.value.length)
var count=countInstances(fnStr2,'
';value+='+ Watch video';value+='
Click here to refresh.');$('ncn_last_updated').value=new Date().getTime();}}});}});function ganjaStarInviteShow() {inviteSent=Cookie.get('starInviteSent');if(inviteSent!=1&&$('ganjaStarInviteFormContainer').style.display=='none') {$('ganjaStarInviteFormContainer').style.display='block';} return false;} function ganjaStarInviteHide() {$('ganjaStarInviteFormContainer').style.display='none';$('ganjaStarInviteForm').reset();ganjaStarInviteMessage('ganjaStarInviteMessage','');for(var i=0;i<3;i++) {ganjaStarInviteMessage('ganjaStarInviteError'+i,'');} return false;} function ganjaStarInvite() {var params=$('ganjaStarInviteForm').serialize();var req=new Ajax.Request('/index.php?op=starinvite',{method:'post',parameters:params,evalJSON:true,onSuccess:function(transport) {if(transport.responseJSON.success==true) {ganjaStarInviteSuccess(transport.responseJSON);} else {ganjaStarInviteFailure(transport.responseJSON);}}});} function ganjaStarInviteSuccess(json) {for(var i=0;i<3;i++) {ganjaStarInviteMessage('ganjaStarInviteError'+i,'');} ganjaStarInviteMessage('ganjaStarInviteMessage',json.message);setTimeout(function(){ganjaStarInviteHide();$('ganjaStarInviteLink').style.display='none';},1500);} function ganjaStarInviteFailure(json) {json.errorMessage.each(function(message,id) {ganjaStarInviteMessage('ganjaStarInviteError'+id,message);}) ganjaStarInviteMessage('ganjaStarInviteMessage',json.message);} function ganjaStarInviteMessage(id,message) {if($(id)) {$(id).innerHTML=message;if(message=='') {$(id).style.display='none';} else {$(id).style.display='block';}}} function ganjaChangeUserStatus(siteId,userId,action,commentId,postId) {var params=new Array();params.push('op='+action+'user');params.push('siteId='+siteId);params.push('postId='+postId);params.push('commentId='+commentId);params.push('id='+userId);params=params.join('&');ganjaAjaxUpdater('buddyMessage_'+commentId,'/index.php',params);} function ganjaChangeUserStatusFailure(userId,message,exception){} function ganjaChangeUserStatusSuccess(userId,action,commentId) {var controls=$$('span.'+action+'User'+userId);controls.each(function(s){s.style.display='none';});if(action=='approve') {$('commentContent'+commentId).removeClassName('draft');$$('span.promoteComment'+userId).each(function(s){s.style.display='inline';new Effect.Highlight(s);});other='remove';} else {$$('span.promoteComment'+userId).each(function(s){s.style.display='none';});other='approve';} var controls=$$('span.'+other+'User'+userId);controls.each(function(s){s.style.display='inline';new Effect.Highlight(s);});} function flagComment(cId,url) {if(confirm("Are you sure you wish to flag this comment?")) {var params=new Array();params.push('op=flag_comment');params.push('url='+url);params=params.join('&');ganjaAjaxUpdater(cId,'/index.php',params);} return false;} function starUser(commentId,commenterId,state) {if(state=='true'){var msg="Are you sure want to star this user?";}else{var msg="Are you sure want to un-star this user?";} if(confirm(msg)) {var params=new Array();params.push('op=setstarcommenter');params.push('id='+commenterId);params.push('cid='+commentId);params.push('starcommenter='+state);params=params.join('&');ganjaAjaxUpdater('starc'+commentId,'/index.php',params);} return false;} function ganjaSetCommentState(commentid,postid,status,userid,rootCommentId) {var parameters=new Array();parameters.push('op=changecommentstatus');parameters.push('id='+commentid);parameters.push('entry_id='+postid);parameters.push('publishStatus='+status);parameters.push('user_id='+userid);parameters.push('root_comment_id='+rootCommentId);parameters=parameters.join('&');if(rootCommentId!=undefined) {var req=new Ajax.Request('/index.php',{method:'post',parameters:parameters,evalJSON:true,onSuccess:function(transport) {if(transport.headerJSON.success==true) {ganjaSetCommentStateSuccess(transport.headerJSON);} else {ganjaSetCommentStateFailure(transport.headerJSON);}}});} else {var req=new Ajax.Updater('scripter','/index.php',{method:'post',parameters:parameters,evalScripts:false,asynchronous:true,onComplete:function(){if(status=='PUBLISHED') {document.getElementById('demoteComment'+commentid).style.display='none';document.getElementById('promoteComment'+commentid).style.display='block';} else if(status=='FRONTPAGE') {document.getElementById('demoteComment'+commentid).style.display='block';document.getElementById('promoteComment'+commentid).style.display='none';}}});}} function ganjaSetCommentStateSuccess(json) {$('deactivateComment'+json.commentId).style.display='none';$('c'+json.commentId).style.display='none';} function ganjaSetCommentStateFailure(json) {ganjaShowMessage('message',json.message,'deactivateMessage'+json.commentId);} function ganjaPromoteComment(commentId) {if(window.confirm('Do you really want to promote this comment to frontpage?')) {var params=new Array();params.push('op=promotecomment');params.push('comment_id='+commentId);params=params.join('&');var req=new Ajax.Request('/index.php',{method:'post',parameters:params,evalJSON:true,onSuccess:function(transport) {if(transport.headerJSON.success==true) {ganjaPromoteCommentSuccess(transport.headerJSON);} else {ganjaPromoteCommentFailure(transport.headerJSON);}}});}} function ganjaPromoteCommentSuccess(json) {ganjaShowMessage('message',json.message,'buddyMessage_'+json.commentId);$('promoteCommentContainer'+json.commentId).innerHTML='Promoted ';} function ganjaPromoteCommentFailure(json) {ganjaShowMessage('message',json.message,'buddyMessage_'+json.commentId);} function ganjaDisemvowelComment(commentId,postId,rootCommentId) {var params=new Array();params.push('op=disemvowelcomment');params.push('comment_id='+commentId);params.push('root_comment_id='+rootCommentId);params.push('entry_id='+postId);params=params.join('&');var req=new Ajax.Request('/index.php',{method:'post',parameters:params,evalJSON:true,onSuccess:function(transport) {json=transport.headerJSON;if(json.success==true) {ganjaDisemvowelCommentSuccess(json);} else {ganjaDisemvowelCommentFailure(json);}}});} function ganjaDisemvowelCommentSuccess(json) {$('commentContent'+json.commentId).innerHTML=json.commentText;} function ganjaDisemvowelCommentFailure(json) {ganjaShowMessage('message',json.message,'dsmvwlMessage'+json.commentId);} function ganjaPostRating(postId,rating) {var params=new Array();params.push('op=postrating');params.push('objId='+postId);params.push('objType=POST');params.push('rating='+rating);params=params.join('&');$$('div#ganjaRatingContainer div#value').pop().innerHTML=rating;var req=new Ajax.Request('/index.php',{method:'post',parameters:params,evalJSON:true,onSuccess:function(transport) {json=transport.responseText.evalJSON();if(json.success==true) {ganjaPostRatingSuccess(json);} else {ganjaPostRatingFailure(json);}}});} function ganjaPostRatingRenderCall(level,bold,copy) {if(copy==undefined) {if(level==undefined) {copy=$$('div#ganjaRatingContainer div#call').pop().innerHTML;} else {var levels=new Array("Poor","Nothing special","It's Ok","Pretty cool","Awesome!");copy=levels[level-1];}} if(bold==true) {$$('div#ganjaRatingContainer div#rateThis').pop().addClassName('bold');} else {$$('div#ganjaRatingContainer div#rateThis').pop().removeClassName('bold');} $$('div#ganjaRatingContainer div#rateThis').pop().innerHTML=copy;} function ganjaPostRatingFillTo(level) {if(level==undefined) {if($$('div#ganjaRatingContainer div#rateThis').pop().hasClassName('bold')) {return false;} level=$$('div#ganjaRatingContainer div#value').pop().innerHTML;} ganjaPostRatingRenderCall(level,false);stars=$$('div#ganjaRatingContainer a');for(var i=0;i<5;i++) {if(i
';ret+='';return ret;} ganjaCMPicSelector.prototype.addImage=function(pic) {this.workingImages[this.workingImages.length]=pic;} ganjaCMPicSelector.prototype.removeImage=function(pic) {this.notWorkingImages[this.notWorkingImages.length]=pic;this.showImage(false,pic);if(this.workingImages.length+this.notWorkingImages.length>=this.images.length)this.resetImage();} ganjaCMPicSelector.prototype.getPicPos=function(pic,arr) {if(arr==null)return;for(var i=0;i
';insertHTML+=''+targets[target_keys[i]].title+' drew comment from ';var keys=$H(targets[target_keys[i]].commented).keys();for(var j=0;j'+dudes[keys[j]].displayName+'';if(j
';insertHTML+=dude_link+' clipped ';var keys=$H(dudes[dude_keys[i]].clip).keys();for(var j=0;j
';insertHTML+=dude_link+' is following ';var keys=$H(dudes[dude_keys[i]].follow).keys();for(var j=0;j
';insertHTML+=dude_link+' removed ';var keys=$H(dudes[dude_keys[i]].leave).keys();for(var j=0;j
';messages_src+=dude_link+' sent you a message: ';messages_src+=dudes[dude_keys[i]].messages[keys[j]].val.text;messages_src+='