var DONT_CACHE_XHR=false;var MW_SERVER_NAME="www.freebase.com:80";var VERSION="110";var LOGANZRWEB_VIEW_TXN_LOG_URL="http://stats.metaweb.com/transaction";var viewTransactionIdLogURL="http://stats.metaweb.com/transaction";var JSON=window.JSON={format:function(A,B){return JSON[typeof A](A,B)},stringify:function(A){return JSON.format(A,false)},parse:function(text,value){var j;if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){try{j=eval("("+text+")")}catch(e){if(arguments.length>1){return arguments[1]}throw e}return j}if(arguments.length>1){return arguments[1]}throw new SyntaxError("parseJSON")},array:function(G,D,I){if(!I){I=0}var F=["["],E,C,B,A=G.length,H;if(A){F=JSON.newline(F,D);I++;for(B=0;B<A;B+=1){H=G[B];C=JSON[typeof H];if(C){H=C(H,D,I);if(typeof H=="string"){if(E){F[F.length]=",";F=JSON.newline(F,D)}F=JSON.indent(F,D,I);F[F.length]=H;E=true}}}I--;F=JSON.newline(F,D);F=JSON.indent(F,D,I)}F[F.length]="]";return F.join("")},"boolean":function(A){return String(A)},"null":function(A){return"null"},"undefined":function(A){return"null"},number:function(A){return isFinite(A)?String(A):"null"},object:function(H,E,I){if(!I){I=0}if(H){if(H instanceof Array){return JSON.array(H,E,I)}var G=["{"],F,D,C,J,A,B=[];for(C in H){B[B.length]=C}B.sort();A=B.length;if(A){G=JSON.newline(G,E);I++;for(C=0;C<A;C+=1){J=H[B[C]];D=JSON[typeof J];if(D){J=D(J,E,I);if(typeof J=="string"){if(F){G[G.length]=",";G=JSON.newline(G,E)}G=JSON.indent(G,E,I);G.push(JSON.string(B[C]),((E)?" : ":":"),J);F=true}}}I--;G=JSON.newline(G,E);G=JSON.indent(G,E,I)}G[G.length]="}";return G.join("")}return"null"},string:function(A){if(/["\\\x00-\x1f]/.test(A)){A=A.replace(/([\x00-\x1f\\"])/g,function(C,B){var D=JSON.m[B];if(D){return D}D=B.charCodeAt();return"\\u00"+Math.floor(D/16).toString(16)+(D%16).toString(16)})}return'"'+A+'"'},INDENT:"  ",NEWLINE:"\n",indent:function(B,C,D){if(!C){return B}for(var A=0;A<D;A++){B[B.length]=JSON.INDENT}return B},newline:function(A,B){if(B){A[A.length]=JSON.NEWLINE}return A},m:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}};function parseUri(E){var D=parseUri.options,A=D.parser[D.strictMode?"strict":"loose"].exec(E),C={},B=14;while(B--){C[D.key[B]]=A[B]||""}C[D.q.name]={};C[D.key[12]].replace(D.q.parser,function(G,F,H){if(F){C[D.q.name][F]=H}});return C}parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};
/*
 * jQuery JavaScript Library v1.3.1
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
 * Revision: 6158
 */
(function(){var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;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&&elem.id!=match[3]){return jQuery().find(selector)}var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;
return ret}}else{return jQuery(context).find(selector)}}else{if(jQuery.isFunction(selector)){return jQuery(document).ready(selector)}}if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context}return this.setArray(jQuery.makeArray(selector))},selector:"",jquery:"1.3.1",size:function(){return this.length},get:function(num){return num===undefined?jQuery.makeArray(this):this[num]},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"}}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){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(typeof name==="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]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.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,function(elem){if(this.nodeType==1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},push:[].push,find:function(selector){if(this.length===1&&!/,/.test(selector)){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret}else{var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem)});return this.pushStack(/[^+>] [^+>]/.test(selector)?jQuery.unique(elems):elems,"find",selector)}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!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,jQuery.grep(this,function(elem){return elem.nodeType===1})),"filter",selector)},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null;
return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){return cur}cur=cur.parentNode}})},not:function(selector){if(typeof selector==="string"){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector)}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 !!selector&&this.is("."+selector)},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text}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(option).val();if(one){return value}values.push(value)}}return values}return(elem.value||"").replace(/\r/g,"")}return undefined}if(typeof value==="number"){value+=""}return this.each(function(){if(this.nodeType!=1){return }if(jQuery.isArray(value)&&/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),"slice",Array.prototype.slice.call(arguments).join(","))},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)},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild,extra=this.length>1?fragment.cloneNode(true):fragment;if(first){for(var i=0,l=this.length;i<l;i++){callback.call(root(this[i],first),i>0?extra.cloneNode(true):fragment)}}if(scripts){jQuery.each(scripts,evalScript)}}return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem}}};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(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){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 exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery}return jQuery},isFunction:function(obj){return toString.call(obj)==="[object Function]"},isArray:function(obj){return toString.call(obj)==="[object Array]"},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)},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.support.scriptEval){script.appendChild(document.createTextNode(data))}else{script.text=data}head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},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 typeof value==="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 elem&&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;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret}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){ret=computedStyle.getPropertyValue(name)}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,fragment){context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match){return[context.createElement(match[1])]}}var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+=""}if(!elem){return }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();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.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--){div=div.lastChild}if(!jQuery.support.tbody){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(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)}elem=jQuery.makeArray(div.childNodes)}if(elem.nodeType){ret.push(elem)}else{ret=jQuery.merge(ret,elem)}});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))))}fragment.appendChild(ret[i])}}return scripts}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;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode){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}if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined}return elem[name]}if(!jQuery.support.style&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)}if(set){elem.setAttribute(name,""+value)}var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr}if(!jQuery.support.opacity&&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||typeof array==="string"||jQuery.isFunction(array)||array.setInterval){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.support.getAll){while((elem=second[i++])!=null){if(elem.nodeType!=8){first[pos++]=elem}}}else{while((elem=second[i++])!=null){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.]+)/)||[0,"0"])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};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),name,selector)}});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,state){if(typeof state!=="boolean"){state=!jQuery.className.has(this,classNames)}jQuery.className[state?"add":"remove"](this,classNames)},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).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)}});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0}var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({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]}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data))}else{if(data){q.push(data)}}}return q},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx"){fn=queue[0]}if(fn!==undefined){fn.call(elem)}}});jQuery.fn.extend({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)})},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx"}if(data===undefined){return jQuery.queue(this[0],type)}return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1){queue[0].call(this)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[]}if(!selector||typeof selector!=="string"){return results}var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift()}set=posProcess(selector,set)}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set)}else{prune=false}while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur=""}else{pop=parts.pop()}if(pop==null){pop=context}Expr.relative[cur](checkSet,pop,isXML(context))}}if(!checkSet){checkSet=set}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)}else{if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])}}}}}else{makeArray(checkSet,results)}if(extra){Sizzle(extra,context,results,seed)}return results};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[]}for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break}}}}if(!set){set=context.getElementsByTagName("*")}return{set:set,expr:expr}};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound;while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
anyFound=false;if(curLoop==result){result=[]}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not);if(!match){anyFound=found=true}else{if(match===true){continue}}}if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true}else{curLoop[i]=false}}else{if(pass){result.push(item);anyFound=true}}}}}if(found!==undefined){if(!inplace){curLoop=result}expr=expr.replace(Expr.match[type],"");if(!anyFound){return[]}break}}}expr=expr.replace(/\s*,\s*/,"");if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr}else{break}}old=expr}return curLoop};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")}},relative:{"+":function(checkSet,part){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var cur=elem.previousSibling;while(cur&&cur.nodeType!==1){cur=cur.previousSibling}checkSet[i]=typeof part==="string"?cur||false:cur===part}}if(typeof part==="string"){Sizzle.filter(part,checkSet,true)}},">":function(checkSet,part,isXML){if(typeof part==="string"&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=typeof part==="string"?elem.parentNode:elem.parentNode===part}}if(typeof part==="string"){Sizzle.filter(part,checkSet,true)}}},"":function(checkSet,part,isXML){var doneName="done"+(done++),checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)},"~":function(checkSet,part,isXML){var doneName="done"+(done++),checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[]}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"&&!isXML){return context.getElementsByName(match[1])}},TAG:function(match,context){return context.getElementsByTagName(match[1])}},preFilter:{CLASS:function(match,curLoop,inplace,result,not){match=" "+match[1].replace(/\\/g,"")+" ";var elem;for(var i=0;(elem=curLoop[i])!=null;i++){if(elem){if(not^(" "+elem.className+" ").indexOf(match)>=0){if(!inplace){result.push(elem)}}else{if(inplace){curLoop[i]=false}}}}return false},ID:function(match){return match[1].replace(/\\/g,"")},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0}match[0]="done"+(done++);return match},ATTR:function(match){var name=match[1].replace(/\\/g,"");if(Expr.attrMap[name]){match[1]=Expr.attrMap[name]}if(match[2]==="~="){match[4]=" "+match[4]+" "}return match},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1){match[3]=Sizzle(match[3],null,null,curLoop)
}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret)}return false}}else{if(Expr.match.POS.test(match[0])){return true}}return match},POS:function(match){match.unshift(true);return match}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"},disabled:function(elem){return elem.disabled===true},checked:function(elem){return elem.checked===true},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true},parent:function(elem){return !!elem.firstChild},empty:function(elem){return !elem.firstChild},has:function(elem,i,match){return !!Sizzle(match[3],elem).length},header:function(elem){return/h\d/i.test(elem.nodeName)},text:function(elem){return"text"===elem.type},radio:function(elem){return"radio"===elem.type},checkbox:function(elem){return"checkbox"===elem.type},file:function(elem){return"file"===elem.type},password:function(elem){return"password"===elem.type},submit:function(elem){return"submit"===elem.type},image:function(elem){return"image"===elem.type},reset:function(elem){return"reset"===elem.type},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)}},setFilters:{first:function(elem,i){return i===0},last:function(elem,i,match,array){return i===array.length-1},even:function(elem,i){return i%2===0},odd:function(elem,i){return i%2===1},lt:function(elem,i,match){return i<match[3]-0},gt:function(elem,i,match){return i>match[3]-0},nth:function(elem,i,match){return match[3]-0==i},eq:function(elem,i,match){return match[3]-0==i}},filter:{CHILD:function(elem,match){var type=match[1],parent=elem.parentNode;var doneName=match[0];if(parent&&(!parent[doneName]||!elem.nodeIndex)){var count=1;for(var node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType==1){node.nodeIndex=count++}}parent[doneName]=count-1}if(type=="first"){return elem.nodeIndex==1}else{if(type=="last"){return elem.nodeIndex==parent[doneName]}else{if(type=="only"){return parent[doneName]==1}else{if(type=="nth"){var add=false,first=match[2],last=match[3];if(first==1&&last==0){return true}if(first==0){if(elem.nodeIndex==last){add=true}}else{if((elem.nodeIndex-last)%first==0&&(elem.nodeIndex-last)/first>=0){add=true}}return add}}}}},PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array)}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0}else{if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false}}return true}}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match},CLASS:function(elem,match){return match.test(elem.className)},ATTR:function(elem,match){var result=Expr.attrHandle[match[1]]?Expr.attrHandle[match[1]](elem):elem[match[1]]||elem.getAttribute(match[1]),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!match[4]?result:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array)}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results}return array};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(e){makeArray=function(array,results){var ret=results||[];
if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i])}}else{for(var i=0;array[i];i++){ret.push(array[i])}}}return ret}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match}}root.removeChild(form)})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i])}}results=tmp}return results}}div.innerHTML="<a href='#'></a>";if(div.firstChild&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return }Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)}catch(e){}}return oldSizzle(query,context,extra,seed)};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context){return context.getElementsByClassName(match[1])}}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem&&elem.nodeType){var done=elem[doneName];if(done){match=checkSet[done];break}if(elem.nodeType===1&&!isXML){elem[doneName]=i}if(elem.nodeName===cur){match=elem;break}elem=elem[dir]}checkSet[i]=match}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem&&elem.nodeType){if(elem[doneName]){match=checkSet[elem[doneName]];break}if(elem.nodeType===1){if(!isXML){elem[doneName]=i}if(typeof cur!=="string"){if(elem===cur){match=true;break}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;break}}}elem=elem[dir]}checkSet[i]=match}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"")}selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet)}return Sizzle.filter(later,tmpSet)};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return"hidden"===elem.type||jQuery.css(elem,"display")==="none"||jQuery.css(elem,"visibility")==="hidden"
};Sizzle.selectors.filters.visible=function(elem){return"hidden"!==elem.type&&jQuery.css(elem,"display")!=="none"&&jQuery.css(elem,"visibility")!=="hidden"};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"}return Sizzle.matches(expr,elems)};jQuery.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};jQuery.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};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)}}return r};return ;window.Sizzle=Sizzle})();jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return }if(elem.setInterval&&elem!=window){elem=window}if(!handler.guid){handler.guid=this.guid++}if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].setup.call(elem,data,namespaces)}if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===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 namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler){delete events[type][handler.guid]}else{for(var handle in events[type]){if(namespace.test(events[type][handle].type)){delete events[type][handle]}}}if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].teardown.call(elem,namespaces)}for(ret in events[type]){break}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===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(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true}if(!elem){event.stopPropagation();if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem)}})}}if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined}event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event)}event.currentTarget=elem;var handle=jQuery.data(elem,"handle");
if(handle){handle.apply(elem,data)}if((!elem[type]||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false}if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;try{elem[type]()}catch(e){}}this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent){jQuery.event.trigger(event,data,parent,true)}}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation()}}if(event.isImmediatePropagationStopped()){break}}}},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 toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event}var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop]}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=proxy||function(){return fn.apply(this,arguments)};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++}});if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler)}}}}}};jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src)}if(src&&src.type){this.originalEvent=src;this.type=src.type}else{this.type=src}this.timeStamp=now();this[expando]=true};function returnFalse(){return false}function returnTrue(){return true}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return }if(e.preventDefault){e.preventDefault()}e.returnValue=false},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return }if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;
while(parent&&parent!=this){try{parent=parent.parentNode}catch(e){parent=this}}if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments)}};jQuery.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)},teardown:function(){jQuery.event.remove(this,orig,withinElement)}}});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){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result}},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.mouseenter(fnOver).mouseleave(fnOut)},ready:function(fn){bindReady();if(jQuery.isReady){fn.call(document,jQuery)}else{jQuery.readyList.push(fn)}return this},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem){elems.push({elem:elem,fn:fn})}}});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false){stop=false}});return stop}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")}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)});jQuery.readyList=null}jQuery(document).triggerHandler("ready")}}});var readyBound=false;function bindReady(){if(readyBound){return }readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready()}});if(document.documentElement.doScroll&&typeof window.frameElement==="undefined"){(function(){if(jQuery.isReady){return }try{document.documentElement.doScroll("left")}catch(error){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,mouseenter,mouseleave,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)}});jQuery(window).bind("unload",function(){for(var id in jQuery.cache){if(id!=1&&jQuery.cache[id].handle){jQuery.event.remove(jQuery.cache[id].handle.elem)}}});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();
div.style.display="none";div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return }jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"))}catch(e){}root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id]}root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee)});div.cloneNode(true).fireEvent("onclick")}jQuery(function(){var div=document.createElement("div");div.style.width="1px";div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div)})})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};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)}var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null}else{if(typeof params==="object"){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)}if(callback){self.each(callback,[res.responseText,status,res])}}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?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:jQuery.isArray(val)?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",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},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 parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=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=s.xhr();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){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}xhr.abort();return false}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])}var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}else{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)}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(isTimeout){xhr.abort()}if(s.async){xhr=null}}}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0){setTimeout(function(){if(xhr&&!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
}catch(e){}return false},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]}catch(e){}return false},httpData:function(xhr,type,s){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(s&&s.dataFilter){data=s.dataFilter(data,type)}if(typeof data==="string"){if(type=="script"){jQuery.globalEval(data)}if(type=="json"){data=window["eval"]("("+data+")")}}return data},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)}if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value)})}else{for(var j in a){if(jQuery.isArray(a[j])){jQuery.each(a[j],function(){add(j,this)})}else{add(j,jQuery.isFunction(a[j])?a[j]():a[j])}}}return s.join("&").replace(/%20/g,"+")}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type});return obj}jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName]}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none"){display="block"}elem.remove();elemdisplay[tagName]=display}this[i].style.display=jQuery.data(this[i],"olddisplay",display)}}return this}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))}this[i].style.display="none"}return this}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]()}):this.animate(genFx("toggle",3),fn,fn2)},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(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&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")&&this.style){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})},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}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)
}});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;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:[],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){this.elem.style.display="block"}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||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;var self=this;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;if(t()&&jQuery.timers.push(t)==1){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(timerId)}},13)}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());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){jQuery(this.elem).hide()}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])}}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,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit}else{fx.elem[fx.prop]=fx.now}}}});if(document.documentElement.getBoundingClientRect){jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])}var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left}}}else{jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])}jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0}prevOffsetParent=offsetParent,offsetParent=elem.offsetParent}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0}prevComputedStyle=computedStyle}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop,left+=body.offsetLeft}if(prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft)}return{top:top,left:left}}}jQuery.offset={initialize:function(){if(this.initialized){return }var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(prop in rules){container.style[prop]=rules[prop]}container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow="hidden",innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseInt(jQuery.curCSS(body,"marginTop",true),10)||0,left+=parseInt(jQuery.curCSS(body,"marginLeft",true),10)||0}return{top:top,left:left}}};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||document.body;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 null}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)};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")}})})();(function(G){if(/1\.(0|1|2)\.(0|1|2)/.test(G.fn.jquery)||/^1.1/.test(G.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later!  You are using v"+G.fn.jquery);return }G.fn._fadeIn=G.fn.fadeIn;var I=document.documentMode||0;var D=G.browser.msie&&((G.browser.version<8&&!I)||I<8);var E=G.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!I;G.blockUI=function(O){C(window,O)};G.unblockUI=function(O){H(window,O)};G.growlUI=function(S,Q,R,O){var P=G('<div class="growlUI"></div>');if(S){P.append("<h1>"+S+"</h1>")}if(Q){P.append("<h2>"+Q+"</h2>")}if(R==undefined){R=3000}G.blockUI({message:P,fadeIn:700,fadeOut:1000,centerY:false,timeout:R,showOverlay:false,onUnblock:O,css:G.blockUI.defaults.growlCSS})};G.fn.block=function(O){return this.unblock({fadeOut:0}).each(function(){if(G.css(this,"position")=="static"){this.style.position="relative"}if(G.browser.msie){this.style.zoom=1}C(this,O)})};G.fn.unblock=function(O){return this.each(function(){H(this,O)})};G.blockUI.version=2.23;G.blockUI.defaults={message:"<h1>Please wait...</h1>",css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:null,color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var B=null;var F=[];function C(Q,O){var Z=(Q==window);var R=O&&O.message!==undefined?O.message:undefined;O=G.extend({},G.blockUI.defaults,O||{});O.overlayCSS=G.extend({},G.blockUI.defaults.overlayCSS,O.overlayCSS||{});var Y=G.extend({},G.blockUI.defaults.css,O.css||{});R=R===undefined?O.message:R;if(Z&&B){H(window,{fadeOut:0})}if(R&&typeof R!="string"&&(R.parentNode||R.jquery)){var T=R.jquery?R[0]:R;var X={};G(Q).data("blockUI.history",X);X.el=T;X.parent=T.parentNode;X.display=T.style.display;X.position=T.style.position;if(X.parent){X.parent.removeChild(T)}}var a=O.baseZ;var W=(G.browser.msie||O.forceIframe)?G('<iframe class="blockUI" style="z-index:'+(a++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+O.iframeSrc+'"></iframe>'):G('<div class="blockUI" style="display:none"></div>');var V=G('<div class="blockUI blockOverlay" style="z-index:'+(a++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var S=Z?G('<div class="blockUI blockMsg blockPage" style="z-index:'+a+';display:none;position:fixed"></div>'):G('<div class="blockUI blockMsg blockElement" style="z-index:'+a+';display:none;position:absolute"></div>');
if(R){S.css(Y)}if(!O.applyPlatformOpacityRules||!(G.browser.mozilla&&/Linux/.test(navigator.platform))){V.css(O.overlayCSS)}V.css("position",Z?"fixed":"absolute");if(G.browser.msie||O.forceIframe){W.css("opacity",0)}G([W[0],V[0],S[0]]).appendTo(Z?"body":Q);var d=D&&(!G.boxModel||G("object,embed",Z?null:Q).length>0);if(E||d){if(Z&&O.allowBodyStretch&&G.boxModel){G("html,body").css("height","100%")}if((E||!G.boxModel)&&!Z){var e=L(Q,"borderTopWidth"),U=L(Q,"borderLeftWidth");var c=e?"(0 - "+e+")":0;var P=U?"(0 - "+U+")":0}G.each([W,V,S],function(f,k){var g=k[0].style;g.position="absolute";if(f<2){Z?g.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+O.quirksmodeOffsetHack+') + "px"'):g.setExpression("height",'this.parentNode.offsetHeight + "px"');Z?g.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):g.setExpression("width",'this.parentNode.offsetWidth + "px"');if(P){g.setExpression("left",P)}if(c){g.setExpression("top",c)}}else{if(O.centerY){if(Z){g.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}g.marginTop=0}else{if(!O.centerY&&Z){var h=(O.css&&O.css.top)?parseInt(O.css.top):0;var j="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+h+') + "px"';g.setExpression("top",j)}}}})}if(R){S.append(R);if(R.jquery||R.nodeType){G(R).show()}}if((G.browser.msie||O.forceIframe)&&O.showOverlay){W.show()}if(O.fadeIn){if(O.showOverlay){V._fadeIn(O.fadeIn)}if(R){S.fadeIn(O.fadeIn)}}else{if(O.showOverlay){V.show()}if(R){S.show()}}K(1,Q,O);if(Z){B=S[0];F=G(":input:enabled:visible",B);if(O.focusInput){setTimeout(N,20)}}else{A(S[0],O.centerX,O.centerY)}if(O.timeout){var b=setTimeout(function(){Z?G.unblockUI(O):G(Q).unblock(O)},O.timeout);G(Q).data("blockUI.timeout",b)}}function H(R,S){var Q=R==window;var P=G(R);var T=P.data("blockUI.history");var U=P.data("blockUI.timeout");if(U){clearTimeout(U);P.removeData("blockUI.timeout")}S=G.extend({},G.blockUI.defaults,S||{});K(0,R,S);var O=Q?G("body").children().filter(".blockUI"):G(".blockUI",R);if(Q){B=F=null}if(S.fadeOut){O.fadeOut(S.fadeOut);setTimeout(function(){J(O,T,S,R)},S.fadeOut)}else{J(O,T,S,R)}}function J(O,R,Q,P){O.each(function(S,T){if(this.parentNode){this.parentNode.removeChild(this)}});if(R&&R.el){R.el.style.display=R.display;R.el.style.position=R.position;if(R.parent){R.parent.appendChild(R.el)}G(R.el).removeData("blockUI.history")}if(typeof Q.onUnblock=="function"){Q.onUnblock(P,Q)}}function K(O,S,T){var R=S==window,Q=G(S);if(!O&&(R&&!B||!R&&!Q.data("blockUI.isBlocked"))){return }if(!R){Q.data("blockUI.isBlocked",O)}if(!T.bindEvents||(O&&!T.showOverlay)){return }var P="mousedown mouseup keydown keypress";O?G(document).bind(P,T,M):G(document).unbind(P,M)}function M(R){if(R.keyCode&&R.keyCode==9){if(B&&R.data.constrainTabKey){var Q=F;var P=!R.shiftKey&&R.target==Q[Q.length-1];var O=R.shiftKey&&R.target==Q[0];if(P||O){setTimeout(function(){N(O)},10);return false}}}if(G(R.target).parents("div.blockMsg").length>0){return true}return G(R.target).parents().children().filter("div.blockUI").length==0}function N(O){if(!F){return }var P=F[O===true?F.length-1:0];if(P){P.focus()}}function A(S,O,U){var T=S.parentNode,R=S.style;var P=((T.offsetWidth-S.offsetWidth)/2)-L(T,"borderLeftWidth");var Q=((T.offsetHeight-S.offsetHeight)/2)-L(T,"borderTopWidth");if(O){R.left=P>0?(P+"px"):"0"}if(U){R.top=Q>0?(Q+"px"):"0"}}function L(O,P){return parseInt(G.css(O,P))||0}})(jQuery);jQuery.cookie=function(B,I,L){if(typeof I!="undefined"){L=L||{};if(I===null){I="";L=$.extend({},L);L.expires=-1}var E="";if(L.expires&&(typeof L.expires=="number"||L.expires.toUTCString)){var F;if(typeof L.expires=="number"){F=new Date();F.setTime(F.getTime()+(L.expires*24*60*60*1000))
}else{F=L.expires}E="; expires="+F.toUTCString()}var K=L.path?"; path="+(L.path):"";var G=L.domain?"; domain="+(L.domain):"";var A=L.secure?"; secure":"";document.cookie=[B,"=",encodeURIComponent(I),E,K,G,A].join("")}else{var D=null;if(document.cookie&&document.cookie!=""){var J=document.cookie.split(";");for(var H=0;H<J.length;H++){var C=jQuery.trim(J[H]);if(C.substring(0,B.length+1)==(B+"=")){D=decodeURIComponent(C.substring(B.length+1));break}}}return D}};(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6rc6",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(K,J){return document.compareDocumentPosition?K.compareDocumentPosition(J)&16:K!==J&&K.contains(J)},cssCache:{},css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen"></div>').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[J]},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(C.curCSS(this,"position",1))&&(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(L,K,J){return !!C.data(L,J[3])},focusable:function(K){var L=K.nodeName.toLowerCase(),J=C.attr(K,"tabindex");return(/input|select|textarea|button|object/.test(L)?!K.disabled:"a"==L||"area"==L?K.href||!isNaN(J):!isNaN(J))&&!C(K)["area"==L?"parents":"closest"](":hidden").length},tabbable:function(K){var J=C.attr(K,"tabindex");return(isNaN(J)||J>=0)&&C(K).is(":focusable")
}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P))._init());(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.namespace=L;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){if(Q.target==O){return M._setData(P,R)}}).bind("getData."+K,function(Q,P){if(Q.target==O){return M._getData(P)}}).bind("remove",function(){return M.destroy()})};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",K)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(L,M,N){var P=this.options[L],J=(L==this.widgetEventPrefix?L:this.widgetEventPrefix+L);M=C.Event(M);M.type=J;if(M.originalEvent){for(var K=C.event.props.length,O;K;){O=C.event.props[--K];M[O]=M.originalEvent[O]}}this.element.trigger(M,N);return !(C.isFunction(P)&&P.call(this.element[0],M,N)===false||M.isDefaultPrevented())}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){if(L.originalEvent.mouseHandled){return }(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(C.browser.safari||L.preventDefault());L.originalEvent.mouseHandled=true;return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);
(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(A){A.widget("ui.tabs",{_init:function(){this._tabify(true)},_setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this._tabify()}},_tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},_sanitizeSelector:function(B){return B.replace(/:/g,"\\:")},_cookie:function(){var B=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+A.data(this.list[0]));return A.cookie.apply(null,[B].concat(A.makeArray(arguments)))},_ui:function(C,B){return{tab:C,panel:B,index:this.$tabs.index(C)}},_tabify:function(O){this.list=this.element.is("div")?this.element.children("ul:first, ol:first").eq(0):this.element;this.$lis=A("li:has(a[href])",this.list);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var P=this,D=this.options;var C=/^#.+/;this.$tabs.each(function(S,Q){var R=A(Q).attr("href");var T=R.split("#")[0],U;if(T&&(T===location.toString().split("#")[0]||(U=A("base")[0])&&T===U.href)){R=Q.hash;Q.href=R}if(C.test(R)){P.$panels=P.$panels.add(P._sanitizeSelector(R))}else{if(R!="#"){A.data(Q,"href.tabs",R);A.data(Q,"load.tabs",R.replace(/#.*$/,""));var W=P._tabId(Q);Q.href="#"+W;var V=A("#"+W);if(!V.length){V=A(D.panelTemplate).attr("id",W).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(P.$panels[S-1]||P.list);V.data("destroy.tabs",true)}P.$panels=P.$panels.add(V)}else{D.disabled.push(S+1)}}});if(O){if(this.element.is("div")){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all")}this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.$lis.addClass("ui-state-default ui-corner-top");this.$panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(D.selected===undefined){if(location.hash){this.$tabs.each(function(R,Q){if(Q.hash==location.hash){D.selected=R;return false}})}else{if(D.cookie){D.selected=parseInt(P._cookie(),10)}else{if(this.$lis.filter(".ui-tabs-selected").length){D.selected=this.$lis.index(this.$lis.filter(".ui-tabs-selected"))}else{D.selected=0}}}}else{if(D.selected===null){D.selected=-1}}D.selected=((D.selected>=0&&this.$tabs[D.selected])||D.selected<0)?D.selected:0;D.disabled=A.unique(D.disabled.concat(A.map(this.$lis.filter(".ui-state-disabled"),function(R,Q){return P.$lis.index(R)}))).sort();if(A.inArray(D.selected,D.disabled)!=-1){D.disabled.splice(A.inArray(D.selected,D.disabled),1)}this.$panels.addClass("ui-tabs-hide");this.$lis.removeClass("ui-tabs-selected ui-state-active");if(D.selected>=0&&this.$tabs.length){this.$panels.eq(D.selected).removeClass("ui-tabs-hide");var F=["ui-tabs-selected ui-state-active"];if(D.deselectable){F.push("ui-tabs-deselectable")}this.$lis.eq(D.selected).addClass(F.join(" "));var J=function(){P._trigger("show",null,P._ui(P.$tabs[D.selected],P.$panels[D.selected]))};if(A.data(this.$tabs[D.selected],"load.tabs")){this.load(D.selected,J)}else{J()}}if(D.event!="mouseover"){var K=function(R,Q){if(Q.is(":not(.ui-state-disabled)")){Q.toggleClass("ui-state-"+R)}};this.$lis.bind("mouseover.tabs mouseout.tabs",function(){K("hover",A(this))});this.$tabs.bind("focus.tabs blur.tabs",function(){K("focus",A(this).parents("li:first"))
})}A(window).bind("unload",function(){P.$lis.add(P.$tabs).unbind(".tabs");P.$lis=P.$tabs=P.$panels=null})}else{D.selected=this.$lis.index(this.$lis.filter(".ui-tabs-selected"))}if(D.cookie){this._cookie(D.selected,D.cookie)}for(var H=0,N;N=this.$lis[H];H++){A(N)[A.inArray(H,D.disabled)!=-1&&!A(N).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(D.cache===false){this.$tabs.removeData("cache.tabs")}var B,I;if(D.fx){if(A.isArray(D.fx)){B=D.fx[0];I=D.fx[1]}else{B=I=D.fx}}function E(Q,R){Q.css({display:""});if(A.browser.msie&&R.opacity){Q[0].style.removeAttribute("filter")}}var L=I?function(Q,R){R.hide().removeClass("ui-tabs-hide").animate(I,500,function(){E(R,I);P._trigger("show",null,P._ui(Q,R[0]))})}:function(Q,R){R.removeClass("ui-tabs-hide");P._trigger("show",null,P._ui(Q,R[0]))};var M=B?function(R,Q,S){Q.animate(B,B.duration||"normal",function(){Q.addClass("ui-tabs-hide");E(Q,B);if(S){L(R,S)}})}:function(R,Q,S){Q.addClass("ui-tabs-hide");if(S){L(R,S)}};function G(S,U,Q,T){var R=["ui-tabs-selected ui-state-active"];if(D.deselectable){R.push("ui-tabs-deselectable")}U.removeClass("ui-state-default").addClass(R.join(" ")).siblings().removeClass(R.join(" ")).addClass("ui-state-default");M(S,Q,T)}this.$tabs.unbind(".tabs").bind(D.event+".tabs",function(){var T=A(this).parents("li:eq(0)"),Q=P.$panels.filter(":visible"),S=A(P._sanitizeSelector(this.hash));if((T.hasClass("ui-state-active")&&!D.deselectable)||T.hasClass("ui-state-disabled")||A(this).hasClass("ui-tabs-loading")||P._trigger("select",null,P._ui(this,S[0]))===false){this.blur();return false}D.selected=P.$tabs.index(this);if(D.deselectable){if(T.hasClass("ui-state-active")){D.selected=-1;if(D.cookie){P._cookie(D.selected,D.cookie)}T.removeClass("ui-tabs-selected ui-state-active ui-tabs-deselectable").addClass("ui-state-default");P.$panels.stop();M(this,Q);this.blur();return false}else{if(!Q.length){if(D.cookie){P._cookie(D.selected,D.cookie)}P.$panels.stop();var R=this;P.load(P.$tabs.index(this),function(){T.addClass("ui-tabs-selected ui-state-active ui-tabs-deselectable").removeClass("ui-state-default");L(R,S)});this.blur();return false}}}if(D.cookie){P._cookie(D.selected,D.cookie)}P.$panels.stop();if(S.length){var R=this;P.load(P.$tabs.index(this),Q.length?function(){G(R,T,Q,S)}:function(){T.addClass("ui-tabs-selected ui-state-active").removeClass("ui-state-default");L(R,S)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(D.event!="click"){this.$tabs.bind("click.tabs",function(){return false})}},destroy:function(){var B=this.options;this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.unbind(".tabs").removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.unbind(".tabs").add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-tabs-deselectable ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")}});if(B.cookie){this._cookie(null,B.cookie)}},add:function(C,H,F){if(F==undefined){F=this.$tabs.length}var I=this,E=this.options;var G=A(E.tabTemplate.replace(/#\{href\}/g,C).replace(/#\{label\}/g,H));G.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var D=C.indexOf("#")==0?C.replace("#",""):this._tabId(A("a:first-child",G)[0]);var J=A("#"+D);if(!J.length){J=A(E.panelTemplate).attr("id",D).data("destroy.tabs",true)}J.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(F>=this.$lis.length){G.appendTo(this.list);J.appendTo(this.list[0].parentNode)}else{G.insertBefore(this.$lis[F]);J.insertBefore(this.$panels[F])}E.disabled=A.map(E.disabled,function(L,K){return L>=F?++L:L
});this._tabify();if(this.$tabs.length==1){G.addClass("ui-tabs-selected ui-state-active");J.removeClass("ui-tabs-hide");var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(0,function(){I._trigger("show",null,I._ui(I.$tabs[0],I.$panels[0]))})}}this._trigger("add",null,this._ui(this.$tabs[F],this.$panels[F]))},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass("ui-tabs-selected")&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this._tabify();this._trigger("remove",null,this._ui(E.find("a")[0],C[0]))},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }this.$lis.eq(B).removeClass("ui-state-disabled");C.disabled=A.grep(C.disabled,function(E,D){return E!=B});this._trigger("enable",null,this._ui(this.$tabs[B],this.$panels[B]))},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass("ui-state-disabled");D.disabled.push(C);D.disabled.sort();this._trigger("disable",null,this._ui(this.$tabs[C],this.$panels[C]))}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]"))}this.$tabs.eq(B).trigger(this.options.event+".tabs")},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter(".ui-tabs-loading").removeClass("ui-tabs-loading").each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(O,N){A(L._sanitizeSelector(J.hash)).html(O);C();if(D.cache){A.data(J,"cache.tabs",true)}L._trigger("load",null,L._ui(L.$tabs[G],L.$panels[G]));try{D.ajaxOptions.success(O,N)}catch(P){}K()}});if(this.xhr){this.xhr.abort();C()}E.addClass("ui-tabs-loading");L.xhr=A.ajax(F)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},length:function(){return this.$tabs.length}});A.extend(A.ui.tabs,{version:"1.6rc6",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"Loading&#8230;",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(D,F){var B=this,E=this.options.selected;function C(){clearTimeout(B.rotation);B.rotation=setTimeout(function(){E=++E<B.$tabs.length?E:0;B.select(E)},D)}if(D){this.element.bind("tabsshow",C);this.$tabs.bind(this.options.event+".tabs",!F?function(G){if(G.clientX){clearTimeout(B.rotation);B.element.unbind("tabsshow",C)}}:function(G){E=B.options.selected;C()});C()}else{clearTimeout(B.rotation);this.element.unbind("tabsshow",C);this.$tabs.unbind(this.options.event+".tabs",stop)}}})})(jQuery);(function(B){B.fn.ajaxSubmit=function(M){if(!this.length){A("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof M=="function"){M={success:M}}M=B.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},M||{});var O={};this.trigger("form-pre-serialize",[this,M,O]);if(O.veto){A("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(M.beforeSerialize&&M.beforeSerialize(this,M)===false){A("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var I=this.formToArray(M.semantic);if(M.data){M.extraData=M.data;for(var E in M.data){if(M.data[E] instanceof Array){for(var F in M.data[E]){I.push({name:E,value:M.data[E][F]})}}else{I.push({name:E,value:M.data[E]})}}}if(M.beforeSubmit&&M.beforeSubmit(I,this,M)===false){A("ajaxSubmit: submit aborted via beforeSubmit callback");
return this}this.trigger("form-submit-validate",[I,this,M,O]);if(O.veto){A("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var D=B.param(I);if(M.type.toUpperCase()=="GET"){M.url+=(M.url.indexOf("?")>=0?"&":"?")+D;M.data=null}else{M.data=D}var N=this,H=[];if(M.resetForm){H.push(function(){N.resetForm()})}if(M.clearForm){H.push(function(){N.clearForm()})}if(!M.dataType&&M.target){var K=M.success||function(){};H.push(function(P){B(M.target).html(P).each(K,arguments)})}else{if(M.success){H.push(M.success)}}M.success=function(S,Q){for(var R=0,P=H.length;R<P;R++){H[R].apply(M,[S,Q,N])}};var C=B("input:file",this).fieldValue();var L=false;for(var G=0;G<C.length;G++){if(C[G]){L=true}}if(M.iframe||L){if(B.browser.safari&&M.closeKeepAlive){B.get(M.closeKeepAlive,J)}else{J()}}else{B.ajax(M)}this.trigger("form-submit-notify",[this,M]);return this;function J(){var T=N[0];if(B(":input[name=submit]",T).length){alert('Error: Form elements must not be named "submit".');return }var R=B.extend({},B.ajaxSettings,M);var c=jQuery.extend(true,{},B.extend(true,{},B.ajaxSettings),R);var S="jqFormIO"+(new Date().getTime());var Y=B('<iframe id="'+S+'" name="'+S+'" />');var a=Y[0];if(B.browser.msie||B.browser.opera){a.src='javascript:false;document.write("");'}Y.css({position:"absolute",top:"-1000px",left:"-1000px"});var b={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;Y.attr("src","about:blank")}};var Z=R.global;if(Z&&!B.active++){B.event.trigger("ajaxStart")}if(Z){B.event.trigger("ajaxSend",[b,R])}if(c.beforeSend&&c.beforeSend(b,c)===false){c.global&&jQuery.active--;return }if(b.aborted){return }var Q=0;var V=0;var P=T.clk;if(P){var U=P.name;if(U&&!P.disabled){M.extraData=M.extraData||{};M.extraData[U]=P.value;if(P.type=="image"){M.extraData[name+".x"]=T.clk_x;M.extraData[name+".y"]=T.clk_y}}}setTimeout(function(){var f=N.attr("target"),d=N.attr("action");N.attr({target:S,method:"POST",action:R.url});if(!M.skipEncodingOverride){N.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(R.timeout){setTimeout(function(){V=true;W()},R.timeout)}var e=[];try{if(M.extraData){for(var g in M.extraData){e.push(B('<input type="hidden" name="'+g+'" value="'+M.extraData[g]+'" />').appendTo(T)[0])}}Y.appendTo("body");a.attachEvent?a.attachEvent("onload",W):a.addEventListener("load",W,false);T.submit()}finally{N.attr("action",d);f?N.attr("target",f):N.removeAttr("target");B(e).remove()}},10);function W(){if(Q++){return }a.detachEvent?a.detachEvent("onload",W):a.removeEventListener("load",W,false);var f=0;var g=true;try{if(V){throw"timeout"}var h,k;k=a.contentWindow?a.contentWindow.document:a.contentDocument?a.contentDocument:a.document;if(k.body==null&&!f&&B.browser.opera){f=1;Q--;setTimeout(W,100);return }b.responseText=k.body?k.body.innerHTML:null;b.responseXML=k.XMLDocument?k.XMLDocument:k;b.getResponseHeader=function(l){var e={"content-type":R.dataType};return e[l]};if(R.dataType=="json"||R.dataType=="script"){var d=k.getElementsByTagName("textarea")[0];b.responseText=d?d.value:b.responseText}else{if(R.dataType=="xml"&&!b.responseXML&&b.responseText!=null){b.responseXML=X(b.responseText)}}h=B.httpData(b,R.dataType)}catch(j){g=false;B.handleError(R,b,"error",j)}if(g){R.success(h,"success");if(Z){B.event.trigger("ajaxSuccess",[b,R])}}if(Z){B.event.trigger("ajaxComplete",[b,R])}if(Z&&!--B.active){B.event.trigger("ajaxStop")}if(R.complete){R.complete(b,g?"success":"error")}setTimeout(function(){Y.remove();b.responseXML=null},100)}function X(d,e){if(window.ActiveXObject){e=new ActiveXObject("Microsoft.XMLDOM");e.async="false";e.loadXML(d)}else{e=(new DOMParser()).parseFromString(d,"text/xml")}return(e&&e.documentElement&&e.documentElement.tagName!="parsererror")?e:null}}};B.fn.ajaxForm=function(C){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){B(this).ajaxSubmit(C);
return false}).each(function(){B(":submit,input:image",this).bind("click.form-plugin",function(E){var D=this.form;D.clk=this;if(this.type=="image"){if(E.offsetX!=undefined){D.clk_x=E.offsetX;D.clk_y=E.offsetY}else{if(typeof B.fn.offset=="function"){var F=B(this).offset();D.clk_x=E.pageX-F.left;D.clk_y=E.pageY-F.top}else{D.clk_x=E.pageX-this.offsetLeft;D.clk_y=E.pageY-this.offsetTop}}}setTimeout(function(){D.clk=D.clk_x=D.clk_y=null},10)})})};B.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){B(":submit,input:image",this).unbind("click.form-plugin")})};B.fn.formToArray=function(N){var M=[];if(this.length==0){return M}var D=this[0];var H=N?D.getElementsByTagName("*"):D.elements;if(!H){return M}for(var I=0,K=H.length;I<K;I++){var E=H[I];var F=E.name;if(!F){continue}if(N&&D.clk&&E.type=="image"){if(!E.disabled&&D.clk==E){M.push({name:F+".x",value:D.clk_x},{name:F+".y",value:D.clk_y})}continue}var O=B.fieldValue(E,true);if(O&&O.constructor==Array){for(var G=0,C=O.length;G<C;G++){M.push({name:F,value:O[G]})}}else{if(O!==null&&typeof O!="undefined"){M.push({name:F,value:O})}}}if(!N&&D.clk){var J=D.getElementsByTagName("input");for(var I=0,K=J.length;I<K;I++){var L=J[I];var F=L.name;if(F&&!L.disabled&&L.type=="image"&&D.clk==L){M.push({name:F+".x",value:D.clk_x},{name:F+".y",value:D.clk_y})}}}return M};B.fn.formSerialize=function(C){return B.param(this.formToArray(C))};B.fn.fieldSerialize=function(D){var C=[];this.each(function(){var H=this.name;if(!H){return }var F=B.fieldValue(this,D);if(F&&F.constructor==Array){for(var G=0,E=F.length;G<E;G++){C.push({name:H,value:F[G]})}}else{if(F!==null&&typeof F!="undefined"){C.push({name:this.name,value:F})}}});return B.param(C)};B.fn.fieldValue=function(H){for(var G=[],E=0,C=this.length;E<C;E++){var F=this[E];var D=B.fieldValue(F,H);if(D===null||typeof D=="undefined"||(D.constructor==Array&&!D.length)){continue}D.constructor==Array?B.merge(G,D):G.push(D)}return G};B.fieldValue=function(C,I){var E=C.name,N=C.type,O=C.tagName.toLowerCase();if(typeof I=="undefined"){I=true}if(I&&(!E||C.disabled||N=="reset"||N=="button"||(N=="checkbox"||N=="radio")&&!C.checked||(N=="submit"||N=="image")&&C.form&&C.form.clk!=C||O=="select"&&C.selectedIndex==-1)){return null}if(O=="select"){var J=C.selectedIndex;if(J<0){return null}var L=[],D=C.options;var G=(N=="select-one");var K=(G?J+1:D.length);for(var F=(G?J:0);F<K;F++){var H=D[F];if(H.selected){var M=B.browser.msie&&!(H.attributes.value.specified)?H.text:H.value;if(G){return M}L.push(M)}}return L}return C.value};B.fn.clearForm=function(){return this.each(function(){B("input,select,textarea",this).clearFields()})};B.fn.clearFields=B.fn.clearInputs=function(){return this.each(function(){var D=this.type,C=this.tagName.toLowerCase();if(D=="text"||D=="password"||C=="textarea"){this.value=""}else{if(D=="checkbox"||D=="radio"){this.checked=false}else{if(C=="select"){this.selectedIndex=-1}}}})};B.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};B.fn.enable=function(C){if(C==undefined){C=true}return this.each(function(){this.disabled=!C})};B.fn.selected=function(C){if(C==undefined){C=true}return this.each(function(){var D=this.type;if(D=="checkbox"||D=="radio"){this.checked=C}else{if(this.tagName.toLowerCase()=="option"){var E=B(this).parent("select");if(C&&E[0]&&E[0].type=="select-one"){E.find("option").selected(false)}this.selected=C}}})};function A(){if(B.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}}})(jQuery);(function(A){A.fn.shadowEnable=function(){return A(this).find("+ .fx-shadow").show().end()};A.fn.shadowDisable=function(){return A(this).find("+ .fx-shadow").hide().end()};A.fn.shadowDestroy=function(){return A(this).find("+ .fx-shadow").remove().end()};A.fn.shadow=function(B){B=A.extend({offset:1,opacity:0.2,color:"#000",monitor:false},B||{});
B.offset-=1;return this.each(function(){var C=A(this).shadowDestroy(),D=A("<div class='fx-shadow' style='position: relative;'></div>").insertAfter(C);baseWidth=C.outerWidth(),baseHeight=C.outerHeight(),position=C.position(),zIndex=parseInt(C.css("zIndex"))||0;A('<div class="fx-shadow-color fx-shadow-layer-1"></div>').css({position:"absolute",opacity:B.opacity-0.05,left:B.offset,top:B.offset,width:baseWidth+1,height:baseHeight+1}).appendTo(D);A('<div class="fx-shadow-color fx-shadow-layer-2"></div>').css({position:"absolute",opacity:B.opacity-0.1,left:B.offset+2,top:B.offset+2,width:baseWidth,height:baseHeight-3}).appendTo(D);A('<div class="fx-shadow-color fx-shadow-layer-3"></div>').css({position:"absolute",opacity:B.opacity-0.1,left:B.offset+2,top:B.offset+2,width:baseWidth-3,height:baseHeight}).appendTo(D);A('<div class="fx-shadow-color fx-shadow-layer-4"></div>').css({position:"absolute",opacity:B.opacity,left:B.offset+1,top:B.offset+1,width:baseWidth-1,height:baseHeight-1}).appendTo(D);A("div.fx-shadow-color",D).css("background-color",B.color);C.css({zIndex:zIndex+1,position:(C.css("position")=="static"?"relative":"")});D.css({position:"absolute",zIndex:zIndex,top:position.top+"px",left:position.left+"px",width:baseWidth,height:baseHeight,marginLeft:C.css("marginLeft"),marginRight:C.css("marginRight"),marginBottom:C.css("marginBottom"),marginTop:C.css("marginTop")});if(B.monitor){function E(){var F=A(this),G=F.next(".fx-shadow");G.css({top:parseInt(F.css("top"))+"px",left:parseInt(F.css("left"))+"px"});A(">*",G).css({height:this.offsetHeight+"px",width:this.offsetWidth+"px"})}C.bind("DOMAttrModified",E);if(D[0].style.setExpression){D[0].style.setExpression("top","parseInt(this.previousSibling.currentStyle.top ) + 'px'");D[0].style.setExpression("left","parseInt(this.previousSibling.currentStyle.left) + 'px'")}}})}})(jQuery);(function($,undefined){if(!window.console){window.console={log:function(){},info:function(){},debug:function(){},warn:function(){},error:function(){}}}$.suggest=function(name,prototype){$.fn[name]=function(options){if(!this.length){console.warn("Suggest: invoked on empty element set")}return this.each(function(){if(this.nodeName){if(this.nodeName.toUpperCase()==="INPUT"){if(this.type&&this.type.toUpperCase()!=="TEXT"){console.warn("Suggest: unsupported INPUT type: "+this.type)}}else{console.warn("Suggest: unsupported DOM element: "+this.nodeName)}}var instance=$.data(this,name);if(instance){instance._destroy()}$.data(this,name,new $.suggest[name](this,options))._init()})};$.suggest[name]=function(input,options){var self=this,o=this.options=$.extend(true,{},$.suggest.defaults,$.suggest[name].defaults,options),p=o.css_prefix=o.css_prefix||"",css=o.css;this.name=name;$.each(css,function(k,v){css[k]=p+css[k]});o.ac_param={};$.each(["type","type_strict","mql_filter","as_of_time","exclude_guids","category"],function(i,n){var v=o[n];if(v===null||v===""){return }if(typeof v==="object"){if(typeof JSON==="undefined"){init_JSON()}v=JSON.stringify(v)}o.ac_param[n]=v});if(o.ac_param.type){this.options._type=$.map(o.ac_param.type.split(/[, ]/),function(n,i){return n.replace(/[\"\[\]]/g,"")})}this._status={START:"",LOADING:"",SELECT:""};if(o.status&&o.status instanceof Array&&o.status.length==3){this._status.START=o.status[0]||"";this._status.LOADING=o.status[1]||"";this._status.SELECT=o.status[2]||""}var s=this.status=$('<div style="display:none;">').addClass(css.status),l=this.list=$("<ul>").addClass(css.list),p=this.pane=$('<div style="display:none;" class="fbs-reset">').addClass(css.pane);p.append(s).append(l);if(o.parent){$(o.parent).append(p)}else{p.css("position","absolute");$(document.body).append(p)}p.bind("mousedown",function(e){self.input.data("dont_hide",true);e.stopPropagation()}).bind("mouseup",function(e){if(self.input.data("dont_hide")){self.input.focus()}self.input.removeData("dont_hide");e.stopPropagation()}).bind("click",function(e){e.stopPropagation();var s=self.get_selected();if(s){self.onselect(s,true);
self.hide_all()}});var hoverover=function(e){self.hoverover_list(e)};var hoverout=function(e){self.hoverout_list(e)};l.hover(hoverover,hoverout);this.input=$(input).attr("autocomplete","off").unbind(".suggest").bind("keydown.suggest",function(e){self.keydown(e)}).bind("keypress.suggest",function(e){self.keypress(e)}).bind("keyup.suggest",function(e){self.keyup(e)}).bind("blur.suggest",function(e){self.blur(e)}).bind("textchange.suggest",function(e){self.textchange()}).bind("focus.suggest",function(e){self.focus(e)}).bind($.browser.msie?"paste.suggest":"input.suggest",function(e){clearTimeout(self.paste_timeout);self.paste_timeout=setTimeout(function(){self.textchange()},0)});this.onresize=function(e){self.invalidate_position();if(p.is(":visible")){self.position();if(o.flyout&&self.flyoutpane&&self.flyoutpane.is(":visible")){var s=self.get_selected();if(s){self.flyout_position(s)}}}};$(window).bind("resize.suggest",this.onresize).bind("scroll.suggest",this.onresize)};$.suggest[name].prototype=$.extend({},$.suggest.prototype,prototype)};$.suggest.prototype={_init:function(){},_destroy:function(){this.pane.remove();this.list.remove();this.input.unbind(".suggest");$(window).unbind("resize.suggest",this.onresize).unbind("scroll.suggest",this.onresize);this.input.removeData("data.suggest")},invalidate_position:function(){self._position=null},status_start:function(){this.hide_all();this.status.siblings().hide();if(this._status.START){this.status.text(this._status.START).show();if(!this.pane.is(":visible")){this.position();this.pane_show()}}if(this._status.LOADING){this.status.removeClass("loading")}},status_loading:function(){this.status.siblings().show();if(this._status.LOADING){this.status.addClass("loading").text(this._status.LOADING).show();if(!this.pane.is(":visible")){this.position();this.pane_show()}}else{this.status.hide()}},status_select:function(){this.status.siblings().show();if(this._status.SELECT){this.status.text(this._status.SELECT).show()}else{this.status.hide()}if(this._status.LOADING){this.status.removeClass("loading")}},focus:function(e){var o=this.options;if($.trim(this.input.val())===""){this.status_start()}else{this.focus_hook(e)}},focus_hook:function(e){if(!this.input.data("data.suggest")&&!this.pane.is(":visible")&&$("."+this.options.css.item,this.list).length){this.position();this.pane_show()}},keydown:function(e){var key=e.keyCode;if(key===9){this.tab(e)}else{if(key===38||key===40){if(!e.shiftKey){e.preventDefault()}}}},keypress:function(e){var key=e.keyCode;if(key===38||key===40){if(!e.shiftKey){e.preventDefault()}}else{if(key===13){this.enter(e)}}},keyup:function(e){var key=e.keyCode;if(key===38){e.preventDefault();this.up(e)}else{if(key===40){e.preventDefault();this.down(e)}else{if(e.ctrlKey&&key===77){$(".fbs-more-link",this.pane).click()}else{if($.suggest.is_char(e)){clearTimeout(this.keypress.timeout);var self=this;this.keypress.timeout=setTimeout(function(){self.textchange()},0)}else{if(key===27){this.escape(e)}}}}}return true},blur:function(e){if(this.input.data("dont_hide")){return }var data=this.input.data("data.suggest");if(!data){this.check_required(e)}this.hide_all()},tab:function(e){if(e.shiftKey||e.metaKey||e.ctrlKey){return }var o=this.options,visible=this.pane.is(":visible")&&$("."+o.css.item,this.list).length,s=this.get_selected();if(visible&&s){this.onselect(s);this.hide_all()}},enter:function(e){var o=this.options,visible=this.pane.is(":visible");if(visible){if(e.shiftKey){this.shift_enter(e);e.preventDefault()}else{if($("."+o.css.item,this.list).length){var s=this.get_selected();if(s){this.onselect(s);this.hide_all();e.preventDefault()}else{var data=this.input.data("data.suggest");if(o.soft){if(!data){this.check_required(e)}}else{if($("."+this.options.css.item+":visible",this.list).length){this.updown(false);e.preventDefault()}else{if(!data){this.check_required(e)}}}}}}}},shift_enter:function(e){},escape:function(e){this.hide_all()},up:function(e){this.updown(true,e.ctrlKey||e.shiftKey)},down:function(e){this.updown(false,null,e.ctrlKey||e.shiftKey)
},updown:function(goup,gofirst,golast){var o=this.options,css=o.css,p=this.pane,l=this.list;if(!p.is(":visible")){if(!goup){this.textchange()}return }var li=$("."+css.item+":visible",l);if(!li.length){return }var first=$(li[0]),last=$(li[li.length-1]),cur=this.get_selected()||[];clearTimeout(this.ignore_mouseover.timeout);this._ignore_mouseover=false;if(goup){if(gofirst){this._goto(first)}else{if(!cur.length){this._goto(last)}else{if(cur[0]==first[0]){first.removeClass(css.selected);this.input.val(this.input.data("original.suggest"));this.hoverout_list()}else{var prev=cur.prevAll("."+css.item+":visible:first");this._goto(prev)}}}}else{if(golast){this._goto(last)}else{if(!cur.length){this._goto(first)}else{if(cur[0]==last[0]){last.removeClass(css.selected);this.input.val(this.input.data("original.suggest"));this.hoverout_list()}else{var next=cur.nextAll("."+css.item+":visible:first");this._goto(next)}}}}},_goto:function(li){li.trigger("mouseover.suggest");var d=li.data("data.suggest");this.input.val(d?d.name:this.input.data("original.suggest"));this.scroll_to(li)},scroll_to:function(item){var l=this.list,scrollTop=l.scrollTop(),scrollBottom=scrollTop+l.innerHeight(),item_height=item.outerHeight(),offsetTop=item.prevAll().length*item_height,offsetBottom=offsetTop+item_height;if(offsetTop<scrollTop){this.ignore_mouseover();l.scrollTop(offsetTop)}else{if(offsetBottom>scrollBottom){this.ignore_mouseover();l.scrollTop(scrollTop+offsetBottom-scrollBottom)}}},textchange:function(){this.input.removeData("data.suggest");this.input.trigger("fb-textchange",this);var val=$.trim(this.input.val());if(val===""){this.status_start();return }else{this.status_loading()}this.request(val)},request:function(){},response:function(data){if("cost" in data){this.trackEvent(this.name,"response","cost",data.cost)}if(!this.check_response(data)){return }var result=[];if($.isArray(data)){result=data}else{if("result" in data){result=data.result}}var args=$.map(arguments,function(a){return a});this.response_hook.apply(this,args);var first=null,self=this,o=this.options;$.each(result,function(i,n){var li=self.create_item(n,data).bind("mouseover.suggest",function(e){self.mouseover_item(e)}).data("data.suggest",n);self.list.append(li);if(i===0){first=li}});this.input.data("original.suggest",this.input.val());if($("."+o.css.item,this.list).length===0){var $nomatch=$('<li class="nomatch">').html(o.nomatch).bind("click.suggest",function(e){e.stopPropagation()});this.list.append($nomatch)}args.push(first);this.show_hook.apply(this,args);this.position();this.pane_show()},pane_show:function(){if(!this.pane.is(":visible")){if(this.options.animate){this.pane.slideDown("fast")}else{this.pane.show()}}this.input.trigger("fb-pane-show",this)},create_item:function(data,response_data){var css=this.options.css;li=$("<li>").addClass(css.item);var label=$("<label>").text(data.name);data.name=label.text();li.append($("<div>").addClass(css.item_name).append(label));return li},mouseover_item:function(e){if(this._ignore_mouseover){return }var target=e.target;if(target.nodeName.toLowerCase()!=="li"){target=$(target).parents("li:first")}var li=$(target),css=this.options.css,l=this.list;$("."+css.item,l).each(function(){if(this!==li[0]){$(this).removeClass(css.selected)}});if(!li.hasClass(css.selected)){li.addClass(css.selected);this.mouseover_item_hook(li)}},mouseover_item_hook:function($li){},hoverover_list:function(e){},hoverout_list:function(e){},check_response:function(response_data){return true},response_hook:function(response_data){this.list.empty()},show_hook:function(response_data){this.status_select()},position:function(){var p=this.pane,o=this.options;if(o.parent){return }if(!self._position){var inp=this.input,pos=inp.offset(),input_width=inp.outerWidth(true),input_height=inp.outerHeight(true);pos.top+=input_height;var pane_width=p.outerWidth(),pane_height=p.outerHeight(),pane_right=pos.left+pane_width,pane_bottom=pos.top+pane_height,pane_half=pos.top+pane_height/2,scroll_left=$(window).scrollLeft(),scroll_top=$(window).scrollTop(),window_width=$(window).width(),window_height=$(window).height(),window_right=window_width+scroll_left,window_bottom=window_height+scroll_top;
var left=true;if("left"==o.align){left=true}else{if("right"==o.align){left=false}else{if(pos.left>(scroll_left+window_width/2)){left=false}}}if(!left){left=pos.left-(pane_width-input_width);if(left>scroll_left){pos.left=left}}if(pane_half>window_bottom){var top=pos.top-input_height-pane_height;if(top>scroll_top){pos.top=top}}this._position=pos}p.css({top:this._position.top,left:this._position.left})},ignore_mouseover:function(e){this._ignore_mouseover=true;var self=this;this.ignore_mouseover.timeout=setTimeout(function(){self.ignore_mouseover_reset()},1000)},ignore_mouseover_reset:function(){this._ignore_mouseover=false},get_selected:function(){var selected=null,select_class=this.options.css.selected;$("li",this.list).each(function(){var $this=$(this);if($this.hasClass(select_class)&&$this.is(":visible")){selected=$this;return false}});return selected},onselect:function($selected,focus){var data=$selected.data("data.suggest");if(data){this.input.val(data.name).data("data.suggest",data).trigger("fb-select",data);this.trackEvent(this.name,"fb-select","index",$selected.prevAll().length)}else{}if(focus){}},trackEvent:function(category,action,label,value){this.input.trigger("fb-track-event",{category:category,action:action,label:label,value:value})},check_required:function(e){var required=this.options.required;if(required===true){if(!$.trim(this.input.val())){this.input.trigger("fb-required",{domEvent:e});return false}}else{if(required==="always"){this.input.trigger("fb-required",{domEvent:e});return false}}return true},hide_all:function(e){this.pane.hide();this.input.trigger("fb-pane-hide",this)}};$.extend($.suggest,{defaults:{status:["Start typing to get suggestions...","Searching...","Select an item from the list:"],required:false,soft:false,nomatch:"no matches",css:{pane:"fbs-pane",list:"fbs-list",item:"fbs-item",item_name:"fbs-item-name",selected:"fbs-selected",status:"fbs-status"},css_prefix:null,parent:null,animate:false},$$:function(cls,ctx){return $("."+cls,ctx)},use_jsonp:function(service_url){if(!service_url){return false}var pathname_len=window.location.pathname.length;var hostname=window.location.href;hostname=hostname.substr(0,hostname.length-pathname_len);if(hostname===service_url){return false}return true},strongify:function(str,substr){var strong=str;var index=str.toLowerCase().indexOf(substr.toLowerCase());if(index>=0){var substr_len=substr.length;strong=$("<div>").text(str.substring(0,index)).append($("<strong>").text(str.substring(index,index+substr_len))).append(document.createTextNode(str.substring(index+substr_len))).html()}return strong},keyCode:{CAPS_LOCK:20,CONTROL:17,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ENTER:108,PAGE_DOWN:34,PAGE_UP:33,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,OPTION:18,APPLE:224},is_char:function(e){if(e.type==="keypress"){if((e.metaKey||e.ctrlKey)&&e.charCode===118){return true}else{if("isChar" in e){return e.isChar}}}else{var not_char=$.suggest.keyCode.not_char;if(!not_char){not_char={};$.each($.suggest.keyCode,function(k,v){not_char[""+v]=1});$.suggest.keyCode.not_char=not_char}return !((""+e.keyCode) in not_char)}}});var base={_destroy:$.suggest.prototype._destroy,show_hook:$.suggest.prototype.show_hook};$.suggest("suggest",{_init:function(){var self=this,o=this.options;if(!o.flyout_service_url){o.flyout_service_url=o.service_url}this.jsonp=$.suggest.use_jsonp(o.service_url);if(!$.suggest.cache){$.suggest.cache={}}if(o.flyout){this.flyoutpane=$('<div style="display:none;position:absolute" class="fbs-reset">').addClass(o.css_prefix+o.css.flyoutpane);$(document.body).append(this.flyoutpane);var hoverover=function(e){self.hoverover_list(e)};var hoverout=function(e){self.hoverout_list(e)};this.flyoutpane.hover(hoverover,hoverout).bind("mousedown.suggest",function(e){e.stopPropagation();self.pane.click()});if(!$.suggest.flyout){$.suggest.flyout={}}if(!$.suggest.flyout.cache){$.suggest.flyout.cache={}}}},_destroy:function(){base._destroy.call(this);if(this.flyoutpane){this.flyoutpane.remove()
}this.input.removeData("request.count.suggest");this.input.removeData("flyout.request.count.suggest")},shift_enter:function(e){if(this.options.suggest_new){this.suggest_new();this.hide_all()}else{this.check_required(e)}},hide_all:function(e){this.pane.hide();if(this.flyoutpane){this.flyoutpane.hide()}this.input.trigger("fb-pane-hide",this)},request:function(val,start){var self=this,o=this.options;if(this.ac_xhr){this.ac_xhr.abort();this.ac_xhr=null}var data={prefix:val};if(start){data.start=start}$.extend(data,o.ac_param);var url=o.service_url+o.service_path+"?"+$.param(data),cached=$.suggest.cache[url];if(cached){this.response(cached,start?start:-1,true);return }clearTimeout(this.request.timeout);this.request.timeout=setTimeout(function(){self.ac_xhr=$.ajax({url:o.service_url+o.service_path,data:data,beforeSend:function(){var calls=self.input.data("request.count.suggest")||0;if(!calls){self.trackEvent(self.name,"start_session")}calls+=1;self.trackEvent(self.name,"request","count",calls);self.input.data("request.count.suggest",calls)},success:function(data){$.suggest.cache[url]=data;self.response(data,start?start:-1)},error:function(xhr){self.trackEvent(self.name,"request","error",{url:this.url,response:xhr?xhr.responseText:""})},complete:function(xhr){if(xhr){self.trackEvent(self.name,"request","tid",xhr.getResponseHeader("X-Metaweb-TID"))}},dataType:self.jsonp?"jsonp":"json",cache:true})},o.xhr_delay)},create_item:function(data,response_data){var css=this.options.css;var li=$("<li>").addClass(css.item);var name=$("<div>").addClass(css.item_name).append($("<label>").append($.suggest.strongify(data.name||data.guid,response_data.prefix))),types=data.type;data.name=name.text();li.append(name);var nt=data["n:type"]||data["notable:type"];if(nt){if(typeof nt==="object"){name.prepend($("<div>").addClass(css.item_type).text(nt.name))}else{var notable,type,is_topic=false;$.each(data.type,function(i,n){if(n.id===nt){notable=n.name}if(n.id==="/common/topic"){is_topic="Topic"}else{if(!type){type=n.name}}});if(notable||type||is_topic){name.prepend($("<div>").addClass(css.item_type).text(notable||type||is_topic))}}}return li},mouseover_item_hook:function(li){var data=li.data("data.suggest");if(this.options.flyout){if(data){this.flyout_request(data)}else{}}},check_response:function(response_data){return response_data.prefix===$.trim(this.input.val())},response_hook:function(response_data,start){if(this.flyoutpane){this.flyoutpane.hide()}if(start>0){$(".fbs-more",this.pane).remove()}else{this.list.empty()}},show_hook:function(response_data,start,first){base.show_hook.apply(this,[response_data]);var o=this.options,self=this,p=this.pane,l=this.list,result=response_data.result;var more=$(".fbs-more",p),suggestnew=$(".fbs-suggestnew",p);if(result&&result.length&&"start" in response_data){if(!more.length){var more_link=$('<a class="fbs-more-link" href="#" title="(Ctrl+m)">view more</a>');more=$('<div class="fbs-more">').append(more_link);more_link.bind("click.suggest",function(e){e.preventDefault();e.stopPropagation();var m=$(this).parent(".fbs-more");self.more(m.data("start.suggest"))});l.after(more)}more.data("start.suggest",response_data.start);more.show()}else{more.remove()}if(o.suggest_new){if(!suggestnew.length){var button=$('<button class="fbs-suggestnew-button">');button.text(o.suggest_new);suggestnew=$('<div class="fbs-suggestnew">').append('<div class="fbs-suggestnew-description">Your item not in the list?</div>').append(button).append('<span class="fbs-suggestnew-shortcut">(Shift+Enter)</span>').bind("click.suggest",function(e){e.stopPropagation();self.suggest_new(e)});p.append(suggestnew)}suggestnew.show()}else{suggestnew.remove()}if(first&&first.length&&start>0){var top=first.prevAll().length*first.outerHeight();var scrollTop=l.scrollTop();l.animate({scrollTop:top},"slow",function(){first.trigger("mouseover.suggest")})}},suggest_new:function(e){var val=$.trim(this.input.val());if(!val){return }this.input.data("data.suggest",val).trigger("fb-select-new",val);
this.trackEvent(this.name,"fb-select-new","index","new");this.hide_all()},more:function(start){if(start){var orig=this.input.data("original.suggest");if(orig!==null){this.input.val(orig)}this.request($.trim(this.input.val()),start);this.trackEvent(this.name,"more","start",start)}return false},flyout_request:function(data){var self=this;if(this.flyout_xhr){this.flyout_xhr.abort();this.flyout_xhr=null}var o=this.options,sug_data=this.flyoutpane.data("data.suggest");if(sug_data&&data.id===sug_data.id){if(!this.flyoutpane.is(":visible")){var s=this.get_selected();this.flyout_position(s);this.flyoutpane.show()}return }var cached=$.suggest.flyout.cache[data.id];if(cached){this.flyout_response(cached);return }var submit_data={id:data.id};if(o.as_of_time){submit_data.as_of_time=o.as_of_time}clearTimeout(this.flyout_request.timeout);this.flyout_request.timeout=setTimeout(function(){self.flyout_xhr=$.ajax({url:o.flyout_service_url+o.flyout_service_path,data:submit_data,beforeSend:function(){var calls=self.input.data("flyout.request.count.suggest")||0;calls+=1;self.trackEvent(self.name,"flyout.request","count",calls);self.input.data("flyout.request.count.suggest",calls)},success:function(data){data=self.jsonp?data:{id:submit_data.id,html:data};$.suggest.flyout.cache[data.id]=data;self.flyout_response(data)},error:function(xhr){self.trackEvent(self.name,"flyout","error",{url:this.url,response:xhr?xhr.responseText:""})},complete:function(xhr){if(xhr){self.trackEvent(self.name,"flyout","tid",xhr.getResponseHeader("X-Metaweb-TID"))}},dataType:self.jsonp?"jsonp":"html",cache:true})},o.xhr_delay)},flyout_response:function(data){var o=this.options,p=this.pane,s=this.get_selected()||[];if(p.is(":visible")&&s.length){var sug_data=s.data("data.suggest");if(sug_data&&data.id===sug_data.id){this.flyoutpane.html(data.html);this.flyout_position(s);this.flyoutpane.show().data("data.suggest",sug_data)}}},flyout_position:function($item){var p=this.pane,fp=this.flyoutpane,css=this.options.css,pos=undefined,old_pos={top:parseInt(fp.css("top"),10),left:parseInt(fp.css("left"),10)},pane_pos=p.offset(),pane_width=p.outerWidth(),flyout_height=fp.outerHeight(),flyout_width=fp.outerWidth();if(this.options.flyout==="bottom"){pos=pane_pos;var input_pos=this.input.offset();if(pane_pos.top<input_pos.top){pos.top-=flyout_height}else{pos.top+=p.outerHeight()}fp.addClass(css.flyoutpane+"-bottom")}else{pos=$item.offset();var item_height=$item.outerHeight();pos.left+=pane_width;var flyout_right=pos.left+flyout_width,scroll_left=$(document.body).scrollLeft(),window_right=$(window).width()+scroll_left;pos.top=pos.top+item_height-flyout_height;if(pos.top<pane_pos.top){pos.top=pane_pos.top}if(flyout_right>window_right){var left=pos.left-(pane_width+flyout_width);if(left>scroll_left){pos.left=left}}fp.removeClass(css.flyoutpane+"-bottom")}if(!(pos.top===old_pos.top&&pos.left===old_pos.left)){fp.css({top:pos.top,left:pos.left})}},hoverout_list:function(e){if(this.flyoutpane&&!this.get_selected()){this.flyoutpane.hide()}}});$.extend($.suggest.suggest,{defaults:{type:null,type_strict:"any",mql_filter:null,as_of_time:null,service_url:"http://www.freebase.com",service_path:"/private/suggest",align:null,flyout:true,flyout_service_url:null,flyout_service_path:"/private/flyout",suggest_new:null,nomatch:'<em class="fbs-nomatch-text">No suggested matches.</em><h3>Tips on getting better suggestions:</h3><ul class="fbs-search-tips"><li>Enter more or fewer characters</li><li>Add words related to your original search</li><li>Try alternate spellings</li><li>Check your spelling</li></ul>',css:{item_type:"fbs-item-type",flyoutpane:"fbs-flyout-pane"},xhr_delay:200}});function init_JSON(){if(!this.JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"
};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}())}})(jQuery);jQuery.suggest.version="Version:r83499M Built:Fri Oct 16 2009 by daepark";(function(C,A){var B=A.QA={};C(document.body).bind("ajaxStart",function(){B.ajaxStart.apply(this,arguments)}).bind("ajaxSend",function(){B.ajaxSend.apply(this,arguments)}).bind("ajaxSuccess",function(){B.ajaxSuccess.apply(this,arguments)}).bind("ajaxError",function(){B.ajaxError.apply(this,arguments)}).bind("ajaxComplete",function(){B.ajaxComplete.apply(this,arguments)}).bind("ajaxStop",function(){B.ajaxStop.apply(this,arguments)});B.ajaxStart=function(D){C(this).attr("ajax","ajaxStart")};B.ajaxSend=function(E,F,D){};B.ajaxSuccess=function(E,F,D){};B.ajaxError=function(F,G,E,D){};B.ajaxComplete=function(E,F,D){};B.ajaxStop=function(D){C(this).attr("ajax","ajaxStop")}})(jQuery,window.freebase);if(typeof T_0=="undefined"){T_0=new Date()}if(!window.freebase){window.freebase={mwLWTReloading:false}}(function(C){if($.cookie("mwLWTReloaded")){$.cookie("mwLWTReloaded",null,{path:"/"});return }if($(document.body).attr("skipreload")){return 
}var E=0;var F=window.PAGE_LASTWRITETIME;var G="mwLastWriteTime";if(document.cookie&&document.cookie!=""){var I=document.cookie.split(";");var H=false;for(var D=0;D<I.length;D++){var A=jQuery.trim(I[D]);if(A.substring(0,G.length+1)==(G+"=")){cookieValue=decodeURIComponent(A.substring(G.length+1));cookie_parts=cookieValue.split("|");if(cookie_parts.length==3&&typeof (GRAPH_POD)!="undefined"&&cookie_parts[2]==GRAPH_POD){if(!H){cookiew_lwt=0}H=true;if(cookie_parts[0]>E){E=cookie_parts[0]}}else{if(cookie_parts.length==2&&!H){if(cookie_parts[0]>E){E=cookie_parts[0]}}}}}}var B=E?parseInt(E,10):-1;var J=F?parseInt(F,10):-1;if(E&&F&&(J<B)){$.cookie("mwLWTReloaded","true",{path:"/"});C.mwLWTReloading=true;window.location.reload(true)}})(window.freebase);(function($,fb){fb.NO_OP=function NO_OP(){return false};fb.PARAM_DELIM="\001";var p="/private";fb.AC_PATH=p+"/autocomplete";var ap=p+"/account";fb.ACCOUNT_CREATE=ap+"/create";fb.ACCOUNT_INFO=ap+"/information";fb.ACCOUNT_ACTIVATE=ap+"/activate";fb.ACCOUNT_RECOVER_PW=ap+"/recover_password";fb.ACCOUNT_CHANGE_PW=ap+"/password_change";fb.ACCOUNT_MODIFY=ap+"/modify";fb.ACCOUNT_UNSUBSCRIBE=ap+"/unsubscribe";fb.ACCOUNT_VERIFY=ap+"/verify";fb.ACCOUNT_REACTIVATE=ap+"/reactivate";if(JSON&&$.browser.msie){JSON.NEWLINE="\u000A\u000D"}fb.Debug=window.Debug={m:["log","debug","info","warn","error",,"dir","dirxml","trace","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","count"],console_wrapper:function(method_name){function m(){if(typeof firebug!=="undefined"&&"d" in firebug&&typeof firebug.d[method_name]==="function"){return firebug.d[method_name].apply(firebug.d,arguments)}else{if(window.console){if(typeof window.console[method_name]==="function"){return window.console[method_name].apply(window.console,arguments)}else{if(typeof window.console[method_name]==="object"){return window.console[method_name]($.map(arguments,function(n,i){return n}).join(","))}}}}}return m},enable:function(l){for(var i=0,len=Debug.m.length;i<len;i++){var m=Debug.m[i];switch(l){case"error":if(m!="error"){Debug[m]=fb.NO_OP}break;case"all":if(m=="error"){Debug.error=Debug.debug_error}else{Debug[m]=Debug.console_wrapper(m)}break;default:Debug[m]=fb.NO_OP;break}Debug["_"+m]=Debug.console_wrapper(m)}},debug_error:function(){Debug.console_wrapper("open")();Debug.console_wrapper("error")(arguments)},assert:function(){if(!arguments[0]){Debug.console_wrapper("error")(arguments);Debug.console_wrapper("trace")()}},assertEquals:function(a,e,args){fb.Debug.assert(a==e,"expected "+e+", got "+a,args)},assertNotEquals:function(a,e,args){fb.Debug.assert(a!=e,"expected "+e+" not to be "+a,args)},assertInObject:function(prop,hash,args){fb.Debug.assert(prop in hash,"expected "+prop+" to be in "+JSON.format(hash),args)},assertInArray:function(o,a,args){fb.Debug.assert($.inArray(o,a)!=-1,"expected "+o+" to be in "+JSON.format(a),args)},assertNull:function(value,args){fb.Debug.assert(value==null||typeof value=="undefined",args)},assertNotNull:function(value,args){fb.Debug.assert(value!=null&&typeof value!="undefined",args)}};Debug.enable("disable");String.prototype.startsWith=function(substr){return this.slice(0,substr.length)==substr};String.prototype.endsWith=function(substr){return substr==""||this.slice(-substr.length)==substr};fb.Set=function(){this.data=[]};fb.Set.prototype.empty=function(){return this.data.length==0};fb.Set.prototype.contains=function(e){return $.inArray(e,this.data)!=-1};fb.Set.prototype.add=function(e){var c=this.contains(e);if(!c){this.data.push(e)}return !c};fb.Set.prototype.remove=function(e){var index=$.inArray(e,this.data);fb.Debug.log(index,e,this.data);if(index!=-1){this.data.splice(index,1)}return index!=-1};fb.Set.prototype.toString=function(){return this.data.toString()};fb.new_id=function(e){return"FBID"+(Math.random().toFixed(3)*1000)};fb.get_cookie_domain=function(){var host=document.location.hostname;var parts=host.split("."),len=parts.length,domain=null;if(/^\d+$/.test(parts[len-1])){domain=null
}else{if(len>1){domain="."+".".join(parts.slice(len-2))}else{domain=null}}return domain};$.extend({localStore:function(key,val,use_cookie,cookie_options){var hostname=document.location.hostname;var prefix=document.location.protocol;if(typeof val!="undefined"){var valstr=JSON.format(val);if(!use_cookie&&window.globalStorage){window.globalStorage[hostname][prefix+key]=valstr}else{if(val===null){var cookie_settings={};if(COOKIE_DOMAIN){cookie_settings.domain=COOKIE_DOMAIN}else{cookie_settings.domain=fb.get_cookie_domain()}$.cookie(key,null,cookie_settings)}else{$.cookie(key,valstr,$.extend(cookie_settings,{expires:14,path:"/"}))}}return val}else{if(!use_cookie&&window.globalStorage){if(window.globalStorage[hostname][prefix+key]){val=window.globalStorage[hostname][prefix+key].value}}else{val=$.cookie(key)}if(val!=null){return JSON.parse(val,null)}}return null}});fb.window_arg={};var q=window.location.search;if(q&&q.length>0){q=q.substring(1);var vars=q.split("&");for(var i=0,len=vars.length;i<len;i++){var index=vars[i].indexOf("=");if(index!=-1){var name=vars[i].substring(0,index);var value=vars[i].substring(index+1);if(!(name in fb.window_arg)){fb.window_arg[name]=[]}var value_esc=value.replace(/\+/g," ");fb.window_arg[name].push(decodeURIComponent(value_esc))}}}fb.arg=function(name,multiple){if(name in fb.window_arg){return multiple?fb.window_arg[name]:fb.window_arg[name][0]}else{return multiple?[]:null}};fb.load_css=function(sourcepath){if(sourcepath in fb.load_css.LOADED){return }var el=$(fb.sprintf("<link rel='stylesheet' type='text/css' href='%s'/>",fb.sprintf("%s/%s",RESOURCE_ROOT,sourcepath)));$("head:first").append(el);fb.load_css.LOADED[sourcepath]=true};fb.load_css.LOADED={};fb.with_source_js=function(sourcepath,callback){if(!fb.document_loaded){$(function(){fb.with_source_js._go(sourcepath,callback)})}else{fb.with_source_js._go(sourcepath,callback)}};fb.with_source_js.LOADED={};fb.with_source_js._go=function(sourcepath,callback){if(typeof sourcepath=="string"){fb.with_source_js._load(sourcepath,callback)}else{if(sourcepath.length==0){callback()}else{fb.with_source_js._load(sourcepath.shift(),(sourcepath.length==0?callback:function(){fb.with_source_js._go((sourcepath.length==1?sourcepath.shift():sourcepath),callback)}))}}};fb.with_source_js._load=function(sourcepath,callback){if(sourcepath in fb.with_source_js.LOADED){fb.doLater(null,callback)}else{function ajax_source_loaded(){fb.Debug.log("loaded source js ",sourcepath);fb.with_source_js.LOADED[sourcepath]=true;callback()}var url=sourcepath;if(!url.match(/^\w+:\/\//)){url=fb.sprintf("%s/%s",LIBRARY_ROOT_REL,url)}fb.Debug.log("loading source js",url);$.ajax({type:"GET",url:url,success:ajax_source_loaded,error:function(e){fb.Debug.error("Couldn't load source:",e)},dataType:"script",cache:!DONT_CACHE_XHR})}};fb.with_source_js.loaded=function(sourcepath){return fb.with_source_js.LOADED[sourcepath]===true};fb.sprintf=function(str){var argIndex=1;var localArgs=arguments;function replace(){return localArgs[argIndex++]}var res=str.replace(/%s/g,replace);return(res)};fb.is_metaweb_system_type=function(typeId){return(typeId.startsWith("/type/")||(typeId.startsWith("/common/")&&typeId!="/common/topic")||(typeId.startsWith("/freebase/")&&typeId.endsWith("_profile")))};fb.is_literal_type=function(id){return $.inArray(id,["/type/int","/type/float","/type/boolean","/type/rawstring","/type/uri","/type/text","/type/datetime","/type/bytestring","/type/id","/type/key","/type/value","/type/enumeration"])!=-1};fb.delegate=function(fn,thisArg,argArray){if(typeof argArray=="undefined"){argArray=[]}var dg=function(){var f_args=[];for(var i=0,len=arguments.length;i<len;i++){f_args.push(arguments[i])}if(arguments.callee&&arguments.callee.fn){return(arguments.callee.fn.apply(arguments.callee.thisArg,arguments.callee.argArray.concat(f_args)))}return undefined};dg.thisArg=thisArg;dg.fn=fn;dg.argArray=argArray;return(dg)};fb.url=fb.u={view:function(id,typeId,service,args){if(id){if(id.substr(0,1)=="#"){id=encodeURIComponent(id.substr(1))
}else{id=id.substr(1)}}else{id=""}if(!service&&id.substr(0,"topic/".length)=="topic/"){id=id.substr("topic/".length)}if(service){service=service+"/"}else{service=""}if(args){args="?"+args}else{args=""}var url=fb.sprintf("/view/%s%s%s",service,id,args);return(url)},signin:function(returnUrl){return $("#header, #mini-header").attr("fb__signin_url")},signout:function(returnUrl){return $("#header, #mini-header").attr("fb__signout_url")},signup:function(returnUrl){return $("#header, #mini-header").attr("fb__signup_url")},settings:function(returnUrl){return $("#header, #mini-header").attr("fb__settings_url")},user:function(id){return fb.u.view(id,null)},open:function(loc){if(loc){window.location=loc}return false},reload:function(){window.location.reload(true)},parse:function(url){return parseUri(url)}};function MetawebUser(){this.init();var owner=this;$(window).bind("login",function(){owner.onLogin()}).bind("logout",function(){owner.onLogout()})}MetawebUser.prototype={init:function(){var cookieInfo=$.cookie("metaweb-user-info");var oldGuid=this.guid;var oldName=this.name;if(cookieInfo){if(cookieInfo.indexOf("A|")==0){this.guid=this.cookieItem(cookieInfo,"g");this.name=this.cookieItem(cookieInfo,"u");this.path=this.cookieItem(cookieInfo,"p");if(!this.path){this.path="/user/"+this.name}}else{cookieInfo=unescape(cookieInfo).split("|");if(cookieInfo.length>=2){this.guid=cookieInfo[0];this.name=cookieInfo[1];this.path="/user/"+this.name}}}else{this.guid=null;this.name=null;this.path=null}this.displayName=this.name;return(oldGuid!=this.guid||oldName!=this.name)},onLogin:function(){this.init();fb.updateUserStatus()},onLogout:function(){this.init();fb.updateUserStatus()},cookieItem:function(c,i){var s=c.indexOf("|"+i+"_");if(s!=-1){s=s+2+i.length;var e=c.indexOf("|",s);if(e!=-1){return decodeURIComponent(c.substr(s,e-s))}}return null},getUser:function(){if(this.guid){return(this)}return undefined},signOut:function(){$.get("/api/account/logout",function(data){$(window).trigger("logout")});return false}};fb.getUser=function(){if(!fb._user){fb._user=new MetawebUser()}return fb._user};fb.updateUserStatus=function(){var user=fb.getUser();if(user&&user.name){var welcomeText=fb.sprintf('<div class="nav-user-controls"><strong id="nav-username"><a href="%s//%s/view/user/%s" title="View your profile">%s</a></strong>| <a href="%s" title="View your account info on Freebase">Settings</a> | <a href="%s" title="Sign out of Freebase">Sign out</a></div>',window.location.protocol,ROOT_HOSTNAME,user.name,user.name,fb.u.settings(),fb.u.signout());$("#nav-account").html(welcomeText)}else{var signupMarkup=fb.sprintf('<span id="anonymous-user-controls"><a href="%s" title="Sign in to your Freebase account">Sign in</a> | <a href="%s" title="Create an account with Freebase">Sign up</a></span>',fb.u.signin(window.location),fb.u.signup());$("#nav-account").html(signupMarkup)}};fb.browserChecked=true===$.localStore("mwbrowserchecked2");fb.firebugChecked=true===$.localStore("mwfirebugchecked");fb.browserWarn=function(){var v=parseFloat($.browser.version);if(fb.browserChecked||($.browser.mozilla&&v>=1.5)||($.browser.msie&&v>=7)||($.browser.safari)){return }fb.msg('You may be using a web browser that is not fully supported at this time.\n\nWe recommend one of the following web browsers: \n\n<a href="http://getfirefox.com">Firefox 2.0+</a> (Mac or PC), \n\n<a href="http://www.microsoft.com/windows/products/winfamily/ie/default.mspx">Internet Explorer 7.0+</a>, or <a href="http://www.apple.com/safari/">Safari 3.0+</a>.\n\nFor more information, see the <a href="http://www.freebase.com/view/guid/9202a8c04000641f800000000420601d" rel="help">Browser Support article</a>\n\nin our <a href="http://www.freebase.com/help/" rel="help">Help section</a>.',"WARN");$.localStore("mwbrowserchecked2",true);fb.browserChecked=true};fb.firebugWarn=function(){if(fb.firebugChecked||!window.console||!window.console.firebug){return }fb.msg("Firebug is known to make Freebase run slow unless it is configured correctly. Disable firebug to be sure the site peforms as expected.","WARN");
$.localStore("mwfirebugchecked",true);fb.firebugChecked=true};fb.transaction_id={};fb.transaction_id.ids=[];fb.transaction_id.suggest=[];fb.transaction_id.ajaxCompleteHandler=function(xml_http_response,textStatus){if(typeof xml_http_response=="undefined"||xml_http_response.readyState!=4){return }var tid=xml_http_response.getResponseHeader("x-metaweb-tid");if(tid){fb.Debug.log("got transaction id:",tid);fb.transaction_id.ids.push(tid)}};fb.initDevbar=function(){var devbar={div:$("#MetawebDevToolbar"),keyDown:function(e){if(e.keyCode==119||e.keyCode==123||(e.keyCode==68&&e.shiftKey&&e.ctrlKey)){devbar.toggle()}return true},toggle:function(){if(devbar.div.css("display")=="none"){$(devbar.div).show();$.localStore("devbar2",true)}else{$(devbar.div).hide();$.localStore("devbar2",false)}return false},refreshCache:function(){$.ajax({type:"POST",url:"/api/service/touch?mw_cookie_scope=domain",dataType:"json",data:"",beforeSend:function(xhr){xhr.setRequestHeader("X-Metaweb-Request","XMLHttpRequest")},success:devbar.refreshSuccess,error:devbar.refreshError});return false},refreshSuccess:function(data,status){},refreshError:function(xhr,status,error){},viewTransactionLog:function(e){return devbar._viewTransactionLog(e.target.href,fb.transaction_id.ids)},suggestTransactionLog:function(e){return devbar._viewTransactionLog(e.target.href,fb.transaction_id.suggest)},_viewTransactionLog:function(href,ids){if(ids&&ids.length){window.open(href+"?"+$.param({tid:ids}))}return false}};var debugLevel=$.localStore("debugLevel2");$(document).keydown(devbar.keyDown);$(".refreshCache",devbar.div).click(devbar.refreshCache);$(".viewTransactionLog",devbar.div).click(devbar.viewTransactionLog);$(".suggestTransactionLog",devbar.div).click(devbar.suggestTransactionLog);$(".viewClientTransactionLog",devbar.div).click(devbar.viewTransactionLog);$("#transaction_id").html(""+fb.transaction_id.ids);$(".hideMe",devbar.div).click(devbar.toggle);$(".debug-level > option",devbar.div).each(function(i){if(this.value==debugLevel){$(this).parent()[0].selectedIndex=i}}).parent().change(function(e){$.localStore("debugLevel2",e.target.value);Debug.enable(e.target.value)});Debug.enable(debugLevel);$.localStore("devbar2")?devbar.div.show():devbar.div.hide();$("#async-mql").click(function(){$.cookie("mql.allow_async",this.checked,{path:"/"})});$(document).bind("fb-track-event",function(e,data){if(data.category==="suggest"&&data.label==="tid"&&data.value){fb.Debug.log("got suggest transaction id: ",data.value);fb.transaction_id.suggest.push(data.value)}})};fb.msg=function(msg,type){type=(type||"INFO").toLowerCase();fb.Debug.assertInArray(type,["info","error","warn"]);var el=$(fb.sprintf("#%s",type.toLowerCase()));el.append(fb.sprintf("<li>%s</li>",msg)).show().parents().show()};fb.doLater=window.doLater=function(owner,method,delay,params){if(delay==undefined){delay=0}if(params==undefined){params=[]}if(owner==null){owner=arguments.caller}var handler=function(){method.apply(owner,params)};return setTimeout(handler,delay)};var RK=["all","any","as","attribute","attribution","class","connect","count","create","creator","cursor","datatype","default","delete","destroy","domain","else","for","function","future","guid","id","if","in","index","insert","is","key","keys","left","limit","link","meta","mql","name","namespace","object","offset","optional","pagesize","permission","property","read","relationship","replace","return","reverse","right","schema","scope","select","self","sort","sql","super","this","timestamp","type","typeguid","unique","update","value","var","while","write","xml"];var fbrk=fb.RESERVED_KEYS={};for(var i=0;i<RK.length;i++){fbrk[RK[i]]=1}fb.checkName=function(displayName,checkKey,firstToUpper,unicodeCheckKey){if(displayName==null){throw ("Null display name not allowed")}displayName=displayName.replace(/^\s*(.*?)\s*$/g,"$1");if(firstToUpper&&/^([a-z])/.test(displayName)){displayName=RegExp.$1.toUpperCase()+displayName.substring(1)}var key=null;if(checkKey){key=displayName.toLowerCase();
if(unicodeCheckKey){key=key.replace(/\s/g,"_")}else{key=key.replace(/[^A-Za-z0-9]/g,"_")}key=key.replace(/^([0-9_])/,"x$1");key=key.replace(/_{2,}/g,"_");key=key.replace(/_$/g,"");if(key in fb.RESERVED_KEYS){throw fb.sprintf('"%s" is a reserved word',key)}}return[displayName,key]};$.fn.outerHTML=function(){var el=this.eq(0);var result=el[0].outerHTML||$("<div>").append(el.clone()).html();return result.replace(/jQuery[\d]+=["']?[\d]+['"]?/g,"")};fb.mql={};fb.mql.STATUS_OK="/api/status/ok";fb.mql.read=function(query,success_callback,error_callback,complete_callback,method,is_raw){if(is_raw===undefined){var is_raw=false}var options={method:method||"GET",url:"/api/service/mqlread",query:query,success:success_callback,error:error_callback,complete:complete_callback,is_raw:is_raw};return fb.mql.service(options)};fb.mql.write=function(query,success_callback,error_callback,complete_callback,is_raw){if(is_raw===undefined){var is_raw=false}var options={method:"POST",url:"/api/service/mqlwrite",query:query,success:success_callback,error:error_callback,complete:complete_callback,is_raw:is_raw};return fb.mql.service(options)};fb.mql.service=function(options){var error_handler=options.error||fb.error.default_error_handler;var ajax_options={type:options.method||"GET",url:options.url||"/api/service/mqlread",dataType:"json",data:{queries:JSON.format({q1:{query:options.query}})},error:error_handler,success:function(data,status){if(data.code!=fb.mql.STATUS_OK||data.q1.code!=fb.mql.STATUS_OK){error_handler(this,(data.code==fb.mql.STATUS_OK?data.q1.code:data.code),"q1" in data?data.q1:null,data)}else{options.success(q,data.q1.result)}},beforeSend:fb.mql.service.beforeSend,complete:options.complete};if(options.is_raw===true){ajax_options.data={queries:JSON.format(options.query)};ajax_options.success=function(data,status){var flag=false;var code=null;flag=flag||(data.code!=fb.mql.STATUS_OK);if(flag){code=data.code}for(var props in options.query){flag=flag||(data[props].code!=fb.mql.STATUS_OK);if(flag){code=data.code;break}}if(flag){error_handler(this,code,data,data)}else{options.success(q,data)}}}ajax_options.data.mw_cookie_scope="domain";$.ajax(ajax_options)};fb.mql.service.beforeSend=function(xhr){xhr.setRequestHeader("X-Metaweb-Request","XMLHttpRequest")};fb.dialog=fb.dialog||{};fb.error={};fb.error.show_error_feedback_dialog=function(error_envelopes,content_target,debug_url){fb.Debug.group("fb.error.show_error_feedback_dialog");fb.with_source_js("src/errorfeedback.js",function(){fb.Debug.log("show_error_feedback_dialog: ",content_target," url: ",debug_url);if(content_target&&content_target.width()!=0){content_target.css({width:content_target.width()+"px"})}fb.errorfeedback.show_dialog(error_envelopes,content_target,debug_url)});fb.Debug.groupEnd("fb.error.show_error_feedback_dialog")};fb.error.render_signin=function(success_callback,cancel_callback){$.ajax({url:"/signin/signindialog",method:"get",success:function(html_response){fb.with_source_js("src/signin.js",function(){var d=fb.dialog.create_dialog(null,html_response);fb.dialog.show_with_block_ui(d);fb.run_init(fb.signin,"signin");var error_callback=fb.error.render_signin.cancel_callback_wrapper(cancel_callback);var event_handlers={login:success_callback,"login-cancel":error_callback};$.each(event_handlers,function(event_name,callback){$(window).one(event_name+".signin",function(e){fb.Debug.log("signin handler for ",e);$(window).unbind("login.signin");$(window).unbind("login-cancel.signin");fb.dialog.hide({target:d});d.empty().remove();if(callback){callback()}})})})}})};fb.error.render_signin.cancel_callback_wrapper=function(callback){return function(){$(document.body).removeClass("editing");if(callback){callback()}}};fb.error.ajax_errorHandler=function(signin_callback){return function(xml_http_response,text_status,error_thrown){var messages=fb.error.expand_error_envelope(xml_http_response,text_status,error_thrown);if(messages&&"401" in messages){fb.error.render_signin(signin_callback)}else{fb.error.default_error_handler(xml_http_response,text_status,error_thrown)
}}};fb.error.default_error_handler=function(xml_http_response,text_status,error_thrown,content_target){fb.Debug.log("fb.error.default_error_handler",xml_http_response);if(xml_http_response.status==0){return }if(error_thrown){error_thrown._source="javascript";fb.Debug.error(error_thrown)}else{var messages=(fb.error.expand_error_envelope(xml_http_response,text_status,error_thrown)||xml_http_response.responseText);var debug_url=xml_http_response.getResponseHeader("x-debug-url");fb.error.show_error_feedback_dialog(messages,content_target,debug_url)}};fb.error.expand_error_envelope=function(xml_http_response,text_status,error_thrown){fb.Debug.log("fb.error.expand_error_envelope",xml_http_response,text_status,error_thrown);if(xml_http_response.status==0){return false}if(error_thrown){return false}var content_type=xml_http_response.getResponseHeader("content-type");if(!content_type.startsWith("text/plain")){return false}var json_response=xml_http_response.responseText;try{json_response=JSON.parse(json_response)}catch(e){fb.Debug.error("unable to parse response",json_response,e)}if(!json_response||!json_response.messages){return false}var result={};for(var i=0;i<json_response.messages.length;i++){var message=json_response.messages[i];if(!(message.code in result)){result[message.code]=[]}result[message.code].push(message)}return result};$.ajaxSetup({error:fb.error.default_error_handler,complete:fb.transaction_id.ajaxCompleteHandler});fb.system_message={_template:('<div class="system-message %s"><span class="btn-close"><a href="javascript:void(0)" title="Close This Message">Close</a></span><p>%s</p></div>'),create:function(message,level,noclose){if(noclose==undefined){noclose=level=="notice"||level=="warning"}var result=$(fb.sprintf(fb.system_message._template,level,message));if(noclose){$(".btn-close",result).remove()}else{$(".btn-close > a",result).click(fb.system_message.close)}return result},close:function(e){$(this).parents(".system-message:first").fadeOut(fb.system_message.remove)},close_all:function(div){$(".system-message",div).each(function(){$(this).fadeOut(fb.system_message.remove)})},remove:function(e){$(this).remove()},level:{SUCCESS:"success",FAILURE:"error",NOTICE:"notice",WARNING:"warning"}};fb.buffer_ajax_html_response=function(html_text){fb.Debug.time("fb.buffer_ajax_html_response");if(typeof html_text!="string"){fb.Debug.assert(html_text.is("div.hide"),"not div.hide",html_text);return html_text}var buffer=$("<div class='hide'/>");$(document.body).append(buffer);buffer.html(html_text.replace(/<!DOCTYPE.*\">/,""));buffer=$("> * ",buffer);fb.Debug.timeEnd("fb.buffer_ajax_html_response");return buffer};fb.post_load_images=function(post_load_class_name){var selector="img."+post_load_class_name+"-postload[fb__src]";$(selector).each(function(i){$(this).attr("src",$(this).attr("fb__src")).removeAttr("fb__src")})};fb.disable=function(elt,b){if(b===false){$(elt).removeAttr("disabled").removeClass("disabled")}else{$(elt).attr("disabled","disabled").addClass("disabled")}return $(elt)};fb.activate=function(elt,b){return fb.disable(elt,!b)};fb.bind_alternate_stylesheet=function(width){function _handler(e){fb.check_alternate_stylesheet(width);return true}$(document).ready(_handler);$(window).bind("resize.fb",_handler)};fb.check_alternate_stylesheet=function(width){fb.Debug.group("fb.check_alternate_stylesheet",width);fb.switch_stylesheet($(window).width()>width?String(width):"");fb.Debug.groupEnd("fb.check_alternate_stylesheet",width)};fb.switch_stylesheet=function(title){$("link[rel*=style][title]").each(function(){disabled=$(this).attr("title")!=title;if(disabled!=this.disabled){this.disabled=disabled;fb.doLater(0,function(){$(window).triggerHandler("switch_stylesheet")})}})};fb.FX_SHADOW={color:"#000000",offset:2,opacity:0.2,monitor:true};fb.time_from_t0=function(msg,t1){var t=(new Date()).getTime()-T_0.getTime();if(msg){var tx="";if(t1){tx=(t-t1)/1000+"s"}if(!fb.devbar_profile){fb.devbar_profile=$("#MetawebDevToolbar .profile")}fb.devbar_profile.append(fb.sprintf('<div class="Label">%s: %ss %s</div>',msg,t/1000,tx))
}return t};fb.get_invites=function(){var map={};var invites=$.cookie("domain-invites");if(!invites){return map}invites=invites.replace(/\"/g,"");var pairs=invites?invites.split(","):[];if(typeof pairs!="undefined"){for(var x=0;x<pairs.length;x++){var pair=pairs[x].split("=");map[pair[0]]=pair[1]}}return map};fb.delete_invites=function(){$.cookie("domain-invites","",{expires:-1,path:"/"})};fb.get_invite=function(domain_id){return fb.get_invites()[domain_id]};fb.set_invites=function(map){var s="";for(var k in map){var v=map[k];if(!v){continue}s+=k+"="+map[k]+","}$.cookie("domain-invites",s,{path:"/"})};fb.set_invite=function(domain_id,value){var invites=fb.get_invites();invites[domain_id]=value;fb.set_invites(invites)};fb.delete_invite=function(domain_id){fb.set_invite(domain_id,null)};fb.run_init=function(object_to_init,script_name){if(fb.mwLWTReloading){return }fb.Debug.group("run_init "+script_name);fb.Debug.time("run_init "+script_name);var t=fb.time_from_t0(script_name+" init start");if(typeof object_to_init=="string"){object_to_init=eval("("+object_to_init+")")}object_to_init.init();fb.time_from_t0(script_name+" init finish",t);fb.Debug.timeEnd("run_init "+script_name);fb.Debug.groupEnd("run_init "+script_name)};fb.logger={send:function(data){fb.Debug.group("fb.logger.send",data);$.ajax({url:"/log",data:data,cache:false,dataType:"text",global:false});fb.Debug.groupEnd("fb.logger.send",data)}};fb.init=function(){fb.browserWarn();fb.firebugWarn();fb.initDevbar();fb.init_searchbox();var tid=$.cookie("metaweb_tid");if(tid){fb.transaction_id.ids.push(tid)}if(window.PAGE_TID){fb.transaction_id.ids.push(window.PAGE_TID)}if(!fb.getUser()||!fb.getUser().name){$.localStore("permissionCache2",null)}};fb.init_searchbox=function(destroy){fb.Debug.group("fb.init_searchbox");var search_input=$("#SearchBox .SearchBox-input, #global-search-input");var domain=search_input.attr("fb__domain")||"";var relative=!!domain;var root=relative?"":document.location.protocol+"//"+ROOT_HOSTNAME;var loading=new Image();loading.src="/resources/images/ui/loader-sm-snake-orange.gif";var search_box=$("#site-search-box");search_input.suggest({service_url:root,soft:true,category:"object",parent:search_box.length?search_box:null,align:"right",status:null,animate:search_box.length!=0});var search_label=$("#site-search-label"),search_suggest=$("#site-search-box .fbs-pane");search_input.bind("fb-select",function(e,data){fb.u.open(root+fb.u.view(data.id))}).bind("fb-pane-show",function(e,data){search_label.html("<span>Select an item from the list</span>").removeClass("loading")}).bind("fb-textchange",function(e,data){if($.trim(search_input.val())===""){search_label.html("<span>Start typing to get some suggestions</span>").removeClass("loading")}else{search_label.html("<span>Searching...</span>").addClass("loading")}}).focus(function(e){if($(this).val()==$(this).attr("default")){$(this).val("")}else{$(this).select()}$(this).removeClass("ghost-input");if(!search_label.is(":visible")){$("#site-search-label").slideDown("fast")}}).blur(function(e){if(!$(this).val()){$(this).val($(this).attr("default")).addClass("ghost-input")}if(!search_suggest.is(":visible")&&search_label.is(":visible")){$("#site-search-label").slideUp("fast")}});var s=fb.arg("query")||search_input.attr("default");if(search_input[0]&&search_input.val().length<1&&search_input.attr("focused")=="0"){search_input.val(s);if(s==search_input.attr("default")){search_input.addClass("ghost-input")}}search_input.parents("form:first").submit(function(e){return $.trim(search_input.val()).length!=0});fb.Debug.groupEnd("fb.init_searchbox")};$(function(){fb.document_loaded=true});fb.run_init(fb,"core.js")})(jQuery,window.freebase);(function(B){B.fn.ajaxSubmit=function(M){if(!this.length){A("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof M=="function"){M={success:M}}M=B.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},M||{});var O={};this.trigger("form-pre-serialize",[this,M,O]);
if(O.veto){A("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(M.beforeSerialize&&M.beforeSerialize(this,M)===false){A("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var I=this.formToArray(M.semantic);if(M.data){M.extraData=M.data;for(var E in M.data){if(M.data[E] instanceof Array){for(var F in M.data[E]){I.push({name:E,value:M.data[E][F]})}}else{I.push({name:E,value:M.data[E]})}}}if(M.beforeSubmit&&M.beforeSubmit(I,this,M)===false){A("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[I,this,M,O]);if(O.veto){A("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var D=B.param(I);if(M.type.toUpperCase()=="GET"){M.url+=(M.url.indexOf("?")>=0?"&":"?")+D;M.data=null}else{M.data=D}var N=this,H=[];if(M.resetForm){H.push(function(){N.resetForm()})}if(M.clearForm){H.push(function(){N.clearForm()})}if(!M.dataType&&M.target){var K=M.success||function(){};H.push(function(P){B(M.target).html(P).each(K,arguments)})}else{if(M.success){H.push(M.success)}}M.success=function(S,Q){for(var R=0,P=H.length;R<P;R++){H[R].apply(M,[S,Q,N])}};var C=B("input:file",this).fieldValue();var L=false;for(var G=0;G<C.length;G++){if(C[G]){L=true}}if(M.iframe||L){if(B.browser.safari&&M.closeKeepAlive){B.get(M.closeKeepAlive,J)}else{J()}}else{B.ajax(M)}this.trigger("form-submit-notify",[this,M]);return this;function J(){var T=N[0];if(B(":input[name=submit]",T).length){alert('Error: Form elements must not be named "submit".');return }var R=B.extend({},B.ajaxSettings,M);var c=jQuery.extend(true,{},B.extend(true,{},B.ajaxSettings),R);var S="jqFormIO"+(new Date().getTime());var Y=B('<iframe id="'+S+'" name="'+S+'" />');var a=Y[0];if(B.browser.msie||B.browser.opera){a.src='javascript:false;document.write("");'}Y.css({position:"absolute",top:"-1000px",left:"-1000px"});var b={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;Y.attr("src","about:blank")}};var Z=R.global;if(Z&&!B.active++){B.event.trigger("ajaxStart")}if(Z){B.event.trigger("ajaxSend",[b,R])}if(c.beforeSend&&c.beforeSend(b,c)===false){c.global&&jQuery.active--;return }if(b.aborted){return }var Q=0;var V=0;var P=T.clk;if(P){var U=P.name;if(U&&!P.disabled){M.extraData=M.extraData||{};M.extraData[U]=P.value;if(P.type=="image"){M.extraData[name+".x"]=T.clk_x;M.extraData[name+".y"]=T.clk_y}}}setTimeout(function(){var f=N.attr("target"),d=N.attr("action");N.attr({target:S,method:"POST",action:R.url});if(!M.skipEncodingOverride){N.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(R.timeout){setTimeout(function(){V=true;W()},R.timeout)}var e=[];try{if(M.extraData){for(var g in M.extraData){e.push(B('<input type="hidden" name="'+g+'" value="'+M.extraData[g]+'" />').appendTo(T)[0])}}Y.appendTo("body");a.attachEvent?a.attachEvent("onload",W):a.addEventListener("load",W,false);T.submit()}finally{N.attr("action",d);f?N.attr("target",f):N.removeAttr("target");B(e).remove()}},10);function W(){if(Q++){return }a.detachEvent?a.detachEvent("onload",W):a.removeEventListener("load",W,false);var f=0;var g=true;try{if(V){throw"timeout"}var h,k;k=a.contentWindow?a.contentWindow.document:a.contentDocument?a.contentDocument:a.document;if(k.body==null&&!f&&B.browser.opera){f=1;Q--;setTimeout(W,100);return }b.responseText=k.body?k.body.innerHTML:null;b.responseXML=k.XMLDocument?k.XMLDocument:k;b.getResponseHeader=function(l){var e={"content-type":R.dataType};return e[l]};if(R.dataType=="json"||R.dataType=="script"){var d=k.getElementsByTagName("textarea")[0];b.responseText=d?d.value:b.responseText}else{if(R.dataType=="xml"&&!b.responseXML&&b.responseText!=null){b.responseXML=X(b.responseText)}}h=B.httpData(b,R.dataType)}catch(j){g=false;B.handleError(R,b,"error",j)}if(g){R.success(h,"success");if(Z){B.event.trigger("ajaxSuccess",[b,R])}}if(Z){B.event.trigger("ajaxComplete",[b,R])
}if(Z&&!--B.active){B.event.trigger("ajaxStop")}if(R.complete){R.complete(b,g?"success":"error")}setTimeout(function(){Y.remove();b.responseXML=null},100)}function X(d,e){if(window.ActiveXObject){e=new ActiveXObject("Microsoft.XMLDOM");e.async="false";e.loadXML(d)}else{e=(new DOMParser()).parseFromString(d,"text/xml")}return(e&&e.documentElement&&e.documentElement.tagName!="parsererror")?e:null}}};B.fn.ajaxForm=function(C){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){B(this).ajaxSubmit(C);return false}).each(function(){B(":submit,input:image",this).bind("click.form-plugin",function(E){var D=this.form;D.clk=this;if(this.type=="image"){if(E.offsetX!=undefined){D.clk_x=E.offsetX;D.clk_y=E.offsetY}else{if(typeof B.fn.offset=="function"){var F=B(this).offset();D.clk_x=E.pageX-F.left;D.clk_y=E.pageY-F.top}else{D.clk_x=E.pageX-this.offsetLeft;D.clk_y=E.pageY-this.offsetTop}}}setTimeout(function(){D.clk=D.clk_x=D.clk_y=null},10)})})};B.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){B(":submit,input:image",this).unbind("click.form-plugin")})};B.fn.formToArray=function(N){var M=[];if(this.length==0){return M}var D=this[0];var H=N?D.getElementsByTagName("*"):D.elements;if(!H){return M}for(var I=0,K=H.length;I<K;I++){var E=H[I];var F=E.name;if(!F){continue}if(N&&D.clk&&E.type=="image"){if(!E.disabled&&D.clk==E){M.push({name:F+".x",value:D.clk_x},{name:F+".y",value:D.clk_y})}continue}var O=B.fieldValue(E,true);if(O&&O.constructor==Array){for(var G=0,C=O.length;G<C;G++){M.push({name:F,value:O[G]})}}else{if(O!==null&&typeof O!="undefined"){M.push({name:F,value:O})}}}if(!N&&D.clk){var J=D.getElementsByTagName("input");for(var I=0,K=J.length;I<K;I++){var L=J[I];var F=L.name;if(F&&!L.disabled&&L.type=="image"&&D.clk==L){M.push({name:F+".x",value:D.clk_x},{name:F+".y",value:D.clk_y})}}}return M};B.fn.formSerialize=function(C){return B.param(this.formToArray(C))};B.fn.fieldSerialize=function(D){var C=[];this.each(function(){var H=this.name;if(!H){return }var F=B.fieldValue(this,D);if(F&&F.constructor==Array){for(var G=0,E=F.length;G<E;G++){C.push({name:H,value:F[G]})}}else{if(F!==null&&typeof F!="undefined"){C.push({name:this.name,value:F})}}});return B.param(C)};B.fn.fieldValue=function(H){for(var G=[],E=0,C=this.length;E<C;E++){var F=this[E];var D=B.fieldValue(F,H);if(D===null||typeof D=="undefined"||(D.constructor==Array&&!D.length)){continue}D.constructor==Array?B.merge(G,D):G.push(D)}return G};B.fieldValue=function(C,I){var E=C.name,N=C.type,O=C.tagName.toLowerCase();if(typeof I=="undefined"){I=true}if(I&&(!E||C.disabled||N=="reset"||N=="button"||(N=="checkbox"||N=="radio")&&!C.checked||(N=="submit"||N=="image")&&C.form&&C.form.clk!=C||O=="select"&&C.selectedIndex==-1)){return null}if(O=="select"){var J=C.selectedIndex;if(J<0){return null}var L=[],D=C.options;var G=(N=="select-one");var K=(G?J+1:D.length);for(var F=(G?J:0);F<K;F++){var H=D[F];if(H.selected){var M=B.browser.msie&&!(H.attributes.value.specified)?H.text:H.value;if(G){return M}L.push(M)}}return L}return C.value};B.fn.clearForm=function(){return this.each(function(){B("input,select,textarea",this).clearFields()})};B.fn.clearFields=B.fn.clearInputs=function(){return this.each(function(){var D=this.type,C=this.tagName.toLowerCase();if(D=="text"||D=="password"||C=="textarea"){this.value=""}else{if(D=="checkbox"||D=="radio"){this.checked=false}else{if(C=="select"){this.selectedIndex=-1}}}})};B.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};B.fn.enable=function(C){if(C==undefined){C=true}return this.each(function(){this.disabled=!C})};B.fn.selected=function(C){if(C==undefined){C=true}return this.each(function(){var D=this.type;if(D=="checkbox"||D=="radio"){this.checked=C}else{if(this.tagName.toLowerCase()=="option"){var E=B(this).parent("select");if(C&&E[0]&&E[0].type=="select-one"){E.find("option").selected(false)
}this.selected=C}}})};function A(){if(B.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}}})(jQuery);(function(A){A.fn.alphanumeric=function(B){B=A.extend({ichars:"!@#$%^&*()+=[]\\';,/{}|\":<>?~`.- ",nchars:"",allow:""},B);return this.each(function(){if(B.nocaps){B.nchars+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"}if(B.allcaps){B.nchars+="abcdefghijklmnopqrstuvwxyz"}s=B.allow.split("");for(i=0;i<s.length;i++){if(B.ichars.indexOf(s[i])!=-1){s[i]="\\"+s[i]}}B.allow=s.join("|");var D=new RegExp(B.allow,"gi");var C=B.ichars+B.nchars;C=C.replace(D,"");A(this).keypress(function(F){var E=String.fromCharCode(F.charCode?F.charCode:F.which);if((F.metaKey||F.ctrlKey)&&E=="v"){return }if(C.indexOf(E)!=-1){F.preventDefault()}});A(this).bind("contextmenu",function(){return false})})};A.fn.numeric=function(C){var B="abcdefghijklmnopqrstuvwxyz";B+=B.toUpperCase();C=A.extend({nchars:B},C);return this.each(function(){A(this).alphanumeric(C)})};A.fn.alpha=function(C){var B="1234567890";C=A.extend({nchars:B},C);return this.each(function(){A(this).alphanumeric(C)})}})(jQuery);(function(D){D.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){D.fx.step[E]=function(G){if(G.state==0){G.start=C(G.elem,E);G.end=B(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"}});function B(F){var E;if(F&&F.constructor==Array&&F.length==3){return F}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]}return A[D.trim(F).toLowerCase()]}function C(G,E){var F;do{F=D.curCSS(G,E);if(F!=""&&F!="transparent"||D.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return B(F)}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);(function(A){A.widget("ui.accordion",{_init:function(){var D=this.options,B=this;this.running=0;if(D.navigation){var C=this.element.find("a").filter(D.navigationFilter);if(C.length){if(C.filter(D.header).length){this.active=C}else{this.active=C.parent().parent().prev();C.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");this.headers=this.element.find(D.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){A(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){A(this).removeClass("ui-state-hover")
});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||D.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");A("<span/>").addClass("ui-icon "+D.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(D.icons.header).toggleClass(D.icons.headerSelected);if(A.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(E){return B._keydown(E)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!A.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(D.event){this.element.bind((D.event)+".accordion",function(E){return B._clickHandler.call(B,E)})}},destroy:function(){this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();this.headers.next().removeClass("ui-accordion-content ui-accordion-content-active")},_keydown:function(E){var G=this.options,F=A.ui.keyCode;if(G.disabled||E.altKey||E.ctrlKey){return }var D=this.headers.length;var B=this.headers.index(E.target);var C=false;switch(E.keyCode){case F.RIGHT:case F.DOWN:C=this.headers[(B+1)%D];break;case F.LEFT:case F.UP:C=this.headers[(B-1+D)%D];break;case F.SPACE:case F.ENTER:return this._clickHandler({target:E.target})}if(C){A(E.target).attr("tabIndex","-1");A(C).attr("tabIndex","0");C.focus();return false}return true},resize:function(){var E=this.options,D;if(E.fillSpace){if(A.browser.msie){var B=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}D=this.element.parent().height();if(A.browser.msie){this.element.parent().css("overflow",B)}this.headers.each(function(){D-=A(this).outerHeight()});var C=0;this.headers.next().each(function(){C=Math.max(C,A(this).innerHeight()-A(this).height())}).height(D-C).css("overflow","auto")}else{if(E.autoHeight){D=0;this.headers.next().each(function(){D=Math.max(D,A(this).outerHeight())}).height(D)}}},activate:function(B){this._clickHandler({target:this._findActive(B)[0]})},_findActive:function(B){return B?typeof B=="number"?this.headers.filter(":eq("+B+")"):this.headers.not(this.headers.not(B)):B===false?A([]):this.headers.filter(":eq(0)")},_clickHandler:function(F){var H=this.options;if(H.disabled){return false}if(!F.target&&!H.alwaysOpen){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(H.icons.headerSelected).addClass(H.icons.header);this.active.next().addClass("ui-accordion-content-active");var C=this.active.next(),G={options:H,newHeader:A([]),oldHeader:H.active,newContent:A([]),oldContent:C},B=(this.active=A([]));this._toggle(B,C,G);return false}var D=A(F.target);D=A(D.parents(H.header)[0]||D);var E=D[0]==this.active[0];if(this.running||(H.alwaysOpen&&E)){return false}if(!D.is(H.header)){return }this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(H.icons.headerSelected).addClass(H.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!E){D.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(H.icons.header).addClass(H.icons.headerSelected);
D.next().addClass("ui-accordion-content-active")}var B=D.next(),C=this.active.next(),G={options:H,newHeader:E&&!H.alwaysOpen?A([]):D,oldHeader:this.active,newContent:E&&!H.alwaysOpen?A([]):B.find("> *"),oldContent:C.find("> *")},I=this.headers.index(this.active[0])>this.headers.index(D[0]);this.active=E?A([]):D;this._toggle(B,C,G,E,I);return false},_toggle:function(B,I,G,J,K){var D=this.options,M=this;this.toShow=B;this.toHide=I;this.data=G;var C=function(){if(!M){return }return M._completed.apply(M,arguments)};this._trigger("changestart",null,this.data);this.running=I.size()===0?B.size():I.size();if(D.animated){var F={};if(!D.alwaysOpen&&J){F={toShow:A([]),toHide:I,complete:C,down:K,autoHeight:D.autoHeight||D.fillSpace}}else{F={toShow:B,toHide:I,complete:C,down:K,autoHeight:D.autoHeight||D.fillSpace}}if(!D.proxied){D.proxied=D.animated}if(!D.proxiedDuration){D.proxiedDuration=D.duration}D.animated=A.isFunction(D.proxied)?D.proxied(F):D.proxied;D.duration=A.isFunction(D.proxiedDuration)?D.proxiedDuration(F):D.proxiedDuration;var L=A.ui.accordion.animations,E=D.duration,H=D.animated;if(!L[H]){L[H]=function(N){this.slide(N,{easing:H,duration:E||700})}}L[H](F)}else{if(!D.alwaysOpen&&J){B.toggle()}else{I.hide();B.show()}C(true)}I.prev().attr("aria-expanded","false").attr("tabIndex","-1");B.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(B){var C=this.options;this.running=B?0:--this.running;if(this.running){return }if(C.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});A.extend(A.ui.accordion,{version:"1.6rc6",defaults:{active:null,autoHeight:true,alwaysOpen:true,animated:"slide",clearStyle:false,event:"click",fillSpace:false,header:"a",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(J,H){J=A.extend({easing:"swing",duration:300},J,H);if(!J.toHide.size()){J.toShow.animate({height:"show"},J);return }var B=J.toHide.height(),I=J.toShow.height(),C=I/B,D=J.toShow.css("overflow"),E={},G={},F=["height","paddingTop","paddingBottom"];A.each(F,function(K,L){G[L]="hide";E[L]=parseFloat(J.toShow.css(L))});J.toShow.css({height:0,overflow:"hidden"}).show();J.toHide.filter(":hidden").each(J.complete).end().filter(":visible").animate(G,{step:function(L,M){if(!J.toShow[0]){return }var K=M.start!=M.end?(M.now-M.start)/(M.end-M.start):0,N=K*E[M.prop];if(A.browser.msie||A.browser.opera){N=Math.ceil(N)}J.toShow[0].style[M.prop]=N+"px"},duration:J.duration,easing:J.easing,complete:function(){if(!J.autoHeight){J.toShow.css("height","auto")}J.toShow.css({overflow:D});J.complete()}})},bounceslide:function(B){this.slide(B,{easing:B.down?"easeOutBounce":"swing",duration:B.down?1000:200})},easeslide:function(B){this.slide(B,{easing:"easeinout",duration:700})}}})})(jQuery);(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass(this.options.cssNamespace+"-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+"-draggable "+this.options.cssNamespace+"-draggable-dragging "+this.options.cssNamespace+"-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is("."+this.options.cssNamespace+"-resizable-handle")){return false}this.handle=this._getHandle(B);if(!this.handle){return false}return true},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this
}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(B);this.originalPageX=B.pageX;this.originalPageY=B.pageY;if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt)}if(C.containment){this._setContainment()}this._trigger("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B)}this.helper.addClass(C.cssNamespace+"-draggable-dragging");this._mouseDrag(B,true);return true},_mouseDrag:function(B,D){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!D){var C=this._uiHash();this._trigger("drag",B,C);this.position=C.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(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},_mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){D=A.ui.ddmanager.drop(this,C)}if(this.dropped){D=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,D))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._trigger("stop",C);B._clear()})}else{this._trigger("stop",C);this._clear()}return false},_getHandle:function(B){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==B.target){C=true}});return C},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C])):(D.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((D.appendTo=="parent"?this.element[0].parentNode:D.appendTo))}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute")}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0])){B.left+=this.scrollParent.scrollLeft();B.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;
if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(E.containment)&&E.containment.constructor!=Array){var C=A(E.containment)[0];if(!C){return }var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)+(parseInt(A(C).css("paddingLeft"),10)||0)-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)+(parseInt(A(C).css("paddingTop"),10)||0)-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-(parseInt(A(C).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-(parseInt(A(C).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(E.containment.constructor==Array){this.containment=E.containment}}},_convertPositionTo:function(E,G){if(!G){G=this.position}var C=E=="absolute"?1:-1;var D=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,F=(/(html|body)/i).test(B[0].tagName);return{top:(G.top+this.offset.relative.top*C+this.offset.parent.top*C-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(F?0:B.scrollTop()))*C),left:(G.left+this.offset.relative.left*C+this.offset.parent.left*C-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():F?0:B.scrollLeft())*C)}},_generatePosition:function(E){var H=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,I=(/(html|body)/i).test(B[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var D=E.pageX;var C=E.pageY;if(this.originalPosition){if(this.containment){if(E.pageX-this.offset.click.left<this.containment[0]){D=this.containment[0]+this.offset.click.left}if(E.pageY-this.offset.click.top<this.containment[1]){C=this.containment[1]+this.offset.click.top}if(E.pageX-this.offset.click.left>this.containment[2]){D=this.containment[2]+this.offset.click.left}if(E.pageY-this.offset.click.top>this.containment[3]){C=this.containment[3]+this.offset.click.top}}if(H.grid){var G=this.originalPageY+Math.round((C-this.originalPageY)/H.grid[1])*H.grid[1];C=this.containment?(!(G-this.offset.click.top<this.containment[1]||G-this.offset.click.top>this.containment[3])?G:(!(G-this.offset.click.top<this.containment[1])?G-H.grid[1]:G+H.grid[1])):G;var F=this.originalPageX+Math.round((D-this.originalPageX)/H.grid[0])*H.grid[0];D=this.containment?(!(F-this.offset.click.left<this.containment[0]||F-this.offset.click.left>this.containment[2])?F:(!(F-this.offset.click.left<this.containment[0])?F-H.grid[0]:F+H.grid[0])):F}}return{top:(C-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(I?0:B.scrollTop()))),left:(D-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():I?0:B.scrollLeft()))}},_clear:function(){this.helper.removeClass(this.options.cssNamespace+"-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(B,C,D){D=D||this._uiHash();
A.ui.plugin.call(this,B,[C,D]);if(B=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return A.widget.prototype._trigger.call(this,B,C,D)},plugins:{},_uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));A.extend(A.ui.draggable,{version:"1.6rc6",eventPrefix:"drag",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cssNamespace:"ui",cursor:"default",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});A.ui.plugin.add("draggable","connectToSortable",{start:function(B,D){var C=A(this).data("draggable"),E=C.options;C.sortables=[];A(E.connectToSortable).each(function(){A(typeof this=="string"?this+"":this).each(function(){if(A.data(this,"sortable")){var F=A.data(this,"sortable");C.sortables.push({instance:F,shouldRevert:F.options.revert});F._refreshItems();F._trigger("activate",B,C)}})})},stop:function(B,D){var C=A(this).data("draggable");A.each(C.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;C.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(B);this.instance.options.helper=this.instance.options._helper;if(C.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",B,C)}})},drag:function(C,F){var E=A(this).data("draggable"),B=this;var D=function(I){var N=this.offset.click.top,M=this.offset.click.left;var G=this.positionAbs.top,K=this.positionAbs.left;var J=I.height,L=I.width;var O=I.top,H=I.left;return A.ui.isOver(G+N,K+M,O,H,J,L)};A.each(E.sortables,function(G){if(D.call(E,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return F.helper[0]};C.target=this.instance.currentItem[0];this.instance._mouseCapture(C,true);this.instance._mouseStart(C,true,true);this.instance.offset.click.top=E.offset.click.top;this.instance.offset.click.left=E.offset.click.left;this.instance.offset.parent.left-=E.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=E.offset.parent.top-this.instance.offset.parent.top;E._trigger("toSortable",C);E.dropped=this.instance.element;this.instance.fromOutside=E}if(this.instance.currentItem){this.instance._mouseDrag(C)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._mouseStop(C,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}E._trigger("fromSortable",C);E.dropped=false}}})}});A.ui.plugin.add("draggable","cursor",{start:function(C,D){var B=A("body"),E=A(this).data("draggable").options;if(B.css("cursor")){E._cursor=B.css("cursor")}B.css("cursor",E.cursor)},stop:function(B,C){var D=A(this).data("draggable").options;if(D._cursor){A("body").css("cursor",D._cursor)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(B,C){var D=A(this).data("draggable").options;A(D.iframeFix===true?"iframe":D.iframeFix).each(function(){A('<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(A(this).offset()).appendTo("body")})},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","opacity",{start:function(C,D){var B=A(D.helper),E=A(this).data("draggable").options;
if(B.css("opacity")){E._opacity=B.css("opacity")}B.css("opacity",E.opacity)},stop:function(B,C){var D=A(this).data("draggable").options;if(D._opacity){A(C.helper).css("opacity",D._opacity)}}});A.ui.plugin.add("draggable","scroll",{start:function(C,D){var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},drag:function(D,E){var C=A(this).data("draggable"),F=C.options,B=false;if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if(!F.axis||F.axis!="x"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}}if(!F.axis||F.axis!="y"){if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}}else{if(!F.axis||F.axis!="x"){if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}}if(!F.axis||F.axis!="y"){if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}}});A.ui.plugin.add("draggable","snap",{start:function(C,D){var B=A(this).data("draggable"),E=B.options;B.snapElements=[];A(E.snap.constructor!=String?(E.snap.items||":data(draggable)"):E.snap).each(function(){var G=A(this);var F=G.offset();if(this!=B.element[0]){B.snapElements.push({item:this,width:G.outerWidth(),height:G.outerHeight(),top:F.top,left:F.left})}})},drag:function(N,K){var E=A(this).data("draggable"),L=E.options;var R=L.snapTolerance;var Q=K.absolutePosition.left,P=Q+E.helperProportions.width,D=K.absolutePosition.top,C=D+E.helperProportions.height;for(var O=E.snapElements.length-1;O>=0;O--){var M=E.snapElements[O].left,J=M+E.snapElements[O].width,I=E.snapElements[O].top,T=I+E.snapElements[O].height;if(!((M-R<Q&&Q<J+R&&I-R<D&&D<T+R)||(M-R<Q&&Q<J+R&&I-R<C&&C<T+R)||(M-R<P&&P<J+R&&I-R<D&&D<T+R)||(M-R<P&&P<J+R&&I-R<C&&C<T+R))){if(E.snapElements[O].snapping){(E.options.snap.release&&E.options.snap.release.call(E.element,N,A.extend(E._uiHash(),{snapItem:E.snapElements[O].item})))}E.snapElements[O].snapping=false;continue}if(L.snapMode!="inner"){var B=Math.abs(I-C)<=R;var S=Math.abs(T-D)<=R;var G=Math.abs(M-P)<=R;var H=Math.abs(J-Q)<=R;if(B){K.position.top=E._convertPositionTo("relative",{top:I-E.helperProportions.height,left:0}).top-E.margins.top}if(S){K.position.top=E._convertPositionTo("relative",{top:T,left:0}).top-E.margins.top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:M-E.helperProportions.width}).left-E.margins.left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J}).left-E.margins.left}}var F=(B||S||G||H);if(L.snapMode!="outer"){var B=Math.abs(I-D)<=R;var S=Math.abs(T-C)<=R;var G=Math.abs(M-Q)<=R;var H=Math.abs(J-P)<=R;if(B){K.position.top=E._convertPositionTo("relative",{top:I,left:0}).top-E.margins.top}if(S){K.position.top=E._convertPositionTo("relative",{top:T-E.helperProportions.height,left:0}).top-E.margins.top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:M}).left-E.margins.left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J-E.helperProportions.width}).left-E.margins.left}}if(!E.snapElements[O].snapping&&(B||S||G||H||F)){(E.options.snap.snap&&E.options.snap.snap.call(E.element,N,A.extend(E._uiHash(),{snapItem:E.snapElements[O].item})))
}E.snapElements[O].snapping=(B||S||G||H||F)}}});A.ui.plugin.add("draggable","stack",{start:function(B,C){var E=A(this).data("draggable").options;var D=A.makeArray(A(E.stack.group)).sort(function(G,F){return(parseInt(A(G).css("zIndex"),10)||E.stack.min)-(parseInt(A(F).css("zIndex"),10)||E.stack.min)});A(D).each(function(F){this.style.zIndex=E.stack.min+F});this[0].style.zIndex=E.stack.min+D.length}});A.ui.plugin.add("draggable","zIndex",{start:function(C,D){var B=A(D.helper),E=A(this).data("draggable").options;if(B.css("zIndex")){E._zIndex=B.css("zIndex")}B.css("zIndex",E.zIndex)},stop:function(B,C){var D=A(this).data("draggable").options;if(D._zIndex){A(C.helper).css("zIndex",D._zIndex)}}})})(jQuery);(function(A){A.widget("ui.droppable",{_init:function(){var C=this.options,B=C.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&A.isFunction(this.options.accept)?this.options.accept:function(D){return D.is(B)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};A.ui.ddmanager.droppables[this.options.scope]=A.ui.ddmanager.droppables[this.options.scope]||[];A.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-droppable"))},destroy:function(){var B=A.ui.ddmanager.droppables[this.options.scope];for(var C=0;C<B.length;C++){if(B[C]==this){B.splice(C,1)}}this.element.removeClass(this.options.cssNamespace+"-droppable "+this.options.cssNamespace+"-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(B,C){if(B=="accept"){this.options.accept=C&&A.isFunction(C)?C:function(D){return D.is(accept)}}else{A.widget.prototype._setData.apply(this,arguments)}},_activate:function(C){var B=A.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(B&&this._trigger("activate",C,this.ui(B)))},_deactivate:function(C){var B=A.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(B&&this._trigger("deactivate",C,this.ui(B)))},_over:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",C,this.ui(B))}},_out:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",C,this.ui(B))}},_drop:function(C,D){var B=D||A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return false}var E=false;this.element.find(":data(droppable)").not("."+B.options.cssNamespace+"-draggable-dragging").each(function(){var F=A.data(this,"droppable");if(F.options.greedy&&A.ui.intersect(B,A.extend(F,{offset:F.element.offset()}),F.options.tolerance)){E=true;return false}});if(E){return false}if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",C,this.ui(B));return this.element}return false},ui:function(B){return{draggable:(B.currentItem||B.element),helper:B.helper,position:B.position,absolutePosition:B.positionAbs,offset:B.positionAbs}}});A.extend(A.ui.droppable,{version:"1.6rc6",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,cssNamespace:"ui",greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});A.ui.intersect=function(O,I,M){if(!I.offset){return false}var D=(O.positionAbs||O.position.absolute).left,C=D+O.helperProportions.width,L=(O.positionAbs||O.position.absolute).top,K=L+O.helperProportions.height;var F=I.offset.left,B=F+I.proportions.width,N=I.offset.top,J=N+I.proportions.height;
switch(M){case"fit":return(F<D&&C<B&&N<L&&K<J);break;case"intersect":return(F<D+(O.helperProportions.width/2)&&C-(O.helperProportions.width/2)<B&&N<L+(O.helperProportions.height/2)&&K-(O.helperProportions.height/2)<J);break;case"pointer":var G=((O.positionAbs||O.position.absolute).left+(O.clickOffset||O.offset.click).left),H=((O.positionAbs||O.position.absolute).top+(O.clickOffset||O.offset.click).top),E=A.ui.isOver(H,G,N,F,I.proportions.height,I.proportions.width);return E;break;case"touch":return((L>=N&&L<=J)||(K>=N&&K<=J)||(L<N&&K>J))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(D<F&&C>B));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(E,G){var B=A.ui.ddmanager.droppables[E.options.scope];var F=G?G.type:null;var H=(E.currentItem||E.element).find(":data(droppable)").andSelf();droppablesLoop:for(var D=0;D<B.length;D++){if(B[D].options.disabled||(E&&!B[D].options.accept.call(B[D].element[0],(E.currentItem||E.element)))){continue}for(var C=0;C<H.length;C++){if(H[C]==B[D].element[0]){B[D].proportions.height=0;continue droppablesLoop}}B[D].visible=B[D].element.css("display")!="none";if(!B[D].visible){continue}B[D].offset=B[D].element.offset();B[D].proportions={width:B[D].element[0].offsetWidth,height:B[D].element[0].offsetHeight};if(F=="mousedown"){B[D]._activate.call(B[D],G)}}},drop:function(B,C){var D=false;A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(!this.options){return }if(!this.options.disabled&&this.visible&&A.ui.intersect(B,this,this.options.tolerance)){D=this._drop.call(this,C)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(B.currentItem||B.element))){this.isout=1;this.isover=0;this._deactivate.call(this,C)}});return D},drag:function(B,C){if(B.options.refreshPositions){A.ui.ddmanager.prepareOffsets(B,C)}A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return }var E=A.ui.intersect(B,this,this.options.tolerance);var G=!E&&this.isover==1?"isout":(E&&this.isover==0?"isover":null);if(!G){return }var F;if(this.options.greedy){var D=this.element.parents(":data(droppable):eq(0)");if(D.length){F=A.data(D[0],"droppable");F.greedyChild=(G=="isover"?1:0)}}if(F&&G=="isover"){F.isover=0;F.isout=1;F._out.call(F,C)}this[G]=1;this[G=="isout"?"isover":"isout"]=0;this[G=="isover"?"_over":"_out"].call(this,C);if(F&&G=="isout"){F.isout=0;F.isover=1;F._over.call(F,C)}})}}})(jQuery);Date.getMonthNumberFromName=function(A){var C=Date.CultureInfo.monthNames,B=Date.CultureInfo.abbreviatedMonthNames,D=A.toLowerCase();for(var E=0;E<C.length;E++){if(C[E].toLowerCase()==D||B[E].toLowerCase()==D){return E}}return -1};Date.getDayNumberFromName=function(A){var C=Date.CultureInfo.dayNames,B=Date.CultureInfo.abbreviatedDayNames,D=Date.CultureInfo.shortestDayNames,E=A.toLowerCase();for(var F=0;F<C.length;F++){if(C[F].toLowerCase()==E||B[F].toLowerCase()==E){return F}}return -1};Date.isLeapYear=function(A){return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.getDaysInMonth=function(B,A){return[31,(Date.isLeapYear(B)?29:28),31,30,31,30,31,31,30,31,30,31][A]};Date.getTimezoneOffset=function(B,A){return(A||false)?Date.CultureInfo.abbreviatedTimeZoneDST[B.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[B.toUpperCase()]};Date.getTimezoneAbbreviation=function(A,C){var D=(C||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,B;for(B in D){if(D[B]===A){return B}}return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(A){if(isNaN(this)){throw new Error(this)}if(A instanceof Date&&!isNaN(A)){return(this>A)?1:(this<A)?-1:0}else{throw new TypeError(A)}};Date.prototype.equals=function(A){return(this.compareTo(A)===0)};Date.prototype.between=function(C,B){var A=this.getTime();return A>=C.getTime()&&A<=B.getTime()};Date.prototype.addMilliseconds=function(A){this.setMilliseconds(this.getMilliseconds()+A);
return this};Date.prototype.addSeconds=function(A){return this.addMilliseconds(A*1000)};Date.prototype.addMinutes=function(A){return this.addMilliseconds(A*60000)};Date.prototype.addHours=function(A){return this.addMilliseconds(A*3600000)};Date.prototype.addDays=function(A){return this.addMilliseconds(A*86400000)};Date.prototype.addWeeks=function(A){return this.addMilliseconds(A*604800000)};Date.prototype.addMonths=function(B){var A=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+B);this.setDate(Math.min(A,this.getDaysInMonth()));return this};Date.prototype.addYears=function(A){return this.addMonths(A*12)};Date.prototype.add=function(A){if(typeof A=="number"){this._orient=A;return this}var B=A;if(B.millisecond||B.milliseconds){this.addMilliseconds(B.millisecond||B.milliseconds)}if(B.second||B.seconds){this.addSeconds(B.second||B.seconds)}if(B.minute||B.minutes){this.addMinutes(B.minute||B.minutes)}if(B.hour||B.hours){this.addHours(B.hour||B.hours)}if(B.month||B.months){this.addMonths(B.month||B.months)}if(B.year||B.years){this.addYears(B.year||B.years)}if(B.day||B.days){this.addDays(B.day||B.days)}return this};Date._validate=function(C,D,B,A){if(typeof C!="number"){throw new TypeError(C+" is not a Number.")}else{if(C<D||C>B){throw new RangeError(C+" is not a valid value for "+A+".")}}return true};Date.validateMillisecond=function(A){return Date._validate(A,0,999,"milliseconds")};Date.validateSecond=function(A){return Date._validate(A,0,59,"seconds")};Date.validateMinute=function(A){return Date._validate(A,0,59,"minutes")};Date.validateHour=function(A){return Date._validate(A,0,23,"hours")};Date.validateDay=function(C,B,A){return Date._validate(C,1,Date.getDaysInMonth(B,A),"days")};Date.validateMonth=function(A){return Date._validate(A,0,11,"months")};Date.validateYear=function(A){return Date._validate(A,1,9999,"seconds")};Date.prototype.set=function(A){var B=A;if(!B.millisecond&&B.millisecond!==0){B.millisecond=-1}if(!B.second&&B.second!==0){B.second=-1}if(!B.minute&&B.minute!==0){B.minute=-1}if(!B.hour&&B.hour!==0){B.hour=-1}if(!B.day&&B.day!==0){B.day=-1}if(!B.month&&B.month!==0){B.month=-1}if(!B.year&&B.year!==0){B.year=-1}if(B.millisecond!=-1&&Date.validateMillisecond(B.millisecond)){this.addMilliseconds(B.millisecond-this.getMilliseconds())}if(B.second!=-1&&Date.validateSecond(B.second)){this.addSeconds(B.second-this.getSeconds())}if(B.minute!=-1&&Date.validateMinute(B.minute)){this.addMinutes(B.minute-this.getMinutes())}if(B.hour!=-1&&Date.validateHour(B.hour)){this.addHours(B.hour-this.getHours())}if(B.month!==-1&&Date.validateMonth(B.month)){this.addMonths(B.month-this.getMonth())}if(B.year!=-1&&Date.validateYear(B.year)){this.addYears(B.year-this.getFullYear())}if(B.day!=-1&&Date.validateDay(B.day,this.getFullYear(),this.getMonth())){this.addDays(B.day-this.getDate())}if(B.timezone){this.setTimezone(B.timezone)}if(B.timezoneOffset){this.setTimezoneOffset(B.timezoneOffset)}return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.prototype.isWeekday=function(){return !(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(B,A){var C=(B-this.getDay()+7*(A||+1))%7;return this.addDays((C===0)?C+=7*(A||+1):C)};Date.prototype.moveToMonth=function(C,B){var A=(C-this.getMonth()+12*(B||+1))%12;return this.addMonths((A===0)?A+=12*(B||+1):A)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000)};Date.prototype.getWeekOfYear=function(I){var C=this.getFullYear(),G=this.getMonth(),E=this.getDate();
var A=I||Date.CultureInfo.firstDayOfWeek;var F=7+1-new Date(C,0,1).getDay();if(F==8){F=1}var H=((Date.UTC(C,G,E,0,0,0)-Date.UTC(C,0,1,0,0,0))/86400000)+1;var B=Math.floor((H-F+7)/7);if(B===A){C--;var D=7+1-new Date(C,0,1).getDay();if(D==2||D==8){B=53}else{B=52}}return B};Date.prototype.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(A){var B=this.getTimezoneOffset(),C=Number(A)*-6/10;this.addMinutes(C-B);return this};Date.prototype.setTimezone=function(A){return this.setTimezoneOffset(Date.getTimezoneOffset(A))};Date.prototype.getUTCOffset=function(){var A=this.getTimezoneOffset()*-10/6,B;if(A<0){B=(A-10000).toString();return B[0]+B.substr(2)}else{B=(A+10000).toString();return"+"+B.substr(1)}};Date.prototype.getDayName=function(A){return A?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(A){return A?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(E){var B=this;var A=function A(F){return(F.toString().length==1)?"0"+F:F};var C=function D(G){G=""+G;var F="000";return F.substring(0,4-G.length)+G};return E?E.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(F){switch(F){case"hh":return A(B.getHours()<13?B.getHours():(B.getHours()-12));case"h":return B.getHours()<13?B.getHours():(B.getHours()-12);case"HH":return A(B.getHours());case"H":return B.getHours();case"mm":return A(B.getMinutes());case"m":return B.getMinutes();case"ss":return A(B.getSeconds());case"s":return B.getSeconds();case"yyyy":return C(B.getFullYear());case"yy":return C(B.getFullYear()).substring(2,4);case"dddd":return B.getDayName();case"ddd":return B.getDayName(true);case"dd":return A(B.getDate());case"d":return B.getDate().toString();case"MMMM":return B.getMonthName();case"MMM":return B.getMonthName(true);case"MM":return A((B.getMonth()+1));case"M":return B.getMonth()+1;case"t":return B.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return B.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return""}}):this._toString()};Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
(function(){Date.Parsing={Exception:function(I){this.message="Parse error at '"+I.substring(0,10)+" ...'"}};var B=Date.Parsing;B.Metadata=function(){this._matches={};this._parsed=null;this._order=[]};B.Metadata.prototype={FIELDS:["hour","minute","second","meridian","timezone","day","month","year","rday","milliseconds"],addParsedValues:function(I){if(this._parsed){return }this._parsed={};for(var K=0;K<this.FIELDS.length;K++){var J=this.FIELDS[K];this._parsed[J]=I[J]}},explicit:function(I){var J=this._parsed[I];var K=this._matches[I];return !K?false:J==undefined?false:typeof J=="number"?J>=0:!!J},match:function(I){if(!this.explicit(I)){return null}return this._matches[I]},addMatch:function(I,J){this._matches[I]=J;this._order.push(I)},relativeDay:function(){return !!this._matches.rday},getOrder:function(){return this._order}};var H=B.Operators={rtoken:function(I){return function(K){var J=K.match(I);if(J){return([J[0],K.substring(J[0].length)])}else{throw new B.Exception(K)}}},token:function(I){return function(J){return H.rtoken(new RegExp("^s*"+J+"s*"))(J)}},stoken:function(I){return H.rtoken(new RegExp("^"+I))},until:function(I){return function(M){var L=[],J=null;while(M.length){try{J=I.call(this,M)}catch(K){L.push(J[0]);M=J[1];continue}break}return[L,M]}},many:function(I){return function(M){var J=[],L=null;while(M.length){try{L=I.call(this,M)}catch(K){return[J,M]}J.push(L[0]);M=L[1]}return[J,M]}},optional:function(I){return function(L){var K=null;try{K=I.call(this,L)}catch(J){return[null,L]}return[K[0],K[1]]}},not:function(I){return function(K){try{I.call(this,K)}catch(J){return[null,K]}throw new B.Exception(K)}},ignore:function(I){return I?function(K){var J=null;J=I.call(this,K);return[null,J[1]]}:null},product:function(){var K=arguments[0],J=Array.prototype.slice.call(arguments,1),I=[];for(var L=0;L<K.length;L++){I.push(H.each(K[L],J))}return I},cache:function(I){var K={},J=null;return function(M){try{J=K[M]=(K[M]||I.call(this,M))}catch(L){J=K[M]=L}if(J instanceof B.Exception){throw J}else{return J}}},any:function(){var I=arguments;return function(L){var K=null;for(var M=0;M<I.length;M++){if(I[M]==null){continue}try{K=(I[M].call(this,L))}catch(J){K=null}if(K){return K}}throw new B.Exception(L)}},each:function(){var I=arguments;return function(L){var N=[],K=null;for(var M=0;M<I.length;M++){if(I[M]==null){continue}try{K=(I[M].call(this,L))}catch(J){throw new B.Exception(L)}N.push(K[0]);L=K[1]}return[N,L]}},all:function(){var I=arguments,J=J;return J.each(J.optional(I))},sequence:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;if(K.length==1){return K[0]}return function(R){var Q=null,P=null;var N=[];for(var S=0;S<K.length;S++){try{Q=K[S].call(this,R)}catch(O){break}N.push(Q[0]);try{P=J.call(this,Q[1])}catch(L){P=null;break}R=P[1]}if(!Q){throw new B.Exception(R)}if(P){throw new B.Exception(P[1])}if(I){try{Q=I.call(this,Q[1])}catch(M){throw new B.Exception(Q[1])}}return[N,(Q?Q[1]:R)]}},between:function(K,J,L){L=L||K;var I=H.each(H.ignore(K),J,H.ignore(L));return function(M){var N=I.call(this,M);return[[N[0][0],r[0][2]],N[1]]}},list:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;return(K instanceof Array?H.each(H.product(K.slice(0,-1),H.ignore(J)),K.slice(-1),H.ignore(I)):H.each(H.many(H.each(K,H.ignore(J))),px,H.ignore(I)))},set:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;return function(L){var Q=null,O=null,P=null,M=null,X=[[],L],N=false;for(var V=0;V<K.length;V++){P=null;O=null;Q=null;N=(K.length==1);try{Q=K[V].call(this,L)}catch(S){continue}M=[[Q[0]],Q[1]];if(Q[1].length>0&&!N){try{P=J.call(this,Q[1])}catch(R){N=true}}else{N=true}if(!N&&P[1].length===0){N=true}if(!N){var U=[];for(var W=0;W<K.length;W++){if(V!=W){U.push(K[W])}}O=H.set(U,J).call(this,P[1]);if(O[0].length>0){M[0]=M[0].concat(O[0]);M[1]=O[1]}}if(M[1].length<X[1].length){X=M}if(X[1].length===0){break}}if(X[0].length===0){return X}if(I){try{P=I.call(this,X[1])}catch(T){throw new B.Exception(X[1])}X[1]=P[1]}return X}},forward:function(J,I){return function(K){return J[I].call(this,K)
}},replace:function(I,J){return function(L){var K=I.call(this,L);return[J,K[1]]}},process:function(I,J){return function(L){var K=I.call(this,L);return[J.call(this,K[0]),K[1]]}},min:function(J,I){return function(L){var K=I.call(this,L);if(K[0].length<J){throw new B.Exception(L)}return K}}};var C=function(I){return function(){var M=null,J=[];if(arguments.length>1){M=Array.prototype.slice.call(arguments)}else{if(arguments[0] instanceof Array){M=arguments[0]}}if(M){for(var K=0,L=M.shift();K<L.length;K++){M.unshift(L[K]);J.push(I.apply(null,M));M.shift();return J}}else{return I.apply(null,arguments)}}};var D="optional not ignore cache".split(/\s/);for(var G=0;G<D.length;G++){H[D[G]]=C(H[D[G]])}var E=function(I){return function(){if(arguments[0] instanceof Array){return I.apply(null,arguments[0])}else{return I.apply(null,arguments)}}};var F="each any all".split(/\s/);for(var A=0;A<F.length;A++){H[F[A]]=E(H[F[A]])}}());(function(){var G=Date,A=G.prototype,F=G.CultureInfo;var E=function(L){var N=[];for(var M=0;M<L.length;M++){if(L[M] instanceof Array){N=N.concat(E(L[M]))}else{if(L[M]){N.push(L[M])}}}return N};G.Grammar={};G.Translator={hour:function(L){return function(){this.parseMetadata.addMatch("hour",L);this.hour=Number(L)}},minute:function(L){return function(){this.parseMetadata.addMatch("minute",L);this.minute=Number(L)}},second:function(L){return function(){this.parseMetadata.addMatch("second",L);this.second=Number(L)}},meridian:function(L){return function(){this.parseMetadata.addMatch("meridian",L);this.meridian=L.slice(0,1).toLowerCase()}},timezone:function(L){return function(){this.parseMetadata.addMatch("timezone",L);var M=L.replace(/[^\d\+\-]/g,"");if(M.length){this.timezoneOffset=Number(M)}else{this.timezone=L.toLowerCase()}}},day:function(M){var L=M[0];return function(){this.parseMetadata.addMatch("day",L);this.day=Number(L.match(/\d+/)[0])}},month:function(L){return function(){this.parseMetadata.addMatch("month",L);this.month=((L.length==3)?G.getMonthNumberFromName(L):(Number(L)-1))}},year:function(L){return function(){this.parseMetadata.addMatch("year",L);var M=Number(L);this.year=((L.length>2)?M:(M+(((M+2000)<F.twoDigitYearMax)?2000:1900)))}},rday:function(L){return function(){this.parseMetadata.addMatch("rday",L);switch(L){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break}}},finishExact:function(M){M=(M instanceof Array)?M:[M];for(var O=0;O<M.length;O++){if(M[O]){M[O].call(this)}}var L=new Date();if((this.hour||this.minute)&&(!this.month&&!this.year&&!this.day)){this.day=L.getDate()}if(!this.year){this.year=L.getFullYear()}if(!this.month&&this.month!==0){this.month=L.getMonth()}if(!this.day){this.day=1}if(!this.hour){this.hour=0}if(!this.minute){this.minute=0}if(!this.second){this.second=0}this.parseMetadata.addParsedValues(this);if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12}else{if(this.meridian=="a"&&this.hour==12){this.hour=0}}}if(this.day>G.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.")}var N=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){N.set({timezone:this.timezone})}else{if(this.timezoneOffset){N.set({timezoneOffset:this.timezoneOffset})}}N.parseMetadata=this.parseMetadata;return N},finish:function(T){T=(T instanceof Array)?E(T):[T];if(T.length===0){return null}for(var P=0;P<T.length;P++){if(typeof T[P]=="function"){T[P].call(this)}}this.parseMetadata.addParsedValues(this);var N=G.today();if(this.now&&!this.unit&&!this.operator){return new Date()}else{if(this.now){N=new Date()}}var O=!!(this.days&&this.days!==null||this.orient||this.operator);var L,M,Q;Q=((this.orient=="past"||this.operator=="subtract")?-1:1);if(!this.now&&"hour minute second".indexOf(this.unit)!=-1){N.setTimeToNow()}if(this.month||this.month===0){if("year day hour minute second".indexOf(this.unit)!=-1){this.value=this.month+1;
this.month=null;O=true}}if(!O&&this.weekday&&!this.day&&!this.days){var S=Date[this.weekday]();this.day=S.getDate();if(!this.month){this.month=S.getMonth()}this.year=S.getFullYear()}if(O&&this.weekday&&this.unit!="month"){this.unit="day";L=(G.getDayNumberFromName(this.weekday)-N.getDay());M=7;this.days=L?((L+(Q*M))%M):(Q*M)}if(this.month&&this.unit=="day"&&this.operator){this.value=(this.month+1);this.month=null}if(this.value!=null&&this.month!=null&&this.year!=null){this.parseMetadata.addMatch("day",this.value+"");this.parseMetadata._parsed.day=this.value;this.day=this.value*1}if(this.month&&!this.day&&this.value){N.set({day:this.value*1});if(!O){this.day=this.value*1}}if(!this.month&&this.value&&this.unit=="month"&&!this.now){this.month=this.value;O=true}if(O&&(this.month||this.month===0)&&this.unit!="year"){this.unit="month";L=(this.month-N.getMonth());M=12;this.months=L?((L+(Q*M))%M):(Q*M);this.month=null}if(!this.unit){this.unit="day"}if(!this.value&&this.operator&&this.operator!==null&&this[this.unit+"s"]&&this[this.unit+"s"]!==null){this[this.unit+"s"]=this[this.unit+"s"]+((this.operator=="add")?1:-1)+(this.value||0)*Q}else{if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1}this[this.unit+"s"]=this.value*Q}}if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12}else{if(this.meridian=="a"&&this.hour==12){this.hour=0}}}if(this.weekday&&!this.day&&!this.days){var S=Date[this.weekday]();this.day=S.getDate();if(S.getMonth()!==N.getMonth()){this.month=S.getMonth()}}if(this.month&&!this.day){this.day=1}if(!this.orient&&!this.operator&&this.unit=="week"&&this.value&&!this.day&&!this.month){return G.jan().first().mon().addWeeks(this.value)}if(O&&this.timezone&&this.day&&this.days){this.day=this.days}var R=(O)?N.add(this):N.set(this);R.parseMetadata=this.parseMetadata;return R}};var D=G.Parsing.Operators,H=G.Grammar,B=G.Translator,J;H.datePartDelimiter=D.rtoken(/^([\s\-\.\,\/\x27]+)/);H.timePartDelimiter=D.stoken("[:h.]");H.whiteSpace=D.rtoken(/^\s*/);H.generalDelimiter=D.rtoken(/^(([\s\,]|at|@|on)+)/);var K={};H.ctoken=function(O){var P=K[O];if(!P){var N=F.regexPatterns;var Q=O.split(/\s+/),L=[];for(var M=0;M<Q.length;M++){L.push(D.replace(D.rtoken(N[Q[M]]),Q[M]))}P=K[O]=D.any.apply(null,L)}return P};H.ctoken2=function(L){return D.rtoken(F.regexPatterns[L])};H.h=D.cache(D.process(D.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),B.hour));H.hh=D.cache(D.process(D.rtoken(/^(0[0-9]|1[0-2])/),B.hour));H.H=D.cache(D.process(D.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),B.hour));H.HH=D.cache(D.process(D.rtoken(/^([0-1][0-9]|2[0-3])/),B.hour));H.m=D.cache(D.process(D.rtoken(/^([0-5][0-9]|[0-9])/),B.minute));H.mm=D.cache(D.process(D.rtoken(/^[0-5][0-9]/),B.minute));H.s=D.cache(D.process(D.rtoken(/^([0-5][0-9]|[0-9])/),B.second));H.ss=D.cache(D.process(D.rtoken(/^[0-5][0-9]/),B.second));H.hms=D.cache(D.sequence([H.H,H.mm,H.ss],H.timePartDelimiter));H.t=D.cache(D.process(H.ctoken2("shortMeridian"),B.meridian));H.tt=D.cache(D.process(H.ctoken2("longMeridian"),B.meridian));H.z=D.cache(D.process(D.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),B.timezone));H.zz=D.cache(D.process(D.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),B.timezone));H.zzz=D.cache(D.process(H.ctoken2("timezone"),B.timezone));H.timeSuffix=D.each(D.ignore(H.whiteSpace),D.set([H.tt,H.zzz]));H.time=D.each(D.optional(D.ignore(D.stoken("T"))),H.hms,H.timeSuffix);H.d=D.cache(D.process(D.each(D.rtoken(/^([0-2]\d|3[0-1]|\d)/),D.optional(H.ctoken2("ordinalSuffix"))),B.day));H.dd=D.cache(D.process(D.each(D.rtoken(/^([0-2]\d|3[0-1])/),D.optional(H.ctoken2("ordinalSuffix"))),B.day));H.ddd=H.dddd=D.cache(D.process(H.ctoken("sun mon tue wed thu fri sat"),function(L){return function(){this.weekday=L}}));H.M=D.cache(D.process(D.rtoken(/^(1[0-2]|0\d|\d)/),B.month));H.MM=D.cache(D.process(D.rtoken(/^(1[0-2]|0\d)/),B.month));H.MMM=H.MMMM=D.cache(D.process(H.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),B.month));H.y=D.cache(D.process(D.rtoken(/^(\d\d?)/),B.year));
H.yy=D.cache(D.process(D.rtoken(/^(\d\d)/),B.year));H.yyy=D.cache(D.process(D.rtoken(/^(\d\d?\d?\d?)/),B.year));H.yyyy=D.cache(D.process(D.rtoken(/^(\d\d\d\d)/),B.year));J=function(){return D.each(D.any.apply(null,arguments),D.not(H.ctoken2("timeContext")))};H.day=J(H.d,H.dd);H.month=J(H.M,H.MMM);H.year=J(H.yyyy,H.yy);H.orientation=D.process(H.ctoken("past future"),function(L){return function(){this.orient=L}});H.operator=D.process(H.ctoken("add subtract"),function(L){return function(){this.operator=L}});H.rday=D.process(H.ctoken("yesterday tomorrow today now"),B.rday);H.unit=D.process(H.ctoken("second minute hour day week month year"),function(L){return function(){this.unit=L}});H.value=D.process(D.rtoken(/^\d\d?(st|nd|rd|th)?/),function(L){return function(){this.value=L.replace(/\D/g,"")}});H.expression=D.set([H.rday,H.operator,H.value,H.unit,H.orientation,H.ddd,H.MMM]);J=function(){return D.set(arguments,H.datePartDelimiter)};H.mdy=J(H.ddd,H.month,H.day,H.year);H.ymd=J(H.ddd,H.year,H.month,H.day);H.dmy=J(H.ddd,H.day,H.month,H.year);H.date=function(L){return((H[F.dateElementOrder]||H.mdy).call(this,L))};H.format=D.process(D.many(D.any(D.process(D.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(L){if(H[L]){return H[L]}else{throw G.Parsing.Exception(L)}}),D.process(D.rtoken(/^[^dMyhHmstz]+/),function(L){return D.ignore(D.stoken(L))}))),function(L){return D.process(D.each.apply(null,L),B.finishExact)});var C={};var I=function(L){return C[L]=(C[L]||H.format(L)[0])};H.formats=function(L){if(L instanceof Array){var N=[];for(var M=0;M<L.length;M++){N.push(I(L[M]))}return D.any.apply(null,N)}else{return I(L)}};H._formats=H.formats(['"yyyy-MM-ddTHH:mm:ssZ"',"yyyy-MM-ddTHH:mm:ssZ","yyyy-MM-ddTHH:mm:ssz","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mmZ","yyyy-MM-ddTHH:mmz","yyyy-MM-ddTHH:mm","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","MMddyyyy","ddMMyyyy","Mddyyyy","ddMyyyy","Mdyyyy","dMyyyy","yyyy","Mdyy","dMyy","d"]);H._start=D.process(D.set([H.date,H.time,H.expression],H.generalDelimiter,H.whiteSpace),B.finish);H.start=function(M){startObject=function(){return{parseMetadata:new Date.Parsing.Metadata()}};try{var L=H._formats.call(startObject(),M);if(L[1].length===0){return L}}catch(N){}return H._start.call(startObject(),M)};G._parse=G.parse;G.parse=function(M){var L=null;if(!M){return null}if(M instanceof Date){return M}try{L=G.Grammar.start.call({},M.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"))}catch(N){return null}return((L[1].length===0)?L[0]:null)};G.getParseFunction=function(L){var M=G.Grammar.formats(L);return function(P){var O=null;try{O=M.call({},P)}catch(N){return null}return((O[1].length===0)?O[0]:null)}};G.parseExact=function(M,L){return G.getParseFunction(L)(M)}}());Date.now=function(){return new Date()};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var A={};A[this._dateElement]=this;return Date.now().add(A)};Number.prototype.ago=function(){var A={};A[this._dateElement]=this*-1;return Date.now().add(A)};(function(){var G=Date.prototype,M=Number.prototype;var A=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),B=("january february march april may june july august september october november december").split(/\s/),C=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),D;var E=function(N){return function(){if(this._is){this._is=false;return this.getDay()==N}return this.moveToDayOfWeek(N,this._orient)}};for(var H=0;H<A.length;H++){G[A[H]]=G[A[H].substring(0,3)]=E(H)}var F=function(N){return function(){if(this._is){this._is=false;return this.getMonth()===N}return this.moveToMonth(N,this._orient)}};for(var J=0;J<B.length;
J++){G[B[J]]=G[B[J].substring(0,3)]=F(J)}var I=function(N){return function(){if(N.substring(N.length-1)!="s"){N+="s"}return this["add"+N](this._orient)}};var L=function(N){return function(){this._dateElement=N;return this}};for(var K=0;K<C.length;K++){D=C[K].toLowerCase();G[D]=G[D+"s"]=I(C[K]);M[D]=M[D+"s"]=L(D)}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};(function(D){var G=/^([a-z]{3}|\d{1,2})\s*\/?\s*(\d{2})\s*$/;var A=/(\d{1,4})\s*((a\.?d\.?)|(c\.?e\.?))/;var E=/(\d{1,4})\s*(bce|bc|b.c.e.|b.c.)/;var F=/^0{2,3}\d{1,2}$/;var B=Date.parse;Date.parse=function(I){if(I.match(F)){I=I+"AD"}var K=B.call(Date,I);I=I.toLowerCase();if(!K){var J=null;I=I.replace(G,function(O,N,M){J=M;return N+"/20"+M});if(J){K=B.call(Date,I);if(K){K.parseMetadata._matches.year=J}}else{var H=null;I=I.replace(A,function(O,N){H=N;var M="000"+H;return M.substring(M.length-4,M.length)});if(H){K=B.call(Date,I);if(K){var H=parseInt(H,10);K.setFullYear(H)}}}}if(K&&K.parseMetadata){var L=K.parseMetadata;if(L.explicit("hour")){return(((L.explicit("month")+L.explicit("day")+L.explicit("year"))%3)==0)&&K}}return K};Date.prototype.toISOString=function(){var J=this.getFullYear()<0;var I=null;if(J){I=this.clone();I.setFullYear(I.getFullYear()*-1)}else{I=this}var H=I.toString(D.datejs._isoFormat);if(J){H="-"+H}return H};D.datejs={parse:function(J){var M=false;var H=J.toLowerCase().replace(E,function(R,Q,O){M=true;var P="000"+Q;return P.substring(P.length-4,P.length)});if(M){J=H}if(J=="now"){return{date:null,choices:null,formatted:this._formatDate(new Date(),this._humanDateFormats[0],this._humanTimeFormats[0]),iso:"__now__"}}var I=Date.parse(J);var N=null;var L=null;var K=null;if(I){N=this.getChoices(I);L=this.getFormattedString(I,M);K=this.getIsoString(I,M)}return{date:N?null:I,choices:N,formatted:N?null:L,iso:N?null:K}},getChoices:function(J){var L=D.datejs._dateData(J);var M=function(R){var U=[];for(var P=0;P<D.datejs._tests.length;P++){var T=D.datejs._tests[P];var Q=D.datejs._runTest(T,R);if(Q!=null){for(var S=0;S<Q.length;S++){U=U.concat(M(Q[S]))}return U}}return[R]};var O=M(L);var N={};var I=[];for(var H=0;H<O.length;H++){var K=D.datejs.getFormattedString(D.datejs._dataToDate(O[H]));if(!N[K]){I.push(K);N[K]=true}}return I.length>1?I:null},getFormattedString:function(K,L){var J=this._getMostSpecificField(K);var I=this._hasDateComponent(K);var H=null;var M=null;if(J>=3){H=this._humanDateFormats[J-3]}else{if(I){H=this._humanDateFormats[0]}M=this._humanTimeFormats[J]}return this._formatDate(K,H,M,L)},_formatDate:function(J,I,L,K){var H="";if(I){if(K){I=I.replace("yyyy","yyyy B.C.E.")}else{if(J.getFullYear()>=0&&J.getFullYear()<1000){I=I.replace("yyyy","yyyy C.E.")}}H=J.toString(I);H=H.replace(/(\d{4}) (C\.E\.|B\.C\.E\.)/,function(O,N,M){return parseInt(N,10)+" "+M})}if(L){H+=(H?" ":"")+J.toString(L).replace(/(AM)|(PM)/,function(M){return M.toLowerCase()})}return H},getIsoString:function(J,K){var I=this._getMostSpecificField(J);var H=this._hasDateComponent(J);return(K?"-":"")+J.toString(this._isoFormat.substring(H?0:11,this._isoFormat.length-I*3))},_getMostSpecificField:function(I){if(I.parseMetadata.relativeDay()){return 3}var H;var J=I.parseMetadata;for(H=0;H<this._fields.length;H++){if(J.explicit(this._fields[H][0])){break}}return H},_hasDateComponent:function(H){if(H.parseMetadata.relativeDay()){return true
}var I=H.parseMetadata;return I.explicit("year")||I.explicit("month")||I.explicit("day")},_swapOrder:function(M,J,N){var I=M.order;var L,K=-1;for(var H=0;H<I.length;H++){if(I[H]==J){L=H}else{if(I[H]==N){K=H}}if(L>-1&&K>-1){I[L]=N;I[K]=J;return }}},_tests:[{name:"dateMonthAmbiguity",fields:["month","day"],test:function(H){if(!D.datejs._isNumeric(H.match.month)){return null}if((H.fields.month<=11)&&(H.fields.day<=12)&&(H.order[0]!="year")){if(H.fields.month+1==H.fields.day){return null}var L=D.datejs._cloneDateData(H);L.definite.month=true;var K=D.datejs._cloneDateData(L);K.fields.month=L.fields.day-1;K.match.month=L.match.day;K.fields.day=L.fields.month+1;K.match.day=L.match.month;D.datejs._swapOrder(K,"day","month");var J=D.datejs._cloneDateData(L);var I=D.datejs._cloneDateData(K);D([J,I]).each(function(N,M){M.definite.month=false;M.definite.day=true});return[L,K,J,I]}return null}},{name:"twoDigitYear",fields:["year"],test:function(H){if(H.match.year.length==2){var J=D.datejs._cloneDateData(H);J.definite.year=true;J.fields.year=parseInt("20"+H.match.year);var I=D.datejs._cloneDateData(J);I.fields.year=parseInt("19"+H.match.year);return[J,I]}return null}},{name:"dayOrYear",fields:["day"],test:function(H){if(!H.explicit.year&&H.fields.day<=31&&H.match.day.length==2&&!H.definite.year&&H.order[1]=="day"){var I=[D.datejs._cloneDateData(H)];I[0].fields.year=(new Date()).getFullYear();I[0].definite.year=true;I[0].definite.day=true;I[1]=D.datejs._cloneDateData(H);I[1].fields.year=parseInt("20"+H.match.day);I[1].match.year=H.fields.day;I[1].explicit.year=true;D.datejs._swapOrder(I[1],"year","day");I[1].fields.day=null;I[1].match.day=null;I[1].explicit.day=false;I[1].definite.day=true;I[2]=D.datejs._cloneDateData(I[1]);I[2].fields.year=parseInt("19"+H.match.day);I[2].match.year=H.fields.day;return I}return null}}],_runTest:function(M,J){for(var H=0;H<M.fields.length;H++){var K=M.fields[H];if(J.definite[K]){return null}if(!J.explicit[K]){return null}}var L=M.test(J);if(!L){return null}var I=[];for(var H=0;H<L.length;H++){if(D.datejs._dataToDate(L[H])){I.push(L[H])}}return I},_dataToDate:function(J){var I=J.fields;var K=new Date(2000,0,1);for(var H=0;H<D.datejs._fields.length;H++){field=D.datejs._fields[H];if(I[field[0]]!=null){K["set"+field[1]](I[field[0]])}}K.setMilliseconds(0);for(var H=0;H<D.datejs._fields.length;H++){field=D.datejs._fields[H];if(J.explicit[field[0]]&&K["get"+field[1]]()!=I[field[0]]){return null}}K.parseMetadata=new C(J.match,J.explicit);return K},_dateData:function(H){var I={fields:{second:H.getSeconds(),minute:H.getMinutes(),hour:H.getHours(),day:H.getDate(),month:H.getMonth(),year:H.getFullYear()},explicit:{},match:{},definite:{},order:H.parseMetadata.getOrder().slice(0)};D(D.datejs._fields).each(function(J,K){I.explicit[K[0]]=H.parseMetadata.explicit(K[0]);I.match[K[0]]=H.parseMetadata.match(K[0])});return I},_cloneDateData:function(H){var I={fields:{},explicit:{},match:{},definite:{}};D(["fields","explicit","match","definite"]).each(function(J,K){D.extend(I[K],H[K])});I.order=H.order.slice(0);I.toString=function(){var J="X";return"m: "+((this.fields.month?this.fields.month+1:J))+" d: "+(this.fields.day||J)+" y: "+(this.fields.year||J)};return I},_isNumeric:function(H){return typeof (H)=="number"?true:isNaN(parseInt(H))?false:true},_humanDateFormats:["MMM d, yyyy","MMM yyyy","yyyy"],_humanTimeFormats:["h:mm:sstt","h:mmtt","htt"],_isoFormat:"yyyy-MM-ddTHH:mm:ss",_fields:[["second","Seconds"],["minute","Minutes"],["hour","Hours"],["day","Date"],["month","Month"],["year","FullYear"]]};var C=D.datejs.DateDataMetadata=function(I,H){this._match=I;this._explicit=H};C.prototype={match:function(H){return this._match[H]||null},explicit:function(H){return this._explicit[H]},relativeDay:function(){return false}}})(jQuery);(function(B){if(!B.suggest){alert("$.suggest required")}var A={_init:B.suggest.suggest.prototype._init,_destroy:B.suggest.suggest.prototype._destroy,response:B.suggest.suggest.prototype.response};B.suggest("suggesttype",B.extend(true,{},B.suggest.suggest.prototype,{_init:function(){var C=this,D=this.options;
A._init.call(C);this.result=null;this.input.next(".fbs-list-dropdown").remove();this.dropdown=B('<button type="button" class="fbs-list-dropdown">&#9660;</button>').bind("mouseup.suggest",function(E){C.request();C.input.focus();return false}).bind("keypress.suggest",function(E){if(E.keyCode===13){C.request();C.input.focus();return false}});this.input.after(this.dropdown);if(D.mql_query&&typeof D.mql_query==="object"){if(typeof JSON==="undefined"){init_JSON()}D.mql_query=JSON.stringify(D.mql_query)}},_destroy:function(){A._destroy.call(this);this.dropdown.remove()},focus:function(C){this.focus_hook()},textchange:function(){this.input.removeData("data.suggest");this.input.trigger("fb-textchange",this);window.clearTimeout(this.textchange.timeout);var C=this;this.textchange.timeout=window.setTimeout(function(){C.textchange_delay()},200)},textchange_delay:function(){var C=B.trim(this.input.val());this.request(C)},request:function(F){if(this.result){this.response(F);return }if(this.ac_xhr){this.ac_xhr.abort();this.ac_xhr=null}var C=this,E=this.options,D={query:E.mql_query||'{"query":[{"id":null,"name":null,"optional":true,"/common/topic/alias":[{"optional":true,"value":null}],"sort":"name","type":"'+E.type+'","limit":'+E.limit+'}],"lang":"'+E.lang+'"}'};window.clearTimeout(this.request.timeout);this.request.timeout=window.setTimeout(function(){C.ac_xhr=B.ajax({url:E.service_url+E.service_path,data:D,beforeSend:function(){var G=C.input.data("request.count.suggest")||0;if(!G){C.trackEvent(C.name,"start_session")}G+=1;C.trackEvent(C.name,"request","count",G);C.input.data("request.count.suggest",G)},success:function(H,G){if(H.code==="/api/status/ok"){C.result=H.result;C.response(F,true)}},error:function(I,H,G){C.trackEvent(C.name,"request","error",{url:this.url,response:I?I.responseText:null})},complete:function(G){if(G){C.trackEvent(C.name,"request","tid",G.getResponseHeader("X-Metaweb-TID"))}},dataType:C.jsonp?"jsonp":"json",cache:true})},200)},build:function(){var C=this;this.list.empty();B.each(this.result,function(){var D=this;if(!D.alias&&"/common/topic/alias" in D){D.alias=B.map(D["/common/topic/alias"],function(G,F){return G.value})}var E=C.create_item(D).bind("mouseover.suggest",function(F){C.mouseover_item(F)}).data("data.suggest",D);C.list.append(E)})},response:function(F,E){var C=this;if(E){this.build()}var G=B(">li",this.list);if(F===null||F===""){G.show()}else{var D=new RegExp("\\b"+F,"i");B.each(G,function(){var J=B(this);var I=B(this).data("data.suggest");if(D.test(I.name)){J.show()}else{var H=false;B.each(I.alias,function(K,L){if(D.test(L)){H=true;return false}});if(H){J.show()}else{J.hide()}}});if(!B(">li:visible",this.list).length){G.show()}}this.input.data("original.suggest",this.input.val());this.position();this.pane.show()},check_response:function(C){return true},create_item:function(E){var C=this.options.css,D=B("<div>").addClass(C.item_name).text(E.name);E.name=D.text();return B("<li>").addClass(C.item).append(D)}}));B.extend(B.suggest.suggesttype,{defaults:B.extend(true,{},B.suggest.suggest.defaults,{type:"/location/country",mql_query:null,limit:500,service_url:"http://www.freebase.com",service_path:"/api/service/mqlread",lang:"/lang/en",status:null})})})(jQuery);(function(A){if(!(A.suggest&&A.suggest.suggesttype)){alert("$.suggesttype required")}A.suggest("suggestboolean",A.extend(true,{},A.suggest.suggesttype.prototype,{request:function(B){if(!this.result){this.result=[{name:this.options["true"],value:"true",alias:["true","yes","1"]},{name:this.options["false"],value:"false",alias:["false","no","0","-1"]}];this.response(B,true)}else{this.response(B,false)}}}));A.extend(A.suggest.suggestboolean,{defaults:A.extend(true,{},A.suggest.suggesttype.defaults,{flyout:false,"true":"true","false":"false"}),helptext:null})})(jQuery);Date.getMonthNumberFromName=function(A){var C=Date.CultureInfo.monthNames,B=Date.CultureInfo.abbreviatedMonthNames,D=A.toLowerCase();for(var E=0;E<C.length;E++){if(C[E].toLowerCase()==D||B[E].toLowerCase()==D){return E
}}return -1};Date.getDayNumberFromName=function(A){var C=Date.CultureInfo.dayNames,B=Date.CultureInfo.abbreviatedDayNames,D=Date.CultureInfo.shortestDayNames,E=A.toLowerCase();for(var F=0;F<C.length;F++){if(C[F].toLowerCase()==E||B[F].toLowerCase()==E){return F}}return -1};Date.isLeapYear=function(A){return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.getDaysInMonth=function(B,A){return[31,(Date.isLeapYear(B)?29:28),31,30,31,30,31,31,30,31,30,31][A]};Date.getTimezoneOffset=function(B,A){return(A||false)?Date.CultureInfo.abbreviatedTimeZoneDST[B.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[B.toUpperCase()]};Date.getTimezoneAbbreviation=function(A,C){var D=(C||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,B;for(B in D){if(D[B]===A){return B}}return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(A){if(isNaN(this)){throw new Error(this)}if(A instanceof Date&&!isNaN(A)){return(this>A)?1:(this<A)?-1:0}else{throw new TypeError(A)}};Date.prototype.equals=function(A){return(this.compareTo(A)===0)};Date.prototype.between=function(C,B){var A=this.getTime();return A>=C.getTime()&&A<=B.getTime()};Date.prototype.addMilliseconds=function(A){this.setMilliseconds(this.getMilliseconds()+A);return this};Date.prototype.addSeconds=function(A){return this.addMilliseconds(A*1000)};Date.prototype.addMinutes=function(A){return this.addMilliseconds(A*60000)};Date.prototype.addHours=function(A){return this.addMilliseconds(A*3600000)};Date.prototype.addDays=function(A){return this.addMilliseconds(A*86400000)};Date.prototype.addWeeks=function(A){return this.addMilliseconds(A*604800000)};Date.prototype.addMonths=function(B){var A=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+B);this.setDate(Math.min(A,this.getDaysInMonth()));return this};Date.prototype.addYears=function(A){return this.addMonths(A*12)};Date.prototype.add=function(A){if(typeof A=="number"){this._orient=A;return this}var B=A;if(B.millisecond||B.milliseconds){this.addMilliseconds(B.millisecond||B.milliseconds)}if(B.second||B.seconds){this.addSeconds(B.second||B.seconds)}if(B.minute||B.minutes){this.addMinutes(B.minute||B.minutes)}if(B.hour||B.hours){this.addHours(B.hour||B.hours)}if(B.month||B.months){this.addMonths(B.month||B.months)}if(B.year||B.years){this.addYears(B.year||B.years)}if(B.day||B.days){this.addDays(B.day||B.days)}return this};Date._validate=function(C,D,B,A){if(typeof C!="number"){throw new TypeError(C+" is not a Number.")}else{if(C<D||C>B){throw new RangeError(C+" is not a valid value for "+A+".")}}return true};Date.validateMillisecond=function(A){return Date._validate(A,0,999,"milliseconds")};Date.validateSecond=function(A){return Date._validate(A,0,59,"seconds")};Date.validateMinute=function(A){return Date._validate(A,0,59,"minutes")};Date.validateHour=function(A){return Date._validate(A,0,23,"hours")};Date.validateDay=function(C,B,A){return Date._validate(C,1,Date.getDaysInMonth(B,A),"days")};Date.validateMonth=function(A){return Date._validate(A,0,11,"months")};Date.validateYear=function(A){return Date._validate(A,1,9999,"seconds")};Date.prototype.set=function(A){var B=A;if(!B.millisecond&&B.millisecond!==0){B.millisecond=-1}if(!B.second&&B.second!==0){B.second=-1}if(!B.minute&&B.minute!==0){B.minute=-1}if(!B.hour&&B.hour!==0){B.hour=-1}if(!B.day&&B.day!==0){B.day=-1}if(!B.month&&B.month!==0){B.month=-1}if(!B.year&&B.year!==0){B.year=-1}if(B.millisecond!=-1&&Date.validateMillisecond(B.millisecond)){this.addMilliseconds(B.millisecond-this.getMilliseconds())}if(B.second!=-1&&Date.validateSecond(B.second)){this.addSeconds(B.second-this.getSeconds())}if(B.minute!=-1&&Date.validateMinute(B.minute)){this.addMinutes(B.minute-this.getMinutes())}if(B.hour!=-1&&Date.validateHour(B.hour)){this.addHours(B.hour-this.getHours())}if(B.month!==-1&&Date.validateMonth(B.month)){this.addMonths(B.month-this.getMonth())}if(B.year!=-1&&Date.validateYear(B.year)){this.addYears(B.year-this.getFullYear())
}if(B.day!=-1&&Date.validateDay(B.day,this.getFullYear(),this.getMonth())){this.addDays(B.day-this.getDate())}if(B.timezone){this.setTimezone(B.timezone)}if(B.timezoneOffset){this.setTimezoneOffset(B.timezoneOffset)}return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.prototype.isWeekday=function(){return !(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(B,A){var C=(B-this.getDay()+7*(A||+1))%7;return this.addDays((C===0)?C+=7*(A||+1):C)};Date.prototype.moveToMonth=function(C,B){var A=(C-this.getMonth()+12*(B||+1))%12;return this.addMonths((A===0)?A+=12*(B||+1):A)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000)};Date.prototype.getWeekOfYear=function(I){var C=this.getFullYear(),G=this.getMonth(),E=this.getDate();var A=I||Date.CultureInfo.firstDayOfWeek;var F=7+1-new Date(C,0,1).getDay();if(F==8){F=1}var H=((Date.UTC(C,G,E,0,0,0)-Date.UTC(C,0,1,0,0,0))/86400000)+1;var B=Math.floor((H-F+7)/7);if(B===A){C--;var D=7+1-new Date(C,0,1).getDay();if(D==2||D==8){B=53}else{B=52}}return B};Date.prototype.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(A){var B=this.getTimezoneOffset(),C=Number(A)*-6/10;this.addMinutes(C-B);return this};Date.prototype.setTimezone=function(A){return this.setTimezoneOffset(Date.getTimezoneOffset(A))};Date.prototype.getUTCOffset=function(){var A=this.getTimezoneOffset()*-10/6,B;if(A<0){B=(A-10000).toString();return B[0]+B.substr(2)}else{B=(A+10000).toString();return"+"+B.substr(1)}};Date.prototype.getDayName=function(A){return A?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(A){return A?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(E){var B=this;var A=function A(F){return(F.toString().length==1)?"0"+F:F};var C=function D(G){G=""+G;var F="000";return F.substring(0,4-G.length)+G};return E?E.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(F){switch(F){case"hh":return A(B.getHours()<13?B.getHours():(B.getHours()-12));case"h":return B.getHours()<13?B.getHours():(B.getHours()-12);case"HH":return A(B.getHours());case"H":return B.getHours();case"mm":return A(B.getMinutes());case"m":return B.getMinutes();case"ss":return A(B.getSeconds());case"s":return B.getSeconds();case"yyyy":return C(B.getFullYear());case"yy":return C(B.getFullYear()).substring(2,4);case"dddd":return B.getDayName();case"ddd":return B.getDayName(true);case"dd":return A(B.getDate());case"d":return B.getDate().toString();case"MMMM":return B.getMonthName();case"MMM":return B.getMonthName(true);case"MM":return A((B.getMonth()+1));case"M":return B.getMonth()+1;case"t":return B.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return B.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return""}}):this._toString()};Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
(function(){Date.Parsing={Exception:function(I){this.message="Parse error at '"+I.substring(0,10)+" ...'"}};var B=Date.Parsing;B.Metadata=function(){this._matches={};this._parsed=null;this._order=[]};B.Metadata.prototype={FIELDS:["hour","minute","second","meridian","timezone","day","month","year","rday","milliseconds"],addParsedValues:function(I){if(this._parsed){return }this._parsed={};for(var K=0;K<this.FIELDS.length;K++){var J=this.FIELDS[K];this._parsed[J]=I[J]}},explicit:function(I){var J=this._parsed[I];var K=this._matches[I];return !K?false:J==undefined?false:typeof J=="number"?J>=0:!!J},match:function(I){if(!this.explicit(I)){return null}return this._matches[I]},addMatch:function(I,J){this._matches[I]=J;this._order.push(I)},relativeDay:function(){return !!this._matches.rday},getOrder:function(){return this._order}};var H=B.Operators={rtoken:function(I){return function(K){var J=K.match(I);if(J){return([J[0],K.substring(J[0].length)])}else{throw new B.Exception(K)}}},token:function(I){return function(J){return H.rtoken(new RegExp("^s*"+J+"s*"))(J)}},stoken:function(I){return H.rtoken(new RegExp("^"+I))},until:function(I){return function(M){var L=[],J=null;while(M.length){try{J=I.call(this,M)}catch(K){L.push(J[0]);M=J[1];continue}break}return[L,M]}},many:function(I){return function(M){var J=[],L=null;while(M.length){try{L=I.call(this,M)}catch(K){return[J,M]}J.push(L[0]);M=L[1]}return[J,M]}},optional:function(I){return function(L){var K=null;try{K=I.call(this,L)}catch(J){return[null,L]}return[K[0],K[1]]}},not:function(I){return function(K){try{I.call(this,K)}catch(J){return[null,K]}throw new B.Exception(K)}},ignore:function(I){return I?function(K){var J=null;J=I.call(this,K);return[null,J[1]]}:null},product:function(){var K=arguments[0],J=Array.prototype.slice.call(arguments,1),I=[];for(var L=0;L<K.length;L++){I.push(H.each(K[L],J))}return I},cache:function(I){var K={},J=null;return function(M){try{J=K[M]=(K[M]||I.call(this,M))}catch(L){J=K[M]=L}if(J instanceof B.Exception){throw J}else{return J}}},any:function(){var I=arguments;return function(L){var K=null;for(var M=0;M<I.length;M++){if(I[M]==null){continue}try{K=(I[M].call(this,L))}catch(J){K=null}if(K){return K}}throw new B.Exception(L)}},each:function(){var I=arguments;return function(L){var N=[],K=null;for(var M=0;M<I.length;M++){if(I[M]==null){continue}try{K=(I[M].call(this,L))}catch(J){throw new B.Exception(L)}N.push(K[0]);L=K[1]}return[N,L]}},all:function(){var I=arguments,J=J;return J.each(J.optional(I))},sequence:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;if(K.length==1){return K[0]}return function(R){var Q=null,P=null;var N=[];for(var S=0;S<K.length;S++){try{Q=K[S].call(this,R)}catch(O){break}N.push(Q[0]);try{P=J.call(this,Q[1])}catch(L){P=null;break}R=P[1]}if(!Q){throw new B.Exception(R)}if(P){throw new B.Exception(P[1])}if(I){try{Q=I.call(this,Q[1])}catch(M){throw new B.Exception(Q[1])}}return[N,(Q?Q[1]:R)]}},between:function(K,J,L){L=L||K;var I=H.each(H.ignore(K),J,H.ignore(L));return function(M){var N=I.call(this,M);return[[N[0][0],r[0][2]],N[1]]}},list:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;return(K instanceof Array?H.each(H.product(K.slice(0,-1),H.ignore(J)),K.slice(-1),H.ignore(I)):H.each(H.many(H.each(K,H.ignore(J))),px,H.ignore(I)))},set:function(K,J,I){J=J||H.rtoken(/^\s*/);I=I||null;return function(L){var Q=null,O=null,P=null,M=null,X=[[],L],N=false;for(var V=0;V<K.length;V++){P=null;O=null;Q=null;N=(K.length==1);try{Q=K[V].call(this,L)}catch(S){continue}M=[[Q[0]],Q[1]];if(Q[1].length>0&&!N){try{P=J.call(this,Q[1])}catch(R){N=true}}else{N=true}if(!N&&P[1].length===0){N=true}if(!N){var U=[];for(var W=0;W<K.length;W++){if(V!=W){U.push(K[W])}}O=H.set(U,J).call(this,P[1]);if(O[0].length>0){M[0]=M[0].concat(O[0]);M[1]=O[1]}}if(M[1].length<X[1].length){X=M}if(X[1].length===0){break}}if(X[0].length===0){return X}if(I){try{P=I.call(this,X[1])}catch(T){throw new B.Exception(X[1])}X[1]=P[1]}return X}},forward:function(J,I){return function(K){return J[I].call(this,K)
}},replace:function(I,J){return function(L){var K=I.call(this,L);return[J,K[1]]}},process:function(I,J){return function(L){var K=I.call(this,L);return[J.call(this,K[0]),K[1]]}},min:function(J,I){return function(L){var K=I.call(this,L);if(K[0].length<J){throw new B.Exception(L)}return K}}};var C=function(I){return function(){var M=null,J=[];if(arguments.length>1){M=Array.prototype.slice.call(arguments)}else{if(arguments[0] instanceof Array){M=arguments[0]}}if(M){for(var K=0,L=M.shift();K<L.length;K++){M.unshift(L[K]);J.push(I.apply(null,M));M.shift();return J}}else{return I.apply(null,arguments)}}};var D="optional not ignore cache".split(/\s/);for(var G=0;G<D.length;G++){H[D[G]]=C(H[D[G]])}var E=function(I){return function(){if(arguments[0] instanceof Array){return I.apply(null,arguments[0])}else{return I.apply(null,arguments)}}};var F="each any all".split(/\s/);for(var A=0;A<F.length;A++){H[F[A]]=E(H[F[A]])}}());(function(){var G=Date,A=G.prototype,F=G.CultureInfo;var E=function(L){var N=[];for(var M=0;M<L.length;M++){if(L[M] instanceof Array){N=N.concat(E(L[M]))}else{if(L[M]){N.push(L[M])}}}return N};G.Grammar={};G.Translator={hour:function(L){return function(){this.parseMetadata.addMatch("hour",L);this.hour=Number(L)}},minute:function(L){return function(){this.parseMetadata.addMatch("minute",L);this.minute=Number(L)}},second:function(L){return function(){this.parseMetadata.addMatch("second",L);this.second=Number(L)}},meridian:function(L){return function(){this.parseMetadata.addMatch("meridian",L);this.meridian=L.slice(0,1).toLowerCase()}},timezone:function(L){return function(){this.parseMetadata.addMatch("timezone",L);var M=L.replace(/[^\d\+\-]/g,"");if(M.length){this.timezoneOffset=Number(M)}else{this.timezone=L.toLowerCase()}}},day:function(M){var L=M[0];return function(){this.parseMetadata.addMatch("day",L);this.day=Number(L.match(/\d+/)[0])}},month:function(L){return function(){this.parseMetadata.addMatch("month",L);this.month=((L.length==3)?G.getMonthNumberFromName(L):(Number(L)-1))}},year:function(L){return function(){this.parseMetadata.addMatch("year",L);var M=Number(L);this.year=((L.length>2)?M:(M+(((M+2000)<F.twoDigitYearMax)?2000:1900)))}},rday:function(L){return function(){this.parseMetadata.addMatch("rday",L);switch(L){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break}}},finishExact:function(M){M=(M instanceof Array)?M:[M];for(var O=0;O<M.length;O++){if(M[O]){M[O].call(this)}}var L=new Date();if((this.hour||this.minute)&&(!this.month&&!this.year&&!this.day)){this.day=L.getDate()}if(!this.year){this.year=L.getFullYear()}if(!this.month&&this.month!==0){this.month=L.getMonth()}if(!this.day){this.day=1}if(!this.hour){this.hour=0}if(!this.minute){this.minute=0}if(!this.second){this.second=0}this.parseMetadata.addParsedValues(this);if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12}else{if(this.meridian=="a"&&this.hour==12){this.hour=0}}}if(this.day>G.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.")}var N=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){N.set({timezone:this.timezone})}else{if(this.timezoneOffset){N.set({timezoneOffset:this.timezoneOffset})}}N.parseMetadata=this.parseMetadata;return N},finish:function(T){T=(T instanceof Array)?E(T):[T];if(T.length===0){return null}for(var P=0;P<T.length;P++){if(typeof T[P]=="function"){T[P].call(this)}}this.parseMetadata.addParsedValues(this);var N=G.today();if(this.now&&!this.unit&&!this.operator){return new Date()}else{if(this.now){N=new Date()}}var O=!!(this.days&&this.days!==null||this.orient||this.operator);var L,M,Q;Q=((this.orient=="past"||this.operator=="subtract")?-1:1);if(!this.now&&"hour minute second".indexOf(this.unit)!=-1){N.setTimeToNow()}if(this.month||this.month===0){if("year day hour minute second".indexOf(this.unit)!=-1){this.value=this.month+1;
this.month=null;O=true}}if(!O&&this.weekday&&!this.day&&!this.days){var S=Date[this.weekday]();this.day=S.getDate();if(!this.month){this.month=S.getMonth()}this.year=S.getFullYear()}if(O&&this.weekday&&this.unit!="month"){this.unit="day";L=(G.getDayNumberFromName(this.weekday)-N.getDay());M=7;this.days=L?((L+(Q*M))%M):(Q*M)}if(this.month&&this.unit=="day"&&this.operator){this.value=(this.month+1);this.month=null}if(this.value!=null&&this.month!=null&&this.year!=null){this.parseMetadata.addMatch("day",this.value+"");this.parseMetadata._parsed.day=this.value;this.day=this.value*1}if(this.month&&!this.day&&this.value){N.set({day:this.value*1});if(!O){this.day=this.value*1}}if(!this.month&&this.value&&this.unit=="month"&&!this.now){this.month=this.value;O=true}if(O&&(this.month||this.month===0)&&this.unit!="year"){this.unit="month";L=(this.month-N.getMonth());M=12;this.months=L?((L+(Q*M))%M):(Q*M);this.month=null}if(!this.unit){this.unit="day"}if(!this.value&&this.operator&&this.operator!==null&&this[this.unit+"s"]&&this[this.unit+"s"]!==null){this[this.unit+"s"]=this[this.unit+"s"]+((this.operator=="add")?1:-1)+(this.value||0)*Q}else{if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1}this[this.unit+"s"]=this.value*Q}}if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12}else{if(this.meridian=="a"&&this.hour==12){this.hour=0}}}if(this.weekday&&!this.day&&!this.days){var S=Date[this.weekday]();this.day=S.getDate();if(S.getMonth()!==N.getMonth()){this.month=S.getMonth()}}if(this.month&&!this.day){this.day=1}if(!this.orient&&!this.operator&&this.unit=="week"&&this.value&&!this.day&&!this.month){return G.jan().first().mon().addWeeks(this.value)}if(O&&this.timezone&&this.day&&this.days){this.day=this.days}var R=(O)?N.add(this):N.set(this);R.parseMetadata=this.parseMetadata;return R}};var D=G.Parsing.Operators,H=G.Grammar,B=G.Translator,J;H.datePartDelimiter=D.rtoken(/^([\s\-\.\,\/\x27]+)/);H.timePartDelimiter=D.stoken("[:h.]");H.whiteSpace=D.rtoken(/^\s*/);H.generalDelimiter=D.rtoken(/^(([\s\,]|at|@|on)+)/);var K={};H.ctoken=function(O){var P=K[O];if(!P){var N=F.regexPatterns;var Q=O.split(/\s+/),L=[];for(var M=0;M<Q.length;M++){L.push(D.replace(D.rtoken(N[Q[M]]),Q[M]))}P=K[O]=D.any.apply(null,L)}return P};H.ctoken2=function(L){return D.rtoken(F.regexPatterns[L])};H.h=D.cache(D.process(D.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),B.hour));H.hh=D.cache(D.process(D.rtoken(/^(0[0-9]|1[0-2])/),B.hour));H.H=D.cache(D.process(D.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),B.hour));H.HH=D.cache(D.process(D.rtoken(/^([0-1][0-9]|2[0-3])/),B.hour));H.m=D.cache(D.process(D.rtoken(/^([0-5][0-9]|[0-9])/),B.minute));H.mm=D.cache(D.process(D.rtoken(/^[0-5][0-9]/),B.minute));H.s=D.cache(D.process(D.rtoken(/^([0-5][0-9]|[0-9])/),B.second));H.ss=D.cache(D.process(D.rtoken(/^[0-5][0-9]/),B.second));H.hms=D.cache(D.sequence([H.H,H.mm,H.ss],H.timePartDelimiter));H.t=D.cache(D.process(H.ctoken2("shortMeridian"),B.meridian));H.tt=D.cache(D.process(H.ctoken2("longMeridian"),B.meridian));H.z=D.cache(D.process(D.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),B.timezone));H.zz=D.cache(D.process(D.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),B.timezone));H.zzz=D.cache(D.process(H.ctoken2("timezone"),B.timezone));H.timeSuffix=D.each(D.ignore(H.whiteSpace),D.set([H.tt,H.zzz]));H.time=D.each(D.optional(D.ignore(D.stoken("T"))),H.hms,H.timeSuffix);H.d=D.cache(D.process(D.each(D.rtoken(/^([0-2]\d|3[0-1]|\d)/),D.optional(H.ctoken2("ordinalSuffix"))),B.day));H.dd=D.cache(D.process(D.each(D.rtoken(/^([0-2]\d|3[0-1])/),D.optional(H.ctoken2("ordinalSuffix"))),B.day));H.ddd=H.dddd=D.cache(D.process(H.ctoken("sun mon tue wed thu fri sat"),function(L){return function(){this.weekday=L}}));H.M=D.cache(D.process(D.rtoken(/^(1[0-2]|0\d|\d)/),B.month));H.MM=D.cache(D.process(D.rtoken(/^(1[0-2]|0\d)/),B.month));H.MMM=H.MMMM=D.cache(D.process(H.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),B.month));H.y=D.cache(D.process(D.rtoken(/^(\d\d?)/),B.year));
H.yy=D.cache(D.process(D.rtoken(/^(\d\d)/),B.year));H.yyy=D.cache(D.process(D.rtoken(/^(\d\d?\d?\d?)/),B.year));H.yyyy=D.cache(D.process(D.rtoken(/^(\d\d\d\d)/),B.year));J=function(){return D.each(D.any.apply(null,arguments),D.not(H.ctoken2("timeContext")))};H.day=J(H.d,H.dd);H.month=J(H.M,H.MMM);H.year=J(H.yyyy,H.yy);H.orientation=D.process(H.ctoken("past future"),function(L){return function(){this.orient=L}});H.operator=D.process(H.ctoken("add subtract"),function(L){return function(){this.operator=L}});H.rday=D.process(H.ctoken("yesterday tomorrow today now"),B.rday);H.unit=D.process(H.ctoken("second minute hour day week month year"),function(L){return function(){this.unit=L}});H.value=D.process(D.rtoken(/^\d\d?(st|nd|rd|th)?/),function(L){return function(){this.value=L.replace(/\D/g,"")}});H.expression=D.set([H.rday,H.operator,H.value,H.unit,H.orientation,H.ddd,H.MMM]);J=function(){return D.set(arguments,H.datePartDelimiter)};H.mdy=J(H.ddd,H.month,H.day,H.year);H.ymd=J(H.ddd,H.year,H.month,H.day);H.dmy=J(H.ddd,H.day,H.month,H.year);H.date=function(L){return((H[F.dateElementOrder]||H.mdy).call(this,L))};H.format=D.process(D.many(D.any(D.process(D.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(L){if(H[L]){return H[L]}else{throw G.Parsing.Exception(L)}}),D.process(D.rtoken(/^[^dMyhHmstz]+/),function(L){return D.ignore(D.stoken(L))}))),function(L){return D.process(D.each.apply(null,L),B.finishExact)});var C={};var I=function(L){return C[L]=(C[L]||H.format(L)[0])};H.formats=function(L){if(L instanceof Array){var N=[];for(var M=0;M<L.length;M++){N.push(I(L[M]))}return D.any.apply(null,N)}else{return I(L)}};H._formats=H.formats(['"yyyy-MM-ddTHH:mm:ssZ"',"yyyy-MM-ddTHH:mm:ssZ","yyyy-MM-ddTHH:mm:ssz","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mmZ","yyyy-MM-ddTHH:mmz","yyyy-MM-ddTHH:mm","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","MMddyyyy","ddMMyyyy","Mddyyyy","ddMyyyy","Mdyyyy","dMyyyy","yyyy","Mdyy","dMyy","d"]);H._start=D.process(D.set([H.date,H.time,H.expression],H.generalDelimiter,H.whiteSpace),B.finish);H.start=function(M){startObject=function(){return{parseMetadata:new Date.Parsing.Metadata()}};try{var L=H._formats.call(startObject(),M);if(L[1].length===0){return L}}catch(N){}return H._start.call(startObject(),M)};G._parse=G.parse;G.parse=function(M){var L=null;if(!M){return null}if(M instanceof Date){return M}try{L=G.Grammar.start.call({},M.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"))}catch(N){return null}return((L[1].length===0)?L[0]:null)};G.getParseFunction=function(L){var M=G.Grammar.formats(L);return function(P){var O=null;try{O=M.call({},P)}catch(N){return null}return((O[1].length===0)?O[0]:null)}};G.parseExact=function(M,L){return G.getParseFunction(L)(M)}}());Date.now=function(){return new Date()};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var A={};A[this._dateElement]=this;return Date.now().add(A)};Number.prototype.ago=function(){var A={};A[this._dateElement]=this*-1;return Date.now().add(A)};(function(){var G=Date.prototype,M=Number.prototype;var A=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),B=("january february march april may june july august september october november december").split(/\s/),C=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),D;var E=function(N){return function(){if(this._is){this._is=false;return this.getDay()==N}return this.moveToDayOfWeek(N,this._orient)}};for(var H=0;H<A.length;H++){G[A[H]]=G[A[H].substring(0,3)]=E(H)}var F=function(N){return function(){if(this._is){this._is=false;return this.getMonth()===N}return this.moveToMonth(N,this._orient)}};for(var J=0;J<B.length;
J++){G[B[J]]=G[B[J].substring(0,3)]=F(J)}var I=function(N){return function(){if(N.substring(N.length-1)!="s"){N+="s"}return this["add"+N](this._orient)}};var L=function(N){return function(){this._dateElement=N;return this}};for(var K=0;K<C.length;K++){D=C[K].toLowerCase();G[D]=G[D+"s"]=I(C[K]);M[D]=M[D+"s"]=L(D)}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};(function(D){var G=/^([a-z]{3}|\d{1,2})\s*\/?\s*(\d{2})\s*$/;var A=/(\d{1,4})\s*((a\.?d\.?)|(c\.?e\.?))/;var E=/(\d{1,4})\s*(bce|bc|b.c.e.|b.c.)/;var F=/^0{2,3}\d{1,2}$/;var B=Date.parse;Date.parse=function(I){if(I.match(F)){I=I+"AD"}var K=B.call(Date,I);I=I.toLowerCase();if(!K){var J=null;I=I.replace(G,function(O,N,M){J=M;return N+"/20"+M});if(J){K=B.call(Date,I);if(K){K.parseMetadata._matches.year=J}}else{var H=null;I=I.replace(A,function(O,N){H=N;var M="000"+H;return M.substring(M.length-4,M.length)});if(H){K=B.call(Date,I);if(K){var H=parseInt(H,10);K.setFullYear(H)}}}}if(K&&K.parseMetadata){var L=K.parseMetadata;if(L.explicit("hour")){return(((L.explicit("month")+L.explicit("day")+L.explicit("year"))%3)==0)&&K}}return K};Date.prototype.toISOString=function(){var J=this.getFullYear()<0;var I=null;if(J){I=this.clone();I.setFullYear(I.getFullYear()*-1)}else{I=this}var H=I.toString(D.datejs._isoFormat);if(J){H="-"+H}return H};D.datejs={parse:function(J){var M=false;var H=J.toLowerCase().replace(E,function(R,Q,O){M=true;var P="000"+Q;return P.substring(P.length-4,P.length)});if(M){J=H}if(J=="now"){return{date:null,choices:null,formatted:this._formatDate(new Date(),this._humanDateFormats[0],this._humanTimeFormats[0]),iso:"__now__"}}var I=Date.parse(J);var N=null;var L=null;var K=null;if(I){N=this.getChoices(I);L=this.getFormattedString(I,M);K=this.getIsoString(I,M)}return{date:N?null:I,choices:N,formatted:N?null:L,iso:N?null:K}},getChoices:function(J){var L=D.datejs._dateData(J);var M=function(R){var U=[];for(var P=0;P<D.datejs._tests.length;P++){var T=D.datejs._tests[P];var Q=D.datejs._runTest(T,R);if(Q!=null){for(var S=0;S<Q.length;S++){U=U.concat(M(Q[S]))}return U}}return[R]};var O=M(L);var N={};var I=[];for(var H=0;H<O.length;H++){var K=D.datejs.getFormattedString(D.datejs._dataToDate(O[H]));if(!N[K]){I.push(K);N[K]=true}}return I.length>1?I:null},getFormattedString:function(K,L){var J=this._getMostSpecificField(K);var I=this._hasDateComponent(K);var H=null;var M=null;if(J>=3){H=this._humanDateFormats[J-3]}else{if(I){H=this._humanDateFormats[0]}M=this._humanTimeFormats[J]}return this._formatDate(K,H,M,L)},_formatDate:function(J,I,L,K){var H="";if(I){if(K){I=I.replace("yyyy","yyyy B.C.E.")}else{if(J.getFullYear()>=0&&J.getFullYear()<1000){I=I.replace("yyyy","yyyy C.E.")}}H=J.toString(I);H=H.replace(/(\d{4}) (C\.E\.|B\.C\.E\.)/,function(O,N,M){return parseInt(N,10)+" "+M})}if(L){H+=(H?" ":"")+J.toString(L).replace(/(AM)|(PM)/,function(M){return M.toLowerCase()})}return H},getIsoString:function(J,K){var I=this._getMostSpecificField(J);var H=this._hasDateComponent(J);return(K?"-":"")+J.toString(this._isoFormat.substring(H?0:11,this._isoFormat.length-I*3))},_getMostSpecificField:function(I){if(I.parseMetadata.relativeDay()){return 3}var H;var J=I.parseMetadata;for(H=0;H<this._fields.length;H++){if(J.explicit(this._fields[H][0])){break}}return H},_hasDateComponent:function(H){if(H.parseMetadata.relativeDay()){return true
}var I=H.parseMetadata;return I.explicit("year")||I.explicit("month")||I.explicit("day")},_swapOrder:function(M,J,N){var I=M.order;var L,K=-1;for(var H=0;H<I.length;H++){if(I[H]==J){L=H}else{if(I[H]==N){K=H}}if(L>-1&&K>-1){I[L]=N;I[K]=J;return }}},_tests:[{name:"dateMonthAmbiguity",fields:["month","day"],test:function(H){if(!D.datejs._isNumeric(H.match.month)){return null}if((H.fields.month<=11)&&(H.fields.day<=12)&&(H.order[0]!="year")){if(H.fields.month+1==H.fields.day){return null}var L=D.datejs._cloneDateData(H);L.definite.month=true;var K=D.datejs._cloneDateData(L);K.fields.month=L.fields.day-1;K.match.month=L.match.day;K.fields.day=L.fields.month+1;K.match.day=L.match.month;D.datejs._swapOrder(K,"day","month");var J=D.datejs._cloneDateData(L);var I=D.datejs._cloneDateData(K);D([J,I]).each(function(N,M){M.definite.month=false;M.definite.day=true});return[L,K,J,I]}return null}},{name:"twoDigitYear",fields:["year"],test:function(H){if(H.match.year.length==2){var J=D.datejs._cloneDateData(H);J.definite.year=true;J.fields.year=parseInt("20"+H.match.year);var I=D.datejs._cloneDateData(J);I.fields.year=parseInt("19"+H.match.year);return[J,I]}return null}},{name:"dayOrYear",fields:["day"],test:function(H){if(!H.explicit.year&&H.fields.day<=31&&H.match.day.length==2&&!H.definite.year&&H.order[1]=="day"){var I=[D.datejs._cloneDateData(H)];I[0].fields.year=(new Date()).getFullYear();I[0].definite.year=true;I[0].definite.day=true;I[1]=D.datejs._cloneDateData(H);I[1].fields.year=parseInt("20"+H.match.day);I[1].match.year=H.fields.day;I[1].explicit.year=true;D.datejs._swapOrder(I[1],"year","day");I[1].fields.day=null;I[1].match.day=null;I[1].explicit.day=false;I[1].definite.day=true;I[2]=D.datejs._cloneDateData(I[1]);I[2].fields.year=parseInt("19"+H.match.day);I[2].match.year=H.fields.day;return I}return null}}],_runTest:function(M,J){for(var H=0;H<M.fields.length;H++){var K=M.fields[H];if(J.definite[K]){return null}if(!J.explicit[K]){return null}}var L=M.test(J);if(!L){return null}var I=[];for(var H=0;H<L.length;H++){if(D.datejs._dataToDate(L[H])){I.push(L[H])}}return I},_dataToDate:function(J){var I=J.fields;var K=new Date(2000,0,1);for(var H=0;H<D.datejs._fields.length;H++){field=D.datejs._fields[H];if(I[field[0]]!=null){K["set"+field[1]](I[field[0]])}}K.setMilliseconds(0);for(var H=0;H<D.datejs._fields.length;H++){field=D.datejs._fields[H];if(J.explicit[field[0]]&&K["get"+field[1]]()!=I[field[0]]){return null}}K.parseMetadata=new C(J.match,J.explicit);return K},_dateData:function(H){var I={fields:{second:H.getSeconds(),minute:H.getMinutes(),hour:H.getHours(),day:H.getDate(),month:H.getMonth(),year:H.getFullYear()},explicit:{},match:{},definite:{},order:H.parseMetadata.getOrder().slice(0)};D(D.datejs._fields).each(function(J,K){I.explicit[K[0]]=H.parseMetadata.explicit(K[0]);I.match[K[0]]=H.parseMetadata.match(K[0])});return I},_cloneDateData:function(H){var I={fields:{},explicit:{},match:{},definite:{}};D(["fields","explicit","match","definite"]).each(function(J,K){D.extend(I[K],H[K])});I.order=H.order.slice(0);I.toString=function(){var J="X";return"m: "+((this.fields.month?this.fields.month+1:J))+" d: "+(this.fields.day||J)+" y: "+(this.fields.year||J)};return I},_isNumeric:function(H){return typeof (H)=="number"?true:isNaN(parseInt(H))?false:true},_humanDateFormats:["MMM d, yyyy","MMM yyyy","yyyy"],_humanTimeFormats:["h:mm:sstt","h:mmtt","htt"],_isoFormat:"yyyy-MM-ddTHH:mm:ss",_fields:[["second","Seconds"],["minute","Minutes"],["hour","Hours"],["day","Date"],["month","Month"],["year","FullYear"]]};var C=D.datejs.DateDataMetadata=function(I,H){this._match=I;this._explicit=H};C.prototype={match:function(H){return this._match[H]||null},explicit:function(H){return this._explicit[H]},relativeDay:function(){return false}}})(jQuery);(function(A){if(!A.suggest){alert("$.suggest required")}if(!A.datejs){alert("$.datejs required")}A.suggest("suggestdate",{request:function(E){var D={};try{D=A.datejs.parse(E)}catch(C){}var B=[];if(D.formatted&&D.iso){B.push({name:D.iso==="__now__"?"now":D.formatted,value:D.iso})
}else{if(D.choices){A.each(D.choices,function(){B.push({name:String(this)})})}}this.response(B);if(B.length){A("li:first",this.list).trigger("mouseover.suggest")}},blur:function(C){if(this.input.data("dont_hide")){return }var E=this.options,D=this.pane.is(":visible")&&A("."+E.css.item,this.list).length,B=this.get_selected();if(D&&B){this.onselect(B)}else{this.check_required(C)}this.hide_all()},onselect:function(C,B){var E=C.data("data.suggest");if(E){if(!E.iso){var D=A.datejs.parse(E.name);E.value=D.iso}this.input.val(E.name).data("data.suggest",E).trigger("fb-select",E)}else{this.check_required()}if(B){this.input.focus()}}});A.extend(A.suggest.suggestdate,{defaults:{nomatch:('<div class="datetime-help">You can enter a date in many ways, just be sure to include the year!<div class="datetime-help-content">Try:</div><ul class="property-help-list"><li class="property-help-listitem">January 2007</li><li class="property-help-listitem">9/30/1986</li><li class="property-help-listitem">2001</li><li class="property-help-listitem">January 2nd 2005 </li><li class="property-help-listitem">4/1975</li></ul></div>'),status:["Please enter a valid date/time",null,null]}})})(jQuery);function NumberFormat(B,A){this.VERSION="Number Format v1.5.4";this.COMMA=",";this.PERIOD=".";this.DASH="-";this.LEFT_PAREN="(";this.RIGHT_PAREN=")";this.LEFT_OUTSIDE=0;this.LEFT_INSIDE=1;this.RIGHT_INSIDE=2;this.RIGHT_OUTSIDE=3;this.LEFT_DASH=0;this.RIGHT_DASH=1;this.PARENTHESIS=2;this.NO_ROUNDING=-1;this.num;this.numOriginal;this.hasSeparators=false;this.separatorValue;this.inputDecimalValue;this.decimalValue;this.negativeFormat;this.negativeRed;this.hasCurrency;this.currencyPosition;this.currencyValue;this.places;this.roundToPlaces;this.truncate;this.setNumber=setNumberNF;this.toUnformatted=toUnformattedNF;this.setInputDecimal=setInputDecimalNF;this.setSeparators=setSeparatorsNF;this.setCommas=setCommasNF;this.setNegativeFormat=setNegativeFormatNF;this.setNegativeRed=setNegativeRedNF;this.setCurrency=setCurrencyNF;this.setCurrencyPrefix=setCurrencyPrefixNF;this.setCurrencyValue=setCurrencyValueNF;this.setCurrencyPosition=setCurrencyPositionNF;this.setPlaces=setPlacesNF;this.toFormatted=toFormattedNF;this.toPercentage=toPercentageNF;this.getOriginal=getOriginalNF;this.moveDecimalRight=moveDecimalRightNF;this.moveDecimalLeft=moveDecimalLeftNF;this.getRounded=getRoundedNF;this.preserveZeros=preserveZerosNF;this.justNumber=justNumberNF;this.expandExponential=expandExponentialNF;this.getZeros=getZerosNF;this.moveDecimalAsString=moveDecimalAsStringNF;this.moveDecimal=moveDecimalNF;this.addSeparators=addSeparatorsNF;if(A==null){this.setNumber(B,this.PERIOD)}else{this.setNumber(B,A)}this.setCommas(true);this.setNegativeFormat(this.LEFT_DASH);this.setNegativeRed(false);this.setCurrency(false);this.setCurrencyPrefix("$");this.setPlaces(2)}function setInputDecimalNF(A){this.inputDecimalValue=A}function setNumberNF(B,A){if(A!=null){this.setInputDecimal(A)}this.numOriginal=B;this.num=this.justNumber(B)}function toUnformattedNF(){return(this.num)}function getOriginalNF(){return(this.numOriginal)}function setNegativeFormatNF(A){this.negativeFormat=A}function setNegativeRedNF(A){this.negativeRed=A}function setSeparatorsNF(A,C,B){this.hasSeparators=A;if(C==null){C=this.COMMA}if(B==null){B=this.PERIOD}if(C==B){this.decimalValue=(B==this.PERIOD)?this.COMMA:this.PERIOD}else{this.decimalValue=B}this.separatorValue=C}function setCommasNF(A){this.setSeparators(A,this.COMMA,this.PERIOD)}function setCurrencyNF(A){this.hasCurrency=A}function setCurrencyValueNF(A){this.currencyValue=A}function setCurrencyPrefixNF(A){this.setCurrencyValue(A);this.setCurrencyPosition(this.LEFT_OUTSIDE)}function setCurrencyPositionNF(A){this.currencyPosition=A}function setPlacesNF(A,B){this.roundToPlaces=!(A==this.NO_ROUNDING);this.truncate=(B!=null&&B);this.places=(A<0)?0:A}function addSeparatorsNF(F,E,B,G){F+="";var D=F.indexOf(E);var C="";if(D!=-1){C=B+F.substring(D+1,F.length);F=F.substring(0,D)}var A=/(\d+)(\d{3})/;
while(A.test(F)){F=F.replace(A,"$1"+G+"$2")}return F+C}function toFormattedNF(){var C;var B=this.num;var N;var M=new Array(2);if(this.roundToPlaces){B=this.getRounded(B);N=this.preserveZeros(Math.abs(B))}else{N=this.expandExponential(Math.abs(B))}if(this.hasSeparators){N=this.addSeparators(N,this.PERIOD,this.decimalValue,this.separatorValue)}else{N=N.replace(new RegExp("\\"+this.PERIOD),this.decimalValue)}var I="";var D="";var J="";var E="";var G="";var K="";var H="";var L="";var A=(this.negativeFormat==this.PARENTHESIS)?this.LEFT_PAREN:this.DASH;var F=(this.negativeFormat==this.PARENTHESIS)?this.RIGHT_PAREN:this.DASH;if(this.currencyPosition==this.LEFT_OUTSIDE){if(B<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){E=A}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){G=F}}if(this.hasCurrency){I=this.currencyValue}}else{if(this.currencyPosition==this.LEFT_INSIDE){if(B<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){D=A}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){H=F}}if(this.hasCurrency){J=this.currencyValue}}else{if(this.currencyPosition==this.RIGHT_INSIDE){if(B<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){D=A}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){H=F}}if(this.hasCurrency){K=this.currencyValue}}else{if(this.currencyPosition==this.RIGHT_OUTSIDE){if(B<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){E=A}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){G=F}}if(this.hasCurrency){L=this.currencyValue}}}}}N=I+D+J+E+N+G+K+H+L;if(this.negativeRed&&B<0){N='<font color="red">'+N+"</font>"}return(N)}function toPercentageNF(){nNum=this.num*100;nNum=this.getRounded(nNum);return nNum+"%"}function getZerosNF(B){var C="";var A;for(A=0;A<B;A++){C+="0"}return C}function expandExponentialNF(A){if(isNaN(A)){return A}var F=parseFloat(A)+"";var C=F.toLowerCase().indexOf("e");if(C!=-1){var B=F.toLowerCase().indexOf("+");var E=F.toLowerCase().indexOf("-",C);var D=F.substring(0,C);if(E!=-1){var G=F.substring(E+1,F.length);D=this.moveDecimalAsString(D,true,parseInt(G))}else{if(B==-1){B=C}var G=F.substring(B+1,F.length);D=this.moveDecimalAsString(D,false,parseInt(G))}F=D}return F}function moveDecimalRightNF(C,A){var B="";if(A==null){B=this.moveDecimal(C,false)}else{B=this.moveDecimal(C,false,A)}return B}function moveDecimalLeftNF(C,A){var B="";if(A==null){B=this.moveDecimal(C,true)}else{B=this.moveDecimal(C,true,A)}return B}function moveDecimalAsStringNF(F,E,I){var A=(arguments.length<3)?this.places:I;if(A<=0){return F}var H=F+"";var D=this.getZeros(A);var B=new RegExp("([0-9.]+)");if(E){H=H.replace(B,D+"$1");var C=new RegExp("(-?)([0-9]*)([0-9]{"+A+"})(\\.?)");H=H.replace(C,"$1$2.$3")}else{var G=B.exec(H);if(G!=null){H=H.substring(0,G.index)+G[1]+D+H.substring(G.index+G[0].length)}var C=new RegExp("(-?)([0-9]*)(\\.?)([0-9]{"+A+"})");H=H.replace(C,"$1$2$4.")}H=H.replace(/\.$/,"");return H}function moveDecimalNF(C,D,A){var B="";if(A==null){B=this.moveDecimalAsString(C,D)}else{B=this.moveDecimalAsString(C,D,A)}return parseFloat(B)}function getRoundedNF(A){A=this.moveDecimalRight(A);if(this.truncate){A=A>=0?Math.floor(A):Math.ceil(A)}else{A=Math.round(A)}A=this.moveDecimalLeft(A);return A}function preserveZerosNF(E){var A;E=this.expandExponential(E);if(this.places<=0){return E}var B=E.indexOf(".");if(B==-1){E+=".";for(A=0;A<this.places;A++){E+="0"}}else{var C=(E.length-1)-B;var D=this.places-C;for(A=0;A<D;A++){E+="0"}}return E}function justNumberNF(D){newVal=D+"";var E=false;if(newVal.indexOf("%")!=-1){newVal=newVal.replace(/\%/g,"");E=true}var A=new RegExp("[^\\"+this.inputDecimalValue+"\\d\\-\\+\\(\\)eE]","g");newVal=newVal.replace(A,"");var C=new RegExp("["+this.inputDecimalValue+"]","g");var F=C.exec(newVal);if(F!=null){var B=newVal.substring(F.index+F[0].length);newVal=newVal.substring(0,F.index)+this.PERIOD+B.replace(C,"")
}if(newVal.charAt(newVal.length-1)==this.DASH){newVal=newVal.substring(0,newVal.length-1);newVal="-"+newVal}else{if(newVal.charAt(0)==this.LEFT_PAREN&&newVal.charAt(newVal.length-1)==this.RIGHT_PAREN){newVal=newVal.substring(1,newVal.length-1);newVal="-"+newVal}}newVal=parseFloat(newVal);if(!isFinite(newVal)){newVal=0}if(E){newVal=this.moveDecimalLeft(newVal,2)}return newVal}(function(A){A.numberjs={format:function(D,B){var C=new NumberFormat(D);C.setCommas(B&&B.comma);C.setPlaces(B&&B.decimal);return C.toFormatted()},parse:function(D,B){var C=new NumberFormat(D);C.setCommas(B&&B.comma);C.setPlaces(B&&B.decimal);return C.toUnformatted()}}})(jQuery);(function(A){if(!A.suggest){alert("$.suggest required")}if(!A.numberjs){alert("$.numberjs required")}A.suggest("suggestnumber",{request:function(C){var D,B=[];C=this.format(C);D=this.parse(C);if(isNaN(D)){this.options.nomatch="Please enter a valid number"}else{B.push({name:C,value:D})}this.response(B);if(B.length){A("li:first",this.list).trigger("mouseover.suggest")}},blur:function(C){if(this.input.data("dont_hide")){return }var E=this.options,D=this.pane.is(":visible")&&A("."+E.css.item,this.list).length,B=this.get_selected();if(D&&B){this.onselect(B)}else{this.check_required(C)}this.hide_all()},format:function(B){return A.numberjs.format(B,this.options)},parse:function(B){return A.numberjs.parse(B,this.options)},scientific:function(B){return A.suggest.suggestnumber.scientific.test(B)}});A.extend(A.suggest.suggestnumber,{defaults:{status:["Please enter a valid number",null,null],nomatch:"Please enter a valid number",decimal:0,comma:true},scientific:/^[0-9]+(\.[0-9]+)?[Ee][+-]?[0-9]+$/})})(jQuery);(function(A){A.fn.expandtext=function(B){return this.each(function(){var C=A.data(this,"expandtext");if(C){C._destroy()}A.data(this,"expandtext",new A.expandtext(this,B))})};A.expandtext=function(C,D){var B=this,F=this.options=A.extend(true,{},A.expandtext.defaults,D);this.input=A(C).bind("keypress.expandtext",function(G){B.input_keypress(G)});this.textarea=A("<textarea class='fbs-expand-textarea'>").bind("keydown.expandtext",function(G){B.textarea_keydown(G)}).bind("keypress.expandtext",function(G){B.textarea_keypress(G)});this.collapsebutton=A('<button type="button" class="fbs-icon-text-collapse">&#8689;</button>').bind("click.expandtext",function(G){B.collapse(true)});this.charcounter=A('<div class="fbs-expand-charcounter">');var E=A('<div class="fbs-expand-toolbar">').append(this.collapsebutton).append(this.charcounter);this.expandpane=A('<div style="display:none;position:absolute" class="fbs-expand-pane">').append(this.textarea).append(E);A(document.body).append(this.expandpane);if(A.fn.autogrow){this.textarea.autogrow()}this.input.next(".fbs-icon-text-expand").remove();this.expandbutton=A('<button type="button" class="fbs-icon-text-expand">&#8690;</button>').bind("mouseup.expandtext",function(G){B.expand()}).bind("keypress.expandtext",function(G){if(G.keyCode===13){B.expand()}});this.input.after(this.expandbutton)};A.expandtext.prototype={_destroy:function(){this.input.unbind(".expandtext");this.textarea.unbind(".expandtext");this.collapsebutton.unbind(".expandtext");this.expandbutton.unbind(".expandtext");this.expandbutton.remove();this.expandpane.remove()},expand:function(){A(".fbs-expand-pane").hide();var B=this,D=this.input.offset(),C=this.input.val();this.textarea.val(C);this.update_charcounter();this.expandpane.css({top:D.top,left:D.left});this.expandpane.slideDown(function(){B.textarea.focus()})},collapse:function(E){var B=this,D=this.options;if(E){var C=this.textarea.val();A.each(A.expandtext.newline_regex,function(F,G){C=C.replace(G," ");mod=true});if(C.length>D.max){C=C.substring(0,D.max)}this.textarea.val(C)}this.expandpane.slideUp(function(){B.input.focus();if(E){B.input.trigger("collapse.expandtext",B.textarea.val())}})},textarea_keydown:function(C){var B=C.keyCode;if(B===9){this.collapse(true)}},textarea_keypress:function(C){var B=C.keyCode;if(B===13){this.collapse(true)
}else{if(B===27){this.collapse(false)}else{this.textarea_textchange()}}},input_keypress:function(B){this.update_max(this.input)},textarea_textchange:function(){var B=this;window.clearTimeout(this.textarea_textchange.timeout);this.textarea_textchange.timeout=window.setTimeout(function(){B.textarea_textchange_delay()},200)},textarea_textchange_delay:function(){this.update_charcounter()},update_charcounter:function(){var C=this.update_max(this.textarea),B=" characters left";if(C<=1){B=" character left"}this.charcounter.text(C+B)},update_max:function(F){var E=this.options,D=F.val(),B=D.length,C=E.max-B;if(C<0){F.val(D.substring(0,E.max));C=0}return C}};A.extend(A.expandtext,{defaults:{max:1000},newline_regex:[new RegExp("\r\n","g"),new RegExp("\n\r","g"),new RegExp("\n","g"),new RegExp("\r","g")]})})(jQuery);(function(A){A.fn.equalizeCols=function(){var B=0,C=A.browser.msie?"1%":"auto";return this.css("height",C).each(function(){B=Math.max(B,this.offsetHeight)}).css("height",B).each(function(){var D=this.offsetHeight;if(D>B){A(this).css("height",B-(D-B))}})}})(jQuery);(function(B,A){A.popup={};A.popup.INSTANCES=[];A.popup.init=function(C){A.Debug.log("fb.popup.init ",C);B(".popup-trigger",C).each(function(E){var D=B(this);if(D.data("fb__popup_initialized")){return }D.click(function(F){A.Debug.log("popup click",F);F.stopPropagation();A.popup.popup_toggle(B(this))}).data("fb__popup_initialized",true)});B(".popup-body[capture=true]",C).click(function(D){D.stopPropagation()})};A.popup.popup_toggle=function(C){C=B(C);A.popup.popup_hide(B(".popup-trigger-active").not(C));if(C.hasClass("popup-trigger-active")){A.popup.popup_hide(C)}else{A.popup.popup_show(C)}};A.popup.popup_show=function(D){D=B(D);A.Debug.group("fb.popup.popup_show",D);var C=D.next(".popup-body");if(C.length){A.popup.bind(D,C.show());D.addClass("popup-trigger-active")}A.Debug.groupEnd("fb.popup.popup_show")};A.popup.popup_hide=function(D){A.Debug.group("fb.popup.popup_hide",D);A.Debug.time("fb.popup.popup_hide");if(!(D&&B(D).length)){var C=B(A.popup.INSTANCES);A.popup.INSTANCES=[]}else{D=B(D);var C=D}C.each(function(){var F=B(this);F.removeClass("popup-trigger-active");var E=F.data("fb.popup");if(E){E.hide()}F.trigger("hide.popup")});A.Debug.timeEnd("fb.popup.popup_hide");A.Debug.groupEnd("fb.popup.popup_hide")};A.popup.bind=function(D,C){D=B(D);A.Debug.group("fb.popup.bind");A.Debug.assertEquals(D.length,1);A.Debug.assert(D.is(".popup-trigger"));A.Debug.assertEquals(C.length,1);A.Debug.assert(C.is(".popup-body"));D.data("fb.popup",C);A.popup.INSTANCES.push(D);A.Debug.groupEnd("fb.popup.bind");return D};A.popup.position=function(E,D,C,F,H){A.Debug.time("fb.popup.postion");E=B(E);D=B(D);var G=E.offset();if(C.length==2&&"W"==C.charAt(1)){G.left-=A.popup.num(E,"marginLeft")}else{if(C.length==2&&"E"==C.charAt(1)){G.left+=(Math.max(E.width(),E.outerWidth())+A.popup.num(E,"marginRight"))}else{if(C.length==1){G.left+=((Math.max(E.width(),E.outerWidth())+A.popup.num(E,"marginLeft")+A.popup.num(E,"marginRight"))/2);G.left-=((Math.max(D.width(),D.outerWidth())+A.popup.num(D,"marginLeft")+A.popup.num(D,"marginRight"))/2)}else{A.Debug.assert(false)}}}if("N"==C.charAt(0)){G.top-=A.popup.num(E,"marginTop")}else{if("S"==C.charAt(0)){G.top+=(Math.max(E.height(),E.outerHeight())+A.popup.num(E,"marginTop"))}else{A.Debug.assert(false)}}if(F.length==2&&"E"==F.charAt(1)){G.right=D.offsetParent().width()-G.left;delete G.left}if("S"==F.charAt(0)){G.top-=Math.max(D.height(),D.outerHeight({margin:true}))}if(H){B.each(["left","right","top","bottom"],function(I,J){if(H[J]&&(G[J]!=undefined)){G[J]+=H[J]}})}if("NW"==C&&"NW"==F){D.css({"max-width":(D.offsetParent().width()-parseInt(B("#content").css("padding-right"))-G.left)})}D.css(G);A.Debug.timeEnd("fb.popup.postion")};A.popup.num=function(C,D){return parseInt(B.curCSS(C.jquery?C[0]:C,D,true))||0};B(document.body).add(".menu-link").click(function(C){if(B(C.target).parents(".popup-body:first").length==0&&B(C.target).is(":not(.popup-body)")){A.popup.popup_hide()
}});A.run_init(A.popup,"popup.js")})(jQuery,window.freebase);(function(B,A){A.dialog={};A.dialog.DIALOG_STACK=[];A.dialog.confirm=function(H,F,D,E){A.Debug.group("fb.dialog.confirm");var G=A.dialog.create_dialog(F,H);B("button:last",G).click(A.dialog.hide);var C=B("button:first[type=submit]",G).focus();A.activate(C,true);if(F&&D&&E){A.dialog.show_relative_to_anchor(G,F,D,E)}else{A.dialog.show_with_block_ui(G)}A.Debug.groupEnd("fb.dialog.confirm");return G};A.dialog._instance_html_templ=function(E){var D='<div class="confirm"><div class="confirm-msg1">%s</div><div class="confirm-msg2">%s</div><form class="confirm-form"><div class="submit-buttons"><div class="save-progress"></div>';for(var C=0;C<E;C++){var F=(C?"submit":"submit active");D+='<button type="submit" class="'+F+'">%s</button>'}D+='<div class="submit-buttons-shim"/></div></form></div>';return D};A.dialog.confirm_html=function(E,C,D,F){return A.sprintf(A.dialog._instance_html_templ(2),E||"Confirm?",C||"",D||"ok",F||"cancel")};A.dialog.info_html=function(E,C,D){D=D||"ok";C=C||"";return A.sprintf(A.dialog._instance_html_templ(1),E,C,D)};A.dialog.confirm_dialog=function(C){A.popup.popup_hide();var E=A.dialog.confirm_html(C.msg1,C.msg2,C.ok_text,C.cancel_text);var D=A.dialog.confirm(E,B(C.relative_to),C.anchor_pos,C.confirm_pos);if(C.success){B("button:first",D).click(C.success)}if(C.failure){B("button:last",D).click(C.failure)}return D};A.dialog.info_dialog=function(C){A.popup.popup_hide();var D=A.dialog.info_html(C.msg1,C.msg2,C.ok_text);return A.dialog.confirm(D,C.relative_to,C.anchor_pos,C.confirm_pos)};A.dialog.show_with_block_ui=function(G){A.Debug.group("fb.dialog.show_with_block_ui",G);G.css({position:"absolute",display:"none"});var C=B("<div class='blockMsg' id='fb_show_with_block_ui_buffer'/>");C.css({position:"fixed",visibility:"hidden"});B(document.body).append(C);var H=G.clone();C.append(H);var E=H.outerWidth();var F=H.outerHeight();C.empty().remove();function D(L,K){return((((L-K)/2)/L)*100)+"%"}var J=D(B(window).width(),E);var I=D(B(window).height(),F);B.blockUI.defaults.css={};B.blockUI({message:G,baseZ:2000,css:{top:I,left:J,width:E,height:F}});G.attr("fb__dialog_show","block_ui");A.Debug.groupEnd("fb.dialog.show_with_block_ui",G);return G};A.dialog.show_relative_to_anchor=function(F,E,C,D){A.Debug.group("fb.dialog.show_relative_to_anchor",F,E,C,D);A.Debug.assert(C&&D);F.css("position","absolute");A.popup.position(E,F,C,D);F.show();F.attr("fb__dialog_show","relative");A.Debug.groupEnd("fb.dialog.show_relative_to_anchor",F,E,C,D);return F};A.dialog.hide_all=function(){A.Debug.group("fb.dialog.hide_all");var C=A.dialog.pop_dialog();while(C&&C.length!=0){A.dialog.hide({target:C});C=A.dialog.pop_dialog()}A.Debug.groupEnd("fb.dialog.hide_all")};A.dialog.hide=function(F){A.Debug.group("fb.dialog.hide",F);var E=B(F.target);E=E.is(".overlay-dialog")?E:E.parents(".overlay-dialog:first");if(E.attr("fb__dialog_show")=="relative"){E.remove()}else{if(E.attr("id")){var D=E.parent().is(".blockMsg");if(!D){E.remove()}else{var C=E.attr("id");B.unblockUI({onUnblock:function(){A.Debug.group("fb.dialog.hide.onUnblock",E,C);B("#"+C).remove();B(document.body).css("cursor","default");A.Debug.groupEnd("fb.dialog.hide.onUnblock",E,C)}})}}else{E.remove()}}A.Debug.groupEnd("fb.dialog.hide",F);return false};A.dialog.create_dialog=function(E,F){A.Debug.group("fb.dialog.create_dialog",E);var D="overlay-dialog-"+A.dialog.create_dialog._counter++;A.dialog.DIALOG_STACK.push(D);var C=B("#"+D);A.Debug.assertEquals(C.length,0);B(document.body).append(A.sprintf('<div id="%s" class="overlay-dialog"/>',D));C=B("#"+D);if(E&&E.length!=0){C.attr("fb__anchor_id",B(E).attr("id"))}if(F){A.Debug.time("fb.dialog.create_dialog.set_html");C.html(F);A.Debug.timeEnd("fb.dialog.create_dialog.set_html")}A.Debug.groupEnd("fb.dialog.create_dialog",E);return C.hide()};A.dialog.create_dialog._counter=0;A.dialog.is_dialog=function(C){return B(C).is(".overlay-dialog")};A.dialog.pop_dialog=function(){A.Debug.group("fb.dialog.pop_dialog");
var E=null;while(A.dialog.DIALOG_STACK.length&&!E){var C=A.dialog.DIALOG_STACK.pop();if(C){var D=B("#"+C+":first");A.Debug.log("attempting to pop",C,D);if(D.length){E=D}}}A.Debug.groupEnd("fb.dialog.pop_dialog");return E};A.dialog.init=function(){};A.run_init(A.dialog,"dialog.js")})(jQuery,window.freebase);(function($,fb){var popup=fb.popup;var fbv=fb.view={};$.blockUI.defaults.fadeIn=100;$.blockUI.defaults.fadeOut=200;fbv.PERMISSION_ERROR_MESSAGE="You do not have permission to do this.";fbv.UNIQUENESS_ERROR_MESSAGE=('The value you are trying to insert is already in use by <a href="/edit/topic%s">%s</a>. Please delete it first');fbv.EDIT_SCRIPTS=["templates/edit.js"];fbv.DEFAULT_OVERLAY_OPTIONS={anchor_pos:"NW",overlay_pos:"NW",inline:false};fbv.is_editing=function(){return $(document.body).hasClass("editing")};fbv.edit_button_handler=function(init_function_name,source_js,overlay_options){this.init_function_name=init_function_name;this.source_js=source_js||fbv.EDIT_SCRIPTS;this.overlay_options={};$.extend(this.overlay_options,fbv.DEFAULT_OVERLAY_OPTIONS,overlay_options)};fbv.EDIT_BUTTON_HANDLERS={"image-add-button":new fbv.edit_button_handler("fb.image.init_add_dialog",fbv.EDIT_SCRIPTS.concat("src/image.js"),{anchor_pos:"NE",overlay_pos:"NE"}),"image-edit-button":new fbv.edit_button_handler("fb.image.init_edit_dialog",fbv.EDIT_SCRIPTS.concat("src/image.js"),{anchor_pos:"NE",overlay_pos:"NE"}),"weblink-edit-button":new fbv.edit_button_handler("fb.weblinks.init_edit_dialog",fbv.EDIT_SCRIPTS.concat("src/weblinks.js"),{anchor_pos:"NE",overlay_pos:"NE"}),"article-edit-button":new fbv.edit_button_handler("fb.edit.article.init_editor",fbv.EDIT_SCRIPTS,{inline:true}),"type-add-button":new fbv.edit_button_handler("fb.edit.add_type.init_dialog"),"type-reorder-button":new fbv.edit_button_handler("fb.edit.init_reorder_type_dialog"),"base-type-remove-button":new fbv.edit_button_handler("fb.bases.remove_base_type.init",fbv.EDIT_SCRIPTS.concat("templates/bases.js")),"add-topic-to-base-button":new fbv.edit_button_handler("fb.bases.add_topic_to_base.init",fbv.EDIT_SCRIPTS.concat("templates/bases.js")),"page-title-edit-button":new fbv.edit_button_handler("fb.edit.init_edit_title_dialog"),"prop-add-form":new fbv.edit_button_handler("fb.edit.init_add_dialog"),"prop-edit-form":new fbv.edit_button_handler("fb.edit.init_edit_dialog")};fbv.edit_link_clickHandler=function(e){e.preventDefault();return fbv.on_click_add_edit(this)};fbv.article_edit_link_clickHandler=function(e){fb.Debug.group("fb.view.article_edit_link_clickHandler");e.preventDefault();var article_container=$(e.target).parents(".article-container:first");fb.Debug.assertEquals(article_container.length,1);var result=false;if(!article_container.attr("fb__wikipedia")){result=fbv.edit_link_clickHandler.apply(this,[e])}else{var html=fb.dialog.confirm_html("This descriptive summary comes from Wikipedia. ",("Would you like to replace it and write one specifically for Freebase?"),"Replace","Cancel");var d=fb.dialog.confirm(html,"div.article");$("button:first",d).click(function(e2){fb.dialog.hide({target:d});return fbv.edit_link_clickHandler.apply(e.target,[e])})}fb.Debug.groupEnd("fb.view.article_edit_link_clickHandler");return result};fbv.import_link_clickHandler=function(e){var user=fb.getUser();var url=$(e.target).attr("fb__href");if(user&&user.name){window.location.href=url;return false}e.preventDefault();fb.error.render_signin(function(){window.location.href=url});return false};fbv.detail_view_clickHandler=function(e){window.location.href=$(e.target).attr("fb__href");return false};fbv.on_click_add_edit=function(anchor){fb.Debug.group("fbv.on_click_add_edit");fb.Debug.time("fbv.on_click_add_edit");var t0=new Date().getTime(),ajax_request_time,js_time;fb.Debug.time("cleanup existing popups and indicators");if(!$(anchor).attr("fb__keep_popups")){fb.popup.popup_hide();fb.dialog.hide_all();fbv.on_edit_cancel()}$(document.body).addClass("editing");fbv.loading_show($($(anchor).attr("fb__editor_target")));
fb.Debug.timeEnd("cleanup existing popups and indicators");var ajax_options={url:$(anchor).attr("fb__href"),data:{ajax:true},cache:!DONT_CACHE_XHR};ajax_options.success=function(html){fb.Debug.time("on_click_add_edit.success");var classes=$(anchor).attr("class").split(/\s+/);var handler=null;$.each(classes,function(i,c){if(c in fbv.EDIT_BUTTON_HANDLERS){handler=fbv.EDIT_BUTTON_HANDLERS[c];return false}});if(!handler){throw new Error("no handler for classes on anchor ["+classes.join(", ")+"]")}fb.Debug.time("loading source js",handler.source_js);fb.Debug.log("loading source js ",handler.source_js," for ",handler.init_function_name);fb.with_source_js(handler.source_js,function(){fb.Debug.timeEnd("loading source js",handler.source_js);ajax_request_time=new Date().getTime();var overlay_options=handler.overlay_options;var init_function=eval(handler.init_function_name);fb.Debug.log("loading ",handler.init_function_name," from ",anchor);var overlay_anchor=$(anchor);var editor_target=($(anchor).is("[fb__editor_target]")?$($(anchor).attr("fb__editor_target")):null);var content_target=($(anchor).is("[fb__content_target]")?$($(anchor).attr("fb__content_target")):null);if(!overlay_options.inline){if(editor_target&&editor_target.length){overlay_anchor=editor_target}var overlay=fb.edit.edit_overlay(overlay_anchor,html,overlay_options.anchor_pos,overlay_options.overlay_pos,overlay_options.fudge);init_function(anchor,overlay)}else{var overlay=$(html);fb.Debug.log(overlay);fb.Debug.assert(overlay.is("div"));fb.Debug.assertEquals(overlay.length,1);var prev_contents=content_target.contents().remove();content_target.prepend(overlay);init_function(anchor,overlay,prev_contents)}fb.Debug.timeEnd("executing "+handler.init_function_name);js_time=new Date().getTime();setTimeout(function(){fb.logger.send({_e:handler.init_function_name,time_request:(ajax_request_time-t0)/1000,time_javascript:(js_time-ajax_request_time)/1000,page_tid:fb.transaction_id.ids[fb.transaction_id.ids.length-1],path:fb.u.parse(anchor.href).path})},1000);fb.Debug.timeEnd("on_click_add_edit.success")})};ajax_options.error=function(xml_http_response,text_status,error_thrown){fbv.on_edit_cancel();var handler=fb.error.ajax_errorHandler(function(){fbv.on_click_add_edit(anchor)});fb.Debug.log("ajax_options.error:",xml_http_response," status ",text_status," error_thrown ",error_thrown);handler(xml_http_response,text_status,error_thrown)};ajax_options.complete=function(xml_http_response,textStatus){fb.Debug.timeEnd("sending ajax request");fb.transaction_id.ajaxCompleteHandler(xml_http_response,textStatus);fbv.loading_hide()};fb.Debug.time("sending ajax request");$.ajax(ajax_options);fb.Debug.timeEnd("fbv.on_click_add_edit");fb.Debug.groupEnd("fbv.on_click_add_edit");return false};fb.view.edit_title_clickHandler=function(e){e.preventDefault();var type=($.inArray("/freebase/query",TOPIC.type)!=-1?"saved view":($.inArray("/type/type",TOPIC.type)!=-1?"type":"topic"));fb.popup.popup_hide();fb.dialog.confirm_dialog({msg1:fb.sprintf("Are you sure you want to rename this %s?",type),msg2:(type=="saved view"?null:("This will affect how it is displayed in all of Freebase and apps that use the API.")),ok_text:"rename",cancel_text:"cancel",success:function(e2){fb.dialog.hide(e2);fbv.on_click_add_edit(e.target);return false}});return false};fb.view.toggler_more_clickHandler=function(e){$("#"+$(this).attr("fb__hidden_id")).show();$("#"+$(this).attr("fb__display_id")).hide();return false};fb.view.init_userinfo_tooltip=function(context){fb.Debug.group("fb.view.init_userinfo_tooltip");context=context||$(document.body);function hover_in(){fb.Debug.group("fb.view.init_userinfo_tooltip.hover_in");var $anchor=$(this);var $tooltip=$(".tooltip",$anchor);var anchor_pos="NW";var tooltip_pos="SW";if($tooltip.attr("fb__tt_direction")=="right"){var anchor_pos="NE";var tooltip_pos="SE"}fb.popup.position($anchor,$tooltip,anchor_pos,tooltip_pos);$tooltip.fadeIn();fb.Debug.groupEnd("fb.view.init_userinfo_tooltip.hover_in")
}function hover_out(){fb.Debug.group("fb.view.init_userinfo_tooltip.hover_out");var $anchor=$(this);var $tooltip=$(".tooltip",$anchor);$tooltip.stop(true,true);$tooltip.hide();fb.Debug.groupEnd("fb.view.init_userinfo_tooltip.hover_out")}$(".vcard:has(> .tooltip)",context).hover(hover_in,hover_out);fb.Debug.groupEnd("fb.view.init_userinfo_tooltip")};fbv.show_message=function(element,description,title,type){var message=fbv.get_message(element,true);if(type){$(message).attr("class",fb.sprintf("popup-body fb-message-body fb-message-body-%s",type))}var message_title=$(".fb-message-title",message);if(type){$(message_title).attr("class",fb.sprintf("fb-message-title fb-message-title-%s",type))}message_title.empty();if(title!=null){message_title.append(title)}var message_description=$(".fb-message-description",message);if(type){$(message_description).attr("class",fb.sprintf("fb-message-description fb-message-description-%s",type))}message_description.empty();if(description!=null){message_description.append(description)}var message_caret=$(".fb-message-carat",message);if(type){$(message_caret).attr("class",fb.sprintf("fb-message-carat fb-message-carat-%s",type))}$(message).show();fb.popup.position($(element),$(message),"NW","SW",{top:-5});$(message).show();return message};fbv.get_message=function(element,create_if_none_exists){fb.Debug.group("fb.view.get_message");var message=$.data($(element)[0],"fb.message");if(!message&&create_if_none_exists){message=document.createElement("div");document.body.appendChild(message);$(message).addClass("popup-body fb-message-body");$(message).attr("style","display:none");$(message).append('<div class="fb-message-icon"/><a class="fb-message-close" href="#">x</a><div class="fb-message-title"/><div class="fb-message-description"/><div class="fb-message-carat"/>');$(".fb-message-close",message).click(function(e){fbv.hide_message(element);e.preventDefault();return false});$.data($(element)[0],"fb.message",message)}fb.Debug.groupEnd("fb.view.get_message");return message};fbv.hide_message=function(element){var message=fbv.get_message(element);if(message){$(message).hide()}$.removeData($(element)[0],"fb.message")};fbv.hide_messages=function(form){$(".invalid-input",form).each(function(){fbv.hide_message(this)});fbv.hide_message(form)};fbv.loading_show=function(anchor,timeout){fb.Debug.group("fb.view.loading_show");if(timeout==undefined){timeout=1500}window.clearTimeout(fbv.loading_show._timer);fbv.loading_show._timer=window.setTimeout(fbv.loading_show._delay,timeout);fb.Debug.groupEnd("fb.view.loading_show")};fbv.loading_show._timer=null;fbv.loading_show._delay=function(){fb.Debug.group("fb.view.loading_show._delay");$.blockUI({message:"<div id='fbv-loading'/>",fadeOut:20,css:{border:"none",width:"76px","background-color":"transparent",cursor:"wait"}});fb.Debug.groupEnd("fb.view.loading_show._delay")};fbv.loading_hide=function(){fb.Debug.group("fb.view.loading_hide");window.clearTimeout(fbv.loading_show._timer);var loader=$("#fbv-loading");if(loader.length){if(!loader.parent().is(".blockMsg")){loader.remove()}else{$.unblockUI({onUnblock:function(){fb.Debug.group("fb.view.loading_show.delay.onUnblock");$(document.body).css("cursor","default");$("#fbv-loading").remove();fb.Debug.groupEnd("fb.view.loading_show.delay.onUnblock")}})}}fb.Debug.groupEnd("fb.view.loading_hide")};fbv.on_edit_cancel=function(e){fb.Debug.group("fbv.on_edit_cancel",e);fb.Debug.time("fbv.on_edit_cancel");if(e&&e.target){var form=$(e.target);form=form.is("form")?form:form.parents("form:first");fbv.hide_messages();fb.dialog.hide(e)}$(document.body).removeClass("editing");fb.Debug.timeEnd("fbv.on_edit_cancel");fb.Debug.groupEnd("fbv.on_edit_cancel",e);return false};fbv.save_progress=function(save,progress){var saveprogress=$(save).prev(".save-progress").empty();if(progress){var msg=fb.sprintf('<div class="save-progress-%s">&nbsp;</div>',progress);saveprogress.append(msg)}};fbv.mark_begin_clickHandler=function(e){fb.Debug.group("fb.view.mark_begin_clickHandler");
fb.popup.popup_hide();var anchor=this;var submit_options={beforeSubmit:function(data,jqform,options){this._form=jqform;fbv.save_progress($("button:first[type=submit]",jqform),"saving");return true},success:function(html){fb.Debug.group("fb.view.mark_begin_clickHandler.success");fb.dialog.hide({target:this._form});fbv.on_edit_cancel();if($(anchor).is(".delete-type, .delete-property, .delete-saved-view")){html=fb.buffer_ajax_html_response(html).css("min-width","30em");fb.dialog.show_with_block_ui(html)}else{$("#topic-flags").html(html);var $target=$($(anchor).attr("fb__editor_target"));var flag=$target.attr("id");var text={mark_as_may_offend:"This topic has been flagged as possibly offensive.",mark_for_delete:"This topic has been flagged for deletion.",mark_for_merge:"This topic has been flagged for merge.",mark_for_split:"This topic has been suggested to be split into multiple topics."}[flag];$target.html(text)}fb.Debug.groupEnd("fb.view.mark_begin_clickHandler.success")},complete:function(xml_http_response,textStatus){fb.Debug.group("fb.view.mark_begin_clickHandler.complete");fb.transaction_id.ajaxCompleteHandler(xml_http_response,textStatus);fbv.save_progress($("button:first[type=submit]",this.form),null);fb.Debug.groupEnd("fb.view.mark_begin_clickHandler.complete")},error:fb.error.default_error_handler};if(e.data&&e.data.ajax_options){$.extend(submit_options,e.data.ajax_options)}fb.Debug.groupEnd("fb.view.mark_begin_clickHandler");return fbv.mark_begin_confirm($(anchor).attr("fb__href"),submit_options,anchor)};fbv.mark_begin_confirm=function(url,submit_options,flag,popup_options){fb.Debug.group("fb.view.mark_begin_confirm");var anchor=$($(flag).attr("fb__editor_target"));var confirm_options={url:url,error:fb.error.ajax_errorHandler(function(){fbv.mark_begin_confirm(url,submit_options,flag)}),complete:function(xml_http_response,textStatus){fbv.loading_hide();fb.transaction_id.ajaxCompleteHandler(xml_http_response,textStatus)},success:function(confirm_html){fb.Debug.group("fb.view.mark_begin_confirm.success");fbv.loading_hide();if($(flag).parent().is("#mark_for_merge")){fb.with_source_js(fbv.EDIT_SCRIPTS,function(){var overlay=fb.edit.edit_overlay(anchor,confirm_html);var form=fb.edit.init_add_dialog(flag,overlay,submit_options);var _ajax_options=fb.edit.get_default_ajaxForm_submit_options(form);submit_options.beforeSubmit=_ajax_options.beforeSubmit;$(form).ajaxForm(submit_options)})}else{var d=fb.dialog.confirm(confirm_html,anchor);$("form",d).ajaxForm(submit_options)}fb.Debug.groupEnd("fb.view.mark_begin_confirm.success")}};fbv.loading_show(anchor);$.ajax(confirm_options);fb.Debug.groupEnd("fb.view.mark_begin_confirm");return false};fbv.check_weblinks_split_view=function(do_navigation){if(window.parent==window.self){return }var weblink_frame_element=$("#weblink_frame",window.parent.document.body);if(do_navigation){if(weblink_frame_element.attr("fb_last_name")){var found=false;$("#weblink-list a.weblink-uri").each(function(){if($(this).attr("innerHTML")==weblink_frame_element.attr("fb_last_name")){$("#location-box",top.footer_frame.document.body).attr("value",$(this).attr("href"));top.document.title="Split View: "+document.title+" -- "+$(this).attr("innerHTML");found=true;top.weblink_frame.location.href=$(this).attr("href")}});if(!found){top.document.title="Split View: "+document.title}}else{if(fb.arg("weblink_name")){weblink_frame_element.attr("fb_last_name",fb.arg("weblink_name"));top.document.title="Split View: "+document.title+" -- "+fb.arg("weblink_name")}}}$("#weblink-list a.weblink-splitview").click(function(e){$(this).attr("href",$(this).attr("fb_weblink_uri"));$(this).attr("target","weblink_frame");weblink_frame_element.attr("fb_last_name",$(this).attr("fb_description"));$("#location-box",top.footer_frame.document.body).attr("value",$(this).attr("href"));top.document.title="Split View: "+document.title+" -- "+$(this).attr("fb_description");return true})}})(jQuery,window.freebase);(function(C,A){var B=A.domain_chooser={};
B.init=function(D){A.Debug.assertEquals(D.length,1);C("#create_new_domain",D).click(function(E){B.toggle_pane(D);return false});C("#select_existing_domain",D).click(function(E){B.toggle_pane(D);return false});return D};B.is_valid=function(G){var D=C(":input:enabled",G);if(D.length==0){return false}for(var E=0;E<D.length;E++){var F=C.trim(C(D[E]).val());if(F.length==0){return false}}return true};B.display_pane=function(E){var D=C(E).siblings();C(E).show();C(":input",E).attr("disabled",false);D.each(function(){C(this).hide();C(":input",this).attr("disabled",true)});domain_chooser.trigger("change",[E])};B.toggle_pane=function(F){var D=C("> :visible",F);var E=C("> :hidden",F);E.each(function(){C(this).show();C(":input",this).attr("disabled",false)});D.each(function(){C(this).hide();C(":input",this).attr("disabled",true)});F.trigger("change",[D])};B.select_domain=function(F,E){var D=C("#selected_domain > select[name=domain_id]",F);A.Debug.assertEquals(D.length,1);if(C(A.sprintf("option[value=%s]",E),D).length==0){return false}D.val(E);C("#select_existing_domain",F).trigger("click");return true}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.view=A.type.view||{};A.type.view.summary={ID:"summary"};A.type.view.summary.filtertypeinstances={};A.type.view.summary.init=function(){A.Debug.group("fb.type.view.summary.init");A.Debug.time("fb.type.view.summary.init");A.bind_alternate_stylesheet(1280);B(window).unbind("resize.fb_summary").unbind("switch_stylesheet").bind("switch_stylesheet",A.type.view.summary.update_item_height).bind("resize.fb_summary",A.type.view.summary.update_item_height);A.type.view.summary.update_item_height();A.Debug.timeEnd("fb.type.view.summary.init");A.Debug.groupEnd("fb.type.view.summary.init")};A.type.view.summary.add_filter_params_to_data=function(C){A.Debug.group("summary.add_filter_params_to_data");A.Debug.groupEnd("summary.add_filter_params_to_data");return true};A.type.view.summary.get_data_ids=function(D){A.Debug.group("get_data_ids");A.Debug.time("get_data_ids");var C=B("> .filter-result",D||B("#filter-results"));C=C.map(function(){return B(this).attr("fb__id")});A.Debug.timeEnd("get_data_ids");A.Debug.groupEnd("get_data_ids");return B.makeArray(C)};A.type.view.summary.filtertypeinstances.successHandler=function(D){A.Debug.group("summary.filtertypeinstances.successHandler");A.Debug.time("summary.filtertypeinstances.successHandler");var C=B("#filter-results",D);var E=B("> #filter-results",A.type.FILTER_RESULTS_CONTAINER);B("> .filter-result",E).remove();E.prepend(B("> .filter-result",C));A.type.view.summary.update_item_height();A.Debug.timeEnd("summary.filtertypeinstances.successHandler");A.Debug.groupEnd("summary.filtertypeinstances.successHandler")};A.type.view.summary.filtertypeinstances.completeHandler=function(C){A.Debug.group("summary.filtertypeinstances.completeHandler");A.Debug.time("summary.filtertypeinstances.completeHandler");A.Debug.timeEnd("summary.filtertypeinstances.completeHandler");A.Debug.groupEnd("summary.filtertypeinstances.completeHandler")};A.type.view.summary.more_clickHandler=function(H){A.Debug.group("summary.more_clickHandler");H.preventDefault();var E=B(B(H.target).is("a")?H.target:B(H.target).parents("a:first"));A.Debug.assert(E.is("a.prop-more"),E);var D={data_id:E.parents(".filter-result:first").attr("fb__id")};var G=E.parents(".galleryview-result-prop-list:last");var I=A.type.view.summary.get_prop_path_id_for_anchor(E);var F=B("> :hidden[name^=show][fb__prop_path_id^="+I+"]",A.type.FILTER_FORM);A.Debug.assertNotEquals(F.length,0,"unable to find show input for ",I);B(F).add(A.type.get_form_inputs("filter")).each(function(){D[B(this).attr("name")]=B(this).val()});E.addClass("loading");var C={cache:!DONT_CACHE_XHR,type:"GET",url:H.target.href,data:D};C.success=function(J){A.Debug.group("summary.more_clickHandler.success");J=A.buffer_ajax_html_response(J);G.replaceWith(J.contents());A.type.view.summary.update_item_height();E.removeClass("loading");J.remove();A.Debug.groupEnd("summary.more_clickHandler.success")
};B.ajax(C);A.Debug.groupEnd("summary.more_clickHandler");return false};A.type.view.summary.update_item_height=function(){A.Debug.group("fb.type.view.summary.update_item_height");B("#filter-results > .filter-result > .summary-box-content").equalizeCols();A.Debug.groupEnd("fb.type.view.summary.update_item_height")};A.type.view.summary.get_prop_path_id_for_anchor=function(C){var D=B(C).parents(".galleryview-result-prop-list");A.Debug.assertNotEquals(D.length,0);return B.map(B.makeArray(D).reverse(),function(E){return B(E).attr("fb__prop_path_id")}).join("-")}})(jQuery,window.freebase);(function($,fb){fb.type=fb.type||{};fb.type.view=fb.type.view||{};fb.type.view.table={ID:"table"};fb.type.view.table.filtertypeinstances={};fb.type.view.table.HEADER_ROW_INDEX={FILTER:0,TITLE:1};fb.type.view.table.init=function(){fb.Debug.group("fb.type.view.table.init");fb.Debug.time("fb.type.view.table.init");fb.type.view.table.TABLE=$("#filter-results");fb.Debug.assertNotNull(fb.type.view.table.TABLE);fb.type.TYPE_FILTER_VIEW.bind("change.fb",fb.type.view.table.type_filter_view_changeHandler);fb.type.view.table.init_filter_inputs($("> thead .fb-filter-input",fb.type.view.table.TABLE));fb.type.init_inline_add_data();$("> tbody > tr > th > .filter-results-btn-remove > a",fb.type.view.table.TABLE).click(fb.type.remove_data_clickHandler);fb.Debug.timeEnd("fb.type.view.table.init");fb.Debug.groupEnd("fb.type.view.table.init")};fb.type.view.table.type_filter_view_changeHandler=function(e){var filter_input_row=$(fb.sprintf("> thead > tr:eq(%s)",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);filter_input_row.toggle($("#add-filter-trigger").is(":visible"))};fb.type.view.table.get_data_ids=function(rows){fb.Debug.group("get_data_ids");fb.Debug.time("get_data_ids");if(!rows){rows=$("> tbody > tr",fb.type.view.table.TABLE)}else{fb.Debug.assert(rows.parent().is("tbody"))}var r=rows.map(function(){return $(this).attr("fb__id")});r=$.map(r,function(v,i){if(i==0||r[i-1]!=v){return v}});fb.Debug.timeEnd("get_data_ids");fb.Debug.groupEnd("get_data_ids");return r};fb.type.view.table.addfiltercolumn_successHandler=function(html_response,text_status){fb.Debug.group("table.addfiltercolumn_successHandler");fb.Debug.time("table.addfiltercolumn_successHandler");var new_table=$("#filtered-results > table",html_response);var results_thead=$("> thead",fb.type.view.table.TABLE);var results_tbody=$("> tbody",fb.type.view.table.TABLE);var new_thead=$("> thead",new_table);var new_tbody=$("> tbody",new_table);var show_inputs=fb.type.get_form_inputs("show");$("> tr:eq("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") > th",results_thead).each(function(){var prop_path_id=$(this).attr("fb__prop_path_id");if(!show_inputs.filter(fb.sprintf("[fb__prop_path_id=%s]",prop_path_id)).length){fb.type.view.table.remove_filter_column(prop_path_id)}});var prop_path_ids=$("> tr:eq("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") > th",new_thead).map(function(){return $(this).attr("fb__prop_path_id")});$.each(prop_path_ids,function(i,prop_path_id){fb.type.view.table.remove_filter_column(prop_path_id)});var insertion_index=show_inputs.index(show_inputs.filter(fb.sprintf("[fb__prop_path_id=%s]",prop_path_ids[0])));var new_row_span=$(fb.sprintf("> tr:gt(%s)",fb.type.view.table.HEADER_ROW_INDEX.FILTER),new_thead).length;var old_row_span=$(fb.sprintf("> tr:gt(%s)",fb.type.view.table.HEADER_ROW_INDEX.FILTER),results_thead).length;$("th.tableview-th-active",(old_row_span<new_row_span?results_thead:new_thead)).each(function(){this.rowSpan=this.rowSpan+Math.abs(new_row_span-old_row_span)});var filter_input_cells=new_thead[0].rows[fb.type.view.table.HEADER_ROW_INDEX.FILTER].cells;fb.type.view.table.init_filter_inputs($(".fb-filter-input",filter_input_cells));var to_filter_row=results_thead[0].rows[fb.type.view.table.HEADER_ROW_INDEX.FILTER];if(insertion_index==-1||insertion_index==to_filter_row.cells.length){$(to_filter_row).append(filter_input_cells)}else{var prev_cell=$(to_filter_row.cells[insertion_index]);
fb.Debug.assertEquals(prev_cell.length,1);prev_cell.before(filter_input_cells)}for(var row_index=fb.type.view.table.HEADER_ROW_INDEX.TITLE;row_index<new_thead[0].rows.length;row_index++){var from_cells=new_thead[0].rows[row_index].cells;if(results_thead[0].rows.length<=row_index){var to_row=$("<tr/>");results_thead.append(to_row);to_row.append(from_cells);continue}var to_row=results_thead[0].rows[row_index];fb.Debug.assertNotNull(to_row);if(insertion_index==-1||to_row.cells.length==0||(insertion_index>=to_row.cells.length&&insertion_index>fb.type.view.table.get_column_index(to_row.cells[to_row.cells.length-1]))){$(to_row).append(from_cells);continue}var prev_col_index=null;for(var cell_index=0;cell_index<to_row.cells.length;cell_index++){var col_index=fb.type.view.table.get_column_index(to_row.cells[cell_index]);if(col_index>=insertion_index&&(prev_col_index==null||insertion_index>prev_col_index)){$(to_row.cells[cell_index]).before(from_cells);break}prev_col_index=col_index}}fb.type.view.table.merge_table_bodys(new_tbody,results_tbody);var num_columns=$("> thead > tr:eq("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") > th",fb.type.view.table.TABLE).length;$("> tfoot > tr > *",fb.type.view.table.TABLE).each(function(){this.colSpan=num_columns});fb.Debug.timeEnd("table.addfiltercolumn_successHandler");fb.Debug.groupEnd("table.addfiltercolumn_successHandler")};fb.type.view.table.remove_filter_column=function(prop_path_id){fb.Debug.group("table.remove_filter_column",prop_path_id);fb.Debug.time("table.remove_filter_column");fb.Debug.assertNotNull(prop_path_id);var filter_input_th=fb.type.view.table.get_header_filter_cell(prop_path_id);fb.Debug.assertNotNull(filter_input_th);if(!filter_input_th.length){fb.Debug.timeEnd("table.remove_filter_column");fb.Debug.groupEnd("table.remove_filter_column",prop_path_id);return -1}var col_index=filter_input_th[0].cellIndex;$(fb.sprintf("> tbody > tr > *[fb__prop_path_id=%s]",prop_path_id),fb.type.view.table.TABLE).remove();var active_th=fb.type.view.table.get_header_cell(prop_path_id);fb.Debug.assertNotNull(active_th);fb.Debug.assertEquals(active_th.length,1);fb.Debug.assertEquals(active_th[0].colSpan,1);var parent_th=fb.type.view.table.get_parent_header_cell(active_th);while(parent_th){var grand_parent_th=fb.type.view.table.get_parent_header_cell(parent_th);if(parent_th.colSpan>1){--parent_th.colSpan}else{fb.Debug.assertNotEquals(parent_th.parentNode.rowIndex,fb.type.view.table.HEADER_ROW_INDEX.FILTER);$(parent_th).remove()}parent_th=grand_parent_th}active_th.add(filter_input_th).remove();var num_columns=$(fb.sprintf("> thead > tr:eq(%s) > th",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).length;$("> tfoot > tr > *",fb.type.view.table.TABLE).each(function(){this.colSpan=num_columns});$(fb.sprintf("> thead > tr:gt(%s) > th.tableview-th-name",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).each(function(){var parent_th=fb.type.view.table.get_parent_header_cell(this);if(!parent_th){return true}var sibling_ths=fb.type.view.table.get_child_header_cells(parent_th);fb.Debug.assertNotEquals(sibling_ths.length,0);if(sibling_ths.length>1){fb.Debug.assertNotEquals($.inArray(this,sibling_ths)!=-1);return true}var row=this.parentNode;if(row.cells.length==1){$(row).remove();$(fb.sprintf("> thead > tr:gt(%s) > th.tableview-th-active",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).each(function(){--this.rowSpan})}else{fb.Debug.log("removing ",this," and incrementing rowspan of parent ",parent_th);$(this).remove();++parent_th.rowSpan;$(parent_th).removeClass("tableview-th-inactive").addClass("tableview-th-active");fb.disable($("> .tableview-th-title-label",parent_th),false)}$(fb.sprintf("> tbody > tr > th[fb__prop_path_id=%s]",$(this).attr("fb__prop_path_id")),fb.type.view.table.TABLE).each(function(){$(this).replaceWith($("<td/>").attr("rowspan",$(this).attr("rowspan")).attr("class",$(this).attr("class")).attr("fb__prop_path_id",$(parent_th).attr("fb__prop_path_id")).html($(this).contents()))
});var filter_th=$(fb.sprintf("> thead > tr:eq(%s) > th[fb__prop_path_id=%s]",fb.type.view.table.HEADER_ROW_INDEX.FILTER,$(this).attr("fb__prop_path_id")),fb.type.view.table.TABLE);fb.Debug.assertEquals(filter_th.length,1);filter_th.attr("fb__prop_path_id",$(parent_th).attr("fb__prop_path_id"));$("> :text",filter_th).attr("name",$(parent_th).attr("fb__filter_input_name"));var show_input=fb.type.get_form_inputs("show").filter(fb.sprintf("[fb__prop_path_id=%s]",$(this).attr("fb__prop_path_id")));fb.Debug.assertEquals(show_input.length,1);show_input.attr({fb__prop_path_id:$(parent_th).attr("fb__prop_path_id"),name:$(parent_th).attr("fb__show_input_name")})});fb.Debug.timeEnd("table.remove_filter_column");fb.Debug.groupEnd("table.remove_filter_column",prop_path_id);return col_index};fb.type.view.table.filtertypeinstances.successHandler=function(html_response){fb.Debug.group("table.filtertypeinstances.successHandler");fb.Debug.time("table.filtertypeinstances.successHandler");var filtered_results=$("#filtered-results",html_response);$("> tbody",fb.type.view.table.TABLE).replaceWith($("> table > tbody",filtered_results));$("> tfoot > .filter-results-pager",fb.type.view.table.TABLE).replaceWith($("> table > tfoot > .filter-results-pager",filtered_results));if($("> table > thead",filtered_results).is(":not(:visible)")){$("> thead",fb.type.view.table.TABLE).hide()}else{$("> thead",fb.type.view.table.TABLE).show()}var new_sort=fb.type.get_form_inputs("sort");var active_sorts=$("> thead > tr:gt("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") > th.tableview-th-active > :hidden.filter-sort-input",fb.type.view.table.TABLE);var active_sort=active_sorts.filter("[name="+new_sort.attr("name")+"]");active_sort.parents("th").addClass("tableview-th-sorted");active_sorts.end();var active_sort=active_sorts.filter("[name!="+new_sort.attr("name")+"]");active_sort.parent("th").removeClass("tableview-th-sorted");active_sorts.end();$("#link-sort-by").text(new_sort.attr("fb__label"));$("> tbody > tr > th > .filter-results-btn-remove > a",fb.type.view.table.TABLE).click(fb.type.remove_data_clickHandler);fb.Debug.timeEnd("table.filtertypeinstances.successHandler");fb.Debug.groupEnd("table.filtertypeinstances.successHandler")};fb.type.view.table.filtertypeinstances.completeHandler=function(html_response){fb.Debug.group("table.filtertypeinstances.completeHandler");fb.Debug.time("table.filtertypeinstances.completeHandler");var filter_inputs=$(fb.sprintf("> thead > tr:eq(%s) .fb-filter-input",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);filter_inputs.each(function(){fb.type.view.table.filtering.reset_input($(this))});fb.disable(filter_inputs,false);$(fb.sprintf("> thead > tr:eq(%s) .medium-progress",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).remove();$(fb.sprintf("> thead > tr:gt(%s) > th > .tableview-th-btn-close",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).removeClass("sort-th-loading");$(fb.sprintf("> thead > tr:gt(%s) > th > .unit",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE).removeClass("loading");fb.Debug.timeEnd("table.filtertypeinstances.completeHandler");fb.Debug.groupEnd("table.filtertypeinstances.completeHandler")};fb.type.view.table.unit_clickHandler=function(e){fb.Debug.group("table.unit_clickHandler");$(e.target).addClass("loading");$.get($(e.target).attr("fb__href"),function(html_response){fb.Debug.group("table.unit_clickHandler.success");$(e.target).removeClass("loading");var d=fb.buffer_ajax_html_response(html_response);$(document.body).append(d);fb.popup.bind($(e.target),d);$("li > a").click(function(e2){fb.Debug.group("table.unit_clickHandler.select");var a=$(e2.target).is("a")?$(e2.target):$(e2.target).parents("a:first");fb.Debug.assert(a.is("a"));fb.Debug.assert(a.parent().is("li"));if(a.parent().is("li:not(.active)")){$(e.target).attr("fb__href",a.attr("fb__href"));var input_name=$(e.target).attr("fb__input_name");var input=$(fb.sprintf(":hidden[name=%s]",input_name),fb.type.FILTER_FORM);
if(!input.length){input=$("<input type='hidden'/>").attr("name",input_name);fb.type.FILTER_FORM.append(input)}input.val(a.attr("fb__id"));$(e.target).addClass("loading");fb.type.filtertypeinstances.run({reset_page:true})}d.fadeOut("slow",function(){d.remove()});fb.Debug.groupEnd("table.unit_clickHandler.select");return false});fb.popup.position($(e.target),d,"N","S",{top:-10});d.fadeIn();fb.Debug.groupEnd("table.unit_clickHandler.success")});fb.Debug.groupEnd("table.unit_clickHandler");return false};fb.type.view.table.header_sort_link_clickHandler=function(e){if($(e.target).is(".disabled")||$(e.target).parents("th.tableview-th-title").is(".tableview-th-inactive")){return }fb.Debug.group("table.header_sort_link_clickHandler");$("> .tableview-th-btn-close",$(e.target).parents("th:first")).addClass("sort-th-loading");var sort_input_template=$(e.target).next("input.filter-sort-input");var sort_input=$(":hidden.filter-sort-input[name="+sort_input_template.attr("name")+"]",fb.type.FILTER_FORM);if(sort_input.length!=0){sort_input.val(!eval(sort_input.val()))}else{$(":hidden.filter-sort-input",fb.type.FILTER_FORM).replaceWith(sort_input_template.clone())}fb.type.filtertypeinstances.run({reset_page:true});fb.Debug.groupEnd("table.header_sort_link_clickHandler");return false};fb.type.view.table.more_clickHandler=function(e){fb.Debug.group("table.more_clickHandler");e.preventDefault();var anchor=$($(e.target).is("a")?e.target:$(e.target).parents("a:first"));fb.Debug.assert(anchor.is("a.prop-more"));var parent_td=anchor.parent("td");fb.Debug.assert(parent_td.is("td.tableview-cell-last-more"));var data_id=parent_td.parent("tr").attr("fb__id");var url_params={data_id:data_id};var prop_path_id=parent_td.attr("fb__prop_path_id");var header_cell=fb.type.view.table.get_header_cell(prop_path_id);var parent_header_cell=fb.type.view.table.get_parent_header_cell(header_cell);if(parent_header_cell){prop_path_id=$(parent_header_cell).attr("fb__prop_path_id")}var show_inputs=fb.type.view.table.get_related_show_inputs(prop_path_id);$(show_inputs).add(fb.type.get_form_inputs("filter")).each(function(){url_params[$(this).attr("name")]=$(this).val()});anchor.addClass("loading");$.ajax({cache:!DONT_CACHE_XHR,type:"GET",url:$(anchor).attr("fb__href"),data:url_params,success:function(html_response){fb.Debug.group("table.more_clickHandler.success");$(show_inputs).each(function(){$(fb.sprintf("> tbody > tr[fb__id=%s] > *[fb__prop_path_id=%s]",data_id,$(this).attr("fb__prop_path_id")),fb.type.view.table.TABLE).remove()});html_response=fb.buffer_ajax_html_response(html_response);fb.type.view.table.merge_table_bodys($("tbody",html_response),$("> tbody",fb.type.view.table.TABLE));anchor.removeClass("loading");html_response.remove();fb.Debug.groupEnd("table.more_clickHandler.success")}});fb.Debug.groupEnd("table.more_clickHandler");return false};fb.type.view.table.remove_prop_clickHandler=function(e){e.preventDefault();fb.Debug.assert($(e.target).parent().is(".tableview-th-btn-close"));if($(e.target).hasClass("disabled")||$(e.target).parent(".sort-th-loading").length){return false}var th=$(this).parents("th.tableview-th-active")[0];var prop_path_id=$(th).attr("fb__prop_path_id");fb.type.remove_filter_column(prop_path_id);return false};fb.type.view.table.get_related_show_inputs=function(prop_path_id){fb.Debug.group("fb.type.view.table.get_related_show_inputs");var show_inputs=fb.type.get_form_inputs("show");show_inputs=show_inputs.filter("[fb__prop_path_id^="+prop_path_id+"]");fb.Debug.assertNotEquals(show_inputs.length,0);fb.Debug.groupEnd("fb.type.view.table.get_related_show_inputs");return show_inputs};fb.type.view.table.get_header_filter_cell=function(prop_path_id){return $(fb.sprintf("> thead > tr:eq(%s) > th[fb__prop_path_id=%s]",fb.type.view.table.HEADER_ROW_INDEX.FILTER,prop_path_id),fb.type.view.table.TABLE)};fb.type.view.table.get_header_cell=function(prop_path_id){return $(fb.sprintf("> thead > tr:gt(%s) > th[fb__prop_path_id=%s]",fb.type.view.table.HEADER_ROW_INDEX.FILTER,prop_path_id),fb.type.view.table.TABLE)
};fb.type.view.table.get_parent_header_cell=function(cell){fb.Debug.assertNotNull(cell);cell=$(cell);fb.Debug.assertEquals(cell.length,1);var row=cell[0].parentNode;fb.Debug.assertNotEquals(row.rowIndex,fb.type.view.table.HEADER_ROW_INDEX.FILTER);if(row.rowIndex==fb.type.view.table.HEADER_ROW_INDEX.TITLE){return null}var prop_path_id=$(cell).attr("fb__prop_path_id");var parent_row=row.parentNode.rows[row.rowIndex-1];for(var cell_index=0;cell_index<parent_row.cells.length;cell_index++){var parent_cell=$(parent_row.cells[cell_index]);if(prop_path_id.indexOf(parent_cell.attr("fb__prop_path_id"))==0){return parent_cell[0]}}throw Error("unable to find parent for header cell "+prop_path_id)};fb.type.view.table.get_child_header_cells=function(cell){fb.Debug.assertNotNull(cell);cell=$(cell);fb.Debug.assertEquals(cell.length,1);fb.Debug.group("table.get_child_header_cells",cell.attr("fb__prop_path_id"));var row=cell[0].parentNode;fb.Debug.assertNotEquals(row.rowIndex,fb.type.view.table.HEADER_ROW_INDEX.FILTER);var result=[];if(row.parentNode.rows.length!=row.rowIndex+1){result=$.makeArray($(fb.sprintf("> th[fb__prop_path_id^=%s]",cell.attr("fb__prop_path_id")),row.parentNode.rows[row.rowIndex+1]))}fb.Debug.groupEnd("table.get_child_header_cells",cell.attr("fb__prop_path_id"));return result};fb.type.view.table.get_column_index=function(header_cell){header_cell=$(header_cell);while(header_cell[0].parentNode.rowIndex!=fb.type.view.table.HEADER_ROW_INDEX.TITLE){header_cell=$(fb.type.view.table.get_parent_header_cell(header_cell))}var result=0;header_cell.prevAll().each(function(){result+=this.colSpan});return result};fb.type.view.table.merge_table_bodys=function(from_tbody,to_tbody){fb.Debug.group("merge_table_bodys");fb.Debug.time("merge_table_bodys");fb.Debug.assert(from_tbody.is("tbody"));fb.Debug.assert(to_tbody.is("tbody"));var prop_path_ids=fb.type.get_form_inputs("show").map(function(){return $(this).attr("fb__prop_path_id")});var all_from_body_rows=$("> tr",from_tbody);var all_to_body_rows=$("> tr",to_tbody);if(all_to_body_rows.length==0){fb.Debug.assertEquals(all_to_body_rows.length,0,all_to_body_rows.length)}else{var all_rows_ids=fb.type.view.table.get_data_ids(all_from_body_rows);var new_cells=[];for(var row_id_index=0;row_id_index<all_rows_ids.length;row_id_index++){var row_id=all_rows_ids[row_id_index];var to_rows=all_to_body_rows.filter("tr[fb__id="+row_id+"]");var from_rows=all_from_body_rows.filter("tr[fb__id="+row_id+"]");if(to_rows.length!=from_rows.length){var last_cells=$("> th.tableview-cell-last, > td.tableview-cell-last,> th.tableview-cell-last-more, > td.tableview-cell-last-more",to_rows.length<from_rows.length?to_rows:from_rows);last_cells.each(function(){var last_row_index=Number($(this.parentNode).attr("fb__row_index"));this.rowSpan=(Math.max(from_rows.length,to_rows.length)-last_row_index)})}var is_even=$(to_rows[0]).is(".even");from_rows.each(function(row_index){fb.Debug.assertNotEquals(this.cells.length,0);$(this.cells).each(function(){new_cells.push(this)});if(is_even&&$(this).is(".odd")){$(this).removeClass("odd").addClass("even")}else{if(!is_even&&$(this).is(".even")){$(this).removeClass("even").addClass("odd")}}if(row_index>=to_rows.length){$(to_rows[to_rows.length-1]).addClass("squat").after(this);to_rows=to_rows.add(this);return }var to_row=to_rows[row_index];if(to_row.cells.length==0){$(to_row).append(this.cells);return }var prop_path_id=$(this.cells[0]).attr("fb__prop_path_id");var prop_path_id_index=$.inArray(prop_path_id,prop_path_ids);fb.Debug.assertNotEquals(prop_path_id_index,-1);var inserted=false;for(var cell_index=to_row.cells.length-1;cell_index>=0;cell_index--){var next_index=$(to_row.cells[cell_index]).attr("fb__prop_path_id");next_index=$.inArray(next_index,prop_path_ids);fb.Debug.assertNotEquals(next_index,-1);if(prop_path_id_index>next_index){$(to_row.cells[cell_index]).after(this.cells);inserted=true;break}var prev_index=-1;if(cell_index>0){prev_index=$(to_row.cells[cell_index-1]).attr("fb__prop_path_id");
prev_index=$.inArray(prev_index,prop_path_ids)}else{fb.Debug.assert(prop_path_id_index<next_index)}if(prop_path_id_index<next_index&&prop_path_id_index>prev_index){$(to_row.cells[cell_index]).before(this.cells);inserted=true;break}}fb.Debug.assert(inserted,"unable to insert ",prop_path_id," into ",to_row.cells)})}}fb.Debug.timeEnd("merge_table_bodys");fb.Debug.groupEnd("merge_table_bodys")};fb.type.view.table.move_column=function(column,after_column){fb.Debug.group("table.move_column");fb.Debug.assert($(column).is("th"));fb.Debug.assert($(after_column).is("th"));var show_inputs=fb.type.get_form_inputs("show");var column_show_inputs=fb.type.view.table.get_related_show_inputs($(column).attr("fb__prop_path_id"));fb.Debug.assertNotEquals(column_show_inputs.length,0);var after_column_show_inputs=fb.type.view.table.get_related_show_inputs($(after_column).attr("fb__prop_path_id"));fb.Debug.assertNotEquals(after_column_show_inputs.length,0);after_column_show_inputs.filter(":last").after(column_show_inputs);show_inputs=fb.type.get_form_inputs("show").each(function(i,show_input){$(show_input).val(i)});var cells_to_move_selector=$.makeArray(column_show_inputs.map(function(){return fb.sprintf("> [fb__prop_path_id=%s]",$(this).attr("fb__prop_path_id"))})).join(",");var cells_to_move_after_selector=show_inputs.slice(0,show_inputs.index(column_show_inputs.filter(":first")));cells_to_move_after_selector=$.makeArray(cells_to_move_after_selector.map(function(){return fb.sprintf("> [fb__prop_path_id=%s]",$(this).attr("fb__prop_path_id"))})).join(",");function move_normal_row(){var cells_to_move=$(cells_to_move_selector,this);if(cells_to_move.length==0){return }var cells_to_move_after=$(cells_to_move_after_selector,this);if(cells_to_move_after.length==0){$(this).prepend(cells_to_move)}else{cells_to_move_after.filter(":last").after(cells_to_move)}}move_normal_row.apply($("> thead > tr:eq("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+")",fb.type.view.table.TABLE)[0],[]);$(after_column).after(column);var child_headers=fb.type.view.table.get_child_header_cells(column);var index=fb.type.view.table.get_column_index(column);var thead=$("> thead",fb.type.view.table.TABLE);while(child_headers.length!=0){var row_index=child_headers[0].parentNode.rowIndex;var sorted_cells=$.makeArray($("> th",thead[0].rows[row_index])).sort(function(a,b){var result=(fb.type.view.table.get_column_index(a)-fb.type.view.table.get_column_index(b));return result==0?-1:result});$(thead[0].rows[row_index]).html(sorted_cells);var next=[];for(var i=0;i<child_headers.length;i++){$(fb.type.view.table.get_child_header_cells(child_headers[i])).each(function(){next.push(this)})}child_headers=next}$("> tbody > tr",fb.type.view.table.TABLE).each(move_normal_row);fb.Debug.groupEnd("table.move_column")};fb.type.view.table.add_filter_params_to_data=function(data){fb.Debug.group("table.add_filter_params_to_data");var filter_inputs=$(fb.sprintf("> thead > tr:eq(%s) .fb-filter-input",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);filter_inputs.each(function(){if(!$(this).data("active")){return }var props=fb.type.get_filter_input_properties($(this));data.push({name:$(this).attr("name").replace("$name",props.type).replace("$comparison",props.comparison),value:props.value});$(this).removeData("criteria_value").data("active",false)});fb.Debug.groupEnd("table.add_filter_params_to_data");return true};fb.type.view.table.init_filter_inputs=function(inputs){fb.type.view.table.filtering.init_inputs(inputs.bind("fb-input",function(e){fb.Debug.group("fb.type.view.table.init_filter_inputs.fb-input",e);var input=$(e.target);fb.Debug.assert(input.is("input"));fb.Debug.assert(input.data("active"));fb.type.filtering.init();var props=fb.type.get_filter_input_properties(input);var pid_path=JSON.parse(input.attr("fb__pid_path"));var prop_names=JSON.parse(input.attr("fb__prop_names"));var c_protos=$("#comparison-select-prototypes");var comparison=$(fb.sprintf("ul[fb__ect_id='%s']",input.attr("fb__ect")),c_protos);
if(comparison.length==0){comparison=$(fb.sprintf("ul[fb__ect_id='/type/object'][fb__enumeration='%s']",input.attr("fb__ect_enumeration")),c_protos)}fb.Debug.assertEquals(comparison.length,1);comparison=$(fb.sprintf("a[fb__value='%s']",props.comparison),comparison).text();var chiclet=fb.type.filtering.append_chiclet(pid_path,prop_names,props.type,comparison,input.val());$(input).hide().blur().after("<div class='medium-progress'/>");chiclet.fadeIn();fb.type.filtertypeinstances.run({reset_page:true});var filter_inputs=$(fb.sprintf("> thead > tr:eq(%s) .fb-filter-input",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);fb.disable(filter_inputs);fb.Debug.groupEnd("fb.type.view.table.init_filter_inputs.fb-input",e)}))};fb.type.view.table.dnd={};fb.type.view.table.dnd.get_draggable_headers=function(){fb.Debug.group("table.dnd.get_draggable_headers");var headers=$(fb.sprintf("> thead > tr:gt(%s) > th",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);var result=[];$.each(headers,function(){if($(this).is(".tableview-th-name")){return }var parent_th=fb.type.view.table.get_parent_header_cell(this);if(parent_th!=null){var sibilings=fb.type.view.table.get_child_header_cells(parent_th);fb.Debug.assertNotEquals(sibilings.length,0);fb.Debug.assertNotEquals($(sibilings).index(this),-1);if(sibilings.length==1){return }}result.push(this)});fb.Debug.groupEnd("table.dnd.get_draggable_headers");return result};fb.type.view.table.dnd.init=function(headers){fb.Debug.group("table.dnd.init");$.each(["change.fb","success.addfiltercolumn","success.removefiltercolumn"],function(){fb.type.TYPE_FILTER_VIEW.bind(this,function(e){fb.Debug.log("dnd.init",e);if(fb.type.TYPE_FILTER_VIEW.is(":not(.editing)")){fb.type.view.table.dnd.unbind()}else{fb.type.view.table.dnd.bind()}})});fb.Debug.groupEnd("table.dnd.init")};fb.type.view.table.dnd.unbind=function(){fb.Debug.group("table.dnd.unbind");var headers=$(fb.sprintf("> thead > tr:gt(%s) > th",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);$(headers).draggable("destroy");fb.Debug.groupEnd("table.dnd.unbind")};fb.type.view.table.dnd.bind=function(){fb.Debug.group("table.dnd.bind");var all_headers=$(fb.sprintf("> thead > tr:gt(%s) > th",fb.type.view.table.HEADER_ROW_INDEX.FILTER),fb.type.view.table.TABLE);var draggable_headers=fb.type.view.table.dnd.get_draggable_headers();$(draggable_headers).draggable("destroy").draggable({revert:false,containment:$("> thead",fb.type.view.table.TABLE),helper:function(){fb.Debug.log("helper",this);var result=$("<table><thead><tr/></table>");var height=$(this).outerHeight();$("> thead > tr",result).append($(this).clone().attr("rowSpan",1));var child_headers=fb.type.view.table.get_child_header_cells(this);while(child_headers.length!=0){var row=$("<tr/>");height+=$(child_headers[0]).outerHeight();row.append($(child_headers).clone().attr("rowSpan",1));$("> thead",result).append(row);var next=[];$(child_headers).each(function(){$(fb.type.view.table.get_child_header_cells(this)).each(function(){next.push(this)})});child_headers=next}result.css({height:height,width:$(this).width()});return result},axis:"x",start:function(event,ui){fb.Debug.group("dnd.bind.drag.start");fb.Debug.log(event,ui,this);fb.Debug.assert($(this).is("th"));var parent_th=fb.type.view.table.get_parent_header_cell(this);var selector="th";var valid_targets;if(parent_th==null){valid_targets=$(this).siblings("th").andSelf()}else{valid_targets=$(fb.type.view.table.get_child_header_cells(parent_th))}fb.Debug.assertNotEquals(valid_targets.index(this),-1);fb.Debug.assertNotEquals(valid_targets.length,1);valid_targets.addClass("tableview-th-valid-drop-target");var cells=$(fb.sprintf("> tbody > tr > td[fb__prop_path_id=%s]",$(this).attr("fb__prop_path_id")),fb.type.view.table.TABLE);cells.addClass("tableview-cell-dragging");$.data(this,"fb.cells",cells);fb.Debug.groupEnd("dnd.bind.drag.start")},stop:function(event,ui){all_headers.removeClass("tableview-th-drop-target").removeClass("tableview-th-valid-drop-target");
var cells=$.data(this,"fb.cells");$.removeData(this,"fb.cells");cells.removeClass("tableview-cell-dragging")},drag:function(event,ui){}});all_headers.droppable({accept:"th",tolerance:"pointer",over:function(event,ui){fb.Debug.log("droppable.over",this,event,ui);all_headers.removeClass("tableview-th-drop-target");if($(this).is(".tableview-th-valid-drop-target")){$(this).addClass("tableview-th-drop-target");var child_headers=fb.type.view.table.get_child_header_cells(this);while(child_headers.length!=0){var ch=child_headers[child_headers.length-1];$(ch).addClass("tableview-th-drop-target");child_headers=fb.type.view.table.get_child_header_cells(ch)}}},drop:function(event,ui){fb.Debug.log("droppable.drop",this,event,ui);if($(this).is(".tableview-th-drop-target")){fb.Debug.assert($(this).is(".tableview-th-valid-drop-target"));fb.type.view.table.move_column(ui.draggable[0],this);fb.type.TYPE_FILTER_VIEW.trigger("change.fb")}}});fb.Debug.groupEnd("table.dnd.bind")};fb.type.view.table.filtering={};fb.type.view.table.filtering.init_inputs=function(inputs,is_primary_name_input){is_primary_name_input=is_primary_name_input||function(input){return $(input).attr("fb__primary_name")=="true"};function _handle_literal_suggest_select(event,data){if($(this).is(":not(:visible)")){return }fb.Debug.group("fb.type.table.filtering.init_inputs._handle_literal_suggest_select",event);$(this).data("criteria_value",String(data.value));fb.Debug.assertNotEquals($.trim($(this).val()),$(this).data("fb__ghost_text"));$(this).trigger("fb-input");fb.Debug.groupEnd("fb.type.table.filtering.init_inputs._handle_literal_suggest_select",event)}fb.Debug.group("fb.type.table.filtering.init_inputs",inputs);inputs.focus(function(e){if(!$(this).data("comparison")){$(this).data("comparison","~=")}if($(this).hasClass("ghost-text")){$(this).removeClass("ghost-text");$(this).data("fb__ghost_text",$(this).val());$(this).val("")}}).blur(function(e){fb.Debug.group("fb.type.view.table.filtering.init_inputs.blur");if(!$(this).val()){var ghost_text=$(this).data("fb__ghost_text");fb.Debug.log("resetting ghost text to ",ghost_text);fb.Debug.assertNotNull(ghost_text,"no ghost text on "+this+" (blur)");$(this).val(ghost_text);$(this).addClass("ghost-text")}fb.Debug.groupEnd("fb.type.view.table.filtering.init_inputs.blur")}).filter(".topic-input").each(function(){$(this).filtered_suggest({required:false,soft:true}).bind("fb-select",function(e,data){fb.Debug.group("fb.type.table.filtering.init_inputs.topic-input.fb-select",e);$(this).data("active",true);$(this).data("comparison","=").data("criteria_value",data.id);if(is_primary_name_input($(this))){$(this).attr("name",$(this).attr("name").replace("/type/object/name","/type/object/id"));$(this).data("criteria_type","value")}else{$(this).data("criteria_type","id")}fb.Debug.assertNotEquals($.trim($(this).val()),$(this).data("fb__ghost_text"));$(this).trigger("fb-input");fb.Debug.groupEnd("fb.type.table.filtering.init_inputs.topic-input.fb-select",e)}).bind("fb-select-new",function(e,data){fb.Debug.assert(false)}).bind("keyup",function(e,data){if(e.keyCode!=$.suggest.keyCode.ENTER){return true}if(!$(this).data("fb__ghost_text")||$.trim($(this).val())==$(this).data("fb__ghost_text")){fb.Debug.log("fb.type.table.filtering.init_inputs.topic-input.key (ignored)",e);return true}fb.Debug.group("fb.type.table.filtering.init_inputs.topic-input.keyup",e);$(this).data("active",true).data("comparison","~=");if(is_primary_name_input($(this))){$(this).attr("name",$(this).attr("name").replace("/type/object/id","/type/object/name"));$(this).data("criteria_type","value")}else{$(this).data("criteria_type","name")}$(this).data("filtered_suggest").hide_all();$(this).trigger("fb-input");fb.Debug.groupEnd("fb.type.table.filtering.init_inputs.topic-input.keyup",e)})}).end().filter(".enum-input").each(function(){var opt={service_url:"",type:$(this).attr("fb__ect"),limit:300,css:{pane:"fbs-pane fbs-pane-enum"},required:"always",align:"left"};$(this).suggesttype(opt).bind("fb-select",function(e,data){fb.Debug.group("fb.type.table.filtering.init_inputs.enum-input.fb-select",e);
$(this).data("active",true).data("criteria_type","id").data("comparison","=").data("criteria_value",data.id);if(is_primary_name_input($(this))){$(this).attr("name",$(this).attr("name").replace("/type/object/name","/type/object/id"));$(this).data("criteria_type","value")}else{$(this).data("criteria_type","id")}fb.Debug.assertNotEquals($.trim($(this).val()),$(this).data("fb__ghost_text"));$(this).trigger("fb-input");fb.Debug.groupEnd("fb.type.table.filtering.init_inputs.enum-input.fb-select",e)})}).end().filter(":not(.topic-input, .enum-input, .boolean-input)").keyup(function(e){$(this).data("active",true).data("criteria_type","value");if(e.keyCode==13){e.preventDefault();if($.trim($(this).val())!=$(this).data("fb__ghost_text")){$(this).trigger("fb-input")}}}).end().filter(".datetime-input").each(function(){$(this).data("comparison","=");var opt={css:{pane:"fbs-pane fbs-pane-datetime"},required:"always",align:"left"};$(this).suggestdate(opt).bind("fb-select",_handle_literal_suggest_select)}).end().filter(".boolean-input").each(function(){$(this).data("comparison","=").data("criteria_type","value");var opt={"true":"Yes","false":"No",css:{pane:"fbs-pane fbs-pane-boolean"},required:"always",align:"left"};$(this).suggestboolean(opt).bind("fb-select",_handle_literal_suggest_select)}).end().filter(".int-input, .float-input").each(function(){$(this).data("comparison","=").data("criteria_type","value");var opt={comma:true,decimal:$(this).is(".float-input")?-1:0,css:{pane:"fbs-pane fbs-pane-number"},required:"always",align:"left"};$(this).suggestnumber(opt).bind("fb-select",_handle_literal_suggest_select)}).end();fb.Debug.groupEnd("fb.type.table.filtering.init_inputs",inputs)};fb.type.view.table.filtering.reset_input=function(input){fb.Debug.group("fb.type.view.table.filtering.reset_input",input);$(input).show();var ghost_text=$(input).data("fb__ghost_text");if(ghost_text){$(input).val(ghost_text).addClass("ghost-text")}fb.Debug.assert($(input).hasClass("ghost-text"));$(input).blur();fb.Debug.groupEnd("fb.type.view.table.filtering.reset_input",input)}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.view=A.type.view||{};A.type.view.gallery={ID:"gallery"};A.type.view.gallery.filtertypeinstances={};A.type.view.gallery.init=function(){A.Debug.group("fb.type.view.gallery.init");A.Debug.time("fb.type.view.gallery.init");A.type.view.gallery.GALLERY=B("> #filter-results",A.type.FILTER_RESULTS_CONTAINER);A.Debug.assertEquals(A.type.view.gallery.GALLERY.length,1);A.bind_alternate_stylesheet(1280);B(window).unbind("resize.fb_summary").unbind("switch_stylesheet").bind("switch_stylesheet",A.type.view.gallery.update_item_height).bind("resize.fb_summary",A.type.view.gallery.update_item_height);A.type.view.gallery.update_item_height();A.type.view.gallery.update_image_filter_toggle();A.Debug.timeEnd("fb.type.view.gallery.init");A.Debug.groupEnd("fb.type.view.gallery.init")};A.type.view.gallery.get_data_ids=function(D){var C=B("> .galleryview-result",D||A.type.view.gallery.GALLERY);C=C.map(function(){return B(this).attr("fb__id")});return B.makeArray(C)};A.type.view.gallery.remove_filter_column=function(D,C){A.Debug.group("gallery.remove_filter_column");A.Debug.groupEnd("gallery.remove_filter_column")};A.type.view.gallery.addfiltercolumn_successHandler=function(D,E,C){A.Debug.group("gallery.addfiltercolumn_successHandler",C);A.Debug.groupEnd("gallery.addfiltercolumn_successHandler",C)};A.type.view.gallery.filtertypeinstances.successHandler=function(D){A.Debug.group("gallery.filtertypeinstances.successHandler");A.Debug.time("gallery.filtertypeinstances.successHandler");var C=B("#filter-results",D);B("> .filter-results-gallery-footer > .filter-results-pager",A.type.view.gallery.GALLERY).replaceWith(B("> .filter-results-gallery-footer > .filter-results-pager",C));B("> .filter-result",A.type.view.gallery.GALLERY).remove();A.type.view.gallery.GALLERY.prepend(B("> .filter-result",C));A.type.view.gallery.update_item_height();A.type.view.gallery.update_image_filter_toggle();
A.Debug.timeEnd("gallery.filtertypeinstances.successHandler");A.Debug.groupEnd("gallery.filtertypeinstances.successHandler")};A.type.view.gallery.filtertypeinstances.completeHandler=function(C){A.Debug.group("gallery.filtertypeinstances.completeHandler");A.Debug.time("gallery.filtertypeinstances.completeHandler");A.Debug.timeEnd("gallery.filtertypeinstances.completeHandler");A.Debug.groupEnd("gallery.filtertypeinstances.completeHandler")};A.type.view.gallery.add_filter_params_to_data=function(C){A.Debug.time("gallery.add_filter_params_to_data");A.Debug.timeEnd("gallery.add_filter_params_to_data");return true};A.type.view.gallery.get_prop_path_id_for_anchor=function(C){var D=B(C).parents(".galleryview-result-prop-list");A.Debug.log(D);A.Debug.assertNotEquals(D.length,0);return B.map(B.makeArray(D).reverse(),function(E){return B(E).attr("fb__prop_path_id")}).join("-")};A.type.view.gallery.update_item_height=function(){B("> .filter-result",A.type.view.gallery.GALLERY).equalizeCols()};A.type.view.gallery.update_image_filter_toggle=function(){var E=B("#image-filter-controls");var C=B("> :hidden[name^=filter]",E);A.Debug.assertEquals(C.length,1);var D=B(A.sprintf("> .filter-criteria > :hidden[name=%s]",C.attr("name")),A.type.FILTER_CRITERIA_CONTAINER);B("a:eq("+D.length+")",E).addClass("pressed");B("a:not(:eq("+D.length+"))",E).removeClass("pressed")};A.type.view.gallery.toggle_image_filter_clickHandler=function(F){A.Debug.group("gallery.toggle_image_filter_clickHandler");F.preventDefault();if(B(F.target).is(".pressed")){return false}var E=B(F.target).parents("#image-filter-controls:first");E.addClass("image-filter-controls-loading");var C=B("> :hidden[name^=filter]",E);A.Debug.assertEquals(C.length,1);var D=B(A.sprintf("> .filter-criteria > :hidden[name=%s]",C.attr("name")),A.type.FILTER_CRITERIA_CONTAINER);if(D.length!=0){D.parent(".filter-criteria").remove()}else{var G=B("<li class='filter-criteria hide'/>");G.append(C.clone());A.type.FILTER_CRITERIA_CONTAINER.append(G)}A.type.filtertypeinstances.run(false);A.Debug.groupEnd("gallery.toggle_image_filter_clickHandler");return false};A.type.view.gallery.toggle_rendering_clickHandler=function(E){A.Debug.group("gallery.toggle_rendering_clickHandler");E.preventDefault();if(B(E.target).is(".selected")){return false}var D=B(E.target).parents("ul#gallery-toggles:first");A.Debug.assertEquals(D.length,1);var C=B("a.selected",D);A.Debug.assertEquals(C.length,1);A.Debug.assert(B("#filter-results").hasClass(C.attr("id")));B("#filter-results").removeClass(C.attr("id")).addClass(B(E.target).attr("id"));C.add(E.target).toggleClass("selected");A.type.view.gallery.update_item_height();A.Debug.groupEnd("gallery.toggle_rendering_clickHandler");return false};A.type.view.old_gallery={};A.type.view.old_gallery.remove_prop_clickHandler=function(C){A.Debug.group("old_gallery.remove_prop_clickHandler");C.preventDefault();A.Debug.assert(B(C.target).is("a.gallery-btn-remove-prop"),C.target);var D=A.type.view.gallery.get_prop_path_id_for_anchor(C.target);A.Debug.log("removing prop path ",D);A.type.remove_filter_column(D);A.Debug.groupEnd("old_gallery.remove_prop_clickHandler");return false};A.type.view.old_gallery.remove_prop_hoverHandler=function(E){if(!A.type.TYPE_FILTER_VIEW.hasClass("editing")){return }A.Debug.group("old_gallery.remove_prop_hoverHandler");A.Debug.time("old_gallery.remove_prop_hoverHandler");var F=B(E.target).parent().parent(".galleryview-result-prop-list");A.Debug.assertEquals(F.length,1);F=F.attr("fb__prop_path_id");var C=B(E.target).parents(".filter-result:first, .info-bubble-item:first").parent();A.Debug.assertEquals(C.length,1);var D=B(".galleryview-result-prop-list[fb__prop_path_id="+F+"]",C);if(E.type=="mouseover"){D.addClass("galleryview-result-prop-list-hover")}else{if(E.type=="mouseout"){D.removeClass("galleryview-result-prop-list-hover")}else{A.Debug.assert(false,E.type)}}A.Debug.timeEnd("old_gallery.remove_prop_hoverHandler");A.Debug.groupEnd("old_gallery.remove_prop_hoverHandler")
};A.type.view.old_gallery.remove_filter_column=function(D,C){A.Debug.group("old_gallery.remove_filter_column");D=D.split("-");var F=B(A.sprintf(".galleryview-result-prop-list[fb__prop_path_id=%s]",D[D.length-1]),C||A.type.view.gallery.GALLERY);if(D.length==1){F.remove();A.type.view.gallery.update_item_height()}else{var I=B(A.sprintf(".galleryview-result-prop-list[fb__prop_path_id=%s]:first",D[D.length-2]),C||A.type.view.gallery.GALLERY);A.Debug.assertEquals(I.length,1);var J=B(A.sprintf(".galleryview-result-prop-item:first > .galleryview-result-prop-list[fb__prop_path_id!=%s]",D[D.length-1]),I);A.Debug.log("children",J);if(J.length==0){D.pop();A.type.view.old_gallery.remove_filter_column(D.join("-"),C)}else{if(J.length==1){D[D.length-1]=J.attr("fb__prop_path_id");D=D.join("-");var H=A.type.get_form_inputs("show");H=H.filter(A.sprintf("[fb__prop_path_id=%s]",D));A.Debug.assertEquals(H.length,1);var E={filter_view:A.type.view.gallery.ID};var K=A.type.view.instance().get_data_ids(C);if(K.length!=0){E.topic_ids=K.join(A.PARAM_DELIM)}B.each(A.type.get_form_inputs(["show","filter"]),function(){E[B(this).attr("name")]=B(this).val()});E[H.attr("name")]="new";var G={cache:false,data:E,type:"POST",url:A.type.FILTER_FORM.attr("fb__addfiltercolumn_url"),success:function(L,M){L=A.buffer_ajax_html_response(L);A.type.view.instance().addfiltercolumn_successHandler(L,M,C);L.remove()}};B.ajax(G)}else{F.remove();A.type.view.gallery.update_item_height()}}}A.Debug.groupEnd("old_gallery.remove_filter_column")}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.view=A.type.view||{};A.type.view.timeline={ID:"timeline",DETAIL_BAND_INDEX:1,OVERVIEW_BAND_INDEX:0};A.type.view.timeline.filtertypeinstances={};A.type.view.timeline.JS_FILES=["/thirdparty/simile/ajax/simile-ajax-api.js","/thirdparty/simile/ajax/simile-ajax-bundle.js","/thirdparty/simile/timeline/timeline-bundle.js"];A.type.view.timeline.init=function(){A.Debug.group("fb.type.view.timeline.init");A.Debug.time("fb.type.view.timeline.init");SimileAjax_urlPrefix=LIBRARY_ROOT_REL+"/thirdparty/simile/ajax/";Timeline_urlPrefix=LIBRARY_ROOT_REL+"/thirdparty/simile/timeline/";window.Timeline=window.Timeline||{urlPrefix:Timeline_urlPrefix,serverLocale:"en",clientLocale:"en"};A.load_css("css/components/timeline.css");A.with_source_js(A.type.view.timeline.JS_FILES,function(){B.extend(window.SimileAjax,{loaded:true,urlPrefix:SimileAjax_urlPrefix});B.extend(window.Timeline,{DateTime:window.SimileAjax.DateTime});A.Debug.log("initializing timeline");A.Debug.log("data",fb_type_view_timeline_data);SimileAjax.History.enabled=false;A.type.view.timeline.load(fb_type_view_timeline_data)});A.Debug.timeEnd("fb.type.view.timeline.init");A.Debug.groupEnd("fb.type.view.timeline.init")};A.type.view.timeline.add_filter_params_to_data=function(G){A.Debug.group("timeline.add_filter_params_to_data");var F=A.type.view.timeline.INSTANCE;if(!F){return true}if(!this.reset_page){var E=F.getBand(A.type.view.timeline.DETAIL_BAND_INDEX);var C=E.getMinVisibleDate();var D=E.getMaxVisibleDate();A.Debug.log("refresh ",C," - ",D,D.getTime());G.push({name:"timeline:earliest_date",value:C.toISOString()});G.push({name:"timeline:latest_date",value:D.toISOString()})}A.Debug.groupEnd("timeline.add_filter_params_to_data");return true};A.type.view.timeline.get_data_ids=function(){A.Debug.time("timeline.get_data_ids");if(!A.type.view.timeline.INSTANCE){A.Debug.warn("timeline not yet initialized",A.type.view.timeline.INSTANCE);return[]}else{var D=A.type.view.timeline.INSTANCE.getBand(0).getEventSource();var E=D.getAllEventIterator();var C=[];while(E.hasNext()){C.push(E.next().getID())}}A.Debug.timeEnd("timeline.get_data_ids");return C};A.type.view.timeline.more_clickHandler=function(D){var C=B(D.target).attr("href").replace(A.sprintf("filter_view=%s",A.type.view.timeline.ID),A.sprintf("filter_view=%s",A.type.view.summary.ID));B(D.target).attr("href",C);return A.type.view.summary.more_clickHandler(D)};A.type.view.timeline.remove_prop_clickHandler=A.type.view.old_gallery.remove_prop_clickHandler;
A.type.view.timeline.remove_filter_column=function(D){var C=B("#info-bubble");A.Debug.assertEquals(C.length,1);return A.type.view.gallery.remove_filter_column(D,C)};A.type.view.timeline.addfiltercolumn_successHandler=function(C,D){A.Debug.group("timeline.addfiltercolumn_successHandler");A.Debug.groupEnd("timeline.addfiltercolumn_successHandler")};A.type.view.timeline.filtertypeinstances.successHandler=function(F,E){A.Debug.group("timeline.filtertypeinstances.successHandler");A.Debug.time("timeline.filtertypeinstances.successHandler");if(this.reset_page){A.type.view.timeline.INSTANCE.dispose();A.type.view.timeline.load(fb_type_view_timeline_data)}else{var C=A.type.view.timeline.INSTANCE.getBand(0).getEventSource();var D=A.type.view.timeline.load_events(fb_type_view_timeline_data,C);C.addMany(D);A.type.view.set_plotted_visible_count(C.getCount())}A.Debug.timeEnd("timeline.filtertypeinstances.successHandler");A.Debug.groupEnd("timeline.filtertypeinstances.successHandler")};A.type.view.timeline.filtertypeinstances.completeHandler=function(C){A.Debug.group("timeline.filtertypeinstances.completeHandler");A.Debug.time("timeline.filtertypeinstances.completeHandler");A.Debug.timeEnd("timeline.filtertypeinstances.completeHandler");A.Debug.groupEnd("timeline.filtertypeinstances.completeHandler")};A.type.view.timeline.load=function(G){A.Debug.group("timeline.load");var M=A.type.view.timeline.load_events(G);var D=new Timeline.DefaultEventSource();D.addMany(M);A.type.view.set_plotted_visible_count(D.getCount());var F=Timeline.ClassicTheme.create();F.event.instant.icon=G.v.small_empty_image.url;F.event.instant.iconWidth=G.v.small_empty_image.size;F.event.instant.iconHeight=G.v.small_empty_image.size;F.event.track.height=G.v.icon_size+6;F.event.track.gap=5;F.ether.highlightOpacity=100;F.ether.interval.marker.hAlign="Top";var J=Timeline.DateTime[G.v.top_interval_unit.toUpperCase()];var L=Timeline.DateTime[G.v.bottom_interval_unit.toUpperCase()];var K=[Timeline.createBandInfo({theme:F,showEventText:false,eventSource:D,width:"10%",overview:true,intervalUnit:L,intervalPixels:200}),Timeline.createBandInfo({theme:F,showEventText:true,eventSource:D,width:"90%",intervalUnit:J,intervalPixels:96,eventPainter:Timeline.CompactEventPainter,eventPainterParams:{iconWidth:G.v.icon_size+6,iconHeight:G.v.icon_size+6,iconLabelGap:5,labelRightMargin:20,trackOffset:20,stackConcurrentPreciseInstantEvents:{limit:5,moreMessageTemplate:"more",icon:G.v.concurrent_empty_image.url,iconWidth:G.v.concurrent_empty_image.size+6,iconHeight:G.v.concurrent_empty_image.size+6}}})];K[A.type.view.timeline.OVERVIEW_BAND_INDEX].syncWith=A.type.view.timeline.DETAIL_BAND_INDEX;K[A.type.view.timeline.OVERVIEW_BAND_INDEX].highlight=true;A.type.view.timeline.INSTANCE=Timeline.create(B("#filter-results")[0],K,Timeline.HORIZONTAL);if(D.getCount()!=0){var C=A.type.view.timeline.INSTANCE.getBand(A.type.view.timeline.OVERVIEW_BAND_INDEX);C.setCenterVisibleDate(SimileAjax.DateTime.parseIso8601DateTime(G.v.center_date))}function I(N,P,O){A.Debug.log("_showBubble",N,P,O);A.type.view.load_info_bubble(B.map(O,function(Q){return Q.getEventID()}),O.length>1?O[0].fb__dates[0]:null,G.v.info_window_url,function(Q){SimileAjax.WindowManager.cancelPopups();Q.css("visibility","hidden");if(A.type.TYPE_FILTER_VIEW.hasClass("editing")){Q.addClass("editing")}B(A.type.FILTER_RESULTS_CONTAINER).append(Q);SimileAjax.Graphics.createBubbleForContentAndPoint(Q[0],N,P,Q.width());Q.css("visibility","visible")})}function H(O){function N(){A.type.view.timeline.timeout_id=null;A.type.filtertypeinstances.run({reset_page:false})}if(A.type.view.timeline.timeout_id){clearTimeout(A.type.view.timeline.timeout_id)}A.type.view.timeline.timeout_id=setTimeout(N,300)}for(var E=0;E<A.type.view.timeline.INSTANCE.getBandCount();E++){band=A.type.view.timeline.INSTANCE.getBand(E);band.getEventPainter()._showBubble=I;band.addOnScrollListener(H)}A.Debug.groupEnd("timeline.load")};A.type.view.timeline.load_events=function(F,C){A.Debug.group("timeline.load_events",F);
var E=[];var D=function(I,K,M,H,L,J){var G=new Timeline.DefaultEventSource.Event({id:I.join(A.PARAM_DELIM),eventID:I.join(A.PARAM_DELIM),start:M.start,end:M.end,instant:M.end==null,text:K,description:"",icon:L,caption:J});G.getProperty=function(N){return null};G.fillInfoBubble=function(N,O,P){self._fillInfoBubble(this,N,O,P)};E.push(G);return G};B.each(F.d,function(G,H){B.each(H.topics,function(K,J){if(C&&C.getEvent(J.id)){return }A.Debug.assert(H.values.length>0&&H.values.length<=2,J);var I=SimileAjax.DateTime.parseIso8601DateTime(H.values[0]);if(I!=null){var M=(H.values.length==2?SimileAjax.DateTime.parseIso8601DateTime(H.values[1]):null);var L=D([J.id],J.name,{start:I,end:M},null,J.image,J.name);L.fb__dates=H.values}})});A.Debug.groupEnd("timeline.load_events",F);return E}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.view=A.type.view||{};A.type.view.map={ID:"map",overlays:[],location_id_to_overlay:{}};A.type.view.map.filtertypeinstances={};A.type.view.map.init=function(){A.Debug.group("fb.type.view.map.init");A.Debug.time("fb.type.view.map.init");var C=fb_type_view_map_data;A.type.view.map;A.with_source_js([C.v.google_jsapi_script_url],function(){google.load("maps","2",{callback:function(){if(!GBrowserIsCompatible()){A.Debug.log("browser not compatible");return }A.Debug.log("rendering map of ",C);A.type.view.map.load_overlays(C.d,C.v,true);var E=new google.maps.LatLngBounds();B.each(A.type.view.map.overlays,function(){if(this instanceof google.maps.Marker){E.extend(this.getLatLng())}});var D=B("#filter-results").show().removeClass("hide");D.height(D.width()*3/5);var F=new google.maps.Map2(D[0]);F.setCenter(E.getCenter());A.Debug.log("bounds",E,F.getBoundsZoomLevel(E));F.setZoom(Math.max(2,F.getBoundsZoomLevel(E)));B.each([new google.maps.OverviewMapControl(),new google.maps.ScaleControl(),new google.maps.LargeMapControl()],function(){F.addControl(this)});B.each(A.type.view.map.overlays,function(){F.addOverlay(this)});A.type.view.set_plotted_visible_count(A.type.view.map.get_data_ids().length);google.maps.Event.addListener(F,"click",function(G,I){if(!G||!G.fb__topics){return }A.Debug.log("click",G.fb__topics);var H=[];B.each(G.fb__topics,function(){H.push(this.id)});A.type.view.load_info_bubble(H,G.fb__id,C.v.info_window_url,function(J){G.openInfoWindowHtml(J[0])})});A.type.view.map.bounds_changeHandler.bind(F);A.type.view.map.INSTANCE=F}})});A.Debug.timeEnd("fb.type.view.map.init");A.Debug.groupEnd("fb.type.view.map.init")};A.type.view.map.bounds_changeHandler=function(){if(B("#info-bubble").length!=0){return }A.Debug.group("map.bounds_changeHandler");var F=A.type.view.map.INSTANCE;var D=F.getCurrentMapType().getProjection().getWrapWidth(F.getZoom());var C=F.getSize().width;var E=F.getBounds();if(!(E.isFullLng()||E.isFullLat())&&C<D){A.type.filtertypeinstances.run({reset_page:false,prevent_recenter:true,add_bounding_box:true})}A.Debug.groupEnd("map.bounds_changeHandler")};A.type.view.map.bounds_changeHandler.bind=function(C){A.type.view.map.bounds_changeHandler.moveend=google.maps.Event.addListener(C,"moveend",A.type.view.map.bounds_changeHandler);A.type.view.map.bounds_changeHandler.zoomend=google.maps.Event.addListener(C,"zoomend",A.type.view.map.bounds_changeHandler)};A.type.view.map.bounds_changeHandler.unbind=function(){if(A.type.view.map.bounds_changeHandler.moveend){google.maps.Event.removeListener(A.type.view.map.bounds_changeHandler.moveend);A.type.view.map.bounds_changeHandler.moveend_event_listener=null}if(A.type.view.map.bounds_changeHandler.zoomend_event_listener){google.maps.Event.removeListener(A.type.view.map.bounds_changeHandler.zoomend);A.type.view.map.bounds_changeHandler.zoomend=null}};A.type.view.map.add_filter_params_to_data=function(E){A.Debug.group("map.add_filter_params_to_data");var G=A.type.view.map.INSTANCE;if(!G){return true}if(this.add_bounding_box){var D=G.getBounds();var C=D.getSouthWest();var F=D.getNorthEast();A.Debug.log(G.getBounds());E.push({name:"map:sw",value:[C.lng(),C.lat()]});
E.push({name:"map:ne",value:[F.lng(),F.lat()]})}A.Debug.groupEnd("map.add_filter_params_to_data");return true};A.type.view.map.remove_prop_clickHandler=A.type.view.old_gallery.remove_prop_clickHandler;A.type.view.map.remove_filter_column=function(D){var C=B("#info-bubble");A.Debug.assertEquals(C.length,1);return A.type.view.old_gallery.remove_filter_column(D,C)};A.type.view.map.get_data_ids=function(){A.Debug.time("map.get_data_ids");var C=[];B.each(A.type.view.map.overlays,function(){if(this instanceof google.maps.Marker&&this.fb__id){B.each(this.fb__topics||[],function(){C.push(this.id)})}});A.Debug.timeEnd("map.get_data_ids");return C};A.type.view.map.get_location_ids=function(){A.Debug.time("map.get_location_ids");var C=[];B.each(A.type.view.map.overlays,function(){if(this instanceof google.maps.Marker&&this.fb__id){C.push(this.fb__id)}});A.Debug.timeEnd("map.get_location_ids");return C};A.type.view.map.more_clickHandler=function(D){var C=B(D.target).attr("href").replace(A.sprintf("filter_view=%s",A.type.view.map.ID),A.sprintf("filter_view=%s",A.type.view.summary.ID));B(D.target).attr("href",C);return A.type.view.summary.more_clickHandler(D)};A.type.view.map.addfiltercolumn_successHandler=function(C,D){A.Debug.group("map.addfiltercolumn_successHandler");A.Debug.groupEnd("map.addfiltercolumn_successHandler")};A.type.view.map.filtertypeinstances.successHandler=function(J,G,I,C){A.Debug.group("map.filtertypeinstances.successHandler");A.Debug.time("map.filtertypeinstances.successHandler");A.Debug.log("data",fb_type_view_map_data);var F=fb_type_view_map_data;var H=A.type.view.map.INSTANCE;if(this.reset_page){H.clearOverlays()}A.type.view.map.load_overlays(F.d,F.v,this.reset_page);var E=new google.maps.LatLngBounds();B.each(A.type.view.map.overlays,function(){if(this instanceof google.maps.Marker){E.extend(this.getLatLng())}});if(!H.getBounds().getCenter().equals(E.getCenter())&&!this.prevent_recenter){A.Debug.log("zooming map to ",E.getCenter()," from ",H.getBounds().getCenter());A.type.view.map.bounds_changeHandler.unbind();var D=H.getCenter();A.Debug.log("center before set ",D);H.setCenter(E.getCenter(),H.getBoundsZoomLevel(E));A.Debug.log("new center ",H.getCenter());A.type.view.map.bounds_changeHandler.bind(H);if(false&&!H.getCenter().equals(D)){A.type.view.map.bounds_changeHandler()}}B.each(A.type.view.map.overlays,function(){H.addOverlay(this)});A.type.view.set_plotted_visible_count(A.type.view.map.get_data_ids().length);A.Debug.timeEnd("map.filtertypeinstances.successHandler");A.Debug.groupEnd("map.filtertypeinstances.successHandler")};A.type.view.map.filtertypeinstances.completeHandler=function(C){A.Debug.group("map.filtertypeinstances.completeHandler");A.Debug.time("map.filtertypeinstances.completeHandler");A.Debug.timeEnd("map.filtertypeinstances.completeHandler");A.Debug.groupEnd("map.filtertypeinstances.completeHandler")};A.type.view.map.load_overlays=function(E,D,C){if(C){A.type.view.map.overlays=[];A.type.view.map.location_id_to_overlay={}}B.each(E,function(){var F=A.type.view.map.location_id_to_overlay[this.location.id];var J=new google.maps.LatLng(this.location.points.lat,this.location.points.lng);if(F){A.Debug.assert(!C);A.Debug.assert(F.getLatLng().equals(J),"inconsistent latlng for "+this.location.name);var I=false;B.each(this.topics,function(L,K){if(B.inArray(K,F.fb__topics)==-1){F.fb__topics.push(K);I=true}});if(!I){return true}A.type.view.map.INSTANCE.removeOverlay(F);var H=B.inArray(F,A.type.view.map.overlays);A.Debug.assertNotEquals(-1,H,"unable to find marker for ",this.location.id," in fb.type.view.map.overlays");A.type.view.map.overlays.splice(H,1)}var G=A.type.view.map.get_marker_image(this.topics,D);var F=new google.maps.Marker(J,{title:this.location.name,icon:G});F.fb__topics=this.topics;F.fb__id=this.location.id;A.type.view.map.overlays.push(F);A.type.view.map.location_id_to_overlay[this.location.id]=F})};A.type.view.map.get_marker_image=function(H,G){var E=new google.maps.Icon();var C=Math.min(40,Math.ceil(20*Math.pow(H.length,1/4)));
var F={maxwidth:C,maxheight:C};var D=[];B.each(F,function(I,J){D.push([I,J].join("="))});E.image=G.marker_image_url+"&"+D.join("&");E.shadow=G.marker_shadow_image_url+"&"+D.join("&");E.iconAnchor=new google.maps.Point(F.maxwidth/2,F.maxheight);E.infoWindowAnchor=new google.maps.Point(F.maxwidth/2,F.maxheight);E.iconSize=new google.maps.Size(F.maxwidth,F.maxheight);E.shadowSize=new google.maps.Size(F.maxwidth,F.maxheight);return E}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.view=A.type.view||{};A.type.view.chart={ID:"chart"};A.type.view.chart.filtertypeinstances={};A.type.view.chart.JS_FILES=["/thirdparty/jquery/flot/excanvas.js","/thirdparty/jquery/flot/jquery.flot.js"];A.type.view.chart.init=function(){A.Debug.group("fb.type.view.chart.init");A.Debug.time("fb.type.view.chart.init");A.with_source_js(A.type.view.chart.JS_FILES,function(){A.Debug.log("initializing chart");A.Debug.log("data",fb_type_view_chart_data);A.type.view.chart._load(fb_type_view_chart_data);B(window).unbind("resize.fb_chart").bind("resize.fb_chart",A.type.view.chart._resizeHandler)});A.Debug.timeEnd("fb.type.view.chart.init");A.Debug.groupEnd("fb.type.view.chart.init")};A.type.view.chart.add_filter_params_to_data=function(C){A.Debug.group("chart.add_filter_params_to_data");A.Debug.groupEnd("chart.add_filter_params_to_data");return true};A.type.view.chart.get_data_ids=function(D){A.Debug.group("get_data_ids");A.Debug.time("get_data_ids");var C=A.type.view.chart.PLOT.getData();C=B.map(C,function(E){return E.id});A.Debug.timeEnd("get_data_ids");A.Debug.groupEnd("get_data_ids");return C};A.type.view.chart.filtertypeinstances.successHandler=function(C){A.Debug.group("chart.filtertypeinstances.successHandler");A.Debug.time("chart.filtertypeinstances.successHandler");if(this.reset_page){A.type.view.chart._load(A.type.view.chart._to_flot_data(fb_type_view_chart_data))}else{var D=A.type.view.chart._to_flot_data(fb_type_view_chart_data);A.type.view.chart.PLOT.setData(D)}A.Debug.timeEnd("chart.filtertypeinstances.successHandler");A.Debug.groupEnd("chart.filtertypeinstances.successHandler")};A.type.view.chart.filtertypeinstances.completeHandler=function(C){A.Debug.group("chart.filtertypeinstances.completeHandler");A.Debug.time("chart.filtertypeinstances.completeHandler");A.Debug.timeEnd("chart.filtertypeinstances.completeHandler");A.Debug.groupEnd("chart.filtertypeinstances.completeHandler")};A.type.view.chart._resizeHandler=function(){A.Debug.group("fb.type.view.chart._resizeHandler");A.Debug.log(fb_type_view_chart_data);window.clearTimeout(A.type.view.chart._resizeHandler._timer);A.type.view.chart._resizeHandler._timer=setTimeout(A.type.view.chart._reload,200);A.Debug.groupEnd("fb.type.view.chart._resizeHandler")};A.type.view.chart._resizeHandler._timer=null;A.type.view.chart.plot_hoverHandler=function(D,I,K){var F=B("#filter-results").data("chart.previous_point");if(!K){B("#chart-plot-tooltip").remove();B("#filter-results").removeData("chart.previous_point")}else{if(F!=K.datapoint){var F=B("#filter-results").data("chart.previous_point",K.datapoint);B("#chart-plot-tooltip").remove();A.Debug.log(K);var C={position:"absolute",display:"none",top:K.pageY+5,left:K.pageX+5,border:"1px solid #ccddff",padding:"0.5em","background-color":"#fff",opacity:0.9};var H=K.series.yaxis.tickFormatter(K.datapoint[1],K.series.yaxis);var J=K.series.xaxis.tickFormatter(K.datapoint[0],K.series.xaxis);var E=A.sprintf("%s: %s in %s",K.series.label,H,J);var G=B('<div id="chart-plot-tooltip">'+E+"</div>");G.css(C).appendTo("body").fadeIn(200)}}};A.type.view.chart._to_flot_data=function(C){return B.map(C.d,function(D){return{data:D.coords,label:D.name,id:D.id,shadowSize:0,color:C.d.length==1?"#cbd6d8":null,lines:{fill:C.d.length==1,fillColor:"#eefafe",lineWidth:3},legend:{show:true,margin:5}}})};A.type.view.chart._reload=function(){A.Debug.group("fb.type.view.chart._reload");if(A.type.view.chart.PLOT){A.type.view.chart.PLOT=null;A.type.view.chart._load(fb_type_view_chart_data)
}A.Debug.groupEnd("fb.type.view.chart._reload")};A.type.view.chart._load=function(C){A.type.view.chart.PLOT=B.plot(B("#filter-results"),A.type.view.chart._to_flot_data(C),{xaxis:{mode:"time"},series:{lines:{show:true},points:{show:true},legend:{show:C.d.length>1}},grid:{hoverable:true,borderWidth:0,tickColor:"#ffffff",mouseActiveRadius:30}});B("#filter-results").removeData("chart.previous_point");B("#filter-results").unbind().bind("plothover",A.type.view.chart.plot_hoverHandler)}})(jQuery,window.freebase);(function(B,A){if(!B.suggest){alert("$.suggest required")}if(!A.type){alert("fb.type required")}A.type.filtered_suggest_control={};A.type.filtered_suggest_control.request=function(F,G){A.Debug.group("filtered_suggest_control.request",F,G);var E=this.options;var C=this._get_filter_params();var D={};B.each(E.ac_param,function(H,I){if(!H.match(/^filter/)){D[H]=I}});E.ac_param=D;B.each(C,function(){E.ac_param[this.name]=this.value});B.extend(E.ac_param,{autocomplete_input:this.input.attr("name"),type:this.input.attr("fb__ect"),id:fb_type_TYPE.id});B.data(this.input,"suggest_options",E);A.Debug.groupEnd("filtered_suggest_control.request");return B.suggest.suggest.prototype.request.apply(this,[F,G])};A.type.filtered_suggest_control._get_filter_params=function(){A.Debug.assert(this.input.is(".topic-input, .enum-input"));return(this.input.is(".advanced-find-value")?this._get_advanced_filter_params():this._get_simple_filter_params())};A.type.filtered_suggest_control._get_simple_filter_params=function(){var E=this.input.attr("name");var D=[];var C=A.type.get_form_inputs("filter").filter("[value!=]");B.each(C,function(){if(E!=B(this).attr("name")){D.push({name:B(this).attr("name"),value:B(this).val()})}});return D};A.type.filtered_suggest_control._get_advanced_filter_params=function(){var E=this.input.attr("name");var D=[];var C=B(":input.advanced-find-value",A.type.advanced_filter.CONTAINER.form);B.each(C,function(){if(E!=B(this).attr("name")){var F=B(this).attr("name");var G=B.data(this,"criteria_value")||B(this).val();if(G||F.endsWith("!0")||F.endsWith("=0")){D.push({name:F,value:G})}}});return D};B.suggest("filtered_suggest",B.extend(true,{},B.suggest.suggest.prototype,A.type.filtered_suggest_control));B.extend(B.suggest.filtered_suggest,{defaults:B.extend(true,{},B.suggest.suggest.defaults,{type:fb_type_TYPE.id,required:"always",limit:15,category:"filtered",service_url:"",suggest_new:null})})})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.type.property_chooser={};A.type.property_chooser.init_fields=function(C){B(".field-input",C).focus(function(D){if(B(this).val()==B(this).attr("default")){B(this).val("")}else{B(this).select()}}).blur(function(D){if(!B(this).val()){B(this).val(B(this).attr("default"))}})};A.type.property_chooser.filter_properties=function(H){var F=B(H.target).val().toLowerCase();if(A.type.property_chooser.prev_input_value==F){return }A.type.property_chooser.prev_input_value=F;var J=B(H.target).parents(".property-chooser-box").find(".property-list");var C=false;var D=B.makeArray(B("li",J)).reverse();for(var E=0;E<D.length;++E){var G=B(D[E]);if(G.hasClass("property-list-item")){var I=B("a > span",G).text().toLowerCase();if(F&&I.indexOf(F)<0&&!G.hasClass("selected")){G.hide().removeClass("property-list-highlight")}else{G.show();C=true}}else{if(G.hasClass("property-list-header")){if(C){G.show()}else{G.hide()}C=false}}}};A.type.property_chooser.navigate=function(F){var H=B(F.target).parents(".property-chooser-box:first");var G=B(".property-list",H);if(F.keyCode==40){var E=B(".property-list-highlight:first",G);var C=(E.length>0?E.nextAll(".property-list-item:visible:first"):B(".property-list-item:visible:first",G));E.removeClass("property-list-highlight");C.addClass("property-list-highlight");A.type.property_chooser.scroll_property(C,G)}else{if(F.keyCode==38){var E=B(".property-list-highlight:first",G);var D=(E.length>0?E.prevAll(".property-list-item:visible:first"):B(".property-list-item:visible:last",G));E.removeClass("property-list-highlight");
D.addClass("property-list-highlight");A.type.property_chooser.scroll_property(D,G)}else{if(F.keyCode==13){var E=B(".property-list-highlight:first",G);if(E.length>0){B("a",E).click()}}else{if(F.keyCode==27){A.popup.popup_hide(H.prev(".popup-trigger-active"))}else{return }}}}F.preventDefault()};A.type.property_chooser.scroll_property=function(F,E,C){if(F.length==0){E.scrollTop(0);return }var D=F[0].offsetTop-E[0].offsetTop;var H=B(F).height();var G=B(E).height();if(C=="top"){E.scrollTop(D)}else{if(C=="bottom"){E.scrollTop(D+H-G)}else{if(D<E.scrollTop()){E.scrollTop(D)}else{if((D+H)>(E.scrollTop()+G)){E.scrollTop(D+H-G)}}}}};A.type.property_chooser.init_dialog=function(C){A.Debug.group("fb.type.property_chooser.init_dialog");A.Debug.time("fb.type.property_chooser.init_dialog");A.type.property_chooser.init_fields(C);B(".property-list li > a",C).click(function(I){var J=B(I.target).parents(".property-chooser-box:first");var G=J.prev(".popup-trigger-active");var H=B(I.target).is("a")?B(I.target):B(I.target).parent("a");A.Debug.assertEquals(H.length,1);var F=B("> .property-chooser-footer li.selected > a",J).attr("fb__value")=="true";B(G).trigger("change.fb",[H,F]);H.parent().siblings().removeClass("selected").removeClass("property-list-highlight");H.parent().addClass("selected");A.popup.popup_hide(G)});B(".property-chooser-footer li > a",C).click(function(I){var J=B(I.target).parents(".property-chooser-box:first");var G=J.prev(".popup-trigger-active");var H=B("> .property-list li.selected > a",J);var F=B(I.target).attr("fb__value")=="true";A.popup.popup_hide(G);B(G).trigger("change.fb",[H,F])});B("#property-chooser-input",C).keyup(A.type.property_chooser.filter_properties);B("#property-chooser-input",C).keydown(A.type.property_chooser.navigate);var D=B(".property-list",C);var E=B(".selected",D).prevAll(".property-list-header:first");A.type.property_chooser.scroll_property(E,D,"top");A.Debug.timeEnd("fb.type.property_chooser.init_dialog");A.Debug.groupEnd("fb.type.property_chooser.init_dialog")};A.type.property_chooser.load=function(G,H,D,J,C,E){A.Debug.group("fb.type.property_chooser.load");A.Debug.assert(G.is(".popup-trigger"));if(G.is(".loading, .popup-trigger-active")){A.Debug.groupEnd("fb.type.property_chooser.load");return }A.popup.popup_hide();var F={tids:J.join(A.PARAM_DELIM)};B.extend(F,D);H.each(function(){var L=B(this).attr("name");if(B(this).is("[name^=filter]")){L=L.replace("$name","id").replace("$comparison","=")}F[L]=B(this).val()});var I=A.type.get_form_inputs("filter_view");F[I.attr("name")]=I.attr("value");var K={url:G.attr("fb__href"),type:"POST",cache:!DONT_CACHE_XHR,data:F};K.error=A.error.default_error_handler;K.complete=function(M,L){A.Debug.group("fb.type.property_chooser.load.complete");G.removeClass("loading");A.transaction_id.ajaxCompleteHandler.apply(this,[M,L]);A.Debug.groupEnd("fb.type.property_chooser.load.complete")};K.success=function(L){A.Debug.group("fb.type.property_chooser.load.success");L=A.buffer_ajax_html_response(L);B(G).bind("hide.popup",function(M){B(M.target).nextAll(".popup-body").remove()});B(G).after(L.addClass("popup-body").addClass("no-shadow"));A.popup.position(G,L,C||"SE",E||"NE");A.popup.popup_show(G);A.type.property_chooser.init_dialog(L);A.Debug.groupEnd("fb.type.property_chooser.load.success")};G.addClass("loading");B.ajax(K);A.Debug.groupEnd("fb.type.property_chooser.load")}})(jQuery,window.freebase);(function(B,A){A.type=A.type||{};A.dialog=A.dialog||{};A.type.view=A.type.view||{};A.type.close_dialog=function(C){A.Debug.group("fb.type.close_dialog",C);A.Debug.time("fb.type.close_dialog");A.dialog.hide(C);if(C&&C.target){var D=B(C.target);D=D.is(".overlay-dialog")?D:D.parents(".overlay-dialog:first");B(A.sprintf("#%s",D.attr("fb__anchor_id"))).removeClass("pressed");D.empty().remove()}B("body > .fb-message-body").shadowDestroy().remove();A.Debug.timeEnd("fb.type.close_dialog");A.Debug.groupEnd("fb.type.close_dialog");return false};A.type.save_view={BLOCK_UI:false,ANCHOR_POS:"SE",OVERLAY_POS:"NE"};
A.type.link_to_page={BLOCK_UI:false,ANCHOR_POS:"SE",OVERLAY_POS:"NE"};A.type.add_data={BLOCK_UI:false,ANCHOR_POS:"SE",OVERLAY_POS:"NE"};A.type.remove_data={BLOCK_UI:false,ANCHOR_POS:"NW",OVERLAY_POS:"NW"};A.type.cotype_instances={BLOCK_UI:true};A.type.show_query={BLOCK_UI:true};A.type.save_view.init_dialog=function(F){A.Debug.group("save_view.init_dialog");A.Debug.time("save_view.init_dialog");var H=B("form",F);H=A.edit.init_form(H,B("div.box-submit :button[type=submit][name=save]",H),B(":button[name=cancel]",F).click(A.type.close_dialog),":input:not(:button)");var C=B(":text.saved-view-name",H);A.Debug.assertEquals(C.length,1);var E=B.data(H[0],"save_buttons");A.activate(E,false);var G=B("#domain_chooser",F);A.domain_chooser.init(G);var I=function(K){C.attr("fb__name",C.val());var J=(A.domain_chooser.is_valid(G)&&B.trim(C.val()).length!=0);A.activate(E,J)};C.bind("keyup",I);G.bind("change",I);G.bind("input",I);if(B.browser.msie){G.bind("keyup",I);G.bind("paste",I)}var D=A.edit.get_default_ajaxForm_submit_options(H);D.success=function(K,L,M){var J=JSON.parse(K,null);A.Debug.assertEquals(J.code,"/api/status/ok");A.with_source_js("thirdparty/jquery/blockUI/jquery.blockUI.js",function(){B.blockUI({message:A.sprintf('<div class="system-message notice"><h5>Loading %s ...</h5></div>',J.saved_view.name)});window.location.href=J.view_url})};D.error=A.type.save_view_errorHandler;B(H).ajaxForm(D);C.focus();A.Debug.timeEnd("save_view.init_dialog");A.Debug.groupEnd("save_view.init_dialog")};A.type.link_to_page.init_dialog=function(D){A.Debug.group("link_to_page.init_dialog");A.Debug.time("link_to_page.init_dialog");B(".ui-accordion-container",D).accordion(A.type.ACCORDION_OPTIONS);B(".ui-accordion-container",D).bind("accordionchange",function(F,G){if(G.newContent.is(".link-to-view-get-link-content")){B("#copy-link-input",G.newContent)[0].select()}A.Debug.log(F,G)});var E=B("#saved-view-invitation form",D);if(E.length){E=A.edit.init_form(E,B(":button[name='send']",E),B(":button[name='cancel']",E));A.edit.init_form_inputs(B(":input",E));A.Debug.assertEquals(E.length,1);var C=A.edit.get_default_ajaxForm_submit_options(E);B.extend(C,{dataType:"json",beforeSubmit:function(){B(".system-message",E).remove();return true},success:function(F){A.Debug.group("link_to_page.invite_form.success");A.Debug.assertEquals(F.code,"/api/status/ok");var G=A.system_message.create(A.sprintf("%s has been sent to %s",F.result.template_params.view_name,F.result.email_addresses.join(",")),A.system_message.level.SUCCESS);E.prepend(G);B(":input[name=email_addresses_]",E).val("")[0].select();B(":hidden[name=email_addresses]",E).val("");A.Debug.groupEnd("link_to_page.invite_form.success")}});E.ajaxForm(C)}B(":button[name=cancel]",D).click(A.type.close_dialog);A.Debug.timeEnd("link_to_page.init_dialog");A.Debug.groupEnd("link_to_page.init_dialog")};A.type.add_data.init_dialog=function(E){A.Debug.group("add_data.init_dialog");A.Debug.time("add_data.init_dialog");var F=B("form.add-data-form",E);F=A.edit.init_form(F,B("div.box-submit :button[type=submit][name=add]",F),B(":button[name=cancel]",E).click(A.type.close_dialog),":input:not(:button)");var D=B(":input:not(:hidden, :button, [readonly])",F);A.edit.init_form_inputs(D);D.filter(".adddatameta-input").bind("fb-select",function(L,K){A.Debug.group("add_data_meta.begin",L,K);B("ul.filters-list :input[fb__adddatameta=true]",F).each(function(){if(B("> li:not(.plusbutton-template)",B(this).parents("ul.filters-list:first")).length>1){B(this).parent("li").remove()}});B(".matches-constraints-msg.conflict",F).removeClass("conflict").addClass("match");A.type.add_data.reset_topic_inputs(F);B(":input[fb__adddatameta=true]:disabled",F).removeAttr("disabled");var K=[];D.each(function(){K.push({name:B(this).attr("name"),value:B(this).val()})});A.edit.rewrite_and_filter_ajaxSubmit_data(K,F,false);A.type.get_form_inputs(["show","filter","filter_view"]).each(function(){K.push({name:B(this).attr("name"),value:B(this).val()})});var I=[{name:B(L.target).attr("name"),value:B(L.target).val()}];
A.edit.rewrite_and_filter_ajaxSubmit_data(I,F,false);K.push({name:"pivot",value:I[0].name});B(".add-data-input-label-container:first",F).addClass("progress");var J=B(":button.active:not(.diabled)",F).length!=0;A.activate(B.data(F[0],"save_buttons"),false);var H={url:F.attr("fb__adddatameta_url"),type:"post",data:K,error:A.error.default_error_handler,beforeSubmit:function(){A.disable(B.data(F[0],"save_buttons"),true);return true},complete:function(M,N){A.transaction_id.ajaxCompleteHandler(M,N);B(".add-data-input-label-container:first",F).removeClass("progress");A.disable(B.data(F[0],"save_buttons"),false);A.activate(B.data(F[0],"save_buttons"),J)},fb__form:F,success:A.type.add_data.meta_succesHandler};B.ajax(H);A.Debug.groupEnd("add_data_meta.begin",L,K)});function G(I){var H=B(I.target).parents("ul:first");B("> li",H).removeClass("filters-list-item-selected");B(I.target).parents("li.filters-list-item:first").addClass("filters-list-item-selected")}B("ul.filters-list",F).each(function(){var H=B(this);A.edit.plusminus_init(H);H.bind("listitemadded.fb",function(J,I){A.edit.init_form_inputs(B(":input:not(:hidden, :button)",I));B(":input",I).focus(G)})});B("ul > li.filters-list-item :input",F).focus(G);var C=A.edit.get_default_ajaxForm_submit_options(F);C._beforeSubmit=C.beforeSubmit;C._complete=C.complete;C.complete=function(I,H){C._complete.apply(this,[I,H]);A.disable(B.data(F[0],"save_buttons"),false);A.type.add_data.pending=null};C.beforeSubmit=function(J,I,H){if(A.type.add_data.pending){return false}A.type.add_data.pending=this;if(!C._beforeSubmit.apply(this,[J,I,H])){A.type.add_data.pending=null;return false}A.type.get_form_inputs(["show","filter","filter_view"]).each(function(){J.push({name:B(this).attr("name"),value:B(this).val()})});A.view.save_progress(B.data(I[0],"save_buttons"),"saving");A.disable(B.data(I[0],"save_buttons"),true);return true};C.success=function(J,K,L){B("> .add-data-submit-msg",F).remove();J=A.buffer_ajax_html_response(J);var M=B("> .add-data-submit-msg",J);B(".btn-close > a",M).click(function(N){M.remove()});F.prepend(M);A.type.filtertypeinstances.successHandler.apply(this,[B("> .xhr-response-root",J),K,L]);var I=M.attr("fb__id");var H=B(A.sprintf("> tbody > tr[fb__id=%s] > *",I),A.type.view.table.TABLE);A.type.fx.fadeIn_highlight(H,"filter-results-cell-animation",500,A.NO_OP);B(":input:enabled:not(:button,:hidden,.disabled-input)",F).each(function(){if(B(this).attr("fb__reset_on_add")=="true"){B(this).val("").removeAttr("fb__id").removeAttr("fb__name").removeAttr("fb__value")}else{if(B(this).is(":not(.topic-input)")){B(this).val(B(this).attr("fb__original_value"))}}});B("ul.filters-list",F).each(function(){var N=B("li.filters-list-item:not(:first, .plusbutton-template)",this);N.each(function(){if(B(":input[fb__reset_on_add=false]",this).length==0){B(this).remove()}});A.edit.plusminus_refresh(B(this))});A.type.add_data.reset_topic_inputs(F);B(".matches-constraints-msg.conflict",F).removeClass("conflict").addClass("match");B(":button[name=cancel]",F).html("Done");A.view.save_progress(B.data(F[0],"save_buttons"),null);A.activate(B.data(F[0],"save_buttons"),false);B(":text:not(:disabled):first",F).focus()};B(F).ajaxForm(C);B(":text:not(:disabled):first",F).focus();A.Debug.timeEnd("add_data.init_dialog");A.Debug.groupEnd("add_data.init_dialog")};A.type.add_data.reset_topic_inputs=function(C){B(".topic-input:disabled, .enum-input:disabled",C).each(function(){B(this).attr("fb__id",B(this).attr("fb__original_value"));B(this).val(B(this).attr("fb__original_display_value"));var D=B(this).prev(A.sprintf(":hidden[name^='%s']",B(this).attr("name")),C);D.val(B(this).attr("fb__original_value"))})};A.type.add_data.meta_succesHandler=function(C){A.Debug.group("add_data_meta.success");var E=this.fb__form;A.Debug.assertNotNull(E);var D=JSON.parse(C,null);A.Debug.assertEquals(D.code,"/api/status/ok");B.each(D.result,function(){var F=B(".add-data-inputs *[fb__pid_path="+this.pid_path.join(".")+"]",E);A.Debug.assertEquals(F.length,1);
A.Debug.log("processing ",this," in ",F);var I=B(".add-data-input-label-container[fb__pid_path="+this.pid_path.join(".")+"]",E);A.Debug.assertEquals(I.length,1);var H=this.data;var L=this.original_value_matches_criteria;function M(){var O=B(".matches-constraints-msg",I);if(L){O.removeClass("conflict").addClass("match")}else{O.addClass("conflict").removeClass("match")}}function K(P){A.Debug.log("applying data ",H," to ",P);P.attr(H);if(P.is(".topic-input:disabled, .enum-input:disabled")){A.Debug.assertInObject("fb__id",H);var O=P.prev(A.sprintf(":hidden[name^='%s']",P.attr("name")));O.val(H.fb__id)}}if(this.action=="prompt"){var N=B(":text",F);A.Debug.assertEquals(N.length,1);var G=A.view.show_message(N,this.message,"","error");B(G).addClass("add-data-meta-prompt");A.Debug.log(B("#use_original_value",G));B("#use_original_value",G).click(function(){M();K(N);return false});B("#use_candidate_value, #use_original_value",G).click(function(){A.view.hide_message(N);return false});N.focus()}else{if(this.action=="set"){var N=B(":text",F);A.Debug.assertEquals(N.length,1);K(N);M()}else{if(this.action=="insert"){var N=B("li.filters-list-item:not(.plusbutton-template) :text:not(:disabled)",F);if(N.length==1){A.Debug.assertEquals(N.parent("li").length,1,N);K(N);A.disable(B(".minusbutton",N.parent("li")))}else{var J=B(".filters-list",F);A.Debug.assertEquals(J.length,1);var N=B(":text",A.edit.create_list_item_for_nonunique_property(J));A.disable(B(".minusbutton",N.parent("li")));K(N)}M()}else{A.Debug.assert(false,this.action)}}}});A.Debug.groupEnd("add_data_meta.success")};A.type.remove_data.init_dialog=function(D){A.Debug.group("remove_data.init_dialog");A.Debug.time("remove_data.init_dialog");var E=B("form",D);E=A.edit.init_form(E,B("div.box-submit :button[type=submit][name=remove]",E),B(":button[name=cancel]",D).click(A.type.close_dialog));B(":checkbox",E).click(function(G){var F=B(":checkbox:checked",E).length!=0;A.activate(B.data(E[0],"save_buttons"),F);A.disable(B.data(E[0],"save_buttons"),!F)});A.activate(B.data(E[0],"save_buttons"),true);var C=A.edit.get_default_ajaxForm_submit_options(E);C.success=function(F,G,H){A.type.filtertypeinstances.successHandler(F,G,H);A.type.close_dialog({target:D})};B(E).ajaxForm(C);A.Debug.timeEnd("remove_data.init_dialog");A.Debug.groupEnd("remove_data.init_dialog")};A.type.show_query.init_dialog=function(C){A.Debug.group("fb.type.show_query.init_dialog");A.Debug.time("fb.type.show_query.init_dialog");B(":button[name=cancel]",C).click(A.type.close_dialog);A.Debug.timeEnd("fb.type.show_query.init_dialog");A.Debug.groupEnd("fb.type.show_query.init_dialog")};A.type.cotype_instances.init_dialog=function(E){A.Debug.group("fb.type.cotype_instances.init_dialog");A.Debug.time("fb.type.cotype_instances.init_dialog");B(":button[name=cancel]",E).click(A.type.close_dialog);var C=B("#cotypeinstances-box > form",E);C=A.edit.init_form(C,B(A.edit.DEFAULT_SAVE_SELECTOR,C),B([]),":input:not(:button)");var G=B(".topic-input",C);var I={service_url:"",type:G.attr("fb__ect"),category:"cotype",exclude_guids:G.attr("fb__exclude_guids"),suggest_new:"Create new type",required:"always"};B.data(G,"suggest_options",I);G.suggest(I).bind("fb-select",function(K,J){G.attr("fb__id",J.id);B("#cotype_select_new").addClass("hide").hide();A.activate(B.data(C[0],"save_buttons"),true)}).bind("fb-required",function(J){G.removeAttr("fb__id");B("#cotype_select_new").addClass("hide").hide();A.activate(B.data(C[0],"save_buttons"),false)}).bind("fb-select-new",function(K,J){G.removeAttr("fb__id").attr("fb__name",J);B("#cotype_new_type_name").text(J);B("#cotype_select_new").removeClass("hide").show();A.activate(B.data(C[0],"save_buttons"),true)});var F=B("#domain_chooser",E);A.domain_chooser.init(F);var H=function(K){var J=(A.domain_chooser.is_valid(F)&&G.attr("fb__name").length!=0);A.activate(B.data(C[0],"save_buttons"),J)};F.bind("change",H);F.bind("keyup",H);var D=A.edit.get_default_ajaxForm_submit_options(C);D.success=function(J){B("#cotypeinstances-box > .system-message",E).remove();
var K=A.buffer_ajax_html_response(J);B("#cotypeinstances-box",E).prepend(K);B("span.btn-close > a").click(function(L){K.remove()});B(":input:enabled:not(:button,:hidden)",C).val("");B(":button[name=cancel]",C).html("Done")};D.error=function(N,L,O){var K=A.error.expand_error_envelope(N,L,O);var M=false;var J=["/api/status/error/cotypeinstancessubmit/too_many_instances","/api/status/error/cotypeinstancessubmit/zero_instances","/api/status/error/cotypeinstancessubmit/cotype_already_included_type","/api/status/error/mql/access"];B.each(J,function(Q,P){if(K&&P in K){var R=K[P][0].message;if(P=="/api/status/error/mql/access"){R=A.view.PERMISSION_ERROR_MESSAGE}R=A.system_message.create(R,A.system_message.level.FAILURE);B("#cotypeinstances-box",E).prepend(R);M=true;return false}});if(!M){A.error.default_error_handler(N,L,O)}};C.ajaxForm(D);A.Debug.timeEnd("fb.type.cotype_instances.init_dialog");A.Debug.groupEnd("fb.type.cotype_instances.init_dialog")}})(jQuery,window.freebase);(function($,fb){fb.type=fb.type||{};fb.type.TYPE_FILTER_VIEW=$("#type-filter-view");fb.type.FILTER_FORM=$("#filter-form");fb.type.FILTERS=$("#filters");fb.type.FILTER_CRITERIA_CONTAINER=$("#filter-criteria-container");fb.type.FILTER_RESULTS_CONTAINER=$("#filter-results-container");fb.type.SAVE_VIEW_CONTAINER=$("#save-view-container");fb.type.DATA_VIEW_CONTROLS=$("#data-view-controls");fb.type.PRIMARY_NAME_PIDS=["/type/object/name","/type/object/id"];fb.type.ACCORDION_OPTIONS={active:":first",header:".ui-accordion-link",alwaysOpen:false,autoHeight:false,clearStyle:true,fillSpace:false};fb.type.FINGER_TABSET_OPTIONS={fx:{opacity:"toggle"}};fb.type.SORT_TIMEOUT_MESSAGE="There are too many items to sort on.  Try filtering the list first.";fb.type.FILTER_TIMEOUT_MESSAGE="That query was too hard and took too long.";fb.view.EDIT_BUTTON_HANDLERS["invite-edit-button"]=new fb.view.edit_button_handler("fb.invite.begin.init_edit",fb.view.EDIT_SCRIPTS.concat("src/invite.js"),{anchor_pos:"NW",overlay_pos:"NW"});fb.type.init=function(){$("#title > .article-container .article .toggler").click(fb.view.toggler_more_clickHandler);fb.type.init_quick_sort();$(["#link-add-data","#link-showquery","#link-cotype-instances","#link-to-view-link","#button-save-view-as"].join(",")).click(fb.type.dialog_anchor_clickHandler);var button_save_view=$("#save-view-container > form > .button-save-view");button_save_view.click(fb.type.save_view_clickHandler);$.each(["success.filtertypeinstances","success.addfiltercolumn","success.removefiltercolumn"],function(){fb.type.TYPE_FILTER_VIEW.bind(this,function(e){fb.activate(button_save_view,true)})});fb.type.view.instance().init();if($("#button-save-view-as").next().is(".prompt")){var prompt=$("#button-save-view-as").next();fb.view.show_message($("#button-save-view-as"),prompt.html(),prompt.attr("title"),"info")}};fb.type.init_inline_add_data=function(){if(fb_type_TYPE["/freebase/type_hints/enumeration"]){return }fb.Debug.group("type.init_inline_add_data");var add_data_inline=$("#add-data-inline",fb.type.FILTER_RESULTS_CONTAINER);var content=$("> .add-data-inline-content",add_data_inline);var toggles=$("> .toggle-inline-add, > #add-inline-title > .toggle-inline-add",add_data_inline);if(toggles.length==0){return }fb.Debug.assertEquals(toggles.length,2);toggles.unbind().click(function(e){var a=$(e.target).is("a")?$(e.target):$(e.target).parents("a.toggle-inline-add:first");fb.type.set_inline_add_expanded(!a.hasClass("toggle-inline-add-expanded"));return false});if($("> .toggle-inline-add",add_data_inline).hasClass("toggle-inline-add-expanded")&&!eval(content.attr("fb__initialized"))){fb.with_source_js(fb.view.EDIT_SCRIPTS,function(){fb.type.add_data.init_dialog(content.attr("fb__initialized","true"))})}fb.Debug.groupEnd("type.init_inline_add_data")};fb.type.init_quick_sort=function(){$("#link-sort-by").click(function(e){e.preventDefault();var anchor=$($(e.target).is("a")?e.target:$(e.target).parents("a:first"));fb.Debug.assert(anchor.is("#link-sort-by"));if(anchor.is(".disabled")){return false
}if(anchor.is(".popup-trigger-active")){fb.popup.popup_hide(anchor)}else{var inputs=$(fb.type.get_form_inputs(["sort","filter"]));fb.Debug.assertNotEquals(inputs.length,0);fb.Debug.assert(inputs.is("input"));fb.type.property_chooser.load(anchor,inputs,{expand_mediators:true},fb.type.get_type_ids(),"SE","NE")}return false}).bind("change.fb",function(e,selected,direction){fb.Debug.log("switching sort to ",selected.attr("name")," direction: ",direction);var sort=$(fb.type.get_form_inputs("sort"));sort.attr("name",selected.attr("name"));sort.val(direction);$("#link-sort-by").text(selected.text()).parent().addClass("loading");fb.type.filtertypeinstances.run({reset_page:true})})};fb.type.plot_point_picker_clickHandler=function(e){e.preventDefault();var anchor=$($(e.target).is("a")?e.target:$(e.target).parents("a:first"));fb.Debug.assert(anchor.is("#link-plot-points"));if(anchor.is(".disabled")){return false}fb.Debug.group("fb.type.plot_point_picker_clickHandler",e);if(anchor.is(".popup-trigger-active")){fb.popup.popup_hide(anchor)}else{var plot_input=$(fb.sprintf(":hidden[name^=show].%s",fb.type.view.instance().ID),anchor);fb.type.property_chooser.load(anchor,plot_input,{expand_mediators:true},fb.type.get_type_ids(),"SW","NW");anchor.unbind("change.fb").bind("change.fb",function(e,selected){fb.Debug.group("fb.type.plot_point_picker_clickHandler.change");fb.Debug.log("switching plot to ",selected.attr("name"));var show_inputs=fb.type.get_form_inputs("show");var plot_input=show_inputs.filter("."+fb.type.view.instance().ID);fb.Debug.log("removing plot ",plot_input);plot_input.remove();$.each(selected.attr("name").split(","),function(i,param_name){plot_input=$(fb.sprintf("<input type='hidden' name='%s' value='%s' class='%s'/>",this,show_inputs.length+1+i,fb.type.view.instance().ID));fb.type.FILTER_FORM.append(plot_input)});$("#link-plot-points").text(selected.text()).parent().addClass("loading");fb.type.filtertypeinstances.run({reset_page:true});fb.Debug.groupEnd("fb.type.plot_point_picker_clickHandler.change")})}fb.Debug.groupEnd("fb.type.plot_point_picker_clickHandler",e);return false};fb.type.get_form_inputs=function(prefixes){if(!prefixes){prefixes=["filter","show","sort","filter_view","filter_mode"]}if(typeof prefixes=="string"){prefixes=[prefixes]}var result=[];if($.inArray("filter",prefixes)>=0){result.push(fb.sprintf("#%s > .filter-criteria > :hidden[name^=filter]",fb.type.FILTER_CRITERIA_CONTAINER.attr("id")))}if($.inArray("show",prefixes)>=0){result.push(fb.sprintf("#%s > :hidden[name^=show]",fb.type.FILTER_FORM.attr("id")))}if($.inArray("sort",prefixes)>=0){result.push(fb.sprintf("#%s > :hidden.filter-sort-input",fb.type.FILTER_FORM.attr("id")))}$.each(["filter_view","filter_mode","domain"],function(i,param_name){if($.inArray(param_name,prefixes)>=0){result.push(fb.sprintf("#%s > :hidden[name=%s]",fb.type.FILTER_FORM.attr("id"),param_name))}});result=result.join(",");return $(result)};fb.type.get_user_criteria=function(){return $("> .filter-criteria:visible",fb.type.FILTER_CRITERIA_CONTAINER)};fb.type.get_filter_input_properties=function(input){fb.Debug.assert(input.is(":input"));var result={comparison:$(input).data("comparison"),type:$(input).data("criteria_type"),value:$.trim($(input).data("criteria_value")||$(input).val())};if($(input).is(".datetime-input, .int-input, .float-input")){var shortcut_comparison=$.trim(result.value).match(/^([><]=?|\!=)(.+)/);if(shortcut_comparison&&shortcut_comparison.length){fb.Debug.assertInArray(shortcut_comparison[1],[">",">=","<","<=","!="]);result.comparison=shortcut_comparison[1];result.value=$.trim(shortcut_comparison[2]);if($(input).is(".datetime-input")){result.value=$.datejs.parse(result.value).iso}}}return result};fb.type.set_configuring=function(configuring){fb.Debug.group("fb.type.set_configuring");if(!configuring){fb.Debug.assert($("#data-view-controls").is(":visible"));fb.type.FILTER_RESULTS_CONTAINER.removeClass("configuring")}else{fb.Debug.assert($("#data-view-controls").is(":not(:visible)"));
fb.type.FILTER_RESULTS_CONTAINER.addClass("configuring");var tac=$("> .type-accordion-container",fb.type.DATA_VIEW_CONTROLS);if(!$(tac).data("fb__initialized")){fb.type.property_selector.init(tac);$(".data-view-controls-btn-close",fb.type.DATA_VIEW_CONTROLS).click(function(e){fb.Debug.assert(fb.type.FILTER_RESULTS_CONTAINER.is(".configuring"));fb.type.set_configuring(false);return false});$("> .ui-accordion-container",tac).trigger("accordionchange");$(tac).data("fb__initialized",true)}}fb.Debug.groupEnd("fb.type.set_configuring")};fb.type.set_inline_add_expanded=function(expanded){fb.Debug.group("fb.type.set_inline_add_expanded");var add_data_inline=$("#add-data-inline",fb.type.FILTER_RESULTS_CONTAINER);var content=$("> .add-data-inline-content",add_data_inline);var toggles=$("> .toggle-inline-add, > #add-inline-title > .toggle-inline-add",add_data_inline);if(!expanded&&toggles.hasClass("toggle-inline-add-expanded")){toggles.removeClass("toggle-inline-add-expanded");content.addClass("hide")}else{if(expanded&&!toggles.hasClass("toggle-inline-add-expanded")){var user=fb.getUser();if(!user||!user.name){fb.error.render_signin(function(){fb.type.set_inline_add_expanded(true)})}else{toggles.addClass("toggle-inline-add-expanded");content.removeClass("hide");if(!eval(content.attr("fb__initialized"))){fb.with_source_js(fb.view.EDIT_SCRIPTS,function(){fb.type.add_data.init_dialog(content.attr("fb__initialized","true"))})}}}}fb.Debug.groupEnd("fb.type.set_inline_add_expanded")};fb.type.remove_filter_column=function(prop_path_id){fb.Debug.group("remove_filter_column");fb.Debug.time("remove_filter_column");$("#PROP_SELECTOR"+prop_path_id).removeClass("type-selector-prop-selected");var inputs=fb.type.get_form_inputs("show");inputs.filter("[fb__prop_path_id="+prop_path_id+"]").remove();inputs.filter("[fb__prop_path_id!="+prop_path_id+"]").each(function(i,v){$(v).val(i)});fb.type.view.instance().remove_filter_column(prop_path_id);fb.type.TYPE_FILTER_VIEW.trigger("success.removefiltercolumn");fb.Debug.timeEnd("remove_filter_column");fb.Debug.groupEnd("remove_filter_column")};fb.type.filtertypeinstances={};fb.type.filtertypeinstances.run=function(options){fb.Debug.group("type.filtertypeinstances.run");if(fb.type.filtertypeinstances.pending&&fb.type.filtertypeinstances.pending.readyState!=4){fb.Debug.log("aborting ",fb.type.filtertypeinstances.pending,fb.type.filtertypeinstances.pending.readyState);fb.type.filtertypeinstances.pending.abort();fb.type.filtertypeinstances.completeHandler(fb.type.filtertypeinstances.pending);fb.type.filtertypeinstances.pending=null}if(options.reset_page){$("> :hidden[name=page]",fb.type.FILTER_FORM).val(0)}var data=$.map(fb.type.FILTER_FORM[0].elements,function(e){return{name:$(e).attr("name"),value:($(e).is(".add-filter-value")?$(e).data("criteria_value"):$(e).val())}});data=$.makeArray(data);var ajax_options={success:fb.type.filtertypeinstances.successHandler,error:fb.type.filtertypeinstances.errorHandler,complete:fb.type.filtertypeinstances.completeHandler,data:data,type:"post",url:fb.type.FILTER_FORM.attr("action")};$.extend(ajax_options,options);fb.type.view.instance().add_filter_params_to_data.apply(ajax_options,[data]);fb.type.filtertypeinstances.pending=$.ajax(ajax_options);fb.Debug.groupEnd("type.filtertypeinstances.run");return ajax_options};fb.type.filtertypeinstances.errorHandler=function(xml_http_response,text_status,error_thrown){fb.Debug.group("filtertypeinstances.errorHandler");fb.Debug.time("filtertypeinstances.errorHandler");var messages=fb.error.expand_error_envelope(xml_http_response,text_status,error_thrown);if(messages&&"/api/status/error/mql/timeout" in messages){var loading=$("> thead > tr:gt("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") > th > .sort-th-loading",fb.type.view.table.TABLE);if($("#link-sort-by").parent().is(".loading")){loading=loading.add($("#link-sort-by"))}if($("#view-controls > .filter-results-pager").is(".loading")){loading=loading.add($("#view-controls > .filter-results-pager"))
}if(loading.length!=0){loading.each(function(){fb.view.show_message(this,fb.type.SORT_TIMEOUT_MESSAGE,"Sorry!","error")});loading.removeClass("loading")}else{loading=$("> thead > tr:eq("+fb.type.view.table.HEADER_ROW_INDEX.FILTER+") .medium-progress",fb.type.view.table.TABLE);loading=loading.parents("th, td");loading.each(function(index,cell){fb.view.show_message(cell,fb.type.FILTER_TIMEOUT_MESSAGE,"Sorry!","error");$(":input",cell).one("focus",function(){fb.view.hide_message(cell)})})}}else{fb.error.default_error_handler(xml_http_response,text_status,error_thrown)}fb.type.TYPE_FILTER_VIEW.trigger("error.filtertypeinstances");fb.Debug.timeEnd("filtertypeinstances.errorHandler");fb.Debug.groupEnd("filtertypeinstances.errorHandler")};fb.type.filtertypeinstances.successHandler=function(html_response,text_status){fb.Debug.group("filtertypeinstances.successHandler");fb.Debug.time("filtertypeinstances.successHandler");html_response=(typeof html_response=="string"?fb.buffer_ajax_html_response(html_response):html_response);$("#filter-results-total").replaceWith($("#filter-results-total",html_response));var pager=$(".filter-results-pager:first",html_response);$("#view-controls > .filter-results-pager").replaceWith(pager.clone());$("#filter-results-container > .filter-results-pager").replaceWith(pager.clone());$("> :hidden[name=page]",fb.type.FILTER_FORM).val($("> :hidden[name=page]",html_response).val());fb.type.get_form_inputs("show").remove();fb.type.FILTER_FORM.append($("> :hidden[name^=show]",html_response));fb.type.get_form_inputs("sort").remove();var new_sort=$("> :hidden.filter-sort-input",html_response);fb.type.FILTER_FORM.append(new_sort);var new_plot_picker=$("#link-plot-points-container",html_response);if(new_plot_picker.length){var plot_picker=$("#link-plot-points-container",fb.type.TYPE_FILTER_VIEW);plot_picker.html(new_plot_picker.contents().clone());new_plot_picker.remove()}var old_criteria=$("> .filter-criteria:not(.add-filter)",fb.type.FILTER_CRITERIA_CONTAINER);var new_criteria=$("> .filter-criteria-result > .filter-criteria",html_response);old_criteria.fadeOut("normal",function(){fb.type.FILTER_CRITERIA_CONTAINER.prepend(new_criteria);old_criteria.filter(":not(.filter-criteria-prototype)").remove();new_criteria.fadeIn("normal",function(){fb.type.TYPE_FILTER_VIEW.trigger("change.fb")})});$.suggest.cache={};var filtered_results=$("#filtered-results",html_response);fb.Debug.assertEquals(filtered_results.length,1);var new_filter_view=$("> :hidden[name=filter_view]",html_response).val();fb.Debug.assertNotNull(new_filter_view);var current_filter_view=$("#data-views .pressed").attr("fb__id");fb.Debug.assertNotNull(current_filter_view);if(new_filter_view!=current_filter_view){fb.Debug.log(fb.sprintf("switching from view %s to %s",current_filter_view,new_filter_view));$("> :hidden[name=filter_view]",fb.type.FILTER_FORM).val(new_filter_view);$("#type-filter-view").removeClass(current_filter_view).addClass(new_filter_view);$("> :not(#data-view-controls-container)",fb.type.FILTER_RESULTS_CONTAINER).remove();fb.type.FILTER_RESULTS_CONTAINER.append(filtered_results.contents());$("#data-views .pressed").removeClass("pressed");$("#data-views .data-view-link[fb__id="+new_filter_view+"]").addClass("pressed");$("#title .filter-view-name").text($("#data-views .pressed").text());var count_summary=$("#plotted-count-summary",fb.type.FILTER_RESULTS_CONTAINER);if(count_summary.length){$("#view-controls > #plotted-count-summary",fb.type.TYPE_FILTER_VIEW).replaceWith(count_summary.show())}fb.type.view.instance().init();fb.type.view.sync_container_height()}else{var old_add_inline=$("#add-data-inline",fb.type.FILTER_RESULTS_CONTAINER);if(old_add_inline.length==1){fb.Debug.assertInArray(current_filter_view,["table","gallery"]);var new_add_inline=$("#add-data-inline",filtered_results);fb.Debug.assertEquals(new_add_inline.length,1,"new_add_inline");fb.Debug.log("preserve_add_inline",this.preserve_add_inline,old_add_inline,new_add_inline);if(this.preserve_add_inline){$("#add-inline-title",old_add_inline).replaceWith($("#add-inline-title",new_add_inline))
}else{old_add_inline.replaceWith(new_add_inline);fb.type.init_inline_add_data()}}var unplottable_count_summary=$("#unplottable-count-summary",html_response);if(unplottable_count_summary.length){$("#view-controls > #plotted-count-summary > #unplottable-count-summary",fb.type.TYPE_FILTER_VIEW).replaceWith(unplottable_count_summary.show())}fb.type.view.instance().filtertypeinstances.successHandler.apply(this,[html_response])}if(fb.type.view.instance().get_data_ids().length==0){$("#link-sort-by").addClass("disabled");var user_criteria=fb.type.get_user_criteria();if(user_criteria.length==0){$("#link-add-columns").parent().addClass("disabled")}}else{$("#link-sort-by").removeClass("disabled");$("#link-add-columns").parent().removeClass("disabled")}html_response.remove();fb.type.TYPE_FILTER_VIEW.trigger("success.filtertypeinstances");fb.Debug.timeEnd("filtertypeinstances.successHandler");fb.Debug.groupEnd("filtertypeinstances.successHandler")};fb.type.filtertypeinstances.completeHandler=function(xml_http_response,text_status){fb.Debug.group("filtertypeinstances.completeHandler");fb.Debug.time("filtertypeinstances.completeHandler");fb.type.filtertypeinstances.pending=null;fb.transaction_id.ajaxCompleteHandler.apply(this,[xml_http_response,text_status]);fb.type.view.instance().filtertypeinstances.completeHandler.apply(this,[xml_http_response]);$("#link-sort-by").parent().removeClass("loading");$("#link-plot-points").parent().removeClass("loading");$("#image-filter-controls").removeClass("image-filter-controls-loading");$("#data-views").removeClass("loading");fb.type.TYPE_FILTER_VIEW.trigger("complete.filtertypeinstances");fb.Debug.timeEnd("filtertypeinstances.completeHandler");fb.Debug.groupEnd("filtertypeinstances.completeHandler")};fb.type.dialog_anchor_clickHandler=function(e){fb.Debug.group("type.dialog_anchor_clickHandler");e.stopPropagation();var anchor=$($(e.target).is("a, button")?e.target:$(e.target).parents("a:first"));var ajax_options={url:anchor.attr("fb__href"),type:"POST",cache:!DONT_CACHE_XHR,data:fb.type.FILTER_FORM.formSerialize()};ajax_options.complete=function(xml_http_response,text_status){anchor.parent().removeClass("loading");fb.transaction_id.ajaxCompleteHandler.apply(this,[xml_http_response,text_status])};ajax_options.error=fb.error.ajax_errorHandler(function(){anchor.trigger("click")});ajax_options.success=function(html_response){fb.type.dialog_successHandler(anchor,html_response,{"link-add-data":fb.type.add_data,"link-showquery":fb.type.show_query,"link-cotype-instances":fb.type.cotype_instances,"link-to-view-link":fb.type.link_to_page,"button-save-view-as":fb.type.save_view}[anchor.attr("id")])};if(anchor.is(":not(.disabled)")&&anchor.is(":not(.pressed)")){anchor.parent().addClass("loading");$.ajax(ajax_options)}fb.Debug.groupEnd("type.dialog_anchor_clickHandler");return false};fb.type.dialog_successHandler=function(anchor,html_response,dialog){fb.Debug.group("type.dialog_successHandler");anchor.addClass("pressed");var d=fb.dialog.create_dialog(anchor,html_response);fb.with_source_js(fb.view.EDIT_SCRIPTS,function(){if(dialog.BLOCK_UI){fb.dialog.show_with_block_ui(d)}else{fb.dialog.show_relative_to_anchor(d,anchor,dialog.ANCHOR_POS,dialog.OVERLAY_POS)}dialog.init_dialog(d)});fb.Debug.groupEnd("type.dialog_successHandler")};fb.type.exporttypeinstances_clickHandler=function(e){fb.Debug.group("type.exporttypeinstances_clickHandler");e.stopPropagation();var anchor=$($(e.target).is("a, button")?e.target:$(e.target).parents("a:first"));var form=$("<form/>");form.attr({method:"get",action:anchor.attr("fb__href"),style:"display: none"});form.append($(":input",fb.type.FILTER_FORM).clone());form.append($("<input/>").attr({type:"hidden",name:"exporttype",value:anchor.attr("fb__exporttype")}));$(document.body).append(form);form.submit();fb.Debug.groupEnd("type.exporttypeinstances_clickHandler");return false};fb.type.remove_data_clickHandler=function(e){fb.Debug.group("type.remove_data_clickHandler");e.stopPropagation();var anchor=$(e.target).is("a")?$(e.target):$(e.target).parents("a:first");
var data={};fb.type.get_form_inputs().each(function(){data[$(this).attr("name")]=$(this).val()});data.topic_id=TOPIC.id;var ajax_options={type:"POST",cache:!DONT_CACHE_XHR,url:anchor.attr("fb__href"),data:data,success:function(html_response){fb.type.dialog_successHandler(anchor,html_response,fb.type.remove_data)},complete:function(xml_http_response,text_status){anchor.removeClass("loading");fb.transaction_id.ajaxCompleteHandler(xml_http_response,text_status)},error:fb.error.ajax_errorHandler(function(){anchor.addClass("loading");$.ajax(ajax_options)})};if(anchor.is(":visible")){anchor.addClass("loading");$.ajax(ajax_options)}fb.Debug.group("type.remove_data_clickHandler");return false};fb.type.filter_clickHandler=function(e){fb.Debug.group("fb.type.filter_clickHandler");e.stopPropagation();fb.type.filtering.init();fb.Debug.groupEnd("fb.type.filter_clickHandler");return false};fb.type.data_view_controls_toggle_clickHandler=function(e){fb.Debug.group("data_view_controls_toggle_clickHandler");fb.type.set_configuring(true);fb.Debug.groupEnd("data_view_controls_toggle_clickHandler");return false};fb.type.data_view_clickHandler=function(e){var new_filter_view=$(this).attr("fb__id");if($(e.target).hasClass("pressed")||$(e.target).hasClass("disabled")){return false}$("> :hidden[name=filter_view]",fb.type.FILTER_FORM).val(new_filter_view);$("#data-views").addClass("loading");fb.type.filtertypeinstances.run({reset_page:true});return false};fb.type.type_popup_clickHandler=function(e){var message=$("#type-popup-message");if(message.is(":visible")){message.hide().shadowDestroy()}else{fb.popup.position($(e.target),$(message),"NW","SW",{top:-5});message.show();if(message.is(":not([fb__initialized])")){$(".article .toggler",message).click(fb.view.toggler_more_clickHandler);$(".fb-message-close",message).click(function(e){e.preventDefault();message.hide().shadowDestroy();return false});message.attr("fb__initialized",true)}}return false};fb.type.save_view_clickHandler=function(e){if($("#save-view-container").is(".loading")){return false}fb.Debug.group("type.save_view_clickHandler");var form=$(e.target).parent("form");fb.Debug.assertEquals(form.length,1);var data=$.map(fb.type.get_form_inputs().add($("> :input[type=hidden]",form)),function(e){return{name:$(e).attr("name"),value:$(e).val()}});var ajax_options={url:$(form).attr("action"),data:data,type:"post",cache:false,error:fb.type.save_view_errorHandler,complete:function(xml_http_response,text_status){$("#save-view-container").removeClass("loading");fb.transaction_id.ajaxCompleteHandler(xml_http_response,text_status)},success:function(response_text,text_status){var result=JSON.parse(response_text,null);fb.Debug.assertEquals(result.code,"/api/status/ok");fb.Debug.log(fb.sprintf("Saved %s",result.saved_view.name));fb.activate($(e.target),false)}};$("#save-view-container").addClass("loading");$.ajax(ajax_options);fb.Debug.groupEnd("type.save_view_clickHandler");return false};fb.type.save_view_errorHandler=function(xml_http_response,text_status,error_thrown){fb.Debug.group("type.save_view_errorHandler");var messages=fb.error.expand_error_envelope(xml_http_response,text_status,error_thrown);if(messages&&"/api/status/error/exists" in messages){fb.view.show_message(name_input,messages["/api/status/error/exists"][0].message,"Sorry!","error")}else{if(messages&&"401" in messages){fb.error.render_signin()}else{fb.type.filtertypeinstances.errorHandler(xml_http_response,text_status,error_thrown)}}fb.Debug.groupEnd("type.save_view_errorHandler")};fb.type.get_type_ids=function(accordion){accordion=accordion||$("> .type-accordion-container:first",fb.type.DATA_VIEW_CONTROLS);fb.Debug.assertEquals(accordion.length,1);var result=$("> .ui-accordion-container > li[fb__tid]",accordion).map(function(){return $(this).attr("fb__tid")});return $.makeArray(result)};fb.type.property_selector={};fb.type.property_selector.init=function(container){fb.Debug.group("property_selector.init");$(".ui-accordion-container",container).accordion(fb.type.ACCORDION_OPTIONS);
$(".ui-accordion-container",container).bind("accordionchange",function(event,ui){fb.Debug.group("fb.type.property_selector.init.accordionchange",event,ui);fb.doLater(null,fb.type.view.sync_container_height,100);if(ui&&ui.newHeader.length&&$(document).scrollTop()>$(ui.newHeader).offset().top){$(document).scrollTop($(ui.newHeader).offset().top)}fb.Debug.groupEnd("fb.type.property_selector.init.accordionchange",event,ui)});$(".ui-accordion-container > li[fb__initialized=false] > a.ui-accordion-link",container).mousedown(function(e){var panel=$(e.target).parent();if(eval(panel.attr("fb__initialized"))){return }var params={};$.each(fb.type.get_form_inputs("show"),function(){params[$(this).attr("name")]=$(this).val()});var ajax_options={type:"GET",data:params,cache:!DONT_CACHE_XHR,url:$(e.target).attr("fb__href")};var progress_decoy=$("<div class='type-selector-properties medium-progress'></div>");$(".type-selector-properties",panel).replaceWith(progress_decoy);ajax_options.success=function(html_response){fb.Debug.group("fb.type.property_selector.init.mousedown.success");html_response=fb.buffer_ajax_html_response(html_response);html_response=$(".type-selector-properties",$(html_response));$(".type-selector-properties",panel).replaceWith(html_response).removeClass("medium-progress");panel.attr("fb__initialized",true);fb.Debug.groupEnd("fb.type.property_selector.init.mousedown.success")};$.ajax(ajax_options)});var exclude_guids=$(".type-selector-type[fb__type_guid]",container).map(function(){return $(this).attr("fb__type_guid")});var suggest_options={service_url:"",type:"/type/type",category:"cotype",exclude_guids:$.makeArray(exclude_guids).join(",")};var input=$(".type-selector-other-container .topic-input",container);$(input).suggest(suggest_options).bind("fb-select",function(e,data){$.ajax({type:"GET",cache:!DONT_CACHE_XHR,url:fb.sprintf($(input).attr("fb__loadpropertyselector_url"),data.id),success:function(html_response){html_response=fb.buffer_ajax_html_response(html_response);fb.Debug.assert(html_response.is(".type-selector-type"));fb.type.property_selector.append_panels(html_response,html_response);input.val("");var tids=suggest_options.exclude_guids.split(",");tids.push(html_response.attr("fb__type_guid"));suggest_options.exclude_guids=tids.join(",")}})});fb.Debug.groupEnd("property_selector.init")};fb.type.property_selector.append_panels=function(panels,selected_panel){fb.Debug.group("fb.type.property_selector.append_panels",panels,selected_panel);var container=$("> .type-accordion-container:visible > .ui-accordion-container",fb.type.DATA_VIEW_CONTROLS);container.accordion("destroy");container.append(panels);var options={};$.extend(options,fb.type.ACCORDION_OPTIONS,{active:".selected"});container.accordion(options);function highlight_callback(){if(selected_panel){var selected_index=$(".type-selector-type",container).index(selected_panel);container.accordion("activate",selected_index)}}highlight_callback();fb.Debug.groupEnd("fb.type.property_selector.append_panels",panels,selected_panel)};fb.type.property_selector.more_clickHandler=function(e){var anchor=$(e.target).is("a")?$(e.target):$(e.target).parents("a:first");if(anchor.hasClass("disabled")){return false}var accordion=anchor.parents(".type-accordion-container:first");fb.Debug.assertEquals(accordion.length,1);var data={tids:fb.type.get_type_ids(accordion).join(fb.PARAM_DELIM)};fb.type.get_form_inputs("show").each(function(){data[$(this).attr("name")]=$(this).val()});anchor.addClass("loading");var ajax_options={data:data,url:anchor.attr("fb__href"),success:function(html_response){html_response=fb.buffer_ajax_html_response(html_response);if(html_response.length){fb.Debug.assert(html_response.is(".ui-accordion-container"),"unexpected response class",html_response);var panels=$("> .type-selector-type",html_response);if(panels.length){fb.type.property_selector.append_panels(panels,null)}}$(".type-selector-other-container",accordion).removeClass("hide");$(">.ui-accordion-container",accordion).trigger("accordionchange");
html_response.remove()},complete:function(xml_http_response,text_status){$(".link-type-selector-more",accordion).removeClass("loading").remove();fb.transaction_id.ajaxCompleteHandler(xml_http_response,text_status)},cache:!DONT_CACHE_XHR,error:fb.error.default_error_handler};$.ajax(ajax_options);return false};fb.type.property_selector.prop_clickHandler=function(e){if($(this).hasClass("type-selector-prop-selected")||$(this).hasClass("type-selector-prop-mediator")){return false}fb.Debug.group("property_selector.prop_clickHandler");fb.Debug.assert($(this).is("a.type-selector-prop"));fb.Debug.assert($(this).parent().is("li"));$(this).parent().addClass("loading");var col_input_name=$(this).parent("li[fb__input_name]").attr("fb__input_name");var topic_ids=(($.inArray(fb.type.view.instance().ID,[fb.type.view.table.ID,fb.type.view.gallery.ID])!=-1)?fb.type.view.instance().get_data_ids():[]);fb.type.add_filter_column(col_input_name,topic_ids);fb.Debug.groupEnd("property_selector.prop_clickHandler");return false};fb.type.property_selector.pivot_clickHandler=function(e){fb.Debug.group("property_selector.pivot_clickHandler");fb.Debug.assert($(this).is("a.type-selector-prop-pivot"));fb.Debug.assert($(this).parent().is("li"));$(this).parent().addClass("loading");var pid_path=$.map($(this).parents("li[fb__pid]"),function(n,i){return $(n).attr("fb__pid")});pid_path=pid_path.reverse();var col_input_name=$(this).parent("li[fb__input_name]").attr("fb__input_name");var params={pid_path:pid_path.join("."),expand_mediators:false};$.each(fb.type.get_form_inputs(["show","filter","filter_view"]),function(){params[$(this).attr("name")]=$(this).val()});var type_accordion_container=$(this).parents(".type-accordion-container:first");var ajax_options={cache:false,data:params,type:"POST",url:type_accordion_container.attr("fb__loadpropertyselector_url"),success:function(html_response,text_status){fb.Debug.group("property_selector.pivot.successHandler");html_response=fb.buffer_ajax_html_response(html_response);var prop_accordion_container=$(html_response);fb.Debug.assertEquals(prop_accordion_container.length,1);fb.Debug.assert(prop_accordion_container.is(".type-accordion-container"));fb.type.property_selector.init(prop_accordion_container);function build_fx_wrapper(fx_wrapper_left){var fx_wrapper=$("<div id='fx_wrapper'/>");$(fb.type.DATA_VIEW_CONTROLS).append(fx_wrapper);fx_wrapper.append(type_accordion_container.show());fx_wrapper.append(prop_accordion_container.css({position:"absolute",top:0,left:$(type_accordion_container).outerWidth()+"px"}));fx_wrapper.css({position:"relative",left:fx_wrapper_left,top:0,width:(2*$(type_accordion_container).outerWidth())+"px",height:Math.max(prop_accordion_container.outerHeight(),type_accordion_container.outerHeight())+"px"});return fx_wrapper}$(build_fx_wrapper(0)).animate({left:-$(type_accordion_container).outerWidth()+"px"},500,"linear",function(){type_accordion_container.hide();$(this).replaceWith($(this).contents().css({position:"static",left:"auto",top:"auto"}))});$("> .type-accordion-prop-path > .type-selector-prop-unpivot",prop_accordion_container).click(function(){$(build_fx_wrapper(-$(type_accordion_container).outerWidth())).animate({left:0},500,"linear",function(){prop_accordion_container.remove();$(this).replaceWith(type_accordion_container.css({position:"static",left:"auto",top:"auto"}))})});fb.Debug.groupEnd("property_selector.pivot.successHandler")},complete:function(xml_http_response,text_status){fb.Debug.group("property_selector.pivot.completeHandler");fb.transaction_id.ajaxCompleteHandler(xml_http_response,text_status);var li=$(fb.sprintf("li[fb__input_name=%s].loading",col_input_name),type_accordion_container);fb.Debug.assertEquals(li.length,1,li);li.removeClass("loading");fb.Debug.groupEnd("property_selector.pivot.completeHandler")}};$.ajax(ajax_options);fb.Debug.groupEnd("property_selector.pivot_clickHandler");return false};fb.type.add_filter_column=function(show_input_name,topic_ids){var params={};if(topic_ids.length!=0){params.topic_ids=topic_ids.join(fb.PARAM_DELIM)
}$.each(fb.type.get_form_inputs(["show","filter","filter_view"]),function(){params[$(this).attr("name")]=$(this).val()});params[show_input_name]="new";var ajax_options={cache:false,data:params,type:"POST",url:fb.type.FILTER_FORM.attr("fb__addfiltercolumn_url"),success:function(html_response,text_status){fb.Debug.group("addfiltercolumn_successHandler");html_response=fb.buffer_ajax_html_response(html_response);fb.type.get_form_inputs("show").remove();fb.type.FILTER_FORM.append($("> :hidden",html_response));fb.type.get_form_inputs("show").each(function(){var prop_path_id=$(this).attr("fb__prop_path_id");$("#PROP_SELECTOR"+prop_path_id).addClass("type-selector-prop-selected")});fb.type.view.instance().addfiltercolumn_successHandler(html_response,text_status);fb.type.TYPE_FILTER_VIEW.trigger("success.addfiltercolumn");html_response.remove();fb.Debug.groupEnd("addfiltercolumn_successHandler")},complete:function(xml_http_response,text_status){fb.transaction_id.ajaxCompleteHandler(xml_http_response,text_status);var li=$(fb.sprintf("> .type-accordion-container li[fb__input_name=%s].loading",show_input_name),fb.type.DATA_VIEW_CONTROLS);fb.Debug.assertEquals(li.length,1,li);li.removeClass("loading")}};return $.ajax(ajax_options)};fb.type.view=fb.type.view||{};fb.type.view.instance=function(){return fb.type.view[$("> :hidden[name=filter_view]",fb.type.FILTER_FORM).val()]};fb.type.view.pager_clickHandler=function(e){fb.Debug.assert($(e.target).is("a"));if(!$(e.target).hasClass("disabled")){var pager=$(e.target).parent(".filter-results-pager");pager.addClass("loading");var new_page=$(e.target).attr("fb__page");$("> :hidden[name=page]",fb.type.FILTER_FORM).val(new_page);fb.type.TYPE_FILTER_VIEW.one("success.filtertypeinstances",function(e){fb.Debug.log("pager_clickHandler.success",e);if($(document).scrollTop()>fb.type.TYPE_FILTER_VIEW.offset().top){$(document).scrollTop(fb.type.TYPE_FILTER_VIEW.offset().top)}});fb.type.TYPE_FILTER_VIEW.one("complete.filtertypeinstances",function(e){fb.Debug.log("pager_clickHandler.complete",e);pager.removeClass("loading")});fb.type.filtertypeinstances.run({reset_page:false})}return false};fb.type.view.open_view_in_new_window=function(uri,input_filter){fb.Debug.group("type.open_view_in_new_window");var form=$(fb.sprintf("<form action='%s' target='_new' method='post' class='hide'/>",uri));form.append(input_filter(fb.type.get_form_inputs().clone()));$(document.body).append(form);form.submit();form.remove();fb.Debug.groupEnd("type.open_view_in_new_window")};fb.type.view.unplottable_clickHandler=function(e){fb.Debug.group("view.unplottable_clickHandler");fb.type.view.open_view_in_new_window($(e.target).attr("fb__href"),function(inputs){inputs=inputs.add($("> :hidden",e.target).clone());inputs.filter(":hidden[name=filter_view]").val(fb.type.view.table.ID);return inputs});fb.Debug.groupEnd("view.unplottable_clickHandler")};fb.type.view.set_plotted_visible_count=function(count){fb.Debug.group("view.set_plotted_visible_count");var visible_count=$("#view-controls > #plotted-count-summary > #visible-topics-count",fb.type.TYPE_FILTER_VIEW);fb.Debug.assertEquals(visible_count.length,1,visible_count);visible_count.text(count);fb.Debug.groupEnd("view.set_plotted_visible_count")};fb.type.view.load_info_bubble=function(topic_ids,plot_point_value,info_bubble_url,success_handler){fb.Debug.log("load_info_bubble",topic_ids),plot_point_value;var urlparams=[];fb.type.get_form_inputs(["show","filter","filter_view"]).each(function(){urlparams.push({name:$(this).attr("name"),value:$(this).val()})});urlparams.push({name:"topic_ids",value:$.makeArray(topic_ids).join(fb.PARAM_DELIM)});if(plot_point_value){urlparams.push({name:"plot_point_value",value:plot_point_value})}fb.Debug.log(urlparams);var ajax_options={url:info_bubble_url,type:"post",cache:!DONT_CACHE_XHR,data:urlparams,success:function(html_response){var html_response=fb.buffer_ajax_html_response(html_response);$(".info-bubble-thumbnail-more",html_response).click(function(e){var info_bubble=$(e.target).parents("#info-bubble:first");
var id=$(e.target).parents(".info-bubble-thumbnail:first").attr("fb__id");$(".info-bubble-thumbnail-container",info_bubble).hide();$("> .info-bubble-count-summary > .info-bubble-thumbnail-less",info_bubble).show();$("> .info-bubble-item[fb__id="+id+"]",info_bubble).removeClass("hide").show()});$("> .info-bubble-count-summary > .info-bubble-thumbnail-less",html_response).click(function(e){$(e.target).hide();$("> .info-bubble-item",html_response).hide();$(".info-bubble-thumbnail-container",html_response).show()});$(".info-bubble-view-all",html_response).click(function(e){fb.type.view.open_view_in_new_window($(e.target).attr("fb__href"),function(inputs){inputs=inputs.add($("> :hidden",e.target).clone());inputs.filter(":hidden[name=filter_view]").val(fb.type.view.gallery.ID);return inputs})});success_handler(html_response)}};$.ajax(ajax_options)};fb.type.view.sync_container_height=function(){fb.Debug.group("fb.type.view.sync_container_height");var container_height=fb.type.DATA_VIEW_CONTROLS.outerHeight();fb.Debug.log("setting filter_result_container height to ",container_height);fb.type.FILTER_RESULTS_CONTAINER.css("min-height",container_height);fb.Debug.groupEnd("fb.type.view.sync_container_height")};fb.type.filtering={};fb.type.filtering.init=function(){if($(document.body).is(".filtering")){return }fb.Debug.group("fb.type.filtering.init");$("#title #page-title *:not(.filtering), #page-tools, #view-info").fadeOut("normal",function(){$("#title .page-title-content.filtering").fadeIn()});$("#filters-wrapper").slideUp("slow",function(){$(document.body).toggleClass("filtering").toggleClass("exploring");$("#filters-wrapper").slideDown("slow",function(){fb.with_source_js(fb.view.EDIT_SCRIPTS,function(){fb.type.TYPE_FILTER_VIEW.trigger("change.fb")})})});fb.Debug.groupEnd("fb.type.filtering.init")};fb.type.filtering.remove_filter_clickHandler=function(e){fb.Debug.group("fb.type.filtering.remove_filter_clickHandler",e);var fc=$(e.target).parents(".filter-criteria:first");var hidden=$(":hidden",fc);fb.Debug.assertEquals(fc.length,1);fb.Debug.assertEquals(hidden.length,1);hidden.remove();fc.addClass("filter-criteria-removing");fb.type.filtertypeinstances.run({reset_page:true,error:function(xml_http_response,text_status,error_thrown){fb.Debug.group("fb.type.filtering.remove_filter_clickHandler.error");fc.append(hidden).removeClass("filter-criteria-removing");fb.type.filtertypeinstances.errorHandler.apply(this,[xml_http_response,text_status,error_thrown]);fb.Debug.groupEnd("fb.type.filtering.remove_filter_clickHandler.error")}});fb.Debug.groupEnd("fb.type.filtering.remove_filter_clickHandler",e);return false};fb.type.filtering.append_chiclet=function(pid_path,prop_names,criteria_type,comparison,value){fb.Debug.group("fb.type.filtering.chiclet.create");fb.Debug.log("pid_path",pid_path,"prop_names",prop_names,"criteria_type",criteria_type,"comparison",comparison,"value",value);var add_filter_li=$("li.add-filter:first",fb.type.FILTER_FORM);var fc_prototype=add_filter_li.prev(".filter-criteria-prototype:first");fb.Debug.assertEquals(add_filter_li.length,1);fb.Debug.assertEquals(fc_prototype.length,1);var chiclet=fc_prototype.clone();fc_prototype.before(chiclet.hide());fb.Debug.assertEquals(prop_names.length,pid_path.length);if($.inArray(pid_path[pid_path.length-1],fb.type.PRIMARY_NAME_PIDS)+1){prop_names.pop()}$(".criteria-prop-path",chiclet).text(prop_names.join(" \xbb "));$(".criteria-comparison",chiclet).text(fb.sprintf("%s %s",{id:"name",name:"name",value:"value"}[criteria_type],comparison));$(".criteria-value",chiclet).text(value);fb.Debug.groupEnd("fb.type.filtering.chiclet.create");return chiclet};fb.type.filtering.submitHandler=function(e){fb.Debug.group("fb.type.filtering.submitHandler",e);fb.Debug.assert($(e.target).is(":button[type=submit], form"));var add_filter_li=$("li.add-filter:first",fb.type.FILTER_FORM);var rows=$("tbody > tr:not(.active-prop-breadcrumb)",add_filter_li);fb.Debug.assertEquals(add_filter_li.length,1);fb.Debug.assertNotEquals(rows.length,0);
var chiclets=rows.map(function(){var prop_path=$("> td.prop-path .advanced-find-prop:last",this);var comparison=$("> td.comparison .comparison-select",this);var value=$("> td.value :text",this);fb.Debug.assertEquals(prop_path.length,1);fb.Debug.assertEquals(comparison.length,1);fb.Debug.assertEquals(value.length,1);var prop_names=JSON.parse(prop_path.attr("fb__prop_names"));var pid_path=fb.type.filtering.get_pid_path(prop_path);var chiclet=fb.type.filtering.append_chiclet(pid_path,prop_names,$(value).data("criteria_type"),$(comparison).text(),$(value).val());return chiclet[0]});chiclets.add(add_filter_li).slideToggle();var options={reset_page:true,error:function(xml_http_response,text_status,error_thrown){fb.Debug.group("fb.type.filtering.submitHandler.error");fb.type.filtertypeinstances.errorHandler.apply(this,[xml_http_response,text_status,error_thrown]);fb.Debug.groupEnd("fb.type.filtering.submitHandler.error")},complete:function(xml_http_response,text_status){fb.Debug.group("fb.type.filtering.submitHandler.complete");fb.type.filtertypeinstances.completeHandler.apply(this,[xml_http_response,text_status]);fb.Debug.groupEnd("fb.type.filtering.submitHandler.complete")},success:function(xml_http_response,text_status){fb.Debug.group("fb.type.filtering.submitHandler.success");$("#add-filter-trigger",fb.type.FILTERS).fadeIn();fb.type.TYPE_FILTER_VIEW.trigger("change.fb");fb.type.filtering._reset(add_filter_li);fb.type.filtertypeinstances.successHandler.apply(this,[xml_http_response,text_status]);fb.Debug.groupEnd("fb.type.filtering.submitHandler.success")}};fb.type.filtertypeinstances.run(options);fb.Debug.groupEnd("fb.type.filtering.submitHandler");return false};fb.type.filtering._reset=function(add_filter_li){fb.Debug.group("fb.type.filtering._reset",add_filter_li);fb.Debug.assertEquals(add_filter_li.length,1);add_filter_li.removeData("branch.prototype").removeData("branch.pid_path");var table=$("table",add_filter_li);table.removeClass("prop-path-breadcrumb-active");$("> tbody > tr:gt(1)",table).remove();var value=$("td.value :input",table);value.attr("name","").val("").removeData("criteria_value").removeData("criteria_type");var prop_path=$("td.prop-path .advanced-find-prop:last",table);var comparison=$("td.comparison .comparison-select",table);prop_path.add(comparison).remove();$("td.buttons > *",table).show();fb.Debug.groupEnd("fb.type.filtering._reset",add_filter_li)};fb.type.filtering.resetHandler=function(e){fb.Debug.group("fb.type.filtering.resetHandler",e);fb.Debug.assert($(e.target).is(":button"));var add_filter_li=$(e.target).parents("li.add-filter:first");var trigger=$("#add-filter-trigger",fb.type.FILTERS);fb.Debug.assertEquals(add_filter_li.length,1);fb.Debug.assertEquals(trigger.length,1);add_filter_li.fadeOut("normal",function(){fb.type.filtering._reset(add_filter_li);trigger.fadeIn("normal");fb.type.TYPE_FILTER_VIEW.trigger("change.fb")});fb.Debug.groupEnd("fb.type.filtering.resetHandler");return true};fb.type.filtering.prop_select_clickHandler=function(e){fb.Debug.group("filtering.prop_selector_clickHandler");e.preventDefault();var anchor=$($(e.target).is("a")?e.target:$(e.target).parents("a:first"));fb.Debug.assert(anchor.is(".advanced-find-prop"));if(anchor.is(":not(.disabled)")){if(anchor.is(".popup-trigger-active")){fb.popup.popup_hide(anchor)}else{var type_id=anchor.attr("fb__schema_id");var type_ids=(type_id==fb_type_TYPE.id?fb.type.get_type_ids():[type_id]);fb.type.property_chooser.load(anchor,anchor,{load_included_types:type_id!=fb_type_TYPE.id,load_correlated_types:type_id!=fb_type_TYPE.id},type_ids,"SW","NW");anchor.bind("change.fb",fb.type.filtering.prop_selector_changeHandler)}}fb.Debug.groupEnd("filtering.prop_selector_clickHandler");return false};fb.type.filtering.prop_selector_changeHandler=function(e,selected){fb.Debug.group("filtering.prop_selector_changeHandler",selected);var prop_selector=$(e.target);fb.Debug.assert(prop_selector.is(".advanced-find-prop"));fb.Debug.assert(selected.is("a"));var add_filter_li=$("#filters li.add-filter:last");
fb.Debug.assertEquals(add_filter_li.length,1);var trigger=$(prop_selector).parents("#add-filter-trigger");var row=$("tbody > tr:last",add_filter_li);if(!trigger.length){row=$(prop_selector).parents("tr:first")}else{prop_selector=prop_selector.clone().removeClass("popup-trigger-active");prop_selector.attr("fb__pid_prefix",fb.new_id());$("> td.prop-path",row).html(prop_selector);$("td.buttons > *",row).show();fb.type.filtering._bind_row_event_handlers(row);trigger.fadeOut("normal",function(){add_filter_li.fadeIn("normal");fb.type.TYPE_FILTER_VIEW.trigger("change.fb")})}fb.Debug.assertEquals(row.length,1);prop_selector.text(selected.text()).attr({name:selected.attr("name"),fb__prop_names:selected.attr("fb__prop_names"),fb__ect_id:selected.attr("fb__ect_id"),fb__ect_name:selected.attr("fb__ect_name"),fb__ect_mediator:selected.attr("fb__ect_mediator")=="true",fb__ect_enumeration:selected.attr("fb__ect_enumeration")=="true",fb__value:selected.attr("fb__value")});if(!fb.type.filtering.is_terminal_prop(prop_selector)){var next_prop_selectors=selected.next(".filter-prop-next");fb.Debug.assertEquals(next_prop_selectors.length,1);var next_prop_selectors=$("> .advanced-find-prop",next_prop_selectors);fb.Debug.assertNotEquals(next_prop_selectors.length,0);next_prop_selectors.attr("fb__pid_prefix",prop_selector.attr("fb__pid_prefix"));prop_selector=next_prop_selectors}$("> td.prop-path",row).html(prop_selector);fb.type.filtering._update_prop_breadcrumb(row);prop_selector=prop_selector.filter(":last");row.trigger({type:"change-prop_path"},[prop_selector]);fb.Debug.groupEnd("filtering.prop_selector_changeHandler",selected)};fb.type.filtering.prop_path_changeHandler=function(e,prop_path){fb.Debug.group("fb.type.filtering.prop_path_changeHandler");var target=$("> td.comparison",$(e.target));fb.Debug.log("loading comparison selector for ",prop_path," into ",target);var prototypes=$("#comparison-select-prototypes");var selector={"/type/float":"number","/type/int":"number","/type/datetime":"datetime","/type/boolean":"boolean","/type/text":"text"}[prop_path.attr("fb__ect_id")];if(!selector){selector=(eval(prop_path.attr("fb__ect_enumeration"))?"enumeration":"text")}var result=$("> .comparison-select."+selector,prototypes);result=result.add(result.next(".popup-body")).clone();fb.Debug.assertEquals(result.length,2);target.html(result);$(e.target).trigger({type:"change-comparison"},["="]);fb.Debug.groupEnd("fb.type.filtering.prop_path_changeHandler");return $(result[0])};fb.type.filtering.comparison_chooser_clickHandler=function(e){fb.Debug.group("filtering.comparison_chooser_clickHandler");e.preventDefault();var anchor=$($(e.target).is("a")?e.target:$(e.target).parents("a:first"));fb.Debug.assert(anchor.is(".comparison-select"));if(anchor.is(":not(.disabled)")){if(anchor.is(".popup-trigger-active")){fb.popup.popup_hide(anchor)}else{var body=anchor.next(".popup-body");fb.popup.position(anchor,body,"SW","NW");fb.popup.popup_show(anchor);fb.type.property_chooser.init_dialog(body);anchor.bind("change.fb",fb.type.filtering.comparison_chooser_selectHandler)}}fb.Debug.groupEnd("filtering.comparison_chooser_clickHandler");return false};fb.type.filtering.comparison_chooser_selectHandler=function(e,selected){fb.Debug.group("fb.type.filtering.comparison_chooser_selectHandler");var comparison=$(e.target);fb.Debug.assert(comparison.is(".comparison-select"));if(comparison.attr("fb__value")!=selected.attr("fb__value")){comparison.text(selected.text()).attr("fb__value",selected.attr("fb__value"));var row=$(e.target).parents("tr:first");row.trigger({type:"change-comparison"},[comparison.attr("fb__value")])}fb.Debug.groupEnd("fb.type.filtering.comparison_chooser_selectHandler")};fb.type.filtering.comparison_changeHandler=function(e,comparison){fb.Debug.group("fb.type.filtering.comparison_changeHandler");var prop_path=$("> td.prop-path > .advanced-find-prop:last",$(e.target));var tf=$("> td.value :text",$(e.target));fb.Debug.assertEquals(prop_path.length,1);fb.Debug.assertEquals(tf.length,1);
fb.type.filtering.init_textfield(prop_path,comparison,tf,true);fb.Debug.groupEnd("fb.type.filtering.comparison_changeHandler")};fb.type.filtering.value_changeHandler=function(e,value){fb.Debug.group("fb.type.filtering.value_changeHandler",e,value);fb.Debug.assert(value.is(":text"));fb.Debug.assert($(e.target).is("tr"));fb.type.filtering._validate_form(value,fb.validation.phase.BLURRED);fb.Debug.groupEnd("fb.type.filtering.value_changeHandler",e,value)};fb.type.filtering.branch_clickHandler=function(e){fb.Debug.group("fb.type.filtering.branch_clickHandler",e);var add_filter_li=$("#filters li.add-filter:last");var prop_path_breadcrumb=$("> .prop-path-breadcrumb",add_filter_li);fb.Debug.assertEquals(add_filter_li.length,1);var proto=add_filter_li.data("branch.prototype");if(!proto){var rows=$("tbody > tr:lt(2)",add_filter_li);proto=rows.clone();$("> td.value :text",proto).val("").removeData("criteria_value");fb.Debug.assertEquals(proto.length,2);add_filter_li.data("branch.prototype",proto);var prop=$("> td.prop-path > .advanced-find-prop:first",rows);var branch_pid_path=fb.type.filtering.get_pid_path(prop).slice(0,-1);fb.Debug.log("branch_pid_path",branch_pid_path);add_filter_li.data("branch.pid_path",branch_pid_path);var prop_names=JSON.parse(prop.attr("fb__prop_names")).slice(0,-1);prop_names.push("");prop_path_breadcrumb.text(prop_names.join(" \xbb "));$("> table",add_filter_li).addClass("prop-path-breadcrumb-active");if(eval(prop.attr("fb__ect_mediator"))){prop.remove();prop=$("> td.prop-path > .advanced-find-prop",rows);fb.Debug.assertEquals(prop.length,1)}fb.type.filtering._update_prop_breadcrumb($(rows.slice(-1)))}proto=proto.clone();$("> td.prop-path .advanced-find-prop",proto).attr("fb__pid_prefix",fb.new_id());$("td.buttons > *",add_filter_li).hide();$("tbody",add_filter_li).append(proto);fb.type.filtering._update_prop_breadcrumb($(proto.slice(-1)));$("> td.buttons > * ",proto).show();fb.disable($("> td.buttons :button[type=submit]",proto));fb.type.filtering.update_filter_input_name({target:proto.slice(-1)});fb.type.filtering._bind_row_event_handlers($(proto.slice(-1)));fb.Debug.groupEnd("fb.type.filtering.branch_clickHandler",e)};fb.type.filtering.update_filter_input_name=function(e){fb.Debug.group("fb.type.filtering.update_filter_input_name",e);fb.Debug.assert($(e.target).is("tr"));var add_filter_li=$(e.target).parents("li.add-filter:first");var branch_pid_path=add_filter_li.data("branch.pid_path")||[];var prop_path=$("> td.prop-path > .advanced-find-prop:last",e.target);var comparison=$("> td.comparison > .comparison-select",e.target);var tf=$("> td.value :text",e.target);fb.Debug.assertEquals(comparison.length,1);fb.Debug.assertEquals(prop_path.length,1);fb.Debug.assertEquals(tf.length,1);comparison=comparison.attr("fb__value");var pid_path=fb.type.filtering.get_pid_path(prop_path);pid_path=$.map(pid_path,function(pid,i){var prefix=prop_path;if(i<branch_pid_path.length){fb.Debug.assertEquals(pid,branch_pid_path[i]);prefix=$("> tr:not(.active-prop-breadcrumb):first .advanced-find-prop:first",$(e.target).parent());fb.Debug.assertEquals(prefix.length,1)}prefix=prefix.attr("fb__pid_prefix");if(pid==pid_path[pid_path.length-1]&&Boolean($.inArray(pid,fb.type.PRIMARY_NAME_PIDS)+1)){pid=fb.type.PRIMARY_NAME_PIDS[fb.type.filtering.is_id_comparison(comparison)?1:0];if(pid_path.length==1){$(tf).data("criteria_type","value")}else{$(tf).data("criteria_type",pid.substring("/type/object".length+1));return null}}return fb.sprintf("p=%s:%s",prefix,pid)});var type=$(tf).data("criteria_type");fb.Debug.assert($.inArray(type,["id","name","value"])!=-1,tf,"has no criteria_type: ",type);var name=["filter",$.makeArray(pid_path).join(fb.PARAM_DELIM),fb.sprintf("%s.%s",type,comparison)].join(fb.PARAM_DELIM);tf.attr("name",name);tf[0].form.elements[name]=tf[0];fb.Debug.groupEnd("fb.type.filtering.update_filter_input_name")};fb.type.filtering.init_textfield=function(prop_path,comparison,tf,full_reset){fb.Debug.group("filtering.init_textfield");
fb.Debug.assert(tf.is(":text"));var row=tf.parents("tr:first");fb.Debug.assertEquals(row.length,1);if(full_reset){tf.val("").unbind().unbind(".fb").removeClass("fbs-enumcontrol").removeClass("topic-input").removeData("criteria_value").removeAttr("fb__value").removeAttr("fb__id")}var ect_id=prop_path.attr("fb__ect_id");if($.inArray(comparison,["=0","!0"])!=-1){tf.data("criteria_type",fb.is_literal_type(ect_id)?"value":"id");tf.removeData("criteria_value");tf.data("validator",function(){return true});tf.removeAttr("fb__value").removeAttr("fb__id");tf.css("visibility","hidden");$(row).trigger({type:"change-value"},[tf]);fb.Debug.groupEnd("filtering.init_textfield");return }tf.css("visibility","visible");var pid_path=fb.type.filtering.get_pid_path(prop_path);var is_primary_name_prop=(pid_path.length==1&&Boolean($.inArray(pid_path[0],fb.type.PRIMARY_NAME_PIDS)+1));var is_enumeration=eval(prop_path.attr("fb__ect_enumeration"));var is_id_comparison=fb.type.filtering.is_id_comparison(comparison);fb.Debug.log("initializing textfield",tf," comparison = ",comparison," name = ",tf.attr("name")," ect_id = ",ect_id," pid_path = ",pid_path," is_primary_name_prop = ",is_primary_name_prop," is_enumeration = ",is_enumeration);if(is_enumeration&&(!is_primary_name_prop||(is_primary_name_prop&&is_id_comparison))){fb.Debug.log("initializing enum for",tf);fb.Debug.assertInArray(comparison,["=","!=","=0","!0"]);tf.data("validator",fb.validation.topic_validate).data("criteria_type","id");var opt={service_url:"",type:ect_id,limit:300,css:{pane:"fbs-pane fbs-pane-enum"},required:"always",align:"left"};tf.suggesttype(opt).addClass("enum-input").bind("fb-select",function(e,data){fb.Debug.group("fb.type.filtering.init_textfield.enum.fb-select");$(this).data("criteria_value",data.id).attr("fb__id",data.id);$(row).trigger({type:"change-value"},[$(this)]);fb.Debug.groupEnd("fb.type.filtering.init_textfield.enum.fb-select")})}else{if(fb.is_literal_type(ect_id)&&!is_primary_name_prop){function _handle_literal_suggest_select(event,data){fb.Debug.group("fb.type.filtering.init_textfield.literal.fb-select");$(this).data("criteria_value",String(data.value)).attr("fb__value",data.value);$(row).trigger({type:"change-value"},[$(this)]);fb.Debug.groupEnd("fb.type.filtering.init_textfield.literal.fb-select")}tf.removeClass("enum-input").removeClass("topic-input");tf.data("criteria_type","value");if(ect_id=="/type/datetime"){fb.Debug.log("initializing date control for",tf);var opt={css:{pane:"fbs-pane fbs-pane-datetime"},required:"always",align:"left"};tf.suggestdate(opt).bind("fb-select",_handle_literal_suggest_select)}else{if(ect_id=="/type/boolean"){fb.Debug.log("initializing boolean control for",tf);fb.Debug.assertInArray(comparison,["=","=0","!0"]);var opt={"true":"Yes","false":"No",css:{pane:"fbs-pane fbs-pane-boolean"},required:"always",align:"left"};tf.suggestboolean(opt).bind("fb-select",_handle_literal_suggest_select)}else{if(ect_id=="/type/int"||ect_id=="/type/float"){fb.Debug.log("initializing number control for",tf);var opt={comma:true,decimal:ect_id=="/type/int"?0:-1,css:{pane:"fbs-pane fbs-pane-number"},required:"always",align:"left"};tf.suggestnumber(opt).bind("fb-select",_handle_literal_suggest_select)}else{fb.Debug.log("initializing literal control for",tf);fb.type.filtering._bind_ontextchange(tf)}}}var validator=fb.validation.validators_by_type[ect_id];fb.Debug.assertNotNull(validator);tf.data("validator",validator)}else{tf.removeData("criteria_value");if(is_id_comparison){fb.Debug.log("initializing topic input control for",tf);tf.unbind().data("criteria_type","id").data("validator",fb.validation.topic_validate).addClass("topic-input").attr("fb__ect",ect_id).attr("fb__ect_name",prop_path.attr("fb__ect_name")).filtered_suggest().bind("fb-select",function(e,data){$(this).data("criteria_value",data.id).attr("fb__id",data.id);$(row).trigger({type:"change-value"},[$(this)])}).bind("fb-select-new",function(e,data){fb.Debug.assert(false)}).bind("fb-required",function(e,data){$(this).removeData("criteria_value").removeAttr("fb__id");
$(row).trigger({type:"change-value"},[$(this)])})}else{fb.Debug.log("initializing literal variant of topic control for",tf);tf.data("criteria_type","name");var fs=tf.data("filtered_suggest");if(fs){fs._destroy()}var validator=fb.validation.validators_by_type["/type/text"];fb.Debug.assertNotNull(validator);tf.data("validator",validator);fb.type.filtering._bind_ontextchange(tf)}}}fb.Debug.groupEnd("filtering.init_textfield")};fb.type.filtering._bind_ontextchange=function(input){fb.Debug.group("fb.type.filtering._bind_ontextchange",input);input.bind("input.fb",fb.type.filtering._ontextchange).bind("paste.fb",fb.type.filtering._ontextchange).bind("keyup.fb",fb.type.filtering._ontextchange).bind("blur.fb",function(e){fb.type.filtering._ontextchange(e,fb.validation.phase.BLURRED)});fb.Debug.groupEnd("fb.type.filtering._bind_ontextchange",input)};fb.type.filtering._ontextchange=function(e,phase){fb.Debug.group("fb.type.filtering.init_textfield.on_text_change",e,phase);var tf=$(e.target);fb.Debug.assert(tf.is(":text"));fb.type.filtering._validate_form(tf,phase||fb.validation.phase.FOCUSED);tf.data("criteria_value",$.trim(tf.val()));fb.Debug.groupEnd("fb.type.filtering.init_textfield.on_text_change",e,phase);return true};fb.type.filtering._validate_form=function(input,phase){fb.Debug.group("fb.type.filtering._validate_form",input,phase);var v=$(input).data("validator");fb.Debug.assertNotNull(v);var tbody=$(input).parents("tbody:first");var submit_buttons=$("> tr > td.buttons :button[type=submit]",tbody);fb.Debug.assertNotEquals(submit_buttons.length,0);if(!v){fb.disable(submit_buttons)}else{var was_valid=!submit_buttons.is(":disabled");var valid=v(input,phase);fb.Debug.log("wv",was_valid,"v",valid);if(!was_valid&&valid){var valid=true;$("> tr > td.value > :input:visible",tbody).each(function(){if($(this)==input){return }var v=$(this).data("validator");if(!v){return }valid=v(input,fb.validation.phase.BLURRED);if(!valid){fb.Debug.log(input," is invalid");return false}})}else{valid=valid&&was_valid}fb.disable(submit_buttons,!valid)}fb.Debug.groupEnd("fb.type.filtering._validate_form")};fb.type.filtering._bind_row_event_handlers=function(row){fb.Debug.group("fb.type.filtering._bind_row_event_handlers",row);fb.Debug.assert(row.is("tr"));fb.Debug.assertEquals(row.length,1);row.unbind().bind("change-comparison",fb.type.filtering.comparison_changeHandler).bind("change-prop_path",fb.type.filtering.prop_path_changeHandler).bind("change-comparison",fb.type.filtering.update_filter_input_name).bind("change-prop_path",fb.type.filtering.update_filter_input_name).bind("change-value",fb.type.filtering.value_changeHandler);var buttons=$("> td.buttons",row);$(":button[type=reset]",buttons).unbind().click(fb.type.filtering.resetHandler);var submit_button=$(":button[type=submit]",buttons);fb.Debug.assertEquals(submit_button.length,1);fb.disable(submit_button,true);submit_button.unbind().click(fb.type.filtering.submitHandler);submit_button.parents("form:first").unbind().submit(fb.type.filtering.submitHandler);fb.Debug.groupEnd("fb.type.filtering._bind_row_event_handlers",row)};fb.type.filtering._update_prop_breadcrumb=function(row){fb.Debug.group("fb.type.filtering._update_prop_breadcrumb",row);fb.Debug.assert(row.is("tr"));fb.Debug.assertEquals(row.length,1);var prop_selector=$("> td.prop-path > .advanced-find-prop:first",row);var prop_names=JSON.parse(prop_selector.attr("fb__prop_names"));var add_filter_li=$(row).parents("li.add-filter:first");var prop_path_breadcrumb=$("> .prop-path-breadcrumb",add_filter_li);if(fb.type.filtering.is_terminal_prop(prop_selector)||eval(prop_selector.attr("fb__schema_mediator"))){prop_names=prop_names.slice(0,-1)}var active_breadcrumb=$("> th",row.prev(".active-prop-breadcrumb"));var branch_pid_path=add_filter_li.data("branch.pid_path");if(branch_pid_path){prop_names=prop_names.slice(branch_pid_path.length);if(prop_names.length){prop_names.push("");prop_names=prop_names.join(" \xbb ")}else{prop_names=""}if($("> tr:gt(1)",row.parent("tbody")).index(row)+1){prop_names="and "+prop_names
}active_breadcrumb.text(prop_names)}else{active_breadcrumb.text(prop_names.length?prop_names.pop():"");if(prop_names.length){prop_names.push("");prop_path_breadcrumb.text(prop_names.join(" \xbb "));$("> table",add_filter_li).addClass("prop-path-breadcrumb-active")}else{prop_path_breadcrumb.text("");$("> table",add_filter_li).removeClass("prop-path-breadcrumb-active")}}fb.Debug.groupEnd("fb.type.filtering._update_prop_breadcrumb")};fb.type.filtering.is_id_comparison=function(comparison){return $.inArray(comparison,["=","!="])!=-1};fb.type.filtering.get_pid_path=function(prop){fb.Debug.group("fb.type.filtering.get_pid_path");var result=JSON.parse($(prop).attr("fb__value"));fb.Debug.assertNotNull(result);fb.Debug.assertNotEquals(result.length,0);fb.Debug.groupEnd("fb.type.filtering.get_pid_path");return result};fb.type.filtering.is_terminal_prop=function(prop_path){var ect_id=prop_path.attr("fb__ect_id");fb.Debug.assert(ect_id);var pid_path=fb.type.filtering.get_pid_path(prop_path);return(fb.is_metaweb_system_type(ect_id)||fb.is_literal_type(ect_id)||Boolean($.inArray(pid_path[pid_path.length-1],fb.type.PRIMARY_NAME_PIDS)+1))};fb.type.fx={};fb.type.fx.fadeIn_highlight=function(elements,to_class,delay,callback){elements.hide().addClass(to_class).animate({opacity:"show"},delay)};fb.run_init(fb.type,"type.js")})(jQuery,window.freebase);