
function PageExpnader(expand){var terminate=this.disconnectOnScroll=partial(disconnect,connect(window,'onscroll',this,'onScroll'));this.expand=partial(callSingularize(expand),terminate);this.triggerHeight=PageExpnader.TRIGGER_HEIGHT;}
PageExpnader.TRIGGER_HEIGHT=800;update(PageExpnader.prototype,{onScroll:function(evt){var remainHeight=getDocumentDimension().h-
getViewportPosition().y-
getViewportDimensions().h;if(remainHeight<this.triggerHeight)
this.expand();}})
function callSingularize(target){var running;var end=function(){running=false;}
return function(){if(running)return;running=true;return target.apply(null,[].concat(end,[].slice.call(arguments)));}}
function dynamicBind(func,self){return function(){return self[func].apply(self,arguments);}}
CancelEvent=new NamedError('CancelEvent');if(document.addEventListener){connect=function(src,sig){sig=sig=='onmousewheel'?'onDOMMouseScroll':sig;return MochiKit.Signal.connect.apply(null,[].slice.apply(arguments));}}
MochiKit.Base.update(MochiKit.Signal.Event.prototype,{wheelDelta:function(){var evt=this.event();return evt.wheelDelta?evt.wheelDelta/120*(window.opera?1:-1):evt.detail/3;},isStopped:function(){var evt=this.event();return evt.getPreventDefault?evt.getPreventDefault():evt.cancelBubble;}})
MochiKit.Base.update(MochiKit.Signal._specialKeys,{61:'KEY_SEMICOLON',226:'KEY_HORIZONTAL_BAR'});function getDocumentDimension(){var dim=new MochiKit.Style.Dimensions();if(document.compatMode=='CSS1Compat'){dim.w=document.documentElement.scrollWidth;dim.h=document.documentElement.scrollHeight;}else{dim.w=document.body.scrollWidth;dim.h=document.body.scrollHeight;}
return dim;}
function getPluguinVersion(pluginName){if(navigator.plugins){var numTest=/^[\d\.]+$/;var plugins=navigator.plugins;for(var i=0;i<plugins.length;i++){if(plugins[i].name.indexOf(pluginName)!=-1){var tokens=(plugins[i].name+' '+plugins[i].description).split(' ');for(var j=0;j<tokens.length;j++){if(numTest.test(tokens[j]))
return tokens[j];}}}}
if(navigator.userAgent.indexOf('MSIE')!=-1){var comName={QuickTime:'QuickTimeCheckObject.QuickTimeCheck',Flash:'ShockwaveFlash.ShockwaveFlash'}[pluginName];try{var obj=new ActiveXObject(comName);switch(pluginName){case'QuickTime':return obj.QuickTimeVersion;case'Flash':return obj.GetVariable("$version").split(' ')[1].replace(/,/g,'.');}}catch(e){}}
return 0;}
function doSimplePostXMLHttpRequest(url){var self=MochiKit.Async;var req=self.getXMLHttpRequest();if(arguments.length>1){var m=MochiKit.Base;var qs=m.queryString.apply(null,m.extend(null,arguments,1));}
req.open("POST",url,true);var requestHeaders=['Accept','text/javascript, text/html, application/xml, text/xml, */*','Content-type','application/x-www-form-urlencoded'];if(req.overrideMimeType){requestHeaders.push('Connection','close');}
for(var i=0;i<requestHeaders.length;i+=2){req.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);}
return self.sendXMLHttpRequest(req,qs);}
function addElementClass(element,className){if(element)MochiKit.DOM.addElementClass(element,className);}
function removeElementClass(element,className){if(element)MochiKit.DOM.removeElementClass(element,className);}
function isVisible(elm){return elm.style.display!='none';}
function isMatchedElement(elm,tagName,className){if(!elm)return false;return(elm.tagName==tagName.toUpperCase()&&(!className||hasElementClass(elm,className)));}
function setInnerText(elm,text){elm.innerHTML=escapeHTML(text);}
function getInnerText(elm,text){return unescapeHTML(elm.innerHTML);}
function unescapeHTML(s){return s.replace(/&amp;/g,'&').replace(/&quot;/g,'"').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}
function getText(url){var xhr=getXMLHttpRequest();xhr.open("GET",url,false);xhr.send(null);return xhr.responseText;}
function createSet(keys){keys=(keys instanceof Array)?keys:keys.split(/\s/);var set={};for(var i in keys)
set[keys[i]]=true;return set;}
function indexOf(arr,key){for(var i=0,len=arr.length;i<len;i++)
if(arr[i]==key)
return i;return-1;}
function getDocument(elm){return elm.ownerDocument||elm.document;}
function getWindow(elm){var doc=(elm.getElementById)?elm:C.getDocument(elm);return doc.defaultView||doc.parentWindow;;}
function getMessage(key){var msg=eval('messages.'+key);for(var i=1;i<arguments.length;i++)
msg=msg.replace('\$'+i,arguments[i]);return msg;}
function moreThan(num,start){return(num<start)?start:num;}
var browser={};var ua=navigator.userAgent;if(ua.indexOf('MSIE')>-1)browser.isIE=true;if(ua.indexOf('Opera')>-1)browser.isOpera=true;if(ua.indexOf('Firefox')>-1)browser.isFirefox=true;if(ua.indexOf('Safari')>-1)browser.isSafari=true;var DOMBuilder={};(function(){forEach(('html head title style script body h1 h2 h3 h4 h5 h6 '+'table tbody tr td col '+'br hr dl ul ol li '+'a img span div style strong b big em p q pre center '+'form input textarea button select option '+'').split(' '),function(tag){DOMBuilder[tag]=partial(createElement,tag)});function createElement(){var tag=Array.prototype.shift.call(arguments);var element=document.createElement(tag);var text=[];forEach(flattenArguments(arguments),function(value){if(value&&value.nodeType){element.appendChild(value);return;}else if(isUndefinedOrNull(value)){return;}
switch(typeof(value)){case'string':case'number':element.appendChild(document.createTextNode(value))
break;default:for(var key in value){var attr=value[key];if(typeof(attr)=='function'){connect(element,key,attr);continue;}
switch(key){case'class':element.className=attr;case'style':element.style.cssText=attr;default:element.setAttribute(key,attr);}};break;}});return element;};})()
var HTMLBuilder={};(function(){forEach(('html head title style script body h1 h2 h3 h4 h5 h6 '+'table tbody tr td col '+'br hr dl ul ol li '+'a img span div style strong b big em p q pre center '+'form input textarea button select option '+'').split(' '),function(tag){HTMLBuilder[tag]=partial(createElement,tag)});function createElement(){var tag=Array.prototype.shift.call(arguments);var text=[];var attr=[];forEach(flattenArguments(arguments),function(value){if(isUndefinedOrNull(value))return;switch(typeof(value)){case'string':case'number':text.push(value);break;default:keys(value).forEach(function(key){attr.push(key+'="'+value[key]+'"')});break;}});attr=(attr.length?' ':'')+attr.join(' ');if(text.length==0)
return"<"+tag+attr+"/>";return"<"+tag+attr+">"+text.join('')+"</"+tag+">";};})()
function Button(elmButton,enable,handler){this.elmButton=getElement(elmButton);connect(elmButton,'onclick',this,'onClick');enable?this.enable():this.disable();if(handler)
connect(this,'onClick',handler);}
MochiKit.Base.update(Button.prototype,{elmButton:null,enable:function(){removeElementClass(this.elmButton,'disabled');addElementClass(this.elmButton,'enabled');},disable:function(){removeElementClass(this.elmButton,'enabled');addElementClass(this.elmButton,'disabled');},isEnabled:function(){return hasElementClass(this.elmButton,'enabled');},isDisabled:function(){return hasElementClass(this.elmButton,'disabled');},onClick:function(evt){if(!this.isDisabled())
signal(this,'onClick',this);}});var State={make:function(cls,stateSetName,stateSet,defaultStateName){if(arguments.length==3){defaultStateName=stateSet;stateSet=stateSetName;stateSetName=void(0);}
var p=cls.prototype;var K=this.K;forEach(this.gatherProperties(stateSet),function(prop){for(var i in stateSet){var state=stateSet[i];if(!state[prop])
state[prop]=K;}});update(p,stateSet[defaultStateName]);if(stateSetName){update(p,this._multiProto);if(!p.state){p.state={};p.stateSet={};}
p.state[stateSetName]=defaultStateName;p.stateSet[stateSetName]=stateSet;}else{update(p,this._singleProto);p.state=defaultStateName;p.stateSet=stateSet;}},gatherProperties:function(stateSet){var props={};for(var i in stateSet)
for(var prop in stateSet[i])
props[prop]=true;return keys(props);},K:function(arg){return arg;},_singleProto:{changeState:function(stateName){update(this,this.stateSet[stateName]);this.state=stateName;}},_multiProto:{changeState:function(stateSetName,stateName){update(this,this.stateSet[stateSetName][stateName]);this.state=update({},this.state);this.state[stateSetName]=stateName;}}}
function QuickTimeSound(url,correctSecondDuration,isMovie){this.correctSecondDuration=correctSecondDuration;var qt_opt={src:url,type:'video/quicktime',controller:'false',autoplay:'false',width:'1px',height:'1px'};if(isMovie){qt_opt['width']='320px';qt_opt['height']='240px';qt_opt['scale']='aspect';}
var qt=this.quicktime=createDOM('embed',qt_opt);document.getElementById('emb').appendChild(qt);setTimeout(function(){qt.blur()},0);QuickTimeSound.instances.push(this);}
MochiKit.Base.update(QuickTimeSound,{instances:[],create:function(url,correctDuration,isMovie){var sound=new QuickTimeSound(url,correctDuration,isMovie);return QuickTimeSound.waitForPlayable(sound);},waitForPlayable:function(sound){var qt=sound.quicktime;var deferred=new Deferred();var interval=100;var interval_count=0;var wait_total=0;var timeout_count=0;var timeout_count_warning=4;var f=function(){try{var qts=qt.GetPluginStatus()
if(/^Error/.test(qts)){clearInterval(intervalId);throw'error';}
switch(qts){case'Waiting':interval_count++
wait_total+=interval
if(interval_count>10){timeout_count++
clearInterval(intervalId)
if(timeout_count==timeout_count_warning){messagePanel.show(getMessage('warn.mediaFile'),7);}
interval*=2;interval_count=0;intervalId=setInterval(f,interval);}
break;case'Playable':case'Complete':clearInterval(intervalId);deferred.callback(sound);}}catch(error){clearInterval(intervalId);removeElement(qt);deferred.errback(error);}}
var intervalId=setInterval(f,interval);return deferred;}})
MochiKit.Base.update(QuickTimeSound.prototype,{quicktime:null,rate:1,playing:false,timeLagScale:0.9953,timeScale:-1,correctSecondDuration:-1,loadSound:function(url){this.quicktime.SetURL(url);return QuickTimeSound.waitForPlayable(this);},start:function(secondOffset){var qt=this.quicktime;if(secondOffset!=null)
this.setPosition(secondOffset*1000);this.quicktime.SetRate(this.rate);this.playing=true;},stop:function(){this.quicktime.Stop()
this.playing=false;},getBytesTotal:function(){return this.quicktime.GetMovieSize()},getBytesLoaded:function(){return this.quicktime.GetMaxBytesLoaded()},getDuration:function(){var qt=this.quicktime;return qt.GetMaxTimeLoaded()/this.getTimeScale()*1000;},getPosition:function(){var qt=this.quicktime;return qt.GetTime()/this.getTimeScale()*1000;},setPosition:function(milliSecond){var qt=this.quicktime;qt.SetTime(Math.floor(this.getTimeScale()*(milliSecond/1000)));},setRate:function(rate){this.rate=rate;if(this.playing)
this.quicktime.SetRate(rate);},getRate:function(){return this.rate;},getTimeScale:function(){return this.timeScale>0?this.timeScale:this.adjustTimeScale(this.getCorrectSecondDuration());},getCorrectSecondDuration:function(){var qt=this.quicktime;return this.correctSecondDuration>0?this.correctSecondDuration:qt.GetDuration()/qt.GetTimeScale()*this.timeLagScale;},adjustTimeScale:function(correctSecondDuration){var qt=this.quicktime;this.timeLagScale=correctSecondDuration*qt.GetTimeScale()/qt.GetDuration();return(this.timeScale=qt.GetTimeScale()/this.timeLagScale);}})
Cookie={get:function(name){var cookies=document.cookie.split('; ');for(var i=0,len=cookies.length;i<len;i++){var pair=cookies[i].split('=');if(pair[0]==name)
return pair[1];}},set:function(name,value,expires){expires=expires==null?'':'; expires='+expires.toGMTString()
document.cookie=name+'='+value+expires+'; path=/';},remove:function(name){this.set(name,'',new Date(0));}}
function addStyle(sel,val){if(document.createStyleSheet){var sheet=document.createStyleSheet();sheet.addRule(sel,val);}
else{var st=document.createElement('style');st.type='text/css';var t=document.createTextNode([sel,'{',val,'}'].join(''));st.appendChild(t);document.getElementsByTagName('head')[0].appendChild(st);}}
function QT(opt){this.correctSecondDuration=opt['duration'];this.loadingInterval=opt['loadingInterval']||(function(){});var qt_opt={src:opt['url'],enablejavascript:true,type:'video/quicktime',controller:opt['controller']||false,autoplay:opt['autoplay']||false,scale:opt['scale']||'aspect'};if(opt['isMovie']){qt_opt['width']=opt['width']||'320px';qt_opt['height']=opt['height']||'240px';}
else{qt_opt['width']=opt['width']||(opt['controller']?'200px':'1px');qt_opt['height']=opt['height']||(opt['controller']?'16px':'1px');qt_opt['style']='position:fixed;top:0;left:0;z-index:999;';}
if(opt['autoplay']){this.playing=opt['autoplay']||false;}
this.qt_opt=qt_opt;var el=document.getElementById(opt['element_id']);if(!el){var eid='emb_'+Math.random();el=createDOM('div',{id:eid});document.body.appendChild(el);}
var emid='em'+Math.random();var myQTObject=new QTObject(qt_opt.src,emid,qt_opt.width,qt_opt.height);for(var k in qt_opt){myQTObject.addParam(k,qt_opt[k]);}
myQTObject.write(el.id);var qt=this.quicktime=getElement(emid);setTimeout(function(){qt.blur();},0);QT.instances.push(this);}
MochiKit.Base.update(QT,{instances:[],create:function(opt){var sound=new QT(opt);return QT.waitForPlayable(sound);},waitForPlayable:function(sound){var qt=sound.quicktime;var deferred=new Deferred();var interval=100;var interval_count=0;var wait_total=0;var timeout_count=0;var timeout_count_warning=4;var f=function(){try{var qts=qt.GetPluginStatus()
if(/^Error/.test(qts)){clearInterval(intervalId);throw'error';}
sound.loadingInterval(sound);switch(qts){case'Waiting':interval_count++;wait_total+=interval;if(interval_count>10){timeout_count++;clearInterval(intervalId);interval*=2;interval_count=0;intervalId=setInterval(f,interval);}
break;case'Playable':case'Complete':clearInterval(intervalId);deferred.callback(sound);}}catch(error){clearInterval(intervalId);removeElement(qt);deferred.errback(error);}}
var intervalId=setInterval(f,interval);return deferred;}})
MochiKit.Base.update(QT.prototype,{quicktime:null,rate:1,playing:false,timeLagScale:0.9953,timeScale:-1,correctSecondDuration:-1,loadSound:function(url){this.quicktime.SetURL(url);return QT.waitForPlayable(this);},start:function(secondOffset){var qt=this.quicktime;if(secondOffset!=null)
this.setPosition(secondOffset*1000);this.quicktime.SetRate(this.rate);this.playing=true;qt.Play();},stop:function(){this.quicktime.Stop()
this.playing=false;},getBytesTotal:function(){return this.quicktime.GetMovieSize();},getBytesLoaded:function(){return this.quicktime.GetMaxBytesLoaded();},getLoadedRatio:function(){var ms=this.quicktime.GetMovieSize();return ms>0?(this.quicktime.GetMaxBytesLoaded()/ms):0;},getDuration:function(){var qt=this.quicktime;return qt.GetMaxTimeLoaded()/this.getTimeScale()*1000;},getPosition:function(){var qt=this.quicktime;return qt.GetTime()/this.getTimeScale()*1000;},setPosition:function(milliSecond){var qt=this.quicktime;qt.SetTime(Math.floor(this.getTimeScale()*(milliSecond/1000)));},setRate:function(rate){this.rate=rate;if(this.playing)
this.quicktime.SetRate(rate);},getRate:function(){return this.rate;},getTimeScale:function(){return this.timeScale>0?this.timeScale:this.adjustTimeScale(this.getCorrectSecondDuration());},getCorrectSecondDuration:function(){var qt=this.quicktime;return this.correctSecondDuration>0?this.correctSecondDuration:qt.GetDuration()/qt.GetTimeScale()*this.timeLagScale;},adjustTimeScale:function(correctSecondDuration){var qt=this.quicktime;this.timeLagScale=correctSecondDuration*qt.GetTimeScale()/qt.GetDuration();return(this.timeScale=qt.GetTimeScale()/this.timeLagScale);},getVolume:function(){var vol=this.quicktime.GetVolume();vol=vol>256?256:vol;vol=vol<0?0:vol;return Math.round(vol/256*100);},setVolume:function(vol){vol=vol>100?100:vol;vol=vol<0?0:vol;return this.quicktime.SetVolume(Math.round(vol*256/100));},hideMovie:function(){this.quicktime.width='1px';this.quicktime.height='1px';},showMovie:function(){this.quicktime.width=this.qt_opt['width'];this.quicktime.height=this.qt_opt['width'];}})
function onYouTubePlayerAPIReady(){YTi.onYouTubePlayerAPIReady_d.callback('ok');}
function YTi(opt){opt=opt||{};this.correctSecondDuration=opt.duration;this.loadingInterval=opt.loadingInterval||(function(){});this.url=opt.url;this.startTime=opt.startTime;this.playing=opt.autoplay||false;this.is_ready=false;var yt_opt={videoId:opt.url.match(/v=([^&]+)/)[1],playerVars:{start:(this.startTime||0),autoplay:(opt.autoplay?1:0),controls:0},events:{onReady:function(ev){if(ev.target.yti&&ev.target.yti.ready){}},onStateChange:function(ev){if(ev.data>0&&!ev.target.yti.is_ready){setTimeout(function(){ev.target.yti.ready();},500);}},onError:function(ev){if(ev.target.yti&&ev.target.yti.error){ev.target.yti.error(ev.data);}}}};if(opt.isMovie){yt_opt.width=opt.width||'320px';yt_opt.height=opt.height||'240px';}
else{yt_opt.width=opt.width||(opt.controller?'200px':'1px');yt_opt.height=opt.height||(opt.controller?'16px':'1px');}
var el=document.getElementById(opt.element_id);if(!el){var elid='emb_'+Math.random();el=createDOM('div',{id:elid});document.body.appendChild(el);}
var elid_=el.id+'_';el.appendChild(createDOM('div',{id:elid_}));this.core=new YT.Player(elid_,yt_opt);this.core.yti=this;this.yt_opt=yt_opt;YTi.instances.push(this);}
MochiKit.Base.update(YTi,{instances:[],inited:false,onYouTubePlayerAPIReady_d:new Deferred(),init:function(){YTi.inited=true;var tag=document.createElement('script');tag.src="http://www.youtube.com/player_api";var firstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);},create:function(opt){if(!YTi.inited){YTi.init();}
return YTi.onYouTubePlayerAPIReady_d.addCallback(function(){return YTi.waitForPlayable(new YTi(opt));});},waitForPlayable:function(sound){sound.wd=new Deferred();sound.ready=function(){sound.wd.callback(sound);sound.is_ready=true;};sound.error=function(err){sound.wd.errback(err);};return sound.wd;}})
MochiKit.Base.update(YTi.prototype,{core:null,playing:false,correctSecondDuration:-1,loadSound:function(url){this.core.SetURL(url);return YTi.waitForPlayable(this);},start:function(secondOffset){var qt=this.core;if(secondOffset!=null){this.setPosition(secondOffset*1000);}
this.playing=true;qt.playVideo();},stop:function(){this.core.pauseVideo()
this.playing=false;},getBytesTotal:function(){return this.core.getVideoBytesTotal()},getBytesLoaded:function(){return this.core.getVideoBytesLoaded();},getLoadedRatio:function(){var t=this.core.getVideoBytesTotal();var l=this.core.getVideoBytesLoaded();return(t==-1||l==-1||t==0||l==0)?0:(l/t);},getDuration:function(){return this.core.getDuration()*1000;},getPosition:function(){return this.core.getCurrentTime()*1000;},setPosition:function(milliSecond){return this.core.seekTo(milliSecond/1000);},setRate:function(rate){},getRate:function(){},getTimeScale:function(){},getCorrectSecondDuration:function(){},adjustTimeScale:function(correctSecondDuration){},getVolume:function(){return this.core.getVolume?this.core.getVolume():100;},setVolume:function(vol){return this.core.setVolume&&this.core.setVolume(vol);},hideMovie:function(){this.core.width='1px';this.core.height='1px';},showMovie:function(){this.core.width=this.yt_opt.width;this.core.height=this.yt_opt.width;}})
function onYouTubePlayerReady(playerId){var ytplayer=document.getElementById(playerId);var cb_s=playerId+'_onStateChange';var cb_e=playerId+'_onError';YTs[cb_s]=function(s){if(s>0&&ytplayer.yt&&ytplayer.yt.ready){ytplayer.yt.ready();}}
YTs[cb_e]=function(e){if(ytplayer.yt&&ytplayer.yt.error){ytplayer.yt.error();}}
ytplayer.addEventListener("onStateChange",'YTs.'+cb_s);ytplayer.addEventListener("onError",'YTs.'+cb_e);ytplayer.yt.load();}
function YTs(opt){opt=opt||{};this.correctSecondDuration=opt.duration;this.loadingInterval=opt.loadingInterval||(function(){});this.url=opt.url;this.startTime=opt.startTime;this.playing=opt.autoplay||false;var qt_opt={enablejavascript:true,type:'application/x-shockwave-flash',data:"http://www.youtube.com/apiplayer?enablejsapi=1&version=3"};if(opt.isMovie){qt_opt.width=opt.width||'320px';qt_opt.height=opt.height||'240px';}
else{qt_opt.width=opt.width||(opt.controller?'200px':'1px');qt_opt.height=opt.height||(opt.controller?'16px':'1px');qt_opt.style='position:fixed;top:0;left:0;z-index:999;';}
var el=document.getElementById(opt['element_id']);if(!el){var elid='emb_'+Math.random();el=createDOM('div',{id:elid});document.body.appendChild(el);}
var elid_=el.id+'_';el.appendChild(createDOM('div',{id:elid_}));this.qt_opt=qt_opt;var params={allowScriptAccess:'always'};var flashvars={};var flid='swfo'+new Date().getTime();qt_opt.data+='&playerapiid='+flid;var attributes={id:flid,style:qt_opt.style};swfobject.embedSWF(qt_opt.data,elid_,qt_opt.width,qt_opt.height,'9.0.0',null,flashvars,params,attributes);this.core=getElement(flid);this.core.yt=this;YTs.instances.push(this);}
MochiKit.Base.update(YTs,{instances:[],create:function(opt){var sound=new YTs(opt);return YTs.waitForPlayable(sound);},waitForPlayable:function(sound){sound.wd=new Deferred();sound.ready=function(){sound.wd.callback(sound)};sound.error=function(err){sound.wd.errback(err)};return sound.wd;}})
MochiKit.Base.update(YTs.prototype,{core:null,playing:false,correctSecondDuration:-1,load:function(){if(!this.is_load){this.is_load=true;var vid=this.url.match(/v=([^&]+)/)[1];if(this.startTime){this.core.loadVideoById(vid,this.startTime);}
else{this.core.loadVideoById(vid);}}},loadSound:function(url){this.core.SetURL(url);return YTs.waitForPlayable(this);},start:function(secondOffset){var qt=this.core;if(secondOffset!=null){this.setPosition(secondOffset*1000);}
this.playing=true;qt.playVideo();},stop:function(){this.core.pauseVideo()
this.playing=false;},getBytesTotal:function(){return this.core.getVideoBytesTotal()},getBytesLoaded:function(){return this.core.getVideoBytesLoaded();},getLoadedRatio:function(){var t=this.core.getVideoBytesTotal();var l=this.core.getVideoBytesLoaded();return(t==-1||l==-1||t==0||l==0)?0:(l/t);},getDuration:function(){return this.core.getDuration()*1000;},getPosition:function(){return this.core.getCurrentTime()*1000;},setPosition:function(milliSecond){return this.core.seekTo(milliSecond/1000);},setRate:function(rate){},getRate:function(){},getTimeScale:function(){},getCorrectSecondDuration:function(){},adjustTimeScale:function(correctSecondDuration){},getVolume:function(){return this.core.getVolume();},setVolume:function(vol){return this.core.setVolume(vol)},hideMovie:function(){this.core.width='1px';this.core.height='1px';},showMovie:function(){this.core.width=this.qt_opt.width;this.core.height=this.qt_opt.width;}})
function H5m(opt){var el=document.getElementById(opt['element_id']);if(!el){var elid='emb_'+Math.random();el=createDOM('div',{id:elid});document.body.appendChild(el);}
if(opt.isMovie){this.core=document.createElement('video');this.core.controls='controls';this.core.width=opt['width']||320;this.core.height=opt['height']||240;}
else{this.core=document.createElement('audio');if(!opt.showControl){this.core.width=opt['width']||1;this.core.height=opt['height']||1;}}
if(opt.url){this.core.src=opt.url;}
if(opt.showControl){this.core.controls='controls';}
if(opt.autoplay){this.core.autoplay='true';}
this.core.preload=opt.preload||'metadata';el.appendChild(this.core);this.core.load();var that=this;this.correctSecondDuration=opt['duration'];this.loadingInterval=opt['loadingInterval']||(function(){});this.url=opt.url;this.opt=opt;H5m.instances.push(this);}
MochiKit.Base.update(H5m,{events:['emptied','loadstart','progress','loadedmetadata','canplay','canplaythrough','load','stalled','suspend','abort','error','loadend','play','playing','timeupdate','waiting','ended'],instances:[],create:function(opt){var sound=new H5m(opt);return H5m.waitForPlayable(sound);},waitForPlayable:function(sound){var d=new Deferred();if(typeof sound.core.canPlayType=='undefined'){d.errback('not support html5 media');}
else if(sound.core.readyState>3){d.callback(sound);}
else{var f=function(){sound.core.removeEventListener('canplay',f);d.callback(sound);}
var e=function(err){console.log(err);sound.core.removeEventListener('error',e,false);d.errback(err);}
sound.core.addEventListener('canplay',f,false);sound.core.addEventListener('error',e,false);}
return d;}})
MochiKit.Base.update(H5m.prototype,{quicktime:null,rate:1,playing:false,timeLagScale:0.9953,timeScale:-1,correctSecondDuration:-1,loadSound:function(url){var src=document.createElement('source');for(var i=0;i<this.core.childNodes.length;i++){this.core.removeChild(this.core.childNodes[i]);}
this.core.appendChild(src);src.src=url;return H5m.waitForPlayable(this);},start:function(secondOffset){if(secondOffset!=null){this.setPosition(secondOffset*1000);}
this.playing=true;this.core.play();},stop:function(){this.core.pause();this.playing=false;},getBytesTotal:function(){},getBytesLoaded:function(){},getLoadedRatio:function(){var du=this.core.duration;if(du==Infinity&&this.correctSecondDuration){du=this.correctSecondDuration;}
var buf=this.core.buffered;if(du==Infinity||buf.length==0){return 0;}
else{return(buf.end(0)-buf.start(0))/du;}},getDuration:function(){return this.core.duration*1000;},getPosition:function(){return this.core.currentTime*1000;},setPosition:function(milliSecond){this.core.currentTime=milliSecond/1000;},setRate:function(rate){this.core.playbackRate=rate;},getRate:function(){return this.core.playbackRate;},getTimeScale:function(){},getCorrectSecondDuration:function(){},adjustTimeScale:function(correctSecondDuration){},getVolume:function(){return this.core.volume*100;},setVolume:function(vol){this.core.volume=vol/100;},hideMovie:function(){this.core.width=1;this.core.height=1;},showMovie:function(){this.core.width=this.opt['width'];this.core.height=this.opt['height'];}})
function Nicovideo(opt){var flid=opt['id']||'external_nico_0';this.quicktime=getElement(flid);if(opt['width']){this.quicktime.width=opt['width'];}
if(opt['height']){this.quicktime.height=opt['height'];}
this.correctSecondDuration=opt['duration'];this.qt_opt=opt;this.use_detect_msec=true;Nicovideo.instances.push(this);}
MochiKit.Base.update(Nicovideo,{instances:[],create:function(opt){var sound=new Nicovideo(opt);return Nicovideo.waitForPlayable(sound);},waitForPlayable:function(sound){var qt=sound.quicktime;var deferred=new Deferred();var interval=300;var interval_count=0;var wait_total=0;var timeout_count=0;var timeout_count_warning=4;var isLoad=false;var f=function(){try{if(typeof qt['ext_getStatus']!='undefined'){clearInterval(intervalId);deferred.callback(sound);}
else{interval_count++;wait_total+=interval;if(interval_count>10){timeout_count++;clearInterval(intervalId);if(timeout_count==timeout_count_warning){}
interval*=2;interval_count=0;intervalId=setInterval(f,interval);}}}catch(error){clearInterval(intervalId);deferred.errback(error);}}
var intervalId=setInterval(f,interval);return deferred;}})
MochiKit.Base.update(Nicovideo.prototype,{quicktime:null,rate:1,playing:false,timeLagScale:0.9953,timeScale:-1,correctSecondDuration:-1,loadSound:function(url){},start:function(secondOffset){var qt=this.quicktime;var t=qt.ext_getPlayheadTime();if(secondOffset!=null&&Math.abs(secondOffset-t)>2){this.setPosition(secondOffset*1000);}
this.playing=true;qt.ext_play(true);},stop:function(){this.quicktime.ext_play(false);this.playing=false;},getBytesTotal:function(){},getBytesLoaded:function(){},getLoadedRatio:function(){var r=0;try{r=this.quicktime.ext_getLoadedRatio();}
catch(e){}
return r;},getDuration:function(){return this.quicktime.ext_getTotalTime()*1000;},getPosition:function(){var d=120;if(this.use_detect_msec){var pos=this.quicktime.ext_getPlayheadTime()*1000;if(pos==this.prevPos&&this.playing){var delta=(this.prevDelta||0)+d;this.prevDelta=delta>=980?980:delta;}
else{this.prevDelta=0;}
this.prevPos=pos;return pos+(this.prevDelta||0);}
else{return this.quicktime.ext_getPlayheadTime()*1000;}},setPosition:function(milliSecond){if(milliSecond>=0){return this.quicktime.ext_setPlayheadTime(milliSecond/1000);}},setRate:function(rate){},getRate:function(){},getTimeScale:function(){return this.timeScale>0?this.timeScale:this.adjustTimeScale(this.getCorrectSecondDuration());},getCorrectSecondDuration:function(){},adjustTimeScale:function(correctSecondDuration){},getVolume:function(){return this.quicktime.ext_getVolume();},setVolume:function(vol){return this.quicktime.ext_setVolume(vol)},hideMovie:function(){this.quicktime.width='1px';this.quicktime.height='1px';},showMovie:function(){this.quicktime.width=this.qt_opt['width'];this.quicktime.height=this.qt_opt['height'];}})
function UST(opt){var opt=opt||{};var flid='swfo'+Math.random();var params={allowScriptAccess:'always'};var re=/http:\/\/www\.ustream\.tv\/recorded\/([^\/?#]+)/;if(opt.url&&opt.url.match(re)){opt.id=opt.url.match(re)[1];}
var flashvars={debug:opt.debug,id:opt.id};var attributes={id:flid,style:''};var el=document.getElementById(opt['element_id']);if(!el){var elid='emb_'+Math.random();el=createDOM('div',{id:elid});document.body.appendChild(el);}
var swf=(opt['swfPath']||'')+'ust.swf';swfobject.embedSWF(swf,el.id,320,240,'9.0.0',null,flashvars,params,attributes);this.quicktime=getElement(flid);UST.instances.push(this);}
MochiKit.Base.update(UST,{instances:[],create:function(opt){var sound=new UST(opt);return UST.waitForPlayable(sound);},waitForPlayable:function(sound){var qt=sound.quicktime;var deferred=new Deferred();var interval=300;var interval_count=0;var wait_total=0;var timeout_count=0;var timeout_count_warning=4;var isLoad=false;var f=function(){try{if(typeof qt['getBufferLength']!='undefined'){clearInterval(intervalId);deferred.callback(sound);}
else{interval_count++;wait_total+=interval;if(interval_count>10){timeout_count++;clearInterval(intervalId);if(timeout_count==timeout_count_warning){messagePanel.show(getMessage('warn.mediaFile'),7);}
interval*=2;interval_count=0;intervalId=setInterval(f,interval);}}}catch(error){clearInterval(intervalId);removeElement(qt);deferred.errback(error);}}
var intervalId=setInterval(f,interval);return deferred;}})
MochiKit.Base.update(UST.prototype,{quicktime:null,rate:1,playing:false,timeLagScale:0.9953,timeScale:-1,correctSecondDuration:-1,loadSound:function(id){this.quicktime.loadVide(id);return UST.waitForPlayable(this);},start:function(secondOffset){var qt=this.quicktime;if(secondOffset!=null){this.setPosition(secondOffset*1000);}
this.playing=true;qt.play();},stop:function(){this.quicktime.pause()
this.playing=false;},getBytesTotal:function(){},getBytesLoaded:function(){},getLoadedRatio:function(){return this.quicktime.getBufferProgress();},getDuration:function(){return this.quicktime.getDuration()*1000;},getPosition:function(){return this.quicktime.getTime()*1000;},setPosition:function(milliSecond){this.quicktime.seekSecond(milliSecond/1000);},setRate:function(rate){},getRate:function(){},getTimeScale:function(){},getCorrectSecondDuration:function(){},adjustTimeScale:function(correctSecondDuration){},getVolume:function(){return this.quicktime.getVolume()*100;},setVolume:function(vol){return this.quicktime.setVolume(vol/100)},hideMovie:function(){this.quicktime.width='1px';this.quicktime.height='1px';},showMovie:function(){this.quicktime.width='320px';this.quicktime.height='240px';}})
QTObject=function(mov,id,w,h){this.mov=mov;this.id=id;this.width=w;this.height=h;this.redirect="";this.sq=document.location.search.split("?")[1]||"";this.altTxt="This content requires the QuickTime Plugin. <a href='http://www.apple.com/quicktime/download/'>Download QuickTime Player</a>.";this.bypassTxt="<p>Already have QuickTime Player? <a href='?detectqt=false&"+this.sq+"'>Click here.</a></p>";this.params=new Object();this.doDetect=getQueryParamValue('detectqt');}
QTObject.prototype.addParam=function(name,value){this.params[name]=value;}
QTObject.prototype.getParams=function(){return this.params;}
QTObject.prototype.getParam=function(name){return this.params[name];}
QTObject.prototype.getParamTags=function(){var paramTags="";for(var param in this.getParams()){paramTags+='<param name="'+param+'" value="'+this.getParam(param)+'" />';}
if(paramTags==""){paramTags=null;}
return paramTags;}
QTObject.prototype.getHTML=function(){var qtHTML="";if(navigator.plugins&&navigator.plugins.length){qtHTML+='<embed type="video/quicktime" src="'+this.mov+'" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'"';for(var param in this.getParams()){qtHTML+=' '+param+'="'+this.getParam(param)+'"';}
qtHTML+='></embed>';}
else{qtHTML+='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'">';this.addParam("src",this.mov);if(this.getParamTags()!=null){qtHTML+=this.getParamTags();}
qtHTML+='</object>';}
return qtHTML;}
QTObject.prototype.getVariablePairs=function(){var variablePairs=new Array();for(var name in this.getVariables()){variablePairs.push(name+"="+escape(this.getVariable(name)));}
if(variablePairs.length>0){return variablePairs.join("&");}
else{return null;}}
QTObject.prototype.write=function(elementId){if(isQTInstalled()||this.doDetect=='false'){if(elementId){document.getElementById(elementId).innerHTML=this.getHTML();}else{document.write(this.getHTML());}}else{if(this.redirect!=""){document.location.replace(this.redirect);}else{if(elementId){document.getElementById(elementId).innerHTML=this.altTxt+""+this.bypassTxt;}else{document.write(this.altTxt+""+this.bypassTxt);}}}}
function isQTInstalled(){var qtInstalled=false;qtObj=false;if(navigator.plugins&&navigator.plugins.length){for(var i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];if(plugin.name.indexOf("QuickTime")>-1){qtInstalled=true;}}}else{execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript');qtInstalled=qtObj;}
return qtInstalled;}
function getQueryParamValue(param){var q=document.location.search;var detectIndex=q.indexOf(param);var endIndex=(q.indexOf("&",detectIndex)!=-1)?q.indexOf("&",detectIndex):q.length;if(q.length>1&&detectIndex!=-1){return q.substring(q.indexOf("=",detectIndex)+1,endIndex);}else{return"";}}
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();computedStyle=MochiKit.Style.getStyle
var UI={};UI.version="0.5.3";UI.Lang={};UI.Lang.Language=function(_1,_2){bindMethods(this);this.code=_1;this.messages=_2;};UI.Lang.Language.prototype={"translate":function(_3){return this.messages[_3];}};UI.Lang.C=new UI.Lang.Language("C",{});UI.Lang.es=new UI.Lang.Language("es",{"The value must be a number":"El valor debe ser num\xe9rico","The field is required":"Debe ingresar un valor en este campo","The field is not valid":"El valor ingresado no es v\xe1lido","The value must contain only letters":"El valor debe contener solo letras","The value must be a valid email address":"El valor debe contener una direcci\xf3n de correo v\xe1lida"});UI.Lang.setLanguage=function(_4){if(typeof(_4)!="undefined"&&typeof(UI.Lang[_4])!="undefined"){UI.Lang.current=UI.Lang[_4];}else{UI.Lang.current=UI.Lang.C;}};if(typeof(LANG)!="undefined"){UI.Lang.setLanguage(LANG);}else{var _detectedLang=navigator.userLanguage||navigator.browserLanguage||navigator.language;if(_detectedLang.length>=2){UI.Lang.setLanguage(_detectedLang.substring(0,2));}else{logWarning("UI.Lang: Can't autodetect language. (Browser says: "+_detectedLang+")");UI.Lang.setLanguage("C");}
_detectedLang=null;}
function _(_5){return UI.Lang.current.translate(_5)||_5;}
UI.Widget=function(_6){bindMethods(this);this.element=$(_6);this.cssClass="uiwidget";this.register();};UI.Widget.get=function(_7){return $(_7)._widget;};var w$=UI.Widget.get;UI.Widget.prototype={"register":function(){if(this.element){this.element._widget=this;addElementClass(this.element,this.cssClass);}},"hide":function(){hideElement(this.element);},"show":function(_8){showElement(this.element,_8);},"toDOM":function(_9){return this.element;},"__dom__":function(_10){return this.element;}};UI.TableModel=function(){bindMethods(this);};UI.TableModel.prototype={"getNumCols":function(){return 0;},"getNumRows":function(){return 0;},"getCell":function(_11,_12){return null;},"getHeader":function(_13){return null;},"getFooter":function(_14){return null;},"getColType":function(_15){return null;},"hasHeader":function(){return false;},"hasFooter":function(){return false;},"getRow":function(_16){return map(partial(this.getCell,_16),range(0,this.getNumCols()));},"getRows":function(){return map(this.getRow,range(0,this.getNumRows()));},"getHeaders":function(){return map(this.getHeader,range(0,this.getNumCols()));},"getFooters":function(){return map(this.getFooter,range(0,this.getNumCols()));},"getColTypes":function(){return map(this.getColType,range(0,this.getNumCols()));}};UI.ArrayTableModel=function(_17,_18,_19,_20,_21){bindMethods(this);this.objects=_17||[];this.fields=_18||this._autoDetectFields();this.headers=_20||this._autoDetectHeaders();this.types=_19;this.footers=_21;};UI.ArrayTableModel.prototype=update(new UI.TableModel(),{"getNumCols":function(){return this.fields?this.fields.length:0;},"getNumRows":function(){return this.objects?this.objects.length:0;},"getCell":function(_22,_23){var val;try{val=this.objects[_22][this.fields[_23]];if(val==null||typeof(val)=="undefined"){val="";}}
catch(e){val="";}
return val;},"getHeader":function(_25){try{return this.headers[_25];}
catch(e){return"";}},"getFooter":function(_26){try{return this.footers[_26];}
catch(e){return"";}},"getColType":function(_27){try{return this.types[_27];}
catch(e){return"string";}},"_autoDetectFields":function(){if(this.objects&&this.objects.length>=1){var _28=[];for(field in this.objects[0]){_28.push(field);}
return _28;}else{return[];}},"_autoDetectHeaders":function(){var _29=[];for(var i=0;i<this.getNumCols();i++){_29.push(this.fields[i]);}
return _29;},"hasHeader":function(){return!(!this.headers);},"hasFooter":function(){return!(!this.footers);},"changed":function(){signal(this,"changed");}});UI.AsyncArrayTableModel=function(_31,_32,_33,_34){bindMethods(this);this.objects=[];this.fields=_31;this.headers=_33;this.types=_32;this.footers=_34;};UI.AsyncArrayTableModel.prototype=update(new UI.ArrayTableModel(),{"retrieveData":function(url,_36){var _36=_36||"GET";var d=loadJSONDoc(url);d.addCallback(this._receiveData);return d;},"_receiveData":function(_38){this.objects=_38;if(!this.fields){this._autoDetectFields();}
if(!this.headers){this._autoDetectHeaders();}
this.changed();}});UI.HTMLTableModel=function(_39,_40){bindMethods(this);this._htmlTable=_39;this._colTypes=_40;};UI.HTMLTableModel.prototype=update(new UI.TableModel(),{"getNumCols":function(){try{return this._htmlTable.tBodies[0].rows[0].cells.length;}
catch(e){return 0;}},"getNumRows":function(){try{return this._htmlTable.tBodies[0].rows.length;}
catch(e){return 0;}},"getCell":function(_41,_42){try{return this._htmlTable.tBodies[0].rows[_41].cells[_42].childNodes;}
catch(e){return"";}},"getHeader":function(_43){try{return this._htmlTable.tHead.rows[0].cells[_43].childNodes;}
catch(e){return"";}},"getFooter":function(_44){try{return this._htmlTable.tFoot.rows[0].cells[_44].childNodes;}
catch(e){return"";}},"getColType":function(_45){try{if(this._colTypes){return this._colTypes[_45];}else{return"string";}}
catch(e){return"string";}},"hasHeader":function(){return!(!this._htmlTable.tHead);},"hasFooter":function(){return!(!this._htmlTable.tFoot);}});UI.ListModel=function(){bindMethods(this);};UI.ListModel.prototype={"getLabel":function(_46){return"";},"getValue":function(_47){return"";},"getLength":function(){return 0;}};UI.ArrayListModel=function(_48,_49,_50){bindMethods(this);this.objects=_48;this.labelField=_49;this.valueField=_50;};UI.ArrayListModel.prototype=update(new UI.ListModel(),{"getLabel":function(_51){return this.labelField?this.objects[_51][this.labelField]:""+this.objects[_51];},"getValue":function(_52){return this.valueField?this.objects[_52][this.valueField]:this.getLabel(_52);},"getLength":function(){return this.objects.length;},"changed":function(){signal(this,"changed");}});UI.AsyncArrayListModel=function(_53,_54){bindMethods(this);this.objects=[];this.labelField=_53;this.valueField=_54;};UI.AsyncArrayListModel.prototype=update(new UI.ArrayListModel(),{"retrieveData":function(url,_55){var _55=_55||"GET";var d=loadJSONDoc(url);d.addCallback(this._receiveData);return d;},"_receiveData":function(_56){this.objects=_56;this.changed();return _56;}});UI.HTMLSelectListModel=function(_57){this._options=_57.getElementsByTagName("option");};UI.HTMLSelectListModel.prototype=update(new UI.ListModel(),{"getLabel":function(_58){return scrapeText(this._options[_58]);},"getValue":function(_59){return this._options[_59].value;},"getLength":function(){try{return this._options.length;}
catch(e){return 0;}}});UI.Window=function(_60){bindMethods(this);if(_60){this.element=$(_60);}else{this.element=DIV({style:{"height":"400px","width":"400px","left":"0px","top":"0px","position":"absolute"}});}
this.titleBar=null;this.content=null;this.draggableTitle=null;var _61=this.element.getElementsByTagName("h1");var _62=null;if(_61.length==0){this.setTitleBar(UI.Window.standardTitleBar("Untitled Window"));}else{this.setTitleBar(_61[0]);}
var _63=getElementsByTagAndClassName("div","uicontent",this.element);if(_63.length==0){var div=DIV({"class":"uicontent"});var _65=filter(function(el){return el.className!="uititlebar";},this.element.childNodes);map(partial(appendChildNodes,div),_65);this.setContent(div);}else{this.setContent(_63[0]);}
this.resize(elementDimensions(this.element));this.visible=computedStyle(this.element,"display")!="none";this.cssClass="uiwindow";this.register();this.NAME=this.element.id+" (UI.Window)";};UI.Window.prototype=update(new UI.Widget(),{"show":function(_67){showElement(this.element);signal(this,"shown");if(_67){this.moveTo(_67);}},"hide":function(){hideElement(this.element);signal(this,"hidden");},"close":function(){removeElement(this.element);this.draggableTitle.disable();this.draggableTitle=null;signal(this,"closed");},"moveTo":function(_68){setElementPosition(this.element,_68);signal(this,"moved",_68);},"resize":function(_69){setElementDimensions(this.element,_69);},"_adjustSize":function(){setElementDimensions(this.content,{"w":this.element.clientWidth-4,"h":this.element.clientHeight-elementDimensions(this.titleBar).h-4});},"include":function(url){var el=DIV();this.setContent(el);var d=doSimpleXMLHttpRequest(url);d.addCallback(function(req){removeElementClass(el,"uierror");el.innerHTML=req.responseText;return req;});d.addErrback(function(req){addElementClass(el,"uierror");if(req){el.innerHTML=req.responseText;}else{el.innerHTML=_("Error loading")+" "+url;}});return d;},"setTitleBar":function(_71){if(this.titleBar){removeElement(this.titleBar);this.draggableTitle.disable();}
addElementClass(_71,"uititlebar");if(this.element.firstChild){this.element.insertBefore(_71,this.element.firstChild);}else{this.element.appendChild(_71);}
this.titleBar=_71;this.draggableTitle=new UI.Draggable(this.titleBar);this.draggableTitle.elementToMove=this.element;},"setContent":function(_72){if(this.content){removeElement(this.content);}
addElementClass(_72,"uicontent");this.content=_72;appendChildNodes(this.element,this.content);setElementDimensions(this.content,{"w":this.element.clientWidth-4,"h":this.element.clientHeight-elementDimensions(this.titleBar).h-4});}});UI.Window._fromElement=function(_73){var win=new UI.Window(_73);var _75=getNodeAttribute("ui:draggable")||"true";if(_75=="false"){win.draggableTitle.disable();}};UI.Window.standardTitleBar=function(_76){return H1({"class":"uititlebar"},_76);};UI.Draggable=function(_77,_78,_79,_80){bindMethods(this);if(_77){this.element=$(_77);}else{this.element=DIV();}
this.element=$(_77);this.elementToMove=$(_77);this.flags=arguments.length>=2?_78:UI.Draggable.DRAG_X|UI.Draggable.DRAG_Y;this.leftLimits=_79;this.topLimits=_80;this._dragXStart=-1;this._dragYStart=-1;this._leftStart=-1;this._topStart=-1;this._installMouseDown();this._disabled=false;this.NAME=repr(_77)+" (Draggable)";};UI.Draggable.DRAG_X=1;UI.Draggable.DRAG_Y=2;UI.Draggable._oldonmousemove=document.onmousemove;UI.Draggable._oldonmouseup=document.onmouseup;UI.Draggable._draggable=null;UI.Draggable.prototype={"startFromEvent":function(e){var e=e||window.event;var x=e.screenX;var y=e.screenY;this.start(x,y);},"start":function(_84,_85){if(this._disabled){return;}
if(UI.Draggable._draggable){return;}
UI.Draggable._draggable=this;this.elementToMove.style.zIndex=1;this._dragXStart=_84;this._dragYStart=_85;this._leftStart=parseInt(computedStyle(this.elementToMove,"left"),10);this._topStart=parseInt(computedStyle(this.elementToMove,"top"),10);if((isNaN(this._leftStart)||isNaN(this._topStart))){logger.error("Can't start the drag for "+repr(this)+" "+"Either the left or the top of the dragged element is not a number "+"left: "+this._leftStart+" top: "+this._topStart);return;}
signal(this,"dragStarted");},"move":function(_86,_87){if(this._disabled){return;}
if((this.flags&UI.Draggable.DRAG_X)>0){var _88=(this._leftStart+_86-this._dragXStart);if(this.leftLimits){if(_88<this.leftLimits[0]){_88=this.leftLimits[0];}
if(_88>this.leftLimits[1]){_88=this.leftLimits[1];}}
if(!isNaN(_88)){this.elementToMove.style.left=_88+"px";}else{logger.error("Draggable.move: newLeft isNaN");}}
if((this.flags&UI.Draggable.DRAG_Y)>0){var _89=(this._topStart+_87-this._dragYStart);if(this.topLimits){if(_89<this.topLimits[0]){_89=this.topLimits[0];}
if(_89>this.topLimits[1]){_89=this.topLimits[1];}}
if(!isNaN(_89)){this.elementToMove.style.top=_89+"px";}else{logger.error("Draggable.move: newTop isNaN");}}
signal(this,"dragging");},"stop":function(){var e=e||window.event;UI.Draggable._draggable=null;signal(this,"dragFinished");},"_installMouseDown":function(){var _90=this.element.onmousedown;var _91=this;this.element.onmousedown=function(e){var e=e||window.event;_91.startFromEvent(e);if(_90){_90.apply(this.element,arguments);}};},"enable":function(){this._disabled=false;},"disable":function(){this._disabled=true;}};document.onmousemove=function(e){var e=e||window.event;var x=e.screenX;var y=e.screenY;if(UI.Draggable._draggable){UI.Draggable._draggable.move(x,y);}
if(UI.Draggable._oldonmousemove){_oldmousemove.apply(document,arguments);}};document.onmouseup=function(e){if(UI.Draggable._draggable){UI.Draggable._draggable.stop(e);}
if(UI.Draggable._oldonmouseup){_oldonmouseup.apply(document,arguments);}};UI.Table=function(_92,_93){bindMethods(this);if(_92){this.element=$(_92);}else{this.element=DIV();}
this.selectedRow=-1;this._modelRowIndexes=[];this._bodyRowIndexes=[];this._selectedTR=null;this._highlightedTR=null;this._sortCol=-1;this._arrow=SPAN(null);this._model=null;this.cssClass="uitable";this.register();if(_93){this.setModel(_93);}
this.NAME=this.element.id+"(UI.Table)";};UI.Table._NO_ARROW="&nbsp;&nbsp;&nbsp;";UI.Table._DOWN_ARROW="&nbsp;&nbsp;&darr;";UI.Table._UP_ARROW="&nbsp;&nbsp;&uarr;";UI.Table.prototype=update(new UI.Widget(),{"setModel":function(_94){this._model=_94;connect(_94,"changed",this,"render");this.render();},"model":function(){return this._model;},"render":function(){if(!this._model){logError("Can't render a table without model");return;}
var _95=this.getTableElement();if(_95){swapDOM(_95,null);}
var _96=[];if(this._model.hasHeader()){_96.push(THEAD(null,TR(null,map(this._makeTH,this._model.getHeaders(),range(0,this._model.getNumCols())))));}
if(this._model.hasFooter()){_96.push(TFOOT(null,TR(null,map(partial(TD,null),this._model.getFooters()))));}
var _97=TABLE(null,_96,TBODY(null,map(this._makeTR,this._model.getRows(),range(0,this._model.getNumRows()))));this.element.appendChild(_97);this._initIndexesMaps();},"_initIndexesMaps":function(){this._bodyRowIndexes=[];this._modelRowIndexes=[];for(var i=0;i<this._model.getNumRows();i++){this._bodyRowIndexes.push(i);this._modelRowIndexes.push(i);}},"getTableElement":function(){return this.element.getElementsByTagName("table")[0];},"_makeTH":function(_98,_99){var th=TH(null,_98);addElementClass(th,"col_"+_99);var _101=this;th.onclick=function(e){_101.clickHeader(_99,e||window.event);};return th;},"_makeTR":function(row,_103){var tr=TR(null,map(this._makeTD,row,this._model.getColTypes()));addElementClass(tr,"row_"+_103);addElementClass(tr,(_103%2)==0?"even":"odd");var _105=this;tr.onclick=function(e){_105.clickRow(_105.modelRowIndex(tr.sectionRowIndex),e||window.event);};tr.onmouseover=function(e){_105.mouseOverRow(_105.modelRowIndex(tr.sectionRowIndex),e||window.event);};tr.onmouseout=function(e){_105.mouseOutRow(_105.modelRowIndex(tr.sectionRowIndex),e||window.event);};signal(this,"rowAdded",tr,_103);return tr;},"_makeTD":function(cell,type){switch(type){case"rawhtml":var td=TD(null);td.innerHTML=cell;return td;default:return TD(null,cell);}},"clickRow":function(_109,_110){this.selectRow(_109);signal(this,"rowClicked",_109,_110);},"clickHeader":function(_111,_112){var _113=this.getTH(_111);var _114=_113.getAttribute("_order")||"asc";var _115=_114=="asc"?"desc":"asc";_113.setAttribute("_order",_115);this.sort(_111,_115=="desc");if(_115=="asc"){this._arrow.innerHTML=UI.Table._DOWN_ARROW;}else{this._arrow.innerHTML=UI.Table._UP_ARROW;}
_113.appendChild(this._arrow);signal(this,"headerClicked",_111,_112);},"mouseOverRow":function(_116,_117){this.highlightRow(_116);signal(this,"rowMouseOver",_116,_117);},"mouseOutRow":function(_118,_119){this.highlightRow(-1);signal(this,"rowMouseOut",_118,_119);},"selectRow":function(_120){if(this._selectedTR){removeElementClass(this._selectedTR,"ui_active");}
var _121=this.getTR(_120);if(_121){addElementClass(_121,"ui_active");this._selectedTR=_121;}else{this._selectedTR=null;}
this.selectedRow=_120;signal(this,"rowSelected",_120);},"highlightRow":function(_122){if(this._highlightedTR){removeElementClass(this._highlightedTR,"ui_hover");}
var _123=this.getTR(_122);if(_123){addElementClass(_123,"ui_hover");this._highlightedTR=_123;}},"modelRowIndex":function(_124){return this._modelRowIndexes[_124];},"bodyRowIndex":function(_125){return this._bodyRowIndexes[_125];},"getTR":function(_126){var _127=this.bodyRowIndex(_126);if(_127>=0){return this.getTableElement().tBodies[0].rows[_127];}else{return null;}},"getTH":function(_128){if(_128>=0){return this.getTableElement().tHead.rows[0].cells[_128];}else{return null;}},"_sortDate":function(a,b){aa=scrapeText(a.cells[this.sortCol]);bb=scrapeText(b.cells[this.sortCol]);if(aa.length==10){dt1=aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);}else{yr=aa.substr(6,2);if(parseInt(yr)<50){yr="20"+yr;}else{yr="19"+yr;}
dt1=yr+aa.substr(3,2)+aa.substr(0,2);}
if(bb.length==10){dt2=bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);}else{yr=bb.substr(6,2);if(parseInt(yr)<50){yr="20"+yr;}else{yr="19"+yr;}
dt2=yr+bb.substr(3,2)+bb.substr(0,2);}
if(dt1==dt2){return 0;}
if(dt1<dt2){return-1;}
return 1;},"_sortCurrency":function(a,b){aa=scrapeText(a.cells[this.sortCol]).replace(/[^0-9.]/g,"");bb=scrapeText(b.cells[this.sortCol]).replace(/[^0-9.]/g,"");return parseFloat(aa)-parseFloat(bb);},"_sortNumeric":function(a,b){aa=parseFloat(scrapeText(a.cells[this.sortCol]));if(isNaN(aa)){aa=0;}
bb=parseFloat(scrapeText(b.cells[this.sortCol]));if(isNaN(bb)){bb=0;}
return aa-bb;},"_sortString":function(a,b){var aa=scrapeText(a.cells[this.sortCol]).toLowerCase();var bb=scrapeText(b.cells[this.sortCol]).toLowerCase();if(aa==bb){return 0;}
if(aa<bb){return-1;}
return 1;},"_sortStringCaseSensitive":function(a,b){aa=scrapeText(a.cells[this.sortCol]);bb=scrapeText(b.cells[this.sortCol]);if(aa==bb){return 0;}
if(aa<bb){return-1;}
return 1;},"sort":function(_133,_134){_133=_133||0;_134=_134||false;this.sortCol=_133;var _135=this._model.getColType(_133)||"string";var _136="_sort"+_135.charAt(0).toUpperCase()+_135.substring(1);if(!this[_136]){logError("UI.Table.sort: Type "+_135+" unrecognized");return;}
var _137=this.getTableElement();var _138=new Array();for(var i=0;i<_137.tBodies[0].rows.length;i++){_138[i]=_137.tBodies[0].rows[i];_138[i]._modelIndex=this.modelRowIndex(i);}
_138.sort(this[_136]);for(var i=0;i<_138.length;i++){if(!_134){_137.tBodies[0].appendChild(_138[i]);}else{_137.tBodies[0].appendChild(_138[_138.length-1-i]);}
this._modelRowIndexes[i]=_138[i]._modelIndex;this._bodyRowIndexes[_138[i]._modelIndex]=i;try{delete _138[i]._modelIndex;}
catch(e){_138[i]._modelIndex=null;}}}});UI.Table._fromElement=function(_139){var _140=new UI.Table(_139.id||_139.getAttribute("id"));var _141=_139.getAttribute("ui:model");if(!_141){var _142=_139.getElementsByTagName("table");if(_142&&_142.length>0){_140.setModel(new UI.HTMLTableModel(_142[0]));}
return;}else{_140.setModel(eval("("+_141+")"));return;}};UI.Slider=function(_143,_144,_145,_146){bindMethods(this);if(_143){this.element=$(_143);}else{this.element=DIV({"style":{"width":"100px"}});}
this.minValue=_144||0;this.maxValue=_145||100;this.value=_144;this.linkedInput=null;var _147=this.element.getElementsByTagName("div");if(!_147||_147.length==0){this.element.appendChild(DIV(null," "));_147=this.element.getElementsByTagName("div");}
var _148=_147[0];this._draggableWidth=parseInt(computedStyle(_148,"width"),10);this._maxLeft=parseInt(computedStyle(this.element,"width"),10)-this._draggableWidth;this.draggable=new UI.Draggable(_148,UI.Draggable.DRAG_X,[0,this._maxLeft]);connect(this.draggable,"dragging",this,"_updateValue");this._connectWithClicks();this.register();this._updateValue();if(_146){this.linkWithInput(_146);_146.value=this.value;}
this.NAME=this.element.id+"(UI.Slider)";};UI.Slider.prototype=update(new UI.Widget(),{"_updateValue":function(left,n){var _150=this.value;if(arguments.length==0){left=parseInt(computedStyle(this.draggable.element,"left"),10);}
this.value=Math.round((left/this._maxLeft)*(this.maxValue-this.minValue)+this.minValue);if(this.value!=_150&&!n){signal(this,"valueChanged",this.value);if(this.linkedInput){this.linkedInput.value=this.value;}}},"_click":function(_151,_152){var _153=elementPosition(this.element).x;var _154=(_151-_153-this._draggableWidth/2);this.setValue(parseFloat((_154/this._maxLeft)*(this.maxValue-this.minValue))+this.minValue);},"setValue":function(_155,n){var _156=this.value;if(_155>this.maxValue){_155=this.maxValue;}
if(_155<this.minValue){_155=this.minValue;}
var left=Math.round(((_155-this.minValue)/(this.maxValue-this.minValue))*this._maxLeft);this.draggable.element.style.left=left+"px";this._updateValue(left,n);},"_connectWithClicks":function(){var _157=this;connect(this.element,"onclick",function(e){var _158=e.mouse();_157._click(_158.page.x,_158.page.y);});connect(this.draggable.element,"onclick",function(e){e.stop();return false;});},"linkWithInput":function(_159){this.linkedInput=_159;this.linkedInput.value=this.value;var _160=this;connect(_159,"onchange",function(e){var val=parseInt(_159.value,10);if(!isNaN(val)){_160.setValue(val);}});}});UI.Slider._fromElement=function(_161){var _162=getNodeAttribute(_161,"ui:minvalue")||0;var _163=getNodeAttribute(_161,"ui:maxvalue")||0;var _164=getNodeAttribute(_161,"ui:input");var _165=new UI.Slider(_161,parseInt(_162,10),parseInt(_163,10));if(_164){_165.linkWithInput($(_164));}};UI.Form=function(_166,_167,_168){bindMethods(this);_166=_166||FORM();this.element=$(_166);this.items=_167||[];this.validators=_168||[];this.cssClass="uiform";this._invalidInputs=[];this.register();this.NAME=this.element.id+"(UI.Form)";var _169=_166.onsubmit;var form=this;_166.onsubmit=function(){if(!form.validate()){return false;}
if(!_169){return true;}else{return _169();}};};UI.Form.VALIDATION_PASSED="";UI.Form.Messages={"REQUIRED":_("The field is required"),"NOT_VALID":_("The field value is not valid"),"NUMBER":_("The value must be a number"),"ALPHA":_("The value must contain only letters"),"ALPHANUM":_("The value must contain only letters and numbers"),"ALPHASPACES":_("The value must contain only letters and spaces"),"ALPHANUMSPACES":_("The value must contain only letters, numbers and spaces"),"EMAIL":_("The value must be a valid email address")};UI.Form.prototype=update(new UI.Widget(),{"render":function(){this.element.appendChild(TABLE(null,TBODY(null,map(function(i){return i.render();},this.items))));},"validate":function(){this._invalidInputs=[];var _171=true;for(var i=0;i<this.items.length;i++){if(this.items[i].inputs){for(var j=0;j<this.items[i].inputs.length;j++){if(this.items[i].inputs[j]){this.items[i].inputs[j].validate();if(!this.items[i].inputs[j].valid){this._invalidInputs.push(this.items[i].inputs[j].element);_171=false;}}}}}
for(var i=0;i<this.validators.length;i++){var errs=this.validators[i](this.element);var form=this;if(errs&&errs.length){_171=false;forEach(errs,function(err){var _175=err.fields;var msg=err.message;forEach(_175,function(_177){form._invalidInputs.push(_177);});});}}
if(_171){signal(this,"validationPassed");}else{signal(this,"validationFailed");}
return _171;},"submitAsync":function(url,_178,_179,_180){if(!this.validate()){return null;}
signal(this,"submitted");var _178=_178||[];var _179=_179||[];var _180=_180||"GET";var url=url||this.element.action;if(url){var _181=formContents(this.element);var _182=_181[0];var _183=_181[1];extend(_182,_178);extend(_183,_179);var d=doSimpleXMLHttpRequest(url,_182,_183);signal(this,"sent",_182,_183);return d;}
return fail("UI.Form.submitAsync: No url given and url autodetection failed");},"invalidInputs":function(){return this._invalidInputs;}});UI.Form.Error=function(msg){this.message=msg;this.fields=extend([],arguments,1);};UI.FormItem=function(_184,_185,_186,flow){bindMethods(this);if(_184){this.element=$(_184);}else{this.element=SPAN(null,_186);}
this.label=_185||"";this.inputs=_186||[];this.flow=flow||"horizontal";};UI.FormItem.prototype={"render":function(){var _188=filter(function(el){return el.nodeType>0;},this.element.childNodes);if(_188&&_188.length){var _189={"class":"noborderspace"};if(this.flow=="horizontal"){this.element.appendChild(TABLE(_189,TBODY(null,TR(_189,map(partial(TD,_189),_188)))));}else{this.element.appendChild(TABLE(_189,TBODY(null,map(function(el){return TR(_189,TD(_189,el));},_188))));}}
return TR(null,TD({"align":"right"},LABEL(null,this.label!=""?this.label+":":"")),TD(null,this.element));}};UI.FormInput=function(_190,_191){bindMethods(this);if(_190){this.element=$(_190);}else{this.element=INPUT();}
this.validators=_191;this.cssClass="uiforminput";this.valid=true;this.tip=null;this.register();this._connectEvents();};UI.FormInput.prototype=update(new UI.Widget(),{"validate":function(){var _192=this.element;this.unmarkError();this.valid=true;if(!this.validators){return;}
for(var i=0;i<this.validators.length;i++){var msg=this.validators[i](this.element);if(msg&&(msg!=UI.Form.VALIDATION_PASSED)){this.markError(msg);return false;}}
return true;},"markError":function(msg){addElementClass(this.element,"uierror");var _193=elementPosition(this.element);var _194=elementDimensions(this.element);if(typeof(_193.x)!="undefined"&&typeof(_194.w)!="undefined"){this.tip=DIV({"class":"uitip"},DIV({"class":"uiarrow"}),DIV({"class":"uimsg"},msg));this.tip.style.left=(_193.x+_194.w)+"px";this.tip.style.top=(_193.y)+"px";hideElement(this.tip);document.getElementsByTagName("body")[0].appendChild(this.tip);connect(this.element,"onmouseover",this,"showTip");connect(this.element,"onmouseout",this,"hideTip");}else{logWarning("FormInput.markError: Can't get element position and/or dimensions");}
this.valid=false;},"showTip":function(){showElement(this.tip);},"hideTip":function(){hideElement(this.tip);},"unmarkError":function(){removeElementClass(this.element,"uierror");if(this.tip){disconnect(this.element,"onmouseover",this,"showTip");disconnect(this.element,"onmouseout",this,"hideTip");removeElement(this.tip);this.tip=null;this.element.onmouseover=null;this.element.onmouseout=null;}},"_connectEvents":function(){if(!this.element){return;}
var _195=this.element.onblur;var _196=this.element.onfocus;var _197=this;this.element.onblur=function(){_197.validate();if(_195){_195.apply(this.element,arguments);}};this.element.onfocus=function(){_197.unmarkError();if(_196){_196.apply(this.element,arguments);}};}});UI.SelectFormInput=function(_198,_199,_200){bindMethods(this);this._model=null;if(_198){this.element=_198;}else{this.element=SELECT();}
this.element=$(_198);this.cssClass="uiselectforminput";this.register();this.setModel(_200);};UI.SelectFormInput.prototype=update(new UI.FormInput(),{"setModel":function(_201){disconnect(this.model,"changed",this,"render");this._model=_201;this.render();connect(_201,"changed",this,"render");},"model":function(){return this._model;},"render":function(){replaceChildNodes(this.element,[]);for(var i=0;i<this._model.getLength();i++){this.element.appendChild(OPTION({"value":this._model.getValue(i)},this._model.getLabel(i)));}}});UI.Form.Validators={};UI.Form.Validators.required=function(el){return el.value.match(/^\s*$/)?UI.Form.Messages.REQUIRED:UI.Form.VALIDATION_PASSED;};UI.Form.Validators.regexp=function(re,msg){return function(el){return el.value.match(re)?UI.Form.VALIDATION_PASSED:msg||UI.Form.Messages.NOT_VALID;};};UI.Form.Validators.numeric=function(el){var val=el.value.replace(/,/,"").replace(/\./,"");return(isNaN(val))?UI.Form.Messages.NUMBER:UI.Form.VALIDATION_PASSED;};UI.Form.Validators.alpha=UI.Form.Validators.regexp(/^[A-Za-záéíóúñ]*$/,UI.Form.Messages.ALPHA);UI.Form.Validators.alphaspaces=UI.Form.Validators.regexp(/^[A-Za-záéíóúñ\s]*$/,UI.Form.Messages.ALPHASPACES);UI.Form.Validators.alphanum=UI.Form.Validators.regexp(/^[0-9A-Za-áéíóúñ]*$/,UI.Form.Messages.ALPHANUM);UI.Form.Validators.alphanumspaces=UI.Form.Validators.regexp(/^[0-9A-Za-záéíóúñ\s]*$/,UI.Form.Messages.ALPHANUMSPACES);UI.Form.Validators.email=UI.Form.Validators.regexp(/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[A-Za-z]{2,4}$/,UI.Form.Messages.EMAIL);UI.FormInput._getValidators=function(el){var _203=el.getAttribute("ui:validators");if(_203){with(UI.Form.Validators){_203=eval("("+_203+")");}}else{_203=[];}
return _203;};UI.FormInput._fromElement=function(el){return new UI.FormInput(el,UI.FormInput._getValidators(el));};UI.SelectFormInput._fromElement=function(el){var _204=el.getAttribute("ui:model");if(_204){_204=eval("("+_204+")");return new UI.SelectFormInput(el,UI.FormInput._getValidators(el),_204);}else{_204=new UI.HTMLSelectListModel(el.cloneNode(true));var _205=new UI.SelectFormInput(el,UI.FormInput._getValidators(el),_204);_205.render();return _205;}};UI.FormItem._fromElement=function(el){var _206=getNodeAttribute(el,"ui:label");var _207=[];if(el.tagName.toLowerCase()=="input"){_207.push(UI.FormInput._fromElement(el));}else{if(el.tagName.toLowerCase()=="select"){_207.push(UI.SelectFormInput._fromElement(el));}else{if(el.tagName.toLowerCase()=="textarea"){_207.push(UI.FormInput._fromElement(el));}}}
var _208=el.getElementsByTagName("input");if(_208&&_208.length){_207=_207.concat(map(UI.FormInput._fromElement,_208));}
var _209=el.getElementsByTagName("textarea");if(_209&&_209.length){_207=_207.concat(map(UI.FormInput._fromElement,_209));}
var _210=el.getElementsByTagName("select");if(_210&&_210.length){_207=_207.concat(map(function(_211){s=UI.SelectFormInput._fromElement(_211);},_210));}
return new UI.FormItem(el,_206,_207);};UI.Form._fromElement=function(el){var _212=getNodeAttribute(el,"ui:keeplayout");_212=(_212&&(_212=="true"));var _213=getNodeAttribute(el,"ui:validators");if(_213){with(UI.Form.Validators){_213=eval("("+_213+")");}}else{_213=[];}
var _214=filter(function(el){return el.nodeType==1;},el.childNodes);var form=new UI.Form(el,map(UI.FormItem._fromElement,_214),_213);if(!_212){form.render();}
return form;};UI.Accordion=function(_215,_216){bindMethods(this);_215=_215||this._defaultElement();if(_216==null||typeof(_216)=="undefined"){_216=false;}
if(_215){this.element=$(_215);}else{this.element=this._defaultElement();}
this.element=$(_215);this.multipleExpansion=_216;this.elements=filter(this._elementNode,iter(this.element.childNodes));var _217=this._elementNode;forEach(this.elements,function(el){addElementClass(el,"uiaccordiontitle");var _218=filter(_217,el.childNodes);addElementClass(_218[0],"uiaccordiontitlebar");_218.splice(0,1);forEach(_218,function(_219){addElementClass(_219,"uiaccordioncontent");hideElement(_219);});});this._installOnClicks();this.activeElements=[];this.cssClass="uiaccordion";this.collapseAll();this.register();this.NAME=this.element.id+"(UI.Accordion)";};UI.Accordion.prototype=update(new UI.Widget(),{"setMultipleExpansion":function(_220){this.multipleExpansion=_220;if(!_220&&this.activeElements.length>1){this.collapseAll();}},"expand":function(_221){var _222=filter(this._elementNode,_221.childNodes);addElementClass(_222[0],"uiexpanded");_222.splice(0,1);forEach(_222,showElement);var _223=findIdentical(this.activeElements,_221);if(_223==-1){this.activeElements.push(_221);}
if(!this.multipleExpansion&&this.activeElements.length>1){this.collapse(this.activeElements[0]);}},"expandAll":function(){if(!this.multipleExpansion){logError("UI.Accordion.expandAll: Can't expand all elements if not in multipleExpansion mode");return;}
forEach(this.elements,this.expand);},"collapse":function(_224){var _225=filter(this._elementNode,_224.childNodes);removeElementClass(_225[0],"uiexpanded");_225.splice(0,1);forEach(_225,hideElement);var _226=findIdentical(this.activeElements,_224);if(_226!=-1){this.activeElements.splice(_226,1);}else{logWarning("UI.Accordion.collapse: collapsing a non-expanded element!?");}},"collapseAll":function(){forEach(extend(null,this.activeElements),this.collapse);},"_defaultElement":function(){return DIV({"class":"uiaccordion"});},"_installOnClicks":function(){var _227=this;forEach(this._titleBars(),function(_228){connect(_228,"onclick",function(e){var _229=findIdentical(_227.activeElements,_228.parentNode);if(_229==-1){_227.expand(_228.parentNode);}else{_227.collapse(_228.parentNode);}});});},"_elementNode":function(el){return el.nodeType==1;},"_firstChildElement":function(el){return filter(this._elementNode,el.childNodes)[0];},"_titleBars":function(){return map(this._firstChildElement,this.elements);}});UI.Accordion._fromElement=function(el){var _230=(getNodeAttribute(el,"ui:multiple")=="true");new UI.Accordion(el,_230);};addLoadEvent(function(){var _231=getElementsByTagAndClassName("div","uislider");map(UI.Slider._fromElement,_231);var _232=getElementsByTagAndClassName("div","uitable");map(UI.Table._fromElement,_232);var _233=getElementsByTagAndClassName("form","uiform");map(UI.Form._fromElement,_233);var _234=getElementsByTagAndClassName("div","uiwindow");map(UI.Window._fromElement,_234);var _235=getElementsByTagAndClassName("div","uiaccordion");map(UI.Accordion._fromElement,_235);});function MessagePanel(elmPanel,displayTime){this.elmPanel=getElement(elmPanel);this.connect();}
MochiKit.Base.update(MessagePanel.prototype,{connectIds:null,elmPanel:null,timeoutId:-1,displayTime:2,connect:function(){this.connectIds=[connect(this.elmPanel,'onclick',this,'onClick')]},disconnect:function(){forEach(this.connectIds,disconnect);this.connectIds=[];},show:function(message,stickyOrTime){clearTimeout(this.timeoutId);var elmPanel=this.elmPanel;elmPanel.innerHTML=message;appear(elmPanel,{to:0.85,duration:0.5});if(typeof(stickyOrTime)=='number'){this.waitAndHide(stickyOrTime);}else if(stickyOrTime==null||!stickyOrTime){this.waitAndHide();}},hide:function(){setTimeout(partial(fade,this.elmPanel),0);},onClick:function(evt){this.hide();},waitAndHide:function(time){time=time||this.displayTime;clearTimeout(this.timeoutId);this.timeoutId=setTimeout(bind('hide',this),time*1000);}})
function KeyRegistry(){this.handlers=[];this.register.apply(this,arguments);}
MochiKit.Base.update(KeyRegistry,{MODIFIER_KEYS:createSet('ALT CTRL SHIFT'),getKeyString:function(evt){var keys=[];var mod=evt.modifier();mod.shift&&keys.push('SHIFT');mod.ctrl&&keys.push('CTRL');mod.alt&&keys.push('ALT');var key=evt.key().string.replace(/^KEY_/,'');(key in KeyRegistry.MODIFIER_KEYS)||keys.push(key);return keys.join('+');},keyChecker:function(expected){if(typeof(expected)=='function')
return expected;expected=[].concat(expected);return function(target,evt,key){for(var i in expected)
if(expected[i]==key)
return true;return false;}},createHelp:function(handler){return{keys:handler.keys,message:getMessage('help.'+handler.name)};}});MochiKit.Base.update(KeyRegistry.prototype,{help:function(key){return key?KeyRegistry.createHelp(this.findHandlerByKey(key)):map(KeyRegistry.createHelp,this.handlers);},add:function(keyOrName,newKey,swap){var handler=this.findHandlerByKey(keyOrName);if(handler){if(swap)
handler.keys.splice(indexOf(handler.keys,keyOrName),1);}else{handler=this.findHandlerByName(keyOrName);if(swap)
handler.keys=[];}
this.remove(newKey);handler.keys.push(newKey);handler.check=KeyRegistry.keyChecker(handler.keys);},swap:function(keyOrName,newKey){this.add(keyOrName,newKey,true);},remove:function(keyOrName){if(this.findHandlerByName(keyOrName,true))
return;var handler=this.findHandlerByKey(keyOrName);if(!handler)
return;if(handler.keys.length==1){this.findHandlerByName(handler.name,true);return;}
handler.keys.splice(indexOf(handler.keys,keyOrName),1);handler.check=KeyRegistry.keyChecker(handler.keys);},getName:function(key){var handler=this.findHandlerByKey(key);return handler?handler.name:void(0);},findHandlerByName:function(name,pop){var handlers=this.handlers;for(var i in handlers)
if(handlers[i].name==name)
return pop?handlers.splice(i,1):handlers[i];return void(0);},findHandlerByKey:function(key,pop){key=key.toUpperCase();var handlers=this.handlers;for(var i in handlers)
if(indexOf(handlers[i].keys,key)!=-1)
return pop?handlers.splice(i,1):handlers[i];return void(0);},match:function(target,evt){if(evt.isStopped())return;var key=KeyRegistry.getKeyString(evt);for(var i=0,handlers=this.handlers,len=handlers.length;i<len;i++){if(handlers[i].check.call(this,target,evt,key)){if(handlers[i].action.call(this,target,evt,key)!=false)
evt.stop();return true;}}
return false;},register:function(name,keys,action){var defs=isArrayLike(name)?arguments:[[name,keys,action]];var handlers=this.handlers;forEach(defs,function(def){var keys=map(methodcaller('toUpperCase'),[].concat(def[1]));handlers.unshift({name:def[0],keys:keys,check:KeyRegistry.keyChecker(keys),action:def[2]});});}});function TabPanel(tabs){this.tabs=tabs;forEach(tabs,bind(function(tab){connect(tab,'onclick',this,'onClick');},this));}
MochiKit.Base.update(TabPanel.prototype,{selected:null,tabs:null,onClick:function(evt){var elmTab=evt.target();if(this.selected==elmTab)return;this.selectTab(elmTab);},selectTab:function(elmTab){elmTab=getElement(elmTab);try{signal(this,'onChange',elmTab);}catch(e){if(e==CancelEvent)return;throw e;}
removeElementClass(this.selected,'selected')
addElementClass(elmTab,'selected');this.selected=elmTab;},getSelectedTabId:function(){return this.selected?this.selected.id:'';},nextTab:function(){this.rollTab(1);},previousTab:function(){this.rollTab(-1);},rollTab:function(amount){var len=this.tabs.length;this.selectTab(this.tabs[(this.getCurrentIndex()+amount+len)%len]);},getCurrentIndex:function(){var tabs=this.tabs;for(var i=0;i<tabs.length;i++)
if(tabs[i]==this.selected)
return i;}});
