/*
 * jQuery 1.2.3 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
 * $Rev: 4663 $
 */
(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
selector=[];}}else
return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[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.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;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);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
ret=array.slice(0);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){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
for(var i=0;second[i];i++)first.push(second[i]);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)||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&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.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;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();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:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="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&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(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.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();// Copyright 2004 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product
//reference to global download manager. this is so the onDownloadComplete method knows where to 
//retrieve references to who it is executing the callbacks for
var _DLM = null;

function downloadManager (editorOnLoadCallback)
{					
	//properties	
	this.downloadObjects = new Object ();	
	this.downloadObjectsCreated = 0;
	this.downloadObjectsReturned = 0;
	this.editorOnLoadCallback = editorOnLoadCallback;
	this.returnedIDs = "";
	this.callbackStates = "";	
	this.hasDownloadManagerOnLoadRan = false;
	
	// behaviors are defined, implicitly, in css files. it causes race conditions where the 
	// behavior will not be ready prior to the rest of editor being ready.
	// They are, however, dumb. They don't really have callbacks or any other post-load processing requirements. 
	// Thus, we have to hack on counts to see if they are ready or not.
	this.behaviorsCreated = 0;
	this.behaviorsReturned = 0;
	this.hasBehaviors = false;

	//methods
	this.initDownloadManager = initDownloadManager;
	this.newDownload = newDownload;			
	this.onDownloadComplete = onDownloadComplete;		
	
	this.behaviorDownloadComplete = behaviorDownloadComplete;
	this.downloadManagerOnLoad = downloadManagerOnLoad;

	//fire constructor
	this.initDownloadManager ();

	function initDownloadManager ()
	{
		trace ("downloadManager: Begin initDownloadManager ()");
		
		_DLM = this;
		
		trace ("downloadManager: End initDownloadManager ()");
	}//end of initDownloadManager
					
	function newDownload (id, type, source, callback, hasBehavior, behaviorCount)
	{				
		//setup default behavior count/boolean
		hasBehavior = (hasBehavior == null ? false : hasBehavior);		
		//trace ("downloadManager: Begin newDownload ()" + ((hasBehavior)? " with a behavior":"") );				
		behaviorCount = (behaviorCount == null ? 1 : behaviorCount); //we only use the count if the hasBehvaior is true, hence, the default is one if you don't specify, instead of 0
				
		var newDL = new download (id, type, source, callback, this, hasBehavior);
		this.downloadObjectsCreated++;
		
		if (hasBehavior == true)
		{
			//trace ("downloadManager: newDownload () - this download has a behavior defined");
			this.behaviorsCreated = parseInt (this.behaviorsCreated, 10) + parseInt (behaviorCount, 10);
			//alert (this.behaviorsCreated);
			this.hasBehaviors = true;
		}
		this.downloadObjects [id] = newDL;		
		return newDL;
		
		//trace ("downloadManager: End newDownload ()");//can't get to this line of code :p
	}//end newDownload
	
	function onDownloadComplete ()
	{
		//trace ("downloadManager: Begin onDownloadComplete ()");

		//if we have the event element, we can find out who the callback belongs to
		if (window.event != null && window.event.srcElement != null)
		{					
			//collect state information
			var readyState = window.event.srcElement.readyState;			
			var callerID = window.event.srcElement.id;		
			//need to massage the callerID b/c the xml/xslt use mediator iframes
			if (callerID.indexOf ("mediator") != -1)
			{				
				callerID = callerID.replace ("_mediator", "");
			}			
																	
			//css's final readySate is "complete"
			//js's final readyState is "loaded" if it is NOT in cache. if it is in the cache , the final state is "complete" 
			//xml's final state is "complete" but passes through 3 others so be careful not to call its callback more than once
			//html (iframes) also uses 'complete'	
			var downloadObject = _DLM.downloadObjects [callerID];
			var	downloadType = downloadObject.type;
			var bReady = false;
			switch (downloadType)
			{
				case ("css"):
				case ("xsl"):
				case ("html"):				
					bReady = ((readyState == "complete") ? true : false);
					break;
				case ("xml"):
					bReady = ((readyState == "complete") ? true : false);// && downloadObject.bHasCompletedFirst == true) ? true : false);					
					break;
				case ("js"):
					bReady = ((readyState == "loaded" || readyState == "complete") ? true : false);
					break;				
			}//end switch			
			
			trace ("downloadManager: OnDownloadComplete() <a title=\""+downloadObject.source+"\" target=\"_blank\" href=\"" + downloadObject.source + "\">" + callerID + "'s</a> being checked");				
				
						
			// Yet More microsoft voodoo:  The first readystatechange event fired by a dynamically created XML data island object
			// is complete.  Even though this event is fired the XML data island isn't really completely loaded so we have to ignore
			// this first event and wait for the second time.  That is why we have the HasCompletedFirst boolean
			downloadObject.bHasCompletedFirst = true;			
			
			//if we are ready, we can fire the callback chain
			//check for has completed first because some objects like the xml data island,
			//fire a complete event first before they are actually ready
			if (bReady == true)
			{							
				trace ("downloadManager: OnDownloadComplete() <a title=\""+downloadObject.source+"\" target=\"_blank\" href=\"" + downloadObject.source + "\">" + callerID + "'s</a> data has loaded or is complete");				
				
							
				downloadObject.onDownloadComplete ();
								
				//set the status to loaded
				downloadObject.isLoaded = true;								
				
				//increment the check-in count of objects
				_DLM.downloadObjectsReturned++;
				
				//call the objects callback and let it run				
				if (downloadObject.callback != null)
				{		
					traceColor ("CALLING callback for " + callerID + " " + downloadObject.callback , "orange");			
					downloadObject.callback (callerID);
				}		
				else
				{
					traceColor ("there was no callback for " + callerID, "orange");
				}
				
				//are we ready to call the editor on load?
				_DLM.downloadManagerOnLoad ();		
			}// end of readyState == loaded or complete.
		}// end if event and event.src not null
		else //we are screwed, we can't find out who the event belongs too (there is no src|evetn object
		{
			trace ("downloadManager: In onDownloadComplete() window.event or its' srcElement were empty. Cannot call download's callback as a result");
		}						
		//trace ("downloadManager: End onDownloadComplete ()");	
	}//end on download complete
	
	function behaviorDownloadComplete ()
	{
		trace ("downloadManager: Begin behaviorDownloadComplete () - a behavior is ready");
		
		this.behaviorsReturned++;
		this.downloadManagerOnLoad ();
		
		trace ("downloadManager: End behaviorDownloadComplete ()");
	}//end behaviorDownloadComplete
	
	function downloadManagerOnLoad ()
	{
		trace ("downloadManager: Begin downloadManagerOnLoad (). hasBehaviors = " + _DLM.hasBehaviors + " behaviorsCreated = " + _DLM.behaviorsCreated + " behaviorsReturned = " + _DLM.behaviorsReturned);
		trace ("downloadManager: downloadManagerOnLoad (). downloadsCreated = " + _DLM.downloadObjectsCreated + " downloadsReturned = " + _DLM.downloadObjectsReturned);
		
		//if the number of opened download objects = the number of returned download objects, we can call the editorOnLoadCallback
		// we must also consider external beahvior files. if we have behaviors and if the created count == returned count, we are ready
		if (_DLM.downloadObjectsReturned == _DLM.downloadObjectsCreated && (_DLM.hasBehaviors == false || _DLM.behaviorsCreated == _DLM.behaviorsReturned))
		{
			traceColor ("downloadManger: downloadManagerOnLoad () - editor has finished downloading", "green");
			if (_DLM.hasDownloadManagerOnLoadRan == false && _DLM.editorOnLoadCallback != null)
			{
				trace ("downloadManger: downloadManagerOnLoad () - calling editorOnLoadCallback...");
				_DLM.hasDownloadManagerOnLoadRan = true;
				_DLM.editorOnLoadCallback ();
			} 
			else
			{
				trace ("downloadManger: downloadManagerOnLoad () - editor has no OnLoad Handler defined. Editor is ready!");
			}
		}	

/*		else
		{
			//tracing information to see who hasn't downloaded yet
			trace ("downloadManager: downloadManagerOnLoad () - not all elements/behaviors have returned yet. not calling editorOnLoadCallback.");
			for(var itest in _DLM.downloadObjects)
			{
				if(!_DLM.downloadObjects[itest].isLoaded)
				{
					trace ("downloadManager: downloadManagerOnLoad () - Pending download :" + _DLM.downloadObjects[itest].id);
					if(_DLM.downloadObjects[itest].type == "xml")
					{
						traceColor ("id = " +itest,"blue")
						//traceTextarea ("html", _DLM.downloadObjects[itest].DOMObject.parentElement.parentElement.ownerDocument.getElementById("iframe:"+itest).tagName)//.getElementById("iframe"+itest).outerHTML);
						//traceColor ("type is XML and status = " +  _DLM.downloadObjects[itest].DOMObject.ownerDocument.getElementById("iframe:"+itest).contentWindow.readyState,"blue")
						
						//traceTextarea ("downloadManager: downloadManagerOnLoad () - Pending download", _DLM.downloadObjects[itest].DOMObject.contentWindow.status);
					}//end if type == xml
				}//end if not loaded
			}//end for
		}//end else
*/		
		trace ("downloadManager: End downloadManagerOnLoad ()");
	}//end downloadManagerOnLoad		
}//end of downloadManager definition

function download (id, type, source, callback, DLM, hasBehavior)
{
	//data members
	this.id = id;
	this.type = type;
	this.source = source;				
	this.callback = callback;
	this.DLM = DLM;
	this.DOMObject = null;
	this.mediatorDOMObject = null; // especially for xml/xslt files as a hack around no-cache xml through ssl
	this.isLoaded = false;
	this.hasBehavior = hasBehavior; //especially for CSS files that have htc behaviors connected to them
	this.bHasCompletedFirst = true;
	
	//methods
	this.startDownload = startDownload;
	this.addScript = addScript;
	this.addStyle = addStyle;
	
	this.addHTML = addHTML;
	this.onDownloadComplete = onDownloadComplete;
		
	function startDownload ()
	{
		trace ("download: Begin startDownload () of <a target=\"_blank\" href=\"" + source + "\" title=\"" + source + "\">" + id + "</a> with contentType = " + type + ((hasBehavior)? " and has a behavior":""));		
		
		this.type == null ? "" : this.type.toLowerCase();
		var bCanDownload = true;
		switch (this.type)
		{
			case ("js"):
			case ("javascript"):
				this.addScript ();							
				break;
			case ("css"):
				this.addStyle ();
				break;
			case ("xml"):
			case ("xsl"):
			case ("html"):
				this.addHTML ();
				break;
			default:
				bCanDownload = false;
				break;				
		}//end switch
		
		if (bCanDownload == false)
		{
			trace ("download: startDownload() Could not start the download, unknown type");
		}											
		//trace ("download: End Constructor()");
	}//end of initImportObj method				
	
	function addScript ()
	{
		//trace ("download: Begin addScript() for id =  " +  this.id);
		var script = document.createElement ("script");
		script.id = this.id;
		script.type = "text/javascript";
		script.language = "javascript";
		script.src = this.source;		
		script.attachEvent ("onreadystatechange", this.DLM.onDownloadComplete);
		this.DOMObject = document.all.tags("head")[0].appendChild (script);			

		//trace ("download: addScript() added script to head");
		//trace ("download End addScript()");
	}//end addScript
			
	function addStyle ()
	{
		//trace ("download: Begin addStyle() for id =  " +  this.id);
		var link = document.createElement ("link");	
		link.id = this.id;			
		link.rel = "stylesheet";
		link.type = "text/css";
		link.href = this.source;					
		link.attachEvent ("onreadystatechange", this.DLM.onDownloadComplete);
		this.DOMObject = document.all.tags("head")[0].appendChild (link);	

		//trace ("download: End addStyle()");
	}//end addStyle												
		
	function onDownloadComplete ()
	{
		trace("download:onDownloadComplete change for " + this.id + " with DOMObject.readyState = " + this.DOMObject.readyState)
		//if we are xml or xslt, we need to transfer it to its dom object
		
		this.DOMObject.detachEvent ("onreadystatechange", this.DLM.onDownloadComplete);	
			
		if (this.type == "xml" || this.type == "xsl")
		{
			//traceXml("xml from iframe", this.mediatorDOMObject.contentWindow.document.XMLDocument.xml);
			traceColor ("transferring xmldom from mediator...", "red");
			//traceColor ("xml from mediator = <textarea>" + this.mediatorDOMObject.contentWindow.document.XMLDocument.xml + "</textarea>", "red");
			//this.DOMObject.XMLDocument = this.mediatorDOMObject.contentWindow.document.XMLDocument;					
			try
			{
				//create the dom object that we will transfer the data into after it has loaded from the iframe
				var xmlDataIsland = document.createElement ("xml");
				xmlDataIsland.id = this.id;
				xmlDataIsland.loadXML (this.DOMObject.contentWindow.document.XMLDocument.xml);
				this.DOMObject = document.getElementById ("dataIslandHolder").appendChild(xmlDataIsland);	
				
				traceXml("xml download objects dom object", this.DOMObject.xml);
			}	
			catch (e)
			{
				traceColor (this.id + ": An error occurred: = " + e.message, "red");
				traceColor ("It is likely that the stylesheet or xml document in question has NOT changed the content headers to 'text/xml'", "red");
				traceColor ("To rectify: include /adx/include/content_type_xml.inc before the caching code", "red");
			}
		
		}
		
			
	}//end of prepareXML
	
	function addHTML ()
	{
		//you cannot set the source of the iframe. This is another retarded nuance of IE. We are
		//inserting multiple iframe elements. On refresh, all of the iframes would point at the same
		//source (the first iframe in the list). After a great deal of stabbing in the dark for a fix, 
		//i found that this (setting the location instead) worked. who knows, maybe we are lucky that there are 52 ways to accomplish
		//the same thing in IE.
		//trace ("download: Begin addHTML () for id =  " +  this.id);
		
		var appendAppIdToQuerylessAspxDownloads = function(href) {
		
			// Don't modify and hrefs that aren't other.aspx
			if (!(href.match(/\other.aspx$/))) return href;
			
			// Get the querystring, sans leading '?'
			var query = location.search.substring(1, location.search.length);
			
			var params = {};
			
			// Turn '+' back into <space>
			query = query.replace(/\+/g, ' ')
			
			var args = query.split('&');
			
			// Parse out the name/value pairs
			for (var i = 0; i < args.length; i++) {
				var pair  = args[i].split('=');
				var name  = unescape(pair[0]);
				var value = (pair.length > 1) ? (value = unescape(pair[1])) : null;
				
				params[name] = value;
			}
			
			var appId = params['AppID'];
			var mode = params['Mode'];
			
			// If we don't have an AppID, just return the original href
			if (!(appId && mode)) return href;
			
			return href + '?AppID=' + appId + '&Mode=' + mode;
		}
		
		var frame = document.createElement ("iframe");		
		frame.name = this.id;
		frame.id = this.id;
		frame.src = appendAppIdToQuerylessAspxDownloads(this.source);
		frame.style.display = "none";
		frame.attachEvent ("onreadystatechange", this.DLM.onDownloadComplete);		
		this.DOMObject = document.getElementById ("iframeHolder").appendChild (frame);
		
		
		//trace ("download: End addHTML ()");
	}//end addHTML	
}//end of Import Object Definition	
// Copyright 2004 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product

function editorElement (id, type, height, DLM, cssClass)
{
	//element variables
	this.id = id;
	this.type = type;
	this.height = height;
	this.DLM = DLM;				
	this.className = cssClass;	
	this.imports = new Array ();	
	this.importCount = 0;
	this.tabBodies = new Array ();		
	this.tabBodyCount = 0;
	this.bHasTabBodies = false;
	
	//element section variables
	this.sections = new Array ();
	this.bHasSection = false;
	
	//stylesheet variables
	this.bHasStylesheet = false;
	this.oStylesheetDownload = null;
	this.bStylesheetIsReady = false;
	this.oStylesheetDOMObject = null;
	
	//content variables
	this.oContentContainer = null;
	this.oTabBodiesContainer = null;	//only used for the tabset element	
	this.oContentDownload = null;
	this.oContentDOMObject = null;
	this.contentType = "xml";
	this.bContentIsExternal = true;
	this.bContentIsReady = false;
		
	//methods
	this.transform = transform;
	this.initEditorElement = initEditorElement;
	this.initImports = initImports;
	this.initContent = initContent;
	this.initTabBodies = initTabBodies;
	this.initStylesheet = initStylesheet;
	this.startDownloads = startDownloads;
	this.buildSection = buildSection;
	this.buildSections = buildSections;
	this.cleanSections = cleanSections;
	
	//fire constructor
	this.initEditorElement ();
	
	function initEditorElement ()
	{
		trace ("editorElement: Being initEditorElement () for id = " + this.id);
		
		// default constructor... sort of
		if(this.id == null)
		{
		    return;
		}
		
		// the real constructor logic follows here
		this.oContentContainer = getNewDiv (this.id);
		if (this.className != null && this.className != "")
		{			
			this.oContentContainer.className = cssClass;
		}
		
		this.oContentContainer = document.getElementById ("editorBody").appendChild (this.oContentContainer);	
		if (this.type.toLowerCase () == "tabset")
		{
			this.oTabBodiesContainer = getNewDiv ("tabBodies");
			this.oTabBodiesContainer.className = "TabBodyContainer";
			this.oTabBodiesContainer = document.getElementById ("editorBody").appendChild (this.oTabBodiesContainer);
		}	
		
		trace ("editorElement: End initEditorElement ()");
	}//end of init
		
	function startDownloads (contentCallback, stylesheetCallback)	
	{			
	
		trace ("startDownloads: Start startDownloads ()");	
		if (this.oContentDownload == null && this.oStylesheetDownload == null)
		{
			//both downloads are null which means we can transform right away
			this.transform ();			
		}
		else //one or both of the downloads must be started
		{
			if (this.oContentDownload != null)
			{
				this.oContentDownload.callback = contentCallback;
				this.oContentDownload.startDownload ();		
			}
			
			if (this.oStylesheetDownload != null)
			{
				this.oStylesheetDownload.callback = stylesheetCallback;
				this.oStylesheetDownload.startDownload ();
			}
		}//end else		
		
		trace ("startDownloads: End startDownloads ()");	
	}//end of startDownloads

	function initImports (importNodes, callback)
	{
		trace ("editorElement: Begin initImports ()");
		
		if (importNodes != null)
		{
			trace ("element " + this.id + " has " + importNodes.length + " import(s)");
			for (var nodeIndex = 0; nodeIndex < importNodes.length; nodeIndex++)
			{				
				var importNode = importNodes [nodeIndex];
				var importType = importNode.getAttribute ("Type"); 
				var importSrc = importNode.getAttribute ("Source");
				var importID = importNode.getAttribute ("ID");
				importID = (importID == null ? this.id + "_import_" + this.importCount : importID);
				var importObject = DLM.newDownload (importID, importType, importSrc, callback);					
				this.imports [importID] = importObject;	
				importObject.startDownload ();
				this.importCount++;
			}//end for
		}//end of importNodes != null
		else
		{
			trace ("element " + this.id + " has no import section");
		}
				
		trace ("editorElement End initImports ()");
	}//end of initImports

	function initContent (contentNode, bIsTabBody)
	{
		trace ("editorElement: Begin initContent()");
		
		/*if(document.getElementById("Menubar_content") != null)
			trace("XML FOR MENUBAR IS HERE AT START OF INIT FOR" + this.id + " \n\n"  + document.getElementById("Menubar_content").xml);*/
		
		if (contentNode != null)
		{
			//set up the element's content type
			var contentType = contentNode.getAttribute ("Type");
			contentType = ((contentType == null || contentType == "") ? "xml" : contentType); //assume xml
			this.contentType = contentType;
						
			//set up the content's src
			var contentSrc = contentNode.getAttribute ("Source"); 
			contentSrc = (contentSrc == null ? "" : contentSrc);			
			this.bContentIsExternal = (contentSrc == "" ? false : true);	
			
			//set up shared label
			var contentLabel = this.id + "_content";
			
			if (this.bContentIsExternal == true)
			{
				trace ("editorElement: initContent() element has external XML data");
				//if we have external data, spark up a newDownload				
				this.oContentDownload = this.DLM.newDownload (contentLabel, this.contentType, contentSrc, null);
			}
			else
			{				
				trace ("editorElement initContent() content is not in an external file");
				
				if (contentType == "xml")
				{
					//need to get the data out of the file
					var xmlDataIsland = document.createElement ("xml");
					xmlDataIsland.id = contentLabel;				
					/**	
					we are using the first child node here as the content, assuming that the first child node is in fact the root
					of the content. I can't see a reason why this is a bad assumption b/c then the other nodes could be different content,
					like the case of a tabset.
					*/
					xmlDataIsland.loadXML (contentNode.childNodes(0).xml);
					xmlDataIsland = document.getElementById ("dataIslandHolder").appendChild (xmlDataIsland);
					
					this.oContentDOMObject = xmlDataIsland;					
				}
				else if (contentType == "html")
				{
					//there is technically no reason for this element to have a contentDOMObject b/c it is already present.
					//ordinarily, the DOM Object would have been responsible for downloading the item. not this time around.
					this.oContentDOMObject = this.oContentContainer;
					this.oContentContainer.innerHTML = contentNode.childNodes(0).xml;
				}
				
				// needed to initialize the menubar if the content is in-line
				contentCallback(contentLabel);
				
				//for all non-external content, we must set the content is ready to be true b/c
				//we dont have to wait for it to download.
				this.bContentIsReady = true;
			}//end if non-external content				
			
			//trace ("elementEditor: initContent () element type = " + this.type);
			if (this.type == "tabset")
			{				
				//if this is a tabset, we need to force it to take up as little amount of space possible.
				//if we don't 
				this.oContentContainer.style.height = "1px";				
				var tabBodies = contentNode.selectNodes ("TabBodies/TabBody");
				trace ("there are " + tabBodies.length + " tab bodies");
				if (tabBodies.length > 0)
				{
					this.bHasTabBodies = true;
					this.initTabBodies (tabBodies);
				}
			}			
			
			// we need to check and see if there are section nodes. anything can have one or more sections
			var sectionNodes = contentNode.selectNodes ("Section");
			trace ("editorElement: initContent () - this element has " + sectionNodes.length + " sections");
			traceXml ("editorElement: initContent () - content node xml = ",contentNode.xml );
			if (sectionNodes != null && sectionNodes.length > 0)
			{					
				for (var sectionIndex = 0; sectionIndex < sectionNodes.length; sectionIndex++)
				{
					var sectionNode = sectionNodes [sectionIndex];
					var sectionSourceID = sectionNode.getAttribute ("SourceID");
					var sectionDestinationID = sectionNode.getAttribute ("DestinationID");
					var sectionXMLPath = sectionNode.getAttribute ("XMLPath");
					var sectionIsMultiLingual = sectionNode.getAttribute ("IsMultiLingual")
					var sectionIsProviderAttribute = sectionNode.getAttribute ("IsProviderAttribute")
															
					if (sectionSourceID != null && sectionDestinationID != null && sectionXMLPath != null)
					{
						this.sections [sectionIndex] = new editorSection (sectionSourceID, sectionDestinationID, sectionXMLPath, sectionIsMultiLingual, sectionIsProviderAttribute);
						this.bHasSection = true;
					}
					else
					{
						trace ("editorElement: initContent () - error creating section. one of SourceID, DestinationID or XMLPath attributes were missing");
					}
				}//end for
			}//end if sectionNode != null				
			
		}//end of contentNode != null
		else
		{
			trace ("element " + this.id + " has no content.");
		} 		
		
		/*if(document.getElementById("Menubar_content") != null)
			trace("XML FOR MENUBAR IS HERE AT END OF INIT FOR" + this.id + " \n\n"  + document.getElementById("Menubar_content").xml);*/
			
		trace ("editorElement: End initContent()");
	}//end of initContent
	
	function initTabBodies (tabBodies)
	{
		trace ("editorElement Begin initTabBodies ()");
		 
		//this.initImports (tabBodies, tabBodyOnDownloadComplete);
		for (var tabBodyIndex = 0; tabBodyIndex < tabBodies.length; tabBodyIndex++)
		{
			var tabBodyNode = tabBodies [tabBodyIndex];															
			
			var type = tabBodyNode.getAttribute ("Type");			
			type = (type == null ? "" : type.toLowerCase()); //sets default type to empty string
			var tabID = tabBodyNode.getAttribute ("ID");			
			tabID = (tabID== null ? this.id + "_tab_body_" + this.tabBodyCount : tabID); //if no ID is provided, assign a unique one	
			this.tabBodyCount++;																															
			
			traceColor ("initTabBodies created another editorElement","blue");
			var tabBody = new editorElement (tabID, type, null, this.DLM);					
			
			this.tabBodies [tabID] = tabBody;	
								
			traceColor ("initTabBodies created another initContent","blue");			
			tabBody.initContent (tabBodyNode, true);
			
			traceColor ("initTabBodies created another startDownloads","blue");
			tabBody.startDownloads (tabBodyOnDownloadComplete,null);
			
			
		}//end for
		
		trace ("editorElement End initTabBodies ()");
	}//end of initTabBodies
	
	function tabBodyOnDownloadComplete (callerID)
	{
		traceColor ("editorElement: Begin tabBodyOnDownloadComplete () for tab body id = " + callerID,"blue");
		window.event.cancelBubble = true;
		//get the DOMObject for this tab body, pilfer its content, add it to a container (div)
		//and then add it after the tab element that the body corresponds to
		var elementID = stripEverythingAfterUnderscore (callerID);		
		var iframe = document.getElementById (callerID);						
		var tabBodyContent = iframe.contentWindow.document.all.tags ("body")[0].innerHTML;
		//var tabBodyDivLabel = callerID + "_tabBody_div";
		//var div = document.createElement ("div");
		//div.id = tabBodyDivLabel;
		//div.style.visibility = "hidden";
		//div.innerHTML = tabBodyContent;
		var tabBodiesDiv = document.getElementById ("tabBodies");
		tabBodiesDiv.insertAdjacentHTML ("beforeEnd", tabBodyContent);	
		window.status = "";
		
		trace ("editorElement: End tabBodyOnDownloadComplete ()");
	}//end of tabBodyCallback	
	
	function initStylesheet (stylesheetNode)
	{		
		//determine if we have a stylesheet. currently there is no support for inline stylesheets
		var bHasNode = (stylesheetNode == null ? false : true);
		if (bHasNode == true)
		{
			var source = stylesheetNode.getAttribute ("Source");
			if (source == null || source == "")
			{
				this.bHasStylesheet = false;
			}
			else
			{
				this.bHasStylesheet = true;
			}
		}
		else
		{
			this.bHasStylesheet = false;
		}
		
		// if we have a stylesheet, we need to spark up a download(er) for it
		if (this.bHasStylesheet)
		{
			var stylesheetLabel = this.id + "_stylesheet";
			this.oStylesheetDownload = this.DLM.newDownload (stylesheetLabel, "xsl", source, null);			
		}		
	}//end of stylesheet node

	function transform ()
	{
		//trace ("editorElement: Begin editorElement transform() for elementID = " + this.id);
		traceColor ("editorElement: Begin editorElement transform() for elementID = " + this.id + " : contentType = " + this.contentType + " : bContentIsReady = " + this.bContentIsReady + " : bStylesheetIsReady " + this.bStylesheetIsReady,"navy");
		
		//and if we have a stylesheet and it is ready
		//and if we have xml, and it is ready
		if (this.contentType == "xml" && this.bContentIsReady == true && this.bStylesheetIsReady == true)
		{	
			//trace ("xsl data = " + this.oStylesheetDOMObject.xml);
			traceXml ("xsl data = ", this.oStylesheetDOMObject.xml);			
			traceXml ("xml data = ", this.oContentDOMObject.xml);			
			//window.clipboardData.setData ('text', );
			
			oStylesheet = new adxStylesheet (this.oStylesheetDOMObject.xml, true);
			var bTransformSuccessful = true;
			var transformedContent = null;
			try
			{	
				transformedContent = oStylesheet.Transform (this.oContentDOMObject);
			}
			catch (e)
			{
				trace ("editorElement: transform() Could not transform data. error message = " + e.message);
				bTransformSuccessful = false;
			}
			
			if (bTransformSuccessful == true)
			{
				traceTextarea (this.id + ": transform() Transform successful\n", transformedContent);
				this.oContentContainer.innerHTML = transformedContent;
			}												
		}//end of contentType == "xml" and all pieces are ready
		else if (this.contentType == "html")
		{
			//we expect the oContentDOMObject for 'html' to be an iframe
			if (this.bContentIsExternal == true)
			{
				this.oContentContainer.innerHTML += this.oContentDOMObject.contentWindow.document.body.innerHTML;
			}
			//else, if it is html and it is not external, there can be no transform. it has been added to the dom already.
		}	
		
		trace ("editorElement: End editorElement transform()");
	}//end of transforum
	
	function buildSection(oSection, oNodes, iNumNodes, oParent, oTemplate)
	{	    
		var sError = "";
		
		if(!oParent)
		{
			sError += "Could not find requested element '"+ oSection.DestinationID +"'\n"
			sError += "It does not appear to exist in the DOM for this page.\n\n"
			
		}
		if(!oTemplate)
		{
			sError += "Could not find requested element '"+ oSection.SourceID +"'\n"
			sError += "It does not appear to exist in the DOM for this page.\n\n"
		}
		
		
		if(sError != "")
		{
			if (!oSection.IsProviderAttribute)
			{
				alert("ERROR in function buildSections()\n\n"+ sError +"Sections of this document may not be displayed.");
			}
			
			return;
		}		
		
		var re = new RegExp ("%i%", "gi");
		var i = 1;
		
		for(i ; i <= iNumNodes ; i++)
		{	
			var sHTML = null;
			
			// if the node exists try creating the html element using the "Number" attribute instead of just auto
			// incrementing, if the number attribute can't be found, then just the auto-incremented number
			if(oNodes != null && oNodes.length > i - 1)
			{					
				var iNumber = oNodes[i - 1].getAttribute("Number");
				
				if(iNumber != null)
				{
					sHTML = oTemplate.outerHTML.replace(re,iNumber);
				}
				else
				{
					sHTML = oTemplate.outerHTML.replace(re,i);
				}
			}//end if(oNodes != null)			
			else
			{
				sHTML = oTemplate.outerHTML.replace(re,i);   
			}
				
			trace("Built section [" + i + "] with number [" + iNumber + "] and with the template [" + oTemplate.id + "]");
			oParent.insertAdjacentHTML ("beforeEnd", sHTML);
			window.status = "";
		}//end for each node to create			
	}//end buildSection
	
	
	function buildSections (oDataXML)
	{	
		trace ("editorElement: Begin buildSections ()");
		
		for (var sectionIndex = 0; sectionIndex < this.sections.length; sectionIndex++)
		{		
			var iNumNodes = 1;//this is the default value. if there are no nodes, we add one for sure.
			var oNodes = null;
			
			if(this.sections[sectionIndex].IsMultiLingual == false)
			{
			    trace("buildSections - We have a MONO-LINGUAL section!");
				if (oDataXML != null)
				{//oDataXML is not null. there can be 0 or more sections to build
					// retrieve the nodes so they can be counted
					oNodes = oDataXML.selectNodes(this.sections [sectionIndex].XMLPath);		
					iNumNodes = (oNodes.length == 0) ? iNumNodes : oNodes.length;													
				}											
				
				var sError = "";
						    
				// builds the required number of sections on editor load.
				var oParent = document.getElementById(this.sections [sectionIndex].DestinationID);
				var oTemplate = document.getElementById(this.sections [sectionIndex].SourceID);
			    
				this.buildSection(this.sections[sectionIndex],oNodes, iNumNodes, oParent, oTemplate);
		    }
		    else
		    {	
		        trace("buildSections - We have a MULTI-LINGUAL section [" + this.sections [sectionIndex].SourceID + "]");
				var re = new RegExp ("%Language%", "gi");
			
				// remove the %Language% compenent from the source
				var langFreeSourceID = this.sections [sectionIndex].SourceID.replace(re, "");
				trace("langFreeSourceID = " + langFreeSourceID);				
				
				// because IE must use the span collection it returns from getElementsByTagName
				// internall, we need to record all the changes that need to be made first,
				// then make.  Otherwise we get stuck in an endless loop
				// Ryan - January 26, 2005 
				var spansToChange = new Array();								
				
				// Cam [2005/08/03]
				// referencing this global like this makes me ill. I had it as a member var but
				// it kept being reset to null for no appearnt reason. After tracking it for over
				// an hour, it finally just became a global reference
				for(var key in _editorLangs)
				{
				    trace("_editorLangs[" + key + "] = " + _editorLangs[key] );
				    var CurSpan = document.getElementById( _editorLangs[key] + langFreeSourceID); 
				    if(CurSpan != null)   
				    {
				        spansToChange[spansToChange.length] = CurSpan;
				        trace("&nbsp; &nbsp; adding span [" + CurSpan.id + "]")
				    }
				    else
				    {
				        trace("&nbsp; &nbsp; can't find [" + _editorLangs[key] + langFreeSourceID + "]")
				    }
				}//for each language				
				
				trace("spansToChange.length = " + spansToChange.length);
					
				// make all the changes that need to be made
				for(var spanIndex = 0; spanIndex < spansToChange.length; spanIndex++)
				{	
					var sourceIndex = spansToChange[spanIndex].id.indexOf(langFreeSourceID)
					var sLanguage = spansToChange[spanIndex].id.substring(0, sourceIndex);
					
					oNodes = null;
					
					var iNumSectionToBuild = 1;
					
					if (oDataXML != null)
					{//oDataXML is not null. there can be 0 or more sections to build										    
						
						// calculate a new xmlPath
						trace("original XPath [" + this.sections [sectionIndex].XMLPath + "] Language = [" + sLanguage + "]")
						var sXmlPath = this.sections [sectionIndex].XMLPath.replace(re, sLanguage);												
						
						// retrieve the nodes so they can be counted
						oNodes = oDataXML.selectNodes(sXmlPath);		
						iNumSectionToBuild = (oNodes.length == 0) ? 1 : oNodes.length;												
						
						trace("We have data. New XPath = [" + sXmlPath + "]");
						trace("We found [" + oNodes.length + "] with that XPath");
						traceXml("oDataXML", oDataXML.xml)
					}//We have Data											
													
					// builds the required number of sections on editor load.
					var oParent = document.getElementById(this.sections[sectionIndex].DestinationID.replace(re, sLanguage));
					var oTemplate = spansToChange[spanIndex];
					
					buildSection(this.sections[sectionIndex], oNodes, iNumSectionToBuild, oParent, oTemplate);
					
					trace("Completed Building " + sLanguage);
				}//end of foreach span change in the document
		    }//end of else this editor is multilingual
			
		}//end for		
	
		trace ("editorElement: End buildSections ()");
	}//end of buildSections
	
	function cleanSections ()
	{	
		trace ("editorElement: Begin cleanSections ()");
		
		for (var sectionIndex = 0; sectionIndex < this.sections.length; sectionIndex++)
		{	
			if(this.sections[sectionIndex].IsMultiLingual == false)
			{		 
				// builds the required number of sections on editor load.
				var oParent = document.getElementById(this.sections [sectionIndex].DestinationID);
				
				var sError = "";
				if(!oParent)
				{
					sError += "Could not find requested element '"+ this.sections [sectionIndex].DestinationID +"'\n"
					sError += "It does not appear to exist in the DOM for this page.\n\n"
					
				}
				if(sError != "")
				{
					alert("ERROR in function cleanSections()\n\n"+ sError +"Sections of this document may not be displayed.");
					return;
				}	
				trace ("eliminating inner html of id = '" + oParent.id + "'");
				oParent.innerHTML = "";
			}
			else
			{
				trace("buildSections - We have a MULTI-LINGUAL section!");
				var re = new RegExp ("%Language%", "gi");
				
				// remove the %Language% compenent from the source
				var langFreeSourceID = this.sections [sectionIndex].SourceID.replace(re, "");
				trace("langFreeSourceID = " + langFreeSourceID);
				
				// currently we are only providing support for Span elements
				var aSpans = document.getElementsByTagName("span");
				
				// because IE must use the span collection it returns from getElementsByTagName
				// internall, we need to record all the changes that need to be made first,
				// then make.  Otherwise we get stuck in an endless loop
				// Ryan - January 26, 2005 
				var spansToChange = new Array();
				
				// search all spans for possible sections
				for(var spanIndex = 0; spanIndex < aSpans.length; spanIndex++)
				{	
					// if the SourceID didn't occur at the start of the ID name, this 
					// is hopefully a language section
					var sourceIndex = aSpans[spanIndex].id.indexOf(langFreeSourceID)
					if(sourceIndex > 0)
					{
						spansToChange[spansToChange.length] = aSpans[spanIndex];
					}		
				}
				
				trace("spansToChange.length = " + spansToChange.length);
					
				// make all the changes that need to be made
				for(var spanIndex = 0; spanIndex < spansToChange.length; spanIndex++)
				{	
					var sourceIndex = spansToChange[spanIndex].id.indexOf(langFreeSourceID)
					var sLanguage = spansToChange[spanIndex].id.substring(0, sourceIndex);
					
					// retrieve the parent span to clear out
					var oParent = document.getElementById(this.sections[sectionIndex].DestinationID.replace(re, sLanguage));
							
					var sError = "";
					if(!oParent)
					{
						sError += "Could not find requested element '"+ this.sections [sectionIndex].DestinationID +"'\n"
						sError += "It does not appear to exist in the DOM for this page.\n\n"
						
					}
					if(sError != "")
					{
						alert("ERROR in function cleanSections()\n\n"+ sError +"Sections of this document may not be displayed.");
						return;
					}	
					
					if(oParent.innerHTML != "")
					{	
						//alert(oParent.innerHTML);
						trace ("eliminating inner html of id = '" + oParent.id + "'");
						oParent.innerHTML = "";
					}
				}
			} //end multilingual 
		}//end for		
	
		trace ("editorElement: End cleanSections ()");
	}//end of cleanSections
	
	
	/*static*/
	//helper function that returns a new, hidden and 100% wide div	
	function getNewDiv (sID)
	{
		var div = document.createElement ("div");
		div.setAttribute ("id", sID);
		//div.style.visibility = "hidden";	
		//if (bDebug) div.style.visibility = "visible";
		//div.style.width = "100%";		
		//if (bDebug) { div.style.borderColor = "black"; div.style.borderWidth = "1px"; div.style.borderStyle = "solid";}				
		return div;					
	}//end of getNewDiv				
}//end of editorElement obj

//editor section is simply an aggregation object
function editorSection (SourceID, DestinationID, XMLPath, IsMultiLingual, IsProviderAttribute)
{
	this.SourceID = SourceID;
	this.DestinationID = DestinationID;
	this.XMLPath = XMLPath;
	this.IsMultiLingual = (IsMultiLingual != null && IsMultiLingual.toLowerCase() == "true" ? true : false);
	this.IsProviderAttribute = IsProviderAttribute;
}//end of editorSection obj definition
// Copyright 2004 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product
var instantiatorLocations = new Array ();
	instantiatorLocations ["nocache"] = "/adx/admin/editors/framework/instantiators/instantiator_nocache.aspx";
	instantiatorLocations ["cache"] = "/adx/admin/editors/framework/instantiators/instantiator_cache.aspx";
	instantiatorLocations ["Init"] = "/adx/admin/editors/framework/instantiators/get_config.aspx";
	instantiatorLocations ["Load"] = "/adx/admin/editors/framework/instantiators/load_data.aspx";
	instantiatorLocations ["Post"] = "/adx/admin/editors/framework/instantiators/post_data.aspx";
	
function editorService (serviceNode)
{
	//local data members
	this.xml = serviceNode;
	this.action = "";
	this.FQN = "";
	this.assembly = "";
	this.instantiator = instantiatorLocations ["nocache"];
	this.parameters = null;
	
	//operations
	this.editorServiceInit = editorServiceInit;
	this.addParameter = addParameter;
	this.removeParameter = removeParameter;
	this.clearParameters = clearParameters;
	this.toQuery = toQuery;
	this.toActionWithQuery = toActionWithQuery;
	this.toFullQuery = toFullQuery;
	this.hasParameters = hasParameters;
	this.getParameter = getParameter;
	
	//fire contstructor
	this.editorServiceInit ();
	
	function editorServiceInit ()
	{		
		this.action = this.xml.getAttribute ("Action");
		this.FQN = this.xml.getAttribute ("FQN");
		this.assembly = this.xml.getAttribute ("Assembly");
				
		//if there is one defined in the config file, override the default nocache
		var instantiator = this.xml.getAttribute ("Instantiator");
		if (instantiator != null)
		{
			this.instantiator = instantiator;
		}
		else
		{
			//hash the action against known instantiators. use it if we find one
			var instantiatorLocation = instantiatorLocations [this.action];
			if (instantiatorLocation != null && instantiatorLocation != "")
			{
				this.instantiator = instantiatorLocation;
			}
		}
		
		var parameterNodes = this.xml.selectNodes ("Parameter");		
		
		this.parameters = new Array ();
		for (var index = 0; index < parameterNodes.length; index++)
		{
			this.parameters [index] = new parameter (parameterNodes[index]);
		}//end for
	}//end editorServiceInit
	
	function hasParameters ()
	{
		var bHasParameters = false;
		if (this.parameters != null)
		{
			bHasParameters = true;
		}
		return bHasParameters;
	} //end of hasParameters
	
	function addParameter (name, value)
	{
		// create parameter node, append it to the xml
		var parameterNode = new adxXMLDOM();
		parameterNode.loadXML("<Parameter/>");
		parameterNode.documentElement.setAttribute("Name", name);
		parameterNode.documentElement.setAttribute("Value", value);
		
		// add the parameter
		this.parameters[this.parameters.length] = new parameter(parameterNode.documentElement);	
	}//end addParameter
	
	function getParameter (key)
	{		
		for (var keyIndex = 0; keyIndex < this.parameters.length; keyIndex++)
		{
			var parameter = this.parameters [keyIndex];
			if (parameter.name.toLowerCase () == key.toLowerCase ())
			{
				return parameter;
			}
		}//end of for
		
		return null;
	}//end of get parameter
	
	//removes a given parameter from the query string
	function removeParameter(name)
	{		
		var i;
		for(i = 0; i < this.parameters.length; i++)
		{
			if(this.parameters[i].name == name)
			{
				this.parameters.splice(i,1);
				break;
			}
		}//end for
	}//end removeParameter	
	
	function clearParameters()
	{
		while(this.parameters.length > 0)
		{
			this.parameters.pop();
		}
	}//end clear parameters
	
	function toQuery (bIncludeAction)
	{
		trace ("editorService - Begin toQuery () for - " + this.action);
		
		if(bIncludeAction == null)
		{
			bIncludeAction = true;
		}
		
		var queryString = "";
		queryString = "FQN=" + this.FQN;
		if (this.assembly != null && this.assembly != "")
		{
			queryString += "&Assembly=" + this.assembly;
		}
		
		if (bIncludeAction == true && this.action != null && this.action != "")
		{
			queryString += "&Action=" + this.action;
		}
		
		for (var index = 0; index < this.parameters.length; index++)
		{
			queryString += "&" + this.parameters [index].name + "=" + this.parameters [index].value;
		}//end for
		
		trace ("editorService - end toQuery () " + queryString);
		return queryString;
	}//end of toQuery
	
	function toActionWithQuery (bIncludeAction)
	{
		var queryString = this.toQuery (bIncludeAction);
		return this.instantiator + ((this.instantiator.indexOf("?") != -1)?"&":"?") + queryString;
	}//end toActionQuery
	
	function toFullQuery (bIncludeAction)
	{
		return this.toActionWithQuery (bIncludeAction);
	}//end of toFullQuery
}//end editorService definition

//aggregation object. wraps up a "parameter"
function parameter (parameterNode)
{
	this.xml = parameterNode;
	this.name = parameterNode.getAttribute ("Name");
	this.value = parameterNode.getAttribute ("Value");
}//end of paramter class definition
//<script language="javascript">
<!--
// Copyright 2004 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product
function trace (sMessage) 
{ 
	//window.status = "bDebug = " +bDebug
	var _tracewindow = null;
	if(_traceActive)
	{
		var _window = window
		var _top = window.top
		
		//if there is top trace window just use it.
		_tracewindow = _top.traceWindow
		
		var i = 0
		while(_tracewindow == null && _window != _top && i < 10)
		{
			if(_window.traceWindow != null)
			{
				_tracewindow = _window.traceWindow
				break;
			}
			i++
			_window = _window.parent;
			
		}
		
		if(_tracewindow == null)
		{
			_window.traceWindow = _tracewindow = traceWindow = window.open ("/adx/admin/editors/framework/trace.htm", "traceWindow", "width=1000, height=700, resizable=1");	
			
		}
		
		
		
		if (_tracewindow)
		{
			
			_tracewindow.focus();
			var traceTextarea = getDebugTraceTextarea (_tracewindow);
			if (traceTextarea != null)
			{			
				try
				{
                 
                    if(traceTextarea.document.styleSheets.length == 0)
                    {
                         traceTextarea.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"/adx/admin/editors/framework/trace.css\">")
                    }
					traceTextarea.document.writeln("<table id=table><tr><td id=col1>"+Time() +"</td><td id=col2>"+sMessage + "</td></tr></table>")
		
                    if(_tracewindow.document.all.autoscroll != null && _tracewindow.document.all.autoscroll.checked)
                    {
					    traceTextarea.window.scrollTo(0,traceTextarea.window.document.body.scrollHeight)
				    }
				}
				catch(e)
				{
					
				}
			}//end if textarea != null
		}//end if there is a trace window
	}						
}//end of trace

function Time()
{
    var today=new Date()
    var h=today.getHours()
    var m=today.getMinutes()
    var s=today.getSeconds()
    var ms=today.getMilliseconds()
    return "<i>"+ h+":"+m+":"+s+":"+ms +"</i>";
}

function traceTextarea (sMessage,sXML) 
{ 
	trace("<div>"+sMessage + "</div>\n<textarea style=\"width:100%;height:150px;\">" + sXML + "</textarea>");							
}//end of trace

function traceXml(sMessage,sXML) 
{ 
	// the user has selected a node (in another frame)
	
    trace(sMessage + "&nbsp;&nbsp;<button style=\"font-size:10px;heigth:11px;\" onclick=\"javascript:var oblah = window.clipboardData.setData('text', this.nextSibling.nextSibling.value);var oWin =  window.open('/adx/aspx/PasteXML.aspx','_blank');\">view xml</button><br/><textarea name=\"traceXML\" id=\"traceXML\" style=\"width:100%;height:50px;\">" + sXML + "</textarea>");							
    //trace("<input type=button onclick=\"alert(document.getElementsByName('traceXML').item("+(ctraceXML.length) + ").value)\">");							
}//end of trace


function traceColor (sMessage, sColor) 
{ 
	trace("<font style=\"color:"+sColor+"\">" + sMessage + "</font>");							
}

function traceError (sMessage) 
{ 
	trace("<font style=\"color:red;font-weight:bold;\">" + sMessage + "</font>");							
}

function clearTrace ()
{
	if (parent.traceWindow != null)
	{
		var traceTextarea = getDebugTraceTextarea ();
		if (traceTextarea != null)
		{
			traceTextarea.value = "";
		}//end of textarea not null
	} //end of traceWindow not null
	
}//end of clear trace function
			
function getDebugTraceTextarea (_tracewindow)
{
	var traceTextarea = null;
	//there is an opportunity here for cross-browser scripting "Access is denied" errors.
	try
	{
		traceTextarea = _tracewindow.document.frames["ConsoleTrace"]
	}
	catch (e)
	{						
		//window.status = "Access denied error occurred while attempting to access trace window. Please reopen this editor from your workspace.";
	}						
	return traceTextarea;
}//end getDebugTraceTextarea


function traceGetCookie(sString)
{
	var sSearchItem = sString + "=";
	var sCookies = document.cookie;
	var iPos = sCookies.indexOf(sSearchItem);
	if(iPos != -1)
	{
		var iStart = iPos + sSearchItem.length;
		var iEnd = sCookies.indexOf(";", iStart);
		if(iEnd == -1)
		{
			iEnd = sCookies.length;
		}
		var sValue = sCookies.substring(iStart, iEnd);
		  
		return(sValue);
	}
	else
	{
		return "";
	}
}//GetFromCookie

function dumpError(error)
{
	var sError = "\n<br/>Error Details:\n<br/>Number = " + error.number;
		sError += "\n<br/>Name = " + error.name;
		sError += "\n<br/>Description = " + error.description;
		sError += "\n<br/>Message = " + error.message;
		return "<font color=\"red\">" + sError + "</font>";
		
}

var _traceActive = (traceGetCookie("traceWindow") == "true");

//-->
// Copyright 2001 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product
function adxXMLHTTP(sURL, sMethod)
{
    // request for the XMLHTTP object only
    if(sURL == null && sMethod == null)
    {
        var oHTTP;
        
        try
        {
            oHTTP = new ActiveXObject("Msxml2.XMLHTTP.6.0");
        }
        catch(e)
        {
        	e.description = "Failed to create new 'Msxml2.XMLHTTP.6.0' in xml.asp :" + e.description;
		    throw e;
		}
		
		return oHTTP;
    }
    
    var sResponse = "";
    var bDone = false;
    var i = 0;
    
    if(sMethod == null)
    {
        sMethod = "GET";
    }
    
    var oHTTP = new adxXMLHTTP();
	
    
    while(!bDone && i < 8)
    {
        try
        {
           oHTTP.Open(sMethod, sURL, false);
           oHTTP.Send();
           sResponse = oHTTP.responseText;
           bDone = true;
        }
        catch(e)
        {
            
        }
        i++
    }
    
    if(i == 8 && sResponse == "")
    {
        alert("There has been a problem retrieving data from the server.")
    }
    
    return sResponse;
}

function adxXMLDOM()
{
	try
	{
		var oXML = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");
		oXML.setProperty("AllowXsltScript", true);
		oXML.async = false; 
	}
	catch(e)
	{
		e.description = "Failed to create new 'Msxml2.FreeThreadedDOMDocument.6.0' in xml.asp :" + e.description;
		throw e;
	}		
	oXML.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'")
	return oXML
	
}


function adxXMLDocument(sXML)
{
    this.oXML = adxXMLDOM()
    this.oXML.loadXML(sXML);
}


// Start Stylesheet Object

function adxStylesheet(sPath, bFromString)
{
   // private properties
   this._oXSLT = null;
   this._oXSL = null;
   this._oXSLProc = null;
   this._bFromString = false;
   
   // public properties
   this.sPath = null;
   this.sError = null;
   
   // private methods
   this._init = new Function ("return _adxStylesheet_Init(this)");
   
   // public methods
   this.AddParameter = new Function ("sName", "sValue", "return _adxStylesheet_AddParameter(this, sName, sValue)");
   this.Transform = new Function ("oXML", "return _adxStylesheet_Transform(this, oXML)");
   
   // initialization
   this.sPath = sPath;   
   this._bFromString = bFromString;
	_adxStylesheet_Init (this);

}//end of adxStylesheet definition  

function _adxStylesheet_Init(oStylesheet)
{
    // generate the xsl stylesheet
	oStylesheet._oXSL = new adxXMLDOM();
	oStylesheet._oXSL.setProperty("AllowXsltScript", true);
	oStylesheet._oXSL.setProperty("ResolveExternals", true);
	
    oStylesheet._oXSL.async = false;    
    if (oStylesheet._bFromString == true)
    {		
		oStylesheet._oXSL.loadXML(oStylesheet.sPath);
	}
	else
	{
		oStylesheet._oXSL.loadXML(adxXMLHTTP(oStylesheet.sPath));
	}

    //generate the xslt stylesheet
    try
    {
		oStylesheet._oXSLT = new ActiveXObject("Msxml2.XSLTemplate.6.0");
//		oStylesheet._oXSLT.setProperty("AllowXsltScript", true);
//		oStylesheet._oXSLT.async = false;    
	}
	catch(e)
	{
		e.description = "Failed to create new 'Msxml2.XSLTemplate.6.0' in xml.asp :" + e.message;
		throw e;
	}		
	try
	{
        oStylesheet._oXSLT.stylesheet = oStylesheet._oXSL;
    }
    catch(e)
    {
        e.description = "Failed to create Msxml2.XSLTemplate.6.0 stylesheet from the file '" + 
		                 oStylesheet.sPath + "'\n" + e.message;		 
        throw e;
    }
    oStylesheet._oXSLProc = oStylesheet._oXSLT.createProcessor();       
}//end of adxStylesheet init

function _adxStylesheet_AddParameter (oStylesheet, sName, sValue)
{
    //add parameters    
    oStylesheet._oXSLProc.addParameter(sName, sValue);
}

function _adxStylesheet_Transform (oStylesheet, oXML)
{
    //return html
    
    oStylesheet._oXSLProc.input = oXML;
    
    oStylesheet._oXSLProc.transform();
    
    return (oStylesheet._oXSLProc.output);
} 

// End Stylesheet Object

function adxXML_SelectSingleNode (oXML, sPattern)
{
    return oXML.selectSingleNode (sPattern);
}

function adxXML_SelectNodes (oXML, sPattern)
{
    return oXML.selectNodes (sPattern);
}

function adxXML_SetAttribute(oXML, sName, sValue)
{
	if(sValue == null) 
	{
		sValue = '';
	}
	
    return oXML.setAttribute(sName, sValue)
}

function adxXML_GetAttribute (oXML, sPattern, sAttribute)
{
    
    var oElem = (oXML == null) ? (null) : (oXML.selectSingleNode (sPattern));
    if (oElem != null)
    {
        var sReturn = oElem.getAttribute (sAttribute);
        return (sReturn != null?sReturn:"");
    }
    else
    {
        return ("");
    }
}   

function adxXML_GetNodeDepth (oNode)
{
    var i = 0;

    var oDoc = oNode.ownerDocument;

    while (oNode != null && oNode != oDoc)
    {
        i++
        oNode = oNode.parentNode;
    }
    
    return (i);
}   


function adxXML_RemoveNodes (oXML, sPattern)
{
    var oNodeList = oXML.selectNodes(sPattern);
    var i;
    for (i=0; i<oNodeList.length; i++)
    {
        if (oNodeList[i].parentNode != null)
        {
            oNodeList[i].parentNode.removeChild(oNodeList[i]);
        }
    }
}

function adxXML_IsAncestor (oNode, oParentTestNode)
{
    // this function will return TRUE if the oParentTestNode is in the list of ancestors of oNode
    var bFound = false;
    while (oNode != null)
    {
        if (oNode == oParentTestNode)
        {
            // found it
            bFound = true;
            oNode = null;
        }
        else
        {
            oNode = oNode.parentNode;
        }
    }
    return bFound;
}

function adxGetGuid()
{
	var sGuid = adxXMLHTTP("/adx/admin/aspx/getguid.aspx")
	if(sGuid.length != 36)
	{
		alert("An error was encountered generating a GUID.  \n\nReason : \n" + sGuid);
		return null;
	}
	else
	{
		return sGuid;
	}
}
// Copyright 2003 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product

function firstMonthDay(oDate)
{
	var _Date = new Date(oDate)
	_Date.setDate(1);
	return _Date;
}
function lastMonthDay(oDate)
{
	var _Date = new Date(oDate)
	_Date.setDate(32);
	_Date.setDate(0);
	return _Date;
}

function formatDate(oDate,format)
{
    var _Date = new Date(oDate);

	//month 	
	var iMonth = parseInt(oDate.getMonth());
	if(format.indexOf("MMMM") != -1)
	{
		var aMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		format = format.replace(/MMMM/g, aMonth[iMonth]);
	}
	if(format.indexOf("MMM") != -1)
	{
		var aMonth = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
		format = format.replace(/MMM/g, aMonth[iMonth]);
	}
	if(format.indexOf("MM") != -1)
	{
		iMonth++;
		format = format.replace(/MM/g, (iMonth < 10 ? "0":"") + iMonth);
	}
		
	//date and days
	var iDate = parseInt(oDate.getDate());
	var iDay = parseInt(oDate.getDay());

	if(format.indexOf("dddd") != -1)
	{
		var aDay = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
		format = format.replace(/dddd/g, aDay[iDay]);
	}
	if(format.indexOf("ddd") != -1)
	{
		var aDay = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
		format = format.replace(/ddd/g, aDay[iDay]);
	}
	if(format.indexOf("dd") != -1)
	{
		format = format.replace(/dd/g,(iDate < 10 ? "0":"") + iDate);
	}
		
	//year
	var iYear= parseInt(oDate.getFullYear());
	
	if(format.indexOf("yyyy") != -1)
	{
		format = format.replace(/yyyy/g, iYear);
	}
	if(format.indexOf("yy") != -1)
	{
		format = format.replace(/yy/g, String(iYear).substring(2));
	}
	
    return format;
}
// Copyright 2001 AppDepot Web Services Inc.  All Rights Reserved.  This is a licensed product

var bChangesMade = false;

function GoCancel ()
{
    if (bChangesMade)
    {
        if (confirm("Close this document without saving changes?"))
        {
            window.close();
        }
    }
    else
    {
        // no changes made yet
        window.close();
    }
    return false;
}

function DeleteElement (sID)
{
    var oDelete = document.getElementById(sID)
    if (oDelete)
    {
        //alert (oDelete.id);
        
        var oParent = oDelete.parentNode
        oParent.removeChild(oDelete);
    }
}

function DeleteParentElement (sID)
{
    var oDelete = parent.document.getElementById('ID' + sID)
    if (oDelete)
    {
        //alert (oDelete.id);
        
        var oParent = oDelete.parentNode
        oParent.removeChild(oDelete);
    }
}

function ClearLogEntries()
{
    var i=1;
    while (document.getElementById("LogTimestamp;" + i))
    {
        DeleteElement("Log;"+i);
        i++;
    }
    //DeleteElement("LogEntriesLabel");

    // calculate the current user's DN
    var iStart = document.cookie.indexOf("adxUserDN") + 10;
    var iEnd = document.cookie.substr(iStart).indexOf(";");
    var sUserDN = document.cookie.substr(iStart,iEnd);

    adxBuildSection("DocumentLogSpan", "Log;%i%", 1);
    adxFieldInit("LogTimestamp;1",escape(adxFormatDate(new Date())));
    adxFieldInit("LogUsername;1",sUserDN);
    adxFieldInit("LogUserDN;1",sUserDN);
    adxFieldInit("LogDescription;1","Log Entries Cleared");
}

function AdvancedMode (bValue)
{

	setAdvancedModeState(bValue);
	
    // show and hide tabs
    var sHide = bValue?"no":"yes";
    var aAdvancedTabs = oTabXML.oXML.selectNodes("//adxTab/Tab[@Advanced='true']");
    
    //alert(oTabXML.oXML.xml);
    
    //alert(oTabXML.oXML.xml);
    
    for (var i=0; i<aAdvancedTabs.length; i++)
    {
        var oTab = aAdvancedTabs[i];
        oTab.setAttribute("Hidden", sHide);
    }
    
    var sTabHTML = oTabXSL.Transform(oTabXML.oXML);
    var oTabDiv = document.getElementById("adxTabDiv");
    oTabDiv.innerHTML = sTabHTML;

    // build an array of all tabs
    var aTabArray = new Array();
    var sFirstTab = null;
    var aTabs = oTabXML.oXML.selectNodes("//adxTab/Tab");
    
    for (var i=0; i<aTabs.length; i++)
    {
        var oTab = aTabs[i];
        var oTabDiv = document.getElementById(oTab.getAttribute("TagID"));
        
        if (sFirstTab==null && oTab.getAttribute("Advanced")!="true")
        {
            // this is the first tab that is not advanced
            sFirstTab = oTab.getAttribute("TagID");
        }
        if ((oTabDiv.className=="adxTabDivShow") && (bValue || oTab.getAttribute("Advanced")!="true"))
        {
            sFirstTab = oTab.getAttribute("TagID");
        }
        aTabArray[aTabArray.length] = oTab.getAttribute("TagID");
    }

    adxTabSwitch (sFirstTab, aTabArray,null,'')
    
    //get all the spans    
    var oSpans = document.getElementsByTagName("span")
    for(var i=0 ; i < oSpans.length ; i++)
    {
        var oElem = oSpans.item(i)
                    
        // check if this is the new language
        if(oElem.id.indexOf("AdvancedMode;") != -1)
        {
            //alert ("found " + oElem.id);
            if (bValue)
            {
                // show it
                oElem.style.visibility =  "visible";
                oElem.style.display =  "";
            }
            else
            {
                // hide it
                oElem.style.visibility =  "hidden";
                oElem.style.display =  "none";
            }
        }
    }
}



function adxAttachChangeHandler()
{
    // this function will attach the change handler on all relevant form elements
    return
    var i;
    for (i=0;i<document.all.length;i++)
    {
        var oElem = document.all[i];
        var sName = oElem.nodeName.toLowerCase();
        
        // make sure it is an appropriate input field and not hidden nor an 'adxEditButton'
        if ((sName == "input" || sName == "textarea") && 
                        oElem.type.toLowerCase() != "hidden" && oElem.name.indexOf("adxEditButton") == -1)
        {
            oElem.onpropertychange = MarkChange;
        }
    }
}

function MarkChange()
{
    var oElem = window.event.srcElement;
    if (oElem)
    {
        if (window.event.propertyName == "onpropertychange")
        {
            // ignore this event
            return;
        }
        //alert ("change " + oElem.name + "." + window.event.propertyName)
    }
    bChangesMade = true;
}

function adxSelectOptionInit (sName,sText, sValue)
{

    var oElem = document.getElementById(sName);
    if (oElem)
    {
        var oOption = document.createElement("option")
	    oOption.value = sValue
	    oOption.innerText = unescape(sText);
	    //alert(oElem.outerHTML)
	    oElem.insertAdjacentElement("beforeEnd",oOption);
    }    
}

function adxFieldDisable (sName, sClassName, bOnlyDisable)
{
	var oElem = document.getElementById(sName);
    var sLowerName = sName.toLowerCase();
    
    if(sClassName == undefined)
    {
        sClassName = "EditorReadOnlyStretch";
    }
    
    if(bOnlyDisable == undefined)
    {
        bOnlyDisable = false;
    }
    
    if (oElem)
    {
        var sNodeName = oElem.nodeName.toLowerCase();
        
	    switch (sNodeName)
        {
			case "input":
			    // check the type of input field
			    if (oElem.type =="text")
			    {
			        if(bOnlyDisable)
			        {
			            oElem.disabled = true;
			        }
			        else
			        {
			            oElem.readOnly = true;
			            oElem.className = sClassName;
			        }
			    }
			    else if (oElem.type =="radio")
			    {
					//there must be more thatn one so get the collection
					var cElem = document.getElementsByName(sName);
					//alert(cElem.length)
					for(var i = 0 ; i < cElem.length ; i ++)
					{
						cElem.item(i).disabled = true;
						//cElem.item(i).className = "EditorReadOnlyStretch";
					}			        
			    }
			    else if("checkbox" == oElem.type)
			    {
					oElem.disabled = true;
			    }
			   
			    break;
			    
			case "select":
			    oElem.disabled = true;
			    if(!bOnlyDisable)
			    {
				    oElem.readOnly = true;				
			        oElem.className = sClassName;
			    }
				break;
				
			case "textarea":
			    oElem.disabled = true;
			    if(!bOnlyDisable)
			    {
			        oElem.className = sClassName;			
			    }
			    break;
		}//switch
	}//non-null element
}//adxFieldDisable


/// <summary>
/// This is a legacy method available for initializing editor fields, and when the adxFieldInit method is 
/// invoked using inline HTML.  sValue must be escaped so that characters such as single quotes do not cause the 
/// surrounding HTML to be malformed.  sValue is unescaped inside adxFieldInit.  Use InitializeField(sName, sValue)
/// instead for new development.
/// </summary>
function adxFieldInit (sName, sValue)
{
	InitializeField(sName, unescape(sValue));
}

/// <summary>
/// This method is used to initialize fields (an HTML element).  The field's ID is located by the parameter sName,
/// and the field's value is set according to the value of the parameter sValue.
/// </summary>
/// <remarks>
/// The value of the element is set exactly to the value of sValue, without any escaping or unescaping.  Code
/// calling this method should escape or unescape the values before using this method.
/// </remarks>
function InitializeField(sName, sValue)
{
    var oElem = document.getElementById(sName);
  
    if (oElem)
    {
        var sNodeName = oElem.nodeName.toLowerCase();
        
	    switch (sNodeName)
        {
			case "input":
			    // check the type of input field
			    if (oElem.type =="radio")
			    {
			        // this is a radio button			        
			        var i=0, bDone = false;
			        var oElems = eval ("window.document.forms[0].elements['"+sName+"']")

			        while (i < oElems.length && !bDone)
			        {
			            //cast the strings to lower case.  there should never be 2 values the same with different cases.
			            if (oElems[i].value.toLowerCase() == sValue.toLowerCase())
			            {
			                //trace ("Found radio " + sName + " = " + sValue);
			                oElems[i].checked = true;
			                bDone = true;
			            }
			            i++;
			        }
			    }
			    else if (oElem.type=="checkbox")
			    {
			        if (sValue.toLowerCase() == "true" || sValue == "Y" || sValue=="1" || sValue=="T")
			        {
			            oElem.checked = true;
			        }
			        else if (sValue == oElem.value)
			        {
			            oElem.checked = true;
			        }
			        else
			        {
			            oElem.checked = false;
			        }
			    }
			    else
			    {
			        // this is a standard input field
			        
					oElem.value = sValue;
			    }
			    break;
			case "textarea":
			
			    oElem.value = sValue;
			    break;
			case "span":
			    oElem.innerHTML = sValue;
			    break;
			case "select":
			
				if(oElem.multiple)
				{
					if(oElem.adxSkipInit == "true") return;
					
					var oTempXML = adxXMLDOM()
					oTempXML.loadXML(unescape(sValue))
					//alert(oTempXML.xml)
					if(oElem.options(oTempXML.documentElement.getAttribute("value")) == null)				
					{
						var oOption = document.createElement("option")
						oOption.value = oTempXML.documentElement.getAttribute("value")
						oOption.id = oTempXML.documentElement.getAttribute("value")
						oOption.innerText = oTempXML.documentElement.text
				
						oElem.insertAdjacentElement("beforeEnd",oOption) ;
					}
				}
				else
				{
					// loop through the elements until we find the appropriate value
					//traceColor("oElem.selectedIndex  = " +  oElem.selectedIndex, "red")
					
					var i=0;
					var bDone = false;
								
					while (!bDone && i<oElem.length)
					{
						//cast the strings to lower case.  there should never be 2 values the same with different cases.
					    if (oElem[i].value.toLowerCase() == unescape(sValue).toLowerCase())
					    {
							//trace("adxFieldInit = " + oElem[i].value + " == " + unescape(sValue))
					        oElem.selectedIndex = i;
					        bDone = true;
					    }
					    i++;
					}
					
					//traceColor("oElem.selectedIndex  = " +  oElem.selectedIndex, "red")
					//traceColor("oElem.outerHTML  = " +  oElem.outerHTML, "red")
					
			    }
			    break;
			default:
				
		}
    }
}


function OpenHelp()
{
//	var oDiv = document.getElementById("helpdiv");
//	if(oDiv == null)
//	{
//		oDiv = document.createElement("iframe");
//		oDiv.id = "helpdiv"
//		oDiv.className = "Hide"
//		oDiv.src = "/adx/blank.html"
//		document.body.appendChild(oDiv)
//	}
//	
//	oDiv.src = "/adx/admin/adxHelp.aspx";
    window.top.open("/adx/admin/adxHelp.aspx","_blank");
}
function SaveAndCloseAndSend()
{
	var d = new Date();
	var sToday = d.getMonth()+1 + "/" + d.getDate() + "/" + d.getYear();	// + " " + d.getTime()
	document.adxForm.ButtonPressed.value="Send";
	document.adxForm.DateSent.value=sToday;
	SaveAndClose();
}
function SaveAndCloseAndPreview()
{
	document.adxForm.ButtonPressed.value="Preview";
	SaveAndClose();
}
function UploadAndClose()
{
	document.adxForm.ButtonPressed.value="Upload";
	SaveAndClose();
}
function DownloadAndClose()
{
	document.adxForm.ButtonPressed.value="Download";
	SaveAndClose();
}

function SaveProcessForm()
{
	if(document.all.adxPleaseWait != null)
	{
		document.all.adxPleaseWait.innerHTML = '<table width="100%" height="100%"><tr><td align="center">Saving... please wait.</td></tr></table>'
		document.all.adxPleaseWait.style.visibility =  "visible";
		document.all.adxPleaseWait.style.display =  "";
	}

	var oDivs = document.getElementsByTagName("div")
	
	for (var i=0; i< oDivs.length;i++)
	{
		var oField = oDivs.item(i)		
		if(oField)
		{
			// look for fields with adxEdit but exclude adxButton, also exclude the template
			if (oField.name != null && oField.name.indexOf("adxEdit") >= 0 && oField.name.indexOf("adxEditButton") < 0 && oField.name.indexOf(";%i%") < 0)
			{
				//var sName = oField.name.substr(0,oField.name.indexOf("adxEdit"));
				var sName = oField.name.replace ("adxEdit", "");
				var oHidden = document.all[sName];
				// make sure we have found the hidden field
				if (oHidden)
				{
				    // cancel it's events so that we don't fire them when we change the value
				    var oEvent = oHidden.onpropertychange
				    oHidden.onpropertychange = null;
				    
				    // transfer the value to the hidden field
				    if (oField.nodeName.toLowerCase() == "textarea")
				    {
				        oHidden.value = oField.value;
				    }
				    else
				    {
				        oHidden.value = oField.innerHTML;
				    }
				    
				     oHidden.onpropertychange = oEvent
				}
				else
				{
				    alert ("hidden field named '" + sName + "' missing. Source field name = '" + oField.name + "'");
				}
			}
		}
	}

	var oTextareas = document.getElementsByTagName("textarea")

	for (var i=0; i< oTextareas.length;i++)
	{
		var oField = oTextareas.item(i)
		if(oField)
		{
			// look for fields with adxEdit but exclude adxButton, also exclude the template
			if (oField.name != null && oField.name.indexOf("adxEdit") >= 0 && oField.name.indexOf("adxEditButton") < 0 && oField.name.indexOf("%i%") < 0)
			{
				//var sName = oField.name.substr(0,oField.name.indexOf("adxEdit"))
				var sName = oField.name.replace ("adxEdit", "");
				var oHidden = document.all[sName]
				// make sure we have found the hidden field
				if (oHidden)
				{
					var oEvent = oHidden.onpropertychange
				    // cancel it's events so that we don't fire them when we change the value
				    oHidden.onpropertychange = null;
				    
				    // transfer the value to the hidden field
				    if (oField.nodeName.toLowerCase() == "textarea")
				    {
				        oHidden.value = oField.value;
				    }
				    else
				    {
				        oHidden.value = oField.innerHTML;
				    }
				    
				    oHidden.onpropertychange = oEvent
				}
				else
				{
				    alert ("hidden field named '" + sName + "' missing.Source field name = '" + oField.name + "'");
				}
			}
		}
	}


	var oSelects = document.getElementsByTagName("select")

	for (var i=0; i< oSelects.length;i++)
	{
		var oField = oSelects.item(i)
		if(oField)
		{
			//tests for multi select that requires all
			if(oField.adxSelectAll == 'true')
			{
				//alert(oField.options.length)
				for(var j=0 ; j < oField.options.length	; j++)
				{
					//oField.options(0).value += ";"+oField.options(j).value
					oField.options(j).selected = true;
				}
			}
		}
	}
	
	//set the author to the adxSetting element
	var oAuthorElem = document.getElementById("adxSetting:AuthorDN");
	if (oAuthorElem == null)
	{
		oAuthorElem = document.getElementById("adxSetting_AuthorDN"); //added by carlin july 27, 2005
	}
	
	if(oAuthorElem != null)
	{		
		oAuthorElem.value = "AuthorDN:"+document.all["AuthorDN"].value;
	}
	
	// clear saved flipped fields
	SavedFlippedFields = new Object();
}

function Save()
{
	// loop through all of the input fields.  Locate any adxEdit fields and transfer the value to the 
	// hidden input field 
	if(typeof(adx_ManditoryFieldCheck) != "undefined")
    {
		var bSave =  adx_ManditoryFieldCheck();
    }
    else
    {
		var bSave = true
    }
   
    
   if (bSave)
   {
		SaveProcessForm();
		
		//need to find the iframe
		var oFrame = document.getElementById("adxSaveFrame")
		
		document.forms[0].target = "adxSaveFrame";
		document.forms[0].adxSaveOnly.value = "true";
		document.forms[0].submit();
		window.setTimeout("SaveDone()",1000);
		
		document.forms[0].target = "";
		document.forms[0].adxSaveOnly.value = "false";
		//end of if bSave test
    }
}

function SaveDone()
{
	//save the doc
    var StartComplete = 0;
    var EndComplete   = 0;
	
	if(document.all.adxSaveFrame.readyState == "complete")
	{				
		StartComplete = document.frames["adxSaveFrame"].document.body.innerHTML.indexOf("DocEditSupport");
		if(StartComplete == -1)
		{
		    adxShowBody();
		    if(document.frames["adxSaveFrame"].document.body.innerHTML.indexOf("<") != -1)
		    {	        
		       var iLeft = window.screenLeft 
	           var iTop = window.screenTop
		       var style = 'top='+iTop+',left='+iLeft+',menubar=0,toolbar=0,location=0,directories=0,status=0,resizable=1,dependent=0,width=500,height=500';
		       var ErrorWin = window.open("", "ErrorWindow", style);
		       ErrorWin.document.write(document.frames["adxSaveFrame"].document.body.innerHTML);
		       ErrorWin.document.close();
		        
		    }
		    else
		    {
			    alert("An error has occured while saving.\nThe document may not have been saved. \n\nERROR:\n" + document.frames["adxSaveFrame"].document.body.innerText)
			}
		}
		else
		{
		    /*
		     * Nov 27, 2003 [Cam]
		     *  - ReInit the Document with the saved and reloaded XML
		     */	    
		    var StartReInit = document.frames["adxSaveFrame"].document.body.innerHTML.indexOf("<REINIT>");
		    var EndReInit = document.frames["adxSaveFrame"].document.body.innerHTML.indexOf("</REINIT>");
		    var TheReInit = document.frames["adxSaveFrame"].document.body.innerHTML.substr(StartReInit + 8, (EndReInit - StartReInit -8));		    
		    // have to do this because a form reset messes things up
		    ResetFileUploads()
		    //alert("starting init")
		    eval(TheReInit);		  
		    adxShowBody();  
		    
		}
	}
	else
	{
		window.setTimeout("SaveDone()",1000)
		
	}	
}

 /// <summary>
 /// Nov 2003 [Cam]
 /// used by SaveDone to reset the file upload inputs.
 ///
 /// Mar 2004 [CL]
 /// added check for null objects
 /// </summary>
function ResetFileUploads()
{
    var oLength = document.forms[0].length;
    //alert("testing " +oLength);
    for(var i=0; i<oLength; i++)
    {
        // this check added Mar 04 [CL]
        if(document.forms[0].elements[i] != null)
        {
        
        if(document.forms[0].elements[i].type.toLowerCase() == "file")
        {
            if(document.forms[0].elements[i].outerHTML.toLowerCase().indexOf("value") != -1)
            {
                // fine the start and end of the value piece
                var start = document.forms[0].elements[i].outerHTML.toLowerCase().indexOf('value="') + 7;
                var end   = document.forms[0].elements[i].outerHTML.toLowerCase().indexOf('"', start);
                var str   = document.forms[0].elements[i].outerHTML.substr(0, start) + 
                            document.forms[0].elements[i].outerHTML.substr(end);
         
                // re-create the Upload piece becasue we can not reset it
                document.forms[0].elements[i].outerHTML = str;
                
            }// has a value node in it
        }// of type file
        
        }// ewnd of new check
        
    }// for loop
}//ResetFileUploads

/// <summary>This function gets the query string and parses it into an collection.</summary>
/// <example>
///	Example implementation:
///	<code>
///		var QSCollection = GetQSArgs();
///		var DN = QSCollection["DN"];
///	</code>
/// </example>
/// <returns>indexable collection of query string elements and their corresponding values</returns>
/// <remarks>Oct 2003 [Cam]</remarks>
function GetQSArgs()
{
    var query = unescape(location.search.substring(1));
    return GetQSArgs (query);    
}//GetQSArgs


function GetQSArgs (sQS)
{
	var query = unescape(sQS);
    var args = new Object();
    var pairs = query.split("&");
    
    for(var i=0; i<pairs.length; i++)
    {
        var pos = pairs[i].indexOf("=");
        if(pos == -1) continue;
        
        var argname = pairs[i].substring(0, pos);
        var value   = pairs[i].substring(pos+1);
        
        args[argname] = unescape(value);
        //alert(argname + " = " + args[argname]);
    }
    
    return args;

}//end of GetQSArgs (sQueryString)

function SaveAndClose()
{
    // loop through all of the input fields.  Locate any adxEdit fields and transfer the value to the 
    // hidden input field 
    
    if(typeof(adx_ManditoryFieldCheck) != "undefined")
    {
		var bSave =  adx_ManditoryFieldCheck();
    }
    else
    {
		var bSave = true
    }
   
	if (bSave)
	{
		SaveProcessForm();
		document.forms[0].submit();
		//end of if bSave test
    }
}

function swapClass(oDiv,sType)
{ 
	if (sType == 'over') { oDiv.className = 'MenuButtonOver';
	}
	else if (sType == 'out') { oDiv.className = 'MenuButton';
	}
	else if (sType == 'click') { oDiv.className = 'MenuButtonClick';
	}
}

function ChangeCreationDate(oElem)
{
    var oSpanElem = document.getElementById("CreationDateSpan")
    if (oElem.value == "")
    {
        oSpanElem.innerHTML = "";
    }
    else if (oSpanElem)
    {
        oSpanElem.innerHTML = adxFormatDate(new Date(oElem.value));
    }
    return true;
}

function ChangeLastUpdateDate(oElem)
{
    var oSpanElem = document.getElementById("LastUpdateDateSpan")
    if (oElem.value == "")
    {
        oSpanElem.innerHTML = "";
    }
    else if (oSpanElem)
    {
        oSpanElem.innerHTML = adxFormatDate(new Date(oElem.value));
    }
    return true;
}

function ChangeCreationUTCDate(oElem)
{
    var oSpanElem = document.getElementById("CreationDateSpan");
    if (oElem.value == "")
    {
        //oSpanElem.innerHTML = "";
        setInnerHTML ("CreationDateSpan", "");
    }
    else if (oSpanElem)
    {
        //oSpanElem.innerHTML = adxFormatUTCDate(oElem.value);
        setInnerHTML ("CreationDateSpan", oElem.value);
    }
    return true;
}
 
function ChangeLastUpdateUTCDate(oElem)
{	
    var oSpanElem = document.getElementById("LastUpdateDateSpan");
    if (oElem.value == "")
    {
        //oSpanElem.innerHTML = "";
        setInnerHTML ("LastUpdateDateSpan", "");
    }
    else if (oSpanElem)
    {
		//oSpanElem.innerHTML = adxFormatUTCDate(oElem.value);
        setInnerHTML ("LastUpdateDateSpan", oElem.value);
    }
    return true;
}

function ChangeDateSpan(oElem)
{
    var oSpanElem = document.getElementById(oElem.name+"Span")
    if (oElem.value == "")
    {
        oSpanElem.innerHTML = "";
    }
    else if (oSpanElem)
    {
        oSpanElem.innerHTML = adxFormatDate(new Date(oElem.value));
    }
    return true;
}

/// <summary>
/// Returns a localally formatted string from a UTC time string
/// </summary>
/// <param name="sDate">UTC date string</param>
/// <returns>Date in a local time and localized format</returns>
function adxFormatUTCDate(sDate)
{
	var sReturn = "";
	var oUTCDate = new Date(sDate)
	
	if (isNaN(oUTCDate) == false && oUTCDate != "NaN") 	
	{	
		oUTCDate.setMinutes(oUTCDate.getMinutes() - oUTCDate.getTimezoneOffset());
		sReturn = oUTCDate.toLocaleString();
	}
	//alert (sDate + " -> " + sReturn);
	return sReturn
}


function adxFormatDate (oDate)
{
    if (isNaN(oDate))
    {
        // this is not a valid date
        return "";
    }
    
    var aMonth = new Array ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
    var sDate = aMonth[oDate.getMonth()] + "/" + oDate.getDate() + "/" + oDate.getFullYear();
    //alert (oDate + " hours=" + oDate.getHours() + " minutes=" + oDate.getMinutes() + " seconds=" + oDate.getSeconds());
    if (oDate.getHours() + oDate.getMinutes() + oDate.getSeconds() > 0)
    {
        /*
        var sHours = "00" + oDate.getHours();
        var sMinutes = "00" + oDate.getMinutes();
        var sSeconds = "00" + oDate.getSeconds();
        sDate += "  " + sHours.substr(sHours.length-2) + ":" + sMinutes.substr(sMinutes.length-2) + ":" + sSeconds.substr(sSeconds.length-2);
		*/
		//Changed by rwu to fix am/pm bug on August 9, 2004
		sDate += " " + getClockTime(oDate)
    }
    //alert(sDate);
    return sDate;
}
/*
* August 9, 2004 [rwu]
*/
function getClockTime(oDate)
{
   if (isNaN(oDate))
   {
       // this is not a valid date
       return "";
   }
    
   var hour   = oDate.getHours();
   var minute = oDate.getMinutes();
   var second = oDate.getSeconds();
   var ap = "AM";
   if (hour   > 11) { ap = "PM";             }
   if (hour   > 12) { hour = hour - 12;      }
   //if (hour   == 0) { hour = 12;           }
   if (hour   == 0 && minute==0 && second==0) { return ""; }	//Return empty string as default. - rwu Aug 12, 2004.
   if (hour   < 10) { hour   = " " + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour + 
                    ':' + 
                    minute + 
                    ':' + 
                    second + 
                    " " + 
                    ap;
   return timeString;
} // function getClockTime()

// The sStyle is the style of the textarea created on the flip. When the source button is clicked, a text area with style
// .sStyle + adxEditTextarea is created.  So this function should be called with a sStyle = 200 to refer to a style
// called 200adxEditTextarea.  When the design button is clicked a Div is created with a style = sStyle + "adxEditDiv"
function adxFlipEditMode (sID, sStyle, oRadio,bWarn)
{
    adxFlipEditModeWithCharacterCount (sID, sStyle, -1, oRadio, bWarn)
}

///This function will be called to switch between design and source mode for the editors that need to keep track of the 
///number of characters in the editable content area.
/// The sStyle is the style of the textarea created on the flip. When the source button is clicked, a text area with style
/// .sStyle + adxEditTextarea is created.  So this function should be called with a sStyle = 200 to refer to a style
/// called 200adxEditTextarea.  When the design button is clicked a Div is created with a style = sStyle + "adxEditDiv"
///sLimitInput is the maximum number of characters that will be allowed for a given editable content area.
function adxFlipEditModeWithCharacterCount (sID, sStyle, sLimitInput, oRadio, bWarn)
{
	if(bWarn == null)
	{
		bWarn = true;
	}
	
	
    var oItem = document.getElementById(sID + "adxEdit")
     
    if(oRadio.value == "source" && (oItem.nodeName).toLowerCase() == "div")
    {
        
        var oTextArea = document.createElement("TEXTAREA");
        oTextArea.id = sID + "adxEdit"
        oTextArea.name = sID + "adxEdit"
        oTextArea.className = sStyle + "adxEditTextarea"
              
        if(sLimitInput >= 0)
        {
             oTextArea.maxInput = sLimitInput;
             try
            {
                oTextArea.attachEvent("onkeypress", UpdateCharacterCount);
            }
            catch(e)
            {
                alert("There was a problem attaching the onkeypress event to the textarea");
            }
        }
        
        var sSpellCheckable = oItem.getAttribute("spellcheckable");
	
	    if(sSpellCheckable != null && sSpellCheckable.toLowerCase() == "true")
	    {
	        oTextArea.spellcheckable = 'true';
	    }
        
        oTextArea.value = oItem.innerHTML
        oTextArea.contentEditable = true
        
        //Attach the onkeypress event to keep track of count of characters as entered by user
        
  
        oItem.parentElement.replaceChild(oTextArea,oItem)
        
        if(eval("document.all[\""+sID+"adxEditButton\"][1].checked") != true)
        {
            eval("document.all[\""+sID+"adxEditButton\"][1].checked = true")
            
        }
        
    }
    else if (oRadio.value == "design" && (oItem.nodeName).toLowerCase() == "textarea")
    {
        var bContinue = true
        
        if((((oItem.value).toLowerCase()).indexOf("</a>") > -1 
			|| ((oItem.value).toLowerCase()).indexOf("<img") > -1 
			|| ((oItem.value).toLowerCase()).indexOf("</table>") > -1 
			|| ((oItem.value).toLowerCase()).indexOf("/script>") > -1 
			|| ((oItem.value).toLowerCase()).indexOf("/object>") > -1 
			|| ((oItem.value).toLowerCase()).indexOf("<hr") > -1)
			&& bWarn)
        {
            var sMessage = "WARNING!\n\n"
            sMessage += "This field contains HTML tags which\n"
            sMessage += "may be modified or not handled properly by the design editor.\n\n"
            sMessage += "Would you like to continue?"
                
            bContinue = confirm(sMessage)
        }
        
        if(bContinue == true)
        {
            var oDiv = document.createElement("DIV");
            oDiv.id = sID + "adxEdit"
            oDiv.name = sID + "adxEdit"
            oDiv.className = sStyle + "adxEditDiv"
           
            
            if(sLimitInput >= 0)
            {
                 oDiv.maxInput = sLimitInput;
                 try
                {
                    oDiv.attachEvent("onkeypress", UpdateCharacterCount);
                }
                catch(e)
                {
                    alert("There was a problem attaching the onkeypress event to the textarea");
                }
            }
                        
            //oDiv.attachEvent("oncontextmenu",DisplayMenu)
            try
            {
                // there could be an error
               var sSpellCheckable = oItem.getAttribute("spellcheckable");
	
	            if(sSpellCheckable != null && sSpellCheckable.toLowerCase() == "true")
	            {
	                oDiv.spellcheckable = 'true';
	            }
                
                oDiv.innerHTML = oItem.value
                oDiv.contentEditable = true
                
                
                oItem.parentElement.replaceChild(oDiv,oItem)
                
            }
            catch (e)
            {
                // there was an error
                alert ("There was a problem switching to Design view.  Switching back to source view.");

                var oRadios = document.getElementsByName(sID+"adxEditButton")
                oRadios[1].checked = true
            }
             
        }
        else
        {
            //set the check back to source
            var oRadios = document.getElementsByName(sID+"adxEditButton")
            oRadios[1].checked = true
        }
    }

}//adxFlipEditModeWithCharacterCount

///Function to update the count of characters when we switch to either source or design mode.
///Object whose characters will be kept track of.
function UpdateCharacterCount(oElem)
{
   
   try
   { 
        var sName = window.event.srcElement.sID;
        var id= window.event.srcElement.id;
        var LimitInput = document.getElementById(sName+"_Count");
        var CharLimit = window.event.srcElement.maxInput;
        
        if(LimitInput)
        {
            LimitInput.innerHTML = document.getElementById(id).innerText.length + 1;
            var CurrentLength = document.getElementById(id).innerText.length + 1
        }
        
        if((CurrentLength > CharLimit))
        {
           alert("You are over the limit for input characters for this field. The maximum number of characters allowed is " + CharLimit);
        }
     }
     catch(e)
     {
        alert(e.message);
     }
}//UpdateCharacterCount

function adxEditChange (oElem, sName)
{
    // this function receives a value in the hidden input field for the HTML edit control and updates the 
    // div or the textarea with the contents
	if(oElem.value.toLowerCase().indexOf("</a>") > -1 ||
		oElem.value.toLowerCase().indexOf("<img") > -1 || 
		oElem.value.toLowerCase().indexOf("<hr") > -1 || 
		oElem.value.toLowerCase().indexOf("</table>") > -1 ||
		oElem.value.toLowerCase().indexOf("/script>") > -1 ||
		oElem.value.toLowerCase().indexOf("/object>") > -1 )
	{
		//alert(sName + " / " + oElem.value )
		var oRadio =  document.getElementsByName(sName + "adxEditButton");
		oRadio[1].click()

		adxFlipEditMode (sName, "", oRadio[1])		
	}
		//alert(sName)
    var oEdit = document.getElementById(sName+"adxEdit");
    if (oEdit)
    {
		
        if (oEdit.nodeName.toLowerCase() == "textarea")
        {
            oEdit.value = oElem.value;
        }
        else //(oEdit.nodeName.toLowerCase() == "textarea")
        {
            oEdit.innerHTML = oElem.value;
        }
    }
}

//This function counts the number of characters as they are entered in the content section of the editor.
function CharacterCount(oElem, sName, CharLimit)
{
    var CurrentLength = oElem.innerText.length + 1;
        
    try
    {
        var LimitInput = document.getElementById(sName+"_Count");
        
        if(LimitInput)
        {
            LimitInput.innerHTML = oElem.innerText.length + 1;
        }
        
        if((CurrentLength > CharLimit))
        {
           alert("You are over the limit for input characters for this field. The maximum number of characters allowed is " + CharLimit);
        }
         
     }
     catch(e)
     {
        alert(e);
     }
}//UpdateCount

function adxEditFormat (sAction)
{
	
	_adxEditFormat(document, sAction);
}

function adxEditFormatMenu (sAction)
{
	
	_adxEditFormat(document.parentWindow.document, sAction);
	
}

function _adxEditFormat (oDocument, sAction)
{
    var oRange = oDocument.selection.createRange();
    
    
    if (sAction=="Bold") 
    {
         oDocument.execCommand("bold");
    } 
    else if (sAction=="Italics") 
    {
         oDocument.execCommand("italic");
    }
    else if (sAction=="Underline") 
    {
         oDocument.execCommand("Underline");
    }
    else if (sAction == "OL")
    {
         oDocument.execCommand("InsertOrderedList");
    }
    else if (sAction == "UL")
    {
         oDocument.execCommand("InsertUnorderedList");
    }
    else if (sAction == "Indent")
    {
         oDocument.execCommand("Indent");
    }
    else if (sAction == "Outdent")
    {
         oDocument.execCommand("Outdent");
    }
    else if (sAction == "Copy")
    {
         oDocument.execCommand("Copy");
    }
    else if (sAction == "Cut")
    {
         oDocument.execCommand("Cut");
    }
    else if (sAction == "PasteAsText")
    {  
        if(oRange.parentElement().ownerDocument.body != null && oRange.parentElement().ownerDocument.body.editorId != null)
        {
            HtmlEditor.execCommand('mcePasteText', true)
        }
        else if(oRange.parentElement().isContentEditable)
        { 
            oDocument.execCommand("Paste");
        }
    }
     else if (sAction == "PasteFromWord")
    {   
       if(oRange.parentElement().ownerDocument.body != null && oRange.parentElement().ownerDocument.body.editorId != null)
        {
            HtmlEditor.execCommand('mcePasteWord', true)
        }
        else if(oRange.parentElement().isContentEditable)
        { 
            oDocument.execCommand("Paste");
        }
    } 
    else if (sAction == "Paste")
    {
         oDocument.execCommand("Paste");
    }
    else if (sAction == "PasteHTML")
    {
        var ta = oDocument.createElement("textarea");
        ta.style.visibility = "hidden";
        ta = oDocument.body.appendChild(ta);
        var oRange2 = ta.createTextRange();
        oRange2.execCommand("Paste");
        var stext = ta.value;
        oDocument.body.removeChild(ta);
        oRange.select();
        oRange.pasteHTML(stext);
    }
    else if (sAction == "Left")
    {
         oDocument.execCommand("JustifyLeft");
    }
    else if (sAction == "Center")
    {
         oDocument.execCommand("JustifyCenter");
    }
    else if (sAction == "Right")
    {
         oDocument.execCommand("JustifyRight");
    }
    else if (sAction == "Undo")
    {
         oDocument.execCommand("Undo");
    }
    else if (sAction == "Redo")
    {
         oDocument.execCommand("Redo");
    }
    else if (sAction == "Refresh")
    {
         oDocument.execCommand("Refresh");
    }
    else if (sAction == "HR")
    {
         oDocument.execCommand("InsertHorizontalRule");
    }
    else if (sAction == "Hyperlink")
    {
         oDocument.execCommand("CreateLink", true);
    }
    // added Normal, Superscript, Subscript Aug 12, 2004 Tony
    else if (sAction == "Normal")
    {
         oDocument.execCommand("RemoveFormat", true);
    }
    else if (sAction == "Superscript")
    {
         oDocument.execCommand("Superscript", true);
    }
    else if (sAction == "Subscript")
    {
         oDocument.execCommand("Subscript", true);
    }
    else if (sAction == "Find")
    {
    }
    else if (sAction == "Roman")
    {
        oDocument.execCommand("FontName", true, "Times New Roman");
    }
    
    // we need to determine if
    //alert (oRange.parentElement().nodeName+ "\n" + oRange.htmlText);
}

function adxCheckParents (oStartElem, sParent)
{
    // this function will check an element and all it's parents for the existence of a tag
    var oElem = oStartElem;
    var bReturn = false;
    var sLowerParent = sParent.toLowerCase();
    var sTemp = "";

    while (oElem && oElem.nodeName.toLowerCase() != "body" && bReturn == false)
    {
        if (oElem.nodeName.toLowerCase() == sLowerParent)
        {
            bReturn = true;
        }
        else
        {
            sTemp += oElem.nodeName + " ";
            oElem = oElem.parentNode;
        }
    }
    
    //alert (oStartElem.outerHTML + "\n\n" + sTemp);
    return bReturn;
}

function adxEditorResize(sEditor, sMenu)
{
	if (!sEditor)
	{
		sEditor = "EditorDiv";
	}
	
	if (!sMenu)
	{
		sMenu = "MenuDiv";
	}
	
    var oEditorDiv = document.getElementById(sEditor);
    var oMenuDiv = document.getElementById(sMenu);
    
     
    if(oMenuDiv)
    {
		if(document.body.clientHeight > oMenuDiv.scrollHeight)
		{
		    oEditorDiv.style.height = document.body.clientHeight - oMenuDiv.scrollHeight;
		}
	}
	else if(oEditorDiv)
	{
		oEditorDiv.style.height = document.body.clientHeight
	}	
}

function adxPreloadToolbar (oXML)
{
    var aNodes = oXML.selectNodes ("adxToolbar//Button[@ImageUp != '']")
    var aImages = new Array();
    
    var i;
    for (i=0; i<aNodes.length; i++)
    {
        aImages[aImages.length] = aNodes[i].getAttribute("ImageUp");
    }
    return adxPreload (aImages);
}

/*
 * Sept 10, 2003 [Cam]
 *  - Refactored to eliminate an odd resizing/scrolling issue
 *  - We are now hidding all of the tabs first, then setting a tab to active
 *     - this stops the parent container from stretching to fit possibly 2
 *       active tabs and then shrinking to the actual active container.
 *     - this crazy resizing was causing items to be scrolled and for
 *       the entire thing to "jump" around
 */
function adxTabSwitch (sName, aTabs,sImagesPath,sFocus)
{	
	if(document.activeElement != null && document.activeElement.tagName.toLowerCase() != "body")
	{
	
		//alert(document.activeElement.tagName);
		document.activeElement.blur();
	}
    // set the images path
	if(sImagesPath == null)
	{
		sImagesPath = "/adx/admin/images/"
	}

    // hide all tabs first. This will stop werid resizing/scrolling issues
    _hideAllTabs(aTabs,sImagesPath);
    
    // setup all of the pieces
    var oTabDiv = document.getElementById(sName);
	if (oTabDiv == null)
	{
		//alert ("adxTabSwitch(): Cannot find tab named '" + sName + "'");
		return;
	}
    var oTabTop = document.getElementById (sName+"adxTabTop");
    var oTabContent = document.getElementById (sName+"adxTabContent");
    var oTabBottom1 = document.getElementById (sName+"adxTabBottom1");
    var oTabBottom2 = document.getElementById (sName+"adxTabBottom2");
    var oTabBottom3 = document.getElementById (sName+"adxTabBottom3");
    var oTabFarLeft = document.getElementById (sName+"adxTabFarLeft");
    var oTabLeft = document.getElementById (sName+"adxTabLeft");
    var oTabRight = document.getElementById (sName+"adxTabRight");    
    
    if (oTabContent==null)
    {
		alert ('tab content is null');
    }
    
    if (oTabContent)
    {
		
        // make this tab active        
        //var pattern = /(adxTabDiv(Show|Hide){1}){1}/; 
        var pattern = /adxTabDivHide/;
        oTabDiv.className = oTabDiv.className.replace (pattern, "adxTabDivShow");        
        
        // find something to focus on or the cursor will look funny
        if (sFocus != null && sFocus != '')
        {
            try
            {
			    var oFocus = document.getElementById(sFocus);
			    oFocus.focus();
			}
			catch(e)
			{		
			}
        }
        else if(sFocus == "NoFocus")   
        {
            // do nothing
        }
        else
        {
            try
            {                    
				/*********** testing for a tag to focus on *************/
				var iChildCount = oTabDiv.all.length, sTag;
				for (var j=0; j < iChildCount; j++)
				{
					sTag = oTabDiv.all[j].tagName;
					sTag = sTag.toUpperCase()
					if (sTag == "SELECT" || sTag == "INPUT" || sTag == "TEXTAREA")
					{
						if (!oTabDiv.all[j].disabled && oTabDiv.all[j].type != "hidden" && oTabDiv.all[j].style.visibility != "hidden")
						{
							oTabDiv.all[j].focus();
							break;
						}
					}
				}
            }
            catch(e)
            {
            }

        }//else
                                  
        oTabTop.className="EditorLight"
        oTabContent.className="EditorLight"
        oTabBottom1.className="EditorLight"
        oTabBottom2.className="EditorLight"
        oTabBottom3.className="EditorLight"
        
        if (oTabFarLeft)
        {
            oTabFarLeft.src = sImagesPath+"on_far_left.gif";
        }
        if (oTabLeft)
        {
            oTabLeft.src = sImagesPath+"on_left.gif";
        }
        if (oTabRight)
        {
            oTabRight.src = sImagesPath+"on_right.gif";
        }
    }// oTabContent is not null                     
                
}//adxTabSwitch

/*
 * Sept 10, 2003 [Cam]
 *  - Added to hide the currently visible tab in a tab set.
 *  - Before we would loop through all tabs and either activate
 *    or de-activate each tab, which means that X-1 tabs would
 *    be de-activated eventhough only 1 would need it, and it
 *    left the possibility for more than 1 tab to be activated
 *    at any given time, (even if just for an instant).
 */
function _hideAllTabs(aTabs,sImagesPath)
{
    for (i=0; i< aTabs.length; i++)
    {
        var oTabDiv = document.getElementById(aTabs[i]);
        if (oTabDiv == null)
        {
			//alert ("_hidAllTabs (): Cannot find tab named '" + aTabs[i] + "'");
		}
		else if(oTabDiv.className.indexOf ("adxTabDivShow") != (-1))		
        {
            var oTabTop = document.getElementById (aTabs[i]+"adxTabTop");
            var oTabContent = document.getElementById (aTabs[i]+"adxTabContent");
            var oTabBottom1 = document.getElementById (aTabs[i]+"adxTabBottom1");
            var oTabBottom2 = document.getElementById (aTabs[i]+"adxTabBottom2");
            var oTabBottom3 = document.getElementById (aTabs[i]+"adxTabBottom3");
            var oTabFarLeft = document.getElementById (aTabs[i]+"adxTabFarLeft");
            var oTabLeft = document.getElementById (aTabs[i]+"adxTabLeft");
            var oTabRight = document.getElementById (aTabs[i]+"adxTabRight");
			
            oTabDiv.className = oTabDiv.className.replace (/adxTabDivShow/, "adxTabDivHide");

            oTabTop.className="EditorUn"
            oTabContent.className="EditorUn"
            oTabBottom1.className="EditorDark"
            oTabBottom2.className="EditorMid"
            oTabBottom3.className="EditorWhite"

            if (oTabFarLeft)
            {
                oTabFarLeft.src = sImagesPath+"off_far_left.gif";
            }
            if (oTabLeft)
            {
                oTabLeft.src = sImagesPath+"off_left.gif";
            }
            if (oTabRight)
            {
                oTabRight.src = sImagesPath+"off_right.gif";
            } 
            
        }// if currently visible       
    }// for each tab
    
}//_hideAllTabs


/// <summary>
/// This method will swap two elements so that their order is reversed. 
/// <remarks>
/// <p>The elements are reversed by manually exchanging the outerHTML of the two elements being swapped. 
/// The outerHTML is swapped rather than using the swapNode() method because, after using swapNode(), 
/// the state of radio buttons and checkboxes is not maintained, causing the default values on these 
/// input fields to be set after the swap occurs.</p>
/// <p>Manually swapping the outerHTML of the two elements has its own deficiency as well - file input fields 
/// do not carry over the state after the swap occurs.</p>
/// </remarks>
/// </summary>
function adxSectionMove(sSectionName,sMove)
{
    var oSection = document.getElementById(sSectionName); 
    var oParent = oSection.parentNode
    
    if(sMove == "up")
    {
        if(oParent.childNodes[0] == oSection)
        {
            alert("The first section cannot be moved up.")
        }
        else
        {
            adxSectionSwap(oSection, oParent.children[sSectionName].previousSibling)
        }
    }
    else if(sMove == "down")
    {
        if(oParent.childNodes[oParent.childNodes.length-1] == oSection)
        {
            alert("The last section cannot be moved down.")
        }
        else
        {
            adxSectionSwap(oSection, oParent.children[sSectionName].nextSibling)
        }
    }   
}

function adxSectionSwap(section, sibling) {
    
    if (typeof(HtmlEditor) != 'undefined') { HtmlEditor.removeControls(); }

	section.swapNode(sibling);
    //section.parentNode.replaceChild(sibling.cloneNode(true), section);
    //sibling.parentNode.replaceChild(section.cloneNode(true), sibling);
    /*
    var siblingHTML = sibling.outerHTML
    var sectionHTML = section.outerHTML
    
    section.outerHTML = siblingHTML
    sibling.outerHTML = sectionHTML
    */
    if (typeof(HtmlEditor) != 'undefined') { HtmlEditor.initializeNonTemplateControls(); }
    
    section.scrollIntoView(true);
}


function adxSectionDelete(sSectionID, bConfirm)
{

    // deletes the requested section
    var bConfirmed = true;
    if (bConfirm == null || bConfirm == true)
    {
        bConfirmed = window.confirm("Are you sure you want to delete this?  ");
    }
    if(bConfirmed)
    {
        var oDelete = document.getElementById(sSectionID)
        var oParent = oDelete.parentNode
        oParent.removeChild(oDelete)
    
        //if this was the last section add an empty one
        if(oParent.children.length == 0)
        {
            var sTemplateID = sSectionID.split(";")[0] + ";%i%"
            adxBuildSection(oParent.id,sTemplateID, 1)
        }
    }
}

function adxBuildSection (sParentID,sTemplateID,iSections)
{
  var sError = "";

  if(iSections == 0 || iSections == null)
  {
    iSections = 1;
  }

  // builds the required number of sections on editor load.
  var oParent = document.getElementById(sParentID);
  var oTemplate = document.getElementById(sTemplateID);

  if(!oParent)
  {
    sError += "Could not find requested element '"+sParentID+"'\n"
    sError += "It does not appear to exist in the DOM for this page.\n\n"
  }
  
  if(!oTemplate)
  {
    sError += "Could not find requested element '"+sTemplateID+"'\n"
    sError += "It does not appear to exist in the DOM for this page.\n\n"
  }
  
  if(sError != "")
  {
    alert("ERROR in function adxBuildSection()\n\n"+ sError +"Sections of this document may not be displayed.");
    return;
  }

  var re = new RegExp ("%i%", "gi");
  var i = 1;

  for(i ; i <= iSections ; i++)
  {	
    var sHTML = oTemplate.outerHTML.replace(re,i);
    oParent.insertAdjacentHTML ("beforeEnd", sHTML);
    window.status = "";
    
    // TinyMCE initialization
    if (typeof(HtmlEditor) != 'undefined') {
      HtmlEditor.initializeControls(document.getElementById(sTemplateID.replace(re, i)));
    }
  }
}


function adxSectionAdd(sSectionName)
{
	//alert(sSectionName)
    // add the requested section after sSectionName
    var oSibling = document.getElementById(sSectionName);
    //alert(oSibling)
    var iNew = oSibling.parentNode.childNodes.length + 1
    
    var sTemplateID = sSectionName.split(";")[0] + ";%i%"
    var oTemplate = document.getElementById(sTemplateID);
    //alert(oTemplate)
    var re = new RegExp ("%i%", "gi");
    // check to see if this ID is already in use
    //This can occur if some items have been deleted
    iNew  = adxTestSectionName(sTemplateID.replace(re,iNew));  
    
  
    var sHTML = oTemplate.outerHTML.replace(re,iNew);
    
    oSibling.insertAdjacentHTML ("afterEnd", sHTML); 
    window.status = "";
    
    if (typeof(HtmlEditor) != 'undefined') {
      HtmlEditor.initializeControls(document.getElementById(sTemplateID.replace(re, iNew)));
    }
    
    return iNew;
}

function adxTestSectionName(sSectionName)
{
	//this checks for an instance of a section
	 var oSection = document.getElementById(sSectionName);
	 var sSectionID = sSectionName.split(";")[1]
	 var sSectionBegin = sSectionName.split(";")[0]
	 if(oSection == null)
	 {
		//this doesn't exsist return the string
		return sSectionID
	 }
	 else
	 {
		//this does exsist loop
		sSectionID = Number(sSectionID)+ 1
		var sNewSectionName = sSectionBegin + ';' + sSectionID
		return adxTestSectionName(sNewSectionName)
	 }
}

function setInnerHTML(sName,sValue)
{
	var oNode = document.all[sName]
	
	if(oNode == null || oNode.tagName == undefined)
	{
		oNode = document.getElementById(sName);
		
		if(oNode == null || oNode.tagName == undefined) return
	}

	if (oNode.tagName.toLowerCase () == "input")
	{
		oNode.value = sValue;
	}
	else
	{
		oNode.innerHTML = sValue;
	}
}

function adxSwitchLanguage (sLanguage)
{
    //get all the spans    
    var oSpans = document.getElementsByTagName("span")

    for(var i=0 ; i < oSpans.length ; i++)
    {
        for (j=0; j<aLanguages.length; j++)
        {
            var oElem = oSpans.item(i)
                      
            // check if this is the new language
            if(oElem.id.indexOf("adxLanguage") != -1)
            {
                
                if (oElem.id.indexOf(sLanguage) != -1)
                {
                    // show it
                    oElem.style.visibility =  "visible";
                    oElem.style.display =  "";
                }
                else
                {
                    // hide it
                    oElem.style.visibility =  "hidden";
                    oElem.style.display =  "none";
                }
            }
        }  
    }
}

function adxBrowseSurvey(sDNField, sTitleField)
{	
	var oTree = new adxXMLDocument(window.opener.document.all("xml").XMLDocument.xml)
    var iLeft = window.screenLeft 
	var iTop = window.screenTop
	
    adxXML_RemoveNodes (oTree.oXML, "/TreeView/Contents/Node[@ObjectClass != 'adxSurveyRoot.1']")
    
    var aResult = window.showModalDialog('/adx/admin/adxTree.aspx',oTree.oXML,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:400px;dialogHeight:400px; scroll:no;dialogTop:"+iTop+";dialogLeft:"+iLeft)
    //alert(sDNField + " / " + sTitleField)
    //alert(aResult[0] + " / " + aResult[1])
    if(aResult != null)
    {   
        if (aResult[0] != null && aResult[0] != "")
        {
	        if (aResult[0].indexOf(":") >= 0)
		    {
				adxFieldInit (sDNField, escape(aResult[0].split(":")[1]));
			}
			else
			{
				adxFieldInit (sDNField, escape(aResult[0]));
			}
        }
        if (aResult[1] != null && aResult[1] != "")
        {
			adxFieldInit (sTitleField, escape(aResult[1]));
        }
        eles
        {
			adxFieldInit (sTitleField, escape(aResult[1]));
        }
    }
}

function adxGetSurvey(sID,sField)
{	
    if(sID != "")
    {
        var sReturn = adxXMLHTTP("/adx/admin/aspx/Services/GetSurveyName.aspx?DN="+sID)
        adxFieldInit (sField, sReturn);
    }
}

// opens a window for browsing the document tree
function adxBrowseTree(sDNField, sTitleField)
{		
	adxBrowseTree(sDNField, sTitleField, false, false)
}

// opens a window for browsing the document tree
function adxBrowseTree(sDNField, sTitleField, bForceNewTreeView)
{		
	adxBrowseTree(sDNField, sTitleField, bForceNewTreeView, false)
}

// opens a window for browsing the document tree
function adxBrowseTree(sDNField, sTitleField, bForceNewTreeView, bAllowShortcuts)
{		
	var oTree = GetTreeView(bForceNewTreeView);
	
    adxXML_RemoveNodes (oTree.oXML, "/TreeView/Contents/Node[@ObjectClass != 'adxDocumentRoot']")

    var iLeft = window.screenLeft 
	var iTop = window.screenTop

	var sTreeviewUrl = '/adx/admin/adxTree.aspx'

	if (bAllowShortcuts == true)
	{
		sTreeviewUrl += '?allowShortcuts=true'
	}

    var aResult = window.showModalDialog(sTreeviewUrl,oTree.oXML,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:400px;dialogHeight:400px; scroll:no;dialogTop:"+iTop+";dialogLeft:"+iLeft)
    
    if(aResult != null)
    {   
        if (aResult[3] != null && aResult[3] != "")
        {
            adxFieldInit (sDNField, escape(aResult[3]));
        }
        else
        {
            adxFieldInit (sDNField, escape(aResult[0]));
        }
        
        adxFieldInit (sTitleField, escape(aResult[1]));
    }
}

///<summary>
/// Allows for browsing in the console tree for adxResource.1 documents
/// Does not restrict the tree scope, but limits the selection of only adxResource.1 document types
///</summary>
///<param name="sDNField">The field on the editor that will be populated with the DN of the selected resource</param>
///<param name="sTitleField">The field on the editor that will be populated with the title of the selected resource</param>
function adxBrowseResources(sDNField, sTitleField)
{
	var oTree = GetTreeView();

    var iLeft = window.screenLeft 
	var iTop = window.screenTop

	// restrict the search to only documents
    adxXML_RemoveNodes (oTree.oXML, "/TreeView/Contents/Node[@ObjectClass != 'adxDocumentRoot']")
    	
    var aResult = window.showModalDialog('/adx/admin/adxTree.aspx',oTree.oXML,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:400px;dialogHeight:400px; scroll:no;dialogTop:"+iTop+";dialogLeft:"+iLeft)
    
    if(aResult != null)
    {   
        // only initialize the fields if a resource has been selected
        if (aResult[4] != null && aResult[4] == "adxResource.1")
        {
            if (aResult[3] != null && aResult[3] != "")
            {
                adxFieldInit (sDNField, escape(aResult[3]));
            }
            else
            {
                adxFieldInit (sDNField, escape(aResult[0]));
            }
            
            adxFieldInit (sTitleField, escape(aResult[1]));        
        
        } // if aResult[4] != null
        else
        {
            alert("You have not selected a Resource file.\nClick 'Browse' again and select a resource file to link to.");
        }
        
    } // aResult != null 

} // adxBrowseResources

// Returns the TreeView xml.  If the window is opened from within the console, the already loaded console tree view xml is returned.
// If the window is opened from outside the console (such as from the edit link when in preview mode) there will be no console tree view xml,
// so the TreeView xml will be queried for and returned.
function GetTreeView()
{
	GetTreeView(false);
}

// Returns the TreeView xml.  If the window is opened from within the console, the already loaded console tree view xml is returned.
// If the window is opened from outside the console (such as from the edit link when in preview mode) there will be no console tree view xml,
// so the TreeView xml will be queried for and returned.
function GetTreeView(bForceNew)
{
	var oOpener = window.top.opener;

	var oTree;

    if(!bForceNew && oOpener != null && oOpener.document.all("xml") != null)
    {
        oTree = new adxXMLDocument(oOpener.document.all("xml").XMLDocument.xml);
    }
    else
    {
        oTree = new adxXMLDocument(adxXMLHTTP("/adx/admin/aspx/InitTreeView.aspx"));
    }

	return oTree;
}

function BrowseUsers(sDNField,sTitleField)
{	
	//alert(window.opener.document.getElementById("xml"));
	var oTree = new adxXMLDocument(window.opener.document.getElementById("xml").XMLDocument.xml)
    
    adxXML_RemoveNodes (oTree.oXML, "/TreeView/Contents/Node[@ObjectClass != 'adxUserRoot']")
    //alert('here '+oTree.oXML.xml);
    var aResult = window.showModalDialog('/adx/admin/adxTree.aspx',oTree.oXML,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:400px;dialogHeight:400px; scroll:no")
    
    
     if(aResult != null)
    {   
        if (aResult[3] != null && aResult[3] != "")
        {
            adxFieldInit (sDNField, escape(aResult[3]));
        }
        else
        {
            adxFieldInit (sDNField, escape(aResult[0]));
        }
        
        adxFieldInit (sTitleField, escape(aResult[1]));
    }
}

function adxGetUserName(sID,sTitleField)
{
    if(sID != "")
    {
		
        //var sReturn = adxXMLHTTP("/adx/admin/asp/GetObjectTitle.asp?DN="+sID)   
        var sReturn = adxXMLHTTP("/adx/admin/asp/GetFormattedUsername.asp?DN="+sID)   

        adxFieldInit (sTitleField, sReturn);
    }    
}

function adxGetObjectProperty(sID,sField,sLDAPProperty)
{	
    if(sID == "") return;
    
    var sReturn = adxXMLHTTP("/adx/admin/aspx/Services/GetObjectProperty.aspx?DN="+sID+"&Property="+sLDAPProperty);
    adxFieldInit (sField, sReturn);
}

function adxSetTextInputValueAndTitleToObjectProperties(sID, sField, sValueProperty, sTitleProperty)
{
	if (sID == "") return;
	
	var sValue = adxXMLHTTP("/adx/admin/aspx/Services/GetObjectProperty.aspx?DN="+sID+"&Property="+sValueProperty);
    adxFieldInit (sField, sValue);

	var sTitle = adxXMLHTTP("/adx/admin/aspx/Services/GetObjectProperty.aspx?DN="+sID+"&Property="+sTitleProperty);
	document.getElementById(sField).title = sTitle;
}

function adxUserGetGroups(oSelect, bIncludeUsers)
{
	var iLeft = window.screenLeft 
	var iTop = window.screenTop
	
	
	var sResult = window.showModalDialog('/adx/admin/asp/GetGroups.asp?IncludeUsers=' + (bIncludeUsers==true?'true':'false'),null,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:400px;dialogHeight:400px; scroll:no;dialogTop:"+iTop+";dialogLeft:"+iLeft)
	if(sResult != null)
	{
		var oXML = adxXMLDOM()
		oXML.loadXML(unescape(sResult))
	
		var oGroups = oXML.selectNodes("groups/SPAN")

		
			
		for(var i=0 ; i < oGroups.length ; i ++)
		{
			adxFieldInit(oSelect.id,"<option value=\""+oGroups[i].getAttribute("adxDN")+"\">"+oGroups[i].text+"</option>");	
		}
		
	}
}

function adxDistuibutionListGetGroups(oSelect)
{
    return adxDistributionListGetGroups(oSelect);
}

function adxDistributionListGetGroups(oSelect)
{
	var sSelectedGroups = "";
	for (var i=0; i<oSelect.options.length; i++)
	{
		sSelectedGroups += oSelect.options[i].value + ",";
	}
		
	var iLeft = window.screenLeft 
	var iTop = window.screenTop
	
	var sResult = window.showModalDialog('/adx/admin/aspx/services/GetDistributionList.aspx?sSelectedGroups='+escape(sSelectedGroups),null,"status:off;help:off;unadorned:no;edge:raised;dialogWidth:300px;dialogHeight:420px; scroll:no;dialogTop:"+iTop+";dialogLeft:"+iLeft)
	//alert(sResult)
	
	if(sResult != null)
	{
		var oXML = adxXMLDOM()
		oXML.loadXML(sResult)
	
		var oGroups = oXML.selectNodes("groups/span")
		oSelect.length = 0;	//reset
		for(var i=0 ; i < oGroups.length ; i ++)
		{
			var oOption = new Option;
			oOption.text = unescape(oGroups[i].text);
			oOption.value = oGroups[i].getAttribute("value");
			oSelect.options[oSelect.length] = oOption;
		}
	}
}

function getUserDisplayString(sDN)
{
	sDN = sDN.replace(/OU=/g,"")
	
	aDN = sDN.split(",")
	aDN.reverse()
	
	sDN = aDN[0];
	
	for (var i = 1; i < aDN.length; i++)
	{
		sDN += "\\"+aDN[i];
	}
	
	return sDN
}//end of getUserDisplayString

function adxUserRemoveGroup(oSelect)
{
	while(oSelect.selectedIndex != -1)
	{
		oSelect.remove(oSelect.selectedIndex)
	}
}

function adxUserGroupsSelectAll(oSelect)
{

	alert("submitting")
} 

function adxViewDocument (sIDField, sTitleField)
{
    var sID = document.all(sIDField).value;
    var sTitle = document.all(sTitleField).value;
	
	if (sID != "" && sTitle != "") {
		window.open("/adx/aspx/PreviewMode.aspx?Mode=Preview&URL=/Default.aspx?DN="+sID, "_blank");
	} else {
		alert('There is no document to view!');
	}
}

function adxViewMedia (sIDField, sFilenameField, sDN)
{
    var sID = document.all(sIDField).value;
    var sFilename = document.all(sFilenameField).value;
	
	if(sID != "" && sFilename != "")
	{
		//alert ("View media id=" + sID + " filename='" + sFilename+"' sDN='" + sDN + "'");
		window.open("/adx/aspx/adxgetmedia.aspx?MediaID="+sID+"&Filename="+sFilename,"_blank")
	}
	else
	{
		alert('No media attached!')
	}
}

/// <summary>
/// Allows viewing of a resource from an editor  
/// </summary>
///<param name="sResourceDNField">The field that holds the DN of the resource to be viewed</param>
function adxViewResource(sResourceDNField)
{    
    var oResourceDN = document.all(sResourceDNField);
    
    // only view if the resource DN has been set
    if (oResourceDN != null && oResourceDN.value != null && oResourceDN.value != "")
    {        
        window.open("/adx/aspx/adxGetMedia.aspx?DocID="+oResourceDN.value,"_blank")
    }
    else
    {
        alert("No resource attached");
    }

} // adxViewResource


function adxSetEditorTitle(sTitle)
{
	document.title = sTitle;
	
}

function adxCtrlKeyPress() 
{
	editEvent = window.event;
	//window.status=editEvent.keyCode;
	if (editEvent.ctrlKey && (editEvent.keyCode == 83)) 
	{ 
	  editEvent.cancelBubble = true;
	  editEvent.returnValue = false;
	  SaveAndClose();	 
	}
	return;
}

function adxRemoveMedia(sFilenameID,sMediaID)
{
	adxFieldInit(sFilenameID, '');
	adxFieldInit(sMediaID, '');
}

//Create an iframe for the calendar control
function getCalendarFor(target, dateFormat)
{
	sTarget = String(target);
    idTarget = "ID" + target;
	ifrm = document.createElement("iframe");
	ifrm.onblur = function(){DeleteIframeElement();};
	ifrm.style.width = 152;
	ifrm.style.height = 163;
    ifrm.style.posLeft = event.clientX - event.offsetX - 100;
	ifrm.style.posTop = event.clientY - event.offsetY - 2;
	ifrm.scrolling = "no";
	ifrm.id = idTarget;
	ifrm.name = "name" + target;
	ifrm.style.position = "absolute";	
	ifrm.style.visibility = "visible";
	ifrm.unselectable = "on";
	ifrm.border = 0;
	ifrm.frameBorder = 0;
	ifrm.marginHeight = 0;
	ifrm.marginWidth = 0;
	
	var calendarUrl = "/adx/admin/editors/picker/calendar/ConsoleCalendar.aspx?Return=" + sTarget;
	if(typeof(dateFormat) != "undefined")
	{
		calendarUrl += "&DateFormat=" + dateFormat;
	}
    
    ifrm.src = calendarUrl;
    
	document.body.appendChild(ifrm);
	document.getElementById(idTarget).focus();
	gblCalendarobj = sTarget;
}

//Used by getCalendarFor(target) to return values to the form
function UpdateCalendarForm(elemItem,elemValue)
{
    document.getElementById(elemItem).innerText=elemValue;
}

//Delete IframeElement on the form
function DeleteIframeElement() 
{
    DeleteElement('ID' + gblCalendarobj);
}

//Set the parent window textbox with a date selected from the iframe; then close the iframe
function ReturnIframetoSource() 
{
    var Target=document.getElementById('txt_Target').value;
    var DateValue=document.getElementById('txtDate').value;   
    parent.document.getElementById(Target).value = DateValue;
    DeleteParentElement(Target);
}


/* PopUp Calendar v2.1
© PCI, Inc.,2000  Freeware
webmaster@personal-connections.com
+1 (925) 955 1624
Permission granted  for unlimited use so far
as the copyright notice above remains intact. */

/* this has been highly modified - although a few date functions from the freeware have been used*/

//TODO: Remove in ADX 6.0
var sDateFormat = "m/d/Y";
var aMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var aWeek = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var aMonthLength=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var adxTT= '';
var adxCD=adxTT;
var adxSV=null;
var adxRL=null;
var adxPreDate=null;

var adxNow=new Date();
var adxPtr=new Date();
var sTarget


//this blurs the popup on cancel 
 function CancelPop(target)
 {
	
	target = target.replace('\(','\(\'');
	target = target.replace('\)','\'\)');
	adxSV = eval(target) 
	if ((adxSV != null)&&(adxSV)) 
	{
		adxSV.value = '';
		
		window.parent.oPopup.hide();
	}
	
	//this.blur();
 }
 
//oPopup = window.createPopup();

//on this creates the popup
function createCalPopup(stext){

   oPopup = window.createPopup();

    var sPopupHTML = ""
    sPopupHTML += '<HTML>'
    sPopupHTML += '<HEAD>'
    sPopupHTML += '<TITLE></TITLE>'
    sPopupHTML += '<LINK rel="stylesheet" type="text/css" href="/adx/css/adxcss.aspx">'
    sPopupHTML += '\x3cSCRIPT language="Javascript" src="/adx/admin/js/adxDocumentEditorJS.aspx">\x3c/SCRIPT>'
    sPopupHTML += '</HEAD>'
    sPopupHTML += '<BODY STYLE="visibility:hidden" onload="Javascript:this.document.body.style.visibility = \'visible\'" class="adxContextMenu" border="0">'
    if (stext){sPopupHTML += stext}
    sPopupHTML += '<input name="TargetText" id="TargetText" type="hidden" value="'+sTarget+'" >';
    sPopupHTML += '</BODY>'
    sPopupHTML += '</HTML>'

	//alert(sPopupHTML);
    var oNewDoc = oPopup.document.open("text/html");
    oNewDoc.write (sPopupHTML);
    oNewDoc.close();
    oPopup.show (1,1,155,162,document.getElementById(sTarget))
    
} 
 
//this updates the contents of the popup 
function UpdateCalPopup(stext)
{
	//this.
    var sPopupHTML = ""
    sPopupHTML += '<HTML>'
    sPopupHTML += '<HEAD>'
    sPopupHTML += '<TITLE></TITLE>'
    sPopupHTML += '<LINK rel="stylesheet" type="text/css" href="/adx/css/adxcss.aspx">'
    sPopupHTML += '\x3cSCRIPT language="Javascript" src="/adx/admin/js/adxDocumentEditorJS.aspx">\x3c/SCRIPT>'
    sPopupHTML += '</HEAD>'
    sPopupHTML += '<BODY STYLE="visibility:hidden" onload="Javascript:this.document.body.style.visibility = \'visible\'" class="adxContextMenu" border="0">'
    if (stext){sPopupHTML += stext}
    sPopupHTML += '<input name="TargetText" id="TargetText" type="hidden" value="'+sTarget+'" >';
    sPopupHTML += '</BODY>'
    sPopupHTML += '</HTML>'

	//alert(sPopupHTML);
    var oNewDoc = this.document.open("text/html");
    oNewDoc.write (sPopupHTML);
    oNewDoc.close();   
    //this.document.show(); 
}  

//this function simply calls the set calendar and makes the calendar visible
//TODO: Remove Javascript Calendar
function getCalendarForOld(target) 
{
	sTarget = String(target);
	//adxSV = eval('parent.document.all.'+target)
	adxSV = document.getElementById (target);
	if((adxSV.className).indexOf("ReadOnly")!=-1)
	{
	    return;
	}
	
	// if the input has a date value open the calendar there.
	if(adxSV.value != "")
	{
		adxNow = new Date(adxSV.value)
	}
	else
	{
		adxNow = new Date()
	}
	//set calendar
	var year = getFullYear(adxNow)
	var month = adxNow.getMonth();
	setSelectList(year,month);
	if (month == 1) 
	{
		aMonthLength[1]  = (isLeap(year)) ? 29 : 28;
	}
	adxPtr.setYear(year);
	adxPtr.setMonth(month);
	adxPtr.setDate(1);

	//create contents
	generateContent();
	createCalPopup(adxCD);
	adxCD = adxTT;
}
 
 //this function simply pops up the time selector
function getTimeFor(target) 
{
	sTargetTime = String(target);
	//adxTimeSV = eval('parent.document.all.'+target)
	//set time
 
	oPopup2 = window.createPopup();
	var  sTDHTML  = '<tr><td align="right" onMouseOver="this.className=\'TimeHover\'" onMouseOut="this.className=\'TimeNormal\'" '; 
    var aTimes = new Array('6:00 AM', '7:00 AM', '8:00 AM', '9:00 AM', '10:00 AM', '11:00 AM', '12:00 PM', '1:00 PM', '2:00 PM', '3:00 PM', '4:00 PM', '5:00 PM', '6:00 PM', '7:00 PM', '8:00 PM', '9:00 PM', '10:00 PM', '11:00 PM', '12:01 AM', '1:00 AM', '2:00 AM', '3:00 AM', '4:00 AM', '5:00 AM')
    var sPopupHTML = ""
    sPopupHTML += '<HTML>'
    sPopupHTML += '<HEAD>'
    sPopupHTML += '<TITLE></TITLE>'
    sPopupHTML += '<LINK rel="stylesheet" type="text/css" href="/adx/css/adxcss.aspx">'
    sPopupHTML += '\x3cSCRIPT language="Javascript" src="/adx/admin/js/adxDocumentEditorJS.aspx">\x3c/SCRIPT>'
    sPopupHTML += '</HEAD>'
    sPopupHTML += '<BODY class="adxContextMenu" border="0">'
    sPopupHTML += '<DIV name="TableDiv" id="TableDiv" STYLE="overflow:scroll; height=162; width=98">'
    sPopupHTML += '<table border="0" width="82" cellspacing="0" cellpadding="0" >' 
    for (var i=0;i<aTimes.length;i++)
    {
		var oCurrentTime = eval("document.getElementById('"+sTargetTime+"')");	
		if (aTimes[i] == oCurrentTime.value)
		{	
			sPopupHTML +=  '<tr><td align="right" onMouseOver="this.className=\'TimeHover\'" onMouseOut="this.className=\'TimeCurrent\'" '; 
			sPopupHTML +=  'onclick="Javascript:selectTime(\''+aTimes[i]+'\',\'parent.document.getElementById('+sTargetTime+')\')"';
			sPopupHTML +=  ' Class="TimeCurrent">'+aTimes[i]+'&nbsp;&nbsp;</td></tr>'
		}
		else
		{
			sPopupHTML += sTDHTML + 'onclick="Javascript:selectTime(\''+aTimes[i]+'\',\'parent.document.getElementById('+sTargetTime+')\')"';
			sPopupHTML += ' Class="TimeNormal">'+aTimes[i]+'&nbsp;&nbsp;</td></tr>'
		}    
    }
    sPopupHTML += '</table>';
    sPopupHTML += '</DIV>'
    sPopupHTML += '<input name="TargetText" id="TargetText" type="hidden" value="'+sTargetTime+'" >';
    sPopupHTML += '</BODY>'
    sPopupHTML += '</HTML>'

	//alert(sPopupHTML);
    var oNewDoc = oPopup2.document.open("text/html");
    oNewDoc.write (sPopupHTML);
    oNewDoc.close();
    oPopup2.show (1,1,100,150,document.getElementById(sTargetTime))
 }
  
function selectTime(param, target) 
{
   target = target.replace('(','(\'');
   target = target.replace(')','\')');
   var oTarget = eval(target) ;
   oTarget.value = param;
   //alert(oTarget.name+":"+oTarget.value+":"+param);
   //this.blur();
   window.parent.oPopup2.hide();
}

//this function sets the appropirate dates  
function setCalendar(year,month) 
{
	sTarget = this.document.all.TargetText.value
	//alert(sTarget);
	setSelectList(year,month);
	if (month == 1) 
	{
		aMonthLength[1]  = (isLeap(year)) ? 29 : 28;
	}
	adxPtr = new Date();
	adxPtr.setYear(year);
	adxPtr.setMonth(month,1);
	//adxPtr.setDate(1);
	//alert(adxPtr.toLocaleString());
	
	updateContent();
}  

//updates contents
function updateContent() 
{
	generateContent();
	UpdateCalPopup(adxCD);
	adxCD = adxTT;
}
 
//generates calendar numbering
function generateContent() 
{
	var year  = getFullYear(adxPtr);
	var month = adxPtr.getMonth();
	var date  = 1;
	var day   = adxPtr.getDay();
	var len   = aMonthLength[month];
	var bgr,cnt,tmp = "";
    var TodayButVal = new Date();
	var sTodayButVal = TodayButVal.getFullYear() + "|" + TodayButVal.getMonth() + "|" + TodayButVal.getDate();
	
	//alert("day = " + day + "\n" + adxPtr.toLocaleString());
	
	//get today button 
	//var sTempDay = adxNow.getDate(), sTempMonth = adxNow.getMonth(), sTempYear = getFullYear(adxNow);
	//var sTempDate = sTempYear+"|"+sTempMonth+"|"+sTempDay;
	//var sTempToday = '<span onclick="Javascript:selectDate(\''+sTempDate+'\',\'parent.document.getElementById('+sTarget+')\')"><img src="/adx/admin/images/calendar/cal_today.gif" border="0"></span>'
	var sTempToday = '<span onclick="Javascript:selectDate(\''+sTodayButVal+'\',\'parent.document.getElementById('+sTarget+')\')"><img src="/adx/admin/images/calendar/cal_today.gif" border="0"></span>'
	try
	{
		var sTempStringElement= 'document.getElementById(\''+sTarget+'\')';
		var sTempObject = eval(sTempStringElement)
		adxPreDate=new Date(sTempObject.value)	
		//alert(adxPreDate)
	}
	catch(e)
	{
		try
		{
			var sTempStringElement= 'parent.document.getElementById(\''+sTarget+'\')';
			var sTempObject = eval(sTempStringElement)
			adxPreDate=new Date(sTempObject.value)	
			//alert(adxPreDate)
		}
		catch(e)
		{}
	}
	
	
	var j,i = 0;
	for (j = 0; j < 7; ++j) 
	{
		if (date > len) 
		{
			//end of the month
			break;
			
		}
		
		for (i = 0; i < 7; ++i) 
		{
			bgr = "#FFFFFF";
			
			//alert(day)
			
			if (((j == 0)&&(i < day))||(date > len)) 
			{
				tmp  += makeCell(bgr,year,month,0);
			}
			else 
			{
				tmp  += makeCell(bgr,year,month,date);
				//alert(date)
				++date;
				//alert(date)
			}
		}
		adxCD += "<tr align=\"center\">\n" + tmp + "</tr>\n";tmp = "";
	}
	adxCD += "<tr><td colspan=\"7\" bgcolor=\"#D6D6CE\"><img src=\"/adx/imgs/spacer.gif\" hieght=\"1\" width=\"1\"></td></tr>"
	adxCD += '<tr><td colspan="7" align="center">'+sTempToday;
	adxCD +='&nbsp;&nbsp;<span onclick="Javascript:CancelPop(\'parent.document.getElementById('+sTarget+')\');"><img src="/adx/admin/images/calendar/cal_none.gif" border="0"></span></td></tr>'

	adxCD += "</table>\n";
	adxCD = '<table width="100% border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td>' +adxCD+ '</td></tr></table>'

 }
 

//creates the cells
function makeCell(bgr,year,month,date) 
{
	var param = "\'"+year+"|"+month+"|"+date+"\'";
	var td1 = "<td width=\"20\" Class=\"CalNormal\" ";
	var td2 = "</span></td>\n"
	var evt = "onMouseOver=\"this.className=\'CalHover\'\" onMouseOut=\"this.className=\'CalNormal\'\" onClick=\"Javascript:selectDate("+param+",'parent.document.getElementById("+sTarget+")')\"";
	var ext = "<span Style=\"cursor: hand\" >";
	var lck = "<span Style=\"cursor: default\">";
	var cellValue = (date != 0) ? date+"" : "&nbsp;";

	if (adxPreDate != null &&(adxPreDate.getDate() == date)&&(adxPreDate.getMonth() == month)&&(getFullYear(adxPreDate) == year)) 
	{
		evt = "onMouseOver=\"this.className=\'CalHoverB\'\" onMouseOut=\"this.className=\'CalNormalB\'\" onClick=\"Javascript:selectDate("+param+",'parent.document.getElementById("+sTarget+")')\"";
		td1 = "<td width=\"20\" Class=\"CalNormalB\" ";
		cellValue = '<B>'+cellValue+'</B>';
	}
	if ((adxNow.getDate() == date)&&(adxNow.getMonth() == month)&&(getFullYear(adxNow) == year)) 
	{
		td1 = "<td width=\"20\" Class=\"CalNormal\" bgcolor=\"#D6D6CE\" ";
		cellValue = ''+cellValue+'';
	}
	var cellCode = "";
	if (date == 0) 
	{
		cellCode = td1+"Style=\"cursor: default\">"+lck+cellValue+td2;  
	}
	else
	{
		cellCode = td1+evt+"Style=\"cursor: hand\">"+ext+cellValue+td2;
	}
	return cellCode;
}

//changes celendar to a new month 
function switchMonth(param) 
{
	// hide here first
	//document.all['PopUpCalendar'].style.visibility = "hidden";
	//alert(param)
	this.document.body.style.visibility = "hidden";
	//alert(this.document.body.style.visibility);

	var tmp = param.split("|");
	setCalendar(tmp[0],tmp[1]);
}
  
 //writes the selected date to the input
function selectDate(param, target) 
{
	var arr   = param.split("|");
	var year  = arr[0];
	var month = arr[1];
	var date  = arr[2];
	var ptr = parseInt(date);
	adxPtr.setDate(ptr);
	target = target.replace('\(','\(\'');
	target = target.replace('\)','\'\)');
	adxSV = eval(target) 
	if ((adxSV != null)&&(adxSV)) 
	{
		if (validDate(date)) 
		{
			var sDateString = dateFormat(year,month,date)
			adxSV.value = adxFormatDate(new Date(sDateString));
			
			//this.blur();
			window.parent.oPopup.hide();
			//alert(adxSV.value);
		}
	}
}
 
//this list creates the dropdown -- not implemented
function setSelectList(year,month){
	var i = 0;
	//this.options[this.selectedIndex].value
	var sSelect = '<td width="70%"><select class="CalDrop" onchange="javascript:switchMonth(this.options[this.selectedIndex].value)">', sNext = '', sPrev = '';
	if (month == 0) {var sTempyear = Number(year)-1
	sPrev = '<td width="15%" align="right" onclick="javascript:switchMonth(\'' +  sTempyear +'|11\')"><img src="/adx/admin/images/calendar/cal_lt_arrow.gif" border="0">&nbsp;</td>'}	
	else {var sTempMonth = Number(month)-1
	sPrev = '<td width="15%" align="right" onclick="javascript:switchMonth(\'' + year +'|'+ sTempMonth + '\')"><img src="/adx/admin/images/calendar/cal_lt_arrow.gif" border="0">&nbsp;</td>'}
	//alert(sPrev)
	//change to 10 from 13 to show
	while (i < 10) {
	    sSelect += '<Option value="'+year + '|' + month + '">';
		sSelect += aMonth[month] + ' ' + year+ '</Option>';
		if (i == 1)(sNext = '<td onclick="javascript:switchMonth(\'' + year +'|'+ month + '\')">&nbsp;<img src="/adx/admin/images/calendar/cal_rt_arrow.gif" border="0"></td>')
		i++;
		month++;
		if (month == 12) {year++;month = 0;}
		}
	sSelect += '</select></td>';
	sSelect = '<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#D6D6CE"><tr>' + sPrev + sSelect + sNext + '</tr></table>';
	adxCD += sSelect;
	adxCD += "<table width=\"150\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\" >\n";
	adxCD += "<tr><td Class=\"CalNormal\">S</td><td Class=\"CalNormal\">M</td><td Class=\"CalNormal\">T</td><td Class=\"CalNormal\">W</td><td Class=\"CalNormal\">T</td><td Class=\"CalNormal\">F</td><td Class=\"CalNormal\">S</td></tr>";
	adxCD += "<tr><td colspan=\"7\" bgcolor=\"#D6D6CE\"><img src=\"/adx/imgs/spacer.gif\" hieght=\"1\" width=\"1\"></td></tr>"
 } 

 //date checking
function isLeap(year) 
{
	if ((year%400==0)||((year%4==0)&&(year%100!=0)))
	{	
		return true;
	}
	else
	{
		return false;
	}
}
 
 //date checking
function getFullYear(obj) 
{
	return obj.getYear();
}
 
 //check to see if valid or not
function validDate(date) {
 var reply = true;
 if (adxRL == null) {/* NOP */}
 else {
  var arr = adxRL.split(":");
  var mode = arr[0];
  var arg  = arr[1];
  var key  = arr[2].charAt(0).toLowerCase();
  if (key != "d") {
   var day = adxPtr.getDay();
   var orn = isEvenOrOdd(date);
   reply = (mode == "[^]") ? !((day == arg)&&((orn == key)||(key == "a"))) : ((day == arg)&&((orn == key)||(key == "a")));}
  else {reply = (mode == "[^]") ? (date != arg) : (date == arg);}}
 return reply;}
 
 //used by valid date checker
function isEvenOrOdd(date) {
 if (date - 21 > 0) {return "e";}
 else if (date - 14 > 0) {return "o";}
 else if (date - 7 > 0) {return "e";}
 else {return "o";}}
 
 //need this to get correct date formats
function dateFormat(year,month,date) {
 if (sDateFormat == null) {sDateFormat = "m/d/Y";}
 var day = adxPtr.getDay();
 var crt = "";
 var str = "";
 var chars = sDateFormat.length;
 for (var i = 0; i < chars; ++i) {
  crt = sDateFormat.charAt(i);
  switch (crt) {
   case "M": str += aMonth[month]; break;
   case "m": str += (month<9) ? ("0"+(++month)) : ++month; break;
   case "Y": str += year; break;
   case "y": str += year.substring(2); break;
   case "d": str += ((sDateFormat.indexOf("m")!=-1)&&(date<10)) ? ("0"+date) : date; break;
   case "W": str += aWeek[day]; break;
    default: str += crt;}}
 return unescape(str);}
 
 function UpdateDateTimeSelector(sInput,sCal,sTime)
 {
	var oInput = document.getElementById(sInput);	
	var sCalTime = '' , sCalDate = ''
	var oCal = document.getElementById(sCal);
	var oTime = document.getElementById(sTime);
	
	try{
		//get calendar date		
		sCalDate = oCal.value;
	}catch(e){}
	
	try{
		//get calendar time		
		sCalTime = oTime.value;
		if (sCalTime == null){sCalTime = '';};
	}catch(e){}
	
	//if (oCal != null)sCalDate = oCal.value;
	//if (oTime != null)sCalTime = oTime.value;
    
	//join date and time in
	var sDate = sCalDate;
	if (sCalDate != '' && sCalTime != '')
	{
	    sDate += " ";
	}
	sDate += sCalTime;
	
	oInput.value = sDate;	
 }
 
 function InitTimeSelectorOnlyOnce(oInput,sCal,sTime)
 {
    // this block code to remove the onpropertychange to make it only fired once at beginning.
    var newE = document.createElement("input")
    newE.id = oInput.id
    newE.name = oInput.name
    newE.value = oInput.value
    newE.type ="hidden"
    oInput.replaceNode(newE)
    
	var sInput = '' , sInputDate = '', sInputTime = ''
	var oCal = document.getElementById(sCal);
	var oTime = document.getElementById(sTime);
	
	try
	{
		//get calendar date	and time	
		sInput = oInput.value;
	}
	catch(e)
	{
	}
	
	if (sInput != "" && sInput != null)
	{
        var oDate = new Date(sInput)	
	    if (oDate == "NaN" || oDate == null)
	    {
    	    sInputDate = ""
	        sInputTime = ""
	    }
	    else
	    {
	        //cut date and time in : 1/12/2002 
	        sInputDate = (oDate.getMonth() + 1) + "/" + oDate.getDate() + "/" + oDate.getFullYear();
            /*
            var iH = parseInt(oDate.getHours())
            var iM = oDate.getMinutes()
            var iS = oDate.getSeconds()
			var sH = ((iH < 10)?"0":"") + iH
            var sM = ((iM < 10 )?"0":"") + iM
            var sS = ((iS < 10 )?"0":"") + iS
	        sInputTime = sH + ":" + sM + ":" + sS
	        if (iH == 0 && iM == 0 && iS == 0) sInputTime = ""
	        */
	        //Changed by rwu to fix am/pm bug on August 9, 2004
			sInputTime = getClockTime(oDate)
	    }
    }
    else
    {
	    sInputDate = ""
	    sInputTime = ""
    }
	if (oCal != null ) oCal.value = sInputDate;	
	if (oTime != null ) oTime.value = sInputTime;	

 }
 
 /*
  * Apr 3, 2003 [Cam]
  * getAdvancedModeState & setAdvancedModeState added to allow for sticky Advanced mode 
  * in the editors.
  *
  * Apr 8, 2003 [Cam]
  *  - refactored to use cookies
  */
 function getAdvancedModeState()
 {
	var bReturnValue = "true" == GetCookie("adxAdvancedMode")?true:false;
	return(bReturnValue);
 }
 
/*
 * Apr 3, 2003 [Cam]
 * getAdvancedModeState & setAdvancedModeState added to allow for sticky Advanced mode 
 * in the editors.
 *
 * Apr 8, 2003 [Cam]
 *  - refactored to use cookies
 */
 function setAdvancedModeState(bState)
 {
	try
	{
		SetCookie("adxAdvancedMode", bState);
		if(bState != document.getElementById("Advanced").checked)
		{
			document.getElementById("Advanced").checked = bState;
		}
	}
	catch(e){}
 }
 
/*
 * Apr 8, 2003 [Cam]
 *  - Set Items in a cookie easily
 */  
function SetCookie(sName, sValue)
{
	var oNextYear = new Date();
		oNextYear.setFullYear(oNextYear.getFullYear() + 1);
		document.cookie = sName + "=" + sValue + "; " +
						  "path=/; " +
						  "expires=" + oNextYear.toUTCString();
}

/*
 * Apr 8, 2003 [Cam]
 *  - Access Items in a cookie easily
 */ 
function GetCookie(sString)
{
 var sSearchItem = sString + "=";
 var sCookies = document.cookie;
 var iPos = sCookies.indexOf(sSearchItem);
 if(iPos != -1)
 {
  var iStart = iPos + sSearchItem.length;
  var iEnd = sCookies.indexOf(";", iStart);
  if(iEnd == -1)
   {
     iEnd = sCookies.length;
   }
  var sValue = sCookies.substring(iStart, iEnd);
  
  return(sValue);
 }
}//GetFromCookie

/*
* Apr 9, 2003 [Cam]
*/
function RememberEditorSpecs(oWin)
{	
	SetCookie("adxEditorLeft", oWin.screenLeft);
	SetCookie("adxEditorTop", oWin.screenTop);
	SetCookie("adxEditorWidth", oWin.document.body.clientWidth);
	SetCookie("adxEditorHeight", oWin.document.body.clientHeight);
    oWin.setInterval("RememberEditorSpecs(self)", 2000);
}//RememberEditorSpecs
 
/*
* Mar 10, 2004 [rwu]
*/
function RichMediaType(Filename)
{
	if (Filename == null || Filename == "") return;
	var FileType = Filename.substr(Filename.lastIndexOf(".")+1)
	if (FileType == null || FileType == "") return;
	
	var AllType = new Array();
	
	AllType["swf"] = "Flash";
	AllType["flv"] = "Flash";
	
	AllType["avi"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["asf"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["asx"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["rmi"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["wav"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["wma"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["wmv"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	AllType["wax"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Microsoft Windows Media formats
	
	AllType["mpg"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["mpeg"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["m1v"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["mp2"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["mp3"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["mpa"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	AllType["mpe"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Moving Pictures Experts Group (MPEG)
	
	AllType["mid"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Musical Instrument Digital Interface (MIDI)
	AllType["rmi"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Musical Instrument Digital Interface (MIDI)
	
	AllType["qt"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Apple QuickTime®, Macintosh® AIFF Resource
	AllType["aif"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Apple QuickTime®, Macintosh® AIFF Resource
	AllType["aifc"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Apple QuickTime®, Macintosh® AIFF Resource
	AllType["aiff"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Apple QuickTime®, Macintosh® AIFF Resource
	AllType["mov"] = "QuickTime";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- Apple QuickTime®, Macintosh® AIFF Resource
	
	AllType["rt"] = "RealPlayer";	//RealPlayer
	AllType["ra"] = "RealPlayer";	//RealPlayer
	AllType["rm"] = "RealPlayer";	//RealPlayer
	AllType["ram"] = "RealPlayer";	//RealPlayer
	AllType["rmvb"] = "RealPlayer";	//RealPlayer
	AllType["rp"] = "RealPlayer";	//RealPlayer
	AllType["rv"] = "RealPlayer";	//RealPlayer
	AllType["r3t"] = "RealPlayer";	//RealPlayer
	
	AllType["au"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- UNIX formats 
	AllType["snd"] = "WMP";	//Windows Media Player(IE 4.x/5.x; Netscape 4.x/6)	- UNIX formats 
	
	//AllType["xx1"] = "RealOne";
	//AllType["xx2"] = "AnimatedGif";
	//AllType["java"] = "Java";
	
	if (AllType[FileType.toLowerCase()]) {
		return AllType[FileType.toLowerCase()]
	}
	else {
		return "StaticImage";
	}
}

///<summary>
/// Pull the media type and display/hide the appropriate section
///</summary>
///<param name="Filename">The file upload input</param>
///<param name="sFieldID">The id of the field</param>
function adxRichMediaType(Filename, sFieldID)
{	
	//document.getElementById(sFieldID).value = RichMediaType(Filename);	
	//This to fix the "Save" button refresh, don't know why. Dec 03, 2004 by rwu.	
	var mediaType = RichMediaType(Filename.value);
	if(mediaType !=null)
	{
	    document.getElementById(sFieldID).value = mediaType;
	    trace ("begin adxRichMediaType for upload object [" + Filename.id + "] with Filename [" + Filename.value + "] to update field id [" + sFieldID + "] with value [" + mediaType + "]");
	    // updates the DropPanel header if it exists
	    var oLabel = document.getElementById(sFieldID + "_Label");
	    if(oLabel != null)
	    {
	        var sName = Filename.value;
	        if(sName.indexOf("\\") != -1)
	        {
	            sName = sName.substring(sName.lastIndexOf("\\")+1);
	        }//trim the filename
	        oLabel.innerHTML = "&nbsp;-&nbsp;" + sName
	    }//label exists
	}
	else
	{
	      trace ("this is not rich media");
	 
	}
}//adxRichMediaType

function adxRichMediaAttr(oThisElem)
{		
	var sType = oThisElem.value;
	
	// Mar 6, 2006 [Cam]
	// this file is still used by legacy ASP editors, trace does not exist in ASP, only in ASPX editors. This line
	// will break existing editors so I have commented it out.
	//trace ("begin adxRichMediaAttr for type [" + sType + "] and field id [" + oThisElem.id + "]");
	
	var RichMediaDiv = document.getElementById(oThisElem.id).parentElement;	//.id	
    var oSpans = RichMediaDiv.getElementsByTagName("span")
    
    for (var i=0 ; i < oSpans.length ; i++)
    {
        var oElem = oSpans.item(i)
        
        //alert(oElem.id)
        // check if this is the new language
        if (sType == null || sType == "" || oElem.type == null ||  oElem.type != "rmt") continue;
        if (oElem.id.indexOf(sType + ";") != -1)
        {
			//alert("show " + oElem.id)
			oElem.className =  "Show";	// show it
        }
        else
        {
			//alert("hide " + oElem.id)
			oElem.className =  "Hide";	// hide it
        }
    }
}//adxRichMediaAttr

///<summary>
/// When setting the link type radio button we do not want it to default to internal everytime
/// some one selects a document since it could also be a mirror. So if either of these values
/// has been seelcted then leave it alone, if neither is selected, then select the first one.
///</summary>
///<param name="fieldId">The id of the field we are setting</param>
///<param name="value1">The value we want to default to</param>
///<param name="value2">Optional value</param>
function SetLinkType(fieldId, value1, value2)
{
    var oElem1 = null;
    var oElem2 = null;
    
    // get all of the elements of this name
    var oElems = eval ("window.document.forms[0].elements['"+fieldId+"']");
    for(var i=0; i<oElems.length; i++)
	{
		if (oElems[i].value == value1)
		{
			oElem1 = oElems[i];
		}
		else if(oElems[i].value == value2)
		{
		    oElem2 = oElems[i];
		}
		
		if(oElem2 != null && oElem1 != null)
		{
		    break;
		}
	}//for each element of this name
	
	if(!oElem1.checked && !oElem2.checked)
	{
	    oElem1.checked = true;
	}
	    
}//SetLinkType
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var D={},B=arguments;for(var C=0,A=B.length;C<A;C=C+1){YAHOO.lang.augmentObject(D,B[C],true);}return D;},later:function(H,B,I,D,E){H=H||0;B=B||{};var C=I,G=D,F,A;if(YAHOO.lang.isString(I)){C=B[I];}if(!C){throw new TypeError("method undefined");}if(!YAHOO.lang.isArray(G)){G=[D];}F=function(){C.apply(B,G);};A=(E)?setInterval(F,H):setTimeout(F,H);return{interval:E,cancel:function(){if(this.interval){clearInterval(A);}else{clearTimeout(A);}}};},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.5.1",build:"984"});(function(){var B=YAHOO.util,K,I,J={},F={},M=window.document;YAHOO.env._id_counter=YAHOO.env._id_counter||0;var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};var N=function(P){if(!E.HYPHEN.test(P)){return P;}if(J[P]){return J[P];}var Q=P;while(E.HYPHEN.exec(Q)){Q=Q.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[P]=Q;return Q;};var O=function(Q){var P=F[Q];if(!P){P=new RegExp("(?:^|\\s+)"+Q+"(?:\\s+|$)");F[Q]=P;}return P;};if(M.defaultView&&M.defaultView.getComputedStyle){K=function(P,S){var R=null;if(S=="float"){S="cssFloat";}var Q=P.ownerDocument.defaultView.getComputedStyle(P,"");if(Q){R=Q[N(S)];}return P.style[S]||R;};}else{if(M.documentElement.currentStyle&&G){K=function(P,R){switch(N(R)){case"opacity":var T=100;try{T=P.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(S){try{T=P.filters("alpha").opacity;}catch(S){}}return T/100;case"float":R="styleFloat";default:var Q=P.currentStyle?P.currentStyle[R]:null;return(P.style[R]||Q);}};}else{K=function(P,Q){return P.style[Q];};}}if(G){I=function(P,Q,R){switch(Q){case"opacity":if(YAHOO.lang.isString(P.style.filter)){P.style.filter="alpha(opacity="+R*100+")";if(!P.currentStyle||!P.currentStyle.hasLayout){P.style.zoom=1;}}break;case"float":Q="styleFloat";default:P.style[Q]=R;}};}else{I=function(P,Q,R){if(Q=="float"){Q="cssFloat";}P.style[Q]=R;};}var D=function(P,Q){return P&&P.nodeType==1&&(!Q||Q(P));};YAHOO.util.Dom={get:function(R){if(R&&(R.nodeType||R.item)){return R;}if(YAHOO.lang.isString(R)||!R){return M.getElementById(R);}if(R.length!==undefined){var S=[];for(var Q=0,P=R.length;Q<P;++Q){S[S.length]=B.Dom.get(R[Q]);}return S;}return R;},getStyle:function(P,R){R=N(R);var Q=function(S){return K(S,R);};return B.Dom.batch(P,Q,B.Dom,true);},setStyle:function(P,R,S){R=N(R);var Q=function(T){I(T,R,S);};B.Dom.batch(P,Q,B.Dom,true);},getXY:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=R.ownerDocument.body){return false;}return H(R);};return B.Dom.batch(P,Q,B.Dom,true);},getX:function(P){var Q=function(R){return B.Dom.getXY(R)[0];};return B.Dom.batch(P,Q,B.Dom,true);},getY:function(P){var Q=function(R){return B.Dom.getXY(R)[1];};return B.Dom.batch(P,Q,B.Dom,true);},setXY:function(P,S,R){var Q=function(V){var U=this.getStyle(V,"position");if(U=="static"){this.setStyle(V,"position","relative");U="relative";}var X=this.getXY(V);if(X===false){return false;}var W=[parseInt(this.getStyle(V,"left"),10),parseInt(this.getStyle(V,"top"),10)];if(isNaN(W[0])){W[0]=(U=="relative")?0:V.offsetLeft;}if(isNaN(W[1])){W[1]=(U=="relative")?0:V.offsetTop;}if(S[0]!==null){V.style.left=S[0]-X[0]+W[0]+"px";}if(S[1]!==null){V.style.top=S[1]-X[1]+W[1]+"px";}if(!R){var T=this.getXY(V);if((S[0]!==null&&T[0]!=S[0])||(S[1]!==null&&T[1]!=S[1])){this.setXY(V,S,true);}}};B.Dom.batch(P,Q,B.Dom,true);},setX:function(Q,P){B.Dom.setXY(Q,[P,null]);},setY:function(P,Q){B.Dom.setXY(P,[null,Q]);},getRegion:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=R.ownerDocument.body){return false;}var S=B.Region.getRegion(R);return S;};return B.Dom.batch(P,Q,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(T,X,U,V){X=X||"*";U=(U)?B.Dom.get(U):null||M;if(!U){return[];}var Q=[],P=U.getElementsByTagName(X),W=O(T);for(var R=0,S=P.length;R<S;++R){if(W.test(P[R].className)){Q[Q.length]=P[R];if(V){V.call(P[R],P[R]);}}}return Q;},hasClass:function(R,Q){var P=O(Q);var S=function(T){return P.test(T.className);};return B.Dom.batch(R,S,B.Dom,true);},addClass:function(Q,P){var R=function(S){if(this.hasClass(S,P)){return false;}S.className=YAHOO.lang.trim([S.className,P].join(" "));return true;};return B.Dom.batch(Q,R,B.Dom,true);},removeClass:function(R,Q){var P=O(Q);var S=function(T){if(!Q||!this.hasClass(T,Q)){return false;}var U=T.className;T.className=U.replace(P," ");if(this.hasClass(T,Q)){this.removeClass(T,Q);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},replaceClass:function(S,Q,P){if(!P||Q===P){return false;}var R=O(Q);var T=function(U){if(!this.hasClass(U,Q)){this.addClass(U,P);return true;}U.className=U.className.replace(R," "+P+" ");if(this.hasClass(U,Q)){this.replaceClass(U,Q,P);}U.className=YAHOO.lang.trim(U.className);return true;};return B.Dom.batch(S,T,B.Dom,true);},generateId:function(P,R){R=R||"yui-gen";var Q=function(S){if(S&&S.id){return S.id;}var T=R+YAHOO.env._id_counter++;if(S){S.id=T;}return T;};return B.Dom.batch(P,Q,B.Dom,true)||Q.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);Q=B.Dom.get(Q);if(!P||!Q){return false;}if(P.contains&&Q.nodeType&&!L){return P.contains(Q);}else{if(P.compareDocumentPosition&&Q.nodeType){return !!(P.compareDocumentPosition(Q)&16);}else{if(Q.nodeType){return !!this.getAncestorBy(Q,function(R){return R==P;});}}}return false;},inDocument:function(P){return this.isAncestor(M.documentElement,P);},getElementsBy:function(W,Q,R,T){Q=Q||"*";R=(R)?B.Dom.get(R):null||M;if(!R){return[];}var S=[],V=R.getElementsByTagName(Q);for(var U=0,P=V.length;U<P;++U){if(W(V[U])){S[S.length]=V[U];if(T){T(V[U]);}}}return S;},batch:function(T,W,V,R){T=(T&&(T.tagName||T.item))?T:B.Dom.get(T);if(!T||!W){return false;}var S=(R)?V:window;if(T.tagName||T.length===undefined){return W.call(S,T,V);}var U=[];for(var Q=0,P=T.length;Q<P;++Q){U[U.length]=W.call(S,T[Q],V);}return U;},getDocumentHeight:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollHeight:M.documentElement.scrollHeight;var P=Math.max(Q,B.Dom.getViewportHeight());return P;},getDocumentWidth:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollWidth:M.documentElement.scrollWidth;var P=Math.max(Q,B.Dom.getViewportWidth());return P;},getViewportHeight:function(){var P=self.innerHeight;
var Q=M.compatMode;if((Q||G)&&!C){P=(Q=="CSS1Compat")?M.documentElement.clientHeight:M.body.clientHeight;}return P;},getViewportWidth:function(){var P=self.innerWidth;var Q=M.compatMode;if(Q||G){P=(Q=="CSS1Compat")?M.documentElement.clientWidth:M.body.clientWidth;}return P;},getAncestorBy:function(P,Q){while(P=P.parentNode){if(D(P,Q)){return P;}}return null;},getAncestorByClassName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return B.Dom.hasClass(S,P);};return B.Dom.getAncestorBy(Q,R);},getAncestorByTagName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return S.tagName&&S.tagName.toUpperCase()==P.toUpperCase();};return B.Dom.getAncestorBy(Q,R);},getPreviousSiblingBy:function(P,Q){while(P){P=P.previousSibling;if(D(P,Q)){return P;}}return null;},getPreviousSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getPreviousSiblingBy(P);},getNextSiblingBy:function(P,Q){while(P){P=P.nextSibling;if(D(P,Q)){return P;}}return null;},getNextSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getNextSiblingBy(P);},getFirstChildBy:function(P,R){var Q=(D(P.firstChild,R))?P.firstChild:null;return Q||B.Dom.getNextSiblingBy(P.firstChild,R);},getFirstChild:function(P,Q){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getFirstChildBy(P);},getLastChildBy:function(P,R){if(!P){return null;}var Q=(D(P.lastChild,R))?P.lastChild:null;return Q||B.Dom.getPreviousSiblingBy(P.lastChild,R);},getLastChild:function(P){P=B.Dom.get(P);return B.Dom.getLastChildBy(P);},getChildrenBy:function(Q,S){var R=B.Dom.getFirstChildBy(Q,S);var P=R?[R]:[];B.Dom.getNextSiblingBy(R,function(T){if(!S||S(T)){P[P.length]=T;}return false;});return P;},getChildren:function(P){P=B.Dom.get(P);if(!P){}return B.Dom.getChildrenBy(P);},getDocumentScrollLeft:function(P){P=P||M;return Math.max(P.documentElement.scrollLeft,P.body.scrollLeft);},getDocumentScrollTop:function(P){P=P||M;return Math.max(P.documentElement.scrollTop,P.body.scrollTop);},insertBefore:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}return P.parentNode.insertBefore(Q,P);},insertAfter:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}if(P.nextSibling){return P.parentNode.insertBefore(Q,P.nextSibling);}else{return P.parentNode.appendChild(Q);}},getClientRegion:function(){var R=B.Dom.getDocumentScrollTop(),Q=B.Dom.getDocumentScrollLeft(),S=B.Dom.getViewportWidth()+Q,P=B.Dom.getViewportHeight()+R;return new B.Region(R,S,P,Q);}};var H=function(){if(M.documentElement.getBoundingClientRect){return function(Q){var R=Q.getBoundingClientRect();var P=Q.ownerDocument;return[R.left+B.Dom.getDocumentScrollLeft(P),R.top+B.Dom.getDocumentScrollTop(P)];};}else{return function(R){var S=[R.offsetLeft,R.offsetTop];var Q=R.offsetParent;var P=(L&&B.Dom.getStyle(R,"position")=="absolute"&&R.offsetParent==R.ownerDocument.body);if(Q!=R){while(Q){S[0]+=Q.offsetLeft;S[1]+=Q.offsetTop;if(!P&&L&&B.Dom.getStyle(Q,"position")=="absolute"){P=true;}Q=Q.offsetParent;}}if(P){S[0]-=R.ownerDocument.body.offsetLeft;S[1]-=R.ownerDocument.body.offsetTop;}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(Q.scrollTop||Q.scrollLeft){if(!E.OP_SCROLL.test(B.Dom.getStyle(Q,"display"))){if(!C||B.Dom.getStyle(Q,"overflow")!=="visible"){S[0]-=Q.scrollLeft;S[1]-=Q.scrollTop;}}}Q=Q.parentNode;}return S;};}}();})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.5.1",build:"984"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){var D=this.subscribers.length;if(!D&&this.silent){return true;}var H=[].slice.call(arguments,0),F=true,C,I=false;if(!this.silent){}var B=this.subscribers.slice();for(C=0;C<D;++C){var K=B[C];if(!K){I=true;}else{if(!this.silent){}var J=K.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var A=null;if(H.length>0){A=H[0];}try{F=K.fn.call(J,A,K.obj);}catch(E){this.lastError=E;}}else{try{F=K.fn.call(J,this.type,H,K.obj);}catch(G){this.lastError=G;}}if(false===F){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L<K.length;L=L+1){F.push({id:K[L],fn:M,obj:Q,override:O,checkReady:N});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(M,K,N,L){this.onAvailable(M,K,N,L,true);},onDOMReady:function(K,M,L){if(this.DOMReady){setTimeout(function(){var N=window;if(L){if(L===true){N=M;}else{N=L;}}K.call(N,"DOMReady",[],M);},0);}else{this.DOMReadyEvent.subscribe(K,M,L);}},addListener:function(M,K,V,Q,L){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var R=0,T=M.length;R<T;++R){W=this.on(M[R],K,V,Q,L)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var P=this.getEl(M);if(P){M=P;}else{this.onAvailable(M,function(){YAHOO.util.Event.on(M,K,V,Q,L);});return true;}}}if(!M){return false;}if("unload"==K&&Q!==this){J[J.length]=[M,K,V,Q,L];return true;}var Y=M;if(L){if(L===true){Y=Q;}else{Y=L;}}var N=function(Z){return V.call(Y,YAHOO.util.Event.getEvent(Z,M),Q);};var X=[M,K,V,N,Y,Q,L];var S=I.length;I[S]=X;if(this.useLegacyEvent(M,K)){var O=this.getLegacyIndex(M,K);if(O==-1||M!=G[O][0]){O=G.length;B[M.id+K]=O;G[O]=[M,K,M["on"+K]];E[O]=[];M["on"+K]=function(Z){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z),O);};}E[O].push(X);}else{try{this._simpleAdd(M,K,N,false);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}}return true;},fireLegacyEvent:function(O,M){var Q=true,K,S,R,T,P;S=E[M].slice();for(var L=0,N=S.length;L<N;++L){R=S[L];if(R&&R[this.WFN]){T=R[this.ADJ_SCOPE];P=R[this.WFN].call(T,O);Q=(Q&&P);}}K=G[M];if(K&&K[2]){K[2](O);}return Q;},getLegacyIndex:function(L,M){var K=this.generateId(L)+M;if(typeof B[K]=="undefined"){return -1;}else{return B[K];}},useLegacyEvent:function(L,M){if(this.webkit&&("click"==M||"dblclick"==M)){var K=parseInt(this.webkit,10);if(!isNaN(K)&&K<418){return true;}}return false;},removeListener:function(L,K,T){var O,R,V;if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var U=true;for(O=L.length-1;O>-1;O--){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=J.length-1;O>-1;O--){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J.splice(O,1);return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O<R;++O){V=M[O];if(V&&V[this.EL]==L&&V[this.TYPE]==K&&V[this.FN]==T){M.splice(O,1);break;}}}}else{try{this._simpleRemove(L,K,P[this.WFN],false);}catch(S){this.lastError=S;return false;}}delete I[Q][this.WFN];delete I[Q][this.FN];I.splice(Q,1);return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];},getRelatedTarget:function(L){var K=L.relatedTarget;
if(!K){if(L.type=="mouseout"){K=L.toElement;}else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break;}N=N.caller;}}return L;},getCharCode:function(L){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in D)){K=D[K];}return K;},_getCacheIndex:function(O,P,N){for(var M=0,L=I.length;M<L;M=M+1){var K=I[M];if(K&&K[this.FN]==N&&K[this.EL]==O&&K[this.TYPE]==P){return M;}}return -1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+A;++A;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(L){if(!H){H=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;clearInterval(this._interval);this._interval=null;return ;}if(this.locked){return ;}if(this.isIE){if(!this.DOMReady){this.startInterval();return ;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0&&F.length>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var L,K,O,N,M=[];for(L=0,K=F.length;L<K;L=L+1){O=F[L];if(O){N=this.getEl(O.id);if(N){if(O.checkReady){if(H||N.nextSibling||!Q){M.push(O);F[L]=null;}}else{R(N,O);F[L]=null;}}else{P.push(O);}}}for(L=0,K=M.length;L<K;L=L+1){O=M[L];R(this.getEl(O.id),O);}C--;if(Q){for(L=F.length-1;L>-1;L--){O=F[L];if(!O||!O.id){F.splice(L,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=Q.length-1;N>-1;N--){var L=Q[N];this.removeListener(M,L.type,L.fn);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[I,J];}else{if(K==="unload"){L=[J];}else{L=[I];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(Q){var K=YAHOO.util.Event,N,M,L,P,O,R=J.slice();for(N=0,P=J.length;N<P;++N){L=R[N];if(L){var S=window;if(L[K.ADJ_SCOPE]){if(L[K.ADJ_SCOPE]===true){S=L[K.UNLOAD_OBJ];}else{S=L[K.ADJ_SCOPE];}}L[K.FN].call(S,K.getEvent(Q,L[K.EL]),L[K.UNLOAD_OBJ]);R[N]=null;L=null;S=null;}}J=null;if(I){for(M=I.length-1;M>-1;M--){L=I[M];if(L){K.removeListener(L[K.EL],L[K.TYPE],L[K.FN],M);}}L=null;}G=null;K._simpleRemove(window,"unload",K._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);
I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.5.1",build:"984"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.5.1", build: "984"});
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(B){var A=YAHOO.util.Event.getTarget(B);if(A.nodeName.toLowerCase()=="input"&&(A.type&&A.type.toLowerCase()=="submit")){YAHOO.util.Connect._submitElementValue=encodeURIComponent(A.name)+"="+encodeURIComponent(A.value);}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(A){this._msxml_progid.unshift(A);},setDefaultPostHeader:function(A){if(typeof A=="string"){this._default_post_header=A;}else{if(typeof A=="boolean"){this._use_default_post_header=A;}}},setDefaultXhrHeader:function(A){if(typeof A=="string"){this._default_xhr_header=A;}else{this._use_default_xhr_header=A;}},setPollingInterval:function(A){if(typeof A=="number"&&isFinite(A)){this._polling_interval=A;}},createXhrObject:function(E){var D,A;try{A=new XMLHttpRequest();D={conn:A,tId:E};}catch(C){for(var B=0;B<this._msxml_progid.length;++B){try{A=new ActiveXObject(this._msxml_progid[B]);D={conn:A,tId:E};break;}catch(C){}}}finally{return D;}},getConnectionObject:function(A){var C;var D=this._transaction_id;try{if(!A){C=this.createXhrObject(D);}else{C={};C.tId=D;C.isUpload=true;}if(C){this._transaction_id++;}}catch(B){}finally{return C;}},asyncRequest:function(F,C,E,A){var D=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();var B=(E&&E.argument)?E.argument:null;if(!D){return null;}else{if(E&&E.customevents){this.initCustomEvents(D,E);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(D,E,C,A);return D;}if(F.toUpperCase()=="GET"){if(this._sFormData.length!==0){C+=((C.indexOf("?")==-1)?"?":"&")+this._sFormData;}}else{if(F.toUpperCase()=="POST"){A=A?this._sFormData+"&"+A:this._sFormData;}}}if(F.toUpperCase()=="GET"&&(E&&E.cache===false)){C+=((C.indexOf("?")==-1)?"?":"&")+"rnd="+new Date().valueOf().toString();}D.conn.open(F,C,true);if(this._use_default_xhr_header){if(!this._default_headers["X-Requested-With"]){this.initHeader("X-Requested-With",this._default_xhr_header,true);}}if((F.toUpperCase()=="POST"&&this._use_default_post_header)&&this._isFormSubmit===false){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(D);}this.handleReadyState(D,E);D.conn.send(A||"");if(this._isFormSubmit===true){this.resetFormState();}this.startEvent.fire(D,B);if(D.startEvent){D.startEvent.fire(D,B);}return D;}},initCustomEvents:function(A,C){for(var B in C.customevents){if(this._customEvents[B][0]){A[this._customEvents[B][0]]=new YAHOO.util.CustomEvent(this._customEvents[B][1],(C.scope)?C.scope:null);A[this._customEvents[B][0]].subscribe(C.customevents[B]);}}},handleReadyState:function(C,D){var B=this;var A=(D&&D.argument)?D.argument:null;if(D&&D.timeout){this._timeOut[C.tId]=window.setTimeout(function(){B.abort(C,D,true);},D.timeout);}this._poll[C.tId]=window.setInterval(function(){if(C.conn&&C.conn.readyState===4){window.clearInterval(B._poll[C.tId]);delete B._poll[C.tId];if(D&&D.timeout){window.clearTimeout(B._timeOut[C.tId]);delete B._timeOut[C.tId];}B.completeEvent.fire(C,A);if(C.completeEvent){C.completeEvent.fire(C,A);}B.handleTransactionResponse(C,D);}},this._polling_interval);},handleTransactionResponse:function(F,G,A){var D,C;var B=(G&&G.argument)?G.argument:null;try{if(F.conn.status!==undefined&&F.conn.status!==0){D=F.conn.status;}else{D=13030;}}catch(E){D=13030;}if(D>=200&&D<300||D===1223){C=this.createResponseObject(F,B);if(G&&G.success){if(!G.scope){G.success(C);}else{G.success.apply(G.scope,[C]);}}this.successEvent.fire(C);if(F.successEvent){F.successEvent.fire(C);}}else{switch(D){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:C=this.createExceptionObject(F.tId,B,(A?A:false));if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}break;default:C=this.createResponseObject(F,B);if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}}this.failureEvent.fire(C);if(F.failureEvent){F.failureEvent.fire(C);}}this.releaseObject(F);C=null;},createResponseObject:function(A,G){var D={};var I={};try{var C=A.conn.getAllResponseHeaders();var F=C.split("\n");for(var E=0;E<F.length;E++){var B=F[E].indexOf(":");if(B!=-1){I[F[E].substring(0,B)]=F[E].substring(B+2);}}}catch(H){}D.tId=A.tId;D.status=(A.conn.status==1223)?204:A.conn.status;D.statusText=(A.conn.status==1223)?"No Content":A.conn.statusText;D.getResponseHeader=I;D.getAllResponseHeaders=C;D.responseText=A.conn.responseText;D.responseXML=A.conn.responseXML;if(G){D.argument=G;}return D;},createExceptionObject:function(H,D,A){var F=0;var G="communication failure";var C=-1;var B="transaction aborted";var E={};E.tId=H;if(A){E.status=C;E.statusText=B;}else{E.status=F;E.statusText=G;}if(D){E.argument=D;}return E;},initHeader:function(A,D,C){var B=(C)?this._default_headers:this._http_headers;B[A]=D;if(C){this._has_default_headers=true;}else{this._has_http_headers=true;
}},setHeader:function(A){if(this._has_default_headers){for(var B in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,B)){A.conn.setRequestHeader(B,this._default_headers[B]);}}}if(this._has_http_headers){for(var B in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,B)){A.conn.setRequestHeader(B,this._http_headers[B]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(K,E,B){this.resetFormState();var J;if(typeof K=="string"){J=(document.getElementById(K)||document.forms[K]);}else{if(typeof K=="object"){J=K;}else{return ;}}if(E){var F=this.createFrame((window.location.href.toLowerCase().indexOf("https")===0||B)?true:false);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=J;return ;}var A,I,G,L;var H=false;for(var D=0;D<J.elements.length;D++){A=J.elements[D];L=A.disabled;I=A.name;G=A.value;if(!L&&I){switch(A.type){case"select-one":case"select-multiple":for(var C=0;C<A.options.length;C++){if(A.options[C].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].attributes["value"].specified?A.options[C].value:A.options[C].text)+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].hasAttribute("value")?A.options[C].value:A.options[C].text)+"&";}}}break;case"radio":case"checkbox":if(A.checked){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(H===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}H=true;}break;default:this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}}}this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);this.initHeader("Content-Type",this._default_form_header);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(A){var B="yuiIO"+this._transaction_id;var C;if(window.ActiveXObject){C=document.createElement("<iframe id=\""+B+"\" name=\""+B+"\" />");if(typeof A=="boolean"){C.src="javascript:false";}}else{C=document.createElement("iframe");C.id=B;C.name=B;}C.style.position="absolute";C.style.top="-1000px";C.style.left="-1000px";document.body.appendChild(C);},appendPostData:function(A){var D=[];var B=A.split("&");for(var C=0;C<B.length;C++){var E=B[C].indexOf("=");if(E!=-1){D[C]=document.createElement("input");D[C].type="hidden";D[C].name=B[C].substring(0,E);D[C].value=B[C].substring(E+1);this._formNode.appendChild(D[C]);}}return D;},uploadFile:function(D,M,E,C){var N=this;var H="yuiIO"+D.tId;var I="multipart/form-data";var K=document.getElementById(H);var J=(M&&M.argument)?M.argument:null;var B={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",E);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",H);if(this._formNode.encoding){this._formNode.setAttribute("encoding",I);}else{this._formNode.setAttribute("enctype",I);}if(C){var L=this.appendPostData(C);}this._formNode.submit();this.startEvent.fire(D,J);if(D.startEvent){D.startEvent.fire(D,J);}if(M&&M.timeout){this._timeOut[D.tId]=window.setTimeout(function(){N.abort(D,M,true);},M.timeout);}if(L&&L.length>0){for(var G=0;G<L.length;G++){this._formNode.removeChild(L[G]);}}for(var A in B){if(YAHOO.lang.hasOwnProperty(B,A)){if(B[A]){this._formNode.setAttribute(A,B[A]);}else{this._formNode.removeAttribute(A);}}}this.resetFormState();var F=function(){if(M&&M.timeout){window.clearTimeout(N._timeOut[D.tId]);delete N._timeOut[D.tId];}N.completeEvent.fire(D,J);if(D.completeEvent){D.completeEvent.fire(D,J);}var P={};P.tId=D.tId;P.argument=M.argument;try{P.responseText=K.contentWindow.document.body?K.contentWindow.document.body.innerHTML:K.contentWindow.document.documentElement.textContent;P.responseXML=K.contentWindow.document.XMLDocument?K.contentWindow.document.XMLDocument:K.contentWindow.document;}catch(O){}if(M&&M.upload){if(!M.scope){M.upload(P);}else{M.upload.apply(M.scope,[P]);}}N.uploadEvent.fire(P);if(D.uploadEvent){D.uploadEvent.fire(P);}YAHOO.util.Event.removeListener(K,"load",F);setTimeout(function(){document.body.removeChild(K);N.releaseObject(D);},100);};YAHOO.util.Event.addListener(K,"load",F);},abort:function(E,G,A){var D;var B=(G&&G.argument)?G.argument:null;if(E&&E.conn){if(this.isCallInProgress(E)){E.conn.abort();window.clearInterval(this._poll[E.tId]);delete this._poll[E.tId];if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{if(E&&E.isUpload===true){var C="yuiIO"+E.tId;var F=document.getElementById(C);if(F){YAHOO.util.Event.removeListener(F,"load");document.body.removeChild(F);if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{D=false;}}if(D===true){this.abortEvent.fire(E,B);if(E.abortEvent){E.abortEvent.fire(E,B);}this.handleTransactionResponse(E,G,true);}return D;},isCallInProgress:function(B){if(B&&B.conn){return B.conn.readyState!==4&&B.conn.readyState!==0;}else{if(B&&B.isUpload===true){var A="yuiIO"+B.tId;return document.getElementById(A)?true:false;}else{return false;}}},releaseObject:function(A){if(A&&A.conn){A.conn=null;A=null;}}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.5.1",build:"984"});/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
(function(){var B=YAHOO.util;var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);};A.NAME="Anim";A.prototype={toString:function(){var C=this.getEl()||{};var D=C.id||C.tagName;return(this.constructor.NAME+": "+D);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},setAttribute:function(C,E,D){if(this.patterns.noNegatives.test(C)){E=(E>0)?E:0;}B.Dom.setStyle(this.getEl(),C,E+D);},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G<C;++G){E[G]=I[G]+F[D]["by"][G]*1;}}else{E=I+F[D]["by"]*1;}}}this.runtimeAttributes[D].start=I;this.runtimeAttributes[D].end=E;this.runtimeAttributes[D].unit=(H(F[D].unit))?F[D]["unit"]:this.getDefaultUnit(D);return true;},init:function(E,J,I,C){var D=false;var F=null;var H=0;E=B.Dom.get(E);this.attributes=J||{};this.duration=!YAHOO.lang.isUndefined(I)?I:1;this.method=C||B.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=B.AnimMgr.fps;this.setEl=function(M){E=B.Dom.get(M);};this.getEl=function(){return E;};this.isAnimated=function(){return D;};this.getStartTime=function(){return F;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(B.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}B.AnimMgr.registerElement(this);return true;};this.stop=function(M){if(!this.isAnimated()){return false;}if(M){this.currentFrame=this.totalFrames;this._onTween.fire();}B.AnimMgr.stop(this);};var L=function(){this.onStart.fire();this.runtimeAttributes={};for(var M in this.attributes){this.setRuntimeAttribute(M);}D=true;H=0;F=new Date();};var K=function(){var O={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};O.toString=function(){return("duration: "+O.duration+", currentFrame: "+O.currentFrame);};this.onTween.fire(O);var N=this.runtimeAttributes;for(var M in N){this.setAttribute(M,this.doMethod(M,N[M].start,N[M].end),N[M].unit);}H+=1;};var G=function(){var M=(new Date()-F)/1000;var N={duration:M,frames:H,fps:H/M};N.toString=function(){return("duration: "+N.duration+", frames: "+N.frames+", fps: "+N.fps);};D=false;H=0;this.onComplete.fire(N);};this._onStart=new B.CustomEvent("_start",this,true);this.onStart=new B.CustomEvent("start",this);this.onTween=new B.CustomEvent("tween",this);this._onTween=new B.CustomEvent("_tween",this,true);this.onComplete=new B.CustomEvent("complete",this);this._onComplete=new B.CustomEvent("_complete",this,true);this._onStart.subscribe(L);this._onTween.subscribe(K);this._onComplete.subscribe(G);}};B.Anim=A;})();YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){F=F||E(G);if(!G.isAnimated()||F==-1){return false;}G._onComplete.fire();B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){var A=function(F,E,G,H){A.superclass.constructor.call(this,F,E,G,H);};A.NAME="ColorAnim";var C=YAHOO.util;YAHOO.extend(A,C.Anim);var D=A.superclass;var B=A.prototype;B.patterns.color=/color$/i;B.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;B.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;B.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;B.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;B.parseColor=function(E){if(E.length==3){return E;}var F=this.patterns.hex.exec(E);if(F&&F.length==4){return[parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16)];}F=this.patterns.rgb.exec(E);if(F&&F.length==4){return[parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10)];}F=this.patterns.hex3.exec(E);if(F&&F.length==4){return[parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16)];}return null;};B.getAttribute=function(E){var G=this.getEl();if(this.patterns.color.test(E)){var H=YAHOO.util.Dom.getStyle(G,E);
if(this.patterns.transparent.test(H)){var F=G.parentNode;H=C.Dom.getStyle(F,E);while(F&&this.patterns.transparent.test(H)){F=F.parentNode;H=C.Dom.getStyle(F,E);if(F.tagName.toUpperCase()=="HTML"){H="#fff";}}}}else{H=D.getAttribute.call(this,E);}return H;};B.doMethod=function(F,J,G){var I;if(this.patterns.color.test(F)){I=[];for(var H=0,E=J.length;H<E;++H){I[H]=D.doMethod.call(this,F,J[H],G[H]);}I="rgb("+Math.floor(I[0])+","+Math.floor(I[1])+","+Math.floor(I[2])+")";}else{I=D.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(F){D.setRuntimeAttribute.call(this,F);if(this.patterns.color.test(F)){var H=this.attributes;var J=this.parseColor(this.runtimeAttributes[F].start);var G=this.parseColor(this.runtimeAttributes[F].end);if(typeof H[F]["to"]==="undefined"&&typeof H[F]["by"]!=="undefined"){G=this.parseColor(H[F].by);for(var I=0,E=J.length;I<E;++I){G[I]=J[I]+G[I];}}this.runtimeAttributes[F].start=J;this.runtimeAttributes[F].end=G;}};C.ColorAnim=A;})();
/*
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){var A=function(H,G,I,J){if(H){A.superclass.constructor.call(this,H,G,I,J);}};A.NAME="Motion";var E=YAHOO.util;YAHOO.extend(A,E.ColorAnim);var F=A.superclass;var C=A.prototype;C.patterns.points=/^points$/i;C.setAttribute=function(G,I,H){if(this.patterns.points.test(G)){H=H||"px";F.setAttribute.call(this,"left",I[0],H);F.setAttribute.call(this,"top",I[1],H);}else{F.setAttribute.call(this,G,I,H);}};C.getAttribute=function(G){if(this.patterns.points.test(G)){var H=[F.getAttribute.call(this,"left"),F.getAttribute.call(this,"top")];}else{H=F.getAttribute.call(this,G);}return H;};C.doMethod=function(G,K,H){var J=null;if(this.patterns.points.test(G)){var I=this.method(this.currentFrame,0,100,this.totalFrames)/100;J=E.Bezier.getPosition(this.runtimeAttributes[G],I);}else{J=F.doMethod.call(this,G,K,H);}return J;};C.setRuntimeAttribute=function(P){if(this.patterns.points.test(P)){var H=this.getEl();var J=this.attributes;var G;var L=J["points"]["control"]||[];var I;var M,O;if(L.length>0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M<O;++M){K[M]=L[M];}L=K;}if(E.Dom.getStyle(H,"position")=="static"){E.Dom.setStyle(H,"position","relative");}if(D(J["points"]["from"])){E.Dom.setXY(H,J["points"]["from"]);}else{E.Dom.setXY(H,E.Dom.getXY(H));}G=this.getAttribute("points");if(D(J["points"]["to"])){I=B.call(this,J["points"]["to"],G);
var N=E.Dom.getXY(this.getEl());for(M=0,O=L.length;M<O;++M){L[M]=B.call(this,L[M],G);}}else{if(D(J["points"]["by"])){I=[G[0]+J["points"]["by"][0],G[1]+J["points"]["by"][1]];for(M=0,O=L.length;M<O;++M){L[M]=[G[0]+L[M][0],G[1]+L[M][1]];}}}this.runtimeAttributes[P]=[G];if(L.length>0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.5.1",build:"984"});/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
YAHOO.widget.AutoComplete=function(G,B,J,C){if(G&&B&&J){if(J instanceof YAHOO.widget.DataSource){this.dataSource=J;}else{return ;}if(YAHOO.util.Dom.inDocument(G)){if(YAHOO.lang.isString(G)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+G;this._elTextbox=document.getElementById(G);}else{this._sName=(G.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+G.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._elTextbox=G;}YAHOO.util.Dom.addClass(this._elTextbox,"yui-ac-input");}else{return ;}if(YAHOO.util.Dom.inDocument(B)){if(YAHOO.lang.isString(B)){this._elContainer=document.getElementById(B);}else{this._elContainer=B;}if(this._elContainer.style.display=="none"){}var D=this._elContainer.parentNode;var A=D.tagName.toLowerCase();if(A=="div"){YAHOO.util.Dom.addClass(D,"yui-ac");}else{}}else{return ;}if(C&&(C.constructor==Object)){for(var I in C){if(I){this[I]=C[I];}}}this._initContainer();this._initProps();this._initList();this._initContainerHelpers();var H=this;var F=this._elTextbox;var E=this._elContent;YAHOO.util.Event.addListener(F,"keyup",H._onTextboxKeyUp,H);YAHOO.util.Event.addListener(F,"keydown",H._onTextboxKeyDown,H);YAHOO.util.Event.addListener(F,"focus",H._onTextboxFocus,H);YAHOO.util.Event.addListener(F,"blur",H._onTextboxBlur,H);YAHOO.util.Event.addListener(E,"mouseover",H._onContainerMouseover,H);YAHOO.util.Event.addListener(E,"mouseout",H._onContainerMouseout,H);YAHOO.util.Event.addListener(E,"scroll",H._onContainerScroll,H);YAHOO.util.Event.addListener(E,"resize",H._onContainerResize,H);YAHOO.util.Event.addListener(F,"keypress",H._onTextboxKeyPress,H);YAHOO.util.Event.addListener(window,"unload",H._onWindowUnload,H);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);F.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListItems=function(){return this._aListItems;};YAHOO.widget.AutoComplete.prototype.getListItemData=function(A){if(A._oResultData){return A._oResultData;}else{return false;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(B){if(this._elHeader){var A=this._elHeader;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setFooter=function(B){if(this._elFooter){var A=this._elFooter;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setBody=function(A){if(this._elBody){var B=this._elBody;if(A){B.innerHTML=A;B.style.display="block";B.style.display="block";}else{B.innerHTML="";B.style.display="none";}this._maxResultsDisplayed=0;}};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,C){var A=B[0];if(A){return A;}else{return"";}};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(D,A,C,B){return true;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(A){this._sendQuery(A);};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return A;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._elTextbox;var D=this._elContainer;this.textboxFocusEvent.unsubscribeAll();this.textboxKeyEvent.unsubscribeAll();this.dataRequestEvent.unsubscribeAll();this.dataReturnEvent.unsubscribeAll();this.dataErrorEvent.unsubscribeAll();this.containerExpandEvent.unsubscribeAll();this.typeAheadEvent.unsubscribeAll();this.itemMouseOverEvent.unsubscribeAll();this.itemMouseOutEvent.unsubscribeAll();this.itemArrowToEvent.unsubscribeAll();this.itemArrowFromEvent.unsubscribeAll();this.itemSelectEvent.unsubscribeAll();this.unmatchedItemSelectEvent.unsubscribeAll();this.selectionEnforceEvent.unsubscribeAll();this.containerCollapseEvent.unsubscribeAll();this.textboxBlurEvent.unsubscribeAll();YAHOO.util.Event.purgeElement(A,true);
YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._elTextbox=null;YAHOO.widget.AutoComplete.prototype._elContainer=null;YAHOO.widget.AutoComplete.prototype._elContent=null;YAHOO.widget.AutoComplete.prototype._elHeader=null;YAHOO.widget.AutoComplete.prototype._elBody=null;YAHOO.widget.AutoComplete.prototype._elFooter=null;YAHOO.widget.AutoComplete.prototype._elShadow=null;YAHOO.widget.AutoComplete.prototype._elIFrame=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._aListItems=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var D=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(D)||(D<1)){this.maxResultsDisplayed=10;}var E=this.queryDelay;if(!YAHOO.lang.isNumber(E)||(E<0)){this.queryDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var C=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(C)||(C<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width="100%";B.style.height="100%";B.tabIndex=-1;this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._elBody.hasChildNodes()){var B=this.getListItems();if(B){for(var A=B.length-1;A>=0;A--){B[A]=null;}}this._elBody.innerHTML="";}var E=document.createElement("ul");E=this._elBody.appendChild(E);for(var C=0;C<this.maxResultsDisplayed;C++){var D=document.createElement("li");D=E.appendChild(D);this._aListItems[C]=D;this._initListItem(D,C);}this._maxResultsDisplayed=this.maxResultsDisplayed;};YAHOO.widget.AutoComplete.prototype._initListItem=function(C,B){var A=this;C.style.display="none";C._nItemIndex=B;C.mouseover=C.mouseout=C.onclick=null;YAHOO.util.Event.addListener(C,"mouseover",A._onItemMouseover,A);YAHOO.util.Event.addListener(C,"mouseout",A._onItemMouseout,A);YAHOO.util.Event.addListener(C,"click",A._onItemMouseclick,A);};YAHOO.widget.AutoComplete.prototype._onIMEDetected=function(A){A._enableIntervalDetection();};YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var A=this._elTextbox.value;var B=this._sLastTextboxValue;if(A!=B){this._sLastTextboxValue=A;this._sendQuery(A);}};YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection=function(A){if(A._queryInterval){clearInterval(A._queryInterval);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(A){if((A==9)||(A==13)||(A==16)||(A==17)||(A>=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(G){if(this.minQueryLength==-1){this._toggleContainer(false);return ;}var C=(this.delimChar)?this.delimChar:null;if(C){var E=-1;for(var B=C.length-1;B>=0;B--){var F=G.lastIndexOf(C[B]);if(F>E){E=F;
}}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(G[E-1]==C[A]){E--;break;}}}if(E>-1){var D=E+1;while(G.charAt(D)==" "){D+=1;}this._sSavedQuery=G.substring(0,D);G=G.substr(D);}else{if(G.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}}if((G&&(G.length<this.minQueryLength))||(!G&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return ;}G=encodeURIComponent(G);this._nDelayID=-1;G=this.doBeforeSendQuery(G);this.dataRequestEvent.fire(this,G);this.dataSource.getResults(this._populateList,G,this);};YAHOO.widget.AutoComplete.prototype._populateList=function(K,L,I){if(L===null){I.dataErrorEvent.fire(I,K);}if(!I._bFocused||!L){return ;}var A=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var O=I._elContent.style;O.width=(!A)?null:"";O.height=(!A)?null:"";var H=decodeURIComponent(K);I._sCurQuery=H;I._bItemSelected=false;if(I._maxResultsDisplayed!=I.maxResultsDisplayed){I._initList();}var C=Math.min(L.length,I.maxResultsDisplayed);I._nDisplayedItems=C;if(C>0){I._initContainerHelpers();var D=I._aListItems;for(var G=C-1;G>=0;G--){var N=D[G];var B=L[G];N.innerHTML=I.formatResult(B,H);N.style.display="list-item";N._sResultKey=B[0];N._oResultData=B;}for(var F=D.length-1;F>=C;F--){var M=D[F];M.innerHTML=null;M.style.display="none";M._sResultKey=null;M._oResultData=null;}var J=I.doBeforeExpandContainer(I._elTextbox,I._elContainer,K,L);I._toggleContainer(J);if(I.autoHighlight){var E=D[0];I._toggleHighlight(E,"to");I.itemArrowToEvent.fire(I,E);I._typeAhead(E,K);}else{I._oCurItem=null;}}else{I._toggleContainer(false);}I.dataReturnEvent.fire(I,K,L);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var C=this._elTextbox.value;var B=(this.delimChar)?this.delimChar[0]:null;var A=(B)?C.lastIndexOf(B,C.length-2):-1;if(A>-1){this._elTextbox.value=C.substring(0,A);}else{this._elTextbox.value="";}this._sSavedQuery=this._elTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var D=null;for(var A=this._nDisplayedItems-1;A>=0;A--){var C=this._aListItems[A];var B=C._sResultKey.toLowerCase();if(B==this._sCurQuery.toLowerCase()){D=C;break;}}return(D);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(D,G){if(!this.typeAhead||(this._nKeyCode==8)){return ;}var F=this._elTextbox;var E=this._elTextbox.value;if(!F.setSelectionRange&&!F.createTextRange){return ;}var B=E.length;this._updateValue(D);var C=F.value.length;this._selectText(F,B,C);var A=F.value.substr(B,C);this.typeAheadEvent.fire(this,G,A);};YAHOO.widget.AutoComplete.prototype._selectText=function(D,A,B){if(D.setSelectionRange){D.setSelectionRange(A,B);}else{if(D.createTextRange){var C=D.createTextRange();C.moveStart("character",A);C.moveEnd("character",B-D.value.length);C.select();}else{D.select();}}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(B){var D=false;var C=this._elContent.offsetWidth+"px";var A=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){D=true;if(B){this._elIFrame.style.width=C;this._elIFrame.style.height=A;}else{this._elIFrame.style.width=0;this._elIFrame.style.height=0;}}if(this.useShadow&&this._elShadow){D=true;if(B){this._elShadow.style.width=C;this._elShadow.style.height=A;}else{this._elShadow.style.width=0;this._elShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(K){var E=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return ;}if(!K){this._elContent.scrollTop=0;var C=this._aListItems;if(C&&(C.length>0)){for(var H=C.length-1;H>=0;H--){C[H].style.display="none";}}if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;}if(!K&&!this._bContainerOpen){this._elContent.style.display="none";return ;}var B=this._oAnim;if(B&&B.getEl()&&(this.animHoriz||this.animVert)){if(!K){this._toggleContainerHelpers(K);}if(B.isAnimated()){B.stop();}var I=this._elContent.cloneNode(true);E.appendChild(I);I.style.top="-9000px";I.style.display="block";var G=I.offsetWidth;var D=I.offsetHeight;var A=(this.animHoriz)?0:G;var F=(this.animVert)?0:D;B.attributes=(K)?{width:{to:G},height:{to:D}}:{width:{to:A},height:{to:F}};if(K&&!this._bContainerOpen){this._elContent.style.width=A+"px";this._elContent.style.height=F+"px";}else{this._elContent.style.width=G+"px";this._elContent.style.height=D+"px";}E.removeChild(I);I=null;var J=this;var L=function(){B.onComplete.unsubscribeAll();if(K){J.containerExpandEvent.fire(J);}else{J._elContent.style.display="none";J.containerCollapseEvent.fire(J);}J._toggleContainerHelpers(K);};this._elContent.style.display="block";B.onComplete.subscribe(L);B.animate();this._bContainerOpen=K;}else{if(K){this._elContent.style.display="block";this.containerExpandEvent.fire(this);}else{this._elContent.style.display="none";this.containerCollapseEvent.fire(this);}this._toggleContainerHelpers(K);this._bContainerOpen=K;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){var B=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,B);}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._oCurItem=A;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(A,C){if(A==this._oCurItem){return ;}var B=this.prehighlightClassName;if((C=="mouseover")&&B){YAHOO.util.Dom.addClass(A,B);}else{YAHOO.util.Dom.removeClass(A,B);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(E){var F=this._elTextbox;var D=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=this._sSavedQuery;var C=E._sResultKey;F.focus();F.value="";if(D){if(B){F.value=B;}F.value+=C+D;if(D!=" "){F.value+=" ";}}else{F.value=C;}if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._oCurItem=E;};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._cancelIntervalDetection(this);this.itemSelectEvent.fire(this,A,A._oResultData);
this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._oCurItem){this._selectItem(this._oCurItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var E=this._oCurItem;var F=-1;if(E){F=E._nItemIndex;}var D=(G==40)?(F+1):(F-1);if(D<-2||D>=this._nDisplayedItems){return ;}if(E){this._toggleHighlight(E,"from");this.itemArrowFromEvent.fire(this,E);}if(D==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._elTextbox.value=this._sSavedQuery;}else{this._elTextbox.value=this._sSavedQuery+this._sCurQuery;}}else{this._elTextbox.value=this._sCurQuery;}this._oCurItem=null;return ;}if(D==-2){this._toggleContainer(false);return ;}var C=this._aListItems[D];var A=this._elContent;var B=((YAHOO.util.Dom.getStyle(A,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(A,"overflowY")=="auto"));if(B&&(D>-1)&&(D<this._nDisplayedItems)){if(G==40){if((C.offsetTop+C.offsetHeight)>(A.scrollTop+A.offsetHeight)){A.scrollTop=(C.offsetTop+C.offsetHeight)-A.offsetHeight;}else{if((C.offsetTop+C.offsetHeight)<A.scrollTop){A.scrollTop=C.offsetTop;}}}else{if(C.offsetTop<A.scrollTop){this._elContent.scrollTop=C.offsetTop;}else{if(C.offsetTop>(A.scrollTop+A.offsetHeight)){this._elContent.scrollTop=(C.offsetTop+C.offsetHeight)-A.offsetHeight;}}}}this._toggleHighlight(C,"to");this.itemArrowToEvent.fire(this,C);if(this.typeAhead){this._updateValue(C);}}};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseover");}else{B._toggleHighlight(this,"to");}B.itemMouseOverEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseout");}else{B._toggleHighlight(this,"from");}B.itemMouseOutEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(A,B){B._toggleHighlight(this,"to");B._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,B){B._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,B){B._bOverContainer=false;if(B._oCurItem){B._toggleHighlight(B._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._elTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;switch(C){case 9:if(B._oCurItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}break;case 13:if(!YAHOO.env.ua.webkit){if(B._oCurItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return ;case 39:B._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(A);B._moveSelection(C);break;case 40:YAHOO.util.Event.stopEvent(A);B._moveSelection(C);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if(YAHOO.env.ua.webkit){switch(C){case 9:if(B._oCurItem){if(B.delimChar&&(B._nKeyCode!=C)){YAHOO.util.Event.stopEvent(A);}}break;case 13:if(B._oCurItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._oCurItem);}else{B._toggleContainer(false);}break;default:break;}}else{if(C==229){B._queryInterval=setInterval(function(){B._onIMEDetected(B);},500);}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(B,D){D._initProps();var E=B.keyCode;D._nKeyCode=E;var C=this.value;if(D._isIgnoreKey(E)||(C.toLowerCase()==D._sCurQuery)){return ;}else{D._bItemSelected=false;YAHOO.util.Dom.removeClass(D._oCurItem,D.highlightClassName);D._oCurItem=null;D.textboxKeyEvent.fire(D,E);}if(D.queryDelay>0){var A=setTimeout(function(){D._sendQuery(C);},(D.queryDelay*1000));if(D._nDelayID!=-1){clearTimeout(D._nDelayID);}D._nDelayID=A;}else{D._sendQuery(C);}};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;if(!B._bItemSelected){B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,B){if(!B._bOverContainer||(B._nKeyCode==9)){if(!B._bItemSelected){var C=B._textMatchesOption();if(!B._bContainerOpen||(B._bContainerOpen&&(C===null))){if(B.forceSelection){B._clearSelection();}else{B.unmatchedItemSelectEvent.fire(B);}}else{if(B.forceSelection){B._selectItem(C);}}}if(B._bContainerOpen){B._toggleContainer(false);}B._cancelIntervalDetection(B);B._bFocused=false;B.textboxBlurEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.DataSource=function(){};YAHOO.widget.DataSource.ERROR_DATANULL="Response data was null";YAHOO.widget.DataSource.ERROR_DATAPARSE="Response data could not be parsed";YAHOO.widget.DataSource.prototype.maxCacheEntries=15;YAHOO.widget.DataSource.prototype.queryMatchContains=false;YAHOO.widget.DataSource.prototype.queryMatchSubset=false;YAHOO.widget.DataSource.prototype.queryMatchCase=false;YAHOO.widget.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.widget.DataSource.prototype.getResults=function(A,D,B){var C=this._doQueryCache(A,D,B);if(C.length===0){this.queryEvent.fire(this,B,D);this.doQuery(A,D,B);}};YAHOO.widget.DataSource.prototype.doQuery=function(A,C,B){};YAHOO.widget.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];}if(this._aCacheHelper){this._aCacheHelper=[];}this.cacheFlushEvent.fire(this);};YAHOO.widget.DataSource.prototype.queryEvent=null;YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;YAHOO.widget.DataSource.prototype.getResultsEvent=null;YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;
YAHOO.widget.DataSource.prototype.dataErrorEvent=null;YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;YAHOO.widget.DataSource._nIndex=0;YAHOO.widget.DataSource.prototype._sName=null;YAHOO.widget.DataSource.prototype._aCache=null;YAHOO.widget.DataSource.prototype._init=function(){var A=this.maxCacheEntries;if(!YAHOO.lang.isNumber(A)||(A<0)){A=0;}if(A>0&&!this._aCache){this._aCache=[];}this._sName="instance"+YAHOO.widget.DataSource._nIndex;YAHOO.widget.DataSource._nIndex++;this.queryEvent=new YAHOO.util.CustomEvent("query",this);this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);};YAHOO.widget.DataSource.prototype._addCacheElem=function(B){var A=this._aCache;if(!A||!B||!B.query||!B.results){return ;}if(A.length>=this.maxCacheEntries){A.shift();}A.push(B);};YAHOO.widget.DataSource.prototype._doQueryCache=function(A,I,N){var H=[];var G=false;var J=this._aCache;var F=(J)?J.length:0;var K=this.queryMatchContains;var D;if((this.maxCacheEntries>0)&&J&&(F>0)){this.cacheQueryEvent.fire(this,N,I);if(!this.queryMatchCase){D=I;I=I.toLowerCase();}for(var P=F-1;P>=0;P--){var E=J[P];var B=E.results;var C=(!this.queryMatchCase)?encodeURIComponent(E.query).toLowerCase():encodeURIComponent(E.query);if(C==I){G=true;H=B;if(P!=F-1){J.splice(P,1);this._addCacheElem(E);}break;}else{if(this.queryMatchSubset){for(var O=I.length-1;O>=0;O--){var R=I.substr(0,O);if(C==R){G=true;for(var M=B.length-1;M>=0;M--){var Q=B[M];var L=(this.queryMatchCase)?encodeURIComponent(Q[0]).indexOf(I):encodeURIComponent(Q[0]).toLowerCase().indexOf(I);if((!K&&(L===0))||(K&&(L>-1))){H.unshift(Q);}}E={};E.query=I;E.results=H;this._addCacheElem(E);break;}}if(G){break;}}}}if(G){this.getCachedResultsEvent.fire(this,N,D,H);A(D,H,N);}}return H;};YAHOO.widget.DS_XHR=function(C,A,D){if(D&&(D.constructor==Object)){for(var B in D){this[B]=D[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(C)){return ;}this.schema=A;this.scriptURI=C;this._init();};YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_XHR.TYPE_JSON=0;YAHOO.widget.DS_XHR.TYPE_XML=1;YAHOO.widget.DS_XHR.TYPE_FLAT=2;YAHOO.widget.DS_XHR.ERROR_DATAXHR="XHR response failed";YAHOO.widget.DS_XHR.prototype.connMgr=YAHOO.util.Connect;YAHOO.widget.DS_XHR.prototype.connTimeout=0;YAHOO.widget.DS_XHR.prototype.scriptURI=null;YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n<!-";YAHOO.widget.DS_XHR.prototype.doQuery=function(E,G,B){var J=(this.responseType==YAHOO.widget.DS_XHR.TYPE_XML);var D=this.scriptURI+"?"+this.scriptQueryParam+"="+G;if(this.scriptQueryAppend.length>0){D+="&"+this.scriptQueryAppend;}var C=null;var F=this;var I=function(K){if(!F._oConn||(K.tId!=F._oConn.tId)){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}for(var N in K){}if(!J){K=K.responseText;}else{K=K.responseXML;}if(K===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var M=F.parseResponse(G,K,B);var L={};L.query=decodeURIComponent(G);L.results=M;if(M===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATAPARSE);M=[];}else{F.getResultsEvent.fire(F,B,G,M);F._addCacheElem(L);}E(G,M,B);};var A=function(K){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DS_XHR.ERROR_DATAXHR);return ;};var H={success:I,failure:A};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){H.timeout=this.connTimeout;}if(this._oConn){this.connMgr.abort(this._oConn);}F._oConn=this.connMgr.asyncRequest("GET",D,H,null);};YAHOO.widget.DS_XHR.prototype.parseResponse=function(sQuery,oResponse,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var nEnd=((this.responseStripAfter!=="")&&(oResponse.indexOf))?oResponse.indexOf(this.responseStripAfter):-1;if(nEnd!=-1){oResponse=oResponse.substring(0,nEnd);}switch(this.responseType){case YAHOO.widget.DS_XHR.TYPE_JSON:var jsonList,jsonObjParsed;if(YAHOO.lang.JSON){jsonObjParsed=YAHOO.lang.JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(oResponse.parseJSON){jsonObjParsed=oResponse.parseJSON();if(!jsonObjParsed){bError=true;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(window.JSON){jsonObjParsed=JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{try{while(oResponse.substring(0,1)==" "){oResponse=oResponse.substring(1,oResponse.length);}if(oResponse.indexOf("{")<0){bError=true;break;}if(oResponse.indexOf("{}")===0){break;}var jsonObjRaw=eval("("+oResponse+")");if(!jsonObjRaw){bError=true;break;}jsonList=eval("(jsonObjRaw."+aSchema[0]+")");}catch(e){bError=true;break;}}}}if(!jsonList){bError=true;break;}if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}break;case YAHOO.widget.DS_XHR.TYPE_XML:var xmlList=oResponse.getElementsByTagName(aSchema[0]);if(!xmlList){bError=true;break;}for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k);var aFieldSet=[];for(var m=aSchema.length-1;m>=1;m--){var sValue=null;var xmlAttr=result.attributes.getNamedItem(aSchema[m]);if(xmlAttr){sValue=xmlAttr.value;}else{var xmlNode=result.getElementsByTagName(aSchema[m]);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){sValue=xmlNode.item(0).firstChild.nodeValue;
}else{sValue="";}}aFieldSet.unshift(sValue);}aResults.unshift(aFieldSet);}break;case YAHOO.widget.DS_XHR.TYPE_FLAT:if(oResponse.length>0){var newLength=oResponse.length-aSchema[0].length;if(oResponse.substr(newLength)==aSchema[0]){oResponse=oResponse.substr(0,newLength);}var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){aResults[n]=aRecords[n].split(aSchema[1]);}}break;default:break;}sQuery=null;oResponse=null;oParent=null;if(bError){return null;}else{return aResults;}};YAHOO.widget.DS_XHR.prototype._oConn=null;YAHOO.widget.DS_ScriptNode=function(D,A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(D)){return ;}this.schema=A;this.scriptURI=D;this._init();};YAHOO.widget.DS_ScriptNode.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_ScriptNode.prototype.getUtility=YAHOO.util.Get;YAHOO.widget.DS_ScriptNode.prototype.scriptURI=null;YAHOO.widget.DS_ScriptNode.prototype.scriptQueryParam="query";YAHOO.widget.DS_ScriptNode.prototype.asyncMode="allowAll";YAHOO.widget.DS_ScriptNode.prototype.scriptCallbackParam="callback";YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;YAHOO.widget.DS_ScriptNode._nPending=0;YAHOO.widget.DS_ScriptNode.prototype.doQuery=function(A,F,C){var B=this;if(YAHOO.widget.DS_ScriptNode._nPending===0){YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;}var E=YAHOO.widget.DS_ScriptNode._nId;YAHOO.widget.DS_ScriptNode._nId++;YAHOO.widget.DS_ScriptNode.callbacks[E]=function(G){if((B.asyncMode!=="ignoreStaleResponses")||(E===YAHOO.widget.DS_ScriptNode.callbacks.length-1)){B.handleResponse(G,A,F,C);}else{}delete YAHOO.widget.DS_ScriptNode.callbacks[E];};YAHOO.widget.DS_ScriptNode._nPending++;var D=this.scriptURI+"&"+this.scriptQueryParam+"="+F+"&"+this.scriptCallbackParam+"=YAHOO.widget.DS_ScriptNode.callbacks["+E+"]";this.getUtility.script(D,{autopurge:true,onsuccess:YAHOO.widget.DS_ScriptNode._bumpPendingDown,onfail:YAHOO.widget.DS_ScriptNode._bumpPendingDown});};YAHOO.widget.DS_ScriptNode.prototype.handleResponse=function(oResponse,oCallbackFn,sQuery,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var jsonList,jsonObjParsed;try{jsonList=eval("(oResponse."+aSchema[0]+")");}catch(e){bError=true;}if(!jsonList){bError=true;jsonList=[];}else{if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}if(bError){aResults=null;}if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATAPARSE);aResults=[];}else{var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);}oCallbackFn(sQuery,aResults,oParent);};YAHOO.widget.DS_ScriptNode._bumpPendingDown=function(){YAHOO.widget.DS_ScriptNode._nPending--;};YAHOO.widget.DS_JSFunction=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isFunction(A)){return ;}else{this.dataFunction=A;this._init();}};YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;YAHOO.widget.DS_JSFunction.prototype.doQuery=function(C,F,D){var B=this.dataFunction;var E=[];E=B(F);if(E===null){this.dataErrorEvent.fire(this,D,F,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var A={};A.query=decodeURIComponent(F);A.results=E;this._addCacheElem(A);this.getResultsEvent.fire(this,D,F,E);C(F,E,D);return ;};YAHOO.widget.DS_JSArray=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)){return ;}else{this.data=A;this._init();}};YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSArray.prototype.data=null;YAHOO.widget.DS_JSArray.prototype.doQuery=function(E,I,A){var F;var C=this.data;var J=[];var D=false;var B=this.queryMatchContains;if(I){if(!this.queryMatchCase){I=I.toLowerCase();}for(F=C.length-1;F>=0;F--){var H=[];if(YAHOO.lang.isString(C[F])){H[0]=C[F];}else{if(YAHOO.lang.isArray(C[F])){H=C[F];}}if(YAHOO.lang.isString(H[0])){var G=(this.queryMatchCase)?encodeURIComponent(H[0]).indexOf(I):encodeURIComponent(H[0]).toLowerCase().indexOf(I);if((!B&&(G===0))||(B&&(G>-1))){J.unshift(H);}}}}else{for(F=C.length-1;F>=0;F--){if(YAHOO.lang.isString(C[F])){J.unshift([C[F]]);}else{if(YAHOO.lang.isArray(C[F])){J.unshift(C[F]);}}}}this.getResultsEvent.fire(this,A,I,J);E(I,J,A);};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.5.1",build:"984"});/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F,E;for(F in this.config){E=this.config[F];if(E&&E.event){D[F]=E.value;}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){this.refireEvent(D);}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(Q,P){if(Q){this.init(Q,P);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,M=YAHOO.util.Event,L=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,H,O,N,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},I={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.textResizeEvent=new L("textResize");function K(){if(!H){H=document.createElement("div");H.innerHTML=('<div class="'+G.CSS_HEADER+'"></div>'+'<div class="'+G.CSS_BODY+'"></div><div class="'+G.CSS_FOOTER+'"></div>');O=H.firstChild;N=O.nextSibling;E=N.nextSibling;}return H;}function J(){if(!O){K();}return(O.cloneNode(false));}function B(){if(!N){K();}return(N.cloneNode(false));}function C(){if(!E){K();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var P=L.LIST;this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=P;this.initEvent=this.createEvent(A.INIT);this.initEvent.signature=P;this.appendEvent=this.createEvent(A.APPEND);
this.appendEvent.signature=P;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=P;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=P;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=P;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=P;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=P;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=P;this.destroyEvent=this.createEvent(A.DESTORY);this.destroyEvent.signature=P;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=P;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=P;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=P;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=P;},platform:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("windows")!=-1||P.indexOf("win32")!=-1){return"windows";}else{if(P.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("opera")!=-1){return"opera";}else{if(P.indexOf("msie 7")!=-1){return"ie7";}else{if(P.indexOf("msie")!=-1){return"ie";}else{if(P.indexOf("safari")!=-1){return"safari";}else{if(P.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(I.VISIBLE.key,{handler:this.configVisible,value:I.VISIBLE.value,validator:I.VISIBLE.validator});this.cfg.addProperty(I.EFFECT.key,{suppressEvent:I.EFFECT.suppressEvent,supercedes:I.EFFECT.supercedes});this.cfg.addProperty(I.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:I.MONITOR_RESIZE.value});this.cfg.addProperty(I.APPEND_TO_DOCUMENT_BODY.key,{value:I.APPEND_TO_DOCUMENT_BODY.value});},init:function(U,T){var R,V;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof U=="string"){R=U;U=document.getElementById(U);if(!U){U=(K()).cloneNode(false);U.id=R;}}this.element=U;if(U.id){this.id=U.id;}V=this.element.firstChild;if(V){var Q=false,P=false,S=false;do{if(1==V.nodeType){if(!Q&&F.hasClass(V,G.CSS_HEADER)){this.header=V;Q=true;}else{if(!P&&F.hasClass(V,G.CSS_BODY)){this.body=V;P=true;}else{if(!S&&F.hasClass(V,G.CSS_FOOTER)){this.footer=V;S=true;}}}}}while((V=V.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(T){this.cfg.applyConfig(T,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var Q=(YAHOO.env.ua.gecko&&this.platform=="windows");if(Q){var P=this;setTimeout(function(){P._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var P,R,T;function V(){G.textResizeEvent.fire();}if(!YAHOO.env.ua.opera){R=F.get("_yuiResizeMonitor");var U=this._supportsCWResize();if(!R){R=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){R.src=G.RESIZE_MONITOR_SECURE_URL;}if(!U){T=["<html><head><script ",'type="text/javascript">',"window.onresize=function(){window.parent.","YAHOO.widget.Module.textResizeEvent.","fire();};<","/script></head>","<body></body></html>"].join("");R.src="data:text/html;charset=utf-8,"+encodeURIComponent(T);}R.id="_yuiResizeMonitor";R.style.position="absolute";R.style.visibility="hidden";var Q=document.body,S=Q.firstChild;if(S){Q.insertBefore(R,S);}else{Q.appendChild(R);}R.style.width="10em";R.style.height="10em";R.style.top=(-1*R.offsetHeight)+"px";R.style.left=(-1*R.offsetWidth)+"px";R.style.borderWidth="0";R.style.visibility="visible";if(YAHOO.env.ua.webkit){P=R.contentWindow.document;P.open();P.close();}}if(R&&R.contentWindow){G.textResizeEvent.subscribe(this.onDomResize,this,true);if(!G.textResizeInitialized){if(U){if(!M.on(R.contentWindow,"resize",V)){M.on(R,"resize",V);}}G.textResizeInitialized=true;}this.resizeMonitor=R;}}},_supportsCWResize:function(){var P=true;if(YAHOO.env.ua.gecko&&YAHOO.env.ua.gecko<=1.8){P=false;}return P;},onDomResize:function(S,R){var Q=-1*this.resizeMonitor.offsetWidth,P=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=P+"px";this.resizeMonitor.style.left=Q+"px";},setHeader:function(Q){var P=this.header||(this.header=J());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeHeaderEvent.fire(Q);this.changeContentEvent.fire();},appendToHeader:function(Q){var P=this.header||(this.header=J());P.appendChild(Q);this.changeHeaderEvent.fire(Q);this.changeContentEvent.fire();},setBody:function(Q){var P=this.body||(this.body=B());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeBodyEvent.fire(Q);this.changeContentEvent.fire();},appendToBody:function(Q){var P=this.body||(this.body=B());P.appendChild(Q);this.changeBodyEvent.fire(Q);this.changeContentEvent.fire();},setFooter:function(Q){var P=this.footer||(this.footer=C());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeFooterEvent.fire(Q);this.changeContentEvent.fire();},appendToFooter:function(Q){var P=this.footer||(this.footer=C());P.appendChild(Q);this.changeFooterEvent.fire(Q);this.changeContentEvent.fire();},render:function(R,P){var S=this,T;function Q(U){if(typeof U=="string"){U=document.getElementById(U);}if(U){S._addToParent(U,S.element);S.appendEvent.fire();}}this.beforeRenderEvent.fire();if(!P){P=this.element;}if(R){Q(R);}else{if(!F.inDocument(this.element)){return false;}}if(this.header&&!F.inDocument(this.header)){T=P.firstChild;if(T){P.insertBefore(this.header,T);}else{P.appendChild(this.header);}}if(this.body&&!F.inDocument(this.body)){if(this.footer&&F.isAncestor(this.moduleElement,this.footer)){P.insertBefore(this.body,this.footer);
}else{P.appendChild(this.body);}}if(this.footer&&!F.inDocument(this.footer)){P.appendChild(this.footer);}this.renderEvent.fire();return true;},destroy:function(){var P,Q;if(this.element){M.purgeElement(this.element,true);P=this.element.parentNode;}if(P){P.removeChild(this.element);}this.element=null;this.header=null;this.body=null;this.footer=null;G.textResizeEvent.unsubscribe(this.onDomResize,this);this.cfg.destroy();this.cfg=null;this.destroyEvent.fire();for(Q in this){if(Q instanceof L){Q.unsubscribeAll();}}},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(Q,P,R){var S=P[0];if(S){this.beforeShowEvent.fire();F.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();F.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(R,Q,S){var P=Q[0];if(P){this.initResizeMonitor();}else{G.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}},_addToParent:function(P,Q){if(!this.cfg.getProperty("appendtodocumentbody")&&P===document.body&&P.firstChild){P.insertBefore(Q,P.firstChild);}else{P.appendChild(Q);}},toString:function(){return"Module "+this.id;}};YAHOO.lang.augmentProto(G,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Overlay=function(L,K){YAHOO.widget.Overlay.superclass.constructor.call(this,L,K);};var F=YAHOO.lang,I=YAHOO.util.CustomEvent,E=YAHOO.widget.Module,J=YAHOO.util.Event,D=YAHOO.util.Dom,C=YAHOO.util.Config,B=YAHOO.widget.Overlay,G,A={"BEFORE_MOVE":"beforeMove","MOVE":"move"},H={"X":{key:"x",validator:F.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:F.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:F.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:F.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.env.ua.ie==6?true:false),validator:F.isBoolean,supercedes:["zindex"]}};B.IFRAME_SRC="javascript:false;";B.IFRAME_OFFSET=3;B.VIEWPORT_OFFSET=10;B.TOP_LEFT="tl";B.TOP_RIGHT="tr";B.BOTTOM_LEFT="bl";B.BOTTOM_RIGHT="br";B.CSS_OVERLAY="yui-overlay";B.windowScrollEvent=new I("windowScroll");B.windowResizeEvent=new I("windowResize");B.windowScrollHandler=function(K){if(YAHOO.env.ua.ie){if(!window.scrollEnd){window.scrollEnd=-1;}clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){B.windowScrollEvent.fire();},1);}else{B.windowScrollEvent.fire();}};B.windowResizeHandler=function(K){if(YAHOO.env.ua.ie){if(!window.resizeEnd){window.resizeEnd=-1;}clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){B.windowResizeEvent.fire();},100);}else{B.windowResizeEvent.fire();}};B._initialized=null;if(B._initialized===null){J.on(window,"scroll",B.windowScrollHandler);J.on(window,"resize",B.windowResizeHandler);B._initialized=true;}YAHOO.extend(B,E,{init:function(L,K){B.superclass.init.call(this,L);this.beforeInitEvent.fire(B);D.addClass(this.element,B.CSS_OVERLAY);if(K){this.cfg.applyConfig(K,true);}if(this.platform=="mac"&&YAHOO.env.ua.gecko){if(!C.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}if(!C.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}this.initEvent.fire(B);},initEvents:function(){B.superclass.initEvents.call(this);var K=I.LIST;this.beforeMoveEvent=this.createEvent(A.BEFORE_MOVE);this.beforeMoveEvent.signature=K;this.moveEvent=this.createEvent(A.MOVE);this.moveEvent.signature=K;},initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);this.cfg.addProperty(H.X.key,{handler:this.configX,validator:H.X.validator,suppressEvent:H.X.suppressEvent,supercedes:H.X.supercedes});this.cfg.addProperty(H.Y.key,{handler:this.configY,validator:H.Y.validator,suppressEvent:H.Y.suppressEvent,supercedes:H.Y.supercedes});this.cfg.addProperty(H.XY.key,{handler:this.configXY,suppressEvent:H.XY.suppressEvent,supercedes:H.XY.supercedes});this.cfg.addProperty(H.CONTEXT.key,{handler:this.configContext,suppressEvent:H.CONTEXT.suppressEvent,supercedes:H.CONTEXT.supercedes});this.cfg.addProperty(H.FIXED_CENTER.key,{handler:this.configFixedCenter,value:H.FIXED_CENTER.value,validator:H.FIXED_CENTER.validator,supercedes:H.FIXED_CENTER.supercedes});this.cfg.addProperty(H.WIDTH.key,{handler:this.configWidth,suppressEvent:H.WIDTH.suppressEvent,supercedes:H.WIDTH.supercedes});this.cfg.addProperty(H.HEIGHT.key,{handler:this.configHeight,suppressEvent:H.HEIGHT.suppressEvent,supercedes:H.HEIGHT.supercedes});this.cfg.addProperty(H.ZINDEX.key,{handler:this.configzIndex,value:H.ZINDEX.value});this.cfg.addProperty(H.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:H.CONSTRAIN_TO_VIEWPORT.value,validator:H.CONSTRAIN_TO_VIEWPORT.validator,supercedes:H.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(H.IFRAME.key,{handler:this.configIframe,value:H.IFRAME.value,validator:H.IFRAME.validator,supercedes:H.IFRAME.supercedes});},moveTo:function(K,L){this.cfg.setProperty("xy",[K,L]);},hideMacGeckoScrollbars:function(){D.removeClass(this.element,"show-scrollbars");D.addClass(this.element,"hide-scrollbars");},showMacGeckoScrollbars:function(){D.removeClass(this.element,"hide-scrollbars");D.addClass(this.element,"show-scrollbars");},configVisible:function(N,K,T){var M=K[0],O=D.getStyle(this.element,"visibility"),U=this.cfg.getProperty("effect"),R=[],Q=(this.platform=="mac"&&YAHOO.env.ua.gecko),b=C.alreadySubscribed,S,L,a,Y,X,W,Z,V,P;
if(O=="inherit"){a=this.element.parentNode;while(a.nodeType!=9&&a.nodeType!=11){O=D.getStyle(a,"visibility");if(O!="inherit"){break;}a=a.parentNode;}if(O=="inherit"){O="visible";}}if(U){if(U instanceof Array){V=U.length;for(Y=0;Y<V;Y++){S=U[Y];R[R.length]=S.effect(this,S.duration);}}else{R[R.length]=U.effect(this,U.duration);}}if(M){if(Q){this.showMacGeckoScrollbars();}if(U){if(M){if(O!="visible"||O===""){this.beforeShowEvent.fire();P=R.length;for(X=0;X<P;X++){L=R[X];if(X===0&&!b(L.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){L.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}L.animateIn();}}}}else{if(O!="visible"||O===""){this.beforeShowEvent.fire();D.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(Q){this.hideMacGeckoScrollbars();}if(U){if(O=="visible"){this.beforeHideEvent.fire();P=R.length;for(W=0;W<P;W++){Z=R[W];if(W===0&&!b(Z.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){Z.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}Z.animateOut();}}else{if(O===""){D.setStyle(this.element,"visibility","hidden");}}}else{if(O=="visible"||O===""){this.beforeHideEvent.fire();D.setStyle(this.element,"visibility","hidden");this.hideEvent.fire();}}}},doCenterOnDOMEvent:function(){if(this.cfg.getProperty("visible")){this.center();}},configFixedCenter:function(O,M,P){var Q=M[0],L=C.alreadySubscribed,N=B.windowResizeEvent,K=B.windowScrollEvent;if(Q){this.center();if(!L(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center);}if(!L(N,this.doCenterOnDOMEvent,this)){N.subscribe(this.doCenterOnDOMEvent,this,true);}if(!L(K,this.doCenterOnDOMEvent,this)){K.subscribe(this.doCenterOnDOMEvent,this,true);}}else{this.beforeShowEvent.unsubscribe(this.center);N.unsubscribe(this.doCenterOnDOMEvent,this);K.unsubscribe(this.doCenterOnDOMEvent,this);}},configHeight:function(N,L,O){var K=L[0],M=this.element;D.setStyle(M,"height",K);this.cfg.refireEvent("iframe");},configWidth:function(N,K,O){var M=K[0],L=this.element;D.setStyle(L,"width",M);this.cfg.refireEvent("iframe");},configzIndex:function(M,K,N){var O=K[0],L=this.element;if(!O){O=D.getStyle(L,"zIndex");if(!O||isNaN(O)){O=0;}}if(this.iframe||this.cfg.getProperty("iframe")===true){if(O<=0){O=1;}}D.setStyle(L,"zIndex",O);this.cfg.setProperty("zIndex",O,true);if(this.iframe){this.stackIframe();}},configXY:function(M,L,N){var P=L[0],K=P[0],O=P[1];this.cfg.setProperty("x",K);this.cfg.setProperty("y",O);this.beforeMoveEvent.fire([K,O]);K=this.cfg.getProperty("x");O=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([K,O]);},configX:function(M,L,N){var K=L[0],O=this.cfg.getProperty("y");this.cfg.setProperty("x",K,true);this.cfg.setProperty("y",O,true);this.beforeMoveEvent.fire([K,O]);K=this.cfg.getProperty("x");O=this.cfg.getProperty("y");D.setX(this.element,K,true);this.cfg.setProperty("xy",[K,O],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([K,O]);},configY:function(M,L,N){var K=this.cfg.getProperty("x"),O=L[0];this.cfg.setProperty("x",K,true);this.cfg.setProperty("y",O,true);this.beforeMoveEvent.fire([K,O]);K=this.cfg.getProperty("x");O=this.cfg.getProperty("y");D.setY(this.element,O,true);this.cfg.setProperty("xy",[K,O],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([K,O]);},showIframe:function(){var L=this.iframe,K;if(L){K=this.element.parentNode;if(K!=L.parentNode){this._addToParent(K,L);}L.style.display="block";}},hideIframe:function(){if(this.iframe){this.iframe.style.display="none";}},syncIframe:function(){var K=this.iframe,M=this.element,O=B.IFRAME_OFFSET,L=(O*2),N;if(K){K.style.width=(M.offsetWidth+L+"px");K.style.height=(M.offsetHeight+L+"px");N=this.cfg.getProperty("xy");if(!F.isArray(N)||(isNaN(N[0])||isNaN(N[1]))){this.syncPosition();N=this.cfg.getProperty("xy");}D.setXY(K,[(N[0]-O),(N[1]-O)]);}},stackIframe:function(){if(this.iframe){var K=D.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(K)&&!isNaN(K)){D.setStyle(this.iframe,"zIndex",(K-1));}}},configIframe:function(N,M,O){var K=M[0];function P(){var R=this.iframe,S=this.element,T;if(!R){if(!G){G=document.createElement("iframe");if(this.isSecure){G.src=B.IFRAME_SRC;}if(YAHOO.env.ua.ie){G.style.filter="alpha(opacity=0)";G.frameBorder=0;}else{G.style.opacity="0";}G.style.position="absolute";G.style.border="none";G.style.margin="0";G.style.padding="0";G.style.display="none";}R=G.cloneNode(false);T=S.parentNode;var Q=T||document.body;this._addToParent(Q,R);this.iframe=R;}this.showIframe();this.syncIframe();this.stackIframe();if(!this._hasIframeEventListeners){this.showEvent.subscribe(this.showIframe);this.hideEvent.subscribe(this.hideIframe);this.changeContentEvent.subscribe(this.syncIframe);this._hasIframeEventListeners=true;}}function L(){P.call(this);this.beforeShowEvent.unsubscribe(L);this._iframeDeferred=false;}if(K){if(this.cfg.getProperty("visible")){P.call(this);}else{if(!this._iframeDeferred){this.beforeShowEvent.subscribe(L);this._iframeDeferred=true;}}}else{this.hideIframe();if(this._hasIframeEventListeners){this.showEvent.unsubscribe(this.showIframe);this.hideEvent.unsubscribe(this.hideIframe);this.changeContentEvent.unsubscribe(this.syncIframe);this._hasIframeEventListeners=false;}}},_primeXYFromDOM:function(){if(YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))){this.syncPosition();this.cfg.refireEvent("xy");this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);}},configConstrainToViewport:function(L,K,M){var N=K[0];if(N){if(!C.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}if(!C.alreadySubscribed(this.beforeShowEvent,this._primeXYFromDOM)){this.beforeShowEvent.subscribe(this._primeXYFromDOM);}}else{this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},configContext:function(M,L,O){var Q=L[0],N,P,K;if(Q){N=Q[0];P=Q[1];
K=Q[2];if(N){if(typeof N=="string"){this.cfg.setProperty("context",[document.getElementById(N),P,K],true);}if(P&&K){this.align(P,K);}}}},align:function(L,K){var Q=this.cfg.getProperty("context"),P=this,O,N,R;function M(S,T){switch(L){case B.TOP_LEFT:P.moveTo(T,S);break;case B.TOP_RIGHT:P.moveTo((T-N.offsetWidth),S);break;case B.BOTTOM_LEFT:P.moveTo(T,(S-N.offsetHeight));break;case B.BOTTOM_RIGHT:P.moveTo((T-N.offsetWidth),(S-N.offsetHeight));break;}}if(Q){O=Q[0];N=this.element;P=this;if(!L){L=Q[1];}if(!K){K=Q[2];}if(N&&O){R=D.getRegion(O);switch(K){case B.TOP_LEFT:M(R.top,R.left);break;case B.TOP_RIGHT:M(R.top,R.right);break;case B.BOTTOM_LEFT:M(R.bottom,R.left);break;case B.BOTTOM_RIGHT:M(R.bottom,R.right);break;}}}},enforceConstraints:function(L,K,M){var O=K[0];var N=this.getConstrainedXY(O[0],O[1]);this.cfg.setProperty("x",N[0],true);this.cfg.setProperty("y",N[1],true);this.cfg.setProperty("xy",N,true);},getConstrainedXY:function(V,T){var N=B.VIEWPORT_OFFSET,U=D.getViewportWidth(),Q=D.getViewportHeight(),M=this.element.offsetHeight,S=this.element.offsetWidth,Y=D.getDocumentScrollLeft(),W=D.getDocumentScrollTop();var P=V;var L=T;if(S+N<U){var R=Y+N;var X=Y+U-S-N;if(V<R){P=R;}else{if(V>X){P=X;}}}else{P=N+Y;}if(M+N<Q){var O=W+N;var K=W+Q-M-N;if(T<O){L=O;}else{if(T>K){L=K;}}}else{L=N+W;}return[P,L];},center:function(){var N=B.VIEWPORT_OFFSET,O=this.element.offsetWidth,M=this.element.offsetHeight,L=D.getViewportWidth(),P=D.getViewportHeight(),K,Q;if(O<L){K=(L/2)-(O/2)+D.getDocumentScrollLeft();}else{K=N+D.getDocumentScrollLeft();}if(M<P){Q=(P/2)-(M/2)+D.getDocumentScrollTop();}else{Q=N+D.getDocumentScrollTop();}this.cfg.setProperty("xy",[parseInt(K,10),parseInt(Q,10)]);this.cfg.refireEvent("iframe");},syncPosition:function(){var K=D.getXY(this.element);this.cfg.setProperty("x",K[0],true);this.cfg.setProperty("y",K[1],true);this.cfg.setProperty("xy",K,true);},onDomResize:function(M,L){var K=this;B.superclass.onDomResize.call(this,M,L);setTimeout(function(){K.syncPosition();K.cfg.refireEvent("iframe");K.cfg.refireEvent("context");},0);},bringToTop:function(){var O=[],N=this.element;function R(V,U){var X=D.getStyle(V,"zIndex"),W=D.getStyle(U,"zIndex"),T=(!X||isNaN(X))?0:parseInt(X,10),S=(!W||isNaN(W))?0:parseInt(W,10);if(T>S){return -1;}else{if(T<S){return 1;}else{return 0;}}}function M(U){var S=D.hasClass(U,B.CSS_OVERLAY),T=YAHOO.widget.Panel;if(S&&!D.isAncestor(N,S)){if(T&&D.hasClass(U,T.CSS_PANEL)){O[O.length]=U.parentNode;}else{O[O.length]=U;}}}D.getElementsBy(M,"DIV",document.body);O.sort(R);var K=O[0],Q;if(K){Q=D.getStyle(K,"zIndex");if(!isNaN(Q)){var P=false;if(K!=N){P=true;}else{if(O.length>1){var L=D.getStyle(O[1],"zIndex");if(!isNaN(L)&&(Q==L)){P=true;}}}if(P){this.cfg.setProperty("zindex",(parseInt(Q,10)+2));}}}},destroy:function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;B.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);B.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);B.superclass.destroy.call(this);},toString:function(){return"Overlay "+this.id;}});}());(function(){YAHOO.widget.OverlayManager=function(G){this.init(G);};var D=YAHOO.widget.Overlay,C=YAHOO.util.Event,E=YAHOO.util.Dom,B=YAHOO.util.Config,F=YAHOO.util.CustomEvent,A=YAHOO.widget.OverlayManager;A.CSS_FOCUSED="focused";A.prototype={constructor:A,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(I){this.cfg=new B(this);this.initDefaultConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();var H=null;this.getActive=function(){return H;};this.focus=function(J){var K=this.find(J);if(K){if(H!=K){if(H){H.blur();}this.bringToTop(K);H=K;E.addClass(H.element,A.CSS_FOCUSED);K.focusEvent.fire();}}};this.remove=function(K){var M=this.find(K),J;if(M){if(H==M){H=null;}var L=(M.element===null&&M.cfg===null)?true:false;if(!L){J=E.getStyle(M.element,"zIndex");M.cfg.setProperty("zIndex",-1000,true);}this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,(this.overlays.length-1));M.hideEvent.unsubscribe(M.blur);M.destroyEvent.unsubscribe(this._onOverlayDestroy,M);if(!L){C.removeListener(M.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);M.cfg.setProperty("zIndex",J,true);M.cfg.setProperty("manager",null);}M.focusEvent.unsubscribeAll();M.blurEvent.unsubscribeAll();M.focusEvent=null;M.blurEvent=null;M.focus=null;M.blur=null;}};this.blurAll=function(){var K=this.overlays.length,J;if(K>0){J=K-1;do{this.overlays[J].blur();}while(J--);}};this._onOverlayBlur=function(K,J){H=null;};var G=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}if(G){this.register(G);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(I){var G=C.getTarget(I),H=this.close;if(H&&(G==H||E.isAncestor(H,G))){this.blur();}else{this.focus();}},_onOverlayDestroy:function(H,G,I){this.remove(I);},register:function(G){var K=this,L,I,H,J;if(G instanceof D){G.cfg.addProperty("manager",{value:this});G.focusEvent=G.createEvent("focus");G.focusEvent.signature=F.LIST;G.blurEvent=G.createEvent("blur");G.blurEvent.signature=F.LIST;G.focus=function(){K.focus(this);};G.blur=function(){if(K.getActive()==this){E.removeClass(this.element,A.CSS_FOCUSED);this.blurEvent.fire();}};G.blurEvent.subscribe(K._onOverlayBlur);G.hideEvent.subscribe(G.blur);G.destroyEvent.subscribe(this._onOverlayDestroy,G,this);C.on(G.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus,null,G);L=E.getStyle(G.element,"zIndex");if(!isNaN(L)){G.cfg.setProperty("zIndex",parseInt(L,10));}else{G.cfg.setProperty("zIndex",0);}this.overlays.push(G);this.bringToTop(G);return true;}else{if(G instanceof Array){I=0;J=G.length;for(H=0;H<J;H++){if(this.register(G[H])){I++;}}if(I>0){return true;}}else{return false;}}},bringToTop:function(M){var I=this.find(M),L,G,J;if(I){J=this.overlays;J.sort(this.compareZIndexDesc);G=J[0];if(G){L=E.getStyle(G.element,"zIndex");
if(!isNaN(L)){var K=false;if(G!==I){K=true;}else{if(J.length>1){var H=E.getStyle(J[1].element,"zIndex");if(!isNaN(H)&&(L==H)){K=true;}}}if(K){I.cfg.setProperty("zindex",(parseInt(L,10)+2));}}J.sort(this.compareZIndexDesc);}}},find:function(G){var I=this.overlays,J=I.length,H;if(J>0){H=J-1;if(G instanceof D){do{if(I[H]==G){return I[H];}}while(H--);}else{if(typeof G=="string"){do{if(I[H].id==G){return I[H];}}while(H--);}}return null;}},compareZIndexDesc:function(J,I){var H=(J.cfg)?J.cfg.getProperty("zIndex"):null,G=(I.cfg)?I.cfg.getProperty("zIndex"):null;if(H===null&&G===null){return 0;}else{if(H===null){return 1;}else{if(G===null){return -1;}else{if(H>G){return -1;}else{if(H<G){return 1;}else{return 0;}}}}}},showAll:function(){var H=this.overlays,I=H.length,G;if(I>0){G=I-1;do{H[G].show();}while(G--);}},hideAll:function(){var H=this.overlays,I=H.length,G;if(I>0){G=I-1;do{H[G].hide();}while(G--);}},toString:function(){return"OverlayManager";}};}());(function(){YAHOO.widget.Tooltip=function(N,M){YAHOO.widget.Tooltip.superclass.constructor.call(this,N,M);};var E=YAHOO.lang,L=YAHOO.util.Event,K=YAHOO.util.CustomEvent,C=YAHOO.util.Dom,G=YAHOO.widget.Tooltip,F,H={"PREVENT_OVERLAP":{key:"preventoverlap",value:true,validator:E.isBoolean,supercedes:["x","y","xy"]},"SHOW_DELAY":{key:"showdelay",value:200,validator:E.isNumber},"AUTO_DISMISS_DELAY":{key:"autodismissdelay",value:5000,validator:E.isNumber},"HIDE_DELAY":{key:"hidedelay",value:250,validator:E.isNumber},"TEXT":{key:"text",suppressEvent:true},"CONTAINER":{key:"container"},"DISABLED":{key:"disabled",value:false,suppressEvent:true}},A={"CONTEXT_MOUSE_OVER":"contextMouseOver","CONTEXT_MOUSE_OUT":"contextMouseOut","CONTEXT_TRIGGER":"contextTrigger"};G.CSS_TOOLTIP="yui-tt";function I(N,M,O){var R=O[0],P=O[1],Q=this.cfg,S=Q.getProperty("width");if(S==P){Q.setProperty("width",R);}this.unsubscribe("hide",this._onHide,O);}function D(N,M){var O=document.body,S=this.cfg,R=S.getProperty("width"),P,Q;if((!R||R=="auto")&&(S.getProperty("container")!=O||S.getProperty("x")>=C.getViewportWidth()||S.getProperty("y")>=C.getViewportHeight())){Q=this.element.cloneNode(true);Q.style.visibility="hidden";Q.style.top="0px";Q.style.left="0px";O.appendChild(Q);P=(Q.offsetWidth+"px");O.removeChild(Q);Q=null;S.setProperty("width",P);S.refireEvent("xy");this.subscribe("hide",I,[(R||""),P]);}}function B(N,M,O){this.render(O);}function J(){L.onDOMReady(B,this.cfg.getProperty("container"),this);}YAHOO.extend(G,YAHOO.widget.Overlay,{init:function(N,M){G.superclass.init.call(this,N);this.beforeInitEvent.fire(G);C.addClass(this.element,G.CSS_TOOLTIP);if(M){this.cfg.applyConfig(M,true);}this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.subscribe("beforeShow",D);this.subscribe("init",J);this.subscribe("render",this.onRender);this.initEvent.fire(G);},initEvents:function(){G.superclass.initEvents.call(this);var M=K.LIST;this.contextMouseOverEvent=this.createEvent(A.CONTEXT_MOUSE_OVER);this.contextMouseOverEvent.signature=M;this.contextMouseOutEvent=this.createEvent(A.CONTEXT_MOUSE_OUT);this.contextMouseOutEvent.signature=M;this.contextTriggerEvent=this.createEvent(A.CONTEXT_TRIGGER);this.contextTriggerEvent.signature=M;},initDefaultConfig:function(){G.superclass.initDefaultConfig.call(this);this.cfg.addProperty(H.PREVENT_OVERLAP.key,{value:H.PREVENT_OVERLAP.value,validator:H.PREVENT_OVERLAP.validator,supercedes:H.PREVENT_OVERLAP.supercedes});this.cfg.addProperty(H.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:H.SHOW_DELAY.validator});this.cfg.addProperty(H.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:H.AUTO_DISMISS_DELAY.value,validator:H.AUTO_DISMISS_DELAY.validator});this.cfg.addProperty(H.HIDE_DELAY.key,{handler:this.configHideDelay,value:H.HIDE_DELAY.value,validator:H.HIDE_DELAY.validator});this.cfg.addProperty(H.TEXT.key,{handler:this.configText,suppressEvent:H.TEXT.suppressEvent});this.cfg.addProperty(H.CONTAINER.key,{handler:this.configContainer,value:document.body});this.cfg.addProperty(H.DISABLED.key,{handler:this.configContainer,value:H.DISABLED.value,supressEvent:H.DISABLED.suppressEvent});},configText:function(N,M,O){var P=M[0];if(P){this.setBody(P);}},configContainer:function(O,N,P){var M=N[0];if(typeof M=="string"){this.cfg.setProperty("container",document.getElementById(M),true);}},_removeEventListeners:function(){var P=this._context,M,O,N;if(P){M=P.length;if(M>0){N=M-1;do{O=P[N];L.removeListener(O,"mouseover",this.onContextMouseOver);L.removeListener(O,"mousemove",this.onContextMouseMove);L.removeListener(O,"mouseout",this.onContextMouseOut);}while(N--);}}},configContext:function(R,N,S){var Q=N[0],T,M,P,O;if(Q){if(!(Q instanceof Array)){if(typeof Q=="string"){this.cfg.setProperty("context",[document.getElementById(Q)],true);}else{this.cfg.setProperty("context",[Q],true);}Q=this.cfg.getProperty("context");}this._removeEventListeners();this._context=Q;T=this._context;if(T){M=T.length;if(M>0){O=M-1;do{P=T[O];L.on(P,"mouseover",this.onContextMouseOver,this);L.on(P,"mousemove",this.onContextMouseMove,this);L.on(P,"mouseout",this.onContextMouseOut,this);}while(O--);}}}},onContextMouseMove:function(N,M){M.pageX=L.getPageX(N);M.pageY=L.getPageY(N);},onContextMouseOver:function(O,N){var M=this;if(M.title){N._tempTitle=M.title;M.title="";}if(N.fireEvent("contextMouseOver",M,O)!==false&&!N.cfg.getProperty("disabled")){if(N.hideProcId){clearTimeout(N.hideProcId);N.hideProcId=null;}L.on(M,"mousemove",N.onContextMouseMove,N);N.showProcId=N.doShow(O,M);}},onContextMouseOut:function(O,N){var M=this;if(N._tempTitle){M.title=N._tempTitle;N._tempTitle=null;}if(N.showProcId){clearTimeout(N.showProcId);N.showProcId=null;}if(N.hideProcId){clearTimeout(N.hideProcId);N.hideProcId=null;}N.fireEvent("contextMouseOut",M,O);N.hideProcId=setTimeout(function(){N.hide();},N.cfg.getProperty("hidedelay"));},doShow:function(O,M){var P=25,N=this;if(YAHOO.env.ua.opera&&M.tagName&&M.tagName.toUpperCase()=="A"){P+=12;
}return setTimeout(function(){var Q=N.cfg.getProperty("text");if(N._tempTitle&&(Q===""||YAHOO.lang.isUndefined(Q)||YAHOO.lang.isNull(Q))){N.setBody(N._tempTitle);}else{N.cfg.refireEvent("text");}N.moveTo(N.pageX,N.pageY+P);if(N.cfg.getProperty("preventoverlap")){N.preventOverlap(N.pageX,N.pageY);}L.removeListener(M,"mousemove",N.onContextMouseMove);N.contextTriggerEvent.fire(M);N.show();N.hideProcId=N.doHide();},this.cfg.getProperty("showdelay"));},doHide:function(){var M=this;return setTimeout(function(){M.hide();},this.cfg.getProperty("autodismissdelay"));},preventOverlap:function(Q,P){var M=this.element.offsetHeight,O=new YAHOO.util.Point(Q,P),N=C.getRegion(this.element);N.top-=5;N.left-=5;N.right+=5;N.bottom+=5;if(N.contains(O)){this.cfg.setProperty("y",(P-M-5));}},onRender:function(Q,P){function R(){var U=this.element,T=this._shadow;if(T){T.style.width=(U.offsetWidth+6)+"px";T.style.height=(U.offsetHeight+1)+"px";}}function N(){C.addClass(this._shadow,"yui-tt-shadow-visible");}function M(){C.removeClass(this._shadow,"yui-tt-shadow-visible");}function S(){var V=this._shadow,U,T,X,W;if(!V){U=this.element;T=YAHOO.widget.Module;X=YAHOO.env.ua.ie;W=this;if(!F){F=document.createElement("div");F.className="yui-tt-shadow";}V=F.cloneNode(false);U.appendChild(V);this._shadow=V;N.call(this);this.subscribe("beforeShow",N);this.subscribe("beforeHide",M);if(X==6||(X==7&&document.compatMode=="BackCompat")){window.setTimeout(function(){R.call(W);},0);this.cfg.subscribeToConfigEvent("width",R);this.cfg.subscribeToConfigEvent("height",R);this.subscribe("changeContent",R);T.textResizeEvent.subscribe(R,this,true);this.subscribe("destroy",function(){T.textResizeEvent.unsubscribe(R,this);});}}}function O(){S.call(this);this.unsubscribe("beforeShow",O);}if(this.cfg.getProperty("visible")){S.call(this);}else{this.subscribe("beforeShow",O);}},destroy:function(){this._removeEventListeners();G.superclass.destroy.call(this);},toString:function(){return"Tooltip "+this.id;}});}());(function(){YAHOO.widget.Panel=function(R,Q){YAHOO.widget.Panel.superclass.constructor.call(this,R,Q);};var I=YAHOO.lang,E=YAHOO.util.DD,F=YAHOO.util.Dom,P=YAHOO.util.Event,B=YAHOO.widget.Overlay,O=YAHOO.util.CustomEvent,C=YAHOO.util.Config,N=YAHOO.widget.Panel,H,L,D,A={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"},J={"CLOSE":{key:"close",value:true,validator:I.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(E?true:false),validator:I.isBoolean,supercedes:["visible"]},"DRAG_ONLY":{key:"dragonly",value:false,validator:I.isBoolean,supercedes:["draggable"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:I.isBoolean,supercedes:["visible","zindex"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]}};N.CSS_PANEL="yui-panel";N.CSS_PANEL_CONTAINER="yui-panel-container";N.FOCUSABLE=["a","button","select","textarea","input"];function M(R,Q){if(!this.header&&this.cfg.getProperty("draggable")){this.setHeader("&#160;");}}function K(R,Q,S){var V=S[0],T=S[1],U=this.cfg,W=U.getProperty("width");if(W==T){U.setProperty("width",V);}this.unsubscribe("hide",K,S);}function G(R,Q){var V=YAHOO.env.ua.ie,U,T,S;if(V==6||(V==7&&document.compatMode=="BackCompat")){U=this.cfg;T=U.getProperty("width");if(!T||T=="auto"){S=(this.element.offsetWidth+"px");U.setProperty("width",S);this.subscribe("hide",K,[(T||""),S]);}}}YAHOO.extend(N,B,{init:function(R,Q){N.superclass.init.call(this,R);this.beforeInitEvent.fire(N);F.addClass(this.element,N.CSS_PANEL);this.buildWrapper();if(Q){this.cfg.applyConfig(Q,true);}this.subscribe("showMask",this._addFocusHandlers);this.subscribe("hideMask",this._removeFocusHandlers);this.subscribe("beforeRender",M);this.initEvent.fire(N);},_onElementFocus:function(Q){this.blur();},_addFocusHandlers:function(Y,S){var V=this,Z="focus",U="hidden";function X(a){if(a.type!==U&&!F.isAncestor(V.element,a)){P.on(a,Z,V._onElementFocus);return true;}return false;}var W=N.FOCUSABLE,Q=W.length,T=[];for(var R=0;R<Q;R++){T=T.concat(F.getElementsBy(X,W[R]));}this.focusableElements=T;},_removeFocusHandlers:function(T,S){var V=this.focusableElements,Q=V.length,R="focus";if(V){for(var U=0;U<Q;U++){P.removeListener(V[U],R,this._onElementFocus);}}},initEvents:function(){N.superclass.initEvents.call(this);var Q=O.LIST;this.showMaskEvent=this.createEvent(A.SHOW_MASK);this.showMaskEvent.signature=Q;this.hideMaskEvent=this.createEvent(A.HIDE_MASK);this.hideMaskEvent.signature=Q;this.dragEvent=this.createEvent(A.DRAG);this.dragEvent.signature=Q;},initDefaultConfig:function(){N.superclass.initDefaultConfig.call(this);this.cfg.addProperty(J.CLOSE.key,{handler:this.configClose,value:J.CLOSE.value,validator:J.CLOSE.validator,supercedes:J.CLOSE.supercedes});this.cfg.addProperty(J.DRAGGABLE.key,{handler:this.configDraggable,value:J.DRAGGABLE.value,validator:J.DRAGGABLE.validator,supercedes:J.DRAGGABLE.supercedes});this.cfg.addProperty(J.DRAG_ONLY.key,{value:J.DRAG_ONLY.value,validator:J.DRAG_ONLY.validator,supercedes:J.DRAG_ONLY.supercedes});this.cfg.addProperty(J.UNDERLAY.key,{handler:this.configUnderlay,value:J.UNDERLAY.value,supercedes:J.UNDERLAY.supercedes});this.cfg.addProperty(J.MODAL.key,{handler:this.configModal,value:J.MODAL.value,validator:J.MODAL.validator,supercedes:J.MODAL.supercedes});this.cfg.addProperty(J.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:J.KEY_LISTENERS.suppressEvent,supercedes:J.KEY_LISTENERS.supercedes});},configClose:function(S,Q,U){var V=Q[0],R=this.close;function T(X,W){W.hide();}if(V){if(!R){if(!D){D=document.createElement("span");D.innerHTML="&#160;";D.className="container-close";}R=D.cloneNode(true);this.innerElement.appendChild(R);P.on(R,"click",T,this);this.close=R;}else{R.style.display="block";}}else{if(R){R.style.display="none";}}},configDraggable:function(R,Q,S){var T=Q[0];if(T){if(!E){this.cfg.setProperty("draggable",false);return ;}if(this.header){F.setStyle(this.header,"cursor","move");this.registerDragDrop();
}this.subscribe("beforeShow",G);}else{if(this.dd){this.dd.unreg();}if(this.header){F.setStyle(this.header,"cursor","auto");}this.unsubscribe("beforeShow",G);}},configUnderlay:function(b,a,V){var Z=YAHOO.env.ua,X=(this.platform=="mac"&&Z.gecko),Y=(Z.ie==6||(Z.ie==7&&document.compatMode=="BackCompat")),c=a[0].toLowerCase(),R=this.underlay,S=this.element;function d(){var e=this.underlay;F.addClass(e,"yui-force-redraw");window.setTimeout(function(){F.removeClass(e,"yui-force-redraw");},0);}function T(){var e=false;if(!R){if(!L){L=document.createElement("div");L.className="underlay";}R=L.cloneNode(false);this.element.appendChild(R);this.underlay=R;if(Y){this.sizeUnderlay();this.cfg.subscribeToConfigEvent("width",this.sizeUnderlay);this.cfg.subscribeToConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.subscribe(this.sizeUnderlay);YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay,this,true);}if(Z.webkit&&Z.webkit<420){this.changeContentEvent.subscribe(d);}e=true;}}function W(){var e=T.call(this);if(!e&&Y){this.sizeUnderlay();}this._underlayDeferred=false;this.beforeShowEvent.unsubscribe(W);}function U(){if(this._underlayDeferred){this.beforeShowEvent.unsubscribe(W);this._underlayDeferred=false;}if(R){this.cfg.unsubscribeFromConfigEvent("width",this.sizeUnderlay);this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.unsubscribe(this.sizeUnderlay);this.changeContentEvent.unsubscribe(d);YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay,this,true);this.element.removeChild(R);this.underlay=null;}}switch(c){case"shadow":F.removeClass(S,"matte");F.addClass(S,"shadow");break;case"matte":if(!X){U.call(this);}F.removeClass(S,"shadow");F.addClass(S,"matte");break;default:if(!X){U.call(this);}F.removeClass(S,"shadow");F.removeClass(S,"matte");break;}if((c=="shadow")||(X&&!R)){if(this.cfg.getProperty("visible")){var Q=T.call(this);if(!Q&&Y){this.sizeUnderlay();}}else{if(!this._underlayDeferred){this.beforeShowEvent.subscribe(W);this._underlayDeferred=true;}}}},configModal:function(R,Q,T){var S=Q[0];if(S){if(!this._hasModalityEventListeners){this.subscribe("beforeShow",this.buildMask);this.subscribe("beforeShow",this.bringToTop);this.subscribe("beforeShow",this.showMask);this.subscribe("hide",this.hideMask);B.windowResizeEvent.subscribe(this.sizeMask,this,true);this._hasModalityEventListeners=true;}}else{if(this._hasModalityEventListeners){if(this.cfg.getProperty("visible")){this.hideMask();this.removeMask();}this.unsubscribe("beforeShow",this.buildMask);this.unsubscribe("beforeShow",this.bringToTop);this.unsubscribe("beforeShow",this.showMask);this.unsubscribe("hide",this.hideMask);B.windowResizeEvent.unsubscribe(this.sizeMask,this);this._hasModalityEventListeners=false;}}},removeMask:function(){var R=this.mask,Q;if(R){this.hideMask();Q=R.parentNode;if(Q){Q.removeChild(R);}this.mask=null;}},configKeyListeners:function(T,Q,W){var S=Q[0],V,U,R;if(S){if(S instanceof Array){U=S.length;for(R=0;R<U;R++){V=S[R];if(!C.alreadySubscribed(this.showEvent,V.enable,V)){this.showEvent.subscribe(V.enable,V,true);}if(!C.alreadySubscribed(this.hideEvent,V.disable,V)){this.hideEvent.subscribe(V.disable,V,true);this.destroyEvent.subscribe(V.disable,V,true);}}}else{if(!C.alreadySubscribed(this.showEvent,S.enable,S)){this.showEvent.subscribe(S.enable,S,true);}if(!C.alreadySubscribed(this.hideEvent,S.disable,S)){this.hideEvent.subscribe(S.disable,S,true);this.destroyEvent.subscribe(S.disable,S,true);}}}},configHeight:function(T,R,U){var Q=R[0],S=this.innerElement;F.setStyle(S,"height",Q);this.cfg.refireEvent("iframe");},configWidth:function(T,Q,U){var S=Q[0],R=this.innerElement;F.setStyle(R,"width",S);this.cfg.refireEvent("iframe");},configzIndex:function(R,Q,T){N.superclass.configzIndex.call(this,R,Q,T);if(this.mask||this.cfg.getProperty("modal")===true){var S=F.getStyle(this.element,"zIndex");if(!S||isNaN(S)){S=0;}if(S===0){this.cfg.setProperty("zIndex",1);}else{this.stackMask();}}},buildWrapper:function(){var S=this.element.parentNode,Q=this.element,R=document.createElement("div");R.className=N.CSS_PANEL_CONTAINER;R.id=Q.id+"_c";if(S){S.insertBefore(R,Q);}R.appendChild(Q);this.element=R;this.innerElement=Q;F.setStyle(this.innerElement,"visibility","inherit");},sizeUnderlay:function(){var R=this.underlay,Q;if(R){Q=this.element;R.style.width=Q.offsetWidth+"px";R.style.height=Q.offsetHeight+"px";}},registerDragDrop:function(){var R=this;if(this.header){if(!E){return ;}var Q=(this.cfg.getProperty("dragonly")===true);this.dd=new E(this.element.id,this.id,{dragOnly:Q});if(!this.header.id){this.header.id=this.id+"_h";}this.dd.startDrag=function(){var T,V,S,Y,X,W;if(YAHOO.env.ua.ie==6){F.addClass(R.element,"drag");}if(R.cfg.getProperty("constraintoviewport")){var U=B.VIEWPORT_OFFSET;T=R.element.offsetHeight;V=R.element.offsetWidth;S=F.getViewportWidth();Y=F.getViewportHeight();X=F.getDocumentScrollLeft();W=F.getDocumentScrollTop();if(T+U<Y){this.minY=W+U;this.maxY=W+Y-T-U;}else{this.minY=W+U;this.maxY=W+U;}if(V+U<S){this.minX=X+U;this.maxX=X+S-V-U;}else{this.minX=X+U;this.maxX=X+U;}this.constrainX=true;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}R.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){R.syncPosition();R.cfg.refireEvent("iframe");if(this.platform=="mac"&&YAHOO.env.ua.gecko){this.showMacGeckoScrollbars();}R.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(YAHOO.env.ua.ie==6){F.removeClass(R.element,"drag");}R.dragEvent.fire("endDrag",arguments);R.moveEvent.fire(R.cfg.getProperty("xy"));};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}},buildMask:function(){var Q=this.mask;if(!Q){if(!H){H=document.createElement("div");H.className="mask";H.innerHTML="&#160;";}Q=H.cloneNode(true);Q.id=this.id+"_mask";document.body.insertBefore(Q,document.body.firstChild);this.mask=Q;if(YAHOO.env.ua.gecko&&this.platform=="mac"){F.addClass(this.mask,"block-scrollbars");
}this.stackMask();}},hideMask:function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";this.hideMaskEvent.fire();F.removeClass(document.body,"masked");}},showMask:function(){if(this.cfg.getProperty("modal")&&this.mask){F.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}},sizeMask:function(){if(this.mask){this.mask.style.height=F.getDocumentHeight()+"px";this.mask.style.width=F.getDocumentWidth()+"px";}},stackMask:function(){if(this.mask){var Q=F.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(Q)&&!isNaN(Q)){F.setStyle(this.mask,"zIndex",Q-1);}}},render:function(Q){return N.superclass.render.call(this,Q,this.innerElement);},destroy:function(){B.windowResizeEvent.unsubscribe(this.sizeMask,this);this.removeMask();if(this.close){P.purgeElement(this.close);}N.superclass.destroy.call(this);},toString:function(){return"Panel "+this.id;}});}());(function(){YAHOO.widget.Dialog=function(L,K){YAHOO.widget.Dialog.superclass.constructor.call(this,L,K);};var J=YAHOO.util.Event,I=YAHOO.util.CustomEvent,D=YAHOO.util.Dom,B=YAHOO.util.KeyListener,H=YAHOO.util.Connect,F=YAHOO.widget.Dialog,E=YAHOO.lang,A={"BEFORE_SUBMIT":"beforeSubmit","SUBMIT":"submit","MANUAL_SUBMIT":"manualSubmit","ASYNC_SUBMIT":"asyncSubmit","FORM_SUBMIT":"formSubmit","CANCEL":"cancel"},G={"POST_METHOD":{key:"postmethod",value:"async"},"BUTTONS":{key:"buttons",value:"none"},"HIDEAFTERSUBMIT":{key:"hideaftersubmit",value:true}};F.CSS_DIALOG="yui-dialog";function C(){var N=this._aButtons,L,M,K;if(E.isArray(N)){L=N.length;if(L>0){K=L-1;do{M=N[K];if(YAHOO.widget.Button&&M instanceof YAHOO.widget.Button){M.destroy();}else{if(M.tagName.toUpperCase()=="BUTTON"){J.purgeElement(M);J.purgeElement(M,false);}}}while(K--);}}}YAHOO.extend(F,YAHOO.widget.Panel,{form:null,initDefaultConfig:function(){F.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null};this.cfg.addProperty(G.POST_METHOD.key,{handler:this.configPostMethod,value:G.POST_METHOD.value,validator:function(K){if(K!="form"&&K!="async"&&K!="none"&&K!="manual"){return false;}else{return true;}}});this.cfg.addProperty(G.HIDEAFTERSUBMIT.key,{value:G.HIDEAFTERSUBMIT.value});this.cfg.addProperty(G.BUTTONS.key,{handler:this.configButtons,value:G.BUTTONS.value});},initEvents:function(){F.superclass.initEvents.call(this);var K=I.LIST;this.beforeSubmitEvent=this.createEvent(A.BEFORE_SUBMIT);this.beforeSubmitEvent.signature=K;this.submitEvent=this.createEvent(A.SUBMIT);this.submitEvent.signature=K;this.manualSubmitEvent=this.createEvent(A.MANUAL_SUBMIT);this.manualSubmitEvent.signature=K;this.asyncSubmitEvent=this.createEvent(A.ASYNC_SUBMIT);this.asyncSubmitEvent.signature=K;this.formSubmitEvent=this.createEvent(A.FORM_SUBMIT);this.formSubmitEvent.signature=K;this.cancelEvent=this.createEvent(A.CANCEL);this.cancelEvent.signature=K;},init:function(L,K){F.superclass.init.call(this,L);this.beforeInitEvent.fire(F);D.addClass(this.element,F.CSS_DIALOG);this.cfg.setProperty("visible",false);if(K){this.cfg.applyConfig(K,true);}this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.subscribe("changeBody",this.registerForm);this.initEvent.fire(F);},doSubmit:function(){var Q=this.form,O=false,N=false,P,K,M,L;switch(this.cfg.getProperty("postmethod")){case"async":P=Q.elements;K=P.length;if(K>0){M=K-1;do{if(P[M].type=="file"){O=true;break;}}while(M--);}if(O&&YAHOO.env.ua.ie&&this.isSecure){N=true;}L=(Q.getAttribute("method")||"POST").toUpperCase();H.setForm(Q,O,N);H.asyncRequest(L,Q.getAttribute("action"),this.callback);this.asyncSubmitEvent.fire();break;case"form":Q.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}},registerForm:function(){var M=this.element.getElementsByTagName("form")[0],L=this,K,N;if(this.form){if(this.form==M&&D.isAncestor(this.element,this.form)){return ;}else{J.purgeElement(this.form);this.form=null;}}if(!M){M=document.createElement("form");M.name="frm_"+this.id;this.body.appendChild(M);}if(M){this.form=M;J.on(M,"submit",function(O){J.stopEvent(O);this.submit();this.form.blur();},this,true);this.firstFormElement=function(){var Q,P,O=M.elements.length;for(Q=0;Q<O;Q++){P=M.elements[Q];if(P.focus&&!P.disabled&&P.type!="hidden"){return P;}}return null;}();this.lastFormElement=function(){var Q,P,O=M.elements.length;for(Q=O-1;Q>=0;Q--){P=M.elements[Q];if(P.focus&&!P.disabled&&P.type!="hidden"){return P;}}return null;}();if(this.cfg.getProperty("modal")){K=this.firstFormElement||this.firstButton;if(K){this.preventBackTab=new B(K,{shift:true,keys:9},{fn:L.focusLast,scope:L,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}N=this.lastButton||this.lastFormElement;if(N){this.preventTabOut=new B(N,{shift:false,keys:9},{fn:L.focusFirst,scope:L,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}}},configClose:function(M,K,N){var O=K[0];function L(Q,P){P.cancel();}if(O){if(!this.close){this.close=document.createElement("div");D.addClass(this.close,"container-close");this.close.innerHTML="&#160;";this.innerElement.appendChild(this.close);J.on(this.close,"click",L,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}},configButtons:function(U,T,O){var P=YAHOO.widget.Button,W=T[0],M=this.innerElement,V,R,L,S,Q,K,N;C.call(this);this._aButtons=null;if(E.isArray(W)){Q=document.createElement("span");Q.className="button-group";S=W.length;this._aButtons=[];for(N=0;N<S;N++){V=W[N];if(P){L=new P({label:V.text,container:Q});R=L.get("element");if(V.isDefault){L.addClass("default");this.defaultHtmlButton=R;}if(E.isFunction(V.handler)){L.set("onclick",{fn:V.handler,obj:this,scope:this});
}else{if(E.isObject(V.handler)&&E.isFunction(V.handler.fn)){L.set("onclick",{fn:V.handler.fn,obj:((!E.isUndefined(V.handler.obj))?V.handler.obj:this),scope:(V.handler.scope||this)});}}this._aButtons[this._aButtons.length]=L;}else{R=document.createElement("button");R.setAttribute("type","button");if(V.isDefault){R.className="default";this.defaultHtmlButton=R;}R.innerHTML=V.text;if(E.isFunction(V.handler)){J.on(R,"click",V.handler,this,true);}else{if(E.isObject(V.handler)&&E.isFunction(V.handler.fn)){J.on(R,"click",V.handler.fn,((!E.isUndefined(V.handler.obj))?V.handler.obj:this),(V.handler.scope||this));}}Q.appendChild(R);this._aButtons[this._aButtons.length]=R;}V.htmlButton=R;if(N===0){this.firstButton=R;}if(N==(S-1)){this.lastButton=R;}}this.setFooter(Q);K=this.footer;if(D.inDocument(this.element)&&!D.isAncestor(M,K)){M.appendChild(K);}this.buttonSpan=Q;}else{Q=this.buttonSpan;K=this.footer;if(Q&&K){K.removeChild(Q);this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");},getButtons:function(){var K=this._aButtons;if(K){return K;}},focusFirst:function(N,L,P){var M=this.firstFormElement,K;if(L){K=L[1];if(K){J.stopEvent(K);}}if(M){try{M.focus();}catch(O){}}else{this.focusDefaultButton();}},focusLast:function(N,L,P){var Q=this.cfg.getProperty("buttons"),M=this.lastFormElement,K;if(L){K=L[1];if(K){J.stopEvent(K);}}if(Q&&E.isArray(Q)){this.focusLastButton();}else{if(M){try{M.focus();}catch(O){}}}},focusDefaultButton:function(){var K=this.defaultHtmlButton;if(K){try{K.focus();}catch(L){}}},blurButtons:function(){var P=this.cfg.getProperty("buttons"),M,O,L,K;if(P&&E.isArray(P)){M=P.length;if(M>0){K=(M-1);do{O=P[K];if(O){L=O.htmlButton;if(L){try{L.blur();}catch(N){}}}}while(K--);}}},focusFirstButton:function(){var N=this.cfg.getProperty("buttons"),M,K;if(N&&E.isArray(N)){M=N[0];if(M){K=M.htmlButton;if(K){try{K.focus();}catch(L){}}}}},focusLastButton:function(){var O=this.cfg.getProperty("buttons"),L,N,K;if(O&&E.isArray(O)){L=O.length;if(L>0){N=O[(L-1)];if(N){K=N.htmlButton;if(K){try{K.focus();}catch(M){}}}}}},configPostMethod:function(L,K,M){this.registerForm();},validate:function(){return true;},submit:function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();if(this.cfg.getProperty("hideaftersubmit")){this.hide();}return true;}else{return false;}},cancel:function(){this.cancelEvent.fire();this.hide();},getData:function(){var a=this.form,M,T,W,O,U,R,Q,L,X,N,Y,b,K,P,c,Z,V;function S(e){var d=e.tagName.toUpperCase();return((d=="INPUT"||d=="TEXTAREA"||d=="SELECT")&&e.name==O);}if(a){M=a.elements;T=M.length;W={};for(Z=0;Z<T;Z++){O=M[Z].name;U=D.getElementsBy(S,"*",a);R=U.length;if(R>0){if(R==1){U=U[0];Q=U.type;L=U.tagName.toUpperCase();switch(L){case"INPUT":if(Q=="checkbox"){W[O]=U.checked;}else{if(Q!="radio"){W[O]=U.value;}}break;case"TEXTAREA":W[O]=U.value;break;case"SELECT":X=U.options;N=X.length;Y=[];for(V=0;V<N;V++){b=X[V];if(b.selected){K=b.value;if(!K||K===""){K=b.text;}Y[Y.length]=K;}}W[O]=Y;break;}}else{Q=U[0].type;switch(Q){case"radio":for(V=0;V<R;V++){P=U[V];if(P.checked){W[O]=P.value;break;}}break;case"checkbox":Y=[];for(V=0;V<R;V++){c=U[V];if(c.checked){Y[Y.length]=c.value;}}W[O]=Y;break;}}}}}return W;},destroy:function(){C.call(this);this._aButtons=null;var K=this.element.getElementsByTagName("form"),L;if(K.length>0){L=K[0];if(L){J.purgeElement(L);if(L.parentNode){L.parentNode.removeChild(L);}this.form=null;}}F.superclass.destroy.call(this);},toString:function(){return"Dialog "+this.id;}});}());(function(){YAHOO.widget.SimpleDialog=function(E,D){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,E,D);};var C=YAHOO.util.Dom,B=YAHOO.widget.SimpleDialog,A={"ICON":{key:"icon",value:"none",suppressEvent:true},"TEXT":{key:"text",value:"",suppressEvent:true,supercedes:["icon"]}};B.ICON_BLOCK="blckicon";B.ICON_ALARM="alrticon";B.ICON_HELP="hlpicon";B.ICON_INFO="infoicon";B.ICON_WARN="warnicon";B.ICON_TIP="tipicon";B.ICON_CSS_CLASSNAME="yui-icon";B.CSS_SIMPLEDIALOG="yui-simple-dialog";YAHOO.extend(B,YAHOO.widget.Dialog,{initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);this.cfg.addProperty(A.ICON.key,{handler:this.configIcon,value:A.ICON.value,suppressEvent:A.ICON.suppressEvent});this.cfg.addProperty(A.TEXT.key,{handler:this.configText,value:A.TEXT.value,suppressEvent:A.TEXT.suppressEvent,supercedes:A.TEXT.supercedes});},init:function(E,D){B.superclass.init.call(this,E);this.beforeInitEvent.fire(B);C.addClass(this.element,B.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(D){this.cfg.applyConfig(D,true);}this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(B);},registerForm:function(){B.superclass.registerForm.call(this);this.form.innerHTML+='<input type="hidden" name="'+this.id+'" value=""/>';},configIcon:function(F,E,J){var K=E[0],D=this.body,I=B.ICON_CSS_CLASSNAME,H,G;if(K&&K!="none"){H=C.getElementsByClassName(I,"*",D);if(H){G=H.parentNode;if(G){G.removeChild(H);H=null;}}if(K.indexOf(".")==-1){H=document.createElement("span");H.className=(I+" "+K);H.innerHTML="&#160;";}else{H=document.createElement("img");H.src=(this.imageRoot+K);H.className=I;}if(H){D.insertBefore(H,D.firstChild);}}},configText:function(E,D,F){var G=D[0];if(G){this.setBody(G);this.cfg.refireEvent("icon");}},toString:function(){return"SimpleDialog "+this.id;}});}());(function(){YAHOO.widget.ContainerEffect=function(F,I,H,E,G){if(!G){G=YAHOO.util.Anim;}this.overlay=F;this.attrIn=I;this.attrOut=H;this.targetElement=E||F.element;this.animClass=G;};var B=YAHOO.util.Dom,D=YAHOO.util.CustomEvent,C=YAHOO.util.Easing,A=YAHOO.widget.ContainerEffect;A.FADE=function(E,G){var I={attributes:{opacity:{from:0,to:1}},duration:G,method:C.easeIn};var F={attributes:{opacity:{to:0}},duration:G,method:C.easeOut};var H=new A(E,I,F,E.element);H.handleUnderlayStart=function(){var K=this.overlay.underlay;
if(K&&YAHOO.env.ua.ie){var J=(K.filters&&K.filters.length>0);if(J){B.addClass(E.element,"yui-effect-fade");}}};H.handleUnderlayComplete=function(){var J=this.overlay.underlay;if(J&&YAHOO.env.ua.ie){B.removeClass(E.element,"yui-effect-fade");}};H.handleStartAnimateIn=function(K,J,L){B.addClass(L.overlay.element,"hide-select");if(!L.overlay.underlay){L.overlay.cfg.refireEvent("underlay");}L.handleUnderlayStart();B.setStyle(L.overlay.element,"visibility","visible");B.setStyle(L.overlay.element,"opacity",0);};H.handleCompleteAnimateIn=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateInCompleteEvent.fire();};H.handleStartAnimateOut=function(K,J,L){B.addClass(L.overlay.element,"hide-select");L.handleUnderlayStart();};H.handleCompleteAnimateOut=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}B.setStyle(L.overlay.element,"visibility","hidden");B.setStyle(L.overlay.element,"opacity",1);L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateOutCompleteEvent.fire();};H.init();return H;};A.SLIDE=function(G,I){var F=G.cfg.getProperty("x")||B.getX(G.element),K=G.cfg.getProperty("y")||B.getY(G.element),J=B.getClientWidth(),H=G.element.offsetWidth,E=new A(G,{attributes:{points:{to:[F,K]}},duration:I,method:C.easeIn},{attributes:{points:{to:[(J+25),K]}},duration:I,method:C.easeOut},G.element,YAHOO.util.Motion);E.handleStartAnimateIn=function(M,L,N){N.overlay.element.style.left=((-25)-H)+"px";N.overlay.element.style.top=K+"px";};E.handleTweenAnimateIn=function(O,N,P){var Q=B.getXY(P.overlay.element),M=Q[0],L=Q[1];if(B.getStyle(P.overlay.element,"visibility")=="hidden"&&M<F){B.setStyle(P.overlay.element,"visibility","visible");}P.overlay.cfg.setProperty("xy",[M,L],true);P.overlay.cfg.refireEvent("iframe");};E.handleCompleteAnimateIn=function(M,L,N){N.overlay.cfg.setProperty("xy",[F,K],true);N.startX=F;N.startY=K;N.overlay.cfg.refireEvent("iframe");N.animateInCompleteEvent.fire();};E.handleStartAnimateOut=function(M,L,P){var N=B.getViewportWidth(),Q=B.getXY(P.overlay.element),O=Q[1];P.animOut.attributes.points.to=[(N+25),O];};E.handleTweenAnimateOut=function(N,M,O){var Q=B.getXY(O.overlay.element),L=Q[0],P=Q[1];O.overlay.cfg.setProperty("xy",[L,P],true);O.overlay.cfg.refireEvent("iframe");};E.handleCompleteAnimateOut=function(M,L,N){B.setStyle(N.overlay.element,"visibility","hidden");N.overlay.cfg.setProperty("xy",[F,K]);N.animateOutCompleteEvent.fire();};E.init();return E;};A.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");this.beforeAnimateInEvent.signature=D.LIST;this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");this.beforeAnimateOutEvent.signature=D.LIST;this.animateInCompleteEvent=this.createEvent("animateInComplete");this.animateInCompleteEvent.signature=D.LIST;this.animateOutCompleteEvent=this.createEvent("animateOutComplete");this.animateOutCompleteEvent.signature=D.LIST;this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);},animateIn:function(){this.beforeAnimateInEvent.fire();this.animIn.animate();},animateOut:function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();},handleStartAnimateIn:function(F,E,G){},handleTweenAnimateIn:function(F,E,G){},handleCompleteAnimateIn:function(F,E,G){},handleStartAnimateOut:function(F,E,G){},handleTweenAnimateOut:function(F,E,G){},handleCompleteAnimateOut:function(F,E,G){},toString:function(){var E="ContainerEffect";if(this.overlay){E+=" ["+this.overlay.toString()+"]";}return E;}};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);})();YAHOO.register("container",YAHOO.widget.Module,{version:"2.5.1",build:"984"});// Creates a very basic collapsing accordion UI using jQuery and a DOM structured like:
//
// <div class="accordion">
//   <div>
//     <div class="hd">Header</div>
//     <div class="bd">Body to hide/show</div>
//   </div>
// </div>
//
// Use with:
//
// jQuery('.accordion').accordion();

jQuery.fn.extend({
    accordion: function() {
        jQuery('.bd', this).hide();
        jQuery('.hd', this).click(function(e) {
            var item = jQuery(this).parent();
            if (item.hasClass('shown')) {
                item.removeClass('shown');
                jQuery('.bd', item).hide();
            } else {
                item.siblings().removeClass('shown');
                item.addClass('shown');
                jQuery('.bd', item.parent()).hide();
                jQuery('.bd', item).show();
            }
        });
    }
});

<!--include virtual="/adx/admin/Editors/framework/js/accordion.js" -->

if (jQuery) jQuery.noConflict();

var Tagging = {};

// In the case where an editor loads this file, and initialize() is called, it's important that all
// functionality simply fails silently/doesn't hook up, due to missing relevant DOM elements. Calling
// initialize() in an editor that simply doesn't have the tagging UI should NOT cause any errors.

Tagging.initialize = function(editor) {
	this._editor = editor;
	this.initializeAutoComplete();
	this.initializeSaveEventHandlers();
	this.initializeTagAdditionEventHandlers();
	this.initializeTagRemovalEventHandlers();
}

Tagging.autoCompleteServiceUri = '/adx/Services/Tag.svc/completions';

Tagging.initializeAutoComplete = function() {
	var tagDataSource = new YAHOO.widget.DS_XHR(Tagging.autoCompleteServiceUri, ['d', 'Name']);
	tagDataSource.responseType = YAHOO.widget.DS_XHR.TYPE_JSON;
	tagDataSource.scriptQueryParam = 'prefix';
	
	var tagAutoComplete = new YAHOO.widget.AutoComplete('tagInput', 'tagInputAutoCompleteContainer', tagDataSource);
	tagAutoComplete.useIFrame = true;
	tagAutoComplete.typeAhead = true;
	tagAutoComplete.useShadow = true;
	tagAutoComplete.autoHighlight = false;
	tagAutoComplete.allowBrowserAutoComplete = false;
}

Tagging.initializeSaveEventHandlers = function() {
	if (!this._editor) return;

	this._editor.addEventListener('onsave', {
		handle: function(editor) {
			var tags = jQuery('#existing-tags .tag:not(.removed) .tag-name');
			
			if(tags.length > 0) {
				// Add a hidden input for each non-removed tag name
				tags.each(function() {
					var tagName = jQuery.trim(jQuery(this).text());
					jQuery('#existing-tags').after('<input name="Tags" type="hidden" value="' + tagName + '" />')
				});
			}
			else {
				// Still add an empty Tags field, so the server-side can detect that yes, we've submitted tag
				// edits -- we just don't have any tags anymore
				jQuery('#existing-tags').after('<input name="Tags" type="hidden" value="" />')
			}
		}
	});
}

Tagging.initializeTagAdditionEventHandlers = function() {
	YAHOO.util.Event.on('tagInput', 'keypress', function(e) {
		if (YAHOO.util.Event.getCharCode(e) == 13) { // Catch return/enter keypress
			Tagging.addTag(YAHOO.util.Event.getTarget(e));
		}
	});
	
	YAHOO.util.Event.on('add-tag', 'click', function(e) {
		Tagging.addTag(YAHOO.util.Dom.get('tagInput'));
	});
}

Tagging.initializeTagRemovalEventHandlers = function() {
	YAHOO.util.Event.onContentReady('existing-tags', function() {
		jQuery('#existing-tags .tag .remove-tag').click(function() {
			jQuery(this).parents('.tag').hide('normal', function() { jQuery(this).addClass('removed'); });
		});
	});
}

Tagging.addTag = function(tagInput) {
	var input = jQuery(tagInput);
	var newTagName = input.val();
	
	// Filter out any attempt to add an empty tag
	if (newTagName.match(/^\s*$/)) return;
	
	// Should filter out any attempts to add duplicates -- or leave that entirely to the server-side?
	// We'll leave it to the server-side for now, since it has to handle that anyway
	
	input.val('');
	var firstTag = jQuery('#existing-tags #tag-prototype');
	var addedTag = firstTag.clone(true);
	jQuery('.tag-name', addedTag).text(jQuery.trim(newTagName));
	addedTag.removeClass('removed');
	addedTag.css('display', 'none');
	addedTag.insertBefore('#existing-tags .tag:first');
	addedTag.show('normal');
	tagInput.focus();
}

var WaitingOverlay = {}

WaitingOverlay.initialize = function(editor) {
	this._editor = editor;
	this.initializeSaveEventHandlers();
}

WaitingOverlay.initializeSaveEventHandlers = function() {
	if (!this._editor) return;
	
	if (!YAHOO) return;
	
	YAHOO.namespace('adxstudio');
	
	if (!YAHOO.adxstudio.saveOverlay) {
		YAHOO.adxstudio.saveOverlay = new YAHOO.widget.Panel('onsave', {
			width: '240px',
			fixedcenter: true,
			close: false,
			draggable: false,
			zindex: 4,
			modal: true,
			visible: false
		});
		YAHOO.adxstudio.saveOverlay.setHeader('Saving, please wait...');
		YAHOO.adxstudio.saveOverlay.setBody('<img src="/adx/imgs/console/rel_interstitial_loading.gif" alt="" />');
		YAHOO.adxstudio.saveOverlay.render(document.body);
  }

	this._editor.addEventListener('onsave', {
		handle: function(editor) {
			if (!YAHOO.adxstudio.saveOverlay) return;
      
      YAHOO.adxstudio.saveOverlay.show();
		}
	});
	
	var hideOverlayHandler = {
		handle: function(editor) {
			if (!YAHOO.adxstudio.saveOverlay) return;
			
			YAHOO.adxstudio.saveOverlay.hide();
		}
	};
	
	this._editor.addEventListener('onsavecomplete', hideOverlayHandler);
	
	this._editor.addEventListener('onsavefailure', hideOverlayHandler);
}

