/* Copyright 2009 Google Inc. All Rights Reserved. */ (function(){var global=this;String.prototype.startsWith=function(prefix){return this.indexOf(prefix)==0};String.prototype.endsWith=function(suffix){var l=this.length-suffix.length;return l>=0&&this.lastIndexOf(suffix,l)==l};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.subs=function(){for(var ret=this,i=0;i<arguments.length;i++)ret=ret.replace(/\%s/,String(arguments[i]));return ret};
if(!Function.prototype.apply)Function.prototype.apply=function(oScope,opt_args){var sarg=[],rtrn,call;oScope||(oScope=global);for(var args=opt_args||[],i=0;i<args.length;i++)sarg[i]="args["+i+"]";call="oScope.__applyTemp__.peek()("+sarg.join(",")+");";if(!oScope.__applyTemp__)oScope.__applyTemp__=[];oScope.__applyTemp__.push(this);rtrn=eval(call);oScope.__applyTemp__.pop();return rtrn};
if(!Array.prototype.push)Array.prototype.push=function(){for(var i=0;i<arguments.length;i++)this[this.length]=arguments[i];return this.length};if(!Array.prototype.pop)Array.prototype.pop=function(){if(this.length){var val=this[this.length-1];this.length--;return val}};Array.prototype.peek=function(){return this[this.length-1]};if(!Array.prototype.shift)Array.prototype.shift=function(){if(this.length!=0){for(var val=this[0],i=0;i<this.length-1;i++)this[i]=this[i+1];this.length--;return val}};
if(!Array.prototype.unshift)Array.prototype.unshift=function(){for(var numArgs=arguments.length,i=this.length-1;i>=0;i--)this[i+numArgs]=this[i];for(var j=0;j<numArgs;j++)this[j]=arguments[j];return this.length};if(!Array.prototype.forEach)Array.prototype.forEach=function(callback,opt_scope){for(var i=0;i<this.length;i++)callback.call(opt_scope,this[i],i,this)};
function bind(fn,self){var boundargs=fn.boundArgs_||[];boundargs=boundargs.concat(Array.prototype.slice.call(arguments,2));if(typeof fn.boundSelf_!="undefined")self=fn.boundSelf_;if(typeof fn.boundFn_!="undefined")fn=fn.boundFn_;var newfn=function(){var args=boundargs.concat(Array.prototype.slice.call(arguments));return fn.apply(self,args)};newfn.boundArgs_=boundargs;newfn.boundSelf_=self;newfn.boundFn_=fn;return newfn}
Function.prototype.bind=function(self){return bind.apply(null,[this,self].concat(Array.prototype.slice.call(arguments,1)))};Function.prototype.partial=function(){return bind.apply(null,[this,null].concat(Array.prototype.slice.call(arguments)))};Function.prototype.inherits=function(parentCtor){var tempCtor=function(){};this.superClass_=tempCtor.prototype=parentCtor.prototype;this.prototype=new tempCtor};
Function.prototype.mixin=function(props){for(var x in props)this.prototype[x]=props[x];if(typeof props.toString=="function"&&props.toString!=this.prototype.toString)this.prototype.toString=props.toString};var DB_mode=false;function DumpError(str){try{throw str;}catch(e){DumpException(e)}}
function DumpException(e,opt_msg){var title="Javascript exception: "+(opt_msg?opt_msg:"")+" "+e;if(BR_AgentContains_("msie")&&!window.opera)title+=" "+e.name+": "+e.message+" ("+e.number+")";var error="";if(typeof e=="string")error=e+"\n";else for(var i in e)try{error+=i+": "+e[i]+"\n"}catch(ex){}error+=DB_GetStackTrace(DumpException.caller);var JSCompiler_inline_str=title+"\n"+error;if(DB_mode){try{var JSCompiler_inline_t_139=(new Date).getTime()-DB_starttime,JSCompiler_inline_html="["+JSCompiler_inline_t_139+
"] "+HtmlEscape(JSCompiler_inline_str).replace(/\n/g,"<br>")+"<br>";JSCompiler_inline_html="<font color=#ff0000><b>Error: "+JSCompiler_inline_html+"</b></font>";DB_win.focus()}catch(JSCompiler_inline_ex){}DB_WriteDebugHtml(JSCompiler_inline_html)}else typeof log!="undefined"&&log(HtmlEscape(JSCompiler_inline_str))}var function_name_re_=/function (\w+)/;
function DB_GetStackTrace(fn){try{if(!(BR_AgentContains_("msie")&&!window.opera)&&!(BR_AgentContains_("safari")||BR_AgentContains_("konqueror"))&&BR_AgentContains_("mozilla"))return Error().stack;if(!fn)return"";var JSCompiler_inline_result_0;var JSCompiler_inline_m_4=function_name_re_.exec(String(fn));JSCompiler_inline_result_0=JSCompiler_inline_m_4?JSCompiler_inline_m_4[1]:"";for(var x="- "+JSCompiler_inline_result_0+"(",i=0;i<fn.arguments.length;i++){if(i>0)x+=", ";var arg=String(fn.arguments[i]);
if(arg.length>40)arg=arg.substr(0,40)+"...";x+=arg}x+=")\n";x+=DB_GetStackTrace(fn.caller);return x}catch(ex){return"[Cannot get stack trace]: "+ex+"\n"}}var DB_starttime,DB_win=null,DB_winopening=false;
function DB_WriteDebugHtml(html){if(DB_mode)try{if((DB_win==null||DB_win.closed)&&!DB_winopening)try{DB_winopening=true;DB_win=window.open("","debug","width=700,height=500,toolbar=no,resizable=yes,scrollbars=yes,left=16,top=16,screenx=16,screeny=16");DB_win.blur();DB_win.document.open();DB_winopening=false;var JSCompiler_inline_html="<font color=#ff0000><b>To turn off this debugging window,hit 'D' inside the main caribou window, then close this window.</b></font><br>";DB_WriteDebugHtml(JSCompiler_inline_html)}catch(JSCompiler_inline_ex){}DB_win.document.write(html);
DB_win.scrollTo(0,1000000)}catch(ex){}};function BR_AgentContains_(str){if(str in BR_AgentContains_cache_)return BR_AgentContains_cache_[str];return BR_AgentContains_cache_[str]=navigator.userAgent.toLowerCase().indexOf(str)!=-1}var BR_AgentContains_cache_={},amp_re_=/&/g,lt_re_=/</g,gt_re_=/>/g;function HtmlEscape(str){if(!str)return"";return str.replace(amp_re_,"&amp;").replace(lt_re_,"&lt;").replace(gt_re_,"&gt;").replace(quote_re_,"&quot;")}var quote_re_=/\"/g;function forid_1(id){return document.getElementById(id)}
function forid_2(id){return document.all[id]}var forid=document.getElementById?forid_1:forid_2;function log(msg){try{if(window.parent!=window&&window.parent.log){window.parent.log(window.name+"::"+msg);return}}catch(e){}var logPane=forid("log");if(logPane){var logText="<p class=logentry><span class=logdate>"+new Date+"</span><span class=logmsg>"+msg+"</span></p>";logPane.innerHTML=logText+logPane.innerHTML}else window.status=msg};function AS_Assert(){}AS_Assert.raise=function(msg){if(typeof Error!="undefined")throw new Error(msg||"Assertion Failed");else throw msg;};AS_Assert.fail=function(opt_msg){opt_msg=opt_msg||"Assertion failed";typeof DumpError!="undefined"&&DumpError(opt_msg+"\n");AS_Assert.raise(opt_msg)};AS_Assert.isTrue=function(expression,opt_msg){if(!expression){if(opt_msg===undefined)opt_msg="Assertion failed";AS_Assert.fail(opt_msg)}};
AS_Assert.equals=function(val1,val2,opt_msg){if(val1!=val2){if(opt_msg===undefined)opt_msg="AS_Assert.equals failed: <"+val1+"> != <"+val2+">";AS_Assert.fail(opt_msg)}};
AS_Assert.typeOf=function(value,type,opt_msg){if(typeof value!=type){if(value||value=="")try{if(type==AS_Assert.TYPE_MAP[typeof value]||value instanceof type)return}catch(e){}if(opt_msg===undefined){if(typeof type=="function"){var match=type.toString().match(/^\s*function\s+([^\s\{]+)/);if(match)type=match[1]}opt_msg="AS_Assert.typeOf failed: <"+value+"> not typeof "+type}AS_Assert.fail(opt_msg)}};AS_Assert.TYPE_MAP={string:String,number:Number,"boolean":Boolean};
AS_Assert.numArgs=function(num,opt_msg){var caller=AS_Assert.numArgs.caller;if(caller&&caller.arguments.length!=num){if(opt_msg===undefined)opt_msg=caller.name+" expected "+num+" arguments  but received "+caller.arguments.length;AS_Assert.fail(opt_msg)}};Function.prototype.bind=function(thisObj){if(typeof this!="function")throw new Error("Bind must be called as a method of a function object.");var self=this,staticArgs=Array.prototype.splice.call(arguments,1,arguments.length);return function(){for(var args=staticArgs.concat(),i=0;i<arguments.length;i++)args.push(arguments[i]);return self.apply(thisObj,args)}};var listen,unlisten,unlistenByKey;
(function(){var listeners={},nextId=0;function getHashCode_(obj){if(obj.listen_hc_==null)obj.listen_hc_=++nextId;return obj.listen_hc_}function createKey_(node,event,listener,opt_useCapture){var nodeHc=getHashCode_(node),listenerHc=getHashCode_(listener);opt_useCapture=!!opt_useCapture;var key=nodeHc+"_"+event+"_"+listenerHc+"_"+opt_useCapture;return key}listen=function(node,event,listener,opt_useCapture){var key=createKey_(node,event,listener,opt_useCapture);if(key in listeners)return key;var proxy=
handleEvent.bind(null,key);listeners[key]={listener:listener,proxy:proxy,event:event,node:node,useCapture:opt_useCapture};if(node.addEventListener)node.addEventListener(event,proxy,opt_useCapture);else if(node.attachEvent)node.attachEvent("on"+event,proxy);else throw new Error("Node {"+node+"} does not support event listeners.");return key};unlisten=function(node,event,listener,opt_useCapture){var key=createKey_(node,event,listener,opt_useCapture);return unlistenByKey(key)};unlistenByKey=function(key){if(!(key in
listeners))return false;var listener=listeners[key],proxy=listener.proxy,event=listener.event,node=listener.node,useCapture=listener.useCapture;if(node.removeEventListener)node.removeEventListener(event,proxy,useCapture);else node.detachEvent&&node.detachEvent("on"+event,proxy);delete listeners[key];return true};function handleEvent(key){var args=Array.prototype.splice.call(arguments,1,arguments.length);return listeners[key].listener.apply(null,args)}})();function Point(x,y,opt_coordinateFrame){this.x=x;this.y=y;this.coordinateFrame=opt_coordinateFrame||null}Point.prototype.toString=function(){return"[P "+this.x+","+this.y+"]"};Point.prototype.clone=function(){return new Point(this.x,this.y,this.coordinateFrame)};function Delta(dx,dy){this.dx=dx;this.dy=dy}Delta.prototype.toString=function(){return"[D "+this.dx+","+this.dy+"]"};
function Rect(x,y,w,h,opt_coordinateFrame){this.x=x;this.y=y;this.w=w;this.h=h;this.coordinateFrame=opt_coordinateFrame||null}Rect.prototype.contains=function(p){return this.x<=p.x&&p.x<this.x+this.w&&this.y<=p.y&&p.y<this.y+this.h};
Rect.prototype.intersects=function(r){var p=function(x,y){return new Point(x,y,null)};return this.contains(p(r.x,r.y))||this.contains(p(r.x+r.w,r.y))||this.contains(p(r.x+r.w,r.y+r.h))||this.contains(p(r.x,r.y+r.h))||r.contains(p(this.x,this.y))||r.contains(p(this.x+this.w,this.y))||r.contains(p(this.x+this.w,this.y+this.h))||r.contains(p(this.x,this.y+this.h))};Rect.prototype.toString=function(){return"[R "+this.w+"x"+this.h+"+"+this.x+"+"+this.y+"]"};
Rect.prototype.clone=function(){return new Rect(this.x,this.y,this.w,this.h,this.coordinateFrame)};var XH_ieProgId_,JSCompiler_inline_XH_ACTIVE_X_IDENTS_106=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
if(typeof XMLHttpRequest=="undefined"&&typeof ActiveXObject!="undefined"){for(var JSCompiler_inline_i$$26_107=0;JSCompiler_inline_i$$26_107<JSCompiler_inline_XH_ACTIVE_X_IDENTS_106.length;JSCompiler_inline_i$$26_107++){var JSCompiler_inline_candidate_108=JSCompiler_inline_XH_ACTIVE_X_IDENTS_106[JSCompiler_inline_i$$26_107];try{new ActiveXObject(JSCompiler_inline_candidate_108);XH_ieProgId_=JSCompiler_inline_candidate_108;break}catch(JSCompiler_inline_e$$12_109){}}if(!XH_ieProgId_)throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed.");
}function XH_XmlHttpCreate(){return XH_ieProgId_?new ActiveXObject(XH_ieProgId_):new XMLHttpRequest}
function XH_XmlHttpPOST(xmlHttp,url,data,handler){xmlHttp.open("POST",url,true);xmlHttp.onreadystatechange=handler;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-Length",data.length);try{xmlHttp.send(data)}catch(JSCompiler_inline_e){log("XMLHttpSend failed "+JSCompiler_inline_e.toString()+"<br>"+JSCompiler_inline_e.stack);throw JSCompiler_inline_e;}};if("undefined"==typeof log)log=function(){};function Dom(opt_doc){this.doc=opt_doc||document;this.getElementById_=this.doc.getElementById?function(id){return this.doc.getElementById(id)}:function(id){return this.doc.all[id]}}Dom.prototype.$=function(id){return this.getElementById_(id)};Dom.prototype.create=function(nodeName){return this.doc.createElement(nodeName)};Dom.prototype.createText=function(text){return this.doc.createTextNode(text)};Dom.remove=function(node){AS_Assert.isTrue(node.parentNode);node.parentNode.removeChild(node)};
Dom.insertAfter=function(newNode,refNode){AS_Assert.isTrue(refNode.parentNode);refNode.parentNode.insertBefore(newNode,refNode.nextSibling)};Dom.insertBefore=function(newNode,refNode){AS_Assert.isTrue(refNode.parentNode);refNode.parentNode.insertBefore(newNode,refNode)};Dom.replace=function(newNode,oldNode){AS_Assert.isTrue(oldNode.parentNode);oldNode.parentNode.replaceChild(newNode,oldNode)};Dom.getInnerText=function(node){var innerText=[];Dom.getInnerTextHelp_(node,innerText);return innerText.join("")};
Dom.getInnerTextHelp_=function(node,stringBuffer){if(node.innerText)stringBuffer.push(node.innerText);else if(node.data)stringBuffer.push(node.data);else if(node.hasChildNodes())for(var child=node.firstChild;child;){arguments.callee(child,stringBuffer);child=child.nextSibling}};new Dom;if(window.jstiming){window.jstiming.beaconImageReferences_={};window.jstiming.reportCounter_=1;function getTick(timer,label,opt_start){var tick=timer.t[label],start=timer.t.start;if(tick&&(start||opt_start)){if(opt_start!=undefined)start=opt_start;return tick-start}}window.jstiming.report=function(timer,opt_extraParams,opt_reportUri){var extra="";if(window.jstiming.pt){extra+="&srt="+window.jstiming.pt;delete window.jstiming.pt}try{if(window.external&&window.external.tran)extra+="&tran="+window.external.tran;
else if(window.gtbExternal&&window.gtbExternal.tran)extra+="&tran="+window.gtbExternal.tran()}catch(e){}if(timer.dapperCookie_)extra+="&"+timer.dapperCookie_;var ticks=timer.t,start=ticks.start,rt=[];for(var label in ticks)label!="start"&&start&&rt.push(label+"."+getTick(timer,label));delete ticks.start;if(opt_extraParams)for(var arg in opt_extraParams)extra+="&"+arg+"="+opt_extraParams[arg];var uri=[opt_reportUri?opt_reportUri:"http://csi.gstatic.com/csi","?v=3","&s="+(window.jstiming.sn||"codesite")+
"&action=",timer.name,extra,"&rt=",rt.join(",")].join(""),img=new Image,id=window.jstiming.reportCounter_++;window.jstiming.beaconImageReferences_[id]=img;img.onload=img.onerror=function(){delete window.jstiming.beaconImageReferences_[id]};img.src=uri;img=null;return uri}};var CS_star={};
function CS_toggleStar(el,args,star_msg_id,star_on_msg,star_off_msg){var starred=el.src.indexOf("star_off.gif")!=-1?1:0;el.src=starred?"http://www.gstatic.com/codesite/ph/images/star_on.gif":"http://www.gstatic.com/codesite/ph/images/star_off.gif";var star_msg_el=document.getElementById(star_msg_id);if(star_msg_el)star_msg_el.innerHTML=starred?star_on_msg:star_off_msg;CS_star={on_msg:star_on_msg,off_msg:star_off_msg,img_el:el,msg_el:star_msg_el};args.starred=starred;var JSCompiler_inline_args=args;
CS_starXmlHttp=XH_XmlHttpCreate();var JSCompiler_inline_setStarURL_122="/hosting/stars.do",JSCompiler_inline_data="";for(var JSCompiler_inline_i in JSCompiler_inline_args)JSCompiler_inline_data+=JSCompiler_inline_i+"="+encodeURIComponent(JSCompiler_inline_args[JSCompiler_inline_i])+"&";XH_XmlHttpPOST(CS_starXmlHttp,JSCompiler_inline_setStarURL_122,JSCompiler_inline_data,CS_setStarCallback)}var CS_starXmlHttp=undefined;
function CS_setStarCallback(){CS_starXmlHttp.readyState==4&&CS_starXmlHttp.status==200&&CS_gotSetStar(CS_starXmlHttp.responseText)}function CS_gotSetStar(responseText){try{var args=eval("_d="+responseText),starred=args.starred;CS_star.img_el.src=starred?"http://www.gstatic.com/codesite/ph/images/star_on.gif":"http://www.gstatic.com/codesite/ph/images/star_off.gif";if(CS_star.msg_el)CS_star.msg_el.innerHTML=starred?CS_star.on_msg:CS_star.off_msg;_CS_updateProjects()}catch(e){return null}};function CS_dismissCue(args){var JSCompiler_inline_el=document.getElementById("cue");JSCompiler_inline_el.style.display="none";args.token&&CS_setCue(args);return false}var CS_cueXmlHttp=undefined;function CS_setCue(args){CS_cueXmlHttp=XH_XmlHttpCreate();var setCueURL="/hosting/cues.do",data="";for(var i in args)data+=i+"="+encodeURIComponent(args[i])+"&";XH_XmlHttpPOST(CS_cueXmlHttp,setCueURL,data,CS_setCueCallback)}function CS_setCueCallback(){};_CS_toggleStar=CS_toggleStar;_CS_dismissCue=CS_dismissCue;_CS_updateProjects=CS_updateProjects;_CS_click=CS_click;(function(){function getPageType(url){var URL_FILTER=/http:\/\/[^\/]*\/(u|hosting|p)\/([^\?\/]*)\/?([^\?\/]*)\/?([^\?\/]*)?/,urlArray=URL_FILTER.exec(url);if(urlArray[1]=="hosting"){if(urlArray[2])return"hosting_"+urlArray[2];return"hosting_home"}if(urlArray[1]=="u"){if(urlArray[3]=="updates"){if(urlArray[4])return"user_updates_"+urlArray[4];return"user_updates_user"}return"user_profile"}if(urlArray[1]=="p"){if(!urlArray[3]&&!urlArray[4])return"summary";if(urlArray[3]=="wiki")return urlArray[3];if(urlArray[3]&&
!urlArray[4])return urlArray[3];if(urlArray[3]&&urlArray[4]){var page=urlArray[3]=="w"?"wiki":urlArray[3];return page+"_"+urlArray[4]}}return"other"}function getActionNames(){var names=["codesite","ph"],pageType="project_"+getPageType(window.location.href);names.push(pageType);return names.join(",")}function onLoadCsi(){var loadTimer=window.jstiming.load;loadTimer.tick("plt");loadTimer.name=getActionNames();window.setTimeout(function(){window.jstiming.report(loadTimer)},500)}function reportToCsi(){if(window.attachEvent)window.attachEvent("onload",
onLoadCsi);else window.addEventListener&&window.addEventListener("load",onLoadCsi,false)}window._CS_reportToCsi=reportToCsi})();CS_ANALYTICS_ACCOUNT="UA-18071-1";
(function(){function loadAnalytics(){window.setTimeout(function(){var gaJsHost="https:"==document.location.protocol?"https://ssl.":"http://www.",url=gaJsHost+"google-analytics.com/ga.js",script=document.createElement("script");script.src=url;script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);_CS_reportAnalytics()},0)}if(window.attachEvent)window.attachEvent("onload",loadAnalytics);else window.addEventListener&&window.addEventListener("load",loadAnalytics,false)})();
function CS_click(link){window.setTimeout(function(){if(window.siteTracker)try{siteTracker._trackPageview(link)}catch(e){}},0)};(function(){var export_name="Menu";window[export_name]=function(target,opt_trigger,opt_triggerType,opt_onShow,opt_icon){this.iid=window[export_name].instance.length;window[export_name].instance[this.iid]=this;this.target=typeof target=="string"?document.getElementById(target):target;opt_trigger=typeof opt_trigger=="string"?document.getElementById(opt_trigger):opt_trigger;this.onShow=opt_onShow&&typeof opt_onShow=="function"?opt_onShow:null;opt_icon=typeof opt_icon=="string"?document.getElementById(opt_icon):
opt_icon;this.trigger=opt_trigger||target;this.items=[];this.onOpenEvents=[];this.triggerType=opt_triggerType||"click";this.menu=this.createElement("div","menuDiv instance"+this.iid);this.targetId=this.target.getAttribute("id");var menuId=this.targetId!=null?"menuDiv-"+this.targetId:"menuDiv-instance"+this.iid;this.menu.setAttribute("id",menuId);this.icon=opt_icon||this.createIcon();this.addEventsToIcon(this.icon);this.hide();this.addCategory("default");this.addEvent(this.trigger,this.triggerType,
this.wrap(this.toggle));this.addEvent(window,"resize",this.wrap(this.adjustSizeAndLocation));this.addEvent(document,"click",this.wrap(this.hide));this.addEvent(this.menu,"click",this.stopPropagation());this.addEvent(this.trigger,"click",this.stopPropagation());this.addEvent(this.icon,"click",this.stopPropagation())};window[export_name].prototype={target:null,targetId:null,trigger:null,triggerType:null,menu:null,onShow:null,icon:null,categories:null,thread:-1,iid:-1,items:null,scrolls:false,onOpenEvents:null,
createElement:function(element,opt_className,opt_content){var div=document.createElement(element);div.className=opt_className;opt_content&&this.append(opt_content,div);return div},createIcon:function(){var icon=this.createElement("img","menuIcon off instance"+this.iid),iconId=this.targetId!=null?"menuIcon-"+this.targetId:"menuIcon-instance"+this.iid;icon.setAttribute("id",iconId);icon.setAttribute("src","http://www.gstatic.com/codesite/ph/images/cleardot.gif");icon.setAttribute("height","14");icon.setAttribute("width",
"14");icon.style.verticalAlignment="middle";this.target.parentNode.insertBefore(icon,this.target.nextSibling);return icon},addEventsToIcon:function(icon){this.addEvent(this.trigger,"mouseover",this.wrap(this.iconOver,icon));this.addEvent(this.trigger,"mouseout",this.wrap(this.iconOut,icon));this.addEvent(icon,"mouseover",this.wrap(this.iconOver,icon));this.addEvent(icon,"mouseout",this.wrap(this.iconOut,icon));this.addEvent(icon,"mousedown",this.wrap(this.toggle))},iconOver:function(){if(this.className)this.className=
this.className.replace(/ off/g," on")},iconOut:function(opt_down){if(this.className){var regex=opt_down?/ (on|down)/g:/ on/g;this.className=this.className.replace(regex," off")}},iconDown:function(){if(this.className)this.className=this.className.replace(/ (off|on)/g," down")},addEvent:function(element,eventType,callback){if(element.addEventListener)element.addEventListener(eventType,callback,false);else try{element.attachEvent("on"+eventType,callback)}catch(e){element["on"+eventType]=callback}},
addOnOpen:function(eventCallback){var eventIndex=this.onOpenEvents.length;this.onOpenEvents.push(eventCallback);return eventIndex},wrap:function(callback,opt_thisObj){var closured_callback=callback,this_object=opt_thisObj||this;return function(){closured_callback.apply(this_object)}},addCategory:function(category,opt_title){this.categories=this.categories||[];var categoryDiv=this.createElement("div","menuCategory "+category);categoryDiv._categoryName=category;if(opt_title){var categoryTitle=this.createElement("b",
"categoryTitle "+category,opt_title);categoryTitle.style.display="block";this.append(categoryTitle);categoryDiv._categoryTitle=categoryTitle}this.append(categoryDiv);return this.categories[this.categories.length]=this.categories[category]=categoryDiv},emptyCategory:function(category){if(this.categories[category])for(var div=this.categories[category],i=div.childNodes.length-1;i>=0;i--)div.removeChild(div.childNodes[i])},clear:function(){for(var i=0;i<this.categories.length;i++)this.categories[this.categories[i]._categoryName]=
null;this.items.splice(0,this.items.length);this.categories.splice(0,this.categories.length);this.categories=[];this.items=[];this.menu.innerHTML=""},removeItem:function(item){for(var result=null,i=0;i<this.items.length;i++){if(this.items[i]==item){result=this.items[i];this.items.splice(i,1)}this.items[i].item._index=i}return result},removeCategory:function(category){var div=this.categories[category];if(div&&div.parentNode){div._categoryTitle&&div._categoryTitle.parentNode.removeChild(div._categoryTitle);
div.parentNode.removeChild(div);for(var i=0;i<this.categories.length;i++)if(this.categories[i]===div){this.categories[this.categories[i]._categoryName]=null;this.categories.splice(i,1);return}for(i=0;i<div.childNodes.length;i++)div.childNodes[i]._index?this.items.splice(div.childNodes[i]._index,1):this.removeItem(div.childNodes[i])}},addItem:function(html_or_element,opt_href,opt_category,opt_title){var category=opt_category?this.categories[opt_category]||this.addCategory(opt_category,opt_title):this.categories["default"],
menuItem=this.createElement("a","menuItem",html_or_element),menuHref=opt_href||"#",itemText=typeof html_or_element=="string"?html_or_element:html_or_element.innerText||"ERROR";menuItem.style.display="block";menuItem.setAttribute("href",menuHref);menuItem._index=this.items.length;this.append(menuItem,category);this.items[this.items.length]={item:menuItem,text:itemText};return menuItem},addSeparator:function(opt_category,opt_title){var category=opt_category?this.categories[opt_category]||this.addCategory(opt_category,
opt_title):this.categories["default"],hr=this.createElement("hr","menuSeparator");this.append(hr,category)},adjustSizeAndLocation:function(){var style=this.menu.style;style.position="absolute";for(var firstCategory=null,i=0;i<this.categories.length;i++){this.categories[i].className=this.categories[i].className.replace(/ first/,"");if(this.categories[i].childNodes.length==0)this.categories[i].style.display="none";else{this.categories[i].style.display="";if(!firstCategory){firstCategory=this.categories[i];
firstCategory.className+=" first"}}}var alreadyVisible=style.display!="none"&&style.visibility!="hidden",docElemWidth=document.documentElement.clientWidth,docElemHeight=document.documentElement.clientHeight,pageSize={w:(window.innerWidth||docElemWidth&&docElemWidth>0?docElemWidth:document.body.clientWidth)||1,h:(window.innerHeight||docElemHeight&&docElemHeight>0?docElemHeight:document.body.clientHeight)||1},iconPos=this.find(this.icon),iconSize={w:this.icon.offsetWidth,h:this.icon.offsetHeight},targetPos=
this.find(this.target),targetSize={w:this.target.offsetWidth,h:this.target.offsetHeight},menuSize={w:this.menu.offsetWidth,h:this.menu.offsetHeight};if(!alreadyVisible){var oldVisibility=style.visibility,oldDisplay=style.display;style.visibility="hidden";style.display="";style.height="";style.width="";menuSize={w:this.menu.offsetWidth,h:this.menu.offsetHeight};style.display=oldDisplay;style.visibility=oldVisibility}var addScroll=this.menu.offsetHeight/pageSize.h>0.8;if(addScroll){menuSize.h=parseInt(pageSize.h*
0.8,10);style.height=menuSize.h+"px";style.overflowX="hidden";style.overflowY="auto"}else style.height=style.overflowY=style.overflowX="";style.top=targetPos.y+targetSize.h+"px";style.left=targetPos.x+"px";if(menuSize.w<175)style.width="175px";if(addScroll)style.width=parseInt(style.width,10)+13+"px";if(targetPos.x+menuSize.w>pageSize.w)style.left=iconPos.x-(menuSize.w-iconSize.w)+"px"},html:function(opt_html){var result=this.menu.innerHTML;if(opt_html)this.menu.innerHTML=opt_html;return result},
append:function(html_or_element,opt_target){var element=opt_target||this.menu;if(typeof opt_target=="string"&&this.categories[opt_target])element=this.categories[opt_target];if(typeof html_or_element=="string")element.innerHTML+=html_or_element;else element.appendChild(html_or_element)},over:function(){this.menu.style.display!="none"&&this.show();if(this.thread!=-1){clearTimeout(this.thread);this.thread=-1}},out:function(){if(this.thread!=-1){clearTimeout(this.thread);this.thread=-1}this.thread=setTimeout(this.wrap(this.hide),
400)},stopPropagation:function(){return function(e){if(!e)e=window.event;e.cancelBubble=true;e.stopPropagation&&e.stopPropagation()}},toggle:function(){this.menu.style.display=="none"?this.show():this.hide()},show:function(){if(this.menu.style.display!=""){for(var i=0;i<this.onOpenEvents.length;i++)this.onOpenEvents[i].call(null,this);this.menu.style.visibility="hidden";this.menu.style.display="";this.adjustSizeAndLocation();this.iconDown.apply(this.icon);this.trigger.nodeName&&this.trigger.nodeName==
"A"&&this.trigger.blur();this.menu.style.visibility="visible";for(i=0;i<window[export_name].instance.length;i++){var menuInstance=window[export_name].instance[i];menuInstance!=this&&menuInstance.hide()}this.onShow&&this.onShow()}},hide:function(){this.iconOut.apply(this.icon,[true]);this.menu.style.display="none"},find:function(element){var curleft=0,curtop=0;if(element.offsetParent){do{curleft+=element.offsetLeft;curtop+=element.offsetTop}while((element=element.offsetParent)&&element.style&&element.style.position!=
"relative"&&element.style.position!="absolute")}return{x:curleft,y:curtop}}};window[export_name].instance=[]})();(function(){var target=document.getElementById("projects-dropdown");if(target){var icon=document.getElementById("menuIcon-projects-dropdown");window.myprojects=new Menu(target,null,null,function(){CS_click("/gb/ph/myprojects")},icon);myprojects.addEvent(window,"load",CS_updateProjects);myprojects.addOnOpen(CS_updateProjects);if(window.addEventListener)window.addEventListener("load",function(){document.body.appendChild(myprojects.menu)},false);else window.attachEvent&&window.attachEvent("onload",function(){document.body.appendChild(myprojects.menu)})}})();
var CS_projectsXmlHttp=undefined;function CS_updateProjects(){if(codesite_token){var postUrl="/hosting/projects",data="token="+encodeURIComponent(codesite_token);CS_ajax(CS_projectsXmlHttp,postUrl,data,CS_updateProjectsCallback)}else CS_updateProjectsCallback()}
function CS_updateProjectsCallback(responseText){if(codesite_token){var projects=[],starredProjects=[],starredProducts=[],json=eval("("+responseText+")");for(var category in json)switch(category){case "contributorto":case "memberof":case "ownerof":for(var i=0;i<json[category].length;i++)projects.push(json[category][i]);break;case "starred_projects":for(i=0;i<json[category].length;i++)starredProjects.push(json[category][i]);break;case "starred_products":for(i=0;i<json[category].length;i++)starredProducts.push(json[category][i]);
break;case "playground_token":var JSCompiler_inline_postUrl="/apis/ajax/playground/get_projects",JSCompiler_inline_data="token="+encodeURIComponent(json[category])+"&u="+encodeURIComponent(logged_in_user_email);CS_ajax(CS_playgroundXmlHttp,JSCompiler_inline_postUrl,JSCompiler_inline_data,CS_updatePlaygroundCallback);break;case "error":return;default:break}myprojects.clear();projects.sort();for(i=0;i<projects.length;i++)myprojects.addItem(projects[i],"/p/"+projects[i]+"/","projects","Projects");starredProjects.sort();
for(i=0;i<starredProjects.length;i++)myprojects.addItem(starredProjects[i],"/p/"+starredProjects[i]+"/","starred_projects","Starred projects");if(window.CS_productDictionary){starredProducts.sort();for(i=0;i<starredProducts.length;i++){var productEntry=CS_productDictionary[starredProducts[i]];productEntry&&productEntry.title&&productEntry.url&&myprojects.addItem(productEntry.title,productEntry.url,"starred_products","Starred products")}}CS_showPlayground(CS_playgroundJson)}else{var current_page_url_encoded=
encodeURIComponent(window.location.href);myprojects.clear();myprojects.addItem("Sign in to see your favorites","http://www.google.com/accounts/ServiceLogin?service=code&ltmpl=phosting&continue="+current_page_url_encoded+"&amp;followup="+current_page_url_encoded,"controls");CS_addDefaultControl()}}
function CS_addDefaultControl(){myprojects.addSeparator("controls","");myprojects.addItem("Find developer products...","/more/","controls");myprojects.addItem("Find open source projects...","/hosting/","controls")}var CS_playgroundJson=null,CS_playgroundXmlHttp=undefined;function CS_updatePlaygroundCallback(responseText){var json=eval("("+responseText+")");if(json!=CS_playgroundJson){CS_showPlayground(json);CS_playgroundJson=json}}
function CS_showPlayground(json){myprojects.removeCategory("playground_projects");myprojects.removeCategory("controls");if(json)if(json.responseStatus=="200"&&json.numSamples>0)for(var i=0;i<json.samples.length;i++){var sample=json.samples[i];myprojects.addItem(sample.sampleName,sample.sampleLoc,"playground_projects","Playground Projects")}CS_addDefaultControl()}
function CS_ajax(xmlHttp,postUrl,data,callback){xmlHttp=XH_XmlHttpCreate();XH_XmlHttpPOST(xmlHttp,postUrl,data,function(){xmlHttp.readyState==4&&xmlHttp.status==200&&callback(xmlHttp.responseText)})};})()
