﻿(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=
/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;
this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]|| !context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=
document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else return jQuery(context).find(selector);}else if(jQuery.isFunction(
selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:
function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;
Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret= -1;return jQuery.inArray(elem&&elem.jquery?
elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=
value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')
&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||
document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});}
);return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;})
.append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);}
);},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(
elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:
function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector)
{var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")> -1?jQuery.unique(elems):elems);},clone:
function(events){var ret=this.map(function(){if(jQuery.browser.msie&& !jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);
return jQuery.clean([container.innerHTML])[0];}else return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)
this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,
events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(
elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));
else selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&& !selector.nodeType;return this.filter(function(){return isArrayLike?
jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(
selector))));},is:function(selector){return! !selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined)
{if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:
0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&& !option.attributes.value.specified?option.text:option.value;if(one)return value;
values.push(value);}}return values;}else return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;
if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=
jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex= -1;}
else this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},
eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(
elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===
undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}
else return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}
,domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=
this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery(
[]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery(
"script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,
dataType:"script"});else jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=
jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!=
"object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(
target===copy)continue;if(deep&&copy&&typeof copy=="object"&& !copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}
return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep)
{window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return! !fn&&typeof fn!="string"&& !fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:
function(elem){return elem.documentElement&& !elem.body||elem.tagName&&elem.ownerDocument&& !elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=
document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;
else script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&
elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]= ++uuid;if(name&& !
jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=
elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(
elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)
if(callback.apply(object[name],args)===false)break;}else for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],
name,object[name])===false)break;}else for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(
jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&& !exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each(
(classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&& !jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,
classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},
has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))> -1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=
elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props=
{position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,
border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+
border);}if(jQuery(elem).is(":visible"))getWH();else jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=
elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&
jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(
name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1")
.toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&& !color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);
a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(
computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){
var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){
var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},
clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;
jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(
/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap= !tags.indexOf("<opt")&&[1,
"<select multiple='multiple'>","</select>"]|| !tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]|| !tags.indexOf("<tr")&&[2,
"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")|| !tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]|| !tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>",
"</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody= !tags.indexOf(
"<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(
tbody[j],"tbody")&& !tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=
jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&& !jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)
ret.push(elem);else ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml= !jQuery.isXMLDoc(elem),set=
value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)
elem.parentNode.selectedIndex;if(name in elem&&notxml&& !special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw "type property can't be changed";elem[name]=value;}if(
jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);
if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=
1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(
elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){
return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else while(i)
ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=
first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={
};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){
var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!= !callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<
length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(
userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&& !/opera/.test(userAgent),mozilla:/mozilla/.test(
userAgent)&& !/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel: !jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{
"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(
elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,
"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(
elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||
elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=
jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},
function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({
removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(
classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(
selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)
this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){
return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&
document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?
Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?
jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=
jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+
chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},
":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:
function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":
function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){
return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return "hidden"!=
a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:
function(a){return "text"==a.type;},radio:function(a){return "radio"==a.type;},checkbox:function(a){return "checkbox"==a.type;},file:function(a){return "file"==a.type;},password:function(a){
return "password"==a.type;},submit:function(a){return "submit"==a.type;},image:function(a){return "image"==a.type;},reset:function(a){return "reset"==a.type;},button:function(a){return "button"==
a.type||jQuery.nodeName(a,"button");},input:function(a){return /input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){
return /h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,
not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=
9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=
m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(
t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||
m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")
merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&& !foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);
r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-
1];if(m[1]=="#"&&elem&&elem.getElementById&& !jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=
jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&
ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(
r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift()
;done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&& !pass)
tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(
/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){
var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&& ! !z||type=="="&&z==
m[5]||type=="!="&&z!=m[5]||type=="^="&&z&& !z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&
m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"|| !/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;
for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)
n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}
r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},
not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,
elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&& ++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(
n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=
this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{
}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&& !jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});
handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!
jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,
handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=
jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){
handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];
else for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||
jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,
jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");
jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(
this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event= !
data[0]|| !data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(
exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+
type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==
false&&val!==false&& !(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,
handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all= !namespace&& !event.exclusive;handlers=(
jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,
arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event=
{originalEvent:originalEvent};var props=
"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(
" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();
originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||
now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=
event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&
doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||
event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(
event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){
bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;}
,teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))
return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",
jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},
handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){
return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){
jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){
jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){
return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(
fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind(
'mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else jQuery.readyList.push(function(){return fn.call(this,jQuery);});
return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});
jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&& !
jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll(
"left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<
document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(
jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]")
.length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each((
"blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){
jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=
parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(
url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};
var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:
params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):
res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(
function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&& !this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||
/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val}
;}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});
var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})
;},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,
type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(
jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,
password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},
lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&
typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data|| !
s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)
s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{
delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(
/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&& !
jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=
document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=
script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(
script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,
s.password);else xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||
"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":
s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);
var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&
"timeout"|| !jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}
catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)
success();}else jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!
requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(
data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&& !
 --jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:
0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}
catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&
xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"|| !type&&ct&&ct.indexOf("xml")>=0,data=xml?
xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw "parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")
data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});
else for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else s.push(encodeURIComponent(j)+"="+encodeURIComponent(
jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},
speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");
this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:
"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,
toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(
function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){
return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({
opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,
callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;
var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&& !hidden)return opt.complete.call(this);if(p=="height"||p==
"width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,
val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(
true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((
parts[1]=="-="? -1:1)*end)+start;e.custom(start,end,unit);}else e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=
type;type="fx";}if(!type||(typeof type=="string"&& !fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(
this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(
timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,
type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);
q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn|| !fn&&easing||jQuery.isFunction(speed)&&speed,
duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||
jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,
n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=
options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(
jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&
this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r> -10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:
function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){
return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i](
))timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=
jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;
this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=
null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)
this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(
this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,
this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){
fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+
fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=
elem.ownerDocument,safari2=safari&&parseInt(version)<522&& !/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=
elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-
doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&& !
/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&& !safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?
offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&& !/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-
parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&
css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,
doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,
10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=
/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,
'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){
var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;
return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){
this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':
'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":
"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(
this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();;(function($){$.ui={plugin:{add:function(module,option,set){var proto=
$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){
return;}for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]= ! !((!(/auto|default/).test(tmp.css(
'cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))|| !(/none/).test(tmp.css('backgroundImage'))|| !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));
try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}return $.ui.cssCache[name];},disableSelection:function(el){$(el).attr('unselectable','on').css('MozUserSelect','none');},enableSelection:
function(el){$(el).attr('unselectable','off').css('MozUserSelect','');},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=
1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments);};
function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!= -1);};
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(
arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}return this.each(function(){
var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args);}else if(!isMethodCall){$.data(this,name,new $[namespace][name](this,
options));}});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,
$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(key,value);}).bind('getData.'+name,function(e,key){return self.getData(key);
}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);};$.widget.prototype={init:function(){},destroy:function(){
this.element.removeData(this.widgetName);},getData:function(key){return this.options[key];},setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':
'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this.setData('disabled',false);},disable:function(){this.setData('disabled',true);}};$.widget.defaults={disabled:false};
$.ui.mouse={mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self.mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr(
'unselectable');this.element.attr('unselectable','on');}this.started=false;},mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',
this._mouseUnselectable));},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(
e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel|| !this.mouseCapture(e)){return true;}this._mouseDelayMet= !this.options.delay;if(!
this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true;},this.options.delay);}if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(
this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}this._mouseMoveDelegate=function(e){return self.mouseMove(e);};this._mouseUpDelegate=function(e){
return self.mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},mouseMove:function(e){if(
$.browser.msie&& !e.button){return this.mouseUp(e);}if(this._mouseStarted){this.mouseDrag(e);return false;}if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(
this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e));}return!this._mouseStarted;},mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,
this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e);}return false;},mouseDistanceMet:function(e){return(
Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},mouseDelayMet:function(e){return this._mouseDelayMet;},mouseStart:
function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget(
"ui.draggable",$.extend({},$.ui.mouse,{init:function(){var o=this.options;if(o.helper=='original'&& !(/(relative|absolute|fixed)/).test(this.element.css('position')))this.element.css('position',
'relative');this.element.addClass('ui-draggable');(o.disabled&&this.element.addClass('ui-draggable-disabled'));this.mouseInit();},mouseStart:function(e){var o=this.options;if(this.helper||o.disabled||
$(e.target).is('.ui-resizable-handle'))return false;var handle= !this.options.handle|| !$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf()
.each(function(){if(this==e.target)handle=true;});if(!handle)return false;if($.ui.ddmanager)$.ui.ddmanager.current=this;this.helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[e])):(
o.helper=='clone'?this.element.clone():this.element);if(!this.helper.parents('body').length)this.helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(this.helper[0]!=
this.element[0]&& !(/(fixed|absolute)/).test(this.helper.css("position")))this.helper.css("position","absolute");this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(
this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-
this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(
this.offsetParent[0]==document.body&&$.browser.mozilla)po={top:0,left:0};this.offset.parent={top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(
this.offsetParent.css("borderLeftWidth"),10)||0)};var p=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:p.top-(parseInt(this.helper.css("top"),10)||0)+
this.offsetParent[0].scrollTop,left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(e);
this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left+this.margins.left;if(
o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right+this.margins.left;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top+this.margins.top;
if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom+this.margins.top;}if(o.containment){if(o.containment=='parent')o.containment=
this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,
$(o.containment=='document'?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),
($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(
this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce)
.css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,co.left+Math.max(
ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(
this.element.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-
this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];}}this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:
this.helper.outerHeight()};if($.ui.ddmanager&& !o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.helper.addClass("ui-draggable-dragging");this.mouseDrag(e);return true;},convertPositionTo:
function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1: -1;return{top:(pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition=="fixed"||(this.cssPosition==
"absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*mod+(this.cssPosition=="fixed"?$(document).scrollTop():0)*mod+this.margins.top*mod),left:(pos.left+
this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*mod+(
this.cssPosition=="fixed"?$(document).scrollLeft():0)*mod+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY-this.offset.click.top-
this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)-(this.cssPosition==
"fixed"?$(document).scrollTop():0)),left:(e.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&
this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)-(this.cssPosition=="fixed"?$(document).scrollLeft():0))};if(!this.originalPosition)return position;if(this.containment){if(
position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=
this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*
o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+
Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-
o.grid[0]:left+o.grid[0])):left;}return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",
e)||this.position;if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=
this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);return false;},mouseStop:function(e){var dropped=false;if($.ui.ddmanager&& !this.options.dropBehaviour)var dropped=
$.ui.ddmanager.drop(this,e);if((this.options.revert=="invalid"&& !dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true){var self=this;$(this.helper).animate(
this.originalPosition,parseInt(this.options.revert,10)||500,function(){self.propagate("stop",e);self.clear();});}else{this.propagate("stop",e);this.clear();}return false;},clear:function(){
this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!='original'&& !this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},plugins:{},
uiHash:function(e){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.uiHash()]);if(n==
"drag")this.positionAbs=this.convertPositionTo("absolute");return this.element.triggerHandler(n=="drag"?n:"drag"+n,[e,this.uiHash()],this.options[n]);},destroy:function(){if(!this.element.data(
'draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');this.mouseDestroy();}}));$.extend($.ui.draggable,{defaults:{appendTo:"parent",axis:false,
cancel:":input",delay:0,distance:1,helper:"original"}});$.ui.plugin.add("draggable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",
ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("draggable","zIndex",{start:function(e,ui){var t=$(ui.helper);if(t.css(
"zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add(
"draggable","opacity",{start:function(e,ui){var t=$(ui.helper);if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(
ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("draggable","iframeFix",{start:function(e,ui){$(ui.options.iframeFix===true?"iframe":ui.options.iframeFix).each(
function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000})
.css($(this).offset()).appendTo("body");});},stop:function(e,ui){$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","scroll",{start:
function(e,ui){var o=ui.options;var i=$(this).data("draggable");o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;i.overflowY=function(el){do{if(/auto|scroll/.test(el.css(
'overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css(
'overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')
i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},drag:function(e,ui){var o=ui.options;var i=$(this).data(
"draggable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)i.overflowY[0].scrollTop=
i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<
o.scrollSensitivity)$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)$(document).scrollTop($(document)
.scrollTop()+o.scrollSpeed);}if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)i.overflowX[0].scrollLeft=
i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft(
)<o.scrollSensitivity)$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)$(document).scrollLeft($(document)
.scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("draggable","snap",{start:function(e,ui){var inst=$(this).data("draggable");inst.snapElements=[];$(ui.options.snap===true?'.ui-draggable':
ui.options.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=inst.element[0])inst.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});})
;},drag:function(e,ui){var inst=$(this).data("draggable");var d=ui.options.snapTolerance||20;var x1=ui.absolutePosition.left,x2=x1+inst.helperProportions.width,y1=ui.absolutePosition.top,y2=y1+
inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;
if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d)))continue;if(ui.options.snapMode!='inner'){var ts=Math.abs(
t-y2)<=20;var bs=Math.abs(b-y1)<=20;var ls=Math.abs(l-x2)<=20;var rs=Math.abs(r-x1)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top;if(bs)
ui.position.top=inst.convertPositionTo("relative",{top:b,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left;if(rs)ui.position.left=
inst.convertPositionTo("relative",{top:0,left:r}).left;}if(ui.options.snapMode!='outer'){var ts=Math.abs(t-y1)<=20;var bs=Math.abs(b-y2)<=20;var ls=Math.abs(l-x1)<=20;var rs=Math.abs(r-x2)<=20;if(ts)
ui.position.top=inst.convertPositionTo("relative",{top:t,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top;if(ls)ui.position.left=
inst.convertPositionTo("relative",{top:0,left:l}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left;}};}});$.ui.plugin.add("draggable",
"connectToSortable",{start:function(e,ui){var inst=$(this).data("draggable");inst.sortables=[];$(ui.options.connectToSortable).each(function(){if($.data(this,'sortable')){var sortable=$.data(this,
'sortable');inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshItems();sortable.propagate("activate",e,inst);}});},stop:function(e,ui){var inst=$(this).data(
"draggable");$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)
this.instance.options.revert=true;this.instance.mouseStop(e);this.instance.element.triggerHandler("sortreceive",[e,$.extend(this.instance.ui(),{sender:inst.element})],this.instance.options["receive"])
;this.instance.options.helper=this.instance.options._helper;}else{this.instance.propagate("deactivate",e,inst);}});},drag:function(e,ui){var inst=$(this).data("draggable"),self=this;var checkPos=
function(o){var l=o.left,r=l+o.width,t=o.top,b=t+o.height;return(l<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<r&&t<(this.positionAbs.top+
this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<b);};$.each(inst.sortables,function(i){if(checkPos.call(inst,this.instance.containerCache)){if(!this.instance.isOver){
this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;
this.instance.options.helper=function(){return ui.helper[0];};e.target=this.instance.currentItem[0];this.instance.mouseCapture(e,true);this.instance.mouseStart(e,true,true);
this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;
this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst.propagate("toSortable",e);}if(this.instance.currentItem)this.instance.mouseDrag(e);}else{if(
this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(e,true);this.instance.options.helper=
this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst.propagate("fromSortable",e);}};});}});$.ui.plugin.add("draggable",
"stack",{start:function(e,ui){var group=$.makeArray($(ui.options.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||ui.options.stack.min)-(parseInt($(b).css("zIndex"),10)||
ui.options.stack.min);});$(group).each(function(i){this.style.zIndex=ui.options.stack.min+i;});this[0].style.zIndex=ui.options.stack.min+group.length;}});})(jQuery);function removeChildren(bd){if(
bd.hasChildNodes()){while(bd.childNodes.length>=1){bd.removeChild(bd.firstChild);}}};function makeXMLNotCachedRequest(bA,F,ag,lk){if(isValid(ag)||(isValid(lk)&&lk)){try{var eh=0;if(isValid(ag.user_id)
)eh+=parseInt(ag.user_id)%123431;if(isValid(ag.from_user_id))eh+=parseInt(ag.from_user_id)%123431;if(isValid(ag.to_user_id))eh+=parseInt(ag.to_user_id)%123431;if(isValid(ag.owner_id))eh+=parseInt(
ag.owner_id)%123431;if(isValid(ag.pet_id))eh+=parseInt(ag.pet_id)%123431;ag.session_id=hex_sha1(""+eh);}catch(err){ag.session_id="none";}XML_REQUEST_QUEUE.addRequest(XMLRequestQueue.DO_GET,bA,F,ag);}
else{XML_REQUEST_QUEUE.addRequest(XMLRequestQueue.DO_GET,bA,F,ag);}};var XML_REQUEST_QUEUE=new XMLRequestQueue();XMLRequestQueue.DO_POST=1;XMLRequestQueue.DO_GET=2;XMLRequestQueue.MAX_RETRIES=1;
XMLRequestQueue.MAX_TIMEOUT=30000;XMLRequestQueue.PREEMPT_REQUESTS=true;function XMLRequestQueue(){var lh=0;var hJ=new Array();var gE=new Array();var hB=new Array();var dU=new Array();var dq=
new Array();var hS=new Array();var dp=undefined;var bz=undefined;var fk=undefined;var aL=undefined;var ff=undefined;var cW=0;var cd= -1;var iy=true;this.addRequest=addRequest;this.timeoutRequest=
timeoutRequest;function addRequest(bk,bA,F,ag){if(XMLRequestQueue.PREEMPT_REQUESTS&&iy&&isValid(ff)){outputDebug("Request to "+bz+" has been pre-empted by "+bA);hJ.push(dp);gE.push(bz);hB.push(fk);
dU.push(aL);dq.push(cW);hS.push(cd);clearCurState();}lh+=1;hJ.push(bk);gE.push(bA);hB.push(F);dU.push(ag);dq.push(0);hS.push(lh);makeNewRequest();};function makeNewRequest(){if(gE.length==0){return;}
if(ff!=undefined){return;}dp=hJ.pop();bz=gE.pop();fk=hB.pop();aL=dU.pop();ff=(new Date()).getTime();cW=dq.pop();cd=hS.pop();if(cW>XMLRequestQueue.MAX_RETRIES){var aR=fk;clearCurState();if(
isValidFunction(aR))aR(undefined);makeNewRequest();}else{doRequest();}};function retryRequest(){cW+=1;outputDebug("retrying "+bz+" "+cW+" retries");hJ.unshift(dp);gE.unshift(bz);hB.unshift(fk);
dU.unshift(aL);dq.unshift(cW);hS.unshift(cd);clearCurState();makeNewRequest();};function timeoutRequest(bq){if(cd!=bq){outputDebug("Timeout request is already over for request with id: "+bq);return;}
outputDebug("Timeout for request with id: "+cd);retryRequest();};function doRequest(){window.setTimeout("XML_REQUEST_QUEUE.timeoutRequest(parseInt("+cd+"));",XMLRequestQueue.MAX_TIMEOUT);if(dp==
XMLRequestQueue.DO_GET){doGetRequest(cd);}else if(dp==XMLRequestQueue.DO_POST){doPostRequest(cd);}else{outputDebug("UNRECOGNIZED REQUEST TYPE!!! "+dp);clearCurState();makeNewRequest();}};
function doGetRequest(bq){var f_curFinishFunction=function(response){onFinishRequest(response,bq);};var db="?";if(bz.indexOf("?")> -1){db="&";}var eT=bz;if(isValid(aL)){var bC="";for(var aa in aL){if(
typeof(aL[aa])=="number"||typeof(aL[aa])=="string"||typeof(aL[aa])=="boolean"){bC+=aa+"="+aL[aa]+"&";}}if(bC.length>0&&bC.lastIndexOf('&')==bC.length-1){bC=bC.substr(0,bC.length-1);}eT+=db+bC;}db="?";
if(eT.indexOf("?")> -1){db="&";}var oU=new Date().getTime();eT=[eT,db,"nocache=",oU].join("");var v={};v['METHOD']='GET';v['CONTENT_TYPE']=gadgets.io.ContentType.DOM;
v[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;outputDebug("GET request with id "+bq+" sent to "+eT);gadgets.io.makeRequest(eT,f_curFinishFunction,v);};
function doPostRequest(bq){var f_curFinishFunction=function(response){onFinishRequest(response,bq);};if(isValid(POST_AS_STRING)&&POST_AS_STRING){var bC="";for(var aa in aL){if(typeof(aL[aa])==
"number"||typeof(aL[aa])=="string"||typeof(aL[aa])=="boolean"){bC+=aa+"="+aL[aa]+"&";}}bC+="nocache="+new Date().getTime();var v={};v[gadgets.io.RequestParameters.POST_DATA]=bC;
v[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;v[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.DOM;v[gadgets.io.RequestParameters.AUTHORIZATION]=
gadgets.io.AuthorizationType.SIGNED;outputDebug("POST string request with id "+bq+" sent to "+bz+" with param "+bC);gadgets.io.makeRequest(bz,f_curFinishFunction,v);}else{aL.nocache=new Date()
.getTime();var v={};v[gadgets.io.RequestParameters.POST_DATA]=aL;v[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;v[gadgets.io.RequestParameters.CONTENT_TYPE]=
gadgets.io.ContentType.DOM;v[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;outputDebug("POST object request with id "+bq+" sent to "+bz+" with param "+aL);
gadgets.io.makeRequest(bz,f_curFinishFunction,v);}};function onFinishRequest(O,bq){if(cd!=bq){outputDebug(" OUT of order request came back with id: "+bq);return;}iy=false;if(dp==
XMLRequestQueue.DO_GET){outputDebug(" GET request with id "+bq+" cameback for "+bz+" after "+cW+" num retries in "+((new Date()).getTime()-ff)+" >>> "+O);}else{outputDebug(" POST request with id "+bq+
" cameback for "+bz+" after "+cW+" num retries in "+((new Date()).getTime()-ff)+" >>> "+O);}if(!isValid(O.data)&& !isValid(O.text)){outputDebug(" response is not valid");retryRequest();}else{var aR=
fk;clearCurState();if(isValidFunction(aR)){aR(O);}makeNewRequest();}iy=true;};function clearCurState(){dp=undefined;bz=undefined;fk=undefined;aL=undefined;ff=undefined;cW=0;cd= -1;}};
function getGadgetResponseData(O){if(!isValid(O)){outputDebug("unfortunately there was an unknown error, please check back later: unknown error");return undefined;}else if(!isValid(O.data)){
outputDebug("unfortunately there was an unknown error, please check back later: "+O.errors);return undefined;}return O.data;};function getGadgetResponseText(O){if(!isValid(O)){outputAlert(
"unfortunatley there was an unknown error, please check back later: unknown error");return undefined;}else if(!isValid(O.text)){outputDebug(
"unfortunatley there was no text, please check back later: "+O.errors);return undefined;}return O.text;};function parseXML(aT){if(typeof DOMParser!="undefined"){return(new DOMParser())
.parseFromString(aT,"application/xml");}else if(typeof ActiveXObject!="undefined"){var mZ=XML.newDocument();mZ.loadXML(aT);return mZ;}else{var oK="data:text/xml;charset=utf-8,"+encodeURIComponent(aT);
var jp=new XMLHttpRequest();jp.open("GET",oK,false);jp.send(null);return jp.responseXML;}};function getXMLNodeValue(bd,fL){var cf=bd.getElementsByTagName(fL);if(isValid(cf)&&cf.length>0&&isValid(
cf[0].firstChild)&&isValid(cf[0].firstChild.nodeValue)){return cf[0].firstChild.nodeValue;}else{return undefined;}};function getXMLFirstNode(lY,fL){var cf=lY.getElementsByTagName(fL);if(isValid(cf)&&
cf.length>0&&isValid(cf[0])){return cf[0];}else{return undefined;}};function getXMLEncodedStringNodeValue(bd,fL){var hd=getXMLNodeValue(bd,fL);if(hd==undefined)return undefined;else{
return decodeURIComponent(hd);}};OpenSocialRequest.REQUESTS=new Object();OpenSocialRequest.TIMEOUT=5000;OpenSocialRequest.MAX_RETRIES=3;function OpenSocialRequest(qA,ky,F){var gJ=ky;var oc=qA;var dB=
F;var dq=0;var lg=false;this.retryRequest=retryRequest;doRequest();function doRequest(){outputDebug("Doing request with key: "+gJ);OpenSocialRequest.REQUESTS[gJ]=retryRequest;oc.send(onFinishRequest);
window.setTimeout("OpenSocialRequest.REQUESTS['"+gJ+"']();",OpenSocialRequest.TIMEOUT);};function retryRequest(){outputDebug("Retrying request with key "+gJ+" num retries already: "+dq);dq+=1;if(dq>
OpenSocialRequest.MAX_RETRIES){onFinishRequest(undefined);}else{doRequest();}};function onFinishRequest(data){outputDebug("Finished request with key: "+gJ);if(!lg){dB(data);}lg=true;}};
function addEvent(aQ,fS,cw){if(aQ.addEventListener){aQ.addEventListener(fS,cw,false);return true;}else if(aQ.attachEvent){var iA=aQ.attachEvent("on"+fS,cw);return iA;}else{return false;}};
function addEventWithParameter(aQ,fS,cw,ag){if(aQ.addEventListener){aQ.addEventListener(fS,function(){cw(ag);return false;},false);return true;}else if(aQ.attachEvent){var iA=aQ.attachEvent("on"+fS,
function(){cw(ag);return false;});return iA;}else{return false;}};function isValid(aQ){return(aQ!=undefined&&aQ!=null);};function isValidFunction(aQ){return isValid(aQ)&&(typeof(aQ)=='function');};
function isDebugging(){try{return(isValid(GLOBAL_DEBUGGING)&&GLOBAL_DEBUGGING);}catch(err){return false;}};function outputDebug(aT){try{if(isDebugging()){var kf=document.getElementById('debugOutput');
if(isValid(kf)&&isValid(kf.style)&&kf.style.display!="none"){var fX=document.createElement("div");fX.innerHTML=aT;document.getElementById('debugOutput').appendChild(fX);}}}catch(err){};};
function outputAlert(aT){try{if(isDebugging()){alert(aT);}}catch(err){};};function shortenedStringKeepEscapedCharacters(bI,lV){if(!isValid(bI)){return bI;}if(bI.length<lV+1){return bI;}var A=0;var bK=
0;while(bK<bI.length&&A<lV){A++;if(bI[bK]!="&"){bK++;}else{if(bK+1<bI.length&&bI[bK+1]==" "){bK+=2;A++;continue;}var cT=bI.indexOf(";",bK);if(cT>0&&cT-bK<9)bK=cT;else break;}}if(bK<bI.length)
return bI.substring(0,bK)+"..";else return bI.substring(0,bK);};function customEncoding(aT){return "cstm_"+encodeURIComponent(aT).replace(/%/g,"@");};function replaceHTMLTags(qa){var iz=qa.replace(
"<","&lt;");iz=iz.replace(">","&gt;");return iz;};var TIME={};TIME.MILLIS_IN_MINUTE=60*1000;TIME.MILLIS_IN_HOUR=60*60*1000;TIME.MILLIS_IN_DAY=24*60*60*1000;TIME.MILLIS_IN_WEEK=7*24*60*60*1000;
TIME.MILLIS_IN_MONTH=30*24*60*60*1000;function getTimeAgoString(ca){if(ca<TIME.MILLIS_IN_MINUTE){return Math.ceil(ca/1000)+" seconds ago";}else if(ca<TIME.MILLIS_IN_HOUR){return Math.floor(ca/
TIME.MILLIS_IN_MINUTE)+" minutes ago";}else if(ca<TIME.MILLIS_IN_DAY){return Math.floor(ca/TIME.MILLIS_IN_HOUR)+" hours ago";}else if(ca<TIME.MILLIS_IN_WEEK){return Math.floor(ca/TIME.MILLIS_IN_DAY)+
" days ago";}else if(ca<TIME.MILLIS_IN_MONTH){return Math.floor(ca/TIME.MILLIS_IN_WEEK)+" weeks ago";}else{return Math.floor(ca/TIME.MILLIS_IN_MONTH)+" months ago";}};function lineBreakText(aT,oo,nG){
var hl=new RegExp(nG);var jn="";var fc=aT;var gf=hl.exec(fc);while(gf!=null){jn+=fc.substring(0,gf.index)+gf+" ";fc=fc.substr(gf.index+oo);gf=hl.exec(fc);}jn+=fc;return jn;};var g_hexcase=0;
var g_chrsz=8;function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length*g_chrsz));};function core_sha1(x,len){x[len>>5]|=0x80<<(24-len%32);x[((len+64>>9)<<4)+15]=len;var w=Array(80);var a=
1732584193;var b= -271733879;var c= -1732584194;var d=271733878;var e= -1009589776;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;var olde=e;for(var j=0;j<80;j++){if(j<16)
w[j]=x[i+j];else w[j]=rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);var t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j)));e=d;d=c;c=rol(b,30);b=a;a=t;}a=safe_add(a,olda);b=
safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);e=safe_add(e,olde);}return Array(a,b,c,d,e);};function sha1_ft(t,b,c,d){if(t<20)return(b&c)|((~b)&d);if(t<40)return b^c^d;if(t<60)return(b&c)|(b&
d)|(c&d);return b^c^d;};function sha1_kt(t){return(t<20)?1518500249:(t<40)?1859775393:(t<60)? -1894007588: -899497514;};function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(
lsw>>16);return(msw<<16)|(lsw&0xFFFF);};function rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt));};function str2binb(str){var bin=Array();var mask=(1<<g_chrsz)-1;for(var i=0;i<str.length*g_chrsz;i+=
g_chrsz)bin[i>>5]|=(str.charCodeAt(i/g_chrsz)&mask)<<(32-g_chrsz-i%32);return bin;};function binb2hex(binarray){var hex_tab=g_hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<
binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF);}return str;};function getOpenSocialParameter(lx){try{var v=
gadgets.views.getParams();if(isValid(v[lx])){return v[lx];}else{return undefined;}}catch(err){outputDebug("getOSParam Error: "+err);}};function getFunctionName(cH){if(cH.name){return cH.name;}var kd=
cH.toString();var eb=kd.substring(kd.indexOf('function')+8,kd.indexOf('('));if(eb)return eb;return "anonymous";};function getSignature(cH){var fE=getFunctionName(cH);fE+="(";for(var bN=0;isValid(
cH.arguments)&&bN<cH.arguments.length;bN++){var hj=cH.arguments[bN];if(hj.length>30)hj=hj.substring(0,30)+"...";fE+="'"+hj+"'";if(bN<cH.arguments.length-1)fE+=", ";}fE+=")";return fE;};function dump(
aQ){var outputList=new Array();outputList.push("<P>");for(var name in aQ){outputList.push(name+":  "+aQ[name]);}outputDebug(outputList.join("<br>"));};function outputStackTrace(qk){outputDebug(
"============================");outputDebug("Stack trace:");var hf=qk;while(hf){outputDebug(getSignature(hf));;hf=hf.caller;}};function navigateToCanvas(){var surfaces=gadgets.views.getSupportedViews(
);var surfaceRef=surfaces[gadgets.views.ViewType.CANVAS];gadgets.views.requestNavigateTo(surfaceRef);};function navigateToCanvasTab(cG){var param={};if(isValid(cG)&&typeof cG=="number"&&cG>=0){
param.initialTab=cG+'';}var surfaces=gadgets.views.getSupportedViews();var surfaceRef=surfaces[gadgets.views.ViewType.CANVAS];gadgets.views.requestNavigateTo(surfaceRef,param);};
function navigateToCanvasTabPreserveDetailedUser(cG){var param={};if(isValid(cG)&&typeof cG=="number"&&cG>=0){param.initialTab=cG+'';}if(isValid(GP.DETAIL_USER_ID)&&(GP.DETAIL_USER_ID!=
MAIN_DATA.getViewer().getUserId())){param.showDetailedUserId=GP.DETAIL_USER_ID;if(isValid(GP.DETAIL_THUMBNAIL_URL)){param.detailedThumbnailUrl=GP.DETAIL_THUMBNAIL_URL;}if(isValid(
GP.DETAIL_DISPLAY_NAME)){param.detailedDisplayName=GP.DETAIL_DISPLAY_NAME.replace(/[^A-Za-z0-9!@' ]/g,'');}}else{navigateToCanvasTab(1);return;}var surfaces=gadgets.views.getSupportedViews();
var surfaceRef=surfaces[gadgets.views.ViewType.CANVAS];gadgets.views.requestNavigateTo(surfaceRef,param);};function getRandomNumbers(cF,fG){var bR=new Array();if(cF<fG){for(var J=0;J<=cF;J++){bR.push(
J);}return bR;}var bR=new Array();var gc={};for(var J=0;J<fG;J++){var cb=Math.round(Math.random()*cF);while(isValid(gc[cb])){cb=(cb+1)%cF;}gc[cb]=1;bR.push(cb);}return bR;};function extendClass(gn,ew)
{function l_inheritance(){};l_inheritance.prototype=ew.prototype;gn.prototype=new l_inheritance();gn.prototype.constructor=gn;gn.baseConstructor=ew;gn.superClass=ew.prototype;};function declareClass(
ew,ob,mq){var jM=ob;if(isValid(ew)){extendClass(jM,ew);}for(var m in mq){jM.prototype[m]=mq[m];}return jM;};function getRandomNumbers(cF,fG){var bR=new Array();if(cF<fG){for(var J=0;J<=cF;J++){
bR.push(J);}return bR;}var bR=new Array();var gc={};for(var J=0;J<fG;J++){var cb=Math.round(Math.random()*cF);while(isValid(gc[cb])){cb=(cb+1)%cF;}gc[cb]=1;bR.push(cb);}return bR;};
function convertToArray(na,qI){var hx=new Array();for(var i in na){if(na[i]==qI){hx.push(i)}}return hx;};function appendParameter(bA,ag){var result=bA;if(bA.charAt(bA.length-1)=='?'||bA.charAt(
bA.length-1)=='&'){result+=ag;}else{var db="?";if(bA.indexOf("?")> -1){db="&";}result+=db+ag;}return result;};String.prototype.replaceAll=function(pcFrom,pcTo){var hl=new RegExp(pcFrom,'g');
return this.replace(hl,pcTo);};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};String.prototype.ltrim=function(){return this.replace(/^\s+/,"");};String.prototype.rtrim=
function(){return this.replace(/\s+$/,"");};Function.prototype.bind=function(aQ){var bZ=this;var kE=[];for(var i=1;i<arguments.length;++i)kE.push(arguments[i]);return function(){var kC=kE.slice(0);
for(var i=0;i<arguments.length;++i)kC.push(arguments[i]);return bZ.apply(aQ,kC);}};function array_permute(a){var gv=a.length;for(var i=0;i<gv;++i){var j=Math.floor(Math.random()*gv);var temp=a[i];
a[i]=a[j];a[j]=temp;}return a;};function array_push_array(a1,a2){for(var i=0;i<a2.length;++i){a1.push(a2[i]);}};function EventDispatcher(){this.fa={};};EventDispatcher.prototype.bind=function(bk,cw){
if(!this.fa[bk]){this.fa[bk]={}}this.fa[bk][$guid(cw)]=cw;return this;};EventDispatcher.prototype.unbind=function(bk,cw){try{delete this.fa[bk][$guid(cw)];}catch(err){}return this;};
EventDispatcher.prototype.trigger=function(bk,ro,rr,rj){var kh=this.fa[bk];if(!kh){return;}var args=[];for(var i=1;i<arguments.length;++i)args.push(arguments[i]);for(var guid in kh){kh[guid].apply(
this,args);}return this;};EventDispatcher.prototype.declareEvent=function(bk){this.fa[bk]={};return this;};var __GUID=1;function $guid(obj){if(!obj._guid){obj._guid=__GUID++;}return obj._guid;};
function GUIDMap(){this.fw={}};GUIDMap.prototype.put=function(key,value){this.fw[$guid(key)]=value;};GUIDMap.prototype.get=function(key){return this.fw[$guid(key)];};GUIDMap.prototype.remove=function(
key){delete this.fw[$guid(key)];};GUIDMap.prototype.contains=function(key){return isValid(this.fw[$guid(key)]);};GUIDMap.prototype.clear=function(){this.fw={};};function hasTags(aT){return(aT.match(
".*<.*")!=null||aT.match(".*>.*")!=null);};function Data(){Data.baseConstructor.call(this);this.fH=0;this.eN=0;};extendClass(Data,EventDispatcher);Data.prototype.watchRange=function(H,G,jL){this.fH=H;
this.eN=G;if(jL){this.triggerUpdate(H,G);}};Data.prototype.getStart=function(){return this.fH};Data.prototype.getEnd=function(){return this.eN};Data.prototype.bindCountCallback=function(F){this.bind(
"count",F);this.requestCount(F);};Data.prototype.bindUpdateCallback=function(F){this.bind("update",F);this.requestData(this.fH,this.eN,F);};Data.prototype.requestCount=function(F){F(this.getCurCount()
,this.countDone());};Data.prototype.triggerCount=function(){this.trigger("count",this.getCurCount(),this.countDone());};Data.prototype.requestData=function(H,G,F){var T=this.getCurData(H,G);var fv=
this.dataDone(H,G);F(H,G,T,fv);};Data.prototype.triggerUpdate=function(H,G){H=Math.max(H,this.fH);G=Math.min(G,this.eN);if(H<G){var cD=this.getCurData(H,G);var fv=this.dataDone(H,G);this.trigger(
"update",H,G,cD,fv);}};Data.prototype.triggerBoth=function(H,G){this.triggerCount();this.triggerUpdate(H,G);};Data.prototype.getCurCount=function(){outputDebug('ERROR: getCurCount not implemented');};
Data.prototype.countDone=function(){outputDebug('ERROR: countDone not implemented');};Data.prototype.getCurData=function(H,G){outputDebug('ERROR: getCurData not implemented');};
Data.prototype.dataDone=function(H,G){outputDebug('ERROR: dataDone not implemented');};Data.prototype.allDone=function(H,G){return this.countDone()&&this.dataDone(0,this.getCurCount());};
Data.prototype.paged=function(ds){ds=ds||20;return new PagedData(this,ds);};Data.prototype.randomized=function(){return new RandomizedData(this);};Data.prototype.filtered=function(qE){
return new FilteredData(this,qE);};Data.prototype.lazyBucketed=function(dr,fR){return new LazyBucketSortedData(this,dr,fR);};Data.prototype.consoleDebug=function(bJ){this.bindCountCallback(function(
ah,ay){try{console.log(bJ+"- count="+ah+" done="+ay);}catch(err){}});this.bindUpdateCallback(function(H,G,R,ay){try{console.log(bJ+"- start="+H+" end="+G+" done="+ay);console.log(R);}catch(err){}});
var oldRequestData=this.requestData;this.requestData=function(H,G,F){console.log(bJ+" requestData start="+H+" end="+G);var pw=function(H,G,R,ay){console.log(bJ+" requestData result start="+H+" end="+
G+" done="+ay);console.log(R);if(F)F(H,G,R,ay);};oldRequestData.call(this,H,G,pw);};return this;};function ArrayData(bn){ArrayData.baseConstructor.call(this);if(!isValid(bn))bn=[];this.setArray(bn);};
extendClass(ArrayData,Data);ArrayData.prototype.setArray=function(bn){this.gB=bn;this.triggerBoth(0,bn.length);};ArrayData.prototype.getCurCount=function(){return this.gB.length;};
ArrayData.prototype.countDone=function(){return true;};ArrayData.prototype.dataDone=function(){return true;};ArrayData.prototype.getCurData=function(H,G){return this.gB.slice(H,G)};
function RemoteData(bA,nF){RemoteData.baseConstructor.call(this,[]);this.gp=false;this.oC=nF;makeXMLNotCachedRequest(bA,this.handleResponse.bind(this),{},0);};extendClass(RemoteData,ArrayData);
RemoteData.prototype.handleResponse=function(O){var ad=getGadgetResponseData(O);if(!isValid(ad)){new ModalDialog(
"Unfortunately there was an error, the technical team has been notified.  Thank you for your patience!").showDialog();return false;}this.gp=true;this.setArray(this.oC(ad));};
RemoteData.prototype.countDone=RemoteData.prototype.dataDone=function(){return this.gp;};function DataOperator(cA){DataOperator.baseConstructor.call(this,[]);this.bh=cA;this.bh.bindCountCallback(
this.handleSubCount.bind(this));this.bh.bindUpdateCallback(this.handleSubData.bind(this));};extendClass(DataOperator,Data);DataOperator.prototype.handleSubCount=function(ah,ay){this.bh.watchRange(0,
ah);this.triggerCount();};DataOperator.prototype.getCurCount=function(){return this.bh.getCurCount();};DataOperator.prototype.countDone=function(){return this.bh.countDone();};function RandomizedData(
cA){this.qQ=0;this.gG=new GUIDMap();this.lI=this.compareFunc.bind(this);this.aN=[];this.dh=[];RandomizedData.baseConstructor.call(this,cA);};extendClass(RandomizedData,DataOperator);
RandomizedData.prototype.handleSubCount=function(ah,ay){if(ah<this.aN.length){this.invalidate(ah,this.aN.length);this.aN=this.aN.slice(0,ah);}RandomizedData.superClass.handleSubCount.call(this,ah,ay);
};RandomizedData.prototype.handleSubData=function(H,G,R,ay){var gV=this.invalidate(H,G);for(var i=0;i<R.length;++i){this.aN[i+H]=R[i];}gV=Math.min(gV,this.insert(R));this.triggerBoth(gV,
this.bh.getCurCount());};RandomizedData.prototype.reset=function(){this.gG.clear();this.bh.requestData(0,this.bh.getCurCount(),this.handleSubData.bind(this));};
RandomizedData.prototype.assignRandomIdx=function(R){var hc=[];for(var i=0;i<R.length;++i){if(!this.gG.contains(R[i])){hc.push(R[i]);}}var kA=[];for(var i=0;i<hc.length;++i){kA.push(this.qQ++);}
array_permute(kA);for(var i=0;i<hc.length;++i){this.gG.put(hc[i],kA[i]);}};RandomizedData.prototype.compareFunc=function(oj,od){var idx1=this.gG.get(oj);var idx2=this.gG.get(od);return idx1-idx2;};
RandomizedData.prototype.invalidate=function(H,G){var dE=this.aN.length;var mP=this.aN.slice(H,G).sort(this.lI);var ri,ei;ri=ei=0;for(;ri<this.dh.length&&ei<mP.length;){var iv=this.compareFunc(
this.dh[ri],mP[ei]);if(iv<0){ri++;}else if(iv==0){dE=Math.min(dE,ri);this.dh.splice(ri,1);ei++;}else{ei++;}}return dE;};RandomizedData.prototype.insert=function(R){this.assignRandomIdx(R);var dE=
this.aN.length;var hD=R.slice(0).sort(this.lI);var ri,ai;ri=ai=0;for(;ri<this.dh.length&&ai<hD.length;){var iv=this.compareFunc(this.dh[ri],hD[ai]);if(iv<0){ri++;break;}else{dE=Math.min(dE,ri);
this.dh.splice(ri,0,hD[ai]);ai++;ri++;}}array_push_array(this.dh,hD.slice(ai));return dE;};RandomizedData.prototype.getCurData=function(H,G){return this.dh.slice(H,G);};
RandomizedData.prototype.dataDone=function(H,G){return this.bh.allDone();};function FilteredData(cA,hT){this.hT=hT;this.reset();FilteredData.baseConstructor.call(this,cA);};extendClass(FilteredData,
DataOperator);FilteredData.prototype.setPredicate=function(predicate){this.hT=predicate;this.dirtyPredicate();};FilteredData.prototype.reset=function(){this.cg=[];this.le=false;};
FilteredData.prototype.dirtyPredicate=function(){this.reset();var pJ=this.bh.getCurCount();this.bh.requestData(0,pJ,this.handleSubData.bind(this));};FilteredData.prototype.handleSubCount=function(ah,
ay){if(ah<this.cg.length){this.cg=this.cg.slice(0,ah);}FilteredData.superClass.handleSubCount.call(this,ah,ay);};FilteredData.prototype.handleSubData=function(H,G,R,ay){var jN=0;for(var i=0;i<H;++i){
if(this.cg[i])jN++;}var mg=0;for(var i=0;i<R.length;++i){var jO=undefined;if(isValid(R[i])){jO=this.hT(R[i]);this.cg[H+i]=jO;if(jO)mg+=1;}else{delete this.cg[H+i];}}if(ay&&G==this.bh.getCurCount()){
this.le=true;}this.triggerBoth(jN,jN+mg);};FilteredData.prototype.getCurCount=function(){var ci=0;for(var i=0;i<this.cg.length;++i){if(this.cg[i]==1)ci++;}return ci;};FilteredData.prototype.countDone=
function(){return this.le;};FilteredData.prototype.getCurData=function(H,G){var bp=[];var gv=this.cg.length;var hx=this.bh.getCurData(0,gv);var fi= -1;for(var i=0;i<gv&&fi<G;++i){if(this.cg[i]){fi++;
if(fi>=H&&fi<G){bp.push(hx[i]);}}}return bp;};FilteredData.prototype.dataDone=function(){return this.countDone()||this.getCurCount()>=this.eN;};function LazyBucketSortedData(cA,dr,fR){this.oY=dr;
this.qm=this.handleBucket.bind(this);this.iw=fR||40;this.aN=[];this.aW=[];this.gi=0;this.jb=false;LazyBucketSortedData.baseConstructor.call(this,cA);};extendClass(LazyBucketSortedData,DataOperator);
LazyBucketSortedData.prototype.handleSubCount=function(ah,ay){if(ah<this.aN.length){this.invalidate(ah,this.aN.length);this.aN=this.aN.slice(0,ah);for(var i=ah;i<this.aW.length;++i){if(isValid(
this.aW[i])){this.gi--;}}this.aW=this.aW.slice(0,ah);}LazyBucketSortedData.superClass.handleSubCount.call(this,ah,ay);};LazyBucketSortedData.prototype.handleSubData=function(H,G,R,ay){var gV=
this.invalidate(H,G);for(var i=0;i<R.length;++i){this.aN[i+H]=R[i];}this.checkBuckets();};LazyBucketSortedData.prototype.watchRange=function(H,G,jL){LazyBucketSortedData.superClass.watchRange.call(
this,H,G,jL);this.checkBuckets();};LazyBucketSortedData.prototype.getCurData=function(H,G){var allDone=this.allDone();var outputIdx= -1;var bp=[];var maxBucket=this.maxBucket();for(var bucketIdx=0;
outputIdx<G&&bucketIdx<=maxBucket;++bucketIdx){for(var i=0;outputIdx<G-1&&i<this.aW.length;++i){if(this.aW[i]==bucketIdx){outputIdx++;if(outputIdx>=H&&outputIdx<G){bp.push(this.aN[i])}}}if(!allDone)
break;}return bp;};LazyBucketSortedData.prototype.dataDone=function(H,G){var allDone=this.allDone();var readyCount=0;for(var i=0;i<this.aW.length;++i){if(isValid(this.aW[i])){if(allDone||this.aW[i]==
0){readyCount++;}}else{break;}}return readyCount>=G;};LazyBucketSortedData.prototype.allDone=function(){return this.bh.countDone()&&this.bh.getCurCount()==this.gi;};
LazyBucketSortedData.prototype.removeItem=function(i){if(isValid(this.aW[i])){this.gi--;}delete this.aW[i];};LazyBucketSortedData.prototype.bucketItem=function(i,nN){if(!isValid(this.aW[i])){this.gi++
;}this.aW[i]=nN;};LazyBucketSortedData.prototype.hasBucket=function(i){return isValid(this.aN[i])&&isValid(this.aW[i]);};LazyBucketSortedData.prototype.maxBucket=function(){var result= -1;for(var i=0;
i<this.aW.length;++i){if(!isValid(this.aW[i]))continue;result=Math.max(result,this.aW[i]);}return result;};LazyBucketSortedData.prototype.invalidate=function(H,G){for(var i=H;i<G;++i){this.removeItem(
i);}};LazyBucketSortedData.prototype.checkBuckets=function(){if(this.dataDone(this.fH,this.eN))return;if(this.jb)return;var H;var G;var R=[];var fq=[];var ah=0;for(var i=0;ah<this.iw&&i<
this.aN.length;++i){if(!this.hasBucket(i)){ah++;R.push(this.aN[i]);fq.push(i);}}if(R.length>0){this.jb=true;this.oY(fq,R,this.qm);}};LazyBucketSortedData.prototype.handleBucket=function(fq,R,fA){
this.jb=false;for(var i=0;i<R.length;++i){if(isValid(R[i])&&isValid(fA[i])){this.bucketItem(fq[i],fA[i]);}}this.triggerBoth(0,this.gi);this.checkBuckets();};function PagedData(cA,ds){
PagedData.baseConstructor.call(this);this.dz=cA;this.eV=ds;this.setPage(1);this.dz.bindCountCallback(this.handleCount.bind(this));this.dz.bindUpdateCallback(this.handleUpdate.bind(this));};
extendClass(PagedData,EventDispatcher);PagedData.prototype.setPage=function(af){this.cV=af;this.dz.watchRange(this._startIdx(),this._endIdx(),true);this.triggerPage();};PagedData.prototype.getPage=
function(){return this.cV;};PagedData.prototype._startIdx=function(af){af=af||this.cV;return(af-1)*this.eV;};PagedData.prototype._endIdx=function(af){af=af||this.cV;return af*this.eV;};
PagedData.prototype._idxToPage=function(i){return Math.ceil((i+1)/this.eV);};PagedData.prototype.getCurPageCount=function(){return Math.ceil(this.dz.getCurCount()/this.eV);};
PagedData.prototype.bindCountCallback=function(F){this.bind("count",F);this.requestCount(F);};PagedData.prototype.bindPageCallback=function(F){this.bind("page",F);this.requestPage(this.cV,F);};
PagedData.prototype.handleCount=function(ah,ay){if(this.cV>this.getCurPageCount()){this.setPage(1);}this.triggerCount();};PagedData.prototype.triggerCount=function(){this.trigger("count",
this.getCurPageCount(),this.dz.countDone());};PagedData.prototype.requestCount=function(F){var ci=this.getCurPageCount();var fv=this.dz.countDone();F(ci,fv);};PagedData.prototype.handleUpdate=
function(H,G,R,ay){var fW=this._idxToPage(H);var cT=this._idxToPage(G);var mA=this.cV;if(fW<=mA&&mA<=cT){this.triggerPage();}};PagedData.prototype.triggerPage=function(){this.trigger("page",this.cV,
this.getCurPage(this.cV),this.pageDone(this.cV));};PagedData.prototype.getCurPage=function(af){var fW=this._startIdx(af);var cT=this._endIdx(af);return this.dz.getCurData(fW,cT);};
PagedData.prototype.pageDone=function(af){var fW=this._startIdx(af);var cT=this._endIdx(af);return this.dz.dataDone(fW,cT);};PagedData.prototype.requestPage=function(af,F){F(af,this.getCurPage(af),
this.pageDone(af));};var InviteUtil={};InviteUtil.REQUEST_URL=REQUEST_DESTINATION_URL+"/green/";InviteUtil.sendInvite=function(aj,hN,F,kq){var lO=aj.getUserId===undefined?aj:aj.getUserId();
InviteUtil.addInvite(lO,kq,function(fK){var I=opensocial.newMessage(hN);var pg=InviteUtil.handleRequestShareApp(fK,aj,F);opensocial.requestShareApp(lO,I,pg);})};InviteUtil.getUsersInviteState=
function(aU,F){var mB=[];for(var i=0;i<aU.length;++i){mB.push(aU[i].getUserId());}var cC=InviteUtil.REQUEST_URL+"get_users_invite_state?";cC+="user_id="+MAIN_DATA.getViewer().getUserId();cC+=
"&query_ids="+mB.join(",");var ip=InviteUtil.handleGetUsersInviteState.bind(null,aU,F);makeXMLNotCachedRequest(cC,ip);};InviteUtil.addInvite=function(dD,kq,F){var query=InviteUtil.REQUEST_URL+
"add_invite";var v={};v["from_id"]=MAIN_DATA.getViewer().getUserId();v["to_id"]=dD;v["source"]=kq;makeXMLNotCachedRequest(query,InviteUtil.handleAddInvite.bind(null,dD,F),v);};
InviteUtil.handleAddInvite=function(dD,F,O){var ad=getGadgetResponseData(O);if(!isValid(ad)){outputDebug('Failed to add invite');return;}var aa=$(ad).find("invite").find("id").text();if(aa!=""&&F){aa=
parseInt(aa);F(aa);}};InviteUtil.registerInviteBlocked=function(qM){makeXMLNotCachedRequest(InviteUtil.REQUEST_URL+"register_invite_blocked?from_user_id="+MAIN_DATA.getViewer().getUserId()+
"&to_user_id="+qM,null);};InviteUtil.cancelInvite=function(fK){makeXMLNotCachedRequest(InviteUtil.REQUEST_URL+"cancel_invite?invite_id="+fK,null);};InviteUtil.handleRequestShareApp=function(fK,fe,F){
return function(O){var pH=O.hadError();var ef=O.getData();if(pH||ef==MyOpenSpace.PostTo.Result.ERROR){var dD=fe.getUserId===undefined?fe:fe.getUserId();if(fe.setInviteBlocked!==undefined){
fe.setInviteBlocked();}InviteUtil.registerInviteBlocked(dD);}else if(ef==MyOpenSpace.PostTo.Result.CANCELLED){InviteUtil.cancelInvite(fK);}else if(ef==MyOpenSpace.PostTo.Result.SUCCESS){
fe.setAlreadyInvited(true);}if(F){F(O);}}};InviteUtil.handleGetUsersInviteState=function(aU,F,O){var ad=getGadgetResponseData(O);if(!isValid(ad)){outputDebug('Failed to get invite state');return;}$(
ad).find("user").each(function(i,lA){var ao=getXMLNodeValue(lA,"user_id");if(aU[i].getUserId()==ao){aU[i].fillUserStateFromXML(lA);}else{outputDebug('not good dude, this should never happen')}});if(
isValid(F)){F(aU);}};InviteUtil.lazyBucketFunc=function(fq,aU,F){var jT=[];for(var i=0;i<aU.length;++i){if(!aU[i].hasInviteState()){jT.push(aU[i]);}}var ip=function(){var fA=[];for(var i=0;i<
aU.length;++i){var hasApp=aU[i].getHasAppFromCache();var hz=0;if(hasApp){hz=3;}else if(aU[i].getInviteBlocked()){hz=2;}else if(aU[i].getAlreadyInvited()){hz=1;}fA.push(hz);}F(fq,aU,fA);};ip();};
var V_LIBRARY_OS_CONTAINER=opensocial.Container.get();var MS_OS_TOKEN=MyOpenSpace.MySpaceContainer.OSToken;function sendInviteIfNotInstalledMessageOtherwise(aj,cz,hN,nx,qG){makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/is_green_user?user_id="+aj.getUserId(),function(O){var ad=getGadgetResponseData(O);var pW=getXMLFirstNode(ad,"is_green_user").firstChild.nodeValue;if(pW=="true"){
sendMessage(aj,cz,hN,qG);}else{sendInvite(aj,hN,nx);}});};function sendInvitesOrMessagesToUsers(da,cz,hN,F){isGreenUsers(da,function(aU,a_isUsers){handleInvitesOrMessages(aU,a_isUsers,cz,hN,F);});};
function handleInvitesOrMessages(aU,a_isUsers,cz,hN,F){var l_inviteUsers=[];var l_sendMessageUsers=[];for(var i=0;i<aU.length;i++){if(a_isUsers[i]){l_sendMessageUsers.push(aU[i]);}else{
l_inviteUsers.push(aU[i]);}}var kT=0;var l_numMessagesSent=0;var l_numInvitesSent=0;var l_inviteCall=function(F){if(l_numMessagesSent>0||l_numInvitesSent>0){makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/invite?user_id="+MAIN_DATA.getViewer().getUserId()+"&num_invites="+l_numInvitesSent+"&num_messages="+l_numMessagesSent,F);}else{if(F)F();}};var l_handleInvites=
function(){if(l_inviteUsers.length==0){l_inviteCall(F);}else{sendMultiInvite(l_inviteUsers,hN,function(O){if(O.getData())l_numInvitesSent=l_inviteUsers.length;l_inviteCall(F);});}};var mw=function(bf)
{if(bf==1){l_numMessagesSent++;}kT++;if(kT>=l_sendMessageUsers.length){l_handleInvites();}else sendMessage(l_sendMessageUsers[kT],cz,hN,mw);};if(l_sendMessageUsers.length==0){l_handleInvites();}
else sendMessage(l_sendMessageUsers[kT],cz,hN,mw);};function isGreenUsers(da,F){var kT=0;var l_isUsers=[];var jF=false;function l_handleNextUser(O){var ad=getGadgetResponseData(O);var pW=
getXMLFirstNode(ad,"is_green_user").firstChild.nodeValue;l_isUsers.push(pW=="true");kT++;if(kT>=da.length){F(da,l_isUsers);}else makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+
"/green/is_green_user?user_id="+da[kT].getUserId(),l_handleNextUser,{},0);};makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/is_green_user?user_id="+da[kT].getUserId(),l_handleNextUser,{},0);};
function sendMessage(aj,cz,bl,F){var I;I=opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TITLE,cz);I.setField(opensocial.Message.Field.TYPE,opensocial.Message.Type.PRIVATE_MESSAGE);
opensocial.requestSendMessage(aj.getUserId(),I,makeErrorCheckCallback("sendMessage",F));};function sendComment(aj,bl,F){var I;I=opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TYPE,
opensocial.Message.Type.PUBLIC_MESSAGE);goToPageTop();opensocial.requestSendMessage(aj.getUserId(),I,makeErrorCheckCallback("sendComment",F));};function sendCommentWOGoToPageTop(aj,bl,F){var I;I=
opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TYPE,opensocial.Message.Type.PUBLIC_MESSAGE);opensocial.requestSendMessage(aj.getUserId(),I,makeErrorCheckCallback(
"sendCommentWOGoToPageTop",F));};function sendInvite(aj,bl,F){var I=opensocial.newMessage(bl);opensocial.requestShareApp(aj.getUserId(),I,makeErrorCheckCallback("sendInvite",F));};
function sendMultiInvite(da,bl,F){var l_ids=[];for(var i=0;i<da.length;++i){var l_targetUserId=da[i].getUserId===undefined?da[i]:da[i].getUserId();l_ids.push(l_targetUserId);}var v={};var I=
opensocial.newMessage(bl);opensocial.requestShareApp(l_ids,I,F);};function postToProfile(aj,bl,fd){var I;I=opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TYPE,
MyOpenSpace.PostTo.Targets.PROFILE);goToPageTop();V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN,I,aj,fd);};function postToBlog(aj,cz,bl,fd){var I;I=opensocial.newMessage(bl);I.setField(
opensocial.Message.Field.TITLE,cz);I.setField(opensocial.Message.Field.TYPE,MyOpenSpace.PostTo.Targets.BLOG);goToPageTop();V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN,I,aj);};function postToBulletin(aj,
cz,bl,fd){var I;I=opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TITLE,cz);I.setField(opensocial.Message.Field.TYPE,MyOpenSpace.PostTo.Targets.BULLETINS);goToPageTop();
V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN,I,aj,fd);};function postToBulletinWOGoToPageTop(aj,cz,bl,fd){var I;I=opensocial.newMessage(bl);I.setField(opensocial.Message.Field.TITLE,cz);I.setField(
opensocial.Message.Field.TYPE,MyOpenSpace.PostTo.Targets.BULLETINS);V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN,I,aj,fd);};function makeErrorCheckCallback(nY,F){return function(O){if(isValid(O)&&
O.hadError()){outputDebug(nY+' request error: '+O.getErrorMessage());}if(isValid(F)){F(O.getData());}}};function postActivity(qP,dm,kp,qJ,F){var v={};v[opensocial.Activity.Field.TITLE_ID]=qP;if(
isValid(dm)){for(var i in dm){dm[i]=""+dm[i];}v[opensocial.Activity.Field.TEMPLATE_PARAMS]=dm;}if(kp){var mG=[];for(var i=0;i<kp.length;++i){mG.push(opensocial.newMediaItem("",kp[i]));}
v[opensocial.Activity.Field.MEDIA_ITEMS]=mG;}var pa=opensocial.newActivity(v);var iL=qJ;if(!isValid(iL))iL=opensocial.CreateActivityPriority.HIGH;opensocial.requestCreateActivity(pa,iL,
makeErrorCheckCallback("postActivity",F));};function setStyle(bd,bi){if(isValid(bi)){for(var i in bi){bd.style[i]=bi[i];}}return bd;};function makeElement(bJ,bu,bi){var bp=document.createElement(bJ);
if(bu)bu.appendChild(bp);return setStyle(bp,bi);};function makeElementId(bJ,bu,aC,bi){var result=makeElement(bJ,bu,bi);result.id=aC;return result;};var $elmid=makeElementId;function makeElementClass(
bJ,bu,dF,bi){var bp=makeElement(bJ,bu,bi);bp.className=dF;return bp;};var $elcl=makeElementClass;var $elid=makeElementId;var $el=makeElement;var $divcl=function(bu,dF,bi){return makeElementClass(
"div",bu,dF,bi);};var $divid=function(bu,aC,bi){return makeElementId("div",bu,aC,bi);};var $div=function(bu,bi){return makeElement("div",bu,bi);};function addGrayBorder(bX){bX.style.borderStyle=
"solid";bX.style.borderWidth="1";bX.style.borderColor="#cccccc";};function addBottomGrayBorder(bX){bX.style.borderBottomStyle="solid";bX.style.borderBottomWidth="1";bX.style.borderBottomColor=
"#cccccc";};function addBottomBlueBorder(bX){bX.style.borderBottomStyle="solid";bX.style.borderBottomWidth="1";bX.style.borderBottomColor="#7f93bc";};function goToPageTop(){location.href=
"#mainFrameTop";};function Button(D,dP,F){var g=D;var cR=dP;var dB=F;this.createDiv=createDiv;if(g!=undefined){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;var ax=
document.createElement("a");ax.className="blueButton";ax.href="#";ax.appendChild(document.createTextNode(cR));addEvent(ax,"click",dB);var aG=document.createElement("span");aG.setAttribute("style",
"text-align:center;");aG.className="blueButton";aG.appendChild(ax);g.appendChild(aG);}};function BigButton(D,dP,F){var g=D;var cR=dP;var dB=F;this.createDiv=createDiv;if(g!=undefined){createDiv(g);}
function createDiv(_a_parentDiv){g=_a_parentDiv;var ax=document.createElement("a");ax.className="bigBlueButton";ax.href="#";ax.appendChild(document.createTextNode(cR));addEvent(ax,"click",dB);var aG=
document.createElement("span");aG.style.textAlign="CENTER";aG.className="bigBlueButton";aG.appendChild(ax);g.appendChild(aG);}};function DivButton(parentDiv,buttonString,callback,callbackArgs){var g=
parentDiv;var cR=buttonString;var dB=callback;var oX=callbackArgs;var aO=undefined;this.createDiv=createDiv;this.getButtonDiv=getButtonDiv;if(g!=undefined){createDiv(g);}function createDiv(_parentDiv)
{g=_parentDiv;aO=document.createElement("div");g.appendChild(aO);aO.style.textAlign="center";aO.style.padding="10px";aO.style.backgroundColor="#3b5998";aO.style.color="white";aO.style.fontSize="16px";
aO.style.fontWeight="bold";aO.style.borderRightStyle="solid";aO.style.borderRightWidth="2px";aO.style.borderRightColor="gray";aO.style.borderBottomStyle="solid";aO.style.borderBottomWidth="2px";
aO.style.borderBottomColor="gray";aO.style.cursor="pointer";aO.innerHTML=cR;addEventWithParameter(aO,"click",dB,oX);};function getButtonDiv(){return aO;}};function LinkButton(D,dP,kw){var g=D;var cR=
dP;this.createDiv=createDiv;if(g!=undefined){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;var ax=document.createElement("a");ax.className="blueButton";ax.href=kw;ax.appendChild(
document.createTextNode(cR));var aG=document.createElement("span");aG.setAttribute("style","text-align:center;");aG.className="blueButton";aG.appendChild(ax);g.appendChild(aG);}};function ClosableDiv(
D){var g=D;var B=undefined;var hv=undefined;this.createDiv=createDiv;this.getContentDiv=getContentDiv;this.closeContainerDiv=closeContainerDiv;if(g!=undefined&&g!=null){createDiv(g);}
function createDiv(_a_parentDiv){g=_a_parentDiv;B=document.createElement("div");g.appendChild(B);B.style.margin="3px 10px 5px 10px";B.style.padding="0";B.style.border="1px solid #0e1f5b";var aw=
document.createElement("div");B.appendChild(aw);aw.style.textAlign="RIGHT";aw.style.padding="3px 10px 3px 10px";aw.style.color="#FFFFFF";aw.style.fontWeight="BOLD";aw.style.backgroundColor="#7f93bc";
var ee=document.createElement("a");aw.appendChild(ee);ee.href="#";ee.style.color="WHITE";ee.style.fontWeight="BOLD";ee.style.textDecoration="none";ee.innerHTML="x";addEvent(ee,"click",
closeContainerDiv);hv=document.createElement("div");B.appendChild(hv);hv.style.padding="6";};function getContentDiv(){return hv;};function closeContainerDiv(){B.style.display="none";return false;}};
function ImageDiv(D,fJ,cl,fg,oB,nC,ov,hq,ht,hs){this.g=D;this.qB=oB;this.dM=fJ;this.fO=cl?parseInt(cl):64;this.lw=fg?parseInt(fg):64;this.pf=nC||"#EEEEEE";this.lB=ov;this.nK=hq;this.hF=isValid(ht)?ht:
true;this.hG=isValid(hs)?hs:false;this.gh=null;this.ju=null;this.jr=null;if(this.g!=undefined){this.createDiv();}};ImageDiv.prototype.createDiv=function(){var bZ=this;this.gh=makeElementClass("div",
this.g,"imgDivFrame",{width:this.fO+"px",height:this.lw+"px",overflow:"hidden",textAlign:"center",backgroundColor:this.pf,position:"relative",left:"0px",top:"0px"});if(this.hG){this.ju=makeElement(
"img",this.gh);this.ju.style.width=this.fO+"px";this.ju.src=this.dM;}else{setStyle(this.gh,{backgroundImage:"url('"+this.dM+"')",backgroundPosition:"top center",backgroundRepeat:"no-repeat"});}
this.jr=makeElement("div",this.gh,{position:"absolute",left:"0px",top:"0px",width:this.fO,height:this.lw});if(isValid(this.lB))this.jr.innerHTML=this.lB;if(this.hF){appendZoomButton(this.jr,this.dM,
this.nK);}};ImageDiv.prototype.getContainerDiv=function(){return this.gh;};ImageDiv.prototype.getselectedImage=function(){return this.qB;};function appendZoomButton(D,hM,hq){if(hM.indexOf("/s_")>0||
hM.indexOf("_s.jpg")>0||hM.indexOf("_s.gif")>0){var pm=hM.replace("/s_","/l_").replace("_s.jpg","_l.jpg").replace("_s.gif","_l.gif");var gF=document.createElement("div");gF.className="zoomButton";
gF.title="Click to zoom.";if(isValid(hq)){gF.scrollAncestor=hq}gF.onclick=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();var xy=findPos(this);
zoomIntoImage(pm,xy[1]-250);};D.appendChild(gF);}};function findPos(obj){var curleft=curtop=0;var stack=new Array();if(obj.scrollAncestor){curtop-=obj.scrollAncestor.scrollTop;}if(obj.offsetParent){
do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;stack.push(obj.offsetTop);}while(obj=obj.offsetParent);}return[curleft,curtop];};function findMousePos(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+document.documentElement.scrollLeft;posy=e.clientY+
document.body.scrollTop+document.documentElement.scrollTop;}return[posx,posy];};function zoomIntoImage(nZ,fg){var aZ=document.getElementById("OYFpopupcontainer");aZ.innerHTML=
"<div style='background: white url(http://cdn0.supercomment.com/kissme/images/ajax-loader.gif) no-repeat scroll center center; margin: 20px; padding: 10px; border: 2px solid gray; font-size: 11px;'"+
" onclick='document.getElementById(\"OYFpopupcontainer\").innerHTML=\"\"'><center>Click to close<br>&nbsp;<br><img src='"+nZ+"'><br>&nbsp;<br>Click to close</center></div>";aZ.style.top=fg;};
function LinkButton(D,dP,kw){var g=D;var cR=dP;this.createDiv=createDiv;if(g!=undefined){createDiv(g);}function createDiv(_parentDiv){g=_parentDiv;var ax=document.createElement("a");ax.className=
"blueButton";ax.href=kw;ax.innerHTML=cR;var aG=document.createElement("span");aG.style.textAlign="CENTER";aG.className="blueButton";aG.appendChild(ax);g.appendChild(aG);}};function PaginationDiv(D,nr,
jG,ot,jU){var g=D;var bG=undefined;var fo=jG;var bB=ot;var lu=jU;var fD=nr;if(isValid(g)){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;bG=document.createElement("div");g.appendChild(
bG);bG.style.margin="5px 50px 0px 0px";bG.style.textAlign="right";if(fo>1&&bB>1){var gq=document.createElement("a");gq.href="#";gq.className="paginationProgressionLink";gq.appendChild(
document.createTextNode("prev<<"));bG.appendChild(gq);addEventWithParameter(gq,"click",fD,bB-1);}bG.appendChild(document.createTextNode("  "));var oI=Math.max(Math.ceil(jU/2),lu-(fo-bB));var mn=
Math.max(1,bB-oI);var oO=Math.max(Math.ceil(jU/2),lu-bB);var mY=Math.min(fo,bB+oO);if(mn>1){var aV=document.createElement("a");aV.appendChild(document.createTextNode("1"));bG.appendChild(aV);aV.href=
"#";aV.className="paginationPageNum";bG.appendChild(document.createTextNode("..."));addEventWithParameter(aV,"click",fD,1);}for(var eL=mn;eL<=mY;eL++){if(eL!=bB){var aV=document.createElement("a");
aV.href="#";aV.className="paginationPageNum";aV.appendChild(document.createTextNode(eL));bG.appendChild(aV);addEventWithParameter(aV,"click",fD,eL);}else{var jX=document.createElement("span");
bG.appendChild(jX);jX.className="paginationCurPageNum";jX.appendChild(document.createTextNode(eL));}}if(mY<fo){bG.appendChild(document.createTextNode("..."));var aV=document.createElement("a");
aV.appendChild(document.createTextNode(fo));aV.href="#";aV.className="paginationPageNum";bG.appendChild(aV);addEventWithParameter(aV,"click",fD,fo);}if(jG>1&&bB<jG){var gj=document.createElement("a");
gj.href="#";gj.className="paginationProgressionLink";gj.appendChild(document.createTextNode("next>>"));bG.appendChild(gj);addEventWithParameter(gj,"click",fD,bB+1);}}};function SideBySideCells(D,ny){
var g=D;var B=undefined;var pd=ny;var bj=undefined;var iO=undefined;this.createDiv=createDiv;this.getLeftCell=getLeftCell;this.getRightCell=getRightCell;if(g!=undefined){createDiv(g);}
function createDiv(_a_parentDiv){g=_a_parentDiv;B=document.createElement("div");g.appendChild(B);var ir=document.createElement("table");B.appendChild(ir);var hZ=document.createElement("tbody");
ir.appendChild(hZ);var ak=document.createElement("tr");hZ.appendChild(ak);bj=document.createElement("td");ak.appendChild(bj);iO=document.createElement("td");ak.appendChild(iO);if(pd){
B.style.textAlign="center";ir.style.marginLeft="auto";ir.style.marginRight="auto";}};function getLeftCell(){return bj;};function getRightCell(){return iO;}};function TabsDiv(D,qg,qf,qe,oH,qS,qc){
var hE="140px";if(IE)hE="140px";var dY="-10000px";var g=D;var iH=qg;var mj=qf;var rk=qe;var qO=oH;var eC=qS;var iS=qc;var ap= -1;var dQ=new Array();var B=undefined;var cx=undefined;var ej=new Array();
var ho=new Array();var bv=undefined;var rq=undefined;this.createDiv=createDiv;this.switchToTab=switchToTab;this.switchToDynamicTab=switchToDynamicTab;this.reloadTab=reloadTab;if(g!=undefined&&g!=null)
{createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;outputDebug("TabsDiv: createDiv");B=document.createElement("div");g.appendChild(B);cx=document.createElement("div");B.appendChild(cx);
createTabs();var hw=document.createElement("div");B.appendChild(hw);hw.className="tabContentFrame";if(IE)hw.style.width=944;hw.style.zIndex="-1";for(var bm=0;bm<iH.length;bm++){var tabContentDiv=
document.createElement("div");tabContentDiv.style.position="absolute";tabContentDiv.style.top=dY;tabContentDiv.style.left="20px";tabContentDiv.style.width="900px";tabContentDiv.style.zIndex="1";
B.appendChild(tabContentDiv);ej.push(tabContentDiv);ho.push(false);}bv=document.createElement("div");bv.style.position="absolute";bv.style.top=dY;bv.style.left="50px";bv.style.width="860px";
bv.style.zIndex="1";B.appendChild(bv);switchToTab(qO);};function createTabs(){outputDebug("TabsDiv: createTabs");cx.innerHTML="";cx.style.background=
"url(http://cdn0.mobwarsapp.com/prod_green/images/ui/greengardentabsgreen_nomoney.gif) no-repeat 0px";cx.style.height=48;cx.style.width=944;cx.style.marginLeft=0;cx.style.position="relative";
var tabLeft=[0,101,216,347,876,696];var tabWidth=[101,115,131,113,69,140];var bm;for(bm=0;bm<GP.NUM_MAIN_TABS-1;bm++){var ab=document.createElement("div");ab.style.cursor="pointer";ab.style.height=47;
ab.style.left=tabLeft[bm];ab.style.width=tabWidth[bm];ab.style.position="absolute";ab.style.backgroundPosition= -tabLeft[bm];cx.appendChild(ab);ab.className=eC;dQ.push(ab);addEventWithParameter(ab,
"click",switchToTab,bm);}if(iH.length==GP.NUM_MAIN_TABS){var ab=document.createElement("div");ab.style.cursor="pointer";ab.style.height=47;ab.style.left=tabLeft[bm];ab.style.width=tabWidth[bm];
ab.style.position="absolute";var ek=document.createElement("div");ek.id="extraTabCaption";ek.style.margin="14px auto";ek.style.fontSize="13px";ek.style.width=tabWidth[bm]-20;ek.innerHTML="<center>"+
iH[bm]+"</center>";ab.appendChild(ek);cx.appendChild(ab);ab.className=eC+"extra";dQ.push(ab);addEventWithParameter(ab,"click",switchToTab,bm);}};function switchToTab(jD){refreshAdvertisement();if(ap>=
0){var ab=dQ[ap];ab.className=ap<5?eC:eC+"extra";var gC=ej[ap];gC.style.top=dY;}bv.innerHTML="";bv.style.top=dY;ap=jD;var jI=dQ[ap];jI.className=ap<5?iS:iS+"extra";var gK=ej[ap];gK.style.top=hE;
var iM=mj[ap];iM(gK,ho[ap]);ho[ap]=true;goToPageTop();return false;};function reloadTab(jD){if(ap>=0){var ab=dQ[ap];ab.className=eC;var gC=ej[ap];gC.style.top=dY;}bv.innerHTML="";bv.style.top=dY;ap=
jD;var jI=dQ[ap];jI.className=iS;var gK=ej[ap];gK.style.top=hE;var iM=mj[ap];iM(gK,false);ho[ap]=true;goToPageTop();return false;};function switchToDynamicTab(ow){outputDebug("switch to dynamic tab");
if(ap>=0){var ab=dQ[ap];ab.className=eC;var gC=ej[ap];gC.style.top=dY;}ap= -1;goToPageTop();bv.innerHTML="";bv.style.top=hE;ow(bv);return false;}};function TextBoxDiv(D,hI){var g=D;var fr=hI;var Q=
null;var dV=null;this.createDiv=createDiv;this.getText=getText;this.setPosition=setPosition;this.setMaxLength=setMaxLength;if(g!=undefined){return createDiv(g);}function createDiv(_a_parentDiv){g=
_a_parentDiv;outputDebug("TextBoxDiv: createDiv");Q=document.createElement("div");Q.setAttribute("style","overflow:auto;");g.appendChild(Q);dV=document.createElement("textarea");dV.setAttribute(
"rows",4);dV.setAttribute("cols",30);if(fr!=undefined&&fr!=null){dV.appendChild(document.createTextNode(fr));}Q.appendChild(dV);addEvent(Q,"click",function(){if(dV.value==fr){dV.value='';}});};
function getText(){return dV.value;};function setMaxLength(qZ){dV.setAttribute("maxlength",250);};function setPosition(fU,gA){Q.style.position="absolute";Q.style.left=fU;Q.style.top=gA;}};
function TextFieldDiv(D,hI,size,maxLength){var g=D;var fr=hI;var Q=null;var bP=null;var mN=size;var nP=maxLength;this.createDiv=createDiv;this.getText=getText;this.setPosition=setPosition;if(g!=
undefined){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;outputDebug("TextFieldDiv: createDiv");Q=document.createElement("div");g.appendChild(Q);try{bP=document.createElement(
"<input type='text' size='"+mN+"' maxlength='"+nP+"'/>");}catch(error){bP=document.createElement("input");bP.type="text";bP.size=mN;bP.maxLength=maxLength;}if(fr!=undefined&&fr!=null){bP.value=hI;}
Q.appendChild(bP);};function getText(){return bP.value;};function setPosition(fU,gA){bP.style.position="absolute";bP.style.left=fU;bP.style.top=gA;}};function CenteredTextMessageDiv(D,jZ,cl){var g=D;
var jl=jZ;var fO=cl;var hQ=null;var Q=null;this.createDiv=createDiv;this.getTextDiv=getTextDiv;if(g!=undefined){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;outputDebug(
"CenteredTextMessageDiv: createDiv");hQ=document.createElement("div");g.appendChild(hQ);hQ.style.textAlign="center";Q=document.createElement("div");hQ.appendChild(Q);Q.style.backgroundColor="#f7f7f7";
Q.style.marginLeft="auto";Q.style.marginRight="auto";Q.style.width=fO;Q.style.padding="5px 5px 5px 10px";Q.style.color="#333333";Q.style.borderStyle="solid";Q.style.borderWidth="1px";
Q.style.borderColor="#7f93bc";Q.innerHTML=jl;};function getTextDiv(){return Q;}};function TextMessageDiv(D,jZ){var g=D;var jl=jZ;var Q=null;this.createDiv=createDiv;this.getContainerDiv=
getContainerDiv;if(g!=undefined){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;outputDebug("HTMLDiv: createDiv");Q=document.createElement("div");g.appendChild(Q);
Q.style.backgroundColor="#fff9d7";Q.style.margin="5px 10px 10px 10px";Q.style.padding="5px 5px 5px 10px";Q.style.color="#333333";Q.style.borderStyle="solid";Q.style.borderWidth="1px";
Q.style.borderColor="#e2c822";Q.innerHTML=jl;};function getContainerDiv(){return Q;}};function id(bJ){return document.getElementById(bJ);};function modalPopup(text,button_params,top){id("overlay")
.style.display="block";id("popupWindow").style.display="block";if(isValid(top))id("popupWindow").style.top=top;else id("popupWindow").style.top=null;id("popupWindowText").innerHTML=text;id(
"popupWindowButtons").innerHTML="";for(var buttontext in button_params){id("popupWindowButtons").appendChild(modalPopupButton(buttontext,button_params[buttontext]));}};function modalBoardPopup(
button_params,top){id("overlay").style.display="block";id("popupWindow").style.display="block";if(isValid(top))id("popupWindow").style.top=top;else id("popupWindow").style.top=null;id(
"popupWindowText").innerHTML=
'Paint your garden board! <br /> This costs 10 green bucks. <br /> <br /> <form> &nbsp; &nbsp; First line (10 chars): <input type="text" size="8" maxlength="10" name="firstline" id="firstline"> <br/> Second line (10 chars): <input type="text" size="8" maxlength="10" name="secondline" id="secondline"></form>';
id("popupWindowButtons").innerHTML="";for(var buttontext in button_params){id("popupWindowButtons").appendChild(modalPopupButton(buttontext,button_params[buttontext]));}};function modalCommentPopup(
button_params){id("overlay").style.display="block";id("popupWindow").style.display="block";id("popupWindow").style.top="800";id("popupWindowText").innerHTML=
'Add your comment! <br /> This costs 1 green buck. <br /> <br /> <form> &nbsp; &nbsp; comment (250 chars max): <input type="text" size="8" maxlength="250" name="comment_text" id="comment_text"> <br/></form>';
id("popupWindowButtons").innerHTML="";for(var buttontext in button_params){id("popupWindowButtons").appendChild(modalPopupButton(buttontext,button_params[buttontext]));}};function dismissModalPopup(){
id("overlay").style.display="none";id("popupWindow").style.display="none";};function modalPopupButton(text,callback){var callback_wrapper=function(){id("overlay").style.display="none";id(
"popupWindow").style.display="none";if(callback)callback();};return greenButton(text,callback_wrapper,330);};function greenButton(aT,F,cl,aC){var auto_width=cl||Math.max(60,10*aT.length);var button=
document.createElement("div");button.style.width=auto_width+"px";var buttonInner=document.createElement("div");button.appendChild(buttonInner);if(auto_width>200)buttonInner.style.width="200px";
button.className="greenButton";buttonInner.className="greenButtonLeft";var buttonInnerRight=document.createElement("div");buttonInnerRight.className="greenButtonRight";buttonInnerRight.style.width=
auto_width-20;button.appendChild(buttonInnerRight);var buttonText=document.createElement("div");buttonText.className="greenButtonText";buttonText.style.width=auto_width+"px";button.appendChild(
buttonText);buttonText.innerHTML=aT;button.onclick=F;if(isValid(aC)){buttonText.id=aC;}return button;};function greenButtonWithParam(aT,F,ag,cl,aC){var auto_width=cl||Math.max(60,10*aT.length);
var button=document.createElement("div");button.style.width=auto_width+"px";var buttonInner=document.createElement("div");button.appendChild(buttonInner);if(auto_width>200)buttonInner.style.width=
"200px";button.className="greenButton";buttonInner.className="greenButtonLeft";var buttonInnerRight=document.createElement("div");buttonInnerRight.className="greenButtonRight";
buttonInnerRight.style.width=auto_width-20;button.appendChild(buttonInnerRight);var buttonText=document.createElement("div");buttonText.className="greenButtonText";buttonText.style.width=auto_width+
"px";button.appendChild(buttonText);buttonText.innerHTML=aT;button.onclick=function(){F(ag);};outputDebug("setting id for button: "+aC);if(isValid(aC)){buttonText.id=aC;}return button;};
function HelpfulInput(bu,nH){var bZ=this;this.eS=makeElementClass("input",bu,"helpful_input");this.qt=nH;this.iZ=false;$(this.eS).focus(this.hideHelp.bind(this)).blur(this.showHelp.bind(this)).keyup(
this.keyup.bind(this));this.showHelp();};extendClass(HelpfulInput,EventDispatcher);HelpfulInput.prototype.showHelp=function(){if(!this.iZ){$(this.eS).val(this.qt).addClass('helpful_input_blank');}};
HelpfulInput.prototype.hideHelp=function(){if(!this.iZ){$(this.eS).val("")}$(this.eS).removeClass("helpful_input_blank");};HelpfulInput.prototype.keyup=function(){this.iZ=$(this.eS).val()!="";
this.hideHelp();};HelpfulInput.prototype.getInput=function(){return this.eS;};function SelectionModel(){SelectionModel.baseConstructor.call(this);this.declareEvent("select").declareEvent("unselect");}
;extendClass(SelectionModel,EventDispatcher);SelectionModel.prototype.toggle=function(L){outputDebug('implement toggle');};SelectionModel.prototype.select=function(L){outputDebug('implement select');}
;SelectionModel.prototype.deselect=function(L){outputDebug('implement deselect');};SelectionModel.prototype.clear=function(){outputDebug('implement clear');};SelectionModel.prototype.getSelected=
function(){outputDebug('implement getSelected');};SelectionModel.prototype.isSelected=function(L){outputDebug('implement isSelected');};function SingleSelectionModel(){
SingleSelectionModel.baseConstructor.call(this);this.bg=null;};extendClass(SingleSelectionModel,SelectionModel);SingleSelectionModel.prototype.toggle=function(L){return this.select(L);};
SingleSelectionModel.prototype.select=function(L){if(this.bg==L){return;}if(this.bg){this.trigger("unselect",this.bg);}if(L!=this.bg){this.bg=L;this.trigger("select",this.bg);}else{this.bg=null;}};
SingleSelectionModel.prototype.clear=function(){if(this.bg){this.trigger("unselect",this.bg);this.bg=null;}};SingleSelectionModel.prototype.deselect=function(L){if(this.bg==L){this.clear();}};
SingleSelectionModel.prototype.getSelected=function(){return isValid(this.bg)?[this.bg]:[];};SingleSelectionModel.prototype.getSelectedItem=function(){return this.bg;};
SingleSelectionModel.prototype.isSelected=function(L){return L==this.bg;};function MultiSelectionModel(){MultiSelectionModel.baseConstructor.call(this);this.cP={};};extendClass(MultiSelectionModel,
SelectionModel);MultiSelectionModel.prototype.toggle=function(L){var fQ=$guid(L);if(this.cP[fQ]){delete this.cP[fQ];this.trigger("unselect",L);}else{this.cP[fQ]=L;this.trigger("select",L);}};
MultiSelectionModel.prototype.select=function(L){if(!this.isSelected(L)){this.toggle(L);}};MultiSelectionModel.prototype.deselect=function(L){if(this.isSelected(L)){this.toggle(L);}};
MultiSelectionModel.prototype.clear=function(){var gO=this.cP;this.cP={};for(var guid in gO){this.trigger("unselect",gO[guid]);}};MultiSelectionModel.prototype.getSelected=function(){var bp=[];for(
var guid in this.cP){bp.push(this.cP[guid]);}return bp;};MultiSelectionModel.prototype.isSelected=function(L){return this.cP[$guid(L)];};MultiSelectionModel.prototype.getCount=function(){var ci=0;for(
var guid in this.cP){ci+=1;}return ci;};function ItemListDiv(D,dF,bS){this.g=D;this.qz=dF;this.ft=undefined;this.iW=false;this.oA=false;this.iI=true;this.createDiv();this.setItemData(bS);};
ItemListDiv.prototype.setShowPagination=function(lv){if(this.iI!=lv){this.iI=lv;this.updatePagination();}return this;};ItemListDiv.prototype.setWidth=function(cl){$(this.am).width(cl);};
ItemListDiv.prototype.setHeight=function(fg){$(this.am).height(fg);};ItemListDiv.prototype.createDiv=function(){this.B=$divcl(this.g,this.qz);$(this.B).css({position:"relative",left:"0px",top:"0px"});
this.am=$divcl(this.B,"item_list");$divcl(this.B,"clearall");this.jq=$divcl(this.B,"item_pagination");this.fz=$divcl(this.B,"loading_overlay");$(this.fz).css('display','none');this.jm=$divcl(this.fz,
"background");$(this.jm).css('opacity',0.1);this.qV=$divcl(this.fz,"icon");};ItemListDiv.prototype.setItemData=function(bS){this.ft=bS;if(isValid(bS)){bS.bindCountCallback(this.handlePageCount.bind(
this));bS.bindPageCallback(this.handleItems.bind(this));}else{outputDebug('ERROR! ItemListDiv.setItemData called with bad bS')}};ItemListDiv.prototype.handlePageCount=function(nq){this.or=nq;
this.updatePagination(this.ft.getPage());};ItemListDiv.prototype.enableLoading=function(nU){this.iW=nU;};ItemListDiv.prototype.showLoading=function(){if(!this.iW)return;$(this.fz).css('display',
'block');$(this.jm).fadeTo('fast',0.9);};ItemListDiv.prototype.hideLoading=function(){if(!this.iW)return;var bZ=this;$(this.jm).fadeTo(100,0.1).queue(function(){$(bZ.fz).css('display','none');$(this)
.dequeue();})};ItemListDiv.prototype.switchToPage=function(af){this.showLoading();this.ft.setPage(af);this.updatePagination(af);};ItemListDiv.prototype.updatePagination=function(af){$(this.jq).html(
"");if(this.iI){this.rb=new PaginationDiv(this.jq,this.switchToPage.bind(this),this.or,af,5,this.oA);$divcl(this.jq,"clearall");}};ItemListDiv.prototype.handleItems=function(af,R,ay){if(ay){
this.hideLoading();}else{this.showLoading();}this.jz=R;this.redraw();};ItemListDiv.prototype.redraw=function(){var bZ=this;var T=[];this.clear();$.each(this.jz,function(i,L){bZ.drawItem(L);});$divcl(
this.am,"clearall");};ItemListDiv.prototype.clear=function(D,L){$(this.am).html("");};ItemListDiv.prototype.drawItem=function(D,L){outputDebug('ItemListDiv.drawItem not implemented! doh!');};
ItemListDiv.prototype.getItems=function(){return this.jz;};function SelectableItemListDiv(D,dF,bS,dZ){this.bb=dZ;this.fs={};SelectableItemListDiv.baseConstructor.call(this,D,dF,bS);this.bb.bind(
"select",this.onSelect.bind(this)).bind("unselect",this.onUnselect.bind(this));};extendClass(SelectableItemListDiv,ItemListDiv);SelectableItemListDiv.prototype.redraw=function(){var bZ=this;var T=[];
this.clear();this.fs={};$.each(this.jz,function(i,L){bZ.fs[$guid(L)]=bZ.drawItem(L);});$divcl(this.am,"clearall");};SelectableItemListDiv.prototype.click=function(oa,L){this.fs[$guid(L)]=oa;
this.bb.toggle(L);};SelectableItemListDiv.prototype.onSelect=function(L){var jR=this.fs[$guid(L)];$(jR).addClass('selected');};SelectableItemListDiv.prototype.onUnselect=function(L){var fQ=$guid(L);
var jR=this.fs[fQ];$(jR).removeClass('selected');};SelectableItemListDiv.prototype.getItemDiv=function(L){return this.fs[$guid(L)];};function FriendChooserDiv(D,kc,hP,dr,dZ,ds){if(dZ==null)
outputDebug('fuck');this.B=$divcl(D,"friend_chooser");this.bb=dZ;this.lf=$divcl(this.B,"friend_filter");this.kK=new HelpfulInput(this.lf,"Search by name...").getInput();$(this.kK).keyup(
this.delayedFilter.bind(this));this.hp="";this.eV=isValid(ds)?ds:21;this.am=new FriendListDiv(this.B,null,this.bb);this.setupData(kc,hP,dr);$divcl(this.B,"clearall");};
FriendChooserDiv.prototype.DEBUG_MAGIC="peterpan";FriendChooserDiv.prototype.setupData=function(kc,hP,dr,fR){var cD=kc;if(isValid(hP)&&hP){this.iG=cD=cD.randomized();}else{this.iG=null;}this.qb=cD=
cD.filtered(this.__curFilter.bind(this));if(isValid(dr)){cD=cD.lazyBucketed(dr,fR);}this.ft=cD;this.oy=this.ft.paged(this.eV);this.am.setItemData(this.oy);};FriendChooserDiv.prototype.randomizeAgain=
function(){if(isValid(this.iG)){this.iG.reset();}};FriendChooserDiv.prototype.getArray=function(qn){return this.ft.getCurData(0,qn);};FriendChooserDiv.prototype.delayedFilter=function(){var cC=$(
this.kK).val().trim().toLowerCase();if(cC==this.DEBUG_MAGIC){this.am.enableDebug();}if(cC==this.hp)return;this.hp=cC;if(this.lM){clearTimeout(this.lM);}this.am.showLoading();this.lM=setTimeout(
this.updateFilter.bind(this),100);};FriendChooserDiv.prototype.__curFilter=function(aB){var cC=this.hp;if(cC=="")return true;var eb=aB.getName();if(!isValid(eb))return false;eb=eb.toLowerCase();
return eb.indexOf(this.hp)>=0;};FriendChooserDiv.prototype.updateFilter=function(){this.qb.dirtyPredicate();};FriendChooserDiv.prototype.getFilterDiv=function(){return this.lf;};
FriendChooserDiv.prototype.getFriendList=function(){return this.am;};function FriendListDiv(D,bS,dZ){if(dZ==null)outputDebug('fuck');this.jk=64;this.nd=true;this.hF=true;this.hG=false;this.lP=false;
FriendListDiv.baseConstructor.call(this,D,"friend_list",bS,dZ);};extendClass(FriendListDiv,SelectableItemListDiv);FriendListDiv.prototype.setIconSize=function(np){this.jk=np;return this;};
FriendListDiv.prototype.setShowName=function(qq){this.nd=qq;return this;};FriendListDiv.prototype.setShowZoom=function(ht){this.hF=ht;return this;};FriendListDiv.prototype.setResizeImage=function(hs){
this.hG=hs;return this;};FriendListDiv.prototype.enableDebug=function(){this.lP=true;};FriendListDiv.prototype.drawItem=function(aB){if(!isValid(aB))return;var bZ=this;var df=$divcl(this.am,"item");
var pO=$divcl(df,"frame");var ar=new ImageDiv(pO,aB.getThumbnailUrl(),this.jk,this.jk,0,null,null,this.am,this.hF,this.hG);if(this.nd){var C=$divcl(df,"name");$(C).html(aB.getName());}if(this.lP){
var debug_suffix=" app="+aB.getHasApp();debug_suffix+=" inv="+aB.getAlreadyInvited();debug_suffix+=" blk="+aB.getInviteBlocked();$(df)[0].title=aB.getName()+debug_suffix;}else{$(df)[0].title=
aB.getName();}if(this.bb.isSelected(aB)){$(df).addClass('selected');}$(df).hover(function(){$(this).addClass('highlighted');},function(){$(this).removeClass('highlighted');}).click(this.click.bind(
this,df,aB));return df;};function GreenStoreDiv(D,M){var g=D;this.createDiv=createDiv;var ae;var U=M;var iu=undefined;var ae=undefined;if(g!=undefined&&g!=null){createDiv(g);}function createDiv(
_a_parentDiv){g=_a_parentDiv;iu=document.createElement("div");g.appendChild(iu);iu.innerHTML=
"<br/><span style='margin: 0px 250px; color:#CC6600; font-size:16px; font-weight:bold;'> Your current balance is: &nbsp;$"+addCommas(U.getCash())+" &nbsp;greenbucks</span><br/>"+
"<br/><span style='margin: 0px 100px; color:#336600; font-size:16px; font-weight:bold;'> The Green Store sells gardening tools that you can use to keep your gardens healthy!</span><br/>";iu.id=
"store_cash";var eE=document.createElement("table");ae=document.createElement("div");g.appendChild(ae);ae.style.margin="0 150px";ae.appendChild(eE);eE.style.marginLeft="auto";eE.style.marginRight=
"auto";eE.style.cellSpacing="0px";eE.style.borderCollapse="collapse";var mr=document.createElement("tbody");eE.appendChild(mr);for(var T=0;T<TOOLS.length;T++){mr.appendChild(createItemTr(TOOLS[T]));}
var hY=document.createElement("div");hY.style.margin="0px 75px";hY.style.marginTop="30px";g.appendChild(hY);var oQ=
"<br/><div style='margin: 0px 0px 0px 60px; color:#CC6600; font-size:16px; font-weight:bold;'>"+"You can also buy gifts for your own garden!</div><br/>";new SeedSelectorDiv(hY,oQ,true);};
function createItemTr(aq){var ak=document.createElement("tr");var k=document.createElement("td");ak.appendChild(k);k.style.padding="5px 0px 5px 0px";k.style.borderBottom="2px solid #e5ffb2";var aF=
document.createElement("table");k.appendChild(aF);aF.style.cellSpacing="0px";aF.style.borderCollapse="collapse";var bT=document.createElement("tbody");aF.appendChild(bT);var ac=document.createElement(
"tr");bT.appendChild(ac);ac.appendChild(createRankTd(aq.getRank()+1));ac.appendChild(createPictureTd(aq));ac.appendChild(createDescriptionTd(aq.getName()));ac.appendChild(createCostTd(aq));
ac.appendChild(createUsesLeftTd(aq,M));createQuantityAndBuyTd(aq,ac,M);return ak;};function createGiftItemTr(rp){var ak=document.createElement("tr");var k=document.createElement("td");ak.appendChild(
k);k.style.padding="5px 0px 5px 0px";k.style.borderBottom="2px solid #e5ffb2";var aF=document.createElement("table");k.appendChild(aF);aF.style.cellSpacing="0px";aF.style.borderCollapse="collapse";
var bT=document.createElement("tbody");aF.appendChild(bT);var ac=document.createElement("tr");bT.appendChild(ac);ac.appendChild(createRankTd(aq.getRank()+1));ac.appendChild(createPictureTd(aq));
ac.appendChild(createDescriptionTd(aq.getName()));ac.appendChild(createCostTd(aq));ac.appendChild(createUsesLeftTd(aq,M));createQuantityAndBuyTd(aq,ac,M);return ak;}};function createRankTd(cj){var k=
document.createElement("td");k.style.width="45px";k.style.textAlign="center";k.innerHTML="<span style='color:#b6e657; font-size:40px; font-weight:bold;'>"+cj+"</span>";return k;};
function createPictureTd(L){var k=document.createElement("td");k.style.width="120px";k.style.textAlign="center";var gD=document.createElement("div");gD.className="tools";var aa=L.getRank();
gD.style.width=TOOLOffsets[aa+1]-TOOLOffsets[aa];gD.style.backgroundPosition=(-TOOLOffsets[aa])+"px 0px";k.appendChild(gD);return k;};function createPictureQuantityUseTd(L,qH){var k=
document.createElement("td");k.style.width="75px";k.style.height="24px";k.style.textAlign="center";k.style.position="relative";var dW=document.createElement("div");dW.style.width=75;dW.style.fontSize=
"18px";dW.style.fontWeight="bold";dW.style.color="#b6e657";dW.style.textAlign="center";dW.innerHTML=qH;k.appendChild(dW);return k;};function createDescriptionTd(dS){var k=document.createElement("td");
k.style.textAlign="left";k.style.width="80px";var C=document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";C.style.cursor="pointer";C.style.fontSize=
"15px";C.style.fontWeight="bold";C.style.color="#336600";C.innerHTML=dS;return k;};function createCostTd(aq){var k=document.createElement("td");k.style.textAlign="center";k.style.width="180px";var C=
document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";C.style.cursor="pointer";C.style.fontSize="15px";C.style.fontWeight="bold";C.style.color="#0e1f5b";
var kl=aq.getUses()==1?"":"s";C.innerHTML='<font color="green" size="2"> $'+aq.getCost()+'<br>for '+aq.getUses()+' use'+kl+'</font>';return k;};function createUsesLeftTd(aq,M){var k=
document.createElement("td");k.style.textAlign="center";k.style.width="180px";var C=document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";C.style.cursor=
"pointer";C.style.fontSize="15px";C.style.fontWeight="bold";C.style.color="#CC6600";if(!isValid(GP.idCount[aq.getRank()])){updateUserData();}C.innerHTML='<font color="#CC6600" size="2"> Uses left: '+
GP.idCount[aq.getRank()]+'</font>';C.id="storeUsesLeft"+aq.getRank();return k;};function createQuantityAndBuyTd(aq,D,M){var k=document.createElement("td");k.style.textAlign="center";k.style.width=
"60px";var iJ=document.createElement("td");D.appendChild(iJ);iJ.style.textAlign="center";iJ.appendChild(greenButton("Buy!",function(){var v={};v['user_id']=MAIN_DATA.getViewer().getUserId();
v['tool_id']=aq.getRank();v['num']=1;if(aq.getCost()>M.getCash()){modalPopup("Sorry. You do not have enough greenbucks. Try helping out with another garden using your existing tools!",{Ok:null});
return;}makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/buytool",function(){updateUserData();},v);modalPopup("Thanks for buying!",{Ok:null});}));};function PatchActivitiesDiv(D,M){var g=D;
this.createDiv=createDiv;var ae;var U=M;var dT=U.getPatchHandledEvents();if(g!=undefined&&g!=null){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;var cB=document.createElement("div");
cB.style.width="250px";cB.style.position="absolute";cB.style.left="0px";cB.style.top="100px";g.appendChild(cB);var ar=document.createElement("img");ar.src=U.getThumbnailUrl();cB.appendChild(ar);
var ma=document.createElement("div");var oN=U.getShortName();ma.innerHTML="<br/><span style='margin: 0px 0px 0px 0px; color:#CC6600; font-size:13px; font-weight:bold;'> Welcome to <br />"+oN+
"'s <br /> garden! </span><br/>";cB.appendChild(ma);var mQ=document.createElement("div");cB.appendChild(mQ);mQ.innerHTML=
"<br/><span style='margin: 0px 0px 0px 0px; color:green; font-size:13px; font-weight:bold;'> Total Activities on the Garden: "+U.getNumHandledEvents()+"</span><br/>";if(false&&isValid(U.getLatestEdit(
))&&isValid(U.getLatestEdit().getEditedByDisplayName())&&U.getLatestEdit().getEditedByDisplayName().length>0){var l_latestEditDiv=document.createElement("div");cB.appendChild(l_latestEditDiv);
l_latestEditDiv.innerHTML="<br/><span style='margin: 0px 0px 0px 0px; color:black; font-size:13px; font-weight:bold;'> Patch last rearranged by: "+U.getLatestEdit().getEditedByDisplayName()+
"</span><br/>";}var jJ=document.createElement("div");cB.appendChild(jJ);jJ.innerHTML=
"<br/><span style='margin: 0px 0px 0px 0px; color:#CC6600; font-size:13px; font-weight:bold;'> Recent Activities on the Garden: </span><br/>";var fh=document.createElement("table");jJ.appendChild(fh);
fh.style.marginLeft="auto";fh.style.marginRight="auto";fh.style.cellSpacing="0px";fh.style.borderCollapse="collapse";var kn=document.createElement("tbody");fh.appendChild(kn);var T=0;for(T=0;dT&&T<
dT.length;T++){kn.appendChild(createItemTr(dT[T],T));}if(T==0){createInitialActivities(kn);}};function createInitialActivities(hZ){var ak=document.createElement("tr");var k=document.createElement(
"td");k.style.fontWeight="bold";if(isValid(MAIN_DATA.getDetailedUser())&&MAIN_DATA.getDetailedUser().getHasAppInstalled()=='true'){k.innerHTML=
"<table><tr><th><span style='color:#0A5729; font-size:20px; font-weight:bold;'>1</span></th><td>You started a garden!</td></tr><tr><th><span style='color:#0A5729; font-size:20px; font-weight:bold;'>2</span></th><td>Kwame sent you a rose.</td></tr></table><br>TIPS:<br>Sometimes your garden will need care. You can buy supplies to help.<br>&nbsp;<br>";
}else{k.innerHTML=
"<table><tr><th><span style='color:#0A5729; font-size:20px; font-weight:bold;'>1</span></th><td>You started a garden!</td></tr></table><br>TIPS:<br>Sometimes your garden will need care. You can buy supplies to help.<br>&nbsp;<br>";
}"Work with your friends to grow the <span style='color: #008d04;'>greenest</span> gardens!";ak.appendChild(k);hZ.appendChild(ak);};function createItemTr(cY,cj){var ak=document.createElement("tr");
var k=document.createElement("td");ak.appendChild(k);k.style.padding="5px 0px 5px 0px";k.style.borderBottom="2px solid #e5ffb2";var aF=document.createElement("table");k.appendChild(aF);
aF.style.cellSpacing="0px";aF.style.borderCollapse="collapse";var bT=document.createElement("tbody");aF.appendChild(bT);var ac=document.createElement("tr");bT.appendChild(ac);ac.appendChild(
createActivityRankTd(cj));ac.appendChild(createActivityPictureTd(cY));ac.appendChild(createActivityDescriptionTd(cY));addEvent(ac,"click",function(){alert(cY.getHandledBy());GP.DETAIL_USER_ID=
cY.getHandledBy();GP.DETAIL_THUMBNAIL_URL=undefined;GP.DETAIL_DISPLAY_NAME=cY.getDisplayName();navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);});ac.style.cursor="pointer";
return ak;}};function createActivityRankTd(cj){var k=document.createElement("td");k.style.width="40px";k.style.textAlign="center";k.innerHTML=
"<span style='color:#0A5729; font-size:20px; font-weight:bold;'>"+(cj+1)+"</span>";return k;};function createActivityPictureTd(cY){var k=document.createElement("td");k.style.width="45px";
k.style.textAlign="center";outputDebug("Thumbnail url: "+cY.getThumbnailUrl());var gD=new ImageDiv(k,cY.getThumbnailUrl(),40,40);return k;};function createActivityDescriptionTd(cY){var k=
document.createElement("td");k.style.textAlign="center";var C=document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";C.style.cursor="pointer";
C.style.fontSize="12px";C.style.fontWeight="bold";C.style.color="#0e1f5b";C.innerHTML=EVENTS[cY.getEventId()].getEventHandledDesc();return k;};function saveSend(ll,fP,jS,gk,qU){var params={};if(!
isValid(ll)){outputAlert("Please select a plant to send!");outputDebug("bad plantId");return;}else{params.plant_id=ll;}if(!isValid(jS)||jS.length==0){outputAlert("Please select a friend!");
outputDebug("bad toUserIds");return;}params.to_user_ids=jS.join(",");params.from_user_id=fP;if(gk!=undefined&&gk!=null){params.display_name=customEncoding(gk);}makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/send",qU,params);}var MAIN_DATA=undefined;var APP_URL="http://www.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=360082188";var APP_CANVAS_URL=
"http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104761&";var IMAGE_SOURCE_UI_URL="http://cdn0.mobwarsapp.com/prod_green/images/ui/";var CUR_NEWSFEED=undefined;
var POST_AS_STRING=false;var IE=(navigator.userAgent.indexOf("MSIE")>=0);var IE6=IE&&(navigator.userAgent.indexOf("MSIE 6")>=0||navigator.userAgent.indexOf("MSIE 5")>=0);var IE6_CLASS=IE6?"GIF":"";
var GP={};GP.VIEWER_STATUS=undefined;GP.MAIN_TABS=undefined;GP.DETAIL_USER_ID=undefined;GP.DETAIL_THUMBNAIL_URL=undefined;GP.DETAIL_DISPLAY_NAME=undefined;GP.RAINFOREST_SAVED_YESTERDAY=undefined;
GP.PLANT_CHOICES=undefined;GP.INITIAL_TAB=undefined;GP.TOMS_ID=6221;GP.NETWORK_MYSPACE=1;GP.NETWORK_HI5=2;GP.network_current=GP.NETWORK_MYSPACE;GP.RAINFOREST_PER_SEND=0.1;GP.MOVE_THRESHOLD=2;
GP.APP_NOT_INSTALLED=0;GP.APP_INSTALLED=1;GP.APP_JUST_INSTALLED=2;GP.app_install_state=GP.APP_INSTALLED;GP.BOARD_REPAINTING_COST=10;GP.DEFAULT_BOARD_MESSAGE="Welcome to`my garden!";
GP.VIEWER_FRIEND_CACHE=undefined;GP.APP_LOAD_TIME=(new Date()).getTime();GP.GIFTS=[];GP.ORDERED_GIFTS=[];GP.CURRENCY_TYPE={};GP.CURRENCY_TYPE.GREENBUCKS=0;GP.CURRENCY_TYPE.ACORNS=1;GP.NUM_MAIN_TABS=6;
GP.TAB_ORDER={};GP.TAB_ORDER.DETAILED_USER=5;GP.REFRESH_AD=true;function GP_getPlantChoices(){if(!isValid(GP.PLANT_CHOICES)){GP.PLANT_CHOICES=new PlantChoices();}return GP.PLANT_CHOICES;};
function getCurrentMonthName(){var pu=(new Date()).getMonth();var pv=["January","February","March","April","May","June","July","August","September","October","November","December"];return pv[pu];};
function GP_getShowUserDetailsLink(ao){return APP_CANVAS_URL+"appParams=%7B%22showDetailedUserId%22%3A%22"+ao+"%22%7D";};GP.idCount={};function GP_offerPalNewWindow(){return APP_CANVAS_URL+
"appParams=%7B%22offer_pal%22%3A%22true%22%7D";};function stripMyspacePrefix(ao){if(isValid(ao)&&isValid(ao.split(":")[1])){return ao.split(":")[1];}return ao;};function StoreItem(cj,dS,fJ,ox,qy){
var on=cj;var bt=dS;var dM=fJ;var qK=ox;var nS=qy;this.getCost=getCost;this.getUses=getUses;this.getRank=getRank;this.getName=getName;this.getImageUrl=getImageUrl;function getCost(){return qK;};
function getUses(){return nS;};function getRank(){return on;};function getName(){return bt;};function getImageUrl(){return dM;}};var TOOLS=new Array();TOOLS.push(new StoreItem(0,"Carrots",
'http://healthinmotion.files.wordpress.com/2007/07/big_carrots.jpg',5,1));TOOLS.push(new StoreItem(1,"Gloves",
'http://www.blueworldgardener.co.uk/store/images/3A021560%20561extragripcotglovesoscom_tn.jpg',10,5));TOOLS.push(new StoreItem(2,"Watering<br>Can",
'http://tbn0.google.com/images?q=tbn:VDPPsP5dEAB03M:http://images.asia.ru/img/alibaba/photo/51643579/Watering_Can.jpg',20,5));TOOLS.push(new StoreItem(3,"Rake",
'http://www.implementations.co.uk/shop_images/perseus_rake.jpg',15,5));TOOLS.push(new StoreItem(4,"Bone",'http://cafesoap.com/myos_images/molds/DogBone297.jpg',10,1));var TOOLOffsets=[0,79,148,240,
321,400];var TOOLBuyOffsets=[40,120,200,280,360];function EventItem(aC,dS,fJ,nT){var pY=aC;var bt=dS;var dM=fJ;var qi=nT;this.getId=getId;this.getName=getName;this.getImageUrl=getImageUrl;
this.getEventHandledDesc=getEventHandledDesc;function getId(){return pY;};function getName(){return bt;};function getImageUrl(){return dM;};function getEventHandledDesc(){return qi;}};var EVENTS={};
EVENTS[100]=new EventItem(100,"Bunny","http://www.dgsgardening.btinternet.co.uk/rabbit1.jpg","fed the bunny");EVENTS[101]=new EventItem(101,"Weeds",
"http://img2.timeinc.net/toh/i/g/0907_rakes/intro-rake.jpg","removed the weeds");EVENTS[102]=new EventItem(102,"Dried Plants","http://web.cs.wpi.edu/~kfisler/Travels/Australia/desert-plants.JPG",
"watered the plants");EVENTS[103]=new EventItem(103,"Leaves","http://azweedwarriors.com/images/Tumbleweed%20and%20Weed%20Twister.JPG","raked the leaves");EVENTS[104]=new EventItem(104,"Dog",
"http://orlandonest.files.wordpress.com/2007/09/dog.jpg","kept the puppy busy");function updateUserData(){var v={};v['user_id']=MAIN_DATA.getViewer().getUserId();makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/getusertools",function(cp){var ad=getGadgetResponseData(cp);var ij=ad.getElementsByTagName("tool");outputDebug("Size: "+ij.length);outputDebug("Tool counts:");for(
var aS=0;aS<TOOLS.length;aS++){GP.idCount[aS]=0;}for(var aS=0;aS<ij.length;aS++){var iQ=getXMLNodeValue(ij[aS],"toolId");var oT=getXMLNodeValue(ij[aS],"toolCount");GP.idCount[iQ]=oT;}for(var aS=0;aS<
TOOLS.length;aS++){if(isValid(id("garden_tool_count"+aS+"_main"))){id("garden_tool_count"+aS+"_main").innerHTML=GP.idCount[aS];}if(isValid(id("garden_tool_count"+aS+"_other"))){id("garden_tool_count"+
aS+"_other").innerHTML=GP.idCount[aS];}}var jP=getXMLFirstNode(ad,"cash").firstChild.nodeValue;var l_acorns=getXMLFirstNode(ad,"acorns").firstChild.nodeValue;MAIN_DATA.getViewer().setCash(jP);
MAIN_DATA.getViewer().setAcorns(l_acorns);if(isValid(id("status_cash"))){id("status_cash").innerHTML="You have <b>$"+MAIN_DATA.getViewer().getCash()+
"</b> greenbucks <span style=\"color:red;font-weight: bold\"> (buy!) </span>";id("status_acorns").innerHTML="and <b>"+MAIN_DATA.getViewer().getAcorns()+
"</b> acorns <span style=\"color:red;font-weight: bold\"> (buy!) </span>";}if(isValid(id("store_cash"))){id("store_cash").innerHTML=
"<br/><span style='margin: 0px 250px; color:#CC6600; font-size:16px; font-weight:bold;'> Your current balance is: &nbsp;$"+jP+" &nbsp;greenbucks</span><br/>"+
"<br/><span style='margin: 0px 100px; color:#336600; font-size:16px; font-weight:bold;'> The Green Store sells gardening tools that you can use to keep your gardens healthy!</span><br/>";}var mt=
getXMLFirstNode(ad,"rainforest_saved").firstChild.nodeValue;if(isValid(id("status_rainforest"))){id("status_rainforest").innerHTML="You've saved <b>"+mt+"</b> sq ft of rainforest, equivalent to <b>"+
Math.round(mt*1.4*100)/100+"</b> lbs of carbon";}for(var A=0;A<TOOLS.length;A++){if(GP.idCount[A]>0){if(isValid(id("toolsBuyUse_main"+A))){id("toolsBuyUse_main"+A).innerHTML="Use!";}if(isValid(id(
"toolsBuyUse_other"+A))){id("toolsBuyUse_other"+A).innerHTML="Use!";}}else{if(isValid(id("toolsBuyUse_main"+A))){id("toolsBuyUse_main"+A).innerHTML="Buy!";}if(isValid(id("toolsBuyUse_other"+A))){id(
"toolsBuyUse_other"+A).innerHTML="Buy!";}}if(isValid(id("storeUsesLeft"+A))){id("storeUsesLeft"+A).innerHTML='<font color="green" size="2"> Uses left: '+GP.idCount[A]+'</font>';}}},v);updateBoardText(
);};function addPlantToMainUser(cp){outputDebug("call to addPlantToMainUser");var ad=getGadgetResponseData(cp);var mC=getXMLFirstNode(ad,"newly_bought_plant");if(isValid(mC)){var pB=getXMLFirstNode(
mC,"plant");var dy=new ReceivedPlant(pB);MAIN_DATA.getViewer().addReceivedPlant(dy);outputDebug("About to call addPlantToPatch");if(isValid(MYPATCH)){MYPATCH.addPlantToPatch(dy);}}};
function updateMainPatch(){updateUserData();outputDebug("Finished updating user data");if(isValid(MYPATCH)){MYPATCH.redrawPatch();}};function getUserBoardText(M){var gM=M.getBoardMessage();var aD=
undefined;if(isValid(gM)){aD=gM.split('`');}if(!isValid(aD)){aD=new Array();}if(!isValid(aD[0])){aD[0]='';}if(!isValid(aD[1])){aD[1]='';}return aD;};function updateBoardText(){var aD=getUserBoardText(
MAIN_DATA.getViewer());if(isValid(id("board_text_1"))){id("board_text_1").innerHTML='<FONT face="matura mt script capitals" color="brown" size="+1">'+aD[0]+'</br>'+aD[1]+'</FONT>';}if(isValid(id(
"board_text_0"))&&isValid(GP.DETAIL_USER_ID)){aD=getUserBoardText(MAIN_DATA.getDetailedUser());id("board_text_0").innerHTML='<FONT face="matura mt script capitals" color="brown" size="+1">'+aD[0]+
'</br>'+aD[1]+'</FONT>';}};function getSellMessage(as){var ml=GP.GIFTS[as];if(ml.getSellingCost()>0){if(ml.getCurrencyType()==Gift.CURRENCY_TYPE.GREENBUCKS){return "You can sell this "+ml.getName()+
" for $"+ml.getSellingCost()+". If you do, it will disappear from your patch. Do you want to sell?";}else{return "You can sell this "+ml.getName()+" for "+ml.getSellingCost()+
" Acorns. If you do, it will disappear from your patch. Do you want to sell?";}}else{return "You can remove this "+ml.getName()+
" from your garden. Note that you will not receive additional cash or Acorns for removing this item.";}}function GreenStatusDiv(D){var g=D;var B=undefined;if(g!=undefined){createDiv(g);}
function createDiv(_a_parentDiv){g=_a_parentDiv;var mR="<div id='topbar'>"+"<img src='http://cdn0.mobwarsapp.com/prod_green/images/ui/logofull.gif'>";if(isValid(GP.RAINFOREST_SAVED_YESTERDAY)){mR+=
"<span id='totalsaved'>  We saved "+GP.RAINFOREST_SAVED_YESTERDAY+" sq ft</span>"+"<span id='totalsaved2'>  of rainforest yesterday! </span>";}g.innerHTML=mR+"</div>";g.id=
"rainforest_saved_yesterday";B=document.createElement("div");g.appendChild(B);B.style.marginBottom="5px";B.style.marginTop="6px";B.style.marginLeft="55px";B.style.height="24px";
B.style.backgroundColor="#B6E657";B.style.borderStyle="solid";B.style.borderWidth="1px";B.style.borderColor="#8EB344";var et=document.createElement("table");B.appendChild(et);et.style.borderCollapse=
"collapse";et.style.width="880px";et.style.cellSpacing="0px";et.style.cellPadding="0px";var mp=document.createElement("tbody");et.appendChild(mp);var iP=document.createElement("tr");mp.appendChild(iP)
;var fF=document.createElement("td");iP.appendChild(fF);fF.style.paddingLeft="10px";fF.style.fontSize="12px";fF.innerHTML="You've saved <b>"+MAIN_DATA.getViewer().getSavedRainForestAmount()+
"</b> sq ft of rainforest, equivalent to <b>"+Math.round(MAIN_DATA.getViewer().getSavedRainForestAmount()*1.4*100)/100+"</b> lbs of carbon";fF.id="status_rainforest";var dX=document.createElement(
"td");iP.appendChild(dX);dX.style.fontSize="12px";dX.style.textAlign="right";dX.innerHTML="You have <b>$"+MAIN_DATA.getViewer().getCash()+
"</b> greenbucks <span style=\"color:red;font-weight: bold\"> (buy!) </span>";dX.id="status_cash";dX.style.cursor="pointer";var l_acornsTd=document.createElement("td");iP.appendChild(l_acornsTd);
l_acornsTd.style.fontSize="12px";l_acornsTd.style.textAlign="right";l_acornsTd.innerHTML="and <b>"+MAIN_DATA.getViewer().getAcorns()+
"</b> acorns <span style=\"color:red;font-weight: bold\"> (buy!) </span>";l_acornsTd.id="status_acorns";l_acornsTd.style.cursor="pointer";}};function updateTotalSaved(){var elapsedTime=(new Date())
.getTime()-GP.APP_LOAD_TIME;var totalSaved=1614395+Math.floor(elapsedTime*.003547);document.getElementById("totalsaved").innerHTML=addCommas(totalSaved);};function addCommas(lL){lL+='';var bN=
lL.split('.');var ia=bN[0];var pj=bN.length>1?'.'+bN[1]:'';var mD=/(\d+)(\d{3})/;while(mD.test(ia)){ia=ia.replace(mD,'$1'+','+'$2');}return ia+pj;};function Plant(as,nL,nv,ns,nB){var ed=as;var rd=nL;
var rf=nv;var ok=ns;var nV=nB;this.getPlantId=getPlantId;this.getPlantImage=getPlantImage;this.getPlantName=getPlantName;this.getPlantCost=getPlantCost;function getPlantId(){return ed;};
function getPlantImage(){var ar=document.createElement("div");ar.className="flora"+IE6_CLASS;ar.style.backgroundPosition=(-ed*80)+"px";ar.style.margin="auto";ar.style.cursor="pointer";return ar;};
function getPlantName(){return ok;};function getPlantCost(){return nV;}};function PlantChoices(){var aE=new Array();var lJ=new Object();this.getPlantChoices=getPlantChoices;this.getPlantById=
getPlantById;initializeArray();function initializeArray(){if(aE.length>0){return;}aE.push(new Plant(0,IMAGE_SOURCE_URL+"rose.gif",IMAGE_SOURCE_URL+"rose_small.gif","Rose",0));aE.push(new Plant(1,
IMAGE_SOURCE_URL+"daffodil.gif",IMAGE_SOURCE_URL+"daffodil_small.gif","Daffodil",0));aE.push(new Plant(2,IMAGE_SOURCE_URL+"crocus.gif",IMAGE_SOURCE_URL+"crocus_small.gif","Crocus",0));aE.push(
new Plant(3,IMAGE_SOURCE_URL+"lily.gif",IMAGE_SOURCE_URL+"lily_small.gif","Lily",0));aE.push(new Plant(4,IMAGE_SOURCE_URL+"clover.gif",IMAGE_SOURCE_URL+"clover_small.gif","Clover",0));aE.push(
new Plant(5,IMAGE_SOURCE_URL+"tulip.gif",IMAGE_SOURCE_URL+"tulip_small.gif","Tulip",0));aE.push(new Plant(6,IMAGE_SOURCE_URL+"hibiscus.gif",IMAGE_SOURCE_URL+"hibiscus_small.gif"," Hibiscus",5));
aE.push(new Plant(7,IMAGE_SOURCE_URL+"daisy.gif",IMAGE_SOURCE_URL+"daisy_small.gif","Daisy",10));aE.push(new Plant(8,IMAGE_SOURCE_URL+"calla.gif",IMAGE_SOURCE_URL+"calla_small.gif","Calla",25));
aE.push(new Plant(9,"","","Cat",0));aE.push(new Plant(10,"","","Bird",0));aE.push(new Plant(11,"","","Fox",0));aE.push(new Plant(12,"","","Bee",0));aE.push(new Plant(13,"","","Butterfly",0));aE.push(
new Plant(14,"","","Beaver",0));for(var seedIndex=0;seedIndex<aE.length;seedIndex++){var mE=aE[seedIndex];lJ[mE.getPlantId()]=mE;}};function getPlantChoices(){return aE;};function getPlantById(qd){
return lJ[qd];}};function getSrcFromReceivedPlant(K){var dK=K.getPlantId();var ml=GP.GIFTS[dK];if(isFauna(dK)){return ml.getSpriteStyle();}if(isFlora(dK)){var oR=(new Date()).getTime()-
K.getSentOnDate().getTime();var kV=Math.round(oR/(1000*60*60*24));if(kV>2*ml.getGrowingTime()){return "flora"+IE6_CLASS;}if(kV>ml.getGrowingTime()){return "flora_juvenile"+IE6_CLASS;}
return "flora_seedling"+IE6_CLASS;}if(isDecor(dK)){if(isBoard(dK)){return "board";}return "decor"+IE6_CLASS;}};function isFauna(as){if(as<0||as>=GP.GIFTS.length){return false;}return(
GP.GIFTS[as].getGiftType()=="fauna");};function isFlora(as){if(as<0||as>=GP.GIFTS.length){return false;}return(GP.GIFTS[as].getGiftType()=="flora");};function isBoard(as){if(as<0||as>=GP.GIFTS.length)
{return false;}return(GP.GIFTS[as].getGiftType()=="board");};function isDecor(as){return(GP.GIFTS[as].getGiftType()=="decor"||GP.GIFTS[as].getGiftType()=="board");};function getPlantImageFromGift(fI,
a_isSmall){if(isBoard(fI.getId())){var ar=document.createElement("img");ar.src="http://cdn0.mobwarsapp.com/prod_green/images/ui/board.gif";return ar;}if(fI.isSprite()){var bE=document.createElement(
"div");bE.className=fI.getSpriteStyle();bE.style.backgroundPosition=(-fI.getSpriteOffset())+"px";bE.style.marginLeft="auto";bE.style.marginRight="auto";return bE;}else{var ar=document.createElement(
"img");if(isValid(a_isSmall)&&a_isSmall&&isValid(fI.getSmallImageFileName())){ar.src="http://cdn0.mobwarsapp.com/prod_green/images/ui/"+fI.getSmallImageFileName();}else{ar.src=
"http://cdn0.mobwarsapp.com/prod_green/images/ui/"+fI.getNormalImageFileName();}return ar;}};function getBoardImage(hU){var aZ=document.createElement("div");aZ.style.background=
"url(http://cdn0.mobwarsapp.com/prod_green/images/ui/board.gif) no-repeat 10px";aZ.style.height=110;aZ.style.width=145;var dN=document.createElement("div");var aD;if(hU){aD=getUserBoardText(
MAIN_DATA.getViewer());}else{aD=getUserBoardText(MAIN_DATA.getDetailedUser());}dN.innerHTML='<FONT face="matura mt script capitals" color="brown" size="+1">'+aD[0]+'</br>'+aD[1]+'</FONT>';if(hU){
dN.id="board_text_1";}else{dN.id="board_text_0";}dN.style.position="relative";dN.style.top="23px";dN.style.left="5px";aZ.appendChild(dN);return aZ;};function getPlantImageFromReceivedPlant(bw,hU,
a_isSmall){if(isBoard(bw.getPlantId())){return getBoardImage(hU)}var ml=GP.GIFTS[bw.getPlantId()];if(ml.isSprite()){var ar=document.createElement("div");ar.className=getSrcFromReceivedPlant(bw);
ar.style.backgroundPosition=(-ml.getSpriteOffset())+"px";ar.style.margin="auto";ar.style.cursor="pointer";return ar;}var aZ=document.createElement("div");if(isValid(a_isSmall)&&a_isSmall&&isValid(
ml.getSmallImageFileName())){aZ.style.background="url(http://cdn0.mobwarsapp.com/prod_green/images/ui/"+ml.getSmallImageFileName()+") no-repeat 10px";}else{aZ.style.background=
"url(http://cdn0.mobwarsapp.com/prod_green/images/ui/"+ml.getNormalImageFileName()+") no-repeat 10px";}aZ.style.height=ml.getNormalImageFileHeight();aZ.style.width=ml.getNormalImageFileWidth();
return aZ;};function SeedSelectorDiv(D,lU,lG){var g=D;var B=null;var cu=null;var eY=null;var iT=null;var gU=false;if(isValid(lG)){gU=lG;}this.createDiv=createDiv;if(g!=undefined){createDiv(g);}
function createDiv(_parentDiv){g=_parentDiv;B=document.createElement("div");g.appendChild(B);var bW=document.createElement("div");bW.style.textAlign="center";bW.style.width=800;B.appendChild(bW);
var lX="";if(MAIN_DATA.getSignin()&&MAIN_DATA.getSignin()>0){lX="<span style='font-size: 20px;'>You received your daily login bonus of $"+MAIN_DATA.getSignin()+"!</span>";}if(isValid(lU)){
bW.innerHTML=lU;}else{bW.innerHTML=lX+
"<br/><div style='background: #E5FFB2; padding: 10px 30px; font-size: 11px; text-align: left;'><span style='font-size: 14px; font-weight: bold;'>Attention Green Gardeners:</span><br/>"+
"The Playdom team would like to thank you for all of the fun and adventure.<br/>"+"With your help we were able to save over 9 million sq. ft. of rainforest from July 2008 - December 2009.<br/>"+
"We regret to inform you that as of February 14, 2010, Green Garden will no longer be available for play.<br/>"+"As of January 20, greenbucks and acorns are no longer available for purchase.<br/>"+
"If you liked this game, check out our other games "+"<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283'>Mobsters</a> or "+
"<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=113384'>Sorority Life</a>!!</div>"+
"<div style='margin: 0px 0px 0px 60px; color:#CC6600; font-size:16px; font-weight:bold;'>Select a gift for your friends' Green Garden.<br>You can send one gift to each of your friends per day."+
"<br>For every 10 gifts you send you will save 1 sq. ft. of rainforest.<br>"+"A maximum of 40 gifts per day contribute to your rainforest savings!!</div><br/>";}cu=document.createElement("div");
B.appendChild(cu);cu.style.width="800px";cu.style.height="1100px";cu.style.overflow="AUTO";cu.style.textAlign="center";cu.style.marginRight="auto";if(!gU){cu.style.marginLeft="60px";}
createPlantChooser();};function createPlantChooser(){cu.innerHTML="";eY=document.createElement("form");cu.appendChild(eY);eY.style.textAlign="center";eY.style.marginLeft="auto";eY.style.marginRight=
"auto";var eP=document.createElement("table");eY.appendChild(eP);eP.style.borderSpacing="2px";eP.style.border="none";eP.style.marginLeft="auto";eP.style.marginRight="auto";var iV=
document.createElement("tbody");eP.appendChild(iV);var qX=GP_getPlantChoices().getPlantChoices();iT=new Array();var fb=null;var fp=0;for(var bQ=0;bQ<GP.ORDERED_GIFTS.length;bQ++){var ml=
GP.ORDERED_GIFTS[bQ];if((gU&&ml.isBuyable())||(!gU&&ml.isSendable())){if(fp%3==0){fb=document.createElement("tr");iV.appendChild(fb);}outputDebug("Gift index: "+bQ);var by=createPlantChooserTd(ml,fp);
iT.push(by);fb.appendChild(by);fp++;}}};function createPlantChooserTd(fI,qj){var by=document.createElement("td");by.className="browseSeed";outputDebug("seed src: "+fI.src);by.appendChild(
getPlantImageFromGift(fI,true));if(fI.getRainforestCost()/10.0<=MAIN_DATA.getViewer().getSavedRainForestAmount()){var C=document.createElement("div");by.appendChild(C);C.style.textAlign="center";
var km='';if(isFlora(fI.getId())&&fI.getGrowingTime()>0){var km="<br /> <font color='green'> Grows over "+2*fI.getGrowingTime()+" days </font>";}var l_refundMsg='';if(fI.getSellingCost()<1){
l_refundMsg='<br /> <font color="black"> No resale value </font>';}if(gU){var l_cost="<br /> Cost: $"+fI.getBuyingCost();if(fI.getCurrencyType()==Gift.CURRENCY_TYPE.ACORNS){l_cost="<br /> Cost: "+
fI.getBuyingCost()+" Acorn(s)";}by.style.cursor="default";C.innerHTML=fI.getName()+km+l_cost+l_refundMsg;var iX=700+qj*50;by.appendChild(greenButton("Buy!",function(){if((fI.getCurrencyType()==
Gift.CURRENCY_TYPE.GREENBUCKS&&MAIN_DATA.getViewer().getCash()<fI.getBuyingCost())||(fI.getCurrencyType()==Gift.CURRENCY_TYPE.ACORNS&&MAIN_DATA.getViewer().getAcorns()<fI.getBuyingCost())){modalPopup(
"Sorry, you do not have enough greenbucks or Acorns.",{Ok:null},iX);return;}if(isBoard(fI.getId())&&MAIN_DATA.getViewer().hasBoard()){modalPopup("Sorry. You can only have one garden board!",{Ok:null},
iX);return;}if(fI.getCurrencyType()==Gift.CURRENCY_TYPE.ACORNS){modalPopup("Purchasing "+fI.getName()+" will cost "+fI.getBuyingCost()+" Acorn(s).",{'Confirm Purchase!':function(){buyGift(fI,iX);},
'Do not Purchase':null},iX);}else{buyGift(fI,iX);}}));}else{var l_cost='';if(fI.isSendable()&&fI.getSendingCost()>0){if(fI.getCurrencyType()==Gift.CURRENCY_TYPE.GREENBUCKS){l_cost=
"<br /> <font color='green'> Cost (per recipient): $"+fI.getSendingCost()+" greenbucks</font>";}else if(fI.getCurrencyType()==Gift.CURRENCY_TYPE.ACORNS){l_cost=
"<br /> <font color='green'> Cost (per recipient): "+fI.getSendingCost()+" Acorn(s)</font>";}}C.innerHTML=fI.getName()+km+l_cost+l_refundMsg;addEventWithParameter(C,"click",confirmPickGift,fI);
addEventWithParameter(by,"click",confirmPickGift,fI);C.style.cursor="pointer";}}else{var jv=document.createElement("div");by.appendChild(jv);jv.style.textAlign="center";jv.innerHTML=
"<span style='font-weight: bold; color: #CC6600'>Send at least "+fI.getRainforestCost()+" plants to unlock the "+fI.getName()+"!</span>";}return by;};function confirmPickGift(fI){if(
fI.getCurrencyType()==Gift.CURRENCY_TYPE.ACORNS){modalPopup("Sending "+fI.getName()+" costs "+fI.getSendingCost()+" Acorn(s) per recipient.",{'Yes, I want to send!':function(){pickGift(fI);},
'Nevermind':null});}else{pickGift(fI);}};function pickGift(fI){GP.MAIN_TABS.switchToDynamicTab(function(gR){gR.innerHTML="";new PlantSenderDiv(gR,fI);});};function buyGift(fI,a_verticalPos){
modalPopup("You have purchased a "+fI.getName()+" for your garden! Look for it in the middle of your patch.",{Ok:null},a_verticalPos);var mV=new Array();mV.push(MAIN_DATA.getViewer().getUserId());
saveSend(fI.getId(),MAIN_DATA.getViewer().getUserId(),mV,null,function(cp){addPlantToMainUser(cp);updateUserData();});}};function PlantSenderDiv(D,fI){var g=D;var B=undefined;var fm=undefined;
var m_gift=fI;var cU=undefined;if(g!=undefined){createDiv(g);}function createDiv(_parentDiv){g=_parentDiv;B=document.createElement("div");g.appendChild(B);B.style.textAlign="center";fm=
document.createElement("div");B.appendChild(fm);fm.className="messageBox";fm.style.display="none";var mO=new SideBySideCells(B,true);var pS=mO.getLeftCell();var fy=mO.getRightCell();var ar=
getPlantImageFromGift(m_gift,true);pS.appendChild(ar);var C=document.createElement("div");fy.style.verticalAlign="middle";fy.style.textAlign="center";fy.style.paddingLeft="30px";fy.style.fontSize=
"20px";fy.innerHTML="Great! You picked a "+m_gift.getName()+".<br>"+"For every 10 gifts you send you will save 1 sq. ft. of rainforest.<br>"+
"A maximum of 40 gifts per day contribute to your rainforest savings! ";var hy=document.createElement("div");hy.style.margin="15px 0px 15px 0px";hy.style.textAlign="CENTER";B.appendChild(hy);
hy.appendChild(greenButton("Send "+m_gift.getName()+" to selected friends",sendSeed));cU=new ChooseFriendsDiv(B);var il=document.createElement("div");il.style.margin="15px 0px 15px 0px";
il.style.textAlign="CENTER";B.appendChild(il);il.appendChild(greenButton("Send "+m_gift.getName()+" to selected friends",sendSeed));};function shareToAllAndTopTen(){var gY="<a href='"+APP_URL+
"'><img src='"+getPlantImage(aM)+"'></a><br/><br/><a href='"+APP_URL+"'>I just gave you a "+aM.name+
" for your Green Garden. Help me and the planet by sending a plant back. Together we can fight Global Warming!</a>";saveSend(aM.id,MAIN_DATA.getViewer().getUserId(),cU.getAllFriendIds(),
MAIN_DATA.getViewer().getName());postToBulletinWOGoToPageTop(MAIN_DATA.getViewer(),"Help fight Global Warming!",gY,shareToTopTenWithoutSaveStick);};function shareToTopTenWithoutSaveStick(){var dA=
cU.getTopTenFriendIds();var cJ=cU.getSelectedFriends(dA);sendCommentToUser(cJ,0);};function sendInviteToUser(da,fu,lQ,eF,eQ){var I="I just gave you a "+m_gift.getName()+
" for your Green Garden. <a href='"+APP_CANVAS_URL+"'> Click here to help me and the planet by sending a plant back</a>.";outputDebug("Message link: "+I);sendInvitesOrMessagesToUsers(da,
"I just gave you a "+m_gift.getName(),I);};function sendCommentToUser(da,fu,lQ){var av=da[fu];var pF=function(bf){var gQ=fu+1;if(gQ<da.length){sendCommentToUser(da,gQ);}};var gY="<a href='"+APP_URL+
"'><img src='"+m_gift.getNormalImageFileName()+"'></a><br/><br/><a href='"+APP_URL+"'>I just gave you a "+m_gift.getName()+
" for your Green Garden. Help me and the planet by sending a plant back. Together we can fight Global Warming!</a>";sendCommentWOGoToPageTop(av,gY,pF);};function sendSeed(){var cJ=
cU.getSelectedFriends();var dA=new Array();for(var A=0;A<cJ.length;A++){dA.push(cJ[A].getUserId());}sendSeedToFriendIds(dA);};function sendSeedToFriendIds(hm){if(!isValid(hm)||hm.length==0){
modalPopup("You haven't selected any friends yet.",{Ok:null});return;}var cJ=GP.VIEWER_FRIEND_CACHE.getUsersById(hm);cU.unselectFriends();var gY="<a href='"+APP_URL+"'><img src='"+
m_gift.getNormalImageFileName()+"'></a><br/><br/><a href='"+APP_URL+"'>I just gave you a "+m_gift.getName()+
" for your Green Garden. Help me and the planet by sending a plant back. Together we can fight Global Warming!</a>";saveSend(m_gift.getId(),MAIN_DATA.getViewer().getUserId(),hm,MAIN_DATA.getViewer()
.getName(),sendFlowerCallback);};function decodeXMLEncodedStringNodeValue(bd){if(isValid(bd)&&isValid(bd.firstChild)&&isValid(bd.firstChild.nodeValue)){return decodeURIComponent(
bd.firstChild.nodeValue);}else{return undefined;}};function decodeXMLEncodedStringNodeList(ka){var kG=new Array();if(isValid(ka)){for(var jK=0;jK<ka.length;++jK){var hd=ka[jK];var kJ=
decodeXMLEncodedStringNodeValue(hd);if(isValid(kJ)){kG.push(kJ);}}return kG;}else{return undefined;}};function sendFlowerCallback(O){var ha=getGadgetResponseData(O);var I;try{var jF=
getXMLEncodedStringNodeValue(ha,"error");if(jF.indexOf("more than 40")> -1){modalPopup("Sorry, you've already sent 40 gifts today!",{Ok:null});return;}if(jF.indexOf("not enough cash")> -1){modalPopup(
"Sorry, you do not have enough greenbucks or Acorns to send this gift.",{'Ok':null});return;}}catch(e){};var mX=ha.getElementsByTagName("duplicateUserIds");var fN=ha.getElementsByTagName(
"successfulUserIds");var iD=getXMLEncodedStringNodeValue(ha,"rainforestSaved");if(isValid(fN)&&isValid(iD)){var fM=decodeXMLEncodedStringNodeList(fN);if(isValid(fM)&&fM.length<=0){modalPopup(
"You have already sent a gift today to all selected friends. Please select different friends or try again tomorrow!",{Ok:null});}else{outputDebug("Successful user Id: "+fM[0]);var cJ=
GP.VIEWER_FRIEND_CACHE.getUsersById(fM);outputDebug("Target user: "+cJ[0]);I="You have sent a "+m_gift.getName()+" to "+fN.length+" friend(s), saving "+iD+" sq ft of rainforest. Thank You!";if(
fM.length*GP.RAINFOREST_PER_SEND>iD){I+="<br /> Remember a maximum of 40 gifts per day contribute to your rainforest savings!";}if(isValid(mX)){var ig=decodeXMLEncodedStringNodeList(mX);if(isValid(ig)
&&ig.length>0){var mW=GP.VIEWER_FRIEND_CACHE.getUsersById(ig);I+="<br>Flowers were not sent to the following friends because you already sent them a flower in the past 24 hours: ";for(var ga=0;ga<
mW.length;++ga){var oJ=mW[ga];if(ga>0){I+=", ";}outputDebug("Duplicate id: "+ig[ga]);I+=oJ.getName();}I+=".";}}if(fN.length==1){modalPopup("You have sent a "+m_gift.getName()+" to your friend!<br>"+
"You can let your friends know with an invite/message",{"Let them know!":function(){sendInviteToUser(cJ,0);},"Never mind, don't tell them.":null});}else{modalPopup("Your gifts have been sent to "+
fN.length+" friends!<br>"+"Tell your friends about their gifts so they can care for it!",{"Let them know with invites.":function(){sendInviteToUser(cJ,0);},"Never mind, don't tell them.":function(){}}
);}}}else{modalPopup("Oops, there must be clouds above our solar cells - our server failed to respond!<br>Sorry!<br>Please try sending your gifts again later.",{Ok:null});}if(I){fm.style.display=
"block";fm.innerHTML=I;}updateUserData();}};function ChooseFriendsDiv(D){this.g=D;this.bb=new MultiSelectionModel().bind("select",this.onSelect.bind(this)).bind("unselect",this.onRemove.bind(this));
this.qF=new SingleSelectionModel().bind("select",this.onRemoveFromChosen.bind(this));if(this.g!=undefined){this.createDiv();}};ChooseFriendsDiv.prototype.createDiv=function(){outputDebug(
"ChooseFriendsDiv: createDiv");this.B=makeElementClass("div",this.g,"friendInviter");if(!isValid(GP.VIEWER_FRIEND_CACHE)){GP.VIEWER_FRIEND_CACHE=new ViewerFriendsCache();}this.refreshDiv();};
ChooseFriendsDiv.prototype.refreshDiv=function(aU){this.B.innerHTML="";this.bb.clear();this.nh=new SideBySideCells(this.B);this.lD=this.nh.getLeftCell();$(this.lD).addClass("picker");this.kX=
this.nh.getRightCell();$(this.kX).css("vertical-align","top");this.jh=makeElementClass("div",this.kX,"chosen");$(this.jh).addClass("chosen");this.qs=new ViewerFriendsCacheData(GP.VIEWER_FRIEND_CACHE,
1000);this.ld=new FriendChooserDiv(this.lD,this.qs,true,InviteUtil.lazyBucketFunc,this.bb,21);var nf=this.ld.getFilterDiv();var mu=makeElementClass("a",nf,"chooseLink",{marginLeft:"120px"});mu.href=
"javascript:void(0)";$(mu).html("Pick 10 Random Friends").click(this.selectRandom10.bind(this));var kS=makeElementClass("a",nf,"chooseLink",{marginLeft:"20px"});kS.href="javascript:void(0)";$(kS)
.html("Clear Selected").click(this.clearSelection.bind(this));this.lH=makeElementClass("div",this.jh,"header");$(this.lH).html("Selected Friends");this.lF=new ArrayData();this.nQ=new FriendListDiv(
this.jh,this.lF.paged(1000000),this.qF);this.nQ.setIconSize(32).setShowName(false).setShowPagination(false).setShowZoom(false).setResizeImage(true);};ChooseFriendsDiv.prototype.onSelect=function(aB){
this.updateSelectedDiv();};ChooseFriendsDiv.prototype.onRemove=function(aB){this.updateSelectedDiv();};ChooseFriendsDiv.prototype.onRemoveFromChosen=function(aB){this.bb.deselect(aB);
this.updateSelectedDiv();};ChooseFriendsDiv.prototype.updateSelectedDiv=function(){var gO=this.bb.getSelected();var ci=gO.length;var fX="Selected Friends:";if(ci>1){fX="Selected "+ci+" Friends";}
this.lH.innerHTML=fX;this.lF.setArray(gO);};ChooseFriendsDiv.prototype.clearSelection=function(){this.unselectFriends();};ChooseFriendsDiv.prototype.unselectFriends=function(){this.bb.clear();};
ChooseFriendsDiv.prototype.getSelectedFriends=function(){return this.bb.getSelected();};ChooseFriendsDiv.prototype.selectRandom10=function(){this.bb.clear();var T=this.ld.getArray(200);if(T.length<=
10){for(var i=0;i<T.length;i++){this.bb.select(T[i]);}return;}while(this.bb.getCount()<10){var i=Math.floor(Math.random()*T.length);var pD=T[i];this.bb.select(pD);}};function GardenPickerDiv(D){var g=
D;var B=undefined;var cU=undefined;if(g!=undefined){createDiv(g);}function createDiv(_parentDiv){g=_parentDiv;B=document.createElement("div");g.appendChild(B);B.style.textAlign="center";var dL=
document.createElement("div");B.appendChild(dL);dL.style.verticalAlign="middle";dL.style.paddingLeft="30px";dL.style.fontSize="20px";dL.marginTop="20px";dL.marginBottom="20px";dL.innerHTML=
"Click on a friend below and then the 'Go to garden' button to see their garden!";var mF=new SingleSelectionModel();B.appendChild(greenButton("Go to garden!",function(){var pn=mF.getSelectedItem();
navigateToFriendsGarden(pn.getUserId());}));if(!isValid(GP.VIEWER_FRIEND_CACHE)){GP.VIEWER_FRIEND_CACHE=new ViewerFriendsCache();}var ph=new ViewerFriendsCacheData(GP.VIEWER_FRIEND_CACHE,1000);cU=
new FriendChooserDiv(B,ph,true,undefined,mF,40);};function navigateToFriendsGarden(hK){GP.DETAIL_USER_ID=hK;var fY=GP.VIEWER_FRIEND_CACHE.getUserById(GP.DETAIL_USER_ID);GP.DETAIL_THUMBNAIL_URL=
fY.getThumbnailUrl();GP.DETAIL_DISPLAY_NAME=fY.getDisplayName();navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);};function navigateToGarden(){var dA=cU.getSelectedFriendIds();if(!
isValid(dA)||dA.length==0){modalPopup("You haven't selected any friends yet.",{Ok:null});return;}GP.DETAIL_USER_ID=dA[0];var fY=GP.VIEWER_FRIEND_CACHE.getUserById(GP.DETAIL_USER_ID);
GP.DETAIL_THUMBNAIL_URL=fY.getThumbnailUrl();GP.DETAIL_DISPLAY_NAME=fY.getDisplayName();navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);}}function CommentInformation(fP,dD,jC,oF,
nX,cc){var qv=fP;var nu=dD;var qD=jC;var qu=oF;var qr=nX;var ge=cc;this.getFromUserId=getFromUserId;this.getToUserId=getToUserId;this.getCommentText=getCommentText;this.getFromUserName=
getFromUserName;this.getFromProfileUrl=getFromProfileUrl;this.getUniqueId=getUniqueId;function getFromUserId(){return qv;};function getToUserId(){return nu;};function getCommentText(){return qD;};
function getFromUserName(){return qu;};function getFromProfileUrl(){return qr;};function getUniqueId(){return ge;}};function GreenCommentsDiv(D,M){var g=D;this.createDiv=createDiv;var ae;var U=M;
var ae=undefined;var cQ=document.createElement("div");var gS=new Array();if(g!=undefined&&g!=null){initializeDiv();}function initializeDiv(){gS=new Array();makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/comments?to_user_id="+M.getUserId()+"&action=get",onReceivingComments);};function onReceivingComments(cp){var ad=getGadgetResponseData(cp);var dI=
ad.getElementsByTagName("comment");for(var di=0;di<dI.length;di++){var pM=getXMLNodeValue(dI[di],"from_user_id");var oV=getXMLNodeValue(dI[di],"to_user_id");var oZ=getXMLEncodedStringNodeValue(dI[di],
"comment_text");var pN=getXMLEncodedStringNodeValue(dI[di],"from_user_name");var pL=getXMLNodeValue(dI[di],"from_user_thumbnail");var oP=getXMLNodeValue(dI[di],"id");gS.push(new CommentInformation(pM,
oV,oZ,pN,pL,oP));}createDiv(g);};function createDiv(_a_parentDiv){g=_a_parentDiv;g.appendChild(cQ);var kQ=new TextBoxDiv(g,"Type your comments here");kQ.setPosition("350px","830px");var hA=
new greenButton("Send Comment for $1!",function(){var eD=kQ.getText();if(eD.length>250){modalPopup("Sorry, comments can be at most 250 characters long",{Ok:null},1000);return;}if(eD.length==0||eD==
"Type your comments here"){modalPopup("Sorry I didn't get your comment",{Ok:null},1000);return;}if(MAIN_DATA.getViewer().getCash()<1){modalPopup("Sorry, you do not have enough greenbucks.",{Ok:null},
1000);return;}eD=customEncoding(eD);var v={};v.action="set";v.from_user_id=MAIN_DATA.getViewer().getUserId();v.to_user_id=M.getUserId();v.comment=eD;makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+
"/green/comments",function(){g.removeChild(cQ);g.removeChild(ae);initializeDiv();updateUserData();},v);});hA.style.position="absolute";hA.style.left="630px";hA.style.top="855px";g.appendChild(hA);
var ez=document.createElement("table");ae=document.createElement("div");ae.style.position="absolute";ae.style.left="5px";ae.style.top="950px";ae.style.scrollWidth="800px";ae.style.width="800px";
ae.style.height="800px";ae.style.scrollHeight="800px";ae.style.overflow="auto";g.appendChild(ae);ae.style.marginLeft="50px";ae.appendChild(ez);ez.style.marginLeft="auto";ez.style.marginRight="auto";
ez.style.cellSpacing="0px";ez.style.borderCollapse="collapse";var kP=document.createElement("tbody");ez.appendChild(kP);if(gS.length==0){cQ.innerHTML=
"<br/><span style='margin: 0px 100px; color:#336600; font-size:16px; font-weight:bold;'> No Comments Yet. </span><br/>";}else if(U.getUserId()==MAIN_DATA.getViewer().getUserId()){cQ.innerHTML=
"<br/><span style='margin: 0px 100px; color:#CC6600; font-size:16px; font-weight:bold;'> Recent Comments! </span><br/> <small> click on comment to delete </small> <br/>";}else{cQ.innerHTML=
"<br/><span style='margin: 0px 100px; color:#CC6600; font-size:16px; font-weight:bold;'> Recent Comments! </span><br/>";}cQ.style.position="absolute";cQ.style.left="430px";cQ.style.top="900px";cQ.id=
"commentsDiv";for(var T=0;T<gS.length;T++){kP.appendChild(createItemTr(gS[T],T+1));}};function createItemTr(bM,cj){var ak=document.createElement("tr");var k=document.createElement("td");
ak.appendChild(k);k.style.padding="5px 0px 5px 0px";k.style.borderBottom="2px solid #e5ffb2";var aF=document.createElement("table");k.appendChild(aF);aF.style.cellSpacing="0px";
aF.style.borderCollapse="collapse";var bT=document.createElement("tbody");aF.appendChild(bT);var ac=document.createElement("tr");bT.appendChild(ac);ac.appendChild(createCommentPictureTd(
bM.getFromProfileUrl()));ac.appendChild(createCommentNameTd(bM.getFromUserName()));ac.appendChild(createCommentTextTd(bM.getCommentText(),bM.getUniqueId()));ak.style.cursor="pointer";if(
bM.getToUserId()==MAIN_DATA.getViewer().getUserId()){addEvent(ak,"click",function(){modalPopup("You can delete this comment or visit the garden of the person who left the comment",{"Delete comment":
function(){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/comments?action=delete&unique_id="+bM.getUniqueId());modalPopup("We have deleted the comment! Refresh the page to verify. Thanks!",{
OK:null},1200);},"Visit their garden!":function(){GP.DETAIL_USER_ID=bM.getFromUserId();GP.DETAIL_THUMBNAIL_URL=bM.getFromProfileUrl();GP.DETAIL_DISPLAY_NAME=bM.getFromUserName();
navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);},"Cancel":null},1200);});}else{addEvent(ak,"click",function(){modalPopup(
"You can visit the garden of the person who left the comment",{"Visit their garden!":function(){GP.DETAIL_USER_ID=bM.getFromUserId();GP.DETAIL_THUMBNAIL_URL=bM.getFromProfileUrl();
GP.DETAIL_DISPLAY_NAME=bM.getFromUserName();navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);},"Cancel":null},1200);});}return ak;};function createCommentRankTd(cj){var k=
document.createElement("td");k.style.width="200px";k.style.textAlign="center";k.innerHTML="<span style='color:#b6e657; font-size:40px; font-weight:bold;'>"+cj+"</span>";return k;};
function createCommentPictureTd(ko){var k=document.createElement("td");k.style.width="100px";k.style.textAlign="center";k.innerHTML="<img height='50' src='"+ko+"'>";return k;};
function createCommentNameTd(nz){var k=document.createElement("td");k.style.textAlign="left";k.style.width="200px";var C=document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";
C.style.marginRight="auto";C.style.fontSize="15px";C.style.fontWeight="bold";C.style.color="#CC6600";C.innerHTML=shortenedStringKeepEscapedCharacters(nz,12);return k;};function createCommentTextTd(jC,
cc){var k=document.createElement("td");k.style.textAlign="left";k.style.width="400px";var C=document.createElement("div");k.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";
C.style.fontSize="15px";C.style.fontWeight="bold";C.style.color="#336600";C.innerHTML=jC;C.style.width="400px";return k;}};GreenPatchDiv.NUM_PER_ROW=5;GreenPatchDiv.MINIMUM_NUM_ROWS=2;
GreenPatchDiv.NORMAL_CELL_DIMENSION=118;GreenPatchDiv.SMALL_CELL_DIMENSION=90;GreenPatchDiv.STALE=false;GreenPatchDiv.updateInterval=null;GreenPatchDiv.isDragging=false;var HEALTHY_GARDEN=
"This garden is healthy!<br>Maybe some of your friends' gardens need care?";function helpFriendsGarden(){var iB=MAIN_DATA.getRandomFriendId();if(iB!=null&&iB>0){GP.DETAIL_USER_ID=iB;
GP.DETAIL_DISPLAY_NAME=undefined;GP.DETAIL_THUMBNAIL_URL=undefined;navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);}else{modalPopup(
"Your friends do not have the app installed yet. Invite them! Meanwhile, you can help maintain the gardens of the 'Greenest People' by clicking on the tab above.",{Ok:null});outputDebug(
"random friend id null");}};function createGardenPickerTab(){GP.MAIN_TABS.switchToDynamicTab(function(gR){gR.innerHTML="";try{id("extraTabCaption").innerHTML="";}catch(e){};new GardenPickerDiv(gR);});
};function GreenPatchDiv(D,M,qw,pb){var g=D;var U=M;var dO=qw;var bH=pb;var B=undefined;var cE=undefined;var au=null;var hn=new Array();var az=null;var aX=null;var bU=(MAIN_DATA.getViewer().getUserId(
)==U.getUserId());var rh=new Array();this.redrawPatch=redrawPatch;this.addPlantToPatch=addPlantToPatch;var be=undefined;if(g!=undefined){createDiv(g);}function clearToolAction(){cE=undefined;};
function createDiv(_a_parentDiv){outputDebug("Call to createDiv of GreenPatchDiv");updateUserData();g=_a_parentDiv;if(isValid(dO)&&dO){be=GreenPatchDiv.SMALL_CELL_DIMENSION;}else{be=
GreenPatchDiv.NORMAL_CELL_DIMENSION;}B=document.createElement("div");g.appendChild(B);B.style.textAlign="center";B.style.padding="0px";createPatchTable();};function addPlantToPatch(K){az.appendChild(
createPatchAreaTd(K,null,null,100));};function toggleModifyState(){var l_currentState=false;if(MAIN_DATA.getViewer().getPermissionToModify()=="1"){l_currentState=true;}if(l_currentState){modalPopup(
"<font size='3'> Currently others can rearrange the gifts in your garden! However they can not sell or move gifts from your shed. <br/> You can click on 'Don't let others modify' to ensure that only you can modify your patch.</font>",
{"Don't let others modify":preventPatchModification,"Let others modify":allowPatchModification});}else{modalPopup(
"<font size=3'> Currently only you can rearrange the gifts in your garden! <br/> You have the option of allowing others to rearrange your garden as well. However they can not sell or move gifts from your shed. <br/> You can click on 'Let others to rearrange' to allow other users to modify.</font>",
{"Don't let others modify":preventPatchModification,"Let others modify":allowPatchModification});}};function preventPatchModification(){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+
"/green/edit_patch?"+"action=prevent_modification&"+"patch_owner_id="+MAIN_DATA.getViewer().getUserId(),function(){modalPopup("Your preferences have been set!",{"Ok.":null});});id("modify_"+bU)
.innerHTML="Let others modify!";};function allowPatchModification(){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/edit_patch?"+"action=allow_modification&"+"patch_owner_id="+
MAIN_DATA.getViewer().getUserId(),function(){modalPopup("Your preferences have been set!",{"Ok.":null});});id("modify_"+bU).innerHTML="Don't let others modify!";};function createPatchTable(){var V=
document.createElement("div");B.appendChild(V);V.className="messageBox";V.style.display="none";new PatchActivitiesDiv(B,U);var aH=document.createElement("div");B.appendChild(aH);aH.style.width=(be*
GreenPatchDiv.NUM_PER_ROW+60)+"px";aH.style.height="700px";aH.style.marginLeft="auto";aH.style.marginRight="auto";aH.style.overflowX="hidden";aH.style.overflowY="auto";aH.style.position="absolute";
aH.style.right=0;aH.id="patchTableDiv";var bo=document.createElement("div");bo.style.height=40;bo.style.paddingTop=5;bo.style.fontWeight="bold";bo.innerHTML=HEALTHY_GARDEN;aH.appendChild(bo);var cK=
document.createElement("div");cK.style.border="4px solid #D2F1AD";cK.style.margin="10px auto 5px auto";cK.style.width=460;if(IE){cK.style.height=118;}else{cK.style.height=115;}cK.style.position=
"relative";var iE=document.createElement("div");iE.className="tools";var cr="_other";if(bU){cr="_main";}for(var A=0;A<TOOLS.length;A++){var eA=document.createElement("div");eA.style.left=
TOOLOffsets[A];eA.style.width=TOOLOffsets[A+1]-TOOLOffsets[A]-20;eA.style.backgroundPosition= -TOOLOffsets[A]+"px -80px";eA.id="garden_tool_count"+A+cr;addEventWithParameter(eA,"click",onClickTool,A);
iE.appendChild(eA);}cK.appendChild(iE);for(var A=0;A<TOOLS.length;A++){var gg;if(GP.idCount[A]>0){gg=greenButtonWithParam("Use!",onClickTool,A,undefined,"toolsBuyUse"+cr+A);}else{gg=
greenButtonWithParam("Buy!",onClickTool,A,undefined,"toolsBuyUse"+cr+A);}gg.style.position="absolute";gg.style.left=TOOLBuyOffsets[A];cK.appendChild(gg);}aH.appendChild(cK);var cI=
document.createElement("span");cI.innerHTML="Saving ...";cI.style.position="absolute";cI.style.display="none";cI.style.left=420;cI.style.top=185;cI.style.fontSize=18;aH.appendChild(cI);
function saveGarden(lq){GreenPatchDiv.stale=false;var iU=new Array();var bN=new Array();var kI=new Array();var al=U.getPatchPlants();for(var A=0;A<al.length;A++){if(isValid(al[A].stale)){al[A].stale=
undefined;iU.push(al[A].getUniqueId());bN.push(al[A].getLeft());kI.push(al[A].getTop());}}if(iU!=""){var l_requestString=REQUEST_DESTINATION_URL+"/green/save_garden?user_id="+MAIN_DATA.getOwner()
.getUserId()+"&unique_id="+iU.join()+"&x="+bN.join()+"&y="+kI.join();if(!bU){l_requestString=REQUEST_DESTINATION_URL+"/green/save_garden?user_id="+U.getUserId()+"&edited_by_id="+MAIN_DATA.getViewer()
.getUserId()+"&edited_by_thumbnail="+customEncoding(MAIN_DATA.getViewer().getThumbnailUrl())+"&edited_by_display_name="+customEncoding(MAIN_DATA.getViewer().getDisplayName())+"&unique_id="+iU.join()+
"&x="+bN.join()+"&y="+kI.join();}cI.style.display="block";makeXMLNotCachedRequest(l_requestString,function(O){var pr=getGadgetResponseText(O);if(pr.indexOf("OKGood")<0){if(!bU){modalPopup(
"Sorry, you no longer have permission to modify this garden.",{OK:null});}else{modalPopup("Uh-oh! Something went wrong while saving your garden!",{OK:null});}}else{if(isValid(lq)&&lq){modalPopup(
"Saved!",{OK:null});}}cI.style.display="none";});}else{if(isValid(lq)&&lq){modalPopup("Your garden was automatically saved a few seconds back! Thanks!",{OK:null});}}};if(bU){var jy=greenButton(
"Store Garden Immediately",function(){saveGarden(true);});jy.style.position="absolute";jy.style.left="120px";aH.appendChild(jy);}GreenPatchDiv.updateInterval=setInterval(function(){saveGarden(false);}
,2000);var cs;var dw;dw=greenButton("Go to Shed",function(){az.style.display="none";aX.style.display="block";$(dw).css('opacity',0.3);$(cs).css('opacity',1);dw.style.cursor="default";cs.style.cursor=
"pointer";});dw.style.position="absolute";dw.style.left=530;aH.appendChild(dw);cs=greenButton("Go to Garden",function(){aX.style.display="none";az.style.display="block";$(cs).css('opacity',0.3);$(dw)
.css('opacity',1);cs.style.cursor="default";dw.style.cursor="pointer";});cs.style.position="absolute";cs.style.left=0;aH.appendChild(cs);$(cs).css('opacity',0.5);cs.style.cursor="default";az=
document.createElement("div");au=document.createElement("div");au.style.position="absolute";au.style.left=0;az.style.width=630;az.style.height=300;au.style.width=630;au.style.height=300;aX=
document.createElement("div");aX.style.width=630;aX.style.height=300;aX.style.display="none";az.appendChild(au);var dj=document.createElement("div");aH.appendChild(az);az.appendChild(dj);
dj.style.position="absolute";dj.style.left=0;dj.style.zIndex=10;dj.style.marginLeft="auto";dj.style.marginRight="auto";az.style.backgroundImage="url('"+IMAGE_SOURCE_URL+"ui/lawn2.jpg')";
az.style.position="absolute";az.style.top=215;if(IE)az.style.top=205;az.style.left=0;dj.style.backgroundRepeat="repeat";az.id="patchTableBg"+cr;var ck=document.createElement("div");ck.id="patchTBody"+
cr;dj.appendChild(ck);var al=U.getPatchPlants();var gX=U.getPatchEvents();outputDebug("For user: "+U.getUserId()+" number of plants: "+al.length);var bF=be+65;if((!isValid(al)||al.length==0)&&(!
isValid(gX)||gX.length==0)){if(bU&& !dO){V.style.display="block";V.innerHTML="Sorry, there is no activity in your garden yet...<br/> Send more plants to receive more plants!";V.style.cursor="pointer";
addEvent(V,"click",function(){GP.MAIN_TABS.switchToTab(0);});createEmptyPatch(ck,GreenPatchDiv.NUM_PER_ROW*GreenPatchDiv.MINIMUM_NUM_ROWS);}else{createEmptyPatch(ck,GreenPatchDiv.NUM_PER_ROW*
GreenPatchDiv.MINIMUM_NUM_ROWS);}}else{V.style.display="block";V.innerHTML="Click here to see a friend's garden!";V.style.cursor="pointer";addEvent(V,"click",createGardenPickerTab);var gr=
GreenPatchDiv.NUM_PER_ROW*(GreenPatchDiv.MINIMUM_NUM_ROWS-1);var py=0;if(al.length<=gr){var numEmptyRows=1+Math.floor((gr-al.length)/GreenPatchDiv.NUM_PER_ROW);var numEmptyCells=numEmptyRows*
GreenPatchDiv.NUM_PER_ROW;bF=(be+65)*numEmptyRows;createEmptyPatch(ck,numEmptyCells);}var numInitialEmptyCells=0;var an=0;var fV=0;var eg=0;var hk=undefined;var mc=0;for(;an<(numInitialEmptyCells+
al.length);an++){if(!isValid(hk)||hk<al[an-numInitialEmptyCells].getSentOn()){hk=al[an-numInitialEmptyCells].getSentOn();mc=an;outputDebug("Latest date: "+hk+" "+al[an-
numInitialEmptyCells].getPlantId());}}an=0;for(;an<(numInitialEmptyCells+al.length);an++){if(an!=0&&an%GreenPatchDiv.NUM_PER_ROW==0){fV+=be+65;eg=0;bF+=be+65;}var kO=20;if(an==mc){kO=21;}
az.appendChild(createPatchAreaTd(al[an-numInitialEmptyCells],fV,eg,kO));eg+=130;}if(bF<450)bF=450;au.style.height=bF;az.style.height=bF;}var dc=document.createElement("div");aH.appendChild(aX);
aX.appendChild(dc);dc.style.position="absolute";dc.style.left=0;dc.style.zIndex=10;dc.style.marginLeft="auto";dc.style.marginRight="auto";aX.style.backgroundImage="url('"+IMAGE_SOURCE_URL+
"ui/lawn2.jpg')";aX.style.position="absolute";aX.style.top=215;if(IE)aX.style.top=205;aX.style.left=0;dc.style.backgroundRepeat="repeat";var he=document.createElement("div");he.id="shedTBody"+cr;
dc.appendChild(he);var ec=U.getShedPlants();outputDebug("For user: "+U.getUserId()+" number of plants: "+ec.length);if((!isValid(ec)||ec.length==0)){createEmptyPatch(he,GreenPatchDiv.NUM_PER_ROW*
GreenPatchDiv.MINIMUM_NUM_ROWS);}else{var me=GreenPatchDiv.NUM_PER_ROW*(GreenPatchDiv.MINIMUM_NUM_ROWS-1);var gw=be+65;if(ec.length<=me){var numEmptyRows=1+Math.floor((me-ec.length)/
GreenPatchDiv.NUM_PER_ROW);var numEmptyCells=numEmptyRows*GreenPatchDiv.NUM_PER_ROW;gw=(be+65)*numEmptyRows;createEmptyPatch(he,numEmptyCells);}var shedNumInitialEmptyCells=0;var gd=0;var mf=0;var jf=
0;for(;gd<(shedNumInitialEmptyCells+ec.length);gd++){if(gd!=0&&gd%GreenPatchDiv.NUM_PER_ROW==0){mf+=be+65;jf=0;gw+=be+65;}aX.appendChild(createPatchAreaTd(ec[gd-shedNumInitialEmptyCells],mf,jf,20));
jf+=130;}if(gw<450)gw=450;aX.style.height=gw;}if(gX.length>0){switch(parseInt(gX[0])){case 100:bo.innerHTML="There's a hungry bunny in this garden!<br>Stop her from eating the flowers.";au.innerHTML=
"<div id='bunnymonster"+cr+"' class='bunny'></div>";au.style.zIndex=40;cE=function(at){switch(at){case 0:id("bunnymonster"+cr).style.backgroundPosition="-300px 0px";setTimeout(function(){bo.innerHTML=
HEALTHY_GARDEN;au.innerHTML="";au.style.zIndex= -1;clearToolAction();modalPopup("Your tasty carrot will keep the bunny out of trouble. Good work!",{Ok:function(){callsAfterEventHandled(U.getUserId(),
100);}});},1200);break;case 1:modalPopup("The bunny is too quick for you to grab!",{Ok:null});break;case 2:modalPopup("Don't wet the bunny!",{Ok:null});break;case 3:modalPopup("That's not nice!",{Ok:
null});break;case 4:modalPopup("You can't beat this bunny caveman-style.",{Ok:null});}};break;case 103:bo.innerHTML=
"There are leaves all over this garden!<br>Make sure the baby plants can still get sunshine.";for(var A=0;A<20;A++){var dC=document.createElement("div");dC.style.position="absolute";dC.style.left=(A*
27);dC.className=(A%2==0)?"leaf1":"leaf2";dC.style.height=bF;var pz=Math.floor(Math.random()*300);dC.style.backgroundPosition="0 "+pz+"px";au.appendChild(dC);hn.push(dC);cE=function(at){if(at!=3){
modalPopup("That's not going to help with those leaves!",{Ok:null});return;}bo.innerHTML=HEALTHY_GARDEN;clearToolAction();rakeEventWrapper(hn,U.getUserId(),au);}}break;case 102:bo.innerHTML=
"This garden is dry!<br>Help out the thirsty plants.";au.style.backgroundImage="url('"+IMAGE_SOURCE_URL+"ui/lawndry.jpg')";cE=function(at){if(at==1){modalPopup("Nope, these plants need water!",{Ok:
null});return;}else if(at==2){bo.innerHTML=HEALTHY_GARDEN;clearToolAction();fadeoutEventWrapper(au,U.getUserId());return;}else if(at==4){modalPopup("Sorry, that'll leave the ground bone-dry!",{Ok:
null});return}modalPopup("That didn't help the dry soil.",{Ok:null});};break;case 101:bo.innerHTML="There are weeds in this garden competing for resources!<br>Give the plants a helping hand.";for(
var A=0;A<20;A++){var er=document.createElement("div");er.style.position="absolute";er.style.left=(A*27);er.className=(A%2==0)?"weed1":"weed2";var pG=Math.floor(Math.random()*300);er.style.top=pG+
"px";au.appendChild(er);hn.push(er);cE=function(at){if(at!=1){modalPopup("That won't help with the weeds.",{Ok:null});return;}bo.innerHTML=HEALTHY_GARDEN;clearToolAction();weedEventWrapper(hn,au,
U.getUserId());}}break;case 104:bo.innerHTML="An excited puppy is running wild in this garden.<br>Find a way to keep him busy.";au.innerHTML="<div id='puppymonster"+cr+"' class='puppy'></div>";
au.style.zIndex=40;cE=function(at){if(at==2){modalPopup("Puppy doesn't want a bath!",{Ok:null});return;}else if(at!=4){modalPopup("The puppy is still running wild!",{Ok:null});return;}id(
"puppymonster"+cr).style.backgroundPosition="-300px 0px";setTimeout(function(){bo.innerHTML=HEALTHY_GARDEN;au.innerHTML="";au.style.zIndex= -1;clearToolAction();modalPopup(
"Good thinking! You've recycled some kitchen waste and kept the puppy busy.",{Ok:function(){callsAfterEventHandled(U.getUserId(),104);}});},1200);};break;}}if(bU){var gl=document.createElement("div");
gl.innerHTML="<br/><span style='margin: 0px 0px 0px 0px; color:red; font-size:18px; font-weight:bold;'>"+"Your patch contains only the recently received plants! <br /></span>"+
"<span style='margin: 0px 0px 0px 0px; color:#CC6600; font-size:18px; font-weight:bold;'>"+"Rearrange your garden by dragging your plants and items around!<br/>"+
"New gifts that you receive will go to your shed.<br/>"+"Click on an item in your shed to move it to your garden.<br/>"+"</span><br/>";gl.style.position="absolute";gl.style.left="260px";gl.style.top=
"720px";B.appendChild(gl);}if(bU){GreenCommentsDiv(B,MAIN_DATA.getViewer());}else{GreenCommentsDiv(B,MAIN_DATA.getDetailedUser());}updateUserData();};function onClickTool(at){if(GP.idCount[at]==0){
GP.MAIN_TABS.switchToTab(3);return;}if(cE==undefined){modalPopup("This garden doesn't need anything right now.",{"Take me to a friend's garden, instead.":helpFriendsGarden,"Never mind.":null});return;
}if(GP.idCount[at]&&GP.idCount[at]>0){useTool(at);cE(at);return;}var kl=at<2?"":"a ";outputDebug(at);modalPopup("You don't have "+kl+TOOLS[at].getName()+".",{"Take me to the store.":function(){
GP.MAIN_TABS.switchToTab(3);},"Never mind.":null})};function redrawPatch(){outputDebug("call to redraw patch");var al=U.getPatchPlants();var ck=id("patchTBody_main");removeChildren(ck);if(!isValid(ck)
){outputDebug("redraw returning since main patch not yet initialized");return;}var gr=GreenPatchDiv.NUM_PER_ROW*(GreenPatchDiv.MINIMUM_NUM_ROWS-1);var py=0;var bF=0;if(al.length<=gr){var numEmptyRows=
1+Math.floor((gr-al.length)/GreenPatchDiv.NUM_PER_ROW);var numEmptyCells=numEmptyRows*GreenPatchDiv.NUM_PER_ROW;bF=(be+65)*numEmptyRows;createEmptyPatch(ck,numEmptyCells);}var numInitialEmptyCells=0;
var dn=null;var an=0;for(;an<(numInitialEmptyCells+al.length);an++){if(an%GreenPatchDiv.NUM_PER_ROW==0){dn=document.createElement("tr");ck.appendChild(dn);bF+=be+65;}if(an<numInitialEmptyCells){
dn.appendChild(createPatchAreaTd(undefined));}else{dn.appendChild(createPatchAreaTd(al[an-numInitialEmptyCells]));}}au.style.height=bF;az.style.height=bF;};function makePatchPlantsDraggable(){
modalPopup("enable draggable",{"OK":null});for(var A=0;A<az.length;A++){var k=az[A];$(k).draggable('enable');}};function onGotUseToolResponse(O){var ad=getGadgetResponseData(cp);try{var jF=
getXMLEncodedStringNodeValue(ad,"error");if(jF.indexOf("user does not have")> -1){modalPopup("Sorry, you don't have any more uses of that tool.",{"Take me to the store.":function(){
GP.MAIN_TABS.switchToTab(3);},"Never mind.":null});return;}}catch(e){}cE(at);};function createToolsTr(nM){var mU=document.createElement("tr");for(var T=0;T<TOOLS.length;T++){var gZ=
nM[TOOLS[T].getRank()];if(gZ==null||gZ==undefined){gZ=0;}mU.appendChild(createToolTd(TOOLS[T],gZ));}return mU;};function createToolTd(qT,oq){return createPictureQuantityUseTd(qT,oq);};
function createEmptyPatch(nJ,op){outputDebug("call to create empty patch");var dn=null;for(var an=0;an<op;an++){if(an%GreenPatchDiv.NUM_PER_ROW==0){dn=document.createElement("tr");nJ.appendChild(dn);}
dn.appendChild(createPatchAreaTd(undefined));}};function createPatchAreaTd(K,fV,eg,pe){var k=document.createElement("div");k.style.verticalAlign="top";k.style.textAlign="center";k.style.position=
"absolute";if(isValid(K)){if(K.getLeft()!=0||K.getTop()!=0){k.style.top=K.getTop();k.style.left=K.getLeft();}else{k.style.top=fV;k.style.left=eg;}}if(isValid(pe)){k.style.zIndex=pe;}if(!dO){
k.style.paddingTop="10px";}else{k.style.verticalAlign="middle";}if(!isValid(K)){return k;}var bE=null;if(!isValid(dO)|| !dO){var ml=GP.GIFTS[K.getPlantId()];bE=getPlantImageFromReceivedPlant(K,bU);if(
K.getIsOnPatch()=="true"&&bU){addEvent(k,'click',function(){if(!isValid(k.dragged)|| !k.dragged){triggerClickEvent(K,k);}k.dragged=false;});}if(K.getIsOnPatch()=="true"){var cr="_other";if(bU){cr=
"_main";}if(bU||U.getPermissionToModify()=="1"){$(k).draggable({containment:'#patchTableBg'+cr,scroll:true,scrollSensitivity:100,start:function(ev,ui){k.dragged=true;},stop:function(ev,ui){if((
Math.abs(U.getPlantFromUniqueId(K.getUniqueId()).getLeft()-ui.position.left)<GP.MOVE_THRESHOLD)&&(Math.abs(U.getPlantFromUniqueId(K.getUniqueId()).getTop()-ui.position.top)<GP.MOVE_THRESHOLD)){
triggerClickEvent(K,k);}var du=U.getPlantFromUniqueId(K.getUniqueId());du.setLeft(ui.position.left);du.setTop(ui.position.top);if(ui.position.top==0)du.setTop(1);du.stale=true;GreenPatchDiv.stale=
true;}});}}k.appendChild(bE);}else{bE=new ImageDiv(k,K.getPlant().getPlantThumbnailURL(),"50px","50px");bE.getContainerDiv().style.marginLeft="auto";bE.getContainerDiv().style.marginRight="auto";}
var ba=document.createElement("div");k.appendChild(ba);ba.className="seedInfoDiv";if(isBoard(K.getPlantId())&&bU){bE.style.cursor="pointer";ba.innerHTML="Click on board to edit!";}else if(
K.getUniqueId()>0&&bU){if(K.getIsOnPatch()=="true"){ba.innerHTML=GP.GIFTS[K.getPlantId()].getName()+"<br>From "+K.getFromUser().getShortName()+
"<br /><span style='font-size: 9px;'>[Click on gift to sell!]</span>";}else{ba.innerHTML=GP.GIFTS[K.getPlantId()].getName()+"<br>From "+K.getFromUser().getShortName()+
"<br /><span style='font-size: 9px;'>[Click on gift to move to garden!]</span>";}}else{ba.innerHTML=GP.GIFTS[K.getPlantId()].getName()+"<br>From "+K.getFromUser().getShortName();}ba.style.display=
"none";addEvent(k,"mouseover",function(){ba.style.display="block";});addEvent(k,"mouseout",function(){ba.style.display="none";});if(bU&&K.getIsOnPatch()=="false"){addEvent(bE,"click",function(){
modalPopup("You can move this item to your garden! The gift will be added in the middle of your garden.",{"Move to garden!":function(){K.setIsOnPatch("true");U.deleteShedPlantUsingUniqueId(
K.getUniqueId());K.setLeft(250);K.setTop(150);K.stale=true;GreenPatchDiv.STALE=true;U.addReceivedPlant(K);aX.removeChild(k);az.appendChild(createPatchAreaTd(K,fV,eg,10000));},"Leave it in the shed":
function(){}});});}return k;};function triggerClickEvent(K,qx){if(bU&&K.getIsOnPatch()=="true"){if(!isBoard(K.getPlantId())&&K.getUniqueId()<=0){modalPopup(
"Remember that you can't sell this item since it was just bought!",{Ok:null});return;}if(isBoard(K.getPlantId())){if(MAIN_DATA.getViewer().getCash()<GP.BOARD_REPAINTING_COST){modalPopup(
"Repainting the board costs 10 greenbucks.",{Ok:null});return;}modalBoardPopup({"OK":function(){var fT=id("firstline").value;var gm=id("secondline").value;fT=fT.replace(/[^A-Za-z0-9!@' ]/g,'');gm=
gm.replace(/[^A-Za-z0-9!@' ]/g,'');outputDebug("First line: "+fT+" "+gm);fT.replace('`','');gm.replace('`','');var gM=fT+"`"+gm;MAIN_DATA.getViewer().setBoardMessage(gM);var v={};v.action="set";
v.user_id=MAIN_DATA.getViewer().getUserId();v.message=gM;makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/boardmessage",updateUserData(),v);},"Cancel":null});}else{var pR=getSellMessage(
K.getPlantId());modalPopup(pR,{"Sell it":function(){var v={};MAIN_DATA.getViewer().deletePlantUsingUniqueId(K.getUniqueId());v.unique_id=K.getUniqueId();v.user_id=MAIN_DATA.getOwner().getUserId();
outputDebug("removing: "+qx);az.removeChild(qx);makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/sellplant",updateUserData,v);},"Never mind":null},350);}}};function createPatchEventAreaTd(hL){
outputDebug("Call to createPatchEvent: "+hL);var k=document.createElement("td");k.style.verticalAlign="top";k.style.width=be+"px";k.style.height=(be+25)+"px";k.style.textAlign="center";if(!dO){
k.style.paddingTop="10px";}else{k.style.verticalAlign="middle";}var kb=null;outputDebug("Event number: "+hL);kb=new ImageDiv(k,EVENTS[hL].getImageUrl(),"100px","100px");kb.getContainerDiv()
.style.marginLeft="auto";kb.getContainerDiv().style.marginRight="auto";var ba=document.createElement("div");k.appendChild(ba);ba.className="seedInfoDiv";ba.innerHTML=EVENTS[hL].getName();
ba.style.display="none";addEvent(k,"mouseover",function(){ba.style.display="block";});addEvent(k,"mouseout",function(){ba.style.display="none";});return k;};function useTool(iQ,nA){var v={};
v['user_id']=MAIN_DATA.getViewer().getUserId();v['tool_id']=iQ;v['patch_owner_id']=U.getUserId();makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/useusertool",nA,v);}};
function fadeoutEventWrapper(cO,ao){function fadeoutEvent(level){cO.style.opacity=level/10;cO.style.filter="alpha(opacity="+(level*10)+")";level--;if(level>=0)setTimeout(function(){fadeoutEvent(level)
;},100);else setTimeout(function(){cO.style.backgroundImage="";cO.style.zIndex= -1;modalPopup("You have nurtured your garden wisely. All the living things there thank you!",{Ok:function(){
callsAfterEventHandled(ao,102);}});},800);};if(IE)fadeoutEvent(0);else fadeoutEvent(10);};function rakeEventWrapper(eR,ao,cO){function rakeEvent(step){for(var A=0;A<step;A++){if(step==20)
eR[A].style.display="none";else eR[A].style.left=(step*27);}step++;if(step<21)setTimeout(function(){rakeEvent(step);},(step%7==0)?250:50);else setTimeout(function(){cO.style.zIndex= -1;modalPopup(
"You have raked the leaves into your compost pile. Good job!",{Ok:function(){callsAfterEventHandled(ao,103);}});},800);};rakeEvent(1);};function weedEventWrapper(eR,cO,ao){function weedEvent(step){
for(var A=0;A<eR.length;A++){if(step<6){eR[A].style.left=A*27+2*(step%2)+"px";}else if(step==6){eR[A].style.backgroundPosition="0 0";}else{eR[A].style.opacity=(16-step)/10;eR[A].style.filter=
"alpha(opacity="+((16-step)*10)+")";}}var kk=50;if(step<6)kk=150;else if(step==6)kk=600;step++;if(step<17)setTimeout(function(){weedEvent(step);},kk);else{cO.innerHTML="";cO.style.zIndex= -1;
modalPopup("You pulled the weeds, without needing to resort to harsh chemicals. Good job!",{Ok:function(){callsAfterEventHandled(ao,101);}});}};weedEvent(1);};function callsAfterEventHandled(ao,eH){
updateUserData();var pR=EVENTS[eH].getEventHandledDesc();inviteDetailedUserIfNeeded(ao,pR,eH);};function inviteDetailedUserIfNeeded(ao,oz,eH){if(isValid(MAIN_DATA.getDetailedUser())&&
MAIN_DATA.getDetailedUser().getUserId()==ao&&ao!=MAIN_DATA.getViewer().getUserId()){var av=MAIN_DATA.getDetailedUser();var I="I "+oz+
" in your Green Garden. Help me and the planet by tending gardens!"+"<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104761&friendId="+av.getUserId()+
"&appParams={\"initialTab\"%3A4%2C\"showDetailedUserId\"%3A\""+MAIN_DATA.getViewer().getUserId()+"\"}'>   Click here to care for my garden!</a>";modalPopup(
"Thanks for taking care of the garden! If you tended your friend's garden, you can send a personal invite/message.",{"Let the world know you care!":function(){var v={};v.target=ao;v.event=
EVENTS[eH].getEventHandledDesc();if(MAIN_DATA.getViewer().getUserId()%10== -1){postActivity("Template_Simple_Garden_Maintenence",v,["http://api.myspace.com/v1/users/"+MAIN_DATA.getViewer().getUserId()
],null,function(){sendInviteIfNotInstalledMessageOtherwise(av,"I tended your garden!",I,function(bf){if(bf==1){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/invite?user_id="+
MAIN_DATA.getViewer().getUserId()+"&num_invites=1&num_messages=0");}},function(bf){if(bf==1){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/invite?user_id="+MAIN_DATA.getViewer().getUserId()+
"&num_invites=0&num_messages=1");}});});}else{sendInviteIfNotInstalledMessageOtherwise(av,"I tended your garden!",I,function(bf){if(bf==1){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+
"/green/invite?user_id="+MAIN_DATA.getViewer().getUserId()+"&num_invites=1&num_messages=0");}},function(bf){if(bf==1){makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/invite?user_id="+
MAIN_DATA.getViewer().getUserId()+"&num_invites=0&num_messages=1");}});}},"Never mind, don't tell them.":function(){}});}};function FetchUsersActionMap(oD){var es=new Array();var gs=oD;
this.initialize=initialize;this.getNumUsersPerPage=getNumUsersPerPage;this.setCurrentUserType=setCurrentUserType;this.getCurrentUserType=getCurrentUserType;this.getNumUserTypes=getNumUserTypes;
this.getUserTypes=getUserTypes;this.getUserListTableWidth=getUserListTableWidth;this.getEmptyExplanation=getEmptyExplanation;this.getNumUsers=getNumUsers;this.getUsers=getUsers;initialize();
function initialize(){es.push(CachedUserList.GLOBAL);es.push(CachedUserList.GLOBAL_MONTHLY);es.push(CachedUserList.MY_TOP_FRIENDS);es.push(CachedUserList.RECRUITERS_MONTHLY);};
function getNumUsersPerPage(){return 8;};function getNumUsers(callback){MAIN_DATA.getCachedUsers(gs).getNumUsers(callback);};function getUsers(startIndex,num,callback){MAIN_DATA.getCachedUsers(gs)
.getUsers(startIndex,num,callback);};function getUserListTableWidth(){return "550px";};function getEmptyExplanation(){var it=document.createElement("div");it.className="explanationBox";switch(gs){
case CachedUserList.MY_TOP_FRIENDS:it.innerHTML="<h1> Your Friends </h1> Here are your Greenest friends!";break;case CachedUserList.GLOBAL:it.innerHTML="<h1> Everyone </h1> This shouldn't be empty.";
break;}return it;};function setCurrentUserType(userType){gs=userType;};function getCurrentUserType(){return gs;};function getNumUserTypes(){return es.length;};function getUserTypes(){return es;}};
function GreenLeaderBoardDiv(D,fetchMap){var g=D;var cn=fetchMap;var bY=undefined;var bB=1;var am=undefined;this.createDiv=createDiv;this.getContainerDiv=getContainerDiv;this.onGottenNumUsers=
onGottenNumUsers;this.jumpToPage=jumpToPage;this.jumpToCategory=jumpToCategory;this.createCategoryTabsDiv=createCategoryTabsDiv;this.createPageNumbersDiv=createPageNumbersDiv;if(g!=undefined&&g!=null)
{createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;am=document.createElement("div");g.appendChild(am);am.innerHTML="Loading Users...";cn.getNumUsers(onGottenNumUsers);};
function getContainerDiv(){return am;};function onGottenNumUsers(lK){outputDebug("UserListDiv: onGottenNumUsers: "+lK);bY=lK;jumpToPage(1);};function jumpToPage(lb){outputDebug(
"UserListDiv: jumpToPage "+lb);bB=lb;am.innerHTML="";cn.getNumUsers(onJumpToPage);};function onJumpToPage(ly){outputDebug("onJumpToPage: "+ly);bY=ly;createCategoryTabsDiv(am);if(!isValid(bY)||bY==0){
var mK=document.createElement("div");am.appendChild(mK);mK.appendChild(cn.getEmptyExplanation());}else{createPageNumbersDiv(am);new UserListTableDiv(am,cn,bB);createPageNumbersDiv(am);}};
function jumpToCategory(mJ){outputDebug("UserListDiv: jumpToCategory "+mJ);cn.setCurrentUserType(mJ);cn.getNumUsers(onGottenNumUsers);};function createCategoryTabsDiv(D){var kB=cn.getNumUserTypes();
if(kB==undefined||kB==null||kB<2){return;}var lW=cn.getUserTypes();var pk=cn.getCurrentUserType();var im=document.createElement("div");D.appendChild(im);for(var aa=0;aa<lW.length;aa++){if(aa>0){
im.appendChild(document.createTextNode(" | "));}var ef=lW[aa];var kR=CachedUserList.getUserTypeName(ef);if(ef==pk){var jj=document.createElement("span");jj.style.fontWeight="700";jj.appendChild(
document.createTextNode(kR));im.appendChild(jj);}else{var iq=document.createElement("a");iq.href="#";iq.appendChild(document.createTextNode(kR));addEventWithParameter(iq,"click",jumpToCategory,ef);
im.appendChild(iq);}}};function createPageNumbersDiv(D,rc){var pq=Math.ceil(bY/cn.getNumUsersPerPage());new PaginationDiv(D,jumpToPage,pq,bB,20);}};function UserListTableDiv(D,oi,pZ){var g=D;var eG=
oi;var fj=(pZ-1)*eG.getNumUsersPerPage();var ae=null;this.createDiv=createDiv;this.onGetUsers=onGetUsers;if(g!=undefined&&g!=null){createDiv(g);}function createDiv(_a_parentDiv){g=_a_parentDiv;
outputDebug("UserListTableDiv: createDiv ");ae=document.createElement("div");g.appendChild(ae);ae.style.textAlign="center";ae.style.overflow="auto";ae.innerHTML=
"<br><font color='red'><b>[Loading Users... Please wait.]</b></font>";outputDebug("start index: "+fj);eG.getUsers(fj,eG.getNumUsersPerPage(),onGetUsers);};function onGetUsers(userCache){outputDebug(
"UserListTableDiv: onGetUsers");if(userCache.length<=fj){ae.innerHTML="<div class='messageBox'> No users... yet! </div>";return;}ae.innerHTML="";var en=document.createElement("table");ae.appendChild(
en);en.style.marginLeft="auto";en.style.marginRight="auto";en.style.cellSpacing="0px";en.style.borderCollapse="collapse";var nl=document.createElement("tbody");en.appendChild(nl);outputDebug(
"start Index "+fj);var nb=Math.min(userCache.length,fj+eG.getNumUsersPerPage());outputDebug("end index "+nb+" cache length: "+userCache.length+"  num users per page: "+eG.getNumUsersPerPage());var hX=
fj;for(;hX<nb;hX++){var ng=createUserTr(userCache[hX],hX);if(ng!=undefined){nl.appendChild(ng);}}};function createUserTr(M,gI){var ak=document.createElement("tr");var k=document.createElement("td");
ak.appendChild(k);k.style.padding="5px 0px 5px 0px";k.style.borderBottom="2px solid #e5ffb2";var ih=document.createElement("table");k.appendChild(ih);ih.style.cellSpacing="0px";
ih.style.borderCollapse="collapse";var nc=document.createElement("tbody");ih.appendChild(nc);var iY=document.createElement("tr");nc.appendChild(iY);iY.appendChild(createRankingTd(M,gI));
iY.appendChild(createInfoTd(M,gI));return ak;};function createRankingTd(M,gI){var k=document.createElement("td");k.style.width="100px";k.style.textAlign="center";k.innerHTML=
"<span style='color:#b6e657; font-size:40px; font-weight:bold;'>"+(gI+1)+"</span>";return k;};function createInfoTd(M,gI){var k=document.createElement("td");k.style.width="600px";k.style.textAlign=
"center";var mb=new SideBySideCells(k);var pU=mb.getLeftCell();var oL=new ImageDiv(pU,M.getThumbnailUrl(),90,90);var aZ=oL.getContainerDiv();aZ.style.cursor="pointer";var hb=mb.getRightCell();
hb.style.paddingLeft="30px";var C=document.createElement("div");hb.appendChild(C);C.style.marginLeft="auto";C.style.marginRight="auto";C.style.cursor="pointer";C.style.fontSize="16px";
C.style.fontWeight="bold";C.style.color="#336600";C.innerHTML=M.getShortName();if(isValid(M.getBoardMessage())&&M.getBoardMessage()!=GP.DEFAULT_BOARD_MESSAGE){var gx=document.createElement("div");
hb.appendChild(gx);gx.style.marginLeft="auto";gx.style.marginRight="auto";gx.style.color="#CC6600";gx.innerHTML="\""+M.getBoardMessage().replace("`"," ")+"\"";}var eO=document.createElement("div");
hb.appendChild(eO);eO.style.marginLeft="auto";eO.style.marginRight="auto";if(eG.getCurrentUserType()==CachedUserList.GLOBAL_MONTHLY){eO.innerHTML="Saved <b>"+M.getSavedMonthlyRainforestAmount()+
" </b> sq ft of rainforest this month! <br>(equivalent to <b>"+Math.round(M.getSavedMonthlyRainforestAmount()*1.4*100)/100+"</b> lbs of carbon). <br /> Sent <b>"+M.getNumInvites()+
"</b> invites this month!";}else{eO.innerHTML="Saved <b>"+M.getSavedRainForestAmount()+"</b> sq ft of rainforest<br>(equivalent to <b>"+Math.round(M.getSavedRainForestAmount()*1.4*100)/100+
"</b> lbs of carbon). <br /> Sent <b>"+M.getNumInvites()+"</b> invites this month!";}addEvent(aZ,"click",function(){GP.DETAIL_USER_ID=M.getUserId();GP.DETAIL_DISPLAY_NAME=M.getDisplayName();
GP.DETAIL_THUMBNAIL_URL=undefined;navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);});addEvent(C,"click",function(){GP.DETAIL_USER_ID=M.getUserId();GP.DETAIL_DISPLAY_NAME=
M.getDisplayName();GP.DETAIL_THUMBNAIL_URL=undefined;navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);});addEvent(eO,"click",function(){GP.DETAIL_USER_ID=M.getUserId();
GP.DETAIL_DISPLAY_NAME=M.getDisplayName();GP.DETAIL_THUMBNAIL_URL=undefined;navigateToCanvasTabPreserveDetailedUser(GP.TAB_ORDER.DETAILED_USER);});return k;}};var idSpecUtil={};if(!isValid(
opensocial.IdSpec.GroupId)){opensocial.IdSpec.GroupId={FRIENDS:"FRIENDS",SELF:"SELF"}}idSpecUtil.viewer=function(){var v={};v[opensocial.IdSpec.Field.USER_ID]=opensocial.IdSpec.PersonId.VIEWER;
return opensocial.newIdSpec(v);};idSpecUtil.owner=function(){var v={};v[opensocial.IdSpec.Field.USER_ID]=opensocial.IdSpec.PersonId.OWNER;return opensocial.newIdSpec(v);};idSpecUtil.viewerFriends=
function(bV){var v={};v[opensocial.IdSpec.Field.USER_ID]=opensocial.IdSpec.PersonId.VIEWER;if(!isValid(bV)){v[opensocial.IdSpec.Field.NETWORK_DISTANCE]=1}else{
v[opensocial.IdSpec.Field.NETWORK_DISTANCE]=1;v[opensocial.IdSpec.Field.GROUP_ID]=bV;}return opensocial.newIdSpec(v);};idSpecUtil.ownerFriends=function(bV){var v={};v[opensocial.IdSpec.Field.USER_ID]=
opensocial.IdSpec.PersonId.OWNER;if(!isValid(bV)){v[opensocial.IdSpec.Field.GROUP_ID]=opensocial.IdSpec.GroupId.FRIENDS;}else{v[opensocial.IdSpec.Field.NETWORK_DISTANCE]=1;
v[opensocial.IdSpec.Field.GROUP_ID]=bV;}return opensocial.newIdSpec(v);};idSpecUtil.userId=function(ao,bV){var v={};v[opensocial.IdSpec.Field.USER_ID]=ao;if(isValid(bV)){
v[opensocial.IdSpec.Field.GROUP_ID]=opensocial.IdSpec.GroupId.SELF;}else{v[opensocial.IdSpec.Field.NETWORK_DISTANCE]=0;v[opensocial.IdSpec.Field.GROUP_ID]=bV;}return opensocial.newIdSpec(v);};
idSpecUtil.userIdArray=function(qC,bV){var v={};v[opensocial.IdSpec.Field.USER_ID]=qC;if(isValid(bV)){v[opensocial.IdSpec.Field.GROUP_ID]=opensocial.IdSpec.GroupId.SELF;}else{
v[opensocial.IdSpec.Field.NETWORK_DISTANCE]=0;v[opensocial.IdSpec.Field.GROUP_ID]=bV;}return opensocial.newIdSpec(v);};function HandledEvent(eH,nt,qL,gk){var qh=eH;var ql=nt;var oG=qL;
var m_displayName=shortenedStringKeepEscapedCharacters(gk,12);this.getEventId=getEventId;this.getHandledBy=getHandledBy;this.getThumbnailUrl=getThumbnailUrl;this.getDisplayName=getDisplayName;
function getEventId(){return qh;};function getHandledBy(){return ql;};function getThumbnailUrl(){return oG;};function getDisplayName(){return m_displayName;}};function HandledEdit(a_editedById,
a_editedByThumbnail,a_editedByDisplayName){var m_editedById=a_editedById;var m_editedByThmbnail=a_editedByThumbnail;var m_editedByDisplayName=shortenedStringKeepEscapedCharacters(
a_editedByDisplayName,12);this.getEditedById=getEditedById;this.getEditedByThumbnail=getEditedByThumbnail;this.getEditedByDisplayName=getEditedByDisplayName;function getEditedById(){
return m_editedById;};function getEditedByThumbnail(){return m_editedByThumbnail;};function getEditedByDisplayName(){return m_editedByDisplayName;}};function ReceivedPlant(cq){var ed=undefined;var eI=
undefined;var iR=undefined;var hH=undefined;var jw=undefined;var ge=undefined;var jx=undefined;var iK=undefined;var qW=undefined;this.getPlant=getPlant;this.getPlantId=getPlantId;this.getFromUser=
getFromUser;this.getSentOn=getSentOn;this.getUniqueId=getUniqueId;this.getSentOnDate=getSentOnDate;this.getIsOnPatch=getIsOnPatch;this.getLeft=getLeft;this.getTop=getTop;this.setLeft=setLeft;
this.setTop=setTop;this.setPlantId=setPlantId;this.setFromUser=setFromUser;this.setUniqueId=setUniqueId;this.setSentOnDate=setSentOnDate;this.setIsOnPatch=setIsOnPatch;if(isValid(cq)){createFromXML();
}function createFromXML(){try{ed=getXMLNodeValue(cq,"plant_id");iR=getXMLNodeValue(cq,"sent_on");jw=getXMLNodeValue(cq,"on_patch");var ks=iR.substr(1,10).split("-");hH=new Date();hH.setFullYear(ks[0],
ks[1]-1,ks[2]);var fromUserId=getXMLEncodedStringNodeValue(cq,"from_user_id");var fromUserName=getXMLEncodedStringNodeValue(cq,"from_user_name");var fromUserProfileUrl=getXMLNodeValue(cq,
"from_user_profile");ge=getXMLNodeValue(cq,"unique_id");jx=getXMLNodeValue(cq,"x");iK=getXMLNodeValue(cq,"y");eI=new User(undefined);eI.setUserId(fromUserId);eI.setName(fromUserName);eI.setProfileUrl(
fromUserProfileUrl);}catch(err){outputDebug("createFromXML "+err);}};function getUniqueId(){return ge;};function getPlant(){return GP_getPlantChoices().getPlantById(ed);};function getPlantId(){
return ed;};function getFromUser(){return eI;};function getSentOn(){return iR;};function setUniqueId(cc){ge=cc;};function setPlantId(as){ed=as;};function setFromUser(oE){eI=oE;};
function setSentOnDate(qo){hH=qo;};function setLeft(fU){jx=fU;};function setTop(gA){iK=gA;};function setIsOnPatch(om){jw=om;};function getSentOnDate(){return hH;};function getIsOnPatch(){return jw;};
function getLeft(){return jx;};function getTop(){return iK;}};function User(lC){var cv=undefined;var bt=undefined;var ea=undefined;var dG=undefined;var gH=undefined;var eZ=undefined;var pl=undefined;
var jc=undefined;var hR=undefined;var iC=undefined;var dT=undefined;var lN=undefined;var la=undefined;var m_latestEdit=undefined;var ja=false;var gP=undefined;var m_permissionToModify=undefined;
this.createOsUser=createOsUser;this.createXMLUser=createXMLUser;this.fillSpecificInfoFromXML=fillSpecificInfoFromXML;this.getUserId=getUserId;this.setUserId=setUserId;this.getName=getName;
this.setName=setName;this.getShortName=getShortName;this.getThumbnailUrl=getThumbnailUrl;this.getProfileUrl=getProfileUrl;this.setProfileUrl=setProfileUrl;this.getAge=getAge;this.getGender=getGender;
this.getAppUser=getAppUser;this.getRegion=getRegion;this.output=output;this.getPatchHandledEvents=getPatchHandledEvents;this.getLatestEdit=getLatestEdit;this.getNumHandledEvents=getNumHandledEvents;
this.getDismissedWelcome=getDismissedWelcome;this.getHasAppInstalled=getHasAppInstalled;this.setHasAppInstalled=setHasAppInstalled;this.getPermissionToModify=getPermissionToModify;this.saveUser=
saveUser;this.constructParamForReq=constructParamForReq;this.setBoardMessage=setBoardMessage;this.getBoardMessage=getBoardMessage;var kF=undefined;var lc=undefined;var ji=undefined;var m_acorns=
undefined;var aY=undefined;var dJ=undefined;var iF=undefined;var kY=undefined;this.getSavedRainForestAmount=getSavedRainForestAmount;this.getNumInvites=getNumInvites;
this.getSavedMonthlyRainforestAmount=getSavedMonthlyRainforestAmount;this.getCash=getCash;this.getAcorns=getAcorns;this.getPatchPlants=getPatchPlants;this.getShedPlants=getShedPlants;
this.getPatchEvents=getPatchEvents;this.getPlantFromUniqueId=getPlantFromUniqueId;this.setCash=setCash;this.setAcorns=setAcorns;this.setThumbnailUrl=setThumbnailUrl;this.addPlant=addPlant;
this.addReceivedPlant=addReceivedPlant;this.addShedPlant=addShedPlant;this.deletePlantUsingUniqueId=deletePlantUsingUniqueId;this.deleteShedPlantUsingUniqueId=deleteShedPlantUsingUniqueId;
this.hasBoard=hasBoard;if(isValid(lC)){createOsUser(lC);}function createOsUser(cN){cv=stripMyspacePrefix(cN.getField(opensocial.Person.Field.ID));bt=cN.getDisplayName();ea=cN.getField(
opensocial.Person.Field.THUMBNAIL_URL);dG=cN.getField(opensocial.Person.Field.PROFILE_URL);try{gH=cN.getField("age");eZ=cN.getField("gender");jc=cN.getField("CITY");hR=cN.getField("REGION");iC=
cN.getField("POSTALCODE");}catch(err){outputDebug("createOsUser: "+err);}};function getPatchHandledEvents(){return dT;};function getLatestEdit(){return m_latestEdit;};function getNumHandledEvents(){
return la;};function createXMLUser(aJ){try{cv=getXMLNodeValue(aJ,"user_id");bt=getXMLEncodedStringNodeValue(aJ,"display_name");ea=getXMLNodeValue(aJ,"thumbnail_url");dG=getXMLNodeValue(aJ,
"profile_url");ja=getXMLNodeValue(aJ,"has_installed_app");}catch(err){outputDebug("createXMLUser "+err);}fillSpecificInfoFromXML(aJ);};function deletePlantUsingUniqueId(cc){for(var A=0;A<aY.length;A++
){if(aY[A].getUniqueId()==cc){aY.splice(A,1);return;}}};function deleteShedPlantUsingUniqueId(cc){for(var A=0;A<dJ.length;A++){if(dJ[A].getUniqueId()==cc){dJ.splice(A,1);return;}}};
function getPlantFromUniqueId(cc){for(var A=0;A<aY.length;A++){if(aY[A].getUniqueId()==cc){return aY[A];}}return null;};function addPlant(as,fP,gk){var dy=new ReceivedPlant(null);dy.setPlantId(as);
dy.setUniqueId(-1);var pP=new Date();dy.setSentOnDate(pP);var kg=new User(undefined);kg.setUserId(fP);kg.setName(gk);dy.setFromUser(kg);aY.reverse();aY.push(dy);aY.reverse();};
function addReceivedPlant(bw){aY.push(bw);};function addShedPlant(bw){dJ.push(bw);};function hasBoard(){if(isValid(aY)){for(var A=0;A<aY.length;A++){if(isBoard(aY[A].getPlantId())){return true;}}}
return false;};function fillSpecificInfoFromXML(aJ){try{kF=getXMLNodeValue(aJ,"rainforest_saved");kY=getXMLNodeValue(aJ,"monthly_invites");lc=getXMLNodeValue(aJ,"monthly_rainforest_saved");ji=
parseInt(getXMLNodeValue(aJ,"cash"));m_acorns=parseInt(getXMLNodeValue(aJ,"acorns"));gP=getXMLNodeValue(aJ,"board_message");m_permissionToModify=getXMLNodeValue(aJ,"permission_to_modify");if(!isValid(
m_permissionToModify)){m_permissionToModify="0";}if(!isValid(gP)){gP=GP.DEFAULT_BOARD_MESSAGE;}var qY=parseInt(getXMLNodeValue(aJ,"num_plants"));var my=getXMLFirstNode(aJ,"plants");if(isValid(my)){aY=
new Array();dJ=new Array();var mx=my.getElementsByTagName("plant");for(var J=0;J<mx.length;J++){var du=new ReceivedPlant(mx[J]);if(du.getIsOnPatch()=="true"){aY.push(du);}else{dJ.push(du);}}}var mS=
getXMLFirstNode(aJ,"events");iF=new Array();if(isValid(mS)){var mT=mS.getElementsByTagName("eventId");for(var J=0;J<mT.length;J++){iF.push(mT[J].firstChild.nodeValue);}}var ik=getXMLFirstNode(aJ,
"handledEvents");if(isValid(ik)){dT=new Array();var mh=ik.getElementsByTagName("eventId");var pI=ik.getElementsByTagName("handledBy");var oS=ik.getElementsByTagName("thumbnailUrl");var oN=
ik.getElementsByTagName("displayName");for(var J=0;J<mh.length;J++){dT.push(new HandledEvent(mh[J].firstChild.nodeValue,pI[J].firstChild.nodeValue,oS[J].firstChild.nodeValue,decodeURIComponent(
oN[J].firstChild.nodeValue)));}}var mI=getXMLFirstNode(aJ,"totalPatchEvents");if(isValid(mI)){la=mI.firstChild.nodeValue;}var l_patchEdit=getXMLFirstNode(aJ,"latest_edit");if(isValid(l_patchEdit)){
var l_editedById=getXMLNodeValue(l_patchEdit,"edited_by_id");var l_editedByThumbnail=getXMLNodeValue(l_patchEdit,"edited_by_thumbnail");var l_editedByDisplayName=getXMLEncodedStringNodeValue(
l_patchEdit,"edited_by_display_name");m_latestEdit=new HandledEdit(l_editedById,l_editedByThumbnail,l_editedByDisplayName);}lN=getXMLNodeValue(aJ,"welcomed");}catch(err){outputDebug(
"fillSpecificInfoFromXML "+err);}};function constructParamForReq(){var v={};v.user_id=cv;if(isValid(ea))v.thumbnail_url=ea;if(isValid(dG))v.profile_url=dG;if(isValid(bt))v.display_name=customEncoding(
bt);if(isValid(gH))v.age=gH;if(isValid(eZ))v.gender=eZ;if(isValid(jc))v.city=customEncoding(jc);if(isValid(hR))v.region=customEncoding(hR);if(isValid(iC))v.postalCode=iC;return v;};function saveUser(
ou,lz){if(!isValid(cv)){var pK=gadgets.views.getParams();cv=pK["viewerid"];}var v=constructParamForReq();v.include_counts="true";v.include_top="true";v.include_top_friends="true";v.include_plants=
"true";v.viewer_id=MAIN_DATA.getViewer().getUserId();v.owner_id=v.viewer_id;if(isValid(GP.DETAIL_USER_ID)){v.owner_id=GP.DETAIL_USER_ID;}if(!isValid(GP.RAINFOREST_SAVED_YESTERDAY)){
v.include_yesterday_rainforest="true";}if(isValid(GP.DETAIL_USER_ID)){v.include_detailed_user_id=GP.DETAIL_USER_ID;}if(isValid(lz)&&lz){v.sign_in="true";}makeXMLNotCachedRequest(
REQUEST_DESTINATION_URL+"/green/getinfo",ou,v,true);};function getHasAppInstalled(){return ja;};function setHasAppInstalled(nn){ja=nn;};function getUserId(){return cv;};function setUserId(ao){cv=ao;};
function getGender(){return eZ;};function getAppUser(){return pl;};function getAge(){return gH;};function getThumbnailUrl(){return ea;};function setThumbnailUrl(qN){ea=qN;};function getName(){
return bt;};function setName(dS){bt=dS;};function getShortName(){return shortenedStringKeepEscapedCharacters(bt,10);};function getProfileUrl(){return dG;};function setProfileUrl(ko){dG=ko;};
function getRegion(){return hR;};function output(){outputDebug("userId: "+cv);outputDebug("name: "+bt);outputDebug("gender: "+eZ);};function getSavedRainForestAmount(){return kF;};
function getNumInvites(){return kY;};function getSavedMonthlyRainforestAmount(){return lc;};function getCash(){return ji;};function getAcorns(){return m_acorns;};function setCash(nm){ji=nm;};
function setAcorns(a_acorns){m_acorns=a_acorns;};function getPatchPlants(){return aY;};function getShedPlants(){return dJ;};function getPatchEvents(){return iF;};function getDismissedWelcome(){
return lN;};function getBoardMessage(){return gP;};function setBoardMessage(nR){gP=nR;};function getPermissionToModify(){return m_permissionToModify;};var lo=false;var ln=false;this.getDisplayName=
getDisplayName;this.getField=getField;this.getId=getId;this.isOwner=isOwner;this.setIsOwner=setIsOwner;this.isViewer=isViewer;this.setIsViewer=setIsViewer;function getDisplayName(){return bt;};
function getField(ky){switch(ky){case opensocial.Person.Field.ID:return cv;case opensocial.Person.Field.NAME:return bt;case opensocial.Person.Field.AGE:return gH;case opensocial.Person.Field.GENDER:
return eZ;case opensocial.Person.Field.THUMBNAIL_URL:return ea;case opensocial.Person.Field.PROFILE_URL:return dG;}return undefined;};function getId(){return cv;};function isOwner(){return lo;};
function setIsOwner(oe){lo=oe;};function isViewer(){return ln;};function setIsViewer(of){ln=of;};User.prototype.fillUserStateFromXML=function(ki){this.hu=isValid(getXMLNodeValue(ki,"has_app"));
this.kU=isValid(getXMLNodeValue(ki,"already_invited"));this.lm=isValid(getXMLNodeValue(ki,"invite_blocked"));this.qp=true;};User.prototype.getHasApp=function(){return this.hu};
User.prototype.getHasAppFromCache=function(){if(!isValid(GP.VIEWER_FRIEND_APPUSERS_CACHE))return this.hu;this.hu=GP.VIEWER_FRIEND_APPUSERS_CACHE.hasUserId(this.getUserId());return this.hu;};
User.prototype.getAlreadyInvited=function(){return this.kU;};User.prototype.setAlreadyInvited=function(nD){this.kU=nD;};User.prototype.getInviteBlocked=function(){return this.lm;};
User.prototype.setInviteBlocked=function(){this.lm=true;};User.prototype.hasInviteState=function(){return this.qp;}};CachedUserList.GLOBAL=1;CachedUserList.MY_TOP_FRIENDS=2;
CachedUserList.GLOBAL_MONTHLY=3;CachedUserList.RECRUITERS_MONTHLY=4;CachedUserList.getUserTypeName=function(gL){switch(gL){case CachedUserList.GLOBAL:return "Everywhere (all time)";
case CachedUserList.MY_TOP_FRIENDS:return "Among Your Friends (all time)";case CachedUserList.GLOBAL_MONTHLY:return "Everywhere ("+getCurrentMonthName()+")";case CachedUserList.RECRUITERS_MONTHLY:
return "Top Recruiters ("+getCurrentMonthName()+")";default:outputAlert("Unrecognized category code "+gL);return undefined;}};function CachedUserList(ku,bk){var mL=bk;var cS=ku;var bc=undefined;var P=
new Array();var bx=new Object();this.getRandomUserId=getRandomUserId;this.setTotalNumUsers=setTotalNumUsers;this.addUser=addUser;this.invalidateCache=invalidateCache;var cX=undefined;this.getNumUsers=
getNumUsers;this.onLoadNumUsers=onLoadNumUsers;var cL=undefined;this.getUsers=getUsers;this.onLoadUsers=onLoadUsers;this.getUserById=getUserById;this.getUsersById=getUsersById;
function setTotalNumUsers(qR){bc=qR;};function addUser(M){P.push(M);bx[M.getUserId()]=M;};function getRandomUserId(){if(P.length<3)return-1;var J=Math.min(Math.floor(Math.random()*P.length),P.length-
1);return P[J].getUserId();};function invalidateCache(){outputDebug("invalidate user cache");bc=undefined;P=new Array();bx=new Object();};function getNumUsers(eK){if(bc!=undefined){eK(bc);return;}cX=
eK;makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/gp/getnumuserinfo?user_id="+cS.getUserId()+getActionURI(mL),onLoadNumUsers);};function onLoadNumUsers(cp){var ad=getGadgetResponseData(cp);if(ad!=
undefined){try{bc=getXMLNodeValue(ad,"num");}catch(err){outputAlert(err);}}if(isValidFunction(cX)){var aR=cX;cX=undefined;aR(bc);}};function getUsers(bL,eU,fZ){if(P.length>=bc||P.length>=(bL+eU-1)){
fZ(P);return;}var mo=Math.min(P.length,bL);var pE=(bL+eU)-mo;cL=fZ;makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/gp/getuserinfo?start="+mo+"&num="+pE+"&user_id="+cS.getUserId()+getActionURI(mL),
onLoadUsers);};function onLoadUsers(requestData){var ad=getGadgetResponseData(requestData);if(ad!=undefined){var dR=ad.getElementsByTagName("user");if(isValid(dR)&&dR.length>0){for(var J=0;J<
dR.length;J++){var gW=new User(undefined);gW.createXMLUser(dR[J]);P.push(gW);bx[gW.getUserId()]=gW;}}}if(isValidFunction(cL)){var aR=cL;cL=undefined;aR(P);}};function getUserById(aC){return bx[aC];};
function getUsersById(dk){var gb=new Array();for(var A;A<dk.length;A++){gb.push(bx[dk[A]]);}return gb;};function getActionURI(gL){switch(gL){case CachedUserList.GLOBAL:return "&action=query_top";
case CachedUserList.MY_TOP_FRIENDS:return "&action=query_top_friends";case CachedUserList.GLOBAL_MONTHLY:return "&action=query_top_monthly";default:outputAlert("Unrecognized category code "+gL);
return undefined;}}};function ViewerFriendsCacheData(og,ah){ViewerFriendsCacheData.baseConstructor.call(this,[]);this.gp=false;og.getTotalUsers(ah,this.doneHandler.bind(this),this.partialHandler.bind(
this));this.lp=0;};extendClass(ViewerFriendsCacheData,ArrayData);ViewerFriendsCacheData.prototype.doneHandler=function(bn){this.gp=true;this.sendTriggers(bn);};
ViewerFriendsCacheData.prototype.partialHandler=function(bn){this.sendTriggers(bn);};ViewerFriendsCacheData.prototype.sendTriggers=function(bn){this.gB=isValid(bn)?bn:[];this.triggerCount();
this.triggerUpdate(this.lp,bn.length);this.lp=bn.length;};ViewerFriendsCacheData.prototype.getCurCount=function(){return this.gB.length;};ViewerFriendsCacheData.prototype.countDone=
ViewerFriendsCacheData.prototype.dataDone=function(){return this.gp;};ViewerFriendsCacheData.prototype.getCurData=function(H,G){return this.gB.slice(H,G)};function CachedOSFriendList(ku){var cS=ku;
var bc=undefined;var P=new Array();var bx=new Object();this.invalidateCache=invalidateCache;var cX=undefined;this.getNumUsers=getNumUsers;var cL=undefined;this.getUsers=getUsers;this.getUserById=
getUserById;this.getUsersById=getUsersById;function invalidateCache(){outputDebug("invalidate CachedOSFriendList cache");bc=undefined;P=new Array();bx=new Object();};function getNumUsers(eK){
outputDebug("CachedOSFriendList: getNumUsers");eK(P.length);return;if(isValid(bc)){eK(bc);return;}cX=eK;var aI={};aI[opensocial.DataRequest.PeopleRequestFields.FIRST]=1;
aI[opensocial.DataRequest.PeopleRequestFields.MAX]=20;var aP=opensocial.newDataRequest();aP.add(aP.newFetchPeopleRequest(idSpecUtil.viewerFriends(),{}),'numFriends');aP.send(onGetNumUsers);};
function onGetNumUsers(O){outputDebug("CachedOSFriendList: onGetNumUsers");try{bc=parseInt(O.get('numFriends').getData().getTotalSize());}catch(err){bc=undefined;outputDebug(err);}outputDebug(
"Number of users: "+bc);P=new Array();for(var J=0;J<bc;J++){P.push(undefined);}if(isValidFunction(cX)){var aR=cX;cX=undefined;aR(bc);}};function getUsers(bL,eU,fZ){outputDebug(
"CachedOSFriendList: getUsers start "+bL+" num "+eU);if(eU%20!=0){outputAlert("Can only handle indices in multiples of 40, since myspace pages friends");}var ii=bL+eU;outputDebug("ii: "+ii);var eo=
false;if(P.length>=ii){eo=true;for(var J=bL;eo&&J<ii;J++){eo=isValid(P[J]);}}outputDebug("eo: "+eo);if(eo){fZ(P);}else{cL=fZ;getOSUsers(bL);}};function getOSUsers(bL){outputDebug("getOSUsers: "+bL);
var aI={};aI[opensocial.DataRequest.PeopleRequestFields.FIRST]=bL;aI[opensocial.DataRequest.PeopleRequestFields.MAX]=20;var aP=opensocial.newDataRequest();aP.add(aP.newFetchPeopleRequest(
idSpecUtil.viewerFriends(),aI),'viewerFriends');aP.send(function(dg){onLoadFriends(bL,dg);});};function onLoadFriends(kZ,dg){outputDebug("onLoadFriends: "+kZ);var dH=false;var kT=kZ;try{var ms=dg.get(
'viewerFriends').getData();if(isValid(ms)){dH=true;ms.each(function(ke){var jH=new User(ke);P[kT]=jH;bx[jH.getUserId()]=jH;kT+=1;});}}catch(err){dH=false;outputDebug("onLoadFriends "+err);}if(!dH){
outputDebug("Getting OS Users failed, should I retry?");}if(isValidFunction(cL)){var aR=cL;cL=undefined;aR(P);}};function getUserById(id){return bx[id];};function getUsersById(dk){var gb=new Array();
for(var A=0;A<dk.length;A++){gb.push(bx[dk[A]]);}return gb;}};function CentralData(hO,oh){var lj=oh;var bH=undefined;var cS=undefined;var gu=undefined;var kD=undefined;var je=undefined;var gy=
undefined;var jd=undefined;var jg=undefined;var nj=undefined;this.createUsers=createUsers;this.onLoadUsers=onLoadUsers;this.isInit=isInit;this.getOwner=getOwner;this.getViewer=getViewer;
this.getDetailedUser=getDetailedUser;this.getCachedViewerFriends=getCachedViewerFriends;this.getCachedUsers=getCachedUsers;this.getRandomFriendId=getRandomFriendId;this.getSignin=getSignin;
createUsers();function createUsers(){outputDebug("loadUsers");kD=new CachedOSFriendList(bH);if(isValid(hO)){hO.getTextDiv().innerHTML=
"<span style='font-weight:bold;'> Loading user information from MySpace... </span> <br> <span style='font-size:10px;'>(If this takes too long, please try refreshing the page.) </span>";}var aP=
opensocial.newDataRequest();var aI={};aI[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]=[opensocial.Person.Field.ID,opensocial.Person.Field.NAME,opensocial.Person.Field.THUMBNAIL_URL,
opensocial.Person.Field.AGE,opensocial.Person.Field.GENDER,opensocial.Person.Field.CURRENT_LOCATION];aP.add(aP.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER,aI),'viewer');aP.add(
aP.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER,aI),'owner');aP.send(onLoadUsers);};function onLoadUsers(dg){outputDebug("load user called");if(isValid(hO)){hO.getTextDiv().innerHTML=
"<span style='font-weight:bold;'> Loading your Green Garden Information... </span> <br> <span style='font-size:10px;'>(Please don't refresh unless this takes longer than 30 seconds.) </span>";}try{
var pA=dg.get('owner').getData();cS=new User(pA);cS.setIsOwner(true);}catch(err){outputDebug(err);cS=null;}try{var pi=dg.get('viewer').getData();bH=new User(pi);bH.setIsViewer(true);bH.saveUser(
onSaveUser,true);}catch(err){outputDebug(err);bH=null;}};function onSaveUser(O){outputDebug("Response: "+O);gy=new CachedUserList(bH,CachedUserList.MY_TOP_FRIENDS);je=new CachedUserList(bH,
CachedUserList.GLOBAL);jd=new CachedUserList(bH,CachedUserList.GLOBAL_MONTHLY);jg=new CachedUserList(bH,CachedUserList.RECRUITERS_MONTHLY);var pp=getGadgetResponseData(O);
handleSingleLoadInitialization(pp);};function getRandomFriendId(){if(isValid(gy)){return gy.getRandomUserId();}return null;};function handleSingleLoadInitialization(bO){var kN=getXMLFirstNode(bO,
"viewer");if(isValid(kN)){var kM=getXMLFirstNode(kN,"user");if(isValid(kM)){bH.fillSpecificInfoFromXML(kM);}}var kj=getXMLFirstNode(bO,"detailed_user");if(isValid(kj)||isValid(GP.DETAIL_USER_ID)){gu=
new User(undefined);outputDebug("About to createXML Detailed user");if(kj){gu.createXMLUser(kj);}else{if(isValid(GP.DETAIL_DISPLAY_NAME)){gu.setName(GP.DETAIL_DISPLAY_NAME);}if(isValid(
GP.DETAIL_THUMBNAIL_URL)){gu.setThumbnailUrl(GP.DETAIL_THUMBNAIL_URL);}}}nj=getXMLNodeValue(bO,"sign_in");initializeUsers(bO,je,"num_top","top");initializeUsers(bO,gy,"num_top_friends","top_friends");
initializeUsers(bO,jd,"num_monthly_top","monthly_top");initializeUsers(bO,jg,"num_recruiters_top","recruiters_top");var kH=getXMLNodeValue(bO,"yesterday_rainforest");if(isValid(kH)){
GP.RAINFOREST_SAVED_YESTERDAY=kH;outputDebug("Setting rainforest: "+GP.RAINFOREST_SAVED_YESTERDAY);if(id("rainforest_saved_yesterday")){id("rainforest_saved_yesterday").innerHTML="<div id='topbar'>"+
"<img src='http://cdn0.mobwarsapp.com/prod_green/images/ui/logofull.gif'>"+"<span id='totalsaved'> We saved "+GP.RAINFOREST_SAVED_YESTERDAY+" sq ft </span>"+
"<span id='totalsaved2'> of rainforest yesterday! </span>";}}if(isValidFunction(lj)){lj();}};function initializeUsers(bO,mH,os,lE){var eW= -1;try{eW=parseInt(getXMLNodeValue(bO,os));}catch(err){eW= -
1;}outputDebug("For type: "+lE+" num users: "+eW);if(eW>0){mH.setTotalNumUsers(eW);}var ni=getXMLFirstNode(bO,lE);if(eW>0&&isValid(ni)){var nk=ni.getElementsByTagName("user");for(var J=0;J<nk.length;
J++){var av=new User(undefined);av.createXMLUser(nk[J]);mH.addUser(av);}}};function getOwner(){return cS;};function getViewer(){return bH;};function getSignin(){return nj;};function getDetailedUser(){
return gu;};function getCachedViewerFriends(){return kD;};function isInit(){return(cS!=undefined||bH!=undefined);};function getCachedUsers(bk){switch(bk){case CachedUserList.MY_TOP_FRIENDS:return gy;
case CachedUserList.GLOBAL:return je;case CachedUserList.GLOBAL_MONTHLY:return jd;case CachedUserList.RECRUITERS_MONTHLY:return jg;}return undefined;}};function ViewerFriendsCache(dm){var dU=isValid(
dm)?dm:{};var bY=undefined;var P=new Array();var bx={};var iw=20;this.getNumCachedUsers=getNumCachedUsers;this.getCachedUsers=getCachedUsers;this.getUserById=getUserById;this.getUsersById=
getUsersById;this.hasUserId=hasUserId;var fl=undefined;var ep=undefined;var ix=undefined;this.getTotalUsers=getTotalUsers;getTotalUsers(1000,function(){});function getNumCachedUsers(){return P.length;
};function getCachedUsers(){return P;};function getUserById(aC){return bx[aC];};function getUsersById(dk){var dR=new Array();for(var A=0;A<dk.length;A++){dR.push(getUserById(dk[A]));}return dR;};
function hasUserId(aC){return isValid(bx[aC]);};function getTotalUsers(lS,F,nI){outputDebug("ViewerFriendsCache getTotalUsers");if(P.length>=lS||(isValid(bY)&&P.length>=bY)){F(P);return;}ep=lS;fl=F;
ix=nI;onGetSomeUsers(P.length);};function onGetSomeUsers(rn){if(P.length>=ep){outputDebug("OnGetSomeUsers finished");var aR=fl;fl=undefined;ep=undefined;aR(P);}else{queryForMoreUsers();}};
function queryForMoreUsers(){outputDebug("ViewerFriendsCache: queryForMoreUsers");var aI={};for(var i in dU)aI[i]=dU[i];aI[opensocial.DataRequest.PeopleRequestFields.FIRST]=P.length+1;
aI[opensocial.DataRequest.PeopleRequestFields.MAX]=iw;var aP=opensocial.newDataRequest();aP.add(aP.newFetchPeopleRequest(idSpecUtil.viewerFriends(),aI),'viewerFriends');aP.send(onLoadMoreUsers);};
function onLoadMoreUsers(dg){var dH=false;var jQ=false;try{var kL=dg.get('viewerFriends').getData();kL.each(function(ke){dH=true;var av=new User(ke);P.push(av);bx[av.getUserId()]=av;});var ps=kL.size(
);if(ps<iw){bY=P.length;jQ=true;}else{bY=P.length+1;jQ=false;}}catch(err){dH=false;outputDebug(err);}ep=Math.min(ep,bY);outputDebug("Current num cached: "+P.length+" upperLimit: "+ep);if(ix)ix(P);if(
dH&& !jQ){setTimeout(queryForMoreUsers,100);}else{if(isValidFunction(fl)){var aR=fl;fl=undefined;aR(P);}}}};function getAppUsersCache(){var aI={};aI[opensocial.DataRequest.PeopleRequestFields.FILTER]=
opensocial.DataRequest.FilterType.HAS_APP;return new ViewerFriendsCache(aI);};function InviteDiv(D,kz,jB,fC){var g=D;var gT=kz;var cy=jB;var jo=fC;var gN=undefined;if(g!=undefined){createDiv(g);}
function createDiv(_parentDiv){g=_parentDiv;outputDebug("InviteDiv: createDiv");gN=document.createElement("div");g.appendChild(gN);var aw=document.createElement("div");gN.appendChild(aw);
aw.style.padding="5px 5px 5px 5px";aw.style.textAlign="CENTER";aw.style.fontSize="18px";aw.style.fontWeight="bold";aw.style.textAlign="CENTER";if(cy==undefined){aw.innerHTML=
"<span style='font-size: 20px; font-weight:700;'>Think this is fun? Invite your friends!</span>";}else{var hW=
"%3Ca+style%3D%22font-size%3A140%25%3B%22+href%3D%22http%3A%2F%2Fprofile.myspace.com%2FModules%2FApplications%2FPages%2FCanvas.aspx%3Fid%3D104107%22%3E";var jA=jo;var rg=
"<a href='http://www.myspace.com/Modules/PostTo/Pages/?l=2&t=Check+out+this+Pic%21&c=<b><font+size=%273%27>I%27ve+just+sent+you+a+Bumper+Sticker%21+"+hW+
"Click+here</a>+to+see+more+funny+stickers+and+send+me+one+back%21<br><br>"+hW+"<img+src=%27"+jA+"%27></a><br><br>["+hW+"See+more+stickers</a>+|+"+hW+
"++Share+this+sticker!</a>]</font></b>' target='_new'>";aw.innerHTML="<table border='0'><tr><td class='browseSticker' width='150'><img src='"+cy+"' width='150' /></td>"+
"<td><div style='padding: 10 10 10 20;'> "+
"Your friends displayed below have not installed Bumper Stickers yet! <b>In order for them to view the bumper sticker you've shared with them, you will have to leave it for them in a comment</b> -- after they get your comment and install this app, all the stickers you send them will automatically show up on their profile!"+
"</div></td> </tr> </table>";}var kt=document.createElement("div");if(cy==undefined){gN.appendChild(kt);kt.className="inviteLinkBox";fillCustomLinkDiv(kt);}if(cy==undefined){}else{var ie=
document.createElement("div");gN.appendChild(ie);ie.className="inviteLinkBox";var V=document.createElement("div");ie.appendChild(V);V.className="inviteInstructionBox";V.innerHTML=
"<span style='font-size:20px; font-weight:700;'>To post this pic to a friend's comments, just click on their picture below and then click 'Add' on the next page!</span>";new InviteFriendsDiv(ie,gT,cy,
jo);}goToPageTop();};function fillCustomLinkDiv(lT){outputDebug("InviteDiv: fillCustomLink");var aw=document.createElement("div");aw.className="inviteInstructionBox";lT.appendChild(aw);if(cy==
undefined){aw.innerHTML=
"<span style='font-size:18px; font-weight:700;'> Invite all your friends with a Bulletin!</span> <br><br>1. Click \"Send Bulletin!\" below.<br> 2. Hit the \"Post\" button. <br> 3. That's it! ";}else{
aw.innerHTML="<span style='font-size:14px; font-weight:700;'> Send this sticker to all your friends with a Bulletin! </span>";}var hi=document.createElement("div");lT.appendChild(hi);hi.style.margin=
"0px 0px 0px 10px";hi.style.textAlign="CENTER";var hh=document.createElement("table");hi.appendChild(hh);hh.style.borderSpacing="2px";hh.style.border="none";var md=document.createElement("tbody");
hh.appendChild(md);var dv=document.createElement("tr");md.appendChild(dv);if(cy!=undefined){var gz=document.createElement("td");gz.width="400";dv.appendChild(gz);gz.style.verticalAlign="TOP";var eu=
document.createElement("input");gz.appendChild(eu);eu.type="TEXT";addEvent(eu,"click",function(){eu.select();});eu.style.width="400px";if(cy==undefined){}else{eu.value=
"<b><font size='3'>I've just sent you a Bumper Sticker! <a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','link1','invite','v1')+
"'>Click here</a> to see more funny stickers and send me one back!</br><a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','img1','invite','v1')+"'><img src=\""+fC+"\"></a></br>[ <a href='"+
BMPSTCKRS_appendTracking(APP_URL,'bulletin','link2','invite','v1')+"'>See more stickers</a> | <a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','link3','invite','v1')+
"'>  Share this sticker!</a> ]</font></b>";}var bW=document.createElement("div");gz.appendChild(bW);bW.style.margin="5px 5px 5px 5px";bW.style.padding="5px 5px 5px 5px";bW.style.backgroundColor=
"#d8dfea";bW.style.fontSize="11px";if(cy==undefined){}else{bW.innerHTML=
"Stick your friends with this bumper sticker by sending them the message in this text box! Click in the text box and press ctrl+C to copy and paste the message."}}var jV=document.createElement("td");
dv.appendChild(jV);jV.style.verticalAlign="middle";var ra=new BigButton(jV,"Send Bulletin!",function(){var jA="http://cdn6.bumperstickersapp.com/bs/big.6739611453135640576.jpg";postToBulletin(
MAIN_DATA.getViewer(),"Check out these pics! ;-)","<font size='3'>I've just shared this Bumper Sticker! <a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','link1','invite','v1')+
"'>Click here</a> to see more funny stickers and send me one back!<br><br><a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','img1','invite','v1')+"'><img src='"+jA+"'></a><br><br>[<a href='"+
BMPSTCKRS_appendTracking(APP_URL,'bulletin','link2','invite','v1')+"'>See more stickers</a> | <a href='"+BMPSTCKRS_appendTracking(APP_URL,'bulletin','link3','invite','v1')+
"'> Share this sticker!</a>]</font></b>");});}};function InviteFriendsDiv(D,kz,jB,fC){var g=D;var eJ=null;var rm="mailto:?subject="+escape("hey")+"&body="+escape("boo");var gT=kz;var cy=jB;var jo=fC;
this.createDiv=createDiv;if(g!=undefined){createDiv(g);}function createDiv(_parentDiv){g=_parentDiv;outputDebug("InviteFriendsDiv: createDiv");eJ=document.createElement("div");g.appendChild(eJ);
eJ.style.height="500px";eJ.style.overflow="auto";var ic=document.createElement("table");ic.style.borderSpacing="2px";ic.style.border="none";var kv=document.createElement("tbody");ic.appendChild(kv);
var dv=document.createElement("tr");kv.appendChild(dv);var kr=0;outputDebug("num invite users: "+gT.length);outputDebug("appendTable");eJ.innerHTML="";eJ.appendChild(ic);for(var J=0;J<gT.length;J++){
var friend=gT[J];if(kr>=5){dv=document.createElement("tr");kv.appendChild(dv);kr=0;}dv.appendChild(createInviteFriendTd(friend.getUserId(),friend.getName(),friend.getThumbnailUrl(),friend));kr+=1;}};
function createInviteFriendTd(hK,kx,jY,aB){outputDebug("createInviteFriendTd");var k=document.createElement("td");k.className="pickFriend";k.align="CENTER";k.appendChild(
createInviteFriendOptionsTable(hK,kx,jY,aB));return k;};function createInviteFriendOptionsTable(hK,kx,jY,aB){outputDebug("createInviteFriendOptionsTable");var ib=document.createElement("table");
ib.style.borderSpacing="2px";ib.style.border="none";var mk=document.createElement("tbody");ib.appendChild(mk);var kW=document.createElement("tr");mk.appendChild(kW);var hg=document.createElement("td")
;hg.style.verticalAlign="TOP";kW.appendChild(hg);var fB=kx;if(isValid(fB)){if(fB.length>13)fB=fB.substring(0,12)+"..";}hg.innerHTML=
"<div class='friendImage'><a href='#' onclick='return false;'><img src='"+jY+"' width='80' height='80'/></a><br/> <span style='font-size:11px;'>"+fB+"</span></img>";addEvent(hg,"click",function(){
sendComment(aB,"<b><font size='3'>I've just sent you a Bumper Sticker! <a href='"+APP_URL+"'>Click here</a> to see more funny stickers and send me one back!<br><br><a href='"+APP_URL+"'><img src=\""+
fC+"\"></a><br><br>[ <a href='"+APP_URL+"'>See more stickers</a> | <a href='"+APP_URL+"'>  Share this sticker!</a> ]</font></b>")});return ib;}}var MYPATCH;var OTHERPATCH;function init(){outputDebug(
"init called");try{_uacct="UA-4182330-16";urchinTracker();}catch(err){}if(isDebugging()){gadgets.window.adjustHeight(5200);}else{gadgets.window.adjustHeight(3000);}var v=gadgets.views.getParams();for(
var aa in v){outputDebug(aa+" >>> "+v[aa]);}try{var pV=v["installState"];switch(pV){case "0":GP.app_install_state=GP.APP_NOT_INSTALLED;break;case "1":GP.app_install_state=GP.APP_INSTALLED;break;
case "2":GP.app_install_state=GP.APP_JUST_INSTALLED;break;default:GP.app_install_state=GP.APP_INSTALLED;break;}}catch(err){GP.app_install_state=GP.APP_INSTALLED;}GP.DETAIL_USER_ID=
getOpenSocialParameter("showDetailedUserId");GP.DETAIL_DISPLAY_NAME=decodeURIComponent(getOpenSocialParameter("detailedDisplayName"));GP.DETAIL_THUMBNAIL_URL=getOpenSocialParameter(
"detailedThumbnailUrl");GP.IS_MY_OFFERPAL_WINDOW=getOpenSocialParameter("offer_pal");GP.INITIAL_TAB=getOpenSocialParameter("initialTab");if(GP.app_install_state==GP.APP_NOT_INSTALLED){outputDebug(
"show not installed message");showNotInstalledMessage();}else{makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/green/getgifts",onLoadGifts);}};function onLoadGifts(O){var pQ=
new CenteredTextMessageDiv(document.getElementById("mainFrame"),"","300px");var ha=getGadgetResponseData(O);$(ha).find("gift").each(function(){var ml=new Gift();ml.fillInfoFromXml($(this));
GP.GIFTS[ml.getId()]=ml;GP.ORDERED_GIFTS.push(ml);});MAIN_DATA=new CentralData(pQ,createUI);outputDebug("creating central data "+GP.VIEWER_FRIEND_CACHE);if(!isValid(GP.VIEWER_FRIEND_CACHE)){
outputDebug("before app users cache");GP.VIEWER_FRIEND_APPUSERS_CACHE=getAppUsersCache();outputDebug("after app users cache");GP.VIEWER_FRIEND_APPUSERS_CACHE.getTotalUsers(1000,function(){outputDebug(
"before viewer friends cache");GP.VIEWER_FRIEND_CACHE=new ViewerFriendsCache();outputDebug("creating new viewer friends cache");});}};function showNotInstalledMessage(){var jE=document.getElementById(
"mainFrame");var ey=document.createElement("img");jE.appendChild(ey);ey.src="http://65.19.191.134/opensocial_test/bumperstickers/images/preview/up_arrow.png";ey.style.position="absolute";ey.style.top=
"0px";ey.style.left="355px";ey.style.zIndex=0;var V=document.createElement("div");jE.appendChild(V);V.style.textAlign="center";V.style.backgroundColor="#FFFFFF";V.style.padding="10px";
V.style.fontSize="18px";V.style.borderColor="black";V.style.borderStyle="solid";V.style.borderWidth="4px";V.style.position="absolute";V.style.top="110px";V.style.left="220px";V.style.zIndex=0;
V.innerHTML="You must add this application to continue!";var eB=document.createElement("img");jE.appendChild(eB);eB.src="http://cdn0.mobwarsapp.com/prod_green/images/promotional/profile.jpg";
eB.style.position="absolute";eB.style.top="200px";eB.style.left="220px";eB.style.zIndex=0;try{requestBasicViewer();}catch(e){consoleDebug(e);}return false;};function createUI(){var jW=
document.getElementById("mainFrame");jW.innerHTML="";GP.VIEWER_STATUS=new GreenStatusDiv(jW);var de=new Array();de.push("Send Gifts");de.push("Your Garden");de.push("Greenest People");de.push(
"Green Store");de.push("FAQ/About");if(isValid(MAIN_DATA.getDetailedUser())){if(isValid(GP.DETAIL_DISPLAY_NAME)&&(!isValid((MAIN_DATA.getDetailedUser().getDisplayName()))||(MAIN_DATA.getDetailedUser()
.getDisplayName()).length<1)){MAIN_DATA.getDetailedUser().setName(GP.DETAIL_DISPLAY_NAME);}if(isValid(GP.DETAIL_THUMBNAIL_URL)&&(!isValid(MAIN_DATA.getDetailedUser().getThumbnailUrl())||
MAIN_DATA.getDetailedUser().length<1)){MAIN_DATA.getDetailedUser().setThumbnailUrl(GP.DETAIL_THUMBNAIL_URL);}}GP.IS_MY_OFFERPAL_DEFAULT_TAB=GP.IS_MY_OFFERPAL_WINDOW;GP.IS_MY_OFFERPAL_WINDOW="true";if(
isValid(MAIN_DATA.getDetailedUser())){de.push(MAIN_DATA.getDetailedUser().getShortName());}var cZ=new Array();cZ.push(toSendGreenTab);cZ.push(toYourPatchTab);cZ.push(toGreenLeaderboard);cZ.push(
toGreenStore);cZ.push(toFAQTab);if(isValid(MAIN_DATA.getDetailedUser())||isValid(GP.DETAIL_DISPLAY_NAME)){cZ.push(toUserDetailsTab);}var dx=new Array();dx.push("left");dx.push("left");dx.push("left");
dx.push("left");dx.push("right");if(isValid(MAIN_DATA.getDetailedUser())){dx.push("left");}var hV=0;var lZ=GP.INITIAL_TAB;if(isValid(lZ)){hV=lZ;}if(isValid(GP.DETAIL_USER_ID)){hV=5;}GP.MAIN_TABS=
new TabsDiv(jW,de,cZ,dx,hV,"unSelectedTab","selectedTab");if(MAIN_DATA&&MAIN_DATA.getViewer().getDismissedWelcome()=="false"){modalPopup(
"<img src='http://cdn0.mobwarsapp.com/prod_green/images/ui/name.gif'><br>&nbsp;<br>"+"<div style='font-size: 12px; text-align: left;'>"+
"This game has a simple premise &mdash; the more plants and animals you and your friends grow in your Gardens, "+"the more we donate to save the planet!<br>&nbsp;<br>"+
"You can grow more plants and animals in your garden by:<br><ol>"+"<li>By having friends send them to you! "+
"<a href='#' onclick='dismissModalPopup(); GP.MAIN_TABS.switchToTab(0);'>Send them gifts</a> to get gifts back.</li>"+
"<li>By buying them from the <a href='#' onclick='dismissModalPopup(); GP.MAIN_TABS.switchToTab(3);'>Green Store</a> using greenbucks.</li>"+"</ol><br>"+"You can earn greenbucks in 3 ways:<br><ol>"+
"<li>By receiving your daily login bonus of 20 greenbucks.<br>(We've already given you your first $20 bonus!)</li>"+
"<li>By tending <a href='#' onclick='dismissModalPopup(); GP.MAIN_TABS.switchToTab(1);'>gardens</a> &mdash; both your friends' and your own!<br>"+
"Tending gardens requires you to use gardening supplies like rakes, gloves, and watering cans, "+
"which can also be purchased from the <a href='#' onclick='dismissModalPopup(); GP.MAIN_TABS.switchToTab(3);'>Green Store</a>.</li>"+
"<li>By selling flowers you no longer want on your garden.<br>Click on a flower to sell it!</li>"+"</ol></div>",{Ok:null,"Don't show this anymore":dismissWelcomeMessage});}};
function refreshAdvertisement(){var refreshTime=90000;try{sr_gof();}catch(e){}outputDebug('ad refreshed at ='+new Date());if(GP.REFRESH_AD){GP.REFRESH_AD=false;setTimeout(function(){GP.REFRESH_AD=
true;refreshAdvertisement();},refreshTime);}};function dismissWelcomeMessage(){var v={};v['user_id']=MAIN_DATA.getViewer().getUserId();makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+
"/green/dismisswelcome",function(){},v);};function toSendGreenTab(aA,bD){outputDebug("toSendGreenTab");if(!bD){aA.innerHTML="";new SeedSelectorDiv(aA);}};function toYourPatchTab(aA,bD){outputDebug(
"toYourPatchTab");if(!bD){aA.innerHTML="";MYPATCH=new GreenPatchDiv(aA,MAIN_DATA.getViewer(),false,false);}};function toGreenStore(aA,bD){outputAlert("toGreenLeaderBoard");if(!bD){aA.innerHTML="";
new GreenStoreDiv(aA,MAIN_DATA.getViewer());}};function toGreenLeaderboard(aA,bD){outputDebug("toGreenLeaderboard");if(!bD){aA.innerHTML="";var oW=new FetchUsersActionMap(
CachedUserList.GLOBAL_MONTHLY);new GreenLeaderBoardDiv(aA,oW);}};function toUserDetailsTab(aA,bD){outputDebug("toUserDetailsTab");if(!bD){aA.innerHTML="";OTHERPATCH=new GreenPatchDiv(aA,
MAIN_DATA.getDetailedUser(),false,true);}};function toFAQTab(aA,bD){outputDebug("toFAQTab");if(!bD){aA.innerHTML="";var l_faq="";l_faq+=
"<div style='padding-right: 140px;'><font size=\"3\"><b>The answer to your questions may be below. If you have a question or a problem with the app, please use the form in the \"Support\" tab rather than sending a MySpace message to the developer.</b></font></div>";
new FAQDiv(aA,"garden",l_faq);}};function FAQDiv(D,a_gameName,a_faqText){this.g=D;this.B=undefined;this.m_gameName=a_gameName;this.m_faqText=a_faqText;this.initialize();this.createDiv();};
FAQDiv.prototype.initialize=function(){};FAQDiv.prototype.createDiv=function(){this.B=makeElementClass("div",this.g,"faq");this.B.innerHTML=this.m_faqText;$(this.B).append(
"<div id='supportIFrameDiv'></div>");$("#supportIFrameDiv").css({'padding-top':'15px'});//@todo move to styles.js
this.showSupportIFrame();};FAQDiv.prototype.showSupportIFrame=function(){var game_name=this.m_gameName;var user_id=MAIN_DATA.getViewer().getId();var base_url=
'http://support-lb.myspacegamingapps.com/';var site=base_url+game_name+'/support_n?user_id='+user_id;$('#supportIFrameDiv').html("<iframe id='supportIFrame' frameborder='0' src ='"+site+"'></iframe>")
;$('#supportIFrame').css({
//@todo move to styles.js
"border":"none 0px","width":"800px","height":"1000px"});goToPageTop();};Gift.CURRENCY_TYPE={};Gift.CURRENCY_TYPE.GREENBUCKS=0;Gift.CURRENCY_TYPE.ACORNS=1;function Gift(){this.pY=undefined;this.bt=
undefined;this.m_rainforestCost=undefined;this.m_isBuyable=undefined;this.m_isSendable=undefined;this.m_isSellable=undefined;this.m_buyingCost=undefined;this.m_sellingCost=undefined;
this.m_sendingCost=undefined;this.m_currencyType=undefined;this.m_giftType=undefined;this.m_growingTime=undefined;this.m_homeImageFileName=undefined;this.m_isSprite=undefined;this.m_spriteOffset=
undefined;this.m_normalImageFileName=undefined;this.m_smallImageFileName=undefined;this.m_normalImageFileWidth=undefined;this.m_normalImageFileHeight=undefined;};Gift.prototype.getId=function(){
return this.pY;};Gift.prototype.getName=function(){return this.bt;};Gift.prototype.getRainforestCost=function(){return this.m_rainforestCost;};Gift.prototype.isBuyable=function(){
return this.m_isBuyable;};Gift.prototype.isSendable=function(){return this.m_isSendable;};Gift.prototype.isSellable=function(){return this.m_isSellable;};Gift.prototype.getBuyingCost=function(){
return this.m_buyingCost;};Gift.prototype.getSellingCost=function(){return this.m_sellingCost;};Gift.prototype.getSendingCost=function(){return this.m_sendingCost;};Gift.prototype.getCurrencyType=
function(){return this.m_currencyType;};Gift.prototype.getGiftType=function(){return this.m_giftType;};Gift.prototype.getGrowingTime=function(){return this.m_growingTime;};
Gift.prototype.getHomeImageFileName=function(){return this.m_homeImageFileName;};Gift.prototype.isSprite=function(){return this.m_isSprite;};Gift.prototype.getSpriteOffset=function(){
return this.m_spriteOffset;};Gift.prototype.getNormalImageFileName=function(){var l_normalImageFileName=this.m_normalImageFileName;if(IE6){var l_extension=l_normalImageFileName.indexOf(".png");if(
l_extension!= -1){l_normalImageFileName=l_normalImageFileName.substring(0,l_extension)+".gif";}}return l_normalImageFileName;};Gift.prototype.getNormalImageFileWidth=function(){
return this.m_normalImageFileWidth;};Gift.prototype.getNormalImageFileHeight=function(){return this.m_normalImageFileHeight;};Gift.prototype.getSmallImageFileName=function(){
return this.m_smallImageFileName;};Gift.prototype.getSpriteStyle=function(){var l_style=this.getGiftType();if(l_style!="board")l_style+=IE6_CLASS;return l_style;};Gift.isValidGiftId=function(a_giftId)
{if(a_giftId<0||a_giftId>=GP.GIFTS.length){return false;}return true;};Gift.isFauna=function(a_giftId){if(!Gift.isValidGiftId(a_giftId)){return false;}return(GP.GIFTS[a_giftId].getGiftType()=="fauna")
;};Gift.isFlora=function(a_giftId){if(!Gift.isValidGiftId(a_giftId)){return false;}return(GP.GIFTS[a_giftId].getGiftType()=="flora");};Gift.isBoard=function(a_giftId){if(!Gift.isValidGiftId(a_giftId))
{return false;}return(GP.GIFTS[a_giftId].getGiftType()=="board");};Gift.isDecor=function(a_giftId){if(!Gift.isValidGiftId(a_giftId)){return false;}return(GP.GIFTS[a_giftId].getGiftType()=="decor"||
GP.GIFTS[a_giftId].getGiftType()=="board");};Gift.prototype.fillInfoFromXml=function(a_giftXml){this.pY=$(a_giftXml).find("giftId").text();this.bt=$(a_giftXml).find("name").text();
this.m_rainforestCost=parseInt($(a_giftXml).find("rainforestCost").text());this.m_isSellable=$(a_giftXml).find("isSellable").text()=="true";this.m_isBuyable=$(a_giftXml).find("isBuyable").text()==
"true";this.m_isSendable=$(a_giftXml).find("isSendable").text()=="true";this.m_buyingCost=parseInt($(a_giftXml).find("buyingCost").text());this.m_sendingCost=parseInt($(a_giftXml).find("sendingCost")
.text());this.m_sellingCost=parseInt($(a_giftXml).find("sellingCost").text());this.m_currencyType=($(a_giftXml).find("currencyType").text()=="GREENBUCKS")?Gift.CURRENCY_TYPE.GREENBUCKS:
Gift.CURRENCY_TYPE.ACORNS;this.m_giftType=$(a_giftXml).find("giftType").text();this.m_growingTime=parseInt($(a_giftXml).find("growingTime").text());this.m_homeImageFileName=$(a_giftXml).find(
"homeImageFile").text();this.m_normalImageFileName=$(a_giftXml).find("normalImageFile").text();this.m_smallImageFileName=$(a_giftXml).find("smallImageFile").text()==""?undefined:$(a_giftXml).find(
"smallImageFile").text();this.m_isSprite=$(a_giftXml).find("isSprite").text()=="true";this.m_spriteOffset=parseInt($(a_giftXml).find("spriteOffset").text());this.m_normalImageFileWidth=parseInt($(
a_giftXml).find("normalImageFileWidth").text());this.m_normalImageFileHeight=parseInt($(a_giftXml).find("normalImageFileHeight").text());}