
function newVideoPlayer(videoURL,movieWidth,movieHeight,waterMarkURL){var vidId='flv_'+Math.round(Math.random()*10000);if(!parseInt(movieWidth))
movieWidth=500;if(!parseInt(movieHeight))
movieHeight=375;if(movieWidth>500){var oldMovieWidth=movieWidth;movieWidth=500;movieHeight=Math.round(movieHeight/oldMovieWidth*movieWidth)+20;}else{movieHeight+=20;}
var flashvars={bgcolor:"#000000",videoURL:videoURL,stageWidth:movieWidth,stageHeight:movieHeight,waterMarkImageURL:waterMarkURL};var params={quality:'best',scale:'noscale',salign:'tl',allowScriptAccess:'always'};var attributes={'class':"flv gawkerVideo"};if(window.permalink)
flashvars.permalink=permalink;else
flashvars.permalink="undefined";if(window.autoplay)
{flashvars.autoplay=autoplay;window.autoplay=false;}
else
flashvars.autoplay="undefined";document.writeln('<object class="flv gawkerVideo" style="height: '+movieHeight+'px; width: '+movieWidth+'px;" id="'+vidId+'"></object>');swfobject.embedSWF("http://cache-foo.gawker.com/gawker/assets/util/videoModule.007e.swf",vidId,movieWidth,movieHeight,"9.0.0","expressInstall.swf",flashvars,params,attributes);}
var ganjaCM=function(id,options)
{if(options==null)options={};this.id=id;this.container=$(id);this.container.ganjaCM=this;ganjaCM.parseOptions(ganjaCM.optionsTemplate,options,this,null);this.origOptions=options;var obj=this;this.origOptions.previewToggle=function(click){obj.previewToggle(click)};if(!ganjaCM.initialized&&this.richEditor==true)ganjaCM.init();if(this.container==undefined)return false;ganjaCM.editors[id]=this;this.sending=false;if(!this.picSelector)this.checkContentForUrls=false;this.images=new ganjaCMPicSelector(this.id+"Pic",this.origOptions);this.url=new ganjaCMUrl(this.id+"Url",this.origOptions,(this.urlSelector?"visible":"hidden"));this.mayHaveUrl=this.url.getUrls;this.url.setImageHandler(this.images);}
ganjaCM.prototype.reset=function()
{this.setText('');if(this.images!=null)
{this.images.resetPicData();this.images.renderPicSlide();}
if(this.url!=null)this.url.reset();}
ganjaCM.prototype.getText=function()
{if(this.richEditor)return tinyMCE.get(this.id+'Editor').getContent();else return $(this.id+'Editor').value;}
ganjaCM.prototype.setText=function(text)
{if(this.richEditor)
{if(tinyMCE.get(this.id+'Editor')!=undefined)tinyMCE.get(this.id+'Editor').setContent(text);else $(this.id+'Editor').value=text;}
else $(this.id+'Editor').value=text;}
ganjaCM.prototype.getImg=function()
{if(this.images.workingImages!=null&&this.images.workingImages[this.images.imagePos]!=null)return this.images.workingImages[this.images.imagePos].url;return"";}
ganjaCM.prototype.render=function()
{if(this.beforeRender!=null)
{var ret=this.beforeRender(this,ganjaCM.domStructure);if(ret==null)ret=ganjaCM.domStructure;}
$(this.id).innerHTML=ganjaCMDomBuilder.build(ganjaCM.domStructure,this.id);if(this.images!=null)this.images.render();if(this.url!=null)this.url.render();if(this.richEditor)tinyMCE.execCommand("mceAddControl",true,this.id+'Editor');else if(this.url!=null)
{obj=this;$(this.id+'Editor').observe('keyup',function(){if(obj.checkContentForUrls==true){obj.url.getUrls(obj.getText())}});}
$(this.id+"SubmitWrapper").innerHTML='<button style="display: block; float: right;" id="'+this.id+'Submit" onclick="ganjaCM.editors[\''+this.id+'\'].submitForm()">Submit</button><span style="width: 260px;">'+this.commentHelpLabel+'</span><div class="cmClear"></div>';$(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<template.length;i++)
{var optT=template[i];if(optT['default']!=null)obj[optT.name]=optT['default'];if(opts[optT.paramName]!=null)obj[optT.name]=opts[optT.paramName];}}
ganjaCM.dispatch=function(editor)
{var content=editor.getContent();var id=$(editor.id).id;id=id.substr(0,id.length-6);var obj=ganjaCM.editors[id];if(obj.url!=null&&obj.checkContentForUrls==true)obj.url.getUrls(content);}
ganjaCM.optionsTemplate=[{"name":"richEditor","paramName":"richEditor","default":true},{"name":"checkContentForUrls","paramName":"checkContentForUrls","default":true},{"name":"picSelector","paramName":"picSelector","default":true},{"name":"urlSelector","paramName":"urlSelector","default":true},{"name":"action","paramName":"action","default":""},{"name":"params","paramName":"formParams","default":{}},{"name":"imgField","paramName":"imgField","default":"img_url"},{"name":"textField","paramName":"textField","default":"text"},{"name":"rendered","paramName":"onRender","default":null},{"name":"beforeRender","paramName":"onBeforeRender","default":null},{"name":"beforeSubmit","paramName":"onBeforeSubmit","default":null},{"name":"submitSuccess","paramName":"onSubmitSuccess","default":null},{"name":"submitFailure","paramName":"onSubmitFailure","default":null},{"name":"previewToggleHandler","paramName":"onPreviewToggle","default":null},{"name":"commentHelpLabel","paramName":"commentHelpLabel","default":'Add a URL to your comment to include an image. Check "remove image" to remove the image from your comment.'}];ganjaCM.domStructure=[{"id":"PicSelectorWrapper","classDef":"cmPicSelectorWrapper"},{"id":"EditorWrapper","classDef":"cmEditorWrapper","children":[{"id":"Editor","classDef":"cmEditor","type":"TEXTAREA"},{"id":"clearEditor","classDef":"cmClear"},{"id":"SubmitWrapper","classDef":"cmSubmitWrapper"}]},{"id":"ClearMain","classDef":"cmClear"},{"id":"UrlWrapper","classDef":"cmUrlWrapper"}];ganjaCM.editors={};ganjaCM.initialized=false;var ganjaCMDomBuilder=function(){}
ganjaCMDomBuilder.build=function(structure,prefix)
{if(prefix==null)prefix='';var iHTML="";for(var i=0;i<structure.length;i++)
{var id=structure[i].id;var item=structure[i];var type='DIV';if(item['type']!=null)type=item['type'];iHTML+='<'+type+' id="'+prefix+id+'"';if(item.classDef!=null)iHTML+=' class="'+item.classDef+'"';iHTML+='>';if(item.content!=null)iHTML+=item.content;if(item.children!=null)iHTML+=ganjaCMDomBuilder.build(item.children,prefix);iHTML+='<'+'/'+type+'>';}
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":'<span style="line-height: '+this.frameHeight+'px;"><img id="'+this.id+'_img" src="'+this.url+'" onload="ganjaCMPic.pictures[\''+this.id+'\'].resizeMe()" onerror="ganjaCMPic.pictures[\''+this.id+'\'].removeMe()" /></span>',"noimage":'<span class="cmNoImage">No image</span>',"wait":'<div style="width: '+this.frameWidth+'px;height: '+this.frameHeight+'px;background-image:url(\''+this.progressIndicator+'\'); background-position: center; background-repeat: no-repeat;"></div>'};return'<div id="'+this.id+'" style="width: '+this.frameWidth+'px;height: '+this.frameHeight+'px;line-height: '+this.frameHeight+'px;vertical-align: middle;text-align: center;">'+content[this.type]+'</div>';}
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(width<this.minPicWidth&&height<this.minPicHeight)
{this.removeMe();return;}
var frameRat=this.frameWidth/this.frameHeight;var imgRat=width/height;var newWidth=width;var newHeight=height;if(frameRat<imgRat&&width>this.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+='<label for="'+this.id+'RemoveImage"><input type="checkbox" id="'+this.id+'RemoveImage" /> '+this.removeImageLabel+'</label>';ret+='<br />';ret+='<label for="'+this.id+'PreviewToggle"><input type="checkbox" id="'+this.id+'PreviewToggle" /> '+this.previewCommentLabel+'</label>';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<arr.length;i++)
{if(arr[i].url==pic.url)
{return i;break;}}
return-1;}
ganjaCMPicSelector.prototype.checkBiggestPic=function(pic)
{if(pic.area!=null&&(this.biggestPic==null||pic.area>this.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<this.images.length;i++)inHtml+=this.images[i].getHtml();inHtml='<div id="'+this.id+'PicSlider" style="margin: 0px; border:0px; padding:0px; overflow:hidden; width:'+this.origOptions.frameWidth+'px; height:'+this.origOptions.frameHeight+'px;">'+inHtml+'</div>';$(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<json.length;i++)
{this.images[this.images.length]=new ganjaCMPic(this.id+'Slide_'+i,"img",this.origOptions,json[i]);}
this.renderPicSlide(true);}
else this.fetchImageFailure();}
ganjaCMPicSelector.prototype.fetchImageFailure=function(json)
{this.showImage(true,this.noImage);}
ganjaCMPicSelector.prototype.showImage=function(show,img)
{if(img==null)
{return;}
if(show)img.showImg();else img.hideImg();}
ganjaCMPicSelector.prototype.hideAllImages=function()
{this.showImage(false,this.noImage);this.showImage(false,this.wait);if(this.images!=null&&this.images!=undefined)
{for(var i=0;i<this.images.length;i++)
{this.showImage(false,this.images[i]);}}}
ganjaCMPicSelector.prototype.getEditor=function()
{return ganjaCM.editors[this.id.substring(0,this.id.length-3)];}
ganjaCMPicSelector.prototype.resetImage=function()
{if(this.workingImages.length+this.notWorkingImages.length>=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":"&nbsp;","type":"BUTTON"},{"id":"Next","classDef":"cmPicNext","content":"&nbsp;","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=/<a[^>]*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.length&&!urlDiffer;i++)
{if(this.previousUrls[i]==null||this.previousUrls[i]!=this.urls[i])
{urlDiffer=true;break;}}
this.previousUrls=this.urls;if(!this.richEditor&&urlDiffer)return false;if(this.urls.length==0)
{return false;}
this.renderUrlPanel();}
ganjaCMUrl.prototype.reset=function()
{this.getUrls('');}
ganjaCMUrl.prototype.resetUrlPanel=function()
{this.urlPos=0;}
ganjaCMUrl.prototype.renderUrlPanel=function()
{if(this.urlPos==null)this.resetUrlPanel();if(this.urls.length==0||this.urls[this.urlPos]==null)return false;$(this.id+'Selector').innerHTML='<span onclick="ganjaCMUrl.panels[\''+this.id+'\'].clickDispatch( this.innerHTML )">'+this.urls[this.urlPos]+'</span>';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+1<this.urls.length)this.urlPos++;if(!forward&&this.urlPos>0)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":"&lt;"},{"id":"Next","classDef":"cmUrlNext","content":"&gt;"},{"id":"Selector","classDef":"cmUrlPanel"},{"id":"clearUrl","classDef":"cmClear"}];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+" ")&&(i<all_images.length)){i++;}
anchor.href=(image_class_ignore_regex.test(" "+all_images[i].className+" "))?anchor.href:anchor.href.replace(/\&u\=/,"&u="+all_images[i].src);}
function dSM(el){for(var i=0;i<el.childNodes.length;i++){if(el.childNodes[i]&&el.childNodes[i].className=='widgetList')
{el.childNodes[i].style.display='block';}}}
function hSM(el){for(var i=0;i<el.childNodes.length;i++){if(el.childNodes[i]&&el.childNodes[i].className=='widgetList')
{el.childNodes[i].style.display='none';}}}
var lastIssueDate=new Array();lastIssueDate['posts']=null;lastIssueDate['comments']=null;var firstRun=new Array();firstRun['posts']=true;firstRun['comments']=true;var count=1;function updateLiveblog(type)
{if(!type)type='posts';var parameters=new Array();if(type=='comments')
{parameters.push('op=liveblogcomments');parameters.push('postId='+commentPostId);}
else
{parameters.push('op=liveblog');if(typeof postTag!='undefined'&&postTag!='')parameters.push('tagName='+postTag);}
parameters.push('lastIssueDate='+lastIssueDate[type]);parameters=parameters.join('&');var req=new Ajax.Request('/index.php',{method:'get',parameters:parameters,evalScripts:false,asynchronous:true,onSuccess:function(resp){var jsonPosts=eval(resp.responseText);addItems(jsonPosts,type);}});setTimeout('updateLiveblog(\''+type+'\')',(refreshSecs[type]*1000));}
function addItems(posts,type)
{if(!type)type='posts';for(var i=posts.length;i>0;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='<h2>'+cleanDate(post.issued)+'</h2>'+'<p><em>'+post.author.displayName+'</em>: '+post.entry+'</p>';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='<a title="Comments by '+post.author+'" href="/people/'+post.username+'/" class="CommenterImageLink">';postHead.innerHTML+='<img src="'+post.avatar+'" alt="Image of '+post.author+'" class="CommenterImage" />';postHead.innerHTML+='</a>';postHead.innerHTML+='<span class="date"><a class="date" href="#'+post.commentId+'">'+post.issuedFormatted+'</a></span><br />';postHead.innerHTML+='<a title="Comments by '+post.author+'" href="/people/'+post.username+'/">'+post.author+'</a> 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 edButtons=new Array();var edLinks=new Array();var edOpenTags=new Array();function edButton(id,display,tagStart,tagEnd,access,open){this.id=id;this.display=display;this.tagStart=tagStart;this.tagEnd=tagEnd;this.access=access;this.open=open;}
edButtons.push(new edButton('ed_bold','B','<strong>','</strong>','b'));edButtons.push(new edButton('ed_italic','I','<em>','</em>','i'));edButtons.push(new edButton('ed_link','Link','','</a>','a'));edButtons.push(new edButton('ed_ext_link','Ext. Link','','</a>','e'));edButtons.push(new edButton('ed_img','IMG','','','m',-1));edButtons.push(new edButton('ed_ul','UL','<ul>\n','</ul>\n\n','u'));edButtons.push(new edButton('ed_ol','OL','<ol>\n','</ol>\n\n','o'));edButtons.push(new edButton('ed_li','LI','\t<li>','</li>\n','l'));edButtons.push(new edButton('ed_block','B-QUOTE','<blockquote>','</blockquote>','q'));var extendedStart=edButtons.length;edButtons.push(new edButton('ed_h1','H1','<h1>','</h1>\n\n','1'));edButtons.push(new edButton('ed_h2','H2','<h2>','</h2>\n\n','2'));edButtons.push(new edButton('ed_h3','H3','<h3>','</h3>\n\n','3'));edButtons.push(new edButton('ed_h4','H4','<h4>','</h4>\n\n','4'));edButtons.push(new edButton('ed_p','P','<p>','</p>\n\n','p'));edButtons.push(new edButton('ed_code','CODE','<code>','</code>','c'));edButtons.push(new edButton('ed_pre','PRE','<pre>','</pre>'));edButtons.push(new edButton('ed_dl','DL','<dl>\n','</dl>\n\n'));edButtons.push(new edButton('ed_dt','DT','\t<dt>','</dt>\n'));edButtons.push(new edButton('ed_dd','DD','\t<dd>','</dd>\n'));edButtons.push(new edButton('ed_table','TABLE','<table>\n<tbody>','</tbody>\n</table>\n'));edButtons.push(new edButton('ed_tr','TR','\t<tr>\n','\n\t</tr>\n'));edButtons.push(new edButton('ed_td','TD','\t\t<td>','</td>\n'));edButtons.push(new edButton('ed_under','U','<u>','</u>'));edButtons.push(new edButton('ed_strike','S','<s>','</s>'));edButtons.push(new edButton('ed_nobr','NOBR','<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('<input type="button" id="'+button.id+'" '+accesskey+' class="ed_button" onclick="edInsertImage(edCanvas);" value="'+button.display+'" />');break;case'ed_link':document.write('<input type="button" id="'+button.id+'" '+accesskey+' class="ed_button" onclick="edInsertLink(edCanvas, '+i+');" value="'+button.display+'" />');break;case'ed_ext_link':document.write('<input type="button" id="'+button.id+'" '+accesskey+' class="ed_button" onclick="edInsertExtLink(edCanvas, '+i+');" value="'+button.display+'" />');break;case'ed_footnote':document.write('<input type="button" id="'+button.id+'" '+accesskey+' class="ed_button" onclick="edInsertFootnote(edCanvas);" value="'+button.display+'" />');break;default:document.write('<input type="button" id="'+button.id+'" '+accesskey+' class="ed_button" onclick="edInsertTag(edCanvas, '+i+');" value="'+button.display+'"  />');break;}}
function edShowLinks(){var tempStr='<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';for(i=0;i<edLinks.length;i++){tempStr+='<option value="'+i+'">'+edLinks[i].display+'</option>';}
tempStr+='</select>';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;i<edOpenTags.length;i++){if(edOpenTags[i]==button){edOpenTags.splice(i,1);document.getElementById(edButtons[button].id).value=document.getElementById(edButtons[button].id).value.replace('/','');}}}
function edCheckOpenTags(button){var tag=0;for(i=0;i<edOpenTags.length;i++){if(edOpenTags[i]==button){tag++;}}
if(tag>0){return true;}
else{return false;}}
function edCloseAllTags(){var count=edOpenTags.length;for(o=0;o<count;o++){edInsertTag(edCanvas,edOpenTags[edOpenTags.length-1]);}}
function edQuickLink(i,thisSelect){if(i>-1){var newWin='';if(edLinks[i].newWin==1){newWin=' target="_blank"';}
var tempStr='<a href="'+edLinks[i].URL+'"'+newWin+'>'
+edLinks[i].display
+'</a>';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('<div id="ed_toolbar"><span>');for(i=0;i<extendedStart;i++){edShowButton(edButtons[i],i);}
if(edShowExtraCookie()){document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" value="Close Tags" />'
+'<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" value="Dict" />'
+'<input type="button" id="ed_extra_show" class="ed_button" onclick="edShowExtra()" value="&raquo;" style="visibility: hidden;" />'
+'</span><br />'
+'<span id="ed_extra_buttons">'
+'<input type="button" id="ed_extra_hide" class="ed_button" onclick="edHideExtra();" value="&laquo;" />');}
else{document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" value="Close Tags" />'
+'<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" value="Dict" />'
+'<input type="button" id="ed_extra_show" class="ed_button" onclick="edShowExtra()" value="&raquo;" />'
+'</span><br />'
+'<span id="ed_extra_buttons" style="display: none;">'
+'<input type="button" id="ed_extra_hide" class="ed_button" onclick="edHideExtra();" value="&laquo;" />');}
for(i=extendedStart;i<edButtons.length;i++){edShowButton(edButtons[i],i);}
document.write('</span>');document.write('</div>');}
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='<a href="'+URL+'">';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='<a href="'+URL+'" rel="external">';edInsertTag(myField,i);}}
else{edInsertTag(myField,i);}}
function edInsertImage(myField){var myValue=prompt('Enter the URL of the image','http://');if(myValue){myValue='<img src="'
+myValue
+'" alt="'+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('<ol class="footnotes">');if(fnStart!=-1){var fnStr1=edCanvas.value.substring(0,fnStart)
var fnStr2=edCanvas.value.substring(fnStart,edCanvas.value.length)
var count=countInstances(fnStr2,'<li id="')+1;}
else{var count=1;}
var count='<sup><a href="#'+fnId+'n" id="'+fnId+'" class="footnote">'+count+'</a></sup>';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"+'<ol class="footnotes">'+"\n"
+'</ol>'+"\n";}
var footnote=' <li id="'+fnId+'n">'+note+' [<a href="#'+fnId+'">back</a>]</li>'+"\n"
+'</ol>';edCanvas.value=fnStr1+fnStr2.replace('</ol>',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<cookies.length;i++){var cookieData=cookies[i];while(cookieData.charAt(0)==' '){cookieData=cookieData.substring(1,cookieData.length);}
if(cookieData.indexOf('js_quicktags_extra')==0){if(cookieData.substring(19,cookieData.length)=='show'){return true;}
else{return false;}}}
return false;}
var Behaviour={list:new Array,register:function(sheet){Behaviour.list.push(sheet);},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply();});},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=$$(selector);if(!list){continue;}
for(i=0;element=list[i];i++){sheet[selector](element);}}}},addLoadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}}
Behaviour.start();function getAllChildren(e){return e.all?e.all:e.getElementsByTagName('*');}
document.getElementsBySelector=function(selector){if(!document.getElementsByTagName){return new Array();}
var tokens=selector.split(' ');var currentContext=new Array(document);for(var i=0;i<tokens.length;i++){token=tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;if(token.indexOf('#')>-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<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(found[k].className&&found[k].className.match(new RegExp('\\b'+className+'\\b'))){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var tagName=RegExp.$1;var attrName=RegExp.$2;var attrOperator=RegExp.$3;var attrValue=RegExp.$4;if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;var checkFunction;switch(attrOperator){case'=':checkFunction=function(e){return(e.getAttribute(attrName)==attrValue);};break;case'~':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b')));};break;case'|':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?')));};break;case'^':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)==0);};break;case'$':checkFunction=function(e){return(e.getAttribute(attrName).lastIndexOf(attrValue)==e.getAttribute(attrName).length-attrValue.length);};break;case'*':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)>-1);};break;default:checkFunction=function(e){return e.getAttribute(attrName);};}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(checkFunction(found[k])){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(!currentContext[0]){return;}
tagName=token;var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements=currentContext[h].getElementsByTagName(tagName);for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=found;}
return currentContext;}
var ActivityTicker=Class.create();ActivityTicker.prototype={initialize:function(options){this.update_url=options.update_url;this.container=options.container;this.update_list=$(options.update_list);this.ticker_list=$(options.ticker_list);this.ticker_length=options.ticker_length;this.update_interval=options.update_interval;this.tick_interval=options.tick_interval;this.update_decay=options.update_decay;},start:function(){if(!this.xhr)this.xhr=new Ajax.PeriodicalUpdater(this.update_list,this.update_url,{method:'get',frequency:this.update_interval,decay:this.update_decay});else this.xhr.start();var binded={'update_list':this.update_list,'ticker_list':this.ticker_list,'ticker_length':this.ticker_length};this.binded_periodical=new PeriodicalExecuter(function(pe){var upds=binded.update_list.childElements();if(upds.length){var act_item=upds[0].remove();var tcks=binded.ticker_list.childElements();var first_item=null;if(tcks.length){tcks[0].insert({'before':'<li style="margin-top:-60px;">'+act_item.innerHTML+'</li>'});}else{binded.ticker_list.innerHTML='<li style="margin-top:-60px;">'+act_item.innerHTML+'</li>';}
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();}};

