Function.getClassName=function(){return"Function";};Function.prototype.Extend=function(superClass){this.prototype=new superClass();this.prototype.getSuperClass=function(){return superClass;};this.getSuperClass=this.prototype.getSuperClass;return this;};Function.prototype.Super=function(context,methodName,args){if(null!=methodName){var method=this.getSuperClass().prototype[methodName];}
else{var method=this.getSuperClass();}
if(!args){return method.call(context);}
else{return method.apply(context,args);}};Function.prototype.Implements=function(obj,members){if(typeof obj=="function"){obj=obj.prototype;}
var tObj={}
for(var i=0,len=members.length;i<len;++i){tObj[members[i]]=obj[members[i]]||null;}
var o=WSDOM.Util.copyObject(tObj);for(var i in o){this.prototype[i]=o[i];}};Function.prototype.Context=function(obj){var fnReference=this;return function(){return typeof fnReference=="function"?fnReference.apply(obj,arguments):obj[fnReference].apply(obj,arguments);};};Function.prototype.EmptyFunction=function(){};WSDOM=new function(){var loadedClasses={};var usingReferences=[];this.defineClass=function(className,superClass,constructor){loadedClasses[className]=constructor;if(null!=superClass){loadedClasses[className].Extend(superClass);}
loadedClasses[className].prototype.getClassName=function(){return className;};loadedClasses[className].getClassName=loadedClasses[className].prototype.getClassName;return loadedClasses[className];};this.loadClass=function(className){var classDef=parseClassName(className);var o=this.getClass(classDef.className);if(o){this[o.getClassName()]=o;this[o.getClassName()].prototype.namespace=classDef.namespace;this[o.getClassName()].prototype.version=classDef.version;};};this.loadSingleton=function(className){var classDef=parseClassName(className);var o=this.getClass(classDef.className);if(o){this[o.getClassName()]=new o();this[o.getClassName()].namespace=classDef.namespace;this[o.getClassName()].version=classDef.version;};};this.getClass=function(className){return loadedClasses[className];};this.getLoadedClasses=function(){return loadedClasses;};this.using=function(originatingClassName,className){usingReferences.push({originatingClassName:originatingClassName,className:className});}
this._processUsingReferences=function(){var usingErrors=false;for(var x=0;x<usingReferences.length;x++){var originatingClassName=usingReferences[x].originatingClassName;var className=usingReferences[x].className;var classDef=parseClassName(className);if(!this[classDef.className]){if(this.Console){this.Console.warn("Missing class definition for "+className+".  Called from "+originatingClassName+".");};usingErrors=true;}else if(this[classDef.className].version!=classDef.version){if(this.Console){this.Console.warn("Version incompatibility for loaded class, "+classDef.className+"."+this[classDef.className].version+", versus requested class, version "+classDef.version+".  Called from "+originatingClassName+".");};usingErrors=false;};};if(!usingErrors){this.Console.log("WSDOM Framework loaded successfully.");};};this._onload=function(){var element=window;var eventType="load";var fnHandler=this._processUsingReferences.Context(this);if(element.addEventListener){element.addEventListener(eventType,fnHandler,false);}
else if(element.attachEvent){element.attachEvent("on"+eventType,fnHandler);};};this._onload();function parseClassName(className){var tokens=className.split('.');var classDef={namespace:tokens[0],className:tokens[1],version:tokens[2]};return classDef;};this.identity=function(x){return x};}();WSDOM.using("WSDOM","WSDOM.Console.1");Console_class=function(){this._isEnabled=false;this._origConsole;if(("console"in window)&&("firebug"in console)){this._origConsole=console;};this._stub();};Console_class.prototype.enable=function(){if(!this._origConsole&&(!("console"in window)||!("firebug"in console))){this._origConsole=this._createBackupConsole();};for(var i in this._origConsole){if(!i.match(/firebug/i)){this[i]=this._origConsole[i];};};i=null;delete i;delete this.group;delete this.groupEnd;this.startGroup=this._origConsole.group;this.endGroup=this._origConsole.groupEnd;delete this.time;delete this.timeEnd;this.startTime=this._origConsole.time;this.endTime=this._origConsole.timeEnd;};Console_class.prototype.disable=function(){for(var i in this){if(typeof this[i]=="function"&&!this.constructor.prototype[i]){this[i]=function(){};};};};Console_class.prototype._stub=function(){var methods=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd","clear","open","close","startGroup","endGroup","startTime","endTime"];for(var x=0;x<methods.length;x++){this[methods[x]]=function(){};};};Console_class.prototype.link=function(){if(arguments.length==2){var description=arguments[0];var link=arguments[1];}else if(arguments.length==1){var description='';var link=arguments[0];}else{return false;}
var a=document.createElement('a');a.setAttribute('href',link);this.log(description,a);}
Console_class.prototype._createBackupConsole=function(){var backupConsole=new function(){this.log=function()
{logFormatted(arguments,"");}
this.link=this.log
this.debug=function()
{logFormatted(arguments,"debug");}
this.info=function()
{logFormatted(arguments,"info");}
this.warn=function()
{logFormatted(arguments,"warning");}
this.error=function()
{logFormatted(arguments,"error");}
this.assert=function(truth,message)
{if(!truth)
{var args=[];for(var i=1;i<arguments.length;++i)
args.push(arguments[i]);logFormatted(args.length?args:["Assertion Failure"],"error");throw message?message:"Assertion Failure";}}
this.dir=function(object)
{var html=[];var pairs=[];for(var name in object)
{try
{pairs.push([name,object[name]]);}
catch(exc)
{}}
pairs.sort(function(a,b){return a[0]<b[0]?-1:1;});html.push('<table>');for(var i=0;i<pairs.length;++i)
{var name=pairs[i][0],value=pairs[i][1];html.push('<tr>','<td class="propertyNameCell"><span class="propertyName">',escapeHTML(name),'</span></td>','<td><span class="propertyValue">');appendObject(value,html);html.push('</span></td></tr>');}
html.push('</table>');logRow(html,"dir");}
this.dirxml=function(node)
{var html=[];appendNode(node,html);logRow(html,"dirxml");}
this.group=function()
{logRow(arguments,"group",pushGroup);}
this.groupEnd=function()
{logRow(arguments,"",popGroup);}
this.time=function(name)
{timeMap[name]=(new Date()).getTime();}
this.timeEnd=function(name)
{if(name in timeMap)
{var delta=(new Date()).getTime()-timeMap[name];logFormatted([name+":",delta+"ms"]);delete timeMap[name];}}
this.count=function()
{this.warn(["count() not supported."]);}
this.trace=function()
{this.warn(["trace() not supported."]);}
this.profile=function()
{this.warn(["profile() not supported."]);}
this.profileEnd=function()
{}
this.clear=function()
{consoleBody.innerHTML="";}
this.open=function()
{toggleConsole(true);}
this.close=function()
{if(frameVisible)
toggleConsole();}
var consoleFrame=null;var consoleBody=null;var commandLine=null;var frameVisible=false;var messageQueue=[];var groupStack=[];var timeMap={};var clPrefix=">>> ";var isFirefox=navigator.userAgent.indexOf("Firefox")!=-1;var isIE=navigator.userAgent.indexOf("MSIE")!=-1;var isOpera=navigator.userAgent.indexOf("Opera")!=-1;var isSafari=navigator.userAgent.indexOf("AppleWebKit")!=-1;function toggleConsole(forceOpen)
{frameVisible=forceOpen||!frameVisible;if(consoleFrame)
consoleFrame.style.visibility=frameVisible?"visible":"hidden";else
waitForBody();}
function focusCommandLine()
{toggleConsole(true);if(commandLine)
commandLine.focus();}
function waitForBody()
{if(document.body)
createFrame();else
setTimeout(waitForBody,200);}
function createFrame()
{if(consoleFrame)
return;window.onFirebugReady=function(doc)
{window.onFirebugReady=null;var toolbar=doc.getElementById("toolbar");toolbar.onmousedown=onSplitterMouseDown;commandLine=doc.getElementById("commandLine");addEvent(commandLine,"keydown",onCommandLineKeyDown);addEvent(doc,isIE||isSafari?"keydown":"keypress",onKeyDown);consoleBody=doc.getElementById("log");layout();flush();}
var baseURL=window._WSDOM_Console_URL||"/includes/jslib/WSDOM/firebug";consoleFrame=document.createElement("iframe");consoleFrame.setAttribute("src",baseURL+"/firebug.html");consoleFrame.setAttribute("frameBorder","0");consoleFrame.style.visibility=(frameVisible?"visible":"hidden");consoleFrame.style.zIndex="2147483647";consoleFrame.style.position="fixed";consoleFrame.style.width="100%";consoleFrame.style.left="0";consoleFrame.style.bottom="0";consoleFrame.style.height="200px";document.body.appendChild(consoleFrame);}
function getFirebugURL()
{var scripts=document.getElementsByTagName("script");for(var i=0;i<scripts.length;++i)
{if(scripts[i].src.indexOf("firebug.js")!=-1)
{var lastSlash=scripts[i].src.lastIndexOf("/");return scripts[i].src.substr(0,lastSlash);}}}
function evalCommandLine()
{var text=commandLine.value;commandLine.value="";logRow([clPrefix,text],"command");var value;try
{value=eval(text);}
catch(exc)
{}
WSDOM.Console.log(value);}
function layout()
{var toolbar=consoleBody.ownerDocument.getElementById("toolbar");var height=consoleFrame.offsetHeight-(toolbar.offsetHeight+commandLine.offsetHeight);consoleBody.style.top=toolbar.offsetHeight+"px";consoleBody.style.height=height+"px";commandLine.style.top=(consoleFrame.offsetHeight-commandLine.offsetHeight)+"px";}
function logRow(message,className,handler)
{if(consoleBody)
writeMessage(message,className,handler);else
{messageQueue.push([message,className,handler]);waitForBody();}}
function flush()
{var queue=messageQueue;messageQueue=[];for(var i=0;i<queue.length;++i)
writeMessage(queue[i][0],queue[i][1],queue[i][2]);}
function writeMessage(message,className,handler)
{var isScrolledToBottom=consoleBody.scrollTop+consoleBody.offsetHeight>=consoleBody.scrollHeight;if(!handler)
handler=writeRow;handler(message,className);if(isScrolledToBottom)
consoleBody.scrollTop=consoleBody.scrollHeight-consoleBody.offsetHeight;}
function appendRow(row)
{var container=groupStack.length?groupStack[groupStack.length-1]:consoleBody;container.appendChild(row);}
function writeRow(message,className)
{var row=consoleBody.ownerDocument.createElement("div");row.className="logRow"+(className?" logRow-"+className:"");row.innerHTML=message.join("");appendRow(row);}
function pushGroup(message,className)
{logFormatted(message,className);var groupRow=consoleBody.ownerDocument.createElement("div");groupRow.className="logGroup";var groupRowBox=consoleBody.ownerDocument.createElement("div");groupRowBox.className="logGroupBox";groupRow.appendChild(groupRowBox);appendRow(groupRowBox);groupStack.push(groupRowBox);}
function popGroup()
{groupStack.pop();}
function logFormatted(objects,className)
{var html=[];var format=objects[0];var objIndex=0;if(typeof(format)!="string")
{format="";objIndex=-1;}
var parts=parseFormat(format);for(var i=0;i<parts.length;++i)
{var part=parts[i];if(part&&typeof(part)=="object")
{var object=objects[++objIndex];part.appender(object,html);}
else
appendText(part,html);}
for(var i=objIndex+1;i<objects.length;++i)
{appendText(" ",html);var object=objects[i];if(typeof(object)=="string")
appendText(object,html);else
appendObject(object,html);}
logRow(html,className);}
function parseFormat(format)
{var parts=[];var reg=/((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;var appenderMap={s:appendText,d:appendInteger,i:appendInteger,f:appendFloat};for(var m=reg.exec(format);m;m=reg.exec(format))
{var type=m[8]?m[8]:m[5];var appender=type in appenderMap?appenderMap[type]:appendObject;var precision=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);parts.push(format.substr(0,m[0][0]=="%"?m.index:m.index+1));parts.push({appender:appender,precision:precision});format=format.substr(m.index+m[0].length);}
parts.push(format);return parts;}
function escapeHTML(value)
{function replaceChars(ch)
{switch(ch)
{case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&#39;";case'"':return"&quot;";}
return"?";};return String(value).replace(/[<>&"']/g,replaceChars);}
function objectToString(object)
{try
{return object+"";}
catch(exc)
{return null;}}
function appendText(object,html)
{if(objectToString(object).match(/href/gi)){html.push(objectToString(object));}else{html.push(escapeHTML(objectToString(object)));}}
function appendNull(object,html)
{html.push('<span class="objectBox-null">',escapeHTML(objectToString(object)),'</span>');}
function appendString(object,html)
{html.push('<span class="objectBox-string">&quot;',escapeHTML(objectToString(object)),'&quot;</span>');}
function appendInteger(object,html)
{html.push('<span class="objectBox-number">',escapeHTML(objectToString(object)),'</span>');}
function appendFloat(object,html)
{html.push('<span class="objectBox-number">',escapeHTML(objectToString(object)),'</span>');}
function appendFunction(object,html)
{var reName=/function ?(.*?)\(/;var m=reName.exec(objectToString(object));var name=m?m[1]:"function";html.push('<span class="objectBox-function">',escapeHTML(name),'()</span>');}
function appendObject(object,html)
{try
{if(object==undefined)
appendNull("undefined",html);else if(object==null)
appendNull("null",html);else if(typeof object=="string")
appendString(object,html);else if(typeof object=="number")
appendInteger(object,html);else if(typeof object=="function")
appendFunction(object,html);else if(object.nodeType==1)
appendSelector(object,html);else if(typeof object=="object")
appendObjectFormatted(object,html);else
appendText(object,html);}
catch(exc)
{}}
function appendObjectFormatted(object,html)
{var text=objectToString(object);var reObject=/\[object (.*?)\]/;var m=reObject.exec(text);html.push('<span class="objectBox-object">',m?m[1]:text,'</span>')}
function appendSelector(object,html)
{html.push('<span class="objectBox-selector">');html.push('<span class="selectorTag">',escapeHTML(object.nodeName.toLowerCase()),'</span>');if(object.id)
html.push('<span class="selectorId">#',escapeHTML(object.id),'</span>');if(object.className)
html.push('<span class="selectorClass">.',escapeHTML(object.className),'</span>');html.push('</span>');}
function appendNode(node,html)
{if(node.nodeType==1)
{html.push('<div class="objectBox-element">','&lt;<span class="nodeTag">',node.nodeName.toLowerCase(),'</span>');for(var i=0;i<node.attributes.length;++i)
{var attr=node.attributes[i];if(!attr.specified)
continue;html.push('&nbsp;<span class="nodeName">',attr.nodeName.toLowerCase(),'</span>=&quot;<span class="nodeValue">',escapeHTML(attr.nodeValue),'</span>&quot;')}
if(node.firstChild)
{html.push('&gt;</div><div class="nodeChildren">');for(var child=node.firstChild;child;child=child.nextSibling)
appendNode(child,html);html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">',node.nodeName.toLowerCase(),'&gt;</span></div>');}
else
html.push('/&gt;</div>');}
else if(node.nodeType==3)
{html.push('<div class="nodeText">',escapeHTML(node.nodeValue),'</div>');}}
function addEvent(object,name,handler)
{if(document.all)
object.attachEvent("on"+name,handler);else
object.addEventListener(name,handler,false);}
function removeEvent(object,name,handler)
{if(document.all)
object.detachEvent("on"+name,handler);else
object.removeEventListener(name,handler,false);}
function cancelEvent(event)
{if(document.all)
event.cancelBubble=true;else
event.stopPropagation();}
function onError(msg,href,lineNo)
{var html=[];var lastSlash=href.lastIndexOf("/");var fileName=lastSlash==-1?href:href.substr(lastSlash+1);html.push('<span class="errorMessage">',msg,'</span>','<div class="objectBox-sourceLink">',fileName,' (line ',lineNo,')</div>');logRow(html,"error");};function onKeyDown(event)
{if(event.keyCode==123)
toggleConsole();else if((event.keyCode==108||event.keyCode==76)&&event.shiftKey&&(event.metaKey||event.ctrlKey))
focusCommandLine();else
return;cancelEvent(event);}
function onSplitterMouseDown(event)
{if(isSafari||isOpera)
return;addEvent(document,"mousemove",onSplitterMouseMove);addEvent(document,"mouseup",onSplitterMouseUp);for(var i=0;i<frames.length;++i)
{addEvent(frames[i].document,"mousemove",onSplitterMouseMove);addEvent(frames[i].document,"mouseup",onSplitterMouseUp);}}
function onSplitterMouseMove(event)
{var win=document.all?event.srcElement.ownerDocument.parentWindow:event.target.ownerDocument.defaultView;var clientY=event.clientY;if(win!=win.parent)
clientY+=win.frameElement?win.frameElement.offsetTop:0;var height=consoleFrame.offsetTop+consoleFrame.clientHeight;var y=height-clientY;consoleFrame.style.height=y+"px";layout();}
function onSplitterMouseUp(event)
{removeEvent(document,"mousemove",onSplitterMouseMove);removeEvent(document,"mouseup",onSplitterMouseUp);for(var i=0;i<frames.length;++i)
{removeEvent(frames[i].document,"mousemove",onSplitterMouseMove);removeEvent(frames[i].document,"mouseup",onSplitterMouseUp);}}
function onCommandLineKeyDown(event)
{if(event.keyCode==13)
evalCommandLine();else if(event.keyCode==27)
commandLine.value="";}
window.onerror=onError;addEvent(document,isIE||isSafari?"keydown":"keypress",onKeyDown);toggleConsole(true);}();return backupConsole;};WSDOM.defineClass("Console",null,Console_class);WSDOM.loadSingleton("WSDOM.Console.1");var EventSource=function(type){this.listeners=[];this.type=type;};EventSource.prototype.addListener=function(listener,context){if(listener instanceof Function){listener={handler:listener,context:context}}
if(!listener.context){listener.context=window;}
this.listeners.push(listener);return listener;};EventSource.prototype.removeListener=function(listener){for(var i=0;i<this.listeners.length;i++){if(listener==this.listeners[i]){this.listeners.splice(i,1);}}};EventSource.prototype.removeAll=function(){this.listeners=[];};EventSource.prototype.fire=function(){var args=[this.type];for(var i=0;i<arguments.length;i++){args.push(arguments[i]);}
for(var i=0;i<this.listeners.length;i++){this.listeners[i].handler.apply(this.listeners[i].context,args);}};var DOMEventSource=function(type){DOMEventSource.Super(this,null,arguments);this.delayTimeouts=[];this.typeIE="on"+this.type;this.elements=[];};DOMEventSource.Extend(EventSource);DOMEventSource.prototype._getBrowserEventName=function(){switch(this.type){case"load":case"change":case"reset":case"select":case"submit":case"blur":case"focus":case"resize":case"scroll":case"abort":case"error":case"unload":return"HTMLEvents";case"mouseover":case"mouseout":case"click":case"dblclick":case"mouseup":case"mousedown":case"mouseenter":case"mouseleave":case"mousemove":case"contextmenu":case"dragstart":case"selectstart":return"MouseEvents";case"keypress":case"keydown":case"keyup":return"UIEvents";default:return null;}};DOMEventSource.prototype._validateEvent=function(e,listener){if(listener.keyCode&&"UIEvents"==this._getBrowserEventName()){return listener.keyCode==e.nativeEvent.keyCode;}
return true;};DOMEventSource.prototype._createDOMHandlerClosure=function(listener,element){var theDOMEventSource=this;for(var i=0,DOMHandler;i<element.length;i++){DOMHandler=function(){var el=element[i].node;if(listener.delay){return function(){var e=window.event||arguments[0];var newEvt={};for(var i in e){newEvt[i]=e[i];}
e=new DOMEvent(newEvt);theDOMEventSource.clearDelayTimeouts();theDOMEventSource.delayTimeouts.push(window.setTimeout(function(){if(theDOMEventSource._validateEvent(e,listener)){listener.handler.call(listener.context,e,el,listener.data);}},listener.delay));}}
else{return function(){var e=new DOMEvent(window.event||arguments[0]);if(theDOMEventSource._validateEvent(e,listener)){listener.handler.call(listener.context,e,el,listener.data);}}}}();this._addEventListener(element[i].node,DOMHandler);element[i].registeredListeners.push({DOMHandler:DOMHandler,listener:listener});}};DOMEventSource.prototype.addElement=function(element,removeIfExisting){if(!(element instanceof Array)){element=[element];}
if(removeIfExisting){this.removeElement(element);}
var elements=[];for(var i=0;i<element.length;i++){elements.push({node:element[i],registeredListeners:[]});}
for(var i=0;i<this.listeners.length;i++){this._createDOMHandlerClosure(this.listeners[i],elements);}
this.elements=this.elements.concat(elements);};DOMEventSource.prototype.removeElement=function(element){var element=[].concat(element);for(var i=0,elWrapper;i<this.elements.length;i++){elWrapper=this.elements[i];if(!element.length){break;}
for(var j=0,el;j<element.length;j++){el=element[j];if(elWrapper.node===el){for(var k=0;k<elWrapper.registeredListeners.length;k++){this._removeEventListener(el,elWrapper.registeredListeners[k].DOMHandler);}
element.splice(j,1);this.elements.splice(i,1);j--;i--;}}}};DOMEventSource.prototype.removeAll=function(){this.removeAllElements();this.listeners=[];};DOMEventSource.prototype.removeAllElements=function(){for(var i=0,el;i<this.elements.length;i++){el=this.elements[i];for(var j=0;j<el.registeredListeners.length;j++){this._removeEventListener(el.node,el.registeredListeners[j].DOMHandler);}}
this.elements=[];};DOMEventSource.prototype.addListener=function(listener,context,delay){if(listener instanceof Function){listener={handler:listener,context:context,delay:delay}}
if(!listener.context){listener.context=window;}
this._createDOMHandlerClosure(listener,this.elements);this.listeners.push(listener);return listener;};DOMEventSource.prototype.removeListener=function(listener){for(var i=0,el;i<this.elements.length;i++){el=this.elements[i];for(var j=0,rl;j<el.registeredListeners.length;j++){rl=el.registeredListeners[j];if(rl.listener==listener){this._removeEventListener(el.node,rl.DOMHandler);el.registeredListeners.splice(j,1);break;}}}
for(var i=0,listener;i<this.listeners.length;i++){if(listener==this.listeners[i]){this.listeners.splice(i,1);break;}}};DOMEventSource.prototype.fire=function(element){if(undefined==element){for(var i=0;i<this.elements.length;i++){this._dispatchEvent(this.elements[i].node);}}
else{if(!(element instanceof Array)){element=[element];}
for(var i=0;i<element.length;i++){this._dispatchEvent(element[i]);}}};DOMEventSource.prototype._addEventListener=function(el,handler){if(document.attachEvent){DOMEventSource.prototype._addEventListener=function(el,handler){el.attachEvent(this.typeIE,handler);};}
else if(document.addEventListener){DOMEventSource.prototype._addEventListener=function(el,handler){el.addEventListener(this.type,handler,false);};}
this._addEventListener=DOMEventSource.prototype._addEventListener;this._addEventListener(el,handler);};DOMEventSource.prototype._removeEventListener=function(el,handler){if(el.detachEvent){DOMEventSource.prototype._removeEventListener=function(el,handler){el.detachEvent(this.typeIE,handler);};}
else if(el.removeEventListener){DOMEventSource.prototype._removeEventListener=function(el,handler){el.removeEventListener(this.type,handler,false);};}
this._removeEventListener=DOMEventSource.prototype._removeEventListener;this._removeEventListener(el,handler);};DOMEventSource.prototype._dispatchEvent=function(el){if(document.createEventObject){DOMEventSource.prototype._dispatchEvent=function(el){var event=document.createEventObject();event.srcElement=el;event.type=this.type;el.fireEvent(this.typeIE,event);};}
else{DOMEventSource.prototype._dispatchEvent=function(el){var event=document.createEvent(this._getBrowserEventName(this.type));event.initEvent(this.type,true,true);el.dispatchEvent(event);};}
this._dispatchEvent=DOMEventSource.prototype._dispatchEvent;this._dispatchEvent(el);};DOMEventSource.prototype.clearDelayTimeouts=function(){for(var i=0;i<this.delayTimeouts.length;i++){window.clearTimeout(this.delayTimeouts[i]);}
this.delayTimeouts=[];};var DOMEvent=function(nativeEvent){this.nativeEvent=nativeEvent;};DOMEvent.prototype.cancel=function(){if(this.nativeEvent.stopPropagation){this.nativeEvent.stopPropagation();}
else{try{this.nativeEvent.cancelBubble=true;}catch(e){}}
if(this.nativeEvent.preventDefault){this.nativeEvent.preventDefault();}
else{try{this.nativeEvent.returnValue=false;}catch(e){}}
return this.nativeEvent;};DOMEvent.prototype.getTarget=function(){var target=this.nativeEvent.srcElement||this.nativeEvent.target;this.getTarget=function(){return target;}
return this.getTarget();};var EventManager=function(){this.events=[];this.add(window,"unload",this.removeAll,this);};EventManager.prototype.KEYCODES={Backspace:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,CAPS:20,ESCAPE:27,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,SPACE:32,COMMAND:224}
EventManager.prototype.add=function(element,type,handler,context,data,delay,keyCode){if(arguments.length>1){var inputs={element:element,type:type,handler:handler,context:context,data:data,delay:delay,keyCode:keyCode}}
else if(arguments[0]instanceof Object){var inputs=arguments[0];}
else{var inputs={type:arguments[0]}}
var listener={handler:inputs.handler,context:inputs.context,delay:inputs.delay,data:inputs.data,keyCode:inputs.keyCode};if(this._isDomEventType(inputs.type)){var e=this._addDOMEvent(inputs.type,listener,inputs.element);}
else{var e=this._addCustomEvent(inputs.type,listener);}
this.events.push(e);return e;};EventManager.prototype._isDomEventType=function(type){if(null==DOMEventSource.prototype._getBrowserEventName.apply({type:type})){return false;}
return true;};EventManager.prototype._addDOMEvent=function(type,listener,element){var e=new DOMEventSource(type);if(listener.handler){e.addListener(listener);}
if(element){e.addElement(element);}
return e;};EventManager.prototype._addCustomEvent=function(type,listener){var e=new EventSource(type);if(listener.handler){e.addListener(listener);}
return e;};EventManager.prototype.remove=function(e,listener){if(e instanceof EventSource){this._removeEvent(e,listener);}
else if(e.nodeName||e instanceof Array){this._removeElement(e,listener);}};EventManager.prototype._removeEvent=function(e,listener){if(undefined==listener){e.removeAll();}else{e.removeListener(listener);}
for(var i=0;i<this.events.length;i++){if(e==this.events[i]){this.events.splice(i,1);break;}}};EventManager.prototype._removeElement=function(el,eventType){for(var i=0,event;i<this.events.length;i++){event=this.events[i];if(event instanceof DOMEventSource){if(!eventType||(event.type==eventType)){event.removeElement(el);}}}};EventManager.prototype.removeAll=function(){for(var i=0;i<this.events.length;i++){this.events[i].removeAll();}
this.events=[];};EventManager.prototype.cancel=function(e){if(!e){return;}
if(e instanceof DOMEvent){e.cancel();}
else if(e.srcElement||e.target){DOMEvent.prototype.cancel.apply({nativeEvent:e});}};if(window["WSDOM"]){WSDOM.defineClass("Events",null,EventManager);WSDOM.loadSingleton("WSDOM.Events.3");}else{var Events=new EventManager();}
var Element_class=function(){}
Element_class.prototype.get=function(el){if(typeof el=="string"||typeof el=="number")el=document.getElementById(el);return el;};Element_class.prototype.create=function(tag,attributes,children,parent,ElementObjectInstance){var element=document.createElement(tag);var attributeMap={"for":["htmlFor"],"colspan":["colSpan"],"usemap":["useMap"]}
for(var i in attributes)
{if(i=="className"||i=="class")
{element.className=attributes[i];}
else if(document.all&&attributeMap[i])
{for(var j=0;j<attributeMap[i].length;j++){element.setAttribute(attributeMap[i][j],attributes[i]);}
element.setAttribute(i,attributes[i]);}
else if(i=="style")
{this.setStyle(element,attributes[i]);}
else if(i=="WSDOM.Events"||i=="Events")
{if(typeof WSDOM.Events!="undefined"){var elEvents=attributes[i];if(!this.isArray(elEvents)){elEvents=[elEvents]}
for(var j=0;j<elEvents.length;j++){elEvents[j].element=element;WSDOM.Events.add(elEvents[j]);}}
else{}}
else
{element.setAttribute(i,attributes[i]);};};if(tag.match(/^map$/i)&&attributes&&attributes.name&&!attributes.id){element.setAttribute("id",attributes.name);}
if(arguments.length>2&&children!=undefined&&children!==""){if(typeof children=="object"&&children.constructor==Array)
{for(var i=0;i<children.length;i++)
{this.addChild(element,children[i]);};}
else
{this.addChild(element,children);};};if(parent){this.addChild(parent,element);}
return(ElementObjectInstance)?new ElementObject(element):element;};Element_class.prototype.addChild=function(el,child){el=this.get(el);if(!this.isArray(child)){child=[child]}
for(var i=0;i<child.length;i++){if(typeof child[i]=="object"){el.appendChild(child[i]);}
else if(typeof child[i]=="string"||typeof child[i]=="number"){el.innerHTML+=child[i];};}};Element_class.prototype.remove=function(el){el=this.get(el);if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].parentNode.removeChild(el[i])}};Element_class.prototype.setDisplay=function(el,d){el=this.get(el);if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].style.display=d;}};Element_class.prototype.setVisibility=function(el,d){el=this.get(el);if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].style.visibility=d;}};Element_class.prototype.removeChildNodes=function(el){el=this.get(el);while(el.childNodes.length){el.removeChild(el.firstChild);}
return el;};Element_class.prototype.cloneNode=function(el,cloneChildren){var cloneChildNodes=(cloneChildren)?cloneChildren:false;if(document.all){var node=el.outerHTML;if(cloneChildNodes&&el.innerHTML){node.innerHTML=el.innerHTML;}
var container=document.createElement("DIV");container.innerHTML=node;node=container.firstChild;}else{var node=el.cloneNode(cloneChildNodes);}
return node;};Element_class.prototype.getParent=function(el,tag,includeSelf){var el=this.get(el);if(!tag){tag=el.tagName;}
if(!includeSelf&&el.parentNode){el=el.parentNode;}
if(el.tagName&&el.tagName.match(/^BODY$/i)&&!tag.match(/^BODY$/i)){return null;}
if(el.nodeType==1&&el.tagName.toLowerCase()==tag.toLowerCase()){return el;}
else{return this.getParent(el.parentNode,tag,true);}}
Element_class.prototype.setHTML=function(el,v,appendV){el=this.get(el);if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].innerHTML=(appendV)?(el[i].innerHTML+v):v;}};Element_class.prototype.parseSelector=function(){var context=this;var SEPERATOR=/\s*,\s*/;function parseSelector(selector,node,num){node=node||document.documentElement;node=this.get(node);var argSelectors=selector.split(SEPERATOR);var result=[];for(var i=0;i<argSelectors.length;i++){if(node==document.documentElement){var matches=argSelectors[i].match(/^\s*#([^\s.:@[~+>]*)\s+(.*)$/);if(matches){node=document.getElementById(matches[1])||[];argSelectors[i]=matches[2];}}
var stream=toStream(argSelectors[i]),prevToken;if(this.isArray(node)){var nodes=node;if(!argSelectors[i].match(/^[A-Za-z1-9]/)){while(stream[0]&&stream[0].match(/[* ]/)){stream.shift();}}}
else{var nodes=[node]}
for(var j=0;j<stream.length;){var token=stream[j++];var args='';if(token=="["){args=stream[j];while(stream[j++]!=']'&&j<stream.length){args+=stream[j]};args=args.slice(0,-1);var filter="";}
else{var filter=stream[j++];}
if(stream[j]=='('){while(stream[j++]!=')'&&j<stream.length)args+=stream[j];args=args.slice(0,-1);}
prevToken=token;nodes=select(nodes,token,filter,args);}
result=result.concat(nodes);}
if(num!=undefined){if(result.length){var REMatch;if(num=="first"){return result[0]}
else if(num=="last"){return result[result.length-1]}
else if(REMatch=String(num).match(/nth\((.*)\)/)||num=="even"){if(num=="even")num=2;else num=REMatch[1];var result2=[];for(var i=0,len=result.length;i<len;i++){if(i%num==0){result2.push(result[i]);}}
return result2;}
else if(num=="odd"){var result2=[];for(var i=0,len=result.length;i<len;i++){if(i%2!=0){result2.push(result[i]);}}
return result2;}
else if(!isNaN(num)&&result.length>=num){return result[num]}
else{return null;}}
else{return null;}}
return result;}
var WHITESPACE=/\s*([\s>+~(),]|^|$)\s*/g;var IMPLIED_ALL=/([\s>+~,]|[^(]\+|^)([#.:@])/g;var STANDARD_SELECT=/^[^\s>+~]/;var STREAM=/[\s#.:>+~[\]()@!]|[^\s#.:>+~[\]()@!]+/g;function toStream(selector){var stream=selector.replace(WHITESPACE,'$1').replace(IMPLIED_ALL,'$1*$2');if(STANDARD_SELECT.test(stream)){stream=' '+stream;}
return stream.match(STREAM)||[];}
function select(nodes,token,filter,args){return(selectors[token])?selectors[token](nodes,filter,args):[];}
var util={toArray:function(enumerable){var a=[];for(var i=0;i<enumerable.length;i++)a.push(enumerable[i]);return a;},push:function(arr,val){arr.push(val)
return arr.length;}};var dom={isTag:function(node,tag){return(tag=='*')||(tag.toLowerCase()==node.nodeName.toLowerCase().replace(':html',''));},previousSiblingElement:function(node){do node=node.previousSibling;while(node&&node.nodeType!=1);return node;},nextSiblingElement:function(node){do node=node.nextSibling;while(node&&node.nodeType!=1);return node;},hasClass:function(name,node){return(new RegExp('(^|\\s)'+name+'(\\s|$)')).test(node.className||'');},getByTag:function(tag,node){if(tag=='*'){var nodes=node.getElementsByTagName(tag);if(nodes.length==0&&node.all!=null)return node.all
return nodes;}
return node.getElementsByTagName(tag);}};var selectors={'#':function(nodes,filter){for(var i=0;i<nodes.length;i++){if(nodes[i].getAttribute('id')==filter)return[nodes[i]];}
return[];},' ':function(nodes,filter){var result=[];for(var i=0;i<nodes.length;i++){result=result.concat(util.toArray(dom.getByTag(filter,nodes[i])));}
return result;},'>':function(nodes,filter){var result=[];for(var i=0,node;i<nodes.length;i++){node=nodes[i];for(var j=0,child;j<node.childNodes.length;j++){child=node.childNodes[j];if(child.nodeType==1&&dom.isTag(child,filter)){result.push(child);}}}
return result;},'.':function(nodes,filter){var result=[];for(var i=0,node;i<nodes.length;i++){node=nodes[i];if(dom.hasClass([filter],node))result.push(node);}
return result;},'!':function(nodes,filter){var result=[];for(var i=0,node;i<nodes.length;i++){node=nodes[i];if(!dom.hasClass([filter],node))result.push(node);}
return result;},':':function(nodes,filter,args){return(pseudoClasses[filter])?pseudoClasses[filter](nodes,args):[];},'+':function(nodes,filter){var result=[];for(var i=0,node;i<nodes.length;i++){node=nodes[i];var sibling=parseSelector.dom.nextSiblingElement(node);if(sibling&&parseSelector.dom.isTag(sibling,filter)){result.push(sibling);}}
return result;},'~':function(nodes,filter){var result=[];for(var i=0,node;i<nodes.length;i++){node=nodes[i];var sibling=parseSelector.dom.previousSiblingElement(node);if(parseSelector.dom.isTag(sibling,filter))result.push(sibling);}
return result;},'[':function(nodes,filter,args){args=args.replace(/'/g,'"');var attributeProps=[];if(!/[<>=]/.test(args)){attributeProps=["",args,"",""];}
else{var params=args.match(/([^!^$*\/.<>=]*)(!\*=|\*=|\$=|!\$=|\^=|\/=|!\/=|<=|>=|<|>|!=|=)(\.*)(i?)(["'`])([^\5]*)(\5)/);if(params){attributeProps=params;}}
attributeProps={name:attributeProps[1],operator:attributeProps[2],isStyle:attributeProps[3]=="..",isProperty:attributeProps[3]==".",casei:attributeProps[4]?true:false,value:attributeProps[6],isValue:(attributeProps[5]=="`")};if(attributeProps.casei){attributeProps.value=attributeProps.value.toLowerCase();}
var result=[];for(var i=0,node,att,val,el;i<nodes.length;i++){node=el=nodes[i];if(attributeProps.isStyle){att=context.getStyle(node,attributeProps.name);if(!att)continue;}
else if(attributeProps.isProperty){if(node[attributeProps.name]!=undefined){var att=node[attributeProps.name];}
else{continue;}}
else{att=node.getAttribute(attributeProps.name);if(!att)continue;}
if(/[*^$\/]/.test(attributeProps.operator)){att=String(att)}
if(attributeProps.casei){att=att.toLowerCase();}
val=attributeProps.value;if(attributeProps.isValue){val=eval(val.replace(/`/g,"'"));}
if(!attributeProps.operator){result.push(nodes[i])}
else{switch(attributeProps.operator){case'=':if(att==val)result.push(node);break;case'!=':if(att!=val)result.push(node);break;case'*=':if(att.match(val))result.push(node);break;case'!*=':if(!att.match(val))result.push(node);break;case'^=':if(att.match('^'+val))result.push(node);break;case'!^=':if(!att.match('^'+val))result.push(node);break;case'$=':if(att.match(val+'$'))result.push(node);break;case'!$=':if(!att.match(val+'$'))result.push(node);break;case'/=':if(att.match(val))result.push(node);break;case'!/=':if(!att.match(val))result.push(node);break;case'>=':if(att>=val)result.push(node);break;case'>':if(att>val)result.push(node);break;case'<=':if(att<=val)result.push(node);break;case'<':if(att<val)result.push(node);break;}}}
return result;}};parseSelector.selectors=selectors;var pseudoClasses={};parseSelector.pseudoClasses=pseudoClasses;parseSelector.util=util;parseSelector.dom=dom;return parseSelector.apply(this,arguments);};Element_class.prototype.is=function(domNode,selector,parent,propagate){parent=parent||domNode.parentNode;var queriedEls=this.parseSelector(selector,parent);var i,l=queriedEls.length;while(domNode&&domNode!==parent){for(i=0;i<l;i++){if(domNode===queriedEls[i]){return true;}}
if(propagate){domNode=domNode.parentNode;continue;}
break;}
return false;};Element_class.prototype.forEach=function(el,callback,context){var returnEls=[];if(typeof el=="string"){el=this.parseSelector(el);}
else if(!this.isArray(el)){el=[el]}
var success;for(var i=0,elLen=el.length;i<elLen;i++){success=context?callback.call(context,el[i],i,el):callback(el[i],i,el)
if(success===false){break;}
returnEls.push(el[i]);}
return returnEls;}
Element_class.prototype.insertBefore=function(el,sibling){el=this.get(el);if(!el)return;sibling=this.get(sibling);if(!el||!sibling||!sibling.parentNode)
{return null;};sibling.parentNode.insertBefore(el,sibling);};Element_class.prototype.insertAfter=function(el,sibling){el=this.get(el);if(!el)return;sibling=this.get(sibling);if(!el||!sibling||!sibling.parentNode)
{return null;};return sibling.nextSibling?sibling.parentNode.insertBefore(el,sibling.nextSibling):sibling.parentNode.appendChild(el);};Element_class.prototype.nextElement=function(el,tagName){tagName=tagName?String(tagName).toLowerCase():null;var sibling=this.get(el);while(sibling=sibling.nextSibling){if(sibling.nodeType==1&&(tagName==null||sibling.tagName.toLowerCase()==tagName)){return sibling;}}
return null;}
Element_class.prototype.previousElement=function(el,tagName){tagName=tagName?String(tagName).toLowerCase():null;var sibling=this.get(el);while(sibling=sibling.previousSibling){if(sibling.nodeType==1&&(tagName==null||sibling.tagName.toLowerCase()==tagName)){return sibling;}}
return null;}
Element_class.prototype.getXY=function(el){el=this.get(el);if(!el)return;var x=0,y=0;while(el.offsetParent){x+=el.offsetLeft;y+=el.offsetTop;el=el.offsetParent;}
return{x:x,y:y};};Element_class.prototype.setXY=function(el,x,y){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){if(x!==null)el[i].style.left=x+"px";if(y!==null)el[i].style.top=y+"px";}};Element_class.prototype.getSize=function(el){el=this.get(el);if(!el)return;var height=el.offsetHeight;var width=el.offsetWidth;return{height:height,width:width};};Element_class.prototype.getSizeXY=function(el){var size=this.getSize(el);return{x:size.width,y:size.height};};Element_class.prototype.setSize=function(el,width,height){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){this.setWidth(el[i],width);this.setHeight(el[i],height);}};Element_class.prototype.setWidth=function(el,width){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].style.width=width+"px";}};Element_class.prototype.setHeight=function(el,height){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){el[i].style.height=height+"px";}};Element_class.prototype.getBorderSize=function(el){el=this.get(el);var height=el.offsetHeight-el.clientHeight;var width=el.offsetWidth-el.clientWidth;return{height:height,width:width};}
Element_class.prototype.switchClass=function(el,classname,b){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
if(b){this.addClass(el,classname);}
else{this.removeClass(el,classname);}
if(el.length){return el[0].className;}};Element_class.prototype.replaceClass=function(el,sClassNameOld,sClassNameNew,bConditional){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
if(bConditional){for(var i=0;i<el.length;i++){if(this.hasClass(el[i],sClassNameOld)){this.removeClass(el[i],sClassNameOld);this.addClass(el[i],sClassNameNew);}}}else{this.removeClass(el,sClassNameOld);this.addClass(el,sClassNameNew);}
if(el.length){return el[0].className;}};Element_class.prototype.addClass=function(el,classname){el=this.get(el);if(!el)return;if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){if(!this.hasClass(el[i],classname)){el[i].className+=(el[i].className?" ":"")+classname;}}
if(el.length){return el[0].className;}};Element_class.prototype.removeClass=function(el,classname){el=this.get(el);if(!this.isArray(el)){el=[el]}
var re=this._getClassnameRegEx(classname);for(var i=0;i<el.length;i++){el[i].className=el[i].className.replace(re,"$1$3");}
if(el.length){return el[0].className;}};Element_class.prototype.toggleClass=function(el,classname){el=this.get(el);if(!this.isArray(el)){el=[el]}
for(var i=0;i<el.length;i++){if(this.hasClass(el[i],classname)){this.removeClass(el[i],classname);}else{this.addClass(el[i],classname);}}
if(el.length){return el[0].className;}};Element_class.prototype.hasClass=function(el,classname){el=this.get(el);return(el.className&&el.className.match(this._getClassnameRegEx(classname))!=null);};Element_class.prototype._getClassnameRegEx=function(classname){return new RegExp("(\\s|^)("+classname+")(\\s|$)","g")};Element_class.prototype.getStyle=function(el,styleProp){el=this.get(el);if(!el)return;if(document.defaultView&&document.defaultView.getComputedStyle){var computedStyle=document.defaultView.getComputedStyle(el,null);return(computedStyle)?computedStyle.getPropertyValue(styleProp):null;}else if(el.currentStyle){styleProp=styleProp.replace(/\-(.)/g,function(){return arguments[1].toUpperCase();});return el.currentStyle[styleProp];}
return null;}
Element_class.prototype.setStyle=function(el,styles){el=this.get(el);if(!el)return;var pairs=[];styles=styles.split(";");for(var i=0;i<styles.length;i++){var nv=styles[i].replace(":","{:}").split("{:}");if(nv.length>1){nv[0]=nv[0].replace(/\-(.)/g,function(){return arguments[1].toUpperCase();}).replace(/\s/g,"");pairs.push({n:nv[0],v:nv[1].replace(/^\s*|\s*$/g,"")});}}
if(!this.isArray(el)){el=[el]}
var attributeMap={"float":["cssFloat","styleFloat"]}
for(var i=0;i<el.length;i++){for(var j=0;j<pairs.length;j++){if(attributeMap[pairs[j].n]){for(var k=0;k<attributeMap[pairs[j].n].length;k++){pairs.push({n:attributeMap[pairs[j].n][k],v:pairs[j].v});}}
el[i].style[pairs[j].n]=pairs[j].v;}}}
Element_class.prototype.isArray=function(o){return(o instanceof Array);};if(typeof WSDOM!="undefined"){WSDOM.using("WSDOM.Element.3","WSDOM.Events.2");WSDOM.defineClass("Element",null,Element_class);WSDOM.loadSingleton("WSDOM.Element.3");}
else{Element=new Element_class();}
function Util_class(){};Util_class.prototype.StringBuilder=function(){this.s=[];};Util_class.prototype.StringBuilder.prototype.append=function(who){this.s.push(who);};Util_class.prototype.StringBuilder.prototype.toString=function(who){return this.s.join("");};Util_class.prototype.copyObject=function(obj){var Copy;if(obj!=null){Copy=new obj.constructor;for(var property in obj){if(typeof(obj[property])=="object"){Copy[property]=this.copyObject(obj[property]);}else{Copy[property]=obj[property];};};};return Copy;};Util_class.prototype.MINUTES_IN_DAY=60*24;Util_class.prototype.MILLISECONDS_IN_DAY=1000*60*60*24;Util_class.prototype.MS_DAYS=25569;Util_class.prototype.msToJsDate=function(msDate){var jO=new Date(((msDate-this.MS_DAYS)*this.MILLISECONDS_IN_DAY));var tz=jO.getTimezoneOffset();var jO=new Date(((msDate-this.MS_DAYS+(tz/(this.MINUTES_IN_DAY)))*this.MILLISECONDS_IN_DAY));return jO;};Util_class.prototype.jsToMsDate=function(jsdate){var timezoneOffset=jsdate.getTimezoneOffset()/this.MINUTES_IN_DAY;var msDateObj=(jsdate.getTime()/this.MILLISECONDS_IN_DAY)+(this.MS_DAYS-timezoneOffset);return msDateObj;}
String.prototype.gsub=function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;};String.prototype.sub=function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});};String.prototype.truncate=function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:this;};String.prototype.scan=function(pattern,iterator){this.gsub(pattern,iterator);return this;};String.prototype.truncate=function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:this;};String.prototype.strip=function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');};String.prototype.stripTags=function(){return this.replace(/<\/?[^>]+>/gi,'');};String.prototype.escapeHTML=function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;};String.prototype.unescapeHTML=function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?new WSDOM.Enumerable(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';};String.prototype.toQueryParams=function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var name=decodeURIComponent(pair[0]);var value=pair[1]?decodeURIComponent(pair[1]):undefined;if(hash[name]!==undefined){if(hash[name].constructor!=Array)
hash[name]=[hash[name]];if(value)hash[name].push(value);}
else hash[name]=value;}
return hash;});};String.prototype.toArray=function(){return this.split('');};String.prototype.succ=function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);};String.prototype.camelize=function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();};String.prototype.underscore=function(){return this.gsub(/::/,'/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();};String.prototype.dasherize=function(){return this.gsub(/_/,'-');};String.prototype.inspect=function(useDoubleQuotes){var escapedString=this.replace(/\\/g,'\\\\');if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"';}else{return"'"+escapedString.replace(/'/g,'\\\'')+"'";};};Util_class.prototype.toEnumerable=function(arr){return new WSDOM.Util.Enumerable(arr);};Util_class.prototype.Enumerable=function(){var arrayConstructor=[];for(var i in this){arrayConstructor[i]=this[i];}
if(arguments[0]&&(arguments[0].length||arguments[0].length==0)){for(var x=0;x<arguments[0].length;x++){arrayConstructor.push(arguments[0][x]);};}else{for(var x=0;x<arguments.length;x++){arrayConstructor.push(arguments[x]);};};return arrayConstructor;};Util_class.prototype.Enumerable.prototype.$break={};Util_class.prototype.Enumerable.prototype.$continue={};Util_class.prototype.Enumerable.prototype.each=function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=this.$continue)throw e;}});}catch(e){if(e!=this.$break)throw e;}
return this;};Util_class.prototype.Enumerable.prototype._each=function(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(this[i]);};Util_class.prototype.Enumerable.prototype.eachSlice=function(number,iterator){var index=-number,slices=[],array=this.toArray();while((index+=number)<array.length){slices.push(array.slice(index,index+number));};return slices.map(iterator);};Util_class.prototype.Enumerable.prototype.all=function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||WSDOM.identity)(value,index);if(!result)throw this.$break;});return result;};Util_class.prototype.Enumerable.prototype.any=function(iterator){var result=false;this.each(function(value,index){if(result=!!(iterator||WSDOM.identity)(value,index))
throw this.$break;});return result;};Util_class.prototype.arrayFrom=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0,length=iterable.length;i<length;i++)
results.push(iterable[i]);return results;}};Util_class.prototype.Enumerable.prototype.collect=function(iterator){var results=[];this.each(function(value,index){results.push((iterator||WSDOM.identity)(value,index));});return results;};Util_class.prototype.Enumerable.prototype.detect=function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw this.$break;}});return result;};Util_class.prototype.Enumerable.prototype.findAll=function(iterator){var results=new WSDOM.Util.Enumerable();this.each(function(value,index){if(iterator(value,index))
results.push(value);});return results;};Util_class.prototype.Enumerable.prototype.grep=function(pattern,iterator){var results=new WSDOM.Util.Enumerable();this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
results.push((iterator||WSDOM.identity)(value,index));})
return results;};Util_class.prototype.Enumerable.prototype.include=function(object){var found=false;this.each(function(value){if(value==object){found=true;throw this.$break;}});return found;};Util_class.prototype.Enumerable.prototype.inGroupsOf=function(number,fillWith){fillWith=fillWith===undefined?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});};Util_class.prototype.Enumerable.prototype.inject=function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;};Util_class.prototype.Enumerable.prototype.invoke=function(method){var args=new WSDOM.Enumerable(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});};Util_class.prototype.Enumerable.prototype.max=function(iterator){var result;this.each(function(value,index){value=(iterator||WSDOM.identity)(value,index);if(result==undefined||value>=result)
result=value;});return result;};Util_class.prototype.Enumerable.prototype.min=function(iterator){var result;this.each(function(value,index){value=(iterator||WSDOM.identity)(value,index);if(result==undefined||value<result)
result=value;});return result;};Util_class.prototype.Enumerable.prototype.partition=function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||WSDOM.identity)(value,index)?trues:falses).push(value);});return[trues,falses];};Util_class.prototype.Enumerable.prototype.pluck=function(property){var results=[];this.each(function(value,index){results.push(value[property]);});return results;};Util_class.prototype.Enumerable.prototype.reject=function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
results.push(value);});return results;};Util_class.prototype.Enumerable.prototype.sortBy=function(iterator){return this.map(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');};Util_class.prototype.Enumerable.prototype.sortByField=function(sortField,sortOrder,caseSensitive){function Sort(a,b){var aField=a[sortField];var bField=b[sortField];if(!caseSensitive&&typeof(aField)=="string")aField=aField.toLowerCase();if(!caseSensitive&&typeof(bField)=="string")bField=bField.toLowerCase();if(aField<bField)return(sortOrder>0)?-1:1;if(aField>bField)return(sortOrder>0)?1:-1;return 0;}
if(!sortField)return this.sort();if(!sortOrder)sortOrder=1;this.sort(Sort);return this;};Util_class.prototype.Enumerable.prototype.toArray=function(){return this.map();};Util_class.prototype.Enumerable.prototype.zip=function(){var iterator=WSDOM.identity,args=new WSDOM.Util.Enumerable(arguments);if(typeof args.last()=='function')
iterator=args.pop();var collections=[this].concat(args).map(new WSDOM.Util.Enumerable());return this.map(function(value,index){return iterator(collections.pluck(index));});};Util_class.prototype.Enumerable.prototype.size=function(){return this.toArray().length;};Util_class.prototype.Enumerable.prototype.clear=function(){this.length=0;return this;};Util_class.prototype.Enumerable.prototype.first=function(){return this[0];};Util_class.prototype.Enumerable.prototype.last=function(){return this[this.length-1];};Util_class.prototype.Enumerable.prototype.compact=function(){return this.select(function(value){return value!=null;});};Util_class.prototype.Enumerable.prototype.flatten=function(){return this.inject([],function(array,value){return array.concat(value&&value.constructor==Array?value.flatten():[value]);});};Util_class.prototype.Enumerable.prototype.without=function(){var values=new WSDOM.Enumerable(arguments);return this.select(function(value){return!values.include(value);});};Util_class.prototype.Enumerable.prototype.indexOf=function(object){for(var i=0,length=this.length;i<length;i++)
if(this[i]==object)return i;return-1;};Util_class.prototype.Enumerable.prototype.reverse=function(inline){return(inline!==false?this:this.toArray())._reverse();};Util_class.prototype.Enumerable.prototype.reduce=function(){return this.length>1?this:this[0];};Util_class.prototype.Enumerable.prototype.uniq=function(){return this.inject([],function(array,value){return array.include(value)?array:array.concat([value]);});};Util_class.prototype.Enumerable.prototype.clone=function(){return[].concat(this);};Util_class.prototype.Enumerable.prototype.size=function(){return this.length;};Util_class.prototype.Enumerable.prototype.toArray=Util_class.prototype.Enumerable.prototype.clone;Util_class.prototype.Enumerable.prototype.map=Util_class.prototype.Enumerable.prototype.collect;Util_class.prototype.Enumerable.prototype.find=Util_class.prototype.Enumerable.prototype.detect;Util_class.prototype.Enumerable.prototype.select=Util_class.prototype.Enumerable.prototype.findAll;Util_class.prototype.Enumerable.prototype.member=Util_class.prototype.Enumerable.prototype.include;Util_class.prototype.Enumerable.prototype.entries=Util_class.prototype.Enumerable.prototype.toArray;Util_class.prototype.toHash=function(o){return new this.Hash(o);};Util_class.prototype.Hash=function(){var objectConstructor={};for(var i in this){objectConstructor[i]=this[i];}
if(arguments[0]){for(var i in arguments[0]){objectConstructor[i]=arguments[0][i];};};return objectConstructor;};Util_class.prototype.Hash.prototype.toQueryString=function(){Console.log("here");var parts=[];this._each(function(pair){if(!pair.key)return;if(pair.value){pair.value=new WSDOM.Util.Enumerable(pair.value);var values=pair.value.compact();if(values.length<2)pair.value=values.reduce();else{key=encodeURIComponent(pair.key);values.each(function(value){value=value!=undefined?encodeURIComponent(value):'';parts.push(key+'='+encodeURIComponent(value));});return;}}
if(pair.value==undefined)pair[1]='';parts.push(pair.map(encodeURIComponent).join('='));});return parts.join('&');};Util_class.prototype.Hash.prototype._each=function(iterator){for(var key in this){var value=this[key];if(value&&value==Util_class.prototype.Hash.prototype[key])continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}};Util_class.prototype.Hash.prototype.keys=function(){return this.pluck('key');};Util_class.prototype.Hash.prototype.values=function(){return this.pluck('value');};Util_class.prototype.Hash.prototype.merge=function(hash){return new WSDOM.Hash(hash).inject(this,function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash;});};Util_class.prototype.Hash.prototype.remove=function(){var result;for(var i=0,length=arguments.length;i<length;i++){var value=this[arguments[i]];if(value!==undefined){if(result===undefined)result=value;else{if(result.constructor!=Array)result=[result];result.push(value)}}
delete this[arguments[i]];}
return result;};WSDOM.defineClass("Util",null,Util_class);WSDOM.loadSingleton("WSDOM.Util.1");Behaviour_class=function(){this.timingEnabled=false;this._stackEvents=false;this.events;if(window["WSDOM"]){this.Events=WSDOM.Events;}else{this.Events=Events;}}
Behaviour_class.prototype.apply=function(map,parentEl,timingEnabled){if(timingEnabled!==undefined){this.timingEnabled=!!timingEnabled;}
this.walkMap(map,parentEl||null);}
Behaviour_class.prototype.applyRules=Behaviour_class.prototype.apply;Behaviour_class.prototype.walkMap=function(map,parentEl){var totalTime=0;var startTime,endTime,selectorTime;var rElements,rule,i,el;for(var address in map){startTime=new Date();rElements=Element.parseSelector(address,parentEl||null);for(i=0;el=rElements[i];i++){if(typeof map[address]=="function"){map[address](el,i)}
else{this.applyEventRule.apply(this,[map[address],el]);}}
endTime=new Date();selectorTime=endTime-startTime;this.outputTiming(selectorTime,"Behaviour timing for "+address+" ("+rElements.length+")");totalTime+=selectorTime;}
this.outputTiming(totalTime,"Total Behaviour timing");}
Behaviour_class.prototype.applyEventRule=function(rule,el){var evtArgs,prop;for(var eventType in rule){eventDesc=rule[eventType];var evtArgs={label:eventType+": "+rule,element:el,type:eventType,handler:eventDesc,data:new Object(),context:window,trace:false}
if(typeof(eventDesc)=="object"){evtArgs.handler=null;if(this.validEventParameter(eventDesc)){for(prop in eventDesc){evtArgs[prop]=eventDesc[prop];}}else{var elementDbg=el.tagName+((el.id)?"#"+el.id:"")+((el.className)?"."+el.className:"");dbg("Invalid event parameter for eventType: "+eventType,elementDbg);}}
if(this.Events.remove&&!this._stackEvents){this.Events.remove(el,eventType);}
this.Events.add(evtArgs);}}
Behaviour_class.prototype.validEventParameter=function(o){return(o.handler!==undefined);}
Behaviour_class.prototype.outputTiming=function(timing,desc){if(this.timingEnabled){try{console.info((desc?desc+": ":"")+timing);}catch(e){}}}
Behaviour_class.prototype.setEventStacking=function(bStackEvents){this._stackEvents=bStackEvents;}
if(window["WSDOM"]){WSDOM.using("WSDOM.Behaviour.2","WSDOM.Events.2");WSDOM.defineClass("Behaviour",null,Behaviour_class);WSDOM.loadSingleton("WSDOM.Behaviour.2");}else{var Behaviour=new Behaviour_class();}
function Remoting_class()
{this.connections=[];this.connectionsMax=100;this.connectionsActive=0;this.connectionsPending=[];this.debug=false;this.context;this.connectionId=0;if(arguments.length&&typeof arguments[0]=="object")
{this.context=arguments[0];};};Remoting_class.prototype.load=function(contentPackage)
{try
{contentPackage.method=contentPackage.method.toLowerCase();if(contentPackage.method!="get"&&contentPackage.method!="post")
{contentPackage.method="post";};}
catch(e)
{contentPackage.method="post";};if(!contentPackage.data)
{contentPackage.data={};};if(document.location.search.match(/\.\.nocache\.\.=on/i))
{contentPackage.data["..nocache.."]="on";};var dbgChartSrv=document.location.search.match(/\.\.debugchartsrv\.\.=([a-zA-Z]+)/i);if(dbgChartSrv){contentPackage.data["..debugchartsrv.."]=dbgChartSrv[1];}
if(contentPackage.protocolType&&contentPackage.protocolType.toString().match(/JsonRPC/gi)){return new JsonRPC_Connection_class(this,this.connectionId++,contentPackage);}else{return new Connection_class(this,this.connectionId++,contentPackage);}};Remoting_class.prototype._loadXMLHTTP=function(connection){var thisConnection=connection;var contentPackage=thisConnection.contentPackage;function stateMonitor(){thisBuffer._monitorConnectionState(thisConnection);};this.connectionsActive++;var dataPackage=null;var thisBuffer=this;thisConnection.active=true;contentPackage.params={};if(typeof contentPackage.contentType=="string"){contentPackage.params["..contenttype.."]=contentPackage.contentType;};if(this.debug||contentPackage.debug){WSDOM.Console.startGroup("Remoting");};contentPackage.params["..requester.."]="ContentBuffer";if(contentPackage.method=="post"){dataPackage="";WSDOM.Console.dir(contentPackage);dataPackage="inputs="+this.encode(WSDOM.Serializer.serialize(contentPackage.data));for(var i in contentPackage.params){dataPackage+=(dataPackage.length?"&":"")+this.encode(i)+"="+this.encode(contentPackage.params[i]);};if(this.debug||contentPackage.debug){WSDOM.Console.log("ContentBuffer post data",dataPackage);};}else{contentPackage.url+=(contentPackage.url.indexOf("?")==-1?"?":"&")+"data="+this.encode(WSDOM.Serializer.serialize(contentPackage.data));};if(this.debug||contentPackage.debug){WSDOM.Console.log("ContentBuffer loading ["+thisConnection.connectionId+"]",contentPackage.url+" ["+contentPackage.method+"]");};if(this.debug||contentPackage.debug){var debugUrl=contentPackage.url;if(dataPackage){debugUrl+=(debugUrl.indexOf("?")==-1?"?":"&")+dataPackage;};debugUrl=debugUrl.replace(/\&?\.\.[^\=\&]*\.\.\=[^\&]*/g,"");if(debugUrl.indexOf("/")!=0&&debugUrl.indexOf("http")!=0){var path=String(window.location).replace(/https*:\/\//,"");debugUrl=path.substr(path.indexOf("/"),path.lastIndexOf("/")+1-path.indexOf("/"))+debugUrl;}
WSDOM.Console.link("ContentBuffer URL",debugUrl);};try{thisConnection.c.open(contentPackage.method.toUpperCase(),contentPackage.url,true);thisConnection.c.onreadystatechange=stateMonitor;}catch(e){};if(contentPackage.method=="post"){thisConnection.c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");};thisConnection.c.send(dataPackage);if(this.debug||contentPackage.debug){WSDOM.Console.endGroup("Remoting");};};Remoting_class.prototype._monitorConnectionState=function(connection){try{if(connection.c.readyState==4){if(connection.c.status!=200){try{var result=connection.c.responseText;}catch(e){var result=null;};connection.contentPackage.result=result;if(typeof connection.contentPackage.onerror=="function"){connection.contentPackage.onerror.apply(connection.context||window,[connection]);};return;};var responseType=connection.contentPackage.contentType||connection.c.getResponseHeader("Content-Type");var result=null;if(responseType.match(/text\/html/g)||responseType.match(/text\/plain/g)){result=connection.c.responseText;}else if(responseType.match(/text\/xml/g)){result=connection.c.responseXML;}else if(responseType.match(/text\/javascript/g)){try{result=connection.c.responseText;if(!connection.contentPackage.preventEval){connection.context.__evalBuffer=function(){eval(result);}
connection.context.__evalBuffer();};}catch(e){if(this.debug||connection.contentPackage.debug){WSDOM.Console.error("Remoting javascript eval error",e.message);WSDOM.Console.dir(e);};};}else if(responseType.match(/application\/json/gi)){try{result=connection.c.responseText;result=WSDOM.Serializer.deserialize(result);}catch(e){if(this.debug||connection.contentPackage.debug){WSDOM.Console.error("Remoting Serializer Error",e.message);WSDOM.Console.dir(e);};};};connection.contentPackage.result=result;if(this.debug||connection.contentPackage.debug){};if(typeof connection.contentPackage.onload=="function"){connection.contentPackage.onload.apply(connection.context||window,[connection]);};this.finishConnection(connection);};}catch(e){if(this.debug||connection.contentPackage.debug){WSDOM.Console.error("state monitoring error",e.message);WSDOM.Console.dir(e);};this.finishConnection(connection);};};Remoting_class.prototype.isActive=function(){for(var i=0;i<this.connections.length;i++){if(this.connections[i].active){return true;}}
return false;}
Remoting_class.prototype.abortRequests=function(){for(var i=0;i<this.connections.length;i++){this.connections[i].abort();};}
Remoting_class.prototype.abortRequests=function(){for(var i=0;i<this.connections.length;i++){this.connections[i].abort();};}
Remoting_class.prototype.encode=function(str){return encodeURIComponent(str);};Remoting_class.prototype.finishConnection=function(connection)
{if(connection.active)
{this.connectionsActive--;connection.active=false;}
if(this.connectionsPending.length)
{this._loadXMLHTTP(this.connectionsPending.shift());}
for(var x=0;x<this.connections.length;x++){if(connection===this.connections[x]){this.connections.splice(x,1);break;}}}
function RemotingBase_class(){};RemotingBase_class.Extend(Remoting_class);function Connection_class(contentBuffer,id,contentPackage){this.active=false;this.parent=contentBuffer;this.connectionId=id;this.contentPackage=contentPackage;this.context=(contentPackage&&contentPackage.context)||(this.parent&&this.parent.context);this._init();};Connection_class.prototype._init=function(){var c=false;try{c=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{c=new ActiveXObject("Microsoft.XMLHTTP");}catch(f){c=false;};};if(!c&&typeof XMLHttpRequest!="undefined"){c=new XMLHttpRequest();};if(c){this.c=c;}else{WSDOM.Console.log("Remoting initialization error.","Not supported by this browser","red");};if(this.parent){if(this.parent.connectionsActive<this.parent.connectionsMax){this.parent.connections.push(this);this.parent._loadXMLHTTP(this);}else{WSDOM.Console.log("queuing request");this.parent.connectionsPending.push(this);};};};Connection_class.prototype.getResult=function(){return this.contentPackage.result;};Connection_class.prototype.status=function(){return(this.c.readyState==4&&this.c.status==200);};Connection_class.prototype.abort=function(){if(this.active){try{this.c.onreadystatechange=function(){};this.c.abort();}catch(e){WSDOM.Console.log("connection abort failed",e,"red");};this.parent.finishConnection(this);};};function JsonRPC_Connection_class(contentBuffer,id,contentPackage){this.protocolType="JsonRPC";this.active=false;this.parent=contentBuffer;this.connectionId=id;this.contentPackage=contentPackage;this.context=(contentPackage&&contentPackage.context)||(this.parent&&this.parent.context);this._init();};JsonRPC_Connection_class.Extend(Connection_class);WSDOM.using("WSDOM.Remoting.1","WSDOM.Console.1");WSDOM.using("WSDOM.Remoting.1","WSDOM.Serializer.3");WSDOM.defineClass("Remoting",null,Remoting_class);WSDOM.loadClass("WSDOM.Remoting.1");function Serializer_class(){this._nameExclusions={};this._typeExclusions={};this._encode=true;this._strictJson=true;this._safeDeserialize=false;this._sBase64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";};Serializer_class.prototype.serialize=function(o){this._data=[];this._serializeNode([o],o,0);this._data=this._data.join("");this._data=this._data.replace(/,}/g,"}");this._data=this._data.replace(/,]/g,"]");this._data=this._data.substr(0,this._data.length-1);if(this.allowEncoding()){this._data=this.base64encode(this._data);}
return this._data;}
Serializer_class.prototype.addNameExclusion=function(){var l=arguments.length;for(var i=0;i<l;i++){this._nameExclusions[arguments[i]]=true;}}
Serializer_class.prototype.removeNameExclusion=function(){var l=arguments.length;for(var i=0;i<l;i++){this._nameExclusions[arguments[i]]=false;}}
Serializer_class.prototype.addTypeExclusion=function(){var l=arguments.length;for(var i=0;i<l;i++){this._typeExclusions[arguments[i].toLowerCase()]=true;}}
Serializer_class.prototype.removeTypeExclusion=function(){var l=arguments.length;for(var i=0;i<l;i++){this._typeExclusions[arguments[i].toLowerCase()]=false;}}
Serializer_class.prototype.requireStrictJson=function(value){if(typeof(value)!="undefined"){this._strictJson=value;}
return this._strictJson;}
Serializer_class.prototype.requireSafeDeserialize=function(value){if(typeof(value)!="undefined"){this._safeDeserialize=value;}
return this._safeDeserialize;}
Serializer_class.prototype.allowEncoding=function(value){if(typeof(value)!="undefined"){this._encode=value;}
return this._encode;}
Serializer_class.prototype._unicodeEscape=function(str){var dec=str.charCodeAt(0);var hexStr="\\u";var hexVals=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];var hexPlace;hexPlace=4096
hexStr+=hexVals[Math.floor(dec/hexPlace)];dec=dec%hexPlace;hexPlace=256
hexStr+=hexVals[Math.floor(dec/hexPlace)];dec=dec%hexPlace;hexPlace=16
hexStr+=hexVals[Math.floor(dec/hexPlace)];dec=dec%hexPlace;hexPlace=1
hexStr+=hexVals[Math.floor(dec/hexPlace)];dec=dec%hexPlace;return hexStr;}
Serializer_class.prototype._serializeNode=function(o,startObj,depth,parentType){var t,f,d1,d2;for(var i in o){if(o[i]===null){t="null";}else{t=typeof(o[i]);}
f=t=="object"?true:false;t=t=="object"&&typeof(o[i].length)!="undefined"&&o[i].constructor==Array?"array":t;if(!this._typeExclusions[t]&&!this._nameExclusions[i]&&!(this._strictJson&&t=="function")){switch(t){case"string":d1="\"";d2="\"";break;case"object":d1="{";d2="}";break;case"array":d1="[";d2="]";break;default:d1="";d2="";break;}
if(isFinite(i)&&!(parentType&&parentType=="object")){this._data.push(d1);}else{var n=typeof(i)=="string"?"\""+i+"\"":i;this._data.push(n+":"+d1);}
if(f){if(depth==0||o[i]!==startObj){this._serializeNode(o[i],null,null,t);}}else{if(t=="string"){this._data.push(o[i].replace(/[^ -~]|[\"\\]/g,this._unicodeEscape));}else if(t=="undefined"||t=="null"){this._data.push(t);}else{this._data.push(o[i]);}}
this._data.push(d2+",");}}}
Serializer_class.prototype.deserialize=function(o){try{if(this.hasEncodingLeader(o)){var indexR=o.indexOf('\r');var indexN=o.indexOf('\n');var index=Math.min(indexR+1||indexN+1,indexN+1||indexR+1)-1;if(index==-1){o=this.base64decode(o);}
else{o=this.base64decode(o.substring(0,index))+o.substring(index);}}
if(this._safeDeserialize){return this.safeDeserialize(o);}else{return this.unsafeDeserialize(o);}}catch(e){WSDOM.Console.log("Serializer.deserialize() error","","red");WSDOM.Console.dir(e);WSDOM.Console.log("Serializer Source",o);var x="";}
return x;}
Serializer_class.prototype.safeDeserialize=function(o){try{var p=new JsonParser_class();p.parse(o);eval("var x = "+o);}catch(e){var x=null;}
return x;}
Serializer_class.prototype.unsafeDeserialize=function(o){try{eval("var x = "+o);}catch(e){WSDOM.Console.dir(e);var x=null;}
return x;}
Serializer_class.prototype.hasEncodingLeader=function(s){return s.indexOf("B64ENC")==0?true:false;}
Serializer_class.prototype.stripLeader=function(s){return s.substr(6,s.length);}
Serializer_class.prototype.prependLeader=function(s){return"B64ENC"+s;}
Serializer_class.prototype.base64decode=function(sIn){var i;var iBits;var sOut=[];if(this.hasEncodingLeader(sIn)){sIn=this.stripLeader(sIn);}else{return sIn;}
sIn=sIn.replace(/=/g,"");for(i=0;i<sIn.length;i+=4){iBits=(this._sBase64.indexOf(sIn.charAt(i))<<18)|(this._sBase64.indexOf(sIn.charAt(i+1))<<12)|((this._sBase64.indexOf(sIn.charAt(i+2))&0xff)<<6)|(this._sBase64.indexOf(sIn.charAt(i+3))&0xff);sOut.push(String.fromCharCode(iBits>>16&0xff));sOut.push((i>sIn.length-3)?"":String.fromCharCode(iBits>>8&0xff));sOut.push((i>sIn.length-4)?"":String.fromCharCode(iBits&0xff));}
return sOut.join("");}
Serializer_class.prototype.base64encode=function(sIn){var i;var iBits;var sOut=[];for(i=0;i<sIn.length;i+=3){iBits=(sIn.charCodeAt(i)<<16)+
((sIn.charCodeAt(i+1)&0xff)<<8)+
(sIn.charCodeAt(i+2)&0xff);sOut.push(this._sBase64.charAt(iBits>>18&0x3f));sOut.push(this._sBase64.charAt(iBits>>12&0x3f));sOut.push((i>sIn.length-2)?"=":this._sBase64.charAt(iBits>>6&0x3f));sOut.push((i>sIn.length-3)?"=":this._sBase64.charAt(iBits&0x3f));}
sOut=this.prependLeader(sOut.join(""));return sOut;}
function JsonParser_class(){this.lexer=null;this.tokens=[];}
JsonParser_class.prototype.parse=function(str){this.lexer=new JsonLexer_class(str);return this._json();}
JsonParser_class.prototype.lookAhead=function(k){while(this.tokens.length<=k){this.tokens.push(this.lexer.nextToken());}
return this.tokens[k].type;}
JsonParser_class.prototype.consume=function(type){if(this.tokens.length==0){this.tokens.push(this.lexer.nextToken());}
if(this.tokens[0].type==type){this.tokens.shift();}else{throw{message:'JSON: invalid token encountered validating string; Expected '+type+', got '+this.tokens[0].type};}}
JsonParser_class.prototype._json=function(){this._value();this.consume('_EOF');}
JsonParser_class.prototype._value=function(){switch(this.lookAhead(0)){case'_OBJ_OPEN':this._object();break;case'_ARR_OPEN':this._array();break;case'_DIGITS':case'_NEG':this._number();break;case'_STRING':this.consume('_STRING');break;case'_TRUE':this.consume('_TRUE');break;case'_FALSE':this.consume('_FALSE');break;case'_NULL':this.consume('_NULL');break;}}
JsonParser_class.prototype._object=function(){this.consume('_OBJ_OPEN');if(this.lookAhead(0)!='_OBJ_CLOSE'){this._member();}
while(this.lookAhead(0)!='_OBJ_CLOSE'){this.consume('_SEP');this._member();}
this.consume('_OBJ_CLOSE');}
JsonParser_class.prototype._member=function(){this.consume('_STRING');this.consume('_ASSIGN');this._value();}
JsonParser_class.prototype._array=function(){this.consume('_ARR_OPEN');if(this.lookAhead(0)!='_ARR_CLOSE'){this._value();}
while(this.lookAhead(0)!='_ARR_CLOSE'){this.consume('_SEP');this._value();}
this.consume('_ARR_CLOSE');}
JsonParser_class.prototype._number=function(){if(this.lookAhead(0)=='_NEG'){this.consume('_NEG');}
this.consume('_DIGITS');if(this.lookAhead(0)=='_DOT'){this.consume('_DOT');this.consume('_DIGITS');}
if(this.lookAhead(0)=='_EXP'){this.consume('_EXP');if(this.lookAhead(0)=='_POS'){this.consume('_POS');}else if(this.lookAhead(0)=='_NEG'){this.consume('_NEG');}
this.consume('_DIGITS');}}
function JsonLexer_class(input){input=input.replace(/"([^"\\]|\\"|\\)*"/g,'S');input=input.replace(/[0-9]+/g,'0');this.input=input;}
JsonLexer_class.prototype.charTokens={'{':'_OBJ_OPEN','}':'_OBJ_CLOSE','[':'_ARR_OPEN',']':'_ARR_CLOSE',':':'_ASSIGN',',':'_SEP','.':'_DOT','-':'_NEG','+':'_POS','e':'_EXP','E':'_EXP','S':'_STRING','0':'_DIGITS'};JsonLexer_class.prototype.nextToken=function(){if(this.input.length==0){return new JsonToken_object("_EOF",null);}
var first=this.input.substr(0,1);if(this.charTokens[first]){this.input=this.input.substr(1);return new JsonToken_object(this.charTokens[first],first);}
switch(first){case't':case'T':if(this.input.substr(0,4).toLowerCase()=='true'){this.input=this.input.substr(4);return new JsonToken_object('_TRUE',true);}
break;case'f':case'F':if(this.input.substr(0,5).toLowerCase()=='false'){this.input=this.input.substr(5);return new JsonToken_object('_FALSE',true);}
break;case'n':if(this.input.substr(0,4)=='null'){this.input=this.input.substr(4);return new JsonToken_object('_NULL',true);}
break;}
throw{message:'JSON: Unexpected character ('+first+') encountered validating string'};}
function JsonToken_object(type,value){this.type=type;this.value=value;}
WSDOM.using("WSDOM.Serializer.3","WSDOM.Console.1");WSDOM.defineClass("Serializer",null,Serializer_class);WSDOM.loadSingleton("WSDOM.Serializer.3");Effects_class=function(){this.namedQueues={};this.globalQueue=[];}
Effects_class.prototype.enqueue=function(effectList,params){if(!params){params={};}
var global=params.global||false;var qName=params.global?null:(params.shared||'r'+Math.random());if(qName&&!this.namedQueues[qName]){this.namedQueues[qName]=[];this.namedQueues[qName].name=qName;}
var queue=qName?this.namedQueues[qName]:this.globalQueue;if(params.onComplete){if(params.context){queue.onComplete=function(){params.onComplete.apply(params.context,[]);}}else{queue.onComplete=params.onComplete;}}
for(var i=0;i<effectList.length;i++){queue.push(effectList[i]);}
this._runQueue(queue);}
Effects_class.prototype.createParallel=function(effectList,params){var onComplete=null;if(params){if(params.onComplete){if(params.context){onComplete=function(){params.onComplete.apply(params.context,[]);}}else{onComplete=params.onComplete;}}}
var InitClosure=function(context){return function(){context._initParallel(effectList,onComplete);};};effectList.animate=InitClosure(this);return effectList;}
Effects_class.prototype.runParallel=function(effectList,params){var ef=this.createParallel(effectList,params);ef.animate();return ef;}
Effects_class.prototype.create=function(element,type,params){var ef=new Effect(element,type,params);return ef;}
Effects_class.prototype.run=function(element,type,params){var ef=this.create(element,type,params);ef.animate();return ef;}
Effects_class.prototype._runQueue=function(queue){if(queue.length){var ef=queue.shift();ef.runningQueue=queue;ef.animate();}else{if(queue.onComplete){queue.onComplete();queue.onComplete=null;}
if(queue.name){delete this.namedQueues[queue.name];}}}
Effects_class.prototype._initParallel=function(effectList,onComplete){for(var i=0;i<effectList.length;i++){effectList[i].animateParallel();}
this._animateParallel(effectList,onComplete);}
Effects_class.prototype._animateParallel=function(effectList,onComplete){var isAnimating=false;for(var i=0;i<effectList.length;i++){effectList[i].nextFrame();isAnimating=isAnimating||effectList[i].isAnimating;}
if(isAnimating){var ParaClosure=function(context){return function(){context._animateParallel(effectList,onComplete);};};setTimeout(ParaClosure(this),0);}else{if(effectList.runningQueue){this._runQueue(effectList.runningQueue);effectList.runningQueue=null;}
if(onComplete){onComplete();}}}
Effects=new Effects_class();var Effect=function(oEl,sType,oParams){oParams=oParams||false;if(!oParams){return;}
this.oEl=Element.get(oEl);this._animType=sType||false;this.valueGetter=this.getValueGetterSetters().getter;this.valueSetter=this.getValueGetterSetters().setter;this._rawTo=oParams.to;this._rawFrom=oParams.from!==undefined?oParams.from:this.valueGetter();this._easing=Easing;this._easeMethod=oParams.easing&&this._easing[oParams.easing]&&this._easing[oParams.easing]!==undefined?this._easing[oParams.easing]:this._easing.easeNone;this._duration=oParams.duration;this.isAnimating=false;this.setOnCompleteHandler(oParams.onComplete,oParams.context);this._startTime=0;this._prevTime=0;this._time=0;}
Effect.prototype.animate=function(){this.animateParallel();this.onEnterFrame();}
Effect.prototype.animateParallel=function(){this._to=(typeof this._rawTo=='function')?this._rawTo():this._rawTo;this._from=(typeof this._rawFrom=='function')?this._rawFrom():this._rawFrom;if(this._animType=='background'){if(!(this._to instanceof Array)){this._to=this.toRGB(this._to);}
if(!(this._from instanceof Array)){this._from=this.toRGB(this._from);}}
this._delta=this.getDelta();this._startTime=new Date().getTime();this.isAnimating=true;}
Effect.prototype.onEnterFrame=function(){if(this.isAnimating){this.nextFrame();var AnimClosure=function(context){return function(){context.onEnterFrame()};};setTimeout(AnimClosure(this),0);}}
Effect.prototype.nextFrame=function(){this.setTime((this.getTimer()-this._startTime)/1000);}
Effect.prototype.getTimer=function(){return new Date().getTime()-this._time;}
Effect.prototype.setTime=function(t){this._prevTime=this._time;if(t>this._duration){this._time=this._duration;this.update();this.stop();}else{this._time=t;this.update();}}
Effect.prototype.update=function(value){if(this._from instanceof Array){this.valueSetter([this._easeMethod(this._time,this._from[0],this._delta[0],this._duration),this._easeMethod(this._time,this._from[1],this._delta[1],this._duration),this._easeMethod(this._time,this._from[2],this._delta[2],this._duration)]);}else{this.valueSetter(this._easeMethod(this._time,this._from,this._delta,this._duration));}}
Effect.prototype.stop=function(){this.isAnimating=false;if(this.runningQueue){Effects._runQueue(this.runningQueue);this.runningQueue=null;}
this.onComplete();}
Effect.prototype.getDelta=function(){return(this._to instanceof Array)?[this._to[0]-this._from[0],this._to[1]-this._from[1],this._to[2]-this._from[2]]:this._to-this._from;}
Effect.prototype.setOnCompleteHandler=function(f,c){if(c&&f){this.onComplete=function(){f.apply(c,arguments)};}else{this.onComplete=f||function(){return false;};}}
Effect.prototype.getValueGetterSetters=function(){var oGS;switch(this._animType){case"width":return{getter:function(){return Element.getSize(this.oEl).width},setter:function(iWidth){iWidth=iWidth>=0?iWidth:0;Element.setWidth(this.oEl,iWidth);}}
break;case"height":return{getter:function(){return Element.getSize(this.oEl).height},setter:function(iHeight){iHeight=iHeight>=0?iHeight:0;Element.setHeight(this.oEl,iHeight);}}
break;case"x":return{getter:function(){return this.oEl.offsetLeft;},setter:function(iX){this.oEl.style.left=iX+"px";}}
break;case"y":return{getter:function(){return this.oEl.offsetTop;},setter:function(iY){this.oEl.style.top=iY+"px";}}
break;case"opacity":return{getter:function(){var iOpac=this.oEl.style.opacity;return iOpac==""||isNaN(iOpac)?100:iOpac*100;},setter:function(iOpacity){Element.setOpacity(this.oEl,iOpacity);}}
break;case"scrollLeft":return{getter:function(){return this.oEl.scrollLeft;},setter:function(iScrollLeft){this.oEl.scrollLeft=iScrollLeft;}}
break;case"scrollTop":return{getter:function(){return this.oEl.scrollTop;},setter:function(iScrollTop){return this.oEl.scrollTop=iScrollTop;}}
case"background":return{getter:function(){return this.toRGB(this.oEl.style.backgroundColor);},setter:function(aRGB){this.oEl.style.backgroundColor=this.toHex(aRGB);return aRGB}}
break;default:return false;break}}
Effect.prototype.toRGB=function(hex){hexInt=parseInt(hex.substr(1),16);return[hexInt>>16,hexInt>>8&255,hexInt&255];}
Effect.prototype.toHex=function(rgb){var hex='#';for(var i=0;i<3;i++){rgb[i]=Math.min(255,Math.max(0,Math.round(rgb[i]))).toString(16);while(rgb[i].length<2){rgb[i]='0'+rgb[i];}
hex+=rgb[i];}
return hex;}
var Easing={};Easing.easeNone=function(t,b,c,d){return c*t/d+b;}
Easing.backEaseIn=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;}
Easing.backEaseOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;}
Easing.backEaseInOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;}
Easing.elasticEaseIn=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else
var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
Easing.elasticEaseOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);}
Easing.elasticEaseInOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)var p=d*(.3*1.5);if(!a||a<Math.abs(c)){var a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;}
Easing.bounceEaseOut=function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}}
Easing.bounceEaseIn=function(t,b,c,d){return c-Easing.bounceEaseOut(d-t,0,c,d)+b;}
Easing.bounceEaseInOut=function(t,b,c,d){if(t<d/2)return Easing.bounceEaseIn(t*2,0,c,d)*.5+b;else return Easing.bounceEaseOut(t*2-d,0,c,d)*.5+c*.5+b;}
Easing.strongEaseInOut=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;}
Easing.regularEaseIn=function(t,b,c,d){return c*(t/=d)*t+b;}
Easing.regularEaseOut=function(t,b,c,d){return-c*(t/=d)*(t-2)+b;}
Easing.regularEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;}
Easing.strongEaseIn=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;}
Easing.strongEaseOut=function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;}
Easing.strongEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;}
WSDOM.defineClass("Effects",null,Effects_class);WSDOM.loadSingleton("WSDOM.Effects.1");UnitTester_class=function(){};UnitTester_class.prototype.TestCase=function(){this.name='TestCase';this.initialize=function(reporter){this._exceptions=new Array();this._reporter=reporter;};this.setUp=function(){};this.tearDown=function(){};this.assertEquals=function(var1,var2){if(var1&&var1.toSource&&var2&&var2.toSource){if(var1.toSource()!=var2.toSource()){throw('Assertion failed: '+var1+' != '+var2);};}else{if(var1!=var2){throw('Assertion failed: '+var1+' != '+var2);};};};this.assert=function(statement){if(!statement){throw('Assertion '+statement.toString?statement.toString():statement+' failed');};};this.assertTrue=this.assert;this.assertFalse=function(statement){if(statement){throw('Assertion '+statement.toString()+' failed');};};this.fail=function(message){throw("Failure: "+message);};this.assertThrows=function(func,exception,context){if(!context){context=null;};if(!exception){return;};var exception_thrown=false;try{func.apply(context,arguments);}catch(e){if(exception.toSource&&e.toSource){exception=exception.toSource();e=e.toSource();}else if(exception.toString&&e.toString){exception=exception.toString();e=e.toString();};if(e!=exception){throw('Function threw the wrong exception '+
e.toString()+', while expecting '+
exception.toString());};exception_thrown=true;};if(!exception_thrown){if(exception){throw("function didn\'t raise exception \'"+
exception.toString()+"'");}else{throw('function didn\'t raise exception');};};};this.runTests=function(){var ret=this._runHelper();this._reporter.summarize(ret[0],ret[1],this._exceptions);};this._runHelper=function(){var now=new Date();var starttime=now.getTime();var numtests=0;for(var attr in this){if(attr.substr(0,4)=='test'){this.setUp();try{this[attr]();this._reporter.reportSuccess(this.name,attr);}catch(e){this._reporter.reportError(this.name,attr,e);this._exceptions.push(new Array(this.name,attr,e));};this.tearDown();numtests++;};};var now=new Date();var totaltime=now.getTime()-starttime;return new Array(numtests,totaltime);};};UnitTester_class.prototype.TestSuite=function(reporter){this._reporter=reporter;this._tests=new Array();this._exceptions=new Array();this.add=function(test){if(!test){throw('TestSuite.add() requires a testcase as argument');};this._tests.push(test);};this.run=function(){this._reporter.start();var now=new Date();var starttime=now.getTime();var testsran=0;for(var i=0;i<this._tests.length;i++){var test=this._tests[i];test.initialize(this._reporter);testsran+=test._runHelper()[0];if(test._exceptions.length){for(var j=0;j<test._exceptions.length;j++){var excinfo=test._exceptions[j];this._exceptions.push(excinfo);};};};var now=new Date();var totaltime=now.getTime()-starttime;this._reporter.summarize(testsran,totaltime,this._exceptions);this._reporter.end();};};UnitTester_class.prototype.ConsoleReporter=function(){this.start=function(){WSDOM.Console.startGroup("WSDOM.UnitTester");};this.end=function(){WSDOM.Console.endGroup("WSDOM.UnitTester");};this.reportSuccess=function(testcase,attr){WSDOM.Console.log("+ "+testcase+'.'+attr);};this.reportError=function(testcase,attr,exception){WSDOM.Console.error(testcase+'.'+attr);};this.summarize=function(numtests,time,exceptions){WSDOM.Console.startGroup("WSDOM.UnitTesting Summary");WSDOM.Console.log(numtests+' tests ran in '+time/1000.0+' seconds');if(exceptions.length){for(var i=0;i<exceptions.length;i++){var testcase=exceptions[i][0];var attr=exceptions[i][1];var exception=exceptions[i][2];var text=testcase+'.'+attr+', exception: '+exception;WSDOM.Console.log(text);};WSDOM.Console.error("NOT OK!");}else{WSDOM.Console.log("OK!");};WSDOM.Console.endGroup("WSDOM.UnitTesting Summary");};};UnitTester_class.prototype.AlertReporter=function(verbose){this.buffer="";this.reportSuccess=function(testcase,attr){this.buffer=this.buffer+".";};this.reportError=function(testcase,attr,exception){this.buffer=this.buffer+"F";};this.summarize=function(numtests,time,exceptions){alert(this.buffer);};}
UnitTester_class.prototype.HTMLReporter=function(outputelement,verbose){this.outputelement=outputelement;this.document=outputelement.ownerDocument;this.verbose=verbose;this.reportSuccess=function(testcase,attr){var dot=this.document.createTextNode('+');this.outputelement.appendChild(dot);};this.reportError=function(testcase,attr,exception){var f=this.document.createTextNode('F');this.outputelement.appendChild(f);};this.summarize=function(numtests,time,exceptions){var p=this.document.createElement('p');var text=this.document.createTextNode(numtests+' tests ran in '+time/1000.0+' seconds');p.appendChild(text);this.outputelement.appendChild(p);if(exceptions.length){for(var i=0;i<exceptions.length;i++){var testcase=exceptions[i][0];var attr=exceptions[i][1];var exception=exceptions[i][2];var div=this.document.createElement('div');var text=this.document.createTextNode(testcase+'.'+attr+', exception: '+exception);div.appendChild(text);div.style.color='red';this.outputelement.appendChild(div);};var div=this.document.createElement('div');var text=this.document.createTextNode('NOT OK!');div.appendChild(text);div.style.backgroundColor='red';div.style.color='black';div.style.fontWeight='bold';div.style.textAlign='center';div.style.marginTop='1em';this.outputelement.appendChild(div);}else{var div=this.document.createElement('div');var text=this.document.createTextNode('OK!');div.appendChild(text);div.style.backgroundColor='lightgreen';div.style.color='black';div.style.fontWeight='bold';div.style.textAlign='center';div.style.marginTop='1em';this.outputelement.appendChild(div);};};};WSDOM.using("WSDOM.UnitTester.1","WSDOM.Console.1");WSDOM.defineClass("UnitTester",null,UnitTester_class);WSDOM.loadSingleton("WSDOM.UnitTester.1");var Element=WSDOM.Element;var Events=WSDOM.Events;var Console=WSDOM.Console;var Behaviour=WSDOM.Behaviour;var Util=WSDOM.Util;var Remoting=WSDOM.Remoting;var Serializer=WSDOM.Serializer;var Effects=WSDOM.Effects;var UnitTester=WSDOM.UnitTester;function Viewport_Class(){};Viewport_Class.prototype.getWindowSize=function(){if(self.innerHeight){var width=self.innerWidth;var height=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){var width=document.documentElement.clientWidth;var height=document.documentElement.clientHeight;}else if(document.body){var width=document.body.clientWidth;var height=document.body.clientHeight;};return{width:width,height:height};};Viewport_Class.prototype.getWindowScrollOffset=function(){if(typeof window.pageYOffset=='number'){var x=window.pageXOffset;var y=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){var x=document.body.scrollLeft;var y=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){var x=document.documentElement.scrollLeft;var y=document.documentElement.scrollTop;};return{x:x||0,y:y||0};};Viewport_Class.prototype.get=function(){var windowSize=this.getWindowSize();var scrollOffset=this.getWindowScrollOffset();var top=scrollOffset.y;var bottom=scrollOffset.y+windowSize.height;var left=scrollOffset.x;var right=scrollOffset.x+windowSize.width;return{top:top,left:left,bottom:bottom,right:right,width:windowSize.width,height:windowSize.height};};WSDOM.defineClass("Viewport",null,Viewport_Class);WSDOM.loadSingleton("WSDOM.Viewport.1");(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)
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);});}});(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";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");};});})();(function($){$.type=function(subject)
{if(null===subject){return"null";}
var objectType=typeof(subject);if("object"==objectType)
{switch(subject.constructor)
{case Array:objectType="array";break;case String:objectType="string";break;case Number:objectType="number";break;case Boolean:objectType="bool";break;default:if(typeof(ActiveXObject)!="undefined"&&subject instanceof ActiveXObject){objectType="dom";}else if(typeof(HTMLElement)!="undefined"&&subject instanceof HTMLElement){objectType="dom";}}}
return objectType;}
$.create=function()
{var tagName,attribs,children,container;if(arguments.length==1&&$.isArray(arguments[0]))
{if($.isArray(arguments[0])){tagName=arguments[0][0];attribs=arguments[0][1];children=arguments[0][2];container=arguments[0][3];}else if("dom"==$.type(arguments[0])){return arguments[0];}}
else
{tagName=arguments[0];attribs=arguments[1];children=arguments[2];container=arguments[3];}
var $element=$('<'+tagName+'/>');if(attribs)
{var filtered={};for(attr in attribs){var attrlow=attr.toLowerCase();var index=attrlow.indexOf("on");if(0==index&&$element[attrlow.substring(2)]){$element[attrlow.substring(2)]=attribs[attr];}
else{filtered[attr]=attribs[attr];}}
$element.attr(filtered);}
if(null!=children)
{if($.isArray(children)){var count=children.length;for(var c=0;c<count;c++){$element.append($.create(children[c]))}}else{$element.html(children);}}
if(container){$(container).append(element);}
return $element;};$.isDebugOn=function(){return typeof(Debug)!="undefined"&&Debug.debugWindow?true:false;}
$.log=function(){$.log=function(){$.log.logger&&$.log.logger.apply(null,arguments);}
$.log.wsdom=function(){WSDOM.Console.log.apply(WSDOM.Console,arguments)};$.log.firebug=function(){console.log.apply(console,arguments);};$.log.showdebuginfo=function(){for(var a=0;a<arguments.length;a++){var c=arguments[a];if(typeof(c)=="string"){Debug.dbg&&Debug.dbg.call(Debug,c);}else{Debug.dbgObject&&Debug.dbgObject.call(Debug,c);}}};var logger=null;if(typeof(WSDOM)!="undefined"){logger=$.log.wsdom;}else if($.isDebugOn()&&typeof(console)!="undefined"){logger=$.log.firebug;}else if($.isDebugOn()){logger=$.log.showdebuginfo;}
$.log.logger=logger;$.log.apply($,arguments);}})(jQuery);String.prototype.format=(function(){var preRE=[];return function(){var str=this;for(var i=0,l=arguments.length;i<l;i++){if(!preRE[i]){preRE[i]=new RegExp();preRE[i].compile('\\{'+(i)+'\\}','gm');}
str=str.replace(preRE[i],arguments[i]);}
return str;}})();Math.log=(function(){var vLog=Math.log;return function(n,base){return vLog(n)/(base!==undefined?vLog(base):1);}})();var Common={};Common.capRE=function(match,index,word){return match.toUpperCase();}
Common.LogoutUser=function()
{var wplogoutlink="http://wsodlabs.com/fundcom/expertdesk/?logout=true'"
if(navigator.appName=="Microsoft Internet Explorer")
{var frame=document.createElement("iframe");frame.setAttribute('id','wpframe');frame.setAttribute('style','display:none;');document.body.appendChild(frame);frame.setAttribute('src',wplogoutlink);var count=0;var onframeload=function()
{if(String(frame.readyState).toLowerCase()=="complete"){FundRemoting.Logout({});}else if(++count>300){FundRemoting.Logout({});}else{setTimeout(onframeload,100);}}
setTimeout(onframeload,100);}
else
{var jframe=jQuery('<iframe style="display:none;" src="'+wplogoutlink+'"></iframe>');jQuery("body").append(jframe);var logout=function(){FundRemoting.Logout({});}
jframe.load(logout);setTimeout(logout,30*1000);}}
Common.GotoLogin=function(bRedirectBack){if(bRedirectBack){var current=window.location.href;setTimeout("window.location.href = Links.Login+\"?referrer="+escape(current)+"\";",0);}else{setTimeout("window.location.href = Links.Login;",0);}}
Common.Goto=function(pageName,bRedirectBack)
{if(typeof(Links)!="undefined"&&Links[pageName])
{if(bRedirectBack){var current=window.location.href;setTimeout("window.location.href = Links['"+pageName+"']+\"?referrer="+escape(current)+"\";",0);}else{setTimeout("window.location.href = Links['"+pageName+"'];",0);}}
else if(pageName)
{setTimeout("window.location.href = '"+pageName+"';",0);}}
Common.SignUp=function(){setTimeout("location.href = '"+Links.SignUp+"'",0);}
Common.showToolTip=function(el,text){var x=Common.mouseX;var y=Common.mouseY;var tooltip=$("#tooltip");if(!tooltip.length){tooltip=$('<div id="tooltip">'+text+'</div>').appendTo(document.body);}
el=$(el);var pos=el.offset();var width=el.width();var height=el.height();var placex=pos.left+(width/2);var placey=pos.top+height+15;tooltip.css("left",placex+"px");tooltip.css("top",placey+"px");tooltip.show();};Common.hideToolTip=function(){$("#tooltip").hide();};Common.check=function(key)
{var keys=jQuery("body").attr("class");rKeys=keys.split(" ");oKeys={};for(var i=rKeys.length-1;i>=0;i--){if(rKeys[i]){oKeys[rKeys[i]]=true;}}
return(Common.check=function(key){return oKeys[key];}).call(Common,key);}
Common.remoteCall=function(url,load,error,context,data)
{var g_remoting=new Remoting();(Common.remoteCall=function(url,load,error,context,data)
{g_remoting.abortRequests();var pair=Common.CreateRemotingPair(load,error,context,data);var conn=g_remoting.load({debug:true,url:url,method:"post",contentType:"text/javascript",context:context,preventEval:true,data:data,onload:pair.load,onerror:pair.error});}).call(this,url,load,error,context,data);}
Common.CreateRemotingPair=function(loadcallback,errorcallback,context,data)
{context=context||null;var error=function(connection,r)
{r=r||{};var result=connection&&connection.getResult();if(result&&"object"==typeof(result)){for(var i in result){r[i]=result[i];}}else{r.result=result;}
WSDOM.Console.log("Remoting Error ",r);if(r.error)
{WSDOM.Console.dir(r.error);if(r.error.Stack)
{var stack=r.error.Stack.split("\r\n");for(var s=0;s<stack.length;s++){WSDOM.Console.log(s+" \u2014 "+stack[s]);}}}
errorcallback.call(context,r,data);}
var load=function(connection)
{var r=connection&&connection.getResult();if(1==parseInt(r.Status)){loadcallback.call(context,r,data);}else{error(connection,r);}}
return{load:load,error:error};}
Common.ShowICAdvertizement=function()
{var content=$.create(["div",{"class":"icadvertizement"},[["a",{"class":"close"}],["h4",null,"Advertising on Fund.com"],["p",null,"Thank you for your interest in advertising on Fund.com. We have recently launched our site and grown our page view base by approximately 30% each month. Engage our valuable demographic of retail investors through multiple placement options including premium display, buttons and links, email and newsletters, co-registration and lead generation, sponsorships, home page takeovers and other creative advertising solutions"],["p",null,[["a",{href:"http://www.investingchannel.com",target:"_new"},"InvestingChannel"],["span",null," is one of the fastest growing financial medial networks and is our exclusive advertising partner. With InvestingChannel's seasoned team of professionals, you can optimize your campaigns to maximize return on investment with the highest level of service."]]],["p",null,[["span",null,"To learn more about advertising on Fund.com contact InvestingChannel at:"],["a",{"class":"ic-imagelink",href:"http://www.investingchannel.com",target:"_new"}]]],["p",{"class":"contant-info"},[["a",{href:"mailto:advertiser@investingchannel.com",target:"_new"},"advertiser@investingchannel.com"],["div",null,"(p) 646.467.7824"],["div",null,"(f) 646.290.8452"],["a",{href:"http://www.investingchannel.com",target:"_new"},"www.investingchannel.com"],["div",null,"52 E. 13th St, Suite 5D / New York, NY / 10003"]]]]]);var dialog=new Popup_class(content);dialog.SetSize({width:600});(Common.ShowICAdvertizement=function(){dialog.Center().Show();}).call(Common);}
Common.install_tb_complete=function(name,result){if(result!=0&&result!=999)alert("An error occured: "+result);else alert("Restart the browser to finish installation");}
Common.install_tb_XPI=function(){var xpi=new Object();xpi["Fund.com_Toolbar"]="http://find.404agent.com/toolbar/Fund.xpi";InstallTrigger.install(xpi,Common.install_tb_complete);}
var MyFundLink={select:function(evt,data){var url,item=data.item;if(item.hasClass("link")){if(item.hasClass("savedFunds")){url=Links.Summary+"?symbolset="+(data.symbolSet?data.symbolSet:"wsodissue")+"&symbol="+data.val;}else if(item.hasClass("savedSearches")){url=Links.FundFinder+"?savedName="+data.val;}else if(item.hasClass("savedPortfolio")){url=Links.Builder+"?saved="+data.val;}
setTimeout("window.location.href = '"+url+"'",0);}}};jQuery(document).ready(function(){$(".accountSettings").click(function(){Common.SignUp();});$(".myfundPage").click(function(){setTimeout("window.location.href = '"+Links.MyFund+"'",0);});$("#MyFundLinks").bind("select",MyFundLink.select.Context(MyFundLink));jQuery("#Input_NavSearchBox, #Input_FundSearchBox").click(function(){NameSearch.initRequest(this);});Events.add({element:Element.get("FundSearchBox"),type:"keyup",handler:NameSearch.submit,context:NameSearch,keyCode:Events.KEYCODES.ENTER});Events.add({element:Element.get("NavSearchBox"),type:"keyup",handler:NameSearch.submit,context:NameSearch,keyCode:Events.KEYCODES.ENTER});});if(WSDOM==undefined)var WSDOM={};WSDOM.Format={};WSDOM.Format.formatNumber=function(value,format){if(isNaN(value)){return value;}
value=Number(value);var type='default';if(format instanceof Array){if(value==0&&format.length>2&&format[2]){return format[2];}else if(value<0&&format.length>1&&format[1]){format=format[1];type='neg';}else{format=format[0];}}
var parsedFormat=format.match(/([^#0]*)([#0][#0,]*)(\.?)([#0]*)([\s\S]*)/);var headFormat=parsedFormat[1];var leftFormat=parsedFormat[2];var rightFormat=parsedFormat[4];var tailFormat=parsedFormat[5];var negative=(value<0);if(negative)value*=-1;var reComma=/,/g;var showCommas=reComma.test(leftFormat);if(showCommas)
{leftFormat=leftFormat.replace(reComma,'');reComma.lastIndex=0;}
var isPercentage=/^\s*%/.test(tailFormat);if(isPercentage)value*=100;var magSuffixes=tailFormat.match(/^\s*\[([\w\s\\|]+)\]/);var magBase=1000,suffix='';if(magSuffixes){if(value){magSuffixes=magSuffixes[1];if(magSuffixes.toLowerCase()=='bytes'){magSuffixes=['b','KB','MB','GB','TB','PB','EB','ZB'];magBase=1024;}else{magSuffixes=magSuffixes.split('|');}
var mag=Math.floor(Math.log(value)/Math.log(magBase));mag=Math.max(0,Math.min(magSuffixes.length-1,mag));suffix=magSuffixes[mag];if(suffix.length)value/=Math.pow(magBase,mag);}
tailFormat=tailFormat.replace(/\[([\w\s|]+)\]/,suffix);}
var unescape=/\\([\s\S])/g;tailFormat=tailFormat.replace(unescape,'$1');headFormat=headFormat.replace(unescape,'$1');var leftFixed=leftFormat.match(/0*$/)[0].length;parsedFormat=rightFormat.match(/^(0*)#*/);var rightAllowed=parsedFormat[0].length;var rightFixed=parsedFormat[1].length;value=value.toFixed(rightAllowed);var result=[headFormat];var leftValue=parseInt("0"+value,10).toString();if(leftValue=='0'&&leftFixed<1){leftValue='';}else{while(leftValue.length<leftFixed)leftValue='0'+leftValue;if(showCommas){var reCommatize=/(\d+)(\d{3}[\d,]*)$/g;while(reCommatize.test(leftValue)){leftValue=leftValue.replace(reCommatize,'$1,$2');reCommatize.lastIndex=0;}}}
result.push(negative&&type!='neg'?'-':'',leftValue);if(rightFixed>0||(rightAllowed>0&&(value%1)!=0)){var rightValue=String(value).match(/\.\d*$/)[0];if(rightFixed<rightAllowed)rightValue=rightValue.replace(new RegExp('0{0,'+(rightAllowed-rightFixed)+'}$'),'');result.push(rightValue);}
result.push(tailFormat);return result.join('');};WSDOM.Format.formatDate=function(value,format){var result=[];var hasAMPM=/A(M?)\/?P\1/i.test(format);var nextToken=/^(?:([DM])\1{0,3}|(?:Y{4}|YY?)|([WHNS])\2?|Q|(A)(M?)\/?P\4|\\?([^\\]))/i;function fixCase(value,token){var checkCase=/^(?:([MD]+)|([md]+))$/;var result=token.match(checkCase);if(!result)return value;if(result[1])return value.toUpperCase();return value.toLowerCase();}
var parsedToken,curVal;while(parsedToken=format.match(nextToken)){if(parsedToken[5]){result.push(parsedToken[5]);}else if(parsedToken[3]){if(value.getHours()<12){curVal='a'+parsedToken[4];}else{curVal='p'+parsedToken[4];}
result.push(parsedToken[3]=='A'?curVal.toUpperCase():curVal.toLowerCase());}else{parsedToken=parsedToken[0];switch(parsedToken.toLowerCase()){case'd':result.push(value.getDate());break;case'dd':curVal=value.getDate();if(curVal<10)result.push('0');result.push(curVal);break;case'ddd':result.push(fixCase(WSDOM.Format._days[value.getDay()].substring(0,3),parsedToken));break;case'dddd':result.push(fixCase(WSDOM.Format._days[value.getDay()],parsedToken));break;case'm':result.push(value.getMonth()+1);break;case'mm':curVal=value.getMonth()+1;if(curVal<10)result.push('0');result.push(curVal);break;case'mmm':result.push(fixCase(WSDOM.Format._months[value.getMonth()].substring(0,3),parsedToken));break;case'mmmm':result.push(fixCase(WSDOM.Format._months[value.getMonth()],parsedToken));break;case'y':curVal=new Date(value.getFullYear(),0,1);result.push(Math.ceil((value-curVal)/86400000)+1);break;case'yy':curVal=value.getFullYear().toString();result.push(curVal.substring(curVal.length-2));break;case'yyyy':result.push(value.getFullYear());break;case'w':result.push(value.getDay()+1);break;case'ww':curVal=new Date(value.getFullYear(),0,1);result.push(Math.ceil(((value-curVal)/86400000+curVal.getDay()+1)/7));break;case'h':curVal=value.getHours();if(hasAMPM){if(curVal==0){curVal=12;}else if(curVal>12){curVal-=12;}}
result.push(curVal);break;case'hh':curVal=value.getHours();if(hasAMPM){if(curVal==0){curVal=12;}else if(curVal>12){curVal-=12;}}
if(curVal<10)result.push('0');result.push(curVal);break;case'n':result.push(value.getMinutes());break;case'nn':curVal=value.getMinutes();if(curVal<10)result.push('0');result.push(curVal);break;case's':result.push(value.getSeconds());break;case'ss':curVal=value.getSeconds();if(curVal<10)result.push('0');result.push(curVal);break;case'q':result.push(Math.floor(value.getMonth()/3)+1);break;default:result.push(parsedToken);}}
format=format.replace(nextToken,'');}
return result.join('');};WSDOM.Format._days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];WSDOM.Format._months=['January','February','March','April','May','June','July','August','September','October','November','December'];var tb_pathToImage="images/loadingAnimation.gif";eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))
function TruncatorLite()
{this.init.apply(this,arguments);}
TruncatorLite.prototype.targetHeight=null;TruncatorLite.prototype.targetWidth=null;TruncatorLite.prototype.targetNumLines=null;TruncatorLite.prototype.init=function(rElement)
{this.setElements(rElement);}
TruncatorLite.prototype.setElements=function(rElement)
{this._elements=(rElement instanceof Array)?rElement:[rElement];}
TruncatorLite.prototype.truncate=function()
{var count=this._elements.length;if(count<1){return;}
if(this.targetNumLines)
{var targetHeight=this._getOneLineHeight(this._elements[0]);for(var e=0;e<count;e++)
{this._truncate(this._elements[e],null,targetHeight);}}
if(this.targetHeight||this.targetWidth)
{for(var e=0;e<count;e++)
{var el=this._elements[e];this._truncate(this._elements[e],this.targetWidth,this.targetHeight);}}}
TruncatorLite.prototype.findNodes=function(rElements,bRecurse)
{if(!(rElements instanceof Array)){rElements=[rElements];}
var nodeList=[];var count=rElements.length;for(var e=0;e<count;e++)
{var n=rElements[e];if(1==n.nodeType)
{var child=n.firstChild;var hasOnlyText=0;while(child&&(hasOnlyText=(3==child.nodeType))){child=child.nextSibling;}
if(hasOnlyText){nodeList.push(n);}else if(bRecurse){nodeList=nodeList.concat(this.findNodes(n.childNodes,true));}}
else if(3==n.nodeType&&n.parentNode)
{nodeList=nodeList.concat(this.findNodes([n.parentNode],bRecurse));}}
return nodeList;}
TruncatorLite.prototype.ellipsis="\u2026";TruncatorLite.prototype._truncate=function(node,targetWidth,targetHeight)
{if(null==targetWidth){targetWidth=node.offsetWidth;}
if(null==targetHeight){targetHeight=node.offsetHeight;}
if(targetHeight<1||targetWidth<1||(node.offsetHeight<=targetHeight&&node.offsetWidth<=targetWidth))
{return;}
var ellipsis=this.ellipsis;var savedText=String(node.firstChild.nodeValue||"");var low=0;var high=savedText.length;while(low<=high)
{var mid=Math.ceil((low+high)/2);var str=savedText.slice(0,mid)+ellipsis;node.replaceChild(document.createTextNode(str),node.firstChild);if(node.offsetHeight>targetHeight||node.offsetWidth>targetWidth){high=mid-1;}else if(low<high){low=mid;}else{break;}}}
TruncatorLite.prototype._getOneLineHeight=function(node)
{var parent=node.parentNode;var newNode=document.createElement(node.nodeName);newNode.appendChild(document.createTextNode("\xA0"));parent.replaceChild(newNode,node);var height=newNode.offsetHeight;parent.replaceChild(node,newNode);return height;}
var abbreviationDictionary=function(){var abbrevs={};abbrevs["average"]="avg";abbrevs["company"]="co";abbrevs["corporation"]="corp";abbrevs["extended"]="ext";abbrevs["government"]="govt";abbrevs["group"]="grp";abbrevs["institutional"]="inst";abbrevs["insurance"]="ins";abbrevs["insured"]="ins";abbrevs["international"]="intl";abbrevs["investment"]="invest";abbrevs["management"]="mgmt";abbrevs["national"]="natl";abbrevs["res"]="res";abbrevs["return"]="rtn";abbrevs["target"]="trgt";abbrevs["alabama"]="AL";abbrevs["alaska"]="AK";abbrevs["arizona"]="AZ";abbrevs["arkansas"]="AR";abbrevs["california"]="CA";abbrevs["colorado"]="CO";abbrevs["connecticut"]="CT";abbrevs["delaware"]="DE";abbrevs["florida"]="FL";abbrevs["georgia"]="GA";abbrevs["hawaii"]="HI";abbrevs["idaho"]="ID";abbrevs["illinois"]="IL";abbrevs["indiana"]="IN";abbrevs["iowa"]="IA";abbrevs["kansas"]="KS";abbrevs["kentucky"]="KY";abbrevs["louisiana"]="LA";abbrevs["maine"]="ME";abbrevs["maryland"]="MD";abbrevs["massachusetts"]="MA";abbrevs["michigan"]="MI";abbrevs["minnesota"]="MN";abbrevs["mississippi"]="MS";abbrevs["missouri"]="MO";abbrevs["montana"]="MT";abbrevs["nebraska"]="NE";abbrevs["nevada"]="NV";abbrevs["new hampshire"]="NH";abbrevs["new jersey"]="NJ";abbrevs["new mexico"]="NM";abbrevs["new york"]="NY";abbrevs["north carolina"]="NC";abbrevs["north dakota"]="ND";abbrevs["ohio"]="OH";abbrevs["oklahoma"]="OK";abbrevs["oregon"]="OR";abbrevs["pennsylvania"]="PA";abbrevs["rhode island"]="RI";abbrevs["south carolina"]="SC";abbrevs["south dakota"]="SD";abbrevs["tennessee"]="TN";abbrevs["texas"]="TX";abbrevs["utah"]="UT";abbrevs["vermont"]="VT";abbrevs["virginia"]="VA";abbrevs["washington"]="WA";abbrevs["west virginia"]="WV";abbrevs["wisconsin"]="WI";abbrevs["wyoming"]="WY";return abbrevs;}();var DropDownList={};DropDownList.OnSelect={};DropDownList.Toggle=function(el){var item=jQuery(el);if(item.hasClass("DropDownMenu-disabled")){return;}
if(item.hasClass("open")){this.Collapse(item);}else{this.Expand(item);}}
DropDownList.Expand=function(item){function collapeItem(){DropDownList.Collapse(item);}
item.addClass("open");item.mouseover(function(){window.clearTimeout(item._timer);});item.mouseout(function(){item._timer=window.setTimeout(collapeItem,2500);});window.setTimeout(function(){jQuery(document.body).click(collapeItem);},10);}
DropDownList.Hover=function(el){var item=jQuery(el);var isFocused=false;if(item.hasClass("open")){isFocused=true;}
if(item.hasClass("hover")&&!isFocused){item.removeClass("hover");}else if(!item.hasClass("hover")&&!isFocused){item.addClass("hover");}}
DropDownList.Collapse=function(item){item.removeClass("open");window.clearTimeout(item._timer);item.unbind("mouseover");item.unbind("mouseout");item.removeClass("hover");try{jQuery(document.body).unbind("click");}catch(err){}}
DropDownList.SelectValue=function(parent,val)
{parent=jQuery(parent);DropDownList.Select(parent.find("div.MenuItemContainer div[value="+val+"]"));}
DropDownList.Select=function(el)
{var item=jQuery(el);var origItemText=item.html();var parent=item.parents("div.DropDownMenu:first");var val=item.attr("value")||"";var textDiv=parent.find("div.ItemDisplay")[0];var initialWidth=textDiv.offsetWidth;var itemDisplay=parent.find("div.ItemDisplay");itemDisplay.attr("curVal",val)
itemDisplay.attr("title",origItemText)
parent.trigger("select",{val:val,item:item,parent:parent});var xonselect;if(xonselect=item.attr("xonselect")){eval(xonselect);}
if(!parent.attr("notruncation")){DropDownList.AbbrevText(el,initialWidth,parent);}}
DropDownList.IsDisabled=function(el){jQuery(el).trigger("disableClick",jQuery(el));}
DropDownList.GetCasedAbbrev=function(word)
{var firstCap=(word.charAt(0)>='A'&&word.charAt(0)<='Z');var secondCap=(word.charAt(1)>='A'&&word.charAt(1)<='Z');var abbrev=abbreviationDictionary[word.toLowerCase()];if(abbrev){if(secondCap){return abbrev.toUpperCase();}
else if(firstCap){return abbrev.charAt(0).toUpperCase()+abbrev.substr(1);}
return abbrev;}
else{return word;}}
DropDownList.AbbrevText=function(el,targetWidth,ddmFirst)
{var item=jQuery(el);var origItemText=item.html();var measurementSpan=document.createElement("span");measurementSpan.className="ItemDisplaySim";measurementSpan.innerHTML=origItemText;document.body.appendChild(measurementSpan);var words=origItemText.split(" ");var i=words.length-1;var lastwidth=Infinity,currentWidth=measurementSpan.offsetWidth;while(i>=0&&currentWidth>targetWidth)
{lastwidth=currentWidth;words[i]=DropDownList.GetCasedAbbrev(words[i]);measurementSpan.firstChild.nodeValue=words.join(" ");currentWidth=measurementSpan.offsetWidth;i--;}
if(measurementSpan.offsetWidth>targetWidth)
{var trunc=new TruncatorLite(measurementSpan);trunc.ellipsis="";trunc.targetWidth=targetWidth;trunc.truncate();}
ddmFirst.find("div.ItemDisplay").html(measurementSpan.innerHTML);document.body.removeChild(measurementSpan);}
DropDownList.CurrentIndex=function(el,val)
{var container=jQuery(el).find("div.MenuItemContainer");if(val!==undefined){var items=container.find("div.listItem");DropDownList.Select(items[val]);}else{var cVal=DropDownList.CurrentValue(el);val=0;var items=container.find("div.listItem");for(var i=0,len=items.length;i<len;i++){if(items[i].getAttribute("value"==cVal)){val=i;break;}}}
return val;}
DropDownList.CurrentValue=function(el,val){var jel=jQuery(el).find(".ItemDisplay");if(val!==undefined){var item=jQuery(el).find("div.MenuItemContainer").find("div.listItem[value='"+val+"']:first");if(item.length==1){DropDownList.Select(item[0]);}}
return jel.attr('curval');}
var CheckBox={};CheckBox.Toggle=function(el)
{var item=jQuery(el);if(item.hasClass("checked")){item.removeClass("checked checkbox-checked");}else{item.addClass("checked checkbox-checked");}}
CheckBox.CurrentValue=function(el)
{var item=jQuery(el).parent();return item.hasClass("checked")?item.attr("value")||true:false;}
var RadioButton={};RadioButton.CurrentValue=function(el)
{RadioButton.Select(el);return RadioButton.CurrentValue(el);}
RadioButton.Select=function(el)
{var list=jQuery(".radiobutton");var groups={};for(var r=list.length-1;r>=0;r--)
{var name=list.eq(r).attr("name");if(name)
{if(!groups[name]){groups[name]=[];}
groups[name].push(list.get(r));}}
RadioButton.CurrentValue=function(el)
{var jel=jQuery(el).children("div").eq(0);var name=jel.attr("name");var rGroup=groups[name];var count=rGroup&&rGroup.length-1||0;for(var r=0;r<count;r++)
{if(jQuery(rGroup[r]).hasClass("checked"))
{return jQuery(rGroup[r]).attr("value");}}
return jel.attr("value");}
RadioButton.Select=function(el)
{var jel=jQuery(el);var name=jel.attr("name");if(name)
{if(groups[name])
{jQuery(groups[name]).removeClass("checked radiobutton-checked")}
jel.addClass("checked radiobutton-checked");}}
RadioButton.Select(el);}
function Popup_class(html,container,width,height,bCenter)
{var _closeDelegate=new Popup_class.MessageDelegate(function(){});if(!container){this.container=jQuery("#PopupTemplate").clone();this.container.removeAttr("id");jQuery(document.body).append(this.container);}else{if(container instanceof Popup_class){this.container=container.container;_closeDelegate=container.CloseDelegate();}else{this.container=container;}}
this.SetHTML(html);this.CloseDelegate=function(delegate){if(delegate instanceof Popup_class.MessageDelegate&&delegate._fnPtr){_closeDelegate=delegate;}
return _closeDelegate._fnPtr;}
this._index=Popup_class.Windows.length;Popup_class.Windows.push(this)
if(width){this.SetSize(width,height||width);}
if(bCenter){this.Center();}}
Popup_class.MessageDelegate=function(fnPtr)
{if(this instanceof Popup_class.MessageDelegate&&typeof(fnPtr)=="function"){this._fnPtr=fnPtr}}
Popup_class.Windows=[];Popup_class.ClearAll=function()
{for(var i=0,len=Popup_class.Windows.length;i<len;i++){Popup_class.Windows[i].Remove();}
Popup_class.Windows=[];}
Popup_class.Remove=function(pop)
{if(pop instanceof Popup_class){pop.Remove();Popup_class.Windows.splice(pop._index,1);}}
Popup_class.prototype.Remove=function()
{this.container.find("a").unbind("click");this.container.remove();return this;}
Popup_class.prototype.AddClass=function(className)
{if(this.container[0]){Element.addClass(this.container[0],className);}}
Popup_class.prototype.Hide=function()
{this.CloseDelegate()(this);this.container.addClass("hidden");return this;}
Popup_class.prototype.Show=function()
{this.container.find("a.close").click(this.Hide.Context(this));this.container.removeClass("hidden");return this;}
Popup_class.prototype.SetSize=function(width,height)
{var size=(typeof(width)=="object"&&height===undefined)?width:{width:width||400,height:height||300};if(Common.check("isie6")||Common.check("isie7")){this.container.css(size);}else{this.container.find(".contentLeft .contentInner").css(size);}
return this;}
Popup_class.prototype.SetPosition=function(top,left)
{var pos=(typeof(top)=="object"&&left===undefined)?top:{top:top||400,left:left||300};this.container.css(pos);return this;}
Popup_class.prototype.Center=function()
{var width=jQuery(this.container).width();var height=jQuery(this.container).height();var viewport=WSDOM.Viewport.get();var left=Math.max(0,(viewport.width-width)/2+viewport.left)
var top=Math.max(0,(viewport.height-height)/2+viewport.top)
this.SetPosition(top,left);return this;}
Popup_class.prototype.SetHTML=function(html)
{var jel=this.container.find(".contentLeft .contentInner");jel.empty();jel.append(html);return this;}
Popup_class.prototype.GetHeight=function()
{return this.container.height();}
function TipRollover(){this.init.apply(this,arguments);}
TipRollover.prototype.id='tiprollovercontainer';TipRollover.prototype.className=null;TipRollover.prototype.bundle=null;TipRollover.prototype.init=function(className,title,text)
{this.className=this.className||className||"";this.x=null;this.y=null;this.w=null;this.h=null;this.title=title||null;this.text=text||null;return this;}
TipRollover.prototype._createHtml=function()
{var rHtml=this.html.split('`');if(rHtml.length%2==0){throw new Error("You are missing a backtick somewhere in your template");}
var bundle=this.bundle;var count=rHtml.length;for(var a=1;a<count;a+=2)
{var name=rHtml[a];var value="";switch(name)
{case"title":if(null!=this.title){value="<h4>"+this.title+"</h4>";}break;case"text":if(null!=this.text){value=this.text;}break;case"class":if(null!=this.className){value=" "+this.className;}break;case"x":if(null!=this.x){value="left:"+this.x+"px;";}break;case"y":if(null!=this.y){value="top:"+this.y+"px;";}break;case"w":if(null!=this.w){value="width:"+this.w+"px;";}break;case"h":if(null!=this.h){value="height:"+this.h+"px;";}break;case"id":if(null!=this.id){value=' id="'+this.id+'"';}break;}
rHtml[a]=value;}
return rHtml.join("");}
TipRollover.prototype._inithtml=function()
{if(!this.el){this.el=jQuery(this._createHtml());this.el.appendTo(document.body);}}
TipRollover.prototype.show=function()
{this._inithtml();this.el.show();return this;}
TipRollover.prototype.hide=function()
{this._inithtml();this.el.css("display","none");return this;}
TipRollover.prototype.position=function(x,y)
{this._inithtml();this.x=x;this.y=y;if(null!=x){this.el.css("left",x+"px");}
if(null!=y){this.el.css("top",y+"px");}
return this;}
TipRollover.prototype.autoPosition=function(el,offset)
{this._inithtml();var viewport=WSDOM.Viewport.get();var x=el.offset().left+offset.x;var y=el.offset().top+el.height()+offset.y;if(x+this.el.width()>viewport.right){x=viewport.right-this.el.width()-offset.x;}
if(y+this.el.height()>viewport.bottom){y=viewport.bottom-this.el.height()-offset.y;}
this.el.css("left",x+"px");this.el.css("top",y+"px");};TipRollover.prototype.positionRightLeft=function(el,offset)
{this._inithtml();el=jQuery(el);var viewport=WSDOM.Viewport.get();var calcoffset=el.offset();var y=calcoffset.top+offset.y;var x=calcoffset.left+el.width()+offset.r;if(x+this.el.width()>viewport.right)
{var ox=x;x=calcoffset.left-this.el.width()-offset.l;if(x<viewport.left){x=ox;}}
this.el.css("left",x+"px");this.el.css("top",y+"px");}
TipRollover.prototype.size=function(w,h)
{this._inithtml();this.w=w;this.h=h;if(null!=w){this.el.css("width",w+"px");}
if(null!=h){this.el.css("height",h+"px");}
return this;}
TipRollover.prototype.setText=function(text,title)
{this._inithtml();var content=this.el.find("div.x-tip-body");if(title){content.html("<h4>"+title+"</h4> "+text);}else{content.html(text);}}
TipRollover.prototype.html='<div class="x-tip`class`"`id` style="`x``y``w`"><div class="x-tip-tl"><div class="x-tip-tr"><div class="x-tip-tc"></div></div></div><div class="x-tip-bwrap"><div class="x-tip-ml"><div class="x-tip-mr"><div class="x-tip-mc"><div class="x-tip-body" style="height: auto;">`title``text`</div></div></div></div><div class="x-tip-bl x-panel-nofooter"><div class="x-tip-br"><div class="x-tip-bc"></div></div></div></div></div>';function GenericRollover(){this.init.apply(this,arguments);}
GenericRollover.prototype=new TipRollover();GenericRollover.prototype.html='<div class="`class`"`id` style="`x``y``w`">`text`</div>';GenericRollover.prototype.setText=function(text)
{this._inithtml();this.el.html(text);}
var NameSearch={}
NameSearch.clear=function(el){if(NameSearch.validRequest(el.value,el.defaultValue)){el.select();}else{el.value="";}}
NameSearch.unclear=function(el){if(!NameSearch.validRequest(el.value,el.defaultValue)){el.value=el.defaultValue;}}
NameSearch.validRequest=function(value,defaultValue){if(value==defaultValue){return false;}else{return true;}}
NameSearch.setTriggerEl=function(el){if(el){NameSearch.element=el;}}
NameSearch.getTriggerEl=function(){return NameSearch.element;}
NameSearch.setSearchKeyword=function(key){if(key){NameSearch.searchKeyword=key;}}
NameSearch.getSearchKeyword=function(){return NameSearch.searchKeyword;}
NameSearch.initRequest=function(el,onload){var inputs=el.getElementsByTagName("input");var element=inputs[0];if(element.value==""||element.value==element.defaultValue){return false;}
NameSearch.request(element,onload);}
NameSearch.request=function(el,onload){NameSearch.setTriggerEl(el);NameSearch.setSearchKeyword(el.value);if(NameSearch.validRequest(el.value,el.defaultValue)){FundRemoting.PerformLookup({onload:function(buffer){NameSearch.load(buffer);if(onload){onload(buffer);}},onerror:NameSearch.error,context:NameSearch,arguments:{keyword:el.value}});}}
NameSearch.resetInput=function(){var input=NameSearch.getTriggerEl();input.value=input.defaultValue;input.blur();}
NameSearch.load=function(buffer){var result=buffer.getResult();NameSearch.resetInput();if(result&&result.length){var table;var content=Element.create("div",null,[Element.create("div",{},[Element.create("div",{className:"div-keyword"},"Results for <b>'"+NameSearch.getSearchKeyword()+"'</b>"),Element.create("a",{className:"close"},null)]),table=Element.create("table",{id:"table-popup-xref",className:"table-popup-xref-lookup"},[Element.create("thead",null,[Element.create("tr",null,[Element.create("th",{className:"td-symbol"},"Symbol"),Element.create("th",{className:"td-name"},"Name")])])])]);var len=result.length;var tbody,oData,style,url,pageCount=0;len=(len>100)?100:len;for(var i=0;i<len;i++){oData=result[i];if(i%5==0){style=(pageCount!=0)?"hide":"";tbody=Element.create("tbody",{className:style,page:pageCount},null,table);pageCount++;}
url=Links.Summary+"?Symbol="+oData.Symbol+"&SymbolSet=Street";Element.create("tr",{"data-issueid":oData.IssueId},[Element.create("td",{className:"td-symbol"},[Element.create("a",{href:url},oData.Symbol)]),Element.create("td",{className:"td-name"},[Element.create("a",{href:url},oData.Name)])],tbody);}
if(pageCount>1){var pageDiv=NameSearch.renderPagination(pageCount);Element.addChild(content,pageDiv);}
args={content:content,width:320,xOffset:15,yOffset:160};NameSearch.renderPopup(args);}else{NameSearch.error();}}
NameSearch.renderPopup=function(args){if(NameSearch._dialog){NameSearch._dialog.Remove();}
NameSearch._dialog=new Popup_class(args.content);NameSearch._dialog.SetSize({width:args.width,height:args.height});var xy=NameSearch.getPosition();var xOffset=args.xOffset||0;var yOffset=args.yOffset||0;NameSearch._dialog.SetPosition({top:xy.y+xOffset,left:xy.x-yOffset});NameSearch._dialog.Show();}
NameSearch.hidePopup=function(){NameSearch._dialog.Hide();};NameSearch.getPosition=function(){var xy=Element.getXY(NameSearch.getTriggerEl());return xy;}
NameSearch.renderPagination=function(pageCount){var pageDiv=Element.create("div",{id:"popup-xref-pagination"},NameSearch.renderPageLink(pageCount));return pageDiv;}
NameSearch.renderPageLink=function(pageCount){var style,html=[];for(var i=0;i<pageCount;i++){style=(i==0)?"selected":"";var a=Element.create("a",{href:"javascript: void(0);",className:style,page:i},i+1);Events.add({element:a,type:"click",handler:NameSearch.togglePage,context:NameSearch});html.push(a);}
return html;}
NameSearch.getExternalProviderName=function(){return"Find.com";}
NameSearch.error=function(msg){var testpath=Links;var externalSearch="<a class='external-search-lookup' href='"+Links.ExternalSearch+"?keyword="+NameSearch.getSearchKeyword()+"'>Get results for "+NameSearch.getSearchKeyword()+" courtesy of "+NameSearch.getExternalProviderName()+"</a>"
msg=msg||"Sorry, there is no information available for <span class='emphasis'>"+NameSearch.getSearchKeyword()+"</span>. Please check the fund symbol or fund name again or click on the magnifying glass to find the names and symbols of funds in our database"+externalSearch;var isPopup=$("#nameSearchError");if(!isPopup.length){var content=Element.create("div",{className:"popup-error",id:"nameSearchError",style:"width:270px;"},msg);var closeIcon=Element.create("div",{className:"popup-close-icon"},"&nbsp;");var container=Element.create("div",{className:"popup-error-container"},[content,closeIcon]);var item=jQuery(closeIcon);item.click(function(){NameSearch.hidePopup();});var args={content:container,width:340,height:170,xOffset:15,yOffset:160};NameSearch.renderPopup(args);}else{NameSearch._dialog.Show()
$("#nameSearchError")[0].innerHTML=msg;}}
NameSearch.togglePage=function(e,el){var pages=Element.get("popup-xref-pagination").getElementsByTagName("a");for(var i=0;i<pages.length;i++){Element.removeClass(pages[i],"selected");}
Element.addClass(el,"selected");var currPage=el.getAttribute("page");var tbodies=Element.get("table-popup-xref").getElementsByTagName("tbody");for(var t,i=0;i<tbodies.length;i++){t=tbodies[i];if(t.getAttribute("page")==currPage){Element.removeClass(t,"hide");}else{Element.addClass(t,"hide");}}}
NameSearch.submit=function(e,el){NameSearch.request(el);}
var HelpText=function(){this._text=this.initText();this._helper;};HelpText.prototype.remove=function(){if(this._helper){this._helper.hide();}}
HelpText.prototype.getHelper=function(){return this._helper;}
HelpText.prototype.initHelper=function(key){var helptext=HelpText.getText(key);if(helptext){if(!this._helper){this._helper=new TipRollover(null,helptext.title,helptext.text);}else{this.setText(helptext.text,helptext.title);}
return this._helper;}}
HelpText.prototype.initText=function(){var text=[];text["familymf"]={page:"home",title:"Mutual Fund Family",text:"A group of mutual funds offered by one investment company that may cover a wide range of categories and goals. Well-known families include Fidelity, T. Rowe Price, and Vanguard."};text["familyetf"]={page:"home",title:"ETF Family",text:"A group of exchange traded funds offered by one investment company that may cover a wide range of categories and goals. Well-known families include Barclays, Fidelity, and Vanguard."};text["opportunity"]={page:"builder",title:"Opportunity for Success",text:"A gauge that lets you know if you can expect to reach your goal. The higher the percentage, the more likely you are to achieve your goal."};text["yourgoal"]={page:"builder",title:"What is your goal",text:"What you want to achieve by investing. When you know what you're planning for, it's easier to build a portfolio that will work for you."};text["yourtimeframe"]={page:"builder",title:"What is your timeframe",text:"The amount of time you want to reach your goal in."};text["investtoday"]={page:"builder",title:"How much can you invest today",text:"The dollar amount you have to start your investment with."};text["futurecontribution"]={page:"builder",title:"How much can you contribute in the future",text:"The dollar amount and frequency with which you want to add to your investment."};text["riskcomfort"]={page:"builder",title:"How much risk are you comfortable with",text:"Select the amount of risk you are willing to take.  Risk is the potential for a change in the value of your investments. The greater risk you're willing to take on, the greater your potential return. After all, you need to be compensated for taking on additional risk."};text["recommended"]={page:"builder",title:"Recommended Portfolio",text:"The allocations or mix of funds investing in stocks, bonds, and cash that was based upon your goal and risk tolerance."};text["allfunds"]={page:"finder",title:"All Fund Types",text:"Choose a type (US Funds, International Stock, Bond or Cash) or select all."};text["allfundcategories"]={page:"finder",title:"All Fund Categories",text:"Differentiates mutual funds based on their characteristics, such as risk and return or portfolio holdings. Classifies a mutual fund as one of four types: international stock fund, U.S. stock fund, bond fund, or cash fund."};text["fundfamilies"]={page:"finder",title:"All Fund Families",text:"A group of mutual funds offered by one investment company that may cover a wide range of categories and goals. Well-known families include Fidelity, T. Rowe Price, and Vanguard."};text["mininvestment"]={page:"finder",title:"Minimum Investment",text:"The minimum dollar amount you need to invest in a mutual fund."};text["sortperformance"]={page:"finder",title:"Sort by Performance",text:"Sort a mutual fund's performance over a period of time: 1 year, 2 years, 3 years, 5 years, 10 years, or YTD (from January 1 of the current year to today)."};text["fundbasic"]={page:"finder",title:"Basic",text:"Shows funds by Fund Name, Fund Type, Fund Category, YTD, and Total Return. For definitions of these terms, see the glossary."};text["fundperformance"]={page:"finder",title:"Performance",text:"Shows a fund's returns over YTD, 1 YR, 2 YRS, 3 YRS, 5 YRS, 10 YRS, and its Total Return. For definitions of these terms, see the glossary."};text["fundmanagement"]={page:"finder",title:"Fund Management",text:"Information about a mutual fund's managing company and the person or people responsible for selecting the investments."};text["fundrating"]={page:"finder",title:"Rating",text:"Shows the Lipper ranking  for Total Return, Consistent Return, Preservation, and Tax Efficiency & Expenses.   For definitions of these terms, see the glossary."};text["timeframe"]={page:"finder",title:"Timeframe",text:"The amount of time you want to reach your goal in."};text["domesticfunds"]={page:"finder",title:"U.S. Stock Funds",text:"Funds that are primarily composed of US Stocks.  Basic  categories are defined by the size of the companies in which the fund invests - large-cap, mid-cap and small-cap - and investment style - value, growth and blend (value/growth mix)."};text["internationalfunds"]={page:"finder",title:"International Stock Funds",text:"Funds that are composed of International Stocks."};text["bondfunds"]={page:"finder",title:"Bonds",text:"Funds that are primarily composed of Bonds. Bond funds are categorized by their average portfolio maturities - long, intermediate and short - and credit quality - high, medium and low."};text["cashfunds"]={page:"finder",title:"Cash",text:"Funds investing that are invested in cash equivalent instruments."};text["etfdescription"]={page:"summary",title:"Exchange Traded Fund (ETF)",text:"A fund that typically tracks a stock market index (i.e., S&P 500), a sector (i.e., technology), or a commodity (i.e., gold or petroleum), but is traded like a stock on an exchange (e.g. the New York Stock Exchange)."};text["fundcategories"]={page:"summary",title:"Fund Categories",text:"Differentiates mutual funds based on their characteristics, such as risk and return or portfolio holdings. Classifies a mutual fund as one of four types: international stock fund, U.S. stock fund, bond fund, or cash fund."};text["fundstyle"]={page:"summary",title:"Fund Style",text:"Investment composition of the fund."};text["overallreturn"]={page:"summary",title:"Overall Return",text:"The simple mathematical average of a mutual fund's set of returns earned over time. It is calculated by adding the return values together, then dividing that sum by the number of time periods involved."};text["overallrisk"]={page:"summary",title:"Overall Risk",text:"The potential for a change in the value of your investments. The greater risk you're willing to take on, the greater your potential return. After all, you need to be compensated for taking on additional risk."};text["growth10k"]={page:"summary",title:"Growth of $10K",text:"A demonstration of how $10,000 invested in a fund would have changed over time; typically shown in the form of a chart."};text["historicalchart"]={page:"summary",title:"Historical Chart",text:"Graphic representation of performance over time."};text["fundprofile"]={page:"summary",title:"Fund Profile",text:"A mutual fund's recent performance summary."};text["avgreturns"]={page:"summary",title:"Average Returns",text:"The simple mathematical average of a mutual fund's set of returns earned over time. It is calculated by adding the return values together, then dividing that sum by the number of time periods involved."};text["topholdings"]={page:"summary",title:"Top 5 Holdings",text:"The five largest securities (i.e., stocks and bonds) held in a mutual fund, as measured by the assets in each security."};text["fees"]={page:"summary",title:"Minimums, Fees & Expenses",text:"Charges that come from purchasing a managed mutual fund."};text["management"]={page:"summary",title:"Management Info",text:"Information about a mutual fund's managing company and the person or people responsible for selecting the investments."};text["lipperleaders"]={page:"summary",title:"Lipper Leaders",text:"Mutual funds ranked by Lipper in five categories: Consistent Return, Expense, Preservation, Tax Efficiency, and Total Return."};return text;}
HelpText.prototype.getText=function(key){if(key&&this._text[key]){return this._text[key];}}
HelpText.prototype.mouseover=function(){jQuery(this).addClass("help-over");var key=jQuery(this)[0].getAttribute("helpid");if(!key){return false;}
HelpText.launchPopup(jQuery(this),key);}
HelpText.prototype.launchPopup=function(obj,key){var tip=HelpText.initHelper(key);if(tip){var offsetX=obj.width()+5;var offsetY=obj.height()+5;var width=300;var pos=obj.offset();tip.size(width);tip.autoPosition(obj,{x:5,y:5});tip.show();}}
HelpText.prototype.setText=function(text,title)
{var content=jQuery("#"+this._helper.id+" div.x-tip-body");if(title){content.html("<h4>"+title+"</h4> "+text);}else{content.html(text);}}
HelpText.prototype.mouseout=function(){jQuery(this).removeClass("help-over");HelpText.remove();}
var HelpText=new HelpText();Button={};Button.mouseover=function(el,name)
{jel=jQuery(el);if(!jel.hasClass('disabled')){jel.addClass(name+"-hover");}}
Button.mouseout=function(el,name)
{jel=jQuery(el);jel.removeClass(name+"-hover");}
function Slider_Class(oData){this.oData=oData||{};this.parentID=this.oData.parentID?this.oData.parentID:"";this.parentEl=this.parentID!=""?Element.get(this.parentID):Element.create("div",{},[],document.getElementsByTagName("body")[0]);this.sliderClass=this.oData.sliderClass?this.oData.sliderClass:"sliderBar";this._initNumbers();this._init();}
Slider_Class.prototype._init=function(){this.handles=[];this.handlesLen=0;this.orientation=this.oData.orientation?this.oData.orientation:"leftToRight";this.isVertical=this.orientation=="topToBottom"||this.orientation=="bottomToTop";this.isBackwards=this.orientation=="bottomToTop"||this.orientation=="rightToLeft";this.handleOverlap=this.oData.handleOverlap?this.oData.handleOverlap:"handleEdge";this._drawSliderBar();this._calculateMagicNumbers();}
Slider_Class.prototype._initNumbers=function(){this.maxVal=!isNaN(parseFloat(this.oData.maxVal))?parseFloat(this.oData.maxVal):100;this.minVal=!isNaN(parseFloat(this.oData.minVal))?parseFloat(this.oData.minVal):0;this.handleOffsetHigh=0;this.handleOffsetLow=0;if(this.oData.handleOffset){if(typeof(this.oData.handleOffset)=="object"){this.handleOffsetLow=this.oData.handleOffset[0]?this.oData.handleOffset[0]:this.handleOffsetLow;this.handleOffsetHigh=this.oData.handleOffset[1]?this.oData.handleOffset[1]:this.handleOffsetHigh;}
else if(!isNaN(parseInt(this.oData.handleOffset))){this.handleOffsetLow=parseInt(this.oData.handleOffset);this.handleOffsetHigh=this.handleOffsetLow;}}}
Slider_Class.prototype._drawSliderBar=function(){this.sliderBar=Element.create("div",{className:this.sliderClass,style:"position:relative"},null,this.parentEl)
this._setDefaults();}
Slider_Class.prototype._calculateMagicNumbers=function(){if(this.isVertical){this.offsetFromEdge=Element.getXY(this.sliderBar).y;this.barLength=Element.getSize(this.sliderBar).height;}else{this.offsetFromEdge=Element.getXY(this.sliderBar).x;this.barLength=Element.getSize(this.sliderBar).width;}
this.minPix=0;this.maxPix=this.barLength-(this.handleOffsetLow+this.handleOffsetHigh);this.valuePerPixel=this.maxPix?(this.maxVal-this.minVal)/this.maxPix:1;this.pixelPerValue=this.valuePerPixel?(1/this.valuePerPixel):1;}
Slider_Class.prototype._setDefaults=function(){if(!Element.getSize(this.sliderBar).height){Element.setHeight(this.sliderBar,this.isVertical?100:10);Element.setWidth(this.sliderBar,this.isVertical?10:100);this.sliderBar.style.backgroundColor="#CCC";this.sliderBar.style.fontSize="1px";}}
Slider_Class.prototype.addHandle=function(){var handle;for(var i=0,len=arguments.length;i<len;i++){handle=arguments[i];if(handle.el){this.handles.push(handle)
Element.addChild(this.sliderBar,handle.el);handle.init(this,this.handlesLen);this.handlesLen++;}}}
function SliderHandle_Class(oData){this._preInit(oData);this.drawHandle();}
SliderHandle_Class.prototype.MyUpdateValue=function(mouseEvent,direction){}
SliderHandle_Class.prototype._preInit=function(oData){this.oData=oData||{};this.defaultVal=!isNaN(parseFloat(this.oData.defaultVal))?parseFloat(this.oData.defaultVal):0;this.increment=!isNaN(parseFloat(this.oData.increment))?parseFloat(this.oData.increment):1;this.tabindex=this.oData.tabindex?String(this.oData.tabindex):"1";this.handleClassName=this.oData.handleClassName?this.oData.handleClassName:"sliderHandle";this.handleLength=1;this.halfOfHandle=1;}
SliderHandle_Class.prototype.init=function(parentSliderBar,whichHandle){this.parentSliderBar=parentSliderBar;this.whichHandle=whichHandle;Element.addClass(this.el,this.handleClassName+this.whichHandle);this.setMaxVal(this.parentSliderBar.maxVal);this.setMaxPix(this.parentSliderBar.maxPix);this.setMinVal(this.parentSliderBar.minVal);this.setMinPix(this.parentSliderBar.minPix);this._setDefaults();this.handleLength=this.parentSliderBar.isVertical?Element.getSize(this.el).height:Element.getSize(this.el).width;this.halfOfHandle=Math.floor(this.handleLength/2);this.finalDisplayFromValue(this.defaultVal);Element.setVisibility(this.el,"visible");this._initEvents();}
SliderHandle_Class.prototype.drawHandle=function(){this.el=Element.create("div",{className:this.handleClassName,tabIndex:this.tabindex,style:"position:absolute;visibility:hidden"})}
SliderHandle_Class.prototype._setDefaults=function(){if(!Element.getSize(this.el).height||!Element.getSize(this.el).width){Element.setSize(this.el,10,10);this.el.style.backgroundColor="#C33";this.el.style.fontSize="1px";}
this._setZIndex(this.whichHandle);}
SliderHandle_Class.prototype._initEvents=function(){this.mouseDownEvent=Events.add({type:'mousedown',handler:this.startMoveHandler,context:this});this.mouseMoveEvent=Events.add({type:'mousemove',handler:this.moveHandler,context:this});this.mouseUpEvent=Events.add({type:'mouseup',handler:this.endMoveHandler,context:this});this.keyDownEvent=Events.add({type:'keydown',handler:this.keyDownHandler,context:this});this.mouseDownEvent.addElement(this.el);this.keyDownEvent.addElement(this.el);}
SliderHandle_Class.prototype.startMoveHandler=function(evt){evt.cancel();this.mouseMoveEvent.addElement(document);this.mouseUpEvent.addElement(document);if(this.parentSliderBar.isVertical){this.eventCoord=isNaN(evt.nativeEvent.clientY)||evt.nativeEvent.clientY<0?0:evt.nativeEvent.clientY;}else{this.eventCoord=isNaN(evt.nativeEvent.clientX)||evt.nativeEvent.clientX<0?0:evt.nativeEvent.clientX;}
this._setZIndex(this.parentSliderBar.handlesLen);this.findMouseOffset(this.eventCoord);if(this.parentSliderBar.handlesLen>1){this.multipleHandleMinMax();}
this.MyUpdateValue("mousestart",null);}
SliderHandle_Class.prototype.moveHandler=function(evt){evt.cancel();if(this.parentSliderBar.isVertical){this.eventCoord=isNaN(evt.nativeEvent.clientY)||evt.nativeEvent.clientY<0?0:evt.nativeEvent.clientY;}else{this.eventCoord=isNaN(evt.nativeEvent.clientX)||evt.nativeEvent.clientX<0?0:evt.nativeEvent.clientX;}
this.prevCurrentValue=this.currentValue;this.finalDisplayFromPosition(this.eventCoord-this.parentSliderBar.offsetFromEdge-this.parentSliderBar.handleOffsetLow+this.mouseOffset);this.MyUpdateValue("mousemove",this.currentValue>this.prevCurrentValue?"up":this.currentValue<this.prevCurrentValue?"down":null)}
SliderHandle_Class.prototype.endMoveHandler=function(e){e.cancel();this.mouseMoveEvent.removeAllElements();this.mouseUpEvent.removeAllElements();this._setZIndex(this.whichHandle);this.MyUpdateValue("mouseend",null);}
SliderHandle_Class.prototype.keyDownHandler=function(evt,el){var k=evt.nativeEvent;var keyNum=k.keyCode||k.charCode;if(this.KEYMAP[keyNum]=="rightArrowKey"||this.KEYMAP[keyNum]=="downArrowKey"){if(this.parentSliderBar.handlesLen>1){this.multipleHandleMinMax()}
if(this.parentSliderBar.isBackwards){this.incrementValue(-1);this.MyUpdateValue("keydown","down")}else{this.incrementValue(1);this.MyUpdateValue("keydown","up")}}
else if(this.KEYMAP[keyNum]=="leftArrowKey"||this.KEYMAP[keyNum]=="upArrowKey"){if(this.parentSliderBar.handlesLen>1){this.multipleHandleMinMax()}
if(this.parentSliderBar.isBackwards){this.incrementValue(1);this.MyUpdateValue("keydown","up")}else{this.incrementValue(-1);this.MyUpdateValue("keydown","down")}}
else if(this.KEYMAP[keyNum]=="enterKey"||this.KEYMAP[keyNum]=="tabKey"){this.MyUpdateValue("mouseend",null);}}
SliderHandle_Class.prototype.KEYMAP={39:"rightArrowKey",54:"rightArrowKey",37:"leftArrowKey",52:"leftArrowKey",38:"upArrowKey",104:"upArrowKey",40:"downArrowKey",98:"downArrowKey",16:"shiftKey",9:"tabKey",13:"enterKey"}
SliderHandle_Class.prototype._setZIndex=function(num){this.el.style.zIndex=10+num;}
SliderHandle_Class.prototype.setMaxVal=function(val){this.maxVal=val;}
SliderHandle_Class.prototype.getMaxVal=function(){return this.maxVal;}
SliderHandle_Class.prototype.setMaxPix=function(pos){this.maxPix=pos;}
SliderHandle_Class.prototype.getMaxPix=function(){return this.maxPix;}
SliderHandle_Class.prototype.setMinVal=function(val){this.minVal=val;}
SliderHandle_Class.prototype.getMinVal=function(){return this.minVal;}
SliderHandle_Class.prototype.setMinPix=function(pos){this.minPix=pos;}
SliderHandle_Class.prototype.getMinPix=function(){return this.minPix;}
SliderHandle_Class.prototype.getPosition=function(){return this.currentPosition;}
SliderHandle_Class.prototype.setPosition=function(pos){this.currentPosition=pos;}
SliderHandle_Class.prototype.finalDisplayFromValue=function(newVal){var newVal=newVal!=null?newVal:this.currentValue;var newPos=Math.round(this.getPositionOfValue(newVal));if(newVal!=this.currentValue){if(newVal>=this.minVal&&newVal<=this.maxVal){this.setPosition(newPos);this.setValue(newVal);this._updateHandle()}
else if(newVal<this.minVal){if(this.parentSliderBar.isBackwards){this.setPosition(this.maxPix)}
else{this.setPosition(this.minPix)}
this.setValue(this.minVal);this._updateHandle()}
else if(newVal>this.maxVal){if(this.parentSliderBar.isBackwards){this.setPosition(this.minPix)}else{this.setPosition(this.maxPix)}
this.setValue(this.maxVal);this._updateHandle()}}}
SliderHandle_Class.prototype.finalDisplayFromPosition=function(newPos){var newPos=newPos!=null?Math.round(newPos):this.currentPosition;var newVal=this.getValueOfPosition(newPos);if(newPos!=this.currentPosition){if(newPos>=this.minPix&&newPos<=this.maxPix){this.setPosition(newPos);this.setValue(newVal);this._updateHandle()}
else if(newPos<this.minPix){this.setPosition(this.minPix)
if(this.parentSliderBar.isBackwards){this.setValue(this.maxVal);}else{this.setValue(this.minVal);}
this._updateHandle()}
else if(newPos>this.maxPix){this.setPosition(this.maxPix)
if(this.parentSliderBar.isBackwards){this.setValue(this.minVal);}else{this.setValue(this.maxVal);}
this._updateHandle()}}}
SliderHandle_Class.prototype._updateHandle=function(){this.handleEdgePosition=(this.currentPosition-this.halfOfHandle+this.parentSliderBar.handleOffsetLow);if(this.parentSliderBar.isVertical){this.el.style.top=this.handleEdgePosition+"px";}else{this.el.style.left=this.handleEdgePosition+"px";}}
SliderHandle_Class.prototype.getValue=function(){return this.currentValue;}
SliderHandle_Class.prototype.setValue=function(val){this.currentValue=val;}
SliderHandle_Class.prototype.incrementValue=function(multiple){this.finalDisplayFromValue(this.currentValue+(this.increment*multiple))}
SliderHandle_Class.prototype.getValueOfPosition=function(pos){if(this.parentSliderBar.isBackwards){return this.parentSliderBar.maxVal-(Math.round(pos)*this.parentSliderBar.valuePerPixel);}else{return this.parentSliderBar.minVal+(Math.round(pos)*this.parentSliderBar.valuePerPixel);}}
SliderHandle_Class.prototype.getPositionOfValue=function(val){if(this.parentSliderBar.isBackwards){return(this.parentSliderBar.maxVal-val)*this.parentSliderBar.pixelPerValue;}else{return(val-this.parentSliderBar.minVal)*this.parentSliderBar.pixelPerValue;}}
SliderHandle_Class.prototype.findMouseOffset=function(pos){this.mouseOffset=this.currentPosition-(Math.round(pos)-this.parentSliderBar.offsetFromEdge-this.parentSliderBar.handleOffsetLow);}
SliderHandle_Class.prototype.multipleHandleMinMax=function(){if(this.parentSliderBar.handleOverlap!="none"){var overlapPix=this.parentSliderBar.handleOverlap=="handleEdge"?this.handleLength:(this.parentSliderBar.handleOverlap=="nextPixel"?1:!isNaN(Number(this.parentSliderBar.handleOverlap))?Number(this.parentSliderBar.handleOverlap):0);if(this.whichHandle>0){this.setMinPix(this.parentSliderBar.handles[this.whichHandle-1].getPosition()+overlapPix)
this.setMinVal(this.getValueOfPosition(this.getMinPix()));}
if(this.whichHandle<this.parentSliderBar.handlesLen-1){this.setMaxPix(this.parentSliderBar.handles[this.whichHandle+1].getPosition()-overlapPix)
this.setMaxVal(this.getValueOfPosition(this.getMaxPix()));}}}
SliderHandle_Class.prototype.keyPressMinMax=function(dir){if(this.parentSliderBar.handleOverlap!="all"){var overlapPix=this.parentSliderBar.handleOverlap=="handleEdge"?this.handleLength:(this.parentSliderBar.handleOverlap=="nextPixel"?1:!isNaN(Number(this.parentSliderBar.handleOverlap))?Number(this.parentSliderBar.handleOverlap):0);if(dir=="right"){if(this.parentSliderBar.handles[this.whichHandle+1]){this.parentSliderBar.handles[this.whichHandle+1].setMinPix(this.getPosition()+overlapPix)}}
else if(dir=="left"){if(this.parentSliderBar.handles[this.whichHandle-1]){this.parentSliderBar.handles[this.whichHandle-1].setMaxPix(this.getPosition()-overlapPix)}}}}
Slider_Class.prototype.resetMinMax=function(oData){try{this.oData.maxVal=!isNaN(parseFloat(oData.maxVal))?parseFloat(oData.maxVal):100;this.oData.minVal=!isNaN(parseFloat(oData.minVal))?parseFloat(oData.minVal):0;this._initNumbers();this._calculateMagicNumbers();for(var i=0,len=this.handles.length;i<len;i++){this.handles[i].resetMinMax(oData,this);}}catch(err){WSDOM.Console.log(err);}}
Slider_Class.prototype._drawSliderBar=function(){if(!this.sliderBar){this.sliderBar=Element.create("div",{className:this.sliderClass,style:"position:relative"},null,this.parentEl);}
this._setDefaults();}
SliderHandle_Class.prototype.reset=function(){this.finalDisplayFromValue(this.defaultVal);this.MyUpdateValue();}
SliderHandle_Class.prototype._setZIndex=function(){};SliderHandle_Class.prototype.resetMinMax=function(oData,parentSliderBar){for(var i in oData){this.oData[i]=oData[i]}
this._preInit(this.oData);this.init(parentSliderBar,this.el);this.finalDisplayFromValue(this.defaultVal);}
SliderHandle_Class.prototype.init=function(parentSliderBar,whichHandle){this.parentSliderBar=parentSliderBar;this.whichHandle=whichHandle;Element.addClass(this.el,this.handleClassName+this.whichHandle);this.setMaxVal(this.parentSliderBar.maxVal);this.setMaxPix(this.parentSliderBar.maxPix);this.setMinVal(this.parentSliderBar.minVal);this.setMinPix(this.parentSliderBar.minPix);this._setDefaults();this.handleLength=this.parentSliderBar.isVertical?Element.getSize(this.el).height:Element.getSize(this.el).width;this.halfOfHandle=Math.floor(this.handleLength/2);this.finalDisplayFromValue(this.defaultVal);if(!this.initialized){this._initEvents();this.initialized=true;}}
SliderHandle_Class.prototype.drawHandle=function(){this.el=Element.create("div",{className:this.handleClassName,tabIndex:this.tabindex,style:"position:absolute;"})}
SliderHandle_Class.prototype._clearEvents=function(){if(this.mouseDownEvent){this.mouseDownEvent.removeAll();}
if(this.mouseMoveEvent){this.mouseMoveEvent.removeAll();}
if(this.mouseUpEvent){this.mouseUpEvent.removeAll();}
if(this.keyDownEvent){this.keyDownEvent.removeAll();}};var TabPanel=function(el,onclick,switchContent){switchContent=switchContent!==undefined?switchContent:true;$(".tab-panel-header a",el).click(function(){var panel=$(this).parents(".tab-panel");$(".tab-panel-header a",panel).removeClass("active")
$(this).addClass("active");this.blur();if(switchContent){$(".tab-panel-body .tab-content",panel).addClass("hide");$("#"+$(this).attr("data-tabcontent")).removeClass("hide");}
if(onclick&&typeof onclick=="function"){onclick(this);}});};function log(){WSDOM.Console.log.apply(WSDOM.Console,arguments);}
function FundFinder(){}
FundFinder.Init=function()
{if(!jQuery("body").hasClass("fundfinder")){return;}
var myStep=jQuery("div.left_helper_walkthough").attr("step");FundFinder._walkHelper=jQuery("div.left_helper_walkthough");if(myStep){FundFinder._greatestStep=parseInt(myStep);FundFinder.currentStep=parseInt(myStep);}else{FundFinder._greatestStep=1;FundFinder.currentStep=1;}
FundFinder.stepMax=4;FundFinder.SetupEvents();}
FundFinder.SCREENTYPE_NORMAL="1";FundFinder.SCREENTYPE_SAVEDFUNDS="2";FundFinder.SCREENTYPE_WALKTHROUGH="3";FundFinder.SCREENTYPE_SELF="4";FundFinder.WALKTHOUGH_TOGGLE={WalkThrough:"Self",Self:"WalkThrough"}
FundFinder.WalkThrough_action=function(e,el)
{if(!Element.hasClass(el,"disabled"))
{Element.addClass(el,"disabled");Element.removeClass(FundFinder.WALKTHOUGH_TOGGLE[el.id],"disabled");FundFinder.ChangeWalkthoughStaus(el.id=="WalkThrough");var jel=jQuery("body, #ctl00_container");if(el.id!="WalkThrough")
{jel.addClass("walkthrough-Self");jel.removeClass("walkthrough-WalkThrough");}
else
{jel.removeClass("walkthrough-Self");jel.addClass("walkthrough-WalkThrough");}
FundFinder.UpdateResult();}}
FundFinder.StepBack_action=function(e,el)
{if(FundFinder.currentStep>1){FundFinder.currentStep--;FundFinder.ChangeWalkthoughStep(FundFinder.currentStep);}}
FundFinder.SaveAndContinue_action=function(e,el)
{var selectedFunds=jQuery("#list_content .bookmark_fund.bookmarked");if(selectedFunds.length)
{if(FundFinder.currentStep<FundFinder.stepMax)
{FundFinder.currentStep++;FundFinder.ChangeWalkthoughStep(FundFinder.currentStep);if(FundFinder._greatestStep<FundFinder.currentStep){FundFinder.selectedFund=false;}}
else
{var create,view;var dialog=new Popup_class(Element.create("div",{className:"PortfolioComplete"},[Element.create("a",{className:"close"}),Element.create("p",null,"Congratulations, you completed a portfolio to match your goal!"),create=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Create Another Portfolio")),view=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"View the Portfolio I Just Created"))]));jQuery(create).click(function(){dialog.Remove();Common.Goto(Links.Builder+"?new=1");});jQuery(view).click(function(){dialog.Remove();Common.Goto("MyFund");});dialog.SetSize(300,130);dialog.Center().Show();}}
else{FundFinder.disallowMoveOnPopup.Center().Show();}}
FundFinder.IsWalkThrough=function(state)
{var iswalk=jQuery("body").hasClass("walkthrough-WalkThrough")||(state&&jQuery("body").hasClass("walkthrough"));return iswalk;}
FundFinder.SetupEvents=function()
{if(FundFinder.IsWalkThrough(true))
{var evtToggleWalkthrough=Events.add({element:Element.get("WalkThrough"),type:"click",handler:FundFinder.WalkThrough_action,context:FundFinder});evtToggleWalkthrough.addElement(Element.get("Self"));var disallowMoveOnPopupClose;FundFinder.disallowMoveOnPopup=new Popup_class([Element.create("a",{className:"close"}),Element.create("div",{className:"moveonerror"},[Element.create("p",{className:"extra-pad"},"You must select at least one fund to move on"),disallowMoveOnPopupClose=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Close"))])],false,220,80,true);Events.add({element:disallowMoveOnPopupClose,type:"click",handler:FundFinder.disallowMoveOnPopup.Hide,context:FundFinder.disallowMoveOnPopup});}
Events.add({element:Element.get("StepBack"),type:"click",handler:FundFinder.StepBack_action,context:FundFinder});Events.add({element:Element.get("StepBackTop"),type:"click",handler:FundFinder.StepBack_action,context:FundFinder});Events.add({element:Element.get("SaveAndContinueTop"),type:"click",handler:FundFinder.SaveAndContinue_action,context:FundFinder});Events.add({element:Element.get("SaveAndContinue"),type:"click",handler:FundFinder.SaveAndContinue_action,context:FundFinder});Events.add({element:Element.get("FindFunds"),type:"click",handler:FundFinder.UpdateResult_action,context:FundFinder});Events.add({element:Element.get("ClearSlection"),type:"click",handler:FundFinder.ClearSelection,context:FundFinder});Events.add({element:Element.get("list_pagination"),type:"click",handler:FundFinder.ChangePage_action,context:FundFinder});Events.add({element:jQuery('#result_left .finder_buttons')[0],type:"click",handler:FundFinder.ButtonClick_action,context:FundFinder});Events.add({element:Element.get("list_content"),type:"click",handler:FundFinder.TableClick_action,context:FundFinder});}
FundFinder.ChangePage_action=function(e,el)
{var target=e.getTarget();while(target&&target.nodeName.toLowerCase()!="li"){target=target.parentNode;}
if(!target){return;}
var jet=jQuery(target);if(!jet.hasClass("selected"))
{var pageattr=jet.attr("page").toLowerCase();FundFinder.ChangePage(pageattr);}}
FundFinder._filterContainer=null;FundFinder._filterContainerWalk=null;FundFinder.ChangeWalkthoughStaus=function(isWalkThrough)
{var jbody=jQuery("body");if(null==FundFinder._filterContainer){FundFinder._filterContainer=jQuery("div.filter_container_self");}
if(null==FundFinder._filterContainerWalk){FundFinder._filterContainerWalk=jQuery("div.filter_container_walk");}
if(isWalkThrough)
{jQuery("#fund_filters").removeClass("self_state");FundFinder._filterContainer.addClass("hidden");FundFinder._filterContainerWalk.removeClass("hidden");FundRemoting.SetWalkthoughStatus({arguments:{status:"WalkThrough"}});}
else
{jQuery("#fund_filters").addClass("self_state");FundFinder._filterContainer.removeClass("hidden");FundFinder._filterContainerWalk.addClass("hidden");FundRemoting.SetWalkthoughStatus({arguments:{status:"Self"}});}}
FundFinder.ChangeWalkthoughStep=function(step)
{step=parseInt(step);FundFinder.currentStep=step;if(step==1){Element.addClass("StepBack","disabled");Element.addClass("StepBackTop","disabled");}else{Element.removeClass("StepBack","disabled");Element.removeClass("StepBackTop","disabled");}
FundFinder._walkHelper.attr("class",FundFinder._walkHelper.attr("class").replace(/Step_[0-9]+/,"Step_"+step));DropDownList.CurrentIndex("#FundBucket",step);FundFinder.UpdateResult_action(null,{action:"walkthrough"});}
FundFinder.ClearSelection=function()
{if(!FundFinder.IsWalkThrough(true))
{DropDownList.CurrentIndex("#FundBucket",0);}
DropDownList.CurrentIndex("#Investment",0);DropDownList.CurrentIndex("#Performance",0);DropDownList.CurrentIndex("#FundCategory",0);jQuery("#filter_checkboxes").find("div.checkbox").removeClass("checked");}
FundFinder.UpdateResult_action=function(e,el)
{if(el.action=="walkthrough"){inputs={FundBucket:DropDownList.CurrentValue("#FundBucket")||"",FundTab:String(FundFinder.GetCurrentTabId())};FundFinder.UpdateResult(inputs);}else{FundFinder.UpdateResult();}}
FundFinder.GetSaveDialog=function(bClear)
{dialog=new Popup_class(jQuery("#saveSearchTemplate").html());var container=jQuery(dialog.container);var input=container.find("input")[0];dialog.SetSize(400,150);var confirmed=function()
{var name=jQuery.trim(input.value);if(name&&FundFinder.savedCriteria){FundFinder.SaveSearch(name,FundFinder.savedCriteria);dialog.Hide();}}
var canceled=function(){dialog.Hide();}
var jel=container.find(".savebtn").click(confirmed);var jem=container.find(".cancel").click(canceled);return(FundFinder.GetSaveDialog=function(bClear)
{if(bClear){input.value=input.defaultValue;}
return dialog;}).call(FundFinder,bClear);}
FundFinder.ButtonClick_action=function(e,el)
{var jtarget=jQuery(e.getTarget()).parent(".bluebutton");if(jtarget.length)
{if(jtarget.hasClass("SaveSearch"))
{FundFinder.GetSaveDialog(true).Center().Show();}
else if(jtarget.hasClass("ViewSaved"))
{FundFinder.LoadSavedFunds("1");}
else if(jtarget.hasClass("StepBack"))
{}
else if(jtarget.hasClass("ViewNormal"))
{Common.Goto("fundFinder.aspx",true);}
else if(jtarget.hasClass("SaveAndContinue"))
{}}}
FundFinder.TableClick_action=function(e,el)
{var jtarget=jQuery(e.getTarget()).parent("td");if(jtarget.length)
{var jp=jtarget.parent("tr");var issueId=jp.attr("issueid");var assetClass=jp.attr("assetclass")||"";if(jtarget.hasClass("list_fund_name"))
{FundFinder.ShowSummaryPage(issueId);}
else if(jtarget.hasClass("bookmark_fund"))
{if(FundFinder.disallowMoveOnPopup){if(!jtarget.hasClass("bookmarked")){FundFinder._greatestStep=FundFinder.currentStep;FundFinder.disallowMoveOnPopup.Hide();}}
FundFinder.BookmarkFund(issueId,assetClass,jtarget.hasClass("bookmarked"),jtarget);}}}
FundFinder.ChangePage=function(pageattr)
{var tab=FundFinder.GetCurrentTab();var page=tab.currentPage;switch(pageattr)
{case"first":page=1;break;case"last":page=tab.pageCount;break;case"prev":page=tab.currentPage-1;if(page<1){page=1;}
break;case"next":page=tab.currentPage+1;if(page>tab.pageCount){page=tab.pageCount;}
break;default:page=parseInt(pageattr);}
if(page!=tab.currentPage)
{tab.currentPage=page;if(FundFinder.isViewSavedFunds())
{FundFinder.LoadSavedFunds();}
else
{FundFinder.UpdateResult();}}}
FundFinder.isViewSavedFunds=function(){return(FundFinder.savedCriteria&&FundFinder.savedCriteria["ScreenType"]==FundFinder.SCREENTYPE_SAVEDFUNDS);}
FundFinder.ChangeSort=function(target)
{var jel=jQuery(target);var sortField=jel.attr("sort");if(!sortField){return;}
var tab=FundFinder.GetCurrentTab();tab.sortField=sortField;tab.sortDir=jel.hasClass("descending")?"A":"D"
tab.currentPage=1;if(FundFinder.isViewSavedFunds())
{FundFinder.LoadSavedFunds();}
else{FundFinder.UpdateResult();}}
FundFinder.GetCurrentTabId=function()
{$tabList=jQuery("#result_list ul.fundilktabs li");return(FundFinder.GetCurrentTabId=function(){for(var t=0;t<$tabList.length;t++)
{if($tabList.eq(t).hasClass("selected")){return t;}}
return null;}).call(FundFinder);}
FundFinder.GetCurrentTab=function()
{var tabList=[{currentPage:1,pageCount:1,sortField:"",sortDir:"",currentView:"Basic"},{currentPage:1,pageCount:1,sortField:"",sortDir:"",currentView:"Basic"}];return(FundFinder.GetCurrentTab=function(){var tab=FundFinder.GetCurrentTabId();return tabList[tab];}).call(FundFinder);}
FundFinder.GetCriteriaInputs=function()
{var tab=FundFinder.GetCurrentTab();var view=FundFinder.GetCurrentView();tab.currentView=view;inputs={FundBucket:DropDownList.CurrentValue("#FundBucket")||"",FundCategory:DropDownList.CurrentValue("#FundCategory")||"",FundFamily:DropDownList.CurrentValue("#FundFamily")||"",MinimumInvestment:DropDownList.CurrentValue("#Investment")||"",TimeFrame:RadioButton.CurrentValue("#timeframe")||"",Performance:DropDownList.CurrentValue("#Performance")||"",IsOpen:(CheckBox.CurrentValue("#OpenToNewInvestors")||false)?"1":"0",HasNoFee:(CheckBox.CurrentValue("#NoTransactionFee")||false)?"1":"0",Page:String(tab.currentPage||"1"),SortField:tab.sortField||"",SortDir:tab.sortDir||"",SaveName:"",FundTab:String(FundFinder.GetCurrentTabId()),View:view||"Basic"};return inputs;}
FundFinder.ChangeView=function(view)
{jQuery("#result_list").attr("class",view);criteria=FundFinder.GetCriteriaInputs();if(FundFinder.isViewSavedFunds())
{criteria["ScreenType"]=FundFinder.SCREENTYPE_SAVEDFUNDS;}
else
{criteria["View"]=view;var pair=Common.CreateRemotingPair(FundFinder.UpdateView_load,FundFinder.UpdateView_error,FundFinder,criteria);FundRemoting.PerformView({onload:pair.load,onerror:pair.error,context:FundFinder,arguments:{criteria:criteria}});}}
FundFinder.UpdateView_load=function(result){}
FundFinder.UpdateView_error=function(result){}
FundFinder.GetCurrentView=function()
{var resultList=jQuery("#result_list");var view=resultList.attr("class");return view;}
FundFinder.UpdateFundCount_error=function(result)
{WSDOM.Console.log("UpdateFundCount_error ",result);}
FundFinder._exportList=function()
{var criteria=FundFinder.GetCriteriaInputs();criteria.FieldList=ExportColumnSelector.GetSelectedFields().join(",");var type=RadioButton.CurrentValue('#exportListTemplate .exporttype');window.open("export/xls.ashx?type="+type+"&input="+WSDOM.Serializer.serialize(criteria));}
FundFinder.ShowPopupTip=function(){document.getElementById("fund-tip-container").style.display="block";}
FundFinder.HidePopupTip=function(){document.getElementById("fund-tip-container").style.display="none";}
FundFinder.UpdateResult=function(criteria)
{if(!criteria){criteria=FundFinder.GetCriteriaInputs();}
if(jQuery("body").hasClass("walkthrough-WalkThrough")){criteria["ScreenType"]=FundFinder.SCREENTYPE_WALKTHROUGH;}else if(jQuery("body").hasClass("walkthrough-Self")){criteria["ScreenType"]=FundFinder.SCREENTYPE_SELF;}else{criteria["ScreenType"]=FundFinder.SCREENTYPE_NORMAL;}
criteria["step"]=String(FundFinder.currentStep);var pair=Common.CreateRemotingPair(FundFinder.UpdateResult_load,FundFinder.UpdateResult_error,FundFinder,criteria);FundRemoting.PerformScreen({onload:pair.load,onerror:pair.error,context:FundFinder,arguments:{criteria:criteria}})}
FundFinder.UpdateResult_load=function(result,criteria)
{var screenType=criteria["ScreenType"]||FundFinder.SCREENTYPE_NORMAL;FundFinder.savedCriteria=criteria;jQuery("#default_graphic").hide();jQuery("#list_content").html(result.Table);jQuery("#list_pagination").html(result.Pagination);jQuery("#list_meta").html(result.Description);var $tabParent=jQuery("#result_list ul.fundilktabs");if(screenType==FundFinder.SCREENTYPE_SAVEDFUNDS||screenType==FundFinder.SCREENTYPE_WALKTHROUGH){$tabParent.hide();}else{$tabParent.show();}
buttonClass="";var finderButtonsDiv=jQuery("#result_left .finder_buttons");if(!finderButtonsDiv.hasClass("stepback"))
{if(screenType==FundFinder.SCREENTYPE_NORMAL)
{buttonClass=" saveonly";if(parseInt(result.SavedFundCount)){buttonClass=" saveview";}}
else if(screenType==FundFinder.SCREENTYPE_SAVEDFUNDS)
{buttonClass=" viewback";}
finderButtonsDiv.attr("class","clearfix finder_buttons"+buttonClass);}
jQuery("#result_left").show();FundFinder.GetCurrentTab().pageCount=parseInt(result.PageCount);}
FundFinder.UpdateResult_error=function(result,criteria)
{WSDOM.Console.log("UpdateResults_error ",result);}
FundFinder.LoadSavedFunds=function(pageNumber)
{var criteria=FundFinder.GetCriteriaInputs();criteria["ScreenType"]=FundFinder.SCREENTYPE_SAVEDFUNDS;if(pageNumber)
{criteria["Page"]=pageNumber;}
var pair=Common.CreateRemotingPair(FundFinder.UpdateResult_load,FundFinder.UpdateResult_error,FundFinder,criteria);FundRemoting.LoadSavedFunds({onload:pair.load,onerror:pair.error,context:FundFinder,arguments:{criteria:criteria}})}
FundFinder.UpdateDropDowns=function(bDoUpdateResults)
{var criteria=FundFinder.GetCriteriaInputs();var pair=Common.CreateRemotingPair(FundFinder.UpdateDropDowns_load,FundFinder.UpdateDropDowns_error,FundFinder,{bDoUpdateResults:true});FundRemoting.PopulateDropDownMenus({onload:pair.load,onerror:pair.error,context:FundFinder,bDoUpdateResults:bDoUpdateResults,arguments:{fundTab:String(FundFinder.GetCurrentTabId()),fundBucket:criteria.FundBucket,fundCategory:criteria.FundCategory}})}
FundFinder.UpdateDropDowns_load=function(result,data)
{jQuery("#combo_fund_type").html(result.FundBucket);jQuery("#combo_category").html(result.FundCategory);jQuery("#combo_fund_family").html(result.FundFamily);if(data&&data.bDoUpdateResults){FundFinder.UpdateResult();}}
FundFinder.UpdateDropDowns_error=function(result)
{WSDOM.Console.log("UpdateDropDowns_error ",result);}
FundFinder.SelectFundBucket=function()
{FundFinder.UpdateDropDowns();}
FundFinder.SelectFundCategory=function()
{FundFinder.UpdateDropDowns();}
FundFinder.SelectFundFamily=function()
{FundFinder.UpdateResult();}
FundFinder.ShowSummaryPage=function(issueId)
{}
FundFinder.BookmarkFund=function(issueId,assetClass,remove,row)
{var pair=Common.CreateRemotingPair(FundFinder.BookmarkFund_load,FundFinder.BookmarkFund_error,FundFinder,row);FundRemoting.BookMarkFund({onload:pair.load,onerror:pair.error,context:FundFinder,arguments:{issueId:issueId,assetClass:assetClass,remove:!!remove}});}
FundFinder.BookmarkFund_load=function(result,row)
{if(result&&result.Status==1)
{jQuery(row).toggleClass("bookmarked");}
log("BookmarkFund_load",result);}
FundFinder.BookmarkFund_error=function(result,row)
{log("BookmarkFund_error",result);}
FundFinder.SaveSearch=function(name,criteria,replace)
{if(!criteria){return;}
if(name){criteria.SaveName=name}
var pair=Common.CreateRemotingPair(FundFinder.SaveSearch_load,FundFinder.SaveSearch_error,FundFinder,criteria);FundRemoting.SaveFundSearch({onload:pair.load,onerror:pair.error,context:FundFinder,arguments:{criteria:criteria,replace:!!replace}});}
FundFinder.SaveSearch_load=function(result,criteria)
{var close;var dialog=new Popup_class(Element.create("div",{className:"SaveSuccess"},[Element.create("p",null,"Save was successfull"),close=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Close"))]));jQuery(close).click(function(){dialog.Remove()});dialog.SetSize(260,80);dialog.Center().Show();}
FundFinder.SaveSearch_error=function(result,criteria)
{var _status=result.Status;if("-3"==_status)
{}
else if("-4"==_status)
{var close;var dialog=new Popup_class(Element.create("div",{className:"SaveError"},[Element.create("p",null,"The specified name is invalid. Change the name and try again."),close=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Try Again"))]));jQuery(close).click(function(){dialog.Remove();FundFinder.GetSaveDialog().Center().Show();});dialog.SetSize(280,110);dialog.Center().Show();}
else if("-2"==_status)
{var overwrite,cancel;var dialog=new Popup_class(Element.create("div",{className:"SaveConfirm"},[Element.create("p",null,'"'+criteria["SaveName"]+'" is already being used. Do you want to overwrite this saved search?'),overwrite=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Overwrite")),cancel=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Cancel"))]));jQuery(overwrite).click(function(){FundFinder.SaveSearch(null,FundFinder.savedCriteria,true);dialog.Remove();});jQuery(cancel).click(function(){dialog.Remove()});dialog.SetSize(400,110);dialog.Center().Show();}
else
{var close;var dialog=new Popup_class(Element.create("div",{className:"SaveError"},[Element.create("p",null,"There was an error saving your portfolio"),close=Element.create("a",{className:"bluebuttonsmall","onmouseout":"Button.mouseout(this,'bluebuttonsmall');","onmouseover":"Button.mouseover(this,'bluebuttonsmall');"},Element.create("span",null,"Close"))]));jQuery(close).click(function(){dialog.Remove()});dialog.SetSize(280,110);dialog.Center().Show();}}
FundFinder.showSavedFundRollover=function(issueId,el)
{var $el=jQuery(el);var $elroll=$el.next(".savedFundRollover");var pos=$el.position();if($elroll){$elroll.css("top",pos.top-$el.height()-$elroll.height());$elroll.css("left",pos.left-$elroll.width());$elroll.css("display","block");}}
FundFinder.hideSavedFundRollover=function(issueId,el)
{var $el=jQuery(el).next(".savedFundRollover");if($el){$el.css("display","");}}
FundFinder.switchTab=function(which)
{var $tabs=jQuery("#result_list ul.fundilktabs li");which=parseInt(which);for(var t=0;t<$tabs.length;t++)
{if(which==t){$tabs.eq(t).addClass("selected");}else{$tabs.eq(t).removeClass("selected");}}
jQuery("#list_content").html("Loading... <img src='Images/loadingAnimation.gif' alt='' />");FundFinder.UpdateDropDowns(true);}
var ff=FundFinder;function getHelpCategory(section){switch(section){case"walkthrough":return getWalkthroughHelpCategory();case"results":return getResultsHelpCategory();case"fundtypes":return getAllFundTypesHelpCategory();}
return;}
function getWalkthroughHelpCategory(){var dropdown=Element.parseSelector("div.ItemDisplay",Element.get("FundBucket"),"first");if(dropdown){return getDropdownHelpCategory(dropdown);}}
function getResultsHelpCategory(){var view=Element.get("result_list");var list=Element.parseSelector("li."+view.className,Element.get("list-result-views"),"first");if(list){var section=list.getAttribute("helpid");if(section){return section;}}}
function getAllFundTypesHelpCategory(){var dropdown=Element.parseSelector("div.ItemDisplay",Element.get("FundBucket"),"first");if(dropdown){return getDropdownHelpCategory(dropdown);}}
function getDropdownHelpCategory(dropdown){var section=dropdown.getAttribute("curval");if(section){return section+"funds";}}
function dynamicHelpText(){var section=getHelpCategory(jQuery(this)[0].getAttribute("section"));if(section){HelpText.launchPopup(jQuery(this),section);}}
jQuery(function(){FundFinder.Init();jQuery('.help').mouseover(HelpText.mouseover).mouseout(HelpText.mouseout);jQuery('.dynamic-help').mouseover(dynamicHelpText).mouseout(HelpText.mouseout);});var Home=function(){}
Home.BuildMyPortfolio=function()
{window.location=Links.Builder+"?goalname="+escape(DropDownList.CurrentValue("#GoalSelect"));}
Home.FindFunds=function()
{window.location=Links.FundFinder+"?familyetf="+escape(DropDownList.CurrentValue("#FamilyETF"))
+"&familymf="+escape(DropDownList.CurrentValue("#FamilyMF"));}
Home.menuAction=function(){}
Home.GetBlogContent=function()
{var pair=Common.CreateRemotingPair(Home.GetBlogContent_load,Home.GetBlogContent_error,Home);var content=FundRemoting.GetFeedContent({onload:pair.load,onerror:pair.error,context:Home,arguments:{feed:"blog"}});}
Home.GetBlogContent_load=function(result)
{jQuery("#ExpertsDeskFeed").replaceWith(result.html);}
Home.GetBlogContent_error=function(result)
{WSDOM.Console.log("ERROR");}
Home.Init=function()
{if(!jQuery("body").hasClass("homepage")){return;}
jQuery('.tip').mouseover(HelpText.mouseover).mouseout(HelpText.mouseout);Home.GetBlogContent();}
jQuery(Home.Init);FrameResize={};FrameResize.setDomain=function()
{var d=document.domain;if(d.indexOf(".")>-1){var end=d.substring(d.lastIndexOf("."),d.length);d=d.substring(0,d.lastIndexOf("."));d=d.substring(d.lastIndexOf(".")+1,d.length);d=d+end;}
document.domain=d;}
FrameResize.mmax=function(numbers)
{var max=-Infinity;var i;for(i=0;i<numbers.length;i++)
{if(numbers[i]>max)max=numbers[i];}
return max;}
FrameResize.getHeight=function(win,elem)
{var h=new Array();if(win)
{if(win.document)
{if(win.document.height)
{h.push(win.document.height);}
else
{if(win.document.body)
{if(win.document.body.scrollHeight)
{h.push(win.document.body.scrollHeight);}
if(win.document.body.offsetHeight)
{h.push(win.document.body.offsetHeight);}}}}
if(win.innerHeight)
{h.push(win.innerHeight);}}
if(elem)
{if(elem.contentDocument)
{if(elem.contentDocument.height)
{h.push(elem.contentDocument.height);}
if(elem.contentDocument.documentElement)
{if(elem.contentDocument.documentElement.offsetHeight)
{h.push(elem.contentDocument.documentElement.offsetHeight);}
if(elem.contentDocument.documentElement.scrollHeight)
{h.push(elem.contentDocument.documentElement.scrollHeight);}}}}
return FrameResize.mmax(h);}
FrameResize.callResize=function(target)
{var _target=target?target:"content";if(window.frames.length==0&&window.parent!=window.self)
{try
{parent.FrameResize.callResize(_target);}
catch(e){}}
else
{var h=0;var frameW=window.frames[_target];var frameE=document.getElementById(_target);if(frameE&&frameW)
{frameE.style.height="auto";var h=FrameResize.getHeight(frameW,frameE);if(h)
{frameE.style.height=h+30+"px";}}}}
function PortfolioBuilder_Class()
{this._goalSlider=null;this._timeFrameSlider=null;this._initialInvestmentSlider=null;this._recurrentInvestmentSlider=null;this._riskSlider=null;this._handles={};this._sliderHiders={};this.invisiblePadder=null;this.portfolioCriteria={Recurrence:jQuery("#TimeFrame div.ItemDisplay").attr("curVal")};this.precision=4;this.mouseOverTimer=0;this.numQuestions=jQuery("#side_panel .module_contents span.question").length;this.setupDialogs();jQuery("#TimeFrame").bind("select",this.SelectTimeFrame.Context(this));jQuery("#GoalList").bind("select",this.SelectGoal.Context(this));this._evtAllocationMouseOver=Events.add({element:Element.get("AllocationRecContainer"),context:this,handler:this._allocationMouseOver,type:"mouseover"});var goalListValue=DropDownList.CurrentValue("#GoalList");if(goalListValue!=-1){this.portfolioCriteria.GoalType=goalListValue;if(goalListValue=="other"){jQuery("#Input_GoalName").removeClass("hidden").siblings("br:last").removeClass("hidden");}else{jQuery("#Input_GoalName").addClass("hidden").siblings("br:last").addClass("hidden");}
FundRemoting.GetSliderInfo({onload:function(b){this._registerSliders();this.LoadSliderInfo(b,parseInt(this._goalSlider.parentEl.getAttribute("default")));},context:this,arguments:{goalType:goalListValue}});}
else{this._registerSliders();}};PortfolioBuilder_Class.prototype._range={goalSlider:{minVal:0,maxVal:10000000,increment:50000,map:"none"},timeFrameSlider:{minVal:0,maxVal:50,increment:1,map:"timeFrame"},initialInvestmentSlider:{minVal:0,maxVal:10000000,increment:1000,map:"none"},recurrentInvestmentSlider:{Week:{minVal:0,maxVal:1000000,increment:50000,map:"recurrentInvestment"},Month:{minVal:0,maxVal:1000000,increment:50000,map:"recurrentInvestment"},Year:{minVal:0,maxVal:1000000,increment:50000,map:"recurrentInvestment"}},riskSlider:{minVal:0,maxVal:4,increment:1,map:"risk"}};PortfolioBuilder_Class.prototype.setupDialogs=function()
{var t=this;this._saveDialog=new Popup_class(jQuery("#saveTemplate div.login"));this._errorDialog=new Popup_class(jQuery("#errorTemplate"));var messages=jQuery("#errorTemplate > div");this._errorDialog.showerror=function(which)
{var count=messages.length;for(var m=0;m<count;m++)
{var c=jQuery(messages.get(m));if(c.hasClass(which)){c.removeClass("hidden");}else{c.addClass("hidden");}}}
this._saveDialog.SetSize({width:320,height:130});this._errorDialog.SetSize({width:300,height:90});Events.add({element:Element.get("ErrorDoLogin"),handler:function(){Common.GotoLogin(true);},type:"click"});Events.add({element:Element.get("ErrorDoLoginCancel"),handler:this._errorDialog.Hide,type:"click",context:this._errorDialog});Events.add({element:Element.get("ErrorNeedsNameClose"),handler:this._errorDialog.Hide,type:"click",context:this._errorDialog});Events.add({element:Element.get("ErrorDoRegister"),handler:Common.SignUp,type:"click"});jQuery("#SavePortfolio").click(this._savePort.Context(this));jQuery("#CancelSave").click(function(){t._saveDialog.Hide();});jQuery("#GoalName").blur(function(){if(this.portfolioCriteria.GoalType=="other"){this.portfolioCriteria.GoalName=this._getGoalName();}else{this.portfolioCriteria.GoalName="";}
FundRemoting.TrackCriteria({arguments:{criteria:this.portfolioCriteria}});}.Context(this));jQuery("a.portBtn").click(function(){t.SaveAction.call(t,jQuery(this));});}
PortfolioBuilder_Class.prototype._riskMap={0:"Don't Want to Lose What I Have",1:"A Little Pain for a Little Gain",2:"Cautiously Optimistic",3:"Go For Gain, I'll Take the Pain",4:"Win Big, or Lose Big"};PortfolioBuilder_Class.prototype.descBlockText=["Choose a goal, and set an end total.","Decide when you want to achieve your goal.","Decide how much you can invest for a start.","Decide how much, and how often, you can add.","Decide how much risk you're comfortable with.","Adjust the sliders to get closer to 95%."];PortfolioBuilder_Class.prototype.headerTips=["To start a portfolio, select a goal to the right.","When are you planning to achieve this goal?","How much of an investment will you start with?","Estimate how much you'll save each month...","Finally, choose a comfortable level of risk.",""];PortfolioBuilder_Class.prototype.builderDescriptions=["A strong portfolio starts with diversification &mdash; meaning investing in a combination of stocks, bonds and cash. Through this combination, you get the best bang for your buck. This is accomplished through what's known as an \"Asset Allocation\". Let's build yours &mdash; once you choose a goal, it just takes 5 quick steps","Now choose the timeframe within which you hope to achieve your goal. Asset Allocations are closely aligned with timeframe, since time is an important element in determining how much risk you can reasonably take on. Some goals are tied to specific dates; others are less time-sensitive (a very good thing!) ","Give some thought to how much money you're willing (and able) to put toward your goal starting on Day One. Obviously the more you start with, the more quickly you'll get it done. But if you have little or no cash, don't let that stop you! Use your Fund.com portfolio as motivation. Surprise yourself!","Here's where you can make up for a cash shortage. Consider how much money you take home each month and what you spend it on. Weigh all that against how strongly you feel about this goal.  Financial planning offers a rare chance to re-align your savings approach so it matches what really matters to you.","Last one, and the toughest. Risk tolerance is mostly a measure of how comfortable you are with the fact that markets do go down at times. Reward is what we're after, but Risk is its evil twin, and try as we might, we can't have one without the other. So experiment a little &mdash; but try to keep on the lower-risk side of the line.","SUCCESS! You've built your first Asset Allocation! Now take a look at the purple pie chart below to assess your chances. If you don't like what you see, adjust the sliders until you're as close as you can realistically get to a 95% Opportunity For Success. Then click \"Save and Continue\"."];PortfolioBuilder_Class.prototype.opportunityTips=["<div class=\"tinyFont\">This gauge represents our estimate of how likely you are to reach your goal:  the higher the percentage, the greater the likelihood.  The assumptions behind it are straightforward:  we assume average returns on investments over time, and adjust them based on historical inflation rates.  Because past performance does not ensure future results, the gauge is meant only to offer you a bit of guidance.  Estimates are subject to many unanticipated factors, and a high percentage should only be taken in that spirit.  In no way is it a guarantee that you will meet your goal.</div>","To increase your chance of success, consider extending your time frame. More time usually means moresavings &mdash; and higher total returns.","Another way to increase your chance of success is to increase your initial investment. Experiment with different amounts and see how they affect your chances.","As noted above, the more you invest over time, the greater your chance of success. That's true regardless of whether you start with a ton of cash, or a small nest egg.","Time is a key element in the risk equation: if your goal is more than five years out, you may (carefully!) consider taking on a bit more risk. That means your Asset Allocation will include a higher percentage of stocks.",""];PortfolioBuilder_Class.prototype.riskMap=function(val){return this._riskMap[val]}
PortfolioBuilder_Class.prototype.timeFrameMap=function(val){return val+" year"+(val!=1?"s":"");}
PortfolioBuilder_Class.prototype.yearlyMap=function(val){return(val?WSDOM.Format.formatNumber(val,"$#,###"):"$0")+" / year"}
PortfolioBuilder_Class.prototype.recurrentInvestmentMap=function(val){return(val?WSDOM.Format.formatNumber(val,"$#,###"):"$0")+" / "+this.portfolioCriteria.Recurrence.toLowerCase();}
PortfolioBuilder_Class.prototype.calculateIncrement=function(maxValue){var exactIncrement=maxValue/(this._goalSlider.barLength/this.precision);return this.ceilQuarterMagnitude(exactIncrement);};PortfolioBuilder_Class.prototype.ceilQuarterMagnitude=function(x){var magnitude=Math.ceil(Math.log(x,10));var power=Math.pow(10,magnitude);var returnValue=power;if(power>=50&&power/2>x){if(power>=100&&power/4>x){returnValue/=4;}
else{returnValue/=2;}}
return returnValue;};PortfolioBuilder_Class.prototype._updateHandle=function(el,val,data){var display;var map=this[data.map+"Map"];if(map){display=map.call(this,val);}else{display=val?WSDOM.Format.formatNumber(val,"$#,###"):"$0";}
jQuery(el).parents("div.x-slider-horz:first").find("div.x-tip-body").html(display);this.portfolioCriteria[data.name.replace(/^[a-z]/,Common.capRE).replace("Slider","")]=val;try{var pos=jQuery(el).position();var bubble=jQuery(el).parents("div.x-slider-horz:first").find("div.x-tip");if(jQuery(document.body).hasClass("isie6"))
bubble.css({left:pos.left-(bubble.width()/2)+18});else
bubble.css({left:pos.left-(bubble.width()/2)+32});}catch(err){WSDOM.Console.log(err);}}
PortfolioBuilder_Class.prototype._endHandle=function(el,val,data,isProgramatic){var sliderParent=jQuery(el).parents("div.x-slider-end");if(sliderParent.length){if(sliderParent[0].id=="goalSlider"||sliderParent[0].id=="timeFrameSlider"){this.updateDynamicSliders();}
var nextSlider=this._sliderHiders[sliderParent[0].id];if(nextSlider){jQuery(nextSlider).parents("span.question").removeClass("invisible");if(!isProgramatic){FundRemoting.TrackCriteria({arguments:{criteria:this.portfolioCriteria}});}
if(!this._sliderHiders[nextSlider.id]){jQuery("a.portBtn.disabled").removeClass("disabled");}}else{this.updateStepText(this.numQuestions);this._endHandle=function(el){if(jQuery(el).parents("div.x-slider-end")[0].id=="goalSlider"||jQuery(el).parents("div.x-slider-end")[0].id=="timeFrameSlider"){this.updateDynamicSliders();}
FundRemoting.GetAllocation({onload:this.LoadAllocation,context:this,arguments:{criteria:this.portfolioCriteria}});};jQuery("a.portBtn.disabled").removeClass("disabled");return this._endHandle(el);}}
var numInvisibles=jQuery("#side_panel .module_contents span.invisible").length;this.updateStepText(this.numQuestions-numInvisibles-1);};PortfolioBuilder_Class.prototype.updateStepText=function(stepIndex){var numQuestions=jQuery("#side_panel .module_contents span.question").length;if(stepIndex===0){jQuery("div.startHere .Title").html("Start Here");}
else if(stepIndex<numQuestions){jQuery("div.startHere .Title").html("Step "+(stepIndex+1)+"...");}
else{jQuery("div.startHere .Title").html("");}
jQuery("div.startHere .DescBlock").html(this.descBlockText[stepIndex]);jQuery("#builder_description").html(this.builderDescriptions[stepIndex]);jQuery("#headerTip").html(this.headerTips[stepIndex]);jQuery("#opportunityTip").html(this.opportunityTips[stepIndex]);};PortfolioBuilder_Class.prototype.updateDynamicSliders=function(){var goalAmount=this._handles.goalSlider.getValue();if(goalAmount>0){var initialInvestmentValue=this._handles.initialInvestmentSlider.getValue();this._initialInvestmentSlider.resetMinMax({minVal:0,maxVal:goalAmount,increment:this.calculateIncrement(goalAmount),map:"initialInvestment"});this._handles.initialInvestmentSlider.finalDisplayFromValue(initialInvestmentValue);this._handles.initialInvestmentSlider.MyUpdateValue();var timeframeYears=this._handles.timeFrameSlider.getValue()||1;var recurUnit=jQuery("#TimeFrame .ItemDisplay").attr("curval");var paymentsPerYear=(recurUnit==="Year"&&1||recurUnit==="Month"&&12||recurUnit==="Week"&&52||1);var maxRecurrentAmount=goalAmount/(timeframeYears*paymentsPerYear);var recurrentInvestmentValue=this._handles.recurrentInvestmentSlider.getValue();var recurrentInvest={minVal:0,maxVal:this.ceilQuarterMagnitude(maxRecurrentAmount),increment:this.calculateIncrement(maxRecurrentAmount),map:"recurrentInvestment"}
this._recurrentInvestmentSlider.resetMinMax(recurrentInvest);this._handles.recurrentInvestmentSlider.finalDisplayFromValue(recurrentInvestmentValue);this._handles.recurrentInvestmentSlider.MyUpdateValue();this._range.recurrentInvestmentSlider[recurUnit]=recurrentInvest;}};PortfolioBuilder_Class.prototype._allocationMouseOver=function(e,el){var targatItem=jQuery(e.getTarget());window.clearTimeout(this.mouseOverTimer);if(targatItem.hasClass("recommended_list_item"))
this.mouseOverTimer=window.setTimeout(function(){this.displayAllocationInfo(targatItem);}.Context(this),10);}
PortfolioBuilder_Class.prototype.LoadAllocation=function(b){var result=b.getResult();if(result.LikelyHood>100){result.LikelyHood=100;}
if(result.LikelyHood<70){jQuery("#opportunityText").html("Low Opportunity");}else if(result.LikelyHood<95){jQuery("#opportunityText").html("Moderate Opportunity");}else{jQuery("#opportunityText").html("Higher Opportunity");}
jQuery("#AllocationRecContainer").html(String(result.HTML));jQuery("#opportunity div.builder_tip_top div").html("<strong>Tip</strong>"+result.Message);jQuery("#likely strong").html(result.LikelyHood+"%");jQuery("#opportunityPercent").html(result.LikelyHood+"<span>%</span>");jQuery("#builder_main_content").removeClass("defaultState");jQuery("#PieValue").html(100-parseInt(result.LikelyHood));jQuery("#PieRemander").html(result.LikelyHood);this.displayAllocationInfo(jQuery("#AllocationRecContainer div.recommended_list_item:first"));$.fgCharting()}
PortfolioBuilder_Class.prototype.displayAllocationInfo=function(item){item.parent().find("div.list_over").removeClass("list_over");item.addClass("list_over");jQuery("#AllocationRecContainer div.recommended_pointer").css({top:item.position().top-25+(item.height()/2)});var recTipArea=jQuery("#recommended_tip");recTipArea.find("h3.recName").html(item.attr("displayName"));recTipArea.find("div.recAllocation").html(item.attr("allocation"));recTipArea.find("div.recReturn").html(item.attr("return"));recTipArea.find("div.recRisk").html(item.attr("risk"));recTipArea.find("div.recDesc").html(item.attr("desc").replace("[","<span class=\"bold\">").replace("]","</span>"));}
PortfolioBuilder_Class.prototype._registerSliders=function(){var that=this;this.updateStepText(0);var sliders=jQuery("#side_panel div.x-slider-end");var sliderHiders={};this._sliderHiders=sliderHiders;sliders.each(function(i,el){var rangeObj=that._range[el.id];if(el.id==="recurrentInvestmentSlider"){rangeObj=rangeObj[that.portfolioCriteria.Recurrence];}
if(sliders[i+1]){sliderHiders[el.id]=sliders[i+1];}
that._registerSlider(el,rangeObj);});};PortfolioBuilder_Class.prototype._registerSlider=function(sliderEl,rangeObj){var that=this;function updateHandler(mEvt,dir,isProgramatic){this.finalDisplayFromValue(Math.round(this.currentValue/this.oData.increment)*this.oData.increment)
that._updateHandle(this.el,this.currentValue,this.oData);if(mEvt=="mouseend"||isProgramatic){that._endHandle(this.el,this.currentValue,this.oData,isProgramatic);}}
var id=sliderEl.id;if(rangeObj){var defVal=sliderEl.getAttribute("default");if(defVal!=-1&&defVal<rangeObj.increment){rangeObj.increment=defVal;}
this["_"+id]=new Slider_Class({parentID:sliderEl,sliderClass:"x-slider-inner",orientation:"leftToRight",handleOverlap:"3",handleOffset:[5,5],minVal:rangeObj.minVal,maxVal:rangeObj.maxVal});var handle=new SliderHandle_Class({increment:rangeObj.increment,defaultVal:0,handleClassName:"x-slider-thumb",name:id,map:rangeObj.map});this._handles[id]=handle;handle.MyUpdateValue=updateHandler;this["_"+id].addHandle(handle);if(defVal!=-1){handle.finalDisplayFromValue(parseInt(defVal));window.setTimeout(function(){handle.MyUpdateValue("set",null,true);},0);}
else{handle.finalDisplayFromValue(0);window.setTimeout(function(){handle.MyUpdateValue("set",null,false);},0);}}};PortfolioBuilder_Class.prototype._savePort=function()
{this.portfolioCriteria.Name=jQuery("#portName").val();if(this.portfolioCriteria.Name){if(this.portfolioCriteria.GoalType=="other"){this.portfolioCriteria.GoalName=this._getGoalName();}else{this.portfolioCriteria.GoalName="";}
this.portfolioCriteria.PortID=jQuery("#Input_portName").attr("portfolioid");FundRemoting.SavePortfolio({onload:this._saveComplete,context:this,arguments:{criteria:this.portfolioCriteria}});}else{this._errorDialog.showerror("needsname");this._errorDialog.Center().Show();}}
PortfolioBuilder_Class.prototype._getGoalName=function(){return jQuery("#GoalName").val();}
PortfolioBuilder_Class.prototype._saveComplete=function(buf){var result=buf.getResult();window.setTimeout("window.location.href = '"+Links.FundFinder+"?portID="+result+"&sort=ytd'",0);}
PortfolioBuilder_Class.prototype._save=function(){if(jQuery(document.body).hasClass("publicUser")){this._errorDialog.showerror("mustlogin");this._errorDialog.Center().Show();}else{this._saveDialog.Center().Show();}}
PortfolioBuilder_Class.prototype._clear=function(){jQuery(".initial").addClass("invisible");jQuery("#builder_main_content").addClass("defaultState");jQuery("a.portBtn").addClass("disabled");DropDownList.SelectValue(jQuery("#GoalList"),"-1");DropDownList.SelectValue(jQuery("#TimeFrame"),"Month");jQuery("div.startHere div.DescBlock").html(this.descBlockText[0])
jQuery("div.startHere div.DescBlock").css({height:20});jQuery("div.startHere div.module_contents").css({height:581});jQuery("div.startHere div.cContainer").css({backgroundPosition:"684px -277px"});jQuery("div.module_contents:first").append(this.invisiblePadder);this.portfolioCriteria={Recurrence:"Week"};this.__isFirstSelect__=false;for(var i in this._handles){this._handles[i].reset();}}
PortfolioBuilder_Class.prototype._continue=function(){this._save();}
PortfolioBuilder_Class.prototype.SaveAction=function(item){if(!item.hasClass("disabled")){var action=item[0]?item[0].id.replace(/btn/i,""):"";this._errorDialog.Hide();switch(action.toLowerCase()){case"newportfolio":var url=Links.Builder+"?new";setTimeout("window.location.href = '"+url+"'",0);break;case"save":this._save();break;case"savecontinue":this._continue();break;}}}
PortfolioBuilder_Class.prototype.SelectTimeFrame=function(evt,data){var prevPaymentsPerYear=this.portfolioCriteria.Recurrence==="Year"&&1||this.portfolioCriteria.Recurrence==="Month"&&12||this.portfolioCriteria.Recurrence==="Week"&&52||0;var curPaymentsPerYear=data.val==="Year"&&1||data.val==="Month"&&12||data.val==="Week"&&52||0;this.portfolioCriteria.Recurrence=data.val;var recurrentInvestmentValue=this._handles.recurrentInvestmentSlider.getValue();this.updateDynamicSliders();this._handles.recurrentInvestmentSlider.finalDisplayFromValue(recurrentInvestmentValue*prevPaymentsPerYear/curPaymentsPerYear);this._handles.recurrentInvestmentSlider.MyUpdateValue();};PortfolioBuilder_Class.prototype.SelectGoal=function(evt,data){this.portfolioCriteria.GoalType=data.val;if(data.val=="other"){jQuery("#Input_GoalName").removeClass("hidden").siblings("br:last").removeClass("hidden");jQuery("div.goalContainer").removeClass("movedGoalContainer");}else{jQuery("#Input_GoalName").addClass("hidden").siblings("br:last").addClass("hidden");jQuery("div.goalContainer").addClass("movedGoalContainer");}
if(data.val!=-1){FundRemoting.GetSliderInfo({onload:this.LoadSliderInfo,context:this,arguments:{goalType:data.val}});}
jQuery("#recommended .recommended_portfolio_goal").text(jQuery(data.item[0]).text());}
PortfolioBuilder_Class.prototype.LoadSliderInfo=function(buf,val){jQuery("div.goalContainer").removeClass("invisible");var sliderInfo=buf.getResult();this._goalSlider.resetMinMax(sliderInfo);this._handles.goalSlider.finalDisplayFromValue(val);this._handles.goalSlider.MyUpdateValue();this.updateDynamicSliders();};PortfolioBuilder_Class.prototype._loadPreSet=function(buf){var result=buf.getResult();try{this._handles.goalSlider.finalDisplayFromValue(result.Goal);this._handles.timeFrameSlider.finalDisplayFromValue(result.TimeFrame);this._handles.initialInvestmentSlider.finalDisplayFromValue(result.InitialInvestment);this._handles.recurrentInvestmentSlider.finalDisplayFromValue(result.RecurantInvestment);this._handles.riskSlider.finalDisplayFromValue(result.Risk);this._handles.goalSlider.MyUpdateValue();this._handles.timeFrameSlider.MyUpdateValue();this._handles.initialInvestmentSlider.MyUpdateValue();this._handles.recurrentInvestmentSlider.MyUpdateValue();this._handles.riskSlider.MyUpdateValue();DropDownList.SelectValue(jQuery("#TimeFrame"),result.Recurrence);this.portfolioCriteria=result;}catch(err){WSDOM.Console.log(err);}}
PortfolioBuilder_Class.prototype.SwitchFrame=function(){jQuery("div.portfolioFrame").toggleClass("defaultState");}
PortfolioBuilder_Class.Init=function()
{if(!jQuery("body").hasClass("portfoliobuilder")){return;}
PortfolioBuilder=new PortfolioBuilder_Class();var menus=jQuery("div.DropDownMenu");var index=1;for(var i=menus.length;i!=0;--i){menus[i-1].style.zIndex=15+index++;}
jQuery('.tip').mouseover(HelpText.mouseover).mouseout(HelpText.mouseout);}
jQuery(document).ready(PortfolioBuilder_Class.Init);if(!window.CanvasRenderingContext2D){(function(){var m=Math;var mr=m.round;var ms=m.sin;var mc=m.cos;var Z=10;var Z2=Z/2;var G_vmlCanvasManager_={init:function(opt_doc){var doc=opt_doc||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var self=this;doc.attachEvent("onreadystatechange",function(){self.init_(doc);});}},init_:function(doc){if(doc.readyState=="complete"){if(!doc.namespaces["g_vml_"]){doc.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml");}
var ss=doc.createStyleSheet();ss.cssText="canvas{display:inline-block;overflow:hidden;"+"text-align:left;width:300px;height:150px}"+"g_vml_\\:*{behavior:url(#default#VML)}";var els=doc.getElementsByTagName("canvas");for(var i=0;i<els.length;i++){if(!els[i].getContext){this.initElement(els[i]);}}}},fixElement_:function(el){var outerHTML=el.outerHTML;var newEl=el.ownerDocument.createElement(outerHTML);if(outerHTML.slice(-2)!="/>"){var tagName="/"+el.tagName;var ns;while((ns=el.nextSibling)&&ns.tagName!=tagName){ns.removeNode();}
if(ns){ns.removeNode();}}
el.parentNode.replaceChild(newEl,el);return newEl;},initElement:function(el){el=this.fixElement_(el);el.getContext=function(){if(this.context_){return this.context_;}
return this.context_=new CanvasRenderingContext2D_(this);};el.attachEvent('onpropertychange',onPropertyChange);el.attachEvent('onresize',onResize);var attrs=el.attributes;if(attrs.width&&attrs.width.specified){el.style.width=attrs.width.nodeValue+"px";}else{el.width=el.clientWidth;}
if(attrs.height&&attrs.height.specified){el.style.height=attrs.height.nodeValue+"px";}else{el.height=el.clientHeight;}
return el;}};function onPropertyChange(e){var el=e.srcElement;switch(e.propertyName){case'width':el.style.width=el.attributes.width.nodeValue+"px";el.getContext().clearRect();break;case'height':el.style.height=el.attributes.height.nodeValue+"px";el.getContext().clearRect();break;}}
function onResize(e){var el=e.srcElement;if(el.firstChild){el.firstChild.style.width=el.clientWidth+'px';el.firstChild.style.height=el.clientHeight+'px';}}
G_vmlCanvasManager_.init();var dec2hex=[];for(var i=0;i<16;i++){for(var j=0;j<16;j++){dec2hex[i*16+j]=i.toString(16)+j.toString(16);}}
function createMatrixIdentity(){return[[1,0,0],[0,1,0],[0,0,1]];}
function matrixMultiply(m1,m2){var result=createMatrixIdentity();for(var x=0;x<3;x++){for(var y=0;y<3;y++){var sum=0;for(var z=0;z<3;z++){sum+=m1[x][z]*m2[z][y];}
result[x][y]=sum;}}
return result;}
function copyState(o1,o2){o2.fillStyle=o1.fillStyle;o2.lineCap=o1.lineCap;o2.lineJoin=o1.lineJoin;o2.lineWidth=o1.lineWidth;o2.miterLimit=o1.miterLimit;o2.shadowBlur=o1.shadowBlur;o2.shadowColor=o1.shadowColor;o2.shadowOffsetX=o1.shadowOffsetX;o2.shadowOffsetY=o1.shadowOffsetY;o2.strokeStyle=o1.strokeStyle;o2.arcScaleX_=o1.arcScaleX_;o2.arcScaleY_=o1.arcScaleY_;}
function processStyle(styleString){var str,alpha=1;styleString=String(styleString);if(styleString.substring(0,3)=="rgb"){var start=styleString.indexOf("(",3);var end=styleString.indexOf(")",start+1);var guts=styleString.substring(start+1,end).split(",");str="#";for(var i=0;i<3;i++){str+=dec2hex[Number(guts[i])];}
if((guts.length==4)&&(styleString.substr(3,1)=="a")){alpha=guts[3];}}else{str=styleString;}
return[str,alpha];}
function processLineCap(lineCap){switch(lineCap){case"butt":return"flat";case"round":return"round";case"square":default:return"square";}}
function CanvasRenderingContext2D_(surfaceElement){this.m_=createMatrixIdentity();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=Z*1;this.globalAlpha=1;this.canvas=surfaceElement;var el=surfaceElement.ownerDocument.createElement('div');el.style.width=surfaceElement.clientWidth+'px';el.style.height=surfaceElement.clientHeight+'px';el.style.overflow='hidden';el.style.position='absolute';surfaceElement.appendChild(el);this.element_=el;this.arcScaleX_=1;this.arcScaleY_=1;};var contextPrototype=CanvasRenderingContext2D_.prototype;contextPrototype.clearRect=function(){this.element_.innerHTML="";this.currentPath_=[];};contextPrototype.beginPath=function(){this.currentPath_=[];};contextPrototype.moveTo=function(aX,aY){this.currentPath_.push({type:"moveTo",x:aX,y:aY});this.currentX_=aX;this.currentY_=aY;};contextPrototype.lineTo=function(aX,aY){this.currentPath_.push({type:"lineTo",x:aX,y:aY});this.currentX_=aX;this.currentY_=aY;};contextPrototype.bezierCurveTo=function(aCP1x,aCP1y,aCP2x,aCP2y,aX,aY){this.currentPath_.push({type:"bezierCurveTo",cp1x:aCP1x,cp1y:aCP1y,cp2x:aCP2x,cp2y:aCP2y,x:aX,y:aY});this.currentX_=aX;this.currentY_=aY;};contextPrototype.quadraticCurveTo=function(aCPx,aCPy,aX,aY){var cp1x=this.currentX_+2.0/3.0*(aCPx-this.currentX_);var cp1y=this.currentY_+2.0/3.0*(aCPy-this.currentY_);var cp2x=cp1x+(aX-this.currentX_)/3.0;var cp2y=cp1y+(aY-this.currentY_)/3.0;this.bezierCurveTo(cp1x,cp1y,cp2x,cp2y,aX,aY);};contextPrototype.arc=function(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){aRadius*=Z;var arcType=aClockwise?"at":"wa";var xStart=aX+(mc(aStartAngle)*aRadius)-Z2;var yStart=aY+(ms(aStartAngle)*aRadius)-Z2;var xEnd=aX+(mc(aEndAngle)*aRadius)-Z2;var yEnd=aY+(ms(aEndAngle)*aRadius)-Z2;if(xStart==xEnd&&!aClockwise){xStart+=0.125;}
this.currentPath_.push({type:arcType,x:aX,y:aY,radius:aRadius,xStart:xStart,yStart:yStart,xEnd:xEnd,yEnd:yEnd});};contextPrototype.rect=function(aX,aY,aWidth,aHeight){this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();};contextPrototype.strokeRect=function(aX,aY,aWidth,aHeight){this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.stroke();};contextPrototype.fillRect=function(aX,aY,aWidth,aHeight){this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.fill();};contextPrototype.createLinearGradient=function(aX0,aY0,aX1,aY1){var gradient=new CanvasGradient_("gradient");return gradient;};contextPrototype.createRadialGradient=function(aX0,aY0,aR0,aX1,aY1,aR1){var gradient=new CanvasGradient_("gradientradial");gradient.radius1_=aR0;gradient.radius2_=aR1;gradient.focus_.x=aX0;gradient.focus_.y=aY0;return gradient;};contextPrototype.drawImage=function(image,var_args){var dx,dy,dw,dh,sx,sy,sw,sh;var oldRuntimeWidth=image.runtimeStyle.width;var oldRuntimeHeight=image.runtimeStyle.height;image.runtimeStyle.width='auto';image.runtimeStyle.height='auto';var w=image.width;var h=image.height;image.runtimeStyle.width=oldRuntimeWidth;image.runtimeStyle.height=oldRuntimeHeight;if(arguments.length==3){dx=arguments[1];dy=arguments[2];sx=sy=0;sw=dw=w;sh=dh=h;}else if(arguments.length==5){dx=arguments[1];dy=arguments[2];dw=arguments[3];dh=arguments[4];sx=sy=0;sw=w;sh=h;}else if(arguments.length==9){sx=arguments[1];sy=arguments[2];sw=arguments[3];sh=arguments[4];dx=arguments[5];dy=arguments[6];dw=arguments[7];dh=arguments[8];}else{throw"Invalid number of arguments";}
var d=this.getCoords_(dx,dy);var w2=sw/2;var h2=sh/2;var vmlStr=[];var W=10;var H=10;vmlStr.push(' <g_vml_:group',' coordsize="',Z*W,',',Z*H,'"',' coordorigin="0,0"',' style="width:',W,';height:',H,';position:absolute;');if(this.m_[0][0]!=1||this.m_[0][1]){var filter=[];filter.push("M11='",this.m_[0][0],"',","M12='",this.m_[1][0],"',","M21='",this.m_[0][1],"',","M22='",this.m_[1][1],"',","Dx='",mr(d.x/Z),"',","Dy='",mr(d.y/Z),"'");var max=d;var c2=this.getCoords_(dx+dw,dy);var c3=this.getCoords_(dx,dy+dh);var c4=this.getCoords_(dx+dw,dy+dh);max.x=Math.max(max.x,c2.x,c3.x,c4.x);max.y=Math.max(max.y,c2.y,c3.y,c4.y);vmlStr.push("padding:0 ",mr(max.x/Z),"px ",mr(max.y/Z),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",filter.join(""),", sizingmethod='clip');")}else{vmlStr.push("top:",mr(d.y/Z),"px;left:",mr(d.x/Z),"px;")}
vmlStr.push(' ">','<g_vml_:image src="',image.src,'"',' style="width:',Z*dw,';',' height:',Z*dh,';"',' cropleft="',sx/w,'"',' croptop="',sy/h,'"',' cropright="',(w-sx-sw)/w,'"',' cropbottom="',(h-sy-sh)/h,'"',' />','</g_vml_:group>');this.element_.insertAdjacentHTML("BeforeEnd",vmlStr.join(""));};contextPrototype.stroke=function(aFill){var lineStr=[];var lineOpen=false;var a=processStyle(aFill?this.fillStyle:this.strokeStyle);var color=a[0];var opacity=a[1]*this.globalAlpha;var W=10;var H=10;lineStr.push('<g_vml_:shape',' fillcolor="',color,'"',' filled="',Boolean(aFill),'"',' style="position:absolute;width:',W,';height:',H,';"',' coordorigin="0 0" coordsize="',Z*W,' ',Z*H,'"',' stroked="',!aFill,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',color,'"',' path="');var newSeq=false;var min={x:null,y:null};var max={x:null,y:null};for(var i=0;i<this.currentPath_.length;i++){var p=this.currentPath_[i];if(p.type=="moveTo"){lineStr.push(" m ");var c=this.getCoords_(p.x,p.y);lineStr.push(mr(c.x),",",mr(c.y));}else if(p.type=="lineTo"){lineStr.push(" l ");var c=this.getCoords_(p.x,p.y);lineStr.push(mr(c.x),",",mr(c.y));}else if(p.type=="close"){lineStr.push(" x ");}else if(p.type=="bezierCurveTo"){lineStr.push(" c ");var c=this.getCoords_(p.x,p.y);var c1=this.getCoords_(p.cp1x,p.cp1y);var c2=this.getCoords_(p.cp2x,p.cp2y);lineStr.push(mr(c1.x),",",mr(c1.y),",",mr(c2.x),",",mr(c2.y),",",mr(c.x),",",mr(c.y));}else if(p.type=="at"||p.type=="wa"){lineStr.push(" ",p.type," ");var c=this.getCoords_(p.x,p.y);var cStart=this.getCoords_(p.xStart,p.yStart);var cEnd=this.getCoords_(p.xEnd,p.yEnd);lineStr.push(mr(c.x-this.arcScaleX_*p.radius),",",mr(c.y-this.arcScaleY_*p.radius)," ",mr(c.x+this.arcScaleX_*p.radius),",",mr(c.y+this.arcScaleY_*p.radius)," ",mr(cStart.x),",",mr(cStart.y)," ",mr(cEnd.x),",",mr(cEnd.y));}
if(c){if(min.x==null||c.x<min.x){min.x=c.x;}
if(max.x==null||c.x>max.x){max.x=c.x;}
if(min.y==null||c.y<min.y){min.y=c.y;}
if(max.y==null||c.y>max.y){max.y=c.y;}}}
lineStr.push(' ">');if(typeof this.fillStyle=="object"){var focus={x:"50%",y:"50%"};var width=(max.x-min.x);var height=(max.y-min.y);var dimension=(width>height)?width:height;focus.x=mr((this.fillStyle.focus_.x/width)*100+50)+"%";focus.y=mr((this.fillStyle.focus_.y/height)*100+50)+"%";var colors=[];if(this.fillStyle.type_=="gradientradial"){var inside=(this.fillStyle.radius1_/dimension*100);var expansion=(this.fillStyle.radius2_/dimension*100)-inside;}else{var inside=0;var expansion=100;}
var insidecolor={offset:null,color:null};var outsidecolor={offset:null,color:null};this.fillStyle.colors_.sort(function(cs1,cs2){return cs1.offset-cs2.offset;});for(var i=0;i<this.fillStyle.colors_.length;i++){var fs=this.fillStyle.colors_[i];colors.push((fs.offset*expansion)+inside,"% ",fs.color,",");if(fs.offset>insidecolor.offset||insidecolor.offset==null){insidecolor.offset=fs.offset;insidecolor.color=fs.color;}
if(fs.offset<outsidecolor.offset||outsidecolor.offset==null){outsidecolor.offset=fs.offset;outsidecolor.color=fs.color;}}
colors.pop();lineStr.push('<g_vml_:fill',' color="',outsidecolor.color,'"',' color2="',insidecolor.color,'"',' type="',this.fillStyle.type_,'"',' focusposition="',focus.x,', ',focus.y,'"',' colors="',colors.join(""),'"',' opacity="',opacity,'" />');}else if(aFill){lineStr.push('<g_vml_:fill color="',color,'" opacity="',opacity,'" />');}else{lineStr.push('<g_vml_:stroke',' opacity="',opacity,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',processLineCap(this.lineCap),'"',' weight="',this.lineWidth,'px"',' color="',color,'" />');}
lineStr.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",lineStr.join(""));this.currentPath_=[];};contextPrototype.fill=function(){this.stroke(true);}
contextPrototype.closePath=function(){this.currentPath_.push({type:"close"});};contextPrototype.getCoords_=function(aX,aY){return{x:Z*(aX*this.m_[0][0]+aY*this.m_[1][0]+this.m_[2][0])-Z2,y:Z*(aX*this.m_[0][1]+aY*this.m_[1][1]+this.m_[2][1])-Z2}};contextPrototype.save=function(){var o={};copyState(this,o);this.aStack_.push(o);this.mStack_.push(this.m_);this.m_=matrixMultiply(createMatrixIdentity(),this.m_);};contextPrototype.restore=function(){copyState(this.aStack_.pop(),this);this.m_=this.mStack_.pop();};contextPrototype.translate=function(aX,aY){var m1=[[1,0,0],[0,1,0],[aX,aY,1]];this.m_=matrixMultiply(m1,this.m_);};contextPrototype.rotate=function(aRot){var c=mc(aRot);var s=ms(aRot);var m1=[[c,s,0],[-s,c,0],[0,0,1]];this.m_=matrixMultiply(m1,this.m_);};contextPrototype.scale=function(aX,aY){this.arcScaleX_*=aX;this.arcScaleY_*=aY;var m1=[[aX,0,0],[0,aY,0],[0,0,1]];this.m_=matrixMultiply(m1,this.m_);};contextPrototype.clip=function(){};contextPrototype.arcTo=function(){};contextPrototype.createPattern=function(){return new CanvasPattern_;};function CanvasGradient_(aType){this.type_=aType;this.radius1_=0;this.radius2_=0;this.colors_=[];this.focus_={x:0,y:0};}
CanvasGradient_.prototype.addColorStop=function(aOffset,aColor){aColor=processStyle(aColor);this.colors_.push({offset:1-aOffset,color:aColor});};function CanvasPattern_(){}
G_vmlCanvasManager=G_vmlCanvasManager_;CanvasRenderingContext2D=CanvasRenderingContext2D_;CanvasGradient=CanvasGradient_;CanvasPattern=CanvasPattern_;})();}
$.fn.createLineGraph=function(tableData,filledLine){var members=tableData.members();var allData=tableData.allData();var dataSum=tableData.dataSum();var topValue=tableData.topValue();var memberTotals=tableData.memberTotals();var xLabels=tableData.xLabels();var yLabels=tableData.yLabels();if($(this).parents('.chartBlock').size()==0)$(this).wrap('<div class="chartBlock" style="position: relative;"></div>');if(!$(this).attr('scalable')){$(this).width($(this).width()/10+'em');$(this).height($(this).height()/10+'em');$(this).attr('scalable','true');}
var xInterval=Math.round($(this).width()/xLabels.length);xInterval+=Math.round(xInterval/xLabels.length+1);var ulID=$(this).attr('id')+'_data';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(xLabels).each(function(){$('#'+ulID).append('<li>'+this+'</li>');});$('#'+ulID+' li').css({'margin':0,'padding':0,'list-style':'none','float':'left','width':xInterval/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'clear':'both'});var yScale=$(this).height()/topValue;var liHeight=$(this).height()/yLabels.length;liHeight+=liHeight/yLabels.length;var ulID=$(this).attr('id')+'_dataY';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(yLabels).each(function(i){$('#'+ulID).prepend('<li>'+this+'</li>');});$('#'+ulID+' li').css({'padding':0,'list-style':'none','height':liHeight/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'position':'absolute','top':0,'text-align':'right','left':'-5em','width':'40px'});var ctx=$(this).get(0);ctx=ctx.getContext('2d');ctx.clearRect(0,0,1000,1000);ctx.save();ctx.translate(0,$(this).height());for(var h=0;h<members.length;h++){ctx.beginPath();ctx.lineWidth='3';ctx.lineJoin='round';var points=members[h].points;var integer=0;ctx.moveTo(0,-Math.round(points[0]*yScale));for(var i=0;i<points.length;i++){ctx.lineTo(integer,-Math.round(points[i]*yScale));integer+=xInterval;}
ctx.strokeStyle=tableData.members()[h].color;ctx.stroke();if(filledLine){ctx.lineTo(integer,0);ctx.lineTo(0,0);ctx.closePath();ctx.fillStyle=tableData.members()[h].color;ctx.globalAlpha=.3;ctx.fill();ctx.globalAlpha=1.0;}
else ctx.closePath();}}
$.fn.createAdditiveLineGraph=function(tableData,filledLine){var members=tableData.members();var allData=tableData.allData();var dataSum=tableData.dataSum();var topValue=tableData.topValue();var memberTotals=tableData.memberTotals();var xLabels=tableData.xLabels();var yLabels=tableData.yLabels();var topYtotal=tableData.topYtotal();var yLabelsAdditive=tableData.yLabelsAdditive();if($(this).parents('.chartBlock').size()==0)$(this).wrap('<div class="chartBlock" style="position: relative;"></div>');if(!$(this).attr('scalable')){$(this).width($(this).width()/10+'em');$(this).height($(this).height()/10+'em');$(this).attr('scalable','true');}
var xInterval=Math.round($(this).width()/xLabels.length);xInterval+=Math.round(xInterval/xLabels.length+1);var ulID=$(this).attr('id')+'_data';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(xLabels).each(function(){$('#'+ulID).append('<li>'+this+'</li>');});$('#'+ulID+' li').css({'margin':0,'padding':0,'list-style':'none','float':'left','width':xInterval/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'clear':'both'});var yScale=$(this).height()/topYtotal;var liHeight=$(this).height()/yLabelsAdditive.length;liHeight+=liHeight/yLabelsAdditive.length;var ulID=$(this).attr('id')+'_dataY';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(yLabelsAdditive).each(function(i){$('#'+ulID).prepend('<li>'+this+'</li>');});$('#'+ulID+' li').css({'padding':0,'list-style':'none','height':liHeight/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'position':'absolute','top':0,'text-align':'right','left':'-5em','width':'40px'});var ctx=$(this).get(0);ctx=ctx.getContext('2d');ctx.clearRect(0,0,1000,1000);ctx.save();ctx.translate(0,$(this).height());for(var h=0;h<members.length;h++){ctx.beginPath();ctx.lineWidth='3';ctx.lineJoin='round';var points=members[h].points;var prevPoints=[];if(members[h+1]){prevPoints=members[h+1].points;}
var nextPrevPoints=[];if(members[h+2]){nextPrevPoints=members[h+2].points;}
var integer=0;ctx.moveTo(0,Math.round(-points[0]*yScale));for(var i=0;i<points.length;i++){var prevPoint=0;var nextPrevPoint=0;if(prevPoints[i])prevPoint=prevPoints[i];if(nextPrevPoints[i])nextPrevPoint=nextPrevPoints[i];ctx.lineTo(integer,Math.round((-points[i]-prevPoint-nextPrevPoint)*yScale));integer+=xInterval;}
ctx.strokeStyle=tableData.members()[h].color;ctx.stroke();if(filledLine){ctx.lineTo(integer,0);ctx.lineTo(0,0);ctx.closePath();ctx.fillStyle=tableData.members()[h].color;ctx.fill();}
else ctx.closePath();}}
$.fn.createPieChart=function(tableData){var members=tableData.members();var allData=tableData.allData();var dataSum=tableData.dataSum();var topValue=tableData.topValue();var memberTotals=tableData.memberTotals();var xLabels=tableData.xLabels();var yLabels=tableData.yLabels();if($(this).parents('.chartBlock').size()==0)$(this).wrap('<div class="chartBlock" style="position: relative;"></div>');if(!$(this).attr('scalable')){$(this).width($(this).width()/10+'em');$(this).height($(this).height()/10+'em');$(this).attr('scalable','true');}
function toRad(integer){return(Math.PI/180)*integer;}
var ctx=$(this).get(0);ctx=ctx.getContext('2d');ctx.clearRect(0,0,1000,1000);ctx.save();var centerx=$(this).width()/2;var centery=$(this).height()/2;var radius=$(this).height()/2-20;ctx.arc(centerx,centery,radius,toRad(0),toRad(360),true);ctx.fillStyle='#ccc';ctx.fill();var counter=0.0;var ulID=$(this).attr('id')+'_data';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'" style="position:absolute; list-style: none; top: -2.5em; left: -3em;"></ul>');$(memberTotals).each(function(i){var fraction=this/dataSum;ctx.beginPath();ctx.moveTo(centerx,centery);ctx.arc(centerx,centery,radius,counter*Math.PI*2-Math.PI*0.5,(counter+fraction)*Math.PI*2-Math.PI*0.5,true);ctx.lineTo(centerx,centery);ctx.closePath();ctx.fillStyle=tableData.members()[i].color;ctx.fill();var sliceMiddle=(counter+fraction/2)
var labelx=centerx+Math.sin(sliceMiddle*Math.PI*2)*(radius/2);var labely=centery-Math.cos(sliceMiddle*Math.PI*2)*(radius/2);if(tableData.showLabels()()){$('#'+ulID).append('<li style="color:#fff; list-style: none !important; font-size: 1.1em; font-weight: bold; position: absolute; left:'+labelx/10+'em; top:'+labely/10+'em;">'+Math.round(fraction*100)+'%</li>');}
counter+=fraction;});}
$.fn.createBarGraph=function(tableData){var members=tableData.members();var allData=tableData.allData();var dataSum=tableData.dataSum();var topValue=tableData.topValue();var memberTotals=tableData.memberTotals();var xLabels=tableData.xLabels();var yLabels=tableData.yLabels();if($(this).parents('.chartBlock').size()==0)$(this).wrap('<div class="chartBlock" style="position: relative;"></div>');if(!$(this).attr('scalable')){$(this).width($(this).width()/10+'em');$(this).height($(this).height()/10+'em');$(this).attr('scalable','true');}
var xInterval=Math.round($(this).width()/xLabels.length);var ulID=$(this).attr('id')+'_data';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(xLabels).each(function(){$('#'+ulID).append('<li>'+this+'</li>');});$('#'+ulID+' li').css({'margin':0,'padding':0,'list-style':'none','float':'left','width':xInterval/10+'em'});$('#'+ulID).css({'margin':0,'padding':0});var yScale=$(this).height()/topValue;var liHeight=$(this).height()/yLabels.length;liHeight+=liHeight/yLabels.length;var ulID=$(this).attr('id')+'_dataY';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(yLabels).each(function(i){$('#'+ulID).prepend('<li>'+this+'</li>');});$('#'+ulID+' li').css({'padding':0,'list-style':'none','height':liHeight/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'position':'absolute','top':0,'text-align':'right','left':'-5em','width':'40px'});var ctx=$(this).get(0);ctx=ctx.getContext('2d');ctx.clearRect(0,0,1000,1000);ctx.save();ctx.translate(0,$(this).height());for(var h=0;h<members.length;h++){ctx.beginPath();var linewidth=Math.round(xInterval/(members.length+1));ctx.lineWidth=linewidth;var points=members[h].points;var integer=0;for(var i=0;i<points.length;i++){ctx.moveTo(Math.round(integer+(h*linewidth)),0);ctx.lineTo(Math.round(integer+(h*linewidth)),Math.round(-points[i]*yScale));integer+=xInterval;}
ctx.strokeStyle=tableData.members()[h].color;ctx.stroke();ctx.closePath();}}
$.fn.createAdditiveBarGraph=function(tableData){var members=tableData.members();var allData=tableData.allData();var dataSum=tableData.dataSum();var topValue=tableData.topValue();var memberTotals=tableData.memberTotals();var xLabels=tableData.xLabels();var yLabels=tableData.yLabels();var topYtotal=tableData.topYtotal();var yLabelsAdditive=tableData.yLabelsAdditive();if($(this).parents('.chartBlock').size()==0)$(this).wrap('<div class="chartBlock" style="position: relative;"></div>');if(!$(this).attr('scalable')){$(this).width($(this).width()/10+'em');$(this).height($(this).height()/10+'em');$(this).attr('scalable','true');}
var xInterval=Math.round($(this).width()/xLabels.length);var ulID=$(this).attr('id')+'_data';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(xLabels).each(function(){$('#'+ulID).append('<li>'+this+'</li>');});$('#'+ulID+' li').css({'margin':0,'padding':0,'list-style':'none','float':'left','width':xInterval/10+'em'});$('#'+ulID).css({'margin':0,'padding':0});var yScale=$(this).height()/topYtotal;var liHeight=$(this).height()/yLabelsAdditive.length;liHeight+=liHeight/yLabelsAdditive.length;var ulID=$(this).attr('id')+'_dataY';$('#'+ulID).remove();$(this).after('<ul id="'+ulID+'"></ul>');$(yLabelsAdditive).each(function(i){$('#'+ulID).prepend('<li>'+this+'</li>');});$('#'+ulID+' li').css({'padding':0,'list-style':'none','height':liHeight/10+'em'});$('#'+ulID).css({'margin':0,'padding':0,'position':'absolute','top':0,'text-align':'right','left':'-5em','width':'40px'});var ctx=$(this).get(0);ctx=ctx.getContext('2d');ctx.clearRect(0,0,1000,1000);ctx.save();ctx.translate(0,$(this).height());for(var h=0;h<members.length;h++){ctx.beginPath();var linewidth=Math.round(xInterval*.8);ctx.lineWidth=linewidth;var points=members[h].points;var prevPoints=[];if(members[h+1]){prevPoints=members[h+1].points;}
var nextPrevPoints=[];if(members[h+2]){nextPrevPoints=members[h+2].points;}
var integer=0;for(var i=0;i<points.length;i++){var prevPoint=0;var nextPrevPoint=0;if(prevPoints[i])prevPoint=prevPoints[i];if(nextPrevPoints[i])nextPrevPoint=nextPrevPoints[i];ctx.moveTo(integer,0);ctx.lineTo(integer,Math.round((-points[i]-prevPoint-nextPrevPoint)*yScale));integer+=xInterval;}
ctx.strokeStyle=tableData.members()[h].color;ctx.stroke();ctx.closePath();}}
$.fn.getTableData=function(chartDimensions){var tableObj=this;var colors=['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#5a3b16','#26a4ed','#f45a90','#e9e744'];var _memlist=false;var tableData={members:function(){if(!_memlist){_memlist=[];tableObj.find('tr:gt(0)').each(function(i){_memlist[i]={};_memlist[i].points=[];_memlist[i].color=$(this).attr("color")||colors[i];$(this).find('td').each(function(){_memlist[i].points.push($(this).text()*1);});});_memlist.reverse();}
return _memlist;},allData:function(){var allData=[];$(this.members()).each(function(){allData.push(this.points);});return allData;},dataSum:function(){var dataSum=0;var allData=this.allData().join(',').split(',');$(allData).each(function(){dataSum+=parseInt(this);});return dataSum},topValue:function(){var topValue=0;var allData=this.allData().join(',').split(',');$(allData).each(function(){if(parseInt(this)>topValue)topValue=parseInt(this);});return topValue;},memberTotals:function(){var memberTotals=[];var members=this.members();$(members).each(function(l){var count=0;$(members[l].points).each(function(m){count+=members[l].points[m];});memberTotals.push(count);});return memberTotals;},yTotals:function(){var yTotals=[];var members=this.members();var loopLength=this.xLabels().length;for(var i=0;i<loopLength;i++){yTotals[i]=[];var thisTotal=0;$(members).each(function(l){yTotals[i].push(this.points[i]);});yTotals[i].join(',').split(',');$(yTotals[i]).each(function(){thisTotal+=parseInt(this);});yTotals[i]=thisTotal;}
return yTotals;},topYtotal:function(){var topYtotal=0;var yTotals=this.yTotals().join(',').split(',');$(yTotals).each(function(){if(parseInt(this)>topYtotal)topYtotal=parseInt(this);});return topYtotal;},xLabels:function(){var xLabels=[];tableObj.find('tr:eq(0) th').each(function(){xLabels.push($(this).html());});return xLabels;},yLabels:function(){var yLabels=[];var chartHeight=chartDimensions.height;var numLabels=chartHeight/30;var loopInterval=Math.round(this.topValue()/numLabels);for(var j=0;j<=numLabels;j++){yLabels.push(j*loopInterval);}
if(yLabels[numLabels]!=this.topValue()){yLabels.pop();yLabels.push(this.topValue());}
return yLabels;},yLabelsAdditive:function(){var yLabelsAdditive=[];var chartHeight=chartDimensions.height;var numLabels=chartHeight/30;var loopInterval=Math.round(this.topYtotal()/numLabels);for(var j=0;j<=numLabels;j++){yLabelsAdditive.push(j*loopInterval);}
if(yLabelsAdditive[numLabels]!=this.topYtotal()){yLabelsAdditive.pop();yLabelsAdditive.push(this.topYtotal());}
return yLabelsAdditive;},showLabels:function(){return $(this).attr("showLabels");}}
if(!$(this).attr('colored')){$(this).find('tr:gt(0) th').each(function(i){$(this).css({'background-color':colors[i]});});$(this).attr('colored','true');}
return tableData;}
$.fgCharting=function(){$('[class^=fgCharting_]').each(function(){var thisClass=$(this).attr('class');var chartClass='';thisClass=thisClass.split(' ');$(thisClass).each(function(){if(this.match('fgCharting_'))chartClass=this;});var chartClass=chartClass.split('_');var chartSrc='';var chartType='';$(chartClass).each(function(){if(this.match('src-'))chartSrc='#'+this.split('-')[1];if(this.match('type-'))chartType=this.split('-')[1];});var chartDimensions={};chartDimensions.width=$(this).width();chartDimensions.height=$(this).height();if($(chartSrc).size()>0&&chartType!=''){var tableData=$(chartSrc).getTableData(chartDimensions);switch(chartType){case'line':$(this).createLineGraph(tableData);break
case'filledLine':$(this).createLineGraph(tableData,true);break
case'additiveLine':$(this).createAdditiveLineGraph(tableData);break
case'additiveFilledLine':$(this).createAdditiveLineGraph(tableData,true);break
case'pie':$(this).createPieChart(tableData);break
case'bar':$(this).createBarGraph(tableData);break
case'additiveBar':$(this).createAdditiveBarGraph(tableData);break}}});}