var ganjaPostingstatus=false;var ganjaPreviewstatus=false;var ganjaNewUser=false;function ganjaUberSubmit(f) {if(f==undefined) {f=$('ganja_uberform');} if(f.elements.status.value=='login') {ganjaLogin(f);} else if(f.elements.status.value=='register') {ganjaRegistration(f)} else if(f.elements.status.value=='comment') {ganjaPostComment(f);}} function ganjaRegistration(f) {var parameters=new Array();parameters.push('op=register');parameters.push('IS_NEW=1');if(f.elements.code)parameters.push(Form.Element.serialize(f.elements.code));f.elements.name.value=f.elements.username.value;parameters.push(Form.Element.serialize(f.elements.name));f.elements.new_password.value=f.elements.password.value;parameters.push(Form.Element.serialize(f.elements.new_password));parameters.push(Form.Element.serialize(f.elements.confirm_password));parameters.push(Form.Element.serialize(f.elements.email));parameters=parameters.join('&');ganjaHideMessage();ganjaShowMessage('message','Registering new user...','registerMessage');ganjaAjaxUpdater('ganja_response','/index.php',parameters);} function ganjaRegistrationSuccess(msg) {var f=$('ganja_uberform');ganjaShowMessage('message','Success! You are now registered.','registerMessage');ganjaNewUser=true;tmp_username=f.elements.name.value;tmp_password=f.elements.new_password.value;f.elements.username.value=tmp_username;f.elements.password.value=tmp_password;ganjaLogin(f,f.elements.callback_method.value);} function ganjaRegistrationFailure(msg) {ganjaShowMessage('failure',msg,'registerMessage');} function ganjaSetProfile(formId,messageId,message) {f=$(formId);if(f.elements.new_password!=undefined) {if(f.elements.new_password.value!='') {if(f.elements.password.value=='') {ganjaShowMessage('failure','You password did not match our records. Please try again.',messageId);f.elements.password.focus();return false;} if(f.elements.new_password.value!=f.elements.confirm_password.value) {ganjaShowMessage('failure','Password confirmation failed. Please try again.',messageId);f.elements.new_password.focus();return false;}} else {ganjaShowMessage('failure','Please enter a new password.',messageId);f.elements.new_password.focus();return false;}} var parameters=f.serialize();ganjaShowMessage('message',message,messageId);var req=new Ajax.Request('/index.php',{method:'post',parameters:parameters,evalJSON:true,onSuccess:function(transport) {if(transport.headerJSON.success==true) {ganjaSetProfileSuccess(transport.headerJSON,messageId);} else {ganjaSetProfileFailure(transport.headerJSON,messageId);}}});} function ganjaSetProfileSuccess(json,messageId) {ganjaShowMessage('message',json.message,messageId);} function ganjaSetProfileFailure(json,messageId) {ganjaShowMessage('message',json.message,messageId,true);} function ganjaStarCommenterSuccess(commentId,userId){var ucs=$$('.cem_'+userId);if(ucs.length>0){for(var i=0;i0){for(var i=0;iLogin failed. Try again or get help. ');return false;} var parameters=new Array();var options={};parameters.push('op=login');parameters.push(Form.Element.serialize(f.elements.username));parameters.push(Form.Element.serialize(f.elements.password));if(callback!=undefined)parameters.push('callback=ganja_'+callback+'_LoginSuccess');if(f.elements.remember.checked||(f.elements.remember.value==1))parameters.push('remember=on');parameters=parameters.join('&');ganjaHideMessage();if(indicator!=undefined){options['indicator']=indicator;}else{var bts=$$('.login_bttn');bts.each(function(el){el.value='logging in...';});if(!fieldPassed){ganjaLoginMessage('message','Logging in...');}} ganjaAjaxUpdater('ganja_response','/index.php',parameters,options);} var loginTimeout;function ganjaLoginDialog() {if($('login_dialog').style.display=='none') {new Effect.BlindDown($('login_dialog'),{duration:0.3,afterFinish:function(){$('username').focus();}});loginTimeout=setTimeout("ganjaLoginDialog();",5000);Event.observe('username','keyup',function(event){clearTimeout(loginTimeout);if(this.value=='') {loginTimeout=setTimeout("ganjaLoginDialog();",10000);}});}else{clearTimeout(loginTimeout);new Effect.BlindUp($('login_dialog'),{duration:0.3});}} function ganjaLoginMessage(type,msg) {if($('registerMessage')){ganjaShowMessage(type,msg,'registerMessage');} ganjaShowMessage(type,msg,'topnavbarMessage');$('topnavbarHelp').style.display='none';if($('loginatcommentMessage')) {ganjaShowMessage(type,msg,'loginatcommentMessage');}} function ganjaLoginSuccess(displayName) {ganja_topnavbar_LoginSuccess(displayName);} function ganja_topnavbar_LoginSuccess(displayName) {var bts=$$('.login_bttn');bts.each(function(el){el.value='logged in';});ganjaLoginMessage('success','Logged in.');document.location.reload()} function ganja_bookmarklet_LoginSuccess(displayName) {ganjaShowMessage('success','Logged in.','topnavbarMessage');var lN=$$('.needsLogin');if(lN) {for(i=0;iLogged in.');document.location.hash='loggedin';document.location.reload();} function ganja_register_LoginSuccess(displayName) {var f=$('ganja_uberform');tmp_username=f.elements.name.value;document.location.href='/people/'+f.elements.name.value;} function ganja_ganjaRedirect_LoginSuccess(displayName) {document.location.href='/';} function ganjaLoginFailure(msg,userexists,redirect) {var f=$('ganja_uberform');ganjaLoginMessage('failure',msg);if(f!=undefined) {f.elements.confirm_password.focus();} var bts=$$('.login_bttn');bts.each(function(el){el.value='login';});} function ganjaToggleIndicator(indicator,showhide) {if($(indicator)!=undefined) {switch(showhide) {case'show':$(indicator).show();break;case'hide':$(indicator).hide();break;case'':if($(indicator).style.display=='none') {ganjaToggleIndicator(indicator,'show');} else {ganjaToggleIndicator(indicator,'hide');} break;}}} function ganjaToggleInlineIndicator(indicator,showhide) {if($(indicator)!=undefined) {switch(showhide) {case'show':$(indicator).addClassName('loading');break;case'hide':$(indicator).removeClassName('loading');break;case'':if($(indicator).hasClassName('loading')) {ganjaToggleInlineIndicator(indicator,'show');} else {ganjaToggleInlineIndicator(indicator,'hide');} break;}}} function ganjaLogout(f,callback) {ganjaHideMessage();params='op=ajax_logout';if(callback!=undefined) {params=params+'&callback='+callback;} var logout=$$('.aLogout');if(logout.length){for(var i=0;iLogging out...');} ganjaAjaxUpdater('ganja_response','/index.php',params);return false;} function ganja_topnavbar_LogoutSuccess() {var logout=$$('.logout_button');if(logout.length){for(var i=0;iLogged out.');} document.location.reload();} function ganjaLogoutSuccess(msg) {ganja_topnavbar_LogoutSuccess();} function ganjaPostUserMessage(f) {if(f==undefined) {f=$('ganja_usermessageform');} if((f.elements.messageText!=undefined)&&(f.elements.messageText.value!='')) {ganjaHideMessage();ganjaShowMessage('message','Sending message...','messageFormMessage',true);var parameters=new Array();parameters.push('op=postmessage');parameters.push(Form.Element.serialize(f.elements.sentToId));if(f.elements.attachedObjId) {parameters.push(Form.Element.serialize(f.elements.attachedObjId));} if(f.elements.public_message.checked) {parameters.push('status=PUBLIC');} else {parameters.push('status=PRIVATE');} var tmp=f.elements.messageText.value;var tmp_cleaned=ganjaCommentPreview(tmp);f.elements.messageText.value=tmp_cleaned;parameters.push(Form.Element.serialize(f.elements.messageText));f.elements.messageText.value=tmp;parameters=parameters.join('&');var r=new Ajax.Request('/index.php',{method:'post',parameters:parameters,evalJSON:true,onSuccess:function(transport) {if(transport.headerJSON.success==true) {ganjaPostUserMessageSuccess(transport.headerJSON);} else {ganjaPostUserMessageFailure(transport.headerJSON);}}});}} function ganjaPostUserMessageSuccess(json) {ganjaShowMessage('message',json.message,'messageFormMessage',true);if($('ganja_usermessageform').hasClassName('needsReload')) {location.href=location.href;}} function ganjaPostUserMessageFailure(json) {ganjaShowMessage('message',json.message,'messageFormMessage');} function ganjaPostUserComment(f) {if(f==undefined) {f=$('ganja_usercommentform');} if((f.elements.text!=undefined)&&(f.elements.text.value!='')) {ganjaHideMessage();ganjaShowMessage('message','Adding comment...','commentformMessage',true);var parameters=new Array();parameters.push('op=postcomment');parameters.push('parentType=USER');parameters.push('rootType=USER');if(f.elements.entry_id) {parameters.push(Form.Element.serialize(f.elements.entry_id));} if(f.elements.private_message&&f.elements.private_message.checked){parameters.push('publishStatus=PRIVATE');} if(!f.elements.public_message||!f.elements.public_message.checked){parameters.push('publishStatus=PRIVATE');} var tmp=f.elements.text.value;var tmp_cleaned=ganjaCommentPreview(tmp);f.elements.text.value=tmp_cleaned;parameters.push(Form.Element.serialize(f.elements.text));f.elements.text.value=tmp;parameters=parameters.join('&');var r=new Ajax.Request('/index.php',{method:'post',parameters:parameters,onSuccess:function(resp){location.href=location.href;}});}} function ganjaPostComment(f) {if((f.elements.text==undefined)&&(f.elements.text.value==''))return false;ganjaHideMessage();ganjaShowMessage('message','Adding comment...','commentformMessage',true);if($('post_button'))$('post_button').value=' sending... ';f.elements.text.value=ganjaCommentPreview(f.elements.text.value);f.elements.text.value=f.elements.text.value.replace(/
'+name+': ';if(userData.id==undefined){Cookie.set('GanjaCommentReplyId',commentId,1,'/');if(commentId.substring(0,1)=='c') {$('guestCommentPostId').value=commentId.substring(1);} else {$('guestCommentPostId').value=commentId;} $('guestCommentBody').value=$('guestCommentBody').value+inReplyFor;$('guestCommentPostType').value='COMMENT';} reForm=new Element('li',{'class':"commentReply"});$('comment_preview').addClassName('commentReply');haschildren=false;$(commentId).descendants().each(function(e){if(e.hasClassName('commentChildren')&&haschildren==false){haschildren=e.firstDescendant();}});if(haschildren!=false){$(haschildren.id).insert({'before':$('comment_preview')})}else{$(commentId).insert({'after':$('comment_preview')})} $('comment_preview').insert({'after':reForm});if($('text'))$('text').value=$('text').value+inReplyFor;} else {reForm=new Element('li');if($('text'))$('text').value='';$('comment_list').insert({'bottom':$('comment_preview')}) $('comment_preview').insert({'after':reForm});document.location.hash='#loginform';} if($('saved_comment'))$('saved_comment').remove();savedComment=new Element('li');savedComment.id='saved_comment';savedComment.className='comment CommentBox';$('comment_preview').insert({'after':savedComment});$('replyContainer').hide();reForm.update($('replyContainer').remove());if(isTinyMce==true) {var content=tinyMCE.activeEditor.getContent().replace(/\+/g,'+');tinyMCE.activeEditor.setContent(content+' '+inReplyFor,{format:'raw'});var e=new Effect.BlindDown($('replyContainer'));} else {var e=new Effect.BlindDown($('replyContainer'));if(setFocus&&$('text'))setTimeout(function(){$('text').focus();},1000);} if($('entry_id')&&$('rootId')&&($('entry_id').value==$('rootId').value)) {$('parentType').value='COMMENT';$('entry_id').value=commentId.substring(1);} return false;} function ganjaReplyCancel() {$('replyContainer').hide();$('comment_list').insert({'bottom':$('comment_preview')}) if(typeof reForm!='undefined')$('comment_preview').insert({'after':reForm});$('text').value='';$('parentType').value=$('rootType').value;$('entry_id').value=$('rootId').value;if(typeof reForm!='undefined')reForm.update($('replyContainer').remove());if($('saved_comment'))$('saved_comment').remove();var savedComment=new Element('li');savedComment.id='saved_comment';savedComment.className='comment CommentBox';$('comment_preview').insert({'before':savedComment});$('replyContainer').show();$('comment_preview').style.display='none';$('comment_preview_name').innerHTML='';$('comment_preview_body').innerHTML='';return false;} function ganjaReplyByName(commentId,name,isTinyMce) {var inReplyFor='@'+name+': ';if(isTinyMce==true) {var content=tinyMCE.activeEditor.getContent().replace(/\+/g,'+');tinyMCE.activeEditor.setContent(content+' '+inReplyFor,{format:'raw'});} else {$('text').value=$('text').value+inReplyFor;$('text').focus();} return false;} function replyToCommenter(commentId) {if($('usercommentForm'+commentId)) {$('usercommentForm'+commentId).submit()}} function ganjaCommentAccessDenied(msg) {f=$('ganja_uberform');if(f!=undefined&&tmp_comment_text!=undefined) {Cookie.set('tmp_comment_'+f.elements.entry_id.value,tmp_comment_text,1);} ganjaShowMessage('message',msg,'commentformMessage');reloadPage(2000);} function ganjaCommentSuccess(msg,id_field,commentId) {if(commentId) {$('saved_comment').id='c'+commentId;} if($('post_button'))$('post_button').value='submit';ganjaReplyCancel();ganjaPreviewstatus=false;$('comment_list').style.display='block';ganjaMinimalCommentSuccess(msg);} function ganjaMinimalCommentSuccess(msg) {ganjaHideMessage();ganjaShowMessage('message',msg,'commentformMessage');if(typeof onLiveblogSite!='undefined'&&onLiveblogSite==true) {updateLiveblog('comments');}} function ganjaTagCommentSuccess(msg,id_field) {var f=$('ganja_uberform');var parameters=new Array();var prev=$('comment_preview');var prev_name=$('comment_preview_name');var prev_body=$('comment_preview_body');ganjaPreviewstatus=false;f.elements.text.value='';prev.style.display='none';prev_name.innerHTML='';prev_body.innerHTML='';ganjaHideMessage();ganjaShowMessage('message',msg,'commentformMessage');$('commentFAQ').style.display='block';setTimeout('location.href=location.href;',2000);} function ganjaCommentFailure(msg,f) {if(f==undefined) {f=$('ganja_uberform');} if(f!=undefined&&tmp_comment_text!=undefined&&f.text!=undefined) {f.text.value=tmp_comment_text;if(typeof tinyMCE!='undefined')tinyMCE.get('text').setContent(tmp_comment_text);} ganjaShowMessage('failure',msg,'commentformMessage');} function ganjaPostCommenterpost() {var f=$('commenterpagePost');if((f.elements.entry!=undefined)&&(f.elements.entry.value!='')) {ganjaHideMessage();ganjaShowMessage('message','Adding post...');var tmp=f.elements.entry.value;var tmp_cleaned=ganjaPostPreview();f.elements.entry.value=tmp_cleaned;f.elements.entry.value=f.elements.entry.value.replace(/
\)\]\!\/]*)((\/)(([^,'"\s\<\>\)\]\!]|[,])*))?/igm,'$1[$3]');text=text.substring(1,text.length);var re=new RegExp(/href.+>(.*?)<\/a>/g);var amatches=re.exec(text);if(amatches){for(i=1;i60){var nhref=href.substr(0,59);var index=text.indexOf(href);var stext=text.substr(0,index);var etext=text.substr(index+href.length,text.length);text=stext+nhref+"..."+etext;}}} return text;} function ganjaYoutubeParser(text) {value='';value+='
';value+='
';value+='+ Watch video';value+='
';value+='';text=' '+text;text=text.replace(/([^"=])(https?\:\/\/)?(www\.)?youtube.com\/watch\?v=([-_a-zA-Z0-9]*)([a-zA-Z0-9#&=]*)/igm,value);return text;} function ganjaCleanQuotes(text) {var chars=text.split("");var newtext='';for(i=0;i';$('comment_image').value=resp.resultUrl;$('commentImagePreviewError').innerHTML='';$('commentImagePreviewError').style.display='none';} else {var msg='';switch(resp.error) {case 400:case 401:msg='Error while uploading image, please try again later';break;case 500:msg='Error while resizing image';break;} $('commentImagePreviewError').style.display='inline';$('commentImagePreviewError').innerHTML=msg;}} function showImagePreview(enabled) {if(enabled) {if($('imagePreviewBox').style.display=='none'||$('imagePreviewBox').style.display=='') {$('imgbttn').style.display='none';$('imagePreviewBox').style.display='inline';}} else {if($('imagePreviewBox').style.display=='inline') {$('imgbttn').style.display='inline';$('imagePreviewBox').style.display='none';}} return false;} function togglePreviewDisplay() {if($('previewToggleCheck')) {if($('previewToggleCheck').checked==false) {$('comment_preview').style.display='none';} else {try{var content=tinyMCE.activeEditor.getContent().replace(/\+/g,'+');}catch(e){var content=$('text').value;} if(content.length>0) {$('comment_preview').style.display='block';}}}} function ganjaPreviewImages(prepareForSubmit) {if(!prepareForSubmit)prepareForSubmit=false;var previewUrls=$$('#comment_preview_body a([href$=jpg]), #preview_area a([href$=png]), #preview_area a([href$=gif])');previewUrls.each(function(url){if(prepareForSubmit) {url.innerHTML='';url.name='image:'+url.href;url.className='commentImagePlaceholder';url.removeAttribute('href');url.removeAttribute('rel');url.removeAttribute('target');} else {url.innerHTML='';url.target='_new';url.rel='lytebox';}});return $('comment_preview_body').innerHTML;} function submitGuestComment() {var form=$('guestForm');var email=form.elements.userEmail.value;var body=form.elements.commentBody.value;var parentId=form.elements.parentId.value;var parentType=form.elements.parentType.value;var rootId=form.elements.rootId.value;var rootType=form.elements.rootType.value;if(email.length==0)return guestCommentMessage('Please enter a valid email address.');if(!/[A-Za-z0-9\+\_\-\.]+@[A-Za-z0-9\+\_\-\.]+\.[A-Za-z0-9\+\_\-\.]+/.match(email))return guestCommentMessage('Please enter a valid email address.');if(body.length==0)return guestCommentMessage('Please enter a comment before clicking Send.');if(isNaN(rootId)||rootId==0)return guestCommentMessage('An error occured while submitting the comment, please try again later.');var options={'onComplete':function(resp){submittedGuestComment(resp);},'parameters':{'email':email,'body':body,'parentId':parentId,'parentType':parentType,'rootId':rootId,'rootType':rootType}};new Ajax.Request('/?op=guestcomment',options);} function submittedGuestComment(resp) {var message='An error occured while submitting the comment, please try again later.';if(resp==null)return guestCommentMessage(message);try {var data=eval('('+resp.responseText+')');} catch(e) {return guestCommentMessage(message);} if(data==null)return guestCommentMessage(message);if(data.success==null||data.success!=1)return guestCommentMessage(data.message);guestCommentMessage(data.message,false);$('guest').style.display='none';$('guestCommentBody')='';setTimeout(function(){$('guestTab').style.display='none';$('guest').style.display='block';$('guestCommentMessage').style.display='none';},5000);} function guestCommentMessage(message,timedHide) {if(timedHide==null)timedHide=true;var divId='guestCommentMessage';var newMessage=message.replace(/([^\.]+\.)(.*)/,'$1$2');$(divId).innerHTML=newMessage;$(divId).style.display='block';if(timedHide)setTimeout(function(){$(divId).style.display='none';},5000);return false;} function deleteUserMessage(messageId) {var parameters=new Array();parameters.push('op=changemessagestatus');parameters.push('id='+messageId);parameters.push('publishStatus=DELETED');parameters=parameters.join('&');if(window.confirm('Are you really want to delete this message?')){var req=new Ajax.Request('/index.php',{method:'post',parameters:parameters,evalJSON:true,onSuccess:function(transport) {if(transport.headerJSON.success==true) {deleteUserMessageSuccess(transport.headerJSON);} else {deleteUserMessageFailure(transport.headerJSON);}}});}} function deleteUserMessageSuccess(json) {Effect.BlindUp($('userMessage'+json.messageId),{'duration':0.3});} function deleteUserMessageFailure(json) {messageContainer=$$('div#userMessage'+json.messageId+' div.userMessageMessage').pop();messageContainer.innerHTML=json.message;messageContainer.removeClassName('hide');setTimeout(function(){messageContainer.addClassName('hide');},3000);} function deletePrivateComment(commentid){var parameters=new Array();parameters.push('op=changecommentstatus');parameters.push('id='+commentid);parameters.push('publishStatus=DELETED');parameters=parameters.join('&');if(window.confirm('Are you really want to delete this message?')){var r=new Ajax.Updater('ucId-'+commentid,'/index.php',{method:'post',parameters:parameters,evalScripts:false,asynchronous:true,onComplete:function(){$$('.ucId-'+commentid)[0].innerHTML='';}});}} function revealOriginalUserMessage(message_id) {if($('userMessage'+message_id)) {return true;} else {Effect.BlindDown($('originalMessage'+message_id),{'duration':0.3});return false;}} function showStrayComments(commentId,forceMode,instant) {if(!$('strayThread_'+commentId))return false;if(!forceMode) {if($('strayThread_'+commentId).style.display=='none') {forceMode='expand';} else {forceMode='collapse';}} if(forceMode=='expand') {if(instant==true) {$('strayThread_'+commentId).show();} else {new Effect.BlindDown($('strayThread_'+commentId),{duration:0.5,afterFinishInternal:function(effect){$('strayThread_'+commentId).style.height='auto';}});} $$('#strayCommentSwitch_'+commentId+' .threadToggle').each(function(el){el.addClassName('minus');});}else if(forceMode=='collapse'){new Effect.BlindUp($('strayThread_'+commentId),{duration:0.5});$$('#strayCommentSwitch_'+commentId+' .threadToggle').each(function(el){el.removeClassName('minus');});}} function toggleExpandAllLinks(enabled) {if(enabled==true) {$$('#comments-subscribe .collapseLink').each(function(item){item.show();});$$('#comments-subscribe .expandLink').each(function(item){item.hide();});} else {$$('#comments-subscribe .collapseLink').each(function(item){item.hide();});$$('#comments-subscribe .expandLink').each(function(item){item.show();});}} function showAllStrayComments() {$$('#comments .collapsedComment').each(function(item) {var commentId=item.id.substring(1);collapseComment(commentId,'expand');});$$('#comments ul.strayComments').each(function(item) {var threadId=item.id.substring(12);showStrayComments(threadId,'expand');});toggleExpandAllLinks(true);} function hideAllStrayComments() {$$('#comments ul.strayComments').each(function(item) {var threadId=item.id.substring(12);showStrayComments(threadId,'collapse');});toggleExpandAllLinks(false);} function collapseComment(commentId,force) {if(!force) {if($('c'+commentId).hasClassName('collapsedComment')){force='expand';}else{force='collapse';}} if(force=='expand'){$('c'+commentId).removeClassName('collapsedComment');if($('c'+commentId).hasClassName('collapsedCommentWithChildren')) {$('c'+commentId).removeClassName('collapsedCommentWithChildren');}}else{$('c'+commentId).addClassName('collapsedComment');} $('c'+commentId).update($('c'+commentId).innerHTML);if($('strayCommentSwitch_'+commentId)) {if(force=='expand') {showStrayComments(commentId,'expand');}}} function setCommentOrder(order) {commentSortOrder=order;cpage=1;cId='';Cookie.set('GanjaCommentsOrder',order,1,'/');loadComments();} function setCommentViewMode(viewmode) {commentViewMode=viewmode;if(viewmode=='classic') {classicComments=true;} else {classicComments=false;} Cookie.set('GanjaCommentsMode',viewmode,1,'/');loadComments();} function setCommentPage(page,jumpToTop) {cpage=page;cId='';loadComments();if(jumpToTop){document.location.hash='#viewcomments';}else{document.location.hash='#c';}} function loadComments() {$$('#comments .pagerProgressIndicator img').each(function(el){el.setStyle({visibility:'visible'});});var params=new Array();params.push('op='+commentLoadType);params.push('title='+commentRootTitle);if(commentLoadType=='imagecomments') {params.push('imageId='+commentRootId);}else{params.push('postId='+commentRootId);} params.push('cId='+cId);params.push('cpage='+cpage);params.push('commentsAllowed='+commentsAllowed);params.push('acceptratings='+acceptratings);if(classicComments)params.push('classic=true');if(commentThread)params.push('t='+commentThread);if(commentSortOrder)params.push('sort='+commentSortOrder);var opts=new Array();opts['onComplete']=function(){$$('#comments .pagerProgressIndicator img').each(function(el){el.setStyle({visibility:'hidden'});});};ganjaAjaxUpdater('comments','/index.php',params.join('&'),opts);} var NewCommentNotification=Class.create({initialize:function(pId,cId){this.pid=pId;this.cid=cId;this.lastUpdated=$('ncn_last_updated').value;if(this.lastUpdated<=0){this.lastUpdated=new Date().getTime();$('ncn_last_updated').value=this.lastUpdated;} this.doRefresh();},doRefresh:function(){var runUpdate=false;minute=60000;now=new Date().getTime();five_mins=new Date(now-(5*minute)).getTime();ten_mins=new Date(now-(10*minute)).getTime();if(this.lastUpdated>five_mins){runUpdate=true;}else if(this.lastUpdated0) {var message=new Array();cdata.replies.each(function(c){message.push(''+c.author.displayName+'');});new GanjaNotifier(message.join(', ')+' replied to your comment.');}else if(cdata.newcommentscount>0){$('ncn_maxid').value=cdata.newest;if(cdata.newcommentscount==1){ctxt='comment';}else{ctxt='comments';} if(cdata.newcommentscount>10){cdata.newcommentscount='10+';} new GanjaNotifier(cdata.newcommentscount+' new '+ctxt+' on this post.

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(iSubmit'+this.commentHelpLabel+'
';$(this.id+'PicPreviewToggle').checked=true;if(!this.picSelector) {$(this.id+'PicSelectorWrapper').style.display='none';} if(this.rendered!=null) {this.rendered(this);}} ganjaCM.prototype.submitForm=function() {var ret=true;if(ret!=false&&this.action!=""&&this.sending!=true) {if(this.params==null||this.params==undefined)this.params={};var obj=this;var src=this.getImg();this.params[this.imgField]=src;this.params[this.textField]=this.getText();if(this.beforeSubmit!=null) {ret=this.beforeSubmit(this);} this.sending=true;$(this.id+'Submit').value=' sending... ';new Ajax.Request(this.action,{method:'post',parameters:this.params,onSuccess:function(resp,json){obj.protoSubmitSuccess(resp);},onFailure:function(resp,json){obj.protoSubmitFailure(resp);}});}} ganjaCM.prototype.protoSubmitSuccess=function(resp) {$(this.id+'Submit').value='Submit';this.sending=false;if(this.submitSuccess!=null)this.submitSuccess(this,resp);} ganjaCM.prototype.protoSubmitFailure=function(resp) {this.sending=false;if(this.submitFailure!=null)this.submitFailure(this,resp);} ganjaCM.prototype.previewToggle=function(clicked) {if(this.previewToggleHandler!=null) {this.previewToggleHandler(this.getText(),clicked);}} ganjaCM.init=function() {if(ganjaCM.initialized)return;tinyMCE.init({height:"146px",width:"330px",strict_loading_mode:1,mode:"none",theme:"advanced",theme_advanced_buttons1:"bold,italic,separator,undo,redo,link,unlink,code",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"",extended_valid_elements:"a[name|href|title],b,i,strong,em,u,del,ins,img[src|alt|title|width|height|align]",plugins:'inlinepopups',setup:function(ed){var dispatch=function(ed) {ganjaCM.dispatch(ed);};ed.onKeyUp.add(dispatch);}});ganjaCM.initialized=true;} ganjaCM.parseOptions=function(template,opts,obj) {for(var i=0;i';} return iHTML;} ganjaCMPic=function(id,type,options,url) {if(url==null)url="";this.type=type;this.id=id;this.url=url;ganjaCM.parseOptions(ganjaCMPic.optionsTemplate,options,this);if(this.type=="img")ganjaCMPic.pictures[id]=this;} ganjaCMPic.prototype.getHtml=function() {var divStyle='display: block; margin: 0px; border:0px; padding:0px; overflow:hidden; width:'+this.frameWidth+'px; height:'+this.frameHeight+'px;';var divStyleHack='display: table; width:'+this.frameWidth+'px; height:'+this.frameHeight+'px; #position: relative; overflow: hidden;';var inDivStyle='#position: relative; #top: 50%;display: table-cell; vertical-align: middle; text-align: center;';var content={"img":'',"noimage":'No image',"wait":'
'};return'
'+content[this.type]+'
';} ganjaCMPic.prototype.showImg=function() {$(this.id).style.display='block';} ganjaCMPic.prototype.hideImg=function() {$(this.id).style.display='none';} ganjaCMPic.prototype.resizeMe=function() {var img=$(this.id+'_img');var image=new Image();image.src=img.src;var width=image.width;var height=image.height;this.area=width*height;if(widththis.frameWidth) {newWidth=this.frameWidth;newHeight=Math.round(this.frameWidth/imgRat);} else if(height>this.frameHeight) {newWidth=Math.round(this.frameHeight*imgRat);newHeight=this.frameHeight;} img.style.width=newWidth+'px';img.style.height=newHeight+'px';if(this.adder!=null) {this.adder(this);} if(this.isBiggestPic!=null) {this.isBiggestPic(this);} this.hideImg();if(this.allDone!=null) {this.allDone();}} ganjaCMPic.prototype.removeMe=function() {if(this.remover!=null) {this.remover(this);}} ganjaCMPic.pictures=[];ganjaCMPic.optionsTemplate=[{"name":"frameWidth","paramName":"frameWidth","default":80},{"name":"frameHeight","paramName":"frameHeight","default":80},{"name":"minPicWidth","paramName":"minPicWidth","default":100},{"name":"minPicHeight","paramName":"minPicHeight","default":100},{"name":"adder","paramName":"onImageAdd","default":null},{"name":"remover","paramName":"onImageRemove","default":null},{"name":"allDone","paramName":"onAllImageLoaded","default":null},{"name":"isBiggestPic","paramName":"biggestPicHandler","default":null},{"name":"progressIndicator","paramName":"progressIndicator","default":"wait30trans.gif"}];ganjaCMPicSelector=function(id,options) {this.picWidth=0;this.picHeight=0;this.id=id;ganjaCM.parseOptions(ganjaCMPicSelector.optionsTemplate,options,this);this.origOptions=options;var obj=this;this.origOptions.onImageRemove=function(pic){obj.removeImage(pic);};this.origOptions.onImageAdd=function(pic){obj.addImage(pic);};this.origOptions.onAllImageLoaded=function(){obj.resetImage();};this.origOptions.biggestPicHandler=function(pic){obj.checkBiggestPic(pic);};this.resetPicData();ganjaCMPicSelector.selectors[this.id]=this;} ganjaCMPicSelector.prototype.render=function() {$(this.id+'SelectorWrapper').innerHTML=ganjaCMDomBuilder.build(ganjaCMPicSelector.domStructure,this.id);var obj=this;$(this.id+'Prev').observe('click',function(){obj.skipImage(false);});$(this.id+'Next').observe('click',function(){obj.skipImage(true);});this.origOptions.frameWidth=$(this.id+'Selector').offsetWidth;this.origOptions.frameHeight=$(this.id+'Selector').offsetHeight;this.noImage=new ganjaCMPic(this.id+"Slide_noimage","noimage",this.origOptions);this.wait=new ganjaCMPic(this.id+"Slide_wait","wait",this.origOptions);$(this.id+'Selector').style.overflow='hidden';if(!this.picPager) {$(this.id+'SelectorPanel').style.display='none';} this.renderPicSlide();$(this.id+'CommentOptions').innerHTML=this.getCommentOptionsHtml();$(this.id+'RemoveImage').observe('click',function(e){obj.removeImageClicked(e)});$(this.id+'PreviewToggle').observe('click',function(e){obj.previewToggleClicked(e)});} ganjaCMPicSelector.prototype.removeImageClicked=function(e) {if(e!=null&&e.target!=null&&e.target.checked==true) {this.resetPicData();this.renderPicSlide();}} ganjaCMPicSelector.prototype.previewToggleClicked=function(e) {if(this.contentChanged!=null) {this.contentChanged(this.getEditor().getText());}} ganjaCMPicSelector.prototype.getCommentOptionsHtml=function() {var ret='';ret+='';ret+='
';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;ithis.biggestPic)) {this.biggestPic=pic.area;var index=this.getPicPos(pic,this.workingImages);if(index!=0&&index!=-1) {var tmp=this.workingImages[index];this.workingImages[index]=this.workingImages[0];this.workingImages[0]=tmp;}}} ganjaCMPicSelector.prototype.resetPicData=function() {this.images=[];ganjaCMPic.pictures=[];this.workingImages=[];this.notWorkingImages=[];this.biggestPic=0;} ganjaCMPicSelector.prototype.fetchImages=function(url) {if(url==null||url=='')return false;if(this.fetchUrl=="")return false;this.resetPicData();var obj=this;var params=this.fetchParams;params[this.fetchUrlParam]=url;var options={evalJSON:true,method:'post',parameters:params,onSuccess:function(resp,json){obj.fetchImageSuccess(resp.responseJSON,resp.responseText);},onFailure:function(resp,json){obj.fetchImageFailure(resp.responseJSON);}} this.hideAllImages();this.showImage(true,this.wait);new Ajax.Request(this.fetchUrl,options);} ganjaCMPicSelector.prototype.renderPicSlide=function(stillWaiting) {if(this.images==null||this.images==undefined)this.images=[];var inHtml="";inHtml+=this.noImage.getHtml();inHtml+=this.wait.getHtml();for(var i=0;i'+inHtml+'
';$(this.id+'Selector').innerHTML=inHtml;if(stillWaiting!=null&&stillWaiting==true) {this.noImage.hideImg();this.wait.showImg();}} ganjaCMPicSelector.prototype.fetchImageSuccess=function(json,text) {this.images=[];if(json!=null) {for(var i=0;i=this.images.length) {this.imagePos=0;this.hideAllImages();this.showImage(true,this.workingImages[this.imagePos]);if(this.contentChanged!=null) {this.contentChanged(this.getEditor().getText());}}} ganjaCMPicSelector.prototype.skipImage=function(forward) {if(this.workingImages.length==0)return false;this.hideAllImages();if(this.imagePos==0&&!forward)this.imagePos=this.workingImages.length-1;else if(forward&&this.imagePos==this.workingImages.length-1)this.imagePos=0;else this.imagePos+=(forward?1:-1);this.showImage(true,this.workingImages[this.imagePos]);if(this.contentChanged!=null) {this.contentChanged(this.getEditor().getText());}} ganjaCMPicSelector.selectors=[];ganjaCMPicSelector.optionsTemplate=[{"name":"picPager","paramName":"picPager","default":true},{"name":"fetchUrl","paramName":"fetchUrl","default":""},{"name":"fetchParams","paramName":"fetchParams","default":{}},{"name":"fetchUrlParam","paramName":"fetchUrlParam","default":"url"},{"name":"previewToggle","paramName":"previewToggle","default":null},{"name":"contentChanged","paramName":"onContentChange","default":null},{"name":"removeImageLabel","paramName":"removeImageLabel","default":"remove image"},{"name":"previewCommentLabel","paramName":"previewCommentLabel","default":"preview comment"}];ganjaCMPicSelector.domStructure=[{"id":"Selector","classDef":"cmPicSelector"},{"id":"SelectorPanel","classDef":"cmPicSelectorPanel","children":[{"id":"Prev","classDef":"cmPicPrev","content":" ","type":"BUTTON"},{"id":"Next","classDef":"cmPicNext","content":" ","type":"BUTTON"}]},{"id":"clearPic","classDef":"cmClear"},{"id":"CommentOptions","classDef":"cmCommentOptions"}];ganjaCMUrl=function(id,options,mode) {this.id=id;this.mode=mode;ganjaCM.parseOptions(ganjaCMUrl.optionsTemplate,options,this);ganjaCMUrl.panels[id]=this;} ganjaCMUrl.prototype.render=function() {$(this.id+'Wrapper').innerHTML=ganjaCMDomBuilder.build(ganjaCMUrl.domStructure,this.id);if(this.mode=="hidden")$(this.id+"Wrapper").style.display='none';else {var obj=this;$(this.id+'Prev').observe('click',function(){obj.skipUrl(false);});$(this.id+'Next').observe('click',function(){obj.skipUrl(true);});if(this.urlPager==null||!this.urlPager) {$(this.id+'Prev').style.display='none';$(this.id+'Next').style.display='none';}}} ganjaCMUrl.prototype.setImageHandler=function(picSelector) {if(picSelector==null)return false;this.urlChanged=function(url){picSelector.fetchImages(url)};} ganjaCMUrl.prototype.getUrls=function(content) {if(this.contentChanged!=null) {this.contentChanged(content);} if(this.previousContent!=null&&content==this.previousContent) {return;} var hasUrl;if(this.richEditor)hasUrl=/]*href="([^"]+)"[^>]*>/i;else hasUrl=/(http\:\/\/[^\s]+)/i;this.urls=[];var origContent=content;while(hasUrl.test(content)) {var singleUrl=hasUrl.exec(content);this.urls.push(singleUrl[1]);content=content.replace(singleUrl[0],'');} this.previousContent=origContent;if(this.previousUrls==null)this.previousUrls=[];var urlDiffer=false;for(var i=0;i'+this.urls[this.urlPos]+'';if(this.autoFetch&&(this.lastFetched==null||this.lastFetched!=this.urls[this.urlPos])&&this.urlChanged!=null) {this.urlChanged(this.urls[this.urlPos]);this.lastFetched=this.urls[this.urlPos];}} ganjaCMUrl.prototype.clickDispatch=function(url) {if(this.urlChanged!=null)this.urlChanged(url);} ganjaCMUrl.prototype.skipUrl=function(forward) {if(forward&&this.urlPos+10)this.urlPos--;return this.renderUrlPanel();} ganjaCMUrl.panels=[];ganjaCMUrl.optionsTemplate=[{"name":"autoFetch","paramName":"autoFetch","default":false},{"name":"richEditor","paramName":"richEditor","default":true},{"name":"urlPager","paramName":"urlPager","default":true},{"name":"contentChanged","paramName":"onContentChange","default":null}];ganjaCMUrl.domStructure=[{"id":"Prev","classDef":"cmUrlPrev","content":"<"},{"id":"Next","classDef":"cmUrlNext","content":">"},{"id":"Selector","classDef":"cmUrlPanel"},{"id":"clearUrl","classDef":"cmClear"}];Object.extend(Event,{_domReady:function(){if(arguments.callee.done)return;arguments.callee.done=true;if(Event._timer)clearInterval(Event._timer);Event._readyCallbacks.each(function(f){f()});Event._readyCallbacks=null;},onReady:function(f){if(!this._readyCallbacks){var domReady=this._domReady;if(domReady.done)return f();if(document.addEventListener) document.addEventListener("DOMContentLoaded",domReady,false);if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState))domReady();},10);} Event.observe(window,'load',domReady);Event._readyCallbacks=[];} Event._readyCallbacks.push(f);}});function showTopNavbar(options) {var params=new Array();params.push('view='+options.view);if(typeof options.postId!='undefined') {params.push('postId='+options.postId);} params.push('op=topnavbarcontent');ganjaAjaxUpdater('navigation','/index.php',params.join('&'),'Loading...');} var ActivityAgent=Class.create();ActivityAgent.prototype={posts:$A(),acts:{},options:{},initialize:function(logs){this.acts=logs;this.posts=this.getPostDivs();},getPostDivs:function(){var posts_local=$A();$$('div.post[id], div.post-quicklinks[id]').each(function(el){posts_local.push({timestamp:el.id.split('_')[2],id:el.id,activity:0,acts:[],before:true});});if(posts_local.length>0)posts_local.push({timestamp:(posts_local[posts_local.length-1].timestamp-7200),id:posts_local[posts_local.length-1].id,activity:0,acts:[],before:false});return posts_local;},sortToSlots:function(){var j=0;for(var i=0;ithis.posts[i].timestamp){this.posts[i].acts.push(this.acts[j]);}else break;j++;}}},summarizeActions:function(dudes,targets,context){var name=context.val.commenterUserName;var post_pl=context.val.postPermalink==undefined?'':context.val.postPermalink;var target_user=context.val.userUserName==undefined?'':context.val.userUserName;if(dudes[name]==undefined)dudes[name]={follow:{},leave:{},comment:{},clip:{},messages:{},newposts:{},displayName:context.val.commenterDisplayName};switch(context.type){case'COMMENT':if(targets[post_pl]==undefined)targets[post_pl]={commented:{},clipped:{},type:'post',title:context.val.postTitle,titleStripped:context.val.postTitleStripped};if(dudes[name]['comment'][post_pl]==undefined)dudes[name]['comment'][post_pl]=0;if(targets[post_pl]['commented'][name]==undefined)targets[post_pl]['commented'][name]=0;dudes[name]['comment'][post_pl]++;targets[post_pl]['commented'][name]++;break;case'POST':if(context.val.action=='TAGGED'){if(targets[post_pl]==undefined)targets[post_pl]={commented:{},clipped:{},type:'post',title:context.val.postTitle,titleStripped:context.val.postTitleStripped};if(dudes[name].clip[post_pl]==undefined)dudes[name].clip[post_pl]=0;if(targets[post_pl].clipped[name]==undefined)targets[post_pl].clipped[name]=0;dudes[name].clip[post_pl]++;targets[post_pl].clipped[name]++;} break;case'USER':if(targets[target_user]==undefined)targets[target_user]={followed:{},leaved:{},type:'user',username:context.val.userDisplayName};if(context.val.action=='TAGGED'){if(targets[target_user].followed[name]==undefined)targets[target_user].followed[name]=0;if(dudes[name].follow[target_user]==undefined)dudes[name].follow[target_user]=0;targets[target_user].followed[name]++;dudes[name].follow[target_user]++;}else{if(targets[target_user].leaved[name]==undefined)targets[target_user].leaved[name]=0;if(dudes[name].leave[target_user]==undefined)dudes[name].leave[target_user]=0;targets[target_user].leaved[name]++;dudes[name].leave[target_user]++;} break;case'MESSAGE':dudes[name].messages[context.val.postId]=context;break;case'NEWPOST':dudes[name].newposts[context.val.postId]=context;break;}},dropActivities:function(){var dudes={};var targets={};for(var i=0;i0){insertHTML='

';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'+dudes[dude_keys[i]].displayName+'';var insertHTML='';if($H(dudes[dude_keys[i]].clip).size()>0){insertHTML='

';insertHTML+=dude_link+' clipped ';var keys=$H(dudes[dude_keys[i]].clip).keys();for(var j=0;j

';} if($H(dudes[dude_keys[i]].follow).size()>0){insertHTML='

';insertHTML+=dude_link+' is following ';var keys=$H(dudes[dude_keys[i]].follow).keys();for(var j=0;j

';} if($H(dudes[dude_keys[i]].leave).size()>0){insertHTML='

';insertHTML+=dude_link+' removed ';var keys=$H(dudes[dude_keys[i]].leave).keys();for(var j=0;j

';} if($H(dudes[dude_keys[i]].messages).size()>0){var messages_src='';var keys=$H(dudes[dude_keys[i]].messages).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+='

';insertHTML+=messages_src;}} if($H(dudes[dude_keys[i]].newposts).size()>0){var newposts_src='';var keys=$H(dudes[dude_keys[i]].newposts).keys();for(var j=0;j

';newposts_src+=dude_link+' wrote: ';newposts_src+='';newposts_src+=dudes[dude_keys[i]].newposts[keys[j]].val.postTitle+'';newposts_src+='

';insertHTML+=newposts_src;}} if(insertHTML.length>0)html_array.push(insertHTML);} var src='

what your friends are up to

';var visible_count=3;for(var i=0;i<(html_array.length>10?10:html_array.length);i++){if(i==visible_count)src+='

more »

';} if(html_array.length<3)src+="

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='

';if(typeof permalink!='undefined') {header+=''+galleryTitle+'';} else {header+=galleryTitle;} header+='

';document.write(header);} var containerId=Math.random();document.write('
');var params=new Array();var pagetype='postlist';if(typeof lyteboxSize!='undefined'&&lyteboxSize=='original')params.push('size=original');if(numImages<1||numImages>150||numImages==undefined||numImages==null) {numImages=6;} if(typeof pageType!='undefined'&&pageType=='post') {pagetype='post';numImages=50;} params.push('maxReturned=50');params.push('numImages='+numImages);params.push('tagName='+niceurlencode(tag));params.push('format=ajax');params.push('galleryLayoutType='+layoutType);params.push('pagetype='+pagetype);if(typeof permalink!='undefined') {params.push('permalink='+niceurlencode(permalink));} params=params.join('&');var req=new Ajax.Updater('gallery'+containerId,'/photogallery/',{method:'post',parameters:params,evalScripts:false,asynchronous:true});document.write('
');} function niceurlencode(str) {from=['_',' ','\'','-','+','.',':','/'];to=['=','-','.','_',' ','\'','|','\\'];retval='';len=str.length;for(i=0;ihelo');ganjaAjaxUpdater('lb'+lbId,url);} function GM_preloadImages() {var d=document;if(d.images){if(!d.GM_p)d.GM_p=new Array();var i,j=d.GM_p.length,a=GM_preloadImages.arguments;for(i=0;i0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);} if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&iclose [x]";this.shade.innerHTML+="";this.shade.innerHTML+="";if(dcState=="on"){this.shade.innerHTML+="\n";} if(postRefId!='-1')this.shade.innerHTML+="";else this.shade.innerHTML+="";if(postRefId!='-1')this.shade.innerHTML+="";else this.shade.innerHTML+="";if(this.shade.style.display=='none')Effect.BlindDown(this.shade,{duration:0.1});},changeReport:function(what) {if(typeof ganjaReports!='undefined'){var data=ganjaReports[what];var reportContent="

"+what+"

";reportContent+="";for(i=0;i";else reportContent+="";var cellData=new String(data[i]);longi=0;for(j=0;j"+cellData[0]+"
"+cellData[2]+"
";} else {cellData=cellData.replace(/, /g,"
");cellData=cellData.replace(/,/g,"
";} reportContent+="";} reportContent+="
");reportContent+=""+cellData+"
";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='

'+cleanDate(post.issued)+'

'+'

'+post.author.displayName+': '+post.entry+'

';postDiv.appendChild(postTextDiv);return postDiv;} function createCommentDiv(post) {var postDiv=document.createElement('div');postDiv.className='comment';postDiv.id=post.commentId;var postHead=document.createElement('div');postHead.className='comment-head';postHead.innerHTML='';postHead.innerHTML+='Image of '+post.author+'';postHead.innerHTML+='';postHead.innerHTML+=''+post.issuedFormatted+'
';postHead.innerHTML+=''+post.author+' said:';postDiv.appendChild(postHead);var postTextDiv=document.createElement('div');postTextDiv.className='comment-body';postTextDiv.innerHTML=post.commentText;postDiv.appendChild(postTextDiv);return postDiv;} function cleanDate(tstamp) {date=new Date(tstamp*1000);hours=date.getHours();if(hours>12) {hours=hours-12;} mins=date.getMinutes();if(mins<10) {mins='0'+mins;} return hours+':'+mins;} var WordEditor=Class.create();var EditorTools=Class.create();WordEditor.prototype={instance:null,editables:null,edited:null,initialize:function() {instance=this;this.editables=this.getEditableFields();this.resizables=this.getResizableFields();this.highlited=this.getHighlitedFields();this.setOnClick();this.edited=new Array();this.setDefaultValues();},getEditableFields:function() {return $$('.editable');},getResizableFields:function() {return $$('.resizable');},getHighlitedFields:function() {return $$('.highlited');},setOnClick:function() {if(this.editables) {for(var i=0;i/g,'\n');prevValue=prevValue.replace(/\/g,'\n');if(this.hasClassName('istextarea')) {this.innerHTML='';if(this.hasClassName('resizable')) {this.firstChild.onkeyup=instance.resizeTextarea.bindAsEventListener(this,this.firstChild);this.firstChild.onfocus=instance.resizeTextarea.bindAsEventListener(this,this.firstChild);} if(this.hasClassName('wysiwyg')) {}} else {prevValue=prevValue.replace(/\n/g,' ');prevValue=prevValue.replace(/\r/g,' ');var classes=$w(this.className);for(var y=0;y';this.firstChild.value=prevValue;} this.firstChild.focus();if(this.hasClassName('istextarea')) {if(instance.edited[this.id]) {if(document.selection) {if(this.firstChild.createTextRange) {var range=this.firstChild.createTextRange();range.moveStart('character',this.firstChild.value.length);range.select();}}} else {if(document.getSelection) {this.firstChild.selectionStart=0;this.firstChild.selectionEnd=0;} else {} instance.edited[this.id]=true;}} if(this.hasClassName('asap')) {this.firstChild.onblur=instance.submitForm.bindAsEventListener(this,this);} else {this.firstChild.onblur=instance.replaceWord.bindAsEventListener(this,this);}},replaceWord:function(event,editorNode) {if(editorNode&&editorNode.firstChild&&(editorNode.firstChild.value||editorNode.firstChild.value=='')) {var word=editorNode.firstChild.value;word=word.replace(/\n/g,'
');editorNode.innerHTML=word;instance.bindEditor(editorNode);instance.setDefaultValues();} return true;},editorOnBlurSetter:function(state) {if($('edit_entry')) {switch(state) {case true:$('edit_entry').onblur=instance.replaceWord.bindAsEventListener($('entry'),$('entry'));break;case false:$('edit_entry').onblur=null;break;}}},resizeTextarea:function(event,textarea) {if(textarea.id) {var textareaId=textarea.id;} else {var textareaId='ta_'+Math.floor(Math.random()*100);textarea.id=textareaId;} var ta=textarea;if(!document.getElementById(textareaId+'HelperDiv')) {var taDiv=document.createElement('div');taDiv.id=textareaId+'HelperDiv';taDiv.className='textareaHelper';document.body.appendChild(taDiv);}else{var taDiv=document.getElementById(textareaId+'HelperDiv');} taDiv.style.width=(textarea.offsetWidth-12)+'px';taDiv.innerHTML=textarea.value.replace(/\/g,'>').replace(/'<br \/>'/g,'
').replace(/\n/g,'
');var newHeight=taDiv.offsetHeight+50;if(textarea.id=='edit_entry'){if(newHeight>126)textarea.style.height=newHeight+'px';}else{textarea.style.height=newHeight+'px';}},setDefaultValues:function() {if(this.editables) {for(var i=0;i','','b'));edButtons.push(new edButton('ed_italic','I','','','i'));edButtons.push(new edButton('ed_link','Link','','','a'));edButtons.push(new edButton('ed_ext_link','Ext. Link','','','e'));edButtons.push(new edButton('ed_img','IMG','','','m',-1));edButtons.push(new edButton('ed_ul','UL','
    \n','
\n\n','u'));edButtons.push(new edButton('ed_ol','OL','
    \n','
\n\n','o'));edButtons.push(new edButton('ed_li','LI','\t
  • ','
  • \n','l'));edButtons.push(new edButton('ed_block','B-QUOTE','
    ','
    ','q'));var extendedStart=edButtons.length;edButtons.push(new edButton('ed_h1','H1','

    ','

    \n\n','1'));edButtons.push(new edButton('ed_h2','H2','

    ','

    \n\n','2'));edButtons.push(new edButton('ed_h3','H3','

    ','

    \n\n','3'));edButtons.push(new edButton('ed_h4','H4','

    ','

    \n\n','4'));edButtons.push(new edButton('ed_p','P','

    ','

    \n\n','p'));edButtons.push(new edButton('ed_code','CODE','','','c'));edButtons.push(new edButton('ed_pre','PRE','
    ','
    '));edButtons.push(new edButton('ed_dl','DL','
    \n','
    \n\n'));edButtons.push(new edButton('ed_dt','DT','\t
    ','
    \n'));edButtons.push(new edButton('ed_dd','DD','\t
    ','
    \n'));edButtons.push(new edButton('ed_table','TABLE','\n','\n
    \n'));edButtons.push(new edButton('ed_tr','TR','\t\n','\n\t\n'));edButtons.push(new edButton('ed_td','TD','\t\t','\n'));edButtons.push(new edButton('ed_under','U','',''));edButtons.push(new edButton('ed_strike','S','',''));edButtons.push(new edButton('ed_nobr','NOBR','',''));edButtons.push(new edButton('ed_footnote','Footnote','','','f'));function edLink(display,URL,newWin){this.display=display;this.URL=URL;if(!newWin){newWin=0;} this.newWin=newWin;} edLinks[edLinks.length]=new edLink('alexking.org','http://www.alexking.org/');function edShowButton(button,i){if(button.access){var accesskey=' accesskey = "'+button.access+'"'} else{var accesskey='';} switch(button.id){case'ed_img':document.write('');break;case'ed_link':document.write('');break;case'ed_ext_link':document.write('');break;case'ed_footnote':document.write('');break;default:document.write('');break;}} function edShowLinks(){var tempStr='';document.write(tempStr);} function edAddTag(button){if(edButtons[button].tagEnd!=''){edOpenTags[edOpenTags.length]=button;document.getElementById(edButtons[button].id).value='/'+document.getElementById(edButtons[button].id).value;}} function edRemoveTag(button){for(i=0;i0){return true;} else{return false;}} function edCloseAllTags(){var count=edOpenTags.length;for(o=0;o-1){var newWin='';if(edLinks[i].newWin==1){newWin=' target="_blank"';} var tempStr='' +edLinks[i].display +'';thisSelect.selectedIndex=0;edInsertContent(edCanvas,tempStr);} else{thisSelect.selectedIndex=0;}} function edSpell(myField){var word='';if(document.selection){myField.focus();var sel=document.selection.createRange();if(sel.text.length>0){word=sel.text;}} else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;if(startPos!=endPos){word=myField.value.substring(startPos,endPos);}} if(word==''){word=prompt('Enter a word to look up:','');} if(word!=''){window.open('http://www.answers.com/'+escape(word));}} function edToolbar(){document.write('
    ');for(i=0;i' +'' +'' +'
    ' +'' +'');} else{document.write('' +'' +'' +'
    ' +'
    ');} 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=''+prompt('Enter a description of the image','')
+'';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,'
    1. '+count+'';edInsertContent(edCanvas,count);if(fnStart!=-1){fnStr1=edCanvas.value.substring(0,fnStart+count.length) fnStr2=edCanvas.value.substring(fnStart+count.length,edCanvas.value.length)} else{var fnStr1=edCanvas.value;var fnStr2="\n\n"+'
        '+"\n" +'
      '+"\n";} var footnote='
    2. '+note+' [back]
    3. '+"\n" +'
    ';edCanvas.value=fnStr1+fnStr2.replace('',footnote);} function countInstances(string,substr){var count=string.split(substr);return count.length-1;} function edSetCookie(name,value,expires,path,domain){document.cookie=name+"="+escape(value)+ ((expires)?"; expires="+expires.toGMTString():"")+ ((path)?"; path="+path:"")+ ((domain)?"; domain="+domain:"");} function edShowExtraCookie(){var cookies=document.cookie.split(';');for(var i=0;i-1){var bits=token.split('#');var tagName=bits[0];var id=bits[1];var element=document.getElementById(id);if(tagName&&element.nodeName.toLowerCase()!=tagName){return new Array();} currentContext=new Array(element);continue;} if(token.indexOf('.')>-1){var bits=token.split('.');var tagName=bits[0];var className=bits[1];if(!tagName){tagName='*';} var found=new Array;var foundCount=0;for(var h=0;h-1);};break;default:checkFunction=function(e){return e.getAttribute(attrName);};} currentContext=new Array;var currentContextIndex=0;for(var k=0;k'+act_item.innerHTML+''});}else{binded.ticker_list.innerHTML='
  • '+act_item.innerHTML+'
  • ';} first_item=$(binded.ticker_list.childElements()[0]);first_item.morph({'margin-top':'0px'},{fps:17,duration:0.5});if(tcks.length+1>binded.ticker_length){var last_item=$(tcks[tcks.length-1]);last_item.morph({height:'0px'},{fps:17,duration:0.5,afterFinish:function(ef_obj){ef_obj.element.remove();}});}}},this.tick_interval);},stop:function(){if(this.binded_periodical)this.binded_periodical.stop();if(this.xhr)this.xhr.stop();}};var css_browser_selector=function(){var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t)!=-1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js';h.className+=h.className?' '+c:c;}();