//Copyright 2008, Grazr Corporation
document.domain="grazr.com";if (!Array.map){Array.prototype.map=function(fn /*, thisp*/){var len=this.length;if (typeof fn !="function"){alert(fn);alert(typeof fn)};var res=new Array(len);var thisp=arguments[1];for (var i=0;i < len;i++){if (i in this) res[i]=fn.call(thisp, this[i], i, this)};return res}};var handler=new Array();function cleanTransfer(num){var appBlock=document.getElementById("grazr");if( handler[num]){var target=document.getElementById("xid"+num);target.parentNode.removeChild(target);handler[num]=null}};function nullTransfer(num){var target=document.getElementById("xid"+num);target.src=null;target.parentNode.removeChild(target);handler[num].callback=function(){}};function xdReceive(num,data){if(handler[num]){handler[num].callback(data,handler[num].arg);data=null;setTimeout(function(){cleanTransfer(num)},100)}else{}};gzE={};function grazrEvent(e){e=e || window.event;if(!e.target){e.target=e.srcElement};if(window.gzHookEvent && window.gzHookEvent(e) ){if(e.preventDefault){e.preventDefault()};if(e.stopPropagation){e.stopPropagation()};e.cancelBubble=true;return false}else{var id=this.events[e.type];if(id){var target=gzE[id].target || this;e.gztarget=target;if(e.target.bypass){if(e.stopPropagation){e.stopPropagation()};e.cancelBubble=true;e.gztarget=null;return true};var retval=gzE[id].listener.apply(target,[e]);target=null;e.gztarget=null;if(retval){e.returnValue=retval;return retval}else{if(e.preventDefault){e.preventDefault()};if(e.stopPropagation){e.stopPropagation()};e.cancelBubble=true;e.returnValue=retval;return retval}}}};function Grazr(){function Translator(App){this.setLanguage=function(language){};if(window.language_table){App.xl=function(text){return window.language_table[text] || text}}else{App.xl=function(text){return text}}};var resigAddEvent=function(){if ( window.attachEvent ){return function(obj, type, fn){obj['on'+type]=fn}}else{return function(obj, type, fn){obj.addEventListener( type, fn, false )}}}();var resigRemoveEvent=function(){if ( window.detachEvent ){return function( obj, type, fn ){obj['on'+type]=null}}else{return function( obj, type, fn ){obj.removeEventListener( type, fn, false )}}}();function clearAllEvents(obj){var target=obj.display || obj;for(var type in target.events){var id=target.events[type];resigRemoveEvent(target,type,window.grazrEvent);delete gzE[id]}};function clearEvent(obj,type){var target=obj.display || obj;var id=target.events[type];resigRemoveEvent(target,type,window.grazrEvent);delete gzE[id]};function regEvent(obj,type,method){regEvent.eid++;gzE[regEvent.eid]={};gzE[regEvent.eid].type=type;gzE[regEvent.eid].listener=method;gzE[regEvent.eid].target=obj;var domobj=obj.getDisplay();if(!domobj.events){domobj.events={}};domobj.events[type]=regEvent.eid;resigAddEvent(domobj,type,window.grazrEvent);type=null;domobj=null;method=null;obj=null;return regEvent.eid};regEvent.eid=0;function Message(App){this.info=function(txt,duration){alert(txt)}};function ClipBoard(App){var myClipboardId="cb"+Math.round(Math.random()*65000);window.name=myClipboardId;var clipboard=null;var storage=null;this.data={};function setCookie(cookies){for(var prop in cookies){document.cookie=prop+"="+cookies[prop]+";path=/;domain=grazr.com"}};function deleteCookie(key){document.cookie=key+"=;path=/;domain=grazr.com"};function getCookies(key){var allcookies=document.cookie.split(";");var mycookie={};for(var i=0;i<allcookies.length;i++){var pair=allcookies[i].split("=");var name=(pair[0])?pair[0].replace(/\s/g,""):null;var value=(pair[1])?pair[1].replace(/\s/g,""):null;mycookie[name]=value};if(key) return mycookie[key];else return mycookie};this.clearClipboard=function(force){if(force || (clipboard==myClipboardId)){document.cookie="clip=;path=/;domain=grazr.com"}};this.getClipboard=function(){return};function objToJson(data){var json='';var nochildren=true;if(data && data.attribute && data.attribute.type && data.attribute.type.match(/rss|include/)){nochildren=false};for(var prop in data){switch(typeof data[prop]){case 'object': if(data[prop].length){if(nochildren){json+="childNodes:[";for(var i=0,j=data[prop].length;i<j;i++){json+="{"+objToJson(data[prop][i]).replace(/\,$/,'')+"},"};json=json.replace(/\,$/,'');json+="],"}}else{json+=prop+":{"+objToJson(data[prop]).replace(/\,$/,'')+"},"};break;default: var val=data[prop];if(val){val=val.replace(/\"/g,"\\\"");json+=prop+":\""+val+"\","}}};return json};function makeJson(data){return "{"+objToJson(data).replace(/\,$/,'')+"}"};this.store=function(key,data){var json=encodeURIComponent("{\""+key.replace(/\:/,'\\:')+"\":"+makeJson(data)+"}");setCookie({"clipboard":json});if(getCookies('clipboard')==json){return true}else{var Pipe=new DataPipe();Pipe.post("/store",{'key':encodeURIComponent(key),'json':json});var json=encodeURIComponent("{\""+key.replace(/\:/,'\\:')+"\":\"serverclip\"}");setCookie({"clipboard":json});return false};return true};this.load=function(key){eval("var jsobj="+decodeURIComponent(getCookies('clipboard')));document.cookie="clipboard=;path=/;domain=.grazr.com";return (jsobj)?jsobj[key] || null:null}};function UserObject(App){function getCookies(key){var allcookies=document.cookie.split(";");var mycookie={};for(var i=0;i<allcookies.length;i++){var pair=allcookies[i].split("=");var name=(pair[0])?pair[0].replace(/\s/g,""):null;var value=(pair[1])?pair[1].replace(/\s/g,""):null;mycookie[name]=value};if(key) return mycookie[key];else return mycookie};this.mycookies=getCookies();this.autoset=(this.mycookies["autosubscribe"] || this.mycookies["autopost_twitter"] || this.mycookies["autopost_blog"]);this.getUserPrefsFromServer=function(){Pipe=new DataPipe();Pipe.getScript("http://grazr.com/user/json","App.user.userPrefsResult")};this.userPrefsResult=function(){var userInfo=arguments[0];if (userInfo){for (var x in userInfo){this.mycookies[x]=userInfo[x]}}};this.getUserPrefs=function(){if(this.mycookies["sessionid"] && !this.autoset){this.userPrefs=this.getUserPrefsFromServer()}};this.getUserPrefs()};function AutoPoster(App){function setCookie(cookies){for(var prop in cookies){document.cookie=prop+"="+cookies[prop]+";path=/;domain=grazr.com"}};function getLastFeedNode(){var idarray=App.datamanager.activeNode.id.toString().split('.');var rootnode=App.datamanager.rootNode;var feedurl="none";var outline=rootnode;for(var i=0,j=idarray.length;i<j;i++){if(idarray[i]=="-1"){if(outline.attribute.type=="rss"){feedurl=outline.attribute.xmlUrl || outline.attribute.xmlurl || outline.attribute.url || outline.attribute.URL || feedurl};feedurl=rootnode.attribute.xmlUrl || rootnode.attribute.xmlurl || feedurl}else{outline=outline.childNodes[idarray[i]].outline;if(outline.attribute.type=="rss"){feedurl=outline.attribute.xmlUrl || outline.attribute.xmlurl || outline.attribute.url || outline.attribute.URL || feedurl}}};return encodeURIComponent(feedurl)};this.subscribe=function(){var feed=getLastFeedNode();if (feed=='none'){return false};if(App.user.mycookies["autosubscribe_reader"]){var suburl='http://grazr.com/autosubscribe?file='+encodeURIComponent(feed);window.open(suburl,"_blank")}else{window.open("http://grazr.com/settings/postsubscribe","_blank")};return true};this.pipe=new DataPipe();this.result=function(){if (App.auto.pipe.req.readyState==4 && App.auto.pipe.req.status==200){var resp;eval("resp="+App.auto.pipe.req.responseText);App.mesg.info(resp.message)}};this.scriptResult=function(){App.mesg.info(arguments[0].message)};this.blogPost=function(type){switch(type){case 'twitter': if(App.user.mycookies["autopost_twitter"]*1){this.pipe.getScript('http://grazr.com/autopost/twitter?gzconfig='+encodeURIComponent(App.confManager.getURLstring()),"App.auto.scriptResult")}else{window.open("http://grazr.com/settings/postsubscribe","_blank")};break;default: if(App.user.mycookies["autopost_blog"]*1){this.pipe.getScript('http://grazr.com/autopost/blog?gzconfig='+encodeURIComponent(App.confManager.getURLstring()),"App.auto.scriptResult")}else{window.open("http://grazr.com/settings/postsubscribe","_blank")};break}}};function FXengine(fps){var local=this;var timeInt=1;var running=false;var effects=new Array();function construct(){timeInt=((1/fps) * 1000).toFixed(0)};function Iterator(){running=true;var iscomplete=false;var nextQueue=new Array();for(var i=0;i<effects.length;i++){iscomplete=effects[i].step();if(!iscomplete){nextQueue.push(effects[i])}};effects=nextQueue;if(effects.length > 0){setTimeout(Iterator,timeInt)}else{running=false}};this.start=function(){if(!running){Iterator()}};this.addAction=function(action){action.setInterval(timeInt);action.setEngine(local);effects.push(action);if(!running){local.start()}};construct()};function FXaction(duration){var local=this;var interval=0;var engine=null;var frames=0;var totalframes=0;var value=0;var valueInterval=0;var trigger=null;var pauseVal=false;this.animFunction=function(frac){};this.chainTo=function(action){trigger=action};this.pause=function(){pauseVal=true};this.unpause=function(){pauseVal=false};this.step=function(){if(!pauseVal){value+=valueInterval;var rounded=value.toFixed(5);local.animFunction(rounded);frames++;if(frames >=totalframes){if(trigger){engine.addAction(trigger)};return true}else{return false}};return false};this.setEngine=function(ineng){engine=ineng};this.setInterval=function(timeint){frames=0;value=0;if(duration==0){totalframes=0;value=1}else{interval=timeint;totalframes=Math.round(1000*duration / interval);valueInterval=1 / totalframes}};this.reset=function(){}};function registerHandler(num,handlerFunction,argument){handler[num]={callback:handlerFunction,arg:argument}};function XDataPipe(){var local=this;var appBlock=null;var sblock=null;var address=null;var options="";var xid=-1;this.setupPipe=function(inadd){local.initPipe();address=inadd};this.setOptions=function(inoptions){options=inoptions};this.genericFetch=function(uri){appBlock=document.getElementById("grazr");if(appBlock){sblock=document.createElement("script");sblock.setAttribute('charset','utf-8');sblock.setAttribute('type','text/javascript');sblock.setAttribute('defer','defer');sblock.setAttribute('src',uri);appBlock.appendChild(sblock)}};this.getData=function(uri,handler,passarg,trans){xid++;handler[xid]=1;trans[passarg].xid=xid;if(handler){registerHandler(xid,handler,passarg)}else{throw(new Error("getData method requires 'handler' callback"))};sblock=document.createElement("script");var target=address+"?xid="+xid+"&rnd="+Math.round(Math.random()*100000)+"&url="+uri;sblock.setAttribute('charset','utf-8');sblock.setAttribute('id',"xid"+xid);sblock.setAttribute('type','text/javascript');sblock.setAttribute('defer','defer');sblock.setAttribute('src',target);var appBlock=null;appBlock=document.getElementById("grazr");if(appBlock){appBlock.appendChild(sblock)}else{local.initPipe()};return xid};this.initPipe=function(){handler=new Array();var appBlock=null;appBlock=document.getElementById("grazr");if(!appBlock){throw(new Error("No head element for XD transfer"))}};local.initPipe()};function DataPipe(){this.makeXHR=function(){if(window.XMLHttpRequest){try{this.req=new XMLHttpRequest()}catch(e){this.req=false}}else if(window.ActiveXObject){try{this.req=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){this.req=false}}};this.post=function(url,data,callback){this.makeXHR();this.req.open("post",url,true);this.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');var payload="";for(var prop in data){payload+=prop+"="+data[prop]+"&"};payload=payload.replace(/\&$/,'');this.req.send(payload)};this.get=function(url,callback){this.makeXHR();this.req.open("GET",url,true);this.req.onreadystatechange=callback;this.req.send(null)};this.getScript=function(url,callbackName){var Xd=new XDataPipe();var stringSeparator=(url.match(/\?/g)) ? "&" : "?";url +=stringSeparator + "jsoncallback=" + callbackName;Xd.genericFetch(url)}};function setStyle(instyle,obj){(obj)?null:obj=this.display;instyle=instyle.replace(/\:\s+/g,":");instyle=instyle.replace(/\;$/,"");var styles=instyle.split(/\;/);for(var s_set=0, s_max=styles.length;s_set < s_max;s_set++){var pair=styles[s_set].split(/\:/);var stname=pair[0];var value=pair[1];obj.style[stname]=value}};function EventObject(){this.getDisplay=function(){return this.display};this.addEvent=function(type,inMethod){return regEvent(this,type,inMethod)};this.removeEvent=function(type){clearEvent(this,type)};this.clearEvents=function(){clearAllEvents(this)}};var eventproto=new EventObject();function GrazrObject(){this.setHW=function(inH,inW){this.display.style.height=inH+"px";this.display.style.width=inW+"px"};this.setXY=function(inX,inY){if (isIE){/* IE6 has issues when quickly rendering successive slides. This only seems to occur for anchor loading. ew 07.09.2007 */ var isNumeric=new RegExp(/\d+/);if (!isNumeric.test(inX)){return}};this.display.style.left=inX+"px";this.display.style.top=inY+"px"};this.setRect=function(inX,inY,inX2,inY2){if(isIE){this.display.style.borderLeft=inX+"px solid #FFFFFF";this.display.style.borderTop=inY+"px solid #FFFFFF";this.display.style.borderRight=inX2+"px solid #FFFFFF";this.display.style.borderBottom=inY2+"px solid #FFFFFF";this.display.style.width="100%"}else{this.display.style.left=inX+"px";this.display.style.top=inY+"px";this.display.style.right=inX2+"px";this.display.style.bottom=inY2+"px"}};this.setStyle=setStyle;this.setClass=function(classname){this.display.className=classname};this.add=function(obj){if(obj.IEcontainer){this.display.appendChild(obj.IEcontainer)}else{this.display.appendChild(obj.display)}};this.remove=function(obj){if(obj.IEcontainer){this.display.removeChild(obj.IEcontainer)}else{this.display.removeChild(obj.display)}}};GrazrObject.prototype=eventproto;var grazrproto=new GrazrObject();function DomObj(dom){this.display=dom};DomObj.prototype=eventproto;function GrazrPanel(){var scrollpos=0;var local=this;this.display=document.createElement("div");this.setStyle("position:absolute");this.storeScroll=function(){scrollpos=local.display.scrollTop};this.reStoreScroll=function(){local.display.scrollTop=scrollpos};this.anchorTo=function(inid){inid.appendChild(this.display)}};GrazrPanel.prototype=grazrproto;function FixedPanel(){var scrollpos=0;var local=this;this.display=document.createElement("div");if(isIE){this.display.style.position="relative";this.IEcontainer=document.createElement("div");this.IEcontainer.style.height="100%";this.IEcontainer.style.width="100%";this.display.style.height="100%";this.display.style.width="100%";this.IEcontainer.appendChild(this.display)}else{this.display.style.position="absolute"};this.setStyle=function(instyle){instyle=instyle.replace(/\s+/g,"");var styles=instyle.split(/\;/);for(var s_set=0, s_max=styles.length;s_set < s_max;s_set++){var pair=styles[s_set].split(/\:/);var stname=pair[0];var value=pair[1];if(isIE){switch(stname){case "top": this.IEcontainer.style["paddingTop"]=value;break;case "bottom": this.IEcontainer.style["paddingBottom"]=value;break;case "left": this.IEcontainer.style["paddingLeft"]=value;break;case "right": this.IEcontainer.style["paddingRight"]=value;break;default: this.display.style[stname]=value}}else{this.display.style[stname]=value}}};this.storeScroll=function(){scrollpos=local.display.scrollTop};this.reStoreScroll=function(){local.display.scrollTop=scrollpos};this.anchorTo=function(inid){inid.appendChild(this.display)}};FixedPanel.prototype=grazrproto;function Mouseable(){var local=this;var startpos={X:0,Y:0};this.target=null;this.setStart=function(pos){startpos=pos};this.getDelta=function(Position){var xdelt=Position.X - startpos.X;var ydelt=Position.Y - startpos.Y;return{X:xdelt, Y:ydelt}};this.getPosition=function(e){var posx=0;var posy=0;if (!e) var e=window.event;if (e.pageX || e.pageY){posx=e.pageX;posy=e.pageY}else if (e.clientX || e.clientY){posx=e.clientX + document.body.scrollLeft;posy=e.clientY + document.body.scrollTop};return{X:posx,Y:posy}};this.moveListener=function(e){if(!e){var e=window.event};var mpos=local.getPosition(e);var delta=local.getDelta(mpos);local.target.moveInc(delta.X, delta.Y)}};var mouse=new Mouseable();var framedoc=new DomObj(document);function Vslider(initPosX,initPosY,frame){var local=this;var vpos=initPosY;var newpos=0;var maxmove=0;this.display=document.createElement("div");this.display.style.position="absolute";this.display.style.height="8px";this.display.style.top=initPosY+"px";if(isIE){this.display.style.width="100%"}else{this.display.style.left=initPosX+8+"px";this.display.style.right="1px";this.display.style.top=initPosY+"px"};this.display.className="vslider";this.display.style.cursor="n-resize";this.display.style.overflow="hidden";this.setPos=function(val){vpos=val;frame.toppanel.style.height=val+"px";this.display.style.top=val+"px";if(isIE){frame.botpanel.style.paddingTop=val+8+"px"}else{frame.botpanel.style.top=val+8+"px"}};this.moveInc=function(dX, dY){newpos=vpos+dY;if(newpos < 16){newpos=16};if(newpos > maxmove){newpos=maxmove};frame.toppanel.style.height=newpos+"px";this.display.style.top=newpos+"px";if(isIE){frame.botpanel.style.paddingTop=newpos+8+"px"}else{frame.botpanel.style.top=newpos+8+"px"}};this.stopMove=function(){App.frame.unwait();vpos=newpos;framedoc.removeEvent("mousemove");framedoc.removeEvent("mouseup");mouse.target=null};this.startMove=function(e){App.frame.wait();var mpos=mouse.getPosition(e);mouse.setStart({X:mpos.X,Y:mpos.Y});mouse.target=local;if(isIE){maxmove=mpos.Y-44+frame.botpanelIE.clientHeight-16}else{maxmove=mpos.Y-44+frame.botpanel.clientHeight-16};framedoc.addEvent("mousemove",mouse.moveListener);framedoc.addEvent("mouseup",local.stopMove)};this.getPos=function(){return vpos};this.extendGrazr=function(s1, p1, p2){return eval(s1)}};Vslider.prototype=eventproto;function Hslider(initPos,frame){var local=this;var hpos=initPos;var newpos=0;this.display=document.createElement("div");if(isIE){this.display.style.cssFloat="left";this.display.style.styleFloat="left"}else{this.display.style.position="absolute";this.display.style.left=initPos+"px"};this.display.style.height="100%";this.display.style.width="8px";this.display.style.overflow="hidden";this.display.className="hslider";this.display.style.cursor="e-resize";this.setPos=function(val){hpos=val;frame.leftpanel.style.width=val+"px";if(!isIE){this.display.style.left=val+"px";frame.vcontrol.style.left=val+8+"px";frame.toppanel.style.left=val+8+"px";frame.botpanel.style.left=val+8+"px"}};this.moveInc=function(dX, dY){newpos=hpos+dX;if(newpos < 16){newpos=16};if(newpos > maxmove){newpos=maxmove};frame.leftpanel.style.width=newpos+"px";if(!isIE){this.display.style.left=newpos+"px";frame.vcontrol.style.left=newpos+8+"px";frame.toppanel.style.left=newpos+8+"px";frame.botpanel.style.left=newpos+8+"px"}};this.stopMove=function(){App.frame.unwait();hpos=newpos;framedoc.removeEvent("mousemove");framedoc.removeEvent("mouseup");mouse.target=null};this.startMove=function(e){App.frame.wait();var mpos=mouse.getPosition(e);mouse.setStart({X:mpos.X,Y:mpos.Y});maxmove=mpos.X+frame.botpanel.clientWidth-16;mouse.target=local;framedoc.addEvent("mousemove",mouse.moveListener);framedoc.addEvent("mouseup",local.stopMove)};this.getPos=function(){return hpos}};Hslider.prototype=eventproto;function ThreePaneFrame(){var local=this;var viewport=App.frame.getViewport();var hpos=0;var vpos=0;var base=document.createElement("div");var originX=0;var originY=0;var newpos=hpos;var newvpos=vpos;base.style.height="100%";base.style.width="100%";base.style.position="absolute";var leftpanel=document.createElement("div");this.leftpanel=leftpanel;var rightpanel=document.createElement("div");this.rightpanel=rightpanel;var toppanel=document.createElement("div");this.toppanel=toppanel;var botpanel=document.createElement("div");this.botpanel=botpanel;var botpanelIE=document.createElement("div");botpanelIE.style.height="100%";botpanelIE.style.width="100%";botpanelIE.style.overflow="auto";this.botpanelIE=botpanelIE;var control=new Hslider(hpos,this);var vcontrol=new Vslider(hpos,vpos,this);this.vcontrol=vcontrol.display;base.appendChild(leftpanel);function setInitialPos(){var hfrac=(App.config.vdiv)?App.config.vdiv.match(/^\d+/)/100 : .5;var vfrac=(App.config.hdiv)?App.config.hdiv.match(/^\d+/)/100 : .425;hpos=(viewport.display.clientWidth) * vfrac;vpos=(viewport.display.clientHeight * hfrac)-4;if(hpos <=0){setTimeout(setInitialPos,50)}else{control.setPos(hpos);vcontrol.setPos(vpos)}};setInitialPos();if(isIE){leftpanel.style.cssFloat="left";leftpanel.style.styleFloat="left";leftpanel.style.width=hpos+"px";base.appendChild(control.display);control.display.style.marginRight="-3px";rightpanel.appendChild(botpanel);rightpanel.appendChild(vcontrol.display);rightpanel.appendChild(toppanel);base.appendChild(rightpanel)}else{base.appendChild(botpanel);base.appendChild(toppanel);base.appendChild(vcontrol.display);base.appendChild(control.display)};control.addEvent("mousedown",control.startMove);vcontrol.addEvent("mousedown",vcontrol.startMove);if(isIE){rightpanel.style.width="100%"}else{leftpanel.style.position="absolute";leftpanel.style.width=hpos+"px"};leftpanel.style.height="100%";leftpanel.style.cssFloat="left";leftpanel.style.styleFloat="left";leftpanel.style.overflow="auto";rightpanel.style.height="100%";rightpanel.style.overflow="hidden";toppanel.style.position="absolute";toppanel.style.top="1px";toppanel.style.height=vpos+"px";toppanel.style.overflow="auto";if(isIE){toppanel.style.width="100%";toppanel.style.zoom="1"}else{toppanel.style.left=hpos+8+"px";toppanel.style.right="1px"};botpanel.style.position="absolute";if(isIE){botpanel.style.width="100%";botpanel.style.height="100%";botpanel.style.paddingTop=vpos+8+"px";botpanel.appendChild(botpanelIE)}else{botpanel.style.left=hpos+8+"px";botpanel.style.right="1px";botpanel.style.top=vpos+8+"px";botpanel.style.bottom="1px"};botpanel.style.overflow="auto";this.getSplits=function(){return{H:control.getPos(),V:vcontrol.getPos()}};this.setSplits=function(obj){control.setPos(obj.H);vcontrol.setPos(obj.V)};this.clear=function(){control.removeEvent("mousedown");vcontrol.removeEvent("mousedown")};this.getLeftPanel=function(){return leftpanel};this.getTopPanel=function(){return toppanel};this.getBotPanel=function(){if(isIE){return botpanelIE}else{return botpanel}};this.getRightPanel=function(){return rightpanel};this.getPanel=function(){return base};this.extendGrazr=function(s1, p1, p2){return eval(s1)}};function Button(type,text){this.display=document.createElement("span");var disp=this.display;function swapIt(){var bg=(disp.currentStyle)?disp.currentStyle.backgroundImage:"none";if(bg !="none"){disp.style.display="inline";bg=bg.replace(/url\(\"/,"");bg=bg.replace(/\"\)/,"");disp.style.backgroundImage="none";disp.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bg+"',sizingMethod='crop')"}else{setTimeout(swapIt,100)}};var buttonclass="gz"+type+"button";this.display.className=buttonclass;this.display.id=buttonclass;this.display.style.position="absolute";this.display.style.height="21px";this.display.style.width="21px";this.display.title=text;this.display.alt=text;this.display.style.cursor="pointer"};Button.prototype=eventproto;function Logo(inClass){this.display=document.createElement("span");this.baseclass=null;this.display.style.display="inline";this.baseclass=(inClass)?inClass:null;this.display.className=this.baseclass+" gzlogoitem";var sticker=document.createElement("div");sticker.applied=false;sticker.className="gzactivity";setStyle("cursor:pointer",this.display);var logotext=document.createElement("span");this.display.appendChild(logotext);logotext.style.zoom="1";this.display.alt=App.xl("Get a Grazr widget for your Web page");this.display.title=App.xl("Get a Grazr widget for your Web page");var tmp=logotext;var outer=this.display;var textnode=document.createTextNode("Grazr");logotext.appendChild(textnode);this.setClass=function(classn){this.baseclass=classn;this.display.className=this.baseclass+" gzlogoitem"};this.setActive=function(){if(!sticker.applied){var stwidth=outer.offsetWidth;setStyle("position:absolute;height:"+outer.offsetHeight+"px;width:"+(stwidth)+"px;left:"+outer.offsetLeft+"px;top:"+outer.offsetTop+"px;",sticker);setStyle("filter:alpha(opacity=0);opacity:0",tmp);sticker.applied=true;outer.appendChild(sticker)}};this.setUnActive=function(){if(sticker.applied){setStyle("filter:none;opacity:1",tmp);sticker.applied=false;outer.removeChild(sticker)}}};Logo.prototype=eventproto;function RoundFrame(r,d,ec,style){(ec)?null:ec=1;this.display=document.createElement("div");var local=this;var boxwidth=0;var divarray=new Array(0);this.getHeight=function(){return this.display.offsetHeight};this.display.style.position="absolute";var nodeclass="";var radius=r;var j=0;for(var i=radius;i>=0;i--){var tst;(d==-1)?tst=radius-i:tst=i;var sidewidth=Math.round((radius-(Math.cos(Math.asin(tst/radius))*radius))*ec);var innerBox=document.createElement("div");var aa=document.createElement("div");var outerBox=document.createElement("div");outerBox.style.position="absolute";outerBox.style.width="100%";outerBox.style.top=j+"px";j++;outerBox.style.height="1px";outerBox.style.overflow="hidden";innerBox.style.height="2px";aa.style.height="2px";if(isIE){outerBox.style.paddingLeft=sidewidth+"px";outerBox.style.paddingRight=sidewidth+"px";innerBox.appendChild(document.createComment(""))}else{innerBox.style.position="absolute";innerBox.style.left=sidewidth+"px";innerBox.style.right=sidewidth+"px"};divarray.push({ref:innerBox,width:sidewidth});/*innerBox.className=nodeclass;*/ outerBox.appendChild(innerBox);innerBox.style.backgroundPosition="-"+sidewidth+"px "+(0-j)+"px";this.display.appendChild(outerBox)};this.changeOffset=function(amount){for(var i=0;i<divarray.length;i++){divarray[i].ref.style.backgroundPosition="-"+divarray[i].width+"px "+((d*i)+parseInt(amount))+"px"}};this.setClass=function(classname){for(var i=0;i<divarray.length;i++){divarray[i].ref.className=classname}};this.display.style.height=radius+"px";this.display.style.overflow="hidden";this.display.style.width="100%";this.setNodeClass=function(classtype){nodeclass=classtype;local.display.className=nodeclass}};RoundFrame.prototype=grazrproto;function Menu(){function highlightToggleLock(tgt){(tgt.display)?null:tgt=tgt.gztarget;if(tgt.hllock){tgt.hllock=false}else{tgt.hllock=true}};function highlight(tgt){(tgt.display)?null:tgt=tgt.gztarget;tgt.display.className=tgt.baseclass+" gzmenuitemhl";if (tgt.subMenu && !document.getElementById("submenu")){showSubMenu(tgt)}};function showSubMenu (parent){var subList=new MenuList(parent.subMenu);var base=App.frame.getBasePanel().display;var subContainer=document.createElement("div");subContainer.id="submenu";subContainer.appendChild(subList.display);setStyle("position:absolute;width:auto;height:50%;zIndex:10;left:167px;top:84px",subContainer);base.appendChild(subContainer)};function destroySubMenu (){var menuDisp=document.getElementById("submenu");if (menuDisp) menuDisp.parentNode.removeChild(menuDisp)};function activecheckhighlight(tgt){if(activeMenu && activeMenu !=tgt.gztarget){local.activateMenu(tgt)}else{highlight(tgt)}};function unhighlight(tgt){(tgt.display)?null:tgt=tgt.gztarget;if(!tgt.hllock){tgt.display.className=tgt.baseclass}};function Blank(){this.display=document.createElement("div");this.display.appendChild(document.createComment(" "));this.display.style.height=".25em";this.display.style.width=".25em"};function Spacer(){this.display=document.createElement("div");var spacer=document.createElement("div");this.display.appendChild(spacer);spacer.className="gzmenulistitemspacer";spacer.appendChild(document.createComment(" "));this.isSpace=true};var menus=new Array();var mitems=new Array();mitems.push({label:App.xl("Outline"), action:function(){App.datamanager.stop();App.viewmanager.changeView("o")},test:function(){return (App.viewer.type=="outline")?true:false}});mitems.push({label:App.xl("Slider"), action:function(){App.datamanager.stop();App.viewmanager.changeView("s")},test:function(){return (App.viewer.type=="slider")?true:false}});mitems.push({label:App.xl("Three Pane"), action:function(){App.datamanager.stop();App.viewmanager.changeView("3p")},test:function(){return (App.viewer.type=="threepane")?true:false}});mitems.push(new Spacer());mitems.push({label:App.xl("Stop"),action:function(){App.datamanager.stop()}});mitems.push({label:App.xl("Refresh"),action:function(){App.frame.addbar.reload()}});mitems.push(new Spacer());mitems.push({label:App.xl("Address Bar"),action:function(){App.frame.toggleToolBar()},test:function(){return App.frame.hasaddbar}});mitems.push({label:App.xl("Menu Bar"),action:function(){App.frame.hideMenu()},test:function(){return App.frame.hasmenu}});mitems.push(new Spacer());mitems.push({label:App.xl("New Window"),action:App.launch});mitems.push({label:App.xl("Add to your page"),action:function(){App.copy()}});menus.push({label:App.xl("View"),mitems:mitems});this.myMenus={"menus" : menus};/* If the user is logged in, let's also grab their files. if (document.cookie.indexOf('sessionid') >=0){var uFiles=new XDataPipe();uFiles.genericFetch("http://www.grazr.com/files/json?jsoncallback=App.userFiles")}*/ function MenuTitle(menuobj){this.display=document.createElement("span");this.menuText=menuobj.label;this.menudata=menuobj;this.display.appendChild(document.createTextNode(this.menuText));this.display.className="gzmenuitem";this.display.style.cursor="default";this.baseclass="gzmenuitem";this.menuActive=false};MenuTitle.prototype=grazrproto;function MenuBar(){this.display=document.createElement("div");this.display.className="gzmenubar";this.display.style.whiteSpace="nowrap";this.display.style.width="100%";this.addMenuTitle=function(menuobj){this.display.appendChild(menuobj.display)};this.removeMenuTitle=function(menuobj){this.display.removeChild(menuobj.display)}};function MenuItem(data){this.display=document.createElement("div");var text=document.createElement("span");text.style.whiteSpace="nowrap";this.display.style.cursor="default";this.display.className="gzmenulistitem";this.baseclass="gzmenulistitem";var check=document.createElement("div");if(data.test && data.test() ){setStyle("left:.25em;position:absolute;height:1em;width:1em",check);if(isIE){setStyle("fontFamily:Wingdings",check);check.appendChild(document.createTextNode(String.fromCharCode(252)))}else{setStyle("fontFamily:Sylfaen,fantasy",check);check.appendChild(document.createTextNode(String.fromCharCode(8730)))};text.appendChild(check)};/* Show hint for submenu if necessary */ var label=(data.mitems) ? data.label + " " + String.fromCharCode(8594) : data.label;this.subMenu=data.mitems;text.appendChild(document.createTextNode(label));this.display.appendChild(text);this.action=function(e){data.action();deactivateMenu()}};MenuItem.prototype=grazrproto;function MenuList(mdata){this.display=document.createElement("div");this.display.className="gzmenufont gzmenulist";var itemList=new Array(0);var top=new Blank();var bottom=new Blank();this.display.appendChild(top.display);for(var i=0;i<mdata.length;i++){if(mdata[i].isSpace){this.display.appendChild(mdata[i].display)}else{var item=new MenuItem(mdata[i]);this.display.appendChild(item.display);item.addEvent("mouseover",highlight);item.addEvent("mouseout", unhighlight);item.addEvent("click", item.action );itemList.push(item)}};this.display.appendChild(bottom.display);this.getHeight=function(){return this.display.offsetHeight};this.destroy=function(){this.display.parentNode.removeChild(this.display);if(this.backing){this.backing.parentNode.removeChild(this.backing);this.backing=null};itemList.map(function(i){i.clearEvents()})}};MenuList.prototype=grazrproto;var local=this;var animEngine=new FXengine(40);this.display=document.createElement("div");setStyle("position:absolute;zIndex:5;width:100%",this.display);var menubar=new MenuBar();var menuport=document.createElement("div");menuport.appendChild(document.createComment(" "));setStyle("position:absolute;width:100%;overflow:hidden;",menuport);this.display.appendChild(menubar.display);this.display.appendChild(menuport);this.display.className="gzmenufont";this.getHeight=function(){return this.display.offsetHeight};this.addLogo=function(logo){menubar.display.insertBefore(logo.display,menubar.display.childNodes[0])};function destroyMenu(menuobj){menuobj.current.destroy();menuobj.current=null;menuport.style.height="0px";menuport.style.left="0px";menuport.style.width="100%";/* destroy submenu if it's visible too */ destroySubMenu()};var activeMenu=null;function deactivateMenu(){if(activeMenu){highlightToggleLock(activeMenu);unhighlight(activeMenu);destroyMenu(activeMenu);if(docEvent){doc.removeEvent("click");docEvent=false};activeMenu=null}};function showMenu(menuobj){var mdata=menuobj.menudata;var mpanel=new MenuList(mdata.mitems);menuobj.current=mpanel;var backing=document.createElement("div");setStyle("position:absolute;overflow:auto",backing);mpanel.backing=backing;mpanel.setStyle("position:absolute;width:auto");menuport.appendChild(backing);menuport.appendChild(mpanel.display);var base=App.frame.getBasePanel().display;if(base.clientWidth < 250){mpanel.display.style.width="98%";setStyle("left:0px",menuport);setStyle("height:"+(mpanel.display.offsetHeight+1)+"px;width:100%",menuport)}else{setStyle("left:"+menuobj.display.offsetLeft+"px",menuport);setStyle("height:"+(mpanel.display.offsetHeight+1)+"px;width:"+mpanel.display.offsetWidth+"px",menuport)};setStyle("height:"+(mpanel.display.offsetHeight+1)+"px;width:"+mpanel.display.offsetWidth+"px",backing)};var menuTitles=new Array(0);var docEvent=null;var doc=new DomObj(document);this.activateMenu=function(e){var ret=true;if(e.gztarget==activeMenu){deactivateMenu()}else{if(activeMenu){deactivateMenu()}else{};highlightToggleLock(e.gztarget);highlight(e.gztarget);activeMenu=e.gztarget;showMenu(e.gztarget);if(docEvent){}else{doc.addEvent("click",function(e){deactivateMenu()});docEvent=true}}};for(var i=0;i<this.myMenus.menus.length;i++){var mitem=new MenuTitle(this.myMenus.menus[i]);menuTitles.push(mitem);menubar.addMenuTitle(mitem);mitem.addEvent("click",local.activateMenu);mitem.addEvent("mouseover",activecheckhighlight);mitem.addEvent("mouseout",unhighlight)}};Menu.prototype=grazrproto;function AddressBar(){this.display=document.createElement("form");this.display.style.display="inline";this.display.style.fontFamily="Arial";this.display.style.fontSize="8pt";this.display.setAttribute('autocomplete','off');this.display.style.marginTop="0px";var outer=document.createElement("div");var minput=document.createElement("input");minput.className="gzaddressbar";minput.style.fontFamily="Arial";if(isIE){minput.style.fontSize="8pt"}else{minput.style.marginTop="1px";minput.style.fontSize="8pt"};minput.name="file";minput.value=decodeURI(App.config.file);var addressLabel=document.createElement("span");addressLabel.appendChild(document.createTextNode(App.xl("Address ")));addressLabel.style.position="absolute";addressLabel.style.top=".2em";addressLabel.style.left=".8em";addressLabel.style.marginTop=".2em";this.display.appendChild(addressLabel);this.display.marginTop="auto";this.display.marginBottom="auto";this.display.appendChild(outer);outer.appendChild(minput);this.display.style.marginLeft="10px";this.display.style.marginTop="0px";this.display.style.padding="0px";this.getDisplay=function(){return this.display};this.setText=function(txt){minput.value=txt};this.go=function(){if(!App.frame.isWaiting()){var newurl=minput.value;newurl="http://"+newurl.replace(/^\s*\w+\:[\/]{2,2}/,"");minput.value=newurl;App.confManager.set("file",minput.value);App.frame.wait();App.frame.setActive();App.viewer.clear();App.viewer.init(minput.value)};return false};regEvent(this,"submit",this.go);outer.style.position="absolute";minput.style.position="absolute";if(isIE){outer.style.paddingRight="0px";outer.style.paddingLeft="5em";outer.style.width="100%";outer.style.height="100%";outer.style.top="0px";minput.style.top="0px";outer.style.left="0px";minput.style.width="100%"}else{outer.style.top="0px";outer.style.left="5em";outer.style.right="0px";outer.style.bottom="0px";minput.style.width="auto";minput.style.marginTop="2px";minput.style.top="0px";minput.style.width="100%";minput.style.left="0px";minput.style.right="0px"};this.setRight=function(val){if(isIE){outer.style.paddingRight=val+10+"px"}else{outer.style.right=val+15+"px"}};this.setRight(0)};AddressBar.prototype=eventproto;function ToolBar(){this.display=document.createElement("div");var local=this;var boxwidth=0;this.display.style.fontSize="7.5pt";var nodeclass="gztoolbar";this.display.className=nodeclass;this.getHeight=function(){return this.display.offsetHeight};this.display.style.height="22px";this.display.style.overflow="hidden";this.display.style.position="absolute";if(isIE){this.display.style.width="100%"}else{this.display.style.left="0px";this.display.style.right="0px"};var buttonbox=document.createElement("div");buttonbox.className="gztitlebuttons";buttonbox.style.position="absolute";buttonbox.style.width=boxwidth+"px";buttonbox.style.height="100%";buttonbox.style.position="absolute";buttonbox.style.right="0px";buttonbox.style.top="0px";buttonbox.style.display="inline";var addr=new AddressBar();this.display.appendChild(addr.display);this.display.appendChild(buttonbox);this.reload=function(){addr.go()};this.setAddress=function(string){addr.setText(string)};this.removeButton=function(gzbutton){var next=gzbutton.display.nextSibling;buttonbox.removeChild(gzbutton.display);boxwidth-=21;(next)?next.style.left=boxwidth-21+"px":null;buttonbox.style.width=boxwidth+"px";addr.setRight(boxwidth)};this.addButton=function(gzbutton){gzbutton.display.style.top="0px";gzbutton.display.style.left=boxwidth+"px";buttonbox.appendChild(gzbutton.display);boxwidth=boxwidth+21;buttonbox.style.width=boxwidth+"px";addr.setRight(boxwidth)}};ToolBar.prototype=grazrproto;function TitleBar(){this.display=document.createElement("div");var local=this;var boxwidth=0;var curtext=null;var text="";var titleheight=22;this.getHeight=function(){return this.display.offsetHeight};var nodeclass="gztitlebar";this.display.className=nodeclass;setStyle("overflow:hidden;position:absolute;height:"+titleheight+"px;width:100%",this.display);var textbox=document.createElement("div");textbox.style.overflow="hidden";textbox.className="gztitletext";var buttonbox=document.createElement("div");buttonbox.className="gztitlebuttons";setStyle("position:absolute;bottom:0px;width:"+boxwidth+"px;height:100%",buttonbox);var data=document.createElement("span");this.getText=function(){return text};this.setText=function(intxt){text=intxt;data.innerHTML=unescape(text)};this.display.appendChild(buttonbox);this.display.appendChild(textbox);textbox.appendChild(data);this.addLogo=function(logo){textbox.insertBefore(logo.display,data)};this.addButton=function(gzbutton){gzbutton.display.style.top="0px";gzbutton.display.style.left=boxwidth+"px";buttonbox.appendChild(gzbutton.display);boxwidth=boxwidth+21;buttonbox.style.width=boxwidth+"px";textbox.style.marginRight=boxwidth+5+"px"}};TitleBar.prototype=grazrproto;function BackButton(){this.display=document.createElement("div");this.setStyle("position:absolute");this.setClass("gzbackbuttonoff");this.activate=function(){this.setClass("gzbackbuttonon")};this.deactivate=function(){this.setClass("gzbackbuttonoff")}};BackButton.prototype=grazrproto;function Footer(){var local=this;try{(window.privatelabel)?null:window.privatelabel=null}catch(er){window.privatelabel=null};this.display=document.createElement("div");this.display.style.overflow="hidden";var footerheight=privatelabel.height || 28;this.display.style.height=footerheight+"px";this.getHeight=function(){return this.display.offsetHeight};var nodeclass="gzfooter";this.display.className=nodeclass;var myUri="http://grazr.com/config";if(privatelabel ){if(privatelabel.ad){var logosrc=(privatelabel.logo)?"./ad/images/"+privatelabel.logo:'';var isad=1}else{var logosrc=(privatelabel.logo)?"./pl/"+privatelabel.id+"/"+privatelabel.logo:''};if(privatelabel.urlExt){var logoUri=privatelabel.urlExt(App)}else{var logoUri=privatelabel.url};var textVal=(privatelabel.text)?privatelabel.text:"";var tooltip=(privatelabel.tooltip)?privatelabel.tooltip:""};var leftPanel=document.createElement("div");leftPanel.className="gzprivatelabellogo";leftPanel.style.cssFloat="left";leftPanel.style.styleFloat="left";var rightPanel=document.createElement("div");rightPanel.className="gzprivatelabellogo";rightPanel.style.top="0px";rightPanel.style.cssFloat="right";rightPanel.style.styleFloat="right";var spn=document.createElement("span");if(!isad){spn.style.whiteSpace="nowrap"};var space=document.createElement("span");space.style.fontSize="10.25pt";space.style.marginTop="50px";space.innerHTML="&nbsp; ";var centerPanel=document.createElement("div");centerPanel.className="gzfootertxt";centerPanel.style.overflow="hidden";centerPanel.appendChild(space);centerPanel.appendChild(spn);var maxw=0;if(logosrc){function addLogo(panel,logourl,targeturl,side){var tmplogo=document.createElement("img");tmplogo.src=logourl;function addNow(){if(isIE){var logo=document.createElement("div");logo.style.height=tmplogo.height+"px";logo.style.width=tmplogo.width+"px";logo.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+logourl+"',sizingMethod='clip')";logo.style.cursor="hand";var iewidth=tmplogo.width}else{var logo=tmplogo};tmplogo=null;if(targeturl){var link=document.createElement("a");logo.style.border="none";link.bypass=true;logo.bypass=true;link.href=targeturl;link.target="_BLANK";link.appendChild(logo);link.title=targeturl;link.alt=targeturl;panel.appendChild(link)}else{panel.appendChild(logo)};var mywidth=(logo.width)?logo.width:iewidth;if(isad){centerPanel.style.textAlign="left"}else{centerPanel.style.paddingRight=mywidth+"px"}};if(tmplogo.width==0){tmplogo.onload=addNow}else{addNow()}}};if(logosrc){addLogo(leftPanel,logosrc,logoUri,"only")};if(isad){centerPanel.style.textAlign="left"};this.setStyle("position:absolute");this.display.appendChild(leftPanel);this.getData=function(e){if(privatelabel.ad){if(window.parent){window.parent.location.href=logoUri}else{window.location.href=logoUri}}else{var child=window.open(myUri+App.confManager.getURLstring(),App.config.linktarget);setTimeout(function(){child.focus()}, 100 )}};spn.innerHTML=textVal;this.display.title=tooltip;this.display.alt=tooltip;this.display.appendChild(centerPanel);this.display.appendChild(rightPanel)};Footer.prototype=grazrproto;function MappedElement(){this.getNextSibling=function(){return this.parent.index[this.index+1]};this.getPrevSibling=function(){return this.parent.index[this.index-1]};this.getParent=function(){if(this.parent && this.parent.parent){return this.parent.parent}};this.getChild=function(){if(this.child){return this.child.index[0]}else{return this}};this.getLastChild=function(){if(this.child){var last=this.child.index.length-1;return this.child.index[last]}else{return this}}};MappedElement.prototype=grazrproto;var mapElementProto=new MappedElement();function Node(){this.nodeclass="gznode";this.setNodeClass=function(classtype){this.nodeclass=classtype;try{this.display.className=classtype}catch(er){alert(this.setNodeClass.caller);alert(er)}};this.getData=function(e){e.gzbubble=true;if (this.outline){var target=(this.outline.attribute.grazrNSlinktarget) ? this.outline.attribute.grazrNSlinktarget : App.config.linktarget;var itemtext=this.outline.attribute.grazrNSitemtext ? this.outline.attribute.grazrNSitemtext : App.config.itemtext}else{var target=App.config.linktarget;var itemtext=App.config.itemtext};/* Suppress loading of RSS items in widget based on the grazr:itemtext or itemtext global attribute, but only for rss-story nodes */ if((e.altKey || App.config.noexp || ((itemtext=="off") && (this.outline.attribute.type=="rss-story"))) && e.gztarget.htmlUri){/* Suppress clicking on twitter item nodes, unless it's on the individual links. */ if (this.isTwitterItem){if (e.target.tagName.toLowerCase()=="a") window.open(e.target,target)}else{window.open(e.gztarget.htmlUri,target)};if(e.stopPropagation){e.stopPropagation()};e.cancelBubble=true;return false}else{App.viewer.nodeAction(e.gztarget)};return false};this.highlight=function(e){window.focus();App.viewer.highlight(e.gztarget);return 1};this.unhighlight=function(e){e.gztarget.display.className=e.gztarget.nodeclass};function scanToTop(dom,reference){var parent=0;if(dom.offsetParent && dom.offsetParent !==reference){parent=scanToTop(dom.offsetParent,reference)};return dom.offsetTop + parent};this.getTop=function(ref){if(isIE){return scanToTop(this.display,ref)}else{return this.display.offsetTop}};this.copyToClipBoard=function(e){App.clipboard.getClipboard();var copySource=null;switch (this.outline.attribute.type){case "rss-story": copySource={attribute:{text:this.outline.attribute.text || this.outline.attribute.title,url:this.htmlUri,type:"link"}};break;default: copySource=this.outline};App.clipboard.store((this.myUri || this.htmlUri),copySource);return true}};Node.prototype=mapElementProto;var nodeproto=new Node();function makeIcon(name,subname){var iconimg=document.createElement("span");var iconclass="gzicon ";iconclass +=(subname) ? subname : "gz" + name + "icon";if(isIE){iconclass+=" ieclear"};iconimg.className=iconclass;return iconimg};function processResult(outlineNode){var tempData=App.forms.getResults(outlineNode.attribute.formname);if(tempData){App.datamanager.setID(tempData, this.outline.id);this.outline.childNodes=tempData.childNodes;App.datamanager.state[outlineNode.id]={loaded:true,expanded:true}}else{if(!App.datamanager.state[outlineNode.id]){App.datamanager.state[outlineNode.id]={loaded:false,expanded:false}}};App.forms.addResultNode(outlineNode.attribute.formname,this)};function ResultNode(outlineNode){var local=this;var enabled=false;var iconimg=null;var domType=(isIphone)?"div":"a";this.display=document.createElement(domType);this.display.style.display="none";this.display.className="gznode";var textVal="";this.display.style.cursor="default";this.outline=outlineNode;outlineNode.attribute.subtype="result";this.proc=processResult;this.proc(outlineNode);this.enable=function(){enabled=true};var superclass=new Node();for(var prop in superclass){this[prop]=superclass[prop]};this.getData=function(e){if(enabled){return superclass.getData(e)}};this.highlight=function(e){if(enabled){return superclass.highlight(e)}};this.unhighlight=function(e){if(enabled){return superclass.highlight(e)}};outlineNode.attribute.type="gzresult";var tempData=App.forms.getResults(outlineNode.attribute.formname);if(tempData){var type=tempData.attribute.type;outlineNode.attribute.type=type;enabled=true};iconimg=makeIcon("result",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);var textVal=outlineNode.attribute.text || "";this.setUri=function(uri){this.myUri=uri;this.display.href=this.myUri};var textnode=document.createElement("span");textnode.className="nodetext";textnode.innerHTML=unescape(textVal);this.display.appendChild(iconimg);this.display.appendChild(textnode)};function FormNode(outlineNode){var local=this;this.display=document.createElement("div");this.display.bypass=true;this.display.className="gztext gzform";var textVal="";this.outline=outlineNode;var textVal=outlineNode.attribute.text || "";var textnode=document.createElement("span");textnode.className="nodetext";textnode.innerHTML=unescape(textVal);this.display.appendChild(textnode);var form=this.display.getElementsByTagName("form")[0];var myname=form.name;var gzform=new DomObj(form);gzform.addEvent("submit",function(){App.forms.getValues(myname);return false});this.myUri="http://var a={i:\""+this.outline.id+"\"};void 0;";this.display.href=this.myUri;var elems=App.forms.getFormVals(myname);if(elems){for(var i=0;i<elems.length;i++){if(elems[i].multiple){for(var j=0;j<elems[i].length;j++){form.elements[i][j].selected=elems[i][j].selected}}else{form.elements[i].value=elems[i].value;(elems[i].checked)?form.elements[i].checked=elems[i].checked:null}}};this.addEvent=function(){return null};this.highlight=function(){return false};this.unhighlight=function(){return false}};FormNode.prototype=mapElementProto;function IncludeNode(outlineNode,listIndex){var local=this;var domType=(isIphone)?"div":"a";this.display=document.createElement(domType);this.display.style.display="block";this.display.target=App.config.linktarget;this.display.className="gznode";var textVal="";this.myUri=null;var iconimg=null;this.outline=outlineNode;if(!App.datamanager.state[outlineNode.id]){App.datamanager.state[outlineNode.id]={loaded:false,expanded:false}};if(outlineNode.attribute.type.match(/(feed)|(rss)|(atom)|(rss20)/i)){iconimg=makeIcon("feed",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);outlineNode.attribute.type="rss";var textVal=outlineNode.attribute.text || outlineNode.attribute.title || "&nbsp;"}else{iconimg=makeIcon("include",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);outlineNode.attribute.type="include";var textVal=outlineNode.attribute.text || "&nbsp;"};this.myUri=outlineNode.attribute.xmlUrl || outlineNode.attribute.xmlurl || outlineNode.attribute.xmlURL || outlineNode.attribute.url || outlineNode.attribute.URL || null;if(outlineNode.attribute.htmlUrl){this.htmlUri=unescape(outlineNode.attribute.htmlUrl || outlineNode.attribute.htmlURL || outlineNode.attribute.url || null)};var textnode=document.createElement("span");textnode.className="nodetext";if(outlineNode.attribute.subtype=="result"){this.proc=processResult;this.proc(outlineNode);iconimg=makeIcon("result",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null)};if(outlineNode.attribute.subtype=="autodiscovered"){this.autodiscovered=true};textnode.innerHTML=unescape(textVal);this.display.appendChild(iconimg);this.display.appendChild(textnode);this.display.href=this.myUri};IncludeNode.prototype=nodeproto;function TextNode(outlineNode,listIndex){var local=this;this.nodeclass="gztext";this.index=listIndex;this.display=document.createElement("div");this.outline=outlineNode;var nodeclass="gztext";this.display.className=nodeclass;var textVal=outlineNode.attribute.text || "&nbsp;";switch(outlineNode.attribute.type){case "gz-title": if(App.viewer.type=="outline" || App.viewer.type=="river"){this.display.style.display="none"}else{var myurl=outlineNode.attribute.htmlUrl || outlineNode.attribute.htmlURL || outlineNode.attribute.url || null;if(myurl){var textVal=decodeURI("<a href='"+myurl+"'><span>"+textVal+"</span><span class='permalink' title='Open this item in a new window'></span></a>")};this.display.className="posttitle"};break;case "gz-author": this.display.className="postauthor";break;case "gz-date": if(outlineNode.attribute.machinetime){var date=new Date(outlineNode.attribute.machinetime*1000);var now=new Date();date=(now-date < 0)?now:date;textVal=date.toLocaleString()};this.display.className="postdate";break;case "gz-enclosure": this.display.className="postenclosure";break;case "gz-postclear": this.display.className="postclear";break;case "gz-content": this.display.className="gztext postcontent";break;default: break};this.display.innerHTML=unescape(textVal);var links=this.display.getElementsByTagName("a");for(var i=0;i<links.length;i++){var target=(this.outline.attribute.grazrNSlinktarget) ? this.outline.attribute.grazrNSlinktarget : App.config.linktarget;links[i].setAttribute("target",target)};this.highlight=function(){return};this.addEvent=function(){return null};this.unhighlight=function(){return}};TextNode.prototype=mapElementProto;function FolderNode(outlineNode,listIndex){var local=this;this.index=listIndex;this.isTwitterItem=(outlineNode.attribute.grazrNSsubtype && outlineNode.attribute.grazrNSsubtype=="twitter") ? true : false;var domType=(isIphone || this.isTwitterItem)?"div":"a";this.display=document.createElement(domType);this.display.style.display="block";this.outline=outlineNode;var textVal="";var nodeclass="gznode";var expanded=false;var rendered=null;if(!App.datamanager.state[outlineNode.id]){App.datamanager.state[outlineNode.id]={loaded:true,expanded:false}};this.display.className=nodeclass;var myChildNodes=outlineNode.childNodes;var textVal=outlineNode.attribute.text || "&nbsp;";var gzList={data:outlineNode.childNodes,title:textVal,scrollPos:0};if(outlineNode.attribute.htmlUrl){/* ew: this may be a very ugly hack, but some people are actually encoding their URL's, making clipboard lookup on dragdrop impossible. */ this.htmlUri=unescape(outlineNode.attribute.htmlUrl)};/* ew 09.12.2007: changed from <span> to <a> to avoid nested <a> issue with permalinks and draggable story nodes. */ var textnode=document.createElement("span");textnode.className="nodetext";var datetext=document.createElement("span");var iconimg;if(outlineNode.attribute.type=="rss-story"){iconimg=makeIcon("story",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);var content=false;for(var i=0,j=outlineNode.childNodes.length;i<j;i++){var test=outlineNode.childNodes[i].outline.attribute.type;content=(content || test=="gz-content" || test=="gz-enclosure" )?true:false};if(!content || this.isTwitterItem) outlineNode.attribute.grazrNSitemtext="off";if(outlineNode.attribute.machinetime && (outlineNode.attribute.isstream || App.config.ts)){var date=new Date(outlineNode.attribute.machinetime*1000);var dateclass='';var now=new Date();var delta=now-date;var minutes=delta / (60*1000);var time='';if(minutes < 0){minutes=0};if(minutes <=60){var time=Math.floor(minutes);time=(time<1)?1:time;var ending=App.xl((time==1)?" minute ago":" minutes ago");dateclass="minutes"};if(minutes > 60 && minutes <=(60*24) ){var time=Math.floor(minutes/60);var ending=App.xl((time==1)?" hour ago":" hours ago");dateclass="hours"};if(minutes > (60*24) && minutes <=(60*48)){var time=Math.floor(minutes/(60*24));var ending=App.xl((time==1)?" day ago":" days ago");dateclass="oneday"};if(minutes > (60*48)){var time=Math.floor(minutes/(60*24));var ending=App.xl((time==1)?" day ago":" days ago");dateclass="moreday"};datetext.innerHTML=time+ending;datetext.className="date date"+dateclass;textnode.appendChild(datetext)};if (this.htmlUri){this.myUri=this.htmlUri}}else{iconimg=makeIcon("folder",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);this.myUri="http://grazr.com/folder?target="+this.outline.id + "&file=" + App.config.file};if (this.isTwitterItem){textVal=twitterText(textVal,this.outline)};var text=document.createElement("span");text.innerHTML=unescape(textVal);textnode.appendChild(text);if(this.myUri){this.display.href=this.myUri};this.display.target=(this.outline.attribute.grazrNSlinktarget) ? this.outline.attribute.grazrNSlinktarget : App.config.linktarget;this.display.appendChild(iconimg);if(this.htmlUri){var linktext=(this.isTwitterItem || isIphone) ? document.createElement("a") : document.createElement("span");if (this.outline.attribute.grazrNSitemtext !="off" || this.isTwitterItem || isIphone){linktext.appendChild(document.createTextNode(" "+String.fromCharCode(160)+String.fromCharCode(160)+String.fromCharCode(160)));if (this.isTwitterItem || isIphone){linktext.href=this.htmlUri;linktext.target=this.display.target};linktext.className="permalink";linktext.bypass=true;linktext.alt=App.xl("Open this item in a new window");linktext.title=App.xl("Open this item in a new window");textnode.appendChild(linktext)}};this.display.appendChild(textnode)};function twitterText (textVal,outlineNode){/* Auto-convert http:// links */ textVal=textVal.replace(/(http\:\/\/\S+[^\W$])/g,"<a href='" + "$1" + "'>" + "$1" + "</a>");/* Autolink poster */ textVal=textVal.replace(/(^[\w]*)/,"<a href='http://www.twitter.com/" + "$1" + "'>" + "$1" + "</a>");/* Reply links */ textVal=textVal.replace(/@([\w]*)/g,"@<a href='http://www.twitter.com/" + "$1" + "'>" + "$1" + "</a>");/* Append date if possible and we're not in a stream. */ if (outlineNode.attribute.machinetime && !outlineNode.attribute.isstream) textVal +=" <span class='twitterDate'>" + prettyDate(outlineNode.attribute.machinetime) + "</span>";return textVal};/* * JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */ function prettyDate(time){/* Convert the machinetime into a format this function can use. */ var date=(new Date(time * 1000)), diff=(((new Date()).getTime() - date.getTime()) / 1000), day_diff=Math.floor(diff / 86400);if ( isNaN(day_diff) || day_diff < 0 || day_diff >=31 ) return;return day_diff==0 && ( diff < 60 && "just now" || diff < 120 && "1 minute ago" || diff < 3600 && Math.floor( diff / 60 ) + " minutes ago" || diff < 7200 && "1 hour ago" || diff < 86400 && Math.floor( diff / 3600 ) + " hours ago") || day_diff==1 && "Yesterday" || day_diff < 7 && day_diff + " days ago" || day_diff < 31 && Math.ceil( day_diff / 7 ) + " weeks ago"};FolderNode.prototype=nodeproto;function LinkNode(outlineNode,listIndex){var local=this;this.index=listIndex;var domType=(isIphone)?"div":"a";this.display=document.createElement(domType);this.display.style.display="block";this.outline=outlineNode;var nodeclass="gznode";var textVal=outlineNode.attribute.text || "&nbsp;";this.display.className=nodeclass;if(!App.datamanager.state[outlineNode.id]){App.datamanager.state[outlineNode.id]={loaded:true}};this.myUri=outlineNode.attribute.url || outlineNode.attribute.URL || outlineNode.attribute.htmlUrl || outlineNode.attribute.htmlURL || outlineNode.attribute.xmlUrl || outlineNode.attribute.xmlurl || outlineNode.attribute.xmlURL || "about:blank";this.display.href=this.myUri;this.htmlUri=this.myUri;var iconimg=makeIcon("link",(outlineNode.attribute.grazrNSsubtype)?outlineNode.attribute.grazrNSsubtype:null);var textnode=document.createElement("div");setStyle("marginLeft: 20px;display:block",textnode);textnode.innerHTML=unescape(textVal);this.display.appendChild(iconimg);this.display.appendChild(textnode);var myChildNodes=outlineNode.childNodes;this.activateLink=function(){var target=(this.outline.attribute.grazrNSlinktarget) ? this.outline.attribute.grazrNSlinktarget : App.config.linktarget;window.open(this.myUri,target)}};LinkNode.prototype=nodeproto;function List(outlineNode,gzNode){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;var textVal;this.display=document.createElement("div");this.display.style.zoom="1";var node=null;this.display.style.overflow="visible";this.outline=outlineNode;if(gzNode){this.parent=gzNode;gzNode.child=this};this.index=new Array(0);var eventList=new Array(0);if(!outlineNode.title){outlineNode.title=outlineNode.attribute.title || outlineNode.attribute.text};var parentTarget=outlineNode.attribute.grazrNSlinktarget ? outlineNode.attribute.grazrNSlinktarget : App.config.linktarget;var itemtext=outlineNode.attribute.grazrNSitemtext ? outlineNode.attribute.grazrNSitemtext : App.config.itemtext;if(outlineNode.childNodes){for(var i=0, j=outlineNode.childNodes.length;i<j;i++){node=null;if(outlineNode.childNodes[i] && outlineNode.childNodes[i].outline){outlineNode.childNodes[i].outline.attribute=outlineNode.childNodes[i].outline.attribute ||{};var type=outlineNode.childNodes[i].outline.attribute.type;if (!outlineNode.childNodes[i].outline.attribute.grazrNSlinktarget){outlineNode.childNodes[i].outline.attribute.grazrNSlinktarget=parentTarget};if (!outlineNode.childNodes[i].outline.attribute.grazrNSitemtext){outlineNode.childNodes[i].outline.attribute.grazrNSitemtext=itemtext};if(type){switch(type){case "rss": node=new IncludeNode(outlineNode.childNodes[i].outline,i);break;case "rss-story": node=new FolderNode(outlineNode.childNodes[i].outline,i);break;case "link": if(outlineNode.childNodes[i].outline.attribute.url){if(outlineNode.childNodes[i].outline.attribute.url.match(/\.opml$/)){node=new IncludeNode(outlineNode.childNodes[i].outline,i)}else{node=new LinkNode(outlineNode.childNodes[i].outline,i)}}else{if(outlineNode.childNodes[i].outline.attribute.xmlUrl &&outlineNode.childNodes[i].outline.attribute.xmlUrl.match(/\.opml$/)){node=new IncludeNode(outlineNode.childNodes[i].outline,i)}else{node=new LinkNode(outlineNode.childNodes[i].outline,i)}};break;case "include": node=new IncludeNode(outlineNode.childNodes[i].outline,i);break;case "gzform": node=new FormNode(outlineNode.childNodes[i].outline,i);break;case "gzresult": node=new ResultNode(outlineNode.childNodes[i].outline,i);break;default: if(outlineNode.childNodes[i].outline.childNodes){node=new FolderNode(outlineNode.childNodes[i].outline,i)}else{node=new TextNode(outlineNode.childNodes[i].outline,i)};break}}else{var a=outlineNode.childNodes[i].outline.attribute;if(a.xmlUrl || a.xmlurl || a.xmlURL || a.url || a.URL){outlineNode.childNodes[i].outline.attribute.type="rss";node=new IncludeNode(outlineNode.childNodes[i].outline,i)}else{if(outlineNode.childNodes[i].outline.childNodes){node=new FolderNode(outlineNode.childNodes[i].outline,i)}else{node=new TextNode(outlineNode.childNodes[i].outline,i)}}};eventList.push(node.addEvent("click",node.getData));eventList.push(node.addEvent("mouseover",node.highlight));eventList.push(node.addEvent("mouseout",node.unhighlight));node.addEvent("draggesture",node.copyToClipBoard);node.addEvent("dragstart",node.copyToClipBoard);node.parent=this;node.index=i;this.display.appendChild(node.display);this.index.push(node)}}};function clearFlash(node){var objs=node.display.getElementsByTagName("object");for (var i=objs.length;i;i--){objs[i-1].parentNode.removeChild(objs[i-1])}};function killDOM(n){if(n && n.childNodes){for(var i=n.childNodes.length-1;i>=0;i--){killDOM(n.childNodes[i]);n.removeChild(n.childNodes[i])}}};this.destroy=function(){clearFlash(local);/* ew: placed in try/catch block to stop breaking expansion state restores. */ if(this.index){this.index.map(function(n){n.clearEvents()})};if(this.index){for(var i=this.index.length-1;i>=0;i--){if(this.index[i].child){this.index[i].child.destroy();this.index[i].child=null};this.index[i].display=null;this.index[i]=null};this.index=null};if(this.display.parentNode){this.display.parentNode.removeChild(this.display)};if(this.parent){this.parent.child=null;this.parent=null}};function scanToLeft(dom,reference){var parent=0;if(dom.offsetParent && dom.offsetParent !==reference){parent=scanToLeft(dom.offsetParent,reference)};return dom.offsetLeft + parent};function scanToTop(dom,reference){var parent=0;if(dom.offsetParent && dom.offsetParent !==reference){parent=scanToTop(dom.offsetParent,reference)};return dom.offsetTop + parent};this.getTop=function(ref){if(isIE){return scanToTop(this.display,ref)}else{return this.display.offsetTop}};this.getLeft=function(ref){if(isIE){return scanToLeft(this.display,ref)}else{return this.display.offsetLeft}}};function AppFrame(base){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;App.activityDisplays=new Array(0);App.go=function(x){var newurl=x.dest;if(!App.frame.isWaiting()){App.confManager.set("file",newurl);App.frame.wait();App.frame.setActive();App.viewer.clear();App.viewer.init(newurl)};return true};App.launch=function(){var loadURL=App.config.loadURL.replace(/\?.*$/,App.confManager.getURLstring());var child=window.open(loadURL,"_blank","width="+base.clientWidth+",height="+base.clientHeight+",resizable=yes,status=yes");App.childlaunch=true};App.print=function(){var myUri="./printing/print_view.html";var child=window.open(myUri,"_blank","width="+base.clientWidth+",height="+base.clientHeight+",scrollbars=yes,resizable=yes,status=yes");setTimeout(function(){child.focus()}, 100 )};App.copy=function(){var myUri="http://grazr.com/config";var child=window.open(myUri+App.confManager.getURLstring(),"_blank");setTimeout(function(){child.focus()}, 100 )};App.about=function(){var myUri="http://grazr.com/info/learn.html";var child=window.open(myUri,App.config.linktarget);setTimeout(function(){child.focus()}, 100 )};App.share=function(dest,target){var shareURL=App.confManager.getURLstring();shareURL=shareURL.replace(/\&frameless\=true/,"");var target=(target) ? target : "_blank";var urlPrefix=/\?/;switch (dest){case "share": shareURL="http://www.grazr.com/share" + shareURL;break;case "facebook": shareURL=shareEncode(shareURL);shareURL=shareURL.replace(urlPrefix,"http://apps.facebook.com/grazrreader/?gzconf=");break;case "google": shareURL=shareEncode(shareURL).replace(new RegExp("http\:\/\/"),"");shareURL=shareURL.replace(urlPrefix,"http://www.google.com/ig/adde?moduleurl=grazr.com/jx/widget.pl?destEQGoogleIGQST");break;case "iphone": shareURL="http://www.grazr.com/iphone.html" + shareURL;break;case "netvibes": shareURL=shareEncode(shareURL);shareURL=shareURL.replace(urlPrefix,"http://www.netvibes.com/subscribe.php?type=api&url=http://grazr.com/jx/widget.pl?destEQNetvibesQST");break;case "pageflakes": shareURL=shareEncode(shareURL);shareURL=shareURL.replace(urlPrefix,"http://www.pageflakes.com/AddFlake.aspx?URL=http://grazr.com/jx/widget.pl?destEQPageflakesQST");break;case "windowslive": shareURL=shareEncode(shareURL);shareURL=shareURL.replace(urlPrefix,"http://www.live.com/?add=http://grazr.com/jx/widget.pl?destEQLive.comAQST");break;case "config": App.copy();return;break;case "readconfig": shareURL="http://grazr.com/config" + shareURL;break;case "addthis": if (App.config.file.match(/grazr.com\/data/g)){var social=App.config.file.replace(/data/,"read")}else{var social="http://www.grazr.com/read?file=" + App.config.file};shareURL="http://www.addthis.com/bookmark.php?pub=addthis&url=" + encodeURIComponent(social) + "&title=" + encodeURIComponent(document.title);break;default: break};var shareWin=window.open(shareURL,target);return false};function shareEncode (inputText){inputText=inputText.replace(/\&/g,"AMP");inputText=inputText.replace(/\=/g,"EQ");inputText=inputText.replace(/ /g,"SPC").replace(/%20/g,"SPC");return inputText};App.edit=function(target){var hostedFile=true;target=target || "_top";if (App.config.file.match(/grazr.com\/data/)){var editURL=App.config.file.replace(/\/data/,"/edit")}else{var editURL="http://grazr.com/edit?file=" + App.config.file;hostedFile=false};/* We're in the sidebar */ if (App.config.sidebar){if (document.cookie.indexOf("sessionid")==-1){/* Not logged in. Redirect content to edit page */ var loginWindow=window.open("/login","_content");return}var editWin=window.open(editURL,"_content")}else{var editWin=window.open(editURL,target)}};App.read=function(){var readURL=(App.config.file.match(/grazr.com\/data/)) ? App.config.file.replace(/\/data/,"/read") : "http://grazr.com/read?file=" + App.config.file;/* We're in the sidebar */ var target=(App.config.sidebar) ? "_content" : "_top";var readWin=window.open(readURL,target)};var Pipe=null;this.waiting=false;var viewer=null;var shield=new Object();shield.display=document.createElement("div");shield.display.className="noselectpane wait";var loadshield=new Object();loadshield.display=document.createElement("div");var basepanel=new GrazrPanel();basepanel.anchorTo(base);basepanel.setStyle("height:100%;width:100%");basepanel.setClass("gzbasepanel");if(isFF && !isSafari && ffVer < 3){var cssNode=document.createElement('style');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.media='screen';cssNode.title='inpage';cssNode.innerHTML='p,span,a{opacity: .999}';document.getElementsByTagName("head")[0].appendChild(cssNode)};this.setFont=function(fontFam){basepanel.setStyle("fontFamily:"+fontFam+",arial,sans-serif")};this.setFontSize=function(fntsize){try{basepanel.setStyle("fontSize:"+fntsize)}catch(er){basepanel.setStyle("fontSize:10pt")}};this.setFont(App.config.font);this.setFontSize(App.config.fontsize);var hdrH=0;var ftrH=0;var viewport=new FixedPanel();viewport.setClass("gzcontentpanel");viewport.display.id="content";basepanel.add(viewport);function setPort(panel,inTop,inBot){panel.setStyle("top:"+inTop+"px;bottom:"+inBot+"px;left:0px;right:0px")};setPort(viewport,hdrH,ftrH);this.removeHeader=function(hobj){if(App.config.frameless){return};hdrH-=hobj.getHeight();basepanel.remove(hobj);setPort(viewport,hdrH,ftrH)};this.addHeader=function(hobj){if(App.config.frameless){return};hobj.setStyle("top:"+hdrH+"px");basepanel.add(hobj);hdrH+=hobj.getHeight();setPort(viewport,hdrH,ftrH)};this.addFooter=function(fobj){if(App.config.frameless){return};fobj.setStyle("bottom:"+ftrH+"px");basepanel.add(fobj);ftrH+=fobj.getHeight();setPort(viewport,hdrH,ftrH)};this.reLayout=function(){};this.getBasePanel=function(){return basepanel};this.getViewport=function(){viewport.display.style.zoom="1";return viewport};var footer=new Footer(App);footer.addEvent("click",footer.getData);footer.setStyle("bottom:0px;left:0px;right:0px;width:100%");var titlebar=new TitleBar();this.addbar=new ToolBar();this.logo=new Logo();this.logo.addEvent("click",function(){var child=window.open("http://grazr.com",App.config.linktarget);setTimeout(function(){child.focus()}, 100 )});App.activityDisplays.push(this.logo);if(App.config.title){titlebar.setText(App.config.title)};this.setTitle=function(intxt){if(!App.config.title){(intxt)?null:intxt="...";intxt=unescape(intxt);intxt=intxt.replace(/\<[^\>]*\>/g," ");titlebar.setText(intxt);try{intxt=intxt.replace(/\&\#([^\;]*)\;/g,function(input){var code=input.match(/\&\#([^\;]*)\;/);return String.fromCharCode(code[1])});intxt=intxt.replace(/\<[^\>]*\>/g," ");document.title=intxt}catch(er){}}};var viewbutton=new Button("view",App.xl("Change Grazr View"));var homebutton=new Button("home",App.xl("Home"));var stopbutton=new Button("stop",App.xl("Stop"));var freshbutton=new Button("refresh",App.xl("Refresh"));var sidebutton=new Button("FFlaunch",App.xl("Open in Firefox Sidebar"));var editbutton=new Button("edit",App.xl("Edit this Reading List"));var readbutton=new Button("read",App.xl("Read this List"));sidebutton.addEvent("click",function(){var answer=confirm(App.xl("Install a Firefox add-on to show Grazr widgets in the sidebar?"));if (answer) document.location.href="http://www.grazr.com/tools/grazrsidebar.xpi"});readbutton.addEvent("click", App.read);editbutton.addEvent("click",function(){App.edit()});freshbutton.addEvent("click",this.addbar.reload);stopbutton.addEvent("click",App.datamanager.stop);this.addbar.addButton(homebutton);this.addbar.addButton(freshbutton);this.addButton=this.addbar.addButton;this.removeButton=this.addbar.removeButton;App.help=function(){var child=window.open("./gzpanel.html?view=o,-s,-3p&addbar=off&file=http://docs.grazr.com/manual/help.xml","_blank","width=300,height=600,resizable=yes,status=yes")};homebutton.addEvent("click", function(){if(location.href.match(/file/)){var homeURL=location.href.match(/file=(.*)$/)[1]}else{var homeURL=App.config.file};this.addbar.setAddress(homeURL);App.viewer.init(homeURL)});if(!isIphone){var topround=new RoundFrame(6,1);setTimeout(function(){topround.setClass("gztitlebar")},50);this.addHeader(topround);titlebar.setStyle("backgroundPosition: 0px -7px");this.addHeader(titlebar)};if(!isIphone){var botround=new RoundFrame(6,-1);this.addFooter(botround);setTimeout(function(){botround.setClass("gzfooter")},50);function displayLog(){alert(log)}};stopbutton.display.style.position="absolute";this.hasaddbar=false;this.addToolBar=function(){if(!this.hasaddbar){this.addHeader(this.addbar);loadshield.display.appendChild(stopbutton.display)};this.hasaddbar=true;App.confManager.set("addbar","on")};this.removeToolBar=function(){if(this.hasaddbar){this.removeHeader(this.addbar);loadshield.display.removeChild(stopbutton.display)};this.hasaddbar=false;App.confManager.clear("addbar")};this.toggleToolBar=function(){if(this.hasaddbar){this.removeToolBar()}else{this.addToolBar()}};this.hideMenu=function(){if(this.hasmenu){this.logo.setClass("gztitlelogo");titlebar.addLogo(this.logo);if(this.hasaddbar){this.removeToolBar();this.removeHeader(mymenu);this.addToolBar()}else{this.removeHeader(mymenu)};App.confManager.set("menu","off")};this.hasmenu=false};this.showMenu=function(){if(!this.hasmenu){this.logo.setClass("gzmenuitem");mymenu.addLogo(this.logo);if(this.hasaddbar){this.removeToolBar();this.addHeader(mymenu);this.addToolBar()}else{this.addHeader(mymenu)};App.confManager.clear("menu");this.hasmenu=true}};this.toggleMenu=function(){if(this.hasmenu){this.hideMenu()}else{this.showMenu()}};var mymenu=new Menu();if(App.config.menu=="off"){this.logo.setClass("gztitlelogo");titlebar.addLogo(this.logo)}else{this.showMenu()};this.getMenuHeight=function(){return mymenu.display.offsetHeight || 0};if(App.config.addbar=="on"){this.addToolBar();this.hasaddbar=true};if(!isIphone){if(privatelabel){this.addFooter(footer);botround.changeOffset("-"+footer.getHeight())}};this.setAddress=function(value){this.addbar.setAddress(value)};this.setActive=function(){for(var i=0;i<App.activityDisplays.length;i++){App.activityDisplays[i].setActive()};this.active=true};this.setUnActive=function(){for(var i=0;i<App.activityDisplays.length;i++){App.activityDisplays[i].setUnActive()};this.active=true};this.loading=function(){stopbutton.display.style.left=freshbutton.display.offsetLeft + freshbutton.display.parentNode.offsetLeft + "px";stopbutton.display.style.top=freshbutton.display.offsetTop + freshbutton.display.parentNode.offsetTop + freshbutton.display.parentNode.parentNode.offsetTop + "px";local.wait();basepanel.add(loadshield);local.isloading=true};this.wait=function(){if(App.keymanager){App.keymanager.enable(false)};local.waiting=true;basepanel.add(shield)};this.unwait=function(){if(local.waiting){local.waiting=false;if(App.keymanager){App.keymanager.enable(true)};local.setUnActive();basepanel.display.removeChild(shield.display)};if(local.isloading){loadshield.display.parentNode.removeChild(loadshield.display);local.isloading=false}};this.isWaiting=function(){return local.waiting};var mouseblock=new DomObj(document.createElement("div"));mouseblock.display.className="noselectpane";this.keymode=function(bool){if(!bool && this.inkeymode){mouseblock.removeEvent("mousemove");basepanel.remove(mouseblock);this.inkeymode=false}else{if(bool){basepanel.add(mouseblock);this.inkeymode=true;App.keymanager.typemode=true;mouseblock.addEvent("mousemove",function(){local.keymode(false)})}}}};function GZid(outline,pnum){if(outline){outline.id=pnum;(App.datamanager.state[pnum])?App.datamanager.state[pnum]=null:null;if(outline.childNodes){for(var i=0, j=outline.childNodes.length;i<j;i++){GZid(outline.childNodes[i].outline,pnum+"."+i)}}}};function stripTags(outline){if(outline && outline.childNodes){var newChild=new Array(0);for(var i=0, j=outline.childNodes.length;i<j;i++){if(outline.childNodes[i].outline){stripTags(outline.childNodes[i].outline);newChild.push(outline.childNodes[i])}};if(newChild.length>0){outline.childNodes=newChild}else{outline.childNodes=null}}};function DataManager(App){var local=this;var pipehome="http://api.grazr.com/";var Xd=new XDataPipe();Xd.setupPipe(pipehome+"xdgraze");var tid=-1;var trans=new Array(0);this.setID=GZid;this.rootNode=null;this.activeNode=null;this.state={};this.getData=function(uri,callback,rootid,target){App.frame.setActive();App.frame.loading();tid++;var ret=local.receiveData;trans[tid]={cb:callback,rid:rootid,tgt:target};Xd.getData(uri,ret,tid,trans)};function timeOut(tid){alert("Transaction Timed Out on "+tid);local.cancel(tid);App.frame.unwait();App.frame.setTitle("Timed out")};this.stop=function(){for(var i=0;i<trans.length;i++){if(trans[i]){local.cancel(i)}};App.frame.unwait()};this.cancel=function(tid){cleanTransfer(trans[tid].xid);trans[tid]=null};this.preprocess=function(data,rootid){try{var title=data.opml.childNodes[0].head.childNodes[0].title.childNodes[0].TextNode.nodeValue}catch(er){};if(!title){try{var title=data.opml.childNodes[0].head.childNodes[0].title.nodeValue}catch(er){var title="..."}};var feedbody=(data.opml.childNodes[1])?data.opml.childNodes[1].body || data.opml.childNodes[0].body:data.opml.childNodes[0].body;var receivedOutline={title:title,attribute:{title:title},childNodes:feedbody.childNodes};stripTags(receivedOutline);if(!receivedOutline.childNodes){receivedOutline.childNodes=[{outline:{attribute:{type:"rss-story",text:"No Posts"},childNodes:[{outline:{attribute:{type:"gz-title",text:"(no posts)"}}}]}}]};if(receivedOutline.childNodes[0].outline.attribute.type=="rss-story"){receivedOutline.attribute.xmlUrl=App.config.file;receivedOutline.attribute.type="rss"};GZid(receivedOutline,rootid);return receivedOutline};this.receiveData=function(data,intid){var receivedOutline=local.preprocess(data,trans[intid].rid);if (App.config["initial_load"]){if (App.config["anc"]){var tmpAnchor=fetchAnchor(receivedOutline,"anc");if (tmpAnchor !=-1){App.config["anc"]=tmpAnchor}};if (App.config["exp"]){var preProcList=App.config["exp"].split(',');var postProcList=new Array();for (var i=0;i < preProcList.length;i++){App.config["exp"]=preProcList[i];var tmpAnchor=fetchAnchor(receivedOutline,"exp");if (tmpAnchor !=-1){postProcList.push(tmpAnchor)}};App.config["exp"]=postProcList.join(',')};delete App.config["initial_load"]};var tmptarget=trans[intid].tgt;var datacall=trans[intid].cb;trans[intid]=null;datacall(receivedOutline,tmptarget)};function fetchAnchor(outline,widgetParam){/* Attempt to translate anchor into an absolute numeric */ var anchorArray=App.config[widgetParam].split(".");for (var i=0;i < anchorArray.length;i++){if (!isNaN(anchorArray[i])){anchorArray[i]--;/* subtract one from the value as the parameter is one-based, but data structure is zero-based. */ try{outline=outline.childNodes[anchorArray[i]].outline}catch(e){delete App.config[widgetParam];break}}else{/* Translate named anchor. First, determine if this level is valid to search. Generally, the answer is no. */ i==0 ? validLevel=true : validLevel=false;translateNamedAnchor(outline,anchorArray[i],validLevel);if (App.config["named_anchor"]){nameArray=App.config["named_anchor"].split('.');/* Transform original anchor array to set new context appropriately */ nameArray.shift();/* Drop off root node */ anchorArray=nameArray.concat(anchorArray.slice((i+1),(anchorArray.length)));/* Replace original anchor array with new one. */ /* Figure out how to move to the new node from here */ if (outline.id=="-1"){var traverse=new Array("-1")}else{var traverse=outline.id.split('.')};var nameTraverse=App.config["named_anchor"].split('.');nameTraverse.shift();traverse.shift();while (traverse.length > 0){traverse.shift();nameTraverse.shift()};i +=(nameTraverse.length -1 );outline=walkToFeedNode(outline,nameTraverse,widgetParam);delete App.config["named_anchor"];/* Reset named anchor search flag. */}else{delete App.config["anc"];/* No anchor was found in this branch. Invalid */ break}}};/* If we haven't declared the passed-in anchor invalid, it's allowable. Replace it with the translated anchor */ if (App.config[widgetParam]){return anchorArray.join(".")}else{return -1}};function translateNamedAnchor(outline,anchorName,currLevelValid){if ((outline.attribute.grazrNSname) && (currLevelValid)){if ((outline.attribute.grazrNSname.toLowerCase()==anchorName.toLowerCase())){App.config["named_anchor"]=outline.id}};if (outline){if(outline.childNodes){for(var i=0, j=outline.childNodes.length;i<j;i++){if ((!App.config["named_anchor"])){translateNamedAnchor(outline.childNodes[i].outline,anchorName,true)}}}}};function walkToFeedNode (outline,destination,widgetParam){for (var i=0;i < destination.length;i++){try{outline=outline.childNodes[destination[i]].outline}catch(e){delete App.config[widgetParam];break}};return outline};function setAnchorState(anchor){var anchorArray=anchor.split('.');for (var i=1;i < anchorArray.length;i++){anchorArray[i]=anchorArray[i-1] + "." + anchorArray[i];App.datamanager.state[anchorArray[i]]={expanded:true,loaded:true}}};function resetState(outline){var id=outline.id;(App.datamanager.state[id])?App.datamanager.state[id]=null:null;if(outline.childNodes){for(var i=0;i<outline.childNodes.length;i++){resetState(outline.childNodes[i].outline)}}};this.resetState=resetState;/* Get current expansion state */ this.getExpansion=function(){var state=App.datamanager.state;var outputState=[];for (var id in state){if (state[id].expanded){var idArray=id.split(".");idArray.shift();for (var i=0;i < idArray.length;i++){idArray[i]++};outputState.push(idArray.join("."))}};return outputState.join(",")};/* Output an XML representation of all the data currently in the widget. */ this.getXML=function(){var xmlData={opml:{attribute:{version:"2.0"},childNodes:[{body:{childNodes:[]}}]}};xmlData.opml.childNodes[0].body=cloneObject(local.rootNode);/* Make a copy of the current node structure and strip hidden nodes. */ var outputXML=stripHiddenNodes(xmlData.opml.childNodes[0].body.childNodes);return extractXML(xmlData)};function cloneObject(data){if(typeof data=='object'){var copy=new Object();var type;for(var prop in data){type=typeof data[prop];type=(type=='object' && data[prop].length)?"array":type;switch(type){case "id": break;case "array": copy[prop]=new Array();for(var i=0, j=data[prop].length;i<j;i++){copy[prop][i]=cloneObject(data[prop][i])};break;case "object": copy[prop]=cloneObject(data[prop]);break;default: if (prop !="grazrNSitemtext" && prop !="grazrNSlinktarget"){copy[prop]=data[prop]};break}};return copy};return data};/* Remove nodes from an outgoing XML file. */ function stripHiddenNodes (nodes){for (var i=0;i < nodes.length;i++){if ((App.datamanager.state[nodes[i].outline.id]) && ((!App.datamanager.state[nodes[i].outline.id].expanded ) && nodes[i].outline.childNodes)){delete nodes[i].outline.childNodes}else if (nodes[i].outline.childNodes){stripHiddenNodes(nodes[i].outline.childNodes)}}};function extractXML(data,tab){var txtdata="";var tab=tab || "";if(data && data.length){for(var i=0,j=data.length;i<j;i++){txtdata+=extractXML(data[i],"\t"+tab)}}else{for(var prop in data){switch(prop){case "childNodes": txtdata+="\n"+extractXML(data[prop],tab)+"\n"+tab;break;case "TextNode": txtdata+=tab+data[prop].nodeValue;break;case "attribute": break;case "nodeValue": case "next": case "previous": case "parent": case "clone": case "map": break;default: var tag=prop.replace(new RegExp(/NS/),":");txtdata+=tab+"<"+tag+processAttributes(data[prop]);if(data[prop].childNodes || data[prop].nodeValue ){txtdata+=" >"+extractXML(data[prop],tab)+"</"+tag+">\n"}else{txtdata+=" />\n"};break}}};return txtdata;/* Make a copy of the current node structure and strip hidden nodes. */ var outputXML=stripHiddenNodes(xmlData.opml.childNodes[0].body.childNodes);return extractXML(outputXML)};function processAttributes(data){var nsFix=/NS/g;if(data.attribute){var txtdata="";for(prop in data.attribute){/* ensure that we don't copy the clone method into the OPML */ if (prop !="clone"){if(data.attribute[prop]=="text" || data.attribute[prop]=="folder"){return txtdata};if (data.attribute[prop]){/* Revert Namespace hack back to colon. */ /* Replace the two most commonly screwed up characters. double quote and ampersand. */ txtdata+=" "+prop.replace(nsFix,":")+"=\""+data.attribute[prop]+"\""}}};return txtdata};return ""};/* Remove nodes from an outgoing XML file. */ function stripHiddenNodes (nodes){for (var i=0;i < nodes.length;i++){if ((!App.datamanager.state[nodes[i].outline.id].expanded ) && nodes[i].outline.childNodes){delete nodes[i].outline.childNodes}else if (nodes[i].outline.childNodes){stripHiddenNodes(nodes[i].outline.childNodes)}};return nodes};function extractXML(data,tab){var txtdata="";var tab=tab || "";if(data && data.length){for(var i=0,j=data.length;i<j;i++){txtdata+=extractXML(data[i],"\t"+tab)}}else{for(var prop in data){switch(prop){case "childNodes": txtdata+="\n"+extractXML(data[prop],tab)+"\n"+tab;break;case "TextNode": txtdata+=tab+data[prop].nodeValue;break;case "attribute": break;case "nodeValue": case "next": case "previous": case "parent": case "clone": case "map": break;default: var tag=prop.replace(new RegExp(/NS/),":");txtdata+=tab+"<"+tag+processAttributes(data[prop]);if(data[prop].childNodes || data[prop].nodeValue ){txtdata+=" >"+extractXML(data[prop],tab)+"</"+tag+">\n"}else{txtdata+=" />\n"};break}}};return txtdata};function processAttributes(data){var nsFix=/NS/g;if(data.attribute){var txtdata="";for(prop in data.attribute){/* ensure that we don't copy the clone method into the OPML */ if (prop !="clone"){if(data.attribute[prop]=="text" || data.attribute[prop]=="folder"){return txtdata};if (data.attribute[prop]){/* Revert Namespace hack back to colon. */ /* Replace the two most commonly screwed up characters. double quote and ampersand. */ txtdata+=" "+prop.replace(nsFix,":")+"=\""+data.attribute[prop]+"\""}}};return txtdata};return ""}};function ConfigManager(){function merge(obj1,obj2){for(var prop in obj1){obj2[prop]=obj1[prop]}};var configpanel=null;var defaultOpt={file:"http://www.grazr.com/info/samplefeeds.xml",font:"arial,sans-serif",fontsize:"10pt",linktarget:"grazrwin"};if(isIphone){defaultOpt.font="helvetica,sans-serif";defaultOpt.fontsize="14pt"};App.config=new Object();merge(defaultOpt,App.config);if(window.privatelabel){for(prop in privatelabel.config){var value=privatelabel.config[prop];prop=(prop=="toolbar")?"addbar":prop;App.config[prop]=value};merge(App.config,defaultOpt)};var urlOpt=new Object();var inputURL=location.href;inputURL=inputURL.replace(/\&amp\;/g,"&");App.config.child=false;var arg1=inputURL.split(/[?|&]file=/);if(arg1[1]){arg1[1]=arg1[1].replace(/\&endfile.*/,"");App.config.file=arg1[1];urlOpt.file=arg1[1]};var split=arg1[0].split("?");if(split[1]){var options=split[1].split("&");var pair;for (var i=0;i<options.length;i++){pair=options[i].split("=");var id=pair[0].toLowerCase();var val=unescape(pair[1]);id=(id=="toolbar")?"addbar":id;App.config[id]=val;if(id !="dis"){urlOpt[id]=val}}};App.config.loadURL=inputURL;loadURL=inputURL;/* Sidebar specific configuration. */ if (App.config.linktarget=="_content" && isMoz){App.config.sidebar=1;App.config.edoff=0;App.config.rdoff=0};this.clear=function(parameter,value){delete App.config[parameter];delete urlOpt[parameter]};this.set=function(parameter,value){App.config[parameter]=value;urlOpt[parameter]=value};this.getURLstring=function(){var opt="?";var tObj=new Object();for(var prop in urlOpt){if(urlOpt[prop] !=defaultOpt[prop] && prop !="frameless" && prop !="edoff" && prop !="rdoff"){tObj[prop]=urlOpt[prop]}};for(prop in tObj){if(prop !="file"){opt+=prop+"="+tObj[prop]+"&"}};opt=opt.replace(/\&$/,"");if(tObj["file"] && (tObj["file"] !=defaultOpt["file"])){if(opt !="?"){opt+="&"};opt+="file="+tObj["file"]};opt=(opt=="?")?"":opt;return opt}};function StyleManager(){function zapChild(myparent,mychild){myparent.removeChild(mychild)};this.removeCurrentTheme=function(){var hd=document.getElementsByTagName("head")[0];var current=document.getElementById("gzskin");if(current){hd.removeChild(current)}};this.setTheme=function(theme){if(theme=="default"){this.removeCurrentTheme()};App.confManager.set("theme",escape(theme));if(theme.match(/^[^\/]*$/)){theme="static.grazr.com/theme/"+theme+"/grazr.css"};var styleinfo=document.createElement("link");styleinfo.setAttribute("rel","stylesheet");styleinfo.setAttribute("href","http://"+unescape(theme));var hd=document.getElementsByTagName("head")[0];var current=document.getElementById("gzskin");if(current){hd.removeChild(current)};styleinfo.id="gzskin";hd.appendChild(styleinfo)};if(App.config.theme){this.setTheme(App.config.theme)}};function ViewManager(App,inKey){var local=this;var viewtext=new Array(0);var views=new Array(0);var defaultlist=["s","o","3p","r"];var availViews={o:["outline",Outline],s:["slider",Slider],"3p":["three pane",ThreePane],r:["river",River]};var total=0;function setView(key){if(availViews[key] && !availViews[key].used){viewtext.push(availViews[key][0]);views.push(key);availViews[key].used=true;total++}};if(App.config.view){var setviews=App.config.view.split(",");for (var i=0;i<setviews.length;i++){setView(setviews[i])}};for(var i=0;i<defaultlist.length;i++){if(!availViews[defaultlist[i]].used && !availViews[defaultlist[i]].block){setView(defaultlist[i])}};if(total<1){setView("s")};if(inKey){var viewindex=-1;for(var x=0;x<views.length;x++){(views[x]==inKey)?viewindex=x:null};var lastview=viewindex}else{var viewindex=0;var lastview=0};App.viewer=new availViews[views[viewindex]][1](App);App.frame.getViewport().add(App.viewer);var animEngine2=new FXengine(20);var indicate=new FXaction(.45);var stopbox=new FXaction(0);this.getViewIndex=function(){return views[viewindex]};this.changeViewNum=function(index){local.changeView(views[index])};this.changeView=function(key){App.confManager.set("view",key);var vi=-1;for(var x=0;x<views.length;x++){(views[x]==key)?vi=x:null};if(!views[vi]){return};viewindex=vi;if(viewindex==lastview){return};lastview=viewindex;App.frame.wait();var tmp=new availViews[key][1](App);var oldViewer=App.viewer.type;App.viewer.type=tmp.type;App.frame.getViewport().add(tmp);if(tmp.type=="river"){data=App.config.file}else if(oldViewer=="river"){data=App.config.file}else{data=(App.datamanager.rootNode)?App.datamanager.rootNode:null};tmp.transition(data);var olddim=App.viewer.getNodeDim();var newdim=tmp.getNodeDim();var halfway=newdim.Y - (tmp.display.clientHeight/2);tmp.display.scrollTop=halfway;if(tmp.type=="outline"){tmp.setScrollPos({X:0,Y:halfway})};olddim.Y=olddim.Y - App.viewer.display.scrollTop;newdim.Y=newdim.Y - tmp.display.scrollTop;App.frame.wait();App.viewer.clearView();App.viewer=tmp;if (oldViewer=="river" || key=="r"){return};var box=document.createElement("div");box.className="gzghost";box.style.position="absolute";box.style.height=olddim.H+"px";box.style.width=olddim.W+"px";box.style.top=olddim.Y+"px";box.style.left=olddim.X+"px";App.frame.getViewport().display.appendChild(box);indicate.animFunction=function(frac){frac=1-(Math.pow(1-frac,3.5));box.style.height=(olddim.H+(newdim.H-olddim.H)*frac)+"px";box.style.width=(olddim.W+(newdim.W-olddim.W)*frac)+"px";box.style.left=(olddim.X+(newdim.X-olddim.X)*frac)+"px";box.style.top=(olddim.Y+(newdim.Y-olddim.Y)*frac)+"px"};stopbox.animFunction=function(frac){box.parentNode.removeChild(box);App.frame.unwait()};indicate.chainTo(stopbox);animEngine2.addAction(indicate)}};function FormManager(){var local=this;var results={};var formvals={};var storedData={};this.clearForms=function(){results={};formvals={};storedData={}};this.getResultNode=function(name){if(results[name]){return results[name]}else{return null}};this.addResultNode=function(name,node){results[name]=node};this.storeFormVals=function(name,elements){formvals[name]=new Array();for(var i=0;i<elements.length;i++){if(elements[i].multiple){var selectarray=new Array();selectarray.multiple=true;for(var j=0;j<elements[i].length;j++){selectarray.push({selected:elements[i][j].selected})};formvals[name].push(selectarray)}else{formvals[name].push({value:elements[i].value,checked:elements[i].checked})}}};this.getFormVals=function(name){return formvals[name]};this.getFormStateObj=function(){return formvals};this.storeResults=function(name,data,uri){storedData[name]=data};this.getResults=function(name){return storedData[name]};this.getValues=function(name){var uri="";var myForm=document[name];var elems=myForm.elements;App.forms.storeFormVals(name,elems);var delim="?";for(var i=0;i<elems.length;i++){var inputname=elems[i].name;var inputvalue=encodeURIComponent(elems[i].value);inputvalue=inputvalue.replace(/\%20/g,"+");switch(elems[i].type){case "radio": if(elems[i].checked==true){uri+=delim+inputname+"="+inputvalue;delim="&"};break;case "submit": break;case "checkbox": if(elems[i].checked==true){uri+=delim+inputname+"="+inputvalue;delim="&"};break;default: if(elems[i].multiple){for(var j=0;j<elems[i].length;j++){if(elems[i][j].selected){inputvalue=encodeURI(elems[i][j].value);inputvalue=inputvalue.replace(/\+/g,"%2B");inputvalue=inputvalue.replace(/\%20/g,"+");uri+=delim+inputname+"="+inputvalue;delim="&"}}}else{uri+=delim+inputname+"="+inputvalue;delim="&"};break}};if(results[name] && results[name].display){App.viewer.resetNode(results[name])};uri="http://script.grazr.com/gzscript"+uri;App.datamanager.getData(uri,dataReceive);function dataReceive(receivedOutline,target){results[name].display.style.display="block";if(results[name] && results[name].display){var outline=results[name].outline;if(results[name].setUri){results[name].setUri(uri)};outline.attribute.url=uri;App.datamanager.setID(receivedOutline,outline.id);App.datamanager.state[outline.id]={};var state=App.datamanager.state[outline.id];if(outline.attribute.type=="gzresult"){if(receivedOutline.childNodes[0].outline.attribute.type=="rss-story"){outline.attribute.type="rss";results[name].enable()}else{outline.attribute.type="include";results[name].enable()}};outline.childNodes=receivedOutline.childNodes;state.loaded=true;App.viewer.nodeAction(results[name])}else{if(receivedOutline.childNodes[0].outline.attribute.type=="rss-story"){receivedOutline.attribute.type="rss"}else{receivedOutline.attribute.type="include"};App.forms.storeResults(name,receivedOutline,uri)};App.frame.unwait()}}};function haltBubble(e){if (e.stopPropagation){e.stopPropagation()};e.cancelBubble=true};this.keyread=function(e){var retval=true;if (e.target.tagName.match(/input|textarea|select/i)){e.gzbubble=true;return true};var code=e.keyCode;if (e.keyCode==0){code=e.charCode};if (code > 96 && code < 123){code=code - 32};var comparecode=code + "" + e.altKey + e.shiftKey + e.ctrlKey;if (((comparecode=="77falsefalsetrue") || (comparecode=="13falsefalsetrue")) && !App.frame.isloading){App.frame.toggleMenu();e.gzbubble=true;return true};var ie_keymap={"107": "plus", "187": "plus", "109": "minus", "189": "minus"};var keymap={"43": "plus", "45": "minus", "38": "up", "63232": "up", "40": "down", "63233": "down", "39": "right", "63235": "right", "37": "left", "63234": "left", "13": "enter"};if (isIE){handled=(ie_keymap[code]) ? ie_keymap[code] : false};handled=(keymap[code]) ? keymap[code] : false;if (!App.frame.inkeymode){App.frame.keymode(true)};if (handled){App.viewer.key(handled, e);return false}else{e.gzbubble=true;return true}};function KeyManager(App){this.typemode=false;var local=this;var doc=new DomObj(document);this.enable=function(arg){};function start(arg){if (arg){if (isIE || isSafari){doc.addEvent("keydown", App.keyread)}else{doc.addEvent("keypress", App.keyread)}}};start(true)};function Viewer(){this.highlight=function(node){if(this.currentHL && this.currentHL.display){this.currentHL.display.className=this.currentHL.nodeclass};node.display.className=node.nodeclass+" gznodehl";this.currentHL=node}};var viewerproto=new Viewer();function Outline(App){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;this.display=document.createElement("div");this.display.id="outline";setStyle("position:absolute;height:100%;width:100%;overflow:auto",this.display);var outerFrame=document.getElementById("grazr");if(isIphone){setStyle("height:auto",this.display)};this.type="outline";this.currentHL=null;var currentView=null;var currentNode=null;var toplist=null;function expandAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && !state.expanded && state.loaded && type !="link"){expand(node)};(node.child)?expandAll(node.child):null}}};function collapseAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];(node.child)?collapseAll(node.child):null;var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && state.expanded && type !="link"){collapse(node)}}}};var exp=false;this.toggleExpansion=function(){if(exp){setActive();collapseAll(toplist);local.currentHL=null;currentNode=null;exp=false}else{expandAll(toplist);exp=true}};this.getNodeDim=function(){if(currentView){var Xset=currentView.getLeft(local.display);var Yset=currentView.getTop(local.display);return{X:Xset,Y:Yset,H:currentView.display.offsetHeight,W:currentView.display.offsetWidth}}else{return{X:0,Y:0,H:0,W:0}}};this.setScrollPos=function(obj){setTimeout(function(){local.display.scrollLeft=obj.X;local.display.scrollTop=obj.Y}, 50)};this.getScrollPos=function(){return{X:local.display.scrollLeft,Y:local.display.scrollTop}};this.clearView=function(){App.frame.removeButton(expandcollapsebutton);local.clear();this.display.parentNode.removeChild(this.display);expandcollapsebutton.removeEvent("click")};this.clear=function(){(toplist)?toplist.destroy():null;(currentView)?currentView=null:null;toplist=null;local.currentHL=null;currentNode=null};function renderList(gzOutline,target){var list=new List(gzOutline,target);if(isIphone){list.display.style.height="auto"};if(App.datamanager.activeNode==gzOutline){currentView=list;setActive(list.parent)};if(App.datamanager.rootNode==gzOutline){toplist=list};for(var i=0, j=gzOutline.childNodes.length;i<j;i++){if(App.datamanager.state[gzOutline.childNodes[i].outline.id]){var state=App.datamanager.state[gzOutline.childNodes[i].outline.id]}else{var state={}};if( state.expanded ){renderList(gzOutline.childNodes[i].outline,list.index[i])}};if(target){list.display.className="outline";target.display.parentNode.insertBefore(list.display,target.display.nextSibling)}else{local.display.appendChild(list.display)};return list};this.resetNode=function(node){setActive();var state=App.datamanager.state[node.outline.id];var type=node.outline.type;if(state && state.expanded && type !="link"){collapse(node)}};this.iPhoneSize=function(){var parent=document.getElementById("grazr");var contentHeight=this.display.scrollHeight+App.frame.getMenuHeight()+20;var newHeight=(contentHeight < window.outerHeight+20)?window.outerHeight+20:contentHeight;parent.style.height=newHeight+"px"};this.showContent=function(gzOutline,target){if(!App.datamanager.activeNode){setActive()};(target)?null:target=null;renderList(gzOutline,target);if(isIphone){this.iPhoneSize()}};var currentNode=null;function setActive(gzNode){(currentNode)?currentNode.setNodeClass("gznode"):null;if(gzNode){/* Special case for when we're restoring expansion states. We don't want to set focus then. */ if (App.config["exp"] && gzNode.outline.id !="-1." + App.config["anc"]){/* Remove this node from the expanded list if we've already fetched it. */ var expNode=gzNode.outline;if (expNode.childNodes){var expArray=App.config["exp"].split(",");for (var i=0;i < expArray.length;i++){if (expArray[i]==expNode.id){delete expArray[i]}};if (expArray.length==0){delete App.config["exp"]}else{App.config["exp"]=expArray.join(",")}}}else{gzNode.setNodeClass(gzNode.nodeclass+" gznodeactive")};currentNode=gzNode;App.datamanager.activeNode=gzNode.outline;if(gzNode.outline.title){App.frame.setTitle(gzNode.outline.title)}else{App.frame.setTitle(gzNode.outline.attribute.text)}}else{App.datamanager.activeNode=App.datamanager.rootNode;App.frame.setTitle(App.datamanager.rootNode.title);currentNode=null}};function load(node){App.frame.setActive();App.datamanager.getData(node.myUri,local.insert,node.outline.id,node)};function expand(node){var state=App.datamanager.state[node.outline.id];if(!state.expanded){local.showContent(node.outline,node);state.expanded=true}};function collapse(node){var state=App.datamanager.state[node.outline.id];if(state.expanded){node.child.destroy();node.child=null;state.expanded=false;if(isIphone){local.iPhoneSize()}}};this.insert=function(outline,target){var state=App.datamanager.state[outline.id];if(!state){App.datamanager.state[outline.id]={};state=App.datamanager.state[outline.id]};target.outline.childNodes=outline.childNodes;expand(target);state.loaded=true;App.frame.unwait()};this.nodeAction=function(gzNode){var outline=gzNode.outline;var state=App.datamanager.state[outline.id];var type=gzNode.outline.attribute.type;setActive(gzNode);if(!type){type="normal text"};if(type=="link" && App.config["anclink"] !="off"){gzNode.activateLink();return}else if (App.config["anclink"]=="off" && type=="link"){delete App.config["anclink"];return};if(type.match(/^include|rss$/) && !state.loaded ){load(gzNode)}else{if(state.expanded){setActive(gzNode.parent.parent);collapse(gzNode)}else{expand(gzNode)}}};this.initReceive=function(outline){App.datamanager.rootNode=outline;App.datamanager.activeNode=outline;local.showContent(outline);setActive();/* Restore expanded state. */ if (App.config["exp"]){var stateList=App.config["exp"].split(",");for (var i=0;i < stateList.length;i++){var explist=toplist;/* Reset list to top for each branch. */ var stateArray=stateList[i].split(".");for (var j=0;j < stateArray.length;j++){/* Make sure we're not overlapping any other expanded branches. */ explist=explist.index[stateArray[j]];var stateSlice=stateArray.slice(0,j+1);if ((App.datamanager.state["-1." + stateSlice.join(".")]) && (!App.datamanager.state["-1." + stateSlice.join(".")].expanded)){local.nodeAction(explist)};explist=explist.child}}};/* Initialize anchor post-widget display. This way, we don't hold up the rest of the interface if there's a remote fetch. */ if (App.config["anc"]){var anchorArray=App.config["anc"].split(".");var list=toplist;for (var i=0;i < anchorArray.length;i++){list=list.index[anchorArray[i]];if (list.nodeclass=="gznode"){var ancSlice=anchorArray.slice(0,i+1);if (!App.datamanager.state["-1." + ancSlice.join(".")].expanded){local.nodeAction(list)}else{/* If we're here, it means that this node was already expanded, but not highlighted. */ list.setNodeClass(list.nodeclass+" gznodeactive")};list=list.child}else{break}}};App.frame.unwait()};this.transition=function(data){local.clear();if(typeof data=="object"){App.frame.wait();App.datamanager.rootNode=data;local.showContent(data);App.frame.unwait()}else{App.datamanager.state={};App.frame.setTitle(App.xl("Loading..."));var uri=data;App.confManager.set("file",uri);App.datamanager.getData(uri,local.initReceive,-1)}};this.init=function(data){App.forms.clearForms();local.transition(data)};var expandcollapsebutton=new Button("expandcollapse",App.xl("Expand All / Collapse All"));expandcollapsebutton.addEvent("click",function(){App.viewer.toggleExpansion()});App.frame.addButton(expandcollapsebutton);this.blinkNode=function(node){var animEngine=new FXengine(20);var indicate=new FXaction(1.5);var end=new FXaction(0);end.animFunction=function(){node.display.style.background=null};indicate.chainTo(end);indicate.animFunction=function(frac){node.display.style.marginLeft=Math.round(20*Math.sin(Math.PI*frac))+"%";node.display.style.fontSize=Math.round(100+100*Math.sin(Math.PI*frac))+"%";node.display.style.background="rgb(255,255,"+Math.round(255*frac)+")"};animEngine.addAction(indicate)};function scrollIntoView(node){var pos=node.getTop(local.display);var bnd=local.getBoundary();var margin=5;var nodebottom=pos+node.display.offsetHeight;if(pos < bnd.min){local.display.scrollTop=pos-margin};if(nodebottom > bnd.max){local.display.scrollTop=local.display.scrollTop + (nodebottom-bnd.max+margin)}};function setHL(node){var tmpe={gztarget:node};return node.highlight(tmpe)};function useItem(e){if(local.currentHL){e.gztarget=local.currentHL;local.currentHL.getData(e);setHL(local.currentHL)}};function getPrevActive(tgt){var node=tgt.getPrevSibling();while(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child){node=node.getLastChild()};if(!node){node=tgt.getParent()};return node};function getNextActive(node){if(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child){var target=node.getChild()}else{var target=node.getNextSibling();while(!target){node=node.getParent();if(!node){return node};target=node.getNextSibling()}};return target};function prevItem(){if(!App.viewer.currentHL){if(this.child){var target=this.child.index[0]};while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=getPrevActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getPrevActive(target)};if(target){scrollIntoView(target)}}};function nextItem(){if(!App.viewer.currentHL){var target=toplist.index[0];while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=App.viewer.currentHL.getNextSibling();var target=getNextActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getNextActive(target)};if(target){scrollIntoView(target)}}};this.getBoundary=function(){var min=this.display.scrollTop;var max=min + this.display.clientHeight;return{min:min,max:max}};this.key=function(code,e){switch(code){case "minus": useItem(e);return false;break;case "plus": useItem(e);return false;break;case "enter": useItem(e);return false;break;case "right": useItem(e);return false;case "left": useItem(e);return false;break;case "up": prevItem();return false;break;case "down": nextItem();return false;break;default: break}}};Outline.prototype=viewerproto;function Slider(App){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;this.type="slider";var currentView=null;this.currentHL=null;var list=null;var btnH=(isIphone)?25:16;var outer=new GrazrPanel();outer.setStyle("height:100%");outer.setStyle("width:100%");outer.setStyle("overflow:hidden");var viewFrame=new GrazrPanel();viewFrame.setStyle("overflow:hidden");outer.add(viewFrame);var sliderpanel=new GrazrPanel();sliderpanel.setStyle("height:100%");sliderpanel.setStyle("width:100%");if(isIE){viewFrame.setStyle("borderLeft:"+btnH+"px solid #FFF");viewFrame.setStyle("height:100%");viewFrame.setStyle("width:100%")}else{viewFrame.setRect(btnH,0,0,0)};this.backbutton=new BackButton();var button=this.backbutton;button.setStyle("height:100%");button.setStyle("width:"+btnH+"px");viewFrame.add(sliderpanel);outer.add(viewFrame);outer.add(button);button.display.className="button";this.getTopList=function(){return currentView};function setHL(node){var tmpe={gztarget:node};if(node.highlight(tmpe)){local.currentHL=node;return true}else{return false}};this.useItem=function(){if (local.currentHL){local.nodeAction(local.currentHL);setHL(local.currentHL)}};this.insert=function(outline,target){var state=App.datamanager.state[outline.id];if (!state){App.datamanager.state[outline.id]={};var state=App.datamanager.state[outline.id]};state.loaded=true;state.expanded=true;target.outline.childNodes=outline.childNodes;local.showContent(target.outline,1)};this.nodeAction=function(gzNode){var outlineNode=gzNode.outline;var state=App.datamanager.state[outlineNode.id];var type=gzNode.outline.attribute.type;if(type=="link" && App.config["anclink"] !="off"){gzNode.activateLink();return}else if (App.config["anclink"]=="off" && type=="link"){delete App.config["anclink"];return};if(state.loaded){App.frame.wait();state.expanded=true;var delaynode=gzNode;setTimeout(function(){local.showContent(delaynode.outline,1)},10)}else{App.frame.wait();App.frame.setActive();App.datamanager.getData(gzNode.myUri,local.insert,outlineNode.id,gzNode)};gzNode=null;outlineNode=null};function getParent(id){var map=id.split(/\./);var out=App.datamanager.rootNode;for(var i=1;i<map.length - 1;i++){(map[i]<0)?out=App.datamanager.rootNode:out=out.childNodes[map[i]].outline};return out};this.backup=function(e){e.gzbubble=true;if(currentView.outline !=App.datamanager.rootNode){App.frame.wait();var lastViewindex=currentView.outline.id.match(/\d+$/);local.showContent(getParent(currentView.outline.id),-1);currentView.index[lastViewindex].setNodeClass("gznode gznodelast");var act=currentView.index[lastViewindex];setHL(act)}};button.addEvent("click",local.backup);var framerate=(isIphone)?15:40;var animEngine=new FXengine(framerate);var slide=new FXaction(.25);var stopWait=new FXaction(0);this.resetNode=function(){return};this.iPhoneSize=function(list){var parent=document.getElementById("grazr");var contentHeight=list.display.scrollHeight+App.frame.getMenuHeight()+20;var newHeight=(contentHeight < window.outerHeight+20)?window.outerHeight+20:contentHeight;parent.style.height=newHeight+"px";var imglist=list.display.getElementsByTagName("img");for(var i=0;i<imglist.length;i++){imglist[i].onload=function(){local.iPhoneSize(list)}}};this.showContent=function(outline,direction,target){if(outline.id=="-1" || outline.id=="-1.-1"){this.backbutton.deactivate()}else{this.backbutton.activate()};if(currentView){var temp=currentView.container;currentView.destroy();sliderpanel.remove(temp);local.currentHL=null;currentView=null;temp=null};if(isIphone){setTimeout(function(){window.scrollTo(0,1)},10)};var listdisp=new List(outline,target);var list=new GrazrPanel();list.add(listdisp);listdisp.container=list;currentView=listdisp;App.datamanager.activeNode=outline;App.frame.setTitle(outline.title);var width=sliderpanel.display.clientWidth;var height=sliderpanel.display.clientHeight;if(direction !=0 && direction !=-1){direction=1};list.setXY(direction*width,0);list.setHW(height,width);sliderpanel.add(list);list.setStyle("overflow:auto");var pre=list.display.clientWidth;pre=list.display.clientWidth;list.setStyle("overflow:hidden");var scroll=sliderpanel.display.scrollTop;sliderpanel.remove(list);list.setHW(height,pre);sliderpanel.add(list);list.display.scrollTop=outline.scrollPos;list.display.scrollTop=outline.scrollPos;slide.animFunction=function(frac){frac=1-(Math.pow(1-frac,3.5));list.setXY(direction*width+(-1*direction)*width*frac,0)};stopWait.animFunction=function(){list.setStyle("height:auto;width:100%;overflow:auto");if(isIphone){local.iPhoneSize(list)};list.setStyle("height:100%");setTimeout(App.frame.unwait,10)};slide.chainTo(stopWait);if(direction==0){list.setStyle("height:100%");list.setStyle("width:100%");list.setStyle("overflow:auto")}else{setTimeout(function(){animEngine.addAction(slide)},10)}};this.display=outer.display;this.setScrollPos=function(obj){setTimeout(function(){currentView.display.parentNode.scrollLeft=obj.X;currentView.display.parentNode.scrollTop=obj.Y;currentView.outline.scrollPos=obj.Y}, 50)};this.getScrollPos=function(){if(currentView){return{X:currentView.display.parentNode.scrollLeft,Y:currentView.display.parentNode.scrollTop}};return{X:0,Y:0}};this.getNodeDim=function(){if(currentView){return{X:currentView.display.offsetLeft+btnH,Y:currentView.display.offsetTop,H:currentView.display.parentNode.offsetHeight,W:currentView.display.parentNode.offsetWidth}}else{return{X:0,Y:0,H:0,W:0}}};this.clear=function(){if(currentView){currentView.destroy()};currentView=null};this.clearView=function(){if(currentView){currentView.destroy()};this.display.parentNode.removeChild(this.display);button.removeEvent("click")};function resetId(outline,id){outline.id=id;if(outline.childNodes){for(var i=0, j=outline.childNodes.length;i<j;i++){GZid(outline.childNodes[i].outline,id+"."+i)}}};function prefetchState(target){var outlineNode=target;var myUri=outlineNode.attribute.url || outlineNode.attribute.URL || outlineNode.attribute.htmlUrl || outlineNode.attribute.htmlURL || outlineNode.attribute.xmlUrl || outlineNode.attribute.xmlurl || outlineNode.attribute.xmlURL || "about:blank";if (myUri !="about:blank"){App.datamanager.getData(myUri,local.prefetchReceive,target.id,target)}};this.prefetchReceive=function(outline,target){var state=App.datamanager.state[outline.id];if (!state){App.datamanager.state[outline.id]={};var state=App.datamanager.state[outline.id]};state.loaded=true;target.childNodes=outline.childNodes};this.initReceive=function(outline){App.datamanager.rootNode=outline;App.datamanager.activeNode=outline;local.showContent(outline,1);if (App.config["exp"]){var expList=App.config["exp"].split(",");var rootList=currentView;var rootOutline=outline;for (var i=0;i < expList.length;i++){outline=App.datamanager.rootNode;var expState=expList[i].split('.');for (j=0;j < expState.length;j++){outline=outline.childNodes[expState[j]].outline;prefetchState(outline)}};delete App.config["exp"];/* reset to root node in case there's an anchor */ outline=App.datamanager.rootNode};/* If an anchor is present, load it. Simulate a click for the last element. */ if (App.config["anc"]){var anchorList=App.config["anc"].split(".");var list=currentView;var i=0;for (i=0;i < anchorList.length-1;i++){outline=outline.childNodes[anchorList[i]].outline;local.showContent(outline,1)};/* Make sure we don't try to expand past a text node. */ if (currentView.index[anchorList[i]].index !=0){local.nodeAction(currentView.index[anchorList[i]])};delete App.config["anc"]}};this.transition=function(data){if(currentView){currentView.destroy();currentView=null};local.currentHL=null;if(typeof data=="object"){App.frame.wait();App.datamanager.rootNode=data;if(!App.datamanager.activeNode){App.datamanager.activeNode=data};local.showContent(App.datamanager.activeNode,0);App.frame.unwait()}else{App.datamanager.state={};this.backbutton.deactivate();App.frame.setTitle(App.xl("Loading..."));var uri=data;App.confManager.set("file",uri);App.frame.wait();App.frame.setActive();App.datamanager.getData(uri,local.initReceive,-1)}};this.init=function(data){App.forms.clearForms();local.transition(data)};function scrollIntoView(node){var pos=node.display.offsetTop;var bnd=local.getBoundary();var margin=5;var nodebottom=pos+node.display.offsetHeight;if(pos < bnd.min){currentView.display.parentNode.scrollTop=pos-margin};if(nodebottom > bnd.max){currentView.display.parentNode.scrollTop=currentView.display.parentNode.scrollTop + (nodebottom-bnd.max+margin)}};function goBack(){this.backup();if(local.currentHL){local.currentHL=null}};function useItem(e){if(local.currentHL){e.gztarget=local.currentHL;local.currentHL.getData(e);local.currentHL=null}};function prevItem(){if(!local.currentHL){var target=currentView.index[0];if (target.nodeclass=="gztext"){var contentNode=target.parent.index[3];target.parent.container.display.scrollTop -=15};while(target && (target !="end") && !setHL(target)){target=target.getNextSibling()}}else{setHL(local.currentHL);var target=local.currentHL.getPrevSibling();while(target && (target !="end") && !setHL(target)){target=target.getPrevSibling()};if(target){scrollIntoView(target)}}};function nextItem(){if(!local.currentHL){var target=currentView.index[0];if (target.nodeclass=="gztext"){var contentNode=target.parent.index[3];target.parent.container.display.scrollTop +=15};while(target && (target !="end") && !setHL(target)){target=target.getNextSibling()}}else{setHL(local.currentHL);var target=local.currentHL.getNextSibling();while(target && (target !="end") && !setHL(target)){target=target.getNextSibling()};if(target){scrollIntoView(target)}}};this.getBoundary=function(){var min=currentView.display.parentNode.scrollTop;var max=min + currentView.display.parentNode.clientHeight;return{min:min,max:max}};this.key=function(code,e){switch(code){case "minus": this.backup(e);return false;break;case "plus": useItem(e);return false;break;case "enter": useItem(e);return false;break;case "left": this.backup(e);return false;break;case "right": useItem(e);return false;break;case "up": prevItem(e);return false;break;case "down": nextItem(e);break;default: break}}};Slider.prototype=viewerproto;function ThreePane(App){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;this.type="threepane";this.currentHL=null;var currentView=null;var currentNode=null;var toplist=null;var myRootNode=null;var panel=new ThreePaneFrame();this.display=panel.getPanel();var hpanel=panel.getTopPanel();var spanel=panel.getBotPanel();var headlineanchor=document.createElement("div");var headlines={display:headlineanchor};hpanel.appendChild(headlineanchor);var storyanchor=document.createElement("div");var stories={display:storyanchor};spanel.appendChild(storyanchor);function expandAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && !state.expanded && state.loaded && type !="link" && type !="rss"){expand(node)};(node.child)?expandAll(node.child):null}}};function collapseAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];(node.child)?collapseAll(node.child):null;var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && state.expanded && type !="link" && type !="rss"){collapse(node)}}}};var exp=false;this.toggleExpansion=function(){if(exp){setActive();if(currentHeadlines){if(currentStory){currentStory.destroy();currentStory=null};local.clearHeadlines()};collapseAll(toplist);local.currentHL=null;currentNode=null;exp=false}else{expandAll(toplist);exp=true}};this.getTopList=function(){return toplist};this.getNodeDim=function(){var size=null;var p=null;var offset=0;var sp=panel.getSplits();if(App.datamanager.activeNode){var type=App.datamanager.activeNode.attribute.type;(type)?null:type="plain";if(type.match(/rss/)){p=panel.getBotPanel();(isIE)?offset=sp.H:null}else{p=panel.getLeftPanel()};return{X:p.offsetLeft+offset,Y:p.offsetTop,H:p.offsetHeight,W:p.offsetWidth}}else{return{X:0,Y:0,H:0,W:0}}};var currentNodeLeft=null;var currentNodeTop=null;function setActive(gzNode){if(gzNode){/* Don't highlight the node if we're simply restoring expansion states. */ if (App.config["exp"] && gzNode.outline.id !="-1." + App.config["anc"]){/* Remove this node from the expanded list if we've already fetched it. */ var expNode=gzNode.outline;if (expNode.childNodes){var expArray=App.config["exp"].split(",");for (var i=0;i < expArray.length;i++){if (expArray[i]==expNode.id){delete expArray[i]}};if (expArray.length==0){delete App.config["exp"]}else{App.config["exp"]=expArray.join(",")}}}else{gzNode.setNodeClass(gzNode.nodeclass+" gznodeactive")};var type=gzNode.outline.attribute.type;(type)?null:type="text";switch(type){case "rss-story": if(currentNodeTop!=gzNode){(currentNodeTop && currentNodeTop.display)?currentNodeTop.setNodeClass("gznode"):null;currentNodeTop=gzNode;if(gzNode.child){currentView=gzNode.child}};break;case "rss": if(currentNodeLeft!=gzNode){(currentNodeLeft)?currentNodeLeft.setNodeClass("gznode"):null;currentNodeLeft=gzNode};break;default: (currentNodeLeft)?currentNodeLeft.setNodeClass("gznode"):null;currentNodeLeft=gzNode;break};App.datamanager.activeNode=gzNode.outline;if(gzNode.outline.title){App.frame.setTitle(gzNode.outline.title)}else{App.frame.setTitle(gzNode.outline.attribute.text)}}else{(currentNodeLeft)?currentNodeLeft.setNodeClass("gznode"):null;App.datamanager.activeNode=App.datamanager.rootNode;App.frame.setTitle(App.datamanager.rootNode.title);currentNodeLeft=null}};function renderList(gzOutline,target){var list=null;var type=gzOutline.attribute.type;(type)?null:type="normaltext";if(gzOutline.attribute.text=="Comment Feed"){type="comment"};if(target){if(target.parent.outline.attribute.text=="Comment Feed"){type="comment"}};var tmp=RegExp("^"+gzOutline.id);if(type.match(/^rss|rss-story|comment$/) && App.datamanager.activeNode && !App.datamanager.activeNode.id.toString().match(tmp)){}else{switch(type){case "rss": var x=App.datamanager.activeNode;list=local.showHeadlines(gzOutline,target);setActive(target);App.datamanager.activeNode=x;break;case "rss-story": var x=App.datamanager.activeNode;list=local.showStory(gzOutline,target);App.datamanager.activeNode=x;break;case "comment": var x=App.datamanager.activeNode;list=local.showComment(gzOutline,target);App.datamanager.activeNode=x;break;default: if(target){list=new List(gzOutline,target);list.display.className="outline";target.display.parentNode.insertBefore(list.display,target.display.nextSibling);if(App.datamanager.activeNode==gzOutline){(currentNodeLeft!=target)?setActive(target):null}}else{list=new List(gzOutline);toplist=list;panel.getLeftPanel().appendChild(list.display)}};if(App.datamanager.activeNode==gzOutline){currentView=list};if(myRootNode==gzOutline){toplist=list};if(gzOutline && gzOutline.childNodes){for(var i=0, j=gzOutline.childNodes.length;i<j;i++){if(App.datamanager.state[gzOutline.childNodes[i].outline.id]){var state=App.datamanager.state[gzOutline.childNodes[i].outline.id]}else{var state={}};if( state.expanded ){renderList(gzOutline.childNodes[i].outline,list.index[i])}}}};return list};this.showComment=function(gzOutline,target){var list=new List(gzOutline,target);if(target){list.display.className="outline";target.display.parentNode.insertBefore(list.display,target.display.nextSibling)};App.datamanager.activeNode=gzOutline;currentView=list;return list};var currentStory=null;this.showStory=function(gzOutline,target){var list=new List(gzOutline,target);if(currentStory){currentStory.destroy();currentStory=null};list.display.className="botpane";stories.display.parentNode.insertBefore(list.display,stories.display.nextSibling);stories.display.parentNode.scrollTop=gzOutline.scrollPos+"px";(currentNodeTop!=list.parent)?setActive(list.parent):null;currentStory=list;return list};var currentHeadlines=null;this.showHeadlines=function(gzOutline,target){var list=null;if((currentHeadlines && currentHeadlines.outline !=gzOutline) || !currentHeadlines){list=new List(gzOutline,target);if(currentHeadlines){currentHeadlines.destroy();if(currentStory){currentStory.destroy();currentStory=null};currentHeadlines=null};list.display.className="toppane";headlines.display.parentNode.insertBefore(list.display,headlines.display.nextSibling);headlines.display.parentNode.scrollTop=gzOutline.scrollPos+"px";currentHeadlines=list}else{list=currentHeadlines};if(!currentStory){if(currentStory){currentStory.destroy();currentStory=null};if(gzOutline.childNodes[0].outline.childNodes){App.datamanager.state[gzOutline.childNodes[0].outline.id]={loaded:true,expanded:true};this.showStory(gzOutline.childNodes[0].outline,list.index[0])}}else{setActive(currentStory.parent)};return list};var blankoutline={attribute:{title:App.xl("No Feed Selected"),text:"( "+App.xl("No Feed Selected")+" )"},childNodes:[{outline:{attribute:{title:App.xl("No Feed Selected"),text:"( "+App.xl("No Feed Selected")+" )"}}}]};this.clearHeadlines=function(){if(currentHeadlines){currentHeadlines.destroy()};var list=new List(blankoutline);currentHeadlines=list;headlines.display.parentNode.insertBefore(list.display,headlines.display.nextSibling)};this.resetNode=function(node){setActive(node);var state=App.datamanager.state[node.outline.id];var type=node.outline.type;if(state && state.expanded && type !="link"){collapse(node)}};this.showContent=function(gzOutline,target){var list;var type=gzOutline.attribute.type;if(gzOutline.attribute.text=="Comment Feed"){type="comment"};if(target){if(target.parent.outline.attribute.text=="Comment Feed"){type="comment"}};switch(type){case "rss": list=local.showHeadlines(gzOutline,target);break;case "rss-story": list=local.showStory(gzOutline,target);break;case "comment": list=local.showComment(gzOutline,target);break;default: list=renderList(gzOutline,target);break};currentView=list;return list};this.insert=function(outline,target){var state=App.datamanager.state[outline.id];if(!state){App.datamanager.state[outline.id]={};state=App.datamanager.state[outline.id]};target.outline.childNodes=outline.childNodes;state.loaded=true;state.expanded=true;if(outline.childNodes && outline.childNodes[0].outline && outline.childNodes[0].outline.attribute.text.match(/Feed file\(s\) found/)){target.outline.attribute.type="include"};if(outline.childNodes && outline.childNodes[0].outline && outline.childNodes[0].outline.attribute.type!="rss-story"){target.outline.attribute.type="include"};local.showContent(target.outline,target);App.frame.unwait()};this.nodeAction=function(gzNode){var outline=gzNode.outline;var state=App.datamanager.state[outline.id];var type=gzNode.outline.attribute.type;if(type=="link" && App.config["anclink"] !="off"){gzNode.activateLink();return}else if (App.config["anclink"]=="off" && type=="link"){delete App.config["anclink"];return};if(gzNode.outline.attribute.text=="Comment Feed" || (gzNode.parent && gzNode.parent.parent && gzNode.parent.parent.outline.attribute.text=="Comment Feed")){type="comment"}else{setActive(gzNode)};if(!type){type="normal text"};if(currentHeadlines){if(gzNode !=currentHeadlines.parent && !(type.match(/^rss-story|comment$/)) ){if(currentStory){currentStory.destroy();currentStory=null};local.clearHeadlines();if(type=="rss" && currentHeadlines){currentHeadlines.destroy();currentHeadlines=null}}};if(type.match(/^include|rss|comment$/) && !state.loaded ){App.frame.setActive();App.frame.wait();App.datamanager.getData(gzNode.myUri,local.insert,outline.id,gzNode)}else{if(state.expanded && !(type.match(/^rss-story|rss$/))){setActive(gzNode.parent.parent);gzNode.child.destroy();gzNode.child=null;state.expanded=false}else{state.expanded=true;local.showContent(gzNode.outline,gzNode)}}};this.setScrollPos=function(obj){setTimeout(function(){panel.setSplits(obj.split);var l=panel.getLeftPanel();var t=panel.getTopPanel();var b=panel.getBotPanel();l.scrollLeft=obj.lX;l.scrollTop=obj.lY;t.scrollLeft=obj.tX;t.scrollTop=obj.tY;b.scrollLeft=obj.bX;b.scrollTop=obj.bY}, 50)};this.getScrollPos=function(){var l=panel.getLeftPanel();var t=panel.getTopPanel();var b=panel.getBotPanel();var sp=panel.getSplits();return{lX:l.scrollLeft,lY:l.scrollTop,tX:t.scrollLeft,tY:t.scrollTop,bX:b.scrollLeft,bY:b.scrollTop,split:sp}};this.clear=function(){if(toplist){toplist.destroy();toplist=null};if(currentStory){currentStory.destroy();currentStory=null};if(currentHeadlines){currentHeadlines.destroy();currentHeadlines=null}};function resetId(outline,id){outline.id=id;if(outline.childNodes){for(var i=0, j=outline.childNodes.length;i<j;i++){GZid(outline.childNodes[i].outline,id+"."+i)}}};this.initReceive=function(outline){if(outline.attribute.type=="rss"){var newoutline={attribute:{title:"dummy",text:"dummy",type:"folder"},childNodes:[{outline:outline}],id:"-1"};resetId(outline,"-1.-1");App.datamanager.state["-1.-1"]={expanded:true,loaded:true};myRootNode=newoutline;(App.datamanager.rootNode)?null:App.datamanager.rootNode=outline;(App.datamanager.activeNode)?null:setActive();local.showContent(newoutline)}else{(App.datamanager.rootNode)?null:App.datamanager.rootNode=outline;myRootNode=outline;(App.datamanager.activeNode && App.datamanager.activeNode.id=="-1")?setActive():null;(App.datamanager.activeNode)?null:setActive();local.showContent(outline);/* Restore expanded state. */ if (App.config["exp"]){var stateList=App.config["exp"].split(",");for (var i=0;i < stateList.length;i++){var explist=toplist;/* Reset list to top for each branch. */ var stateArray=stateList[i].split(".");for (var j=0;j < stateArray.length;j++){/* Make sure we're not overlapping any other expanded branches. */ explist=explist.index[stateArray[j]];var stateSlice=stateArray.slice(0,j+1);if ((App.datamanager.state["-1." + stateSlice.join(".")]) && (!App.datamanager.state["-1." + stateSlice.join(".")].expanded)){local.nodeAction(explist)};explist=explist.child}}};/* Initialize anchor post-widget display. This way, we don't hold up the rest of the interface if there's a remote fetch. */ if (App.config["anc"]){var anchorArray=App.config["anc"].split(".");var list=toplist;for (var i=0;i < anchorArray.length;i++){list=list.index[anchorArray[i]];if (list.nodeclass=="gznode"){var ancSlice=anchorArray.slice(0,i+1);if (!App.datamanager.state["-1." + ancSlice.join(".")].expanded){local.nodeAction(list)}else{/* If we're here, it means that this node was already expanded, but not highlighted. */ list.setNodeClass(list.nodeclass+" gznodeactive")};list=list.child}else{break}}}};App.frame.unwait()};this.transition=function(data){local.currentHL=null;currentNodeTop=null;currentNodeLeft=null;if(toplist){toplist.destroy()};local.clear();local.clearHeadlines();if(typeof data=="object"){App.frame.wait();local.initReceive(data)}else{App.datamanager.state={};App.datamanager.activeNode=null;App.datamanager.rootNode=null;App.frame.setTitle(App.xl("Loading..."));var uri=data;App.confManager.set("file",uri);App.frame.wait();App.frame.setActive();App.datamanager.getData(uri,local.initReceive,-1)}};this.init=function(data){App.forms.clearForms();local.transition(data)};this.clearView=function(){App.frame.removeButton(expandcollapsebutton);expandcollapsebutton.removeEvent("click");panel.clear();if(toplist){toplist.destroy()};this.display.parentNode.removeChild(this.display);this.display=null};function expand(node){var state=App.datamanager.state[node.outline.id];if(!state.expanded){local.showContent(node.outline,node);state.expanded=true}};function collapse(node){var state=App.datamanager.state[node.outline.id];if(state.expanded){if(node.child){node.child.destroy();node.child=null};state.expanded=false}};var expandcollapsebutton=new Button("expandcollapse",App.xl("Expand All / Collapse All"));expandcollapsebutton.addEvent("click",function(){App.viewer.toggleExpansion()});App.frame.addButton(expandcollapsebutton);function setHL(node){var tmpe={gztarget:node};return node.highlight(tmpe)};function backPanel(e){(local.currentHL && local.currentHL.parent && local.currentHL.parent==currentHeadlines && local.currentHL.parent.parent)?setHL(local.currentHL.parent.parent):useItem(e)};function useItem(e){if(local.currentHL){e.gztarget=local.currentHL;var state=App.datamanager.state[local.currentHL.outline.id];var type=local.currentHL.outline.attribute.type;if(type=="rss" || type=="rss-story"){if(!state.loaded){local.currentHL.getData(e);setHL(local.currentHL)}else{local.currentHL.getData(e);local.nodeAction(local.currentHL);setHL(currentNodeTop)}}else{local.currentHL.getData(e);setHL(local.currentHL)}}};this.getBoundary=function(panel){var min=panel.scrollTop;var max=min + panel.clientHeight;return{min:min,max:max}};function scrollIntoView(node){switch(node.parent){case currentHeadlines: var mypanel=hpanel;break;case currentStory: var mypanel=spanel;break;default: var mypanel=panel.getLeftPanel();break};var pos=node.getTop(mypanel);var bnd=local.getBoundary(mypanel);var margin=5;var nodebottom=pos+node.display.offsetHeight;if(pos < bnd.min){mypanel.scrollTop=pos-margin};if(nodebottom > bnd.max){mypanel.scrollTop=mypanel.scrollTop + (nodebottom-bnd.max+margin)}};function getPrevActive(tgt){var node=tgt.getPrevSibling();while(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child && node.outline.attribute.type !="rss" && node.outline.attribute.type !="rss-story"){node=node.getLastChild()};if(!node){if(tgt.parent==currentHeadlines){node=null}else{node=tgt.getParent()}};return node};function prevItem(){if(!App.viewer.currentHL){if(this.child){var target=this.child.index[0]};while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=getPrevActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getPrevActive(target)};if(target){scrollIntoView(target)}}};function getNextActive(node){if(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child && node.outline.attribute.type !="rss" && node.outline.attribute.type !="rss-story"){var target=node.getChild()}else{var target=node.getNextSibling();while(!target && node.parent !=currentHeadlines){node=node.getParent();if(!node){return node};target=node.getNextSibling()}};return target};function nextItem(){if(!App.viewer.currentHL){var target=toplist.index[0];while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=App.viewer.currentHL.getNextSibling();var target=getNextActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getNextActive(target)};if(target){scrollIntoView(target)}}};this.key=function(code,e){e.gzbubble=false;switch(code){case "minus": useItem(e);return false;break;case "plus": useItem(e);return false;break;case "enter": useItem(e);return false;break;case "right": useItem(e);return false;case "left": backPanel(e);return false;break;case "up": prevItem();return false;break;case "down": nextItem();return false;break;default: e.gzbubble=true;break}}};ThreePane.prototype=viewerproto;function River(App){this.extendGrazr=function(s1, p1, p2){return eval(s1)};var local=this;this.display=document.createElement("div");this.display.id="river";setStyle("position:absolute;height:100%;width:100%;overflow:auto",this.display);var outerFrame=document.getElementById("grazr");if(isIphone){setStyle("height:auto",this.display)};this.type="river";this.currentHL=null;var currentView=null;var currentNode=null;var toplist=null;function expandAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && !state.expanded && state.loaded && type !="link"){expand(node)};(node.child)?expandAll(node.child):null}}};function collapseAll(list){if(list && list.index){for(var i=0;i<list.index.length;i++){var node=list.index[i];(node.child)?collapseAll(node.child):null;var state=App.datamanager.state[node.outline.id];var type=node.outline.attribute.type;if(state && state.expanded && type !="link"){collapse(node)}}}};var exp=false;this.toggleExpansion=function(){if(exp){setActive();collapseAll(toplist);local.currentHL=null;currentNode=null;exp=false}else{expandAll(toplist);exp=true}};this.getNodeDim=function(){if(currentView){var Xset=currentView.getLeft(local.display);var Yset=currentView.getTop(local.display);return{X:Xset,Y:Yset,H:currentView.display.offsetHeight,W:currentView.display.offsetWidth}}else{return{X:0,Y:0,H:0,W:0}}};this.setScrollPos=function(obj){setTimeout(function(){local.display.scrollLeft=obj.X;local.display.scrollTop=obj.Y}, 50)};this.getScrollPos=function(){return{X:local.display.scrollLeft,Y:local.display.scrollTop}};this.clearView=function(){App.frame.removeButton(expandcollapsebutton);local.clear();this.display.parentNode.removeChild(this.display);expandcollapsebutton.removeEvent("click")};this.clear=function(){(toplist)?toplist.destroy():null;(currentView)?currentView=null:null;toplist=null;local.currentHL=null;currentNode=null};this.highlight=function(node){if(local.currentHL && local.currentHL.display){local.currentHL.display.className=local.currentHL.nodeclass};node.display.className +=" gznodehl";App.viewer.currentHL=node};function renderList(gzOutline,target){var list=new List(gzOutline,target);if(isIphone){list.display.style.height="auto"};if(App.datamanager.activeNode==gzOutline){currentView=list;setActive(list.parent)};if(App.datamanager.rootNode==gzOutline){toplist=list};for(var i=0, j=gzOutline.childNodes.length;i<j;i++){if(App.datamanager.state[gzOutline.childNodes[i].outline.id]){var state=App.datamanager.state[gzOutline.childNodes[i].outline.id]}else{var state={}};if( state.expanded ){renderList(gzOutline.childNodes[i].outline,list.index[i])}};if(target){list.display.className="outline";target.display.parentNode.insertBefore(list.display,target.display.nextSibling)}else{local.display.appendChild(list.display)};return list};this.resetNode=function(node){setActive();var state=App.datamanager.state[node.outline.id];var type=node.outline.type;if(state && state.expanded && type !="link"){collapse(node)}};this.iPhoneSize=function(){var parent=document.getElementById("grazr");var contentHeight=this.display.scrollHeight+App.frame.getMenuHeight()+20;var newHeight=(contentHeight < window.outerHeight+20)?window.outerHeight+20:contentHeight;parent.style.height=newHeight+"px"};this.showContent=function(gzOutline,target){if(!App.datamanager.activeNode){setActive()};(target)?null:target=null;renderList(gzOutline,target);if(isIphone){this.iPhoneSize()}};var currentNode=null;function setActive(gzNode){(currentNode)?currentNode.setNodeClass("gznode"):null;if(gzNode){/* Special case for when we're restoring expansion states. We don't want to set focus then. */ if (App.config["exp"] && gzNode.outline.id !="-1." + App.config["anc"]){/* Remove this node from the expanded list if we've already fetched it. */ var expNode=gzNode.outline;if (expNode.childNodes){var expArray=App.config["exp"].split(",");for (var i=0;i < expArray.length;i++){if (expArray[i]==expNode.id){delete expArray[i]}};if (expArray.length==0){delete App.config["exp"]}else{App.config["exp"]=expArray.join(",")}}}else{gzNode.setNodeClass(gzNode.nodeclass+" gznodeactive")};currentNode=gzNode;App.datamanager.activeNode=gzNode.outline;if(gzNode.outline.title){App.frame.setTitle(gzNode.outline.title)}else{App.frame.setTitle(gzNode.outline.attribute.text)}}else{App.datamanager.activeNode=App.datamanager.rootNode;App.frame.setTitle(App.datamanager.rootNode.title);currentNode=null}};function load(node){App.frame.setActive();App.datamanager.getData(node.myUri,local.insert,node.outline.id,node)};function expand(node){var state=App.datamanager.state[node.outline.id];if(!state.expanded){local.showContent(node.outline,node);state.expanded=true}};function collapse(node){var state=App.datamanager.state[node.outline.id];if(state.expanded){node.child.destroy();node.child=null;state.expanded=false;if(isIphone){local.iPhoneSize()}}};this.insert=function(outline,target){var state=App.datamanager.state[outline.id];if(!state){App.datamanager.state[outline.id]={};state=App.datamanager.state[outline.id]};target.outline.childNodes=outline.childNodes;expand(target);state.loaded=true;App.frame.unwait()};this.nodeAction=function(gzNode){var outline=gzNode.outline;var state=App.datamanager.state[outline.id];var type=gzNode.outline.attribute.type;setActive(gzNode);if(!type){type="normal text"};if(type=="link" && App.config["anclink"] !="off"){gzNode.activateLink();return}else if (App.config["anclink"]=="off" && type=="link"){delete App.config["anclink"];return};if(type.match(/^include|rss$/) && !state.loaded ){load(gzNode)}else{if(state.expanded){setActive(gzNode.parent.parent);collapse(gzNode)}else{expand(gzNode)}}};this.initReceive=function(outline){App.datamanager.rootNode=outline;App.datamanager.activeNode=outline;local.showContent(outline);setActive();/* Restore expanded state. */ if (App.config["exp"]){var stateList=App.config["exp"].split(",");for (var i=0;i < stateList.length;i++){var explist=toplist;/* Reset list to top for each branch. */ var stateArray=stateList[i].split(".");for (var j=0;j < stateArray.length;j++){/* Make sure we're not overlapping any other expanded branches. */ explist=explist.index[stateArray[j]];var stateSlice=stateArray.slice(0,j+1);if ((App.datamanager.state["-1." + stateSlice.join(".")]) && (!App.datamanager.state["-1." + stateSlice.join(".")].expanded)){local.nodeAction(explist)};explist=explist.child}}};/* Initialize anchor post-widget display. This way, we don't hold up the rest of the interface if there's a remote fetch. */ if (App.config["anc"]){var anchorArray=App.config["anc"].split(".");var list=toplist;for (var i=0;i < anchorArray.length;i++){list=list.index[anchorArray[i]];if (list.nodeclass=="gznode"){var ancSlice=anchorArray.slice(0,i+1);if (!App.datamanager.state["-1." + ancSlice.join(".")].expanded){local.nodeAction(list)}else{/* If we're here, it means that this node was already expanded, but not highlighted. */ list.setNodeClass(list.nodeclass+" gznodeactive")};list=list.child}else{break}}};App.frame.unwait()};this.transition=function(data){local.clear();if(typeof data=="object"){App.frame.wait();App.datamanager.rootNode=data;local.showContent(data);App.frame.unwait()}else{App.datamanager.state={};App.frame.setTitle(App.xl("Loading..."));var uri=data;App.confManager.set("file",uri);if(!App.config.nomunge){uri="http://script.grazr.com/gztransform?merge=1&file="+encodeURIComponent(uri)};App.datamanager.getData(uri,local.initReceive,-1)}};this.init=function(data){App.forms.clearForms();local.transition(data)};var expandcollapsebutton=new Button("expandcollapse",App.xl("Expand All / Collapse All"));expandcollapsebutton.addEvent("click",function(){App.viewer.toggleExpansion()});App.frame.addButton(expandcollapsebutton);this.blinkNode=function(node){var animEngine=new FXengine(20);var indicate=new FXaction(1.5);var end=new FXaction(0);end.animFunction=function(){node.display.style.background=null};indicate.chainTo(end);indicate.animFunction=function(frac){node.display.style.marginLeft=Math.round(20*Math.sin(Math.PI*frac))+"%";node.display.style.fontSize=Math.round(100+100*Math.sin(Math.PI*frac))+"%";node.display.style.background="rgb(255,255,"+Math.round(255*frac)+")"};animEngine.addAction(indicate)};function scrollIntoView(node){var pos=node.getTop(local.display);var bnd=local.getBoundary();var margin=5;var nodebottom=pos+node.display.offsetHeight;if(pos < bnd.min){local.display.scrollTop=pos-margin};if(nodebottom > bnd.max){local.display.scrollTop=local.display.scrollTop + (nodebottom-bnd.max+margin)}};function setHL(node){var tmpe={gztarget:node};return node.highlight(tmpe)};function useItem(e){if(local.currentHL){e.gztarget=local.currentHL;local.currentHL.getData(e);setHL(local.currentHL)}};function getPrevActive(tgt){var node=tgt.getPrevSibling();while(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child){node=node.getLastChild()};if(!node){node=tgt.getParent()};return node};function getNextActive(node){if(node && node.outline && App.datamanager.state[node.outline.id] && App.datamanager.state[node.outline.id].expanded && node.child){var target=node.getChild()}else{var target=node.getNextSibling();while(!target){node=node.getParent();if(!node){return node};target=node.getNextSibling()}};return target};function prevItem(){if(!App.viewer.currentHL){if(this.child){var target=this.child.index[0]};while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=getPrevActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getPrevActive(target)};if(target){scrollIntoView(target)}}};function nextItem(){if(!App.viewer.currentHL){var target=toplist.index[0];while(target && (target !="end") && !setHL(target)){target=getNextActive(target)}}else{setHL(App.viewer.currentHL);var target=App.viewer.currentHL.getNextSibling();var target=getNextActive(App.viewer.currentHL);while(target && (target !="end") && !setHL(target)){target=getNextActive(target)};if(target){scrollIntoView(target)}}};this.getBoundary=function(){var min=this.display.scrollTop;var max=min + this.display.clientHeight;return{min:min,max:max}};this.key=function(code,e){switch(code){case "minus": useItem(e);return false;break;case "plus": useItem(e);return false;break;case "enter": useItem(e);return false;break;case "right": useItem(e);return false;case "left": useItem(e);return false;break;case "up": prevItem();return false;break;case "down": nextItem();return false;break;default: break}}};River.prototype=viewerproto;var isIE=false;var isOpera=false;var isIphone=false;var isSafari=!!(window.navigator && window.navigator.vendor && window.navigator.vendor.match(/Apple/));var isChrome=!!(window.navigator && window.navigator.vendor && window.navigator.vendor.match(/Google/));var isMoz=(navigator.product=='Gecko' && !isSafari && !isChrome);var isFF=(isMoz && !navigator.savePreferences);var ffVer=(isMoz && navigator.userAgent && navigator.userAgent.match(/Firefox\/(\d+)/i))?navigator.userAgent.match(/Firefox\/(\d+)/i)[1]:0;if(document.all){if(window.opera){isOpera=true}else{isIE=true}};if(window.isIphone){isIphone=true};if(isIE){try{document.execCommand("BackgroundImageCache", false, true)}catch(err){}};var App=this;this.errorlog=new Array(0);this.render=function(){if(window.grazrstatic){var startfile=window.grazrstatic}else{var startfile=null};this.mesg=new Message(this);this.user=new UserObject(this);this.auto=new AutoPoster(this);this.confManager=new ConfigManager();this.style=new StyleManager();this.translator=new Translator(this);this.clipboard=new ClipBoard(this);this.datamanager=new DataManager(this);this.forms=new FormManager();this.frame=new AppFrame(document.getElementById("grazr"));this.keymanager=new KeyManager(this);var child=false;try{if(window.opener && window !=window.opener && window.opener.App && window.opener.App.childlaunch){child=true;window.opener.App.childlaunch=false}}catch(er){};if(child){this.viewmanager=new ViewManager(this,window.opener.App.viewmanager.getViewIndex());this.frame.wait();this.datamanager.state={};var parentState=window.opener.App.datamanager.state;for(var id in parentState){this.datamanager.state[id]={};for(var value in parentState[id]){this.datamanager.state[id][value]=parentState[id][value]}};this.datamanager.activeNode=window.opener.App.datamanager.activeNode;var temp=window.opener.App.forms.getFormStateObj();for(var name in temp){App.forms.storeFormVals(name,temp[name])};this.viewer.transition( window.opener.App.datamanager.rootNode);this.viewer.setScrollPos(window.opener.App.viewer.getScrollPos())}else{/* Create an "initial load" configuration variable so we absolutely know to process expansion states and anchors only once. */ App.config["initial_load"]=true;this.viewmanager=new ViewManager(this);if(startfile && startfile[this.config.file]){var outline=this.datamanager.preprocess(startfile[this.config.file],-1);this.viewer.init(outline)}else{this.viewer.init(this.config.file)}}};this.extendGrazr=function(s1, p1, p2){return eval(s1)}};var App;if(window.console){}else{console={};console.log=function(){return true}};window.onload=function(){var delayApp=new Grazr();setTimeout(function(){delayApp.render();App=delayApp},50)};