(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){selector=jQuery.clean([match[1]],context)}else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3]){return jQuery().find(selector)}return jQuery(elem)}selector=[]}}else{return jQuery(context).find(selector)}}else{if(jQuery.isFunction(selector)){return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector)}}return this.setArray(jQuery.makeArray(selector))},jquery:"1.2.6",size:function(){return this.length},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num]
},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this},each:function(callback,args){return jQuery.each(this,callback,args)},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(name.constructor==String){if(value===undefined){return this[0]&&jQuery[type||"attr"](this[0],name)}else{options={};options[name]=value}}return this.each(function(i){for(name in options){jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))}})},css:function(key,value){if((key=="width"||key=="height")&&parseFloat(value)<0){value=undefined}return this.attr(key,value,"curCSS")},text:function(text){if(typeof text!="object"&&text!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))}var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8){ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])
}})});return ret},wrapAll:function(html){if(this[0]){jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)}})},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem)
});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems)},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0]}else{return this.cloneNode(true)}});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined){this[expando]=null}});if(events===true){this.find("*").andSelf().each(function(i){if(this.nodeType==3){return}var events=jQuery.data(this,"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data)}}})}return ret},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)})||jQuery.multiFilter(selector,this))},not:function(selector){if(selector.constructor==String){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true))
}else{selector=jQuery.multiFilter(selector,this)}}var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector})},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=="string"?jQuery(selector):jQuery.makeArray(selector))))},is:function(selector){return !!selector&&jQuery.multiFilter(selector,this).length>0},hasClass:function(selector){return this.is("."+selector)},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0){return null}for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one){return value}values.push(value)}}return values
}else{return(this[0].value||"").replace(/\r/g,"")}}return undefined}if(value.constructor==Number){value+=""}return this.each(function(){if(this.nodeType!=1){return}if(value.constructor==Array&&/radio|checkbox/.test(this.type)){this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0)}else{if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)});if(!values.length){this.selectedIndex=-1}}else{this.value=value}}})},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value)},replaceWith:function(value){return this.after(value).remove()},eq:function(i){return this.slice(i,i+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},andSelf:function(){return this.add(this.prevObject)
},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key)}return data===undefined&&parts[1]?this.data(parts[0]):data}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value)})}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse){elems.reverse()}}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr")){obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"))}var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem)
}else{if(elem.nodeType==1){scripts=scripts.add(jQuery("script",elem).remove())}callback.call(obj,elem)}});scripts.each(evalScript)})}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"})}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"")}if(elem.parentNode){elem.parentNode.removeChild(elem)}}function now(){return +new Date}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2}if(typeof target!="object"&&typeof target!="function"){target={}}if(length==i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(var name in options){var src=target[name],copy=options[name];if(target===copy){continue}if(deep&&copy&&typeof copy=="object"&&!copy.nodeType){target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy)}else{if(copy!==undefined){target[name]=copy
}}}}}return target};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery}return jQuery},isFunction:function(fn){return !!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"")},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie){script.text=data}else{script.appendChild(document.createTextNode(data))}head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;
var id=elem[expando];if(!id){id=elem[expando]=++uuid}if(name&&!jQuery.cache[id]){jQuery.cache[id]={}}if(data!==undefined){jQuery.cache[id][name]=data}return name?jQuery.cache[id][name]:id},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id]){break}if(!name){jQuery.removeData(elem)}}}else{try{delete elem[expando]}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando)}}delete jQuery.cache[id]}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object){if(callback.apply(object[name],args)===false){break}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break}}}}else{if(length==undefined){for(name in object){if(callback.call(object[name],name,object[name])===false){break}}}else{for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}return object
},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)){value=value.call(elem,i)}return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)){elem.className+=(elem.className?" ":"")+className}})},remove:function(elem,classNames){if(elem.nodeType==1){elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return !jQuery.className.has(classNames,className)}).join(" "):""}},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name]}callback.call(elem);for(var name in options){elem.style[name]=old[name]}},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];
function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0});val-=Math.round(padding+border)}if(jQuery(elem).is(":visible")){getWH()}else{jQuery.swap(elem,props,getWH)}return Math.max(0,val)}return jQuery.curCSS(elem,name,force)},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari){return false}var ret=defaultView.getComputedStyle(elem,null);return !ret||ret.getPropertyValue("color")==""}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save}if(name.match(/float/i)){name=styleFloat}if(!force&&style&&style[name]){ret=style[name]}else{if(defaultView.getComputedStyle){if(name.match(/float/i)){name="float"
}name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem)){ret=computedStyle.getPropertyValue(name)}else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode){stack.unshift(a)}for(;i<stack.length;i++){if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block"}}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++){if(swap[i]!=null){stack[i].style.display=swap[i]}}}if(name=="opacity"&&ret==""){ret="1"}}else{if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft
}}}}return ret},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}jQuery.each(elems,function(i,elem){if(!elem){return}if(elem.constructor==Number){elem+=""}if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];
div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--){div=div.lastChild}if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])}}if(/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)}}elem=jQuery.makeArray(div.childNodes)}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select"))){return}if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options){ret.push(elem)}else{ret=jQuery.merge(ret,elem)}});return ret},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined}var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);
if(name=="selected"&&jQuery.browser.safari){elem.parentNode.selectedIndex}if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode){throw"type property can't be changed"}elem[name]=value}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue}return elem[name]}if(msie&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)}if(set){elem.setAttribute(name,""+value)}var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+""=="NaN"?"":"alpha(opacity="+value*100+")")}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase()});if(set){elem[name]=value}return elem[name]
},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"")},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call){ret[0]=array}else{while(i){ret[--i]=array[i]}}}return ret},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i}}return -1},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++]){if(elem.nodeType!=8){first[pos++]=elem}}}else{while(elem=second[i++]){first[pos++]=elem}}return first},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i])}}}catch(e){ret=array}return ret},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!=!callback(elems[i],i)){ret.push(elems[i])}}return ret},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;
i<length;i++){var value=callback(elems[i],i);if(value!=null){ret[ret.length]=value}}return ret.concat.apply([],ret)}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode},parents:function(elem){return jQuery.dir(elem,"parentNode")},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")
},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string"){ret=jQuery.multiFilter(selector,ret)}return this.pushStack(jQuery.unique(ret))}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++){jQuery(args[i])[original](this)}})}});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1){this.removeAttribute(name)}},addClass:function(classNames){jQuery.className.add(this,classNames)
},removeClass:function(classNames){jQuery.className.remove(this,classNames)},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames)},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){jQuery(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)}});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px")
}});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2])},"#":function(a,i,m){return a.getAttribute("id")==m[2]},":":{lt:function(a,i,m){return i<m[3]-0},gt:function(a,i,m){return i>m[3]-0},nth:function(a,i,m){return m[3]-0==i},eq:function(a,i,m){return m[3]-0==i},first:function(a,i){return i==0},last:function(a,i,m,r){return i==r.length-1},even:function(a,i){return i%2==0},odd:function(a,i){return i%2},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a},"only-child":function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling")
},parent:function(a){return a.firstChild},empty:function(a){return !a.firstChild},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"},enabled:function(a){return !a.disabled},disabled:function(a){return a.disabled},checked:function(a){return a.checked},selected:function(a){return a.selected||jQuery.attr(a,"selected")},text:function(a){return"text"==a.type},radio:function(a){return"radio"==a.type},checkbox:function(a){return"checkbox"==a.type},file:function(a){return"file"==a.type},password:function(a){return"password"==a.type},submit:function(a){return"submit"==a.type},image:function(a){return"image"==a.type},reset:function(a){return"reset"==a.type},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button")
},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},has:function(a,i,m){return jQuery.find(m[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem}).length}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r)}return cur},find:function(t,context){if(typeof t!="string"){return[t]}if(context&&context.nodeType!=1&&context.nodeType!=9){return[]}context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++){for(var c=ret[i].firstChild;c;c=c.nextSibling){if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName)){r.push(c)
}}}ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0){continue}foundToken=true}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling){if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id]){break}if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~"){merge[id]=true}r.push(n)}if(m=="+"){break}}}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0]){ret.shift()}done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length)}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]]}else{re2=quickClass;m=re2.exec(t)}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2]){oid=jQuery('[@id="'+m[2]+'"]',elem)[0]
}ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[]}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object"){tag="param"}r=jQuery.merge(r,ret[i].getElementsByTagName(tag))}if(m[1]=="."){r=jQuery.classFilter(r,m[2])}if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++){if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break}}r=tmp}ret=r}t=t.replace(re2,"")}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t)}}if(t){ret=[]}if(ret&&context==ret[0]){ret.shift()}done=jQuery.merge(done,ret);return done},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass){tmp.push(r[i])}}return tmp},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break}}if(!m){break}if(m[1]==":"&&m[2]=="not"){r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3])
}else{if(m[1]=="."){r=jQuery.classFilter(r,m[2],not)}else{if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2])){z=jQuery.attr(a,m[2])||""}if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not){tmp.push(a)}}r=tmp}else{if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling){if(n.nodeType==1){n.nodeIndex=c++}}merge[id]=true}var add=false;if(first==0){if(node.nodeIndex==last){add=true}}else{if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0){add=true
}}if(add^not){tmp.push(node)}}r=tmp}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object"){fn=fn[m[2]]}if(typeof fn=="string"){fn=eval("false||function(a,i){return "+fn+";}")}r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r)},not)}}}}}return{r:r,t:t}},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1){matched.push(cur)}cur=cur[dir]}return matched},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType==1&&++num==result){break}}return cur},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)}}return r}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return}if(jQuery.browser.msie&&elem.setInterval){elem=window}if(!handler.guid){handler.guid=this.guid++}if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments)});handler.data=data}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered){return jQuery.event.handle.apply(arguments.callee.elem,arguments)
}});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener){elem.addEventListener(type,handle,false)}else{if(elem.attachEvent){elem.attachEvent("on"+type,handle)}}}}handlers[handler.guid]=handler;jQuery.event.global[type]=true});elem=null},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8){return}var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)==".")){for(var type in events){this.remove(elem,type+(types||""))}}else{if(types.type){handler=types.handler;types=types.type}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler){delete events[type][handler.guid]}else{for(handler in events[type]){if(!parts[1]||events[type][handler].type==parts[1]){delete events[type][handler]
}}}for(ret in events[type]){break}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener){elem.removeEventListener(type,jQuery.data(elem,"handle"),false)}else{if(elem.detachEvent){elem.detachEvent("on"+type,jQuery.data(elem,"handle"))}}}ret=null;delete events[type]}}})}for(ret in events){break}if(!ret){var handle=jQuery.data(elem,"handle");if(handle){handle.elem=null}jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle")}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true}if(!elem){if(this.global[type]){jQuery("*").add([window,document]).trigger(type,data)}}else{if(elem.nodeType==3||elem.nodeType==8){return undefined}var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});
data[0][expando]=true}data[0].type=type;if(exclusive){data[0].exclusive=true}var handle=jQuery.data(elem,"handle");if(handle){val=handle.apply(elem,data)}if((!fn||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){val=false}if(event){data.shift()}if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined){val=ret}}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;try{elem[type]()}catch(e){}}this.triggered=false}return val},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);
if(val!==false){val=ret}if(ret===false){event.preventDefault();event.stopPropagation()}}}return val},fix:function(event){if(event[expando]==true){return event}var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--){event[props[i]]=originalEvent[props[i]]}event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault){originalEvent.preventDefault()}originalEvent.returnValue=false};event.stopPropagation=function(){if(originalEvent.stopPropagation){originalEvent.stopPropagation()}originalEvent.cancelBubble=true};event.timeStamp=event.timeStamp||now();if(!event.target){event.target=event.srcElement||document
}if(event.target.nodeType==3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0)}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))}return event},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy},special:{ready:{setup:function(){bindReady();return},teardown:function(){return}},mouseenter:{setup:function(){if(jQuery.browser.msie){return false
}jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true},teardown:function(){if(jQuery.browser.msie){return false}jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true},handler:function(event){if(withinElement(event,this)){return true}event.type="mouseenter";return jQuery.event.handle.apply(this,arguments)}},mouseleave:{setup:function(){if(jQuery.browser.msie){return false}jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true},teardown:function(){if(jQuery.browser.msie){return false}jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true},handler:function(event){if(withinElement(event,this)){return true}event.type="mouseleave";return jQuery.event.handle.apply(this,arguments)}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data)})},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);
return(fn||data).apply(this,arguments)});return this.each(function(){jQuery.event.add(this,type,one,fn&&data)})},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn)})},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn)})},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn)},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.event.proxy(fn,args[i++])}return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false}))},hover:function(fnOver,fnOut){return this.bind("mouseenter",fnOver).bind("mouseleave",fnOut)},ready:function(fn){bindReady();if(jQuery.isReady){fn.call(document,jQuery)}else{jQuery.readyList.push(function(){return fn.call(this,jQuery)})}return this}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;
if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document)});jQuery.readyList=null}jQuery(document).triggerHandler("ready")}}});var readyBound=false;function bindReady(){if(readyBound){return}readyBound=true;if(document.addEventListener&&!jQuery.browser.opera){document.addEventListener("DOMContentLoaded",jQuery.ready,false)}if(jQuery.browser.msie&&window==top){(function(){if(jQuery.isReady){return}try{document.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return}jQuery.ready()})()}if(jQuery.browser.opera){document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady){return}for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return}}jQuery.ready()},false)}if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady){return}if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return}if(numStyles===undefined){numStyles=jQuery("style, link[rel=stylesheet]").length
}if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return}jQuery.ready()})()}jQuery.event.add(window,"load",jQuery.ready)}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)}});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem){try{parent=parent.parentNode}catch(error){parent=elem}}return parent==elem};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind()});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!="string"){return this._load(url)}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}callback=callback||function(){};var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null
}else{params=jQuery.param(params);type="POST"}}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified"){self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText)}self.each(callback,[res.responseText,status,res])}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val}}):{name:elem.name,value:val}}).get()}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)
}});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})},getScript:function(url,callback){return jQuery.get(url,null,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={}}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type})},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings)},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));
var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string"){s.data=jQuery.param(s.data)}if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre)){s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?"}}else{if(!s.data||!s.data.match(jsre)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"}}s.dataType="json"}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1")}s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp]}catch(e){}if(head){head.removeChild(script)}}}if(s.dataType=="script"&&s.cache==null){s.cache=false}if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"")}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;
s.data=null}if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")}var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset}if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script)}}}head.appendChild(script);return undefined}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username){xhr.open(type,s.url,s.async,s.username,s.password)}else{xhr.open(type,s.url,s.async)}try{if(s.data){xhr.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT")
}xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])}var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter)}catch(e){status="parsererror"}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified")}catch(e){}if(s.ifModified&&modRes){jQuery.lastModified[s.url]=modRes}if(!jsonp){success()}}else{jQuery.handleError(s,xhr,status)}complete();if(s.async){xhr=null}}};
if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0){setTimeout(function(){if(xhr){xhr.abort();if(!requestDone){onreadystatechange("timeout")}}},s.timeout)}}try{xhr.send(s.data)}catch(e){jQuery.handleError(s,xhr,null,e)}if(!s.async){onreadystatechange()}function success(){if(s.success){s.success(data,status)}if(s.global){jQuery.event.trigger("ajaxSuccess",[xhr,s])}}function complete(){if(s.complete){s.complete(xhr,status)}if(s.global){jQuery.event.trigger("ajaxComplete",[xhr,s])}if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}}return xhr},handleError:function(s,xhr,status,e){if(s.error){s.error(xhr,status,e)}if(s.global){jQuery.event.trigger("ajaxError",[xhr,s,e])}},active:0,httpSuccess:function(xhr){try{return !xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined}catch(e){}return false},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");
return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined}catch(e){}return false},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror"){throw"parsererror"}if(filter){data=filter(data,type)}if(type=="script"){jQuery.globalEval(data)}if(type=="json"){data=eval("("+data+")")}return data},param:function(a){var s=[];if(a.constructor==Array||a.jquery){jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value))})}else{for(var j in a){if(a[j]&&a[j].constructor==Array){jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this))})}else{s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]))}}}return s.join("&").replace(/%20/g,"+")}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";
if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none"){this.style.display="block"}elem.remove()}}).end()},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none"}).end()},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]()})},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback)},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback)},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback)
},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback)},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback)},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback)},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1){return false}var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden){return opt.complete.call(this)}if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow}}if(opt.overflow!=null){this.style.overflow="hidden"}opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val)){e[val=="toggle"?hidden?"show":"hide":val](prop)}else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;
if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit}if(parts[1]){end=((parts[1]=="-="?-1:1)*end)+start}e.custom(start,end,unit)}else{e.custom(start,val,"")}}});return true})},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx"}if(!type||(typeof type=="string"&&!fn)){return queue(this[0],type)}return this.each(function(){if(fn.constructor==Array){queue(this,type,fn)}else{queue(this,type).push(fn);if(queue(this,type).length==1){fn.call(this)}}})},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([])}this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem==this){if(gotoEnd){timers[i](true)}timers.splice(i,1)}}});if(!gotoEnd){this.dequeue()}return this}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array){q=jQuery.data(elem,type+"queue",jQuery.makeArray(array))
}}return q};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length){q[0].call(this)}})};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue()}if(jQuery.isFunction(opt.old)){opt.old.call(this)}};return opt},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={}}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)
}(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width"){this.elem.style.display="block"}},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null){return this.elem[this.prop]}var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1)}}if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());
if(this.prop=="width"||this.prop=="height"){this.elem.style[this.prop]="1px"}jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false}}if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){this.elem.style.display="none"}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])}}}if(done){this.options.complete.call(this.elem)}return false}else{var n=t-this.startTime;this.state=n/this.options.duration;
this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now},scrollTop:function(fx){fx.elem.scrollTop=fx.now},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem){with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));
add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop)}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2){border(offsetParent)}if(!fixed&&css(offsetParent,"position")=="fixed"){fixed=true}offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display"))){add(-parent.scrollLeft,-parent.scrollTop)}if(mozilla&&css(parent,"overflow")!="visible"){border(parent)}parent=parent.parentNode}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute")){add(-doc.body.offsetLeft,-doc.body.offsetTop)}if(fixed){add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop))}}results={top:top,left:left}
}}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true))}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0}return results};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,"marginTop");offset.left-=num(this,"marginLeft");parentOffset.top+=num(offsetParent,"borderTopWidth");parentOffset.left+=num(offsetParent,"borderLeftWidth");results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}}return results},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,"position")=="static")){offsetParent=offsetParent.offsetParent}return jQuery(offsetParent)}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;
jQuery.fn[method]=function(val){if(!this[0]){return}return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val}):this[0]==window||this[0]==document?self[i?"pageYOffset":"pageXOffset"]||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method]}});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br)};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0)}})})();jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();
f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};(function(c){c.ui={plugin:{add:function(e,f,h){var g=c.ui[e].prototype;for(var d in h){g.plugins[d]=g.plugins[d]||[];g.plugins[d].push([f,h[d]])}},call:function(d,f,e){var h=d.plugins[f];if(!h){return}for(var g=0;g<h.length;g++){if(d.options[h[g][0]]){h[g][1].apply(d.element,e)}}}},cssCache:{},css:function(d){if(c.ui.cssCache[d]){return c.ui.cssCache[d]}var f=c('<div class="ui-gen">').addClass(d).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");c.ui.cssCache[d]=!!((!(/auto|default/).test(f.css("cursor"))||(/^[1-9]/).test(f.css("height"))||(/^[1-9]/).test(f.css("width"))||!(/none/).test(f.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(f.css("backgroundColor"))));
try{c("body").get(0).removeChild(f.get(0))}catch(g){}return c.ui.cssCache[d]},disableSelection:function(d){c(d).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(d){c(d).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(h,f){var d=/top/.test(f||"top")?"scrollTop":"scrollLeft",g=false;if(h[d]>0){return true}h[d]=1;g=h[d]>0?true:false;h[d]=0;return g}};var b=c.fn.remove;c.fn.remove=function(){c("*",this).add(this).triggerHandler("remove");return b.apply(this,arguments)};function a(e,f,g){var d=c[e][f].getter||[];d=(typeof d=="string"?d.split(/,?\s+/):d);return(c.inArray(g,d)!=-1)}c.widget=function(e,d){var f=e.split(".")[0];e=e.split(".")[1];c.fn[e]=function(j){var h=(typeof j=="string"),i=Array.prototype.slice.call(arguments,1);if(h&&a(f,e,j)){var g=c.data(this[0],e);return(g?g[j].apply(g,i):undefined)}return this.each(function(){var k=c.data(this,e);if(h&&k&&c.isFunction(k[j])){k[j].apply(k,i)}else{if(!h){c.data(this,e,new c[f][e](this,j))
}}})};c[f][e]=function(i,h){var g=this;this.widgetName=e;this.widgetBaseClass=f+"-"+e;this.options=c.extend({},c.widget.defaults,c[f][e].defaults,h);this.element=c(i).bind("setData."+e,function(l,j,k){return g.setData(j,k)}).bind("getData."+e,function(k,j){return g.getData(j)}).bind("remove",function(){return g.destroy()});this.init()};c[f][e].prototype=c.extend({},c.widget.prototype,d)};c.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(d){return this.options[d]},setData:function(d,e){this.options[d]=e;if(d=="disabled"){this.element[e?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};c.widget.defaults={disabled:false};c.ui.mouse={mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(f){return d.mouseDown(f)});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(g){(this._mouseStarted&&this.mouseUp(g));this._mouseDownEvent=g;var f=this,h=(g.which==1),d=(typeof this.options.cancel=="string"?c(g.target).parents().add(g.target).filter(this.options.cancel).length:false);if(!h||d||!this.mouseCapture(g)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){f._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(g)&&this.mouseDelayMet(g)){this._mouseStarted=(this.mouseStart(g)!==false);if(!this._mouseStarted){g.preventDefault();return true}}this._mouseMoveDelegate=function(i){return f.mouseMove(i)};this._mouseUpDelegate=function(i){return f.mouseUp(i)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
return false},mouseMove:function(d){if(c.browser.msie&&!d.button){return this.mouseUp(d)}if(this._mouseStarted){this.mouseDrag(d);return false}if(this.mouseDistanceMet(d)&&this.mouseDelayMet(d)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this.mouseDrag(d):this.mouseUp(d))}return !this._mouseStarted},mouseUp:function(d){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(d)}return false},mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},mouseDelayMet:function(d){return this._mouseDelayMet},mouseStart:function(d){},mouseDrag:function(d){},mouseStop:function(d){},mouseCapture:function(d){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){jQuery.fn.pngFix=function(d){d=jQuery.extend({blankgif:"blank.gif"},d);
var c=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var b=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(c||b)){jQuery(this).find("img[@src$=.png]").each(function(){jQuery(this).attr("width",jQuery(this).width());jQuery(this).attr("height",jQuery(this).height());var l="";var g="";var f=(jQuery(this).attr("id"))?'id="'+jQuery(this).attr("id")+'" ':"";var m=(jQuery(this).attr("class"))?'class="'+jQuery(this).attr("class")+'" ':"";var i=(jQuery(this).attr("title"))?'title="'+jQuery(this).attr("title")+'" ':"";var j=(jQuery(this).attr("alt"))?'alt="'+jQuery(this).attr("alt")+'" ':"";var h=(jQuery(this).attr("align"))?"float:"+jQuery(this).attr("align")+";":"";var e=(jQuery(this).parent().attr("href"))?"cursor:hand;":"";if(this.style.border){l+="border:"+this.style.border+";";this.style.border=""}if(this.style.padding){l+="padding:"+this.style.padding+";";
this.style.padding=""}if(this.style.margin){l+="margin:"+this.style.margin+";";this.style.margin=""}var k=(this.style.cssText);g+="<span "+f+m+i+j;g+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+h+e;g+="width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+"px;";g+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+jQuery(this).attr("src")+"', sizingMethod='scale');";g+=k+'"></span>';if(l!=""){g='<span style="position:relative;display:inline-block;'+l+e+"width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+'px;">'+g+"</span>"}jQuery(this).hide();jQuery(this).after(g)});jQuery(this).find("*").each(function(){var f=jQuery(this).css("background-image");if(f.indexOf(".png")!=-1){var e=f.split('url("')[1].split('")')[0];jQuery(this).css("background-image","none");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e+"',sizingMethod='scale')"}});jQuery(this).find("input[@src$=.png]").each(function(){var e=jQuery(this).attr("src");
jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e+"', sizingMethod='scale');";jQuery(this).attr("src",d.blankgif)})}return jQuery}})(jQuery);(function(a){a.extend(a.fn,{validate:function(b){if(!this.length){b&&b.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return}var c=a.data(this[0],"validator");if(c){return c}c=new a.validator(b,this[0]);a.data(this[0],"validator",c);if(c.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){c.cancelSubmit=true});this.submit(function(d){if(c.settings.debug){d.preventDefault()}function e(){if(c.settings.submitHandler){c.settings.submitHandler.call(c,c.currentForm);return false}return true}if(c.cancelSubmit){c.cancelSubmit=false;return e()}if(c.form()){if(c.pendingRequest){c.formSubmitted=true;return false}return e()}else{c.focusInvalid();return false}})}return c},valid:function(){if(a(this[0]).is("form")){return this.validate().form()
}else{var c=false;var b=a(this[0].form).validate();this.each(function(){c|=b.element(this)});return c}},removeAttrs:function(d){var b={},c=this;a.each(d.split(/\s/),function(e,f){b[f]=c.attr(f);c.removeAttr(f)});return b},rules:function(e,b){var g=this[0];if(e){var d=a.data(g.form,"validator").settings;var i=d.rules;var j=a.validator.staticRules(g);switch(e){case"add":a.extend(j,a.validator.normalizeRule(b));i[g.name]=j;if(b.messages){d.messages[g.name]=a.extend(d.messages[g.name],b.messages)}break;case"remove":if(!b){delete i[g.name];return j}var h={};a.each(b.split(/\s/),function(k,l){h[l]=j[l];delete j[l]});return h}}var f=a.validator.normalizeRules(a.extend({},a.validator.metadataRules(g),a.validator.classRules(g),a.validator.attributeRules(g),a.validator.staticRules(g)),g);if(f.required){var c=f.required;delete f.required;f=a.extend({required:c},f)}return f}});a.extend(a.expr[":"],{blank:function(b){return !a.trim(b.value)},filled:function(b){return !!a.trim(b.value)},unchecked:function(b){return !b.checked
}});a.format=function(b,c){if(arguments.length==1){return function(){var d=a.makeArray(arguments);d.unshift(b);return a.format.apply(this,d)}}if(arguments.length>2&&c.constructor!=Array){c=a.makeArray(arguments).slice(1)}if(c.constructor!=Array){c=[c]}a.each(c,function(d,e){b=b.replace(new RegExp("\\{"+d+"\\}","g"),e)});return b};a.validator=function(b,c){this.settings=a.extend({},a.validator.defaults,b);this.currentForm=c;this.init()};a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",errorElement:"label",focusInvalid:true,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(b){this.lastActive=b;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,b,this.settings.errorClass);this.errorsFor(b).hide()}},onfocusout:function(b){if(!this.checkable(b)&&(b.name in this.submitted||!this.optional(b))){this.element(b)}},onkeyup:function(b){if(b.name in this.submitted||b==this.lastElement){this.element(b)
}},onclick:function(b){if(b.name in this.submitted){this.element(b)}},highlight:function(c,b){a(c).addClass(b)},unhighlight:function(c,b){a(c).removeClass(b)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:a.format("Please enter no more than {0} characters."),minlength:a.format("Please enter at least {0} characters."),rangelength:a.format("Please enter a value between {0} and {1} characters long."),range:a.format("Please enter a value between {0} and {1}."),max:a.format("Please enter a value less than or equal to {0}."),min:a.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=a(this.settings.errorLabelContainer);
this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm);this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=(this.groups={});a.each(this.settings.groups,function(e,f){a.each(f.split(/\s/),function(h,g){b[g]=e})});var d=this.settings.rules;a.each(d,function(e,f){d[e]=a.validator.normalizeRule(f)});function c(f){var e=a.data(this[0].form,"validator");e.settings["on"+f.type]&&e.settings["on"+f.type].call(e,this[0])}a(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",c).delegate("click",":radio, :checkbox",c);if(this.settings.invalidHandler){a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)}},form:function(){this.checkForm();a.extend(this.submitted,this.errorMap);this.invalid=a.extend({},this.errorMap);if(!this.valid()){a(this.currentForm).triggerHandler("invalid-form",[this])
}this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var b=0,c=(this.currentElements=this.elements());c[b];b++){this.check(c[b])}return this.valid()},element:function(c){c=this.clean(c);this.lastElement=c;this.prepareElement(c);this.currentElements=a(c);var b=this.check(c);if(b){delete this.invalid[c.name]}else{this.invalid[c.name]=true}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers)}this.showErrors();return b},showErrors:function(c){if(c){a.extend(this.errorMap,c);this.errorList=[];for(var b in c){this.errorList.push({message:c[b],element:this.findByName(b)[0]})}this.successList=a.grep(this.successList,function(d){return !(d.name in c)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){if(a.fn.resetForm){a(this.currentForm).resetForm()}this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)
},objectLength:function(d){var c=0;for(var b in d){c++}return c},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid){try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus()}catch(b){}}},findLastActive:function(){var b=this.lastActive;return b&&a.grep(this.errorList,function(c){return c.element.name==b.name}).length==1&&b},elements:function(){var c=this,b={};return a([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&c.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!c.objectLength(a(this).rules())){return false}b[this.name]=true;return true})},clean:function(b){return a(b)[0]},errors:function(){return a(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)
},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=a([]);this.toHide=a([]);this.formSubmitted=false;this.currentElements=a([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(b){this.reset();this.toHide=this.errorsFor(b)},check:function(c){c=this.clean(c);if(this.checkable(c)){c=this.findByName(c.name)[0]}var h=a(c).rules();var d=false;for(method in h){var g={method:method,parameters:h[method]};try{var b=a.validator.methods[method].call(this,c.value,c,g.parameters);if(b=="dependency-mismatch"){d=true;continue}d=false;if(b=="pending"){this.toHide=this.toHide.not(this.errorsFor(c));return}if(!b){this.formatAndAdd(c,g);return false}}catch(f){this.settings.debug&&window.console&&console.log("exception occured when checking element "+c.id+", check the '"+g.method+"' method");throw f}}if(d){return}if(this.objectLength(h)){this.successList.push(c)}return true},customMetaMessage:function(b,d){if(!a.metadata){return
}var c=this.settings.meta?a(b).metadata()[this.settings.meta]:a(b).metadata();return c&&c.messages&&c.messages[d]},customMessage:function(c,d){var b=this.settings.messages[c];return b&&(b.constructor==String?b:b[d])},findDefined:function(){for(var b=0;b<arguments.length;b++){if(arguments[b]!==undefined){return arguments[b]}}return undefined},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customMetaMessage(b,c),!this.settings.ignoreTitle&&b.title||undefined,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,d){var c=this.defaultMessage(b,d.method);if(typeof c=="function"){c=c.call(this,d.parameters,b)}this.errorList.push({message:c,element:b});this.errorMap[b.name]=c;this.submitted[b.name]=c},addWrapper:function(b){if(this.settings.wrapper){b=b.add(b.parents(this.settings.wrapper))}return b},defaultShowErrors:function(){for(var c=0;this.errorList[c];c++){var b=this.errorList[c];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass);
this.showLabel(b.element,b.message)}if(this.errorList.length){this.toShow=this.toShow.add(this.containers)}if(this.settings.success){for(var c=0;this.successList[c];c++){this.showLabel(this.successList[c])}}if(this.settings.unhighlight){for(var c=0,d=this.validElements();d[c];c++){this.settings.unhighlight.call(this,d[c],this.settings.errorClass)}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(c,d){var b=this.errorsFor(c);if(b.length){b.removeClass().addClass(this.settings.errorClass);b.attr("generated")&&b.html(d)}else{b=a("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(c),generated:true}).addClass(this.settings.errorClass).html(d||"");if(this.settings.wrapper){b=b.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()}if(!this.labelContainer.append(b).length){this.settings.errorPlacement?this.settings.errorPlacement(b,a(c)):b.insertAfter(c)
}}if(!d&&this.settings.success){b.text("");typeof this.settings.success=="string"?b.addClass(this.settings.success):this.settings.success(b)}this.toShow=this.toShow.add(b)},errorsFor:function(b){return this.errors().filter("[for='"+this.idOrName(b)+"']")},idOrName:function(b){return this.groups[b.name]||(this.checkable(b)?b.name:b.id||b.name)},checkable:function(b){return/radio|checkbox/i.test(b.type)},findByName:function(b){var c=this.currentForm;return a(document.getElementsByName(b)).map(function(d,e){return e.form==c&&e.name==b&&e||null})},getLength:function(c,b){switch(b.nodeName.toLowerCase()){case"select":return a("option:selected",b).length;case"input":if(this.checkable(b)){return this.findByName(b.name).filter(":checked").length}}return c.length},depend:function(c,b){return this.dependTypes[typeof c]?this.dependTypes[typeof c](c,b):true},dependTypes:{"boolean":function(c,b){return c},string:function(c,b){return !!a(c,b.form).length},"function":function(c,b){return c(b)}},optional:function(b){return !a.validator.methods.required.call(this,a.trim(b.value),b)&&"dependency-mismatch"
},startRequest:function(b){if(!this.pending[b.name]){this.pendingRequest++;this.pending[b.name]=true}},stopRequest:function(b,c){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0}delete this.pending[b.name];if(c&&this.pendingRequest==0&&this.formSubmitted&&this.form()){a(this.currentForm).submit()}else{if(!c&&this.pendingRequest==0&&this.formSubmitted){a(this.currentForm).triggerHandler("invalid-form",[this])}}},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(b,c){b.constructor==String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(c){var d={};var b=a(c).attr("class");
b&&a.each(b.split(" "),function(){if(this in a.validator.classRuleSettings){a.extend(d,a.validator.classRuleSettings[this])}});return d},attributeRules:function(c){var e={};var b=a(c);for(method in a.validator.methods){var d=b.attr(method);if(d){e[method]=d}}if(e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)){delete e.maxlength}return e},metadataRules:function(b){if(!a.metadata){return{}}var c=a.data(b.form,"validator").settings.meta;return c?a(b).metadata()[c]:a(b).metadata()},staticRules:function(c){var d={};var b=a.data(c.form,"validator");if(b.settings.rules){d=a.validator.normalizeRule(b.settings.rules[c.name])||{}}return d},normalizeRules:function(c,b){a.each(c,function(f,e){if(e===false){delete c[f];return}if(e.param||e.depends){var d=true;switch(typeof e.depends){case"string":d=!!a(e.depends,b.form).length;break;case"function":d=e.depends.call(b,b);break}if(d){c[f]=e.param!==undefined?e.param:true}else{delete c[f]}}});a.each(c,function(d,e){c[d]=a.isFunction(e)?e(b):e});a.each(["minlength","maxlength","min","max"],function(){if(c[this]){c[this]=Number(c[this])
}});a.each(["rangelength","range"],function(){if(c[this]){c[this]=[Number(c[this][0]),Number(c[this][1])]}});if(a.validator.autoCreateRanges){if(c.min&&c.max){c.range=[c.min,c.max];delete c.min;delete c.max}if(c.minlength&&c.maxlength){c.rangelength=[c.minlength,c.maxlength];delete c.minlength;delete c.maxlength}}if(c.messages){delete c.messages}return c},normalizeRule:function(c){if(typeof c=="string"){var b={};a.each(c.split(/\s/),function(){b[this]=true});c=b}return c},addMethod:function(b,d,c){a.validator.methods[b]=d;a.validator.messages[b]=c;if(d.length<3){a.validator.addClassRules(b,a.validator.normalizeRule(b))}},methods:{required:function(d,c,e){if(!this.depend(e,c)){return"dependency-mismatch"}switch(c.nodeName.toLowerCase()){case"select":var b=a("option:selected",c);return b.length>0&&(c.type=="select-multiple"||(a.browser.msie&&!(b[0].attributes.value.specified)?b[0].text:b[0].value).length>0);case"input":if(this.checkable(c)){return this.getLength(d,c)>0}default:return a.trim(d).length>0
}},remote:function(f,c,g){if(this.optional(c)){return"dependency-mismatch"}var d=this.previousValue(c);if(!this.settings.messages[c.name]){this.settings.messages[c.name]={}}this.settings.messages[c.name].remote=typeof d.message=="function"?d.message(f):d.message;g=typeof g=="string"&&{url:g}||g;if(d.old!==f){d.old=f;var b=this;this.startRequest(c);var e={};e[c.name]=f;a.ajax(a.extend(true,{url:g,mode:"abort",port:"validate"+c.name,dataType:"json",data:e,success:function(i){if(i){var h=b.formSubmitted;b.prepareElement(c);b.formSubmitted=h;b.successList.push(c);b.showErrors()}else{var j={};j[c.name]=i||b.defaultMessage(c,"remote");b.showErrors(j)}d.valid=i;b.stopRequest(c,i)}},g));return"pending"}else{if(this.pending[c.name]){return"pending"}}return d.valid},minlength:function(c,b,d){return this.optional(b)||this.getLength(a.trim(c),b)>=d},maxlength:function(c,b,d){return this.optional(b)||this.getLength(a.trim(c),b)<=d},rangelength:function(d,b,e){var c=this.getLength(a.trim(d),b);return this.optional(b)||(c>=e[0]&&c<=e[1])
},min:function(c,b,d){return this.optional(b)||c>=d},max:function(c,b,d){return this.optional(b)||c<=d},range:function(c,b,d){return this.optional(b)||(c>=d[0]&&c<=d[1])},email:function(c,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(c)
},url:function(c,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(c)
},date:function(c,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(c))},dateISO:function(c,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(c)},dateDE:function(c,b){return this.optional(b)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(c)},number:function(c,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(c)},numberDE:function(c,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(c)},digits:function(c,b){return this.optional(b)||/^\d+$/.test(c)},creditcard:function(f,c){if(this.optional(c)){return"dependency-mismatch"}if(/[^0-9-]+/.test(f)){return false}var g=0,e=0,b=false;f=f.replace(/\D/g,"");for(n=f.length-1;n>=0;n--){var d=f.charAt(n);var e=parseInt(d,10);if(b){if((e*=2)>9){e-=9}}g+=e;b=!b}return(g%10)==0},accept:function(c,b,d){d=typeof d=="string"?d:"png|jpe?g|gif";return this.optional(b)||c.match(new RegExp(".("+d+")$","i"))},equalTo:function(c,b,d){return c==a(d).val()}}})})(jQuery);(function(c){var b=c.ajax;var a={};
c.ajax=function(e){e=c.extend(e,c.extend({},c.ajaxSettings,e));var d=e.port;if(e.mode=="abort"){if(a[d]){a[d].abort()}return(a[d]=b.apply(this,arguments))}return b.apply(this,arguments)}})(jQuery);(function(a){a.each({focus:"focusin",blur:"focusout"},function(c,b){a.event.special[b]={setup:function(){if(a.browser.msie){return false}this.addEventListener(c,a.event.special[b].handler,true)},teardown:function(){if(a.browser.msie){return false}this.removeEventListener(c,a.event.special[b].handler,true)},handler:function(d){arguments[0]=a.event.fix(d);arguments[0].type=b;return a.event.handle.apply(this,arguments)}}});a.extend(a.fn,{delegate:function(d,c,b){return this.bind(d,function(e){var f=a(e.target);if(f.is(c)){return b.apply(f,arguments)}})},triggerEvent:function(b,c){return this.triggerHandler(b,[a.event.fix({type:b,target:c})])}})})(jQuery);(function(a){a.fn.addOption=function(){var h=function(q,k,m,r){var p=document.createElement("option");p.value=k,p.text=m;var u=q.options;var j=u.length;
if(!q.cache){q.cache={};for(var l=0;l<j;l++){q.cache[u[l].value]=l}}if(typeof q.cache[k]=="undefined"){q.cache[k]=j}q.options[q.cache[k]]=p;if(r){p.selected=true}};var c=arguments;if(c.length==0){return this}var g=true;var b=false;var e,d,f;if(typeof(c[0])=="object"){b=true;e=c[0]}if(c.length>=2){if(typeof(c[1])=="boolean"){g=c[1]}else{if(typeof(c[2])=="boolean"){g=c[2]}}if(!b){d=c[0];f=c[1]}}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}if(b){for(var i in e){h(this,i,e[i],g)}}else{h(this,d,f,g)}});return this};a.fn.ajaxAddOption=function(d,f,b,e,c){if(typeof(d)!="string"){return this}if(typeof(f)!="object"){f={}}if(typeof(b)!="boolean"){b=true}this.each(function(){var g=this;a.getJSON(d,f,function(h){a(g).addOption(h,b);if(typeof e=="function"){if(typeof c=="object"){e.apply(g,c)}else{e.call(g)}}})});return this};a.fn.removeOption=function(){var c=arguments;if(c.length==0){return this}var e=typeof(c[0]);var d,f;if(e=="string"||e=="object"||e=="function"){d=c[0];
if(d.constructor==Array){var b=d.length;for(var g=0;g<b;g++){this.removeOption(d[g],c[1])}return this}}else{if(e=="number"){f=c[0]}else{return this}}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}if(this.cache){this.cache=null}var h=false;var l=this.options;if(!!d){var j=l.length;for(var k=j-1;k>=0;k--){if(d.constructor==RegExp){if(l[k].value.match(d)){h=true}}else{if(l[k].value==d){h=true}}if(h&&c[1]===true){h=l[k].selected}if(h){l[k]=null}h=false}}else{if(c[1]===true){h=l[f].selected}else{h=true}if(h){this.remove(f)}}});return this};a.fn.sortOptions=function(c){var d=a(this).selectedValues();var b=typeof(c)=="undefined"?true:!!c;this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}var g=this.options;var e=g.length;var h=[];for(var f=0;f<e;f++){h[f]={v:g[f].value,t:g[f].text}}h.sort(function(j,i){o1t=j.t.toLowerCase(),o2t=i.t.toLowerCase();if(o1t==o2t){return 0}if(b){return o1t<o2t?-1:1}else{return o1t>o2t?-1:1}});for(var f=0;f<e;f++){g[f].text=h[f].t;
g[f].value=h[f].v}}).selectOptions(d,true);return this};a.fn.selectOptions=function(e,b){var d=e;var g=typeof(e);if(g=="object"&&d.constructor==Array){var f=this;a.each(d,function(){f.selectOptions(this,b)})}var h=b||false;if(g!="string"&&g!="function"&&g!="object"){d=d.toString();g="string"}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}var k=this.options;var c=k.length;for(var j=0;j<c;j++){if(d.constructor==RegExp){if(k[j].value.match(d)){k[j].selected=true}else{if(h){k[j].selected=false}}}else{if(k[j].value==d){k[j].selected=true}else{if(h){k[j].selected=false}}}}});return this};a.fn.copyOptions=function(d,c){var b=c||"selected";if(a(d).size()==0){return this}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}var g=this.options;var e=g.length;for(var f=0;f<e;f++){if(b=="all"||(b=="selected"&&g[f].selected)){a(d).addOption(g[f].value,g[f].text)}}});return this};a.fn.containsOption=function(e,c){var d=false;var b=e;var f=typeof(b);var g=typeof(c);
if(f!="string"&&f!="function"&&f!="object"){return g=="function"?this:d}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}if(d&&g!="function"){return false}var k=this.options;var h=k.length;for(var j=0;j<h;j++){if(b.constructor==RegExp){if(k[j].value.match(b)){d=true;if(g=="function"){c.call(k[j],j)}}}else{if(k[j].value==b){d=true;if(g=="function"){c.call(k[j],j)}}}}});return g=="function"?this:d};a.fn.selectedValues=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.value});return b};a.fn.selectedTexts=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.text});return b};a.fn.selectedOptions=function(){return this.find("option:selected")}})(jQuery);var neolaomp3playerListener;(function(g){var f;var a=false;var d=null;function c(){return g("#neolaomp3player")[0]}function b(){if(!d){return}d.find(".stop-button").hide();d.find(".play-button").show();d=null}function e(){if(!a){return}c().SetVariable("method:stop","")}function h(i,j){if(!a){return
}if(!!d){e();b()}c().SetVariable("method:setUrl",j);c().SetVariable("method:play","");c().SetVariable("enabled","true");d=i;d.find(".play-button").hide();d.find(".stop-button").show()}neolaomp3playerListener={onInit:function(){a=true;g.log("Player available")},onUpdate:function(){var i=(this.isPlaying=="true");if(!i&&!!d){b()}if(i&&!!d&&d.parents("body").length==0){e()}}};g.fn.neolaomp3player=function(){this.each(function(){var j=g(this);var k=j.attr("href");var i;j.after(i=g("<span />").addClass("neolaomp3player"));i.append(g("<a />").addClass("play-button").html('<img src="images/global/miniplay.gif" />').attr({href:"#"}).click(function(l){h(i,k)}));i.append(g("<a />").addClass("stop-button").html('<img src="images/global/ministop.gif" />').attr({href:"#"}).click(function(l){e()}));i.find(".stop-button").hide();j.remove()})}})(jQuery);(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);
c.highlight=c.highlight||function(e){return e};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var b=a(l).attr("autocomplete","off").addClass(g.inputClass);var j;var q="";var m=a.Autocompleter.Cache(g);var e=0;var w;var z={mouseDownOnSelect:false};var t=a.Autocompleter.Select(g,l,d,z);var y;a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){if(y){y=false;return false}});b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(A){w=A.keyCode;switch(A.keyCode){case c.UP:A.preventDefault();if(t.visible()){t.prev()
}else{v(0,true)}break;case c.DOWN:A.preventDefault();if(t.visible()){t.next()}else{v(0,true)}break;case c.PAGEUP:A.preventDefault();if(t.visible()){t.pageUp()}else{v(0,true)}break;case c.PAGEDOWN:A.preventDefault();if(t.visible()){t.pageDown()}else{v(0,true)}break;case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:if(d()){A.preventDefault();y=true;return false}break;case c.ESC:t.hide();break;default:clearTimeout(j);j=setTimeout(v,g.delay);break}}).focus(function(){e++}).blur(function(){e=0;if(!z.mouseDownOnSelect){u()}}).click(function(){if(e++>1&&!t.visible()){v(0,true)}}).bind("search",function(){var A=(arguments.length>1)?arguments[1]:null;function B(F,E){var C;if(E&&E.length){for(var D=0;D<E.length;D++){if(E[D].result.toLowerCase()==F.toLowerCase()){C=E[D];break}}}if(typeof A=="function"){A(C)}else{b.trigger("result",C&&[C.data,C.value])}}a.each(h(b.val()),function(C,D){f(D,B,B)})}).bind("flushCache",function(){m.flush()}).bind("setOptions",function(){a.extend(g,arguments[1]);
if("data" in arguments[1]){m.populate()}}).bind("unautocomplete",function(){t.unbind();b.unbind();a(l.form).unbind(".autocomplete")});function d(){var B=t.selected();if(!B){return false}var A=B.result;q=A;if(g.multiple){var C=h(b.val());if(C.length>1){A=C.slice(0,C.length-1).join(g.multipleSeparator)+g.multipleSeparator+A}A+=g.multipleSeparator}b.val(A);x();b.trigger("result",[B.data,B.value]);return true}function v(C,B){if(w==c.DEL){t.hide();return}var A=b.val();if(!B&&A==q){return}q=A;A=i(A);if(A.length>=g.minChars){b.addClass(g.loadingClass);if(!g.matchCase){A=A.toLowerCase()}f(A,k,x)}else{o();t.hide()}}function h(B){if(!B){return[""]}var C=B.split(g.multipleSeparator);var A=[];a.each(C,function(D,E){if(a.trim(E)){A[D]=a.trim(E)}});return A}function i(A){if(!g.multiple){return A}var B=h(A);return B[B.length-1]}function r(A,B){if(g.autoFill&&(i(b.val()).toLowerCase()==A.toLowerCase())&&w!=c.BACKSPACE){b.val(b.val()+B.substring(i(q).length));a.Autocompleter.Selection(l,q.length,q.length+B.length)
}}function u(){clearTimeout(j);j=setTimeout(x,200)}function x(){var A=t.visible();t.hide();clearTimeout(j);o();if(g.mustMatch){b.search(function(B){if(!B){if(g.multiple){var C=h(b.val()).slice(0,-1);b.val(C.join(g.multipleSeparator)+(C.length?g.multipleSeparator:""))}else{b.val("")}}})}if(A){a.Autocompleter.Selection(l,l.value.length,l.value.length)}}function k(B,A){if(A&&A.length&&e){o();t.display(A,B);r(B,A[0].value);t.show()}else{x()}}function f(B,D,A){if(!g.matchCase){B=B.toLowerCase()}var C=m.load(B);if(C&&C.length){D(B,C)}else{if((typeof g.url=="string")&&(g.url.length>0)){var E={timestamp:+new Date()};a.each(g.extraParams,function(F,G){E[F]=typeof G=="function"?G():G});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:g.dataType,url:g.url,data:a.extend({q:i(B),limit:g.max},E),success:function(G){var F=g.parse&&g.parse(G)||p(G);m.add(B,F);D(B,F)}})}else{t.emptyList();A(B)}}}function p(D){var A=[];var C=D.split("\n");for(var B=0;B<C.length;B++){var E=a.trim(C[B]);if(E){E=E.split("|");
A[A.length]={data:E,value:E[0],result:g.formatResult&&g.formatResult(E,E[0])||E[0]}}}return A}function o(){b.removeClass(g.loadingClass)}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};a.Autocompleter.Cache=function(c){var f={};var d=0;function h(l,k){if(!c.matchCase){l=l.toLowerCase()}var j=l.indexOf(k);if(j==-1){return false}return j==0||c.matchContains}function g(j,i){if(d>c.cacheLength){b()}if(!f[j]){d++}f[j]=i}function e(){if(!c.data){return false}var k={},j=0;
if(!c.url){c.cacheLength=1}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var q=c.data[m];q=(typeof q=="string")?[q]:q;var p=c.formatMatch(q,m+1,c.data.length);if(p===false){continue}var o=p.charAt(0).toLowerCase();if(!k[o]){k[o]=[]}var r={value:p,data:q,result:c.formatResult&&c.formatResult(q)||p};k[o].push(r);if(j++<c.max){k[""].push(r)}}a.each(k,function(t,u){c.cacheLength++;g(t,u)})}setTimeout(e,25);function b(){f={};d=0}return{flush:b,add:g,populate:e,load:function(o){if(!c.cacheLength||!d){return null}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var p=f[j];a.each(p,function(q,k){if(h(k.value,o)){m.push(k)}})}}return m}else{if(f[o]){return f[o]}else{if(c.matchSubset){for(var l=o.length-1;l>=c.minChars;l--){var p=f[o.substr(0,l)];if(p){var m=[];a.each(p,function(q,k){if(h(k.value,o)){m[m.length]=k}});return m}}}}}return null}}};a.Autocompleter.Select=function(e,j,l,q){var i={ACTIVE:"ac_over"};var k,f=-1,t,m="",u=true,c,p;function o(){if(!u){return}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(document.body);
p=a("<ul/>").appendTo(c).mouseover(function(v){if(r(v).nodeName&&r(v).nodeName.toUpperCase()=="LI"){f=a("li",p).removeClass(i.ACTIVE).index(r(v));a(r(v)).addClass(i.ACTIVE)}}).click(function(v){a(r(v)).addClass(i.ACTIVE);l();j.focus();return false}).mousedown(function(){q.mouseDownOnSelect=true}).mouseup(function(){q.mouseDownOnSelect=false});if(e.width>0){c.css("width",e.width)}u=false}function r(w){var v=w.target;while(v&&v.tagName!="LI"){v=v.parentNode}if(!v){return[]}return v}function h(v){k.slice(f,f+1).removeClass(i.ACTIVE);g(v);var x=k.slice(f,f+1).addClass(i.ACTIVE);if(e.scroll){var w=0;k.slice(0,f).each(function(){w+=this.offsetHeight});if((w+x[0].offsetHeight-p.scrollTop())>p[0].clientHeight){p.scrollTop(w+x[0].offsetHeight-p.innerHeight())}else{if(w<p.scrollTop()){p.scrollTop(w)}}}}function g(v){f+=v;if(f<0){f=k.size()-1}else{if(f>=k.size()){f=0}}}function b(v){return e.max&&e.max<v?e.max:v}function d(){p.empty();var w=b(t.length);for(var x=0;x<w;x++){if(!t[x]){continue}var y=e.formatItem(t[x].data,x+1,w,t[x].value,m);
if(y===false){continue}var v=a("<li/>").html(e.highlight(y,m)).addClass(x%2==0?"ac_even":"ac_odd").appendTo(p)[0];a.data(v,"ac_data",t[x])}k=p.find("li");if(e.selectFirst){k.slice(0,1).addClass(i.ACTIVE);f=0}if(a.fn.bgiframe){p.bgiframe()}}return{display:function(w,v){o();t=w;m=v;d()},next:function(){h(1)},prev:function(){h(-1)},pageUp:function(){if(f!=0&&f-8<0){h(-f)}else{h(-8)}},pageDown:function(){if(f!=k.size()-1&&f+8>k.size()){h(k.size()-1-f)}else{h(8)}},hide:function(){c&&c.hide();k&&k.removeClass(i.ACTIVE);f=-1},visible:function(){return c&&c.is(":visible")},current:function(){return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0])},show:function(){var x=a(j).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),top:x.top+j.offsetHeight,left:x.left}).show();if(e.scroll){p.scrollTop(0);p.css({overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var v=0;k.each(function(){v+=this.offsetHeight});var w=v>e.scrollHeight;
p.css("height",w?e.scrollHeight:v);if(!w){k.width(p.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")))}}}},selected:function(){var v=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);return v&&v.length&&a.data(v[0],"ac_data")},emptyList:function(){p&&p.empty()},unbind:function(){c&&c.remove()}}};a.Autocompleter.Selection=function(d,e,c){if(d.createTextRange){var b=d.createTextRange();b.collapse(true);b.moveStart("character",e);b.moveEnd("character",c);b.select()}else{if(d.setSelectionRange){d.setSelectionRange(e,c)}else{if(d.selectionStart){d.selectionStart=e;d.selectionEnd=c}}}d.focus()}})(jQuery);Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.abbrMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.firstDayOfWeek=1;
Date.format="dd/mm/yyyy";Date.fullYearStart="20";(function(){function b(c,d){if(!Date.prototype[c]){Date.prototype[c]=d}}b("isLeapYear",function(){var c=this.getFullYear();return(c%4==0&&c%100!=0)||c%400==0});b("isWeekend",function(){return this.getDay()==0||this.getDay()==6});b("isWeekDay",function(){return !this.isWeekend()});b("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]});b("getDayName",function(c){return c?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()]});b("getMonthName",function(c){return c?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()]});b("getDayOfYear",function(){var c=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-c.getTime())/86400000)});b("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});b("setDayOfYear",function(c){this.setMonth(0);this.setDate(c);return this});b("addYears",function(c){this.setFullYear(this.getFullYear()+c);return this
});b("addMonths",function(d){var c=this.getDate();this.setMonth(this.getMonth()+d);if(c>this.getDate()){this.addDays(-this.getDate())}return this});b("addDays",function(c){this.setTime(this.getTime()+(c*86400000));return this});b("addHours",function(c){this.setHours(this.getHours()+c);return this});b("addMinutes",function(c){this.setMinutes(this.getMinutes()+c);return this});b("addSeconds",function(c){this.setSeconds(this.getSeconds()+c);return this});b("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});b("asString",function(d){var c=d||Date.format;return c.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("mmmm").join(this.getMonthName(false)).split("mmm").join(this.getMonthName(true)).split("mm").join(a(this.getMonth()+1)).split("dd").join(a(this.getDate())).split("HH").join(a(this.getHours())).split("MM").join(a(this.getMinutes())).split("SS").join(a(this.getSeconds()))});
b("asUTCString",function(d){var c=d||Date.format;return c.split("yyyy").join(this.getUTCFullYear()).split("yy").join((this.getUTCFullYear()+"").substring(2)).split("mm").join(a(this.getUTCMonth()+1)).split("dd").join(a(this.getUTCDate())).split("HH").join(a(this.getUTCHours())).split("MM").join(a(this.getUTCMinutes())).split("SS").join(a(this.getUTCSeconds()))});Date.fromString=function(o){var j=Date.format;var m=new Date("01/01/1977");var k=0;var c=j.indexOf("mmmm");if(c>-1){for(var g=0;g<Date.monthNames.length;g++){var e=o.substr(c,Date.monthNames[g].length);if(Date.monthNames[g]==e){k=Date.monthNames[g].length-4;break}}m.setMonth(g)}else{c=j.indexOf("mmm");if(c>-1){var e=o.substr(c,3);for(var g=0;g<Date.abbrMonthNames.length;g++){if(Date.abbrMonthNames[g]==e){break}}m.setMonth(g)}else{m.setMonth(Number(o.substr(j.indexOf("mm"),2))-1)}}var l=j.indexOf("yyyy");if(l>-1){if(c<l){l+=k}m.setFullYear(Number(o.substr(l,4)))}else{if(c<l){l+=k}m.setFullYear(Number(Date.fullYearStart+o.substr(j.indexOf("yy"),2)))
}var h=j.indexOf("dd");if(c<h){h+=k}m.setDate(Number(o.substr(h,2)));if(isNaN(m.getTime())){return false}return m};var a=function(c){var d="0"+c;return d.substring(d.length-2)}})();(function(d){d.fn.extend({renderCalendar:function(u){var D=function(i){return document.createElement(i)};u=d.extend({},d.fn.datePicker.defaults,u);if(u.showHeader!=d.dpConst.SHOW_HEADER_NONE){var p=d(D("tr"));for(var y=Date.firstDayOfWeek;y<Date.firstDayOfWeek+7;y++){var h=y%7;var x=Date.dayNames[h];p.append(jQuery(D("th")).attr({scope:"col",abbr:x,title:x,"class":(h==0||h==6?"weekend":"weekday")}).html(u.showHeader==d.dpConst.SHOW_HEADER_SHORT?x.substr(0,1):x))}}var e=d(D("table")).attr({cellspacing:2}).addClass("jCalendar").append((u.showHeader!=d.dpConst.SHOW_HEADER_NONE?d(D("thead")).append(p):D("thead")));var f=d(D("tbody"));var A=(new Date()).zeroTime();var C=u.month==undefined?A.getMonth():u.month;var q=u.year||A.getFullYear();var m=new Date(q,C,1);var l=Date.firstDayOfWeek-m.getDay()+1;if(l>1){l-=7}var t=Math.ceil(((-1*l+1)+m.getDaysInMonth())/7);
m.addDays(l-1);var B=function(i){return function(){if(u.hoverClass){var r=d(this);if(!u.selectWeek){r.addClass(u.hoverClass)}else{if(i&&!r.is(".disabled")){r.parent().addClass("activeWeekHover")}}}}};var g=function(){if(u.hoverClass){var i=d(this);i.removeClass(u.hoverClass);i.parent().removeClass("activeWeekHover")}};var o=0;while(o++<t){var v=jQuery(D("tr"));var k=u.dpController?m>u.dpController.startDate:false;for(var y=0;y<7;y++){var j=m.getMonth()==C;var z=d(D("td")).text(m.getDate()+"").addClass((j?"current-month ":"other-month ")+(m.isWeekend()?"weekend ":"weekday ")+(j&&m.getTime()==A.getTime()?"today ":"")).data("datePickerDate",m.asString()).hover(B(k),g);v.append(z);if(u.renderCallback){u.renderCallback(z,m,C,q)}m=new Date(m.getFullYear(),m.getMonth(),m.getDate()+1)}f.append(v)}e.append(f);return this.each(function(){d(this).empty().append(e)})},datePicker:function(e){if(!d.event._dpCache){d.event._dpCache=[]}e=d.extend({},d.fn.datePicker.defaults,e);return this.each(function(){var g=d(this);
var i=true;if(!this._dpId){this._dpId=d.event.guid++;d.event._dpCache[this._dpId]=new a(this);i=false}if(e.inline){e.createButton=false;e.displayClose=false;e.closeOnSelect=false;g.empty()}var f=d.event._dpCache[this._dpId];f.init(e);if(!i&&e.createButton){f.button=d('<a href="#" class="dp-choose-date" title="'+d.dpText.TEXT_CHOOSE_DATE+'">'+d.dpText.TEXT_CHOOSE_DATE+"</a>").bind("click",function(){g.dpDisplay(this);this.blur();return false});g.after(f.button)}if(!i&&g.is(":text")){g.bind("dateSelected",function(k,j,l){this.value=j.asString()}).bind("change",function(){if(this.value==""){f.clearSelected()}else{var j=Date.fromString(this.value);if(j){f.setSelected(j,true,true)}}});if(e.clickInput){g.bind("click",function(){g.trigger("change");g.dpDisplay()})}var h=Date.fromString(this.value);if(this.value!=""&&h){f.setSelected(h,true,true)}}g.addClass("dp-applied")})},dpSetDisabled:function(e){return b.call(this,"setDisabled",e)},dpSetStartDate:function(e){return b.call(this,"setStartDate",e)
},dpSetEndDate:function(e){return b.call(this,"setEndDate",e)},dpGetSelected:function(){var e=c(this[0]);if(e){return e.getSelected()}return null},dpSetSelected:function(i,g,f,h){if(g==undefined){g=true}if(f==undefined){f=true}if(h==undefined){h=true}return b.call(this,"setSelected",Date.fromString(i),g,f,h)},dpSetDisplayedMonth:function(e,f){return b.call(this,"setDisplayedMonth",Number(e),Number(f),true)},dpDisplay:function(f){return b.call(this,"display",f)},dpSetRenderCallback:function(e){return b.call(this,"setRenderCallback",e)},dpSetPosition:function(e,f){return b.call(this,"setPosition",e,f)},dpSetOffset:function(e,f){return b.call(this,"setOffset",e,f)},dpClose:function(){return b.call(this,"_closeCalendar",false,this[0])},_dpDestroy:function(){}});var b=function(h,g,e,j,i){return this.each(function(){var f=c(this);if(f){f[h](g,e,j,i)}})};function a(e){this.ele=e;this.displayedMonth=null;this.displayedYear=null;this.startDate=null;this.endDate=null;this.showYearNavigation=null;
this.closeOnSelect=null;this.displayClose=null;this.rememberViewedMonth=null;this.selectMultiple=null;this.numSelectable=null;this.numSelected=null;this.verticalPosition=null;this.horizontalPosition=null;this.verticalOffset=null;this.horizontalOffset=null;this.button=null;this.renderCallback=[];this.selectedDates={};this.inline=null;this.context="#dp-popup";this.settings={}}d.extend(a.prototype,{init:function(e){this.setStartDate(e.startDate);this.setEndDate(e.endDate);this.setDisplayedMonth(Number(e.month),Number(e.year));this.setRenderCallback(e.renderCallback);this.showYearNavigation=e.showYearNavigation;this.closeOnSelect=e.closeOnSelect;this.displayClose=e.displayClose;this.rememberViewedMonth=e.rememberViewedMonth;this.selectMultiple=e.selectMultiple;this.numSelectable=e.selectMultiple?e.numSelectable:1;this.numSelected=0;this.verticalPosition=e.verticalPosition;this.horizontalPosition=e.horizontalPosition;this.hoverClass=e.hoverClass;this.setOffset(e.verticalOffset,e.horizontalOffset);
this.inline=e.inline;this.settings=e;if(this.inline){this.context=this.ele;this.display()}},setStartDate:function(e){if(e){this.startDate=Date.fromString(e)}if(!this.startDate){this.startDate=(new Date()).zeroTime()}this.setDisplayedMonth(this.displayedMonth,this.displayedYear)},setEndDate:function(e){if(e){this.endDate=Date.fromString(e)}if(!this.endDate){this.endDate=(new Date("12/31/2999"))}if(this.endDate.getTime()<this.startDate.getTime()){this.endDate=this.startDate}this.setDisplayedMonth(this.displayedMonth,this.displayedYear)},setPosition:function(e,f){this.verticalPosition=e;this.horizontalPosition=f},setOffset:function(e,f){this.verticalOffset=parseInt(e)||0;this.horizontalOffset=parseInt(f)||0},setDisabled:function(e){$e=d(this.ele);$e[e?"addClass":"removeClass"]("dp-disabled");if(this.button){$but=d(this.button);$but[e?"addClass":"removeClass"]("dp-disabled");$but.attr("title",e?"":d.dpText.TEXT_CHOOSE_DATE)}if($e.is(":text")){$e.attr("disabled",e?"disabled":"")}},setDisplayedMonth:function(f,o,j){if(this.startDate==undefined||this.endDate==undefined){return
}var i=new Date(this.startDate.getTime());i.setDate(1);var l=new Date(this.endDate.getTime());l.setDate(1);var h;if((!f&&!o)||(isNaN(f)&&isNaN(o))){h=new Date().zeroTime();h.setDate(1)}else{if(isNaN(f)){h=new Date(o,this.displayedMonth,1)}else{if(isNaN(o)){h=new Date(this.displayedYear,f,1)}else{h=new Date(o,f,1)}}}if(h.getTime()<i.getTime()){h=i}else{if(h.getTime()>l.getTime()){h=l}}var g=this.displayedMonth;var k=this.displayedYear;this.displayedMonth=h.getMonth();this.displayedYear=h.getFullYear();if(j&&(this.displayedMonth!=g||this.displayedYear!=k)){this._rerenderCalendar();d(this.ele).trigger("dpMonthChanged",[this.displayedMonth,this.displayedYear])}},setSelected:function(l,e,f,h){if(l<this.startDate||l>this.endDate){return}var g=this.settings;if(g.selectWeek){l=l.addDays(-(l.getDay()-Date.firstDayOfWeek+7)%7);if(l<this.startDate){return}}if(e==this.isSelected(l)){return}if(this.selectMultiple==false){this.clearSelected()}else{if(e&&this.numSelected==this.numSelectable){return}}if(f&&(this.displayedMonth!=l.getMonth()||this.displayedYear!=l.getFullYear())){this.setDisplayedMonth(l.getMonth(),l.getFullYear(),true)
}this.selectedDates[l.toString()]=e;this.numSelected+=e?1:-1;var j="td."+(l.getMonth()==this.displayedMonth?"current-month":"other-month");var k;d(j,this.context).each(function(){if(d(this).data("datePickerDate")==l.asString()){k=d(this);if(g.selectWeek){k.parent()[e?"addClass":"removeClass"]("selectedWeek")}k[e?"addClass":"removeClass"]("selected")}});d("td",this.context).not(".selected")[this.selectMultiple&&this.numSelected==this.numSelectable?"addClass":"removeClass"]("unselectable");if(h){var g=this.isSelected(l);$e=d(this.ele);var i=Date.fromString(l.asString());$e.trigger("dateSelected",[i,k,g]);$e.trigger("change")}},isSelected:function(e){return this.selectedDates[e.toString()]},getSelected:function(){var e=[];for(s in this.selectedDates){if(this.selectedDates[s]==true){e.push(Date.parse(s))}}return e},clearSelected:function(){this.selectedDates={};this.numSelected=0;d("td.selected",this.context).removeClass("selected").parent().removeClass("selectedWeek")},display:function(e){if(d(this.ele).is(".dp-disabled")){return
}e=e||this.ele;var m=this;var i=d(e);var l=i.offset();var o;var p;var g;var j;if(m.inline){o=d(this.ele);p={id:"calendar-"+this.ele._dpId,"class":"dp-popup dp-popup-inline"};d(".dp-popup",o).remove();j={}}else{o=d("body");p={id:"dp-popup","class":"dp-popup"};j={top:l.top+m.verticalOffset,left:l.left+m.horizontalOffset};var k=function(t){var q=t.target;var r=d("#dp-popup")[0];while(true){if(q==r){return true}else{if(q==document){m._closeCalendar();return false}else{q=d(q).parent()[0]}}}};this._checkMouse=k;m._closeCalendar(true);d(document).bind("keydown.datepicker",function(q){if(q.keyCode==27){m._closeCalendar()}})}if(!m.rememberViewedMonth){var h=this.getSelected()[0];if(h){h=new Date(h);this.setDisplayedMonth(h.getMonth(),h.getFullYear(),false)}}o.append(d("<div></div>").attr(p).css(j).append(d("<h2></h2>"),d('<div class="dp-nav-prev"></div>').append(d('<a class="dp-nav-prev-year" href="#" title="'+d.dpText.TEXT_PREV_YEAR+'">&lt;&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,-1)
}),d('<a class="dp-nav-prev-month" href="#" title="'+d.dpText.TEXT_PREV_MONTH+'">&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,-1,0)})),d('<div class="dp-nav-next"></div>').append(d('<a class="dp-nav-next-year" href="#" title="'+d.dpText.TEXT_NEXT_YEAR+'">&gt;&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,1)}),d('<a class="dp-nav-next-month" href="#" title="'+d.dpText.TEXT_NEXT_MONTH+'">&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,1,0)})),d('<div class="dp-calendar"></div>')).bgIframe());var f=this.inline?d(".dp-popup",this.context):d("#dp-popup");if(this.showYearNavigation==false){d(".dp-nav-prev-year, .dp-nav-next-year",m.context).css("display","none")}if(this.displayClose){f.append(d('<a href="#" id="dp-close">'+d.dpText.TEXT_CLOSE+"</a>").bind("click",function(){m._closeCalendar();return false}))}m._renderCalendar();d(this.ele).trigger("dpDisplayed",f);if(!m.inline){if(this.verticalPosition==d.dpConst.POS_BOTTOM){f.css("top",l.top+i.height()-f.height()+m.verticalOffset)
}if(this.horizontalPosition==d.dpConst.POS_RIGHT){f.css("left",l.left+i.width()-f.width()+m.horizontalOffset)}d(document).bind("mousedown.datepicker",this._checkMouse)}},setRenderCallback:function(e){if(e==null){return}if(e&&typeof(e)=="function"){e=[e]}this.renderCallback=this.renderCallback.concat(e)},cellRender:function(i,e,g,f){var j=this.dpController;var h=new Date(e.getTime());i.bind("click",function(){var k=d(this);if(!k.is(".disabled")){j.setSelected(h,!k.is(".selected")||!j.selectMultiple,false,true);if(j.closeOnSelect){j._closeCalendar()}if(!d.browser.msie){d(j.ele).trigger("focus",[d.dpConst.DP_INTERNAL_FOCUS])}}});if(j.isSelected(h)){i.addClass("selected");if(j.settings.selectWeek){i.parent().addClass("selectedWeek")}}else{if(j.selectMultiple&&j.numSelected==j.numSelectable){i.addClass("unselectable")}}},_applyRenderCallbacks:function(){var e=this;d("td",this.context).each(function(){for(var f=0;f<e.renderCallback.length;f++){$td=d(this);e.renderCallback[f].apply(this,[$td,Date.fromString($td.data("datePickerDate")),e.displayedMonth,e.displayedYear])
}});return},_displayNewMonth:function(f,e,g){if(!d(f).is(".disabled")){this.setDisplayedMonth(this.displayedMonth+e,this.displayedYear+g,true)}f.blur();return false},_rerenderCalendar:function(){this._clearCalendar();this._renderCalendar()},_renderCalendar:function(){d("h2",this.context).html((new Date(this.displayedYear,this.displayedMonth,1)).asString(d.dpText.HEADER_FORMAT));d(".dp-calendar",this.context).renderCalendar(d.extend({},this.settings,{month:this.displayedMonth,year:this.displayedYear,renderCallback:this.cellRender,dpController:this,hoverClass:this.hoverClass}));if(this.displayedYear==this.startDate.getFullYear()&&this.displayedMonth==this.startDate.getMonth()){d(".dp-nav-prev-year",this.context).addClass("disabled");d(".dp-nav-prev-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var i=d(this);if(Number(i.text())>20){i.addClass("disabled")}});var h=this.startDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var i=d(this);
if(Number(i.text())<h){i.addClass("disabled")}})}else{d(".dp-nav-prev-year",this.context).removeClass("disabled");d(".dp-nav-prev-month",this.context).removeClass("disabled");var h=this.startDate.getDate();if(h>20){var f=this.startDate.getTime();var g=new Date(f);g.addMonths(1);if(this.displayedYear==g.getFullYear()&&this.displayedMonth==g.getMonth()){d(".dp-calendar td.other-month",this.context).each(function(){var i=d(this);if(Date.fromString(i.data("datePickerDate")).getTime()<f){i.addClass("disabled")}})}}}if(this.displayedYear==this.endDate.getFullYear()&&this.displayedMonth==this.endDate.getMonth()){d(".dp-nav-next-year",this.context).addClass("disabled");d(".dp-nav-next-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var i=d(this);if(Number(i.text())<14){i.addClass("disabled")}});var h=this.endDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var i=d(this);if(Number(i.text())>h){i.addClass("disabled")
}})}else{d(".dp-nav-next-year",this.context).removeClass("disabled");d(".dp-nav-next-month",this.context).removeClass("disabled");var h=this.endDate.getDate();if(h<13){var e=new Date(this.endDate.getTime());e.addMonths(-1);if(this.displayedYear==e.getFullYear()&&this.displayedMonth==e.getMonth()){d(".dp-calendar td.other-month",this.context).each(function(){var i=d(this);if(Number(i.text())>h){i.addClass("disabled")}})}}}this._applyRenderCallbacks()},_closeCalendar:function(e,f){if(!f||f==this.ele){d(document).unbind("mousedown.datepicker");d(document).unbind("keydown.datepicker");this._clearCalendar();d("#dp-popup a").unbind();d("#dp-popup").empty().remove();if(!e){d(this.ele).trigger("dpClosed",[this.getSelected()])}}},_clearCalendar:function(){d(".dp-calendar td",this.context).unbind();d(".dp-calendar",this.context).empty()}});d.dpConst={SHOW_HEADER_NONE:0,SHOW_HEADER_SHORT:1,SHOW_HEADER_LONG:2,POS_TOP:0,POS_BOTTOM:1,POS_LEFT:0,POS_RIGHT:1,DP_INTERNAL_FOCUS:"dpInternalFocusTrigger"};
d.dpText={TEXT_PREV_YEAR:"Previous year",TEXT_PREV_MONTH:"Previous month",TEXT_NEXT_YEAR:"Next year",TEXT_NEXT_MONTH:"Next month",TEXT_CLOSE:"Close",TEXT_CHOOSE_DATE:"Choose date",HEADER_FORMAT:"mmmm yyyy"};d.dpVersion="$Id: jquery.datePicker.js 70 2009-04-05 19:25:15Z kelvin.luck $";d.fn.datePicker.defaults={month:undefined,year:undefined,showHeader:d.dpConst.SHOW_HEADER_SHORT,startDate:undefined,endDate:undefined,inline:false,renderCallback:null,createButton:true,showYearNavigation:true,closeOnSelect:true,displayClose:false,selectMultiple:false,numSelectable:Number.MAX_VALUE,clickInput:false,rememberViewedMonth:true,selectWeek:false,verticalPosition:d.dpConst.POS_TOP,horizontalPosition:d.dpConst.POS_LEFT,verticalOffset:0,horizontalOffset:0,hoverClass:"dp-hover"};function c(e){if(e._dpId){return d.event._dpCache[e._dpId]}return false}if(d.fn.bgIframe==undefined){d.fn.bgIframe=function(){return this}}d(window).bind("unload",function(){var f=d.event._dpCache||[];for(var e in f){d(f[e].ele)._dpDestroy()
}})})(jQuery);var TRMApi={constants:{WORLD_ZOOM:2,COUNTRY_ZOOM:7,FOOTPRINT_ZOOM:9,CITY_ZOOM:11,STREET_ZOOM:15,POI_ZOOM:17,USER_ZOOM:15,FRONTPAGE_ZOOM:3,EMAIL_REGEX:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/,DEFAULT_IMAGE:{thumbnailUrl:"/images/content/add_new/no_image.gif",imageUrl:"/images/content/add_new/no_image.gif"},DEFAULT_USER_IMAGE:{thumbnailUrl:"/images/global/hummba_default_user_thumb.png",imageUrl:"/images/global/hummba_default_user_thumb.png"}}};
(function($){var loadTime=(new Date()).getTime();var shuttingDown=false;Number.prototype.toRad=function(){return this*Math.PI/180};Number.prototype.toDeg=function(){return this*180/Math.PI};Number.prototype.toBrng=function(){return(this.toDeg()+360)%360};var subSessionName=Math.random();if(typeof(console)!="undefined"&&typeof(console.log)!="undefined"){$.log=function(){$("<div />").text(((new Date()).getTime()-loadTime)+": "+arguments[0]).prependTo("#waiting_log");switch(arguments.length){case 0:console.log("log mark");break;case 1:console.log(arguments[0]);break;case 2:console.log(arguments[0],arguments[1]);break;case 3:console.log(arguments[0],arguments[1],arguments[2]);break;case 4:console.log(arguments[0],arguments[1],arguments[2],arguments[3]);break;case 5:console.log(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);break;default:console.log(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);break}}}else{$.log=function(){$("<div />").text(((new Date()).getTime()-loadTime)+": "+arguments[0]).prependTo("#waiting_log")
}}$.fn.log=function(msg){$.log("%s: %o",msg,this);return this};$.fn.clearOptions=function(){this.each(function(){this.cache=null;while(this.options.length){this.remove(0)}});return this};$.fn.bindOptions=function(data,options){var opts=$.extend({valueProperty:"value",textProperty:"text",clear:true,preserveSelection:true},options);var selectedValues=this.selectedValues();if(opts.clear){this.clearOptions()}var self=this;$.each(data,function(){self.addOption(this[opts.valueProperty],this[opts.textProperty],false)});if(opts.preserveSelection){this.selectOptions(selectedValues,true)}return this};$.fn.getSelectedOptionText=function(){var text=null;this.selectedOptions().each(function(){text=$(this).text()});return text};$.fn.serializeMap=function(){var s={};this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&/checkbox/i.test(this.type)&&!this.checked&&this.value=="true"}).each(function(){s[this.name]=["false"]
});$.each(this.serializeArray(),function(){if(!s[this.name]){s[this.name]=[]}s[this.name].push(this.value)});return s};$.isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};Date.prototype.toHummbaTimestamp=function(){return Math.round((Date.UTC(this.getUTCFullYear(),this.getUTCMonth(),this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds())-Date.UTC(2000,0,1,0,0,0))/1000)};function getBindExpression(elem){var bindExpression=elem.name;if(elem.className){$.each(elem.className.split(/\s+/),function(){if(this.substr(0,5)=="bind_"){bindExpression=this.substr(5)}})}return bindExpression}function inArray(elem,array){for(var i=0,length=array.length;i<length;i++){if(array[i].toString()==elem.toString()){return true}}return false}$.fn.checkRadio=function(isChecked){this.each(function(){if(!!isChecked&&this.type.toLowerCase()=="radio"){$(this).parents("form").find("input[@type='radio'][@name='"+this.name+"']").checkRadio(false)}this.checked=this.defaultChecked=!!isChecked
})};$.fn.unserializeMap=function(map){var mapcpy=$.extend({},map);$(":input",this).each(function(){var name=getBindExpression(this);if(!name){return}var val;try{val=eval("mapcpy."+name)}catch(e){}if(typeof(val)=="undefined"){return}val=val||"";if(!$.isArray(val)){if(val.constructor==Date){val=val.asString()}else{val=val.toString()}}var nodeName=this.nodeName.toLowerCase();if(nodeName=="input"||nodeName=="textarea"){if(this.type.toLowerCase()=="checkbox"||this.type.toLowerCase()=="radio"){if($.isArray(val)){$(this).checkRadio(inArray(this.value,val))}else{$(this).checkRadio(this.value==val)}}else{var singleValue=$.isArray(val)?val.shift():val;$(this).val(singleValue)}}else{if(nodeName=="select"){$(this).selectOptions(val,true)}}})};var executingServiceCalls=0;TRMApi.serviceCall=function(options){this.options=$.extend({form:null,serviceName:"",params:{},method:"GET",complete:function(){},success:function(){},exceptionHandlers:{},message:options.serviceName,suppressWaiting:false,waitingType:"waiting-1"},options);
$.log("serviceCall: "+this.options.serviceName);$.extend(this.options.exceptionHandlers,{FileTooBigException:this.onFileTooBigException,WrongFileFormatException:this.onWrongFileFormatException,UserChangedException:this.onUserChangedException});if(TRMApi.session.user){$.extend(this.options.params,{u:TRMApi.session.user.UserId})}};TRMApi.serviceCall.prototype.onWrongFileFormatException=function(exception){alert("The format of the file you tried to upload was not recognized.")};TRMApi.serviceCall.prototype.onFileTooBigException=function(exception){alert("The file you tried to upload exceeds the allowed size.")};TRMApi.serviceCall.prototype.onUserChangedException=function(exception){if(shuttingDown){return}TRMApi.services.sessionExpired()};TRMApi.serviceCall.prototype.onUnhandledException=function(exception){if(shuttingDown){return}exception=$.extend({},{Type:"UnknownException",Message:"no message",Detail:""},exception);var msg="Unhandled exception "+exception.Type+': "'+exception.Message+'" calling service '+this.options.serviceName+"\r\n\r\n"+exception.Detail;
try{TRMApi.ui.message({Message:'An error occured processing your request. <a href="#" onclick="TRMApi.ui.dialogs.messageDialog.close(\'more-info\')">More Info</a>.',Title:"Error",OnClose:function(result){if(result=="more-info"){alert(msg)}}})}catch(e){alert(msg)}$.log(msg);jQuery.ajax({type:"POST",url:"/JsonFrontController.ashx?op=LogError",data:{Reporter:"JavaScript",Message:msg},dataType:"json"})};TRMApi.serviceCall.prototype.execute=function(){var _this=this;var waitHandle;if(!this.options.suppressWaiting){waitHandle=TRMApi.callbacks.onStartWait(this.options.message||"",this.options.waitingType)}executingServiceCalls++;function createException(type,message){return{Type:type,Message:message}}function processData(data){_this.data=data;$.log("serviceCall: "+_this.options.serviceName+": processData");try{_this.options.complete();if(!data._jsonResponse){data={_jsonResponse:true,_exception:createException("NoJsonResponseException","There was no _jsonResponse tag in the response.")}}var exception=data._exception;
if(exception){if(_this.options.exceptionHandlers["*"]){_this.options.exceptionHandlers["*"].call(_this,exception)}if(_this.options.exceptionHandlers[exception.Type]){_this.options.exceptionHandlers[exception.Type].call(_this,exception);return}_this.onUnhandledException(exception);return}$.log("serviceCall: "+_this.options.serviceName+": calling success() callback.");_this.options.success(data);if(data.__fb_PublishUserAction){TRMApi.callbacks.onFacebookPublishUserAction(data.__fb_PublishUserAction)}$.log("serviceCall: "+_this.options.serviceName+": success() callback done.")}finally{if(!_this.options.suppressWaiting){TRMApi.callbacks.onEndWait(waitHandle)}executingServiceCalls--}}switch(this.options.method.toLowerCase()){case"get":case"post":this.retryCount=3;this.requestFunction=function(){return jQuery.ajax({type:this.options.method.toUpperCase(),url:"/JsonFrontController.ashx?op="+this.options.serviceName+"&ss="+subSessionName,data:this.options.params,success:function(data,textStatus){_this.textStatus=textStatus;
processData(data)},error:function(xhr,textStatus,errorThrown){if(_this.retryCount>0){$.log("serviceCall: "+_this.options.serviceName+": error, retrying in 2 secs...");_this.retryCount--;setTimeout(function(){_this.httpRequest=_this.requestFunction()},2000);return}_this.textStatus=textStatus;processData({_jsonResponse:true,_exception:createException("AjaxException",'Error while submitting request, textStatus: "'+textStatus+'", errorThrown: "'+errorThrown+'", responseText: "'+(xhr.responseText||"none")+'"')})},dataType:"json"})};this.httpRequest=this.requestFunction();break;case"frame":TRMApi.callbacks.onFrameCallComplete=processData;$(this.options.form).attr({target:"submit_iframe",action:this.options.actionUrl||"/JsonFrontController.ashx?op="+this.options.serviceName+"&f=window.parent.TRMApi.callbacks.onFrameCallComplete"}).bind("ready.frameCall",function(){$(_this.options.form).unbind("ready.frameCall");_this.options.complete()})[0].submit();break}};TRMApi.session={user:null,configuration:{},languages:[],projects:[],trips:[],footprints:[],breadcrumbs:[],groups:[],explicitFootprints:[],relations:[],others:[],categories:[],countries:[],interests:[],footprintPhotos:{},searchCriteria:{},homeCountry:{},pendingInvitation:null,countryById:function(countryId){for(var i=0;
i<this.countries.length;i++){if(this.countries[i].CountryId==countryId){return this.countries[i]}}return null},footprintById:function(footprintId){for(var i=0;i<this.footprints.length;i++){if(this.footprints[i].FootprintId==footprintId){return this.footprints[i]}}return null},friends:function(){var friends=[];$.each(this.relations,function(){if(this.Type=="Friend"){friends.push(this)}});return friends},friendIds:function(){var friends=[];$.each(this.relations,function(){if(this.Type=="Friend"){friends.push(this.User2Id)}});return friends},isFriend:function(userId){var isFriend=false;$.each(this.relations,function(){if(this.Type=="Friend"&&this.User2Id==userId){isFriend=true}});return isFriend},isAdmin:function(){return TRMApi.session.user.UserRole&&(TRMApi.session.user.UserRole&4096!=0)},isBannerAdmin:function(){return TRMApi.session.user.UserId==TRMApi.session.configuration.BannerUserId}};TRMApi.services={};TRMApi.util={};TRMApi.callbacks={onSessionStart:function(){alert("onSessionStart unhandled.")
},onUserChanged:function(userData){alert("onUserChanged unhandled.")},onProjectsChanged:function(){alert("onProjectsChanged unhandled.")},onTripsChanged:function(){alert("onTripsChanged unhandled.")},onBreadcrumbsChanged:function(){alert("onBreadcrumbsChanged unhandled.")},onFootprintsChanged:function(){alert("onFootprintsChanged unhandled.")},onRelationsChanged:function(){alert("onRelationsChanged unhandled.")},onExplicitFootprintsChanged:function(){alert("onExplicitFootprintsChanged unhandled.")},onGroupsChanged:function(){alert("onGroupsChanged unhandled.")},onUnconfirmedUserLogin:function(userName){alert("onUnconfirmedUserLogin unhandled.")},onUploadImageComplete:function(data){alert("onUploadImageComplete unhandled.")},onStartWait:function(msg){return null},onEndWait:function(handle){},onLoginRequired:function(){alert("onLoginRequired unhandled.")},onFacebookPublishUserAction:function(action){},onSignalsStart:function(){},onOtherChanged:function(user){},onNotifications:function(notification){},onSignalsEnd:function(){}};
var pagers={};TRMApi.callService_=function(options){options.params=options.params||{};$.each(pagers,function(idx){options.params["__pg_"+idx]=this[0]+","+this[1]});pagers={};var serviceCall=new TRMApi.serviceCall(options);serviceCall.execute();return serviceCall};TRMApi.services.setPager=function(pagerName,firstItem,lastItem){pagers[pagerName]=[firstItem,lastItem]};var backgroundSearchCriteria={};var activeSearchCriteria=null;TRMApi.services.setLanguageId=function(languageId){if(languageId==""||languageId==0){languageId=0}backgroundSearchCriteria["Crit.LanguageId"]=languageId};TRMApi.services.getLanguageId=function(){return backgroundSearchCriteria["Crit.LanguageId"]};TRMApi.services.setShowItems=function(value){backgroundSearchCriteria.Show=value};TRMApi.services.getShowItems=function(){return backgroundSearchCriteria.Show};TRMApi.services.setShowItems("AudioGuides");TRMApi.services.setSearchCriteria=function(searchCriteria){if(!searchCriteria){TRMApi.services.clearSearchCriteria();return
}function assignField(fieldName){if(searchCriteria[fieldName]&&searchCriteria[fieldName].length>0&&searchCriteria[fieldName][0].length>0){activeSearchCriteria["Crit."+fieldName]=searchCriteria[fieldName][0]}}activeSearchCriteria={};$.each("Name CategoryId LanguageId UserName OnlyUnapproved OnlyReportedAsSpam OnlyAdvertisement MinStarsRating".split(" "),function(){assignField(this)});if(searchCriteria.Tags&&searchCriteria.Tags.length>0&&searchCriteria.Tags[0].length){activeSearchCriteria["Crit.Tags"]=[];var tags=searchCriteria.Tags[0].split(",");$.each(tags,function(){if(this.length){activeSearchCriteria["Crit.Tags"].push(this)}})}};TRMApi.services.clearSearchCriteria=function(){activeSearchCriteria=null};var processedVideos={};var processedVideosObservers=[];TRMApi.services.getUptodateMedia=function(media){if(!media||!media.MediaId||!processedVideos[media.MediaId]){return media}return processedVideos[media.MediaId]};TRMApi.services.addProcessedVideosObserver=function(callback){processedVideosObservers.push(callback)
};TRMApi.services.removeProcessedVideosObserver=function(callback){processedVideosObservers=$.grep(processedVideosObservers,function(e){return e!=callback})};TRMApi.services._fillImageTag=function(img,media,handlerUrl,defaultImageUrl){media=TRMApi.services.getUptodateMedia(media);if(!media||!media.MediaId){img.attr("src",defaultImageUrl).removeClass("unprocessed-video").removeAttr("mediaId").removeAttr("mediaHandler")}else{if(media.Type=="Video"&&media.VideoState!="Ready"){img.attr("src","/images/content/unprocessed_video.jpg").addClass("unprocessed-video")}else{img.attr("src",handlerUrl+"?mediaId="+media.MediaId).removeClass("unprocessed-video")}img.attr("mediaId",media.MediaId);img.attr("mediaHandler",handlerUrl)}};TRMApi.services._onProcessedVideos=function(){$("img.unprocessed-video").each(function(){var img=$(this);if(!processedVideos[img.attr("mediaId")]){return}TRMApi.services._fillImageTag(img,processedVideos[img.attr("mediaId")],img.attr("mediaHandler"),null)});$.each(processedVideosObservers,function(){this(processedVideos)
})};TRMApi.services._getImageTag=function(media,handlerUrl,defaultImageUrl){var img=$("<img />");TRMApi.services._fillImageTag(img,media,handlerUrl,defaultImageUrl);return img};TRMApi.services.getImageThumbnailTag=function(media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;return TRMApi.services._getImageTag(media,"/Thumbnail.ashx",defaultImage.thumbnailUrl)};TRMApi.services.getImageThumbnailTagHtml=function(media,defaultImage){return $("<div />").append(TRMApi.services.getImageThumbnailTag(media,defaultImage)).html()};TRMApi.services.fillImageThumbnailTag=function(img,media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;TRMApi.services._fillImageTag(img,media,"/Thumbnail.ashx",defaultImage.thumbnailUrl);return img};TRMApi.services.getImageTag=function(media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;return TRMApi.services._getImageTag(media,"/Image.ashx",defaultImage.thumbnailUrl)};TRMApi.services.getImageTagHtml=function(media,defaultImage){return $("<div />").append(TRMApi.services.getImageTag(media,defaultImage)).html()
};TRMApi.services.fillImageTag=function(img,media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;TRMApi.services._fillImageTag(img,media,"/Image.ashx",defaultImage.thumbnailUrl);return img};TRMApi.services._getImageUrl=function(media,handlerUrl,defaultImageUrl){var mediaId;media=TRMApi.services.getUptodateMedia(media);if(media&&media.MediaId){if(media.Type=="Video"&&media.VideoState!="Ready"){return"/images/content/unprocessed_video.jpg"}mediaId=media.MediaId}else{mediaId=media}return !mediaId?defaultImageUrl:handlerUrl+"?mediaId="+mediaId};TRMApi.services.getImageThumbnailUrl=function(media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;return TRMApi.services._getImageUrl(media,"/Thumbnail.ashx",defaultImage.thumbnailUrl)};TRMApi.services.getImageUrl=function(media,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;return TRMApi.services._getImageUrl(media,"/Image.ashx",defaultImage.imageUrl)};TRMApi.services.getCountryFlagUrl=function(iso){iso=iso.replace(/-.*$/,"");
return"/images/flags/"+iso+".png"};TRMApi.services.getAdvertisementUrl=function(mediaId,defaultImage){defaultImage=defaultImage||TRMApi.constants.DEFAULT_IMAGE;return !mediaId?defaultImage.imageUrl:"/Image.ashx?pro=yes&mediaId="+mediaId};TRMApi.services.getMp3Url=function(mediaId){return"Audio.ashx?mediaId="+mediaId};TRMApi.services.login=function(username,password,callback){TRMApi.callService_({serviceName:"Login",method:"POST",params:{Username:username,Password:password,Terminal:"PC"},waitingType:"waiting-2",success:function(response){if(!response.LoginResult){TRMApi.ui.showValidationErrorDialog("The specified username or password was invalid.",function(){if(callback){callback(false)}});return}TRMApi.session.user=response.User;TRMApi.session.pendingInvitation=response.PendingInvitation||null;TRMApi.callbacks.onUserChanged(response.User);if(callback){callback(true)}},exceptionHandlers:{UserNotConfirmedException:function(exception){TRMApi.callbacks.onUnconfirmedUserLogin(username)}}})};
TRMApi.services.linkFb=function(username,password,callback){TRMApi.callService_({serviceName:"LinkFb",method:"POST",params:{Username:username,Password:password},success:function(response){callback(response.Success)}})};TRMApi.services.loginFb=function(fbSession,isAutomatic,callback){TRMApi.callService_({serviceName:"LoginFb",method:"POST",params:{UserId:fbSession.uid,SessionKey:fbSession.session_key,Secret:fbSession.secret,Expires:fbSession.expires},suppressWaiting:true,success:function(response){if(!response.LoginResult){if(callback){callback(false)}return}TRMApi.session.user=response.User;TRMApi.session.pendingInvitation=response.PendingInvitation||null;if(callback){callback(true)}TRMApi.callbacks.onUserChanged(response.User)},exceptionHandlers:{UserNotConfirmedException:function(exception){if(!isAutomatic){TRMApi.callbacks.onUnconfirmedUserLogin("facebook")}}}})};TRMApi.services.connectFb=function(fbSession,callback){TRMApi.callService_({serviceName:"ConnectFb",method:"POST",params:{UserId:fbSession.uid,SessionKey:fbSession.session_key,Secret:fbSession.secret,Expires:fbSession.expires},success:function(response){callback(response.User,response.FacebookFullName)
}})};TRMApi.services.registerFb=function(data,callback){TRMApi.callService_({serviceName:"RegisterFb",method:"POST",params:data,success:function(response){TRMApi.session.user=response.User;TRMApi.callbacks.onUserChanged(response.User)}})};TRMApi.services.getFacebookPublishTargets=function(callback){TRMApi.callService_({serviceName:"GetFacebookPublishTargets",method:"POST",params:{},success:function(response){callback(response.PublishTargets)}})};TRMApi.services.sendConfirmationEmail=function(email,callback){TRMApi.callService_({serviceName:"SendConfirmationEmail",method:"POST",params:{Email:email},success:function(response){callback(true)},exceptionHandlers:{InvalidEmailAddressException:function(exception){callback(false)},UserAlreadyConfirmedException:function(exception){callback(false)}}})};TRMApi.services.confirmEmail=function(email,confirmationCode,callback){TRMApi.callService_({serviceName:"ConfirmEmailAddress",method:"POST",params:{Email:email,ConfirmationCode:confirmationCode},success:function(response){TRMApi.session.user=response.User;
TRMApi.callbacks.onUserChanged(response.User);callback(true)},exceptionHandlers:{InvalidEmailAddressException:function(exception){callback("InvalidEmailAddressException")},UserAlreadyConfirmedException:function(exception){callback("UserAlreadyConfirmedException")}}})};TRMApi.services.logout=function(){TRMApi.callService_({serviceName:"Logout",success:function(response){TRMApi.session.user=response.User;TRMApi.callbacks.onUserChanged(response.User)}})};var signalTimer=null;var unprocessedVideosTimer=null;function processSignal(signal){switch(signal.Name){case"status":TRMApi.session.others[signal.Data.UserId]=signal.Data;TRMApi.callbacks.onOtherChanged(signal.Data);break;case"relations":processNewRelations(signal.Data);break;case"notifications":$.each(signal.Data,function(){if(this.ParamFootprintId){TRMApi.services.refreshFootprint(this.ParamFootprintId)}if(this.Type=="GroupBreadcrumbAdded"){TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(this.ParamGroupId).clear()}if(this.Type=="GroupCommented"){TRMApi.util.DataSource.getGroupCommentsDataSource(this.ParamGroupId).clear()
}});TRMApi.callbacks.onNotifications(signal.Data);break;case"conversations":TRMApi.util.DataSource.getConversationHeadersDataSource()._injectData(signal.Data);break;case"footprints":TRMApi.util.DataSource.getFootprintsDataSource(signal.Data).clear();break}}function unprocessedVideosTimerHandler(){unprocessedVideosTimer=null;if(executingServiceCalls){$.log("postponing GetReadyVideos due to a pending request...");unprocessedVideosTimer=window.setTimeout(unprocessedVideosTimerHandler,10000);return}var unprocessedVideosIds=[];var ids={};$("img.unprocessed-video").each(function(){ids[$(this).attr("mediaId")]=true});$.each(ids,function(idx){unprocessedVideosIds.push(idx)});function processReadyVideos(videos){if(videos.length==0){return}$.each(videos,function(){processedVideos[this.MediaId]=this});TRMApi.services._onProcessedVideos()}if(unprocessedVideosIds.length>0){TRMApi.callService_({serviceName:"GetReadyVideos",method:"POST",params:{MediaIds:unprocessedVideosIds},success:function(response){processReadyVideos(response.Media)
},complete:function(){unprocessedVideosTimer=window.setTimeout(unprocessedVideosTimerHandler,10000)},suppressWaiting:true})}else{unprocessedVideosTimer=window.setTimeout(unprocessedVideosTimerHandler,10000)}}function signalTimerHandler(){signalTimer=null;if(!subSessionName){return}if(executingServiceCalls){$.log("postponing GetSignals due to a pending request...");signalTimer=window.setTimeout(signalTimerHandler,3000);return}TRMApi.callService_({serviceName:"GetSignals",success:function(response){TRMApi.callbacks.onSignalsStart();$.each(response.Signals,function(){processSignal(this)});TRMApi.callbacks.onSignalsEnd()},complete:function(){signalTimer=window.setTimeout(signalTimerHandler,30000)},suppressWaiting:true})}TRMApi.services.fillSession=function(response){TRMApi.session.user=response.User;TRMApi.session.configuration=response.Configuration;TRMApi.session.languages=response.Languages;TRMApi.session.projects=response.Projects;TRMApi.session.categories=response.Categories;TRMApi.session.countries=response.Countries;
TRMApi.session.interests=response.Interests;TRMApi.session.pendingInvitation=response.PendingInvitation||null;var country=$.grep(TRMApi.session.countries,function(e){return e.Iso3166==response.GeoIpIso3166});if(country.length){TRMApi.session.homeCountry=country[0]}else{TRMApi.session.homeCountry=TRMApi.session.countries[0]}};TRMApi.services.startSession=function(){TRMApi.callService_({serviceName:"GetSession",params:{Enumerations:"Languages, Categories, Countries, Interests"},waitingType:"waiting-2",success:function(response){TRMApi.session.isStarted=true;TRMApi.services.fillSession(response);TRMApi.callbacks.onSessionStart();signalTimerHandler();unprocessedVideosTimerHandler()}})};TRMApi.services.endSession=function(){if(signalTimer){window.clearTimeout(signalTimer);signalTimer=null}TRMApi.callService_({serviceName:"EndSession",success:function(response){}});subSessionName=null};TRMApi.services.getCitiesByCountry=function(countryId,callback){TRMApi.callService_({serviceName:"GetCitiesByCountry",params:{CountryId:countryId},success:function(response){callback(response.Cities)
}})};function serializeClips(clips){return{ClipIds:$.map(clips,function(n){return n.ClipId}),ClipNames:$.map(clips,function(n){return n.Name}),ClipMediaIds:$.map(clips,function(n){return n.MediaId})}}TRMApi.services.register=function(user,callback){TRMApi.callService_({serviceName:"Register",method:"POST",params:$.extend({},user,{Terminal:"PC"}),success:function(response){callback(response.NewUser)}})};TRMApi.services.forgottenPassword=function(username,email,captcha,callback){TRMApi.callService_({serviceName:"ForgottenPassword",method:"POST",params:{UserName:username,Email:email,Captcha:captcha},success:function(response){callback(response)}})};TRMApi.services.forgottenPassword2=function(username,password,callback){TRMApi.callService_({serviceName:"ForgottenPassword2",method:"POST",params:{UserName:username,Password:password},success:function(response){callback(response)}})};TRMApi.services.changePassword=function(request,callback){TRMApi.callService_({serviceName:"ChangePassword",method:"POST",params:request,success:function(response){callback(response.Success)
}})};TRMApi.services.saveTrip=function(trip,callback){TRMApi.callService_({serviceName:"SaveTrip",method:"POST",params:trip,success:function(response){if($.isFunction(callback)){callback(response.Trip)}}})};TRMApi.services.saveFootprint=function(footprint,callback){var req=$.extend({},footprint,{FootprintFlags:footprint.Flags});delete req.Flags;TRMApi.callService_({serviceName:"SaveFootprint",method:"POST",params:req,success:function(response){if($.isFunction(callback)){callback(response.Footprint)}}})};TRMApi.services.saveProject=function(project,callback){TRMApi.callService_({serviceName:"SaveProject",method:"POST",params:project,success:function(response){if($.isFunction(callback)){callback(response.Project)}}})};TRMApi.services.savePoi=function(oldpoi,poi,callback){TRMApi.callService_({serviceName:"SavePoi",method:"POST",params:$.extend({},serializeClips(poi.Clips),poi,{Type:"Poi",Position:""+poi.Position[0]+","+poi.Position[1]}),success:function(response){if(oldpoi){TRMApi.util.DataSource.getProjectMapItemsDataSource(oldpoi.ProjectId).clear()
}TRMApi.util.DataSource.getProjectMapItemsDataSource(response.MapItem.ProjectId).clear();if($.isFunction(callback)){callback(response.MapItem)}}})};TRMApi.services.deleteMapItem=function(mapItem,callback){TRMApi.callService_({serviceName:"DeleteMapItem",method:"POST",params:{MapItemId:mapItem.MapItemId},success:function(){callback();TRMApi.util.DataSource.getProjectMapItemsDataSource(mapItem.ProjectId).clear();$.each(TRMApi.session.trips,function(){var trip=this;var tripDataSource=TRMApi.util.DataSource.getTripMapItemsDataSource(trip.TripId);if(tripDataSource.isDataReady()){$.each(tripDataSource.getData(),function(){var tripMapItem=this;if(tripMapItem.MapItemId==mapItem.MapItemId){TRMApi.util.DataSource.getTripMapItemsDataSource(trip.TripId).clear()}})}})}})};TRMApi.services.approveMapItem=function(mapItemId,callback){TRMApi.callService_({serviceName:"ApproveMapItem",method:"POST",params:{MapItemId:mapItemId},success:callback})};TRMApi.services.approveMapItemsInTrip=function(tripId,callback){TRMApi.callService_({serviceName:"ApproveMapItemsInTrip",method:"POST",params:{TripId:tripId},success:callback})
};TRMApi.services.reportSpamOnMapItem=function(mapItemId,callback){TRMApi.callService_({serviceName:"ReportSpamOnMapItem",method:"POST",params:{MapItemId:mapItemId},success:callback})};TRMApi.services.saveArea=function(oldarea,area,callback){TRMApi.callService_({serviceName:"SaveArea",method:"POST",params:$.extend({},serializeClips(area.Clips),area,{Type:"Area",Points:$.map(area.Points,function(p){return""+p[0]+","+p[1]})}),success:function(response){if(oldarea){TRMApi.util.DataSource.getProjectMapItemsDataSource(oldarea.ProjectId).clear()}TRMApi.util.DataSource.getProjectMapItemsDataSource(response.MapItem.ProjectId).clear();if($.isFunction(callback)){callback(response.MapItem)}}})};TRMApi.services.saveUser=function(user,callback){TRMApi.callService_({serviceName:"SaveUser",method:"POST",params:user,success:function(response){TRMApi.session.user=response.User;TRMApi.callbacks.onUserChanged(response.User);callback(response.User)}})};TRMApi.services.upgradeFbUser=function(user,callback){TRMApi.callService_({serviceName:"UpgradeFbUser",method:"POST",params:user,success:function(response){TRMApi.session.user=response.NewUser;
TRMApi.callbacks.onUserChanged(response.NewUser);callback(response.NewUser)}})};TRMApi.services.saveUserStatus=function(userId,status,callback){TRMApi.callService_({serviceName:"SaveUserStatus",method:"POST",params:{UserId:userId,Status:status},success:function(response){TRMApi.session.user=response.User;TRMApi.callbacks.onUserChanged(response.User);if(callback){callback(response.User)}}})};TRMApi.services.saveUserPosition=function(userId,position,location,callback){TRMApi.callService_({serviceName:"SaveUserPosition",method:"POST",params:{UserId:userId,Position:!position?null:""+position[0]+","+position[1],Location:location},success:function(response){TRMApi.session.user=response.User;TRMApi.callbacks.onUserChanged(response.User);if(callback){callback(response.User)}}})};TRMApi.services.getProjects=function(userId,callback){TRMApi.callService_({serviceName:"GetProjects",params:{UserId:userId},success:function(response){TRMApi.session.projects=response.Projects;TRMApi.callbacks.onProjectsChanged();
if($.isFunction(callback)){callback()}}})};function processNewRelations(relations){TRMApi.session.relations=relations;$.each(relations,function(){TRMApi.session.others[this.User2.UserId]=this.User2});TRMApi.callbacks.onRelationsChanged()}TRMApi.services.getUserRelations=function(userId,callback){TRMApi.callService_({serviceName:"GetUserRelations",params:{UserId:userId},success:function(response){if(userId==TRMApi.session.user.UserId){processNewRelations(response.Relations)}if($.isFunction(callback)){callback(response.Relations)}}})};TRMApi.services.getTrips=function(userId,callback){TRMApi.callService_({serviceName:"GetTrips",params:{UserId:userId},success:function(response){if(userId==TRMApi.session.user.UserId){TRMApi.session.trips=response.Trips;TRMApi.callbacks.onTripsChanged()}if($.isFunction(callback)){callback(response.Trips)}}})};TRMApi.services.getTrip=function(tripId,callback){TRMApi.callService_({serviceName:"GetTrip",params:{TripId:tripId},success:function(response){callback(response.Trip)
}})};TRMApi.services.getExplicitFootprints=function(callback){TRMApi.callService_({serviceName:"GetExplicitFootprints",params:{},success:function(response){TRMApi.session.explicitFootprints=response.Footprints;TRMApi.callbacks.onExplicitFootprintsChanged();if($.isFunction(callback)){callback(response.Footprints)}}})};TRMApi.services.removeExplicitFootprint=function(footprintId,callback){TRMApi.callService_({serviceName:"RemoveExplicitFootprint",params:{FootprintId:footprintId},success:function(response){TRMApi.session.explicitFootprints=response.Footprints;TRMApi.callbacks.onExplicitFootprintsChanged();if($.isFunction(callback)){callback(response.Footprints)}}})};TRMApi.services.getFootprints=function(userId,callback){TRMApi.callService_({serviceName:"GetFootprints",params:{UserId:userId},success:function(response){if(userId==TRMApi.session.user.UserId){TRMApi.session.footprints=response.Footprints;TRMApi.callbacks.onFootprintsChanged()}if($.isFunction(callback)){callback(response.Footprints)
}}})};TRMApi.services.getBreadcrumb=function(breadcrumbId,callback){TRMApi.callService_({serviceName:"GetBreadcrumb",params:{BreadcrumbId:breadcrumbId},success:function(response){if($.isFunction(callback)){callback(response.Breadcrumb)}},exceptionHandlers:{AccessDeniedException:function(exception){callback(null)}}})};TRMApi.services.getBreadcrumbComments=function(breadcrumbId,callback){TRMApi.callService_({serviceName:"GetBreadcrumbComments",params:{BreadcrumbId:breadcrumbId},success:function(result){callback(result.BreadcrumbComments)}})};TRMApi.services.resetBreadcrumbHasComment=function(breadcrumbId,callback){TRMApi.callService_({serviceName:"ResetBreadcrumbHasComment",params:{BreadcrumbId:breadcrumbId},success:function(result){var breadcrumb=result.Breadcrumb;TRMApi.util.DataSource.getBreadcrumbsDataSource(breadcrumb.UserId)._injectItem(breadcrumb);if(callback){callback(result)}}})};TRMApi.services.addBreadcrumbComment=function(breadcrumbId,comment,callback){TRMApi.callService_({serviceName:"AddBreadcrumbComment",params:{BreadcrumbId:breadcrumbId,Comment:comment},success:function(result){var comments=result.BreadcrumbComments;
TRMApi.util.DataSource.getBreadcrumbCommentsDataSource(breadcrumbId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.deleteBreadcrumbComment=function(breadcrumbId,breadcrumbCommentId,callback){TRMApi.callService_({serviceName:"DeleteBreadcrumbComment",params:{BreadcrumbCommentId:breadcrumbCommentId},success:function(result){var comments=result.BreadcrumbComments;TRMApi.util.DataSource.getBreadcrumbCommentsDataSource(breadcrumbId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.getBreadcrumbs0=function(userId,callback){TRMApi.callService_({serviceName:"GetBreadcrumbs",params:{UserId:userId},success:function(response){if(userId==TRMApi.session.user.UserId){TRMApi.session.breadcrumbs=response.Breadcrumbs;TRMApi.callbacks.onBreadcrumbsChanged()}if($.isFunction(callback)){callback(response.Breadcrumbs)}}})};TRMApi.services.getBreadcrumbs=function(userId,callback){return TRMApi.services.getBreadcrumbs0(userId,function(data){TRMApi.util.DataSource.getBreadcrumbsDataSource(userId)._injectData(data);
if($.isFunction(callback)){callback(data)}})};TRMApi.services.deleteBreadcrumb=function(breadcrumbId,reason,callback){TRMApi.callService_({serviceName:"DeleteBreadcrumb",params:{BreadcrumbId:breadcrumbId,Reason:reason},success:callback})};TRMApi.services.saveBreadcrumb=function(breadcrumb,callback){var req=$.extend({},breadcrumb);if(req.BreadcrumbId){delete req.Position}else{req.Position=""+breadcrumb.Position[0]+","+breadcrumb.Position[1]}TRMApi.callService_({serviceName:"SaveBreadcrumb",method:"POST",params:req,success:function(response){if($.isFunction(callback)){callback(response.Breadcrumb)}}})};TRMApi.services.getStatistics=function(startdate,enddate,grouping,split,eventType,eventSubtype,unique,callback){TRMApi.callService_({serviceName:"GetStatistics",params:{StartDate:startdate,EndDate:enddate,Grouping:grouping,Split:split,EventType:eventType,EventSubtype:eventSubtype,Unique:unique},success:function(response){callback(response)}})};TRMApi.services.getMapItem=function(mapItemId,callback){TRMApi.callService_({serviceName:"GetMapItem",params:{MapItemId:mapItemId},success:function(response){callback(response.MapItem)
}})};TRMApi.services.getContent=function(contentId,callback){TRMApi.callService_({serviceName:"GetContent",params:{ContentId:contentId},success:function(response){callback(response.Content)}})};TRMApi.services.saveContent=function(contentId,content,callback){TRMApi.callService_({serviceName:"SaveContent",params:{ContentId:contentId,Content:content},success:function(response){callback()}})};TRMApi.services.getFriendOfAllUsers=function(callback){TRMApi.callService_({serviceName:"GetFriendOfAllUsers",params:{},success:function(response){callback(response.Users)}})};TRMApi.services.getGroupOfAllUsers=function(callback){TRMApi.callService_({serviceName:"GetGroupOfAllUsers",params:{},success:function(response){callback(response.Groups)}})};TRMApi.services.scheduleEmail=function(targetGroup,subject,content,callback){TRMApi.callService_({serviceName:"ScheduleEmail",params:{TargetGroup:targetGroup,Subject:subject,Content:content},success:function(response){callback(response.Email)}})};TRMApi.services.uploadImage=function(fileForm,callback){TRMApi.callService_({serviceName:"UploadImage",form:fileForm,method:"frame",success:function(data){callback(data)
}})};TRMApi.services.uploadKml=function(fileForm,callback){TRMApi.callService_({serviceName:"UploadKml",form:fileForm,method:"frame",success:function(data){callback(data)}})};TRMApi.services.uploadKmlFootprint=function(fileForm,callback){TRMApi.callService_({serviceName:"UploadKmlFootprint",form:fileForm,method:"frame",success:function(data){callback(data)}})};TRMApi.services.uploadAudio=function(fileForm,callback){TRMApi.callService_({serviceName:"UploadAudio",form:fileForm,method:"frame",success:function(data){callback(data)}})};TRMApi.services.getMapItems=function(swlat,swlng,nelat,nelng,callback){TRMApi.callService_({serviceName:"GetMapItems",params:$.extend({Sw:swlat+","+swlng,Ne:nelat+","+nelng},activeSearchCriteria,backgroundSearchCriteria),success:callback,suppressWaiting:true})};TRMApi.services.getBannersByArea=function(swlat,swlng,nelat,nelng,callback){TRMApi.callService_({serviceName:"GetBannersByArea",params:{Sw:swlat+","+swlng,Ne:nelat+","+nelng,__pg_Banners:"0,10"},success:function(response){callback(response.Banners)
},suppressWaiting:true})};TRMApi.services.getSearchResultSummary=function(callback){TRMApi.callService_({serviceName:"GetSearchResultSummary",params:$.extend({},activeSearchCriteria,backgroundSearchCriteria),success:function(data){callback(data.Summary)}})};TRMApi.services.getFootprintLevelPoints=function(footprintId,precisionlevel,callback){TRMApi.callService_({serviceName:"GetFootprintLevelPoints",params:{FootprintId:footprintId,PrecisionLevel:precisionlevel},success:function(data){callback(data.LevelPoints)}})};TRMApi.services.shortNameAvailable=function(shortName,callback){TRMApi.callService_({serviceName:"ShortNameAvailable",params:{ShortName:shortName},success:callback,exceptionHandlers:{"*":function(){callback({IsAvailable:false})}}})};TRMApi.services.emailAvailable=function(email,callback){TRMApi.callService_({serviceName:"EmailAvailable",params:{Email:email},success:callback,exceptionHandlers:{"*":function(){callback({IsAvailable:false})}}})};TRMApi.services.verifyCaptcha=function(value,callback){TRMApi.callService_({serviceName:"VerifyCaptcha",params:{Captcha:value},success:callback,exceptionHandlers:{"*":function(){callback({IsValid:false})
}}})};TRMApi.services.getProjectMapItems=function(projectId,callback){TRMApi.callService_({serviceName:"GetProjectMapItems",params:{ProjectId:projectId},success:function(response){callback(response.MapItems)}})};TRMApi.services.getTripMapItems=function(tripId,callback){TRMApi.callService_({serviceName:"GetTripMapItems",params:{TripId:tripId},success:function(response){callback(response.MapItems)}})};TRMApi.services.getFootprintPhotos=function(footprintId,callback){TRMApi.callService_({serviceName:"GetFootprintPhotos",params:{FootprintId:footprintId},success:function(response){callback(response.FootprintPhotos)}})};TRMApi.services.getTripPhotos=function(tripId,callback){TRMApi.callService_({serviceName:"GetTripPhotos",params:{TripId:tripId},success:function(response){callback(response.TripPhotos)}})};TRMApi.services.refreshFootprintPhotos=function(footprintId){TRMApi.util.DataSource.getFootprintPhotosDataSource(footprintId).clear()};TRMApi.services.refreshFootprint=function(footprintId){var regex=new RegExp("^Footprint(Points|Photos)."+footprintId);
$.each(dataSources,function(idx){if(idx.match(regex)&&this.isDataReady()){this.clear()}})};TRMApi.services.refreshAllGroupBreadcrumbs=function(){var regex=new RegExp("^GroupBreadcrumbs.");$.each(dataSources,function(idx){if(idx.match(regex)&&this.isDataReady()){this.clear()}})};TRMApi.services.refreshProject=function(projectId){TRMApi.util.DataSource.getProjectMapItemsDataSource(projectId).clear()};TRMApi.services.deleteTrip=function(tripId,callback){TRMApi.callService_({serviceName:"DeleteTrip",params:{TripId:tripId},success:callback})};TRMApi.services.deleteFootprint=function(footprintId,callback){TRMApi.callService_({serviceName:"DeleteFootprint",params:{FootprintId:footprintId},success:callback})};TRMApi.services.shareFootprint=function(request,callback){TRMApi.callService_({serviceName:"ShareFootprint",params:request,success:callback})};TRMApi.services.deleteFootprintPhoto=function(footprintPhotoId,reason,callback){TRMApi.callService_({serviceName:"DeleteFootprintPhoto",params:{FootprintPhotoId:footprintPhotoId,Reason:reason},success:callback})
};TRMApi.services.rotateFootprintPhoto=function(footprintPhotoId,angle,callback){TRMApi.callService_({serviceName:"RotateFootprintPhoto",params:{FootprintPhotoId:footprintPhotoId,Degrees:angle},success:callback})};TRMApi.services.rotateBreadcrumb=function(breadcrumbId,angle,callback){TRMApi.callService_({serviceName:"RotateBreadcrumb",params:{BreadcrumbId:breadcrumbId,Degrees:angle},success:callback})};TRMApi.services.saveFootprintPhoto=function(footprintPhoto,callback){TRMApi.callService_({serviceName:"SaveFootprintPhoto",params:{FootprintPhotoId:footprintPhoto.FootprintPhotoId,Description:footprintPhoto.Description},success:callback})};TRMApi.services.deleteProject=function(projectId,callback){TRMApi.callService_({serviceName:"DeleteProject",params:{ProjectId:projectId},success:callback})};TRMApi.services.addTripMapItems=function(tripId,items,callback){TRMApi.callService_({serviceName:"AddTripMapItems",params:{TripId:tripId,Id:items},success:function(data){TRMApi.util.DataSource.getTripMapItemsDataSource(tripId)._injectData(data.MapItems);
callback(data)}})};TRMApi.services.getTripMapItemCount=function(trip){var dataSource=TRMApi.util.DataSource.getTripMapItemsDataSource(trip.TripId);if(dataSource.isDataReady()){return dataSource.getData().length}return trip.NumberOfMapItems};TRMApi.services.deleteTripMapItems=function(tripId,items,callback){TRMApi.callService_({serviceName:"DeleteTripMapItems",params:{TripId:tripId,Id:items},success:function(data){TRMApi.util.DataSource.getTripMapItemsDataSource(tripId)._injectData(data.MapItems);callback(data)}})};TRMApi.services.rateMapItem=function(mapItemId,value,callback){TRMApi.callService_({serviceName:"RateMapItem",params:{MapItemId:mapItemId,Value:value},success:function(response){callback(response.NewRating)}})};TRMApi.services.getApplications=function(callback){TRMApi.callService_({serviceName:"GetApplications",params:{},success:callback})};TRMApi.services.embedFootprint=function(request,callback){TRMApi.callService_({serviceName:"EmbedFootprint",params:request,success:callback})
};TRMApi.services.embedTrip=function(request,callback){TRMApi.callService_({serviceName:"EmbedTrip",params:request,success:callback})};TRMApi.services.getUsers=function(request,callback){TRMApi.callService_({serviceName:"GetUsers",params:request,success:callback})};TRMApi.services.getUser=function(userId,callback){TRMApi.callService_({serviceName:"GetUser",params:{UserId:userId},success:function(response){callback(response.User)}})};TRMApi.services.getUserByUserName=function(userName,callback){TRMApi.callService_({serviceName:"GetUserBy",params:{UserName:userName},success:function(response){callback(response.User)}})};TRMApi.services.makeUserFriendOfAll=function(userId,callback){TRMApi.callService_({serviceName:"MakeUserFriendOfAll",params:{UserId:userId},success:function(response){callback(response)}})};TRMApi.services.makeGroupOfAll=function(groupId,callback){TRMApi.callService_({serviceName:"MakeGroupOfAll",params:{GroupId:groupId},success:function(response){callback(response)}})};TRMApi.services.inviteUsers=function(userList,callback){TRMApi.callService_({serviceName:"InviteUsers",params:{UserIds:userList},success:function(){callback();
TRMApi.util.DataSource.getRequestedFriendsDataSource(TRMApi.session.user.UserId).clear()}})};TRMApi.services.inviteUsersToGroup=function(userList,groupId,callback){TRMApi.callService_({serviceName:"InviteUsersToGroup",params:{UserIds:userList,GroupId:groupId},success:callback})};TRMApi.services.inviteOthers=function(request,callback){TRMApi.callService_({serviceName:"InviteOthers",params:request,success:callback})};TRMApi.services.acceptFriend=function(userRelationId,callback){TRMApi.callService_({serviceName:"AcceptFriend",params:{UserRelationId:userRelationId},success:function(response){processNewRelations(response.Relations);if($.isFunction(callback)){callback(response)}}})};TRMApi.services.rejectFriend=function(userRelationId,callback){TRMApi.callService_({serviceName:"RejectFriend",params:{UserRelationId:userRelationId},success:function(response){processNewRelations(response.Relations);if($.isFunction(callback)){callback(response)}}})};TRMApi.services.removeFriend=function(userRelationId,callback){TRMApi.callService_({serviceName:"RemoveFriend",params:{UserRelationId:userRelationId},success:function(response){processNewRelations(response.Relations);
if($.isFunction(callback)){callback(response)}}})};TRMApi.services.acceptInvitation=function(token,callback){TRMApi.callService_({serviceName:"AcceptInvitation",params:{InvitationToken:token},success:function(response){processNewRelations(response.Relations);if($.isFunction(callback)){callback(response)}}})};TRMApi.services.rejectInvitation=function(token,callback){TRMApi.callService_({serviceName:"RejectInvitation",params:{InvitationToken:token},success:function(response){if($.isFunction(callback)){callback(response)}}})};TRMApi.services.blockUser=function(userId,callback){TRMApi.callService_({serviceName:"BlockUser",params:{UserId:userId},success:function(response){processNewRelations(response.Relations);if($.isFunction(callback)){callback(response)}}})};TRMApi.services.getFriendPermission=function(userId,callback){TRMApi.callService_({serviceName:"GetFriendPermission",params:{User2Id:userId},success:function(response){callback(response.Relation)}})};TRMApi.services.setFriendPermission=function(userId,permission,callback){TRMApi.callService_({serviceName:"SetFriendPermission",params:{User2Id:userId,FriendPermissions:permission},success:function(response){callback(response)
}})};TRMApi.services.getNotifications=function(callback){TRMApi.callService_({serviceName:"GetNotifications",params:{},success:function(response){callback(response.Notifications)}})};TRMApi.services.getFrontPageEntries=function(callback){TRMApi.callService_({serviceName:"GetFrontPageEntries",params:{},suppressWaiting:true,success:callback})};TRMApi.services.getFootprint=function(footprintId,callback){TRMApi.callService_({serviceName:"GetFootprint",params:{FootprintId:footprintId},success:callback,exceptionHandlers:{AccessDeniedException:function(exception){callback(null)}}})};TRMApi.services.getFootprintPhotoComments=function(footprintPhotoId,callback){TRMApi.callService_({serviceName:"GetFootprintPhotoComments",params:{FootprintPhotoId:footprintPhotoId},success:function(result){callback(result.FootprintPhotoComments)}})};TRMApi.services.resetFootprintPhotoHasComment=function(footprintPhotoId,callback){TRMApi.callService_({serviceName:"ResetFootprintPhotoHasComment",params:{FootprintPhotoId:footprintPhotoId},success:function(result){var footprintPhoto=result.FootprintPhoto;
TRMApi.util.DataSource.getFootprintPhotosDataSource(footprintPhoto.FootprintId)._injectItem(footprintPhoto);if(callback){callback(result)}}})};TRMApi.services.addFootprintPhotoComment=function(footprintPhotoId,comment,callback){TRMApi.callService_({serviceName:"AddFootprintPhotoComment",params:{FootprintPhotoId:footprintPhotoId,Comment:comment},success:function(result){var comments=result.FootprintPhotoComments;TRMApi.util.DataSource.getFootprintPhotoCommentsDataSource(footprintPhotoId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.deleteFootprintPhotoComment=function(footprintPhotoId,footprintPhotoCommentId,callback){TRMApi.callService_({serviceName:"DeleteFootprintPhotoComment",params:{FootprintPhotoCommentId:footprintPhotoCommentId},success:function(result){var comments=result.FootprintPhotoComments;TRMApi.util.DataSource.getFootprintPhotoCommentsDataSource(footprintPhotoId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.getGroups=function(userId,callback){TRMApi.callService_({serviceName:"GetGroups",params:{UserId:userId},success:function(response){if(userId==TRMApi.session.user.UserId){TRMApi.session.groups=response.Groups;
TRMApi.callbacks.onGroupsChanged()}if($.isFunction(callback)){callback(response.Groups)}}})};TRMApi.services.getGroupMembers=function(groupId,friendsOnly,callback){TRMApi.callService_({serviceName:"GetGroupMembers",params:{GroupId:groupId,FriendsOnly:friendsOnly},success:function(response){if($.isFunction(callback)){callback(response.GroupMembers)}}})};TRMApi.services.getGroupAdmins=function(groupId,callback){TRMApi.callService_({serviceName:"GetGroupAdmins",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback(response.GroupAdmins)}}})};TRMApi.services.getGroup=function(groupId,callback){TRMApi.callService_({serviceName:"GetGroup",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback(response.Group)}}})};TRMApi.services.getGroupByShortName=function(shortName,callback){TRMApi.callService_({serviceName:"GetGroupByShortName",params:{ShortName:shortName},success:function(response){if($.isFunction(callback)){callback(response.Group)
}}})};TRMApi.services.getGroupsBySearch=function(request,callback){TRMApi.callService_({serviceName:"GetGroupsBySearch",params:request,success:function(response){if($.isFunction(callback)){callback(response.Groups)}}})};TRMApi.services.saveGroup=function(group,callback){TRMApi.callService_({serviceName:"SaveGroup",method:"POST",params:group,success:function(response){if($.isFunction(callback)){callback(response.Group)}}})};TRMApi.services.joinGroup=function(groupId,callback){TRMApi.callService_({serviceName:"JoinGroup",method:"POST",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback()}}})};TRMApi.services.leaveGroup=function(groupId,callback){TRMApi.callService_({serviceName:"LeaveGroup",method:"POST",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback()}}})};TRMApi.services.getGroupBreadcrumbs=function(groupId,callback){TRMApi.callService_({serviceName:"GetGroupBreadcrumbs",method:"POST",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback(response.Breadcrumbs)
}}})};TRMApi.services.addGroupBreadcrumbs=function(groupId,breadcrumbIds,callback){TRMApi.callService_({serviceName:"AddGroupBreadcrumbs",method:"POST",params:{GroupId:groupId,BreadcrumbIds:breadcrumbIds},success:function(response){TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(groupId)._injectData(response.Breadcrumbs);if($.isFunction(callback)){callback()}}})};TRMApi.services.deleteGroupBreadcrumb=function(groupId,breadcrumbId,callback){TRMApi.callService_({serviceName:"DeleteGroupBreadcrumb",method:"POST",params:{GroupId:groupId,BreadcrumbId:breadcrumbId},success:function(response){TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(groupId)._injectData(response.Breadcrumbs);if($.isFunction(callback)){callback()}}})};TRMApi.services.getGroupComments=function(groupId,callback){TRMApi.callService_({serviceName:"GetGroupComments",params:{GroupId:groupId},success:function(result){callback(result.GroupComments)}})};TRMApi.services.addGroupComment=function(groupId,comment,callback){TRMApi.callService_({serviceName:"AddGroupComment",params:{GroupId:groupId,Comment:comment},success:function(result){var comments=result.GroupComments;
TRMApi.util.DataSource.getGroupCommentsDataSource(groupId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.deleteGroupComment=function(groupId,groupCommentId,callback){TRMApi.callService_({serviceName:"DeleteGroupComment",params:{GroupCommentId:groupCommentId},success:function(result){var comments=result.GroupComments;TRMApi.util.DataSource.getGroupCommentsDataSource(groupId)._injectData(comments);if(callback){callback(result)}}})};TRMApi.services.deleteGroup=function(groupId,callback){TRMApi.callService_({serviceName:"DeleteGroup",method:"POST",params:{GroupId:groupId},success:function(response){if($.isFunction(callback)){callback()}}})};TRMApi.services.reportAbuse=function(params,callback){TRMApi.callService_({serviceName:"ReportAbuse",params:params,success:function(result){if(callback){callback(result)}}})};TRMApi.services.createConversation=function(request,callback){TRMApi.callService_({serviceName:"CreateConversation",params:request,success:function(result){if(callback){callback(result)
}TRMApi.util.DataSource.getConversationHeadersDataSource().clear()}})};TRMApi.services.getConversationHeaders=function(callback){TRMApi.callService_({serviceName:"GetConversationHeaders",params:{},success:function(result){callback(result.Conversations)}})};TRMApi.services.addToConversation=function(conversationId,content,callback){TRMApi.callService_({serviceName:"AddToConversation",params:{ConversationId:conversationId,Content:content},success:function(result){if(callback){callback(result)}TRMApi.util.DataSource.getConversationHeadersDataSource().clear()}})};TRMApi.services.getConversation=function(conversationId,callback){TRMApi.callService_({serviceName:"GetConversation",params:{ConversationId:conversationId},success:function(result){callback(result.Conversation)}})};TRMApi.services.markConversationAsRead=function(conversationId,lastMessageId,callback){TRMApi.callService_({serviceName:"MarkConversationAsRead",params:{ConversationId:conversationId,LastMessageId:lastMessageId},success:function(result){if(callback){callback()
}TRMApi.util.DataSource.getConversationHeadersDataSource().clear()}})};TRMApi.services.deleteConversation=function(conversationId,callback){TRMApi.callService_({serviceName:"DeleteConversation",params:{ConversationId:conversationId},success:function(result){if(callback){callback()}TRMApi.util.DataSource.getConversationHeadersDataSource().clear()}})};TRMApi.services.saveGroupAdvertisement=function(fileForm,callback){TRMApi.callService_({serviceName:"SaveGroupAdvertisement",form:fileForm,method:"frame",success:function(data){callback(data)}})};TRMApi.services.getRequestedFriends=function(userId,callback){TRMApi.callService_({serviceName:"GetRequestedFriends",params:{UserId:userId},success:function(result){callback(result.RequestedFriends)}})};TRMApi.services.getAudioGuidesOnMap=function(swlat,swlng,nelat,nelng,callback){TRMApi.callService_({serviceName:"GetAudioGuidesOnMap",params:{Sw:swlat+","+swlng,Ne:nelat+","+nelng,LanguageId:TRMApi.services.getLanguageId()==0?null:TRMApi.services.getLanguageId()},success:function(response){callback(response.AudioGuides)
},suppressWaiting:true})};TRMApi.services.uploadZoopyStart=function(callback){TRMApi.callService_({serviceName:"UploadZoopyStart",params:{},success:function(response){callback(response)}})};TRMApi.services.uploadVideo=function(form,callback){TRMApi.services.uploadZoopyStart(function(response){$(form).find("input[@name='uploadToken']").val(response.ZoopyUploadToken);$(form).find("input[@name='return']").val(response.ReturnUrl);TRMApi.callService_({serviceName:"-none-",form:form,method:"frame",actionUrl:"http://api.zoopy.com/zoopy/0.1/rest/media/upload.json",success:function(data){callback(data)}})})};TRMApi.services.getMediaVideoEmbedCode=function(mediaId,width,height,callback){TRMApi.callService_({serviceName:"GetMediaVideoEmbedCode",params:{MediaId:mediaId,Width:width,Height:height},success:function(response){callback(response.EmbedCode)}})};TRMApi.services.getMedia=function(mediaId,callback){TRMApi.callService_({serviceName:"GetMedia",params:{MediaId:mediaId},success:function(response){callback(response.Media)
}})};TRMApi.services.ensureLoggedIn=function(callback){if(TRMApi.session.user.IsGuest){TRMApi.callbacks.onLoginRequired();return}TRMApi.callService_({serviceName:"Ping",params:{},success:callback})};TRMApi.services.sessionExpired=function(){if(shuttingDown){return}shuttingDown=true;alert("Your session has timed out or you have logged out/in in another window.");window.location.href="/Map.aspx?rnd="+Math.random()};function remoteRequestValidationFunction(validationName,remoteRequest){return function(value,element,param){var previous=this.previousValue(element);if(!this.settings.messages[element.name]){this.settings.messages[element.name]={}}this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);remoteRequest(value,function(response){if(response){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;
validator.successList.push(element);validator.showErrors()}else{var errors={};errors[element.name]=validator.defaultMessage(element,validationName);validator.showErrors(errors)}previous.valid=response;validator.stopRequest(element,response)});return"pending"}else{if(this.pending[element.name]){return"pending"}}return previous.valid}}$.validator.addMethod("shortNameAvailable",remoteRequestValidationFunction("shortNameAvailable",function(value,callback){TRMApi.services.shortNameAvailable(value,function(response){callback(response.IsAvailable)})}),"This name already exists");$.validator.addMethod("emailDoesNotExist",remoteRequestValidationFunction("emailDoesNotExist",function(value,callback){TRMApi.services.emailAvailable(value,function(response){callback(response.IsAvailable)})}),"This email is already registered");$.validator.addMethod("captcha",remoteRequestValidationFunction("captcha",function(value,callback){TRMApi.services.verifyCaptcha(value,function(response){callback(response.IsValid)
})}),"Wrong response");$.validator.addMethod("validShortName",function(value,element){return this.optional(element)||/^[-a-zA-Z0-9_.]{3,20}$/i.test(value)},"Can only contain letters, numbers and must be at least 3 characters long");$.validator.addMethod("validAdUrl",function(value,element){return this.optional(element)||/^http:\/\//.test(value)||/^x-phone:\+/.test(value)},"Must start with http:// or x-phone:+, e.g. http://www.google.com/ or x-phone:+420603512999");function bytelength(value){var len=0;for(var i=0;i<value.length;i++){var c=value.charCodeAt(i);if(c<128){len+=1}else{if(c<2047){len+=2}else{if(c<65535){len+=3}else{len+=4}}}}return len}$.validator.addMethod("bytemaxlength",function(value,element,param){return this.optional(element)||bytelength(value)<=param},$.format("Please enter no more than {0} characters."));$.validator.addMethod("emails",function(value,element,param){var isValid=true;$.each(value.split(/[,; ]+/),function(){isValid=isValid&&this.match(TRMApi.constants.EMAIL_REGEX)
});return this.optional(element)||isValid},$.format("Please enter list of valid email addresses."));function pad(v,n){v=v.toString();while(v.length<n){v="0"+v}return v}TRMApi.util.formatDate=function(date){return date.getFullYear()+"-"+pad(date.getMonth()+1,2)+"-"+pad(date.getDate(),2)+" at "+pad(date.getHours(),2)+":"+pad(date.getMinutes(),2)};TRMApi.util.formatRemoteDate=function(date,timezoneoffset){if(date==null){return""}date=new Date(date.getTime()+timezoneoffset);return date.getUTCFullYear()+"-"+pad(date.getUTCMonth()+1,2)+"-"+pad(date.getUTCDate(),2)+" at "+pad(date.getUTCHours(),2)+":"+pad(date.getUTCMinutes(),2)};TRMApi.util.dateISO2Net=function(date){if(!/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(date)){return""}return date+"T00:00:00"};TRMApi.util.date2ISO=function(date){if(!date){return""}return date.asString()};function finishBoundingBox(bb){bb.Center=[(bb.NorthEast[0]+bb.SouthWest[0])/2,(bb.NorthEast[1]+bb.SouthWest[1])/2];return bb}TRMApi.util.calculateBoundingBoxOfMapItem=function(mapItem){switch(mapItem.Type){case"Poi":return finishBoundingBox({SouthWest:[mapItem.Position[0],mapItem.Position[1]],NorthEast:[mapItem.Position[0],mapItem.Position[1]]});
case"Area":var bb={SouthWest:[10000,1000],NorthEast:[-10000,-10000]};for(var i=0;i<mapItem.Points.length;i++){var p=mapItem.Points[i];if(p[0]<bb.SouthWest[0]){bb.SouthWest[0]=p[0]}if(p[1]<bb.SouthWest[1]){bb.SouthWest[1]=p[1]}if(p[0]>bb.NorthEast[0]){bb.NorthEast[0]=p[0]}if(p[1]>bb.NorthEast[1]){bb.NorthEast[1]=p[1]}}return finishBoundingBox(bb)}return null};TRMApi.util.calculateBoundingBoxOfMapItems=function(mapItems){var bb={SouthWest:[10000,1000],NorthEast:[-10000,-10000]};$.each(mapItems,function(){var bbi=TRMApi.util.calculateBoundingBoxOfMapItem(this);if(bbi.SouthWest[0]<bb.SouthWest[0]){bb.SouthWest[0]=bbi.SouthWest[0]}if(bbi.SouthWest[1]<bb.SouthWest[1]){bb.SouthWest[1]=bbi.SouthWest[1]}if(bbi.NorthEast[0]>bb.NorthEast[0]){bb.NorthEast[0]=bbi.NorthEast[0]}if(bbi.NorthEast[1]>bb.NorthEast[1]){bb.NorthEast[1]=bbi.NorthEast[1]}});return finishBoundingBox(bb)};TRMApi.util.calculateDistanceInKm=function(point1,point2){var R=6371;var dLat=(point2[0]-point1[0]).toRad();var dLon=(point2[1]-point1[1]).toRad();
var a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(point1[0].toRad())*Math.cos(point2[0].toRad())*Math.sin(dLon/2)*Math.sin(dLon/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return R*c};function ExecuteLaterObj(condition,callback){this.condition=condition;this.callback=callback;this.cancelled=false;this.counter=0;this.schedule()}ExecuteLaterObj.prototype={schedule:function(){if(this.cancelled){return}if(this.counter++>50){this.stop();return}if(this.condition()){this.callback();return}var self=this;this.handle=window.setTimeout(function(){self.schedule()},100)},stop:function(){this.cancelled=true;window.clearTimeout(this.handle)}};TRMApi.util.executeLater=function(condition,callback){return new ExecuteLaterObj(condition,callback)};TRMApi.util.userIsLive=function(user){return user.LastSeenOn&&user.LastLoginFrom&&user.LastLoginFrom=="Mobile"&&((new Date()).getTime()-user.LastSeenOn.getTime())<5*60*1000};TRMApi.util.userIsFriendOfAll=function(user){return user.Flags&&user.Flags.indexOf("IsFriendOfAll")>-1
};Date.firstDayOfWeek=1;Date.format="yyyy-mm-dd";function unloader(){shuttingDown=true;if(TRMApi.session.isStarted){TRMApi.services.endSession()}}$(window).bind("unload",unloader);TRMApi.util.DataSource=function(name,options){this.options=$.extend({},TRMApi.util.DataSource.defaults,options);this.callbacks=[];this.name=name;this.events={load:[],loading:[],loaded:[],statusChanged:[]};this.data=null;this.delayClear=false;this.lastAccess=(new Date()).getTime();this._changeStatus("idle")};TRMApi.util.DataSource.defaults={load:function(){},getId:function(item){},freeable:true};TRMApi.util.DataSource.prototype._trigger=function(event,params){var self=this;$.each(this.events[event]||[],function(){this.apply(self,params)})};TRMApi.util.DataSource.prototype.addObserver=function(callback){this.bind("statusChanged",callback);callback.apply(this,[this.status])};TRMApi.util.DataSource.prototype.removeObserver=function(callback){this.unbind("statusChanged",callback)};TRMApi.util.DataSource.prototype.bind=function(event,callback){this.events[event].push(callback)
};TRMApi.util.DataSource.prototype.unbind=function(event,callback){if(!this.events[event]){return false}this.events[event]=$.grep(this.events[event],function(e){return e!=callback})};TRMApi.util.DataSource.prototype._changeStatus=function(status){$.log("DataSource "+this.name+" changing to "+status);this.status=status;this._trigger("statusChanged",[this.status]);this._trigger(status,[])};TRMApi.util.DataSource.prototype.clear=function(){if(this.status=="loading"){this.delayClear=true;return}this.data=null;this._changeStatus("idle")};TRMApi.util.DataSource.prototype.ensureData=function(callback){switch(this.status){case"idle":case"error":if(callback){this.callbacks.push(callback)}this._load();break;case"loading":if(callback){this.callbacks.push(callback)}break;case"loaded":if(callback){var self=this;setTimeout(function(){callback.apply(self,[self.data])},1)}break}this.lastAccess=(new Date()).getTime()};TRMApi.util.DataSource.prototype.isDataReady=function(){return this.status=="loaded"};
TRMApi.util.DataSource.prototype.isError=function(){return this.status=="error"};TRMApi.util.DataSource.prototype.getData=function(){if(this.status!="loaded"){throw"getData() on DataSource called when data are not ready yet. Use ensureData()."}this.lastAccess=(new Date()).getTime();return this.data};TRMApi.util.DataSource.prototype.getItemById=function(id){var result=null;var getId=this.options.getId;$.each(this.data,function(){if(getId(this)==id){result=this}});return result};TRMApi.util.DataSource.prototype.getIdIndex=function(id){var result=-1;var getId=this.options.getId;$.each(this.data,function(idx){if(getId(this)==id){result=idx}});return result};TRMApi.util.DataSource.prototype.containsId=function(id){return this.getIdIndex(id)>-1};TRMApi.util.DataSource.prototype.getResume=function(){return this.name+": "+this.status+", "+this.events.statusChanged.length+" observers, last access "+(((new Date()).getTime()-this.lastAccess)/1000)+" secs ago"};TRMApi.util.DataSource.prototype._injectData=function(data){this.data=null;
this._changeStatus("loading");var self=this;setTimeout(function(){self._loadComplete(null,data)},1)};TRMApi.util.DataSource.prototype._injectItem=function(item){if(this.status!="loaded"){return}var getId=this.options.getId;var itemIndex=this.getIdIndex(getId(item));var data=this.data;this.data=null;this._changeStatus("loading");var self=this;setTimeout(function(){if(itemIndex==-1){data.push(item)}else{data[itemIndex]=item}self._loadComplete(null,data)},1)};TRMApi.util.DataSource.prototype._load=function(){var self=this;this.data=null;this._changeStatus("loading");this.options.load.apply(this,[function(status,data){self._loadComplete(status,data)}])};TRMApi.util.DataSource.prototype._loadComplete=function(status,data){if(this.delayClear){this.delayClear=false;this.status="loaded";this.clear();return}if(status!=null){this.data=null;this._changeStatus("error");this.callbacks=[];return}this.data=data;this._changeStatus("loaded");if(this.callbacks.length){var self=this;$.each(this.callbacks,function(){this.apply(self,[self.data])
});this.callbacks=[]}this.lastAccess=(new Date()).getTime()};var dataSources={};function cleanupDataSources(){var candidate={lastAccess:(new Date()).getTime(),clear:function(){}};var dataReadyCount=0;var dataSourceResume="Data Sources:";$.each(dataSources,function(){if(this.freeable&&this.isDataReady()){dataReadyCount++;if(this.lastAccess<candidate.lastAccess){candidate=this}}dataSourceResume+="\r\n  "+this.getResume()});setTimeout(cleanupDataSources,10000);if(dataReadyCount<6){return}candidate.clear()}setTimeout(cleanupDataSources,10000);function getDataSource(key,constructFunction){return dataSources[key]||(dataSources[key]=constructFunction.apply(this))}TRMApi.util.DataSource.getTripMapItemsDataSource=function(tripId){var key="TripMapItems."+tripId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getTripMapItems(tripId,function(data){callback(null,data)})},getId:function(item){return item.MapItemId}})})};TRMApi.util.DataSource.getProjectMapItemsDataSource=function(projectId){var key="ProjectMapItems."+projectId;
return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getProjectMapItems(projectId,function(data){callback(null,data)})},getId:function(item){return item.MapItemId}})})};TRMApi.util.DataSource.getFootprintsDataSource=function(userId){var key="Footprints."+userId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getFootprints(userId,function(data){callback(null,data)})},getId:function(item){return item.FootprintId}})})};TRMApi.util.DataSource.getFootprintPhotosDataSource=function(footprintId){var key="FootprintPhotos."+footprintId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getFootprintPhotos(footprintId,function(data){callback(null,data)})},getId:function(item){return item.FootprintPhotoId}})})};TRMApi.util.DataSource.getFootprintPhotoCommentsDataSource=function(footprintPhotoId){var key="FootprintPhotoComments."+footprintPhotoId;
return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getFootprintPhotoComments(footprintPhotoId,function(data){callback(null,data)})},getId:function(item){return item.CommentId}})})};TRMApi.util.DataSource.getBreadcrumbCommentsDataSource=function(breadcrumbId){var key="BreadcrumbComments."+breadcrumbId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getBreadcrumbComments(breadcrumbId,function(data){callback(null,data)})},getId:function(item){return item.CommentId}})})};TRMApi.util.DataSource.getFootprintPointsDataSource=function(footprintId,precisionLevel){var key="FootprintPoints."+footprintId+"."+precisionLevel;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getFootprintLevelPoints(footprintId,precisionLevel,function(data){callback(null,data)})}})})};TRMApi.util.DataSource.getConversationHeadersDataSource=function(){var key="ConversationHeaders";
return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getConversationHeaders(function(data){callback(null,data)})}})})};TRMApi.util.DataSource.getBreadcrumbsDataSource=function(userId){var key="Breadcrumbs."+userId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getBreadcrumbs0(userId,function(data){callback(null,data)})},getId:function(item){return item.BreadcrumbId}})})};TRMApi.util.DataSource.getGroupBreadcrumbsDataSource=function(groupId){var key="GroupBreadcrumbs."+groupId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getGroupBreadcrumbs(groupId,function(data){callback(null,data)})},getId:function(item){return item.BreadcrumbId}})})};TRMApi.util.DataSource.getGroupCommentsDataSource=function(groupId){var key="GroupComments."+groupId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getGroupComments(groupId,function(data){callback(null,data)
})},getId:function(item){return item.CommentId}})})};TRMApi.util.DataSource.getRequestedFriendsDataSource=function(userId){var key="RequestedFriends."+userId;return getDataSource(key,function(){return new TRMApi.util.DataSource(key,{load:function(callback){TRMApi.services.getRequestedFriends(userId,function(data){callback(null,data)})},getId:function(item){return item.User1Id}})})};TRMApi.util.DataSource.getCombinedDataSource=function(dataSources){var key="Combined";$.each(dataSources,function(){key+="."+this.name});return getDataSource(key,function(){var loadingCallback=null;function somethingLoaded(){if(!loadingCallback){return}var allReady=true;var isError=false;$.each(dataSources,function(){if(!this.isDataReady()){allReady=false}if(this.isError()){isError=true}});if(isError){loadingCallback("Error in the underlaying datasource",null);loadingCallback=null;return}if(allReady){loadingCallback(null,dataSources);loadingCallback=null;return}}var ds=new TRMApi.util.DataSource(key,{load:function(callback){loadingCallback=callback;
$.each(dataSources,function(){this.ensureData()});somethingLoaded()},freeable:false});function innerDataSourceStatusChanged(status){switch(status){case"idle":ds.clear();break;case"loading":break;case"loaded":somethingLoaded();break}}$.each(dataSources,function(){this.addObserver(innerDataSourceStatusChanged)});return ds})};TRMApi.util.showLog=function(){$(document.body).append($('<div id="__showLog" />').css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height(),zIndex:10000,backgroundColor:"white",color:"black",textAlign:"left",borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,overflowY:"scroll"}).html($("#waiting_log").html()).prepend($("<a />").text("close").click(function(){$("#__showLog").remove()})))};TRMApi.util.escapeHtml=function(html){return(html||"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}})(jQuery);(function(e){var d=["#ffe9dd","#ffc7a8","#ffa26f","#ff7d37","#ff5a00"];e.fn.flashit=function(){var m=this.css("background-color");
var i=0;var k=1;var j=this;function l(){j.css("background-color",d[i]);i=i+k;if(i>=d.length){k=-1;i-=2}if(i>0){setTimeout(l,50)}else{j.css("background-color",m)}}setTimeout(l,1)};TRMApi.ui={};TRMApi.ui.overlay=null;TRMApi.ui.showValidationErrorDialog=function(i,j){TRMApi.functions.message({Message:i,Title:"Error",OnClose:j})};TRMApi.ui.showLoginRequiredDialog=function(){TRMApi.functions.message({Message:'You have to login to use this function. If you don\'t have account here yet, please <a href="javascript:TRMApi.functions.closeMessage(); TRMApi.functions.register();">register</a>.',Title:"Not logged in"})};TRMApi.callbacks.onLoginRequired=TRMApi.ui.showLoginRequiredDialog;TRMApi.ui.tab=function(j,k){var i=this;this.options=e.extend({},TRMApi.ui.tab.defaults,k);this.line=e("<a />").text(j).attr("title",this.options.title).click(function(){i.select()}).wrap("<li />").parent().addClass(k.extraClass);e(".main_control_widget_menu ul").append(this.line);this.content=e('<div class="main_control_trips" />').wrap(e("<div />"));
e(".main_control_widget_tab_holder").append(this.content.parent());this.isSelected=false};TRMApi.ui.tab.prototype.text=function(i){return this.line.find("a").text(i)};TRMApi.ui.tab.prototype.select=function(){if(this.isSelected){return this}var i=this;e.each(TRMApi.ui.tabs,function(){if(this==i){this.line.addClass("selected");this.content.show();this.isSelected=true}else{this.line.removeClass("selected");this.content.hide();this.isSelected=false}});TRMApi.ui.tab.onTabSelected(this);i.options.onSelect.apply(this);return this};TRMApi.ui.tab.onTabSelected=function(){};TRMApi.ui.tab.defaults={onSelect:function(){},extraClass:"",title:""};TRMApi.ui.tabs=[];TRMApi.ui.addTab=function(i,j){var k=new TRMApi.ui.tab(i,j);TRMApi.ui.tabs.push(k);return k};TRMApi.ui.refreshTabs=function(){e.each(TRMApi.ui.tabs,function(){if(this.isSelected){this.isSelected=false;this.select()}})};var f=0;TRMApi.ui.disableUi=function(){f++;if(f>1){return}};TRMApi.ui.enableUi=function(){f--;if(f>0){return}};TRMApi.ui.mapHoverClass=function(){var i=this;
this.closeHandler=null;e("#map_message a.map-message-close").click(function(){i.close()})};TRMApi.ui.mapHoverClass.prototype={show:function(j,i){e("#map_message p").html(j);e("#map_message").show();this.closeHandler=i},hide:function(){e("#map_message").hide()},close:function(i){if(this.closeHandler){this.closeHandler(i)}this.hide()}};TRMApi.ui.selectAreaOnMap=function(m,p){var o=e("#google_map").gmap();var j=null;var l=[];function k(q){TRMApi.ui.enableUi();TRMApi.ui.mapHover.hide();o.hideAdhocPolygon();GEvent.removeListener(j);p(q=="finish"?l:null,q)}TRMApi.ui.disableUi();TRMApi.ui.mapHover.show(m+" <a href=\"javascript:TRMApi.ui.mapHover.close('finish')\">FINISH</a>",k);function i(q){if(l.length==0){l[0]=l[1]=[q.lat(),q.lng()]}else{l[l.length-1]=[q.lat(),q.lng()];l.push(l[0])}e.log(l);o.showAdhocPolygon(l)}j=GEvent.bind(o.gmap,"click",null,function(r,t,q){i(t)})};TRMApi.ui.selectPointOnMap=function(k,m){var l=e("#google_map").gmap();var i=null;function j(o){TRMApi.ui.enableUi();if(o){TRMApi.ui.mapHover.hide()
}GEvent.removeListener(i);if(typeof o=="string"){m(null,o)}else{if(o!=null){m([o.lat(),o.lng()],"")}else{m(null,"")}}}TRMApi.ui.disableUi();TRMApi.ui.mapHover.show(k,j);i=GEvent.bind(l.gmap,"click",null,function(p,q,o){j(q)})};TRMApi.ui.message=function(i){TRMApi.ui.dialogs.messageDialog.run(i,{close:function(){if(i.OnClose){i.OnClose(TRMApi.ui.dialogs.messageDialog.result)}}})};TRMApi.ui.closeMessage=function(){TRMApi.ui.dialogs.messageDialog.close()};TRMApi.ui.showContent=function(i){TRMApi.ui.dialogs.contentDialog.run(i,{})};var h=[];TRMApi.ui.onRelationsChanged=function(){e.each(h,function(){this.notifyRelationsChanged()})};function g(j,i){this.options=i;this.element=j;this.selectedUsers=[];this.rebuildHiddenFields();this.associateAutocomplete();this.enabled=true;h.push(this)}g.prototype={disassociateAutocomplete:function(){this.element.unautocomplete();this.element.unbind(".friendsselector")},associateAutocomplete:function(){var i=this;var j=TRMApi.session.friends();if(this.options.excludeFriendOfAll){j=e.grep(j,function(l,k){return !TRMApi.util.userIsFriendOfAll(l.User2)
})}this.element.autocomplete(j,{formatItem:function(m,k,o,l){return"<img src='"+TRMApi.services.getImageThumbnailUrl(m.User2.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE)+"' class='user-photo-icon' /> "+m.User2.FullName},formatMatch:function(m,l,k){return m.User2.FullName},formatResult:function(k){return k.User2.FullName},minchars:0,scrollHeight:220,autoFill:true,matchContains:true});this.element.result(function(k,m,l){i.onAfterAutocompleteSelected(k,m,l)})},containsUser:function(k){if(k&&k.UserId){k=k.UserId}for(var j=0;j<this.selectedUsers.length;j++){if(this.selectedUsers[j].UserId==k){return true}}return false},addUser:function(i){if(this.containsUser(i)){return false}this.selectedUsers.push(i);this.rebuildUserList();this.rebuildHiddenFields()},removeUser:function(i){if(i&&i.UserId){i=i.UserId}this.selectedUsers=e.grep(this.selectedUsers,function(k,j){return !(k.UserId==i)});this.rebuildUserList();this.rebuildHiddenFields()},onAfterAutocompleteSelected:function(j,l,k){var i=this;if(l){this.addUser(l.User2)
}setTimeout(function(){i.element.val("");i.element.focus()},10)},rebuildUserList:function(){var j=this;var i=e(this.options.userList);i.empty();e.each(this.selectedUsers,function(){var l=this.UserId;var k=e("<li />").append(e("<span />").text(this.FullName)).append(e("<a />").attr("href","#").text("remove").click(function(){j.removeUser(l)}));i.append(k)})},rebuildHiddenFields:function(){var i=this;i.element.parents("form").find("input[@name='"+this.options.hiddenName+"']").remove();e.each(this.selectedUsers,function(){i.element.after(e('<input type="hidden" />').attr("name",i.options.hiddenName).val(this.UserId))});i.element.parents("form").find("input[@name='"+this.options.hiddenCountName+"']").val(this.selectedUsers.length)},notifyRelationsChanged:function(i){this.disassociateAutocomplete();this.associateAutocomplete()},clear:function(){this.selectedUsers=[];this.rebuildUserList();this.rebuildHiddenFields()},disable:function(){if(!this.enabled){return}this.disassociateAutocomplete();
this.clear();this.enabled=false},enable:function(){if(!!this.enabled){return}this.associateAutocomplete();this.enabled=true}};e.fn.trfriendsselector=function(i){if(this.length!=1){throw"Only available for single-match"}var j=e.extend({},e.fn.trfriendsselector.defaults,i);return new g(this,j)};e.fn.trfriendsselector.defaults={hiddenName:"UserIds",hiddenCountName:"UserIdCount",userList:null};e.fn.trpopupchooser=function(r){var i=e.extend({},e.fn.trpopupchooser.defaults,r);var q=this;var l;var k;function j(){l.empty();l.remove();l=null;q.unbind("mouseout",m).unbind("mouseover",p)}function p(){if(k){window.clearTimeout(k)}k=null}function m(){p();k=window.setTimeout(j,3000)}function o(){i.onShow.apply(this,[i]);l=e("<div />").addClass(i.outerClass).css("position","absolute").mouseover(p).mouseout(m);q.after(l).mouseover(p).mouseout(m);var t=e("<ul />").appendTo(l);e.each(i.data,function(w){var x=this;var v=e("<li />").text(this[i.nameField]).addClass(w%2==0?"ac_even":"ac_odd").appendTo(t);v.mouseover(function(){v.addClass("ac_over")
}).mouseout(function(){v.removeClass("ac_over")}).click(function(){j();i.onSelect(x[i.valueField])});i.onAfterItemCreated(v,this)});var u=q.position();l.css({top:u.top+q[0].offsetHeight,left:u.left})}q.click(function(){if(l){j()}else{o()}});q.unload(function(){if(l){j()}});return this};e.fn.trpopupchooser.defaults={nameField:"name",valueField:"value",data:[{name:"attach data",value:"#"}],onSelect:function(i){},onShow:function(){},onAfterItemCreated:function(i,j){},outerClass:"ac_results"};TRMApi.ui.createStars=function(l){var j=e("<span />");for(var k=0;k<5;k++){j.append(e("<img />").attr("src","images/global/pop_up/star-"+(l>k?"full":"empty")+".gif").addClass("rating_star"))}return j};e.fn.trstarrating=function(){var q=this;var w=parseInt(this.val());var j=w;var v=[];function t(){for(var x=0;x<5;x++){v[x].attr("src","images/content/advanced_search/star-"+(j>x?"full":"empty")+".gif")}}function r(i){j=i;t()}function l(i){return function(){r(i)}}function u(){j=w;t()}function k(i){q.val(w=j=i);
t()}function m(i){return function(){k(i)}}this.before(e("<img />").attr("src","images/content/advanced_search/star-none.gif").addClass("rating_star").bind("mouseenter",l(0)).bind("mouseleave",function(){u()}).click(m(0)));for(var p=0;p<5;p++){var o=e("<img />").addClass("rating_star");o.bind("mouseenter",l(p+1)).bind("mouseleave",function(){u()}).click(m(p+1));this.before(o);v[p]=o}t()};e.fn.trmapitemrating=function(q){var w=parseInt(this.text());var j=w;var v=[];function t(){for(var x=0;x<5;x++){v[x].attr("src","images/global/pop_up/star-"+(j>x?"full":"empty")+".gif")}}function r(i){j=i;t()}function l(i){return function(){r(i)}}function u(){j=w;t()}function k(i){TRMApi.services.rateMapItem(q,i,function(x){w=j=x;t()})}function m(i){return function(){k(i)}}this.empty();for(var p=0;p<5;p++){var o=e("<img />").addClass("rating_star");if(!TRMApi.session.user.IsGuest){o.bind("mouseenter",l(p+1)).bind("mouseleave",function(){u()}).click(m(p+1))}this.append(o);v[p]=o}t()};e(document).ready(function(){TRMApi.ui.mapHover=new TRMApi.ui.mapHoverClass();
e("#waitingDialog").registerDialog("waitingDialog",{hideFlashes:false,load:function(i){e("#waitingDialog .waiting-image").hide();e("#waitingDialog ."+i).show()}});e("#messageDialog").registerDialog("messageDialog",{load:function(i){e("#messageDialog .id-content").html(i.Message);e("#messageDialog h2").text(i.Title||"Message")}});e("#confirmDialog").registerDialog("confirmDialog",{load:function(i){e("#confirmDialog .id-content").html(i.Message);e("#confirmDialog h2").text(i.Title||"Question")}})});e.extend(TRMApi.callbacks,{onAfterInitialLoad:function(){alert("onAfterInitialLoad unhandled.")},onBlockScreen:function(i){alert("onBlockScreen unhandled.")}});TRMApi.ui.readDate=function(j){if(!j){return"never"}var i=(new Date()).getTime();var j=j.getTime();var k=i-j;if(k<5*60*1000){return"less than 5 minutes ago"}if(k<60*60*1000){return Math.round(k/1000/60)+" minutes ago"}if(k<24*60*60*1000){return Math.round(k/1000/60/60)+" hours ago"}return Math.round(k/1000/60/60/24)+" days ago"};TRMApi.ui.readLastSeen=function(i){if(!i.LastSeenOn){return""
}if(TRMApi.util.userIsLive(i)){return"Travelling LIVE"}return"Last seen "+TRMApi.ui.readDate(i.LastSeenOn)+((i.LastSeenOn&&i.LastLoginFrom!="Unknown")?" from "+i.LastLoginFrom:"")};var c=true;var b=0;TRMApi.ui.startWait=function(j,i){if(b==0){TRMApi.ui.dialogs.waitingDialog.run(i)}TRMApi.ui.dialogs.waitingDialog.moveToTop();b++;return 0};TRMApi.ui.endWait=function(i){b--;if(b==0){TRMApi.ui.dialogs.waitingDialog.close();if(c){TRMApi.callbacks.onAfterInitialLoad();c=false}}if(b<0){b=0;e.log("waitingCount < 0")}};TRMApi.ui.setInitial=function(){c=true};TRMApi.callbacks.onStartWait=TRMApi.ui.startWait;TRMApi.callbacks.onEndWait=TRMApi.ui.endWait;e.validator.setDefaults({debug:true,errorClass:"form_error",onkeyup:false});var a=e.fn.val;e.fn.val=function(j){if(typeof(j)=="undefined"){return a.apply(this)}var i=a.apply(this,arguments);e.each(this,function(){var k;if(this.__isdate&&(k=e(this).data("trdatepicker"))){k.fromHidden()}});return i};e.trdatepicker=function(k,j){this.options=e.extend({},e.trdatepicker.defaults,j);
k=e(k);this.dayElement=e("<select />").addClass("trdatepicker-day").attr({name:k.attr("name")+"-day"});this.monthElement=e("<select />").addClass("trdatepicker-month").attr({name:k.attr("name")+"-month"});this.yearElement=e("<select />").addClass("trdatepicker-year").attr({name:k.attr("name")+"-year"});this.hourElement=e("<select />").addClass("trdatepicker-hour").attr({name:k.attr("name")+"-hour"});k.before(this.dayElement).before(this.monthElement).before(this.yearElement).before(this.hourElement);k.remove();this.element=e('<input type="hidden" id="'+k.attr("id")+'" />').val(k.val()).attr({name:k.attr("name")});this.element.data("trdatepicker",this);this.element[0].__isdate=true;this.yearElement.after(this.element);var i=this;this.fillIn();this.fromHidden();this.element.change(function(){i.fromHidden()});this.dayElement.change(function(){i.toHidden()});this.monthElement.change(function(){i.toHidden()});this.yearElement.change(function(){i.toHidden()});this.hourElement.change(function(){i.toHidden()
});if(!this.options.showHour){this.hourElement.hide()}};e.trdatepicker.defaults={startDate:"1990-01-01",endDate:"2020-12-31",showHour:false};e.trdatepicker.prototype={fillIn:function(){this.dayElement.clearOptions().addOption("","").selectOptions("");for(var k=1;k<=31;k++){this.dayElement.addOption(k,k)}this.monthElement.clearOptions().addOption("","").selectOptions("");for(var p=1;p<=12;p++){this.monthElement.addOption(p,Date.abbrMonthNames[p-1])}var i=Date.fromString(this.options.startDate);var o;switch(this.options.endDate){case"today":o=new Date();break;default:o=Date.fromString(this.options.endDate);break}this.yearElement.clearOptions().addOption("","").selectOptions("");for(var l=i.getYear();l<=o.getYear();l++){this.yearElement.addOption(l+1900,l+1900)}function m(q,r){q=q.toString();while(q.length<r){q="0"+q}return q}this.hourElement.clearOptions().addOption("0","").selectOptions("");for(var j=0;j<24*60;j+=15){this.hourElement.addOption(j,m(Math.floor(j/60),2)+":"+m(j%60,2))}},fromHidden:function(){var i;
if(this.element.val().length==0||!(i=Date.fromString(this.element.val()))){this.dayElement.selectOptions("");this.monthElement.selectOptions("");this.yearElement.selectOptions("");this.hourElement.selectOptions("");return}this.dayElement.selectOptions(i.getDate());this.monthElement.selectOptions(i.getMonth()+1);this.yearElement.selectOptions(i.getYear()+1900);this.hourElement.selectOptions(i.getHours()*60+15*Math.floor(i.getMinutes()/15))},toHidden:function(){var k=this.yearElement.selectedValues()[0];var l=this.monthElement.selectedValues()[0];var j=this.dayElement.selectedValues()[0];var i=this.hourElement.selectedValues()[0];if(k.length==0||l.length==0||j.length==0||i.length==0){a.call(this.element,"")}else{if(this.options.showHour){a.call(this.element,new Date(k,l-1,j,Math.floor(i/60),i%60,0).asUTCString("yyyy-mm-ddTHH:MM:SS"))}else{a.call(this.element,new Date(k,l-1,j,0,0,0).asString("yyyy-mm-dd"))}}}};e.fn.trdatepicker=function(i){var j=[];this.each(function(){j.push(new e.trdatepicker(this,i))
});return j.length==1?j[0]:j};e.fn.trwaiting=function(){};e.fn.backgroundText=function(m,k){var l=e(this);var o;var j=false;function i(){o.css({display:(l.val()=="")?"":"none"})}l.before(o=e("<span />").addClass("ui-background-text").addClass(k).click(function(){l[0].focus()}).text(m));l.focus(function(){o.css({display:"none"})});l.blur(i);l.change(i);i()}})(jQuery);(function(f){var c={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};f.widget("ui.dialog",{init:function(){var j=this,l=this.options,k=typeof l.resizable=="string"?l.resizable:"n,e,s,w,se,sw,ne,nw",m=this.element.addClass("ui-dialog-content").wrap("<div/>").wrap("<div/>"),o=(this.uiDialogContainer=m.parent().addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"})),i=(this.uiDialog=o.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(l.dialogClass).css({position:"absolute",width:l.width,height:l.height,overflow:"hidden",zIndex:l.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(p){if(l.closeOnEscape){var q=27;
(p.keyCode&&p.keyCode==q&&j.close())}}).mousedown(function(){j.moveToTop()});this.isOpen=false;(l.bgiframe&&f.fn.bgiframe&&i.bgiframe());(l.autoOpen&&this.open())},setData:function(i,j){(c[i]&&this.uiDialog.data(c[i],j));switch(i){case"height":this.uiDialog.height(j);break;case"position":this.position(j);break;case"width":this.uiDialog.width(j);break}f.widget.prototype.setData.apply(this,arguments)},position:function(q,i){var l=f(window),m=f(document),o=m.scrollTop(),k=m.scrollLeft(),p=o;if(f.isFunction(q)){var j=q(this.uiDialog);k+=j[0];o+=j[1]}else{if(f.inArray(q,["center","top","right","bottom","left"])>=0){q=[q=="right"||q=="left"?q:"center",q=="top"||q=="bottom"?q:"middle"]}if(q.constructor!=Array){q=["center","middle"]}if(q[0].constructor==Number){k+=q[0]}else{switch(q[0]){case"left":k+=0;break;case"right":k+=l.width()-this.uiDialog.width();break;default:case"center":k+=(l.width()-this.uiDialog.width())/2}}if(q[1].constructor==Number){o+=q[1]}else{switch(q[1]){case"top":o+=0;break;
case"bottom":o+=l.height()-this.uiDialog.height();break;default:case"middle":o+=(l.height()-this.uiDialog.height())/2}}}o=Math.max(o,p);if(i){this.uiDialog.animate({top:o,left:k},200)}else{this.uiDialog.css({top:o,left:k})}},size:function(){var j=this.uiDialogContainer,k=this.element,l=parseInt(k.css("margin-top"),10)+parseInt(k.css("margin-bottom"),10),i=parseInt(k.css("margin-left"),10)+parseInt(k.css("margin-right"),10);k.height(j.height()-l);k.width(j.width()-i)},open:function(){var i=this;if(this.isOpen){return}this.overlay=this.options.modal?new f.ui.dialog.overlay(this):null;(this.uiDialog.next().length>0)&&this.uiDialog.appendTo("body");this.position(this.options.position);this.uiDialog.show(this.options.show);this.options.autoResize&&this.size();this.moveToTop(true);this.resizeHandler=function(){i.position(i.options.position)};f(window).bind("resize",this.resizeHandler);var j=null;var k={options:this.options};this.element.triggerHandler("dialogopen",[j,k],this.options.open);this.isOpen=true
},moveToTop:function(k){if((this.options.modal&&!k)||(!this.options.stack&&!this.options.modal)){return this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)}var j=this.options.zIndex,i=this.options;f(".ui-dialog:visible").each(function(){j=Math.max(j,parseInt(f(this).css("z-index"),10)||i.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++j));this.uiDialog.css("z-index",++j);this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)},close:function(j){if(!this.isOpen){return}(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide);if(this.resizeHandler){f(window).unbind("resize",this.resizeHandler)}var k=null;var i={options:this.options,result:j};this.element.triggerHandler("dialogclose",[k,i],this.options.close);f.ui.dialog.overlay.resize();this.isOpen=false},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");
this.uiDialog.remove()},isOpened:function(){return this.isOpen}});f.extend(f.ui.dialog,{defaults:{autoOpen:false,autoResize:false,bgiframe:true,closeOnEscape:true,height:"auto",minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",stack:true,width:"auto",zIndex:1000},overlay:function(i){this.$el=f.ui.dialog.overlay.create(i)}});f.extend(f.ui.dialog.overlay,{instances:[],events:f.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(i){return i+".dialog-overlay"}).join(" "),create:function(j){if(this.instances.length===0){setTimeout(function(){f("a, :input").bind(f.ui.dialog.overlay.events,function(){var l=false;var o=f(this).parents(".ui-dialog");if(o.length){var k=f(".ui-dialog-overlay");if(k.length){var m=parseInt(k.css("z-index"),10);k.each(function(){m=Math.max(m,parseInt(f(this).css("z-index"),10))});l=parseInt(o.css("z-index"),10)>m}else{l=true}}return l})},1);f(document).bind("keydown.dialog-overlay",function(k){var l=27;(k.keyCode&&k.keyCode==l&&j.close())
});f(window).bind("resize.dialog-overlay",f.ui.dialog.overlay.resize)}var i=f("<div/>").appendTo(document.body).addClass("ui-dialog-overlay").css(f.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},j.options.overlay));(j.options.bgiframe&&f.fn.bgiframe&&i.bgiframe());this.instances.push(i);return i},destroy:function(i){this.instances.splice(f.inArray(this.instances,i),1);if(this.instances.length===0){f("a, :input").add([document,window]).unbind(".dialog-overlay")}i.remove()},height:function(){if(f.browser.msie&&f.browser.version<7){var j=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var i=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(j<i){return f(window).height()+"px"}else{return j+"px"}}else{return f(document).height()+"px"}},width:function(){if(f.browser.msie&&f.browser.version<7){var i=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var j=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);
if(i<j){return f(window).width()+"px"}else{return i+"px"}}else{return f(document).width()+"px"}},resize:function(){var i=f([]);f.each(f.ui.dialog.overlay.instances,function(){i=i.add(this)});i.css({width:0,height:0}).css({width:f.ui.dialog.overlay.width(),height:f.ui.dialog.overlay.height()})}});f.extend(f.ui.dialog.overlay.prototype,{destroy:function(){f.ui.dialog.overlay.destroy(this.$el)}});var a=0;var g=null;function e(){if(a++>0){return}g=f("embed:visible").hide()}function d(){if(--a==0){g.show();g=null}}TRMApi.ui.dialogs={};TRMApi.ui.dialogList=[];function h(){}function b(){}TRMApi.ui.dialog=function(l,k,j){TRMApi.ui.dialogs[k]=this;TRMApi.ui.dialogList.push(this);var o={form:"#__nonexistent",validateOptions:{},dialogOptions:{},hideFlashes:true,init:function(){},load:function(p){},gather:function(){return{}},close:function(){}};var m=f.extend(o,j);this.element=f(l);this.form=f(m.form);this.submitHandler=h;this.closeHandler=b;this.options=m;this.options.init.call(this);var i=this;this.validator=this.form.validate(f.extend({submitHandler:function(){i.submitHandler()
}},this.options.validateOptions));this.element.dialog(f.extend({modal:true},m.dialogOptions)).bind("dialogopen",function(r,q,p){if(i.options.hideFlashes){e()}}).bind("dialogclose",function(r,q,p){i.closeHandler(p.result);if(i.options.hideFlashes){d()}i.options.close()})};TRMApi.ui.dialog.closeAll=function(){f.each(TRMApi.ui.dialogList,function(){this.close()})};TRMApi.ui.dialog.prototype={isOpened:function(){return this.element.dialog("isOpened")},valid:function(){return this.validator.valid()},close:function(i){this.element.dialog("close",i)},moveToTop:function(){this.element.dialog("moveToTop")},notify:function(i){this.notifyHandler.call(this,i)},run:function(l,j){var i=this;this.result=null;var m={save:function(o){},close:function(){},notify:function(o){}};var k=f.extend(m,j);this.validator&&this.validator.resetForm();this.options.load.call(this,l);this.submitHandler=function(){i.submitHandler=h;var o=i.options.gather.call(i);k.save.call(i,o)};this.closeHandler=function(o){i.submitHandler=h;
i.closeHandler=b;i.result=o;k.close.call(i,o)};this.notifyHandler=k.notify;this.element.dialog("open")},resize:function(){this.element.dialog("resizeHandler")}};f.fn.registerDialog=function(j,i){if(this.length!=1){f.log("registerDialog for "+j+" called with "+this.length+" items, expected 1.");return null}return new TRMApi.ui.dialog(this[0],j,i)}})(jQuery);(function(d){function c(e){d("#addImage_data").val("");d("#addImage_type").val(e.Type||"JPG")}function b(){return d("#addImageForm")}function a(){}d(document).ready(function(){d("#addImageDialog").registerDialog("addImageDialog",{form:"#addImageForm",init:a,load:c,gather:b,validateOptions:{}})})})(jQuery);(function(d){function c(e){d("#addVideo_data").val("")}function b(){return d("#addVideoForm")}function a(){}d(document).ready(function(){d("#addVideoDialog").registerDialog("addVideoDialog",{form:"#addVideoForm",init:a,load:c,gather:b,validateOptions:{}})})})(jQuery);(function(d){function c(e){this._data=e;d("#register_countryId").selectOptions("");
d("#register_contryId").clearOptions().addOption("","Please select...").bindOptions(TRMApi.session.countries,{valueProperty:"CountryId",textProperty:"Name",clear:false}).selectOptions("");this.form.unserializeMap(e);d("#register_image").attr("src",TRMApi.services.getImageThumbnailUrl(e.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE));TRMApi.functions.setCaptcha("#register_captchaImage")}function b(){return this._data=d.extend({},this._data,this.form.serializeMap())}function a(){var e=this;d("#register_changePicture").click(function(){TRMApi.functions.addImage(function(f){d("#register_imageId").val(f.MediaImage.MediaId);d("#register_image").attr("src",TRMApi.services.getImageThumbnailUrl(f.MediaImage.MediaId,TRMApi.constants.DEFAULT_USER_IMAGE))})})}d(document).ready(function(){d("#registerDialog").registerDialog("registerDialog",{form:"#registerForm",init:a,load:c,gather:b,validateOptions:{rules:{UserName:{shortNameAvailable:true,bytemaxlength:30,validShortName:true},EmailAddress:{emailDoesNotExist:true,bytemaxlength:255},Captcha:"captcha",Confirm:{equalTo:"#register_password"},FirstName:{bytemaxlength:255},LastName:{bytemaxlength:255},Password:{bytemaxlength:30,minlength:5}},messages:{AcceptTaC:"You have to agree."},onfocusout:false}})
})})(jQuery);(function(c){function b(d){c("#confirmEmail_confirmationCode").val("")}function a(){return this._data=c.extend({},this.form.serializeMap())}c(document).ready(function(){c("#confirmEmailDialog").registerDialog("confirmEmail",{form:"#confirmEmailForm",load:b,gather:a,validateOptions:{rules:{Email:{bytemaxlength:255}}}})})})(jQuery);(function(c){function b(d){}function a(){return this._data=c.extend({},this.form.serializeMap())}c(document).ready(function(){c("#resendConfirmationEmailDialog").registerDialog("resendConfirmationEmailDialog",{form:"#resendConfirmationEmailForm",load:b,gather:a,validateOptions:{rules:{Email:{bytemaxlength:255}}}})})})(jQuery);(function(d){function c(e){this._data=e;this.form.unserializeMap({UserName:"",EmailAddress:"",Captcha:""}||e);TRMApi.functions.setCaptcha("#forgottenPassword_captchaImage")}function b(){return this._data=d.extend({},this._data,this.form.serializeMap())}function a(){var e=this}d(document).ready(function(){d("#forgottenPasswordDialog").registerDialog("forgottenPasswordDialog",{form:"#forgottenPasswordForm",init:a,load:c,gather:b,validateOptions:{onfocusout:false,rules:{UserName:{required:"#forgottenPassword_email:blank",bytemaxlength:255},EmailAddress:{required:"#forgottenPassword_username:blank",bytemaxlength:255},Captcha:"captcha"},messages:{UserName:"Either username or email address is required.",EmailAddress:"Either username or email address is required."}}})
})})(jQuery);(function(d){function c(e){this._data=e;d("#connectFbDialog .facebook-fullname").text(e.FacebookFullName);this.form.unserializeMap({Username:"",Password:"",AcceptTaC:false})}function b(){return this._data=d.extend({},this._data,this.form.serializeMap())}function a(){var e=this}d(document).ready(function(){d("#connectFbDialog").registerDialog("connectFbDialog",{form:"#connectFbForm",init:a,load:c,gather:b,validateOptions:{onfocusout:false,rules:{Username:{required:"#connectFbDialog_Action_LinkWithFacebook:checked",bytemaxlength:255},Password:{required:"#connectFbDialog_Action_LinkWithFacebook:checked",bytemaxlength:255},Action:{required:true}},messages:{AcceptTaC:"You have to agree.",Action:"Choose one option."}}})})})(jQuery);(function(e){var g;var c;var h;var b;var a;function i(){TRMApi.services.getApplications(function(j){g=j;e("#downloadApplication_manufacturer").clearOptions().addOption("","-- select --").bindOptions(g.MobilePhones,{valueProperty:"MobileManufacturerId",textProperty:"Name",clear:false}).selectOptions("").trigger("change")
});e("#downloadApplication_model").clearOptions()}function f(){return{application:a,model:b}}function d(){var j=this;e("#downloadApplication_manufacturer").change(function(){var k=e("#downloadApplication_manufacturer").val();e("#downloadApplication_model").selectOptions("");if(!k){e("#downloadApplication_model").attr("disabled","disabled").clearOptions()}else{e("#downloadApplication_model").removeAttr("disabled");c=e.grep(g.MobilePhones,function(o,m){return o.MobileManufacturerId==k})[0];var l=c.Models;h={};e.each(l,function(){h[this.MobileModelId]=this});e("#downloadApplication_model").clearOptions().addOption("","-- select --").bindOptions(l,{valueProperty:"MobileModelId",textProperty:"Name",clear:false})}e("#downloadApplication_model").selectOptions("").trigger("change")});e("#downloadApplication_model").change(function(){var k=e("#downloadApplication_model").val();if(!!k){b=h[k];var l=b.ApplicationId;a=e.grep(g.Applications,function(o,m){return o.ApplicationId==l})[0]}})}e(document).ready(function(){var j=e("#downloadApplicationDialog").registerDialog("downloadApplicationDialog",{form:"#downloadApplicationForm",init:d,load:i,gather:f})
})})(jQuery);