/*
 * Newtown Bee
 * Copyright(c) 2008, Wellspring Technologies.
 */


var isDOM=document.getElementById?1:0,isIE=document.all?1:0,isNS4=navigator.appName=='Netscape'&&!isDOM?1:0,isOp=self.opera?1:0,isDyn=isDOM||isIE||isNS4;function getRef(i,p){p=!p?document:p.navigator?p.document:p;return isIE?p.all[i]:isDOM?(p.getElementById?p:p.ownerDocument).getElementById(i):isNS4?p.layers[i]:null};function getSty(i,p){var r=getRef(i,p);return r?isNS4?r:r.style:null};if(!self.LayerObj)var LayerObj=new Function('i','p','this.ref=getRef(i,p);this.sty=getSty(i,p);return this');function getLyr(i,p){return new LayerObj(i,p)};function LyrFn(n,f){LayerObj.prototype[n]=new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px";with(this){'+f+'}')};LyrFn('x','if(!isNaN(p))sty.left=p+px;else return parseInt(sty.left)');LyrFn('y','if(!isNaN(p))sty.top=p+px;else return parseInt(sty.top)');if(typeof addEvent!='function'){var addEvent=function(o,t,f,l){var d='addEventListener',n='on'+t,rO=o,rT=t,rF=f,rL=l;if(o[d]&&!l)return o[d](t,f,false);if(!o._evts)o._evts={};if(!o._evts[t]){o._evts[t]=o[n]?{b:o[n]}:{};o[n]=new Function('e','var r=true,o=this,a=o._evts["'+t+'"],i;for(i in a){o._f=a[i];r=o._f(e||window.event)!=false&&r;o._f=null}return r');if(t!='unload')addEvent(window,'unload',function(){removeEvent(rO,rT,rF,rL)})}if(!f._i)f._i=addEvent._i++;o._evts[t][f._i]=f};addEvent._i=1;var removeEvent=function(o,t,f,l){var d='removeEventListener';if(o[d]&&!l)return o[d](t,f,false);if(o._evts&&o._evts[t]&&f._i)delete o._evts[t][f._i]}}function FSMenu(myName,nested,cssProp,cssVis,cssHid){this.myName=myName;this.nested=nested;this.cssProp=cssProp;this.cssVis=cssVis;this.cssHid=cssHid;this.cssLitClass='highlighted';this.menus={root:new FSMenuNode('root',true,this)};this.menuToShow=[];this.mtsTimer=null;this.showDelay=0;this.switchDelay=125;this.hideDelay=500;this.showOnClick=0;this.hideOnClick=true;this.animInSpeed=0.2;this.animOutSpeed=0.2;this.animations=[]};FSMenu.prototype.show=function(mN){with(this){menuToShow.length=arguments.length;for(var i=0;i<arguments.length;i++)menuToShow[i]=arguments[i];clearTimeout(mtsTimer);if(!nested)mtsTimer=setTimeout(myName+'.menus.root.over()',10)}};FSMenu.prototype.hide=function(mN){with(this){clearTimeout(mtsTimer);if(menus[mN])menus[mN].out()}};FSMenu.prototype.hideAll=function(){with(this){for(var m in menus)if(menus[m].visible&&!menus[m].isRoot)menus[m].hide(true)}};function FSMenuNode(id,isRoot,obj){this.id=id;this.isRoot=isRoot;this.obj=obj;this.lyr=this.child=this.par=this.timer=this.visible=null;this.args=[];var node=this;this.over=function(evt){with(node)with(obj){if(isNS4&&evt&&lyr.ref)lyr.ref.routeEvent(evt);clearTimeout(timer);clearTimeout(mtsTimer);if(!isRoot&&!visible)node.show();if(menuToShow.length){var a=menuToShow,m=a[0];if(!menus[m]||!menus[m].lyr.ref)menus[m]=new FSMenuNode(m,false,obj);var c=menus[m];if(c==node){menuToShow.length=0;return}clearTimeout(c.timer);if(c!=child&&c.lyr.ref){c.args.length=a.length;for(var i=0;i<a.length;i++)c.args[i]=a[i];var delay=child?switchDelay:showDelay;c.timer=setTimeout('with('+myName+'){menus["'+c.id+'"].par=menus["'+node.id+'"];menus["'+c.id+'"].show()}',delay?delay:1)}menuToShow.length=0}if(!nested&&par)par.over()}};this.out=function(evt){with(node)with(obj){if(isNS4&&evt&&lyr&&lyr.ref)lyr.ref.routeEvent(evt);clearTimeout(timer);if(!isRoot&&hideDelay>=0){timer=setTimeout(myName+'.menus["'+id+'"].hide()',hideDelay);if(!nested&&par)par.out()}}};if(this.id!='root')with(this)with(lyr=getLyr(id))if(ref){if(isNS4)ref.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);addEvent(ref,'mouseover',this.over);addEvent(ref,'mouseout',this.out);if(obj.nested){addEvent(ref,'focus',this.over);addEvent(ref,'click',this.over);addEvent(ref,'blur',this.out)}}};FSMenuNode.prototype.show=function(forced){with(this)with(obj){if(!lyr||!lyr.ref)return;if(par){if(par.child&&par.child!=this)par.child.hide();par.child=this}var offR=args[1],offX=args[2],offY=args[3],lX=0,lY=0,doX=''+offX!='undefined',doY=''+offY!='undefined';if(self.page&&offR&&(doX||doY)){with(page.elmPos(offR,par.lyr?par.lyr.ref:0))lX=x,lY=y;if(doX)lyr.x(lX+eval(offX));if(doY)lyr.y(lY+eval(offY))}if(offR)lightParent(offR,1);visible=1;if(obj.onshow)obj.onshow(id);lyr.ref.parentNode.style.zIndex='2';setVis(1,forced)}};FSMenuNode.prototype.hide=function(forced){with(this)with(obj){if(!lyr||!lyr.ref||!visible)return;if(isNS4&&self.isMouseIn&&isMouseIn(lyr.ref))return show();if(args[1])lightParent(args[1],0);if(child)child.hide();if(par&&par.child==this)par.child=null;if(lyr){visible=0;if(obj.onhide)obj.onhide(id);lyr.ref.parentNode.style.zIndex='1';setVis(0,forced)}}};FSMenuNode.prototype.lightParent=function(elm,lit){with(this)with(obj){if(!cssLitClass||isNS4)return;if(lit)elm.className+=(elm.className?' ':'')+cssLitClass;else elm.className=elm.className.replace(new RegExp('(\\s*'+cssLitClass+')+$'),'')}};FSMenuNode.prototype.setVis=function(sh,forced){with(this)with(obj){if(lyr.forced&&!forced)return;lyr.forced=forced;lyr.timer=lyr.timer||0;lyr.counter=lyr.counter||0;with(lyr){clearTimeout(timer);if(sh&&!counter)sty[cssProp]=cssVis;var speed=sh?animInSpeed:animOutSpeed;if(isDOM&&speed<1)for(var a=0;a<animations.length;a++)animations[a](ref,counter,sh);counter+=speed*(sh?1:-1);if(counter>1){counter=1;lyr.forced=false}else if(counter<0){counter=0;sty[cssProp]=cssHid;lyr.forced=false}else if(isDOM){timer=setTimeout(myName+'.menus["'+id+'"].setVis('+sh+','+forced+')',50)}}}};FSMenu.animSwipeDown=function(ref,counter,show){if(show&&(counter==0)){ref._fsm_styT=ref.style.top;ref._fsm_styMT=ref.style.marginTop;ref._fsm_offT=ref.offsetTop||0}var cP=Math.pow(Math.sin(Math.PI*counter/2),0.75);var clipY=ref.offsetHeight*(1-cP);ref.style.clip=(counter==1?((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto,auto,auto,auto)'):'rect('+clipY+'px,'+ref.offsetWidth+'px,'+ref.offsetHeight+'px,0)');if(counter==1||(counter<0.01&&!show)){ref.style.top=ref._fsm_styT;ref.style.marginTop=ref._fsm_styMT}else{ref.style.top=((0-clipY)+(ref._fsm_offT))+'px';ref.style.marginTop='0'}};FSMenu.animFade=function(ref,counter,show){var done=(counter==1);if(ref.filters){var alpha=!done?' alpha(opacity='+parseInt(counter*100)+')':'';if(ref.style.filter.indexOf("alpha")==-1)ref.style.filter+=alpha;else ref.style.filter=ref.style.filter.replace(/\s*alpha\([^\)]*\)/i,alpha)}else ref.style.opacity=ref.style.MozOpacity=counter/1.001};FSMenu.animClipDown=function(ref,counter,show){var cP=Math.pow(Math.sin(Math.PI*counter/2),0.75);ref.style.clip=(counter==1?((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto,auto,auto,auto)'):'rect(0,'+ref.offsetWidth+'px,'+(ref.offsetHeight*cP)+'px,0)')};FSMenu.prototype.activateMenu=function(id,subInd){with(this){if(!isDOM||!document.documentElement)return;var fsmFB=getRef('fsmenu-fallback');if(fsmFB){fsmFB.rel='alternate stylesheet';fsmFB.disabled=true}var a,ul,li,parUL,mRoot=getRef(id),nodes,count=1;var lists=mRoot.getElementsByTagName('ul');for(var i=0;i<lists.length;i++){li=ul=lists[i];while(li){if(li.nodeName.toLowerCase()=='li')break;li=li.parentNode}if(!li)continue;parUL=li;while(parUL){if(parUL.nodeName.toLowerCase()=='ul')break;parUL=parUL.parentNode}a=null;for(var j=0;j<li.childNodes.length;j++)if(li.childNodes[j].nodeName.toLowerCase()=='a')a=li.childNodes[j];if(!a)continue;var menuID=myName+'-id-'+count++;if(ul.id)menuID=ul.id;else ul.setAttribute('id',menuID);var sOC=(showOnClick==1&&li.parentNode==mRoot)||(showOnClick==2);var evtProp=navigator.userAgent.indexOf('Safari')>-1||isOp?'safRtnVal':'returnValue';var eShow=new Function('with('+myName+'){var m=menus["'+menuID+'"],pM=menus["'+parUL.id+'"];'+(sOC?'if((pM&&pM.child)||(m&&m.visible))':'')+' show("'+menuID+'",this)}');var eHide=new Function('e','if(e.'+evtProp+'!=false)'+myName+'.hide("'+menuID+'")');addEvent(a,'mouseover',eShow);addEvent(a,'focus',eShow);addEvent(a,'mouseout',eHide);addEvent(a,'blur',eHide);if(sOC)addEvent(a,'click',new Function('e',myName+'.show("'+menuID+'",this);if(e.cancelable&&e.preventDefault)e.preventDefault();e.'+evtProp+'=false;return false'));if(subInd)a.insertBefore(subInd.cloneNode(true),a.firstChild)}if(isIE&&!isOp){var aNodes=mRoot.getElementsByTagName('a');for(var i=0;i<aNodes.length;i++){addEvent(aNodes[i],'focus',new Function('e','var node=this.parentNode;while(node){if(node.onfocus)node.onfocus(e);node=node.parentNode}'));addEvent(aNodes[i],'blur',new Function('e','var node=this.parentNode;while(node){if(node.onblur)node.onblur(e);node=node.parentNode}'))}}if(hideOnClick)addEvent(mRoot,'click',new Function(myName+'.hideAll()'));menus[id]=new FSMenuNode(id,true,this)}};var page={win:self,minW:0,minH:0,MS:isIE&&!isOp,db:document.compatMode&&document.compatMode.indexOf('CSS')>-1?'documentElement':'body'};page.elmPos=function(e,p){var x=0,y=0,w=p?p:this.win;e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}if(e&&this.MS&&navigator.platform.indexOf('Mac')>-1&&e.tagName=='A'){e.onfocus=new Function('with(event){self.tmpX=clientX-offsetX;self.tmpY=clientY-offsetY}');e.focus();x=tmpX;y=tmpY;e.blur()}else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}return{x:x,y:y}};if(isNS4){var fsmMouseX,fsmMouseY,fsmOR=self.onresize,nsWinW=innerWidth,nsWinH=innerHeight;document.fsmMM=document.onmousemove;self.onresize=function(){if(fsmOR)fsmOR();if(nsWinW!=innerWidth||nsWinH!=innerHeight)location.reload()};document.captureEvents(Event.MOUSEMOVE);document.onmousemove=function(e){fsmMouseX=e.pageX;fsmMouseY=e.pageY;return document.fsmMM?document.fsmMM(e):document.routeEvent(e)};function isMouseIn(sty){with(sty)return((fsmMouseX>left)&&(fsmMouseX<left+clip.width)&&(fsmMouseY>top)&&(fsmMouseY<top+clip.height))}}

function fixAnthem(){var frm=document.getElementById(Anthem_FormID);if(frm){frm.action=window.location.toString();}}
function fixStoryImages(){var forceUrl=(arguments.length>0)?arguments[0]:window.location.toString();var images=$('#storyBody .imageContainer img');images.each(function(i){var a=document.createElement('a');a.setAttribute('rel','lightbox');a.href=this.getAttribute('popupTarget');this.parentNode.insertBefore(a,this);a.appendChild(this);var s=document.createElement('span');s.className='enlarge'
s.innerHTML="Enlarge image";a.appendChild(s);});$("#storyBody a[rel=lightbox]").fancybox({type:'image',showCloseButton:false,titlePosition:'inside',titleFormat:function(title,currentArray,currentIndex,currentOpts){return'<div class="lightboxCaption"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="Wellspring/lib/other/jquery/images/closelabel.gif" /></a></span>'+(title&&title.length?'<p>'+title+'</p>':'')+'Image '+(currentIndex+1)+' of '+currentArray.length+'</div>';}});var bindAddThis=function(){addthis.toolbox('#addThis',{services_compact:'facebook,twitter',ui_click:true,ui_cobrand:'Newtown Bee'},{url:forceUrl,title:$('#storyBody h1').html()});}
if(!window.addthis){$.getScript('http://s7.addthis.com/js/250/addthis_widget.js#username=thenewtownbee',function(){bindAddThis();})}else{bindAddThis();}}
function applyFlowplayer(){var body=document.getElementById("storyBody");var atags=body.getElementsByTagName('a');for(var i=0;i<atags.length;i++){if(atags[i].className.indexOf('audio')>=0){atags[i].style.width='600px';atags[i].style.height='27px';atags[i].style.display='block';if(atags[i].id==''){var d=new Date();atags[i].id='vid_'+d.getMilliseconds();console.log(atags[i].id);}
applyAudioPlayer({applyTo:atags[i].id});}}}
function applyAudioPlayer(cfg){var applyTo=cfg.applyTo;console.log('Binding %o',applyTo);var id=(cfg.id)?cfg.id:'audioplayer';var width=(cfg.width)?cfg.width:600;var height=(cfg.height)?cfg.height:27;$f(applyTo,'Wellspring/lib/other/flowplayer/flowplayer-3.1.0.swf',{plugins:{controls:{fullscreen:false,height:height}},clip:{autoPlay:false}});}
function getStoryForHomepage(node){var retVal=true;var tabTarget=document.getElementById('homepageTabContainer');if(tabTarget){retVal=false;var root=document.getElementsByTagName('head')[0].getElementsByTagName('base')[0].href;var target=root+'Loader.aspx?action=story';$.post(target,{url:node.href},function(result){StoryTab.removeAll();var newTab=new StoryTab(result.title,result.body);newTab.contentContainerId='MainPageTabContents';newTab.tabContainerId='homepageTabContainer';newTab.build();var printlink='<div style="width:100%;height:100%;cursor:hand;cursor:pointer;" onclick="window.print()">&nbsp;</div>';createFontSizeControl(document.getElementById('storyBody'),'',2,document.getElementById('fontControlTarget'),null,null,printlink);var container=document.getElementById('RecentStoryContainer');if(container){container.innerHTML=result.recentstories;}
fixStoryImages(node.href);applyFlowplayer();},'json');}
return retVal;}

var xVersion='3.15.4',xNN4,xOp7,xOp5or6,xIE4Up,xIE4,xIE5,xUA=navigator.userAgent.toLowerCase();if(window.opera){xOp7=(xUA.indexOf('opera 7')!=-1||xUA.indexOf('opera/7')!=-1);if(!xOp7)xOp5or6=(xUA.indexOf('opera 5')!=-1||xUA.indexOf('opera/5')!=-1||xUA.indexOf('opera 6')!=-1||xUA.indexOf('opera/6')!=-1);}
else if(document.all&&xUA.indexOf('msie')!=-1){xIE4Up=parseInt(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}
else if(document.layers){xNN4=true;}
xMoz=xUA.indexOf('gecko')!=-1;xMac=xUA.indexOf('mac')!=-1;function xGetElementById(e){if(typeof(e)!='string')return e;if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;return e;}
function xParent(e,bNode){if(!(e=xGetElementById(e)))return null;var p=null;if(!bNode&&xDef(e.offsetParent))p=e.offsetParent;else if(xDef(e.parentNode))p=e.parentNode;else if(xDef(e.parentElement))p=e.parentElement;return p;}
function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}
return true;}
function xStr(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false;}
return true;}
function xNum(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='number')return false;}
return true;}
function xShow(e){return xVisibility(e,1);}
function xHide(e){return xVisibility(e,0);}
function xVisibility(e,bShow)
{if(!(e=xGetElementById(e)))return null;if(e.style&&xDef(e.style.visibility)){if(xDef(bShow))e.style.visibility=bShow?'visible':'hidden';return e.style.visibility;}
return null;}
function xDisplay(e,sProp)
{if(!(e=xGetElementById(e)))return null;if(e.style&&xDef(e.style.display)){if(xStr(sProp))e.style.display=sProp;return e.style.display;}
return null;}
function xZIndex(e,uZ){if(!(e=xGetElementById(e)))return 0;if(e.style&&xDef(e.style.zIndex)){if(xNum(uZ))e.style.zIndex=uZ;uZ=parseInt(e.style.zIndex);}
return uZ;}
function xColor(e,sColor){if(!(e=xGetElementById(e)))return'';var c='';if(e.style&&xDef(e.style.color)){if(xStr(sColor))e.style.color=sColor;c=e.style.color;}
return c;}
function xBackground(e,sColor,sImage){if(!(e=xGetElementById(e)))return'';var bg='';if(e.style){if(xStr(sColor)){if(!xOp5or6)e.style.backgroundColor=sColor;else e.style.background=sColor;}
if(xStr(sImage))e.style.backgroundImage=(sImage!='')?'url('+sImage+')':null;if(!xOp5or6)bg=e.style.backgroundColor;else bg=e.style.background;}
return bg;}
function xMoveTo(e,iX,iY){xLeft(e,iX);xTop(e,iY);}
function xLeft(e,iX){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.left)){if(xNum(iX))e.style.left=iX+'px';else{iX=parseInt(e.style.left);if(isNaN(iX))iX=0;}}
else if(css&&xDef(e.style.pixelLeft)){if(xNum(iX))e.style.pixelLeft=iX;else iX=e.style.pixelLeft;}
return iX;}
function xTop(e,iY){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.top)){if(xNum(iY))e.style.top=iY+'px';else{iY=parseInt(e.style.top);if(isNaN(iY))iY=0;}}
else if(css&&xDef(e.style.pixelTop)){if(xNum(iY))e.style.pixelTop=iY;else iY=e.style.pixelTop;}
return iY;}
function xPageX(e){if(!(e=xGetElementById(e)))return 0;var x=0;while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null;}
return x;}
function xPageY(e){if(!(e=xGetElementById(e)))return 0;var y=0;while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null;}
return y;}
function xOffsetLeft(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetLeft))return e.offsetLeft;else return 0;}
function xOffsetTop(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetTop))return e.offsetTop;else return 0;}
function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)||bWin){var w=e||window;if(w.document.documentElement&&w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body&&xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft;}
else{e=xGetElementById(e);if(e&&xNum(e.scrollLeft))offset=e.scrollLeft;}
return offset;}
function xScrollTop(e,bWin){var offset=0;if(!xDef(e)||bWin){var w=e||window;if(w.document.documentElement&&w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body&&xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop;}
else{e=xGetElementById(e);if(e&&xNum(e.scrollTop))offset=e.scrollTop;}
return offset;}
function xHasPoint(ele,iLeft,iTop,iClpT,iClpR,iClpB,iClpL){if(!xNum(iClpT)){iClpT=iClpR=iClpB=iClpL=0;}
else if(!xNum(iClpR)){iClpR=iClpB=iClpL=iClpT;}
else if(!xNum(iClpB)){iClpL=iClpR;iClpB=iClpT;}
var thisX=xPageX(ele),thisY=xPageY(ele);return(iLeft>=thisX+iClpL&&iLeft<=thisX+xWidth(ele)-iClpR&&iTop>=thisY+iClpT&&iTop<=thisY+xHeight(ele)-iClpB);}
function xResizeTo(e,uW,uH){xWidth(e,uW);xHeight(e,uH);}
function xWidth(e,uW){if(!(e=xGetElementById(e)))return 0;if(xNum(uW)){if(uW<0)uW=0;else uW=Math.round(uW);}
else uW=-1;var css=xDef(e.style);if(css&&xDef(e.offsetWidth)&&xStr(e.style.width)){if(uW>=0)xSetCW(e,uW);uW=e.offsetWidth;}
else if(css&&xDef(e.style.pixelWidth)){if(uW>=0)e.style.pixelWidth=uW;uW=e.style.pixelWidth;}
return uW;}
function xHeight(e,uH){if(!(e=xGetElementById(e)))return 0;if(xNum(uH)){if(uH<0)uH=0;else uH=Math.round(uH);}
else uH=-1;var css=xDef(e.style);if(css&&xDef(e.offsetHeight)&&xStr(e.style.height)){if(uH>=0)xSetCH(e,uH);uH=e.offsetHeight;}
else if(css&&xDef(e.style.pixelHeight)){if(uH>=0)e.style.pixelHeight=uH;uH=e.style.pixelHeight;}
return uH;}
function xGetCS(ele,sP){return parseInt(document.defaultView.getComputedStyle(ele,'').getPropertyValue(sP));}
function xSetCW(ele,uW){var pl=0,pr=0,bl=0,br=0;if(xDef(document.defaultView)&&xDef(document.defaultView.getComputedStyle)){pl=xGetCS(ele,'padding-left');pr=xGetCS(ele,'padding-right');bl=xGetCS(ele,'border-left-width');br=xGetCS(ele,'border-right-width');}
else if(xDef(ele.currentStyle,document.compatMode)){if(document.compatMode=='CSS1Compat'){pl=parseInt(ele.currentStyle.paddingLeft);pr=parseInt(ele.currentStyle.paddingRight);bl=parseInt(ele.currentStyle.borderLeftWidth);br=parseInt(ele.currentStyle.borderRightWidth);}}
else if(xDef(ele.offsetWidth,ele.style.width)){ele.style.width=uW+'px';pl=ele.offsetWidth-uW;}
if(isNaN(pl))pl=0;if(isNaN(pr))pr=0;if(isNaN(bl))bl=0;if(isNaN(br))br=0;var cssW=uW-(pl+pr+bl+br);if(isNaN(cssW)||cssW<0)return;else ele.style.width=cssW+'px';}
function xSetCH(ele,uH){var pt=0,pb=0,bt=0,bb=0;if(xDef(document.defaultView)&&xDef(document.defaultView.getComputedStyle)){pt=xGetCS(ele,'padding-top');pb=xGetCS(ele,'padding-bottom');bt=xGetCS(ele,'border-top-width');bb=xGetCS(ele,'border-bottom-width');}
else if(xDef(ele.currentStyle,document.compatMode)){if(document.compatMode=='CSS1Compat'){pt=parseInt(ele.currentStyle.paddingTop);pb=parseInt(ele.currentStyle.paddingBottom);bt=parseInt(ele.currentStyle.borderTopWidth);bb=parseInt(ele.currentStyle.borderBottomWidth);}}
else if(xDef(ele.offsetHeight,ele.style.height)){ele.style.height=uH+'px';pt=ele.offsetHeight-uH;}
if(isNaN(pt))pt=0;if(isNaN(pb))pb=0;if(isNaN(bt))bt=0;if(isNaN(bb))bb=0;var cssH=uH-(pt+pb+bt+bb);if(isNaN(cssH)||cssH<0)return;else ele.style.height=cssH+'px';}
function xClip(e,iTop,iRight,iBottom,iLeft){if(!(e=xGetElementById(e)))return;if(e.style){if(xNum(iLeft))e.style.clip='rect('+iTop+'px '+iRight+'px '+iBottom+'px '+iLeft+'px)';else e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)';}}
function xClientWidth(){var w=0;if(xOp5or6)w=window.innerWidth;else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientWidth)
w=document.documentElement.clientWidth;else if(document.body&&document.body.clientWidth)
w=document.body.clientWidth;else if(xDef(window.innerWidth,window.innerHeight,document.height)){w=window.innerWidth;if(document.height>window.innerHeight)w-=16;}
return w;}
function xClientHeight(){var h=0;if(xOp5or6)h=window.innerHeight;else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientHeight)
h=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight&&document.body.clientHeight>100)
h=document.body.clientHeight;else if(xDef(window.innerWidth,window.innerHeight,document.width)){h=window.innerHeight;if(document.width>window.innerWidth)h-=16;}
return h;}

function xAddEventListener(e,eventType,eventListener,useCapture)
{if(!(e=xGetElementById(e)))return;eventType=eventType.toLowerCase();if((!xIE4Up&&!xOp7)&&e==window){if(eventType=='resize'){window.xPCW=xClientWidth();window.xPCH=xClientHeight();window.xREL=eventListener;xResizeEvent();return;}
if(eventType=='scroll'){window.xPSL=xScrollLeft();window.xPST=xScrollTop();window.xSEL=eventListener;xScrollEvent();return;}}
var eh='e.on'+eventType+'=eventListener';if(e.addEventListener)e.addEventListener(eventType,eventListener,useCapture);else if(e.attachEvent)e.attachEvent('on'+eventType,eventListener);else eval(eh);}
function xRemoveEventListener(e,eventType,eventListener,useCapture)
{if(!(e=xGetElementById(e)))return;eventType=eventType.toLowerCase();if((!xIE4Up&&!xOp7)&&e==window){if(eventType=='resize'){window.xREL=null;return;}
if(eventType=='scroll'){window.xSEL=null;return;}}
var eh='e.on'+eventType+'=null';if(e.removeEventListener)e.removeEventListener(eventType,eventListener,useCapture);else if(e.detachEvent)e.detachEvent('on'+eventType,eventListener);else eval(eh);}
function xEvent(evt)
{this.type='';this.target=null;this.relatedTarget=null;this.pageX=0;this.pageY=0;this.keyCode=0;this.offsetX=0;this.offsetY=0;var e=evt||window.event;if(!e)return;if(e.type)this.type=e.type;if(e.target)this.target=e.target;else if(e.srcElement)this.target=e.srcElement;if(e.relatedTarget)this.relatedTarget=e.relatedTarget;else if(xIE4Up){if(e.type=='mouseover')this.relatedTarget=e.fromElement;else if(e.type=='mouseout')this.relatedTarget=e.toElement;}
if(xOp5or6){this.pageX=e.clientX;this.pageY=e.clientY;}
else if(xDef(e.pageX,e.pageY)){this.pageX=e.pageX;this.pageY=e.pageY;}
else if(xDef(e.clientX,e.clientY)){this.pageX=e.clientX+xScrollLeft();this.pageY=e.clientY+xScrollTop();}
if(xDef(e.offsetX,e.offsetY)){this.offsetX=e.offsetX;this.offsetY=e.offsetY;if(xIE4Up&&xMac){this.offsetX+=xScrollLeft();this.offsetY+=xScrollTop();}}
else if(xDef(e.layerX,e.layerY)){this.offsetX=e.layerX;this.offsetY=e.layerY;}
else{this.offsetX=this.pageX-xPageX(this.target);this.offsetY=this.pageY-xPageY(this.target);}
if(e.keyCode){this.keyCode=e.keyCode;}
else if(xDef(e.which)&&e.type.indexOf('key')!=-1){this.keyCode=e.which;}}
function xResizeEvent()
{if(window.xREL)setTimeout('xResizeEvent()',250);var cw=xClientWidth(),ch=xClientHeight();if(window.xPCW!=cw||window.xPCH!=ch){window.xPCW=cw;window.xPCH=ch;if(window.xREL)window.xREL();}}
function xScrollEvent()
{if(window.xSEL)setTimeout('xScrollEvent()',250);var sl=xScrollLeft(),st=xScrollTop();if(window.xPSL!=sl||window.xPST!=st){window.xPSL=sl;window.xPST=st;if(window.xSEL)window.xSEL();}}
function xStopPropagation(evt)
{if(evt&&evt.stopPropagation)evt.stopPropagation();else if(window.event)window.event.cancelBubble=true;}
function xPreventDefault(evt)
{if(evt&&evt.preventDefault)evt.preventDefault();else if(window.event)window.event.returnValue=false;}

var xb=new Object();xb.clientHeight=function(){var retVal=-1;if(window.innerHeight)retVal=window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)retVal=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)retVal=document.body.clientHeight;return retVal;}
xb.getStyle=function(node,cssProperty,GeckoProperty){var retVal=null;if(node.currentStyle){retVal=node.currentStyle[cssProperty];}else if(window.getComputedStyle){if(node.nodeType==1){var elstyle=document.defaultView.getComputedStyle(node,"");var propToUse=(GeckoProperty)?GeckoProperty:cssProperty;retVal=elstyle.getPropertyValue(propToUse);}}
return retVal;}
xb.getUrlRoot=function(){var retVal='';var header=document.getElementsByTagName('head');if(header.length>0){var base=header[0].getElementsByTagName('base');if(base.length>0){retVal=base[0].href;}}
return retVal;}
xb.bindEvent=function(node,type,fn){if(node&&node.addEventListener)node.addEventListener(type,fn,false);else if(node&&node.attachEvent)node.attachEvent('on'+type,fn);}
xb.getNodeArgument=function(e){if(!e)e=window.event;var retVal=null;if(e)retVal=(e.srcElement)?e.srcElement:e.target;return retVal;}

var INTERNAL_ddmlButtons=new Array();function ddmlButton(text,oFunction,className,id,name){this.text=text;this.targetFunction=oFunction;this.className=className||'ddmlButton';this.id=id;this.name=name;this.over=false;this.down=false;}
ddmlButton.prototype.getClass=function(){var newClass=this.className;newClass+=(this.over)?'Over':'';newClass+=(this.down)?'Down':'';return newClass;}
ddmlButton.prototype.getObject=function(){var newButton=document.createElement('div');newButton.innerHTML=this.text.replace(/&(?!amp;)/g,'&amp;');newButton.className=this.className;if(this.id)newButton.id=this.id;if(this.name)newButton.name=this.name;xAddEventListener(newButton,'mouseover',ddmlButtonOverE);xAddEventListener(newButton,'mouseout',ddmlButtonOutE);xAddEventListener(newButton,'mousedown',ddmlButtonDownE);xAddEventListener(newButton,'mouseup',ddmlButtonUpE);xAddEventListener(newButton,'selectstart',ddmlButtonSelect);if(this.targetFunction)xAddEventListener(newButton,'click',this.targetFunction);newButton.ddmlButton=this;newButton.ddmlButton.nodeIndex=INTERNAL_ddmlButtons.length;INTERNAL_ddmlButtons.push(newButton);return newButton;}
ddmlButton.prototype.getHTML=function(sExtra){if(!sExtra)sExtra='';var sFunctionName=this.targetFunction.toString().replace(/[\n\r]/g,'');sFunctionName=sFunctionName.replace(/function\s*(\w*).*/gim,'$1');return'<div id="'+this.id+'" name="'+this.name+'" class="'+this.className+'"'+' onmouseover="ddmlButtonOver(this);" onmouseout="ddmlButtonOut(this);"'+' onmousedown="ddmlButtonDown(this);" onmouseup="ddmlButtonUp(this);"'+' onclick="'+sFunctionName+'(event);" onselectstart="ddmlButtonSelect();" '+sExtra+'>'+
this.text+'</div>';}
ddmlButton.prototype.getNode=function(){if(this.nodeIndex!==null&&INTERNAL_ddmlButtons.length>this.nodeIndex)return INTERNAL_ddmlButtons[this.nodeIndex];}
function ddmlButtonFixHTMLButton(node){node.ddmlButton=new ddmlButton(node.innerHTML,null,node.className,node.id,node.name);node.ddmlButton.nodeIndex=INTERNAL_ddmlButtons.length;INTERNAL_ddmlButtons.push(node);}
function ddmlButtonOverE(e){var myEvent=new xEvent(e);ddmlButtonOver(myEvent.target);}
function ddmlButtonOver(node){if(node.ddmlButton){node.ddmlButton.over=true;if(node.ddmlButton.onMouseOver)node.ddmlButton.onMouseOver(node.ddmlButton);node.className=node.ddmlButton.getClass();}else{ddmlButtonFixHTMLButton(node);ddmlButtonOver(node)}}
function ddmlButtonOutE(e){var myEvent=new xEvent(e);ddmlButtonOut(myEvent.target);}
function ddmlButtonOut(node){if(node.ddmlButton){node.ddmlButton.over=false;if(node.ddmlButton.onMouseOut)node.ddmlButton.onMouseOut(node.ddmlButton);node.className=node.ddmlButton.getClass();}else{ddmlButtonFixHTMLButton(node);ddmlButtonOut(node);}}
var ddml_INTERNAL_buttonWatch;function ddmlButtonDownE(e){var myEvent=new xEvent(e);ddmlButtonDown(myEvent.target);}
function ddmlButtonDown(node){if(node.ddmlButton){xAddEventListener(document,'mousemove',ddmlButtonWatch);ddml_INTERNAL_buttonWatch=node;node.ddmlButton.down=true;node.className=node.ddmlButton.getClass();}else{ddmlButtonFixHTMLButton(node);ddmlButtonDown(node);}}
function ddmlButtonUpE(e){var myEvent=new xEvent(e);ddmlButtonUp(myEvent.target)}
function ddmlButtonUp(node){if(node.ddmlButton){xRemoveEventListener(document,'mousemove',ddmlButtonWatch);ddml_INTERNAL_buttonWatch=null;node.ddmlButton.down=false;node.className=node.ddmlButton.getClass();}else{ddmlButtonFixHTMLButton(node);ddmlButtonUp(node);}}
function ddmlButtonWatch(e){var myEvent=new xEvent(e);var currTarget=e.target||window.event.srcElement;if(currTarget!=ddml_INTERNAL_buttonWatch){ddmlButtonUp(ddml_INTERNAL_buttonWatch);}}
function ddmlButtonSelect(e){return false;}

if(!window.console){window.console={};window.console.log=function(s){};window.console.error=function(s){};}
var wsTabControls=new Object();wsTabControls.doLog=false;wsTabControls.log=function(s){if(wsTabControls.doLog)console.log(s);}
wsTabControls.addEventTo=function(node,type,fn){if(node.addEventListener)node.addEventListener(type,fn,false);else if(node.attachEvent)node.attachEvent('on'+type,fn);}
wsTabControls.swapTab=function(event){var node;if(!event||!event.nodeName){if(!event)event=window.event;node=(event.target)?event.target:event.srcElement;}else if(event.nodeName){node=event;}
if(node){while(node.parentNode&&!(node.className.indexOf('tab')==0||node.className.indexOf('activeTab')==0)){node=node.parentNode;}
if(node.className.indexOf('tab')==0||node.className.indexOf('activeTab')==0){if(!node.ddmlButton)ddmlButtonFixHTMLButton(node);if(node.ddmlButton&&node.ddmlButton.target){if(node.ddmlButton.target.indexOf('http')==0){window.open(node.ddmlButton.target);}else{wsTabControls.createCookie('tabControl:'+node.ddmlButton.containerId+'Tabs:last',node.ddmlButton.target.replace('Container',''),7);wsTabControls[node.ddmlButton.containerId].clicked=true;var tabContainer=document.getElementById(node.ddmlButton.containerId+'Tabs');if(!tabContainer)tabContainer=document.getElementById(node.ddmlButton.containerId);var divs=tabContainer.getElementsByTagName('div');var showingSomething=false;for(var i=0;i<divs.length;i++){if(divs[i].ddmlButton){divs[i].className=(node.id==divs[i].id)?'activeTab':'tab';divs[i].ddmlButton.className=(node.id==divs[i].id)?'activeTab':'tab';target=document.getElementById(divs[i].ddmlButton.target);if(target){target.style.display=(divs[i].className!='tab')?'block':'none';if(divs[i].className!='tab')showingSomething=true;}}}
if(!showingSomething&&divs.length>0&&divs[0].ddmlButton){divs[0].className='activeTab';divs[0].ddmlButton.className='activeTab';target=document.getElementById(divs[0].ddmlButton.target);if(target){target.style.display='block';}}}}else{wsTabControls.log('Button has no target');}}else{wsTabControls.log('No node was found for the tab swap event');}}}
wsTabControls.createCookie=function(name,value,days){var currDomain=window.location.toString();currDomain=currDomain.replace(/https?\:\/\//i,'');if(currDomain.indexOf('/')>0)currDomain=currDomain.substr(0,currDomain.indexOf('/'));if(currDomain.indexOf('.')>=0&&currDomain.indexOf('.')!=currDomain.lastIndexOf('.')){var parts=currDomain.split('.');if(parts.count<3){currDomain=currDomain.substring(currDomain.indexOf('.')+1,currDomain.length);}}
else if(currDomain.indexOf('.')<0)currDomain='';if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";var newCookie=name+"="+value+expires+"; path=/;";if(currDomain!='')newCookie+="domain=."+currDomain;document.cookie=newCookie;}
wsTabControls.readCookie=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function wsTabControl(containerId){if(!wsTabControls[containerId]){wsTabControls[containerId]=this;this.container=document.getElementById(containerId+'Tabs');if(!this.container)this.container=document.getElementById(containerId);this.tabs=new Array();this.clicked=false;var nodes=this.container.getElementsByTagName('div');var button;var tabCount=0;var label;var target;var id;var buttonElement;var lastTarget=wsTabControls.readCookie('tabControl:'+containerId+'Tabs:last');var currTabName='';for(var i=nodes.length-1;i>=0;i--){if(nodes[i].getAttribute('for')&&nodes[i].getAttribute('for')!=''&&nodes[i].className!='clear'&&nodes[i].className!='containerSpacer'){currTabName=nodes[i].getAttribute('for').replace('Container','');if(lastTarget==currTabName||(lastTarget==null&&i==0)){var loc=window.location.toString();var qsRegEx=new RegExp('[?&]'+containerId+'=([^&]*)');if(loc.search(qsRegEx)<0||loc.replace(qsRegEx,'$1').toLowerCase()==currTabName.toLowerCase()){className='activeTab';this.queueSwap(nodes[i].getAttribute('for'));}else{className='tab';}}else className='tab';if(nodes[i].innerText)label=nodes[i].innerText;else if(nodes[i].textContent)label=nodes[i].textContent;else label=nodes[i].innerHTML;target=nodes[i].getAttribute('for');id=nodes[i].id;this.createTab(label,target,className,id,nodes[i].onclick);tabCount++;nodes[i].parentNode.removeChild(nodes[i]);}}
var found=false;for(var i=this.tabs.length-1;i>=0;i--){this.container.appendChild(this.tabs[i]);if(this.tabs[i].className=='activeTab'){wsTabControls.swapTab({target:this.tabs[i]});found=true;}}
if(!found&&this.tabs.length>0){wsTabControls.swapTab({target:this.tabs[this.tabs.length-1]});}}
this.currNode=null;}
wsTabControl.prototype.createTab=function(label,target,className,id,onclick){if(!id)id=this.container.id+'_'+target+'_tab';wsTabControls.log('Creating tab with label "'+label+'", target "'+target+'", index "'+this.tabs.length+'", and id "'+id+'"');button=new ddmlButton(label,wsTabControls.swapTab,className,id);button.target=target;button.containerId=this.container.id;buttonElement=button.getObject();if(onclick!=null)wsTabControls.addEventTo(buttonElement,'click',onclick);buttonElement.tabIndex=this.tabs.length;this.tabs.push(buttonElement);return buttonElement;}
wsTabControl.prototype.addTab=function(label,target,className,id,onclick){var tab=this.createTab(label,target,'tab',id,onclick);this.container.appendChild(tab);wsTabControls.swapTab({target:tab});return tab;}
wsTabControl.prototype.removeTab=function(tabOrTarget,removeContents){var tab=null;if(typeof tabOrTarget=='string'){for(var i=0;i<this.tabs.length;i++){if(this.tabs[i].ddmlButton&&this.tabs[i].ddmlButton.target==tabOrTarget){tab=this.tabs[i];break;}}}else tab=tabOrTarget;if(tab){var target=tab.ddmlButton.target;var index=tab.tabIndex;wsTabControls.log('Removing tab at index '+index);tab.parentNode.removeChild(tab);if(removeContents){wsTabControls.log('Removing element "'+target+'"');this.tabs.splice(tab.tabIndex,1);var contents=document.getElementById(target);if(contents)contents.parentNode.removeChild(contents);}
var nextTarget=index-1;if(this.tabs[nextTarget])wsTabControls.swapTab(this.tabs[nextTarget]);}else{wsTabControls.log('Couldn\'t find tab to remove');}}
wsTabControl.prototype.queueSwap=function(id){var controlName='wsTabControls.'+this.container.id;var func='if (!'+controlName+'.clicked) { window.status = '+controlName+'.clicked; '+controlName+'.swapContents(\''+id+'\'); }';if(window.attachEvent)window.attachEvent('onload',new Function(func));else if(window.addEventListener)window.addEventListener('load',new Function(func),false);}
wsTabControl.prototype.swapContents=function(id){var node;for(var i=0;i<this.tabs.length;i++){node=document.getElementById(this.tabs[i].ddmlButton.target);if(node)node.style.display=(this.tabs[i].ddmlButton.target==id)?'block':'none';}}

function FrontPage_Form1_Validator(theForm){if(theForm.DaInBox.value==""){alert("Please specify something for which to Search.");theForm.DaInBox.focus();return(false);}
return(true);}
function showCalendar(id){var format='%m/%d/%y';var el=document.getElementById(id);if(calendar!=null){calendar.hide();}else{var cal=new Calendar(false,null,selected,closeHandler);calendar=cal;cal.setRange(1990,2070);cal.create();}
calendar.setDateFormat(format);calendar.parseDate(el.value);calendar.sel=el;calendar.showAtElement(el,'bR');}
function selected(cal,date){if(cal.dateClicked){cal.sel.value=date;cal.callCloseHandler();}}
function closeHandler(cal){searchPageAdvanceCheckBox(cal.sel);cal.hide();}
function searchPageAdvanceCheckBox(node){while(node.nodeName.search(/tr/i)<0&&node.parentNode)node=node.parentNode;if(node.nodeName.search(/tr/i)>=0){var bFound=false;while(!bFound){if(node.nodeName.search(/tr/i)>=0){var inputs=node.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type.search(/checkbox/i)>=0){inputs[i].checked=true;bFound=true;}}}
if(node.previousSibling){node=node.previousSibling;}else{bFound=true;}}}}
function validateSearch(form){var inputs=form.getElementsByTagName('input');var bSomethingChecked=false;for(var i=0;i<inputs.length;i++){if(form.id=='advancedSearch'){(inputs[i].type=='checkbox'&&inputs[i].checked)?bSomethingChecked=true:null;}else{((inputs[i].type=='text'||inputs[i].type=='')&&inputs[i].value.replace(/ /g,'')!='')?bSomethingChecked=true:null;}}
(!bSomethingChecked)?alert('You need to search for something.'):bSomethingChecked=true;return bSomethingChecked}
function swapAdvancedSearchSubtype(node){var targetNode=node;while(node.nodeName.search(/table/i)<0&&node.parentNode)node=node.parentNode;if(node.nodeName.search(/table/i)>=0){var rows=node.getElementsByTagName('tr');for(var i=0;i<rows.length;i++){if(rows[i].id.search(/^searchPageSubtypeTR_/i)>=0){rows[i].style.display=(rows[i].id=='searchPageSubtypeTR_'+targetNode.value)?'':'none';}}}
return true;}
function cleanSearch(id){var a=document.getElementById(id);if(a){var link=a.href.replace(/.*\?(.*)/,'$1');a.href="#";a.onclick=Function("runSearch('"+link+"');"+"return false;");}else{console.log("No A");}}
function runSearch(link){var f=document.createElement('form');f.method='post';var items=link.split('&');for(var i=0;i<items.length;i++){var parts=items[i].split('=');var input=document.createElement('input');input.type='hidden';input.name=parts[0];input.value=parts[1];f.appendChild(input);}
f.action=xb.getUrlRoot();if(f.action.charAt(f.action.length-1)!="/")f.action+="/";f.action+="search/default.aspx";document.body.appendChild(f);f.submit();}

var lastNodeClickedForMyArchive=null;var nodeToDelete=null;function removeFromMyArchive(node){var retVal=true;if(node&&node.nodeName&&node.nodeName.toLowerCase()=='a'){var href=node.href.replace(/&return=\w*/i,"");if(wsAjax.canRequest()){wsAjax.runRequest(href,deleteMyArchiveResponse);retVal=false;}
nodeToDelete=node;}
return retVal;}
function addToMyArchive(node){var retVal=true;if(node&&node.nodeName&&node.nodeName.toLowerCase()=='a'){var href=node.href.replace(/&return=[^&]*/i,"");if(wsAjax.canRequest()){wsAjax.runRequest(href,addMyArchiveResponse);lastNodeClickedForMyArchive=node;retVal=false;}}
return retVal;}
function deleteMyArchiveResponse(){if(nodeToDelete){var target=nodeToDelete;while(target.parentNode&&target.className!='plusLine')target=target.parentNode;if(target.className=='plusLine'){if(target.parentNode){target=target.parentNode;if(target.parentNode)target.parentNode.removeChild(target);}}}
nodeToDelete=null;updateMyArchive('delete');}
function addMyArchiveResponse(){updateMyArchive('add');}
var responsePopupCounter=0;function updateMyArchive(requestType){ddmlCloseTopPopup();if(wsAjax.request.readyState==4){var newContent,popupText;var target=document.getElementById('myArchiveMenu');if(target){if(wsAjax.request.status==200){document.body.style.cursor='';var dummyList=document.createElement('ul');dummyList.innerHTML=wsAjax.request.responseText;var dummyItems=dummyList.getElementsByTagName('a');var currentItems=target.getElementsByTagName('a');if(requestType=='add'){if(dummyItems.length>0&&currentItems.length>0&&dummyItems[0].href.toLowerCase()==currentItems[0].href.toLowerCase()){popupText='Already saved';}else if(wsAjax.request.responseText.replace(/\s/g,'')!=''&&domChildren(dummyList).length>0){popupText='New story added';target.innerHTML=wsAjax.request.responseText;}else{popupText='Error archiving';}}else if(requestType=='delete'){if(dummyItems.length!=currentItems.length){popupText='Story Removed';target.innerHTML=wsAjax.request.responseText;}else{popupText='Error deleting from archive';}}}
if(lastNodeClickedForMyArchive){var popup=new ddmlPopup();popup.useBacking=false;popup.contents=popupText;popup.bShowToolbar=false;popup.target=new Array(lastNodeClickedForMyArchive,'right','center');popup.display();responsePopupCounter++
setTimeout('closeResponsePopup('+responsePopupCounter+')',2000);lastNodeClickedForMyArchive=null}}}}
function closeResponsePopup(id){if(responsePopupCounter==id)ddmlCloseTopPopup();}

var wsAjax=new Object();wsAjax.canRequest=function(){return(window.XMLHttpRequest||window.ActiveXObject);}
wsAjax.submitForm=function(node,handler){if(!wsAjax.canRequest()){node.submit();}else{var fauxEvent=new Object();fauxEvent.target=node;wsAjax.getLink(fauxEvent,handler);}}
wsAjax.parseForm=function(node){var retVal='';for(var i=0;i<node.elements.length;i++){var currNode=node.elements[i];switch(currNode.nodeName.toLowerCase()){case'input':case'textarea':if(currNode.nodeName.toLowerCase()!='input'||currNode.type.toLowerCase()!='button'){if(!currNode.type||(currNode.type!='radio'&&currNode.type!='checkbox')||currNode.checked){if(currNode.value.replace(/\s*/g,'')!='')retVal+=currNode.name.replace(/ /g,'%20')+'='+currNode.value.replace(/ /g,'%20')+'&';}}
break;case'select':retVal+=currNode.name+'='+currNode.options[currNode.selectedIndex]+'&';break;}}
return(retVal=='')?retVal:retVal.substr(0,retVal.length-1);}
wsAjax.getLink=function(e,handler){if(wsAjax.canRequest()){var target;if(!e)e=window.event;else if(e.nodeName)target=e;else target=(e.srcElement)?e.srcElement:e.target;if(target){while(target&&target.nodeName&&target.nodeName.toLowerCase()!='a'&&target.nodeName.toLowerCase()!='form'&&target.parentNode)target=target.parentNode;if(target.nodeName.toLowerCase()=='a'){runRequest(target.href+'&onlyContent=true',resultHandler);}else if(target.nodeName.toLowerCase()=='form'){var finalTargetString=target.action;finalTargetString+='&onlyContent=true';wsAjax.runRequest(finalTargetString,handler,wsAjax.parseForm(target));}}
return false;}else{return true;}}
function db(msg,target){if(target&&document.getElementById(target)){document.getElementById(target).innerHTML+='<span style="font-size:6px;color:lightblue;">'+msg+'</span>';}else{document.body.innerHTML+='<span style="font-size:6px;color:lightblue;">'+msg+'</span>';}}
wsAjax.request=null;wsAjax.runRequest=function(sURL,handler,sendAsPost){this.request=null;if(!this.request){if(window.XMLHttpRequest){try{this.request=new XMLHttpRequest();}catch(e){this.request=null;}}else if(window.ActiveXObject){try{this.request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{this.request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){this.request=null;}}}}
if(this.request){var tsDate,ts;tsDate=new Date();ts=tsDate.getTime();if(!handler)handler=wsAjax.resultHandler;this.request.onreadystatechange=handler;document.body.style.cursor='wait';var target=sURL+'&ts='+ts;if(sendAsPost){this.request.open('POST',target,true);this.request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");}else{this.request.open('GET',target,true);}
try{this.request.send(sendAsPost);}catch(e){this.request.send();}}
return this.request;}
wsAjax.resultHandler=function(){var retVal=-1;if(wsAjax.request.readyState==4){retVal=wsAjax.request.status;var newContent;if(wsAjax.request.status==200){newContent=wsAjax.request.responseText;document.body.style.cursor='';}else{window.status='Request failed on '+wsAjax.request.status;document.body.style.cursor='';newContent='<div class="error">We couldn\'t find the file you requested ('+wsAjax.request.status+').  Please try your request again.  If you still can\'t get your file, please contact the administrator.</div>';newContent=wsAjax.request.responseText;}
var headers=wsAjax.getResponseHeaders(wsAjax.request);if(headers['wsResponseTarget']&&headers['wsResponseTarget'].toString()!=''){var target=document.getElementById(headers['wsResponseTarget']);if(target){var action='replace';if(headers['wsResponseAction'].toString()!=''){action=headers['wsResponseAction'].toString().toLowerCase();}
switch(action){case'replace':target.innerHTML=newContent;break;case'append':target.innerHTML+=newContent;break;default:window.status='I don\'t understand a responseAction "'+action+'"';break;}
target.scrollTop=0;}else{window.status='I couldn\'t find a target area "'+headers['wsResponseTarget']+'"';}}}
return retVal}
wsAjax.getResponseHeaders=function(request){var sHeaders=request.getAllResponseHeaders();var oHeaders=new Object();oHeaders.keys=new Array();if(sHeaders!=''){var headers=sHeaders.split('\n');var headerRegExp=new RegExp('([^\:]*)\:(.*)','i');var prefix,suffix;for(var i in headers){prefix=headers[i].replace(headerRegExp,'$1');suffix=headers[i].replace(headerRegExp,'$2');if(prefix!=''&&suffix!=''){suffix=suffix.replace(/^\s+/,'').replace(/\s+$/,'');oHeaders[prefix]=suffix;oHeaders.keys.push(prefix);}}}
return oHeaders;}

var ddml_INTERNAL_validDrag=true;function ddmlPopupDragStart(ele,dx,dy){ddml_INTERNAL_validDrag=(xMoz||(ele.className&&(ele.className=='ddmlPopupHeader'||ele.className=='ddmlPopupTitle')));}
function ddmlPopupDrag(ele,dx,dy){if(ddml_INTERNAL_validDrag)xMoveTo(ele.parentNode.parentNode,xLeft(ele.parentNode.parentNode)+dx,xTop(ele.parentNode.parentNode)+dy);}
var ddmlActivePopups=new Array();var ddml_INTERNAL_activePopupFormRegister=new Array();function ddmlPopup(sName,sTitle){this.debug=arguments[2]||false;this.name=(sName)?sName:'';this.id='';this.title=sTitle;this.icon='';this.bShowToolbar=true;this.bAllowDrag=true;this.bAllowMaximize=false;this.bAllowMinimize=false;this.bShowClose=true;this.bCloseRightClickMenus=true;this.bShowMask=true;this.bAllowEscape=true;this.contents='';this.width=null;this.height=null;this.target=null;this.padding=30;this.bFade=true;this.fadeSpeed=50;this.fadeSize=.1;this.bIgnoreWidthBoundaries=false;this.bIgnoreHeightBoundaries=false;this.index=null;this.useBacking=!xMoz;this.body=null;this.inner=null;this.reNum=new RegExp('^[0-9\-]*$');}
function ddmlPopupToString(bShowContents){var contents;if(bShowContents)contents='"\n Contents:"'+(typeof this.contents=='string')?this.contents:this.contents.outerHTML;else contents='';return'Popup name:"'+this.name+'\n", ID:"'+this.id+contents+'"';}
ddmlPopup.prototype.toString=ddmlPopupToString;ddmlPopup.prototype.display=function(oParent){var bContinue=true;if(this.onBeforeDisplay)bContinue=this.onBeforeDisplay();if(!bContinue)return;this.body=document.createElement('div');this.body.style.textAlign='center';this.body.className='ddmlPopupOuter';if(this.id)this.body.id=this.id;var innerDiv=document.createElement('div');innerDiv.className='ddmlPopupInner';var popupBacking;if(this.useBacking){if(this.debug)ddmlAddThread('debug_ddmlPopup.display','ddml','Adding an iframe back for IE select hiding');innerDiv.className+='Backed';popupBacking=document.createElement('iframe');popupBacking.className='ddmlPopupIframeBack';popupBacking.name='ddmlPopupIframeBack';popupBacking.style.zIndex=-100;this.body.appendChild(popupBacking);popupBacking.style.dispay='';}
var header;if(this.bShowToolbar){if(this.debug)ddmlAddThread('debug_ddmlPopup.display','ddml','Adding a toolbar to the popup "'+this.name+'"');header=document.createElement('div');header.className='ddmlPopupHeader';if(this.icon||this.title){var titleNode=document.createElement('div');titleNode.className='ddmlPopupTitle';if(typeof this.icon=='string')titleNode.innerHTML=this.icon+this.title;else{titleNode.appendChild(this.icon);titleNode.appendChild(document.createTextNode(this.title));}
header.appendChild(titleNode);}
var closeButton=new ddmlButton('X',ddmlCloseThisPopupE,'ddmlPopupButton');var maximizeButton=new ddmlButton('|=|',ddmlMaximizeThisPopupE,'ddmlPopupButton');var minimizeButton=new ddmlButton('||',null,'ddmlPopupButton');var debugButton=new ddmlButton('?',ddmlDebugThisPopupE,'ddmlPopupButton');if(this.bShowClose)header.appendChild(closeButton.getObject());if(this.bAllowMaximize)header.appendChild(maximizeButton.getObject());if(this.bAllowMinimize)header.appendChild(minimizeButton.getObject());if(this.debug)header.appendChild(debugButton.getObject());innerDiv.appendChild(header);}
if(typeof this.contents=='string'){if(this.debug)ddmlAddThread('debug_ddmlPopup.display','ddml','Inserting string-based contents "'+this.contents+'"');var contents=document.createElement('div');contents.innerHTML=this.contents;innerDiv.appendChild(contents);}else if(this.contents&&this.contents.nodeName){if(this.debug)ddmlAddThread('debug_ddmlPopup.display','ddml','Inserting a node '+getElementIDString(this.contents)+' into the popup "'+this.name+'"');this.contents.style.display='block';this.contents.style.visibility='visible';innerDiv.appendChild(this.contents);}else{ddmlAddThread('error_ddmlPopup.display','ddml','No valid contents were declared - '+getElementIDString(contents)+' was passed.');}
this.body.appendChild(innerDiv);this.body.style.position='absolute';this.body.style.top='0px';this.body.style.left='0px';this.body.style.display='block';document.body.appendChild(this.body);this.size();if(this.target&&this.target.length==3&&this.target[0].nodeName){var newTop=xPageY(this.target[0])-xHeight(this.body);var newBottom=xPageY(this.target[0])+xHeight(this.target[0])+xHeight(this.body);var newLeft=xPageX(this.target[0])-xWidth(this.body);var newRight=xPageX(this.target[0])+xWidth(this.target[0])+xWidth(this.body);if(!this.bIgnoreWidthBoundaries){switch(this.target[1].toLowerCase()){case'left':if(this._distanceFrom('left',newLeft)<0&&this._distanceFrom('left',newLeft)<this._distanceFrom('right',newRight)){this.target[1]='right';}
break;case'right':if(this._distanceFrom('right',newRight)<0&&this._distanceFrom('right',newRight)<this._distanceFrom('left',newLeft)){this.target[1]='left';}
break;}}
if(!this.bIgnoreHeightBoundaries){switch(this.target[2].toLowerCase()){case'top':if(this._distanceFrom('top',newTop)<0&&this._distanceFrom('top',newTop)<this._distanceFrom('bottom',newBottom)){this.target[2]='bottom';}
break;case'bottom':if(this._distanceFrom('bottom',newBottom)<0&&this._distanceFrom('bottom',newBottom)<this._distanceFrom('top',newTop)){this.target[2]='top';}
break;}}}
this.position();this.register(oParent);if(this.bFade){if(this.body.currentStyle)this._existingIEFilter=this.body.currentStyle.filter;if(!this._existingIEFilter||this._existingIEFilter=='undefined')this._existingIEFilter='';this.fade(0);setTimeout('ddmlPopupFade('+this.index+', 1)',this.fadeSpeed);}
if(this.bAllowDrag&&header){if(this.debug)ddmlAddThread('debug_ddmlPopup.display','ddml','Enabling drag for the popup "'+this.name+'"');var finalDragEvent=(this.onDragEnd)?this.onDragEnd:null;xEnableDrag(header,ddmlPopupDragStart,ddmlPopupDrag,finalDragEvent);}
var inputs=this.body.getElementsByTagName('input');var bFound=false;for(var i=0;i<inputs.length;i++){if(inputs[i].type.search(/hidden/i)<0&&isNodeVisible(inputs[i])){bFound=true;inputs[i].focus();break;}}
if(!bFound){var selects=this.body.getElementsByTagName('select');for(var i=0;i<selects.length;i++){if(selects[i].type.search(/hidden/i)<0&&isNodeVisible(selects[i])){selects[i].focus();break;}}}
if(this.onAfterDisplay)this.onAfterDisplay();display=this.body;}
ddmlPopup.prototype.maximize=function(){this.width=xClientWidth()-(this.padding);this.height=xb.clientHeight()-(this.padding);if(this.debug)ddmlAddThread('debug_ddmlPopup.maximize','ddml','Maximizing the popup "'+this.name+'" to width='+this.width+' and height='+this.height);}
ddmlPopup.prototype.size=function(){if(this.width&&this.reNum.test(this.width))xWidth(this.body,this.width);if(this.height&&this.reNum.test(this.height))xHeight(this.body,this.height);if(this.useBacking)xResizeTo(this.body.getElementsByTagName('iframe')[0],xWidth(this.body),xHeight(this.body));if(this.debug)ddmlAddThread('debug_ddmlPopup.size','ddml','Attempted to resize the popup "'+this.name+'" to width='+this.width+' and height='+this.height+'.  Actual results are width='+xWidth(this.body)+' height='+xHeight(this.body)+'.  If these numbers differ, the content of your popup '+'couldn\'t be compressed and needs to be sized appropriatley before being added.');}
ddmlPopup.prototype.position=function(){var screenWidth=xClientWidth();var screenHeight=xb.clientHeight();var width=xWidth(this.body);var height=xHeight(this.body);var newTop=xScrollTop()+(screenHeight/2-height/2);var newLeft=xScrollLeft()+(screenWidth/2-width/2);if(this.target&&this.target.length&&this.target.length==3){if(this.target[0].nodeName){var target=this.target[0];var targetTop=xPageY(target);var targetLeft=xPageX(target);var targetHeight=xHeight(target);var targetWidth=xWidth(target);switch(this.target[1]){case'middle':newLeft=targetLeft+targetWidth/2-width/2;if(!this.bIgnoreWidthBoundaries){if(newLeft<xScrollLeft())newLeft=xScrollLeft();if(newLeft+width>=xClientWidth()+xScrollLeft())newLeft=xClientWidth()+xScrollLeft()-width;}
break;case'left':newLeft=targetLeft-width;break;case'right':newLeft=targetLeft+targetWidth;break;default:if(this.reNum.test(this.target[1])){newLeft=targetLeft+(this.target[1]*1);}
break;}
switch(this.target[2]){case'center':newTop=targetTop+targetHeight/2-height/2;if(!this.bIgnoreHeightBoundaries){if(newTop<xScrollTop())newTop=xScrollTop();if(newTop+height>=xb.clientHeight()+xScrollTop())newTop=xb.clientHeight()+xScrollTop()-height;}
break;case'top':newTop=targetTop-height;break;case'bottom':newTop=targetTop+targetHeight;break;default:if(this.reNum.test(target[2]))newTop=targetTop+parseInt(target[2]);break;}}}
else if(this.target&&this.target.length&&this.target.length==2){switch(this.target[0]){case'middle':break;case'left':newLeft=0;break;case'right':newLeft=screenWidth-width;break;default:if(this.reNum.test(this.target[0]))newLeft=parseInt(this.target[0]);break;}
switch(this.target[1]){case'center':break;case'top':newTop=0;break;case'bottom':newTop=screenHeight-height;break;default:if(this.reNum.test(this.target[1]))newTop=parseInt(this.target[1]);break;}
if(!this.bIgnoreHeightBoundaries){if(newTop+height>screenHeight+xScrollTop())newTop=screenHeight-height;if(newTop<0)newTop=0;}
if(!this.bIgnoreWidthBoundaries){if(newLeft+width>screenWidth+xScrollLeft())newLeft=screenWidth-width;if(newLeft<0)newLeft=0;}}
if(this.debug)ddmlAddThread('debug_ddmlPopup.position','ddml','Moving the popup "'+this.name+'" to x='+newLeft+', y='+newTop);xLeft(this.body,newLeft);xTop(this.body,newTop);}
ddmlPopup.prototype._distanceFrom=function(side,value){var retVal=0;switch(side.toLowerCase()){case'left':if(!value)value=xLeft(this.body);retVal=value-xScrollLeft();break;case'right':if(!value)value=xLeft(this.body)+xWidth(this.body);retVal=xClientWidth()+xScrollLeft()-value;break;case'top':if(!value)value=xTop(this.body);retVal=value-xScrollTop();break;case'bottom':if(!value)value=xTop(this.body)+xHeight(this.body);retVal=xb.clientHeight()+xScrollTop()-value;break;}
return retVal;}
ddmlPopup.prototype.fade=function(counter){var newFade1Scale=(counter*this.fadeSize>1)?1:counter*this.fadeSize;newFade1Scale=Math.round(newFade1Scale*10)/10;this.body.style.opacity=newFade1Scale;this.body.style.filter=this._existingIEFilter+' progid:DXImageTransform.Microsoft.Alpha(opacity='+(newFade1Scale*100)+', style=0)';counter++;if(newFade1Scale<1&&ddmlActivePopups[this.index]&&ddmlActivePopups[this.index].fade)
setTimeout('ddmlPopupFade('+this.index+', '+counter+')',this.fadeSpeed);else{var origFilter=this.body.style.filter;this.body.style.filter=this._existingIEFilter;}}
ddmlPopup.prototype.register=function(oParent){this.body.ddmlPopup=ddmlActivePopups.length;this.index=ddmlActivePopups.length;ddmlActivePopups.push(this);}
ddmlPopup.prototype.destroy=function(){if(this.body&&!this.nodeName){var bContinue=(window.localPopupDestroy)?localPopupDestroy(this):true;if(this.onBeforeClose)bContinue=this.onBeforeClose();if(!bContinue)return;if(this.debug)ddmlAddThread('debug_ddmlPopup.destroy','ddml','Removing DOM references to popup "'+this.toString()+'"');var forms=this.body.getElementsByTagName('form');var bContinue=true;if(forms.length>0){for(var i=ddml_INTERNAL_activePopupFormRegister.length-1;i>=0;i--){if(this.debug)ddmlAddThread('debug_ddmlPopup.destroy','ddml','Destroying saved item, '+getElementIDString(ddml_INTERNAL_activePopupFormRegister[i]));for(var j=0;j<forms.length;j++){if(forms[j]==ddml_INTERNAL_activePopupFormRegister){bContinue=false;break;}}
if(bContinue&&ddml_INTERNAL_activePopupFormRegister[i]){ddmlRemoveNode(ddml_INTERNAL_activePopupFormRegister[i]);}
bContinue=true;}
ddml_INTERNAL_activePopupFormRegister=new Array();for(var i=forms.length-1;i>=0;i--){if(forms[i]&&forms[i].style){forms[i].style.display='none';forms[i].name+=new Date();if(this.debug)ddmlAddThread('debug_ddmlPopup.destroy','ddml','Backing up item, '+getElementIDString(forms[i]));ddml_INTERNAL_activePopupFormRegister.push(document.body.appendChild(forms[i]));}}}
ddmlRemoveNode(this.body,true);if(this.debug)ddmlAddThread('debug_ddmlPopup.destroy','ddml','Destryoing popup at index '+this.index+' of '+ddmlActivePopups.length);ddmlActivePopups.splice(this.index-1,1);if(this.debug)ddmlAddThread('debug_ddmlPopup.destroy','ddml','New length after destruction:'+ddmlActivePopups.length+'.');for(var i=0;i<ddmlActivePopups.length;i++){ddmlActivePopups[i].index=i+1;if(ddmlActivePopups[i].body)ddmlActivePopups[i].body.ddmlPopup=i+1;}}else{ddmlAddThread('error_ddmlPopup.destroy','ddml','The destroy function for popup '+this+' was called, but the popup had no content.  No popup destruction will occur.');}
this.body=null;this.contents=null;this.reNum=null;if(this.onAfterClose)bContinue=this.onAfterClose();}
function ddmlGetThisPopup(node){var origNode=node;if(node){while(node.ddmlPopup==null&&node.parentNode&&node.parentNode.nodeType&&node.parentNode.nodeType==1)node=node.parentNode;if(node.ddmlPopup!=null){return ddmlActivePopups[(node.ddmlPopup*1)];}}
ddmlAddThread('error_ddmlGetThisPopup','ddml','System tried to get a popup and failed.  Called was '+getElementIDString(origNode)+' and last node looked at was '+getElementIDString(node));return null;}
function ddmlGetTopPopup(){if(ddmlActivePopups.length>0&&ddmlActivePopups[ddmlActivePopups.length-1].bAllowEscape){return ddmlActivePopups[ddmlActivePopups.length-1];}else{return null;}}
function ddmlCloseThisPopupE(e){var event=new xEvent(e);ddmlCloseThisPopup(event.target);}
function ddmlCloseThisPopup(node){var popup=ddmlGetThisPopup(node);if(popup){popup.destroy();return true;}
ddmlAddThread('error_ddmlCloseThisPopup','ddml','System tried to close a popup and failed.  Called was '+getElementIDString(node)+' and the popup object was '+popup);return false;}
function ddmlMaximizeThisPopupE(e){var event=new xEvent(e);ddmlMaximizeThisPopup(event.target);}
function ddmlMaximizeThisPopup(node){var popup=ddmlGetThisPopup(node);if(popup){ddmlAddThread('debug_ddmlMaximizeThisPopup','ddml','Maximizing popup at index '+i+' of '+ddmlActivePopups.length);popup.maximize();popup.size();popup.position();return true;}
ddmlAddThread('error_ddmlMaximizeThisPopup','ddml','System tried to maximize a popup and failed.  Called was '+getElementIDString(node)+' and the popup object was '+popup);return false;}
function ddmlCloseAllPopups(){for(var i=ddmlActivePopups.length-1;i>=0;i--){ddmlActivePopups[i].destroy();}
ddmlActivePopups=new Array();}
function ddmlCloseTopPopup(){if(ddmlActivePopups.length>0&&ddmlActivePopups[ddmlActivePopups.length-1].bAllowEscape)ddmlActivePopups[ddmlActivePopups.length-1].destroy();}
function ddmlDebugThisPopupE(e){var event=new xEvent(e);ddmlDebugThisPopup(event.target);}
function ddmlDebugThisPopup(node){var popup=ddmlGetThisPopup(node);if(popup){alert(popup.toString(true));return true;}
ddmlAddThread('error_ddmlMaximizeThisPopup','ddml','System tried to maximize a popup and failed.  Called was '+getElementIDString(node)+' and the popup object was '+popup);return false;}
function ddmlGetCurrentPopupTrace(){ddmlAddThread('debug_ddmlPopups','ddml',ddmlActivePopups.length+' popups are currently registered in the system.');for(var i=0;i<ddmlActivePopups.length;i++){ddmlAddThread('debug_ddmlPopups','ddml','Popup #'+(i+1)+' - '+ddmlActivePopups[i]);}}
function ddmlPopupFade(popupIndex,counter){if(ddmlActivePopups[popupIndex]){ddmlActivePopups[popupIndex].fade(counter);}}
if(window.addEventListener)window.addEventListener('keydown',clearTopPopupOnEscape,false);else if(window.attachEvent){window.attachEvent('onload',function(){document.body.attachEvent('onkeypress',clearTopPopupOnEscape);});}
function clearTopPopupOnEscape(e){if(!e)e=window.event;if(e.keyCode==27)ddmlCloseTopPopup();}
function ddmlAddThread(){return false;};function ddmlRemoveNode(node){node.parentNode.removeChild(node);node.innerHTML='';node=null;}
function isNodeVisible(oNode){var retVal=true;var loopNode=oNode;while(retVal&&loopNode.parentNode){if(loopNode.style.display.toLowerCase()=='none'||xb.getStyle(loopNode,'display').toLowerCase()=='none'||xb.getStyle(loopNode,'visibility').toLowerCase()=='hidden'||loopNode.style.visibility.toLowerCase()=='hidden'){retVal=false;}
loopNode=loopNode.parentNode;}
return retVal;}
function domChildren(parentNode){if(parentNode){var retVal=false;if(parentNode.children){retVal=parentNode.children;}else if(parentNode.childNodes){retVal=new Array();for(var i=0;i<parentNode.childNodes.length;i++){(parentNode.childNodes[i].nodeType==1)?retVal.push(parentNode.childNodes[i]):null;}}
return retVal;}else{return new Array();}}
function getElementIDString(node){if(!node||!node.nodeName)return'(Invalid node)';else return node.nodeName+' (id='+node.id+')';}

function StoryTab(title,body){this.maxTitleLength=StoryTab.maxTitleLength;this.tabContainerId=StoryTab.tabContainerId;this.contentContainerId=StoryTab.contentContainerId;this.title=title;if(this.title.length>this.maxTitleLength)this.title=this.title.substring(0,this.maxTitleLength-3)+'...';this.title='Story: '+this.title;this.body=body;this.contentId=this.tabContainerId+'_'+this.title.replace(/[^\w]/g,'');this.tabId=this.contentId+'_tab'
this.build();}
StoryTab.prototype={tab:null,build:function(){var contentContainer=document.getElementById(this.contentContainerId);var tabContainer=wsTabControls[this.tabContainerId];if(contentContainer&&tabContainer){var newDiv=document.createElement('div');newDiv.innerHTML=this.body;newDiv.id=this.contentId;contentContainer.appendChild(newDiv);this.tab=tabContainer.addTab(this.title,this.contentId,'storyTab',this.tabId);StoryTab.objectCache.push(this);}},remove:function(){var tabContainer=wsTabControls[this.tabContainerId];if(tabContainer){tabContainer.removeTab(this.tab,true);}}}
StoryTab.objectCache=[];StoryTab.removeAll=function(){var toRemove=null;for(var i=0;i<StoryTab.objectCache.length;i++){toRemove=StoryTab.objectCache.splice(i,1);toRemove[0].remove();}}
StoryTab.maxTitleLength=40;StoryTab.contentContainerId='contentContainer';StoryTab.tabContainerId='tabContainer';

var fontSizeControl_INTERNAL_targetNode;var fontSizeControl_INTERNAL_sizeStep;var fontSizeControl_INTERNAL_fontSizeRegExp='^([0-9.]*)([pxtem]*)$';var fontSizeControl_INTERNAL_cookieName='fontSizeControl.lastUsed';var fontSizeControl_INTERNAL_showVisualFeedback=true;function fontControlSetVisualFeedback(bDisable){fontSizeControl_INTERNAL_showVisualFeedback=bDisable;}
function createFontSizeControl(fontNode,label,step,placementNode,smallerDivContent,largerDivContent,extraContent){fontSizeControl_INTERNAL_targetNode=fontNode;var findFontSizeNode=fontNode
var bFound=false;var fontSize=getCookie(fontSizeControl_INTERNAL_cookieName);while(!bFound&&findFontSizeNode.parentNode){if(findFontSizeNode.style.fontSize){fontNode.style.fontSize=(fontSize)?fontSize:findFontSizeNode.style.fontSize;bFound=true;}else if(getStyle(findFontSizeNode,'fontSize','font-size')){fontNode.style.fontSize=(fontSize)?fontSize:getStyle(findFontSizeNode,'fontSize','font-size');bFound=true;}else{findFontSizeNode=findFontSizeNode.parentNode;}}
fontSizeControl_INTERNAL_sizeStep=(step>0)?step:1;var containerDiv=document.createElement('div');containerDiv.className='fontSizeControlContainer';var smallerDiv=document.createElement('div');smallerDiv.className='fontSizeControlSmallerDiv fontSizeControlMouseUp fontSizeControlMouseOut';smallerDiv.onmouseover=fontSizeControlMouseOver;smallerDiv.onmouseout=fontSizeControlMouseOut;smallerDiv.onmousedown=fontSizeControlMouseDown;smallerDiv.onmouseup=fontSizeControlMouseUp;smallerDiv.onclick=fontSizeControlDownOnclick;smallerDiv.innerHTML=(smallerDivContent)?smallerDivContent:' ';var largerDiv=document.createElement('div');largerDiv.className='fontSizeControlLargerDiv fontSizeControlMouseUp fontSizeControlMouseOut';largerDiv.onmouseover=fontSizeControlMouseOver;largerDiv.onmouseout=fontSizeControlMouseOut;largerDiv.onmousedown=fontSizeControlMouseDown;largerDiv.onmouseup=fontSizeControlMouseUp;largerDiv.onclick=fontSizeControlUpOnclick
largerDiv.innerHTML=(largerDivContent)?largerDivContent:' ';var labelDiv=document.createElement('div');labelDiv.className='fontSizeControlLabel';var extraDiv=document.createElement('div');extraDiv.className='fontSizeControlExtra';(extraContent)?extraDiv.innerHTML=extraContent:null;containerDiv.appendChild(smallerDiv);containerDiv.appendChild(largerDiv);containerDiv.appendChild(labelDiv);containerDiv.appendChild(extraDiv);(placementNode)?placementNode.appendChild(containerDiv):null;return containerDiv;}
function fontSizeControlGetNextExpirationDate(){var seed=(new Date()).getTime();return new Date(seed+1000*60*60*24*30);}
function fontSizeControlMouseOver(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;(currentTarget.className.search(/fontSizeControlMouseOver/i)<0&&fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className+=' fontSizeControlMouseOver':null;(fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className=currentTarget.className.replace(/\s*fontSizeControlMouseOut/i,''):null;}
function fontSizeControlMouseOut(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;(currentTarget.className.search(/fontSizeControlMouseOut/i)<0&&fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className+=' fontSizeControlMouseOut':null;(fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className=currentTarget.className.replace(/\s*fontSizeControlMouseOver/i,''):null;}
function fontSizeControlMouseDown(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;(currentTarget.className.search(/fontSizeControlMouseDown/i)<0&&fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className+=' fontSizeControlMouseDown':null;(fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className=currentTarget.className.replace(/\s*fontSizeControlMouseUp/i,''):null;}
function fontSizeControlMouseUp(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;(currentTarget.className.search(/fontSizeControlMouseUp/i)<0&&fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className+=' fontSizeControlMouseUp':null;(fontSizeControl_INTERNAL_showVisualFeedback)?currentTarget.className=currentTarget.className.replace(/\s*fontSizeControlMouseDown/i,''):null;}
function fontSizeControlDownOnclick(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;fontSizeControlSetSize(currentTarget,-1);}
function fontSizeControlUpOnclick(e){e=(e)?e:window.event;currentTarget=(e.currentTarget)?e.currentTarget:e.srcElement;fontSizeControlSetSize(currentTarget,1);}
function fontSizeControlSetSize(node,positiveOrNegative){if(!positiveOrNegative)positiveOrNegative=1;var sizeRegExp=new RegExp(fontSizeControl_INTERNAL_fontSizeRegExp,'i');var parts=sizeRegExp.exec(fontSizeControl_INTERNAL_targetNode.style.fontSize);var actualStep=fontSizeControl_INTERNAL_sizeStep;switch(parts[2].toLowerCase()){case'em':actualStep=Math.ceil(actualStep*1)/10;break;case'%':actualStep=actualStep*10;break;}
actualStep*=positiveOrNegative;var newSize=(parseFloat(parts[1])+actualStep)+parts[2];fontSizeControl_INTERNAL_targetNode.style.fontSize=newSize;setCookie(fontSizeControl_INTERNAL_cookieName,newSize,fontSizeControlGetNextExpirationDate());}
function getStyle(node,cssProperty,GeckoProperty){if(node.currentStyle){return node.currentStyle[cssProperty];}else if(window.getComputedStyle){if(node.nodeType==1){var elstyle=document.defaultView.getComputedStyle(node,"");var propToUse=(GeckoProperty)?GeckoProperty:cssProperty;return elstyle.getPropertyValue(propToUse);}else{return null;}}}
if(!window.setCookie){function setCookie(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=curCookie;}}
if(!window.getCookie){function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else
begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}}
if(!window.console){window.console={};window.console.log=function(str){alert(str);};}
