var Base=function(){};
Base.extend=function(_instance,_static){var extend=Base.prototype.extend;
Base._prototyping=true;
var proto=new this;
extend.call(proto,_instance);
delete Base._prototyping;
var constructor=proto.constructor;
var klass=proto.constructor=function(){if(!Base._prototyping){if(this._constructing||this.constructor==klass){this._constructing=true;
constructor.apply(this,arguments);
delete this._constructing
}else{if(arguments[0]!=null){return(arguments[0].extend||extend).call(arguments[0],proto)
}}}};
klass.ancestor=this;
klass.extend=this.extend;
klass.forEach=this.forEach;
klass.implement=this.implement;
klass.prototype=proto;
klass.toString=this.toString;
klass.valueOf=function(type){return(type=="object")?klass:constructor.valueOf()
};
extend.call(klass,_static);
if(typeof klass.init=="function"){klass.init()
}return klass
};
Base.prototype={extend:function(source,value){if(arguments.length>1){var ancestor=this[source];
if(ancestor&&(typeof value=="function")&&(!ancestor.valueOf||ancestor.valueOf()!=value.valueOf())&&/\bbase\b/.test(value)){var method=value.valueOf();
value=function(){var previous=this.base||Base.prototype.base;
this.base=ancestor;
var returnValue=method.apply(this,arguments);
this.base=previous;
return returnValue
};
value.valueOf=function(type){return(type=="object")?value:method
};
value.toString=Base.toString
}this[source]=value
}else{if(source){var extend=Base.prototype.extend;
if(!Base._prototyping&&typeof this!="function"){extend=this.extend||extend
}var proto={toSource:null};
var hidden=["constructor","toString","valueOf"];
var i=Base._prototyping?0:1;
while(key=hidden[i++]){if(source[key]!=proto[key]){extend.call(this,key,source[key])
}}for(var key in source){if(!proto[key]){extend.call(this,key,source[key])
}}}}return this
},base:function(){}};
Base=Base.extend({constructor:function(){this.extend(arguments[0])
}},{ancestor:Object,version:"1.1",forEach:function(object,block,context){for(var key in object){if(this.prototype[key]===undefined){block.call(context,object[key],key,object)
}}},implement:function(){for(var i=0;
i<arguments.length;
i++){if(typeof arguments[i]=="function"){arguments[i](this.prototype)
}else{this.prototype.extend(arguments[i])
}}return this
},toString:function(){return String(this.valueOf())
}});
if(!this.JSON){JSON={}
}(function(){function f(n){return n<10?"0"+n:n
}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"
};
String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()
}
}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;
function quote(string){escapable.lastIndex=0;
return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];
return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
})+'"':'"'+string+'"'
}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];
if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)
}if(typeof rep==="function"){value=rep.call(holder,key,value)
}switch(typeof value){case"string":return quote(value);
case"number":return isFinite(value)?String(value):"null";
case"boolean":case"null":return String(value);
case"object":if(!value){return"null"
}gap+=indent;
partial=[];
if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;
for(i=0;
i<length;
i+=1){partial[i]=str(i,value)||"null"
}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";
gap=mind;
return v
}if(rep&&typeof rep==="object"){length=rep.length;
for(i=0;
i<length;
i+=1){k=rep[i];
if(typeof k==="string"){v=str(k,value);
if(v){partial.push(quote(k)+(gap?": ":":")+v)
}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);
if(v){partial.push(quote(k)+(gap?": ":":")+v)
}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";
gap=mind;
return v
}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;
gap="";
indent="";
if(typeof space==="number"){for(i=0;
i<space;
i+=1){indent+=" "
}}else{if(typeof space==="string"){indent=space
}}rep=replacer;
if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")
}return str("",{"":value})
}
}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;
function walk(holder,key){var k,v,value=holder[key];
if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);
if(v!==undefined){value[k]=v
}else{delete value[k]
}}}}return reviver.call(holder,key,value)
}cx.lastIndex=0;
if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
})
}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");
return typeof reviver==="function"?walk({"":j},""):j
}throw new SyntaxError("JSON.parse")
}
}}());
/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)
},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;
jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;
if(selector.nodeType){this[0]=selector;
this.length=1;
this.context=selector;
return this
}if(typeof selector==="string"){var match=quickExpr.exec(selector);
if(match&&(match[1]||!context)){if(match[1]){selector=jQuery.clean([match[1]],context)
}else{var elem=document.getElementById(match[3]);
if(elem&&elem.id!=match[3]){return jQuery().find(selector)
}var ret=jQuery(elem||[]);
ret.context=document;
ret.selector=selector;
return ret
}}else{return jQuery(context).find(selector)
}}else{if(jQuery.isFunction(selector)){return jQuery(document).ready(selector)
}}if(selector.selector&&selector.context){this.selector=selector.selector;
this.context=selector.context
}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))
},selector:"",jquery:"1.3.2",size:function(){return this.length
},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]
},pushStack:function(elems,name,selector){var ret=jQuery(elems);
ret.prevObject=this;
ret.context=this.context;
if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector
}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"
}}return ret
},setArray:function(elems){this.length=0;
Array.prototype.push.apply(this,elems);
return this
},each:function(callback,args){return jQuery.each(this,callback,args)
},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)
},attr:function(name,value,type){var options=name;
if(typeof name==="string"){if(value===undefined){return this[0]&&jQuery[type||"attr"](this[0],name)
}else{options={};
options[name]=value
}}return this.each(function(i){for(name in options){jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))
}})
},css:function(key,value){if((key=="width"||key=="height")&&parseFloat(value)<0){value=undefined
}return this.attr(key,value,"curCSS")
},text:function(text){if(typeof text!=="object"&&text!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))
}var ret="";
jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8){ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])
}})
});
return ret
},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();
if(this[0].parentNode){wrap.insertBefore(this[0])
}wrap.map(function(){var elem=this;
while(elem.firstChild){elem=elem.firstChild
}return elem
}).append(this)
}return this
},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)
})
},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)
})
},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.appendChild(elem)
}})
},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)
}})
},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)
})
},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)
})
},end:function(){return this.prevObject||jQuery([])
},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);
ret.length=0;
jQuery.find(selector,this[0],ret);
return ret
}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)
})),"find",selector)
}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;
if(!html){var div=this.ownerDocument.createElement("div");
div.appendChild(this.cloneNode(true));
html=div.innerHTML
}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]
}else{return this.cloneNode(true)
}});
if(events===true){var orig=this.find("*").andSelf(),i=0;
ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName){return 
}var events=jQuery.data(orig[i],"events");
for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)
}}i++
})
}return ret
},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)
})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1
})),"filter",selector)
},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;
return this.map(function(){var cur=this;
while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);
return cur
}cur=cur.parentNode;
closer++
}})
},not:function(selector){if(typeof selector==="string"){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector)
}else{selector=jQuery.multiFilter(selector,this)
}}var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;
return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector
})
},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))))
},is:function(selector){return !!selector&&jQuery.multiFilter(selector,this).length>0
},hasClass:function(selector){return !!selector&&this.is("."+selector)
},val:function(value){if(value===undefined){var elem=this[0];
if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text
}if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";
if(index<0){return null
}for(var i=one?index:0,max=one?index+1:options.length;
i<max;
i++){var option=options[i];
if(option.selected){value=jQuery(option).val();
if(one){return value
}values.push(value)
}}return values
}return(elem.value||"").replace(/\r/g,"")
}return undefined
}if(typeof value==="number"){value+=""
}return this.each(function(){if(this.nodeType!=1){return 
}if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type)){this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0)
}else{if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);
jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)
});
if(!values.length){this.selectedIndex=-1
}}else{this.value=value
}}})
},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value)
},replaceWith:function(value){return this.after(value).remove()
},eq:function(i){return this.slice(i,+i+1)
},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))
},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)
}))
},andSelf:function(){return this.add(this.prevObject)
},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;
if(first){for(var i=0,l=this.length;
i<l;
i++){callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment)
}}if(scripts){jQuery.each(scripts,evalScript)
}}return this;
function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem
}}};
jQuery.fn.init.prototype=jQuery.fn;
function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"})
}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"")
}if(elem.parentNode){elem.parentNode.removeChild(elem)
}}function now(){return +new Date
}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;
if(typeof target==="boolean"){deep=target;
target=arguments[1]||{};
i=2
}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}
}if(length==i){target=this;
--i
}for(;
i<length;
i++){if((options=arguments[i])!=null){for(var name in options){var src=target[name],copy=options[name];
if(target===copy){continue
}if(deep&&copy&&typeof copy==="object"&&!copy.nodeType){target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy)
}else{if(copy!==undefined){target[name]=copy
}}}}}return target
};
var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;
jQuery.extend({noConflict:function(deep){window.$=_$;
if(deep){window.jQuery=_jQuery
}return jQuery
},isFunction:function(obj){return toString.call(obj)==="[object Function]"
},isArray:function(obj){return toString.call(obj)==="[object Array]"
},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)
},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");
script.type="text/javascript";
if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data))
}else{script.text=data
}head.insertBefore(script,head.firstChild);
head.removeChild(script)
}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()
},each:function(object,callback,args){var name,i=0,length=object.length;
if(args){if(length===undefined){for(name in object){if(callback.apply(object[name],args)===false){break
}}}else{for(;
i<length;
){if(callback.apply(object[i++],args)===false){break
}}}}else{if(length===undefined){for(name in object){if(callback.call(object[name],name,object[name])===false){break
}}}else{for(var value=object[0];
i<length&&callback.call(value,i,value)!==false;
value=object[++i]){}}}return object
},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)){value=value.call(elem,i)
}return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value
},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)){elem.className+=(elem.className?" ":"")+className
}})
},remove:function(elem,classNames){if(elem.nodeType==1){elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return !jQuery.className.has(classNames,className)
}).join(" "):""
}},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1
}},swap:function(elem,options,callback){var old={};
for(var name in options){old[name]=elem.style[name];
elem.style[name]=options[name]
}callback.call(elem);
for(var name in options){elem.style[name]=old[name]
}},css:function(elem,name,force,extra){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;
if(extra==="border"){return 
}jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0
}if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0
}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0
}})
}if(elem.offsetWidth!==0){getWH()
}else{jQuery.swap(elem,props,getWH)
}return Math.max(0,Math.round(val))
}return jQuery.curCSS(elem,name,force)
},curCSS:function(elem,name,force){var ret,style=elem.style;
if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");
return ret==""?"1":ret
}if(name.match(/float/i)){name=styleFloat
}if(!force&&style&&style[name]){ret=style[name]
}else{if(defaultView.getComputedStyle){if(name.match(/float/i)){name="float"
}name=name.replace(/([A-Z])/g,"-$1").toLowerCase();
var computedStyle=defaultView.getComputedStyle(elem,null);
if(computedStyle){ret=computedStyle.getPropertyValue(name)
}if(name=="opacity"&&ret==""){ret="1"
}}else{if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()
});
ret=elem.currentStyle[name]||elem.currentStyle[camelCase];
if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;
elem.runtimeStyle.left=elem.currentStyle.left;
style.left=ret||0;
ret=style.pixelLeft+"px";
style.left=left;
elem.runtimeStyle.left=rsLeft
}}}}return ret
},clean:function(elems,context,fragment){context=context||document;
if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document
}if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);
if(match){return[context.createElement(match[1])]
}}var ret=[],scripts=[],div=context.createElement("div");
jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+=""
}if(!elem){return 
}if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"
});
var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();
var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];
div.innerHTML=wrap[1]+elem+wrap[2];
while(wrap[0]--){div=div.lastChild
}if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];
for(var j=tbody.length-1;
j>=0;
--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])
}}}if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)
}elem=jQuery.makeArray(div.childNodes)
}if(elem.nodeType){ret.push(elem)
}else{ret=jQuery.merge(ret,elem)
}});
if(fragment){for(var i=0;
ret[i];
i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])
}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))))
}fragment.appendChild(ret[i])
}}return scripts
}return ret
},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined
}var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;
name=notxml&&jQuery.props[name]||name;
if(elem.tagName){var special=/href|src|style/.test(name);
if(name=="selected"&&elem.parentNode){elem.parentNode.selectedIndex
}if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode){throw"type property can't be changed"
}elem[name]=value
}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue
}if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");
return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined
}return elem[name]
}if(!jQuery.support.style&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)
}if(set){elem.setAttribute(name,""+value)
}var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);
return attr===null?undefined:attr
}if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;
elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+""=="NaN"?"":"alpha(opacity="+value*100+")")
}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+"":""
}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase()
});
if(set){if(value!=="NaNpx"&&value!==undefined){elem[name]=value
}}return elem[name]
},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"")
},makeArray:function(array){var ret=[];
if(array!=null){var i=array.length;
if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval){ret[0]=array
}else{while(i){ret[--i]=array[i]
}}}return ret
},inArray:function(elem,array){for(var i=0,length=array.length;
i<length;
i++){if(array[i]===elem){return i
}}return -1
},merge:function(first,second){var i=0,elem,pos=first.length;
if(!jQuery.support.getAll){while((elem=second[i++])!=null){if(elem.nodeType!=8){first[pos++]=elem
}}}else{while((elem=second[i++])!=null){first[pos++]=elem
}}return first
},unique:function(array){var ret=[],done={};
try{for(var i=0,length=array.length;
i<length;
i++){var id=jQuery.data(array[i]);
if(!done[id]){done[id]=true;
ret.push(array[i])
}}}catch(e){ret=array
}return ret
},grep:function(elems,callback,inv){var ret=[];
for(var i=0,length=elems.length;
i<length;
i++){if(!inv!=!callback(elems[i],i)){ret.push(elems[i])
}}return ret
},map:function(elems,callback){var ret=[];
for(var i=0,length=elems.length;
i<length;
i++){var value=callback(elems[i],i);
if(value!=null){ret[ret.length]=value
}}return ret.concat.apply([],ret)
}});
var userAgent=navigator.userAgent.toLowerCase();
jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
jQuery.each({parent:function(elem){return elem.parentNode
},parents:function(elem){return jQuery.dir(elem,"parentNode")
},next:function(elem){return jQuery.nth(elem,2,"nextSibling")
},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")
},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")
},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")
},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)
},children:function(elem){return jQuery.sibling(elem.firstChild)
},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)
}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);
if(selector&&typeof selector=="string"){ret=jQuery.multiFilter(selector,ret)
}return this.pushStack(jQuery.unique(ret),name,selector)
}
});
jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);
for(var i=0,l=insert.length;
i<l;
i++){var elems=(i>0?this.clone(true):this).get();
jQuery.fn[original].apply(jQuery(insert[i]),elems);
ret=ret.concat(elems)
}return this.pushStack(ret,name,selector)
}
});
jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");
if(this.nodeType==1){this.removeAttribute(name)
}},addClass:function(classNames){jQuery.className.add(this,classNames)
},removeClass:function(classNames){jQuery.className.remove(this,classNames)
},toggleClass:function(classNames,state){if(typeof state!=="boolean"){state=!jQuery.className.has(this,classNames)
}jQuery.className[state?"add":"remove"](this,classNames)
},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);
jQuery.removeData(this)
});
if(this.parentNode){this.parentNode.removeChild(this)
}}},empty:function(){jQuery(this).children().remove();
while(this.firstChild){this.removeChild(this.firstChild)
}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)
}
});
function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0
}var expando="jQuery"+now(),uuid=0,windowData={};
jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;
var id=elem[expando];
if(!id){id=elem[expando]=++uuid
}if(name&&!jQuery.cache[id]){jQuery.cache[id]={}
}if(data!==undefined){jQuery.cache[id][name]=data
}return name?jQuery.cache[id][name]:id
},removeData:function(elem,name){elem=elem==window?windowData:elem;
var id=elem[expando];
if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];
name="";
for(name in jQuery.cache[id]){break
}if(!name){jQuery.removeData(elem)
}}}else{try{delete elem[expando]
}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando)
}}delete jQuery.cache[id]
}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";
var q=jQuery.data(elem,type);
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data))
}else{if(data){q.push(data)
}}}return q
},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();
if(!type||type==="fx"){fn=queue[0]
}if(fn!==undefined){fn.call(elem)
}}});
jQuery.fn.extend({data:function(key,value){var parts=key.split(".");
parts[1]=parts[1]?"."+parts[1]:"";
if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);
if(data===undefined&&this.length){data=jQuery.data(this[0],key)
}return data===undefined&&parts[1]?this.data(parts[0]):data
}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value)
})
}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)
})
},queue:function(type,data){if(typeof type!=="string"){data=type;
type="fx"
}if(data===undefined){return jQuery.queue(this[0],type)
}return this.each(function(){var queue=jQuery.queue(this,type,data);
if(type=="fx"&&queue.length==1){queue[0].call(this)
}})
},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)
})
}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;
var Sizzle=function(selector,context,results,seed){results=results||[];
context=context||document;
if(context.nodeType!==1&&context.nodeType!==9){return[]
}if(!selector||typeof selector!=="string"){return results
}var parts=[],m,set,checkSet,check,mode,extra,prune=true;
chunker.lastIndex=0;
while((m=chunker.exec(selector))!==null){parts.push(m[1]);
if(m[2]){extra=RegExp.rightContext;
break
}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)
}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);
while(parts.length){selector=parts.shift();
if(Expr.relative[selector]){selector+=parts.shift()
}set=posProcess(selector,set)
}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));
set=Sizzle.filter(ret.expr,ret.set);
if(parts.length>0){checkSet=makeArray(set)
}else{prune=false
}while(parts.length){var cur=parts.pop(),pop=cur;
if(!Expr.relative[cur]){cur=""
}else{pop=parts.pop()
}if(pop==null){pop=context
}Expr.relative[cur](checkSet,pop,isXML(context))
}}if(!checkSet){checkSet=set
}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)
}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)
}else{if(context.nodeType===1){for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])
}}}else{for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])
}}}}}else{makeArray(checkSet,results)
}if(extra){Sizzle(extra,context,results,seed);
if(sortOrder){hasDuplicate=false;
results.sort(sortOrder);
if(hasDuplicate){for(var i=1;
i<results.length;
i++){if(results[i]===results[i-1]){results.splice(i--,1)
}}}}}return results
};
Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)
};
Sizzle.find=function(expr,context,isXML){var set,match;
if(!expr){return[]
}for(var i=0,l=Expr.order.length;
i<l;
i++){var type=Expr.order[i],match;
if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;
if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");
set=Expr.find[type](match,context,isXML);
if(set!=null){expr=expr.replace(Expr.match[type],"");
break
}}}}if(!set){set=context.getElementsByTagName("*")
}return{set:set,expr:expr}
};
Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);
while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
anyFound=false;
if(curLoop==result){result=[]
}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);
if(!match){anyFound=found=true
}else{if(match===true){continue
}}}if(match){for(var i=0;
(item=curLoop[i])!=null;
i++){if(item){found=filter(item,match,i,curLoop);
var pass=not^!!found;
if(inplace&&found!=null){if(pass){anyFound=true
}else{curLoop[i]=false
}}else{if(pass){result.push(item);
anyFound=true
}}}}}if(found!==undefined){if(!inplace){curLoop=result
}expr=expr.replace(Expr.match[type],"");
if(!anyFound){return[]
}break
}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr
}else{break
}}old=expr
}return curLoop
};
var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")
}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;
if(isTag&&!isXML){part=part.toUpperCase()
}for(var i=0,l=checkSet.length,elem;
i<l;
i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part
}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)
}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";
if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){var parent=elem.parentNode;
checkSet[i]=parent.nodeName===part?parent:false
}}}else{for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part
}}if(isPartStr){Sizzle.filter(part,checkSet,true)
}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)
},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)
}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?[m]:[]
}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);
for(var i=0,l=results.length;
i<l;
i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])
}}return ret.length===0?null:ret
}},TAG:function(match,context){return context.getElementsByTagName(match[1])
}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";
if(isXML){return match
}for(var i=0,elem;
(elem=curLoop[i])!=null;
i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)
}}else{if(inplace){curLoop[i]=false
}}}}return false
},ID:function(match){return match[1].replace(/\\/g,"")
},TAG:function(match,curLoop){for(var i=0;
curLoop[i]===false;
i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()
},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);
match[2]=(test[1]+(test[2]||1))-0;
match[3]=test[3]-0
}match[0]=done++;
return match
},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");
if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]
}if(match[2]==="~="){match[4]=" "+match[4]+" "
}return match
},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)
}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);
if(!inplace){result.push.apply(result,ret)
}return false
}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true
}}return match
},POS:function(match){match.unshift(true);
return match
}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"
},disabled:function(elem){return elem.disabled===true
},checked:function(elem){return elem.checked===true
},selected:function(elem){elem.parentNode.selectedIndex;
return elem.selected===true
},parent:function(elem){return !!elem.firstChild
},empty:function(elem){return !elem.firstChild
},has:function(elem,i,match){return !!Sizzle(match[3],elem).length
},header:function(elem){return/h\d/i.test(elem.nodeName)
},text:function(elem){return"text"===elem.type
},radio:function(elem){return"radio"===elem.type
},checkbox:function(elem){return"checkbox"===elem.type
},file:function(elem){return"file"===elem.type
},password:function(elem){return"password"===elem.type
},submit:function(elem){return"submit"===elem.type
},image:function(elem){return"image"===elem.type
},reset:function(elem){return"reset"===elem.type
},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"
},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)
}},setFilters:{first:function(elem,i){return i===0
},last:function(elem,i,match,array){return i===array.length-1
},even:function(elem,i){return i%2===0
},odd:function(elem,i){return i%2===1
},lt:function(elem,i,match){return i<match[3]-0
},gt:function(elem,i,match){return i>match[3]-0
},nth:function(elem,i,match){return match[3]-0==i
},eq:function(elem,i,match){return match[3]-0==i
}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];
if(filter){return filter(elem,i,match,array)
}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0
}else{if(name==="not"){var not=match[3];
for(var i=0,l=not.length;
i<l;
i++){if(not[i]===elem){return false
}}return true
}}}},CHILD:function(elem,match){var type=match[1],node=elem;
switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false
}}if(type=="first"){return true
}node=elem;
case"last":while(node=node.nextSibling){if(node.nodeType===1){return false
}}return true;
case"nth":var first=match[2],last=match[3];
if(first==1&&last==0){return true
}var doneName=match[0],parent=elem.parentNode;
if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;
for(node=parent.firstChild;
node;
node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count
}}parent.sizcache=doneName
}var diff=elem.nodeIndex-last;
if(first==0){return diff==0
}else{return(diff%first==0&&diff/first>=0)
}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match
},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match
},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1
},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];
return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false
},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];
if(filter){return filter(elem,i,match,array)
}}}};
var origPOS=Expr.match.POS;
for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)
}var makeArray=function(array,results){array=Array.prototype.slice.call(array);
if(results){results.push.apply(results,array);
return results
}return array
};
try{Array.prototype.slice.call(document.documentElement.childNodes)
}catch(e){makeArray=function(array,results){var ret=results||[];
if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)
}else{if(typeof array.length==="number"){for(var i=0,l=array.length;
i<l;
i++){ret.push(array[i])
}}else{for(var i=0;
array[i];
i++){ret.push(array[i])
}}}return ret
}
}var sortOrder;
if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();
aRange.selectNode(a);
aRange.collapse(true);
bRange.selectNode(b);
bRange.collapse(true);
var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);
if(ret===0){hasDuplicate=true
}return ret
}
}}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();
form.innerHTML="<input name='"+id+"'/>";
var root=document.documentElement;
root.insertBefore(form,root.firstChild);
if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]
}};
Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");
return elem.nodeType===1&&node&&node.nodeValue===match
}
}root.removeChild(form)
})();
(function(){var div=document.createElement("div");
div.appendChild(document.createComment(""));
if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);
if(match[1]==="*"){var tmp=[];
for(var i=0;
results[i];
i++){if(results[i].nodeType===1){tmp.push(results[i])
}}results=tmp
}return results
}
}div.innerHTML="<a href='#'></a>";
if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)
}
}})();
if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");
div.innerHTML="<p class='TEST'></p>";
if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return 
}Sizzle=function(query,context,extra,seed){context=context||document;
if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)
}catch(e){}}return oldSizzle(query,context,extra,seed)
};
Sizzle.find=oldSizzle.find;
Sizzle.filter=oldSizzle.filter;
Sizzle.selectors=oldSizzle.selectors;
Sizzle.matches=oldSizzle.matches
})()
}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");
div.innerHTML="<div class='test e'></div><div class='test'></div>";
if(div.getElementsByClassName("e").length===0){return 
}div.lastChild.className="e";
if(div.getElementsByClassName("e").length===1){return 
}Expr.order.splice(1,0,"CLASS");
Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])
}}
})()
}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(elem.nodeName===cur){match=elem;
break
}elem=elem[dir]
}checkSet[i]=match
}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(typeof cur!=="string"){if(elem===cur){match=true;
break
}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;
break
}}}elem=elem[dir]
}checkSet[i]=match
}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16
}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)
};
var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)
};
var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;
while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];
selector=selector.replace(Expr.match.PSEUDO,"")
}selector=Expr.relative[selector]?selector+"*":selector;
for(var i=0,l=root.length;
i<l;
i++){Sizzle(selector,root[i],tmpSet)
}return Sizzle.filter(later,tmpSet)
};
jQuery.find=Sizzle;
jQuery.filter=Sizzle.filter;
jQuery.expr=Sizzle.selectors;
jQuery.expr[":"]=jQuery.expr.filters;
Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0
};
Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0
};
Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem
}).length
};
jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"
}return Sizzle.matches(expr,elems)
};
jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];
while(cur&&cur!=document){if(cur.nodeType==1){matched.push(cur)
}cur=cur[dir]
}return matched
};
jQuery.nth=function(cur,result,dir,elem){result=result||1;
var num=0;
for(;
cur;
cur=cur[dir]){if(cur.nodeType==1&&++num==result){break
}}return cur
};
jQuery.sibling=function(n,elem){var r=[];
for(;
n;
n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)
}}return r
};
return ;
window.Sizzle=Sizzle
})();
jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return 
}if(elem.setInterval&&elem!=window){elem=window
}if(!handler.guid){handler.guid=this.guid++
}if(data!==undefined){var fn=handler;
handler=this.proxy(fn);
handler.data=data
}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined
});
handle.elem=elem;
jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");
type=namespaces.shift();
handler.type=namespaces.slice().sort().join(".");
var handlers=events[type];
if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].setup.call(elem,data,namespaces)
}if(!handlers){handlers=events[type]={};
if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener){elem.addEventListener(type,handle,false)
}else{if(elem.attachEvent){elem.attachEvent("on"+type,handle)
}}}}handlers[handler.guid]=handler;
jQuery.event.global[type]=true
});
elem=null
},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8){return 
}var events=jQuery.data(elem,"events"),ret,index;
if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)==".")){for(var type in events){this.remove(elem,type+(types||""))
}}else{if(types.type){handler=types.handler;
types=types.type
}jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");
type=namespaces.shift();
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
if(events[type]){if(handler){delete events[type][handler.guid]
}else{for(var handle in events[type]){if(namespace.test(events[type][handle].type)){delete events[type][handle]
}}}if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].teardown.call(elem,namespaces)
}for(ret in events[type]){break
}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener){elem.removeEventListener(type,jQuery.data(elem,"handle"),false)
}else{if(elem.detachEvent){elem.detachEvent("on"+type,jQuery.data(elem,"handle"))
}}}ret=null;
delete events[type]
}}})
}for(ret in events){break
}if(!ret){var handle=jQuery.data(elem,"handle");
if(handle){handle.elem=null
}jQuery.removeData(elem,"events");
jQuery.removeData(elem,"handle")
}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;
if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);
if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);
event.exclusive=true
}if(!elem){event.stopPropagation();
if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem)
}})
}}if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined
}event.result=undefined;
event.target=elem;
data=jQuery.makeArray(data);
data.unshift(event)
}event.currentTarget=elem;
var handle=jQuery.data(elem,"handle");
if(handle){handle.apply(elem,data)
}if((!elem[type]||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false
}if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;
try{elem[type]()
}catch(e){}}this.triggered=false;
if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;
if(parent){jQuery.event.trigger(event,data,parent,true)
}}},handle:function(event){var all,handlers;
event=arguments[0]=jQuery.event.fix(event||window.event);
event.currentTarget=this;
var namespaces=event.type.split(".");
event.type=namespaces.shift();
all=!namespaces.length&&!event.exclusive;
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
handlers=(jQuery.data(this,"events")||{})[event.type];
for(var j in handlers){var handler=handlers[j];
if(all||namespace.test(handler.type)){event.handler=handler;
event.data=handler.data;
var ret=handler.apply(this,arguments);
if(ret!==undefined){event.result=ret;
if(ret===false){event.preventDefault();
event.stopPropagation()
}}if(event.isImmediatePropagationStopped()){break
}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event
}var originalEvent=event;
event=jQuery.Event(originalEvent);
for(var i=this.props.length,prop;
i;
){prop=this.props[--i];
event[prop]=originalEvent[prop]
}if(!event.target){event.target=event.srcElement||document
}if(event.target.nodeType==3){event.target=event.target.parentNode
}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement
}if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;
event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);
event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0)
}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode
}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey
}if(!event.which&&event.button){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))
}return event
},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments)
};
proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;
return proxy
},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)
},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");
jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++
}});
if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler)
}}}}}};
jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src)
}if(src&&src.type){this.originalEvent=src;
this.type=src.type
}else{this.type=src
}this.timeStamp=now();
this[expando]=true
};
function returnFalse(){return false
}function returnTrue(){return true
}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.preventDefault){e.preventDefault()
}e.returnValue=false
},stopPropagation:function(){this.isPropagationStopped=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.stopPropagation){e.stopPropagation()
}e.cancelBubble=true
},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;
this.stopPropagation()
},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};
var withinElement=function(event){var parent=event.relatedTarget;
while(parent&&parent!=this){try{parent=parent.parentNode
}catch(e){parent=this
}}if(parent!=this){event.type=event.data;
jQuery.event.handle.apply(this,arguments)
}};
jQuery.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)
},teardown:function(){jQuery.event.remove(this,orig,withinElement)
}}
});
jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data)
})
},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);
return(fn||data).apply(this,arguments)
});
return this.each(function(){jQuery.event.add(this,type,one,fn&&data)
})
},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn)
})
},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)
})
},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);
event.preventDefault();
event.stopPropagation();
jQuery.event.trigger(event,data,this[0]);
return event.result
}},toggle:function(fn){var args=arguments,i=1;
while(i<args.length){jQuery.event.proxy(fn,args[i++])
}return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;
event.preventDefault();
return args[this.lastToggle++].apply(this,arguments)||false
}))
},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut)
},ready:function(fn){bindReady();
if(jQuery.isReady){fn.call(document,jQuery)
}else{jQuery.readyList.push(fn)
}return this
},live:function(type,fn){var proxy=jQuery.event.proxy(fn);
proxy.guid+=this.selector+type;
jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);
return this
},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);
return this
}});
function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];
jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];
if(elem){elems.push({elem:elem,fn:fn})
}}});
elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest")
});
jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false){return(stop=false)
}});
return stop
}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")
}jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;
if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery)
});
jQuery.readyList=null
}jQuery(document).triggerHandler("ready")
}}});
var readyBound=false;
function bindReady(){if(readyBound){return 
}readyBound=true;
if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);
jQuery.ready()
},false)
}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);
jQuery.ready()
}});
if(document.documentElement.doScroll&&window==window.top){(function(){if(jQuery.isReady){return 
}try{document.documentElement.doScroll("left")
}catch(error){setTimeout(arguments.callee,0);
return 
}jQuery.ready()
})()
}}}jQuery.event.add(window,"load",jQuery.ready)
}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)
}
});
jQuery(window).bind("unload",function(){for(var id in jQuery.cache){if(id!=1&&jQuery.cache[id].handle){jQuery.event.remove(jQuery.cache[id].handle.elem)
}}});
(function(){jQuery.support={};
var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();
div.style.display="none";
div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];
if(!all||!all.length||!a){return 
}jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};
script.type="text/javascript";
try{script.appendChild(document.createTextNode("window."+id+"=1;"))
}catch(e){}root.insertBefore(script,root.firstChild);
if(window[id]){jQuery.support.scriptEval=true;
delete window[id]
}root.removeChild(script);
if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;
div.detachEvent("onclick",arguments.callee)
});
div.cloneNode(true).fireEvent("onclick")
}jQuery(function(){var div=document.createElement("div");
div.style.width=div.style.paddingLeft="1px";
if(document.body){document.body.appendChild(div);
jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;
document.body.removeChild(div).style.display="none"
}})
})();
var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";
jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};
jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string"){return this._load(url)
}var off=url.indexOf(" ");
if(off>=0){var selector=url.slice(off,url.length);
url=url.slice(0,off)
}var type="GET";
if(params){if(jQuery.isFunction(params)){callback=params;
params=null
}else{if(typeof params==="object"){params=jQuery.param(params);
type="POST"
}}}var self=this;
jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified"){self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText)
}if(callback){self.each(callback,[res.responseText,status,res])
}}});
return this
},serialize:function(){return jQuery.param(this.serializeArray())
},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this
}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))
}).map(function(i,elem){var val=jQuery(this).val();
return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val}
}):{name:elem.name,value:val}
}).get()
}});
jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)
}
});
var jsc=now();
jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;
data=null
}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})
},getScript:function(url,callback){return jQuery.get(url,null,callback,"script")
},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")
},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;
data={}
}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type})
},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings)
},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()
},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));
var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data)
}if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre)){s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?"
}}else{if(!s.data||!s.data.match(jsre)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"
}}s.dataType="json"
}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;
if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1")
}s.url=s.url.replace(jsre,"="+jsonp+"$1");
s.dataType="script";
window[jsonp]=function(tmp){data=tmp;
success();
complete();
window[jsonp]=undefined;
try{delete window[jsonp]
}catch(e){}if(head){head.removeChild(script)
}}
}if(s.dataType=="script"&&s.cache==null){s.cache=false
}if(s.cache===false&&type=="GET"){var ts=now();
var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");
s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"")
}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;
s.data=null
}if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")
}var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);
if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];
var script=document.createElement("script");
script.src=s.url;
if(s.scriptCharset){script.charset=s.scriptCharset
}if(!jsonp){var done=false;
script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;
success();
complete();
script.onload=script.onreadystatechange=null;
head.removeChild(script)
}}
}head.appendChild(script);
return undefined
}var requestDone=false;
var xhr=s.xhr();
if(s.username){xhr.open(type,s.url,s.async,s.username,s.password)
}else{xhr.open(type,s.url,s.async)
}try{if(s.data){xhr.setRequestHeader("Content-Type",s.contentType)
}if(s.ifModified){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT")
}xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");
xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)
}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}xhr.abort();
return false
}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])
}var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);
ival=null;
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}}}else{if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;
if(ival){clearInterval(ival);
ival=null
}status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";
if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s)
}catch(e){status="parsererror"
}}if(status=="success"){var modRes;
try{modRes=xhr.getResponseHeader("Last-Modified")
}catch(e){}if(s.ifModified&&modRes){jQuery.lastModified[s.url]=modRes
}if(!jsonp){success()
}}else{jQuery.handleError(s,xhr,status)
}complete();
if(isTimeout){xhr.abort()
}if(s.async){xhr=null
}}}};
if(s.async){var ival=setInterval(onreadystatechange,13);
if(s.timeout>0){setTimeout(function(){if(xhr&&!requestDone){onreadystatechange("timeout")
}},s.timeout)
}}try{xhr.send(s.data)
}catch(e){jQuery.handleError(s,xhr,null,e)
}if(!s.async){onreadystatechange()
}function success(){if(s.success){s.success(data,status)
}if(s.global){jQuery.event.trigger("ajaxSuccess",[xhr,s])
}}function complete(){if(s.complete){s.complete(xhr,status)
}if(s.global){jQuery.event.trigger("ajaxComplete",[xhr,s])
}if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}}return xhr
},handleError:function(s,xhr,status,e){if(s.error){s.error(xhr,status,e)
}if(s.global){jQuery.event.trigger("ajaxError",[xhr,s,e])
}},active:0,httpSuccess:function(xhr){try{return !xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223
}catch(e){}return false
},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");
return xhr.status==304||xhrRes==jQuery.lastModified[url]
}catch(e){}return false
},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;
if(xml&&data.documentElement.tagName=="parsererror"){throw"parsererror"
}if(s&&s.dataFilter){data=s.dataFilter(data,type)
}if(typeof data==="string"){if(type=="script"){jQuery.globalEval(data)
}if(type=="json"){data=window["eval"]("("+data+")")
}}return data
},param:function(a){var s=[];
function add(key,value){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)
}if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value)
})
}else{for(var j in a){if(jQuery.isArray(a[j])){jQuery.each(a[j],function(){add(j,this)
})
}else{add(j,jQuery.isFunction(a[j])?a[j]():a[j])
}}}return s.join("&").replace(/%20/g,"+")
}});
var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];
function genFx(type,num){var obj={};
jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type
});
return obj
}jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
this[i].style.display=old||"";
if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;
if(elemdisplay[tagName]){display=elemdisplay[tagName]
}else{var elem=jQuery("<"+tagName+" />").appendTo("body");
display=elem.css("display");
if(display==="none"){display="block"
}elem.remove();
elemdisplay[tagName]=display
}jQuery.data(this[i],"olddisplay",display)
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||""
}return this
}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display="none"
}return this
}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";
return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");
jQuery(this)[state?"show":"hide"]()
}):this.animate(genFx("toggle",3),fn,fn2)
},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback)
},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);
return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;
for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden){return opt.complete.call(this)
}if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");
opt.overflow=this.style.overflow
}}if(opt.overflow!=null){this.style.overflow="hidden"
}opt.curAnim=jQuery.extend({},prop);
jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);
if(/toggle|show|hide/.test(val)){e[val=="toggle"?hidden?"show":"hide":val](prop)
}else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;
if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";
if(unit!="px"){self.style[name]=(end||1)+unit;
start=((end||1)/e.cur(true))*start;
self.style[name]=start+unit
}if(parts[1]){end=((parts[1]=="-="?-1:1)*end)+start
}e.custom(start,end,unit)
}else{e.custom(start,val,"")
}}});
return true
})
},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;
if(clearQueue){this.queue([])
}this.each(function(){for(var i=timers.length-1;
i>=0;
i--){if(timers[i].elem==this){if(gotoEnd){timers[i](true)
}timers.splice(i,1)
}}});
if(!gotoEnd){this.dequeue()
}return this
}});
jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)
}
});
jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};
opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;
opt.old=opt.complete;
opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue()
}if(jQuery.isFunction(opt.old)){opt.old.call(this)
}};
return opt
},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p
},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum
}},timers:[],fx:function(elem,options,prop){this.options=options;
this.elem=elem;
this.prop=prop;
if(!options.orig){options.orig={}
}}});
jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)
}(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);
if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"
}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]
}var r=parseFloat(jQuery.css(this.elem,this.prop,force));
return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0
},custom:function(from,to,unit){this.startTime=now();
this.start=from;
this.end=to;
this.unit=unit||this.unit||"px";
this.now=this.start;
this.pos=this.state=0;
var self=this;
function t(gotoEnd){return self.step(gotoEnd)
}t.elem=this.elem;
if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;
for(var i=0;
i<timers.length;
i++){if(!timers[i]()){timers.splice(i--,1)
}}if(!timers.length){clearInterval(timerId);
timerId=undefined
}},13)
}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.show=true;
this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());
jQuery(this.elem).show()
},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.hide=true;
this.custom(this.cur(),0)
},step:function(gotoEnd){var t=now();
if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;
this.pos=this.state=1;
this.update();
this.options.curAnim[this.prop]=true;
var done=true;
for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false
}}if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;
this.elem.style.display=this.options.display;
if(jQuery.css(this.elem,"display")=="none"){this.elem.style.display="block"
}}if(this.options.hide){jQuery(this.elem).hide()
}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])
}}this.options.complete.call(this.elem)
}return false
}else{var n=t-this.startTime;
this.state=n/this.options.duration;
this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);
this.now=this.start+((this.end-this.start)*this.pos);
this.update()
}return true
}};
jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)
},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit
}else{fx.elem[fx.prop]=fx.now
}}}});
if(document.documentElement.getBoundingClientRect){jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;
return{top:top,left:left}
}
}else{jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}jQuery.offset.initialized||jQuery.offset.initialize();
var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;
while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);
top-=elem.scrollTop,left-=elem.scrollLeft;
if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;
if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevOffsetParent=offsetParent,offsetParent=elem.offsetParent
}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevComputedStyle=computedStyle
}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop,left+=body.offsetLeft
}if(prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft)
}return{top:top,left:left}
}
}jQuery.offset={initialize:function(){if(this.initialized){return 
}var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
rules={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};
for(prop in rules){container.style[prop]=rules[prop]
}container.innerHTML=html;
body.insertBefore(container,body.firstChild);
innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder=(checkDiv.offsetTop!==5);
this.doesAddBorderForTableAndCells=(td.offsetTop===5);
innerDiv.style.overflow="hidden",innerDiv.style.position="relative";
this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);
body.style.marginTop="1px";
this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);
body.style.marginTop=bodyMarginTop;
body.removeChild(container);
this.initialized=true
},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();
var top=body.offsetTop,left=body.offsetLeft;
if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseInt(jQuery.curCSS(body,"marginTop",true),10)||0,left+=parseInt(jQuery.curCSS(body,"marginLeft",true),10)||0
}return{top:top,left:left}
}};
jQuery.fn.extend({position:function(){var left=0,top=0,results;
if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();
offset.top-=num(this,"marginTop");
offset.left-=num(this,"marginLeft");
parentOffset.top+=num(offsetParent,"borderTopWidth");
parentOffset.left+=num(offsetParent,"borderLeftWidth");
results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}
}return results
},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;
while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,"position")=="static")){offsetParent=offsetParent.offsetParent
}return jQuery(offsetParent)
}});
jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;
jQuery.fn[method]=function(val){if(!this[0]){return null
}return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val
}):this[0]==window||this[0]==document?self[i?"pageYOffset":"pageXOffset"]||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method]
}
});
jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();
jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null
};
jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null
};
var type=name.toLowerCase();
jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")
}
})
})();
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);
c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;
for(var j in n){m.plugins[j]=m.plugins[j]||[];
m.plugins[j].push([l,n[j]])
}},call:function(j,l,k){var n=j.plugins[l];
if(!n||!j.element[0].parentNode){return 
}for(var m=0;
m<n.length;
m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)
}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)
},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false
}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;
if(m[j]>0){return true
}m[j]=1;
l=(m[j]>0);
m[j]=0;
return l
},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))
},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)
},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};
if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;
c.attr=function(k,j,l){var m=l!==undefined;
return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))
};
c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))
}):e.call(this,j))
}
}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")
});
return i.apply(this,arguments)
},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")
},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false
})
},scrollParent:function(){var j;
if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))
}).eq(0)
}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))
}).eq(0)
}return(/fixed/).test(this.css("position"))||!j.length?c(document):j
}});
c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])
},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");
return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length
},tabbable:function(k){var j=c.attr(k,"tabindex");
return(isNaN(j)||j>=0)&&c(k).is(":focusable")
}});
function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];
return(typeof p=="string"?p.split(/,?\s+/):p)
}var j=k("getter");
if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))
}return(c.inArray(o,j)!=-1)
}c.widget=function(k,j){var l=k.split(".")[0];
k=k.split(".")[1];
c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);
if(n&&p.substring(0,1)=="_"){return this
}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);
return(m?m[p].apply(m,o):undefined)
}return this.each(function(){var q=c.data(this,k);
(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());
(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))
})
};
c[l]=c[l]||{};
c[l][k]=function(o,n){var m=this;
this.namespace=l;
this.widgetName=k;
this.widgetEventPrefix=c[l][k].eventPrefix||k;
this.widgetBaseClass=l+"-"+k;
this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);
this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)
}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)
}}).bind("remove",function(){return m.destroy()
})
};
c[l][k].prototype=c.extend({},c.widget.prototype,j);
c[l][k].getterSetter="option"
};
c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")
},option:function(l,m){var k=l,j=this;
if(typeof l=="string"){if(m===undefined){return this._getData(l)
}k={};
k[l]=m
}c.each(k,function(n,o){j._setData(n,o)
})
},_getData:function(j){return this.options[j]
},_setData:function(j,k){this.options[j]=k;
if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)
}},enable:function(){this._setData("disabled",false)
},disable:function(){this._setData("disabled",true)
},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);
m=c.Event(m);
m.type=j;
if(m.originalEvent){for(var k=c.event.props.length,o;
k;
){o=c.event.props[--k];
m[o]=m.originalEvent[o]
}}this.element.trigger(m,n);
return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())
}};
c.widget.defaults={disabled:false};
c.ui.mouse={_mouseInit:function(){var j=this;
this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)
}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;
k.stopImmediatePropagation();
return false
}});
if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");
this.element.attr("unselectable","on")
}this.started=false
},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))
},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};
if(l.originalEvent.mouseHandled){return 
}(this._mouseStarted&&this._mouseUp(l));
this._mouseDownEvent=l;
var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);
if(!m||j||!this._mouseCapture(l)){return true
}this.mouseDelayMet=!this.options.delay;
if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true
},this.options.delay)
}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);
if(!this._mouseStarted){l.preventDefault();
return true
}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)
};
this._mouseUpDelegate=function(n){return k._mouseUp(n)
};
c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
(c.browser.safari||l.preventDefault());
l.originalEvent.mouseHandled=true;
return true
},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)
}if(this._mouseStarted){this._mouseDrag(j);
return j.preventDefault()
}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);
(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))
}return !this._mouseStarted
},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;
this._preventClickEvent=(j.target==this._mouseDownEvent.target);
this._mouseStop(j)
}return false
},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)
},_mouseDelayMet:function(j){return this.mouseDelayMet
},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true
}};
c.ui.mouse.defaults={cancel:null,distance:1,delay:0}
})(jQuery);
(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"
}(this.options.addClasses&&this.element.addClass("ui-draggable"));
(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));
this._mouseInit()
},destroy:function(){if(!this.element.data("draggable")){return 
}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");
this._mouseDestroy()
},_mouseCapture:function(b){var c=this.options;
if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false
}this.handle=this._getHandle(b);
if(!this.handle){return false
}return true
},_mouseStart:function(b){var c=this.options;
this.helper=this._createHelper(b);
this._cacheHelperProportions();
if(a.ui.ddmanager){a.ui.ddmanager.current=this
}this._cacheMargins();
this.cssPosition=this.helper.css("position");
this.scrollParent=this.helper.scrollParent();
this.offset=this.element.offset();
this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};
a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this._generatePosition(b);
this.originalPageX=b.pageX;
this.originalPageY=b.pageY;
if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)
}if(c.containment){this._setContainment()
}this._trigger("start",b);
this._cacheHelperProportions();
if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)
}this.helper.addClass("ui-draggable-dragging");
this._mouseDrag(b,true);
return true
},_mouseDrag:function(b,d){this.position=this._generatePosition(b);
this.positionAbs=this._convertPositionTo("absolute");
if(!d){var c=this._uiHash();
this._trigger("drag",b,c);
this.position=c.position
}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"
}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"
}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)
}return false
},_mouseStop:function(c){var d=false;
if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)
}if(this.dropped){d=this.dropped;
this.dropped=false
}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;
a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);
b._clear()
})
}else{this._trigger("stop",c);
this._clear()
}return false
},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;
a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true
}});
return c
},_createHelper:function(c){var d=this.options;
var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);
if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))
}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")
}return b
},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left
}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left
}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top
}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top
}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();
var b=this.offsetParent.offset();
if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();
b.top+=this.scrollParent.scrollTop()
}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}
}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}
},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();
return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}
}else{return{top:0,left:0}
}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}
},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}
},_setContainment:function(){var e=this.options;
if(e.containment=="parent"){e.containment=this.helper[0].parentNode
}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]
}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];
if(!c){return 
}var d=a(e.containment).offset();
var b=(a(c).css("overflow")!="hidden");
this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]
}else{if(e.containment.constructor==Array){this.containment=e.containment
}}},_convertPositionTo:function(f,h){if(!h){h=this.position
}var c=f=="absolute"?1:-1;
var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);
return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}
},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);
if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()
}var d=e.pageX;
var c=e.pageY;
if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left
}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top
}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left
}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top
}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];
c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;
var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];
d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f
}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}
},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()
}this.helper=null;
this.cancelHelperRemoval=false
},_trigger:function(b,c,d){d=d||this._uiHash();
a.ui.plugin.call(this,b,[c,d]);
if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")
}return a.widget.prototype._trigger.call(this,b,c,d)
},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}
}}));
a.extend(a.ui.draggable,{version:"1.7.1",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});
a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});
d.sortables=[];
a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");
if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});
g._refreshItems();
g._trigger("activate",c,b)
}})
},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});
a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;
d.cancelHelperRemoval=true;
this.instance.cancelHelperRemoval=false;
if(this.shouldRevert){this.instance.options.revert=true
}this.instance._mouseStop(c);
this.instance.options.helper=this.instance.options._helper;
if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})
}}else{this.instance.cancelHelperRemoval=false;
this.instance._trigger("deactivate",c,b)
}})
},drag:function(c,f){var e=a(this).data("draggable"),b=this;
var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;
var g=this.positionAbs.top,k=this.positionAbs.left;
var j=i.height,l=i.width;
var p=i.top,h=i.left;
return a.ui.isOver(g+n,k+m,p,h,j,l)
};
a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;
this.instance.helperProportions=e.helperProportions;
this.instance.offset.click=e.offset.click;
if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;
this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);
this.instance.options._helper=this.instance.options.helper;
this.instance.options.helper=function(){return f.helper[0]
};
c.target=this.instance.currentItem[0];
this.instance._mouseCapture(c,true);
this.instance._mouseStart(c,true,true);
this.instance.offset.click.top=e.offset.click.top;
this.instance.offset.click.left=e.offset.click.left;
this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;
this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;
e._trigger("toSortable",c);
e.dropped=this.instance.element;
e.currentItem=e.element;
this.instance.fromOutside=e
}if(this.instance.currentItem){this.instance._mouseDrag(c)
}}else{if(this.instance.isOver){this.instance.isOver=0;
this.instance.cancelHelperRemoval=true;
this.instance.options.revert=false;
this.instance._trigger("out",c,this.instance._uiHash(this.instance));
this.instance._mouseStop(c,true);
this.instance.options.helper=this.instance.options._helper;
this.instance.currentItem.remove();
if(this.instance.placeholder){this.instance.placeholder.remove()
}e._trigger("fromSortable",c);
e.dropped=false
}}})
}});
a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;
if(b.css("cursor")){e._cursor=b.css("cursor")
}b.css("cursor",e.cursor)
},stop:function(b,c){var d=a(this).data("draggable").options;
if(d._cursor){a("body").css("cursor",d._cursor)
}}});
a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;
a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")
})
},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)
})
}});
a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;
if(b.css("opacity")){e._opacity=b.css("opacity")
}b.css("opacity",e.opacity)
},stop:function(b,c){var d=a(this).data("draggable").options;
if(d._opacity){a(c.helper).css("opacity",d._opacity)
}}});
a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");
if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()
}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;
if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed
}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed
}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed
}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed
}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)
}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)
}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)
}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)
}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)
}}});
a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;
b.snapElements=[];
a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);
var f=g.offset();
if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})
}})
},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;
var y=q.snapTolerance;
var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;
for(var v=g.snapElements.length-1;
v>=0;
v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;
if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))
}g.snapElements[v].snapping=false;
continue
}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;
var z=Math.abs(A-f)<=y;
var j=Math.abs(s-w)<=y;
var k=Math.abs(n-x)<=y;
if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top
}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top
}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left
}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left
}}var h=(c||z||j||k);
if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;
var z=Math.abs(A-e)<=y;
var j=Math.abs(s-x)<=y;
var k=Math.abs(n-w)<=y;
if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top
}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top
}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left
}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left
}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))
}g.snapElements[v].snapping=(c||z||j||k||h)
}}});
a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;
var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)
});
a(d).each(function(f){this.style.zIndex=e.stack.min+f
});
this[0].style.zIndex=e.stack.min+d.length
}});
a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;
if(b.css("zIndex")){e._zIndex=b.css("zIndex")
}b.css("zIndex",e.zIndex)
},stop:function(b,c){var d=a(this).data("draggable").options;
if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)
}}})
})(jQuery);
(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;
this.isover=0;
this.isout=1;
this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)
};
this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};
a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];
a.ui.ddmanager.droppables[this.options.scope].push(this);
(this.options.addClasses&&this.element.addClass("ui-droppable"))
},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];
for(var c=0;
c<b.length;
c++){if(b[c]==this){b.splice(c,1)
}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")
},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)
}
}else{a.widget.prototype._setData.apply(this,arguments)
}},_activate:function(c){var b=a.ui.ddmanager.current;
if(this.options.activeClass){this.element.addClass(this.options.activeClass)
}(b&&this._trigger("activate",c,this.ui(b)))
},_deactivate:function(c){var b=a.ui.ddmanager.current;
if(this.options.activeClass){this.element.removeClass(this.options.activeClass)
}(b&&this._trigger("deactivate",c,this.ui(b)))
},_over:function(c){var b=a.ui.ddmanager.current;
if(!b||(b.currentItem||b.element)[0]==this.element[0]){return 
}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)
}this._trigger("over",c,this.ui(b))
}},_out:function(c){var b=a.ui.ddmanager.current;
if(!b||(b.currentItem||b.element)[0]==this.element[0]){return 
}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)
}this._trigger("out",c,this.ui(b))
}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;
if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false
}var e=false;
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");
if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;
return false
}});
if(e){return false
}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)
}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)
}this._trigger("drop",c,this.ui(b));
return this.element
}return false
},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}
}});
a.extend(a.ui.droppable,{version:"1.7.1",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});
a.ui.intersect=function(q,j,o){if(!j.offset){return false
}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;
var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;
switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);
break;
case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);
break;
case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);
return f;
break;
case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));
break;
default:return false;
break
}};
a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];
var f=g?g.type:null;
var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();
droppablesLoop:for(var d=0;
d<b.length;
d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue
}for(var c=0;
c<h.length;
c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;
continue droppablesLoop
}}b[d].visible=b[d].element.css("display")!="none";
if(!b[d].visible){continue
}b[d].offset=b[d].element.offset();
b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};
if(f=="mousedown"){b[d]._activate.call(b[d],g)
}}},drop:function(b,c){var d=false;
a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return 
}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)
}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;
this.isover=0;
this._deactivate.call(this,c)
}});
return d
},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)
}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return 
}var e=a.ui.intersect(b,this,this.options.tolerance);
var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);
if(!g){return 
}var f;
if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");
if(d.length){f=a.data(d[0],"droppable");
f.greedyChild=(g=="isover"?1:0)
}}if(f&&g=="isover"){f.isover=0;
f.isout=1;
f._out.call(f,c)
}this[g]=1;
this[g=="isout"?"isover":"isout"]=0;
this[g=="isover"?"_over":"_out"].call(this,c);
if(f&&g=="isout"){f.isout=0;
f.isover=1;
f._over.call(f,c)
}})
}}
})(jQuery);
(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;
this.element.addClass("ui-resizable");
c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})
}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));
this.element=this.element.parent().data("resizable",this.element.data("resizable"));
this.elementIsWrapper=true;
this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});
this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});
this.originalResizeStyle=this.originalElement.css("resize");
this.originalElement.css("resize","none");
this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));
this.originalElement.css({margin:this.originalElement.css("margin")});
this._proportionallyResize()
}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});
if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"
}var k=this.handles.split(",");
this.handles={};
for(var f=0;
f<k.length;
f++){var h=c.trim(k[f]),d="ui-resizable-"+h;
var g=c('<div class="ui-resizable-handle '+d+'"></div>');
if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})
}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")
}this.handles[h]=".ui-resizable-"+h;
this.element.append(g)
}}this._renderAxis=function(p){p=p||this.element;
for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()
}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;
o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();
var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");
p.css(l,o);
this._proportionallyResize()
}if(!c(this.handles[m]).length){continue
}}};
this._renderAxis(this.element);
this._handles=c(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)
}e.axis=i&&i[1]?i[1]:"se"
}});
if(j.autoHide){this._handles.hide();
c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");
e._handles.show()
},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");
e._handles.hide()
}})
}this._mouseInit()
},destroy:function(){this._mouseDestroy();
var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()
};
if(this.elementIsWrapper){d(this.element);
var e=this.element;
e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()
}this.originalElement.css("resize",this.originalResizeStyle);
d(this.originalElement)
},_mouseCapture:function(e){var f=false;
for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true
}}return this.options.disabled||!!f
},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;
this.resizing=true;
this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};
if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})
}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})
}this._renderProxy();
var j=b(this.helper.css("left")),g=b(this.helper.css("top"));
if(i.containment){j+=c(i.containment).scrollLeft()||0;
g+=c(i.containment).scrollTop()||0
}this.offset=this.helper.offset();
this.position={left:j,top:g};
this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};
this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};
this.originalPosition={left:j,top:g};
this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};
this.originalMousePosition={left:f.pageX,top:f.pageY};
this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);
var h=c(".ui-resizable-"+this.axis).css("cursor");
c("body").css("cursor",h=="auto"?this.axis+"-resize":h);
d.addClass("ui-resizable-resizing");
this._propagate("start",f);
return true
},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;
var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;
var h=this._change[m];
if(!h){return false
}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;
if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)
}k=this._respectSize(k,d);
this._propagate("resize",d);
g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});
if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()
}this._updateCache(k);
this._trigger("resize",d,this.ui());
return false
},_mouseStop:function(g){this.resizing=false;
var h=this.options,l=this;
if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;
var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;
if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))
}l.helper.height(l.size.height);
l.helper.width(l.size.width);
if(this._helper&&!h.animate){this._proportionallyResize()
}}c("body").css("cursor","auto");
this.element.removeClass("ui-resizable-resizing");
this._propagate("stop",g);
if(this._helper){this.helper.remove()
}return false
},_updateCache:function(d){var e=this.options;
this.offset=this.helper.offset();
if(a(d.left)){this.position.left=d.left
}if(a(d.top)){this.position.top=d.top
}if(a(d.height)){this.size.height=d.height
}if(a(d.width)){this.size.width=d.width
}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;
if(g.height){g.width=(e.height*this.aspectRatio)
}else{if(g.width){g.height=(e.width/this.aspectRatio)
}}if(d=="sw"){g.left=i.left+(e.width-g.width);
g.top=null
}if(d=="nw"){g.top=i.top+(e.height-g.height);
g.left=i.left+(e.width-g.width)
}return g
},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);
if(g){k.width=h.minWidth
}if(r){k.height=h.minHeight
}if(s){k.width=h.maxWidth
}if(l){k.height=h.maxHeight
}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;
var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);
if(g&&j){k.left=e-h.minWidth
}if(s&&j){k.left=e-h.maxWidth
}if(r&&d){k.top=n-h.minHeight
}if(l&&d){k.top=n-h.maxHeight
}var m=!k.width&&!k.height;
if(m&&!k.left&&k.top){k.top=null
}else{if(m&&!k.top&&k.left){k.left=null
}}return k
},_proportionallyResize:function(){var j=this.options;
if(!this._proportionallyResizeElements.length){return 
}var f=this.helper||this.element;
for(var e=0;
e<this._proportionallyResizeElements.length;
e++){var g=this._proportionallyResizeElements[e];
if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];
this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;
return l+n
})
}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue
}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})
}},_renderProxy:function(){var e=this.element,h=this.options;
this.elementOffset=e.offset();
if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');
var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);
this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});
this.helper.appendTo("body").disableSelection()
}else{this.helper=this.element
}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}
},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;
return{left:h.left+e,width:f.width-e}
},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;
return{top:h.top+d,height:f.height-d}
},s:function(f,e,d){return{height:this.originalSize.height+d}
},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))
},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))
},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))
},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))
}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);
(e!="resize"&&this._trigger(e,d,this.ui()))
},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}
}}));
c.extend(c.ui.resizable,{version:"1.7.1",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});
c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;
_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})
})
};
if(typeof (g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];
_store(g.alsoResize)
}else{c.each(g.alsoResize,function(h,i){_store(h)
})
}}else{_store(g.alsoResize)
}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;
var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];
c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);
if(s&&s>=0){o[t]=s||null
}});
if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;
p.css({position:"absolute",top:"auto",left:"auto"})
}p.css(o)
})
};
if(typeof (i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)
})
}else{d(i.alsoResize)
}},stop:function(e,f){var d=c(this).data("resizable");
if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;
el.css({position:"relative"})
}c(this).removeData("resizable-alsoresize-start")
}});
c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;
var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;
var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;
n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};
if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})
}n._updateCache(o);
n._propagate("resize",h)
}})
}});
c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;
var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;
if(!j){return 
}s.containerElement=c(j);
if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};
s.containerPosition={left:0,top:0};
s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}
}else{var m=c(j),h=[];
c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))
});
s.containerOffset=m.offset();
s.containerPosition=m.position();
s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};
var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);
s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}
}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;
if(g[0]!=document&&(/static/).test(g.css("position"))){d=n
}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));
if(q){s.size.height=s.size.width/h.aspectRatio
}s.position.left=h.helper?n.left:0
}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);
if(q){s.size.width=s.size.height*h.aspectRatio
}s.position.top=s._helper?n.top:0
}s.offset.left=s.parentData.left+s.position.left;
s.offset.top=s.parentData.top+s.position.top;
var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);
var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));
if(j&&i){k-=s.parentData.left
}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;
if(q){s.size.height=s.size.width/s.aspectRatio
}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;
if(q){s.size.width=s.size.height*s.aspectRatio
}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;
var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;
if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})
}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})
}}});
c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;
d.ghost=d.originalElement.clone();
d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");
d.ghost.appendTo(d.helper)
},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;
if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})
}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;
if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))
}}});
c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;
g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;
var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);
if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;
n.size.height=h.height+e
}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;
n.size.height=h.height+e;
n.position.top=i.top-e
}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;
n.size.height=h.height+e;
n.position.left=i.left-f
}else{n.size.width=h.width+f;
n.size.height=h.height+e;
n.position.top=i.top-e;
n.position.left=i.left-f
}}}}});
var b=function(d){return parseInt(d,10)||0
};
var a=function(d){return !isNaN(parseInt(d,10))
}
})(jQuery);
(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;
this.element.addClass("ui-selectable");
this.dragged=false;
var c;
this.refresh=function(){c=a(b.options.filter,b.element[0]);
c.each(function(){var d=a(this);
var e=d.offset();
a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})
})
};
this.refresh();
this.selectees=c.addClass("ui-selectee");
this._mouseInit();
this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")
},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");
this._mouseDestroy()
},_mouseStart:function(d){var b=this;
this.opos=[d.pageX,d.pageY];
if(this.options.disabled){return 
}var c=this.options;
this.selectees=a(c.filter,this.element[0]);
this._trigger("start",d);
a(c.appendTo).append(this.helper);
this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});
if(c.autoRefresh){this.refresh()
}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");
e.startselected=true;
if(!d.metaKey){e.$element.removeClass("ui-selected");
e.selected=false;
e.$element.addClass("ui-unselecting");
e.unselecting=true;
b._trigger("unselecting",d,{unselecting:e.element})
}});
a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");
if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");
e.unselecting=false;
e.selecting=true;
e.selected=true;
b._trigger("selecting",d,{selecting:e.element});
return false
}})
},_mouseDrag:function(i){var c=this;
this.dragged=true;
if(this.options.disabled){return 
}var e=this.options;
var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;
if(d>b){var f=b;
b=d;
d=f
}if(h>g){var f=g;
g=h;
h=f
}this.helper.css({left:d,top:h,width:b-d,height:g-h});
this.selectees.each(function(){var j=a.data(this,"selectable-item");
if(!j||j.element==c.element[0]){return 
}var k=false;
if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))
}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)
}}if(k){if(j.selected){j.$element.removeClass("ui-selected");
j.selected=false
}if(j.unselecting){j.$element.removeClass("ui-unselecting");
j.unselecting=false
}if(!j.selecting){j.$element.addClass("ui-selecting");
j.selecting=true;
c._trigger("selecting",i,{selecting:j.element})
}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");
j.selecting=false;
j.$element.addClass("ui-selected");
j.selected=true
}else{j.$element.removeClass("ui-selecting");
j.selecting=false;
if(j.startselected){j.$element.addClass("ui-unselecting");
j.unselecting=true
}c._trigger("unselecting",i,{unselecting:j.element})
}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");
j.selected=false;
j.$element.addClass("ui-unselecting");
j.unselecting=true;
c._trigger("unselecting",i,{unselecting:j.element})
}}}});
return false
},_mouseStop:function(d){var b=this;
this.dragged=false;
var c=this.options;
a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");
e.$element.removeClass("ui-unselecting");
e.unselecting=false;
e.startselected=false;
b._trigger("unselected",d,{unselected:e.element})
});
a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");
e.$element.removeClass("ui-selecting").addClass("ui-selected");
e.selecting=false;
e.selected=true;
e.startselected=true;
b._trigger("selected",d,{selected:e.element})
});
this._trigger("stop",d);
this.helper.remove();
return false
}}));
a.extend(a.ui.selectable,{version:"1.7.1",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})
})(jQuery);
(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;
this.containerCache={};
this.element.addClass("ui-sortable");
this.refresh();
this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;
this.offset=this.element.offset();
this._mouseInit()
},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");
this._mouseDestroy();
for(var b=this.items.length-1;
b>=0;
b--){this.items[b].item.removeData("sortable-item")
}},_mouseCapture:function(e,f){if(this.reverting){return false
}if(this.options.disabled||this.options.type=="static"){return false
}this._refreshItems(e);
var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);
return false
}});
if(a.data(e.target,"sortable-item")==c){d=a(e.target)
}if(!d){return false
}if(this.options.handle&&!f){var g=false;
a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true
}});
if(!g){return false
}}this.currentItem=d;
this._removeCurrentsFromItems();
return true
},_mouseStart:function(e,f,b){var g=this.options,c=this;
this.currentContainer=this;
this.refreshPositions();
this.helper=this._createHelper(e);
this._cacheHelperProportions();
this._cacheMargins();
this.scrollParent=this.helper.scrollParent();
this.offset=this.currentItem.offset();
this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};
this.helper.css("position","absolute");
this.cssPosition=this.helper.css("position");
a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this._generatePosition(e);
this.originalPageX=e.pageX;
this.originalPageY=e.pageY;
if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)
}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()
}this._createPlaceholder();
if(g.containment){this._setContainment()
}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")
}a("body").css("cursor",g.cursor)
}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")
}this.helper.css("opacity",g.opacity)
}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")
}this.helper.css("zIndex",g.zIndex)
}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()
}this._trigger("start",e,this._uiHash());
if(!this._preserveHelperProportions){this._cacheHelperProportions()
}if(!b){for(var d=this.containers.length-1;
d>=0;
d--){this.containers[d]._trigger("activate",e,c._uiHash(this))
}}if(a.ui.ddmanager){a.ui.ddmanager.current=this
}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)
}this.dragging=true;
this.helper.addClass("ui-sortable-helper");
this._mouseDrag(e);
return true
},_mouseDrag:function(f){this.position=this._generatePosition(f);
this.positionAbs=this._convertPositionTo("absolute");
if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs
}if(this.options.scroll){var g=this.options,b=false;
if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed
}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed
}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed
}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed
}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)
}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)
}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)
}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)
}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)
}}this.positionAbs=this._convertPositionTo("absolute");
if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"
}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"
}for(var d=this.items.length-1;
d>=0;
d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);
if(!h){continue
}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";
if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)
}else{break
}this._trigger("change",f,this._uiHash());
break
}}this._contactContainers(f);
if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)
}this._trigger("sort",f,this._uiHash());
this.lastPositionAbs=this.positionAbs;
return false
},_mouseStop:function(c,d){if(!c){return 
}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)
}if(this.options.revert){var b=this;
var e=b.placeholder.offset();
b.reverting=true;
a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)
})
}else{this._clear(c,d)
}return false
},cancel:function(){var b=this;
if(this.dragging){this._mouseUp();
if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")
}else{this.currentItem.show()
}for(var c=this.containers.length-1;
c>=0;
c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));
if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));
this.containers[c].containerCache.over=0
}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])
}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()
}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});
if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)
}else{a(this.domPosition.parent).prepend(this.currentItem)
}return true
},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);
var c=[];
d=d||{};
a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));
if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))
}});
return c.join("&")
},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);
var c=[];
d=d||{};
b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")
});
return c
},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;
var f=m.left,c=f+m.width,n=m.top,i=n+m.height;
var o=this.offset.click.top,h=this.offset.click.left;
var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;
if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g
}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)
}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();
if(!g){return false
}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))
},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();
if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))
}else{return b&&((b=="down"&&c)||(b=="up"&&!c))
}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;
return b!=0&&(b>0?"down":"up")
},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;
return b!=0&&(b>0?"right":"left")
},refresh:function(b){this._refreshItems(b);
this.refreshPositions()
},_connectWith:function(){var b=this.options;
return b.connectWith.constructor==String?[b.connectWith]:b.connectWith
},_getItemsAsjQuery:function(b){var l=this;
var g=[];
var e=[];
var h=this._connectWith();
if(h&&b){for(var d=h.length-1;
d>=0;
d--){var k=a(h[d]);
for(var c=k.length-1;
c>=0;
c--){var f=a.data(k[c],"sortable");
if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])
}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);
for(var d=e.length-1;
d>=0;
d--){e[d][0].each(function(){g.push(this)
})
}return a(g)
},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");
for(var c=0;
c<this.items.length;
c++){for(var b=0;
b<d.length;
b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)
}}}},_refreshItems:function(b){this.items=[];
this.containers=[this];
var h=this.items;
var p=this;
var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];
var l=this._connectWith();
if(l){for(var e=l.length-1;
e>=0;
e--){var m=a(l[e]);
for(var d=m.length-1;
d>=0;
d--){var g=a.data(m[d],"sortable");
if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);
this.containers.push(g)
}}}}for(var e=f.length-1;
e>=0;
e--){var k=f[e][1];
var c=f[e][0];
for(var d=0,n=c.length;
d<n;
d++){var o=a(c[d]);
o.data("sortable-item",k);
h.push({item:o,instance:k,width:0,height:0,left:0,top:0})
}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()
}for(var d=this.items.length-1;
d>=0;
d--){var e=this.items[d];
if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue
}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;
if(!b){e.width=c.outerWidth();
e.height=c.outerHeight()
}var f=c.offset();
e.left=f.left;
e.top=f.top
}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)
}else{for(var d=this.containers.length-1;
d>=0;
d--){var f=this.containers[d].element.offset();
this.containers[d].containerCache.left=f.left;
this.containers[d].containerCache.top=f.top;
this.containers[d].containerCache.width=this.containers[d].element.outerWidth();
this.containers[d].containerCache.height=this.containers[d].element.outerHeight()
}}},_createPlaceholder:function(d){var b=d||this,e=b.options;
if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;
e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
if(!c){f.style.visibility="hidden"
}return f
},update:function(f,g){if(c&&!e.forcePlaceholderSize){return 
}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))
}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))
}}}
}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));
b.currentItem.after(b.placeholder);
e.placeholder.update(b,b.placeholder)
},_contactContainers:function(d){for(var c=this.containers.length-1;
c>=0;
c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;
var g=null;
var e=this.positionAbs[this.containers[c].floating?"left":"top"];
for(var b=this.items.length-1;
b>=0;
b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue
}var f=this.items[b][this.containers[c].floating?"left":"top"];
if(Math.abs(f-e)<h){h=Math.abs(f-e);
g=this.items[b]
}}if(!g&&!this.options.dropOnEmpty){continue
}this.currentContainer=this.containers[c];
g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);
this._trigger("change",d,this._uiHash());
this.containers[c]._trigger("change",d,this._uiHash(this));
this.options.placeholder.update(this.currentContainer,this.placeholder)
}this.containers[c]._trigger("over",d,this._uiHash(this));
this.containers[c].containerCache.over=1
}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));
this.containers[c].containerCache.over=0
}}}},_createHelper:function(c){var d=this.options;
var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);
if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])
}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}
}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())
}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())
}return b
},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left
}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left
}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top
}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top
}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();
var b=this.offsetParent.offset();
if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();
b.top+=this.scrollParent.scrollTop()
}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}
}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}
},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();
return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}
}else{return{top:0,left:0}
}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}
},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}
},_setContainment:function(){var e=this.options;
if(e.containment=="parent"){e.containment=this.helper[0].parentNode
}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]
}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];
var d=a(e.containment).offset();
var b=(a(c).css("overflow")!="hidden");
this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]
}},_convertPositionTo:function(f,h){if(!h){h=this.position
}var c=f=="absolute"?1:-1;
var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);
return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}
},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);
if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()
}var d=e.pageX;
var c=e.pageY;
if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left
}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top
}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left
}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top
}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];
c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;
var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];
d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f
}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}
},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));
this.counter=this.counter?++this.counter:1;
var d=this,b=this.counter;
window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)
}},0)
},_clear:function(d,e){this.reverting=false;
var f=[],b=this;
if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)
}this._noFinalSort=null;
if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""
}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")
}else{this.currentItem.show()
}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))
})
}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())
})
}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())
})
}for(var c=this.containers.length-1;
c>=0;
c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))
}
}).call(this,this.containers[c]));
f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))
}
}).call(this,this.containers[c]))
}}}for(var c=this.containers.length-1;
c>=0;
c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))
}
}).call(this,this.containers[c]))
}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))
}
}).call(this,this.containers[c]));
this.containers[c].containerCache.over=0
}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)
}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)
}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)
}this.dragging=false;
if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());
for(var c=0;
c<f.length;
c++){f[c].call(this,d)
}this._trigger("stop",d,this._uiHash())
}return false
}if(!e){this._trigger("beforeStop",d,this._uiHash())
}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
if(this.helper[0]!=this.currentItem[0]){this.helper.remove()
}this.helper=null;
if(!e){for(var c=0;
c<f.length;
c++){f[c].call(this,d)
}this._trigger("stop",d,this._uiHash())
}this.fromOutside=false;
return true
},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()
}},_uiHash:function(c){var b=c||this;
return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}
}}));
a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.1",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})
})(jQuery);
(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;
this.running=0;
if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen
}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);
if(c.length){if(c.filter(d.header).length){this.active=c
}else{this.active=c.parent().parent().prev();
c.addClass("ui-accordion-content-active")
}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");
if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")
}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")
}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")
}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")
}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")
});
this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.next().addClass("ui-accordion-content-active");
a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);
this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);
if(a.browser.msie){this.element.find("a").css("zoom","1")
}this.resize();
this.element.attr("role","tablist");
this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)
}).next().attr("role","tabpanel");
this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();
if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")
}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")
}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")
}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)
})
}},destroy:function(){var c=this.options;
this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");
this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
this.headers.find("a").removeAttr("tabindex");
this.headers.children(".ui-icon").remove();
var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
if(c.autoHeight||c.fillHeight){b.css("height","")
}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";
c=!c
}a.widget.prototype._setData.apply(this,arguments)
},_keydown:function(e){var g=this.options,f=a.ui.keyCode;
if(g.disabled||e.altKey||e.ctrlKey){return 
}var d=this.headers.length;
var b=this.headers.index(e.target);
var c=false;
switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];
break;
case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];
break;
case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)
}if(c){a(e.target).attr("tabIndex","-1");
a(c).attr("tabIndex","0");
c.focus();
return false
}return true
},resize:function(){var e=this.options,d;
if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");
this.element.parent().css("overflow","hidden")
}d=this.element.parent().height();
if(a.browser.msie){this.element.parent().css("overflow",b)
}this.headers.each(function(){d-=a(this).outerHeight()
});
var c=0;
this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())
}).height(Math.max(0,d-c)).css("overflow","auto")
}else{if(e.autoHeight){d=0;
this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())
}).height(d)
}}},activate:function(b){var c=this._findActive(b)[0];
this._clickHandler({target:c},c)
},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")
},_clickHandler:function(b,f){var d=this.options;
if(d.disabled){return false
}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
this.active.next().addClass("ui-accordion-content-active");
var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));
this._toggle(c,h,e);
return false
}var g=a(b.currentTarget||f);
var i=g[0]==this.active[0];
if(this.running||(!d.collapsible&&i)){return false
}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
this.active.next().addClass("ui-accordion-content-active");
if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);
g.next().addClass("ui-accordion-content-active")
}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);
this.active=i?a([]):g;
this._toggle(c,h,e,i,j);
return false
},_toggle:function(b,i,g,j,k){var d=this.options,m=this;
this.toShow=b;
this.toHide=i;
this.data=g;
var c=function(){if(!m){return 
}return m._completed.apply(m,arguments)
};
this._trigger("changestart",null,this.data);
this.running=i.size()===0?b.size():i.size();
if(d.animated){var f={};
if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}
}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}
}if(!d.proxied){d.proxied=d.animated
}if(!d.proxiedDuration){d.proxiedDuration=d.duration
}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;
d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;
var l=a.ui.accordion.animations,e=d.duration,h=d.animated;
if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})
}
}l[h](f)
}else{if(d.collapsible&&j){b.toggle()
}else{i.hide();
b.show()
}c(true)
}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();
b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()
},_completed:function(b){var c=this.options;
this.running=b?0:--this.running;
if(this.running){return 
}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})
}this._trigger("change",null,this.data)
}});
a.extend(a.ui.accordion,{version:"1.7.1",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()
}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);
if(!j.toHide.size()){j.toShow.animate({height:"show"},j);
return 
}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);
return 
}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;
var i=j.toShow;
b=i[0].style.width;
i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));
a.each(e,function(k,m){f[m]="hide";
var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);
d[m]={value:l[1],unit:l[2]||"px"}
});
j.toShow.css({height:0,overflow:"hidden"}).show();
j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)
}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit
},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")
}j.toShow.css("width",b);
j.toShow.css({overflow:c});
j.complete()
}})
},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})
},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})
}}})
})(jQuery);
(function(c){var b={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"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";
c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");
var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))
}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)
}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")
},function(){i.removeClass("ui-state-hover")
}).focus(function(){i.addClass("ui-state-focus")
}).blur(function(){i.removeClass("ui-state-focus")
}).mousedown(function(n){n.stopPropagation()
}).click(function(n){l.close(n);
return false
}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);
f.find("*").add(f).disableSelection();
(m.draggable&&c.fn.draggable&&this._makeDraggable());
(m.resizable&&c.fn.resizable&&this._makeResizable());
this._createButtons(m.buttons);
this._isOpen=false;
(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());
(m.autoOpen&&this.open())
},destroy:function(){(this.overlay&&this.overlay.destroy());
this.uiDialog.hide();
this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
this.uiDialog.remove();
(this.originalTitle&&this.element.attr("title",this.originalTitle))
},close:function(e){var d=this;
if(false===d._trigger("beforeclose",e)){return 
}(d.overlay&&d.overlay.destroy());
d.uiDialog.unbind("keypress.ui-dialog");
(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)
}):d.uiDialog.hide()&&d._trigger("close",e));
c.ui.dialog.overlay.resize();
d._isOpen=false
},isOpen:function(){return this._isOpen
},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)
}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex
}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));
var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};
this.uiDialog.css("z-index",++c.ui.dialog.maxZ);
this.element.attr(d);
this._trigger("focus",e)
},open:function(){if(this._isOpen){return 
}var e=this.options,d=this.uiDialog;
this.overlay=e.modal?new c.ui.dialog.overlay(this):null;
(d.next().length&&d.appendTo("body"));
this._size();
this._position(e.position);
d.show(e.show);
this.moveToTop(true);
(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return 
}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];
if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()
},1)
}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()
},1)
}}}));
c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();
this._trigger("open");
this._isOpen=true
},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
this.uiDialog.find(".ui-dialog-buttonpane").remove();
(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)
}));
if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)
}).hover(function(){c(this).addClass("ui-state-hover")
},function(){c(this).removeClass("ui-state-hover")
}).focus(function(){c(this).addClass("ui-state-focus")
}).blur(function(){c(this).removeClass("ui-state-focus")
}).appendTo(e)
});
e.appendTo(this.uiDialog)
}},_makeDraggable:function(){var d=this,f=this.options,e;
this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;
c(this).height(c(this).height()).addClass("ui-dialog-dragging");
(f.dragStart&&f.dragStart.apply(d.element[0],arguments))
},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))
},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);
(f.dragStop&&f.dragStop.apply(d.element[0],arguments));
c.ui.dialog.overlay.resize()
}})
},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);
var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";
this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");
(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))
},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))
},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");
f.height=c(this).height();
f.width=c(this).width();
(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));
c.ui.dialog.overlay.resize()
}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")
},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;
if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]
}if(i.constructor!=Array){i=["center","middle"]
}if(i[0].constructor==Number){d+=i[0]
}else{switch(i[0]){case"left":d+=0;
break;
case"right":d+=e.width()-this.uiDialog.outerWidth();
break;
default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2
}}if(i[1].constructor==Number){g+=i[1]
}else{switch(i[1]){case"top":g+=0;
break;
case"bottom":g+=e.height()-this.uiDialog.outerHeight();
break;
default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2
}}g=Math.max(g,h);
this.uiDialog.css({top:g,left:d})
},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));
switch(e){case"buttons":this._createButtons(f);
break;
case"closeText":this.uiDialogTitlebarCloseText.text(f);
break;
case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);
break;
case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));
break;
case"height":this.uiDialog.height(f);
break;
case"position":this._position(f);
break;
case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");
(g&&!f&&d.resizable("destroy"));
(g&&typeof f=="string"&&d.resizable("option","handles",f));
(g||this._makeResizable(f));
break;
case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");
break;
case"width":this.uiDialog.width(f);
break
}c.widget.prototype._setData.apply(this,arguments)
},_size:function(){var e=this.options;
this.element.css({height:0,minHeight:0,width:"auto"});
var d=this.uiDialog.css({height:"auto",width:e.width}).height();
this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})
}});
c.extend(c.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)
},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)
}});
c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"
}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;
return(g>c.ui.dialog.overlay.maxZ)
})
},1);
c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))
});
c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)
}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});
(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());
this.instances.push(d);
return d
},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);
if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")
}d.remove()
},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);
if(e<d){return c(window).height()+"px"
}else{return e+"px"
}}else{return c(document).height()+"px"
}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);
var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);
if(d<e){return c(window).width()+"px"
}else{return d+"px"
}}else{return c(document).width()+"px"
}},resize:function(){var d=c([]);
c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)
});
d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})
}});
c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)
}})
})(jQuery);
(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;
this._keySliding=false;
this._handleIndex=null;
this._detectOrientation();
this._mouseInit();
this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");
this.range=a([]);
if(c.range){if(c.range===true){this.range=a("<div></div>");
if(!c.values){c.values=[this._valueMin(),this._valueMin()]
}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]
}}else{this.range=a("<div></div>")
}this.range.appendTo(this.element).addClass("ui-slider-range");
if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)
}this.range.addClass("ui-widget-header")
}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");
this.handle=this.handles.eq(0);
this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()
}).hover(function(){a(this).addClass("ui-state-hover")
},function(){a(this).removeClass("ui-state-hover")
}).focus(function(){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");
a(this).addClass("ui-state-focus")
}).blur(function(){a(this).removeClass("ui-state-focus")
});
this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)
});
this.handles.keydown(function(i){var f=true;
var e=a(this).data("index.ui-slider-handle");
if(b.options.disabled){return 
}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;
if(!b._keySliding){b._keySliding=true;
a(this).addClass("ui-state-active");
b._start(i,e)
}break
}var g,d,h=b._step();
if(b.options.values&&b.options.values.length){g=d=b.values(e)
}else{g=d=b.value()
}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();
break;
case a.ui.keyCode.END:d=b._valueMax();
break;
case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return 
}d=g+h;
break;
case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return 
}d=g-h;
break
}b._slide(i,e,d);
return f
}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");
if(b._keySliding){b._stop(e,d);
b._change(e,d);
b._keySliding=false;
a(this).removeClass("ui-state-active")
}});
this._refreshValue()
},destroy:function(){this.handles.remove();
this.range.remove();
this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy()
},_mouseCapture:function(d){var e=this.options;
if(e.disabled){return false
}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};
this.elementOffset=this.element.offset();
var h={x:d.pageX,y:d.pageY};
var j=this._normValueFromMouse(h);
var c=this._valueMax()-this._valueMin()+1,f;
var k=this,i;
this.handles.each(function(l){var m=Math.abs(j-k.values(l));
if(c>m){c=m;
f=a(this);
i=l
}});
if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])
}this._start(d,i);
k._handleIndex=i;
f.addClass("ui-state-active").focus();
var g=f.offset();
var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");
this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};
j=this._normValueFromMouse(h);
this._slide(d,i,j);
return true
},_mouseStart:function(b){return true
},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};
var c=this._normValueFromMouse(b);
this._slide(d,this._handleIndex,c);
return false
},_mouseStop:function(b){this.handles.removeClass("ui-state-active");
this._stop(b,this._handleIndex);
this._change(b,this._handleIndex);
this._handleIndex=null;
this._clickOffset=null;
return false
},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"
},_normValueFromMouse:function(d){var c,h;
if("horizontal"==this.orientation){c=this.elementSize.width;
h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)
}else{c=this.elementSize.height;
h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)
}var f=(h/c);
if(f>1){f=1
}if(f<0){f=0
}if("vertical"==this.orientation){f=1-f
}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;
if(b>(this.options.step/2)){g+=this.options.step
}return parseFloat(g.toFixed(5))
},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){b.value=this.values(c);
b.values=this.values()
}this._trigger("start",d,b)
},_slide:function(f,e,d){var g=this.handles[e];
if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);
if((e==0&&d>=b)||(e==1&&d<=b)){d=b
}if(d!=this.values(e)){var c=this.values();
c[e]=d;
var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});
var b=this.values(e?0:1);
if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)
}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});
if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))
}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){b.value=this.values(c);
b.values=this.values()
}this._trigger("stop",d,b)
},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){b.value=this.values(c);
b.values=this.values()
}this._trigger("change",d,b)
},value:function(b){if(arguments.length){this._setData("value",b);
this._change(null,0)
}return this._value()
},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;
this._refreshValue(c);
if(!d){this._change(null,b)
}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)
}else{return this.value()
}}else{return this._values()
}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);
switch(b){case"orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);
this._refreshValue(c);
break;
case"value":this._refreshValue(c);
break
}},_step:function(){var b=this.options.step;
return b
},_value:function(){var b=this.options.value;
if(b<this._valueMin()){b=this._valueMin()
}if(b>this._valueMax()){b=this._valueMax()
}return b
},_values:function(b){if(arguments.length){var c=this.options.values[b];
if(c<this._valueMin()){c=this._valueMin()
}if(c>this._valueMax()){c=this._valueMax()
}return c
}else{return this.options.values
}},_valueMin:function(){var b=this.options.min;
return b
},_valueMax:function(){var b=this.options.max;
return b
},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;
if(this.options.values&&this.options.values.length){var i,h;
this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;
var m={};
m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";
a(this).stop(1,1)[c?"animate":"css"](m,d.animate);
if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);
(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})
}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);
(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})
}}lastValPercent=o
})
}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;
var b={};
b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";
this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);
(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);
(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});
(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);
(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})
}}}));
a.extend(a.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})
})(jQuery);
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable
}this._tabify(true)
},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return 
}this.select(c)
}else{this.options[b]=c;
if(b=="deselectable"){this.options.collapsible=c
}this._tabify()
}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)
},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")
},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));
return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))
},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}
},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);
b.html(b.data("label.tabs")).removeData("label.tabs")
})
},_tabify:function(n){this.list=this.element.children("ul:first");
this.lis=a("li:has(a[href])",this.list);
this.anchors=this.lis.map(function(){return a("a",this)[0]
});
this.panels=a([]);
var p=this,d=this.options;
var c=/^#.+/;
this.anchors.each(function(r,o){var q=a(o).attr("href");
var s=q.split("#")[0],u;
if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;
o.href=q
}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))
}else{if(q!="#"){a.data(o,"href.tabs",q);
a.data(o,"load.tabs",q.replace(/#.*$/,""));
var w=p._tabId(o);
o.href="#"+w;
var v=a("#"+w);
if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);
v.data("destroy.tabs",true)
}p.panels=p.panels.add(v)
}else{d.disabled.push(r)
}}});
if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");
this.lis.addClass("ui-state-default ui-corner-top");
this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");
if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;
return false
}})
}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)
}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))
}d.selected=d.selected||0
}else{if(d.selected===null){d.selected=-1
}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;
d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)
}))).sort();
if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)
}this.panels.addClass("ui-tabs-hide");
this.lis.removeClass("ui-tabs-selected ui-state-active");
if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");
this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");
p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))
});
this.load(d.selected)
}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");
p.lis=p.anchors=p.panels=null
})
}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))
}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");
if(d.cookie){this._cookie(d.selected,d.cookie)
}for(var g=0,m;
(m=this.lis[g]);
g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")
}if(d.cache===false){this.anchors.removeData("cache.tabs")
}this.lis.add(this.anchors).unbind(".tabs");
if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)
}};
var j=function(o,i){i.removeClass("ui-state-"+o)
};
this.lis.bind("mouseover.tabs",function(){f("hover",a(this))
});
this.lis.bind("mouseout.tabs",function(){j("hover",a(this))
});
this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))
});
this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))
})
}var b,h;
if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];
h=d.fx[1]
}else{b=h=d.fx
}}function e(i,o){i.css({display:""});
if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")
}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");
o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);
p._trigger("show",null,p._ui(i,o[0]))
})
}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");
o.removeClass("ui-tabs-hide");
p._trigger("show",null,p._ui(i,o[0]))
};
var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");
i.addClass("ui-tabs-hide");
e(i,b);
p.element.dequeue("tabs")
})
}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");
i.addClass("ui-tabs-hide");
p.element.dequeue("tabs")
};
this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));
if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();
return false
}d.selected=p.anchors.index(this);
p.abort();
if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;
if(d.cookie){p._cookie(d.selected,d.cookie)
}p.element.queue("tabs",function(){l(o,i)
}).dequeue("tabs");
this.blur();
return false
}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)
}p.element.queue("tabs",function(){k(o,q)
});
p.load(p.anchors.index(this));
this.blur();
return false
}}}if(d.cookie){p._cookie(d.selected,d.cookie)
}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)
})
}p.element.queue("tabs",function(){k(o,q)
});
p.load(p.anchors.index(this))
}else{throw"jQuery UI Tabs: Mismatching fragment identifier."
}if(a.browser.msie){this.blur()
}});
this.anchors.bind("click.tabs",function(){return false
})
},destroy:function(){var b=this.options;
this.abort();
this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");
this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");
this.anchors.each(function(){var c=a.data(this,"href.tabs");
if(c){this.href=c
}var d=a(this).unbind(".tabs");
a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")
})
});
this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()
}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))
}});
if(b.cookie){this._cookie(null,b.cookie)
}},add:function(e,d,c){if(c===undefined){c=this.anchors.length
}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);
i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);
var f=a("#"+h);
if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)
}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");
if(c>=this.lis.length){i.appendTo(this.list);
f.appendTo(this.list[0].parentNode)
}else{i.insertBefore(this.lis[c]);
f.insertBefore(this.panels[c])
}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k
});
this._tabify();
if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");
f.removeClass("ui-tabs-hide");
this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))
});
this.load(0)
}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))
},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))
}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b
}),function(g,f){return g>=b?--g:g
});
this._tabify();
this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))
},enable:function(b){var c=this.options;
if(a.inArray(b,c.disabled)==-1){return 
}this.lis.eq(b).removeClass("ui-state-disabled");
c.disabled=a.grep(c.disabled,function(e,d){return e!=b
});
this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))
},disable:function(c){var b=this,d=this.options;
if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");
d.disabled.push(c);
d.disabled.sort();
this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))
}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))
}else{if(b===null){b=-1
}}if(b==-1&&this.options.collapsible){b=this.options.selected
}this.anchors.eq(b).trigger(this.options.event+".tabs")
},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");
this.abort();
if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");
return 
}this.lis.eq(e).addClass("ui-state-processing");
if(g.spinner){var f=a("span",b);
f.data("label.tabs",f.html()).html(g.spinner)
}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);
c._cleanup();
if(g.cache){a.data(b,"cache.tabs",true)
}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));
try{g.ajaxOptions.success(i,h)
}catch(j){}c.element.dequeue("tabs")
}}))
},abort:function(){this.element.queue([]);
this.panels.stop(false,true);
if(this.xhr){this.xhr.abort();
delete this.xhr
}this._cleanup()
},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)
},length:function(){return this.anchors.length
}});
a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});
a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;
var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);
b.rotation=setTimeout(function(){var i=g.selected;
b.select(++i<b.anchors.length?i:0)
},d);
if(h){h.stopPropagation()
}});
var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)
}}:function(h){t=g.selected;
c()
});
if(d){this.element.bind("tabsshow",c);
this.anchors.bind(g.event+".tabs",e);
c()
}else{clearTimeout(b.rotation);
this.element.unbind("tabsshow",c);
this.anchors.unbind(g.event+".tabs",e);
delete this._rotate;
delete this._unrotate
}}})
})(jQuery);
(function($){$.extend($.ui,{datepicker:{version:"1.7.1"}});
var PROP_NAME="datepicker";
function Datepicker(){this.debug=false;
this._curInst=null;
this._keyEvent=false;
this._disabledInputs=[];
this._datepickerShowing=false;
this._inDialog=false;
this._mainDivId="ui-datepicker-div";
this._inlineClass="ui-datepicker-inline";
this._appendClass="ui-datepicker-append";
this._triggerClass="ui-datepicker-trigger";
this._dialogClass="ui-datepicker-dialog";
this._disableClass="ui-datepicker-disabled";
this._unselectableClass="ui-datepicker-unselectable";
this._currentClass="ui-datepicker-current-day";
this._dayOverClass="ui-datepicker-days-cell-over";
this.regional=[];
this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};
this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};
$.extend(this._defaults,this.regional[""]);
this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')
}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)
}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});
return this
},_attachDatepicker:function(target,settings){var inlineSettings=null;
for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);
if(attrValue){inlineSettings=inlineSettings||{};
try{inlineSettings[attrName]=eval(attrValue)
}catch(err){inlineSettings[attrName]=attrValue
}}}var nodeName=target.nodeName.toLowerCase();
var inline=(nodeName=="div"||nodeName=="span");
if(!target.id){target.id="dp"+(++this.uuid)
}var inst=this._newInst($(target),inline);
inst.settings=$.extend({},settings||{},inlineSettings||{});
if(nodeName=="input"){this._connectDatepicker(target,inst)
}else{if(inline){this._inlineDatepicker(target,inst)
}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");
return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}
},_connectDatepicker:function(target,inst){var input=$(target);
inst.trigger=$([]);
if(input.hasClass(this.markerClassName)){return 
}var appendText=this._get(inst,"appendText");
var isRTL=this._get(inst,"isRTL");
if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")
}var showOn=this._get(inst,"showOn");
if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)
}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");
var buttonImage=this._get(inst,"buttonImage");
inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));
input[isRTL?"before":"after"](inst.trigger);
inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()
}else{$.datepicker._showDatepicker(target)
}return false
})
}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value
}).bind("getData.datepicker",function(event,key){return this._get(inst,key)
});
$.data(target,PROP_NAME,inst)
},_inlineDatepicker:function(target,inst){var divSpan=$(target);
if(divSpan.hasClass(this.markerClassName)){return 
}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value
}).bind("getData.datepicker",function(event,key){return this._get(inst,key)
});
$.data(target,PROP_NAME,inst);
this._setDate(inst,this._getDefaultDate(inst));
this._updateDatepicker(inst);
this._updateAlternate(inst)
},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;
if(!inst){var id="dp"+(++this.uuid);
this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');
this._dialogInput.keydown(this._doKeyDown);
$("body").append(this._dialogInput);
inst=this._dialogInst=this._newInst(this._dialogInput,false);
inst.settings={};
$.data(this._dialogInput[0],PROP_NAME,inst)
}extendRemove(inst.settings,settings||{});
this._dialogInput.val(dateText);
this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);
if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;
var scrollY=document.documentElement.scrollTop||document.body.scrollTop;
this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]
}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");
inst.settings.onSelect=onSelect;
this._inDialog=true;
this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[0]);
if($.blockUI){$.blockUI(this.dpDiv)
}$.data(this._dialogInput[0],PROP_NAME,inst);
return this
},_destroyDatepicker:function(target){var $target=$(target);
var inst=$.data(target,PROP_NAME);
if(!$target.hasClass(this.markerClassName)){return 
}var nodeName=target.nodeName.toLowerCase();
$.removeData(target,PROP_NAME);
if(nodeName=="input"){inst.trigger.remove();
$target.siblings("."+this._appendClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)
}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()
}}},_enableDatepicker:function(target){var $target=$(target);
var inst=$.data(target,PROP_NAME);
if(!$target.hasClass(this.markerClassName)){return 
}var nodeName=target.nodeName.toLowerCase();
if(nodeName=="input"){target.disabled=false;
inst.trigger.filter("button").each(function(){this.disabled=false
}).end().filter("img").css({opacity:"1.0",cursor:""})
}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);
inline.children().removeClass("ui-state-disabled")
}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)
})
},_disableDatepicker:function(target){var $target=$(target);
var inst=$.data(target,PROP_NAME);
if(!$target.hasClass(this.markerClassName)){return 
}var nodeName=target.nodeName.toLowerCase();
if(nodeName=="input"){target.disabled=true;
inst.trigger.filter("button").each(function(){this.disabled=true
}).end().filter("img").css({opacity:"0.5",cursor:"default"})
}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);
inline.children().addClass("ui-state-disabled")
}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)
});
this._disabledInputs[this._disabledInputs.length]=target
},_isDisabledDatepicker:function(target){if(!target){return false
}for(var i=0;
i<this._disabledInputs.length;
i++){if(this._disabledInputs[i]==target){return true
}}return false
},_getInst:function(target){try{return $.data(target,PROP_NAME)
}catch(err){throw"Missing instance data for this datepicker"
}},_optionDatepicker:function(target,name,value){var settings=name||{};
if(typeof name=="string"){settings={};
settings[name]=value
}var inst=this._getInst(target);
if(inst){if(this._curInst==inst){this._hideDatepicker(null)
}extendRemove(inst.settings,settings);
var date=new Date();
extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});
this._updateDatepicker(inst)
}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)
},_refreshDatepicker:function(target){var inst=this._getInst(target);
if(inst){this._updateDatepicker(inst)
}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);
if(inst){this._setDate(inst,date,endDate);
this._updateDatepicker(inst);
this._updateAlternate(inst)
}},_getDateDatepicker:function(target){var inst=this._getInst(target);
if(inst&&!inst.inline){this._setDateFromField(inst)
}return(inst?this._getDate(inst):null)
},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);
var handled=true;
var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");
inst._keyEvent=true;
if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");
break;
case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);
if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])
}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))
}return false;
break;
case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));
break;
case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");
break;
case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");
break;
case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)
}handled=event.ctrlKey||event.metaKey;
break;
case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)
}handled=event.ctrlKey||event.metaKey;
break;
case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")
}handled=event.ctrlKey||event.metaKey;
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")
}break;
case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")
}handled=event.ctrlKey||event.metaKey;
break;
case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")
}handled=event.ctrlKey||event.metaKey;
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")
}break;
case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")
}handled=event.ctrlKey||event.metaKey;
break;
default:handled=false
}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)
}else{handled=false
}}if(handled){event.preventDefault();
event.stopPropagation()
}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);
if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));
var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);
return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)
}},_showDatepicker:function(input){input=input.target||input;
if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]
}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return 
}var inst=$.datepicker._getInst(input);
var beforeShow=$.datepicker._get(inst,"beforeShow");
extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));
$.datepicker._hideDatepicker(null,"");
$.datepicker._lastInput=input;
$.datepicker._setDateFromField(inst);
if($.datepicker._inDialog){input.value=""
}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);
$.datepicker._pos[1]+=input.offsetHeight
}var isFixed=false;
$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";
return !isFixed
});
if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;
$.datepicker._pos[1]-=document.documentElement.scrollTop
}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};
$.datepicker._pos=null;
inst.rangeStart=null;
inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});
$.datepicker._updateDatepicker(inst);
offset=$.datepicker._checkOffset(inst,offset,isFixed);
inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});
if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";
var duration=$.datepicker._get(inst,"duration");
var postProcess=function(){$.datepicker._datepickerShowing=true;
if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})
}};
if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)
}else{inst.dpDiv[showAnim](duration,postProcess)
}if(duration==""){postProcess()
}if(inst.input[0].type!="hidden"){inst.input[0].focus()
}$.datepicker._curInst=inst
}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};
var self=this;
inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");
if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")
}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")
}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
$(this).addClass("ui-state-hover");
if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")
}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")
}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();
var numMonths=this._getNumberOfMonths(inst);
var cols=numMonths[1];
var width=17;
if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")
}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")
}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");
inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");
if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()
}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();
var dpHeight=inst.dpDiv.outerHeight();
var inputWidth=inst.input?inst.input.outerWidth():0;
var inputHeight=inst.input?inst.input.outerHeight():0;
var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();
var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();
offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);
offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;
offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;
offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;
offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;
return offset
},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling
}var position=$(obj).offset();
return[position.left,position.top]
},_hideDatepicker:function(input,duration){var inst=this._curInst;
if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return 
}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))
}inst.stayOpen=false;
if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));
var showAnim=this._get(inst,"showAnim");
var postProcess=function(){$.datepicker._tidyDialog(inst)
};
if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)
}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)
}if(duration==""){this._tidyDialog(inst)
}var onClose=this._get(inst,"onClose");
if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])
}this._datepickerShowing=false;
this._lastInput=null;
if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});
if($.blockUI){$.unblockUI();
$("body").append(this.dpDiv)
}}this._inDialog=false
}this._curInst=null
},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")
},_checkExternalClick:function(event){if(!$.datepicker._curInst){return 
}var $target=$(event.target);
if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")
}},_adjustDate:function(id,offset,period){var target=$(id);
var inst=this._getInst(target[0]);
if(this._isDisabledDatepicker(target[0])){return 
}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);
this._updateDatepicker(inst)
},_gotoToday:function(id){var target=$(id);
var inst=this._getInst(target[0]);
if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;
inst.drawMonth=inst.selectedMonth=inst.currentMonth;
inst.drawYear=inst.selectedYear=inst.currentYear
}else{var date=new Date();
inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear()
}this._notifyChange(inst);
this._adjustDate(target)
},_selectMonthYear:function(id,select,period){var target=$(id);
var inst=this._getInst(target[0]);
inst._selectingMonthYear=false;
inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);
this._notifyChange(inst);
this._adjustDate(target)
},_clickMonthYear:function(id){var target=$(id);
var inst=this._getInst(target[0]);
if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()
}inst._selectingMonthYear=!inst._selectingMonthYear
},_selectDay:function(id,month,year,td){var target=$(id);
if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return 
}var inst=this._getInst(target[0]);
inst.selectedDay=inst.currentDay=$("a",td).html();
inst.selectedMonth=inst.currentMonth=month;
inst.selectedYear=inst.currentYear=year;
if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null
}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));
if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));
this._updateDatepicker(inst)
}},_clearDate:function(id){var target=$(id);
var inst=this._getInst(target[0]);
inst.stayOpen=false;
inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;
this._selectDate(target,"")
},_selectDate:function(id,dateStr){var target=$(id);
var inst=this._getInst(target[0]);
dateStr=(dateStr!=null?dateStr:this._formatDate(inst));
if(inst.input){inst.input.val(dateStr)
}this._updateAlternate(inst);
var onSelect=this._get(inst,"onSelect");
if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])
}else{if(inst.input){inst.input.trigger("change")
}}if(inst.inline){this._updateDatepicker(inst)
}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));
this._lastInput=inst.input[0];
if(typeof (inst.input[0])!="object"){inst.input[0].focus()
}this._lastInput=null
}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");
if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");
var date=this._getDate(inst);
dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));
$(altField).each(function(){$(this).val(dateStr)
})
}},noWeekends:function(date){var day=date.getDay();
return[(day>0&&day<6),""]
},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());
var firstMon=new Date(checkDate.getFullYear(),1-1,4);
var firstDay=firstMon.getDay()||7;
firstMon.setDate(firstMon.getDate()+1-firstDay);
if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);
return $.datepicker.iso8601Week(checkDate)
}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;
if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1
}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1
},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"
}value=(typeof value=="object"?value.toString():value+"");
if(value==""){return null
}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;
var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;
var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;
var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;
var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;
var year=-1;
var month=-1;
var day=-1;
var doy=-1;
var literal=false;
var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);
if(matches){iFormat++
}return matches
};
var getNumber=function(match){lookAhead(match);
var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));
var size=origSize;
var num=0;
while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);
size--
}if(size==origSize){throw"Missing number at position "+iValue
}return num
};
var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);
var size=0;
for(var j=0;
j<names.length;
j++){size=Math.max(size,names[j].length)
}var name="";
var iInit=iValue;
while(size>0&&iValue<value.length){name+=value.charAt(iValue++);
for(var i=0;
i<names.length;
i++){if(name==names[i]){return i+1
}}size--
}throw"Unknown name at position "+iInit
};
var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue
}iValue++
};
var iValue=0;
for(var iFormat=0;
iFormat<format.length;
iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false
}else{checkLiteral()
}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");
break;
case"D":getName("D",dayNamesShort,dayNames);
break;
case"o":doy=getNumber("o");
break;
case"m":month=getNumber("m");
break;
case"M":month=getName("M",monthNamesShort,monthNames);
break;
case"y":year=getNumber("y");
break;
case"@":var date=new Date(getNumber("@"));
year=date.getFullYear();
month=date.getMonth()+1;
day=date.getDate();
break;
case"'":if(lookAhead("'")){checkLiteral()
}else{literal=true
}break;
default:checkLiteral()
}}}if(year==-1){year=new Date().getFullYear()
}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)
}}if(doy>-1){month=1;
day=doy;
do{var dim=this._getDaysInMonth(year,month-1);
if(day<=dim){break
}month++;
day-=dim
}while(true)
}var date=this._daylightSavingAdjust(new Date(year,month-1,day));
if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"
}return date
},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""
}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;
var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;
var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;
var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;
var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);
if(matches){iFormat++
}return matches
};
var formatNumber=function(match,value,len){var num=""+value;
if(lookAhead(match)){while(num.length<len){num="0"+num
}}return num
};
var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])
};
var output="";
var literal=false;
if(date){for(var iFormat=0;
iFormat<format.length;
iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false
}else{output+=format.charAt(iFormat)
}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);
break;
case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);
break;
case"o":var doy=date.getDate();
for(var m=date.getMonth()-1;
m>=0;
m--){doy+=this._getDaysInMonth(date.getFullYear(),m)
}output+=formatNumber("o",doy,3);
break;
case"m":output+=formatNumber("m",date.getMonth()+1,2);
break;
case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);
break;
case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);
break;
case"@":output+=date.getTime();
break;
case"'":if(lookAhead("'")){output+="'"
}else{literal=true
}break;
default:output+=format.charAt(iFormat)
}}}}return output
},_possibleChars:function(format){var chars="";
var literal=false;
for(var iFormat=0;
iFormat<format.length;
iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false
}else{chars+=format.charAt(iFormat)
}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";
break;
case"D":case"M":return null;
case"'":if(lookAhead("'")){chars+="'"
}else{literal=true
}break;
default:chars+=format.charAt(iFormat)
}}}return chars
},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]
},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");
var dates=inst.input?inst.input.val():null;
inst.endDay=inst.endMonth=inst.endYear=null;
var date=defaultDate=this._getDefaultDate(inst);
var settings=this._getFormatConfig(inst);
try{date=this.parseDate(dateFormat,dates,settings)||defaultDate
}catch(event){this.log(event);
date=defaultDate
}inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear();
inst.currentDay=(dates?date.getDate():0);
inst.currentMonth=(dates?date.getMonth():0);
inst.currentYear=(dates?date.getFullYear():0);
this._adjustInstDate(inst)
},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());
var minDate=this._getMinMaxDate(inst,"min",true);
var maxDate=this._getMinMaxDate(inst,"max");
date=(minDate&&date<minDate?minDate:date);
date=(maxDate&&date>maxDate?maxDate:date);
return date
},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();
date.setDate(date.getDate()+offset);
return date
};
var offsetString=function(offset,getDaysInMonth){var date=new Date();
var year=date.getFullYear();
var month=date.getMonth();
var day=date.getDate();
var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
var matches=pattern.exec(offset);
while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);
break;
case"w":case"W":day+=parseInt(matches[1],10)*7;
break;
case"m":case"M":month+=parseInt(matches[1],10);
day=Math.min(day,getDaysInMonth(year,month));
break;
case"y":case"Y":year+=parseInt(matches[1],10);
day=Math.min(day,getDaysInMonth(year,month));
break
}matches=pattern.exec(offset)
}return new Date(year,month,day)
};
date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));
date=(date&&date.toString()=="Invalid Date"?defaultDate:date);
if(date){date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0)
}return this._daylightSavingAdjust(date)
},_daylightSavingAdjust:function(date){if(!date){return null
}date.setHours(date.getHours()>12?date.getHours()+2:0);
return date
},_setDate:function(inst,date,endDate){var clear=!(date);
var origMonth=inst.selectedMonth;
var origYear=inst.selectedYear;
date=this._determineDate(date,new Date());
inst.selectedDay=inst.currentDay=date.getDate();
inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();
inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();
if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)
}this._adjustInstDate(inst);
if(inst.input){inst.input.val(clear?"":this._formatDate(inst))
}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));
return startDate
},_generateHTML:function(inst){var today=new Date();
today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));
var isRTL=this._get(inst,"isRTL");
var showButtonPanel=this._get(inst,"showButtonPanel");
var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");
var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");
var numMonths=this._getNumberOfMonths(inst);
var showCurrentAtPos=this._get(inst,"showCurrentAtPos");
var stepMonths=this._get(inst,"stepMonths");
var stepBigMonths=this._get(inst,"stepBigMonths");
var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);
var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));
var minDate=this._getMinMaxDate(inst,"min",true);
var maxDate=this._getMinMaxDate(inst,"max");
var drawMonth=inst.drawMonth-showCurrentAtPos;
var drawYear=inst.drawYear;
if(drawMonth<0){drawMonth+=12;
drawYear--
}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));
maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);
while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;
if(drawMonth<0){drawMonth=11;
drawYear--
}}}inst.drawMonth=drawMonth;
inst.drawYear=drawYear;
var prevText=this._get(inst,"prevText");
prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));
var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));
var nextText=this._get(inst,"nextText");
nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));
var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));
var currentText=this._get(inst,"currentText");
var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);
currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));
var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");
var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";
var firstDay=parseInt(this._get(inst,"firstDay"),10);
firstDay=(isNaN(firstDay)?0:firstDay);
var dayNames=this._get(inst,"dayNames");
var dayNamesShort=this._get(inst,"dayNamesShort");
var dayNamesMin=this._get(inst,"dayNamesMin");
var monthNames=this._get(inst,"monthNames");
var monthNamesShort=this._get(inst,"monthNamesShort");
var beforeShowDay=this._get(inst,"beforeShowDay");
var showOtherMonths=this._get(inst,"showOtherMonths");
var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;
var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;
var defaultDate=this._getDefaultDate(inst);
var html="";
for(var row=0;
row<numMonths[0];
row++){var group="";
for(var col=0;
col<numMonths[1];
col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));
var cornerClass=" ui-corner-all";
var calender="";
if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';
switch(col){case 0:calender+="first";
cornerClass=" ui-corner-"+(isRTL?"right":"left");
break;
case numMonths[1]-1:calender+="last";
cornerClass=" ui-corner-"+(isRTL?"left":"right");
break;
default:calender+="middle";
cornerClass="";
break
}calender+='">'
}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';
var thead="";
for(var dow=0;
dow<7;
dow++){var day=(dow+firstDay)%7;
thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"
}calender+=thead+"</tr></thead><tbody>";
var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);
if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)
}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;
var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));
var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));
for(var dRow=0;
dRow<numRows;
dRow++){calender+="<tr>";
var tbody="";
for(var dow=0;
dow<7;
dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);
var otherMonth=(printDate.getMonth()!=drawMonth);
var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);
tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";
printDate.setDate(printDate.getDate()+1);
printDate=this._daylightSavingAdjust(printDate)
}calender+=tbody+"</tr>"
}drawMonth++;
if(drawMonth>11){drawMonth=0;
drawYear++
}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");
group+=calender
}html+=group
}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");
inst._keyEvent=false;
return html
},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);
var changeMonth=this._get(inst,"changeMonth");
var changeYear=this._get(inst,"changeYear");
var showMonthAfterYear=this._get(inst,"showMonthAfterYear");
var html='<div class="ui-datepicker-title">';
var monthHtml="";
if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "
}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);
var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);
monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";
for(var month=0;
month<12;
month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"
}}monthHtml+="</select>"
}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")
}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"
}else{var years=this._get(inst,"yearRange").split(":");
var year=0;
var endYear=0;
if(years.length!=2){year=drawYear-10;
endYear=drawYear+10
}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);
endYear=drawYear+parseInt(years[1],10)
}else{year=parseInt(years[0],10);
endYear=parseInt(years[1],10)
}}year=(minDate?Math.max(year,minDate.getFullYear()):year);
endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);
html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";
for(;
year<=endYear;
year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"
}html+="</select>"
}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml
}html+="</div>";
return html
},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);
var month=inst.drawMonth+(period=="M"?offset:0);
var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);
var date=this._daylightSavingAdjust(new Date(year,month,day));
var minDate=this._getMinMaxDate(inst,"min",true);
var maxDate=this._getMinMaxDate(inst,"max");
date=(minDate&&date<minDate?minDate:date);
date=(maxDate&&date>maxDate?maxDate:date);
inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear();
if(period=="M"||period=="Y"){this._notifyChange(inst)
}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");
if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])
}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");
return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))
},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);
return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))
},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()
},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()
},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);
var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));
if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))
}return this._isInRange(inst,date)
},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));
newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);
var minDate=newMinDate||this._getMinMaxDate(inst,"min");
var maxDate=this._getMinMaxDate(inst,"max");
return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))
},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");
shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));
return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}
},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;
inst.currentMonth=inst.selectedMonth;
inst.currentYear=inst.selectedYear
}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));
return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))
}});
function extendRemove(target,props){$.extend(target,props);
for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]
}}return target
}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))
}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);
$.datepicker.initialized=true
}var otherArgs=Array.prototype.slice.call(arguments,1);
if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))
}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)
})
};
$.datepicker=new Datepicker();
$.datepicker.initialized=false;
$.datepicker.uuid=new Date().getTime();
$.datepicker.version="1.7.1";
window.DP_jQuery=$
})(jQuery);
(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});
this.valueDiv=a('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
this._refreshValue()
},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");
this.valueDiv.remove();
a.widget.prototype.destroy.apply(this,arguments)
},value:function(b){arguments.length&&this._setData("value",b);
return this._value()
},_setData:function(b,c){switch(b){case"value":this.options.value=c;
this._refreshValue();
this._trigger("change",null,{});
break
}a.widget.prototype._setData.apply(this,arguments)
},_value:function(){var b=this.options.value;
if(b<this._valueMin()){b=this._valueMin()
}if(b>this._valueMax()){b=this._valueMax()
}return b
},_valueMin:function(){var b=0;
return b
},_valueMax:function(){var b=100;
return b
},_refreshValue:function(){var b=this.value();
this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");
this.valueDiv.width(b+"%");
this.element.attr("aria-valuenow",b)
}});
a.extend(a.ui.progressbar,{version:"1.7.1",defaults:{value:0}})
})(jQuery);
jQuery.effects||(function(d){d.effects={version:"1.7.1",save:function(g,h){for(var f=0;
f<h.length;
f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])
}}},restore:function(g,h){for(var f=0;
f<h.length;
f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))
}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"
}return g
},getBaseline:function(g,h){var i,f;
switch(g[0]){case"top":i=0;
break;
case"middle":i=0.5;
break;
case"bottom":i=1;
break;
default:i=g[0]/h.height
}switch(g[1]){case"left":f=0;
break;
case"center":f=0.5;
break;
case"right":f=1;
break;
default:f=g[1]/h.width
}return{x:f,y:i}
},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()
}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};
f.wrap('<div class="ui-effects-wrapper" style="font-size: 100%;background:transparent;border:none;margin:0;padding:0"></div>');
var j=f.parent();
if(f.css("position")=="static"){j.css({position:"relative"});
f.css({position:"relative"})
}else{var i=f.css("top");
if(isNaN(parseInt(i,10))){i="auto"
}var h=f.css("left");
if(isNaN(parseInt(h,10))){h="auto"
}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();
f.css({position:"relative",top:0,left:0})
}j.css(g);
return j
},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)
}return f
},setTransition:function(g,i,f,h){h=h||{};
d.each(i,function(k,j){unit=g.cssUnit(j);
if(unit[0]>0){h[j]=unit[0]*f+unit[1]
}});
return h
},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));
var g=(typeof k=="string"?k:null);
return this.each(function(){var q={};
var o=d(this);
var p=o.attr("style")||"";
if(typeof p=="object"){p=p.cssText
}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle
}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));
if(h.add){o.addClass(h.add)
}if(h.remove){o.removeClass(h.remove)
}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));
if(h.add){o.removeClass(h.add)
}if(h.remove){o.addClass(h.remove)
}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]
}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";
d(this).attr("style")["cssText"]=p
}else{d(this).attr("style",p)
}if(h.add){d(this).addClass(h.add)
}if(h.remove){d(this).removeClass(h.remove)
}if(f){f.apply(this,arguments)
}})
})
}};
function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};
if(f){i.mode=f
}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);
h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;
var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);
return[g[0],i,h,j]
}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null
},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)
}else{return this.effect.apply(this,c(arguments,"show"))
}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)
}else{return this.effect.apply(this,c(arguments,"hide"))
}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)
}else{return this.effect.apply(this,c(arguments,"toggle"))
}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)
},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)
},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)
},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])
},switchClass:function(){return this.morph.apply(this,arguments)
},cssUnit:function(f){var g=this.css(f),h=[];
d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]
}});
return h
}});
d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);
h.end=b(h.end)
}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"
}
});
function b(g){var f;
if(g&&g.constructor==Array&&g.length==3){return g
}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]
}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]
}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]
}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]
}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent
}return a[d.trim(g).toLowerCase()]
}function e(h,f){var g;
do{g=d.curCSS(h,f);
if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break
}f="backgroundColor"
}while(h=h.parentNode);
return b(g)
}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};
d.easing.jswing=d.easing.swing;
d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)
},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f
},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f
},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f
}return -j/2*((--h)*(h-2)-1)+f
},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f
},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f
},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f
}return j/2*((h-=2)*h*h+2)+f
},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f
},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f
},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f
}return -j/2*((h-=2)*h*h*h-2)+f
},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f
},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f
},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f
}return j/2*((h-=2)*h*h*h*h+2)+f
},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f
},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f
},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f
},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f
},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f
},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f
}if(h==i){return f+j
}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f
}return j/2*(-Math.pow(2,-10*--h)+2)+f
},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f
},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f
},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f
}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f
},easeInElastic:function(g,i,f,m,l){var j=1.70158;
var k=0;
var h=m;
if(i==0){return f
}if((i/=l)==1){return f+m
}if(!k){k=l*0.3
}if(h<Math.abs(m)){h=m;
var j=k/4
}else{var j=k/(2*Math.PI)*Math.asin(m/h)
}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f
},easeOutElastic:function(g,i,f,m,l){var j=1.70158;
var k=0;
var h=m;
if(i==0){return f
}if((i/=l)==1){return f+m
}if(!k){k=l*0.3
}if(h<Math.abs(m)){h=m;
var j=k/4
}else{var j=k/(2*Math.PI)*Math.asin(m/h)
}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f
},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;
var k=0;
var h=m;
if(i==0){return f
}if((i/=l/2)==2){return f+m
}if(!k){k=l*(0.3*1.5)
}if(h<Math.abs(m)){h=m;
var j=k/4
}else{var j=k/(2*Math.PI)*Math.asin(m/h)
}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f
}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f
},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158
}return k*(h/=j)*h*((i+1)*h-i)+f
},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158
}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f
},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158
}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f
}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f
},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f
},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f
}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f
}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f
}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f
}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f
}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f
}})
})(jQuery);
(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];
var h=a.effects.setMode(d,b.options.mode||"hide");
var g=b.options.direction||"vertical";
a.effects.save(d,c);
d.show();
var j=a.effects.createWrapper(d).css({overflow:"hidden"});
var e=(g=="vertical")?"height":"width";
var i=(g=="vertical")?j.height():j.width();
if(h=="show"){j.css(e,0)
}var f={};
f[e]=h=="show"?i:0;
j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()
}a.effects.restore(d,c);
a.effects.removeWrapper(d);
if(b.callback){b.callback.apply(d[0],arguments)
}d.dequeue()
})
})
}
})(jQuery);
(function(a){a.effects.bounce=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];
var k=a.effects.setMode(e,b.options.mode||"effect");
var n=b.options.direction||"up";
var c=b.options.distance||20;
var d=b.options.times||5;
var g=b.duration||250;
if(/show|hide/.test(k)){l.push("opacity")
}a.effects.save(e,l);
e.show();
a.effects.createWrapper(e);
var f=(n=="up"||n=="down")?"top":"left";
var p=(n=="up"||n=="left")?"pos":"neg";
var c=b.options.distance||(f=="top"?e.outerHeight({margin:true})/3:e.outerWidth({margin:true})/3);
if(k=="show"){e.css("opacity",0).css(f,p=="pos"?-c:c)
}if(k=="hide"){c=c/(d*2)
}if(k!="hide"){d--
}if(k=="show"){var h={opacity:1};
h[f]=(p=="pos"?"+=":"-=")+c;
e.animate(h,g/2,b.options.easing);
c=c/2;
d--
}for(var j=0;
j<d;
j++){var o={},m={};
o[f]=(p=="pos"?"-=":"+=")+c;
m[f]=(p=="pos"?"+=":"-=")+c;
e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing);
c=(k=="hide")?c*2:c/2
}if(k=="hide"){var h={opacity:0};
h[f]=(p=="pos"?"-=":"+=")+c;
e.animate(h,g/2,b.options.easing,function(){e.hide();
a.effects.restore(e,l);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(this,arguments)
}})
}else{var o={},m={};
o[f]=(p=="pos"?"-=":"+=")+c;
m[f]=(p=="pos"?"+=":"-=")+c;
e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing,function(){a.effects.restore(e,l);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(this,arguments)
}})
}e.queue("fx",function(){e.dequeue()
});
e.dequeue()
})
}
})(jQuery);
(function(a){a.effects.clip=function(b){return this.queue(function(){var f=a(this),j=["position","top","left","height","width"];
var i=a.effects.setMode(f,b.options.mode||"hide");
var k=b.options.direction||"vertical";
a.effects.save(f,j);
f.show();
var c=a.effects.createWrapper(f).css({overflow:"hidden"});
var e=f[0].tagName=="IMG"?c:f;
var g={size:(k=="vertical")?"height":"width",position:(k=="vertical")?"top":"left"};
var d=(k=="vertical")?e.height():e.width();
if(i=="show"){e.css(g.size,0);
e.css(g.position,d/2)
}var h={};
h[g.size]=i=="show"?d:0;
h[g.position]=i=="show"?0:d/2;
e.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()
}a.effects.restore(f,j);
a.effects.removeWrapper(f);
if(b.callback){b.callback.apply(f[0],arguments)
}f.dequeue()
}})
})
}
})(jQuery);
(function(a){a.effects.drop=function(b){return this.queue(function(){var e=a(this),d=["position","top","left","opacity"];
var i=a.effects.setMode(e,b.options.mode||"hide");
var h=b.options.direction||"left";
a.effects.save(e,d);
e.show();
a.effects.createWrapper(e);
var f=(h=="up"||h=="down")?"top":"left";
var c=(h=="up"||h=="left")?"pos":"neg";
var j=b.options.distance||(f=="top"?e.outerHeight({margin:true})/2:e.outerWidth({margin:true})/2);
if(i=="show"){e.css("opacity",0).css(f,c=="pos"?-j:j)
}var g={opacity:i=="show"?1:0};
g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;
e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()
}a.effects.restore(e,d);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(this,arguments)
}e.dequeue()
}})
})
}
})(jQuery);
(function(a){a.effects.explode=function(b){return this.queue(function(){var k=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;
var e=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;
b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;
var h=a(this).show().css("visibility","hidden");
var l=h.offset();
l.top-=parseInt(h.css("marginTop"),10)||0;
l.left-=parseInt(h.css("marginLeft"),10)||0;
var g=h.outerWidth(true);
var c=h.outerHeight(true);
for(var f=0;
f<k;
f++){for(var d=0;
d<e;
d++){h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)
}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();
if(b.callback){b.callback.apply(h[0])
}h.dequeue();
a("div.ui-effects-explode").remove()
},b.duration||500)
})
}
})(jQuery);
(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];
var h=a.effects.setMode(e,b.options.mode||"hide");
var o=b.options.size||15;
var n=!(!b.options.horizFirst);
var g=b.duration?b.duration/2:a.fx.speeds._default/2;
a.effects.save(e,k);
e.show();
var d=a.effects.createWrapper(e).css({overflow:"hidden"});
var i=((h=="show")!=n);
var f=i?["width","height"]:["height","width"];
var c=i?[d.width(),d.height()]:[d.height(),d.width()];
var j=/([0-9]+)%/.exec(o);
if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]
}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})
}var m={},l={};
m[f[0]]=h=="show"?c[0]:o;
l[f[1]]=h=="show"?c[1]:0;
d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()
}a.effects.restore(e,k);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(e[0],arguments)
}e.dequeue()
})
})
}
})(jQuery);
(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];
var h=a.effects.setMode(e,b.options.mode||"show");
var c=b.options.color||"#ffff99";
var g=e.css("backgroundColor");
a.effects.save(e,d);
e.show();
e.css({backgroundImage:"none",backgroundColor:c});
var f={backgroundColor:g};
if(h=="hide"){f.opacity=0
}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()
}a.effects.restore(e,d);
if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")
}if(b.callback){b.callback.apply(this,arguments)
}e.dequeue()
}})
})
}
})(jQuery);
(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);
var g=a.effects.setMode(d,b.options.mode||"show");
var f=b.options.times||5;
var e=b.duration?b.duration/2:a.fx.speeds._default/2;
if(g=="hide"){f--
}if(d.is(":hidden")){d.css("opacity",0);
d.show();
d.animate({opacity:1},e,b.options.easing);
f=f-2
}for(var c=0;
c<f;
c++){d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing)
}if(g=="hide"){d.animate({opacity:0},e,b.options.easing,function(){d.hide();
if(b.callback){b.callback.apply(this,arguments)
}})
}else{d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)
}})
}d.queue("fx",function(){d.dequeue()
});
d.dequeue()
})
}
})(jQuery);
(function(a){a.effects.puff=function(b){return this.queue(function(){var f=a(this);
var c=a.extend(true,{},b.options);
var h=a.effects.setMode(f,b.options.mode||"hide");
var g=parseInt(b.options.percent,10)||150;
c.fade=true;
var e={height:f.height(),width:f.width()};
var d=g/100;
f.from=(h=="hide")?e:{height:e.height*d,width:e.width*d};
c.from=f.from;
c.percent=(h=="hide")?g:100;
c.mode=h;
f.effect("scale",c,b.duration,b.callback);
f.dequeue()
})
};
a.effects.scale=function(b){return this.queue(function(){var g=a(this);
var d=a.extend(true,{},b.options);
var j=a.effects.setMode(g,b.options.mode||"effect");
var h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(j=="hide"?0:100));
var i=b.options.direction||"both";
var c=b.options.origin;
if(j!="effect"){d.origin=c||["middle","center"];
d.restore=true
}var f={height:g.height(),width:g.width()};
g.from=b.options.from||(j=="show"?{height:0,width:0}:f);
var e={y:i!="horizontal"?(h/100):1,x:i!="vertical"?(h/100):1};
g.to={height:f.height*e.y,width:f.width*e.x};
if(b.options.fade){if(j=="show"){g.from.opacity=0;
g.to.opacity=1
}if(j=="hide"){g.from.opacity=1;
g.to.opacity=0
}}d.from=g.from;
d.to=g.to;
d.mode=j;
g.effect("size",d,b.duration,b.callback);
g.dequeue()
})
};
a.effects.size=function(b){return this.queue(function(){var c=a(this),n=["position","top","left","width","height","overflow","opacity"];
var m=["position","top","left","overflow","opacity"];
var j=["width","height","overflow"];
var p=["fontSize"];
var k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];
var f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];
var g=a.effects.setMode(c,b.options.mode||"effect");
var i=b.options.restore||false;
var e=b.options.scale||"both";
var o=b.options.origin;
var d={height:c.height(),width:c.width()};
c.from=b.options.from||d;
c.to=b.options.to||d;
if(o){var h=a.effects.getBaseline(o,d);
c.from.top=(d.height-c.from.height)*h.y;
c.from.left=(d.width-c.from.width)*h.x;
c.to.top=(d.height-c.to.height)*h.y;
c.to.left=(d.width-c.to.width)*h.x
}var l={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};
if(e=="box"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(k);
c.from=a.effects.setTransition(c,k,l.from.y,c.from);
c.to=a.effects.setTransition(c,k,l.to.y,c.to)
}if(l.from.x!=l.to.x){n=n.concat(f);
c.from=a.effects.setTransition(c,f,l.from.x,c.from);
c.to=a.effects.setTransition(c,f,l.to.x,c.to)
}}if(e=="content"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(p);
c.from=a.effects.setTransition(c,p,l.from.y,c.from);
c.to=a.effects.setTransition(c,p,l.to.y,c.to)
}}a.effects.save(c,i?n:m);
c.show();
a.effects.createWrapper(c);
c.css("overflow","hidden").css(c.from);
if(e=="content"||e=="both"){k=k.concat(["marginTop","marginBottom"]).concat(p);
f=f.concat(["marginLeft","marginRight"]);
j=n.concat(k).concat(f);
c.find("*[width]").each(function(){child=a(this);
if(i){a.effects.save(child,j)
}var q={height:child.height(),width:child.width()};
child.from={height:q.height*l.from.y,width:q.width*l.from.x};
child.to={height:q.height*l.to.y,width:q.width*l.to.x};
if(l.from.y!=l.to.y){child.from=a.effects.setTransition(child,k,l.from.y,child.from);
child.to=a.effects.setTransition(child,k,l.to.y,child.to)
}if(l.from.x!=l.to.x){child.from=a.effects.setTransition(child,f,l.from.x,child.from);
child.to=a.effects.setTransition(child,f,l.to.x,child.to)
}child.css(child.from);
child.animate(child.to,b.duration,b.options.easing,function(){if(i){a.effects.restore(child,j)
}})
})
}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(g=="hide"){c.hide()
}a.effects.restore(c,i?n:m);
a.effects.removeWrapper(c);
if(b.callback){b.callback.apply(this,arguments)
}c.dequeue()
}})
})
}
})(jQuery);
(function(a){a.effects.shake=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];
var k=a.effects.setMode(e,b.options.mode||"effect");
var n=b.options.direction||"left";
var c=b.options.distance||20;
var d=b.options.times||3;
var g=b.duration||b.options.duration||140;
a.effects.save(e,l);
e.show();
a.effects.createWrapper(e);
var f=(n=="up"||n=="down")?"top":"left";
var p=(n=="up"||n=="left")?"pos":"neg";
var h={},o={},m={};
h[f]=(p=="pos"?"-=":"+=")+c;
o[f]=(p=="pos"?"+=":"-=")+c*2;
m[f]=(p=="pos"?"-=":"+=")+c*2;
e.animate(h,g,b.options.easing);
for(var j=1;
j<d;
j++){e.animate(o,g,b.options.easing).animate(m,g,b.options.easing)
}e.animate(o,g,b.options.easing).animate(h,g/2,b.options.easing,function(){a.effects.restore(e,l);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(this,arguments)
}});
e.queue("fx",function(){e.dequeue()
});
e.dequeue()
})
}
})(jQuery);
(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];
var i=a.effects.setMode(e,b.options.mode||"show");
var h=b.options.direction||"left";
a.effects.save(e,d);
e.show();
a.effects.createWrapper(e).css({overflow:"hidden"});
var f=(h=="up"||h=="down")?"top":"left";
var c=(h=="up"||h=="left")?"pos":"neg";
var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));
if(i=="show"){e.css(f,c=="pos"?-j:j)
}var g={};
g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;
e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()
}a.effects.restore(e,d);
a.effects.removeWrapper(e);
if(b.callback){b.callback.apply(this,arguments)
}e.dequeue()
}})
})
}
})(jQuery);
(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();
(b.callback&&b.callback.apply(f[0],arguments));
f.dequeue()
})
})
}
})(jQuery);
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie){s=$.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"/tool/current/asset/js/lib/blackbirdjs/blackbirdjs-1.0-OHMOD/blank.html"},s||{});
var prop=function(n){return n&&n.constructor==Number?n+"px":n
},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(s.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":prop(s.top))+";left:"+(s.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":prop(s.left))+";width:"+(s.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":prop(s.width))+";height:"+(s.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":prop(s.height))+';"/>';
return this.each(function(){if($("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(html),this.firstChild)
}})
}return this
}
})(jQuery);
jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};
if(value===null){value="";
options.expires=-1
}var expires="";
if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;
if(typeof options.expires=="number"){date=new Date();
date.setTime(date.getTime()+(options.expires*24*60*60*1000))
}else{date=options.expires
}expires="; expires="+date.toUTCString()
}var path=options.path?"; path="+(options.path):"";
var domain=options.domain?"; domain="+(options.domain):"";
var secure=options.secure?"; secure":"";
document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("")
}else{var cookieValue=null;
if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");
for(var i=0;
i<cookies.length;
i++){var cookie=jQuery.trim(cookies[i]);
if(cookie.substring(0,name.length+1)==(name+"=")){cookieValue=decodeURIComponent(cookie.substring(name.length+1));
break
}}}return cookieValue
}};
(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)
};
k.defaults={axis:"xy",duration:parseFloat(d.fn.jquery)>=1.3?0:1};
k.window=function(a){return d(window)._scrollable()
};
d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;
if(!i){return a
}var e=(a.contentWindow||a).document||a.ownerDocument||a;
return d.browser.safari||e.compatMode=="BackCompat"?e.body:e.documentElement
})
};
d.fn.scrollTo=function(n,j,b){if(typeof j=="object"){b=j;
j=0
}if(typeof b=="function"){b={onAfter:b}
}if(n=="max"){n=9000000000
}b=d.extend({},k.defaults,b);
j=j||b.speed||b.duration;
b.queue=b.queue&&b.axis.length>1;
if(b.queue){j/=2
}b.offset=p(b.offset);
b.over=p(b.over);
return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is("html,body");
switch(typeof f){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);
break
}f=d(f,this);
case"object":if(f.is||f.style){s=(f=d(f)).offset()
}}d.each(b.axis.split(""),function(a,i){var e=i=="x"?"Left":"Top",h=e.toLowerCase(),c="scroll"+e,l=q[c],m=k.max(q,i);
if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);
if(b.margin){g[c]-=parseInt(f.css("margin"+e))||0;
g[c]-=parseInt(f.css("border"+e+"Width"))||0
}g[c]+=b.offset[h]||0;
if(b.over[h]){g[c]+=f[i=="x"?"width":"height"]()*b.over[h]
}}else{var o=f[h];
g[c]=o.slice&&o.slice(-1)=="%"?parseFloat(o)/100*m:o
}if(/^\d+$/.test(g[c])){g[c]=g[c]<=0?0:Math.min(g[c],m)
}if(!a&&b.queue){if(l!=g[c]){t(b.onAfterFirst)
}delete g[c]
}});
t(b.onAfter);
function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)
})
}}).end()
};
k.max=function(a,i){var e=i=="x"?"Width":"Height",h="scroll"+e;
if(!d(a).is("html,body")){return a[h]-d(a)[e.toLowerCase()]()
}var c="client"+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;
return Math.max(l[h],m[h])-Math.min(l[c],m[c])
};
function p(a){return typeof a=="object"?a:{top:a,left:a}
}})(jQuery);
(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log("ajaxSubmit: skipping submit process - no element selected");
return this
}if(typeof options=="function"){options={success:options}
}var url=$.trim(this.attr("action"));
if(url){url=(url.match(/^([^#]+)/)||[])[1]
}url=url||window.location.href||"";
options=$.extend({url:url,type:this.attr("method")||"GET"},options||{});
var veto={};
this.trigger("form-pre-serialize",[this,options,veto]);
if(veto.veto){log("ajaxSubmit: submit vetoed via form-pre-serialize trigger");
return this
}if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log("ajaxSubmit: submit aborted via beforeSerialize callback");
return this
}var a=this.formToArray(options.semantic);
if(options.data){options.extraData=options.data;
for(var n in options.data){if(options.data[n] instanceof Array){for(var k in options.data[n]){a.push({name:n,value:options.data[n][k]})
}}else{a.push({name:n,value:options.data[n]})
}}}if(options.before_submit&&options.before_submit(a,this,options)===false){log("ajaxSubmit: submit aborted via before_submit callback");
return this
}this.trigger("form-submit-validate",[a,this,options,veto]);
if(veto.veto){log("ajaxSubmit: submit vetoed via form-submit-validate trigger");
return this
}var q=$.param(a);
if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;
options.data=null
}else{options.data=q
}var $form=this,callbacks=[];
if(options.resetForm){callbacks.push(function(){$form.resetForm()
})
}if(options.clearForm){callbacks.push(function(){$form.clearForm()
})
}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};
callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments)
})
}else{if(options.success){callbacks.push(options.success)
}}options.success=function(data,status){for(var i=0,max=callbacks.length;
i<max;
i++){callbacks[i].apply(options,[data,status,$form])
}};
var files=$("input:file",this).fieldValue();
var found=false;
for(var j=0;
j<files.length;
j++){if(files[j]){found=true
}}var multipart=false;
if(options.iframe||found||multipart){if(options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload)
}else{fileUpload()
}}else{$.ajax(options)
}this.trigger("form-submit-notify",[this,options]);
return this;
function fileUpload(){var form=$form[0];
if($(":input[name=submit]",form).length){alert('Error: Form elements must not be named "submit".');
return 
}var opts=$.extend({},$.ajaxSettings,options);
var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);
var id="jqFormIO"+(new Date().getTime());
var $io=$('<iframe id="'+id+'" name="'+id+'" src="about:blank" />');
var io=$io[0];
$io.css({position:"absolute",top:"-1000px",left:"-1000px"});
var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;
$io.attr("src","about:blank")
}};
var g=opts.global;
if(g&&!$.active++){$.event.trigger("ajaxStart")
}if(g){$.event.trigger("ajaxSend",[xhr,opts])
}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;
return 
}if(xhr.aborted){return 
}var cbInvoked=0;
var timedOut=0;
var sub=form.clk;
if(sub){var n=sub.name;
if(n&&!sub.disabled){options.extraData=options.extraData||{};
options.extraData[n]=sub.value;
if(sub.type=="image"){options.extraData[name+".x"]=form.clk_x;
options.extraData[name+".y"]=form.clk_y
}}}setTimeout(function(){var t=$form.attr("target"),a=$form.attr("action");
form.setAttribute("target",id);
if(form.getAttribute("method")!="POST"){form.setAttribute("method","POST")
}if(form.getAttribute("action")!=opts.url){form.setAttribute("action",opts.url)
}if(!options.skipEncodingOverride){$form.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})
}if(opts.timeout){setTimeout(function(){timedOut=true;
cb()
},opts.timeout)
}var extraInputs=[];
try{if(options.extraData){for(var n in options.extraData){extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0])
}}$io.appendTo("body");
io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);
form.submit()
}finally{form.setAttribute("action",a);
t?form.setAttribute("target",t):$form.removeAttr("target");
$(extraInputs).remove()
}},10);
var nullCheckFlag=0;
function cb(){if(cbInvoked++){return 
}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);
var ok=true;
try{if(timedOut){throw"timeout"
}var data,doc;
doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;
if((doc.body==null||doc.body.innerHTML=="")&&!nullCheckFlag){nullCheckFlag=1;
cbInvoked--;
setTimeout(cb,100);
return 
}xhr.responseText=doc.body?doc.body.innerHTML:null;
xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;
xhr.getResponseHeader=function(header){var headers={"content-type":opts.dataType};
return headers[header]
};
if(opts.dataType=="json"||opts.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];
xhr.responseText=ta?ta.value:xhr.responseText
}else{if(opts.dataType=="xml"&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText)
}}data=$.httpData(xhr,opts.dataType)
}catch(e){ok=false;
$.handleError(opts,xhr,"error",e)
}if(ok){opts.success(data,"success");
if(g){$.event.trigger("ajaxSuccess",[xhr,opts])
}}if(g){$.event.trigger("ajaxComplete",[xhr,opts])
}if(g&&!--$.active){$.event.trigger("ajaxStop")
}if(opts.complete){opts.complete(xhr,ok?"success":"error")
}setTimeout(function(){$io.remove();
xhr.responseXML=null
},100)
}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");
doc.async="false";
doc.loadXML(s)
}else{doc=(new DOMParser()).parseFromString(s,"text/xml")
}return(doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null
}}};
$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){$(this).ajaxSubmit(options);
return false
}).each(function(){$(":submit,input:image",this).bind("click.form-plugin",function(e){var form=this.form;
form.clk=this;
if(this.type=="image"){if(e.offsetX!=undefined){form.clk_x=e.offsetX;
form.clk_y=e.offsetY
}else{if(typeof $.fn.offset=="function"){var offset=$(this).offset();
form.clk_x=e.pageX-offset.left;
form.clk_y=e.pageY-offset.top
}else{form.clk_x=e.pageX-this.offsetLeft;
form.clk_y=e.pageY-this.offsetTop
}}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null
},10)
})
})
};
$.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");
return this.each(function(){$(":submit,input:image",this).unbind("click.form-plugin")
})
};
$.fn.formToArray=function(semantic){var a=[];
var radioButtonNames={};
if(this.length==0){return a
}var form=this[0];
var els=semantic?form.getElementsByTagName("*"):form.elements;
if(!els){return a
}for(var i=0,max=els.length;
i<max;
i++){var el=els[i];
var n=el.name;
if(!n){continue
}var t=el.type;
if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});
a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})
}continue
}var v=$.fieldValue(el,true);
if(v&&v.constructor==Array){for(var j=0,jmax=v.length;
j<jmax;
j++){a.push({name:n,value:v[j]})
}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v});
if(t=="radio"){radioButtonNames[n]="checked"
}}else{if(t=="radio"){if(!radioButtonNames[n]){radioButtonNames[n]=""
}}}}}for(var radioButtonName in radioButtonNames){var radioButtonValue=radioButtonNames[radioButtonName];
if(radioButtonValue===""){a.push({name:radioButtonName,value:""})
}}if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;
if(n&&!input.disabled&&input.type=="image"){a.push({name:n,value:$input.val()});
a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})
}}return a
};
$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))
};
$.fn.fieldSerialize=function(successful){var a=[];
this.each(function(){var n=this.name;
if(!n){return 
}var v=$.fieldValue(this,successful);
if(v&&v.constructor==Array){for(var i=0,max=v.length;
i<max;
i++){a.push({name:n,value:v[i]})
}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})
}}});
return $.param(a)
};
$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;
i<max;
i++){var el=this[i];
var v=$.fieldValue(el,successful);
if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue
}v.constructor==Array?$.merge(val,v):val.push(v)
}return val
};
$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();
if(typeof successful=="undefined"){successful=true
}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return""
}else{if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null
}}if(tag=="select"){var index=el.selectedIndex;
if(index<0){return null
}var a=[],ops=el.options;
var one=(t=="select-one");
var max=(one?index+1:ops.length);
for(var i=(one?index:0);
i<max;
i++){var op=ops[i];
if(op.selected){var v=op.value;
if(!v){v=(op.attributes&&op.attributes.value&&!(op.attributes.value.specified))?op.text:op.value
}if(one){return v
}a.push(v)
}}return a
}return el.value
};
$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()
})
};
$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();
if(t=="text"||t=="password"||tag=="textarea"){this.value=""
}else{if(t=="checkbox"||t=="radio"){this.checked=false
}else{if(tag=="select"){this.selectedIndex=-1
}}}})
};
$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()
}})
};
$.fn.enable=function(b){if(b==undefined){b=true
}return this.each(function(){this.disabled=!b
})
};
$.fn.selected=function(select){if(select==undefined){select=true
}return this.each(function(){var t=this.type;
if(t=="checkbox"||t=="radio"){this.checked=select
}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");
if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").selected(false)
}this.selected=select
}}})
};
function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))
}}})(jQuery);
(function($){$.json2xml=function(json,options){settings={};
settings=$.extend(true,settings,defaultSettings,options||{});
return convertToXml(json,settings.rootTagName,"",0)
};
var defaultSettings={formatOutput:false,formatTextNodes:false,indentString:"  ",rootTagName:"root",ignore:[],replace:[],nodes:[],attributes:[],exceptions:[]};
var settings={};
var convertToXml=function(json,tagName,parentPath,depth){var suffix=(settings.formatOutput)?"\r\n":"";
var indent=(settings.formatOutput)?getIndent(depth):"";
var xmlTag=indent+"<"+tagName;
var children="";
for(var key in json){if(json.hasOwnProperty(key)){var propertyPath=parentPath+key;
var propertyName=getPropertyName(parentPath,key);
if($.inArray(propertyPath,settings.ignore)==-1){if($.isArray(json[key])){children+=createNodeFromArray(json[key],propertyName,propertyPath+".",depth+1,suffix)
}else{if(typeof (json[key])==="object"){children+=convertToXml(json[key],propertyName,propertyPath+".",depth+1)
}else{if($.inArray(propertyPath,settings.attributes)===-1){children+=createTextNode(propertyName,json[key],depth,suffix)
}else{xmlTag+=" "+propertyName+'="'+json[key]+'"'
}}}}}}if(children!==""){xmlTag+=">"+suffix+children+indent+"</"+tagName+">"+suffix
}else{xmlTag+="/>"+suffix
}return xmlTag
};
var getIndent=function(depth){var output="";
for(var i=0;
i<depth;
i++){output+=settings.indentString
}return output
};
var getPropertyName=function(parentPath,name){var index=settings.replace.length;
var searchName=parentPath+name;
while(index--){if(settings.replace[index].hasOwnProperty(searchName)){return settings.replace[index][searchName]
}}return name
};
var createNodeFromArray=function(source,name,path,depth,suffix){var xmlNode="";
if(source.length>0){for(var index in source){if(typeof (source[index])!=="object"){if(source[index]===""){xmlNode+=getIndent(depth)+"<"+name+"/>"+suffix
}else{var textPrefix=(settings.formatTextNodes)?suffix+getIndent(depth+1):"";
var textSuffix=(settings.formatTextNodes)?suffix+getIndent(depth):"";
xmlNode+=getIndent(depth)+"<"+name+">"+textPrefix+source[index]+textSuffix+"</"+name+">"+suffix
}}else{xmlNode+=convertToXml(source[index],name,path,depth)
}}}else{xmlNode+=getIndent(depth)+"<"+name+"/>"+suffix
}return xmlNode
};
var createTextNode=function(name,text,parentDepth,suffix){var textPrefix=(settings.formatTextNodes)?suffix+getIndent(parentDepth+2):"";
var textSuffix=(settings.formatTextNodes)?suffix+getIndent(parentDepth+1):"";
var xmlNode=getIndent(parentDepth+1)+"<"+name+">"+textPrefix+text+textSuffix+"</"+name+">"+suffix;
return xmlNode
}
})(jQuery);
if(window.jQuery){(function($){$.extend({xml2json:function(xml,extended){if(!xml){return{}
}function parseXML(node,simple){if(!node){return null
}var txt="",obj=null,att=null;
var nt=node.nodeType,nn=jsVar(node.localName||node.nodeName);
var nv=node.text||node.nodeValue||"";
if(node.childNodes){if(node.childNodes.length>0){$.each(node.childNodes,function(n,cn){var cnt=cn.nodeType,cnn=jsVar(cn.localName||cn.nodeName);
var cnv=cn.text||cn.nodeValue||"";
if(cnt==8){return 
}else{if(cnt==3||cnt==4||!cnn){if(cnv.match(/^\s+$/)){return 
}txt+=cnv.replace(/^\s+/,"").replace(/\s+$/,"")
}else{obj=obj||{};
if(obj[cnn]){if(!obj[cnn].length){obj[cnn]=myArr(obj[cnn])
}obj[cnn][obj[cnn].length]=parseXML(cn,true);
obj[cnn].length=obj[cnn].length
}else{obj[cnn]=parseXML(cn)
}}}})
}}if(node.attributes){if(node.attributes.length>0){att={};
obj=obj||{};
$.each(node.attributes,function(a,at){var atn=jsVar(at.name),atv=at.value;
att[atn]=atv;
if(obj[atn]){if(!obj[atn].length){obj[atn]=myArr(obj[atn])
}obj[atn][obj[atn].length]=atv;
obj[atn].length=obj[atn].length
}else{obj[atn]=atv
}})
}}if(obj){obj=$.extend((txt!=""?new String(txt):{}),obj||{});
txt=(obj.text)?(typeof (obj.text)=="object"?obj.text:[obj.text||""]).concat([txt]):txt;
if(txt){obj.text=txt
}txt=""
}var out=obj||txt;
if(extended){if(txt){out={}
}txt=out.text||txt||"";
if(txt){out.text=txt
}if(!simple){out=myArr(out)
}}return out
}var jsVar=function(s){return String(s||"").replace(/-/g,"_")
};
var isNum=function(s){return(typeof s=="number")||String((s&&typeof s=="string")?s:"").test(/^((-)?([0-9]*)((\.{0,1})([0-9]+))?$)/)
};
var myArr=function(o){if(!o.length){o=[o]
}o.length=o.length;
return o
};
if(typeof xml=="string"){xml=$.text2xml(xml)
}if(!xml.nodeType){return 
}if(xml.nodeType==3||xml.nodeType==4){return xml.nodeValue
}var root=(xml.nodeType==9)?xml.documentElement:xml;
var out=parseXML(root,true);
xml=null;
root=null;
return out
},text2xml:function(str){var out;
try{var xml=($.browser.msie)?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser();
xml.async=false
}catch(e){throw new Error("XML Parser could not be instantiated")
}try{if($.browser.msie){out=(xml.loadXML(str))?xml:false
}else{out=xml.parseFromString(str,"text/xml")
}}catch(e){throw new Error("Error parsing XML string")
}return out
}})
})(jQuery);
/* Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
}(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;
if($.isFunction(type)){fn2=fn,fn=type,type=undefined
}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)){return(q=query)&&false
}});
q=q||new $.livequery(this.selector,this.context,type,fn,fn2);
q.stopped=false;
q.run();
return this
},expire:function(type,fn,fn2){var self=this;
if($.isFunction(type)){fn2=fn,fn=type,type=undefined
}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped){$.livequery.stop(query.id)
}});
return this
}});
$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;
this.context=context||document;
this.type=type;
this.fn=fn;
this.fn2=fn2;
this.elements=[];
this.stopped=false;
this.id=$.livequery.queries.push(this)-1;
fn.$lqguid=fn.$lqguid||$.livequery.guid++;
if(fn2){fn2.$lqguid=fn2.$lqguid||$.livequery.guid++
}return this
};
$.livequery.prototype={stop:function(){var query=this;
if(this.type){this.elements.unbind(this.type,this.fn)
}else{if(this.fn2){this.elements.each(function(i,el){query.fn2.apply(el)
})
}}this.elements=[];
this.stopped=true
},run:function(){if(this.stopped){return 
}var query=this;
var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);
this.elements=els;
if(this.type){nEls.bind(this.type,this.fn);
if(oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){$.event.remove(el,query.type,query.fn)
}})
}}else{nEls.each(function(){query.fn.apply(this)
});
if(this.fn2&&oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){query.fn2.apply(el)
}})
}}}};
$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;
while(length--){$.livequery.queries[$.livequery.queue.shift()].run()
}}},pause:function(){$.livequery.running=false
},play:function(){$.livequery.running=true;
$.livequery.run()
},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n]){return 
}var old=$.fn[n];
$.fn[n]=function(){var r=old.apply(this,arguments);
$.livequery.run();
return r
}
})
},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id)
}}else{$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id)
}})
}if($.livequery.timeout){clearTimeout($.livequery.timeout)
}$.livequery.timeout=setTimeout($.livequery.checkQueue,20)
},stop:function(id){if(id!=undefined){$.livequery.queries[id].stop()
}else{$.each($.livequery.queries,function(id){$.livequery.queries[id].stop()
})
}}});
$.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");
$(function(){$.livequery.play()
});
var init=$.prototype.init;
$.prototype.init=function(a,c){var r=init.apply(this,arguments);
if(a&&a.selector){r.context=a.context,r.selector=a.selector
}if(typeof a=="string"){r.context=c||document,r.selector=a
}return r
};
$.prototype.init.prototype=$.prototype
})(jQuery);
(function($){var CLASS="jQuery.ui.synchronizedColumns.";
var SynchronizedColumns={_$body:null,_$footer:null,_$footerCells:null,_$header:null,_$headerCells:null,_init:function(){this._$body=this.element.find(this.options.bodySelector);
this._$footer=this.element.find(this.options.footerSelector);
this._$footerCells=this._$footer.find(this.options.footerCellSelector);
this._$header=this.element.find(this.options.headerSelector);
this._$headerCells=this._$header.find(this.options.headerCellSelector);
if(this.options.useOnresize){$(window).bind("resize",this._getFunctionInContext(this,this.synchronize))
}this._log("Initialized in synch columns",CLASS+"_init",{bodyClassName:this._$body.attr("class"),headerClassName:this._$header.attr("class"),headerColCount:this._$headerCells.length})
},_logMethod:"info",_loggingEnabled:false,_log:function(msg,method,hash){if(this._loggingEnabled){oh.core.log[this._logMethod](msg,method,hash)
}},destroy:function(){$.widget.prototype.destroy.apply(this,arguments);
this._$body=null;
this._$footer=null;
this._$footerCells=null;
this._$header=null;
this._$headerCells=null;
if(this.options.useOnresize){$(window).unbind("resize")
}},_getFunctionInContext:function(context,fn){return function(){return fn.apply(context,arguments)
}
},_getScrollBarWidth:function(){var body=this._$body.get(0);
var parent=body.parentNode;
var grandParent=parent.parentNode;
var scrollBarWidth=grandParent.clientWidth-parent.clientWidth;
this._log("Calculate scroll bar width:",CLASS+"_getScrollBarWidth",{parentWidth:parent.clientWidth,grandParentWidth:grandParent.clientWidth,scrollbarWidth:scrollBarWidth});
body=parent=grandParent=null;
return scrollBarWidth
},_getContentWidth:function(node){var METHODNAME=CLASS+"_getContentWidth";
this._log("Get the content width",METHODNAME,{node:node.className,childNodeCount:node.childNodes.length});
var el=this._getDocumentElement(node).createElement("div");
var width=0;
this._log("DIV created",METHODNAME);
node.appendChild(el);
width=el.offsetWidth;
this._log("Width of DIV",METHODNAME,{width:width});
node.removeChild(el);
node=el=null;
return width
},_getDocumentElement:function(node){return oh.utils.dom.getNodeDocumentElement(node)
},synchronize:function(){this._log("called",CLASS+"synchronize");
var $cells=this._$body.find(this.options.bodyCellSelector);
var cellWidth=0;
var scrollBarWidth=0;
var bodyWidth=this._getContentWidth(this._$body.get(0).parentNode);
this._$body.css("width",bodyWidth+"px");
this._log("Synchronize the columns",CLASS+"synchronize",{cellCount:$cells.length,bodyWidth:bodyWidth});
for(var i=0,length=$cells.length;
i<length;
i++){cellWidth=this._getContentWidth($cells.get(i));
this._$headerCells.get(i).style.width=cellWidth+"px";
if(this._$footerCells[i]){this._$footerCells.get(i).style.width=cellWidth+"px"
}}this._$header.parents("table").css("width",bodyWidth+"px");
$cells=null
}};
$.widget("ui.synchronizedColumns",SynchronizedColumns);
$.ui.synchronizedColumns.defaults={bodyCellSelector:"tr:first td",bodySelector:".ui-synchronizedColumns-body",footerCellSelector:"th",footerSelector:".ui-synchronizedColumns-footerRow",headerCellSelector:"th",headerSelector:".ui-synchronizedColumns-headerRow",useOnresize:false}
})(jQuery);
var blackbird=function(opts){opts=opts||{};
var IE6_POSITION_FIXED=opts.IE6_POSITION_FIXED!==false;
var code=opts.code||113;
var paused=!!(opts.paused||false);
var useShim=document.all&&opts.useShim!==false;
var shimSrc=opts.shimSrc||"blank.html";
var maxNumLogEntries=opts.maxNumLogEntries||1000;
var numLogEntriesToTrim=opts.numLogEntriesToTrim||100;
var manageMessages=(true===opts.manageMessages);
var numLogEntries=0;
var didTrimLogEntries=false;
var IDs=opts.IDs||{blackbird:"blackbird",shim:"bbShim",inner:"bbInner",pause:"bbPause",checkbox:"bbVis",filters:"bbFilters",controls:"bbControls",size:"bbSize"};
var messageTypes=opts.messageTypes||["info","debug","warn","error","profile"];
var bbird,outputList;
var classes={};
var profiler={};
var cache=[];
var state=getState();
function manageMessageConsole(){if(numLogEntries>=maxNumLogEntries){var currentLogMarkup=outputList.innerHTML;
var currentEntries=currentLogMarkup.match(/((<li\s+class=[^>]+>(.|\s)+?<\/li>)+?)/gi);
var sliceIndex=numLogEntriesToTrim;
if(!didTrimLogEntries){didTrimLogEntries=true
}else{sliceIndex++
}var entriesToLeave=currentEntries.slice(sliceIndex);
numLogEntries=entriesToLeave.length;
outputList.innerHTML="";
appendMessage("error","Maximum number of log entries reached.");
var trimmedLogMarkup=entriesToLeave.join("");
outputList.innerHTML+=trimmedLogMarkup
}else{numLogEntries++
}}function generateMarkup(){var spans=[];
for(var i=0;
messageTypes[i];
i++){var type=messageTypes[i];
spans.push(['<span class="',type,'" type="',type,'"></span>'].join(""))
}numLogEntries=cache.length||0;
var newNode=document.createElement("div");
newNode.id=IDs.blackbird;
newNode.style.display="none";
newNode.innerHTML=[(!useShim?"":'<iframe id="'+IDs.shim+'" src="'+shimSrc+'" frameborder="0" tabindex="-1"></iframe>'),'<div id="',IDs.inner,'">','<div class="header">','<div class="left">','<div id="',IDs.filters,'" class="filters" title="click to filter by message type">',spans.join(""),"</div>","</div>",'<div class="right">','<div id="',IDs.controls,'" class="controls">','<span id="',IDs.size,'" title="contract" op="resize"></span>','<span id="',IDs.pause,'" class="pause" title="pause" op="pause"></span>','<span class="clearLog" title="clear" op="clear"></span>','<span class="close" title="close" op="close"></span>',"</div>","</div>","</div>",'<div class="main">','<div class="left"></div>','<div class="mainBody">',"<ol>",cache.join(""),"</ol>","</div>",'<div class="right"></div>',"</div>",'<div class="footer">','<div class="left">','<label for="',IDs.checkbox,'">','<input type="checkbox" id="',IDs.checkbox,'" />',"Visible on page load","</label>","</div>",'<div class="right"></div>',"</div>","</div>",].join("");
return newNode
}function backgroundImage(){var bodyTag=getBody();
if(bodyTag&&bodyTag.currentStyle&&IE6_POSITION_FIXED){if(bodyTag.currentStyle.backgroundImage=="none"){bodyTag.style.backgroundImage="url(about:blank)"
}if(bodyTag.currentStyle.backgroundAttachment=="scroll"){bodyTag.style.backgroundAttachment="fixed"
}}}function addMessage(type,content){if(!paused){content=(content.constructor==Array)?content.join(""):content;
if(outputList){appendMessage(type,content)
}else{cache.push(['<li class="',type,'"><span class="icon"></span>',content,"</li>"].join(""))
}}}function appendMessage(type,content){var newMsg=document.createElement("LI");
newMsg.className=type;
newMsg.innerHTML=['<span class="icon"></span>',content].join("");
outputList.appendChild(newMsg);
scrollToBottom();
if(manageMessages){manageMessageConsole()
}}function clear(){outputList.innerHTML="";
numLogEntries=0
}function clickControl(evt){if(!evt){evt=window.event
}var el=(evt.target)?evt.target:evt.srcElement;
if(el.tagName=="SPAN"){switch(el.getAttributeNode("op").nodeValue){case"resize":resize();
break;
case"clear":clear();
break;
case"close":hide();
break;
case"pause":pause();
break
}}}function clickFilter(evt){if(!evt){evt=window.event
}var span=(evt.target)?evt.target:evt.srcElement;
if(span&&span.tagName=="SPAN"){var type=span.getAttributeNode("type").nodeValue;
if(evt.altKey){var filters=getFilters();
var active=0;
for(var i=0;
messageTypes[i];
i++){var thisType=messageTypes[i];
if(state[thisType]){active++
}}var oneActiveFilter=(active==1&&state[type]);
for(var j=0;
filters[j];
j++){var spanType=filters[j].getAttributeNode("type").nodeValue;
var isEnabled=(oneActiveFilter||(spanType==type));
state[spanType]=isEnabled
}}else{var isEnabled=!state[type];
state[type]=isEnabled
}enforceFilters();
setState();
scrollToBottom()
}}function getFilters(){return document.getElementById(IDs.filters).getElementsByTagName("SPAN")
}function getFilter(type){var filters=getFilters();
for(var i=0;
filters[i];
i++){var filter=filters[i];
if(type===filter.getAttributeNode("type").nodeValue){return filter
}}return null
}function enforceFilters(){var disabledTypes=[];
for(var i=0;
messageTypes[i];
i++){var type=messageTypes[i];
var isEnabled=state[type];
if(!isEnabled){disabledTypes.push(type)
}var filter=getFilter(type);
if(filter){filter.className=(isEnabled?type:type+"Disabled")
}}disabledTypes.push("");
var newClassNames=disabledTypes.join("Hidden ");
outputList.className=newClassNames
}function clickVis(evt){if(!evt){evt=window.event
}var el=(evt.target)?evt.target:evt.srcElement;
state.load=el.checked;
setState()
}function getBody(){if(!getBody.bodyTag){getBody.bodyTag=document.getElementsByTagName("body")[0]
}return getBody.bodyTag
}function appendToBody(node){var bodyTag=getBody();
if(bodyTag){bodyTag.appendChild(node)
}return node
}function scrollToBottom(){outputList.scrollTop=outputList.scrollHeight
}function isVisible(){return(bbird.style.display=="block")
}function hide(){bbird.style.display="none"
}function show(){var bodyTag=getBody();
if(bodyTag){bodyTag.removeChild(bbird);
appendToBody(bbird);
bbird.style.display="block";
enforceFilters()
}}function reposition(position){if(position===undefined||position==null){position=(state&&state.pos===null)?1:(state.pos+1)%4
}switch(position){case 0:classes[0]="bbTopLeft";
break;
case 1:classes[0]="bbTopRight";
break;
case 2:classes[0]="bbBottomLeft";
break;
case 3:classes[0]="bbBottomRight";
break
}state.pos=position;
setState()
}function resize(size){if(size===undefined||size===null){size=(state&&state.size==null)?0:(state.size+1)%2
}classes[1]=(size===0)?"bbSmall":"bbLarge";
var span=document.getElementById(IDs.size);
span.title=(size===1)?"small":"large";
span.className=span.title;
state.size=size;
setState();
scrollToBottom()
}function pause(){paused=paused?false:true;
var span=document.getElementById(IDs.pause);
span.title=(paused)?"resume":"pause";
span.className=span.title
}function setState(){var props=[];
for(entry in state){var value=(state[entry]&&state[entry].constructor===String)?'"'+state[entry]+'"':state[entry];
props.push(entry+":"+value)
}props=props.join(",");
var expiration=new Date();
expiration.setDate(expiration.getDate()+14);
document.cookie=["blackbird={",props,"}; path=/; expires=",expiration.toUTCString(),";"].join("");
var newClass=[];
for(word in classes){newClass.push(classes[word])
}bbird.className=newClass.join(" ")
}function getState(){var defaults={pos:null,size:null,load:null,info:true,debug:true,warn:true,error:true,profile:true};
var re=new RegExp(/blackbird=({[^;]+})(;|\b|$)/);
var match=re.exec(document.cookie);
var state=(match&&match[1])?eval("("+match[1]+")"):{};
for(member in defaults){if(defaults.hasOwnProperty(member)){if(!state.hasOwnProperty(member)){state[member]=defaults[member]
}}}return state
}function readKey(evt){if(!evt){evt=window.event
}if(evt&&evt.keyCode==code){var visible=isVisible();
if(visible&&evt.shiftKey&&evt.altKey){reposition()
}else{if(evt.shiftKey&&!evt.altKey){(visible)?hide():show()
}}}}function addEvent(obj,type,fn){var obj=(obj.constructor===String)?document.getElementById(obj):obj;
if(obj.attachEvent){obj["e"+type+fn]=fn;
obj[type+fn]=function(){obj["e"+type+fn](window.event)
};
obj.attachEvent("on"+type,obj[type+fn])
}else{obj.addEventListener(type,fn,false)
}}function removeEvent(obj,type,fn){var obj=(obj.constructor===String)?document.getElementById(obj):obj;
if(obj.detachEvent){obj.detachEvent("on"+type,obj[type+fn]);
obj[type+fn]=null
}else{obj.removeEventListener(type,fn,false)
}}addEvent(window,"load",function(){bbird=appendToBody(generateMarkup());
outputList=bbird.getElementsByTagName("OL")[0];
backgroundImage();
addEvent(IDs.checkbox,"click",clickVis);
addEvent(IDs.filters,"click",clickFilter);
addEvent(IDs.controls,"click",clickControl);
addEvent(document,"keyup",readKey);
resize(state.size);
reposition(state.pos);
if(state.load){show();
document.getElementById(IDs.checkbox).checked=true
}scrollToBottom();
addEvent(window,"unload",function(){removeEvent(IDs.checkbox,"click",clickVis);
removeEvent(IDs.filters,"click",clickFilter);
removeEvent(IDs.controls,"click",clickControl);
removeEvent(document,"keyup",readKey)
})
});
return{pause:function(){pause()
},toggle:function(){(isVisible())?hide():show()
},resize:function(){resize()
},clear:function(){clear()
},move:function(){reposition()
},debug:function(msg){addMessage("debug",msg)
},warn:function(msg){addMessage("warn",msg)
},info:function(msg){addMessage("info",msg)
},error:function(msg){addMessage("error",msg)
},profile:function(label){var currentTime=new Date();
if(label==undefined||label==""){addMessage("error","<b>ERROR:</b> Please specify a label for your profile statement")
}else{if(profiler[label]){addMessage("profile",[label,": ",currentTime-profiler[label],"ms"].join(""));
delete profiler[label]
}else{profiler[label]=currentTime;
addMessage("profile",label)
}}return currentTime
}}
};
var $p=pure=function(){var sel=arguments[0],ctxt=false;
if(typeof sel==="string"){ctxt=arguments[1]||false
}return $p.core(sel,ctxt)
};
$p.core=function(sel,ctxt,plugins){var plugins=getPlugins(),templates=[];
if(typeof sel==="string"){templates=plugins.find(ctxt||document,sel)
}else{if(typeof sel==="object"){templates=[sel]
}else{error("No templates found. Review your selector")
}}for(var i=0,ii=templates.length;
i<ii;
i++){plugins[i]=templates[i]
}plugins.length=ii;
var Sig="_s"+Math.floor(Math.random()*1000000)+"_",attPfx="_a"+Math.floor(Math.random()*1000000)+"_",selRx=/^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,CLASSNAME=(/MSIE\s+(6|7)/).test(navigator.userAgent)?"className":"class";
return plugins;
function error(e){alert(e);
if(typeof console!=="undefined"){console.log(e)
}throw ("pure error: "+e)
}function getPlugins(){var plugins=$p.plugins,f=function(){};
f.prototype=plugins;
f.prototype.compile=plugins.compile||compile;
f.prototype.render=plugins.render||render;
f.prototype.autoRender=plugins.autoRender||autoRender;
f.prototype.find=plugins.find||find;
f.prototype._compiler=compiler;
f.prototype._error=error;
return new f()
}function outerHTML(node){return node.outerHTML||(function(n){var div=document.createElement("div"),h;
div.appendChild(n.cloneNode(true));
h=div.innerHTML;
div=null;
return h
})(node)
}function isArray(o){return Object.prototype.toString.call(o)==="[object Array]"
}function wrapquote(qfn,f){return function(ctxt){return qfn(""+f(ctxt))
}
}function domify(ns,pa){pa=pa||document.createDocumentFragment();
var nn,leaf;
for(var n in ns){nn=document.createElement(n);
pa.appendChild(nn);
if(typeof ns[n]==="object"){leaf=domify(ns[n],nn)
}else{leaf=document.createElement(ns[n]);
nn.appendChild(leaf)
}}return leaf
}function find(n,sel){if(typeof n==="string"){sel=n;
n=false
}if(typeof document.querySelectorAll!=="undefined"){return(n||document).querySelectorAll(sel)
}else{error("You can test PURE standalone with: iPhone, FF3.5+, Safari4+ and IE8+\n\nTo run PURE on your browser, you need a JS library/framework with a CSS selector engine")
}}function concatenator(parts,fns){return function(ctxt){var strs=[parts[0]],n=parts.length,fnVal,pVal,attLine,pos;
for(var i=1;
i<n;
i++){fnVal=fns[i](ctxt);
pVal=parts[i];
if(fnVal===""){attLine=strs[strs.length-1];
if((pos=attLine.search(/[\w]+=\"?$/))>-1){strs[strs.length-1]=attLine.substring(0,pos);
pVal=pVal.substr(1)
}}strs[strs.length]=fnVal;
strs[strs.length]=pVal
}return strs.join("")
}
}function parseloopspec(p){var m=p.match(/^(\w+)\s*<-\s*(\S+)?$/);
if(m===null){error('bad loop spec: "'+p+'"')
}if(m[1]==="item"){error('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.')
}if(!m[2]){m[2]=function(ctxt){return ctxt.data
}
}return{name:m[1],sel:m[2]}
}function dataselectfn(sel){if(typeof (sel)==="function"){return sel
}var m=sel.match(/^(\w+)(\.(\w+))*$/);
if(m===null){var found=false,s=sel,parts=[],pfns=[],i=0;
if(/\'|\"/.test(s.charAt(0))){if(/\'|\"/.test(s.charAt(s.length-1))){var retStr=s.substring(1,s.length-1);
return function(){return retStr
}
}}else{while((m=s.match(/#\{([^{}]+)\}/))!==null){found=true;
parts[i++]=s.slice(0,m.index);
pfns[i]=dataselectfn(m[1]);
s=s.slice(m.index+m[0].length,s.length)
}}if(!found){error("bad data selector syntax: "+sel)
}parts[i]=s;
return concatenator(parts,pfns)
}m=sel.split(".");
return function(ctxt){var data=ctxt.data;
if(!data){return""
}var v=ctxt[m[0]],i=0;
if(v){data=v.item;
i+=1
}var n=m.length;
for(;
i<n;
i++){if(!data){break
}data=data[m[i]]
}return(!data&&data!==0)?"":data
}
}function gettarget(dom,sel,isloop){var osel,prepend,selector,attr,append,target=[];
if(typeof sel==="string"){osel=sel;
var m=sel.match(selRx);
if(!m){error("bad selector syntax: "+sel)
}prepend=m[1];
selector=m[2];
attr=m[3];
append=m[4];
if(selector==="."||(!selector&&attr)){target[0]=dom
}else{target=plugins.find(dom,selector)
}if(!target||target.length===0){return{attr:null,nodes:target,set:null,sel:osel}
}}else{prepend=sel.prepend;
attr=sel.attr;
append=sel.append;
target=[dom]
}if(prepend||append){if(prepend&&append){error("append/prepend cannot take place at the same time")
}else{if(isloop){error("no append/prepend/replace modifiers allowed for loop target")
}else{if(append&&isloop){error("cannot append with loop (sel: "+osel+")")
}}}}var setstr,getstr,quotefn,isStyle,isClass;
if(attr){isStyle=(/^style$/i).test(attr);
isClass=(/^class$/i).test(attr);
if(isClass){setstr=function(node,s){node.setAttribute(attPfx+attr,s);
node.removeAttribute(CLASSNAME)
}
}else{setstr=function(node,s){node.setAttribute(attPfx+attr,s);
node.removeAttribute(attr)
}
}if(isStyle){getstr=function(node){return node.style.cssText
}
}else{getstr=function(node){return node.getAttribute(attr)
}
}if(isStyle||isClass){quotefn=function(s){return s.replace(/\"/g,"&quot;")
}
}else{quotefn=function(s){return s.replace(/\"/g,"&quot;").replace(/\s/g,"&nbsp;")
}
}}else{if(isloop){setstr=function(node,s){var pn=node.parentNode;
if(pn){var t=document.createTextNode(s);
node.parentNode.insertBefore(t,node.nextSibling);
node.parentNode.removeChild(node)
}}
}else{getstr=function(node){return node.innerHTML
};
setstr=function(node,s){node.innerHTML=s
}
}quotefn=function(s){return s
}
}var setfn;
if(prepend){setfn=function(node,s){setstr(node,s+getstr(node))
}
}else{if(append){setfn=function(node,s){setstr(node,getstr(node)+s)
}
}else{setfn=function(node,s){setstr(node,s)
}
}}return{attr:attr,nodes:target,set:setfn,sel:osel,quotefn:quotefn}
}function setsig(target,n){var sig=Sig+n+":";
for(var i=0;
i<target.nodes.length;
i++){target.set(target.nodes[i],sig)
}}function loopfn(name,dselect,inner){return function(ctxt){var a=dselect(ctxt),old=ctxt[name],temp={items:a},strs=[],buildArg=function(idx){ctxt.items=a;
ctxt.pos=temp.pos=idx;
ctxt.item=temp.item=a[idx];
strs.push(inner(ctxt))
};
ctxt[name]=temp;
if(isArray(a)){for(var i=0,ii=a.length||0;
i<ii;
i++){buildArg(i)
}}else{for(var prop in a){a.hasOwnProperty(prop)&&buildArg(prop)
}}ctxt[name]=old;
return strs.join("")
}
}function loopgen(dom,sel,loop,fns){var already=false;
var p;
for(var i in loop){if(loop.hasOwnProperty(i)){if(already){error("cannot have more than one loop on a target")
}p=i;
already=true
}}if(!p){error("no loop spec")
}var dsel=loop[p];
if(typeof (dsel)==="string"||typeof (dsel)==="function"){loop={};
loop[p]={root:dsel};
return loopgen(dom,sel,loop,fns)
}var spec=parseloopspec(p),itersel=dataselectfn(spec.sel),target=gettarget(dom,sel,true),nodes=target.nodes;
for(i=0;
i<nodes.length;
i++){var node=nodes[i],inner=compiler(node,dsel);
fns[fns.length]=wrapquote(target.quotefn,loopfn(spec.name,itersel,inner));
target.nodes=[node];
setsig(target,fns.length-1)
}}function getAutoNodes(n,data){var ns=n.getElementsByTagName("*"),an=[],openLoops={a:[],l:{}},cspec,i,ii,j,jj,ni,cs,cj;
for(i=-1,ii=ns.length;
i<ii;
i++){ni=i>-1?ns[i]:n;
if(ni.nodeType===1&&ni.className!==""){cs=ni.className.split(" ");
for(j=0,jj=cs.length;
j<jj;
j++){cj=cs[j];
cspec=checkClass(cj,data);
if(cspec!==false){an.push({n:ni,cspec:cspec})
}}}}return an;
function checkClass(c){var ca=c.match(selRx),cspec={prepend:!!ca[1],prop:ca[2],attr:ca[3],append:!!ca[4],sel:c},val=isArray(data)?data[0][cspec.prop]:data[cspec.prop],i,ii,loopi;
if(typeof val==="undefined"){for(i=openLoops.a.length-1;
i>=0;
i--){loopi=openLoops.a[i];
val=loopi.l[0][cspec.prop];
if(typeof val!=="undefined"){cspec.prop=loopi.p+"."+cspec.prop;
if(openLoops.l[cspec.prop]===true){val=val[0]
}break
}}}if(typeof val==="undefined"){return false
}if(isArray(val)){openLoops.a.push({l:val,p:cspec.prop});
openLoops.l[cspec.prop]=true;
cspec.t="loop"
}else{cspec.t="str"
}return cspec
}}function compiler(dom,directive,data,ans){var fns=[];
ans=ans||data&&getAutoNodes(dom,data);
if(data){var j,jj,cspec,n,target,nodes,itersel,node,inner;
while(ans.length>0){cspec=ans[0].cspec;
n=ans[0].n;
ans.splice(0,1);
if(cspec.t==="str"){target=gettarget(n,cspec,false);
setsig(target,fns.length);
fns[fns.length]=wrapquote(target.quotefn,dataselectfn(cspec.prop))
}else{itersel=dataselectfn(cspec.sel);
target=gettarget(n,cspec,true);
nodes=target.nodes;
for(j=0,jj=nodes.length;
j<jj;
j++){node=nodes[j];
inner=compiler(node,false,data,ans);
fns[fns.length]=wrapquote(target.quotefn,loopfn(cspec.sel,itersel,inner));
target.nodes=[node];
setsig(target,fns.length-1)
}}}}var target,dsel;
for(var sel in directive){if(directive.hasOwnProperty(sel)){dsel=directive[sel];
if(typeof (dsel)==="function"||typeof (dsel)==="string"){target=gettarget(dom,sel,false);
setsig(target,fns.length);
fns[fns.length]=wrapquote(target.quotefn,dataselectfn(dsel))
}else{loopgen(dom,sel,dsel,fns)
}}}var h=outerHTML(dom).split(attPfx).join(""),pfns=[];
var parts=h.split(Sig),p;
for(var i=1;
i<parts.length;
i++){p=parts[i];
pfns[i]=fns[parseInt(p,10)];
parts[i]=p.substring(p.indexOf(":")+1)
}return concatenator(parts,pfns)
}function compile(directive,ctxt,template){var rfn=compiler((template||this[0]).cloneNode(true),directive,ctxt);
return function(data,context){context=context||data;
return rfn({data:data,context:context})
}
}function render(ctxt,directive){var fn=typeof directive==="function"?directive:plugins.compile(directive,false,this[0]);
for(var i=0,ii=this.length;
i<ii;
i++){this[i]=replaceWith(this[i],fn(ctxt,false))
}context=null;
return this
}function autoRender(ctxt,directive){var fn=typeof directive==="function"?directive:plugins.compile(directive,ctxt,this[0]);
for(var i=0,ii=this.length;
i<ii;
i++){this[i]=replaceWith(this[i],fn(ctxt,false))
}context=null;
return this
}function replaceWith(elm,html){var div=document.createElement("DIV"),tagName=elm.tagName.toLowerCase(),ne,pa;
if((/td|tr|th/).test(tagName)){var parents={tr:{table:"tbody"},td:{table:{tbody:"tr"}},th:{table:{thead:"tr"}}};
pa=domify(parents[tagName])
}else{if((/tbody|thead|tfoot/).test(tagName)){pa=document.createElement("table")
}else{pa=document.createElement("div")
}}var ep=elm.parentNode;
ep.insertBefore(pa,elm);
ep.removeChild(elm);
pa.innerHTML=html;
ne=pa.firstChild;
ep.insertBefore(ne,pa);
ep.removeChild(pa);
elm=ne;
pa=ne=ep=null;
return elm
}};
$p.plugins={};
$p.libs={dojo:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return dojo.query(sel,n)
}
}},domassistant:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return $(n).cssSelect(sel)
}
}DOMAssistant.attach({publicMethods:["compile","render","autoRender"],compile:function(directive,ctxt){return $p(this).compile(directive,ctxt)
},render:function(ctxt,directive){return $($p(this).render(ctxt,directive))[0]
},autoRender:function(ctxt,directive){return $($p(this).autoRender(ctxt,directive))[0]
}})
},jquery:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return $(n).find(sel)
}
}jQuery.fn.extend({compile:function(directive,ctxt){return $p(this[0]).compile(directive,ctxt)
},render:function(ctxt,directive){return jQuery($p(this[0]).render(ctxt,directive))
},autoRender:function(ctxt,directive){return jQuery($p(this[0]).autoRender(ctxt,directive))
}})
},mootools:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return $(n).getElements(sel)
}
}Element.implement({compile:function(directive,ctxt){return $p(this).compile(directive,ctxt)
},render:function(ctxt,directive){return $p(this).render(ctxt,directive)
},autoRender:function(ctxt,directive){return $p(this).autoRender(ctxt,directive)
}})
},prototype:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){n=n===document?n.body:n;
return typeof n==="string"?$$(n):$(n).select(sel)
}
}Element.addMethods({compile:function(element,directive,ctxt){return $p(element).compile(directive,ctxt)
},render:function(element,ctxt,directive){return $p(element).render(ctxt,directive)
},autoRender:function(element,ctxt,directive){return $p(element).autoRender(ctxt,directive)
}})
},sizzle:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return Sizzle(sel,n)
}
}},sly:function(){if(typeof document.querySelector==="undefined"){$p.plugins.find=function(n,sel){return Sly(sel,n)
}
}}};
(function(){var libkey=typeof dojo!=="undefined"&&"dojo"||typeof DOMAssistant!=="undefined"&&"domassistant"||typeof jQuery!=="undefined"&&"jquery"||typeof MooTools!=="undefined"&&"mootools"||typeof Prototype!=="undefined"&&"prototype"||typeof Sizzle!=="undefined"&&"sizzle"||typeof Sly!=="undefined"&&"sly";
libkey&&$p.libs[libkey]()
})();
var oh={};
oh.emptyFunction=function(){};
oh.namespace=function(){var validNamespace=/^([\$a-z]+[a-z0-9]?)+(\.[a-z]+[a-z0-9]?)*$/i;
return function(namespaceInput){var initialErrorMessage="oh.namespace():\n";
var errorMessage=initialErrorMessage;
if(("string"!=typeof (namespaceInput))||!validNamespace.test(namespaceInput)){errorMessage+="The namespace input must be a string of the form level1.level2.level3...where each level is of the form /[a-z]+[a-z0-9]?/i.\n You provided "+namespaceInput+"."
}if(errorMessage==initialErrorMessage){var namespaceLevels=namespaceInput.split(".");
var namespaceHierarchy=window;
for(var i=0;
i<namespaceLevels.length;
i++){var namespaceLevel=namespaceLevels[i];
if("undefined"==typeof (namespaceHierarchy[namespaceLevel])){namespaceHierarchy[namespaceLevel]={}
}namespaceHierarchy=namespaceHierarchy[namespaceLevel]
}return namespaceHierarchy
}if(errorMessage!=initialErrorMessage){oh.core.log.error(errorMessage)
}}
}();
oh.isDevSite=function(){return(window.location.href.indexOf("optionshouse.com")===-1&&window.location.href.indexOf("optionsfirst.scottrade.com")===-1)
};
(function($){oh.namespace("oh.classInterface");
oh.classInterface.factory={getInstance:function(args,instanceHandle,debugMode){oh.core.log.info("Calling class-level getInstance method","oh.classInterface.factory");
var myInstance=new this(instanceHandle,debugMode);
if(typeof myInstance.init=="function"){myInstance.init.apply(myInstance,args)
}return myInstance
}}
})(jQuery);
(function($){oh.namespace("oh.classInterface");
oh.classInterface.singleton={myInstance:null,constructing:false,getInstance:function(args,instanceHandle,debugMode){var instanceAlreadyExists=!!(this.myInstance||this.constructing);
oh.core.log.info("Calling class-level getInstance method","oh.classInterface.singleton",{instanceAlreadyExists:instanceAlreadyExists});
if(!instanceAlreadyExists){this.constructing=true;
var myInstance=new this(instanceHandle,debugMode);
this.myInstance=myInstance;
this.constructing=false;
if(myInstance&&$.isFunction(myInstance.init)){myInstance.init.apply(myInstance,$.makeArray(args))
}}return this.myInstance
}}
})(jQuery);
(function($){oh.Awesome=Base.extend({constructor:function(instanceHandle,classHandle,logMethod){this.instanceHandle=instanceHandle||"";
this.classHandle=classHandle||"oh.Awesome";
this.logMethod=logMethod||"info"
},writeLogMessage:function(method,msg,params){oh.core.log[method](msg,this.getLogHandle(),params)
},log:function(msg,params){this.writeLogMessage(this.logMethod,msg,params)
},error:function(msg,params){this.writeLogMessage("error",msg,params)
},warn:function(msg,params){this.writeLogMessage("warn",msg,params)
},getLogHandle:function(){var logHandle=this.classHandle;
if(this.instanceHandle){logHandle=logHandle+"::"+this.instanceHandle
}this.getLogHandle=function(){return logHandle
};
return logHandle
},logMethod:"",classHandle:"",instanceHandle:""})
})(jQuery);
(function($){oh.SuperAwesome=Base.extend({classHandle:"oh.SuperAwesome",instanceHandle:"",debugMode:false,initSuccessful:false,constructor:function(instanceHandle,debugMode){this.instanceHandle=instanceHandle||"";
this.debugMode=!!(debugMode);
this.log("Constructor run","constructor",{instanceHandle:this.instanceHandle,debugMode:this.debugMode})
},confirmSuccessfulInit:function(){this.log("Instance successfully initialized","init");
this.initSuccessful=true
},init:function(){},destroy:function(){},shouldExit:function(methodHandle){if(!this.initSuccessful){this.error("Method exiting due to unsuccessful initialization",methodHandle)
}return !this.initSuccessful
},writeLogMessage:function(logMethod,msg,methodHandle,params){oh.core.log[logMethod](msg,this.getLogHandle(methodHandle),params)
},log:function(msg,methodHandle,params){var logMethod=(this.debugMode?"debug":"info");
this.writeLogMessage(logMethod,msg,methodHandle,params)
},error:function(msg,methodHandle,params){this.writeLogMessage("error",msg,methodHandle,params)
},warn:function(msg,methodHandle,params){this.writeLogMessage("warn",msg,methodHandle,params)
},profile:function(label){oh.core.log.profile(label)
},getLogHandle:function(methodHandle){var logHandle=(this.instanceHandle||this.classHandle+"::instance");
if(methodHandle!==undefined){logHandle+="."+methodHandle
}return logHandle
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.Validator=oh.Awesome.extend({constructor:function(func,opts,instanceHandle,classHandle,logMethod){this.base(instanceHandle,classHandle||"oh.Validator",logMethod||"info");
this.func=func;
this.opts=opts||{}
},func:null,opts:{},runTest:function(value,$input,data){this.log("Running test");
var finalValue=value;
if(this.opts.valueTranslator){finalValue=this.opts.valueTranslator(value)
}var passedTest=this.func(finalValue,$input,data);
if(this.opts.invert){passedTest=!passedTest
}if(passedTest&&this.opts.postValueTransformer){var newPostValue=this.opts.postValueTransformer(value);
this.log("Resetting form node value",{oldValue:value,newValue:newPostValue});
oh.utils.forms.setValue($input,newPostValue)
}return passedTest
}})
})(jQuery);
(function($){oh.RegExValidator=oh.Validator.extend({constructor:function(regEx,opts,instanceHandle,classHandle,logMethod){this.regEx=regEx;
var func=function(value,$input,data){return this.regEx.test(value)
};
this.base(func,opts,instanceHandle,classHandle||"oh.RegExValidator",logMethod||"info")
},regEx:null})
})(jQuery);
(function($){oh.ComparisonValidator=oh.Validator.extend({constructor:function(func,opts,instanceHandle,classHandle,logMethod){var wrappedFunc=function(value,$input,data){var testValue;
if(data.testValueSelector){testValue=oh.utils.forms.getValue(data.testValueSelector)
}else{if(data.testValue!==undefined){testValue=data.testValue
}}if(testValue===undefined){this.error("No value to test against",{value:value,inputLength:$input.length,data:data})
}var finalTestValue=testValue;
if(this.opts.valueTranslator){finalTestValue=this.opts.valueTranslator(testValue)
}var returnValue=func.call(this,value,finalTestValue,$input,data);
return returnValue
};
this.base(wrappedFunc,opts,instanceHandle,classHandle||"oh.ComparisonValidator",logMethod||"info")
}})
})(jQuery);
(function($){oh.TextComparisonValidator=oh.ComparisonValidator.extend({constructor:function(func,opts,instanceHandle,classHandle,logMethod){opts=opts||{};
opts.valueTranslator=oh.utils.strings.trim;
this.base(func,opts,instanceHandle,classHandle||"oh.TextComparisonValidator",logMethod||"info")
}})
})(jQuery);
(function($){oh.NumericComparisonValidator=oh.ComparisonValidator.extend({constructor:function(func,opts,instanceHandle,classHandle,logMethod){opts=opts||{};
opts.valueTranslator=Number;
this.base(func,opts,instanceHandle,classHandle||"oh.NumericComparisonValidator",logMethod||"info")
}})
})(jQuery);
(function($){oh.Config=oh.Awesome.extend({constructor:function(configs,instanceHandle,classHandle,logMethod){if(configs){this.extend(configs)
}this.base(instanceHandle,classHandle||"oh.Config",logMethod||"info")
},get:function(key){if(typeof (this[key])!="undefined"){return this[key]
}return null
},set:function(key,value){this[key]=value
}})
})(jQuery);
(function($){oh.ConfirmOffsiteLink=Base.extend({constructor:function(msg){this.msg=msg
},test:function(){return confirm(this.msg)
},go:function(node,link){var $node=$(node);
var href=(link||$node.attr("href"));
var isPopup=!!($node.attr("target"));
if(this.test()){if(isPopup){window.open(href)
}else{oh.marketingSite.utils.goToPage(href)
}}return false
},msg:""})
})(jQuery);
(function($){oh.ProgressiveLink=Base.extend({constructor:function(selector,url,opts){this.opts=opts||{};
this.$node=$(selector);
this.$links=this.$node.find("[href]").andSelf().filter("[href*="+this.unenhancedURLFormat+"]");
if(this.opts.urlTransformer&&this.$node){this.url=this.opts.urlTransformer(url,this.$node)
}else{this.url=url
}this.bindClick();
this.bindHover();
this.transformLinks()
},go:function(){oh.marketingSite.utils.goToPage(this.url)
},bindClick:function(){var _this=this;
this.$node.click(function(){_this.go();
return false
})
},bindHover:function(){if(this.opts.addHover){oh.marketingSite.utils.toggleHover(this.$node)
}},transformLinks:function(){this.$links.attr("href",this.url)
},unenhancedURLFormat:"pleaseUpgradeYourBrowser",url:"",$node:null,$links:null,opts:{}})
})(jQuery);
(function($){oh.ProgressivePopupLink=oh.ProgressiveLink.extend({constructor:function(selector,url,opts){this.base(selector,url,opts);
this.windowName=opts.windowName||"";
this.windowParams=opts.windowParams||""
},go:function(){window.open(this.url,this.windowName,this.windowParams);
return false
},transformLinks:function(){this.base();
this.$links.attr("target",(this.windowName||"_blank"))
}})
})(jQuery);
(function($){oh.PureTemplate=oh.SuperAwesome.extend({classHandle:"oh.PureTemplate",selector:null,directive:null,$j:null,$p:null,renderer:null,initialRenderComplete:false,hideUntilRender:false,removeAfterCompiling:false,jQueryContext:null,pureContext:null,init:function(selector,directive,options){this.selector=selector;
this.directive=directive;
var opts=options||{};
this.hideUntilRender=!!(opts.hideUntilRender);
this.removeAfterCompiling=!!(opts.removeAfterCompiling);
if(opts.jQueryContext){this.jQueryContext=opts.jQueryContext
}if(opts.pureContext){this.pureContext=opts.pureContext
}this.$j=$(this.selector,this.jQueryContext);
if(this.$j.length===0){this.error("No DOM node","init",{selector:selector,directive:directive});
return 
}this.$p=$p(this.selector,this.pureContext);
this.renderer=this.$p.compile(this.directive);
if(this.hideUntilRender){this.log("Hiding content until initial render","init");
this.$j.css("visibility","hidden")
}if(this.removeAfterCompiling){this.$j.remove();
this.render=function(){this.error("Can't call render after original node removed - call getMarkup instead","render")
}
}this.base();
this.confirmSuccessfulInit()
},getMarkup:function(context){if(this.shouldExit("getMarkup")){return 
}var markup=this.renderer(context);
this.log("Markup generation complete","getMarkup");
return markup
},render:function(context){if(this.shouldExit("render")){return 
}this.log("Preparing to render markup","render",{context:context});
var markup=this.getMarkup(context);
this.$j=oh.utils.dom.replaceAndReselect(this.$j,markup);
this.log("Render complete","render",{markup:markup});
if(!this.initialRenderComplete){this.log("Setting initial render flag to true","render");
this.initialRenderComplete=true;
if(this.hideUntilRender){this.log("Showing content after initial render","render",{visibility:this.$j.css("visibility"),length:this.$j.length});
this.$j.css("visibility","visible")
}}}},oh.classInterface.factory)
})(jQuery);
oh.namespace("oh.marketingSite.brightcove");
oh.SingleVideoPlayerHandler=function(argsHash){var brcvExperience=argsHash.brcvExperience;
this._currentVideoId=argsHash.initialVideoId;
this._trackingIdPrefix=argsHash.trackingIdPrefix;
this._autoStarts=argsHash.autoStarts;
this._experienceModule=brcvExperience.getModule(APIModules.EXPERIENCE);
this._videoPlayerModule=brcvExperience.getModule(APIModules.VIDEO_PLAYER);
var _this=this;
var onContentLoadWrapper=function(evt){_this._onContentLoad(evt)
};
var onStreamStartWrapper=function(evt){_this._onStreamStart(evt)
};
this._experienceModule.addEventListener(BCExperienceEvent.CONTENT_LOAD,onContentLoadWrapper);
this._videoPlayerModule.addEventListener(BCVideoEvent.STREAM_START,onStreamStartWrapper)
};
oh.SingleVideoPlayerHandler.prototype._onContentLoad=function(evt){if(this._autoStarts){this._trackAnalytics()
}};
oh.SingleVideoPlayerHandler.prototype._onStreamStart=function(evt){if(!this._autoStarts){this._trackAnalytics()
}};
oh.SingleVideoPlayerHandler.prototype._trackAnalytics=function(){oh.utils.analytics.google.trackByMainTrackingCode(this._trackingIdPrefix+this._currentVideoId)
};
oh.SingleVideoPlayerHandler.prototype.loadVideoById=function(videoId){this._videoPlayerModule.loadVideo(videoId);
this._currentVideoId=videoId
};
oh.namespace("oh.marketingSite.brightcove");
oh.TabbedMultiVideoPlayerHandler=function(argsHash){var brcvExperience=argsHash.brcvExperience;
this._initialVideoId=argsHash.initialVideoId;
var playerPlaylistTabsId=argsHash.playerPlaylistTabsId;
var playerVideoListId=argsHash.playerVideoListId;
this._experienceModule=brcvExperience.getModule(APIModules.EXPERIENCE);
this._videoPlayerModule=brcvExperience.getModule(APIModules.VIDEO_PLAYER);
this._contentModule=brcvExperience.getModule(APIModules.CONTENT);
this._playlistTabs=this._experienceModule.getElementByID(playerPlaylistTabsId);
this._videoList=this._experienceModule.getElementByID(playerVideoListId);
this._onPlayListTabPropertyChangeWrapper=null;
this._currentVideoId=null;
this._atLeastOneOtherVideoSelected=false;
var _this=this;
var onContentLoadWrapper=function(evt){_this._onContentLoad(evt)
};
var onStreamStartWrapper=function(evt){_this._onStreamStart(evt)
};
this._onPlayListTabPropertyChangeWrapper=function(evt){_this._onPlayListTabPropertyChange(evt)
};
this._experienceModule.addEventListener(BCExperienceEvent.CONTENT_LOAD,onContentLoadWrapper);
this._videoPlayerModule.addEventListener(BCVideoEvent.STREAM_START,onStreamStartWrapper)
};
oh.TabbedMultiVideoPlayerHandler.prototype._onContentLoad=function(evt){this._videoPlayerModule.loadVideo(this._initialVideoId)
};
oh.TabbedMultiVideoPlayerHandler.prototype._onStreamStart=function(evt){if(this._currentVideoId!=this._getCurrentVideoId()){this._currentVideoId=this._getCurrentVideoId();
if((this._currentVideoId==this._initialVideoId)&&!this._atLeastOneOtherVideoSelected){this._selectInitialVideoAndList()
}else{this._atLeastOneOtherVideoSelected=true
}}};
oh.TabbedMultiVideoPlayerHandler.prototype._getCurrentVideoId=function(){var currentVideoDTO=this._videoPlayerModule.getCurrentVideo();
var currentVideoId=currentVideoDTO.id;
return currentVideoId
};
oh.TabbedMultiVideoPlayerHandler.prototype._getPlaylistIdForVideo=function(videoId){var playlistId=null;
var allPlaylists=this._contentModule.getAllPlaylists();
for(var i=0;
i<allPlaylists.length;
i++){var thisPlaylist=allPlaylists[i];
var thisPlaylistId=thisPlaylist.id;
var videoIds=thisPlaylist.videoIds;
for(var j=0;
j<videoIds.length;
j++){var thisVideoId=videoIds[j];
if(thisVideoId==videoId){playlistId=thisPlaylistId;
break
}}}return playlistId
};
oh.TabbedMultiVideoPlayerHandler.prototype._selectInitialVideoAndList=function(){var videoId=this._getCurrentVideoId();
var playlistId=this._getPlaylistIdForVideo(videoId);
this._playlistTabs.addEventListener("propertyChange",this._onPlayListTabPropertyChangeWrapper);
var playlistTabsData=this._playlistTabs.getData();
for(var listTabKey in playlistTabsData){var listTab=playlistTabsData[listTabKey];
var listTabId=listTab.id;
if(listTabId&&(listTabId==playlistId)){this._playlistTabs.setSelectedIndex(listTabKey)
}}};
oh.TabbedMultiVideoPlayerHandler.prototype._onPlayListTabPropertyChange=function(evt){this._playlistTabs.removeEventListener("propertyChange",this._onPlayListTabPropertyChangeWrapper);
var videoId=this._getCurrentVideoId();
var videoListData=this._videoList.getData();
for(var videoListingKey in videoListData){var videoListing=videoListData[videoListingKey];
var videoListingId=videoListing.id;
if(videoListingId&&(videoListingId==videoId)){this._videoList.setSelectedIndex(videoListingKey);
this._videoList.scrollTo(videoListingKey)
}}};
(function($){oh.Template=oh.Awesome.extend({template:null,constructor:function(template,instanceHandle,classHandle,logMethod){this.base(instanceHandle,classHandle||"oh.Template",logMethod||"info");
this.template=template
},getTemplate:function(){return this.template
},render:function(vars){var key="";
var template=this.getTemplate();
var regEx=null;
var tag="";
for(key in vars){if(vars.hasOwnProperty(key)){tag="\\$\\{"+key+"\\}";
regEx=new RegExp(tag,"g");
template=template.replace(regEx,vars[key])
}}return template
}});
oh.Template.templates={};
oh.Template.create=function(name,template,instanceHandle,classHandle,logMethod){this.templates[name]=new this(template,instanceHandle,classHandle,logMethod);
return this.templates[name]
};
oh.Template.exists=function(name){return !!this.templates[name]
};
oh.Template.get=function(name){if(!this.templates[name]){return null
}return this.templates[name]
}
})(jQuery);
(function($){oh.TimingLogger=oh.Awesome.extend({constructor:function(collectionName,description,logMethod){this.base(collectionName,"oh.TimingLogger",logMethod||"info");
this.collectionName=collectionName;
this.description=description;
this.logMethod=logMethod;
this.benchmarks=[]
},addBenchmark:function(name){this.benchmarks.push({name:name,date:new Date()})
},logBenchmarks:function(){var indentMarkup="&nbsp;&nbsp;";
this.log("***** Timing benchmarks: "+this.collectionName+" *****");
if(this.description){this.log(indentMarkup+this.description)
}var numBenchmarks=this.benchmarks.length;
if(numBenchmarks>0){var cumulativeDiff=0;
for(var i=0;
i<numBenchmarks-1;
i++){var benchmark1=this.benchmarks[i];
var benchmark2=this.benchmarks[i+1];
var diff=benchmark2.date.getTime()-benchmark1.date.getTime();
cumulativeDiff+=diff;
this.log(indentMarkup+'"'+benchmark1.name+'" to "'+benchmark2.name+'": '+diff+" ms - "+cumulativeDiff+" ms")
}this.log(indentMarkup+"Total time: "+cumulativeDiff+" ms")
}else{this.log(indentMarkup+"No benchmarks")
}this.log("**********")
}})
})(jQuery);
(function($){oh.namespace("oh.core.agent");
$(function(){oh.core.agent.viewport=function(){var height=0;
var width=0;
var top=0;
var bottom=0;
var left=0;
var right=0;
var getHeight=function(){return height
};
var getWidth=function(){return width
};
var getTop=function(){return top
};
var getBottom=function(){return bottom
};
var getLeft=function(){return left
};
var getRight=function(){return right
};
var isAbove=function(y){return y<top
};
var isBelow=function(y){return y>bottom
};
var isLeft=function(x){return x<left
};
var isRight=function(x){return x>right
};
var isInside=function(top,right,bottom,left){return(isAbove(top)||isBelow(bottom)||isLeft(left)||isRight(right))?false:true
};
var isOutside=function(top,right,bottom,left){return !isInside(top,right,bottom,left)
};
var calculate=function(){height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
top=$(document).scrollTop();
bottom=top+height;
left=$(document).scrollLeft();
right=left+width;
debug()
};
var debug=function(methodname){methodname=methodname||"oh.core.agent.viewport.calculate"
};
var init=function(){$(window).resize(function(){calculate()
});
$(window).scroll(function(){calculate()
});
calculate()
};
return{init:init,height:getHeight,width:getWidth,top:getTop,bottom:getBottom,left:getLeft,right:getRight,isAbove:isAbove,isBelow:isBelow,isLeft:isLeft,isRight:isRight,inside:isInside,outside:isOutside,debug:debug,calculate:calculate}
}()
})
})(jQuery);
(function($){oh.namespace("oh.core");
oh.core.log=function(){var report=function(func,err,handle,params){$(function(){if(canDisplayReport(func)){var errMsg=mixedToString(err);
if(params){errMsg+=mixedToString(params)
}if(handle){errMsg=handle+" -> "+errMsg
}if(top.oh&&top.oh.core&&top.oh.core.blackbird){func=top.oh.core.blackbird[func];
if(func){func(errMsg)
}}}})
};
var prettyObjectToString=function(o){var str="<pre>";
str+=oh.utils.objects.objectToString(o,{escapeHTML:true});
return str+"</pre>"
};
var mixedToString=function(x){var str="";
if(x!==null&&oh.utils.objects.isObject(x)){if(x.message){str=oh.utils.strings.escapeHTML(x.message)
}else{str=prettyObjectToString(x)
}}else{if(typeof (x)=="function"){str="<pre>"+String(x)+"</pre>"
}else{if(typeof (x)=="string"){str=oh.utils.strings.escapeHTML(x)
}else{str=oh.utils.strings.escapeHTML(String(x))
}}}return str
};
var canDisplayReport=function(func){return(oh.isDevSite()||func=="warn"||func=="error")
};
var _this={info:function(err,handle,params){report("info",err,handle,params)
},warn:function(err,handle,params){report("warn",err,handle,params)
},debug:function(err,handle,params){report("debug",err,handle,params)
},error:function(err,handle,params){report("error",err,handle,params)
},profile:function(label){top.oh.core.blackbird.profile(label)
}};
return _this
}()
})(jQuery);
oh.namespace("oh.core.msg");
oh.core.msg={};
oh.core.msg._VALID_TOPIC_NAME_REGEXP=/\S/;
oh.core.msg._topics={};
oh.core.msg.subscribe=function(topic,callback){var initialErrorMessage="oh.core.msg.subscribe():\n";
var errorMessage=initialErrorMessage;
if(("string"!==typeof (topic))||!oh.core.msg._VALID_TOPIC_NAME_REGEXP.test(topic)){errorMessage+="  The topic input must be a non-blank string.\n"
}if("function"!==typeof (callback)){errorMessage+="  The callback input must be a function.\n"
}if(errorMessage==initialErrorMessage){if("undefined"===typeof (oh.core.msg._topics[topic])){oh.core.msg._topics[topic]=[]
}var topicFunctions=oh.core.msg._topics[topic];
var numFunctionsForTopic=0;
for(var i=0;
i<topicFunctions.length;
i++){if(topicFunctions[i]==callback){numFunctionsForTopic++
}}if(0===numFunctionsForTopic){topicFunctions.push(callback)
}}if(errorMessage!==initialErrorMessage){throw (new Error(errorMessage))
}};
oh.core.msg.unsubscribe=function(topic,callback){var initialErrorMessage="oh.core.msg.unsubscribe():\n";
var errorMessage=initialErrorMessage;
if(("string"!==typeof (topic))||!oh.core.msg._VALID_TOPIC_NAME_REGEXP.test(topic)){errorMessage+="  The topic input must be a non-blank string.\n"
}if("function"!==typeof (callback)){errorMessage+="  The callback input must be a function.\n"
}var subscriptionExists=false;
if(errorMessage===initialErrorMessage){var topicFunctions=oh.core.msg._topics[topic];
if("undefined"!=typeof (topicFunctions)){var deleteIndex=-1;
for(var i=0;
i<topicFunctions.length;
i++){if(topicFunctions[i]===callback){deleteIndex=i
}}topicFunctions=topicFunctions.splice(deleteIndex,1);
subscriptionExists=(deleteIndex!=-1)
}}if(errorMessage===initialErrorMessage){return subscriptionExists
}else{throw (new Error(errorMessage))
}};
oh.core.msg.publish=function(topic,params){var initialErrorMessage="oh.core.msg.publish():\n";
var errorMessage=initialErrorMessage;
if(("string"!==typeof (topic))||!oh.core.msg._VALID_TOPIC_NAME_REGEXP.test(topic)){errorMessage+="  The topic input must be a non-blank string.\n"
}if(("undefined"!==typeof (params))&&("object"!==typeof (params))){errorMessage+="  The params argument must either be undefined or an object.\n"
}var topicExists=false;
if(errorMessage===initialErrorMessage){if(("undefined"===typeof (params))||(null===params)){params={}
}var topicFunctions=oh.core.msg._topics[topic];
if("undefined"!==typeof (topicFunctions)){topicExists=true;
for(var i=0;
i<topicFunctions.length;
i++){var topicFunction=topicFunctions[i];
topicFunction.call(this,params)
}}}if(errorMessage===initialErrorMessage){return topicExists
}else{throw (new Error(errorMessage))
}};
(function($){oh.namespace("oh.core.template")
})(jQuery);
oh.namespace("oh.core.transport");
oh.core.transport.JSON_DATA_TYPE="json";
oh.core.transport.XML_DATA_TYPE="xml";
oh.core.transport.JSON_URL="/j";
oh.core.transport.GENERAL_URL="/m";
oh.core.transport.cleanXmlRequestBody=function(requestBody){var requestBodyAttributeDelimiterInRegExp=/'|"/g;
var requestBodyAttributeDelimiterOut="\u0006";
return requestBody.replace(requestBodyAttributeDelimiterInRegExp,requestBodyAttributeDelimiterOut)
};
oh.core.transport.postToWebMessage=function(){if(arguments.length>1){return oh.core.transport.postToWebMessageOld.apply(null,arguments)
}else{return oh.core.transport.postToWebMessageNew.apply(null,arguments)
}};
oh.core.transport.postToWebMessageWithOptions=function(mutableOptions,callerOptions,immutableOptions){var options=$.extend(true,{},mutableOptions,callerOptions);
options=$.extend(true,{},immutableOptions,options);
return oh.core.transport.postToWebMessage(options)
};
oh.core.transport.postToWebMessageNew=function(options){var METHODNAME="oh.core.transport.postToWebMessageNew";
var synchronousResponse=null;
if(options){var action=options.action;
var data=options.data;
var async=!(false===options.async);
var dataType=options.dataType||oh.core.transport.JSON_DATA_TYPE;
var xmlStylesheet=options.xmlStylesheet;
var url=options.url||oh.core.transport.GENERAL_URL;
var getRequestBody=null;
var processServerSuccessResponse=null;
var defaultErrorCallback=options.defaultErrorCallback||function(errorStatus,errorThrown,elapsedTime){oh.core.log.error("Error posting request to the WebMessage servlet.",METHODNAME,{action:action,dataType:dataType,errorStatus:errorStatus,errorThrown:errorThrown,elapsedTime:elapsedTime});
return null
};
var getElapsedTimeSince=function(startTime){return(new Date()).getTime()-startTime
};
var httpSuccessCallbackWrapper=function(response,respStatus){var elapsedTime=getElapsedTimeSince(this.requestStartTime);
var successResponse=processServerSuccessResponse(response);
var respAction=successResponse[0];
var respData=successResponse[1];
var respErrors=successResponse[2];
if(!oh.utils.objects.objectHasProperties(respErrors)){if(options.successCallback){synchronousResponse=options.successCallback.apply(null,[respAction,respData,elapsedTime])
}}else{var errorArguments=[respAction,respErrors,elapsedTime];
var messageErrorStatus=null;
var errorHandled=false;
if("timeout"===respErrors.action){if(options.messageTimeoutCallback){synchronousResponse=options.messageTimeoutCallback.apply(null,errorArguments);
errorHandled=true
}else{messageErrorStatus="Timeout Message Error"
}}else{if("denied"===respErrors.access){if(options.messageAccessDeniedCallback){synchronousResponse=options.messageAccessDeniedCallback.apply(null,errorArguments);
errorHandled=true
}else{messageErrorStatus="Access Ddenied Message Error"
}}}if(!errorHandled){if(options.messageErrorCallback){synchronousResponse=options.messageErrorCallback.apply(null,errorArguments);
errorHandled=true
}else{messageErrorStatus="Message Error"
}}if(!errorHandled&&(null!==messageErrorStatus)){synchronousResponse=defaultErrorCallback.apply(null,[messageErrorStatus,null,elapsedTime])
}}};
var httpErrorCallbackWrapper=function(xhr,errorStatus,errorThrown){var elapsedTime=getElapsedTimeSince(this.requestStartTime);
if("timeout"===errorStatus){if(options.httpTimeoutCallback){synchronousResponse=options.httpTimeoutCallback.apply(null,[xhr,errorStatus,errorThrown,elapsedTime])
}}else{if(options.httpErrorCallback){synchronousResponse=options.httpErrorCallback.apply(null,[errorStatus,errorThrown,elapsedTime])
}else{synchronousResponse=defaultErrorCallback.apply(null,[errorStatus,errorThrown,elapsedTime])
}}};
var httpCompleteCallbackWrapper=function(xhr,respStatus){var elapsedTime=getElapsedTimeSince(this.requestStartTime);
var completeResponse=options.completeCallback.apply(null,[xhr,respStatus,elapsedTime]);
if(!!options.returnCompleteResponse){synchronousResponse=completeResponse
}};
var requestData={};
if(oh.core.transport.JSON_DATA_TYPE===dataType){getRequestBody=function(){var ezMessage={EZMessage:{action:action,data:data}};
return JSON.stringify(ezMessage)
};
processServerSuccessResponse=function(response){var respAction=response.EZMessage.action||"";
var respData=response.EZMessage.data||{};
var respErrors=response.EZMessage.errors||{};
return[respAction,respData,respErrors]
}
}else{if(oh.core.transport.XML_DATA_TYPE===dataType){if(xmlStylesheet){requestData.p=xmlStylesheet
}getRequestBody=function(){var ezMessage={action:action,data:data};
var json2xmlOptions={rootTagName:"EZMessage",attributes:["action"]};
var ezMessageMarkup=$.json2xml(ezMessage,json2xmlOptions);
ezMessageMarkup=oh.core.transport.cleanXmlRequestBody(ezMessageMarkup);
return ezMessageMarkup
};
processServerSuccessResponse=function(response){var $ezMessage=$.xml2json(response);
var respAction=$ezMessage.action||"";
var respData=$ezMessage.data||{};
var respErrors=$ezMessage.errors||{};
return[respAction,respData,respErrors]
}
}else{oh.core.log.error("Unrecognized data type.",METHODNAME,{action:action,dataType:dataType})
}}requestData.r=getRequestBody();
var ajaxOptions={url:url,type:"POST",async:async,dataType:dataType,data:requestData,success:httpSuccessCallbackWrapper,error:httpErrorCallbackWrapper,beforeSend:function(xhr){this.requestStartTime=(new Date()).getTime()
}};
if(options.completeCallback){ajaxOptions.complete=httpCompleteCallbackWrapper
}if(async&&options.httpTimeoutPeriod){ajaxOptions.timeout=options.httpTimeoutPeriod
}oh.core.log.info("Posting request to the WebMessage servlet.",METHODNAME,{action:action,ajaxOptions:ajaxOptions});
var xhr=$.ajax(ajaxOptions)
}return synchronousResponse
};
oh.core.transport.postToWebMessageOld=function(action,data,dataType,successCallback,errorCallback,options){dataType=dataType||oh.core.transport.JSON_DATA_TYPE;
var async=true;
if(options){async=options.async
}var requestData={};
var requestBody=null;
var getSuccessArgs=null;
var returnValue=null;
var successCallbackWrapper=function(response,status){if(successCallback){returnValue=successCallback.apply(null,getSuccessArgs(response))
}};
var errorCallbackWrapper=function(xhr,status,error){if(errorCallback){returnValue=errorCallback.call(null,xhr,status,error)
}};
var ezMessage=null;
if(oh.core.transport.JSON_DATA_TYPE===dataType){ezMessage={EZMessage:{action:action,data:data}};
requestBody=JSON.stringify(ezMessage);
getSuccessArgs=function(response){var respAction=response.EZMessage.action||"";
var respData=response.EZMessage.data||{};
var respErrors=response.EZMessage.errors||{};
return[respAction,respData,respErrors]
}
}else{if(oh.core.transport.XML_DATA_TYPE===dataType){ezMessage="<EZMessage action='"+action+"'>";
ezMessage+="<data>";
for(var key in data){var value=data[key];
ezMessage+="<"+key+">"+value+"</"+key+">"
}ezMessage+="</data>";
ezMessage+="</EZMessage>";
ezMessage=oh.core.transport.cleanXmlRequestBody(ezMessage);
requestBody=ezMessage;
if(options&&options.stylesheet){requestData.p=options.stylesheet
}getSuccessArgs=function(response){var $ezMessage=$.xml2json(response);
var respAction=$ezMessage.action||"";
var respData=$ezMessage.data||{};
var respErrors=$ezMessage.errors||{};
return[respAction,respData,respErrors]
}
}else{}}requestData.r=requestBody;
var ajaxOptions={url:"/m",type:"POST",async:async,dataType:dataType,data:requestData,success:successCallbackWrapper,error:errorCallbackWrapper};
var synchronousResponse=$.ajax(ajaxOptions);
return returnValue
};
oh.core.transport.getKeepAliveTimer=function(renewFunction,failureFunction,KAMax,warningIndex,warningFunction){var METHODNAME="oh.core.transport.getKeepAliveTimer";
var KATimer=null;
var KACount=0;
var KAMax=KAMax||30;
var start=function(){clearTimeout(KATimer);
oh.core.log.info("Timer cleared",METHODNAME,{KATimer:KATimer,KACount:KACount});
if(KACount>0){if(KACount>KAMax){oh.core.log.info("Running failure",METHODNAME);
failureFunction()
}else{if(warningFunction&&KACount===warningIndex){oh.core.log.info("Running warning",METHODNAME);
warningFunction()
}oh.core.log.info("Running renew",METHODNAME);
renewFunction()
}}var interval=top.oh.legacyTool.refreshRates.getKeepAliveRate();
KATimer=setTimeout(function(){start()
},interval);
KACount++;
oh.core.log.info("Timer instantiated and count incremented",METHODNAME,{KATimer:KATimer,KACount:KACount})
};
var stop=function(){clearTimeout(KATimer)
};
var reset=function(){stop();
KACount=0;
start()
};
return{start:start,stop:stop,reset:reset}
};
(function($){oh.namespace("oh.core.widget");
oh.core.widget.dialog=function(){var defaults={bgiframe:true,resizable:false};
return function(content,options){var opts=$.extend(true,{},defaults,options);
var $dialog=$("body").find(":first").before('<div class="modal">'+content+"</div>").prev();
$dialog.dialog(opts);
return $dialog
}
}();
oh.core.widget.confirm=function(content,yesCallback,noCallback){if($.fn.dialog){oh.core.widget.dialog(content,{title:"Please Confirm",buttons:{No:function(){var $modal=$(this);
if(noCallback){noCallback.call($modal)
}$modal.dialog("close")
},Yes:function(){var $modal=$(this);
if(yesCallback){yesCallback.call($modal)
}$modal.dialog("close")
}}})
}else{oh.core.log.error("jQuery UI Dialog widget required","oh.core.widget.confirm")
}};
oh.core.widget.alert=function(content){if($.fn.dialog){oh.core.widget.dialog(content,{title:"Alert",buttons:{OK:function(){var $modal=$(this);
$modal.dialog("close")
}}})
}else{oh.core.log.warn("jQuery UI Dialog widget required, so defaulting to JS alert","oh.core.widget.confirm");
alert(content)
}};
oh.core.dom=oh.core.widget
})(jQuery);
(function($){oh.namespace("oh.utils.analytics");
oh.utils.analytics.loadRemoteLibrary=function(libraryUrl,callback){$.getScript(libraryUrl,function(){callback.call(null)
})
};
oh.utils.analytics.getInstance=function(serviceName){if(oh.utils.analytics[serviceName]){return oh.utils.analytics[serviceName]
}return null
}
})(jQuery);
(function($){oh.namespace("oh.utils.analytics.dart");
var isAvailable=!oh.isDevSite()||false;
var baseUrl="https://fls.doubleclick.net/activityi";
var codes={startApplication:{src:"2569617",type:"accou162",cat:"creat797"},createLogin:{src:"2569617",type:"accou162",cat:"login598"},completeApplication:{src:"2569617",type:"accou162",cat:"compl626"},publisherTag:{src:"2569617",type:"cpaaz920",cat:"cpata559"},investingChannel:{src:"1803519",type:"optio776",cat:"q1con817"}};
var iframe=null;
var getIframe=function(params){iframe=document.createElement("iframe");
return iframe
};
var getParams=function(codeName){if(codes[codeName]){return codes[codeName]
}else{return null
}};
var makeCallToDart=function(params){oh.core.log.info("load the config file.","oh.utils.analytics.dart.makeCallToDart",{params:params});
var axel=(Math.random())*10000000000000;
getIframe(params);
iframe.src=baseUrl+";src="+params.src+";type="+params.type+";cat="+params.cat+";ord="+axel+"?;~oref="+encodeURIComponent(location.href)+";";
iframe.width=1;
iframe.height=1;
document.body.appendChild(iframe)
};
oh.utils.analytics.dart.trackEvent=function(code){if(isAvailable){$(function(){var params=getParams(code);
makeCallToDart(params)
})
}};
oh.utils.analytics.dart.trackPage=function(params){if(isAvailable){$(function(){makeCallToDart(params)
})
}}
})(jQuery);
(function($){oh.namespace("oh.utils.analytics.google");
oh.utils.analytics.google.trackingCodes={main:"UA-7306337-1",abTesting:"UA-7306337-3",landingPage:"UA-7306337-4",tradingTool:"UA-7306337-7"};
oh.utils.analytics.google.analyticsReady=false;
oh.utils.analytics.google.libraryRequested=false;
oh.utils.analytics.google.trackingQueue=[];
oh.utils.analytics.google.handleLibraryLoaded=function(){oh.utils.analytics.google.analyticsReady=true;
$.each(oh.utils.analytics.google.trackingQueue,function(i,method){method.call(null)
})
};
oh.utils.analytics.google.getRemoteLibraryUrl=function(){var protocolAndSubdomain=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");
var libraryUrl=protocolAndSubdomain+"google-analytics.com/ga.js";
return libraryUrl
};
oh.utils.analytics.google.init=function(){if(!oh.utils.analytics.google.libraryRequested){oh.utils.analytics.google.libraryRequested=true;
$(function(){oh.utils.analytics.loadRemoteLibrary(oh.utils.analytics.google.getRemoteLibraryUrl(),oh.utils.analytics.google.handleLibraryLoaded)
})
}};
oh.utils.analytics.google.lazyLoad=function(){if(!oh.utils.analytics.google.analyticsReady){oh.utils.analytics.google.init()
}};
var getTracker=function(trackingCode){return _gat._getTracker(trackingCode)
};
var trackByTrackingCode=function(trackingCode,value){try{var pageTracker=getTracker(trackingCode);
pageTracker._trackPageview(value)
}catch(err){if(oh.core&&oh.core.log){oh.core.log.error("Error attempting to track analytics.","oh.utils.analytics.google.trackByTrackingCode",{trackingCode:trackingCode,value:value,err:err})
}}};
var setVar=function(trackingCode,value){trackingCode=trackingCode||oh.utils.analytics.google.trackingCodes.main;
var pageTracker=getTracker(trackingCode);
pageTracker._setVar(value)
};
oh.utils.analytics.google.trackByTrackingCode=function(trackingCode,value){oh.utils.analytics.google.lazyLoad();
if(oh.utils.analytics.google.analyticsReady){trackByTrackingCode(trackingCode,value)
}else{oh.utils.analytics.google.trackingQueue.push(function(){trackByTrackingCode(trackingCode,value)
})
}};
oh.utils.analytics.google.trackByMainTrackingCode=function(value){oh.utils.analytics.google.trackByTrackingCode(oh.utils.analytics.google.trackingCodes.main,value)
};
oh.utils.analytics.google.setVar=function(trackingCode,value){oh.utils.analytics.google.lazyLoad();
if(oh.utils.analytics.google.analyticsReady){setVar(trackingCode,value)
}else{oh.utils.analytics.google.trackingQueue.push(function(){setVar(trackingCode,value)
})
}}
})(jQuery);
(function($){oh.namespace("oh.utils.analytics.microsoft");
microsoft_adcenterconversion_domainid=763315;
microsoft_adcenterconversion_cp=5050;
microsoft_adcenterconversionparams=["dedup=1"];
var isAvailable=!oh.isDevSite()||false;
var codes={completeApplication:{imageSource:"https://"+microsoft_adcenterconversion_domainid+".r.msn.com/?type=1&cp=1&"+microsoft_adcenterconversionparams[0]}};
var setUniversalTag=function(params){var thisImage=getimageTag();
thisImage.src=params.imageSource
};
var getParams=function(codeName){if(codes[codeName]){return codes[codeName]
}else{return null
}};
var getimageTag=function(){imageTag=document.createElement("img");
return imageTag
};
oh.utils.analytics.microsoft.trackEvent=function(code){if(isAvailable){$(function(){var params=getParams(code);
if(params){setUniversalTag(params)
}})
}};
oh.utils.analytics.microsoft.trackPage=function(params){if(isAvailable){$(function(){setUniversalTag(params)
})
}}
})(jQuery);
(function($){oh.namespace("oh.utils.analytics.yahoo");
var ysm_accountid="1IBUABI6FETVQ2TLRHC3954OAQ8";
var isAvailable=!oh.isDevSite()||false;
var codes={completeApplication:{segementId:"conversion",segmentValue:"transId=,currency=,amount=",segmentHost:"data.wa.perf.overture.com",segmentNameSpace:"ysmcc.js",segmentImage:"/image/ysmcc.gif",segmentVersion:"1.9"}};
var setUniversalTag=function(params){var ysm_customData={};
ysm_customData[params.segementId]=params.segmentValue;
makeCall(params,ysm_customData)
};
var ysm0=function(locUrl,refUrl,customData){var hashValue=0;
var hashString="";
var maxValue=16000000;
if(customData!=null&&typeof (hashString.charCodeAt)=="function"){hashString=customData;
if(locUrl!=null){hashString+=locUrl
}if(refUrl!=null){hashString+=refUrl
}for(var i=0;
i<hashString.length;
i++){hashValue=11*hashValue+hashString.charCodeAt(i);
if(hashValue>=maxValue){hashValue=hashValue%maxValue
}}}return hashValue
};
var ysm1=function(name){var cookie=document.cookie;
var i=-1;
var j=0;
while((i=cookie.indexOf(name,j))!=-1){if(i==0){break
}else{if(i>1&&i<cookie.length){if(cookie.charAt(i-1)==" "&&cookie.charAt(i-2)==";"){break
}}}j=i+1
}if(i==-1){return""
}var s=i+name.length;
var e=cookie.indexOf(";",s);
if(e==-1){e=cookie.length
}return cookie.substring(s,e)
};
var ysm2=function(obj,f,i){if(i>20){return""
}var e="";
for(p in obj){if(typeof (p)=="string"&&p!=null){var x=(f!=""?f+"."+p:"."+p);
if(typeof (obj[p])=="object"&&obj[p]!=null){e+=ysm2(obj[p],x,i+1)
}else{if(typeof (obj[p])=="string"&&obj[p]!=null){e+=x+":"+escape(obj[p])+";"
}}}}return e
};
var getParams=function(codeName){if(codes[codeName]){return codes[codeName]
}else{return null
}};
var getImageTag=function(){var head=document.getElementsByTagName("head")[0];
imageTag=document.createElement("script");
head.appendChild(imageTag);
return imageTag
};
var setConversionTag=function(params){var ysm_customData={};
ysm_customData[params.segementId]=params.segmentValue;
makeCall(params,ysm_customData)
};
var makeCall=function(params,ysm_customData){var cookieName="ysm_bbk"+ysm_accountid;
var ohc=ysm1(cookieName+"=");
var c=ysm2(ysm_customData,"",0);
if(c.length>0){var cd=escape(c.toString());
var hc=ysm0(document.location.toString(),document.referrer.toString(),cd);
if(hc==0||hc!=ohc){getImageTag();
var newDate=new Date();
var yahooAnalyticsSource="//"+params.segmentHost+params.segmentImage+"?pv=1&cv=1&sn="+params.segmentNameSpace+"&sv="+params.segmentVersion+"&st="+newDate.getTime().toString()+"&ad="+ysm_accountid+"&cs="+cd;
imageTag.src=yahooAnalyticsSource;
oh.utils.cookies.setValue(cookieName,hc,"At End Of Session","/")
}}};
oh.utils.analytics.yahoo.trackEvent=function(code){if(isAvailable){$(function(){var params=getParams(code);
if(params){setConversionTag(params)
}})
}};
oh.utils.analytics.yahoo.trackPage=function(params){if(isAvailable){$(function(){setUniversalTag(params)
})
}}
})(jQuery);
(function($){oh.namespace("oh.utils.cookies");
oh.utils.cookies.getDefaultPath=function(){return"/"
};
oh.utils.cookies.getCurrentPort=function(){alert(window.location.host);
return window.location.host
};
oh.utils.cookies.setValue=function(name,value,expires,path){path=path||oh.utils.cookies.getDefaultPath();
expires=expires||"365";
$.cookie(name,value,{path:path,expires:expires})
};
oh.utils.cookies.getValue=function(name){return $.cookie(name)
};
oh.utils.cookies.testValue=function(name,values){return $.grep($.makeArray(values),function(value,i){return($.cookie(name)==value)
}).length>0
};
oh.utils.cookies.clear=function(name,path){path=path||oh.utils.cookies.getDefaultPath();
$.cookie(name,null,{path:path})
}
})(jQuery);
(function($){oh.namespace("oh.utils.dates");
oh.utils.dates.formatMonthOrDayAsTwoDigit=function(s){s=String(s);
return(s.length===1?"0"+s:s)
};
oh.utils.dates.getDateObjectForFirstDayOfMonth=function(dateObject){var METHODNAME="getDateObjectForFirstDayOfMonth";
if(!(dateObject instanceof Date)){oh.core.log.error("Invalid date object",METHODNAME,{dateObject:dateObject,"typeof dateObject":typeof dateObject});
return null
}var ms=dateObject.setDate(1);
oh.core.log.info("Milliseconds",METHODNAME,{ms:ms});
return new Date(dateObject.setDate(1))
};
oh.utils.dates.getDaysInMilliseconds=function(days){var METHODNAME="getDaysInMilliseconds";
if(isNaN(days)){oh.core.log.error("Invalid number for days parameter",METHODNAME,{days:days,"typeof days":typeof days});
return null
}return(days*1000*60*60*24)
};
oh.utils.dates.getDaysInMonth=function(month,year){var isLeap=((year%4===0)&&(year%100!==0||year%400===0));
var days={"01":"31","02":(isLeap?29:28),"03":"31","04":"30","05":"31","06":"30","07":"31","08":"31","09":"30","10":"31","11":"30","12":"31"};
var daysInMonth=days[month];
if(!daysInMonth){oh.core.log.error("Cant give meaningful days in month","getDaysInMonth",{month:month,year:year});
return null
}return daysInMonth
};
oh.utils.dates.getFormattedDateStringFromDateObject=function(dateObject){var METHODNAME="getFormattedDateStringFromDateObject";
if(!(dateObject instanceof Date)){oh.core.log.error("Invalid date object",METHODNAME,{dateObject:dateObject,"typeof dateObject":typeof dateObject});
return null
}var month=oh.utils.dates.formatMonthOrDayAsTwoDigit(dateObject.getMonth()+1);
var date=oh.utils.dates.formatMonthOrDayAsTwoDigit(dateObject.getDate());
var year=String(dateObject.getFullYear());
var dateString=month+"/"+date+"/"+year;
oh.core.log.info("Formatted date",METHODNAME,{dateString:dateString});
return dateString
};
oh.utils.dates.getDifferentialDateObject=function(dateObject,differential){if(!(dateObject instanceof Date)){oh.core.log.error("Invalid date object",METHODNAME,{dateObject:dateObject,"typeof dateObject":typeof dateObject});
return null
}if(isNaN(differential)){oh.core.log.error("Invalid differential",METHODNAME,{differential:differential,"typeof differential":typeof differential});
return null
}var ms=dateObject.getTime();
var diff=oh.utils.dates.getDaysInMilliseconds(differential);
return new Date(ms+diff)
};
oh.utils.dates.getTimeStamp=function(){return new Date().getTime()
};
oh.utils.dates.setYearForCopyright=function(selector){if(selector===undefined){return 
}var date=new Date();
var year=date.getFullYear();
var yearToString=year.toString();
var abbrYear;
if(yearToString[2]==0){abbrYear=yearToString[3]
}else{abbrYear=yearToString.substring(2,4)
}$(selector).html(abbrYear)
}
})(jQuery);
(function($){oh.namespace("oh.utils.dom");
oh.utils.dom.bindDatepicker=function(labelSelector,uiOptions){var METHODNAME="oh.utils.dom.bindDatepicker";
var $label=$(labelSelector);
var $input=$label.find("input");
var logProps={labelSelector:String(labelSelector),labelLength:$label.length,inputLength:$input.length};
if($label.length===0||$input.length===0){oh.core.log.error("Can't find input to turn into datepicker",METHODNAME,logProps);
return 
}var uiDefaults={constrainInput:true,changeMonth:true,changeYear:true,showOn:"button",buttonImage:"/tool/current/asset/img/app/tradingTool/flyovers/tradingTicket/calendar.gif",buttonImageOnly:true,buttonText:"Click to choose date",showAnim:""};
var opts=$.extend(true,{},uiDefaults,uiOptions);
var $datepicker=$input.datepicker(opts);
$("#ui-datepicker-div").bgiframe()
};
oh.utils.dom.getElementInFrame=function(frameSelector,elementSelector){var frameDoc=oh.utils.dom.getFrameDocumentElement(frameSelector);
return $(elementSelector,frameDoc)
};
oh.utils.dom.getFrameDocumentElement=function(frameSelector){var $frame=$(frameSelector);
var doc=null;
if($frame.length>0){var frame=$frame[0];
doc=(frame.contentWindow?frame.contentWindow.document:(frame.contentDocument?frame.contentDocument:frame.document))
}return doc
};
oh.utils.dom.getUniqueId=function(prefix){var timeStamp=new String(oh.utils.dates.getTimeStamp());
var rand=new String(Math.floor((Math.random()*100000)));
prefix=prefix||"";
return prefix+timeStamp+rand
};
oh.utils.dom.getNodeDocumentElement=function(node){while(node=node.parentNode){if(node.nodeName==="#document"){return node
}}return null
};
oh.utils.dom.imageCache=null;
oh.utils.dom.imageCacheURLs={};
oh.utils.dom.precacheImages=function(){var img=null;
if(!oh.utils.dom.imageCache){var body=document.getElementsByTagName("body");
var cache=null;
var firstChild=null;
if(body.length){body=body[0];
cache=document.createElement("div");
cache.style.display="none";
firstChild=body.childNodes[0];
body.insertBefore(cache,firstChild);
oh.utils.dom.imageCache=cache
}cache=body=firstChild=null
}for(var i=0,length=arguments.length;
i<length;
i++){if(!oh.utils.dom.imageCacheURLs[arguments[i]]){img=document.createElement("img");
img.src=arguments[i];
oh.utils.dom.imageCache.appendChild(img);
oh.utils.dom.imageCacheURLs[arguments[i]]=true
}}};
oh.utils.dom.replaceAndReselect=function(node,content){var $node=$(node);
$node.replaceWith(content);
if($node.selector){$node=$($node.selector)
}else{oh.core.log.error("The specified node does not have a jQuery selector set.","oh.core.template.replaceWithContentAndResetNode")
}return $node
};
oh.namespace("oh.core.template");
oh.core.template.replaceWithContentAndReselectNode=oh.utils.dom.replaceAndReselect;
oh.utils.dom.setFormFieldEnablement=function(selector,enabled){var $node=$(selector);
var $inputs=$node.find(":input");
var disabledClassName="disabledFormField";
if(!!(enabled)){$node.removeClass(disabledClassName);
$inputs.removeAttr("disabled")
}else{$node.addClass(disabledClassName);
$inputs.attr("disabled","disabled")
}};
oh.utils.dom.wrapUIButtons=function(selector){var $buttons=$(".ui-dialog-buttonpane button",selector);
oh.core.log.debug("Buttons","wrapUIButtons",{length:$buttons.length,selectorLength:$(selector).length});
$buttons.wrapAll('<div class="buttonWrapper" />')
}
})(jQuery);
(function($){oh.namespace("oh.utils.formatting");
oh.utils.formatting.address=function(addressObj){if(!addressObj){oh.core.log.warn("No data","oh.utils.formatting.address",{addressObj:addressObj});
return""
}var line1=addressObj.street1||"";
var line2=addressObj.street2||"";
var city=addressObj.city||"";
var state=addressObj.state||"";
var postalCode=addressObj.postalCode||"";
var line3="";
if(city!==""||state!==""||postalCode!==""){line3=city;
if(state!==""){if(city!==""){line3+=", "
}line3+=state
}if(postalCode!==""){line3+=" "+postalCode
}}var line4=addressObj.country||"";
var break1=(line2!==""?"<br/>":"");
var break2=(line3!==""?"<br/>":"");
var break3=(line4!==""?"<br/>":"");
var formattedAddress=line1+break1+line2+break2+line3+break3+line4;
return formattedAddress
};
oh.utils.formatting.currency=function(numberString){var type=typeof (numberString);
if(type!=="string"&&type!=="number"){oh.core.log.warn("No data","oh.utils.formatting.currency",{numberString:numberString});
return""
}return"$"+Number(numberString).toFixed(2)
};
oh.utils.formatting.commaSeparatedNumber=function(value){value=(Math.round((value-0)*100))/100;
if(value==Math.floor(value)){value=value+".00"
}else{if(value*10==Math.floor(value*10)){value=value+"0"
}}value=String(value);
var splitValue=value.split(".");
var integer=splitValue[0];
var decimal=splitValue[1]?"."+splitValue[1]:".00";
var regExp=/(\d+)(\d{3})/;
while(regExp.test(integer)){integer=integer.replace(regExp,"$1,$2")
}value=integer+decimal;
if(value.charAt(0)=="-"){return"-"+value.substr(1)
}return value
};
oh.utils.formatting.personalName=function(nameObj,opts){if(!nameObj){oh.core.log.warn("No data","oh.utils.formatting.personalName",{nameObj:nameObj,opts:opts});
return""
}var firstName=nameObj.firstName||"";
var middleName=nameObj.middleName||"";
var lastName=nameObj.lastName||"";
var formattedName=firstName;
if(middleName!==""&&!opts.excludeMiddleName){formattedName+=" "+middleName
}formattedName+=" "+lastName;
return oh.utils.strings.trim(formattedName)
};
oh.utils.formatting.time=function(timeString){if(!timeString||timeString.length!=4){oh.core.log.warn("No data or incorrect data","oh.utils.formatting.time",{timeString:timeString});
return""
}var time=Number(timeString);
var hour=Number(time/100).toFixed(0);
var minutes=Number(time%100);
var meridiem="am";
minutes=(minutes!=0)?minutes:"00";
if(hour>12){hour=hour-12;
meridiem="pm"
}else{if(hour==12){meridiem="pm"
}}return hour+":"+minutes+" "+meridiem
}
})(jQuery);
(function($){oh.namespace("oh.utils.forms");
oh.utils.forms.getTriggerEvent=function(field){var $field=oh.utils.forms.getEntireInputGroup(field);
var triggerEvent=($field.is(":text, select")?"change":"click");
return triggerEvent
};
oh.utils.forms.trimFormField=function($input){var value=oh.utils.forms.getValue($input,{defaultValue:""});
if(!$input.is(":text")||value===""){return 
}var newValue=oh.utils.strings.trim(value);
if(value!==newValue){oh.core.log.info("Resetting node value!","trimFormField",{value:value,newValue:newValue});
oh.utils.forms.setValue(newValue)
}};
oh.utils.forms.FORM_INPUT_TYPE_SELECT="select";
oh.utils.forms.FORM_INPUT_TYPE_TEXT="text";
oh.utils.forms.FORM_INPUT_TYPE_CHECKRADIO="checkRadio";
oh.utils.forms.FORM_INPUT_TYPE_BUTTON="button";
oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER="getter";
oh.utils.forms.FORM_VALUE_ACCESSOR_SETTER="setter";
oh.utils.forms.hasValue=function($formNodes){var returnValue=false;
$($formNodes).each(function(){var $formNode=$(this);
var value=oh.utils.forms.getValue($formNode);
if(value!==null){returnValue=true;
return false
}});
return returnValue
};
oh.utils.forms.getValue=function(nodeOrSelector,options){var opts=$.extend({},{emptyValue:"",defaultValue:null},options);
var $node=$(nodeOrSelector);
var checkForEmpty=function(value){return value===opts.emptyValue?opts.defaultValue:value
};
var returnValue=opts.defaultValue;
if($node.length===0){oh.core.log.error("No valid node ($node.length === 0)","oh.utils.forms.getValue")
}else{var getter=oh.utils.forms.getGetter($node);
if(getter){var $completeNode=oh.utils.forms.getEntireInputGroup($node);
var getValue=getter.call(null,$completeNode);
returnValue=checkForEmpty(getValue)
}else{oh.core.log.error("No getter for this node")
}}return returnValue
};
oh.utils.forms.setValue=function(nodeOrSelector,value){var $node=$(nodeOrSelector).eq(0);
if($node.length===0){oh.core.log.error("No valid node ($node.length === 0)","oh.utils.forms.setValue")
}else{var setter=oh.utils.forms.getSetter($node);
if(setter){var $completeNode=oh.utils.forms.getEntireInputGroup($node);
setter.call(null,$completeNode,value)
}else{oh.core.log.error("No setter for this node")
}}};
oh.utils.forms.getGetter=function($node){return oh.utils.forms.getAccessor($node,"getter")
};
oh.utils.forms.getSetter=function($node){return oh.utils.forms.getAccessor($node,"setter")
};
oh.utils.forms.getAccessor=function($node,type){var accessor=null;
if(type!==oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER&&type!==oh.utils.forms.FORM_VALUE_ACCESSOR_SETTER){oh.core.log.error("Type must be "+oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER+" or "+oh.utils.forms.FORM_VALUE_ACCESSOR_SETTER,"oh.utils.forms.getAccessor")
}else{var inputType=oh.utils.forms.getInputType($node);
switch(inputType){case oh.utils.forms.FORM_INPUT_TYPE_SELECT:if(type===oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER){accessor=function($formNode){var $selected=$formNode.find("option:selected").eq(0);
return $selected.val()
}
}else{accessor=function($formNode,value){var selectedIndex=-1;
$formNode.find("option").each(function(i,option){if($(option).val()===value){selectedIndex=i;
return false
}});
if(selectedIndex>-1){$formNode.attr("selectedIndex",selectedIndex)
}else{oh.core.log.error("No option with specified value","oh.utils.forms.getAccessor:SELECT")
}}
}break;
case oh.utils.forms.FORM_INPUT_TYPE_TEXT:if(type===oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER){accessor=function($formNode){return $formNode.val()
}
}else{accessor=function($formNode,value){$formNode.attr("value",value)
}
}break;
case oh.utils.forms.FORM_INPUT_TYPE_CHECKRADIO:if(type===oh.utils.forms.FORM_VALUE_ACCESSOR_GETTER){accessor=function($formNode){var checkedNodes=$formNode.filter(":checked").eq(0);
if(checkedNodes.length>0){return checkedNodes.val()
}else{return null
}}
}else{accessor=function($formNode,value){var METHODNAME="oh.utils.forms.getAccessor:CHECKRADIO";
var logParams={value:value,typeofValue:typeof value,fieldName:$formNode.attr("name")};
if(value===""||value===null){$formNode.attr("checked","");
oh.core.log.info("Null or empty string value, so unchecking all elements",METHODNAME,logParams)
}else{var $checkRadioItem=$formNode.filter("[value="+value+"]").eq(0);
if($checkRadioItem.length===1){$checkRadioItem.attr("checked","checked")
}else{oh.core.log.error("No option with specified value",METHODNAME,logParams)
}}}
}break;
case oh.utils.forms.FORM_INPUT_TYPE_BUTTON:oh.core.log.warn("Button inputs not currently supported","oh.utils.forms.getAccessor:BUTTON");
break;
default:oh.core.log.error("Input type not recognized","oh.utils.forms.getAccessor",{inputType:inputType,type:type,id:$node.attr("id"),selector:$node.selector,className:$node.attr("class"),name:$node.attr("name")});
break
}}return accessor
};
oh.utils.forms.getInputType=function($node){var inputType=null;
if($node.is(":submit,:image,:reset,:button")){inputType=oh.utils.forms.FORM_INPUT_TYPE_BUTTON
}else{if($node.is("select")){inputType=oh.utils.forms.FORM_INPUT_TYPE_SELECT
}else{if($node.is("textarea, :text, :password")){inputType=oh.utils.forms.FORM_INPUT_TYPE_TEXT
}else{if($node.attr("type")==="hidden"){inputType=oh.utils.forms.FORM_INPUT_TYPE_TEXT
}else{if($node.is(":checkbox, :radio")){inputType=oh.utils.forms.FORM_INPUT_TYPE_CHECKRADIO
}else{oh.core.log.error("Input type is not button, select, text or checkRadio","oh.utils.forms.getInputType")
}}}}}return inputType
};
oh.utils.forms.getEntireInputGroup=function(input){var $returnedInput=$input=$(input);
if($input.is(":radio, :checkbox")){$returnedInput=$("[name="+$input.attr("name")+"]")
}else{if($input.is("option")){$returnedInput=$input.parents("select");
oh.core.log.info("Getting select element associated with this option","getEntireInputGroup")
}}return $returnedInput
};
oh.utils.forms.STASH_DATA_ATTRIBUTE="previousValue";
oh.utils.forms.stashOriginalValue=function(input,newValue){var $input=$(input);
var originalValue=oh.utils.forms.getValue($input,{defaultValue:""});
$input.data(oh.utils.forms.STASH_DATA_ATTRIBUTE,originalValue);
oh.core.log.info("Stashing value","oh.utils.forms.stashOriginalValue",{originalValue:originalValue,stashedValue:$input.data(oh.utils.forms.STASH_DATA_ATTRIBUTE)});
if(newValue!==undefined){oh.core.log.info("Setting new value","oh.utils.forms.stashOriginalValue",{newValue:newValue});
oh.utils.forms.setValue($input,newValue)
}};
oh.utils.forms.recoverOriginalValue=function(input,options){var opts=options||{};
var doNotStashExisting=!!(opts.doNotStashExisting);
var $input=$(input);
var originalValue=$input.data(oh.utils.forms.STASH_DATA_ATTRIBUTE);
oh.core.log.info("Recovering value","oh.utils.forms.recoverOriginalValue",{originalValue:String(originalValue)});
if(originalValue!==undefined){if(doNotStashExisting){oh.core.log.info("Clearing stash","oh.utils.forms.recoverOriginalValue");
oh.utils.forms.setValue($input,originalValue);
$input.removeData(oh.utils.forms.STASH_DATA_ATTRIBUTE)
}else{oh.core.log.info("Re-stashing","oh.utils.forms.recoverOriginalValue");
stashOriginalValue($input,originalValue)
}}};
oh.utils.forms.DEFAULT_ATTRIBUTE="isDefaultValue";
oh.utils.forms.getDefaultStatus=function(input){var $input=$(input);
var defaultStatus=($input.data(oh.utils.forms.DEFAULT_ATTRIBUTE)==="true");
oh.core.log.info("status?","getDefaultStatus",{name:$input.attr("name"),defaultStatus:defaultStatus});
return defaultStatus
};
oh.utils.forms.setDefaultStatus=function(input,bool){var $input=$(input);
var defaultStatus=String(bool);
$input.data(oh.utils.forms.DEFAULT_ATTRIBUTE,defaultStatus);
oh.core.log.info("Status is now?","setDefaultStatus",{name:$input.attr("name"),defaultStatus:defaultStatus})
};
oh.utils.forms.setToDefaultValue=function(input,defaultValue){var METHODNAME="oh.utils.forms.setToDefaultValue";
var $input=$(input).eq(0);
if($input.length!==1){oh.core.log.error("No input found",METHODNAME);
return 
}oh.core.log.info("Setting value to default",METHODNAME,{name:$input.attr("name"),defaultValue:defaultValue});
oh.utils.forms.setValue($input,defaultValue);
oh.utils.forms.setDefaultStatus($input,true);
$input.change(function(){oh.utils.forms.setDefaultStatus($(this),false)
})
};
oh.utils.forms.hasDirtyFields=function(node){var METHODNAME="oh.utils.forms.hasDirtyFields";
var $node=$(node);
var $inputs=$node.find(":input");
if($node.length===0||$inputs.length===0){oh.core.log.error("Missing node or inputs",METHODNAME);
return null
}var isDirty=false;
var fieldValues=[];
$inputs.each(function(){var $input=$(this);
var hasValue=oh.utils.forms.hasValue($input);
var isDefault=oh.utils.forms.getDefaultStatus($input);
fieldValues.push({name:$input.attr("name"),value:oh.utils.forms.getValue($input),hasValue:hasValue,isDefault:String(isDefault)});
if(hasValue&&!isDefault){isDirty=true;
return false
}});
oh.core.log.info("Determining if any fields are dirty",METHODNAME,{isDirty:isDirty});
return isDirty
}
})(jQuery);
(function($){oh.namespace("oh.utils.objects");
oh.utils.objects.isObject=function(obj){var bool=(typeof obj==="object"&&!oh.utils.objects.isArray(obj)&&obj!==null&&obj!==undefined);
return bool
};
oh.utils.objects.isArray=function(obj){return Object.prototype.toString.apply(obj)==="[object Array]"
};
oh.utils.objects.makeArray=function(obj,delim){return this.isArray(obj)?obj:(delim&&obj.split&&obj.indexOf(delim)>=0?obj.split(delim):[obj])
};
oh.utils.objects.partialFunction=function(fn,scope){scope=scope||window;
var args=Array.prototype.slice.call(arguments,2);
return function(){var arg=0;
for(var i=0;
i<args.length&&arg<arguments.length;
i++){if(args[i]===undefined){args[i]=arguments[arg++]
}}return fn.apply(scope,args)
}
};
oh.utils.objects.argumentsToArray=function(args){var arr=[];
if(args.length){for(var i=0,j=args.length;
i<j;
i++){arr[i]=args[i]
}}else{arr.push(args)
}return arr
};
oh.utils.objects.arrayToString=function(arr,options){var opts=options||{};
var go=!opts.startFrom;
var pretty="";
if(oh.utils.objects.isArray(arr)){for(var i=0;
i<arr.length;
i++){if(i==opts.startFrom){go=true
}if(go){pretty+=arr[i]+", "
}}pretty="["+pretty.substring(0,pretty.length-2)+"]"
}if(opts.formatAsHTML){pretty=oh.utils.strings.toHTML(pretty)
}return pretty
};
oh.utils.objects.objectToString=function(obj,options){var returnVal,opts=options||{};
if(JSON&&JSON.stringify){returnVal=JSON.stringify(obj,null,5)
}else{returnVal=String(obj)
}if(opts.escapeHTML){returnVal=oh.utils.strings.escapeHTML(returnVal)
}return returnVal
};
oh.utils.objects.objectHasProperties=function(obj){var hasProperties=false;
if(oh.utils.objects.isObject(obj)){var numKeys=0;
for(var key in obj){numKeys++
}hasProperties=(numKeys>0)
}return hasProperties
};
oh.utils.objects.getMatchingValueFromArray=function(myValue,values,stronglyTyped){var looselyTyped=!stronglyTyped;
values=$.makeArray(values);
var returnValue;
for(var i=0,length=values.length;
i<length;
i++){var bool=looselyTyped?myValue==values[i]:myValue===values[i];
if(bool){returnValue=values[i];
break
}}return returnValue
};
oh.utils.objects.arrayContainsValue=function(myValue,values){if(!oh.utils.objects.isArray(myValue)){return oh.utils.objects.getMatchingValueFromArray(myValue,values)!==undefined
}else{var isFound=false;
for(var i=0;
i<myValue.length;
i++){if(oh.utils.objects.getMatchingValueFromArray(myValue[i],values)){isFound=true;
break
}}return isFound
}};
oh.utils.objects.mapKeyObjToValueObj=function(keyObj,valueObj){var valueMap=[];
$.each(keyObj,function(i,key){var value=valueObj[key];
if(value!==undefined&&value!==null){valueMap.push({key:key,value:value})
}});
oh.core.log.info("valueMap","mapKeyObjToValueObj",valueMap);
return valueMap
};
oh.utils.objects.getFunctionInContext=function(context,func){return function(){return func.apply(context,arguments)
}
};
oh.utils.objects.bindAsEventListener=function(context,event,target,handler){var handlerWrapper=oh.utils.objects.getFunctionInContext(context,handler);
$(target).bind(event,handlerWrapper)
};
oh.utils.objects.toBoolean=function(input){var output=input;
if("boolean"!==typeof (input)){output=("true"===input)
}return output
};
oh.utils.objects.keys=function(obj){var keys=[];
$.each(obj,function(key,value){keys.push(key)
});
return keys
}
})(jQuery);
(function($){oh.namespace("oh.utils.querystrings");
oh.utils.querystrings.getValue=function(name){var pairs,pair,value="";
var qs=window.location.href.split("?");
if(qs.length>1){qs=qs[1].split("#")[0];
pairs=qs.split("&");
for(var i=0,length=pairs.length;
i<length;
i++){pair=pairs[i].split("=");
if(pair[0]==name&&pair[1]){value=pair[1]
}}}return value
};
oh.utils.querystrings.testValue=function(name,values){return($.grep($.makeArray(values),function(value,i){return(oh.utils.querystrings.getValue(name)==value)
}).length>0)
};
oh.utils.querystrings.build=function(arr,currentQS){var qs=currentQS||"";
$.each(arr,function(i){if(this.key&&this.value!==undefined&&this.value!==null){qs+=(qs===""?"?":"&");
qs+=this.key+"="+this.value
}});
return qs
}
})(jQuery);
(function($){oh.namespace("oh.utils.strings");
oh.utils.strings.regexFormats={ymd:/^\d{4}[-/.](0|1)\d[-/.](0|1|2|3)\d( (0|1|2)\d:(0|1|2|3|4|5)\d:\d{2}(\.\d+)?)?$/};
oh.utils.strings.trim=function(str){var trimmed=str;
var regEx=/^[\s]*([^\s]*)[\s]*$/;
var match=regEx.exec(String(str));
if(match&&match.length>1){trimmed=match[1]
}return trimmed
};
oh.utils.strings.escapeHTML=function(str){var returnValue=String(str).replace(/\</g,"&lt;").replace(/\>/g,"&gt;");
return returnValue
};
oh.utils.strings.stripNonNumerals=function(str){var regEx=/[^0-9]/g;
var returnValue=String(str).replace(regEx,"");
return returnValue
};
oh.utils.strings.toHTML=function(str){var returnValue=String(str).replace(/\n/g,"<br />").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
return returnValue
};
oh.utils.strings.extractNumberAsString=function(input){if(input===undefined||input===null){oh.core.log.warn("Translating null/undefined to an empty string","oh.utils.strings.extractNumberAsString");
input=""
}var newString=String(input).replace(/[^-.0-9]/g,"");
return newString
};
oh.utils.strings.extractNumberAsNumber=function(input){var newNumber=Number(oh.utils.strings.extractNumberAsString(input));
if(isNaN(newNumber)){oh.core.log.warn("Return type of number expected but returning NaN instead","oh.utils.strings.extractNumberAsNumber")
}return newNumber
};
oh.utils.strings.extractDateAsDate=function(dateString){var regex=oh.utils.strings.regexFormats.ymd;
var datePieces=null;
var year=0,month=1,day=2,hours=3,minutes=4,seconds=5;
var date=null;
if(regex.test(dateString)){datePieces=dateString.split(/[-/. :]+/g);
date=new Date();
date.setFullYear(datePieces[year],datePieces[month],datePieces[day]);
date.setHours(datePieces[hours]);
date.setMinutes(datePieces[minutes]);
date.setSeconds(datePieces[seconds])
}else{oh.core.log.error("Could not parse date string into Date object","oh.utils.strings.extractDateAsDate",{dateString:dateString,regex:String(regex)})
}return date
};
oh.utils.strings.extractDigitsAsString=function(input){if(input===undefined||input===null){oh.core.log.warn("Translating null/undefined to an empty string","oh.utils.strings.extractDigitsAsString");
input=""
}var numbersOnly=String(input).match(/\d/g).join("");
return numbersOnly
};
oh.utils.strings.extractDigitsAsNumber=function(input){var numbersOnly=Number(oh.utils.strings.extractDigitsAsString(input));
if(isNaN(numbersOnly)){oh.core.log.warn("Return type of number expected but returning NaN instead","oh.utils.strings.extractDigitsAsNumber")
}return numbersOnly
};
oh.utils.strings.formatSSNorITIN=function(str){var numbersOnly=oh.utils.strings.extractDigitsAsString(str);
if(numbersOnly.length!==9){oh.core.log.error("Don't have 9 digits so cannot format an ITIN or SSN","oh.utils.strings.formatSSNorITIN");
return str
}var formattedValue=[numbersOnly.substring(0,3),numbersOnly.substring(3,5),numbersOnly.substring(5,9)].join("-");
return formattedValue
};
oh.utils.strings.formatEIN=function(str){var numbersOnly=oh.utils.strings.extractDigitsAsString(str);
if(numbersOnly.length!==9){oh.core.log.error("Don't have 9 digits so cannot format an EIN","oh.utils.strings.formatEIN");
return str
}var formattedValue=[numbersOnly.substring(0,2),numbersOnly.substring(2,9)].join("-");
return formattedValue
};
oh.utils.strings.ucfirst=function(str){return str.charAt(0).toUpperCase()+str.substring(1,str.length)
};
oh.utils.strings.camelCase=function(str,separator){separator=separator||".";
var pieces=null;
var formattedValue=[];
if(typeof (separator)==="object"){pieces=separator.match(str)
}else{pieces=str.split(separator)
}for(var i=0,length=pieces.length;
i<length;
i++){formattedValue.push(oh.utils.strings.ucfirst(pieces[i]))
}return formattedValue.join("")
}
})(jQuery);
(function($){oh.namespace("oh.utils.validators");
oh.utils.validators.equal=new oh.NumericComparisonValidator(function(value,testValue){return(value===testValue)
},null,"equal");
oh.utils.validators.lessThan=new oh.NumericComparisonValidator(function(value,testValue){return(value<testValue)
},null,"lessThan");
oh.utils.validators.lessThanOrEqual=new oh.NumericComparisonValidator(function(value,testValue){return(value<=testValue)
},null,"lessThanOrEqual");
oh.utils.validators.greaterThan=new oh.NumericComparisonValidator(function(value,testValue){return(value>testValue)
},null,"greaterThan");
oh.utils.validators.greaterThanOrEqual=new oh.NumericComparisonValidator(function(value,testValue){return(value>=testValue)
},null,"greaterThanOrEqual");
oh.utils.validators.currency=new oh.RegExValidator(/^(([0-9]{1,3}(,[0-9]{3})*)|([0-9]{1,}))(\.[0-9]{2})?$/,null,"currency");
oh.utils.validators.insideRange=new oh.Validator(function(value,$input,data){var valid=!isNaN(value);
var max=data.max;
var min=data.min;
max=oh.utils.strings.extractNumberAsNumber(max);
min=oh.utils.strings.extractNumberAsNumber(min);
if(isNaN(min)||isNaN(max)){this.error("No min or max, so this validation is meaningless",{min:min,max:max});
return false
}return(valid&&value>=min&&value<=max)
},{valueTranslator:oh.utils.strings.extractNumberAsNumber},"insideRange");
oh.utils.validators.denyCombinations=new oh.ComparisonValidator(function(value,testValue,$input,data){var isValid=true;
$.each(data.combinations,function(i,combination){var match=$.inArray(value,combination.values);
var testMatch=$.inArray(testValue,combination.testValues);
var bothMatch=(match!==-1&&testMatch!==-1);
oh.core.log.info("Testing","conditional",{combination:combination,value:value,match:match,testValue:testValue,testMatch:testMatch,bothMatch:bothMatch});
if(bothMatch){isValid=false;
return false
}});
return isValid
},null,"denyCombinations");
oh.utils.validators.email=new oh.RegExValidator(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/,null,"email");
oh.utils.validators.isInteger=new oh.RegExValidator(/^[0-9]+$/,null,"isInteger");
oh.utils.validators.lengthRange=new oh.Validator(function(value,$input,data){var min=$input.attr("minlength")||null;
var max=$input.attr("maxlength")||null;
var len=value.length;
var isValid=false;
if(min!==null){isValid=(len>=min)
}if(max!==null){isValid=isValid&&(len<=max)
}return isValid
},null,"lengthRange");
oh.utils.validators.lengthRangeNumeric=new oh.Validator(function(value,$input,data){var isNumber=oh.utils.validators.validNumber.runTest(value,$input,data);
var isValidLength=oh.utils.validators.lengthRange.runTest(value,$input,data);
return isNumber&&isValidLength
},null,"lengthRangeNumeric");
oh.utils.validators.numericTotal=new oh.NumericComparisonValidator(function(value,testValue,$input,data){return(value+testValue===data.totalValue)
},null,"numericTotal");
oh.utils.validators.phone=new oh.RegExValidator(/^[0-9]{10,}$/,{valueTranslator:oh.utils.strings.stripNonNumerals},"phone");
oh.utils.validators.poBox=new oh.RegExValidator(/p\.?o\.?( )?box/i,{invert:true},"poBox");
oh.utils.validators.socialSecurityNumber=new oh.RegExValidator(/^(\d{1}\D*){9}$/,{postValueTransformer:function(value){return oh.utils.strings.formatSSNorITIN(value)
}},"socialSecurityNumber");
oh.utils.validators.employerIdentificationNumber=new oh.RegExValidator(/^(\d{1}\D*){9}$/,{postValueTransformer:function(value){return oh.utils.strings.formatEIN(value)
}},"employerIdentificationNumber");
oh.utils.validators.stringMatch=new oh.ComparisonValidator(function(value,testValue){return(value===testValue)
},null,"stringMatch");
oh.utils.validators.stringMismatch=new oh.ComparisonValidator(function(value,testValue){return(value!==testValue)
},null,"stringMismatch");
oh.utils.validators.validDate=new oh.Validator(function(value,$input,data){var today=new Date();
var dateParts=value.split("/");
var month=parseInt(dateParts[0],"10");
var day=parseInt(dateParts[1],"10");
var year=parseInt(dateParts[2],"10");
oh.core.log.info("Date parts","date",{month:month,day:day,year:year});
var regEx=/^[01]{1}[0-9]{1}\/[0123]{1}[0-9]{1}\/(18|19|20)[0-9]{2}$/;
var isLeap=((year%4===0)&&(year%100!==0||year%400===0));
var monthDayArray=[31,(isLeap?29:28),31,30,31,30,31,31,30,31,30,31];
var dayIsValid=function(month,day){var isValid=((day<=monthDayArray[month-1])&&(day>0));
return isValid
};
var monthIsValid=function(month){var isValid=((month>0&&month<=12));
return isValid
};
var yearIsValid=function(year){return((year<=today.getFullYear())&&(year>1850))
};
var isValid=(regEx.test(value)&&monthIsValid(month)&&dayIsValid(month,day)&&yearIsValid(year));
return isValid
},null,"validDate");
oh.utils.validators.validNumber=new oh.Validator(function(value,$input,data){return !isNaN(value)
},null,"validNumber");
oh.utils.validators.zip=new oh.RegExValidator(/^[0-9]{5}(-[0-9]{4})?$/,null,"zip")
})(jQuery);
(function($){oh.namespace("oh.utils.webMessage");
oh.utils.webMessage.authLogin=function(userName,password,successCallback,errorCallback,options){var action="auth.login";
var data={userName:userName,password:password};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.createNewAuthToken=function(currentAuthToken,successCallback,errorCallback,options){var action="auth.create.token";
var data={authToken:currentAuthToken};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.authLogout=function(authToken,successCallback,errorCallback,options){var action="auth.logout";
var data={authToken:authToken};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.authKeepAlive=function(authToken,successCallback,errorCallback,options){var action="auth.keepAlive";
var data={authToken:authToken};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.logError=function(authToken,errorMessage,successCallback,errorCallback,options){var action="application-log";
var data={authToken:authToken,message:errorMessage};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.passwordRecoverBegin=function(userName,firstName,lastName,email,successCallback,errorCallback,options){var action="auth-recover-begin";
var data={userName:userName,firstName:firstName,lastName:lastName,email:email};
return oh.core.transport.postToWebMessage(action,data,oh.utils.webMessage.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.passwordRecoverComplete=function(authToken,answer,password,successCallback,errorCallback,options){var action="auth-recover-complete";
var data={answer:answer,password:password,authToken:authToken};
return oh.core.transport.postToWebMessage(action,data,oh.utils.webMessage.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.viewChain=function(authToken,account,symbol,greeks,bs,quotesAfter,dataType,successCallback,errorCallback,options){var action="view.chain";
var data={authToken:authToken,account:account,symbol:symbol,greeks:greeks,bs:bs,quotesAfter:quotesAfter};
return oh.core.transport.postToWebMessage(action,data,dataType,successCallback,errorCallback,options)
};
oh.utils.webMessage.loadPreference=function(authToken,preferenceName,successCallback,errorCallback,options){var action="preferences.load";
var data={authToken:authToken,name:preferenceName};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.savePreference=function(authToken,preferenceName,preferenceValue,successCallback,errorCallback,options){var action="preferences.save";
var data={authToken:authToken,preference:{name:preferenceName,value:preferenceValue}};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.isAuthTokenValid=function(authToken){var successCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){return true
}else{oh.core.log.error("Could not validate auth token.","oh.utils.webMessage.isAuthTokenValid");
return false
}};
var errorCallback=function(respStatus,respText){oh.core.log.error("Could not validate auth token.","oh.utils.webMessage.isAuthTokenValid");
return false
};
var options={async:false};
return oh.utils.webMessage.authKeepAlive(authToken,successCallback,errorCallback,options)
};
oh.utils.webMessage.getCommissionSchedule=function(authToken,accountId,symbol,successCallback,errorCallback,options){var action="account-commission-schedule-find";
var data={authToken:authToken,account:accountId};
if(symbol){data.underlying=symbol
}return oh.core.transport.postToWebMessage(action,data,oh.core.transport.XML_DATA_TYPE,successCallback,errorCallback,options)
};
oh.utils.webMessage.echo=function(authToken,echoData,successCallback,errorCallback,options){var data={authToken:authToken,echo:echoData};
return oh.core.transport.postToWebMessage("echo",data,oh.core.transport.JSON_DATA_TYPE,successCallback,errorCallback,options)
}
})(jQuery);
(function($){oh.namespace("oh.utils.webMessageNew");
oh.utils.webMessageNew.authLogin=function(userName,password,options){var immutableOptions={action:"auth.login",data:{userName:userName,password:password}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE,successCallback:function(respAction,respData,elapsedTime){var authToken=respData.authToken;
oh.core.log.info("Got auth token: "+authToken,"oh.test.utils.getAuthToken");
return authToken
}};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.authLogout=function(authToken,options){var immutableOptions={action:"auth.logout",data:{authToken:authToken}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.authKeepAlive=function(authToken,options){var immutableOptions={action:"auth.keepAlive",data:{authToken:authToken}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.logError=function(authToken,errorMessage,options){var immutableOptions={action:"application-log",data:{authToken:authToken,message:errorMessage}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.passwordRecoverBegin=function(userName,firstName,lastName,email,options){var immutableOptions={action:"auth-recover-begin",data:{userName:userName,firstName:firstName,lastName:lastName,email:email}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.passwordRecoverComplete=function(authToken,answer,password,options){var immutableOptions={action:"auth-recover-complete",data:{answer:answer,password:password,authToken:authToken}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.loadPreference=function(authToken,preferenceName,options){var immutableOptions={action:"preferences.load",data:{authToken:authToken,name:preferenceName}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.savePreference=function(authToken,preferenceName,preferenceValue,options){var immutableOptions={action:"preferences.save",data:{authToken:authToken,preference:{name:preferenceName,value:preferenceValue}}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.utils.webMessageNew.isAuthTokenValid=function(authToken){var successCallback=function(respAction,respData,elapsedTime){return true
};
var errorCallback=function(respStatus,respError,elapsedTime){oh.core.log.error("Could not validate auth token.","oh.utils.webMessageNew.isAuthTokenValid");
return false
};
var options={async:false,successCallback:savePreferenceSuccess,defaultErrorCallback:savePreferenceError};
return oh.utils.webMessageNew.authKeepAlive(authToken,options)
};
oh.utils.webMessageNew.echo=function(authToken,echoData,options){var immutableOptions={action:"echo",data:{authToken:authToken,echo:echoData}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
}
})(jQuery);
(function($){oh.namespace("oh.changePassword.utils")
})(jQuery);
(function($){oh.namespace("oh.contactUs.utils")
})(jQuery);
(function($){oh.namespace("oh.marketingSite.utils");
oh.marketingSite.utils.launchVideoFromQuerystring=function(lightboxId){if(lightboxId&&oh.utils.querystrings.getValue("brightCoveVid")=="true"){showLightbox(lightboxId)
}};
oh.marketingSite.utils.PARTNER_COOKIE_KEY="partner";
oh.marketingSite.utils.PARTNER_COOKIE_KEY_ALT="pcode";
oh.marketingSite.utils.setPartnerCookie=function(){var newPartnerCode=(oh.utils.querystrings.getValue(oh.marketingSite.utils.PARTNER_COOKIE_KEY)||oh.utils.querystrings.getValue(oh.marketingSite.utils.PARTNER_COOKIE_KEY_ALT));
if(newPartnerCode){oh.utils.cookies.setValue(oh.marketingSite.utils.PARTNER_COOKIE_KEY,newPartnerCode,30);
return true
}return false
};
oh.marketingSite.utils.setCommissionJunctionCookie=function(){var cjPartnerCode="CJ:";
var hasCode=false;
var cjURLKeys=["CJAID","CJPID","CJSID"];
$.each(cjURLKeys,function(i,param){var qsParam=oh.utils.querystrings.getValue(param);
if(qsParam){cjPartnerCode+=param+"="+qsParam+";";
hasCode=true
}});
if(hasCode){oh.utils.cookies.setValue(oh.marketingSite.utils.PARTNER_COOKIE_KEY,cjPartnerCode,45)
}return hasCode
};
oh.marketingSite.utils.setAllPartnerCookies=function(){var partnerCookieHasBeenSet=(oh.marketingSite.utils.setPartnerCookie()||oh.marketingSite.utils.setCommissionJunctionCookie());
return partnerCookieHasBeenSet
};
oh.marketingSite.utils.showVlog=function(vidId,videoTitle){var vlogFrame=document.getElementById("mediaWrapper");
vlogFrame.contentWindow.location.href="/video/homepage/ohVideo.jsp?vidId="+vidId;
$("#vlogContainer").css("display","block").animate({opacity:1,top:"116px",height:"610px"},500,function(){$(vlogFrame).css("display","block")
});
videoTitle=videoTitle?videoTitle:"emailVideo"+vidId;
oh.utils.analytics.google.trackByMainTrackingCode("ajax-call-homepage-video-"+videoTitle)
};
oh.marketingSite.utils.hideVlog=function(){var vlogFrame=document.getElementById("mediaWrapper");
vlogFrame.contentWindow.location.href="/asset/html/blank.html";
$("#vlogContainer").animate({opacity:0,top:"727px",height:"0px"},500,function(){$("#vlogContainer").css("display","none")
});
$(vlogFrame).css("display","none")
};
oh.marketingSite.utils.goToPage=function(page){top.document.location.href=page;
return false
};
oh.marketingSite.utils.anchorPos=function(id){$(id).click(function(){return false
})
};
oh.marketingSite.utils.toggleSiblingHover=function(hoverSelector,siblingSelector,options){var opts=options||{returnValue:false};
var $siblings=$(siblingSelector);
$(hoverSelector).mouseover(function(){$siblings.addClass("hover");
return opts.returnValue
}).mouseout(function(){$siblings.removeClass("hover")
})
};
oh.marketingSite.utils.toggleHover=function(hoverSelector){oh.marketingSite.utils.toggleSiblingHover(hoverSelector,hoverSelector,{returnValue:true})
};
oh.marketingSite.utils.styleNav=function(){var match=function(id){return(document.location.href.indexOf(id)!==-1)
};
var selectIt=function(id){$("ul li.nav_"+id+" a").addClass("selected")
};
if(match("events")){selectIt("events")
}else{var id=$("body:first").attr("id");
if(id==="management_team"||id==="press_releases"||id==="media"||id==="in_the_news"||id==="careers"){id="company_info"
}if(match(id)){selectIt(id)
}}};
oh.marketingSite.utils.forceSecure=function(){if(oh.isDevSite()){return 
}var href=window.location.href;
if(href.indexOf("https:")===-1){window.location.href=href.replace("http://","https://")
}};
$.fn.launchVideoFromQuerystring=function(){$(this).eq(0).each(function(){oh.marketingSite.utils.launchVideoFromQuerystring()
});
return this
};
$.fn.bindClick=function(url){$(this).click(function(){return oh.marketingSite.utils.goToPage(url)
});
return this
};
$.fn.toggleHover=function(){$(this).each(function(){oh.marketingSite.utils.toggleHover(this)
});
return this
};
$.fn.toggleSiblingHover=function(selectors){$(this).each(function(){oh.marketingSite.utils.toggleSiblingHover(this,selectors)
});
return this
};
$.fn.toggleHoverAndBindClick=function(url){$(this).each(function(){$(this).toggleHover().bindClick(url)
});
return this
};
$.fn.bindShowLightbox=function(id,title){$(this).click(function(){$("#windowShade").addClass("on");
oh.marketingSite.utils.showVlog(id,title);
return false
});
return this
};
$.fn.bindHideLightbox=function(){$(this).click(function(){$("#windowShade").removeClass("on");
oh.marketingSite.utils.hideVlog();
return false
});
return this
};
$.fn.confirmAndGoToPage=function(){var txt="You are now leaving optionshouse.com\n\nYou are about to enter a site that is external to optionshouse.com.\n\nOptionshouse.com has provided this link for educational and informational purposes only. OptionsHouse does not monitor the external site's content and does not endorse the site, product, or service. OptionsHouse makes no representation of the external site's privacy policy or security measures. We recommend you review this external site's privacy policy and security measures prior to utilizing their site.";
var myLink=new oh.ConfirmOffsiteLink(txt);
$(this).click(function(){return myLink.go($(this))
});
return this
};
$.fn.confirmAndGoToONN=function(link){var txt="You are now leaving OptionsHouse.com and about to enter www.ONN.tv, a site that is external to optionshouse.com.\n\nOptionsHouse.com has provided this link for informational and educational purposes only. OptionsHouse does not monitor the external site's content and does not endorse the site, product or service. OptionsHouse is affiliated with www.ONN.tv (Options News Network) through their parent company, PEAK6 Investments, L.P. OptionsHouse makes no  representation of this external site's privacy policy and security measures and we recommend you review them prior to utilizing their site.";
var myLink=new oh.ConfirmOffsiteLink(txt);
$(this).click(function(){return myLink.go($(this),link)
});
return this
};
$.fn.openAnAccount=function(){var url="/securehost/tool/current/app/accountSignup/page/createLogin.jsp";
var urlTransformer=function(url,$node){var promoCode=$node.filter(".setPromoFromId").attr("id");
if(promoCode){url+="?promo="+promoCode
}return url
};
$(this).each(function(){new oh.ProgressiveLink(this,url,{urlTransformer:urlTransformer})
});
return this
};
$.fn.secureLogin=function(){var url="/securehost/tool/login/";
var params={windowParams:"toolbar=no,menubar=no,status=yes,resizable=yes",addHover:true};
$(this).each(function(){new oh.ProgressivePopupLink(this,url,params)
});
return this
};
$.fn.liveHelp=function(){var url="https://server.iad.liveperson.net/hc/65351157/?cmd=file&file=visitorWantsToChat&site=65351157&byhref=1&imageUrl=https://www.optionshouse.com/asset/img/chat";
var params={windowParams:"width=472,height=520",windowName:"chat65351157",addHover:true};
$(this).each(function(){new oh.ProgressivePopupLink(this,url,params)
});
return this
};
$.fn.referAFriend=function(){var url="/refer/";
$(this).each(function(){new oh.ProgressiveLink(this,url)
});
return this
};
$.fn.toggleFAQ=function(){var selectors={item:".faqItem",question:".faqQuestion",content:".faqContent",text:"span:eq(1)"};
var $node=$(this);
$node.find(selectors.question).css("cursor","pointer");
$node.find(selectors.content).hide();
$node.find(selectors.item).each(function(){var $item=$(this);
var $question=$item.find(selectors.question);
var $text=$question.find(selectors.text);
$question.hover(function(){$text.addClass("link")
},function(){$text.removeClass("link")
});
$question.click(function(){$item.find(selectors.content).toggle();
return false
})
})
};
$.fn.throb=function(duration){duration=duration||2000;
$(this).each(function(){var $node=$(this);
if($node.data("throbbing")=="yes"){$node.stop(true,true);
$node.data("throbbing","no")
}$node.data("throbbing","yes");
$node.effect("highlight",{},duration,function(){$node.data("throbbing","no")
})
});
return this
};
$.fn.firstAndLastChild=function(){$(this).each(function(){var $node=$(this);
if($.browser.msie&&$.browser.version<8){$node.find(":first-child").addClass("firstChild");
$node.find(":last-child").addClass("lastChild")
}});
return this
};
$.fn.fixSelectWidths=function(){$(this).each(function(){var $selects=$(this).find("select");
if($.browser.msie){$selects.focus(function(){var $this=$(this);
var originalWidth=$this.css("width");
$this.data("originalWidth",originalWidth).css("width","auto")
}).blur(function(){var $this=$(this);
var originalWidth=$this.data("originalWidth");
$this.css("width",originalWidth)
})
}});
return this
};
$.fn.riskNavigator=function(){$(this).each(function(){$(this).change(function(){var url=oh.utils.forms.getValue(this);
oh.marketingSite.utils.goToPage(url)
})
});
return this
}
})(jQuery);
(function($){oh.namespace("oh.referAFriend.utils")
})(jQuery);
(function($){oh.namespace("oh.legacyTool");
oh.legacyTool.Component=oh.SuperAwesome.extend({classHandle:"oh.legacyTool.Component",manager:null,top:null,init:function(){this.top=oh.tradingTool.utils.getTop();
if(!this.top||!this.top.oh||!this.top.oh.tradingTool){this.error("No reference to top window and its JS components");
return 
}this.manager=this.top.oh.tradingTool.manager;
if(!this.manager){this.error("No reference to oh.tradingTool.manager","init");
return 
}this.base();
this.confirmSuccessfulInit()
},sendMessage:function(func){if(this.shouldExit("sendMessage")){return 
}if(!$isFunction(func)){this.error("Not a function","sendMessage",{func:func});
return 
}this.manager.receiveMessage(func)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.legacyTool");
oh.legacyTool.init=function(){var mappings=[];
var bindStandardEvents=function(){var $node=$("body:not(.print)");
$node.click(function(){top.clearPopups()
}).mousedown(function(e){docClick(e)
}).mouseover(function(e){top.getMOobject(e)
}).keyup(function(e){getKey(e)
}).keydown(function(e){getKeyDown(e)
});
if(!oh.isDevSite()){$node.bind("contextmenu",function(){return false
})
}};
var bindCustomEvents=function(){$.each(mappings,function(){var mapping=this;
var selectorFound=$(mapping.selector).length!==0;
if(selectorFound){mapping.fn()
}})
};
return{bindAllEvents:function(){bindStandardEvents();
bindCustomEvents()
},registerEvent:function(selector,fn){mappings.push({selector:selector,fn:fn})
}}
}();
oh.namespace("oh.tradingTool");
oh.tradingTool.init=oh.legacyTool.init
}(jQuery));
(function($){oh.namespace("oh.legacyTool");
oh.legacyTool.refreshRates=function(){var _this={};
var keepAliveRate=60000;
var resendRate=11000;
var resendMaxAttempts=15;
var numerator=1000;
var lowestAllowableRate=1000;
var defaultRate=5000;
var defaults={position:5000,watchlist:5000,accountdetail:5000,messagecenter:5000,chart:5000,exchangelookup:5000,accountorder:5000,quote:5000,cash:5000,chain:5000};
var setOne=function(oXml,key){var node,newRate;
node=btn(oXml,"refreshRate."+key);
if(node&&node.length>0){newRate=iNode(node[0])*numerator
}if(newRate&&newRate>=lowestAllowableRate){_this[key]=newRate
}else{_this[key]=defaultRate;
oh.core.log.error("Tried to set "+key+" refresh rate to "+newRate+" but failed. Set it to default rate of "+_this[key]+" instead.")
}};
for(pref in defaults){if(defaults.hasOwnProperty(pref)){_this[pref]=defaults[pref]
}}_this.enabled=true;
_this.getResendRate=function(){return resendRate
};
_this.getResendMaxAttempts=function(){return resendMaxAttempts
};
_this.getKeepAliveRate=function(){return keepAliveRate
};
_this.setAll=function(oXml){for(pref in defaults){if(defaults.hasOwnProperty(pref)){setOne(oXml,pref)
}}};
return _this
}();
oh.namespace("oh.core.transport");
oh.core.transport.refreshRates=oh.legacyTool.refreshRates
})(jQuery);
(function($){oh.namespace("oh.tradingTool.utils");
oh.tradingTool.utils.getTop=function(){if(this.topObj){return this.topObj
}var topWindowOpenerExists=!!(top.window.opener);
var undocked=!!(top.thisUndocked);
oh.core.log.info("Finding top window reference","getTop",{topWindowOpenerExists:topWindowOpenerExists,undocked:undocked});
this.topObj=(topWindowOpenerExists&&undocked?top.window.opener:top);
return this.topObj
};
oh.tradingTool.utils.waitForConditionAndAct=function(conditional,action,options){var METHODNAME="waitForConditionAndAct";
var defaults={pollingPeriod:100,conditionalLabel:"condition",maxPeriod:15000};
var opts=$.extend({},defaults,options);
if(!opts.maxPeriodCallback){opts.maxPeriodCallback=function(){oh.core.log.error("Exceeded "+opts.maxPeriod+" ms without "+opts.conditionalLabel+" being met",METHODNAME)
}
}oh.core.log.info("Called for "+opts.conditionalLabel,METHODNAME,{pollingPeriod:opts.pollingPeriod,maxPeriod:opts.maxPeriod});
var maxAttempts=Math.round(opts.maxPeriod/opts.pollingPeriod);
var numAttempts=0;
var pollingInterval=setInterval(function(){if(numAttempts<maxAttempts){if(conditional()){oh.core.log.info(opts.conditionalLabel+" met",METHODNAME);
clearInterval(pollingInterval);
action()
}else{numAttempts++;
oh.core.log.info("Waiting for "+opts.conditionalLabel,METHODNAME)
}}else{clearInterval(pollingInterval);
opts.maxPeriodCallback()
}},opts.pollingPeriod)
}
})(jQuery);
(function($){oh.namespace("oh.tradingTool.utils.order");
oh.tradingTool.utils.order.addOrder=function(orderDetails,orderDetailLegs,counter,orderRestatementRows){if(orderDetailLegs){if(orderDetailLegs.length>1){oh.tradingTool.utils.order.addSpreadOrders(orderDetails,orderDetailLegs,counter,orderRestatementRows)
}else{oh.tradingTool.utils.order.addSingleOrder(orderDetails,orderDetailLegs[0],counter,orderRestatementRows)
}}};
oh.tradingTool.utils.order.addSingleOrder=function(orderDetails,orderDetailLeg,counter,orderRestatementRows){var singleLeg=oh.tradingTool.utils.order.createSingleOrderLeg(orderDetails,orderDetailLeg,counter);
orderRestatementRows.push(singleLeg)
};
oh.tradingTool.utils.order.addSpreadOrders=function(orderDetails,orderDetailLegs,counter,orderRestatementRows){var spreadHeader=oh.tradingTool.utils.order.createSpreadHeader(orderDetails,counter);
orderRestatementRows.push(spreadHeader);
for(var i=0;
i<orderDetailLegs.length;
i++){var spreadOrderLeg=oh.tradingTool.utils.order.createSpreadOrderLegs(orderDetailLegs[i]);
orderRestatementRows.push(spreadOrderLeg)
}};
oh.tradingTool.utils.order.addTrailingStop=function(orderDetails,orderRestatementRows){var trailingStopHeader=oh.tradingTool.utils.order.createTrailingStop(orderDetails);
orderRestatementRows.push(trailingStopHeader)
};
oh.tradingTool.utils.order.addTrigger=function(orderDetails,orderRestatementRows){var triggerHeader=oh.tradingTool.utils.order.createTrigger(orderDetails);
orderRestatementRows.push(triggerHeader)
};
oh.tradingTool.utils.order.createSpreadHeader=function(orderDetails,counter){var spreadHeader={};
spreadHeader.leg_description=orderDetails.underlying_symbol+" Spread:";
spreadHeader.leg_price=oh.utils.formatting.currency(orderDetails.price);
spreadHeader.price_type=oh.tradingTool.utils.order.convertPriceType(orderDetails.price_type);
spreadHeader.time_in_force=oh.tradingTool.utils.order.convertTimeInForceType(orderDetails.time_in_force);
spreadHeader.transaction="Spread";
spreadHeader.status=oh.utils.strings.ucfirst(orderDetails.status);
spreadHeader.last_updated=oh.tradingTool.utils.order.getFormattedDate(orderDetails.legs[0].last_updated);
spreadHeader.legNumber=++counter;
spreadHeader.quantity="--";
spreadHeader.filled="--";
return spreadHeader
};
oh.tradingTool.utils.order.createSpreadOrderLegs=function(orderDetailLeg){var spreadOrderLeg={};
spreadOrderLeg.leg_description=orderDetailLeg.leg_description;
spreadOrderLeg.transaction=oh.tradingTool.utils.order.convertTransactionType(orderDetailLeg.transaction);
spreadOrderLeg.quantity=orderDetailLeg.quantity;
spreadOrderLeg.filled=orderDetailLeg.quantity_filled||"--";
spreadOrderLeg.isSpreadOrderLeg=true;
spreadOrderLeg.leg_price="--";
spreadOrderLeg.price_type="--";
spreadOrderLeg.time_in_force="--";
return spreadOrderLeg
};
oh.tradingTool.utils.order.createSingleOrderLeg=function(orderDetails,orderDetailLeg,counter){var singleLeg={};
singleLeg.leg_price=oh.utils.formatting.currency(orderDetails.price);
singleLeg.price_type=oh.tradingTool.utils.order.convertPriceType(orderDetails.price_type);
singleLeg.time_in_force=oh.tradingTool.utils.order.convertTimeInForceType(orderDetails.time_in_force);
singleLeg.status=oh.utils.strings.ucfirst(orderDetails.status);
singleLeg.leg_description=orderDetailLeg.leg_description;
singleLeg.last_updated=oh.tradingTool.utils.order.getFormattedDate(orderDetailLeg.last_updated);
singleLeg.transaction=oh.tradingTool.utils.order.convertTransactionType(orderDetailLeg.transaction);
singleLeg.quantity=orderDetailLeg.quantity;
singleLeg.filled=orderDetailLeg.quantity_filled||"--";
singleLeg.legNumber=++counter;
return singleLeg
};
oh.tradingTool.utils.order.createTrailingStop=function(orderDetails){var trailingStopHeader={};
trailingStopHeader.leg_description=oh.tradingTool.utils.order.getTrailingStopDescription(orderDetails.trigger_condition,orderDetails.time_in_force);
trailingStopHeader.status=oh.tradingTool.utils.order.convertTriggerTrailStopStatusType(orderDetails.trigger_condition.trailstop_status);
trailingStopHeader.last_updated=oh.tradingTool.utils.order.getFormattedDate(orderDetails.trigger_condition.trailstop_date_updated);
trailingStopHeader.isTrailingStop=true;
trailingStopHeader.leg_price="--";
trailingStopHeader.price_type="--";
trailingStopHeader.time_in_force="--";
trailingStopHeader.transaction="--";
trailingStopHeader.quantity="--";
trailingStopHeader.filled="--";
return trailingStopHeader
};
oh.tradingTool.utils.order.createTrigger=function(orderDetails){var triggerHeader={};
triggerHeader.leg_description=oh.tradingTool.utils.order.getTriggerDescription(orderDetails.trigger_condition,orderDetails.time_in_force);
triggerHeader.status=oh.tradingTool.utils.order.convertTriggerTrailStopStatusType(orderDetails.trigger_condition.trigger_status);
triggerHeader.last_updated=oh.tradingTool.utils.order.getFormattedDate(orderDetails.trigger_condition.trigger_date_updated);
triggerHeader.isTrigger=true;
triggerHeader.leg_price="--";
triggerHeader.price_type="--";
triggerHeader.time_in_force="--";
triggerHeader.transaction="--";
triggerHeader.quantity="--";
triggerHeader.filled="--";
return triggerHeader
};
oh.tradingTool.utils.order.convertPriceType=function(priceTypeAbbr){var priceTypeString="";
if(priceTypeAbbr){switch(priceTypeAbbr.toUpperCase()){case"L":priceTypeString="Limit";
break;
case"M":priceTypeString="Market";
break;
case"H":priceTypeString="Stop";
break;
case"S":priceTypeString="Stop Limit";
break;
default:priceTypeString=priceTypeAbbr;
break
}}return priceTypeString
};
oh.tradingTool.utils.order.convertTimeInForceType=function(timeInForceAbbr){var timeInForceTypeString="";
if(timeInForceAbbr){switch(String(timeInForceAbbr)){case"0":timeInForceTypeString="Day";
break;
case"1":timeInForceTypeString="GTC";
break;
case"2":timeInForceTypeString="At Open";
break;
case"3":timeInForceTypeString="IOC";
break;
case"4":timeInForceTypeString="FOK";
break;
case"7":timeInForceTypeString="At Close";
break;
default:timeInForceTypeString=timeInForceAbbr
}}return timeInForceTypeString
};
oh.tradingTool.utils.order.convertTransactionType=function(transactionTypeAbbr){var transactionTypeString="";
if(transactionTypeAbbr){switch(transactionTypeAbbr.toUpperCase()){case"BTC":transactionTypeString="Buy to Close";
break;
case"BTO":transactionTypeString="Buy to Open";
break;
case"STC":transactionTypeString="Sell to Close";
break;
case"STO":transactionTypeString="Sell to Open";
break;
default:transactionTypeString=transactionTypeAbbr
}}return transactionTypeString
};
oh.tradingTool.utils.order.convertTriggerTrailStopStatusType=function(statusTypeAbbr){var statusTypeString="";
if(statusTypeAbbr){switch(statusTypeAbbr.toUpperCase()){case"C":statusTypeString="Canceled";
break;
case"E":statusTypeString="Expired";
break;
case"J":statusTypeString="Rejected";
break;
case"O":statusTypeString="Updated";
break;
case"T":statusTypeString="Triggered";
break;
default:oh.core.log.warn("Could not find matching status type","convertTriggerTrailStopStatusType",{statusTypeAbbr:statusTypeAbbr});
statusTypeString=statusTypeAbbr
}}return statusTypeString
};
oh.tradingTool.utils.order.getFormattedDate=function(dateTimeString){if(!dateTimeString){oh.core.log.warn("No data or incorrect data","oh.utils.ticket.getPrettyDate",{dateTimeString:dateTimeString});
return""
}var newDateTimeString=dateTimeString.replace(/-/g,"/");
return newDateTimeString
};
oh.tradingTool.utils.order.getOrderDetailContext=function(orderDetails){var METHODNAME="getOrderDetailContext";
var context=null;
if(oh.utils.objects.objectHasProperties(orderDetails)){var orderRestatementRows=oh.tradingTool.utils.order.getOrderDetailContextRows(orderDetails);
var orderCreatedOn=(orderDetails.date_created)?"Created On: "+oh.tradingTool.utils.order.getFormattedDate(orderDetails.date_created):"";
var orderTitle=orderDetails.order_title||"";
context={orderTitle:orderTitle,orderCreatedOn:orderCreatedOn,orderRestatementRows:orderRestatementRows}
}return context
};
oh.tradingTool.utils.order.getOrderDetailContextRows=function(orderDetails){var METHODNAME="getOrderDetailContextRows";
var counter=0;
var orderRestatementRows=[];
if(oh.utils.objects.objectHasProperties(orderDetails)){if(orderDetails.trigger_condition_type){var triggeredOrder=orderDetails.triggered_order;
var triggeredOrderLegs=triggeredOrder.legs;
if(orderDetails.trigger_condition_type=="trigger"){oh.tradingTool.utils.order.addTrigger(orderDetails,orderRestatementRows);
if(triggeredOrder.trigger_condition_type=="trailing_stop"){oh.tradingTool.utils.order.addTrailingStop(triggeredOrder,orderRestatementRows);
var triggeredTrailingStopOrder=triggeredOrder.triggered_order;
var triggeredTrailingStopOrderLegs=triggeredOrder.triggered_order.legs;
oh.tradingTool.utils.order.addOrder(triggeredTrailingStopOrder,triggeredTrailingStopOrderLegs,counter,orderRestatementRows)
}else{oh.tradingTool.utils.order.addOrder(triggeredOrder,triggeredOrderLegs,counter,orderRestatementRows)
}}else{if(orderDetails.trigger_condition_type=="trailing_stop"){oh.tradingTool.utils.order.addTrailingStop(orderDetails,orderRestatementRows);
oh.tradingTool.utils.order.addOrder(triggeredOrder,triggeredOrderLegs,counter,orderRestatementRows)
}else{oh.tradingTool.utils.order.error("Received incorrect trigger_condition_type",METHODNAME,{trigger_condition_type:trigger_condition_type})
}}}else{var orderDetailLegs=orderDetails.legs;
oh.tradingTool.utils.order.addOrder(orderDetails,orderDetailLegs,counter,orderRestatementRows)
}}else{oh.core.log.debug("Received empty order.details data",METHODNAME)
}return orderRestatementRows
};
oh.tradingTool.utils.order.getOrderHistorySortActivityDate=function(orderHistoryItem){var methodname="oh.tradingTool.utils.order.getOrderHistorySortActivityDate";
if(orderHistoryItem.trailstop_description){return orderHistoryItem.trailstop_date_updated
}else{if(orderHistoryItem.trigger_description){return orderHistoryItem.trigger_date_updated
}else{return orderHistoryItem.activity_date
}}};
oh.tradingTool.utils.order.getTrailingStopDescription=function(trailingStopDetails,trailingStopTimeInForce){var METHODNAME="oh.tradingTool.utils.order.getTrailingStopDescription";
var description=trailingStopDetails.trailstop_description+", ";
var currentPrice=(trailingStopDetails.trailstop_current_price)?"("+oh.utils.formatting.currency(trailingStopDetails.trailstop_current_price)+")":"";
if(trailingStopDetails&&trailingStopDetails.trailstop_price_condition){switch(trailingStopDetails.trailstop_price_condition.toUpperCase()){case"AD$":description+="Ask price down "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"BD$":description+="Bid price down "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"LD$":description+="Last price down "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"ADP":description+="Ask price down "+trailingStopDetails.trailstop_condition_amount+"%";
break;
case"BDP":description+="Bid price down "+trailingStopDetails.trailstop_condition_amount+"%";
break;
case"LDP":description+="Last price down "+trailingStopDetails.trailstop_condition_amount+"%";
break;
case"AU$":description+="Ask price up "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"BU$":description+="Bid price up "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"LU$":description+="Last price up "+oh.utils.formatting.currency(trailingStopDetails.trailstop_condition_amount);
break;
case"AUP":description+="Ask price up "+trailingStopDetails.trailstop_condition_amount+"%";
break;
case"BUP":description+="Bid price up "+trailingStopDetails.trailstop_condition_amount+"%";
break;
case"LUP":description+="Last price up "+trailingStopDetails.trailstop_condition_amount+"%";
break;
default:oh.core.log.warn("incorrect trailing stop price condition",METHODNAME,{trailstop_price_condition:trailstop_price_condition})
}}description+=currentPrice+", ";
if(trailingStopDetails.trailstop_start_time&&trailingStopDetails.trailstop_end_time){description+="from "+(oh.utils.formatting.time(trailingStopDetails.trailstop_start_time))+" to "+(oh.utils.formatting.time(trailingStopDetails.trailstop_end_time))+", "
}if(trailingStopTimeInForce){switch(String(trailingStopTimeInForce)){case"0":description+="Duration: Day";
break;
case"1":description+="Duration: GTC";
break;
default:oh.core.log.error("invalid trailing stop duration")
}}return description
};
oh.tradingTool.utils.order.getTriggerDescription=function(triggerDetails,triggerTimeInForce){var description="";
if(triggerDetails.trigger_type=="T"){description+=" at "+oh.utils.formatting.time(triggerDetails.trigger_start_time)
}else{description+=triggerDetails.trigger_description+", ";
if(triggerDetails&&triggerDetails.trigger_price_condition){switch(triggerDetails.trigger_price_condition.toUpperCase()){case"GL":description+="Last price Greater than ";
break;
case"LL":description+="Last price Lower than ";
break;
default:oh.core.log.error("invalid trigger price condition "+triggerDetails.trigger_price_condition)
}}description+="$"+Number(triggerDetails.trigger_price_threshold).toFixed(2)+", ";
if(triggerDetails.trigger_start_time&&triggerDetails.trigger_end_time){description+="from "+(oh.utils.formatting.time(triggerDetails.trigger_start_time))+" to "+(oh.utils.formatting.time(triggerDetails.trigger_end_time))+", "
}if(triggerTimeInForce){switch(String(triggerTimeInForce)){case"0":description+="Duration: Day";
break;
case"1":description+="Duration: GTC";
break;
default:oh.core.log.error("invalid trigger duration "+triggerDetails.trigger_duration)
}}}return description
}
})(jQuery);
(function($){oh.namespace("oh.tradingTool.utils.webMessage");
oh.tradingTool.utils.webMessage.checkAuthToken=function(methodName){var authTokenSet=!!top.authToken;
if(!authTokenSet){oh.core.log.error("The auth token is not set at the top application level.",methodName)
}return authTokenSet
};
oh.tradingTool.utils.webMessage.loadPreference=function(preferenceName,options){var METHODNAME="oh.tradingTool.utils.webMessage.loadPreference";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}return oh.utils.webMessageNew.loadPreference(top.authToken,preferenceName,options)
};
oh.tradingTool.utils.webMessage.savePreference=function(preferenceName,preferenceValue,options){var METHODNAME="oh.tradingTool.utils.webMessage.savePreference";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}return oh.utils.webMessageNew.savePreference(top.authToken,preferenceName,preferenceValue,options)
};
oh.tradingTool.utils.webMessage.viewChain=function(account,symbol,greeks,bs,quotesAfter,options){var METHODNAME="oh.tradingTool.utils.webMessage.viewChain";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var immutableOptions={action:"view.chain",data:{authToken:top.authToken,account:account,symbol:symbol,greeks:greeks,bs:bs,quotesAfter:quotesAfter}};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.getCommissionSchedule=function(accountId,symbol,options){var METHODNAME="oh.tradingTool.utils.webMessage.getCommissionSchedule";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,account:accountId};
if(symbol){data.underlying=symbol
}var immutableOptions={action:"account-commission-schedule-find",data:data};
var mutableOptions={dataType:oh.core.transport.XML_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.viewQuote=function(symbol,accountId,description,fundamentals,bs,options){var METHODNAME="oh.tradingTool.utils.webMessage.viewQuote";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,symbol:symbol,account:accountId,description:description,fundamentals:fundamentals,bs:bs};
var immutableOptions={action:"view.quote",data:data};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.accountSymbolPositions=function(symbol,accountId,options){var METHODNAME="oh.tradingTool.utils.webMessage.accountSymbolPositions";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,symbol:symbol,account:accountId};
var immutableOptions={action:"account.symbol.positions",data:data};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.viewQuoteList=function(symbols,options){var METHODNAME="oh.tradingTool.utils.webMessage.viewQuoteList";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,key:symbols};
var immutableOptions={action:"view.quote.list",data:data};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.orderDetails=function(orderId,accountId,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.orderDetails";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,order_details:{master_order_id:orderId,account_id:accountId,timestamp:timestamp}};
var immutableOptions={action:"order.details",data:data,url:oh.core.transport.JSON_URL};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.getMasterAccountOrdersRequestImmutableOptions=function(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.getMasterAccountOrdersRequestImmutableOptions";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,master_order:{account_id:accountId}};
if(options&&options.response_type){data.master_order.response_type=options.response_type
}if(sortKey){data.master_order.sort_key=sortKey
}if(sortOrder){data.master_order.sort_order=sortOrder
}if(page){data.master_order.page=page;
data.master_order.page_size=pageSize
}if(filter){data.master_order.filter=filter
}if(timestamp){data.master_order.timestamp=timestamp
}var immutableOptions={action:"master.account.orders",data:data,url:oh.core.transport.JSON_URL};
return immutableOptions
};
oh.tradingTool.utils.webMessage.masterAccountOrders=function(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.masterAccountOrders";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var immutableOptions=oh.tradingTool.utils.webMessage.getMasterAccountOrdersRequestImmutableOptions(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options);
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.masterAccountOrdersPrint=function(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.masterAccountOrders";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}if(!options){options={}
}options.response_type="print";
return oh.tradingTool.utils.webMessage.masterAccountOrders(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options)
};
oh.tradingTool.utils.webMessage.masterAccountOrdersCSV=function(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.masterAccountOrders";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}if(!options){options={}
}options.response_type="csv";
return oh.tradingTool.utils.webMessage.masterAccountOrders(accountId,sortKey,sortOrder,page,pageSize,filter,timestamp,options)
};
oh.tradingTool.utils.webMessage.orderHistory=function(orderId,accountId,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.orderHistory";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,order_history:{master_order_id:orderId,account_id:accountId}};
if(timestamp){data.order_history.timestamp=timestamp
}var immutableOptions={action:"order.history",data:data,url:oh.core.transport.JSON_URL};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.tradingTool.utils.webMessage.executionReport=function(orderId,accountId,timestamp,options){var METHODNAME="oh.tradingTool.utils.webMessage.executionReport";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,master_order:{master_order_id:orderId,account_id:accountId}};
if(timestamp){data.master_order.timestamp=timestamp
}var immutableOptions={action:"master.order.exreport",data:data,url:oh.core.transport.JSON_URL};
var mutableOptions={dataType:oh.core.transport.JSON_DATA_TYPE};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
}
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.PopupWindow=oh.Awesome.extend({openerWindow:null,openPopupWindowTriggerId:null,popupWindowUrl:null,popupWindowName:null,popupWindowParams:null,popupWindow:null,$openPopupWindowTrigger:null,constructor:function(openerWindow,openPopupWindowTriggerId,popupWindowUrl,popupWindowName,popupWindowParams,instanceHandle,className,logMethod){var METHODNAME="constructor";
this.base(instanceHandle,className||"oh.tradingTool.PopupWindow",logMethod||"info");
this.openerWindow=openerWindow;
this.openPopupWindowTriggerId=openPopupWindowTriggerId;
this.popupWindowUrl=popupWindowUrl;
this.popupWindowName=popupWindowName;
this.popupWindowParams=popupWindowParams;
this.log(METHODNAME+": Completed")
},init:function(){var METHODNAME="init";
this.$openPopupWindowTrigger=$("#"+this.openPopupWindowTriggerId);
oh.utils.objects.bindAsEventListener(this,"click",this.$openPopupWindowTrigger,this.openPopupWindow);
oh.utils.objects.bindAsEventListener(this,"unload",this.openerWindow,this.handleOpenerWindowUnload);
this.log(METHODNAME+": Completed")
},openPopupWindow:function(evt){var METHODNAME="openPopupWindow";
this.log(METHODNAME+": Open popup window trigger clicked");
evt.preventDefault();
if(!this.popupWindow||this.popupWindow.closed){this.log(METHODNAME+": "+this.popupWindowName+" - Opening popup window",{authToken:this.openerWindow.authToken});
this.popupWindow=this.openerWindow.open(this.popupWindowUrl,this.popupWindowName,this.popupWindowParams)
}else{this.log(METHODNAME+": "+this.popupWindowName+" - Popup window already open")
}this.popupWindow.focus()
},handleOpenerWindowUnload:function(evt){var METHODNAME="handleOpenerWindowUnload";
this.log(METHODNAME+": "+this.popupWindowName+" - Opener window unload");
if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close()
}}})
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.AccountManagementPopupWindow=oh.tradingTool.PopupWindow.extend({defaultTabId:null,popupWindowBaseUrl:"/securehost/tool/current/app/accountManagement/page/home.jsp",popupWindowName:"accountManagementWindow",popupWindowParams:"width=750,height=380,resizable=1,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,titlebar=0",constructor:function(openerWindow,openPopupWindowTriggerId,defaultTabId,instanceHandle,logMethod){var METHODNAME="constructor";
this.defaultTabId=defaultTabId||"accountsInfo";
this.popupWindowUrl=this.popupWindowBaseUrl+"?defaultTabId="+this.defaultTabId;
this.base(openerWindow,openPopupWindowTriggerId,this.popupWindowUrl,this.popupWindowName,this.popupWindowParams,instanceHandle,"oh.tradingTool.AccountManagementPopupWindow",logMethod||"info");
this.log(METHODNAME+": Completed")
}})
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.AccountManagement=oh.Awesome.extend({toolWindow:null,constructor:function(toolWindow,instanceHandle,logMethod){var METHODNAME="constructor";
this.base(instanceHandle,"oh.tradingTool.AccountManagement",logMethod||"info");
this.toolWindow=toolWindow;
this.log(METHODNAME+": Completed")
},init:function(){var METHODNAME="init";
(new oh.tradingTool.AccountManagementPopupWindow(this.toolWindow,"accountManagementTrigger","accountsInfo","Account Management Manage Accounts Window Controller")).init();
this.log(METHODNAME+": Completed")
}})
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.ChangeAccount=oh.Awesome.extend({constructor:function(toolWindow,instanceHandle,logMethod){var METHODNAME="constructor";
this.base(instanceHandle,"oh.tradingTool.ChangeAccount",logMethod||"info");
this.toolWindow=toolWindow;
this.log(METHODNAME+": Completed")
},init:function(){var METHODNAME="init";
var _this=this;
this.$openChangeAccountFlyoverTrigger=$("#openChangeAccountFlyoverTrigger");
var handleOpenChangeAccountFlyoverTriggerClickWrapper=function(evt){_this.handleOpenChangeAccountFlyoverTriggerClick(evt)
};
this.$openChangeAccountFlyoverTrigger.click(handleOpenChangeAccountFlyoverTriggerClickWrapper);
this.log(METHODNAME+": Completed")
},handleOpenChangeAccountFlyoverTriggerClick:function(evt){var METHODNAME="handleOpenChangeAccountFlyoverTriggerClick";
this.log(METHODNAME+": Open change account flyover trigger clicked");
this.toolWindow.getAccountSwitch()
}})
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.Manager=oh.SuperAwesome.extend({classHandle:"oh.tradingTool.Manager",mainEventNodeSelector:"body#mainBody",$mainEventNode:null,templateContainerSelector:"#all_flyovers",$templateContainer:null,flyovers:{},accountManagementComponents:{},iframedComponents:{},init:function(){this.handleFlyoverMarkupLoaded();
this.base()
},bind:function(eventName,func){this.log("Binding global event","bind",{eventName:eventName});
(this.getMainEventNode()).bind(eventName,func)
},triggerHandler:function(eventName,eventData){this.log("Triggering global event","triggerHandler",{eventName:eventName,eventData:eventData});
(this.getMainEventNode()).triggerHandler(eventName,eventData)
},getMainEventNode:function(){if(!this.$mainEventNode){this.$mainEventNode=$(this.mainEventNodeSelector)
}if(this.$mainEventNode.length===0){this.error("Couldn't find main event node","getMainEventNode",{mainEventNodeSelector:this.mainEventNodeSelector})
}return this.$mainEventNode
},headersLoaded:function(){return top.loadedArray.frame_header.loaded
},handleFlyoverMarkupLoaded:function(){var handler=oh.utils.objects.getFunctionInContext(this,this.findTemplateContainer);
this.bind("flyoverMarkupLoaded",handler)
},findTemplateContainer:function(){var METHODNAME="findTemplateContainer";
this.$templateContainer=$(this.templateContainerSelector);
if(this.$templateContainer.length===0){this.error("Missing $templateContainer",METHODNAME,{templateContainerSelector:this.templateContainerSelector});
return false
}return true
},getTemplateSelector:function(key){return"#flyover_"+key
},getStaticMarkup:function(key,options){var opts=options||{};
var selector=this.getTemplateSelector(key);
var $node=$(selector,this.$templateContainer);
if($node.length===0){this.error("Couldn't get markup node","getStaticMarkup",{key:key});
return null
}var markup=$node.html();
if(opts.singleInstanceOnly){$node.remove()
}return markup
},getTemplateObject:function(key,directive,options,instanceHandle,debugMode){var selector=this.getTemplateSelector(key);
var defaults={removeAfterCompiling:true,jQueryContext:this.$templateContainer,pureContext:this.$templateContainer};
var opts=$.extend({},defaults,options);
var pureTemplate=oh.PureTemplate.getInstance([selector,directive,opts],instanceHandle,debugMode);
if(!pureTemplate.initSuccessful){this.error("Error building template object","getTemplateObject",{key:key});
return null
}return pureTemplate
},registerComponent:function(obj){var METHODNAME="registerComponent";
var key,processId,collectionName,collection,objExists=!!obj;
if(objExists){key=obj.key;
processId=obj.processId;
collectionName=obj.collectionName;
if(key&&processId&&collectionName){collection=this[obj.collectionName];
if(collection){if(!collection[key]){collection[key]={}
}this.log("Successfully registered component",METHODNAME,{namespace:this.getLogHandle(collectionName+"."+key+"."+processId)});
collection[key][processId]=obj;
return true
}}}this.error("Error registering component. Parameter missing?",METHODNAME,{objExists:objExists,key:key||"missing",processId:processId||"missing",collectionName:collectionName||"missing",collectionExists:!!collection});
return false
}},oh.classInterface.singleton)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.Controller=oh.SuperAwesome.extend({classHandle:"oh.tradingTool.Controller",key:null,processId:null,init:function(){this.setProcessId();
this.waitToBindInternalHandlers();
this.waitToBindExternalHandlers();
this.base()
},setProcessId:function(){if(!this.processId){var prefix=this.key+"Id_";
this.processId=oh.utils.dom.getUniqueId(prefix)
}},bind:function(eventName,func){var METHODNAME="bind";
var testProcessId=this.processId;
this.log("Binding handler to processId",METHODNAME,{eventName:eventName,processId:testProcessId});
var logMethod=oh.utils.objects.getFunctionInContext(this,this.log);
var errorMethod=oh.utils.objects.getFunctionInContext(this,this.error);
var wrappedFunc=function(evt,data){if(!data||!data.processId){this.error("No event data for evaluating processId",METHODNAME,{evt:evt||"undefined",data:data||"undefined"});
return 
}var eventProcessId=data.processId;
var shouldExecuteHandler=(eventProcessId===testProcessId);
logMethod("Evauating processId before executing event handler",METHODNAME,{eventProcessId:eventProcessId,testProcessId:testProcessId,shouldExecuteHandler:shouldExecuteHandler});
if(shouldExecuteHandler){func(evt,data)
}};
oh.tradingTool.manager.bind(eventName,wrappedFunc)
},triggerHandler:function(eventName,eventData){var newEventData=eventData||{};
newEventData.processId=this.processId;
this.log("Triggering event by processId","triggerHandler",{eventName:eventName,eventData:newEventData});
oh.tradingTool.manager.triggerHandler(eventName,newEventData)
},internalBindingCondition:function(){return true
},externalBindingCondition:function(){return true
},bindInternalHandlers:oh.emptyFunction,bindExternalHandlers:oh.emptyFunction,waitToBindInternalHandlers:function(){var METHODNAME="waitToBindExternalHandlers";
this.log("Called",METHODNAME);
var options={conditionalLabel:"waitToBindInternalHandlers for "+this.instanceHandle};
oh.tradingTool.utils.waitForConditionAndAct(this.internalBindingCondition,this.bindInternalHandlers,options)
},waitToBindExternalHandlers:function(){var METHODNAME="waitToBindExternalHandlers";
this.log("Called",METHODNAME);
var options={conditionalLabel:"waitToBindExternalHandlers for "+this.instanceHandle};
oh.tradingTool.utils.waitForConditionAndAct(this.externalBindingCondition,this.bindExternalHandlers,options)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.TopLevelController=oh.tradingTool.Controller.extend({classHandle:"oh.tradingTool.TopLevelController",collectionName:null,viewControllers:{},initialView:null,currentView:null,standardEvents:{viewCreated:"viewCreated",viewChanged:"viewChanged"},init:function(){if(!this.key||!this.collectionName){this.error("To instantiate, you must define a key and a collectionName in your class definition",METHODNAME);
return false
}this.setProcessId();
this.registerWithManager();
this.base()
},registerWithManager:function(){oh.tradingTool.manager.registerComponent(this)
},createViewController:function(viewKey,viewConstructor,initArguments){var index=this.getNextViewControllerIndex();
var initArgs=initArguments||[];
var logHandle=this.getLogHandle("viewControllers."+viewKey);
var debugMode=this.debugMode;
var obj=viewConstructor.getInstance(initArgs,logHandle,debugMode);
this.viewControllers[viewKey]={index:index,obj:obj};
this.triggerHandler(this.standardEvents.viewCreated,{view:viewKey})
},getNextViewControllerIndex:function(){var nextIndex=0;
$.each(this.viewControllers,function(i,val){nextIndex=nextIndex+1
});
return nextIndex
},getViewControllerByIndex:function(index){var returnObj=null;
$.each(this.viewControllers,function(key,val){if(val&&val.index===index){returnObj=val.obj;
return false
}});
if(!returnObj){this.error("Couldn't find an viewController with the specified index","getViewControllerByIndex",{index:index})
}return returnObj
},getIndexOfViewController:function(viewControllerName){var index=-1;
$.each(this.viewControllers,function(key,val){if(viewControllerName===key){index=val.index;
return false
}});
return index
},getViewControllerByName:function(viewControllerName){var obj=null;
$.each(this.viewControllers,function(key,val){if(viewControllerName===key){obj=val.obj;
return false
}});
return obj
},createAllViewControllers:function(){var METHODNAME="createAllViewControllers";
this.error("Abstract method - must be overridden by each sublcass",METHODNAME)
},setCurrentView:function(viewKey){this.log("Setting current view","setCurrentView",{viewKey:viewKey});
this.currentView=viewKey;
this.triggerHandler(this.standardEvents.viewChanged,{view:viewKey})
},setInitialView:function(){if(this.initialView){this.setCurrentView(this.initialView)
}else{this.log("No initialView property defined, so not setting current view","setInitialView")
}}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.TopLevelController=oh.tradingTool.Controller.extend({classHandle:"oh.tradingTool.TopLevelController",collectionName:null,viewControllers:{},initialView:null,currentView:null,standardEvents:{viewCreated:"viewCreated",viewChanged:"viewChanged"},init:function(){if(!this.key||!this.collectionName){this.error("To instantiate, you must define a key and a collectionName in your class definition",METHODNAME);
return false
}this.setProcessId();
this.registerWithManager();
this.base()
},registerWithManager:function(){oh.tradingTool.manager.registerComponent(this)
},createViewController:function(viewKey,viewConstructor,initArguments){var index=this.getNextViewControllerIndex();
var initArgs=initArguments||[];
var logHandle=this.getLogHandle("viewControllers."+viewKey);
var debugMode=this.debugMode;
var obj=viewConstructor.getInstance(initArgs,logHandle,debugMode);
this.viewControllers[viewKey]={index:index,obj:obj};
this.triggerHandler(this.standardEvents.viewCreated,{view:viewKey})
},getNextViewControllerIndex:function(){var nextIndex=0;
$.each(this.viewControllers,function(i,val){nextIndex=nextIndex+1
});
return nextIndex
},getViewControllerByIndex:function(index){var returnObj=null;
$.each(this.viewControllers,function(key,val){if(val&&val.index===index){returnObj=val.obj;
return false
}});
if(!returnObj){this.error("Couldn't find an viewController with the specified index","getViewControllerByIndex",{index:index})
}return returnObj
},getIndexOfViewController:function(viewControllerName){var index=-1;
$.each(this.viewControllers,function(key,val){if(viewControllerName===key){index=val.index;
return false
}});
return index
},getViewControllerByName:function(viewControllerName){var obj=null;
$.each(this.viewControllers,function(key,val){if(viewControllerName===key){obj=val.obj;
return false
}});
return obj
},createAllViewControllers:function(){var METHODNAME="createAllViewControllers";
this.error("Abstract method - must be overridden by each sublcass",METHODNAME)
},setCurrentView:function(viewKey){this.log("Setting current view","setCurrentView",{viewKey:viewKey});
this.currentView=viewKey;
this.triggerHandler(this.standardEvents.viewChanged,{view:viewKey})
},setInitialView:function(){if(this.initialView){this.setCurrentView(this.initialView)
}else{this.log("No initialView property defined, so not setting current view","setInitialView")
}}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.SubController=oh.tradingTool.Controller.extend({classHandle:"oh.tradingTool.SubController",viewKey:null,parentController:null,standardEvents:null,init:function(viewKey,parentController){var METHODNAME="init";
this.viewKey=viewKey;
this.parentController=parentController;
if(!this.parentController){this.error("No parentController",METHODNAME)
}if(this.parentController){this.standardEvents=this.parentController.standardEvents
}this.base()
},setProcessId:function(){if(!this.processId){if(!this.parentController){this.error("No parentController so cannot set processId");
return 
}this.processId=this.parentController.processId
}},bindStandardCustomEventHandlers:function(){var METHODNAME="bindStandardCustomEventHandlers";
this.bindViewChange()
},bindViewChange:function(){this.bind(this.standardEvents.viewChanged,oh.utils.objects.getFunctionInContext(this,this.handleViewChange))
},handleViewChange:function(evt,data){var METHODNAME="handleViewChange";
if(!data||!data.view){this.error("Missing data",METHODNAME,{evt:evt,data:data||"undefined"});
return 
}var viewMatched=(this.viewKey===data.view);
this.log((viewMatched?"Showing":"Hiding"),METHODNAME,{myViewKey:this.viewKey,eventViewKey:data.viewKey});
if(viewMatched){this.handleViewSelected()
}else{this.handleViewDeselected()
}},handleViewSelected:function(){this.log("Method can be overridden by the implementing class","handleViewSelected")
},handleViewDeselected:function(){this.log("Method can be overridden by the implementing class","handleViewDeselected")
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.IframeController=oh.tradingTool.TopLevelController.extend({classHandle:"oh.tradingTool.IframeController",collectionName:"iframedComponents",frameId:null,domId:null,containerSelector:null,$container:null,init:function(){var METHODNAME="init";
this.containerSelector="#content_"+this.domId;
this.log("Called",METHODNAME,{frameId:this.frameId,domId:this.domId,containerSelector:this.containerSelector});
var callbackInContext=oh.utils.objects.getFunctionInContext(this,this.setFrameAndContainerReferences);
this.waitForFrameToLoad(this.frameId,callbackInContext);
this.base()
},onFrameLoad:function(){var METHODNAME="onFrameLoad";
this.error("Subclasses must override this method.",METHODNAME)
},waitForFrameToLoad:function(frameId,callback){var METHODNAME="waitForFrameToLoad";
this.log("Called",METHODNAME,{frameId:frameId});
var conditional=function(){return top.loadedArray[frameId].loaded
};
var options={conditionalLabel:"top.loadedArray["+frameId+"].loaded === true"};
oh.tradingTool.utils.waitForConditionAndAct(conditional,callback,options)
},setFrameAndContainerReferences:function(){var METHODNAME="frameLoaded";
this.log("Called",METHODNAME);
var frameSelector="#"+this.frameId;
this.$container=oh.utils.dom.getElementInFrame(frameSelector,this.containerSelector);
if(this.$container.length===0){this.error("Missing $container",METHODNAME,{frameSelector:frameSelector,containerSelector:this.containerSelector});
return 
}this.onFrameLoad()
},$:function(selector){if(this.$container){return $(selector,this.$container)
}else{this.error("No container","$",{selector:selector})
}},toggleLoading:function(showContent){var METHODNAME="toggleLoading";
showContent=(true===showContent);
var showLoading=!showContent;
this.log("Called",METHODNAME,{showContent:showContent,showLoading:showLoading});
this.$container.toggleClass("loaded_"+this.domId,showContent).toggleClass("loaded",showContent).toggleClass("loading_"+this.domId,showLoading).toggleClass("loading",showLoading)
},isFrameLoading:function(frameId){var $frameBody=oh.utils.dom.getElementInFrame("#"+frameId,"body");
var frameBodyId=$frameBody.attr("id");
return("body_loading"===frameBodyId)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.RightTabsController=oh.tradingTool.IframeController.extend({classHandle:"oh.tradingTool.RightTabsController",key:"rightTabs",frameId:"frame_tabs",domId:"frameworkTabsRight",onClassName:"on",hoverClassName:"hover",currentTabId:null,rightTabsSelector:"#rightTabsContainer li",rightTabIds:[],onFrameLoad:function(){var METHODNAME="onFrameLoad";
this.log("Called",METHODNAME);
var $rightTabs=this.$(this.rightTabsSelector);
var pushRightTabId=oh.utils.objects.getFunctionInContext(this,function(i,element){var tabId=$(element).attr("id");
this.rightTabIds.push(tabId)
});
$.each($rightTabs,pushRightTabId);
$.each(this.rightTabIds,function(i,tabId){top.toolHas[tabId]=true
});
var bindTabEventHandler=oh.utils.objects.getFunctionInContext(this,function(i,tabId){var $rightTab=this.$("#"+tabId);
oh.utils.objects.bindAsEventListener(this,"click",$rightTab,this.handleRightTabClick);
oh.utils.objects.bindAsEventListener(this,"dragstart",$rightTab,this.handleRightTabDragStart);
var _this=this;
$rightTab.hover(function(){$(this).addClass(_this.hoverClassName)
},function(){$(this).removeClass(_this.hoverClassName)
})
});
$.each(this.rightTabIds,bindTabEventHandler);
var initialRightTabId=window.subTabStart;
var conditional=function(){return top.allowTabbing
};
var action=oh.utils.objects.getFunctionInContext(this,function(){this.runTab(initialRightTabId)
});
var options={conditionalLabel:"top.allowTabbing === true"};
oh.tradingTool.utils.waitForConditionAndAct(conditional,action,options);
this.toggleLoading(true)
},handleRightTabClick:function(evt){evt.preventDefault();
var $target=$(evt.target);
var tabId=$target.attr("id");
this.runTab(tabId)
},handleRightTabDragStart:function(evt){var METHODNAME="handleRightTabDragStart";
this.log("Called",METHODNAME);
evt.preventDefault()
},getTabStyleElement:function(tabId){return this.$("#"+tabId)
},getNameFromFrameId:function(frameId){return frameId.replace("tab_","")
},getSectionFromFrameId:function(frameId){return"subtable_"+this.getNameFromFrameId(frameId)
},getTargetFrameIdFromFrameId:function(frameId){return"frame_"+this.getNameFromFrameId(frameId)
},getTargetXslFilenameFromFrameId:function(frameId){return this.getNameFromFrameId(frameId)
},runTab:function(tabId){var METHODNAME="runTab";
this.log("Called",METHODNAME,{tabId:tabId});
this.currentTabId=tabId;
this.saveSideTabsDefaultPreference(tabId);
if(!shouldShowSideTabs()){subtabs(this.getSectionFromFrameId(tabId));
this.setTabSelectionClass(tabId);
if(this.isFrameLoading(this.getTargetFrameIdFromFrameId(tabId))){this.loadSideTab(tabId)
}}else{setSubTabsLaunchParams(tabId)
}},setTabSelectionClass:function(selecteTabId){var setOnOffClass=oh.utils.objects.getFunctionInContext(this,function(i,tabId){var $tabStyleElement=this.getTabStyleElement(tabId);
$tabStyleElement.toggleClass(this.onClassName,(selecteTabId===tabId));
$tabStyleElement.removeClass(this.hoverClassName)
});
$.each(this.rightTabIds,setOnOffClass)
},saveSideTabsDefaultPreference:function(tabId){var METHODNAME="saveSideTabsDefaultPreference";
if(allowTabbing){this.log("Saving sideTabsDefault preference",METHODNAME,{tabId:tabId});
var _this=this;
var savePreferenceSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){_this.log("Successfully saved preference sideTabsDefault = "+tabId,METHODNAME)
}else{_this.error("Error saving sideTabsDefault preference",METHODNAME)
}};
var savePreferenceErrorCallback=function(xhr,status,error){_this.error("Error saving sideTabsDefault preference",METHODNAME)
};
var options={successCallback:savePreferenceSuccessCallback,defaultErrorCallback:savePreferenceErrorCallback,async:false};
oh.tradingTool.utils.webMessage.savePreference("sideTabsDefault",tabId,options)
}},loadSideTab:function(tabId){var METHODNAME="loadSideTab";
var ezMessage=requestEnv("echo",{echo:"<layout>base</layout>"});
var targetSideFrameXslFilename=this.getTargetXslFilenameFromFrameId(tabId);
var targetXslPath=pathName+targetSideFrameXslFilename+"/"+targetSideFrameXslFilename+".xsl";
var targetSideFrameId=this.getTargetFrameIdFromFrameId(tabId);
this.log("Submitting XML",METHODNAME,{tabId:tabId,targetXslPath:targetXslPath,targetSideFrameId:targetSideFrameId});
submitXML(ezMessage,targetXslPath,targetSideFrameId)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.AbstractFlyoverController=oh.tradingTool.TopLevelController.extend({classHandle:"oh.tradingTool.AbstractFlyoverController",collectionName:"flyovers",$flyover:null,currentlyVisible:false,defaultDialogOptions:{dialogClass:"ohComponent oh-component flyoverComponent flyover-component",autoOpen:false,bgiframe:true,modal:false,resizable:false,draggable:false},dialogOptions:null,init:function(dialogOptions){if(!this.key){this.error("Key required in class definition to instantiate",METHODNAME);
return false
}this.dialogOptions=$.extend(true,{},this.defaultDialogOptions,dialogOptions);
this.base();
return true
},buildFlyover:function(markup,dialogOverrides){var _this=this;
if(this.$flyover){this.$flyover.remove();
this.$flyover=null
}this.$flyover=$(markup);
this.$flyover.dialog(this.getDialogOptions(dialogOverrides)).bind("dialogopen",function(){_this.currentlyVisible=true
}).bind("dialogclose",function(){_this.currentlyVisible=false
}).draggable("option","iframeFix",true);
oh.utils.dom.wrapUIButtons(this.$flyover.parent());
this.bindInternalHandlers()
},mergeDialogOptions:function(dialogOverrides){if(dialogOverrides){if(this.dialogOptions.dialogClass&&dialogOverrides.dialogClass){dialogOverrides.dialogClass+=" "+this.dialogOptions.dialogClass
}this.dialogOptions=$.extend(true,{},this.dialogOptions,dialogOverrides)
}},getDialogOptions:function(dialogOverrides){this.mergeDialogOptions(dialogOverrides);
return this.dialogOptions
},toggleFlyover:function(show){var METHODNAME="toggleFlyover";
if(this.shouldExit(METHODNAME)){return 
}this.log("Called",METHODNAME);
if(!this.$flyover){this.error("No $flyover. You must run buildFlyover first.",METHODNAME);
return 
}if(show===undefined){show=!this.currentlyVisible
}if(this.currentlyVisible!==show){var dialogMethod=(show?"open":"close");
this.$flyover.dialog(dialogMethod)
}},showFlyover:function(){this.toggleFlyover(true)
},hideFlyover:function(){this.toggleFlyover(false)
}})
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.StaticFlyoverController=oh.tradingTool.AbstractFlyoverController.extend({classHandle:"oh.tradingTool.StaticFlyoverController",markup:null,init:function(dialogOptions){var METHODNAME="init";
var success=this.base(dialogOptions);
this.markup=this.getStaticMarkup();
if(!success||!this.markup){this.error("Failed to generate markup",METHODNAME,{key:this.key});
return 
}this.confirmSuccessfulInit()
},getStaticMarkup:function(){return oh.tradingTool.manager.getStaticMarkup(this.key)
},buildFlyover:function(){var markup=this.markup;
this.base(markup)
},toggleFlyover:function(show){if(!this.$flyover){this.buildFlyover()
}this.base(show)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.DynamicFlyoverController=oh.tradingTool.AbstractFlyoverController.extend({classHandle:"oh.tradingTool.DynamicFlyoverController",template:null,currentContext:null,init:function(key,directive,templateOptions,dialogOptions){var METHODNAME="init";
var success=this.base(key,dialogOptions);
this.template=this.getTemplate(key,directive,templateOptions);
if(!success||!this.template){this.error("Failed to generate template",METHODNAME,{key:key});
return 
}this.confirmSuccessfulInit()
},getTemplate:function(key,directive,options){var instanceHandle=this.getLogHandle("template");
var newTemplate=oh.tradingTool.manager.getTemplateObject(key,directive,options,instanceHandle,this.debugMode);
return newTemplate
},buildFlyover:function(context,dialogOverrides){var markup=this.template.getMarkup(context);
this.base(markup,dialogOverrides)
},renderFlyover:function(context,dialogOverrides){if(!this.$flyover||dialogOverrides||this.currentContext!==context){this.buildFlyover(context,dialogOverrides)
}this.currentContext=context
},toggleFlyover:function(show,context){if(show){this.renderFlyover(context)
}this.base(show)
},showFlyover:function(context){this.toggleFlyover(true,context)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.tradingTool");
oh.tradingTool.VirtualDisclaimerController=oh.tradingTool.StaticFlyoverController.extend({classHandle:"oh.tradingTool.VirtualDisclaimerController",key:"virtualDisclaimer",myDisclaimerKey:"VTdisclaimerVersion",myDisclaimerVersion:null,currentDisclaimerKey:"VTdisclaimerCurrentVersion",currentDisclaimerVersion:null,$checkbox:null,init:function(){this.myDisclaimerVersion=oh.utils.forms.getValue("#"+this.myDisclaimerKey);
this.currentDisclaimerVersion=oh.utils.forms.getValue("#"+this.currentDisclaimerKey);
this.$checkbox=$("#VTdisclaimer");
var _this=this;
var dialogOptions={title:"About Virtual Trading",width:620,buttons:{Close:function(){_this.hideFlyover()
}},beforeclose:function(){_this.setPreference()
}};
this.bindExternalHandlers=oh.utils.objects.getFunctionInContext(this,this.bindExternalHandlers);
this.base(dialogOptions)
},externalBindingCondition:function(){return oh.tradingTool.manager.headersLoaded()
},bindExternalHandlers:function(){var METHODNAME="bindExternalHandlers";
if(top.isVirtual!="true"){this.log("Real account so don't need to show or bind virtual tab image",METHODNAME);
return 
}this.showFlyoverOnLogin();
var $virtualTab=oh.utils.dom.getElementInFrame("#frame_header","#virtual_tab");
if($virtualTab.length===0){this.error("No virtual tab to bind",METHODNAME);
return 
}this.log("Showing and binding virtual tab",METHODNAME);
oh.utils.objects.bindAsEventListener(this,"click",$virtualTab,function(){this.toggleFlyover()
});
$virtualTab.css({cursor:"pointer",visibility:"visible"})
},showFlyoverOnLogin:function(){if(this.myDisclaimerVersion!=this.currentDisclaimerVersion){this.toggleFlyover(true)
}},setPreference:function(){var METHODNAME="setPreference";
var checkboxValue=oh.utils.forms.getValue(this.$checkbox);
if(checkboxValue==="on"){this.log("Setting disclaimer preference",METHODNAME);
window.prefSave(this.myDisclaimerKey,this.currentDisclaimerVersion,window.genericPrefVerify)
}else{this.log("No need to set disclaimer preference",METHODNAME)
}}},oh.classInterface.singleton)
})(jQuery);
oh.namespace("oh.tradingTool");
oh.tradingTool.CollectionModel=oh.SuperAwesome.extend({classHandle:"oh.tradingTool.CollectionModel",currentPage:0,dataConverters:{mixedToString:function(){return String(arguments[0])
},stringToDate:function(){var date=oh.utils.strings.extractDateAsDate(arguments[0]);
var time=null;
if(date){time=date.getTime()
}oh.core.log.warn("Conversion","stringToDate",{dateString:arguments[0],date:String(date),time:time});
return time
},stringToFloat:function(){return oh.utils.strings.extractNumberAsNumber(arguments[0])
},stringToInt:function(){return Math.floor(oh.utils.strings.extractNumberAsNumber(arguments[0]))
}},dataSorters:{asc:function(a,b){if(a===b){return 0
}else{if(a<b){return -1
}else{return 1
}}},desc:function(a,b){if(a===b){return 0
}else{if(a>b){return -1
}else{return 1
}}}},idKey:null,records:null,recordsPerPage:10,sortDataTypes:null,sortValueExtractors:null,sortKey:"",sortOrder:"",init:function(collectionOptions){if(this.initSuccessful){return 
}this.records=[];
this.sortDataTypes={};
this.sortValueExtractors={};
this.initCollectionOptions(collectionOptions);
this.confirmSuccessfulInit()
},initCollectionOptions:function(collectionOptions){this.log("Object collection being initialized","init",collectionOptions);
this.setSortOrder(collectionOptions.sortOrder);
this.setSortKey(collectionOptions.sortKey);
this.setRecordsPerPage(collectionOptions.recordsPerPage);
this.setIdKey(collectionOptions.idKey);
this.setCurrentPage(collectionOptions.currentPage)
},addRecord:function(record){if(this.shouldExit("addRecords")){return 
}this.records.push(record)
},addRecordsRaw:function(records){if(this.shouldExit("addRecordsRaw")||!oh.utils.objects.isArray(records)){return 
}if(this.getRecordCount()===0){this.records=records
}else{for(var i=0,length=records.length;
i<length;
i++){this.addRecord(records[i])
}}this.log("Number of records inserted: "+records.length,"addRecordsRaw");
this.onAfterRecordsUpdated(this,records)
},addSortDataType:function(key,dataType){this.sortDataTypes[key]=dataType
},addSortValueExtractor:function(key,func){if(typeof func!=="function"){this.error("Second parameter must be a function.","addSortValueExtractor");
return 
}this.sortValueExtractors[key]=func
},getId:function(record){if(typeof record[this.idKey]!=="undefined"){return record[this.idKey]
}return null
},getIndexByPage:function(page){return this.recordsPerPage*page
},getLastPage:function(){return Math.ceil(this.getRecordCount()/this.recordsPerPage)-1
},getNextPage:function(){var nextPage=this.currentPage+1;
if(nextPage>this.getLastPage()){nextPage=0
}return nextPage
},getPageCount:function(){return Math.ceil(this.getRecordCount()/this.recordsPerPage)
},getPrevPage:function(){var prevPage=this.currentPage-1;
if(prevPage<0){prevPage=this.getLastPage()
}return prevPage
},getRecordCount:function(){return this.records.length
},getRecordById:function(id){var i=this.getRecordIndexById(id);
return(i<0)?null:this.records[i]
},getRecordIndexById:function(id){if(!this.idKey){return -1
}for(var i=0,length=this.records.length;
i>length;
i++){if(this.records[i][this.idKey]===id){return i
}}return -1
},getRecords:function(startIndex,endIndex){if(this.shouldExit("getRecords")){return[]
}this.log("Get records by start and end index","getRecords",{startIndex:startIndex,endIndex:endIndex});
if(endIndex>=this.getRecordCount()){endIndex=this.getRecordCount()-1
}if(this.isValidIndexRange(startIndex,endIndex)){if(startIndex===endIndex){return[this.records[startIndex]]
}else{var results=[];
for(var i=startIndex,length=endIndex+1;
i<length;
i++){results.push(this.records[i])
}return results
}}else{this.error("Cannot retrieve records for an invalid range of indexes","getRecords",{startIndex:startIndex,endIndex:endIndex});
return[]
}},getRecordsByPage:function(page){if(this.shouldExit("getRecordsByPage")||!this.pageExists(page)){return[]
}var startIndex=0,endIndex=0;
if(this.recordsPerPage<0){startIndex=0;
endIndex=this.getRecordCount()-1
}else{startIndex=this.getIndexByPage(page);
endIndex=startIndex+this.recordsPerPage
}this.setCurrentPage(page);
this.log("Get records in range","getRecordsByPage",{page:page,startIndex:startIndex,endIndex:endIndex});
return this.getRecords(startIndex,endIndex)
},getRecordsForCurrentPage:function(){this.log("Get the records for the current page: "+this.currentPage,"getRecordsForCurrentPage");
try{return this.getRecordsByPage(this.currentPage)
}catch(err){this.error(err,"getRecordsForCurrentPage");
return[]
}},getRecordsForFirstPage:function(){return this.getRecordsByPage(0)
},getRecordsForLastPage:function(){return this.getRecordsByPage(this.getLastPage())
},getRecordsForNextPage:function(){return this.getRecordsByPage(this.getNextPage())
},getRecordsForPrevPage:function(){return this.getRecordsByPage(this.getPrevPage())
},getSortDataType:function(key){return(this.sortDataTypes[key])?this.sortDataTypes[key]:"string"
},getSortValueExtractor:function(key){if(this.sortValueExtractors[key]){return this.sortValueExtractors[key]
}else{return null
}},isValidIndexRange:function(startIndex,endIndex){return(startIndex<=endIndex&&startIndex>=0&&endIndex<=this.getRecordCount()-1)
},onAfterRecordsSorted:function(collection){this.log("This method may be used by other objects as an event handler.","onAfterRecordsSorted")
},onBeforeRecordsSorted:function(collection){this.log("This method may be used by other objects as an event handler.","onBeforeRecordsSorted")
},onAfterRecordsUpdated:function(collection,records){this.log("This method may be used by other objects as an event handler.","onAfterRecordsUpdated")
},pageExists:function(page){if(isNaN(page)){return false
}else{if(this.recordsPerPage<0){return(page===0)
}else{if(page<this.getRecordCount()/this.recordsPerPage){return true
}}}},purgeRecords:function(){this.records=[]
},setIdKey:function(idKey){if(typeof idKey==="string"&&idKey!==""){this.idKey=idKey
}},setCurrentPage:function(page){if(this.pageExists(page)){this.currentPage=page
}},setRecordsPerPage:function(num){if(typeof num==="number"&&!isNaN(num)){this.recordsPerPage=num;
this.log("Setting number of records per page: "+num,"setRecordsPerPage")
}},setSortKey:function(key){if(typeof key==="string"&&key!==""){this.sortKey=key
}},setSortOrder:function(order){if(oh.tradingTool.CollectionModel.SORT_ORDER_DESC===order){this.sortOrder=oh.tradingTool.CollectionModel.SORT_ORDER_DESC
}else{this.sortOrder=oh.tradingTool.CollectionModel.SORT_ORDER_ASC
}},sort:function(key,order,dataType){if(this.shouldExit("sort")){return 
}dataType=dataType||this.getSortDataType(key);
key=key||this.sortKey;
order=order||this.sortOrder;
var sorter=this.dataSorters[order];
var extractor=this.getSortValueExtractor(key);
var recordsWithMissingValues=[];
var thisRecord=null;
var i=this.records.length;
var length=0;
this.log("Sort the collection","sort",{key:key,oldOrder:this.sortOrder,newOrder:order,dataType:dataType});
if(!extractor){extractor=function(key,record){return record[key]
};
while(i--){thisRecord=this.records[i];
if(typeof thisRecord[key]==="undefined"){recordsWithMissingValues.push(thisRecord);
this.records.splice(i,1)
}}}var getSortFunction=function(key,order,dataType,dataConverters){var converter=null;
switch(dataType){case"float":converter=dataConverters.stringToFloat;
break;
case"int":converter=dataConverters.stringToInt;
break;
case"date":converter=dataConverters.stringToDate;
break;
default:converter=dataConverters.mixedToString;
break
}return function(recordA,recordB){var a=converter(extractor(key,recordA));
var b=converter(extractor(key,recordB));
return sorter(a,b)
}
};
this.setSortOrder(order);
this.setSortKey(key);
this.records.sort(getSortFunction(this.sortKey,this.sortOrder,dataType,this.dataConverters));
for(i=0,length=recordsWithMissingValues.length;
i<length;
i++){this.records.push(recordsWithMissingValues[i])
}this.onAfterRecordsSorted(this)
},updateRecord:function(record){var id=record[this.idKey];
var i=this.getRecordIndexById(id);
if(i<0){this.addRecord(record)
}else{this.records[i]=record
}},updateRecords:function(records){if(this.shouldExit("updateRecords")){return 
}this.log("Inserting or updating "+records.length+" records","updateRecords");
if(this.getRecordCount()<1){this.records=records
}else{for(var i=0,length=records.length;
i<length;
i++){this.updateRecord(records[i])
}}this.onAfterRecordsUpdated(this,records)
}},oh.classInterface.factory);
oh.tradingTool.CollectionModel.SORT_ORDER_ASC="asc";
oh.tradingTool.CollectionModel.SORT_ORDER_DESC="desc";
oh.namespace("oh.tradingTool");
oh.tradingTool.AbstractWebMessageCollectionModel=oh.tradingTool.CollectionModel.extend({classHandle:"oh.tradingTool.AbstractWebMessageCollectionModel",defaultMessageOptions:null,init:function(collectionOptions,messageOptions){this.base(collectionOptions);
this.defaultMessageOptions=messageOptions
},insertDataFromMessage:function(data){this.error("Child classes must implement this method.","insertDataFromMessage")
},onAfterSendMessage:function(collection,lastRequestTimestamp){this.log("This method may be used by other objects as an event handler.","onAfterSendMessage")
},onBeforeSendMessage:function(collection,lastRequestTimestamp){this.log("This method may be used by other objects as an event handler.","onBeforeSendMessage")
},onInsertDataFromMessage:function(records){return records
},onSendMessageSuccess:function(action,data,errors){if(oh.utils.objects.objectHasProperties(errors)){this.error("One or more errors occurred while sending "+action,"onSendMessageSuccess",errors)
}else{this.insertDataFromMessage(data);
this.onAfterSendMessage(this,data.timestamp)
}},sendMessage:function(messageOptions,lastRequestTimestamp){this.error("Child classes must implement this method","sendMessage")
}});
(function($){oh.namespace("oh.accountManagement.utils");
oh.accountManagement.utils.LOGIN_COOKIE_NAME="accountManagementLogin";
oh.accountManagement.utils.setStatus=function(statusContainer,message,fade,fadeInterval){var $statusContainer=$(statusContainer);
fade=!!fade;
fadeInterval=fadeInterval||2000;
$statusContainer.html(message);
if(fade){$statusContainer.fadeOut(fadeInterval,function(){$statusContainer.html("");
$statusContainer.show()
})
}};
oh.accountManagement.utils.clearStatus=function(statusContainer){oh.accountManagement.utils.setStatus(statusContainer,"")
};
oh.accountManagement.utils.getLoginCookie=function(){return oh.utils.cookies.getValue(oh.accountManagement.utils.LOGIN_COOKIE_NAME)
};
oh.accountManagement.utils.setLoginCookie=function(cookieValue){oh.utils.cookies.setValue(oh.accountManagement.utils.LOGIN_COOKIE_NAME,cookieValue,0)
};
oh.accountManagement.utils.clearLoginCookie=function(){oh.utils.cookies.clear(oh.accountManagement.utils.LOGIN_COOKIE_NAME)
};
oh.accountManagement.utils.redirectToLogin=function(){window.location.href="/securehost/tool/current/app/accountManagement/page/login.jsp"
};
oh.accountManagement.utils.redirectToHome=function(){window.location.href="/securehost/tool/current/app/accountManagement/page/home.jsp"
};
oh.accountManagement.utils.redirectToLoginIfTimedOut=function(respErrors){if("denied"===respErrors.access){oh.accountManagement.utils.redirectToLogin()
}};
oh.accountManagement.utils.getAccountByAccountId=function(accountId,accountsContext){var account=null;
if(accountsContext){if(accountsContext.accounts){$.each(accountsContext.accounts,function(i,thisAccount){if(accountId===thisAccount.accountId){account=thisAccount
}})
}if(accountsContext.virtualAccounts){$.each(accountsContext.virtualAccounts,function(i,thisAccount){if(accountId===thisAccount.accountId){account=thisAccount
}})
}}return account
}
})(jQuery);
(function($){oh.namespace("oh.accountManagement.utils.webMessage");
oh.accountManagement.utils.webMessage.findActiveTradingAlerts=function(type,options){var METHODNAME="oh.accountManagement.utils.webMessage.findActiveTradingAlerts";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,type:type};
var immutableOptions={action:"alert.find",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.persistActiveTradingAlerts=function(expirationDays,type,description,active,metric,value,underlying,options){var METHODNAME="oh.accountManagement.utils.webMessage.persistActiveTradingAlerts";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,type:type,description:description,active:active,metric:metric,value:value,underlying:underlying};
if(expirationDays&&expirationDays!=""){data.expirationDays=expirationDays
}var immutableOptions={action:"alert.persist",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.deleteActiveTradingAlerts=function(alertId,options){var METHODNAME="oh.accountManagement.utils.webMessage.deleteActiveTradingAlerts";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,alert:alertId};
var immutableOptions={action:"alert.delete",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.findHistoricalTradingAlertEvents=function(type,options){var METHODNAME="oh.accountManagement.utils.webMessage.findHistoricalTradingAlertEvents";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,type:type};
var immutableOptions={action:"alert.event.find",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.findAlertRecipient=function(alertType,options){var METHODNAME="oh.accountManagement.utils.webMessage.findAlertRecipient";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,alertType:alertType};
var immutableOptions={action:"alert.recipient.find",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.persistAlertRecipient=function(recipient,status,options){var METHODNAME="oh.accountManagement.utils.webMessage.persistAlertRecipient";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,recipient:recipient,status:status};
var immutableOptions={action:"alert.recipient.persist",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.deleteAlertRecipient=function(recipientId,options){var METHODNAME="oh.accountManagement.utils.webMessage.deleteAlertRecipient";
if(!oh.tradingTool.utils.webMessage.checkAuthToken(METHODNAME)){return 
}var data={authToken:top.authToken,recipient:recipientId};
var immutableOptions={action:"alert.recipient.delete",data:data,dataType:oh.core.transport.JSON_DATA_TYPE,url:oh.core.transport.JSON_URL};
var mutableOptions={};
return oh.core.transport.postToWebMessageWithOptions(mutableOptions,options,immutableOptions)
};
oh.accountManagement.utils.webMessage.retrieveAccounts=function(authToken,successCallback,errorCallback,options){var action="account.list";
var data={authToken:authToken};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.XML_DATA_TYPE,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.getActiveAccount=function(authToken,successCallback,errorCallback,options){return oh.utils.webMessage.loadPreference(authToken,"primaryAccount",successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.setActiveAccount=function(authToken,accountNumber,successCallback,errorCallback,options){return oh.utils.webMessage.savePreference(authToken,"primaryAccount",accountNumber,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.setAccountStatementsOption=function(authToken,accountId,receivePrintedStatements,successCallback,errorCallback,options){var action="account-electronic-statement-opt";
var data={authToken:authToken,account:accountId,opt:!receivePrintedStatements};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.XML_DATA_TYPE,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.retrieveStatements=function(authToken,accountId,period,beginYear,beginMonth,endYear,endMonth,sortBy,sortDirection,successCallback,errorCallback,options){var action="account-electronic-statement";
var searchBy="account";
var account=accountId;
if("all"===accountId){searchBy="all";
account=""
}if("DESC"===sortDirection){sortBy="-"+sortBy
}else{sortBy="+"+sortBy
}var data={authToken:authToken,period:period,beginYear:beginYear,beginMonth:beginMonth,endYear:endYear,endMonth:endMonth,searchBy:searchBy,account:account,sortBy:sortBy,org:"OPHOUSE"};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.XML_DATA_TYPE,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.retrieveStatementsFiltersPreferences=function(authToken,successCallback,errorCallback,options){var preferenceName="accountManagementStatementsFilters";
return oh.utils.webMessage.loadPreference(authToken,preferenceName,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.saveStatementsFiltersPreferences=function(authToken,statementsFilters,successCallback,errorCallback,options){var preferenceName="accountManagementStatementsFilters";
var preferenceValue={accountId:statementsFilters.accountId.currentValue,period:statementsFilters.period.currentValue,startDate:statementsFilters.startDate.currentValue,endDate:statementsFilters.endDate.currentValue,sortBy:statementsFilters.sortBy.currentValue,sortDirection:statementsFilters.sortDirection.currentValue};
return oh.utils.webMessage.savePreference(authToken,preferenceName,preferenceValue,successCallback,errorCallback,options)
};
oh.accountManagement.utils.webMessage.updateCommissionSchedule=function(authToken,accountId,commissionSchedule,successCallback,errorCallback,options){var action="account-commission-schedule-update";
var data={authToken:authToken,account:accountId,commissionSchedule:commissionSchedule};
return oh.core.transport.postToWebMessage(action,data,oh.core.transport.XML_DATA_TYPE,successCallback,errorCallback,options)
}
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.Home=oh.Awesome.extend({authToken:null,delayedQuotes:null,defaultTabId:null,standAloneMode:false,initialActiveAccountId:null,initialActiveAccount:null,tabs:{},$uiTabs:null,$accountManagementContainer:null,$manageAccountsHomeTabsContainer:null,$logoutContainer:null,$logoutTrigger:null,$tradingAlertsDisclaimer:null,tradingAlertsDisclaimerSelector:"#tradingAlertsDisclaimer",constructor:function(authToken,delayedQuotes,defaultTabId,instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.Home",logMethod||"info");
this.authToken=authToken;
this.delayedQuotes=delayedQuotes;
this.defaultTabId=defaultTabId;
this.log("Created instance")
},init:function(){this.authToken=this.authToken||oh.accountManagement.utils.getLoginCookie();
this.defaultTabId=this.defaultTabId||"accountsInfo";
if(!this.authToken){oh.accountManagement.utils.redirectToLogin()
}this.standAloneMode=(null!==oh.accountManagement.utils.getLoginCookie());
var _this=this;
this.asyncOption={async:false};
this.initialActiveAccountId=this.getInitialActiveAccountId();
this.accountsContext=this.retrieveAccountsContext();
this.initialActiveAccount=oh.accountManagement.utils.getAccountByAccountId(this.initialActiveAccountId,this.accountsContext);
this.initializeTabs();
this.$accountManagementContainer=$("#accountManagementContainer");
this.$manageAccountsHomeTabsContainer=$("#manageAccountsHomeTabsContainer");
this.$logoutContainer=$("#manageAccountsHomeLogoutContainer");
this.$logoutTrigger=$("#manageAccountsHomeLogoutTrigger");
this.$tradingAlertsDisclaimer=$(this.tradingAlertsDisclaimerSelector);
if(this.delayedQuotes){var tradingAlertsTab=$("#manageAccountsTradingAlertsTabTrigger");
tradingAlertsTab.remove();
var tradingAlertsTabContent=$("#manageAccountsTradingAlertsTab");
tradingAlertsTabContent.remove()
}this.$uiTabs=this.$manageAccountsHomeTabsContainer.tabs();
var handleTabsSelectWrapper=function(evt,context){_this.handleTabsSelect(evt,context)
};
this.$manageAccountsHomeTabsContainer.bind("tabsselect",handleTabsSelectWrapper);
var defaultTab=this.tabs[this.defaultTabId];
this.$uiTabs.tabs("select","#"+defaultTab.tabContainerId);
if(this.standAloneMode){this.setupKeepAlive(this.authToken);
this.$logoutContainer.show();
var handleLogoutWrapper=function(evt){_this.handleLogout(evt)
};
this.$logoutTrigger.click(handleLogoutWrapper)
}this.$accountManagementContainer.show();
this.log("Initialized")
},handleTabsSelect:function(evt,context){var tabTriggerId=context.tab.id;
var selectedTab=this.getTabByTabTriggerId(tabTriggerId);
selectedTab.controller.handleTabSelect(evt,context);
if(tabTriggerId=="manageAccountsTradingAlertsTabTrigger"){this.$tradingAlertsDisclaimer.show()
}else{this.$tradingAlertsDisclaimer.hide()
}},handleLogout:function(evt){evt.preventDefault();
oh.accountManagement.utils.clearLoginCookie();
oh.accountManagement.utils.redirectToLogin()
},initializeTabs:function(){var accountsInfoController=new oh.accountManagement.AccountsInfo(this.authToken,this.initialActiveAccount,this.accountsContext,"Accounts Info Tab Controller");
var statementsConfirmsController=new oh.accountManagement.StatementsConfirms(this.authToken,this.initialActiveAccount,this.accountsContext,"Statements/Confirms Tab Controller");
var ratesController=new oh.accountManagement.Rates(this.authToken,this.initialActiveAccount,this.accountsContext,"Rates Tab Controller");
var tradingAlertsController=oh.accountManagement.tradingAlerts.Controller.getInstance([this.authToken,this.initialActiveAccountId],"oh.accountManagement.Controller","debug");
this.tabs={accountsInfo:new oh.accountManagement.Tab("manageAccountsAccountsInfoTab","manageAccountsAccountsInfoTabTrigger",accountsInfoController,"Accounts Info Tab"),statementsConfirms:new oh.accountManagement.Tab("manageAccountsStatementsTab","manageAccountsStatementsTabTrigger",statementsConfirmsController,"Statements/Confirms Tab"),rates:new oh.accountManagement.Tab("manageAccountsRatesTab","manageAccountsRatesTabTrigger",ratesController,"Rates Info Tab"),tradingAlerts:new oh.accountManagement.Tab("manageAccountsTradingAlertsTab","manageAccountsTradingAlertsTabTrigger",tradingAlertsController,"Trading Alerts Tab")};
$.each(this.tabs,function(tab){if(tab!="tradingAlerts"){this.init()
}})
},getTabByTabTriggerId:function(tabTriggerId){var tab=null;
$.each(this.tabs,function(){if(tabTriggerId===this.tabTriggerId){tab=this
}});
return tab
},getAccountsContext:function(accountsData){var accountsContext={};
accountsContext.totalPortfolioValue=accountsData.totalPortfolioValue;
accountsContext.totalAccountValue=accountsData.totalAccountValue;
accountsContext.accounts=[];
accountsContext.virtualAccounts=[];
if(!oh.utils.objects.isArray(accountsData.accounts)){accountsData.accounts=[accountsData.accounts]
}$.each(accountsData.accounts,function(i,account){if("true"!==account.isVirtual){accountsContext.accounts.push(account)
}else{accountsContext.virtualAccounts.push(account)
}});
return accountsContext
},getInitialActiveAccountId:function(){var _this=this;
var getCurrentAccountSuccessCallback=function(respAction,respData,respErrors){var currentAccountId=null;
if(!oh.utils.objects.objectHasProperties(respErrors)){currentAccountId=respData.preference.value
}else{_this.error("Could not retrieve the current account.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}return currentAccountId
};
var getCurrentAccountErrorCallback=function(respStatus,respText){_this.error("Could not retrieve the current account.")
};
return oh.accountManagement.utils.webMessage.getActiveAccount(this.authToken,getCurrentAccountSuccessCallback,getCurrentAccountErrorCallback,this.asyncOption)
},retrieveAccountsContext:function(){var _this=this;
var retrieveAccountsSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){return _this.getAccountsContext(respData)
}else{_this.error("Could not retrieve accounts.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}};
var retrieveAccountsErrorCallback=function(respStatus,respText){_this.error("Could not retrieve accounts.")
};
return oh.accountManagement.utils.webMessage.retrieveAccounts(this.authToken,retrieveAccountsSuccessCallback,retrieveAccountsErrorCallback,this.asyncOption)
},setupKeepAlive:function(authToken){var renewFunction=function(){oh.utils.webMessage.authKeepAlive(authToken)
};
var failureFunction=function(){window.location.href=window.location.href
};
var KAMax=30;
var warningIndex=30;
var warningFunction=function(){};
var keppAliveTimer=oh.core.transport.getKeepAliveTimer(renewFunction,failureFunction,KAMax,warningIndex,warningFunction);
keppAliveTimer.start()
}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.Tab=oh.Awesome.extend({tabContainerId:null,tabTriggerId:null,controller:null,constructor:function(tabContainerId,tabTriggerId,controller,instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.Tab",logMethod||"info");
this.tabContainerId=tabContainerId;
this.tabTriggerId=tabTriggerId;
this.controller=controller;
this.log("Created instance")
},init:function(){this.controller.init();
this.log("Initialized")
}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.AccountsInfo=oh.Awesome.extend({authToken:null,activeAccount:null,accountsContext:null,activeAccountId:null,activeAccountRowStyleClass:"active",evenAccountRowStyleClass:"even",oddAccountRowStyleClass:"odd",accountRowIdPrefix:"accountsRow",accountSelectorIdPrefix:"accountsInfoAccountSelector",virtualAccountSelectorIdPrefix:"virtualAccountsInfoAccountSelector",accountStatementsOptionIdPrefix:"accountStatementOption",accountsTotalsDirective:null,accountsDirective:null,virtualAccountsDirective:null,$accountsInfoTab:null,$cancelAccountChangeTrigger:null,$accountChangeTrigger:null,$accountsTotalValuesContainer:null,$accountsContainer:null,$virtualAccountsContainer:null,$statusContainer:null,$p_accountsTotalValuesContainer:null,$p_accountsContainer:null,$p_virtualAccountsContainer:null,$p_accountsTotalsRenderFunction:null,$p_accountsRenderFunction:null,$p_virtualAccountsRenderFunction:null,constructor:function(authToken,activeAccount,accountsContext,instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.AccountsInfo",logMethod||"info");
this.authToken=authToken;
this.activeAccount=activeAccount;
this.accountsContext=accountsContext||{};
this.log("Created instance")
},init:function(){this.activeAccountId=this.activeAccount.accountId;
var _this=this;
this.accountsTotalsDirective={"td.totalPortfolioValue":"totalPortfolioValue","td.totalAccountValue":"totalAccountValue"};
var accountDirective={"@class":function(arg){return _this.getAccountRowStyleClass(arg.item.accountId,arg.pos)
},"@id":function(arg){return _this.accountRowIdPrefix+arg.item.accountId
},"td.activeSelector input@id":function(arg){var account=arg.item;
var selectorIdPrefix=_this.accountSelectorIdPrefix;
if("true"===account.isVirtual){selectorIdPrefix=_this.virtualAccountSelectorIdPrefix
}return selectorIdPrefix+account.accountId
},"td.activeSelector input@checked":function(arg){return _this.getCheckedAttributeValueForAccountSelectorById(arg.item.accountId)
},"td.accountName":function(arg){return arg.item.accountName.replace(",",", ")
},"td.accountNumber":"account.account","td.accountType":"account.accountType","td.cashBalance":"account.cashBalance","td.portfolioValue":"account.portfolioValue","td.accountValue":"account.accountValue","td.statementsOption input@id":function(arg){return _this.accountStatementsOptionIdPrefix+arg.item.accountId
},"td.statementsOption input@checked":function(arg){var checked="";
if("false"===arg.item.optIn){checked="checked"
}return checked
},"td.statementsOption span.status":"account.optStatus"};
this.accountsDirective={tr:{"account <- accounts":accountDirective}};
this.virtualAccountsDirective={tr:{"account <- virtualAccounts":accountDirective}};
this.$accountsInfoTab=$("#manageAccountsAccountsInfoTab");
this.$cancelAccountChangeTrigger=$("#accountsInfoCancel");
this.$accountChangeTrigger=$("#accountsInfoChangeAccount");
this.$accountsTotalValuesContainer=$("table#accountsInfoContainer tbody#accountsTotalValuesContainer");
this.$accountsContainer=$("table#accountsInfoContainer tbody#accountsContainer");
this.$virtualAccountsContainer=$("table#accountsInfoContainer tbody#virtualAccountsContainer");
this.$statusContainer=$("#accountsInfoStatusContainer");
this.$p_accountsTotalValuesContainer=$p("table#accountsInfoContainer tbody#accountsTotalValuesContainer");
this.$p_accountsContainer=$p("table#accountsInfoContainer tbody#accountsContainer");
this.$p_virtualAccountsContainer=$p("table#accountsInfoContainer tbody#virtualAccountsContainer");
this.$p_accountsTotalsRenderFunction=this.$p_accountsTotalValuesContainer.compile(this.accountsTotalsDirective);
this.$p_accountsRenderFunction=this.$p_accountsContainer.compile(this.accountsDirective);
this.$p_virtualAccountsRenderFunction=this.$p_virtualAccountsContainer.compile(this.virtualAccountsDirective);
this.renderAccountsInfo();
this.initAccountStatementsOptionHandlers();
this.initAccountChangeHandlers();
this.$accountsInfoTab.show();
this.log("Initialized")
},renderAccountsInfo:function(){var accountsTotalsContent=this.$p_accountsTotalsRenderFunction(this.accountsContext);
var accountsContent=this.$p_accountsRenderFunction(this.accountsContext);
var virtualAccountsContent=this.$p_virtualAccountsRenderFunction(this.accountsContext);
this.$accountsTotalValuesContainer.replaceWith(accountsTotalsContent);
this.$accountsContainer.replaceWith(accountsContent);
this.$virtualAccountsContainer.replaceWith(virtualAccountsContent)
},initAccountStatementsOptionHandlers:function(){var $statementOptCheckboxes=$("td.statementsOption input");
var _this=this;
var toggleAccountStatementsOptionWrapper=function(evt){_this.toggleAccountStatementsOption(evt)
};
$statementOptCheckboxes.bind("click",toggleAccountStatementsOptionWrapper)
},initAccountChangeHandlers:function(){var _this=this;
var cancelAccountChangeWrapper=function(evt){_this.cancelAccountChange(evt)
};
var changeActiveAccountWrapper=function(evt){_this.changeActiveAccount(evt)
};
this.$cancelAccountChangeTrigger.bind("click",cancelAccountChangeWrapper);
this.$accountChangeTrigger.bind("click",changeActiveAccountWrapper)
},handleTabSelect:function(evt,context){this.log("Tab selected")
},cancelAccountChange:function(evt){var _this=this;
$("input[name='activeAccount']").each(function(i,accountSelector){var $accountSelector=$(accountSelector);
var accountSelectorId=_this.getAccountIdFromAccountSelector($accountSelector);
var checkedAttributeValue=_this.getCheckedAttributeValueForAccountSelectorById(accountSelectorId);
$accountSelector.attr("checked",checkedAttributeValue)
})
},changeActiveAccount:function(evt){var $selectedAccountSelector=$("input[name='activeAccount']:checked");
var selectedAccountId=this.getAccountIdFromAccountSelector($selectedAccountSelector);
var selectedAccountIsVirtual=this.isVirtualAccount($selectedAccountSelector);
if(this.activeAccountId!==selectedAccountId){var _this=this;
var setActiveAccountSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)&&("true"===respData.saved)){_this.activeAccountId=selectedAccountId;
_this.setClassAttributeOnAccountRows(_this.accountsContext.accounts);
_this.setClassAttributeOnAccountRows(_this.accountsContext.virtualAccounts);
var activeAccountChangeTopicParams={activeAccountId:_this.activeAccountId,virtualAccount:selectedAccountIsVirtual};
oh.core.msg.publish(oh.accountManagement.AccountsInfo.activeAccountChangeTopic,activeAccountChangeTopicParams)
}else{_this.error("Could not set active account in preferences.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}};
var setActiveAccountErrorCallback=function(respStatus,respText){_this.error("Could not set active account in preferences.")
};
oh.accountManagement.utils.webMessage.setActiveAccount(this.authToken,selectedAccountId,setActiveAccountSuccessCallback,setActiveAccountErrorCallback)
}},toggleAccountStatementsOption:function(evt){var $accountsStatementsOptionCheckbox=$(evt.target);
var accountId=this.getAccountIdFromAccountsStatementsOptionCheckbox($accountsStatementsOptionCheckbox);
var receivePrintedStatements=$accountsStatementsOptionCheckbox.is(":checked");
var statusMessage="You have opted to receive electronic statements.";
if(receivePrintedStatements){statusMessage="You have opted to receive printed statements."
}var _this=this;
var setAccountStatementsOptionSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){oh.accountManagement.utils.setStatus(_this.$statusContainer,statusMessage,true,3000)
}else{_this.error("Could not set the account printed statements option.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}};
var setAccountStatementsOptionErrorCallback=function(respStatus,respText){_this.error("Could not set the account printed statements option.")
};
oh.accountManagement.utils.webMessage.setAccountStatementsOption(this.authToken,accountId,receivePrintedStatements,setAccountStatementsOptionSuccessCallback,setAccountStatementsOptionErrorCallback)
},getAccountRowStyleClass:function(accountId,position){var styleClass=this.activeAccountRowStyleClass;
if(accountId!==this.activeAccountId){styleClass=(((position%2)===0)?this.evenAccountRowStyleClass:this.oddAccountRowStyleClass)
}return styleClass
},getAccountIdFromAccountSelector:function(accountSelector){var $accountSelector=$(accountSelector);
var accountSelectorIdAttr=$accountSelector.attr("id");
var selectedAccountId=accountSelectorIdAttr.replace(this.accountSelectorIdPrefix,"");
selectedAccountId=selectedAccountId.replace(this.virtualAccountSelectorIdPrefix,"");
return selectedAccountId
},isVirtualAccount:function(accountSelector){accountIsVirtual=false;
var $accountSelector=$(accountSelector);
var accountSelectorIdAttr=$accountSelector.attr("id");
if(accountSelectorIdAttr.indexOf(this.virtualAccountSelectorIdPrefix)>-1){accountIsVirtual=true
}return accountIsVirtual
},getAccountIdFromAccountsStatementsOptionCheckbox:function(accountsStatementsOptionCheckbox){var $accountsStatementsOptionCheckbox=$(accountsStatementsOptionCheckbox);
var accountsStatementsOptionCheckboxIdAttr=$accountsStatementsOptionCheckbox.attr("id");
var accountId=accountsStatementsOptionCheckboxIdAttr.replace(this.accountStatementsOptionIdPrefix,"");
return accountId
},getCheckedAttributeValueForAccountSelectorById:function(accountId){var checked="";
if(accountId===this.activeAccountId){checked="checked"
}return checked
},setClassAttributeOnAccountRows:function(accounts){var _this=this;
$.each(accounts,function(i,account){var accountId=account.accountId;
var accountRowSelector="#"+_this.accountRowIdPrefix+accountId;
var $accountRow=$(accountRowSelector);
$accountRow.attr("class",_this.getAccountRowStyleClass(accountId,i))
})
}},{activeAccountChangeTopic:"accountManagementActiveAccountChange"})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.StatementsConfirms=oh.Awesome.extend({authToken:null,activeAccount:null,accountsContext:null,activeAccountId:null,evenStatementRowStyleClass:"even",oddStatementRowStyleClass:"odd",activeSortColumnClass:"activeSortColumn",statementsTabSelectedAtLeastOnce:false,useAllAccountsFilterOption:false,statementsFilters:null,accountsFilterContext:null,statementsContext:{},$statementsTabContainer:null,$accountFilterInput:null,$periodFilterInput:null,$startDateFilterInput:null,$startDateFilterStatus:null,$endDateFilterInput:null,$endDateFilterStatus:null,$saveFilterSettingsTrigger:null,$resetFilterSettingsTrigger:null,$statementsHeaderContainer:null,$statementsContainer:null,$noStatementsContainer:null,$serviceUnavailableContainer:null,$accountErrorContainer:null,$accoutNumberColumnHeading:null,$accoutNameColumnHeading:null,$statementDateColumnHeading:null,$p_accountFilterInput:null,$p_periodFilterInput:null,$p_statementsContainer:null,$p_accountFilterRenderFunction:null,$p_periodFilterRenderFunction:null,$p_statementsRenderFunction:null,statementsDirective:null,accountFilterDirective:null,periodFilterDirective:null,periodsFilterContext:null,sortableColumnHeadings:{},constructor:function(authToken,activeAccount,accountsContext,instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.StatementsConfirms",logMethod||"info");
this.authToken=authToken;
this.activeAccount=activeAccount;
this.accountsContext=accountsContext||{};
this.log("Created instance")
},init:function(){this.activeAccountId=this.activeAccount.accountId;
this.statementsFilters={accountId:{currentValue:null,lastSavedValue:null,defaultValue:"all"},period:{currentValue:null,lastSavedValue:null,defaultValue:"all"},startDate:{currentValue:null,lastSavedValue:null,defaultValue:"mm/dd/yyyy"},endDate:{currentValue:null,lastSavedValue:null,defaultValue:"mm/dd/yyyy"},sortBy:{currentValue:null,lastSavedValue:null,defaultValue:"date"},sortDirection:{currentValue:null,lastSavedValue:null,defaultValue:"ASC"}};
this.setAccountFilterDefaultValue();
this.setStatementsFiltersToDefaultState();
this.accountsFilterContext=$.extend(true,{},this.accountsContext);
if(this.useAllAccountsFilterOption&&this.accountsFilterContext.accounts){this.accountsFilterContext.accounts.unshift({accountId:"all",accountName:"All"})
}var _this=this;
var statementDirective={"@class":function(arg){return _this.getStatementRowStyleClass(arg.pos)
},"td.accountNumber":"statement.account","td.accountName":"statement.name","td.date":"statement.date","td.type":"statement.type","td.url a@href":function(arg){return arg.item.url
},"td.url a@target":function(arg){return"_blank"
}};
this.statementsDirective={tr:{"statement <- statements":statementDirective}};
this.accountFilterDirective={option:{"account <- accounts":{"@value":function(arg){return arg.item.accountId
},".":function(arg){return arg.item.account+" - "+arg.item.accountName+", "+_this.toTitleCase(arg.item.accountType)
}}}};
this.periodFilterDirective={option:{"period <- periods":{"@value":function(arg){return arg.item.value
},".":function(arg){return arg.item.label
}}}};
this.periodsFilterContext={periods:[{value:"all",label:"All"},{value:"yearToDate",label:"Year to Date"},{value:"mostRecent",label:"Most Recent"}]};
this.$statementsTabContainer=$("#manageAccountsStatementsTab");
this.$accountFilterInput=$("#statementsAccountFilter");
this.$periodFilterInput=$("#statementsPeriodFilter");
this.$startDateFilterInput=$("#statementsStartDateFilterInput");
this.$startDateFilterStatus=$("#statementsStartDateFilterStatus");
this.$endDateFilterInput=$("#statementsEndDateFilterInput");
this.$endDateFilterStatus=$("#statementsEndDateFilterStatus");
this.$saveFilterSettingsTrigger=$("#statementsSaveFilterSettingsTrigger");
this.$resetFilterSettingsTrigger=$("#statementsResetFilterSettingsTrigger");
this.$statementsHeaderContainer=$("table#statementsResultsContainer thead");
this.$statementsContainer=$("table#statementsResultsContainer tbody#statementsContainer");
this.$noStatementsContainer=$("table#statementsResultsContainer tbody#noStatementsContainer");
this.$serviceUnavailableContainer=$("table#statementsResultsContainer tbody#serviceUnavailableContainer");
this.$accountErrorContainer=$("table#statementsResultsContainer tbody#accountErrorContainer");
this.$accoutNumberColumnHeading=$("#statementsAccoutNumberHeading span");
this.$accoutNameColumnHeading=$("#statementsAccoutNameHeading span");
this.$statementDateColumnHeading=$("#statementsStatementDateHeading  span");
this.$p_accountFilterInput=$p("#statementsAccountFilter");
this.$p_periodFilterInput=$p("#statementsPeriodFilter");
this.$p_statementsContainer=$p("table#statementsResultsContainer tbody#statementsContainer");
this.$p_accountFilterRenderFunction=this.$p_accountFilterInput.compile(this.accountFilterDirective);
this.$p_periodFilterRenderFunction=this.$p_periodFilterInput.compile(this.periodFilterDirective);
this.$p_statementsRenderFunction=this.$p_statementsContainer.compile(this.statementsDirective);
this.sortableColumnHeadings={statementDate:{sortBy:"date",triggerElement:_this.$statementDateColumnHeading}};
this.retrieveStatementsFiltersPreferences();
this.updateStatementsView();
this.initFilterElements();
this.setSortableColumnHeadingsClass();
var handleActiveAccountChangeWrapper=function(params){_this.handleActiveAccountChange(params)
};
oh.core.msg.subscribe(oh.accountManagement.AccountsInfo.activeAccountChangeTopic,handleActiveAccountChangeWrapper);
this.log("Initialized")
},initFilterElements:function(){var _this=this;
var accountFilterContent=this.$p_accountFilterRenderFunction(this.accountsFilterContext);
this.$accountFilterInput=oh.core.template.replaceWithContentAndReselectNode(this.$accountFilterInput,accountFilterContent);
var periodFilterContent=this.$p_periodFilterRenderFunction(this.periodsFilterContext);
this.$periodFilterInput=oh.core.template.replaceWithContentAndReselectNode(this.$periodFilterInput,periodFilterContent);
var handleDatePickerSelectWrapper=function(dateStr,dateInput){_this.handleDatePickerSelect(dateStr,dateInput)
};
var datepickerOptions={showOn:"button",buttonImage:"../../../asset/img/app/accountManagement/calendar_icon.gif",buttonImageOnly:true,onSelect:handleDatePickerSelectWrapper};
$.datepicker.setDefaults(datepickerOptions);
this.$startDateFilterInput.datepicker();
this.$endDateFilterInput.datepicker();
this.setStatementsFiltersInputs();
this.setDatePickersState();
this.initFilterElementsEventHandlers();
this.initSortableColumnsEventHandlers()
},initFilterElementsEventHandlers:function(){var _this=this;
var handleAccountFilterChangeWrapper=function(evt){_this.handleAccountFilterChange(evt)
};
var handlePeriodFilterChangeWrapper=function(evt){_this.handlePeriodFilterChange(evt)
};
var handleStartDateFilterChangeWrapper=function(evt){_this.handleStartDateFilterChange(evt)
};
var handleEndDateFilterChangeWrapper=function(evt){_this.handleEndDateFilterChange(evt)
};
var handleSaveFilterSettingsClickWrapper=function(evt){_this.handleSaveFilterSettingsClick(evt)
};
var handleResetFilterSettingsClickWrapper=function(evt){_this.handleResetFilterSettingsClick(evt)
};
this.$accountFilterInput.change(handleAccountFilterChangeWrapper);
this.$periodFilterInput.change(handlePeriodFilterChangeWrapper);
this.$startDateFilterInput.change(handleStartDateFilterChangeWrapper);
this.$endDateFilterInput.change(handleEndDateFilterChangeWrapper);
this.$saveFilterSettingsTrigger.bind("click",handleSaveFilterSettingsClickWrapper);
this.$resetFilterSettingsTrigger.bind("click",handleResetFilterSettingsClickWrapper)
},initSortableColumnsEventHandlers:function(){var _this=this;
var handleSortableColumnHeadingClickWrapper=function(evt){_this.handleSortableColumnHeadingClick(evt)
};
this.$statementDateColumnHeading.click(handleSortableColumnHeadingClickWrapper)
},handleTabSelect:function(evt,context){this.log("Tab selected");
if(!this.statementsTabSelectedAtLeastOnce){this.statementsTabSelectedAtLeastOnce=true;
this.updateStatementsView()
}},handleDatePickerSelect:function(dateStr,dateInput){switch(dateInput.id){case this.$startDateFilterInput.attr("id"):this.statementsFilters.startDate.currentValue=dateStr;
break;
case this.$endDateFilterInput.attr("id"):this.statementsFilters.endDate.currentValue=dateStr;
break;
default:this.error("Date input id "+dateInput.id+" not recognized");
break
}},handleAccountFilterChange:function(evt){this.statementsFilters.accountId.currentValue=oh.utils.forms.getValue(this.$accountFilterInput)
},handlePeriodFilterChange:function(evt){this.statementsFilters.period.currentValue=oh.utils.forms.getValue(this.$periodFilterInput);
this.setDatePickersState()
},handleStartDateFilterChange:function(evt){this.statementsFilters.startDate.currentValue=oh.utils.forms.getValue(this.$startDateFilterInput)
},handleEndDateFilterChange:function(evt){this.statementsFilters.endDate.currentValue=oh.utils.forms.getValue(this.$endDateFilterInput)
},handleSaveFilterSettingsClick:function(evt){if(this.statementsFiltersChangedSinceLastSave()){if(!this.customDateRangeChosen()||(this.customDateRangeChosen()&&this.statementsDateFilterInputsValid())){this.saveStatementsFiltersPreferences();
this.updateStatementsView()
}}},handleResetFilterSettingsClick:function(evt){this.setStatementsFiltersToDefaultState();
this.setStatementsFiltersInputs();
this.setDatePickersState();
if(this.statementsFiltersChangedSinceLastSave()){this.saveStatementsFiltersPreferences();
this.updateStatementsView();
this.clearDateFiltersStatus()
}},handleSortableColumnHeadingClick:function(evt){var $columnHeading=$(evt.target);
var columnHeadingId=$columnHeading.attr("id");
var columnHeading=null;
switch(columnHeadingId){case this.sortableColumnHeadings.statementDate.triggerElement.attr("id"):columnHeading=this.sortableColumnHeadings.statementDate;
break;
default:this.error("Sortable column heading id "+columnHeadingId+" not recognized");
break
}if(columnHeading){if(columnHeading.sortBy===this.statementsFilters.sortBy.currentValue){this.toggleStatementsFiltersSortDirection()
}else{this.statementsFilters.sortBy.currentValue=columnHeading.sortBy
}this.updateStatementsView();
this.setSortableColumnHeadingsClass()
}},handleActiveAccountChange:function(params){this.activeAccountId=params.activeAccountId;
if(false===params.virtualAccount){this.setAccountFilterDefaultValue()
}},getStatementsContext:function(statementsData){var statementsContext={};
statementsContext.statements=[];
if(statementsData&&statementsData.item){var statements=statementsData.item;
if(oh.utils.objects.isObject(statementsData.item)){statements=[statementsData.item]
}$.each(statements,function(i,statement){statement.type="Statement";
statementsContext.statements.push(statement)
})
}return statementsContext
},retrieveStatementsFiltersPreferences:function(){var _this=this;
var asyncOption={async:false};
var retrieveStatementsFiltersPreferencesSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){if(respData.preference){var preferences=respData.preference.value;
$.each(_this.statementsFilters,function(filterName,filterProperty){filterProperty.currentValue=preferences[filterName];
filterProperty.lastSavedValue=preferences[filterName]
})
}_this.log("Retrieved the statements filters preferences.")
}else{_this.error("Could not retrieve the statements filters preferences.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}};
var retrieveStatementsFiltersPreferencesErrorCallback=function(respStatus,respText){_this.error("Could not retrieve the statements filters preferences.")
};
oh.accountManagement.utils.webMessage.retrieveStatementsFiltersPreferences(this.authToken,retrieveStatementsFiltersPreferencesSuccessCallback,retrieveStatementsFiltersPreferencesErrorCallback,asyncOption)
},updateStatementsView:function(){var _this=this;
var retrieveStatementsSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){_this.statementsContext=_this.getStatementsContext(respData);
var statementsContent=_this.$p_statementsRenderFunction(_this.statementsContext);
if(_this.statementsContext.statements.length>0){_this.$statementsContainer=oh.core.template.replaceWithContentAndReselectNode(_this.$statementsContainer,statementsContent);
_this.$statementsHeaderContainer.show();
_this.$statementsContainer.show();
_this.$noStatementsContainer.hide();
_this.$serviceUnavailableContainer.hide();
_this.$accountErrorContainer.hide()
}else{_this.$statementsHeaderContainer.hide();
_this.$statementsContainer.hide();
_this.$noStatementsContainer.show();
_this.$serviceUnavailableContainer.hide();
_this.$accountErrorContainer.hide()
}}else{_this.error("Could not retrieve statements.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors);
_this.$statementsHeaderContainer.hide();
_this.$statementsContainer.hide();
_this.$noStatementsContainer.hide();
_this.$accountErrorContainer.hide();
_this.$serviceUnavailableContainer.hide();
if(respErrors.system){_this.$serviceUnavailableContainer.show()
}else{if(respErrors.action=="timeout"){_this.$serviceUnavailableContainer.show()
}else{_this.$accountErrorContainer.show()
}}}_this.$statementsTabContainer.show()
};
var retrieveStatementsErrorCallback=function(respStatus,respText){_this.error("Could not retrieve statements.")
};
var statementsDateRange=this.getStatementsDateRangeFromPeriod();
oh.accountManagement.utils.webMessage.retrieveStatements(this.authToken,this.statementsFilters.accountId.currentValue,this.statementsFilters.period.currentValue,statementsDateRange.beginYear,statementsDateRange.beginMonth,statementsDateRange.endYear,statementsDateRange.endMonth,this.statementsFilters.sortBy.currentValue,this.statementsFilters.sortDirection.currentValue,retrieveStatementsSuccessCallback,retrieveStatementsErrorCallback)
},saveStatementsFiltersPreferences:function(){var _this=this;
var saveStatementsFiltersPreferencesSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)&&("true"===respData.saved)){_this.log("Saved statements filters settings.");
_this.resetStatementsFiltersLastSaved()
}else{_this.error("Could not save statements filters settings.");
oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}};
var saveStatementsFiltersPreferencesErrorCallback=function(respStatus,respText){_this.error("Could not save statements filters settings.")
};
oh.accountManagement.utils.webMessage.saveStatementsFiltersPreferences(this.authToken,this.statementsFilters,saveStatementsFiltersPreferencesSuccessCallback,saveStatementsFiltersPreferencesErrorCallback)
},getStatementRowStyleClass:function(position){var styleClass=(((position%2)===0)?this.evenStatementRowStyleClass:this.oddStatementRowStyleClass);
return styleClass
},resetStatementsFiltersLastSaved:function(){$.each(this.statementsFilters,function(filterName,filter){filter.lastSavedValue=filter.currentValue
})
},statementsFiltersChangedSinceLastSave:function(){var changed=false;
$.each(this.statementsFilters,function(filterName,filter){if(filter.currentValue!==filter.lastSavedValue){changed=true
}});
return changed
},setAccountFilterDefaultValue:function(){var defaultValue="all";
if(!this.useAllAccountsFilterOption){if(this.accountIdIsVirtual(this.activeAccountId)){if(this.accountsContext.accounts.length!=0){defaultValue=this.accountsContext.accounts[0].accountId
}}else{defaultValue=this.activeAccountId
}}this.statementsFilters.accountId.defaultValue=defaultValue
},setStatementsFiltersToDefaultState:function(){$.each(this.statementsFilters,function(filterName,filter){filter.currentValue=filter.defaultValue
})
},setStatementsFiltersInputs:function(){oh.utils.forms.setValue(this.$accountFilterInput,this.statementsFilters.accountId.currentValue);
oh.utils.forms.setValue(this.$periodFilterInput,this.statementsFilters.period.currentValue);
oh.utils.forms.setValue(this.$startDateFilterInput,this.statementsFilters.startDate.currentValue);
oh.utils.forms.setValue(this.$endDateFilterInput,this.statementsFilters.endDate.currentValue)
},setDatePickersState:function(){if(this.customDateRangeChosen()){this.$startDateFilterInput.datepicker("enable");
this.$endDateFilterInput.datepicker("enable")
}else{this.$startDateFilterInput.datepicker("disable");
this.$endDateFilterInput.datepicker("disable")
}},customDateRangeChosen:function(){return("customDateRange"===this.statementsFilters.period.currentValue)
},statementsDateFilterInputsValid:function(){var startDateStr=oh.utils.forms.getValue(this.$startDateFilterInput);
var endDateStr=oh.utils.forms.getValue(this.$endDateFilterInput);
var startDateValid=oh.utils.validators.validDate.runTest(startDateStr);
var endDateValid=oh.utils.validators.validDate.runTest(endDateStr);
this.clearDateFiltersStatus();
var datesValid=true;
if(!startDateValid){datesValid=false;
oh.accountManagement.utils.setStatus(this.$startDateFilterStatus,"Please enter a valid start date.")
}if(!endDateValid){datesValid=false;
oh.accountManagement.utils.setStatus(this.$endDateFilterStatus,"Please enter a valid end date.")
}if(datesValid){var startDate=new Date(startDateStr);
var endDate=new Date(endDateStr);
datesValid=(endDate.getTime()>=startDate.getTime());
if(!datesValid){oh.accountManagement.utils.setStatus(this.$endDateFilterStatus,"The end date can not be before the start date.")
}}return datesValid
},clearDateFiltersStatus:function(){oh.accountManagement.utils.clearStatus(this.$startDateFilterStatus);
oh.accountManagement.utils.clearStatus(this.$endDateFilterStatus)
},getStatementsDateRangeFromPeriod:function(){var startDate=new Date();
var endDate=new Date();
switch(this.statementsFilters.period.currentValue){case"all":break;
case"yearToDate":startDate=new Date("01/01/"+endDate.getFullYear());
break;
case"mostRecent":break;
case"customDateRange":startDate=new Date(this.statementsFilters.startDate.currentValue);
endDate=new Date(this.statementsFilters.endDate.currentValue);
break;
default:this.error("Statement period filter value "+this.statementsFilters.period.currentValue+" not recognized");
break
}var dateRange={beginYear:startDate.getFullYear(),beginMonth:startDate.getMonth()+1,endYear:endDate.getFullYear(),endMonth:endDate.getMonth()+1};
return dateRange
},toggleStatementsFiltersSortDirection:function(){switch(this.statementsFilters.sortDirection.currentValue){case"ASC":this.statementsFilters.sortDirection.currentValue="DESC";
break;
case"DESC":this.statementsFilters.sortDirection.currentValue="ASC";
break;
default:this.error("Statement sort direction filter value "+this.statementsFilters.sortDirection.currentValue+" not recognized");
break
}},setSortableColumnHeadingsClass:function(){var _this=this;
$.each(this.sortableColumnHeadings,function(columnKey,columnHeading){if(columnHeading.sortBy===_this.statementsFilters.sortBy.currentValue){columnHeading.triggerElement.addClass(_this.activeSortColumnClass)
}else{columnHeading.triggerElement.removeClass(_this.activeSortColumnClass)
}})
},toTitleCase:function(input){var firstChar=input.substr(0,1);
var restOfWord=input.substr(1);
var output=firstChar.toUpperCase()+restOfWord.toLowerCase();
return output
},accountIdIsVirtual:function(accountId){var isVirtual=false;
if(this.accountsContext.virtualAccounts){$.each(this.accountsContext.virtualAccounts,function(){if(this.accountId===accountId){isVirtual=true
}})
}return isVirtual
}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.RatesLearnMorePopupWindow=oh.tradingTool.PopupWindow.extend({defaultTabId:null,popupWindowUrl:"/faq/index.jsp#faq_Rates",popupWindowName:"ratesLearnMoreWindow",popupWindowParams:"width=1000,height=380,resizable=1,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,titlebar=0",constructor:function(openerWindow,openPopupWindowTriggerId,instanceHandle,logMethod){var METHODNAME="constructor";
this.base(openerWindow,openPopupWindowTriggerId,this.popupWindowUrl,this.popupWindowName,this.popupWindowParams,instanceHandle,"oh.accountManagement.RatesLearnMorePopupWindow",logMethod||"info");
this.log(METHODNAME+": Completed")
}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.Rates=oh.Awesome.extend({authToken:null,activeAccount:null,accountsContext:null,activeAccountId:null,plans:{},canChangeCommissionSchedule:false,currentPlan:null,selectedPlan:null,inConfirmState:false,$ratesTab:null,$activeAccountNumberContainer:null,$learnMoreWindowTrigger:null,$changeDateContainer:null,$statusContainer:null,$currentPlanStatusMessageContainer:null,$confirmPlanStatusMessageContainer:null,$selectedPlanStatusMessageContainer:null,$planChangeUpdateErrorStatusMessageContainer:null,$planChangeSystemErrorStatusMessageContainer:null,$planSelectors:null,$savePlanTrigger:null,$confirmPlanTrigger:null,$resetPlanTrigger:null,planSelectorsName:"ratesPlanSelector",selectedRateStyleClassname:"ratesHighlighted",planNameClassname:"ratesPlanName",disabledChangeTriggerClassname:"ratesChangeTriggersDisabled",constructor:function(authToken,activeAccount,accountsContext,instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.Rates",logMethod||"info");
this.authToken=authToken;
this.activeAccount=activeAccount;
this.accountsContext=accountsContext||{};
this.log("Created instance")
},init:function(){this.activeAccountId=this.activeAccount.accountId;
this.plans={planA:{selectorId:"ratesPlanSelector1",planName:"up to 5 for $5"},planB:{selectorId:"ratesPlanSelector2",planName:"$8.50 + $.15/contract"}};
$.each(this.plans,function(){this.$planSelector=$("#"+this.selectorId);
this.planValue=this.$planSelector.val();
this.$planContentContainers=this.$planSelector.parents("tr").children()
});
this.$ratesTab=$("#manageAccountsRatesTab");
this.$activeAccountNumberContainer=$("#ratesActiveAccountNumberContainer");
this.$learnMoreWindowTrigger=$("#ratesLearnMoreWindowTrigger");
this.$changeDateContainer=$("#ratesChangeDate");
this.$statusContainer=$("#ratesStatusContainer");
this.$currentPlanStatusMessageContainer=$("#ratesCurrentPlanStatusMessageContainer");
this.$confirmPlanStatusMessageContainer=$("#ratesConfirmPlanStatusMessageContainer");
this.$selectedPlanStatusMessageContainer=$("#ratesSelectedPlanStatusMessageContainer");
this.$planChangeUpdateErrorStatusMessageContainer=$("#ratesPlanChangeUpdateErrorStatusMessageContainer");
this.$planChangeSystemErrorStatusMessageContainer=$("#ratesPlanChangeSystemErrorStatusMessageContainer");
this.$planSelectors=$("input[name='"+this.planSelectorsName+"']");
this.$savePlanTrigger=$("#ratesSavePlanTrigger");
this.$confirmPlanTrigger=$("#ratesConfirmPlanTrigger");
this.$resetPlanTrigger=$("#ratesResetPlanTrigger");
this.canChangeCommissionSchedule=oh.utils.objects.toBoolean(this.activeAccount.canChangeCommissionSchedule);
var _this=this;
this.$planSelectors.each(function(){oh.utils.objects.bindAsEventListener(_this,"click",$(this),_this.handleRateSelect)
});
oh.utils.objects.bindAsEventListener(this,"click",this.$savePlanTrigger,this.handleSaveTriggerClick);
oh.utils.objects.bindAsEventListener(this,"click",this.$confirmPlanTrigger,this.handleConfirmTriggerClick);
oh.utils.objects.bindAsEventListener(this,"click",this.$resetPlanTrigger,this.handleResetTriggerClick);
(new oh.accountManagement.RatesLearnMorePopupWindow(window,"ratesLearnMoreWindowTrigger","Rates Learn More Window Controller")).init();
this.$activeAccountNumberContainer.html(this.activeAccount.account);
this.setInitialPlan();
this.$ratesTab.show();
this.log("Initialized")
},handleTabSelect:function(evt,context){this.log("Tab selected")
},handleRateSelect:function(evt){var $planSelector=$(evt.target);
var plan=this.getPlanById($planSelector.attr("id"));
this.selectedPlan=plan;
this.setPlanTriggersDiabled((this.selectedPlan===this.currentPlan));
this.setPlansView(plan)
},handleSaveTriggerClick:function(evt){if(this.selectedPlan!==this.currentPlan){this.inConfirmState=true;
this.$savePlanTrigger.hide();
this.$confirmPlanTrigger.show();
this.displayConfirmPlanStatus();
this.setPlanSelectorsDisabled(true)
}},handleConfirmTriggerClick:function(evt){var _this=this;
var handleUpdateCommissionScheduleError=function(respErrors){_this.error("Could not update the commision plan.");
if(respErrors){if(respErrors["schedule.not.found"]){}else{if(respErrors["schedule.change.not.available"]){_this.displayPlanChangeUpdateErrorStatus()
}else{if(respErrors["schedule.date.not.available"]){}else{if(respErrors.action==="timeout"){_this.setPlanTriggersDiabled(false);
_this.displayPlanChangeSystemErrorStatus()
}}}}oh.accountManagement.utils.redirectToLoginIfTimedOut(respErrors)
}else{_this.setPlanTriggersDiabled(false);
_this.displayPlanChangeSystemErrorStatus()
}};
var formatNextCommissionSchedule=function(nextCommissionSchedule){var output=nextCommissionSchedule;
output=output.replace("AM","a.m.");
output=output.replace("PM","p.m.");
output=output.replace("CDT","CT");
return output
};
var updateCommissionScheduleSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)){_this.currentPlan=_this.selectedPlan;
_this.canChangeCommissionSchedule=false;
var nextCommissionSchedule=formatNextCommissionSchedule(respData.nextCommissionSchedule);
_this.$changeDateContainer.html(nextCommissionSchedule);
_this.displaySelectedPlanStatus()
}else{handleUpdateCommissionScheduleError(respErrors)
}};
var updateCommissionScheduleErrorCallback=function(respStatus,respText){handleUpdateCommissionScheduleError(null)
};
this.setInputsDisabled(true);
oh.accountManagement.utils.webMessage.updateCommissionSchedule(this.authToken,this.activeAccountId,this.selectedPlan.planValue,updateCommissionScheduleSuccessCallback,updateCommissionScheduleErrorCallback)
},handleResetTriggerClick:function(evt){if(this.selectedPlan!==this.currentPlan){this.selectedPlan=this.currentPlan;
this.setViewToCurrentPlan();
this.$savePlanTrigger.show();
this.$confirmPlanTrigger.hide();
this.setPlanSelectorsDisabled(false);
this.inConfirmState=false;
this.setPlanTriggersDiabled(true)
}},getPlanById:function(planId){var plan=null;
$.each(this.plans,function(){if(planId===this.selectorId){plan=this
}});
return plan
},getPlanByValue:function(planValue){var plan=null;
$.each(this.plans,function(){var planSelectorValue=this.$planSelector.val();
if(planValue===planSelectorValue){plan=this
}});
return plan
},setPlansView:function(plan){var _this=this;
$.each(this.plans,function(){if(this===plan){this.$planContentContainers.addClass(_this.selectedRateStyleClassname)
}else{this.$planContentContainers.removeClass(_this.selectedRateStyleClassname)
}})
},setPlanSelectorsDisabled:function(disabled){this.$planSelectors.each(function(){$(this).attr("disabled",disabled)
})
},setPlanTriggersDiabled:function(disabled){this.$savePlanTrigger.attr("disabled",disabled);
this.$confirmPlanTrigger.attr("disabled",disabled);
this.$resetPlanTrigger.attr("disabled",disabled);
if(disabled){this.$savePlanTrigger.addClass(this.disabledChangeTriggerClassname);
this.$confirmPlanTrigger.addClass(this.disabledChangeTriggerClassname);
this.$resetPlanTrigger.addClass(this.disabledChangeTriggerClassname)
}else{this.$savePlanTrigger.removeClass(this.disabledChangeTriggerClassname);
this.$confirmPlanTrigger.removeClass(this.disabledChangeTriggerClassname);
this.$resetPlanTrigger.removeClass(this.disabledChangeTriggerClassname)
}},setInputsDisabled:function(disabled){this.setPlanSelectorsDisabled(disabled);
this.setPlanTriggersDiabled(disabled)
},setViewToCurrentPlan:function(){this.setPlansView(this.currentPlan);
var _this=this;
$.each(this.plans,function(){this.$planSelector.attr("checked",(this===_this.currentPlan))
});
this.displayCurrentPlanStatus()
},setInitialPlan:function(){var currentCommissionSchedule=this.activeAccount.currentCommissionSchedule;
this.currentPlan=this.getPlanByValue(currentCommissionSchedule);
this.selectedPlan=this.currentPlan;
var disablePlanSelectors=!this.canChangeCommissionSchedule;
this.setPlanSelectorsDisabled(disablePlanSelectors);
this.setPlanTriggersDiabled(true);
this.setViewToCurrentPlan()
},setPlanNameValueInStatusContainer:function(statusContainer,message){var $planNameContainer=$("."+this.planNameClassname,$(statusContainer));
$planNameContainer.html(message)
},displayCurrentPlanStatus:function(){if(this.currentPlan){this.setPlanNameValueInStatusContainer(this.$currentPlanStatusMessageContainer,this.currentPlan.planName);
this.$currentPlanStatusMessageContainer.show()
}else{this.$currentPlanStatusMessageContainer.hide()
}this.$confirmPlanStatusMessageContainer.hide();
this.$selectedPlanStatusMessageContainer.hide();
this.$planChangeUpdateErrorStatusMessageContainer.hide();
this.$planChangeSystemErrorStatusMessageContainer.hide()
},displayConfirmPlanStatus:function(){if(this.selectedPlan){this.setPlanNameValueInStatusContainer(this.$confirmPlanStatusMessageContainer,this.selectedPlan.planName);
this.$confirmPlanStatusMessageContainer.show()
}else{this.$confirmPlanStatusMessageContainer.hide()
}this.$currentPlanStatusMessageContainer.hide();
this.$selectedPlanStatusMessageContainer.hide();
this.$planChangeUpdateErrorStatusMessageContainer.hide();
this.$planChangeSystemErrorStatusMessageContainer.hide()
},displaySelectedPlanStatus:function(){this.setPlanNameValueInStatusContainer(this.$selectedPlanStatusMessageContainer,this.currentPlan.planName);
this.$selectedPlanStatusMessageContainer.show();
this.$currentPlanStatusMessageContainer.hide();
this.$confirmPlanStatusMessageContainer.hide();
this.$planChangeUpdateErrorStatusMessageContainer.hide();
this.$planChangeSystemErrorStatusMessageContainer.hide()
},displayPlanChangeUpdateErrorStatus:function(){this.$planChangeUpdateErrorStatusMessageContainer.show();
this.$selectedPlanStatusMessageContainer.hide();
this.$currentPlanStatusMessageContainer.hide();
this.$confirmPlanStatusMessageContainer.hide();
this.$planChangeSystemErrorStatusMessageContainer.hide()
},displayPlanChangeSystemErrorStatus:function(){this.$planChangeSystemErrorStatusMessageContainer.show();
this.$selectedPlanStatusMessageContainer.hide();
this.$currentPlanStatusMessageContainer.hide();
this.$confirmPlanStatusMessageContainer.hide();
this.$planChangeUpdateErrorStatusMessageContainer.hide()
}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement");
oh.accountManagement.Login=oh.Awesome.extend({$loginForm:null,$loginMessageContainer:null,$usernameInput:null,$usernameMessageContainer:null,$passwordInput:null,$passwordMessageContainer:null,$nonBlankValidator:null,constructor:function(instanceHandle,logMethod){this.base(instanceHandle,"oh.accountManagement.Login",logMethod||"info");
this.log("Created instance")
},init:function(){this.$nonBlankValidator=new oh.RegExValidator(/\S/,null,this.instanceHandle,this.classHandle,this.logMethod);
this.$loginForm=$("#manageAccountsLoginForm");
this.$loginMessageContainer=$("#manageAccountsLoginMessage");
this.$usernameInput=$("#manageAccountsUsername");
this.$usernameMessageContainer=$("#manageAccountsUsernameMessage");
this.$passwordInput=$("#manageAccountsPassword");
this.$passwordMessageContainer=$("#manageAccountsPasswordMessage");
var _this=this;
var handleFormSubmitWrapper=function(evt){_this.handleFormSubmit(evt)
};
this.$loginForm.bind("submit",handleFormSubmitWrapper);
this.log("Initialized")
},handleFormSubmit:function(evt){evt.preventDefault();
oh.accountManagement.utils.clearStatus(this.$loginMessageContainer);
oh.accountManagement.utils.clearStatus(this.$usernameMessageContainer);
oh.accountManagement.utils.clearStatus(this.$passwordMessageContainer);
var username=this.$usernameInput.val();
var password=this.$passwordInput.val();
var usernameValid=this.$nonBlankValidator.runTest(username);
var passwordValid=this.$nonBlankValidator.runTest(password);
var formIsValid=usernameValid&&passwordValid;
if(!usernameValid){oh.accountManagement.utils.setStatus(this.$usernameMessageContainer,"Please input a valid username")
}if(!passwordValid){oh.accountManagement.utils.setStatus(this.$passwordMessageContainer,"Please input a valid password")
}var _this=this;
var loginSuccessCallback=function(respAction,respData,respErrors){if(!oh.utils.objects.objectHasProperties(respErrors)&&("granted"===respData.access)){top.authToken=respData.authToken;
oh.accountManagement.utils.setLoginCookie(top.authToken);
oh.accountManagement.utils.redirectToHome()
}else{_this.log("User error attempting to login.");
oh.accountManagement.utils.setStatus(_this.$loginMessageContainer,"Error logging in.  Please try again.")
}};
var loginErrorCallback=function(respStatus,respText){_this.error("Server error attempting to login.");
oh.accountManagement.utils.setStatus(_this.$loginMessageContainer,"Error logging in.  Please try again.")
};
if(formIsValid){oh.utils.webMessage.authLogin(username,password,loginSuccessCallback,loginErrorCallback)
}}})
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts");
oh.accountManagement.tradingAlerts.ActiveView=oh.PureTemplate.extend({selector:"#tradingAlertsManageMain .tradingAlertsActiveBody",tradingAlertsRows:null,$tradingAlertsManageMain:null,$deleteButton:null,init:function(){var directive={"tr.tradingAlertsRow":{"tradingAlertRow <- tradingAlertRows":{"@class+":oh.accountManagement.tradingAlerts.utils.getRowClass,"td.checkBox input@id":oh.accountManagement.tradingAlerts.utils.getRowId,"td.tradingAlertsUnderlying":"tradingAlertRow.underlying","td.tradingAlertsStatus":oh.accountManagement.tradingAlerts.utils.getTradingAlertStatus,"td.tradingAlertsMetric":oh.accountManagement.tradingAlerts.utils.getMetric,"td.tradingAlertsNotes":oh.accountManagement.tradingAlerts.utils.getDescription,"td.tradingAlertsExpirationDays":oh.accountManagement.tradingAlerts.utils.getExpirationDays}}};
this.base(this.selector,directive);
this.$tradingAlertsManageMain=$("#tradingAlertsManageMain");
this.$deleteButton=$("button#tradingAlertsManageDeleteButton",this.$tradingAlertsManageMain)
},createContext:function(tradingAlerts){var context=null;
context={tradingAlertRows:tradingAlerts};
return context
},renderActiveTradingAlerts:function(activeTradingAlertsResponse){var context=this.createContext(activeTradingAlertsResponse);
var activeTradingAlertsMarkup=this.getMarkup(context);
$(this.selector).replaceWith(activeTradingAlertsMarkup)
},showEmptyActiveAlerts:function(){var $tradingAlertsActiveTableBody=$(".tradingAlertsActiveBody",this.$tradingAlertsManageMain);
$tradingAlertsActiveTableBody.html('<tr><td class="leftIndent">You have no active trading alerts.</td></tr>');
this.$deleteButton.hide()
},showErrorActiveAlerts:function(){var $tradingAlertsActiveTableBody=$(".tradingAlertsActiveBody",this.$tradingAlertsManageMain);
$tradingAlertsActiveTableBody.html('<tr><td class="leftIndent">Service currently unavailable. Please try again later.</td></tr>');
this.$deleteButton.hide()
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts");
oh.accountManagement.tradingAlerts.Controller=oh.tradingTool.TopLevelController.extend({accountId:null,classHandle:"oh.accountManagement.tradingAlerts.Controller",collectionName:"accountManagementComponents",key:"tradingAlerts",$tradingAlertsContainer:null,init:function(accountId){var containerFound=($("#manageAccountsTradingAlertsTabTrigger").length>0);
if(!containerFound){return 
}this.base();
this.accountId=accountId;
this.$tradingAlertsContainer=$("#tradingAlertsMain");
this.createAllViewControllers();
this.bindDomEventHandlers();
this.confirmSuccessfulInit()
},bindDomEventHandlers:function(){$("#manageAlertsLink").bind("click",oh.utils.objects.getFunctionInContext(this,this.handleManageAlertsClick));
$("#deliverySettingsLink").bind("click",oh.utils.objects.getFunctionInContext(this,this.handleDeliverySettingsClick))
},createAllViewControllers:function(){this.createViewController("manage",oh.accountManagement.tradingAlerts.ManageViewController,["manage",this,this.$tradingAlertsContainer,this.accountId]);
this.createViewController("deliverySettings",oh.accountManagement.tradingAlerts.DeliverySettingsViewController,["deliverySettings",this,this.$tradingAlertsContainer])
},handleTabSelect:function(evt,context){this.initialView="manage";
this.setInitialView()
},handleManageAlertsClick:function(){var newCurrentViewController=this.getViewControllerByName("manage");
if(!newCurrentViewController){this.error("Failed to find new current view controller by tab index")
}var newViewKey=newCurrentViewController.viewKey;
this.setCurrentView(newViewKey)
},handleDeliverySettingsClick:function(){var newCurrentViewController=this.getViewControllerByName("deliverySettings");
if(!newCurrentViewController){this.error("Failed to find new current view controller by tab index")
}var newViewKey=newCurrentViewController.viewKey;
this.setCurrentView(newViewKey)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts");
oh.accountManagement.tradingAlerts.DeliverySettingsViewController=oh.tradingTool.SubController.extend({classHandle:"oh.accountManagement.tradingAlerts.DeliverySettingsViewController",key:"DeliverySettingsViewController",recipientEmailId:null,recipientSMSId:null,deliverySettingsLinkSelector:"#tradingAlertsMain #deliverySettingsLink",$deliverySettingsLink:null,$pageLevelMessagesList:null,$tradingAlertsContainer:null,$tradingAlertsDeliverySettingsMain:null,$emailInput:null,$smsProviderSelectBox:null,$smsNumberInput:null,$stockAlertsSMSCheckbox:null,$stockAlertsEmailCheckbox:null,init:function(viewKey,parentController,$tradingAlertsContainer){this.base(viewKey,parentController);
this.$tradingAlertsContainer=$tradingAlertsContainer;
this.$tradingAlertsDeliverySettingsMain=$("#tradingAlertsDeliverySettingsMain",this.$tradingAlertsContainer);
this.$deliverySettingsLink=$(this.deliverySettingsLinkSelector);
this.$pageLevelMessagesList=$(".pageLevelMessages",this.$tradingAlertsDeliverySettingsMain);
this.$smsProviderSelectBox=$(".deliverySMSSelectBox",this.$tradingAlertsDeliverySettingsMain);
this.$smsNumberInput=$(".deliverySMSNumberInput",this.$tradingAlertsDeliverySettingsMain);
this.$emailInput=$(".deliveryEmailInput",this.$tradingAlertsDeliverySettingsMain);
this.$stockAlertsSMSCheckbox=$(".stockAlertsSMSCheckbox",this.$tradingAlertsDeliverySettingsMain);
this.$stockAlertsEmailCheckbox=$(".stockAlertsEmailCheckbox",this.$tradingAlertsDeliverySettingsMain);
this.$deliverySMSExampleText=$(".deliverySMSExampleText",this.$tradingAlertsDeliverySettingsMain);
this.bindStandardCustomEventHandlers();
this.bindDomEventHandlers()
},bindDomEventHandlers:function(){var $cancelButton=$("button#tradingAlertsDeliveryCancelButton",this.$tradingAlertsDeliverySettingsMain);
oh.utils.objects.bindAsEventListener(this,"click",$cancelButton,this.handleCancelButtonClick);
var $saveButton=$("button#tradingAlertsDeliverySaveButton",this.$tradingAlertsDeliverySettingsMain);
oh.utils.objects.bindAsEventListener(this,"click",$saveButton,this.handleSaveButtonClick);
this.$smsProviderSelectBox.change(oh.utils.objects.getFunctionInContext(this,this.handleSelectBoxChange))
},handleViewSelected:function(){this.$tradingAlertsDeliverySettingsMain.show();
this.$deliverySettingsLink.addClass("selectedLink");
this.setCurrentFormValues();
this.showPageLevelMessages()
},handleViewDeselected:function(){this.$tradingAlertsDeliverySettingsMain.hide();
this.$deliverySettingsLink.removeClass("selectedLink")
},handleSelectBoxChange:function(){var smsProviderValue=oh.utils.forms.getValue(this.$smsProviderSelectBox);
if(smsProviderValue=="other"){this.$deliverySMSExampleText.html("Example: 8885551212@otherprovider.com <br/> No dashes please ")
}else{this.$deliverySMSExampleText.html("Example: 8885551212 <br/> No dashes please ")
}},handleCancelButtonClick:function(){this.setCurrentFormValues()
},handleSaveButtonClick:function(){var isFormValid=this.validateForm();
if(isFormValid){this.persistRecipientInfo()
}this.showPageLevelMessages()
},setCurrentFormValues:function(){this.clearForm();
var alertType="SECURITY_PRICE";
this.findRecipientResponse(alertType)
},clearAndHideErrors:function(){this.hidePageLevelMessages();
this.clearErrors()
},clearErrors:function(){this.clearErrorInputBackgroundColor();
this.clearPageLevelMessages()
},clearErrorInputBackgroundColor:function(){this.$smsProviderSelectBox.removeClass("errorBackground");
this.$smsNumberInput.removeClass("errorBackground");
this.$emailInput.removeClass("errorBackground")
},clearForm:function(){this.clearErrors();
oh.utils.forms.setValue(this.$smsProviderSelectBox,"");
oh.utils.forms.setValue(this.$smsNumberInput,"");
oh.utils.forms.setValue(this.$emailInput,"");
oh.utils.forms.setValue(this.$stockAlertsSMSCheckbox,"");
oh.utils.forms.setValue(this.$stockAlertsSMSCheckbox,"")
},addErrorBackground:function($input){$input.addClass("errorBackground")
},addPageLevelErrorMessageAndBackgroundColor:function($input,errorMessage){this.addErrorBackground($input);
this.addErrorPageLevelMessage(errorMessage)
},addPageLevelMessage:function(type,message){this.$pageLevelMessagesList.append("<li class="+type+"Message>"+message+"</li>")
},addErrorPageLevelMessage:function(message){this.addPageLevelMessage("error",message)
},addSuccessPageLevelMessage:function(message){this.addPageLevelMessage("success",message)
},clearPageLevelMessages:function(){this.$pageLevelMessagesList.empty()
},hidePageLevelMessages:function(){this.$pageLevelMessagesList.hide()
},showPageLevelMessages:function(){this.$pageLevelMessagesList.show()
},validateForm:function(){this.clearAndHideErrors();
var isEmailValid=this.validateEmailAddress();
var isSMSAddressValid=this.validateSMSAddress();
var isFormValid=(isEmailValid&&isSMSAddressValid);
var smsNumber=oh.utils.forms.getValue(this.$smsNumberInput);
var smsProvider=oh.utils.forms.getValue(this.$smsProviderSelectBox);
var emailAddress=this.getEmailAddress();
if((!smsProvider||!smsNumber)&&!emailAddress){this.addErrorPageLevelMessage("Please fill out an SMS number or an email address.");
isFormValid=false
}else{isFormValid=isFormValid&&this.validFormCheckboxCombination()
}return isFormValid
},validateSMSAddress:function(){var isValid=true;
var smsProvider=oh.utils.forms.getValue(this.$smsProviderSelectBox)||"";
var smsNumber=oh.utils.forms.getValue(this.$smsNumberInput)||"";
var validPhoneNumber;
var validSMSFullAddress;
var errorOnNumberFieldOnly=false;
var errorOnProviderFieldOnly=false;
if(smsProvider==""){if(smsNumber.length>0){isValid=false;
errorOnProviderFieldOnly=true;
this.addErrorPageLevelMessage("Please select a service provider")
}}else{if(smsProvider=="other"){var phoneNumber=smsNumber.split("@")[0];
validPhoneNumber=oh.utils.validators.phone.runTest(phoneNumber);
validSMSFullAddress=oh.utils.validators.email.runTest(smsNumber);
if(!validPhoneNumber||!validSMSFullAddress){isValid=false;
errorOnNumberFieldOnly=true;
this.addErrorPageLevelMessage("Please enter a number in the format 8885551212@otherprovider.com")
}}else{validPhoneNumber=(oh.utils.validators.phone.runTest(smsNumber)&&smsNumber.length==10);
if(!validPhoneNumber){isValid=false;
errorOnNumberFieldOnly=true;
this.addErrorPageLevelMessage("Please enter a valid phone number in the format 8885551212, no dashes")
}}}if(!isValid){if(errorOnNumberFieldOnly){this.addErrorBackground(this.$smsNumberInput)
}else{if(errorOnProviderFieldOnly){this.addErrorBackground(this.$smsProviderSelectBox)
}else{this.addErrorBackground(this.$smsProviderSelectBox);
this.addErrorBackground(this.$smsNumberInput)
}}}return isValid
},validateEmailAddress:function(){var isValid=true;
var emailAddress=this.getEmailAddress();
isValid=(!!emailAddress)?oh.utils.validators.email.runTest(emailAddress):true;
if(!isValid){this.addPageLevelErrorMessageAndBackgroundColor(this.$emailInput,"Please enter a valid email address")
}return isValid
},validFormCheckboxCombination:function(){var isValid=true;
var isStockAlertsSMSChecked=this.$stockAlertsSMSCheckbox.attr("checked");
var isStockAlertsEmailChecked=this.$stockAlertsEmailCheckbox.attr("checked");
var emailAddress=this.getEmailAddress()||"";
var smsProvider=oh.utils.forms.getValue(this.$smsProviderSelectBox)||"";
var smsNumber=oh.utils.forms.getValue(this.$smsNumberInput)||"";
var isSMSAddressEmpty=(smsProvider==""&&smsNumber=="")?true:false;
var isEmailAddressEmpty=(emailAddress=="")?true:false;
if(isStockAlertsSMSChecked){if(isSMSAddressEmpty){this.addErrorPageLevelMessage("Please fill out an SMS number.");
isValid=false
}}if(isStockAlertsEmailChecked){if(isEmailAddressEmpty){this.addErrorPageLevelMessage("Please fill out an email address.");
isValid=false
}}return isValid
},findRecipientResponse:function(alertType){var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.findRecipientResponseHandler),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve alert.recipient.find data",{alertType:alertType});
this.addErrorPageLevelMessage("Service temporarily unavailable. Please try again later.")
})};
oh.accountManagement.utils.webMessage.findAlertRecipient(alertType,options)
},findRecipientResponseHandler:function(respStatus,respData,elapsedTime){this.setFormValues(respData)
},setFormValues:function(respData){var recipient=respData.recipient;
var status=respData.status;
this.recipientEmailId=null;
this.recipientSMSId=null;
if(recipient&&recipient.length>0){for(var i=0;
i<recipient.length;
i++){if(recipient[i].type.toUpperCase()=="EMAIL"){this.recipientEmailId=respData.recipient[i].id;
var emailAddress=recipient[i].instructions;
oh.utils.forms.setValue(this.$emailInput,emailAddress)
}if(recipient[i].type.toUpperCase()=="SMS"){var fullSMSNumber=recipient[i].instructions;
var provider=this.getSMSProvider(fullSMSNumber);
var phoneNumber=(provider!="other")?this.getSMSPhoneNumber(fullSMSNumber):fullSMSNumber;
this.recipientSMSId=respData.recipient[i].id;
oh.utils.forms.setValue(this.$smsProviderSelectBox,provider);
oh.utils.forms.setValue(this.$smsNumberInput,phoneNumber)
}}}if(status&&status.length>0){for(var i=0;
i<status.length;
i++){if(status[i].alertType.toUpperCase()=="SECURITY_PRICE"){if(status[i].active&&status[i].type.toUpperCase()=="EMAIL"){this.$stockAlertsEmailCheckbox.attr("checked",true)
}if(status[i].active&&status[i].type.toUpperCase()=="SMS"){this.$stockAlertsSMSCheckbox.attr("checked",true)
}}}}},persistRecipientResponse:function(status,recipient){var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.persistRecipientResponseHandler),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve alert.recipient.persist data");
this.addErrorPageLevelMessage("Service temporarily unavailable. Please try again later.")
})};
oh.accountManagement.utils.webMessage.persistAlertRecipient(recipient,status,options)
},persistRecipientResponseHandler:function(respStatus,respData,elapsedTime){if(respData&&respData.recipient){this.setCurrentFormValues();
this.addSuccessPageLevelMessage("Delivery settings saved!")
}},addStatus:function(type,isSMSChecked,isEmailChecked,status){status.push({type:type,SMS:isSMSChecked,EMAIL:isEmailChecked})
},addRecipient:function(id,alertType,type,instructions,active,recipients){if(!instructions&&id==""){return 
}var recipientData={alertType:alertType,type:type,active:active};
if(!!instructions){recipientData.instructions=instructions
}if(id!=""){recipientData.id=id
}recipients.push(recipientData)
},getEmailAddress:function(){var emailAddress=oh.utils.forms.getValue(this.$emailInput);
return emailAddress
},getFullSMSNumber:function(){var METHODNAME="getFullSMSNumber";
var smsProvider=oh.utils.forms.getValue(this.$smsProviderSelectBox);
var smsNumber=oh.utils.forms.getValue(this.$smsNumberInput);
var smsFullAddress="";
switch(smsProvider){case"att":smsFullAddress=smsNumber+"@txt.att.net";
break;
case"cingular":smsFullAddress=smsNumber+"@cingularme.com";
break;
case"sprint":smsFullAddress=smsNumber+"@messaging.sprintpcs.com";
break;
case"tmobile":smsFullAddress=smsNumber+"@tmomail.net";
break;
case"verizon":smsFullAddress=smsNumber+"@vtext.com";
break;
case"virgin":smsFullAddress=smsNumber+"@vmobl.com";
break;
case"other":smsFullAddress=smsNumber;
break;
default:this.error("Could not find sms service provider",METHODNAME,{smsProvider:smsProvider,smsNumber:smsNumber});
smsFullAddress=smsNumber
}return smsFullAddress
},getSMSProvider:function(fullSMSNumber){var smsProviderAddress=fullSMSNumber.split("@")[1];
var smsProvider="";
switch(smsProviderAddress){case"txt.att.net":smsProvider="att";
break;
case"cingularme.com":smsProvider="cingular";
break;
case"messaging.sprintpcs.com":smsProvider="sprint";
break;
case"tmomail.net":smsProvider="tmobile";
break;
case"vtext.com":smsProvider="verizon";
break;
case"vmobl.com":smsProvider="virgin";
break;
default:smsProvider="other"
}return smsProvider
},getSMSPhoneNumber:function(fullSMSNumber){var phoneNumber=fullSMSNumber.split("@")[0];
return phoneNumber
},persistRecipientInfo:function(){var alertType="";
var instructions="";
var instructionType;
var isSMSChecked=null;
var isEmailChecked=null;
var recipientEmailId=this.recipientEmailId||"";
var recipientSMSId=this.recipientSMSId||"";
var statuses=[];
var recipients=[];
alertType="SECURITY_PRICE";
isSMSChecked=this.$stockAlertsSMSCheckbox.attr("checked");
isEmailChecked=this.$stockAlertsEmailCheckbox.attr("checked");
this.addStatus(alertType,isSMSChecked,isEmailChecked,statuses);
alertType="SECURITY_PRICE";
this.log("something something","persistRecipientInfo",{recipientEmailId:recipientEmailId,recipientSMSId:recipientSMSId,alertType:alertType,instructionType:instructionType,instructions:instructions,recipients:recipients});
instructions=this.getEmailAddress();
instructionType="EMAIL";
this.addRecipient(recipientEmailId,alertType,instructionType,instructions,true,recipients);
instructions=this.getFullSMSNumber();
instructionType="SMS";
this.addRecipient(recipientSMSId,alertType,instructionType,instructions,true,recipients);
this.persistRecipientResponse(statuses,recipients)
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts");
oh.accountManagement.tradingAlerts.HistoryView=oh.PureTemplate.extend({selector:"#tradingAlertsManageMain .tradingAlertsHistoryBody",tradingAlertsRows:null,$tradingAlertsManageMain:null,init:function(){var directive={"tr.tradingAlertsRow":{"tradingAlertRow <- tradingAlertRows":{"@class+":oh.accountManagement.tradingAlerts.utils.getRowClass,"td.tradingAlertsUnderlying":"tradingAlertRow.underlying","td.tradingAlertsStatus":this.getHistoricAlertsStatus,"td.tradingAlertsMetric":oh.accountManagement.tradingAlerts.utils.getMetric,"td.tradingAlertsTriggerDate":"tradingAlertRow.triggerDate","td.tradingAlertsNotes":oh.accountManagement.tradingAlerts.utils.getDescription}}};
this.base(this.selector,directive);
this.$tradingAlertsManageMain=$("#tradingAlertsManageMain")
},getHistoricAlertsStatus:function(){return"Triggered"
},retrieveHistoricTradingAlertsResponse:function(){var type="SECURITY_PRICE";
var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.retrieveHistoryTradingAlertsResponseHandler),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve alert.event.find response.",METHODNAME,{type:type});
this.showErrorHistoricalAlertsMessage()
})};
oh.accountManagement.utils.webMessage.findHistoricalTradingAlertEvents(type,options)
},retrieveHistoryTradingAlertsResponseHandler:function(respAction,respData,respTimeElapsed){if(respData&&respData.alert&&respData.alert.length>0){this.renderHistoricTradingAlerts(respData.alert)
}else{this.showEmptyHistoricalAlertsMessage()
}},createContext:function(historicalTradingAlerts){var context=null;
context={tradingAlertRows:historicalTradingAlerts};
return context
},renderHistoricTradingAlerts:function(historicTradingAlertsResponse){var context=this.createContext(historicTradingAlertsResponse);
var historicTradingAlertsMarkup=this.getMarkup(context);
$(this.selector).replaceWith(historicTradingAlertsMarkup)
},showEmptyHistoricalAlertsMessage:function(){var $tradingAlertsHistoryTableBody=$(".tradingAlertsHistoryBody",this.$tradingAlertsManageMain);
$tradingAlertsHistoryTableBody.html('<tr><td class="leftIndent">You have no triggered trading alerts.</td></tr>')
},showErrorHistoricalAlertsMessage:function(){var $tradingAlertsHistoryTableBody=$(".tradingAlertsHistoryBody",this.$tradingAlertsManageMain);
$tradingAlertsHistoryTableBody.html('<tr><td class="leftIndent">Service currently unavailable. Please try again later.</td></tr>')
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts");
oh.accountManagement.tradingAlerts.ManageViewController=oh.tradingTool.SubController.extend({accountId:null,classHandle:"oh.accountManagement.tradingAlerts.ManageViewController",key:"ManageViewController",tradingAlertsActiveView:null,tradingAlertsHistoryView:null,viewInstantiated:false,manageAlertsLinkSelector:"#tradingAlertsMain #manageAlertsLink",$manageAlertsLink:null,$deleteButton:null,$tradingAlertsContainer:null,$tradingAlertsManageMain:null,$pageLevelMessagesList:null,$symbolField:null,$metricField:null,$metricValueField:null,$notesField:null,$durationSixtyDayCheckbox:null,alertsCount:null,maxAlerts:10,init:function(viewKey,parentController,$tradingAlertsContainer,accountId){this.base(viewKey,parentController);
this.accountId=accountId;
this.getFormFieldNodes();
this.$manageAlertsLink=$(this.manageAlertsLinkSelector);
this.$tradingAlertsContainer=$tradingAlertsContainer;
this.$tradingAlertsManageMain=$("#tradingAlertsManageMain",this.$tradingAlertsContainer);
this.$pageLevelMessagesList=$(".pageLevelMessages",this.$tradingAlertsManageMain);
this.$deleteButton=$("button#tradingAlertsManageDeleteButton",this.$tradingAlertsManageMain);
this.bindStandardCustomEventHandlers();
this.bindDomEventHandlers()
},bindDomEventHandlers:function(){var $addButton=$("button#tradingAlertsManageAddButton",this.$tradingAlertsManageMain);
oh.utils.objects.bindAsEventListener(this,"click",$addButton,this.handleAddButtonClick);
var $cancelButton=$("button#tradingAlertsManageCancelButton",this.$tradingAlertsManageMain);
oh.utils.objects.bindAsEventListener(this,"click",$cancelButton,this.handleCancelButtonClick);
var $selectAllLink=$("a#tradingAlertsManageSelectAllLink",this.$tradingAlertsManageMain);
oh.utils.objects.bindAsEventListener(this,"click",$selectAllLink,this.handleSelectAllLinkClick);
var $unselectAllLink=$("#tradingAlertsManageUnselectAllLink",this.$tradingAlertsManageMain);
oh.utils.objects.bindAsEventListener(this,"click",$unselectAllLink,this.handleUnselectAllLinkClick);
var $deleteButton=$("button#tradingAlertsManageDeleteButton",this.$tradingAlertsManageMain);
oh.utils.objects.bindAsEventListener(this,"click",$deleteButton,this.handleDeleteButtonClick)
},handleViewSelected:function(){this.hidePageLevelMessages();
this.clearFormAndErrors();
this.$tradingAlertsManageMain.show();
this.$manageAlertsLink.addClass("selectedLink");
var firstTime=!this.viewInstantiated;
if(firstTime){this.activeView=oh.accountManagement.tradingAlerts.ActiveView.getInstance([],"activeView","debug");
this.historyView=oh.accountManagement.tradingAlerts.HistoryView.getInstance([],"historyView","debug");
this.viewInstantiated=true
}this.findActiveTradingAlertsResponse();
this.historyView.retrieveHistoricTradingAlertsResponse()
},handleViewDeselected:function(){this.$tradingAlertsManageMain.hide();
this.$manageAlertsLink.removeClass("selectedLink")
},handleAddButtonClick:function(){this.clearErrors();
if(this.alertsCount<this.maxAlerts){var isFormValid=this.validateForm();
if(isFormValid){this.persistAlertResponse()
}}else{this.addErrorPageLevelMessage("You have reached the maximum of 10 alerts.")
}this.showPageLevelMessages()
},handleCancelButtonClick:function(){this.clearFormAndErrors()
},handleDeleteButtonClick:function(){this.clearErrors();
var $checkedActiveCheckboxes=$(".tradingAlertsActiveTable :checkbox:checked",this.$tradingAlertsManageMain);
if($checkedActiveCheckboxes.length>0){var tradingAlertIds=[];
$checkedActiveCheckboxes.each(function(){var $node=$(this);
var checkboxId=$node.attr("id");
var tradingAlertId=parseInt(checkboxId.split("_")[1]);
tradingAlertIds.push(tradingAlertId)
});
this.deleteAlertResponse(tradingAlertIds);
this.showPageLevelMessages()
}},handleSelectAllLinkClick:function(){var $activeCheckbox=$(".tradingAlertsActiveTable :checkbox",this.$tradingAlertsManageMain);
if($activeCheckbox.length){$activeCheckbox.each(function(){var $node=$(this);
var isChecked=$node.is(":checked");
if(!isChecked){$node.attr("checked",true)
}})
}},handleUnselectAllLinkClick:function(){var $activeCheckbox=$(".tradingAlertsActiveTable :checkbox:checked",this.$tradingAlertsManageMain);
if($activeCheckbox.length>0){$activeCheckbox.each(function(){var $node=$(this);
$node.attr("checked",false)
})
}},findActiveTradingAlertsResponse:function(){var type="SECURITY_PRICE";
var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.findActiveTradingAlertsResponseHandler),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve alert.find response.",METHODNAME,{type:type});
this.activeView.showErrorActiveAlerts()
})};
oh.accountManagement.utils.webMessage.findActiveTradingAlerts(type,options)
},findActiveTradingAlertsResponseHandler:function(respAction,respData,respTimeElapsed){if(respData&&respData.alert&&respData.alert.length>0){this.alertsCount=respData.alert.length;
this.activeView.renderActiveTradingAlerts(respData.alert);
this.$deleteButton.show()
}else{this.alertsCount=0;
this.activeView.showEmptyActiveAlerts()
}},persistAlertResponse:function(){var METHODNAME="persistAlertResponse";
var symbolFieldValue=oh.utils.forms.getValue(this.$symbolField).toUpperCase();
var metricFieldValue=oh.utils.forms.getValue(this.$metricField);
var metricValueFieldValue=oh.utils.strings.extractNumberAsString(oh.utils.forms.getValue(this.$metricValueField));
var notesFieldValue=oh.utils.forms.getValue(this.$notesField)||"";
var durationValue=oh.utils.forms.getValue(this.$durationSixtyDayCheckbox)||"";
var type="SECURITY_PRICE";
var isActive=true;
var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.persistAlertResponseHandler),messageErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.customErrorMessageHandler(respError,metricFieldValue,symbolFieldValue)
})};
oh.accountManagement.utils.webMessage.persistActiveTradingAlerts(durationValue,type,notesFieldValue,isActive,metricFieldValue,metricValueFieldValue,symbolFieldValue,options)
},customErrorMessageHandler:function(respError,metricFieldValue,symbolFieldValue){var errorMsg="Service temporarily unavailable. Please try again later.";
if(oh.utils.objects.objectHasProperties(respError)){if(respError["condition.met"]&&respError["condition.met"]!=""){switch(metricFieldValue){case"HIGH_TARGET":errorMsg="The high target has already been met";
break;
case"LOW_TARGET":errorMsg="The low target has already been met";
break;
default:errorMsg="The metric condition has already been met"
}}else{if(respError["invalid.security"]&&respError["invalid.security"]!=""){errorMsg="The symbol "+symbolFieldValue+" is not a valid stock"
}else{if(respError["security.not.supported"]&&respError["security.not.supported"]!=""){errorMsg="The symbol "+symbolFieldValue+" is not supported by alerts"
}}}}this.addErrorPageLevelMessage(errorMsg)
},persistAlertResponseHandler:function(){this.addSuccessPageLevelMessage("Alert has been created!");
this.clearForm();
this.findActiveTradingAlertsResponse()
},deleteAlertResponse:function(alertIds){var METHODNAME="deleteAlertResponse";
var options={successCallback:oh.utils.objects.getFunctionInContext(this,this.deleteAlertResponseHandler),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve alert.delete response",METHODNAME,{alert:alertIds});
this.addErrorPageLevelMessage("Service temporarily unavailable. Please try again later.")
})};
oh.accountManagement.utils.webMessage.deleteActiveTradingAlerts(alertIds,options)
},deleteAlertResponseHandler:function(){this.addSuccessPageLevelMessage("Alert(s) deleted!");
this.findActiveTradingAlertsResponse()
},clearErrors:function(){this.clearPageLevelMessages();
this.clearErrorInputBackgroundColor()
},clearErrorInputBackgroundColor:function(){this.$symbolField.removeClass("errorBackground");
this.$metricField.removeClass("errorBackground");
this.$metricValueField.removeClass("errorBackground");
this.$notesField.removeClass("errorBackground")
},clearForm:function(){oh.utils.forms.setValue(this.$symbolField,"");
oh.utils.forms.setValue(this.$metricField,"");
oh.utils.forms.setValue(this.$metricValueField,"");
oh.utils.forms.setValue(this.$notesField,"");
oh.utils.forms.setValue(this.$durationSixtyDayCheckbox,60)
},clearFormAndErrors:function(){this.clearErrors();
this.clearForm()
},addPageLevelErrorMessageAndBackgroundColor:function($input,errorMessage){$input.addClass("errorBackground");
this.addErrorPageLevelMessage(errorMessage)
},addPageLevelMessage:function(type,message){this.$pageLevelMessagesList.append("<li class="+type+"Message>"+message+"</li>")
},addErrorPageLevelMessage:function(message){this.addPageLevelMessage("error",message)
},addSuccessPageLevelMessage:function(message){this.addPageLevelMessage("success",message)
},clearPageLevelMessages:function(){this.$pageLevelMessagesList.empty()
},hidePageLevelMessages:function(){this.$pageLevelMessagesList.hide()
},showPageLevelMessages:function(){this.$pageLevelMessagesList.show()
},getFormFieldNodes:function(){this.$symbolField=$("#addAlertSymbol",this.$tradingAlertsManageMain);
this.$metricField=$("#addAlertMetric",this.$tradingAlertsManageMain);
this.$metricValueField=$("#addAlertValue",this.$tradingAlertsManageMain);
this.$notesField=$("#addAlertNotes",this.$tradingAlertsManageMain);
this.$durationSixtyDayCheckbox=$("#addAlertDurationSixtyDays",this.$tradingAlertsManageMain)
},validateForm:function(){var isFormValid=false;
this.hidePageLevelMessages();
this.clearErrors();
var symbolFieldValue=oh.utils.forms.getValue(this.$symbolField)||"";
var metricFieldValue=oh.utils.forms.getValue(this.$metricField)||"";
var metricValueFieldValue=oh.utils.forms.getValue(this.$metricValueField)||"";
var notesFieldValue=oh.utils.forms.getValue(this.$notesField)||"";
var isSymbolValid=this.validateSymbol(symbolFieldValue,this.$symbolField);
var isMetricValid=this.validateMetric(metricFieldValue,this.$metricField);
var isMetricValueValid=this.validateMetricValue(metricValueFieldValue,this.$metricValueField);
var isNoteValueValid=this.validateNoteValue(notesFieldValue,this.$notesField);
isFormValid=(isSymbolValid&&isMetricValid&&isMetricValueValid&&isNoteValueValid);
return isFormValid
},validateSymbol:function(symbolFieldValue,$input){var isValid=true;
if(symbolFieldValue.length<1||symbolFieldValue.length>6){isValid=false
}else{if(!symbolFieldValue.match(/^[a-zA-Z]+(\.)?([a-zA-Z]+)?$/)){isValid=false
}else{isValid=this.getViewQuoteResponse(symbolFieldValue,this.accountId)
}}if(!isValid){this.addPageLevelErrorMessageAndBackgroundColor($input,"Please enter a valid symbol")
}return isValid
},getViewQuoteResponse:function(symbolValue,accountId){var METHODNAME="getViewQuoteResponse";
var options={async:false,successCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){return true
}),defaultErrorCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve view.quote response",METHODNAME,{symbol:symbolValue,account:accountId});
return false
}),messageTimeoutCallback:oh.utils.objects.getFunctionInContext(this,function(respStatus,respError,elapsedTime){this.error("Unable to retrieve view.quote response",METHODNAME,{symbol:symbolValue,account:accountId});
this.addErrorPageLevelMessage("Service temporarily unavailable. Please try again later.");
return false
})};
return oh.tradingTool.utils.webMessage.viewQuote(symbolValue,this.accountId,false,false,false,options)
},validateMetric:function(metricFieldValue,$input){var isValid=true;
if(metricFieldValue==""){isValid=false
}if(!isValid){this.addPageLevelErrorMessageAndBackgroundColor($input,"Please select a metric")
}return isValid
},validateMetricValue:function(metricValueFieldValue,$input){var isValid=true;
var metricValue=oh.utils.strings.extractNumberAsString(metricValueFieldValue);
var floatMetricValueFieldValue=parseFloat(metricValue);
if(!oh.utils.validators.currency.runTest(metricValueFieldValue)){isValid=false
}else{if(floatMetricValueFieldValue<0.01||floatMetricValueFieldValue>999999.99){isValid=false
}}if(!isValid){this.addPageLevelErrorMessageAndBackgroundColor($input,"Please enter a value between 0.01 and 999,999.99")
}return isValid
},validateNoteValue:function(notesFieldValue,$input){var isValid=true;
if(notesFieldValue.length>110){isValid=false
}if(!isValid){this.addPageLevelErrorMessageAndBackgroundColor($input,"Please enter a note with less than 110 characters")
}return isValid
}},oh.classInterface.factory)
})(jQuery);
(function($){oh.namespace("oh.accountManagement.tradingAlerts.utils");
oh.accountManagement.tradingAlerts.utils.getDescription=function(arg){var item=arg.items[arg.pos];
var tradingAlertDescription=oh.utils.strings.escapeHTML(item.description);
return tradingAlertDescription
};
oh.accountManagement.tradingAlerts.utils.getExpirationDays=function(arg){var item=arg.items[arg.pos];
var expirationDaysString="";
if(!item.expirationDays){expirationDaysString="Never"
}else{expirationDaysString=item.expirationDays+" days"
}return expirationDaysString
};
oh.accountManagement.tradingAlerts.utils.getMetric=function(arg){var item=arg.items[arg.pos];
var metricString="";
if(item.metric){var metricValue=item.metric.toUpperCase();
switch(metricValue){case"HIGH_TARGET":metricString="High $ Target";
break;
case"LOW_TARGET":metricString="Low $ Target";
break;
case"DAILY_DOLLAR_UP":metricString="Daily $ Up";
break;
case"DAILY_DOLLAR_DOWN":metricString="Daily $ Down";
break;
case"DAILY_PERCENT_UP":metricString="Daily % Up";
break;
case"DAILY_PERCENT_DOWN":metricString="Daily % Down";
break;
default:metricString=item.metric;
oh.core.log.error("could not find metric",METHODNAME,{metric:item.metric})
}}metricString+=" "+oh.utils.formatting.commaSeparatedNumber(item.value);
return metricString
};
oh.accountManagement.tradingAlerts.utils.getRowClass=function(arg){var cssClass="";
if((arg.pos%2)!=0){cssClass+=" coloredRow"
}return cssClass
};
oh.accountManagement.tradingAlerts.utils.getRowId=function(arg){var item=arg.items[arg.pos];
var tradingAlertId=(item.id)?"tradingAlertId_"+item.id:"";
return tradingAlertId
};
oh.accountManagement.tradingAlerts.utils.getTradingAlertStatus=function(arg){var item=arg.items[arg.pos];
var status=(item.active)?"Active":"Inactive";
return status
}
})(jQuery);