
CERNY.require("CERNY.js.Array");(function(){var check=CERNY.check;var method=CERNY.method;var pre=CERNY.pre;var signature=CERNY.signature;CERNY.js.Array={};Array.prototype.logger=CERNY.Logger("CERNY.js.Array");function map(func){var result=[];for(var i=0,l=this.length;i<l;i++){result.push(func(this[i]));}
return result;};signature(map,Array,"function");method(Array.prototype,"map",map);function append(array){if(array){for(var i=0,l=array.length;i<l;i++){this.push(array[i]);}}};signature(append,"undefined",["null","undefined",Array]);method(Array.prototype,"append",append);if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i];}
return this.length;};}
function filter(predicate){var result=[],i=this.length,item;while(i--){item=this[i];if(predicate(item)){result.unshift(item);}}
return result;};signature(filter,Array,"function");method(Array.prototype,"filter",filter);function copy(){return this.filter(function(){return true;});};signature(copy,Array);method(Array.prototype,"copy",copy);function indexOf(item,cmpFunc){if(!cmpFunc){cmpFunc=function(a,b){return a==b;};}
var i=this.length;while(i--){if(cmpFunc(this[i],item)){return i;}}
return-1;};signature(indexOf,"number","any",["undefined","function"]);method(Array.prototype,"indexOf",indexOf);function contains(item,cmpFunc){return this.indexOf(item,cmpFunc)>=0;}
signature(contains,"boolean","any",["undefined","function"]);method(Array.prototype,"contains",contains);function remove(item,cmpFunc){var i=this.indexOf(item,cmpFunc);if(i>=0){this.splice(i,1);}
return i;};signature(remove,"number","any",["undefined","function"]);method(Array.prototype,"remove",remove);function replace(replaced,replacing,cmpFunc){var i=this.indexOf(replaced,cmpFunc);if(i<0){this.push(replacing);}else{this.splice(i,1,replacing);}};signature(replace,"undefined","any","any",["undefined","function"]);method(Array.prototype,"replace",replace);function isSubArray(array,cmpFunc){for(var i=0,l=this.length;i<l;i++){if(array.indexOf(this[i],cmpFunc)<0){return false;}}
return true;};signature(isSubArray,"boolean",Array,["undefined","function"]);method(Array.prototype,"isSubArray",isSubArray);function equals(array,cmpFunc){if(this.length!=array.length){return false;}
for(var i=0,l=this.length;i<l;i++){if(array.indexOf(this[i],cmpFunc)!=i){return false;}}
return true;}
signature(equals,"boolean",Array,["undefined","function"]);method(Array.prototype,"equals",equals);function same(array,cmpFunc){if(this.length!=array.length){return false;}
return this.isSubArray(array,cmpFunc)&&array.isSubArray(this,cmpFunc);}
signature(same,"boolean",Array,["undefined","function"]);method(Array.prototype,"same",same);function intersect(array,cmpFunc){return this.filter(function(item){return array.contains(item,cmpFunc);});}
signature(intersect,Array,Array,["undefined","function"]);method(Array.prototype,"intersect",intersect);function overlaps(array,cmpFunc){return this.intersect(array,cmpFunc).length>0;}
signature(overlaps,"boolean",Array,["undefined","function"]);method(Array.prototype,"overlaps",overlaps);function insertAt(index,item){var moverCount=this.length-index;if(moverCount>0){this.append(this.splice(index,moverCount,item));}else{this[index]=item;}}
signature(insertAt,"undefined","number","any");method(Array.prototype,"insertAt",insertAt);pre(insertAt,function(index,item){check(index>=0,"index must be bigger than or equal to 0.");});function getInsertionIndex(item,comperator){var i=0;var l=this.length;while(i<l&&comperator(this[i],item)<1){i+=1;}
return i;}
signature(getInsertionIndex,"number","any","function");method(Array.prototype,"getInsertionIndex",getInsertionIndex);function sortedInsert(item,comperator){var position=this.getInsertionIndex(item,comperator);this.insertAt(position,item);return position;}
signature(sortedInsert,"number","any","function");method(Array.prototype,"sortedInsert",sortedInsert);function unique(cmpFunc){var result=[],item,i=this.length;while(i--){item=this[i];if(!result.contains(item,cmpFunc)){result.unshift(item);}}
return result;}
signature(unique,Array,["function","undefined"]);method(Array.prototype,"unique",unique);function pushUnique(item,cmpFunc){if(!this.contains(item,cmpFunc)){this.push(item);return true;}
return false;}
signature(pushUnique,"boolean","any",["function","undefined"]);method(Array.prototype,"pushUnique",pushUnique);function removeAll(){var i=this.length;while(i--){this.pop();}}
signature(removeAll,"undefined");method(Array.prototype,"removeAll",removeAll);})();CERNY.require("CERNY.js.String");(function(){var method=CERNY.method;var signature=CERNY.signature;CERNY.js.String={};String.prototype.logger=CERNY.Logger("CERNY.js.String");function entityify(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");}
signature(entityify,"string");method(String.prototype,"entityify",entityify);function trim(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");}
signature(trim,"string");method(String.prototype,"trim",trim);function pad(padChr,length,front){padChr=padChr.substring(0,1);if(!isBoolean(front)){front=true;}
var padSize=length-this.length;if(padSize>0){var padStr="";for(var i=0;i<padSize;i++){padStr+=padChr;}
if(front){return padStr+this;}
return this+padStr;}
return""+this;}
signature(pad,"string","string","number",["undefined","boolean"]);method(String.prototype,"pad",pad);})();function isNonEmptyString(s){return!isNull(s)&&isString(s)&&s.trim().length>0;}
CERNY.namespace("util");CERNY.require("CERNY.util","CERNY.js.Array","CERNY.js.String");(function(){var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("CERNY.util");CERNY.util.logger=logger;function indent(indentation){var result="\n";for(var i=0;i<indentation;i++){result+=" ";}
return result;};method(CERNY.util,"indent",indent);signature(indent,"string","number");function fillNumber(number){var str=number.toString();return str.pad("0",2);};method(CERNY.util,"fillNumber",fillNumber);signature(fillNumber,"string","number");function cutNumber(number,size){var str=""+number.toString();return str.slice(str.length-size,str.length);};method(CERNY.util,"cutNumber",cutNumber);signature(cutNumber,"string","number","number");function escapeStrForRegexp(str){if(str=="."){return'\\'+str;}
return str;};method(CERNY.util,"escapeStrForRegexp",escapeStrForRegexp);signature(escapeStrForRegexp,"string","string");function parseUri(uri){var r=new RegExp(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/);var m=r.exec(uri);var ensure=function(_str){return _str!=null?_str:"";}
var i={};i.scheme=ensure(m[2]);i.authority=ensure(m[4]);i.path=ensure(m[5]);i.query=ensure(m[7]);i.fragment=ensure(m[9]);var ra=new RegExp(/^(([^@]+)@)?([^:]+)(:([0-9]*))?/);var ma=ra.exec(i.authority);if(ma){i.userinfo=ensure(ma[2]);i.host=ensure(ma[3]);i.port=ensure(ma[5]);}
i.path_segments=i.path.replace(/^\//,"").split("/");return i;};method(CERNY.util,"parseUri",parseUri);signature(parseUri,"object","string");function getNameFromFqName(fqName){var lastSegment=fqName.split("\.").pop();if(lastSegment.indexOf("_")>=0){lastSegment=lastSegment.split("_").pop();}
return lastSegment;}
method(CERNY.util,"getNameFromFqName",getNameFromFqName);signature(getNameFromFqName,"string","string");function getUriParameters(uri){if(!uri){uri=document.URL;}
var result={};var query=parseUri(uri).query;var parts=query.split("&");parts.map(function(part){var array=part.split("=");var parameter=array[0];var value=array[1];var current=result[parameter];if(current){current.push(value);}else{result[parameter]=[decodeURIComponent(value)];}});return result;}
method(CERNY.util,"getUriParameters",getUriParameters);signature(getUriParameters,"object",["string","undefined"]);function getUriParameterValue(parameter,uri){if(!uri){uri=document.URL;}
var parameters=getUriParameters(uri);var value=parameters[parameter];if(!value){value=null;}else{if(value.length==1){value=value[0];}}
return value;}
method(CERNY.util,"getUriParameterValue",getUriParameterValue);signature(getUriParameterValue,["null","string",Array],["string"],["string","undefined"]);function compare(a,b){if(a==b)return 0;if(a>b)return 1;return-1;}
method(CERNY.util,"compare",compare);signature(compare,"number","any","any");function createComparator(order,compare){if(!compare){compare=CERNY.util.compare;}
return function(a,b){var indexA=order.indexOf(a);var indexB=order.indexOf(b);if(indexA<0){if(indexB<0){return compare(a,b);}
return 1;}
if(indexB<0){return-1;}
return compare(indexA,indexB);}}
method(CERNY.util,"createComparator",createComparator);signature(createComparator,"function",Array,["undefined","function"]);function escapeHtml(str){return str.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");}
method(CERNY.util,"escapeHtml",escapeHtml);signature(escapeHtml,"string","string");})();CERNY.require("TOPINCS.cons","CERNY.util");if(!TOPINCS.cons){TOPINCS.namespace("cons");}
(function(){var info=CERNY.util.parseUri(document.URL);TOPINCS.BASE=getBase();TOPINCS.HOST=info.scheme+"://"+info.host;if(info.port){TOPINCS.HOST+=":"+info.port;}
TOPINCS.UI_LANGUAGE=TOPINCS.UI_LANGUAGE||"en";function getBase(){var base="";for(var i=0;i<info.path_segments.length-1;i++){base+="/"+info.path_segments[i];}
if(typeof REMOVE_FROM_BASE_DIR=="string"){base=base.replace(REMOVE_FROM_BASE_DIR,"");}
return base;}})();var MAPS="topicmaps/";var LOGIN_URL=".login";var CORE_TOPICS_URL="4.4.0/.core-topics";var CORE_TOPICS_URL_NO_CACHED=".core-topics";var ROLES_URL="associations/.roles";var POSSIBLE_ROLE_TYPES_URL="roles/.possible-types";var POSSIBLE_OCCURRENCE_TYPES_URL="occurrences/.possible-types";var POSSIBLE_NAME_TYPES_URL="names/.possible-types";var POSSIBLE_PLAYERS_URL="roles/.possible-players";var TOOLS_URL=".tools";var TOPIC_SEARCH_URL="topics/.search";var WIKI_SEARCH_URL="wiki/.search";var WIKI_CHANGES_URL="wiki/.changes";var TOPIC_LABEL_URL="topics/.label";var TOPIC_DESCRIPTION_URL="topics/.description";var DATATYPES_URL="occurrences/.datatypes";var ROLES_SEARCH_URL="roles/.search";var TOPICMAPS_CONTENT_URL="topicmaps/.content";var TOPIC_LOCATE_URL="topics/.locate";var TOPIC_USAGE_URL="topics/.usage";var JOURNAL_URL=".journal";var META_URL=".meta";var POSSIBLE_SCOPING_TOPINCS_URL=".possible-scoping-topics";var CONSTRAINTS_URL=".constraints";var RANGE_URL="roles/.range";var TOPIC_PROXY_URL="topics/.proxy";var RESOLVE_URL="topics/.resolve";var ALLOWED_LIST_TYPES_URL="occurrences/.allowed-list-types";var USERS_URL=TOPINCS.BASE+"/users/";var INCLUDE_URL="wiki/.include";var ACCEPT_SCOPE="";var USCOPE="uc";var ASCOPE="*";var DT_SCHEMA="http://www.w3.org/2001/XMLSchema#";var DT_STRING=DT_SCHEMA+"string";var DT_NORMALIZEDSTRING=DT_SCHEMA+"normalizedString";var DT_TOKEN=DT_SCHEMA+"token";var DT_BASE64BINARY=DT_SCHEMA+"base64Binary";var DT_HEXBINARY=DT_SCHEMA+"hexBinary";var DT_INTEGER=DT_SCHEMA+"integer";var DT_POSITIVEINTEGER=DT_SCHEMA+"positiveInteger";var DT_NEGATIVEINTEGER=DT_SCHEMA+"negativeInteger";var DT_NONNEGATIVEINTEGER=DT_SCHEMA+"nonNegativeInteger";var DT_NONPOSITIVEINTEGER=DT_SCHEMA+"nonPositiveInteger";var DT_LONG=DT_SCHEMA+"long";var DT_UNSIGNEDLONG=DT_SCHEMA+"unsignedLong";var DT_INT=DT_SCHEMA+"int";var DT_UNSIGNEDINT=DT_SCHEMA+"unsignedInt";var DT_SHORT=DT_SCHEMA+"short";var DT_UNSIGNEDSHORT=DT_SCHEMA+"unsignedShort";var DT_BYTE=DT_SCHEMA+"byte";var DT_UNSIGNEDBYTE=DT_SCHEMA+"unsignedByte";var DT_DECIMAL=DT_SCHEMA+"decimal";var DT_FLOAT=DT_SCHEMA+"float";var DT_DOUBLE=DT_SCHEMA+"double";var DT_BOOLEAN=DT_SCHEMA+"boolean";var DT_DURATION=DT_SCHEMA+"duration";var DT_DATETIME=DT_SCHEMA+"dateTime";var DT_DATE=DT_SCHEMA+"date";var DT_TIME=DT_SCHEMA+"time";var DT_GYEAR=DT_SCHEMA+"gYear";var DT_GYEARMONTH=DT_SCHEMA+"gYearMonth";var DT_GMONTH=DT_SCHEMA+"gMonth";var DT_GMONTHDAY=DT_SCHEMA+"gMonthDay";var DT_GDAY=DT_SCHEMA+"gDay";var DT_NAME=DT_SCHEMA+"Name";var DT_QNAME=DT_SCHEMA+"QName";var DT_NCNAME=DT_SCHEMA+"NCName";var DT_ANYURI=DT_SCHEMA+"anyURI";var DT_LANGUAGE=DT_SCHEMA+"language";var DT_ID=DT_SCHEMA+"ID";var DT_IDREF=DT_SCHEMA+"IDREF";var DT_IDREFS=DT_SCHEMA+"IDREFS";var DT_ENTITY=DT_SCHEMA+"ENTITY";var DT_ENTITIES=DT_SCHEMA+"ENTITIES";var DT_NOTATION=DT_SCHEMA+"NOTATION";var DT_NMTOKEN=DT_SCHEMA+"NMTOKEN";var DT_NMTOKENS=DT_SCHEMA+"NMTOKENS";var DT_ANYTYPE=DT_SCHEMA+"anyType";var DT_TOPIC_REFERENCE_LIST="http://www.topincs.com/topincs/topic-reference-list";var DT_VALUE_LIST="http://www.topincs.com/topincs/value-list";var DT_WIKIMARKUP="http://tmwiki.org/psi/wiki-markup";var DT_CTM_INTEGER="http://www.topincs.com/topincs/tmcl/2009-10-19/integer";var MEDIA_TYPE_JSON="application/json";var MEDIA_TYPE_XTM="application/xtm+xml;1.0";var MEDIA_TYPE_XTM_2_0="application/xtm+xml;2.0";var MEDIA_TYPE_XTM_2_1="application/xtm+xml;2.1";var MEDIA_TYPE_TOPIC_PROXY_ARRAY="application/topicproxyarray+topincs+json";var MEDIA_TYPE_ROLE_TYPE_PROXY_ARRAY="application/roletypeproxyarray+topincs+json";var MEDIA_TYPE_ROLE_PROXY_ARRAY="application/roleproxyarray+topincs+json";var MEDIA_TYPE_TOPINCS_TOOL_ARRAY="application/topincstoolarray+topincs+json";var MEDIA_TYPE_STORE_SEARCH_RESULT="application/storesearchresult+topincs+json";var MEDIA_TYPE_STORE_SEARCH_RESULT_V2="application/storesearchresult+topincs+json;v2";var MEDIA_TYPE_CORE_TOPIC_PROXY_MAP="application/coretopicproxymap+topincs+json";var MEDIA_TYPE_DATATYPE_ARRAY="application/datatypearray+topincs+json";var MEDIA_TYPE_RECENT_CHANGES="application/recentchanges+topincs+json";var MEDIA_TYPE_ITEM_META_INFORMATION="application/itemmetainformation+topincs+json";var MEDIA_TYPE_NODE="application/node+topincs+json";var MEDIA_TYPE_JTM="application/jtm+json";var MEDIA_TYPE_JTM_1_0="application/jtm+json";var FORMAT_XTM_1_0="xtm-1.0";var FORMAT_XTM_2_0="xtm-2.0";var FORMAT_XTM_2_1="xtm-2.1";var FORMAT_JTM_1_0="jtm-1.0";var IMPORT_SOURCE_URL="URL";var IMPORT_SOURCE_FILE="File";var COOKIE_CONFIGURATION="topincs.editor.conf";var HREF_VOID="javascript:void(null)";var PSI_TYPE_INSTANCE="http://psi.topicmaps.org/iso13250/model/type-instance";var PSI_INSTANCE="http://psi.topicmaps.org/iso13250/model/instance";var PSI_TYPE="http://psi.topicmaps.org/iso13250/model/type";var PSI_TOPIC_TYPE="http://psi.topincs.com/iso13250/topic-type";var PSI_LANG_BASE="http://www.topicmaps.org/xtm/1.0/language.xtm#";CERNY.require("CERNY.text.DateFormat","CERNY.util");(function(){var cutNumber=CERNY.util.cutNumber;var fillNumber=CERNY.util.fillNumber;var identity=CERNY.identity;var signature=CERNY.signature;CERNY.text.DateFormat=DateFormat;function DateFormat(regexp){var self=CERNY.object();self.regexp=regexp;self.separator="";self.positions={day:1,month:2,year:3};self.formatters={day:identity,month:identity,year:identity};self.century=20;return self;};signature(DateFormat,"object",RegExp);function cutLast2(x){return cutNumber(x,2);};var formatters1={day:fillNumber,month:fillNumber,year:identity};var formatters2={day:fillNumber,month:fillNumber,year:cutLast2};var formatters3={day:identity,month:identity,year:cutLast2};DateFormat.DE=DateFormat(/(\d\d)\.(\d\d)\.(\d\d\d\d)/);DateFormat.DE.separator=".";DateFormat.DE.formatters=formatters1;DateFormat.DE1=DateFormat(/(\d\d).(\d\d).(\d\d)/);DateFormat.DE1.separator=".";DateFormat.DE1.formatters=formatters2;DateFormat.DE2=DateFormat(/(\d\d)(\d\d)(\d\d\d\d)/);DateFormat.DE2.formatters=formatters1;DateFormat.DE3=DateFormat(/(\d\d)(\d\d)(\d\d)/);DateFormat.DE3.formatters=formatters2;DateFormat.DE4=DateFormat(/(\d\d?)\.(\d\d?)\.(\d\d\d\d)/);DateFormat.DE4.separator=".";DateFormat.DE5=DateFormat(/(\d\d?)\.(\d\d?)\.(\d\d)/);DateFormat.DE5.separator=".";DateFormat.DE5.formatters=formatters3;var positionsUS={month:1,day:2,year:3};DateFormat.US=DateFormat(/(\d\d)\/(\d\d)\/(\d\d\d\d)/);DateFormat.US.separator="/";DateFormat.US.positions=positionsUS;DateFormat.US.formatters=formatters1;DateFormat.US1=DateFormat(/(\d\d)\/(\d\d)\/(\d\d)/);DateFormat.US1.separator="/";DateFormat.US1.positions=positionsUS;DateFormat.US1.formatters=formatters2;DateFormat.US2=DateFormat(/(\d\d)(\d\d)(\d\d\d\d)/);DateFormat.US2.positions=positionsUS;DateFormat.US2.formatters=formatters1;DateFormat.US3=DateFormat(/(\d\d)(\d\d)(\d\d)/);DateFormat.US3.positions=positionsUS;DateFormat.US3.formatters=formatters2;DateFormat.US4=DateFormat(/(\d\d?)\/(\d\d?)\/(\d\d\d\d)/);DateFormat.US4.separator="/";DateFormat.US4.positions=positionsUS;DateFormat.US5=DateFormat(/(\d\d?)\/(\d\d?)\/(\d\d)/);DateFormat.US5.separator="/";DateFormat.US5.positions=positionsUS;DateFormat.US5.formatters=formatters3;var positionsISO={year:1,month:2,day:3};DateFormat.ISO=DateFormat(/(\d\d\d\d)-(\d\d)-(\d\d)/);DateFormat.ISO.separator="-";DateFormat.ISO.positions=positionsISO;DateFormat.ISO.formatters=formatters1;DateFormat.ISO1=DateFormat(/(\d\d\d\d)(\d\d)(\d\d)/);DateFormat.ISO1.positions=positionsISO;DateFormat.ISO1.formatters=formatters1;var positionsFrance={day:1,month:2,year:3};DateFormat.FR=DateFormat(/(\d\d)\/(\d\d)\/(\d\d\d\d)/);DateFormat.FR.separator="/";DateFormat.FR.positions=positionsFrance;DateFormat.FR.formatters=formatters1;DateFormat.FR1=DateFormat(/(\d\d)\/(\d\d)\/(\d\d)/);DateFormat.FR1.separator="/";DateFormat.FR1.positions=positionsFrance;DateFormat.FR1.formatters=formatters2;})();CERNY.require("CERNY.text.NumberFormat","CERNY.util");(function(){var signature=CERNY.signature;var escapeStrForRegexp=CERNY.util.escapeStrForRegexp;CERNY.text.NumberFormat=NumberFormat;function NumberFormat(){var self=CERNY.object();self.separators={grouping:"",decimal:","};self.digits={grouping:null,fraction:null};self.init=init;self.parse=parse;return self;};signature(NumberFormat,"object");function init(){var r="";if(!this.digits.grouping){r="\\d+";}else{rFirstGroup="\\d{1,"+this.digits.grouping+"}";rOtherGroups="\\d{"+this.digits.grouping+"}";r=rFirstGroup+"("+escapeStrForRegexp(this.separators.grouping)+rOtherGroups+")*";}
var decimalSeparator=escapeStrForRegexp(this.separators.decimal);if(!this.digits.fraction){r=r+"("+decimalSeparator+"\\d*)?";}else{r=r+decimalSeparator+"\\d{"+this.digits.fraction+"}";}
this.regexp=new RegExp("^[+-]?"+r+"$");};function parse(numStr,_type){_type=(_type=="Float"||_type=="Int")?_type:"Float";var num=numStr;if(this.separators.grouping!=""){var regexp=escapeStrForRegexp(this.separators.grouping);num=num.replace(new RegExp(regexp,"g"),"");}
var regexp=escapeStrForRegexp(this.separators.decimal);num=num.replace(new RegExp(regexp),".");var func="parse"+_type;return eval(func)(num);};signature(parse,"number","string","string");NumberFormat.DE=NumberFormat();NumberFormat.DE.separators={grouping:"",decimal:","};NumberFormat.DE.init();NumberFormat.DE1=NumberFormat();NumberFormat.DE1.separators={grouping:".",decimal:","};NumberFormat.DE1.digits={grouping:3,fraction:2};NumberFormat.DE1.init();NumberFormat.DE2=NumberFormat();NumberFormat.DE2.separators={grouping:".",decimal:","};NumberFormat.DE2.digits={grouping:null,fraction:2};NumberFormat.DE2.init();NumberFormat.US=NumberFormat();NumberFormat.US.separators={grouping:"",decimal:"."};NumberFormat.US.init();})();CERNY.require("CERNY.js.Date","CERNY.util");(function(){var method=CERNY.method;var signature=CERNY.signature;var fillNumber=CERNY.util.fillNumber;CERNY.js.Date={};var TIMEZONE_OFFSET_PROPERTY_NAME="timezoneOffsetInMinutes";var LOCAL_TIMEZONE_OFFSET=new Date().getTimezoneOffset();var logger=CERNY.Logger("CERNY.js.Date");Date.prototype.logger=logger;Date.logger=logger;function formatDate(format,separator,timezoneFormat){var dateStr="<1>"+format.separator+"<2>"+format.separator+"<3>";var year=this.getFullYear();var month=this.getMonth()+1;var day=this.getDate();dateStr=dateStr.replace("<"+format.positions.year+">",format.formatters.year(year));dateStr=dateStr.replace("<"+format.positions.month+">",format.formatters.month(month));dateStr=dateStr.replace("<"+format.positions.day+">",format.formatters.day(day));var timezoneOffset=CERNY.js.Date.getTimezoneOffset(this);if(timezoneFormat&&timezoneOffset){dateStr+=separator+timezoneFormat.format(timezoneOffset);}
return dateStr;}
signature(formatDate,"String","object",["undefined","string"],["undefined","object"]);method(Date.prototype,"format",formatDate);method(Date.prototype,"formatDate",formatDate);function formatTime(timeFormat,separator,timezoneFormat){var result=timeFormat.format(this);var timezoneOffset=CERNY.js.Date.getTimezoneOffset(this);if(timezoneFormat&&timezoneOffset){result+=separator+timezoneFormat.format(timezoneOffset);}
return result;}
signature(formatTime,"string","object",["undefined","string"],["undefined","object"]);method(Date.prototype,"formatTime",formatTime);function formatDateTime(dateFormat,separator1,timeFormat,separator2,timezoneFormat){return this.formatDate(dateFormat)+separator1+this.formatTime(timeFormat,separator2,timezoneFormat);}
signature(formatDateTime,"string","object","string","object");method(Date.prototype,"formatDateTime",formatDateTime);function parseDate(dateStr,formats){if(!isArray(formats)&&isObject(formats)&&formats.regexp){formats=[formats];}
var match=null;var i=0;while(i<formats.length&&!match){match=dateStr.match(formats[i].regexp);if(match===null){i+=1;}}
if(match){var format=formats[i];var year=match[format.positions.year];var month=match[format.positions.month];var day=match[format.positions.day];year=(year>=100)?year:""+format.century+year;var date=new Date(year,month-1,day);var aYear=date.getFullYear();var aMonth=date.getMonth();var aDay=date.getDay();if(year==date.getFullYear()&&month==date.getMonth()+1&&day==date.getDate()){var tzdStr=extractTimezoneDesignator(dateStr);var offset=new Date().getTimezoneOffset();try{offset=CERNY.text.TimezoneFormat.ISO.parse(tzdStr);}catch(e){}finally{CERNY.js.Date.setTimezoneOffset(date,offset);}
return date;}}
return null;}
signature(parseDate,["null",Date],"string","object");method(Date,"_parse",parseDate);method(Date,"parseDate",parseDate);function parseTime(timeStr,timeFormat,date){return timeFormat.parse(timeStr,date);}
method(Date,"parseTime",parseTime);function parseDateTime(dateStr,dateFormat,timeStr,timeFormat){var date=Date._parse(dateStr,dateFormat);Date.parseTime(timeStr,timeFormat,date);return date;}
signature(parseDateTime,Date,"string");method(Date,"parseDateTime",parseDateTime);function getTimezoneOffset(date){if(date.hasOwnProperty(TIMEZONE_OFFSET_PROPERTY_NAME)){return date.timezoneOffsetInMinutes;}
return date.getTimezoneOffset();}
signature(getTimezoneOffset,Number,Date);method(CERNY.js.Date,"getTimezoneOffset",getTimezoneOffset);function setTimezoneOffset(date,timezoneOffset){date[TIMEZONE_OFFSET_PROPERTY_NAME]=timezoneOffset;}
signature(setTimezoneOffset,"undefined",Date,Number);method(CERNY.js.Date,"setTimezoneOffset",setTimezoneOffset);function convertToLocalTime(date){var currentTimezoneOffset=new Date().getTimezoneOffset();var dateTimezoneOffset=CERNY.js.Date.getTimezoneOffset(date);var differenceInMin=currentTimezoneOffset-dateTimezoneOffset;return new Date(date.getTime()+differenceInMin*60*1000);}
signature(convertToLocalTime,Date,Date);method(CERNY.js.Date,"convertToLocalTime",convertToLocalTime);function parseDateFragment(str,max,_default){str=str||_default;var n=new Number(str);if(n>=0&&n<=max){return n;}
throw new Error("Could not parse date fragment: '"+str+"'.");}
signature(parseDateFragment,"string","number",["undefined","string"]);method(CERNY.js.Date,"parseDateFragment",parseDateFragment);function extractTimezoneDesignator(str){var firstMatch=getFirstMatch(str.match(/Z|[+-][0-9][0-9]:[0-9][0-9]/));if(firstMatch){return firstMatch;}else{return"";}}
signature(extractTimezoneDesignator,["undefined","string"],"string");method(CERNY.js.Date,"extractTimezoneDesignator",extractTimezoneDesignator);function extractTime(str){return getFirstMatch(str.match(/^[0-9:]+/));}
signature(extractTime,["undefined","string"],"string");method(CERNY.js.Date,"extractTime",extractTime);function extractAmPm(timeStr){return getFirstMatch(timeStr.match(/am|pm|a\.m\.|p\.m\./));}
signature(extractAmPm,["undefined","string"],"string");method(CERNY.js.Date,"extractAmPm",extractAmPm);function isInLocalTimezone(date){return CERNY.js.Date.getTimezoneOffset(date)==LOCAL_TIMEZONE_OFFSET;}
signature(isInLocalTimezone,["boolean"],Date);method(CERNY.js.Date,"isInLocalTimezone",isInLocalTimezone);function getFirstMatch(matchResult){if(matchResult){return matchResult[0];}}})();CERNY.require("CERNY.text.TimezoneFormat","CERNY.util","CERNY.js.Date");(function(){CERNY.text.TimezoneFormat=TimezoneFormat;var fillNumber=CERNY.util.fillNumber;var parseDateFragment=CERNY.js.Date.parseDateFragment;var signature=CERNY.signature;var logger=CERNY.Logger("CERNY.text.TimezoneFormat");function TimezoneFormat(){var self=CERNY.object({});self.logger=logger;return self;};signature(TimezoneFormat,"object");function formatIso(timezoneOffset){if(isUndefined(timezoneOffset)||timezoneOffset==null){return"";}
if(timezoneOffset==0){return"Z";}
var i=timezoneOffset/60;var tzd="+";if(i>0){tzd="-";}
tzd+=fillNumber(Math.abs(i))+":00";return tzd;}
signature(formatIso,"string","number");function parseIso(tzd){if(tzd==""){return null;}
if(tzd=="Z"){return 0;}
if(tzd.length<2){throw new Error("Time zone designator is too short.");}
var sign=tzd.substr(0,1);if(sign!="+"&&sign!="-"){throw new Error("Time zone designator must have a + or - in the beginning.");}
var rest=tzd.substr(1);var segments=rest.split(":");var hours=parseDateFragment(segments[0],12);var minutes=parseDateFragment(segments[1],59,"0");var total=hours*60+minutes;if(sign=="+"){return total*(-1);}
return total;}
signature(parseIso,"number","string");TimezoneFormat.ISO=TimezoneFormat();TimezoneFormat.ISO.format=formatIso;TimezoneFormat.ISO.parse=parseIso;})();CERNY.require("CERNY.text.TimeFormat","CERNY.text.TimezoneFormat","CERNY.util","CERNY.js.Date","CERNY.js.String");(function(){CERNY.text.TimeFormat=TimeFormat;var extractAmPm=CERNY.js.Date.extractAmPm;var extractTime=CERNY.js.Date.extractTime;var extractTimezoneDesignator=CERNY.js.Date.extractTimezoneDesignator;var fillNumber=CERNY.util.fillNumber;var parseDateFragment=CERNY.js.Date.parseDateFragment;var signature=CERNY.signature;var TimezoneFormat=CERNY.text.TimezoneFormat;var logger=CERNY.Logger("CERNY.text.TimeFormat");var CURRENT_TIMEZONE_OFFSET=new Date().getTimezoneOffset();function TimeFormat(separator,ampm){var self=CERNY.object({});self.separator=separator||":";self.ampm=ampm||false;self.logger=logger;self.format=format;self.formatHours=formatHoursFill;self.formatMinutes=formatMinutes;self.formatSeconds=formatSeconds;self.formatAmPm=formatAmPm;self.parse=parseEurope;return self;};signature(TimeFormat,"object",["undefined","string"],["undefined","boolean"]);function format(date){var timeStr=this.formatHours(date.getHours());timeStr+=this.formatMinutes(date.getMinutes());timeStr+=this.formatSeconds(date.getSeconds());timeStr+=this.formatAmPm(date.getHours(),this.ampm);return timeStr;}
function adjustHour(hour,ampm){if(hour>12&&ampm){return hour-12;}
return hour;}
function formatHoursFill(hour){return fillNumber(adjustHour(hour,this.ampm));}
function formatHoursDonotFill(hour){return adjustHour(hour,this.ampm);}
function formatMinutes(minutes){return this.separator+fillNumber(minutes);}
function formatSeconds(seconds){return this.separator+fillNumber(seconds);}
function formatSecondsIfNotZero(seconds){if(seconds==0){return"";}
return this.separator+fillNumber(seconds);}
function formatAmPm(hour,ampm){if(!ampm){return"";}
if(hour>12){return" p.m.";}
return" a.m.";}
function parseEurope(str,date){return parseTime(this,str,date,false);}
function parseUs(str,date){return parseTime(this,str,date,true);}
function parseTime(t,str,date,us){date=date||new Date();str=str.trim();var timeStr=extractTime(str);var tzdStr=extractTimezoneDesignator(str);var pm,appStr;if(us){appStr=extractAmPm(str);if(!appStr){throw new Error("a.m. or p.m. must be present.");}
pm=(appStr.indexOf("p")==0);}
var restStr=str.replace(timeStr,"").replace(tzdStr,"");if(appStr){restStr=restStr.replace(appStr,"");}
if(restStr.match(/\S/)){throw Error("Unkown component in time string.");}
var segments=timeStr.split(t.separator);var hour;if(us){if(pm){hour=parseDateFragment(segments[0],11);hour+=12;}else{hour=parseDateFragment(segments[0],12);}}else{hour=parseDateFragment(segments[0],23);}
date.setHours(hour);date.setMinutes(parseDateFragment(segments[1],59,"0"));date.setSeconds(parseDateFragment(segments[2],59,"0"));var offset=new Date().getTimezoneOffset();try{offset=TimezoneFormat.ISO.parse(tzdStr);}catch(e){logger.debug("e: "+CERNY.dump(e));}finally{CERNY.js.Date.setTimezoneOffset(date,offset);}
return date;}
function dontFormat(){return"";}
TimeFormat.DE=TimeFormat();TimeFormat.DE1=TimeFormat();TimeFormat.DE1.formatHours=formatHoursDonotFill;TimeFormat.DE1.formatSeconds=formatSecondsIfNotZero;TimeFormat.DE2=TimeFormat();TimeFormat.DE2.formatHours=formatHoursDonotFill;TimeFormat.DE2.formatSeconds=dontFormat;TimeFormat.US=TimeFormat(":",true);TimeFormat.US.parse=parseUs;TimeFormat.US1=TimeFormat(":",true);TimeFormat.US1.formatHours=formatHoursDonotFill;TimeFormat.US1.formatSeconds=formatSecondsIfNotZero;TimeFormat.US1.parse=parseUs;TimeFormat.US2=TimeFormat(":",true);TimeFormat.US2.formatHours=formatHoursDonotFill;TimeFormat.US2.formatSeconds=dontFormat;TimeFormat.US2.parse=parseUs;TimeFormat.ISO=TimeFormat(":");})();CERNY.require("CERNY.util.Locale","CERNY.util","CERNY.text.DateFormat","CERNY.text.NumberFormat","CERNY.text.TimezoneFormat","CERNY.text.TimeFormat");(function(){CERNY.util.Locale=Locale;CERNY.util.FormatsMap=FormatsMap;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("CERNY.util.Locale");function Locale(language,country,formatsMap){formatsMap=formatsMap||FormatsMap.DEFAULT;this.language=language;this.country=country;this.formats=formatsMap.getFormats(country);}
function FormatsMap(formatsMap){var self=CERNY.object(formatsMap);method(self,"getFormats",getFormats);return self;}
function getFormats(country){if(this[country]){return this[country];}
return this["_default"];}
signature(getFormats,"undefined","string");FormatsMap.DEFAULT=FormatsMap({"_default":{decimal:CERNY.text.NumberFormat.DE,date:CERNY.text.DateFormat.DE,time:CERNY.text.TimeFormat.DE1,timeShort:CERNY.text.TimeFormat.DE,timezone:CERNY.text.TimezoneFormat.ISO},"DE":{decimal:CERNY.text.NumberFormat.DE,date:CERNY.text.DateFormat.DE,time:CERNY.text.TimeFormat.DE1,timeShort:CERNY.text.TimeFormat.DE,timezone:CERNY.text.TimezoneFormat.ISO},"US":{decimal:CERNY.text.NumberFormat.US,date:CERNY.text.DateFormat.US,time:CERNY.text.TimeFormat.US1,timeShort:CERNY.text.TimeFormat.US,timezone:CERNY.text.TimezoneFormat.ISO}});})();CERNY.require("TOPINCS.locale","CERNY.util.Locale","CERNY.text.TimeFormat","CERNY.text.DateFormat");(function(){TOPINCS.namespace("locale");var Locale=CERNY.util.Locale;function getLocale(){var browserLocale=window.navigator.language;browserLocale=browserLocale||window.navigator.userLanguage;browserLocale=browserLocale||"en_US";var country;var language=browserLocale.substr(0,2);if(browserLocale.length==5){country=browserLocale.substr(3,2);}else{country=language.toUpperCase();}
return new Locale(language,country);}
CERNY.method(TOPINCS,"getLocale",getLocale);})();CERNY.require("CERNY.dom");CERNY.namespace("dom");CERNY.dom.logger=CERNY.Logger("CERNY.dom");function isNode(a){return isObject(a)&&isNumber(a.nodeType);}
function isElement(a){return isNode(a)&&a.nodeType==1;}
function isTextNode(a){return isNode(a)&&a.nodeType==3;}
CERNY.require("CERNY.dom.Node","CERNY.dom");(function(){var method=CERNY.method;var signature=CERNY.signature;var pre=CERNY.pre;var post=CERNY.post;var check=CERNY.check;CERNY.dom.Node=function(nodeOrId){if(isUndefined(nodeOrId)){return this;}
if(nodeOrId instanceof CERNY.dom.Node){return nodeOrId;}
var node=nodeOrId;var id=nodeOrId;if(isString(id)){node=document.getElementById(id);if(node===null){throw new Error("Document does not contain element with id '"+id+"'");}}
if(isNode(node)){this.node=node;return this;}
throw new Error("No node");};signature(CERNY.dom.Node,"object",["string","object",CERNY.dom.Node,"undefined"],["boolean","undefined"]);CERNY.intercept(CERNY.dom,"Node");CERNY.dom.Node.prototype.logger=CERNY.Logger("CERNY.dom.Node");var getChildren=function(predicate){if(!predicate){predicate=isNode;}
var result=[];var children=this.node.childNodes;for(var i=0;i<children.length;i++){if(predicate(children[i])){result.push(children[i]);}}
return result;};signature(getChildren,Array,["function","undefined"]);method(CERNY.dom.Node.prototype,"getChildren",getChildren);var deleteChildren=function(predicate){if(!predicate){predicate=isNode;}
var children=this.node.childNodes;var count=0;for(var i=children.length;i>=0;i--){if(predicate(children[i])){this.node.removeChild(children[i]);count+=1;}}
return count;};signature(deleteChildren,"number",["function","undefined"]);CERNY.pre(deleteChildren,function(predicate){CERNY.check(isObject(this.node),"this.node must be present");});method(CERNY.dom.Node.prototype,"deleteChildren",deleteChildren);var countChildren=function(predicate){return this.getChildren(predicate).length;};signature(countChildren,"number",["function","undefined"]);method(CERNY.dom.Node.prototype,"countChildren",countChildren);var appendChild=function(node){if(isNode(node)){this.node.appendChild(node);}else if(isNode(node.node)){this.node.appendChild(node.node);}};signature(appendChild,"undefined",[CERNY.dom.Node,"object"]);method(CERNY.dom.Node.prototype,"appendChild",appendChild);var appendChildren=function(){for(var i=0;i<arguments.length;i++){this.appendChild(arguments[i]);}};signature(appendChildren,"undefined",[CERNY.dom.Node,"object"]);method(CERNY.dom.Node.prototype,"appendChildren",appendChildren);function getDescendants(predicate){var result=[];var children=this.getChildren();children.map(function(child){if(predicate(child)){result.push(child);}
result.append(new CERNY.dom.Node(child).getDescendants(predicate));});return result;}
signature(getDescendants,Array,["function","undefined"]);method(CERNY.dom.Node.prototype,"getDescendants",getDescendants);var getNthSibling=function(predicate,next,nth){var sibling=this.node;if(!isFunction(predicate)){predicate=isNode;}
if(!isBoolean(next)){next=true;}
if(!isNumber(nth)){nth=1;}
var direction="previousSibling";if(next){direction="nextSibling";}
var matches=0;while(sibling!==null&&matches<nth){sibling=sibling[direction];if(predicate(sibling)){matches++;}}
return sibling;};signature(getNthSibling,["object","null"],["function","undefined"],["boolean","undefined"],["number","undefined"]);method(CERNY.dom.Node.prototype,"getNthSibling",getNthSibling);var getClosestSibling=function(predicate,next){return this.getNthSibling(predicate,next,1);};signature(getClosestSibling,["object","null"],["function","undefined"],["boolean","undefined"]);method(CERNY.dom.Node.prototype,"getClosestSibling",getClosestSibling);var getFirstChild=function(predicate){if(!isFunction(predicate)){predicate=isNode;}
var first=this.node.firstChild;if(first===null||predicate(first)){return first;}
return new CERNY.dom.Node(first).getClosestSibling(predicate);};signature(getFirstChild,["object","null"],["function","undefined"]);method(CERNY.dom.Node.prototype,"getFirstChild",getFirstChild);var isGrandchildOf=function(node){node=new CERNY.dom.Node(node);var climber=this.node.parentNode;while(climber!==null){if(climber===node.node){return true;}
climber=climber.parentNode;}
return false;};signature(isGrandchildOf,["boolean"],[CERNY.dom.Node,"object"]);method(CERNY.dom.Node.prototype,"isGrandchildOf",isGrandchildOf);var isAncestorOf=function(node){return new CERNY.dom.Node(node).isGrandchildOf(this.node);};signature(isAncestorOf,["boolean"],[CERNY.dom.Node,"object"]);method(CERNY.dom.Node.prototype,"isAncestorOf",isAncestorOf);var getAncestors=function(predicate){if(!predicate){predicate=isNode;}
var result=[];var ancestor=this.node.parentNode;while(ancestor){if(predicate(ancestor)){result.push(ancestor);}
ancestor=ancestor.parentNode;}
return result;};signature(getAncestors,Array,["function","undefined"]);method(CERNY.dom.Node.prototype,"getAncestors",getAncestors);var getFirstAncestor=function(predicate){if(!predicate){predicate=isNode;}
var parent=this.node.parentNode;if(parent===null){return null;}
if(predicate(parent)){return parent;}else{return new CERNY.dom.Node(parent).getFirstAncestor(predicate);}};signature(getFirstAncestor,["object","null"],["function","undefined"]);method(CERNY.dom.Node.prototype,"getFirstAncestor",getFirstAncestor);var addEvtListener=function(type,listener,capture){if(this.node.attachEvent){this.node.attachEvent("on"+type,listener);}else{this.node.addEventListener(type,listener,capture);}
if(!this.eventListeners){this.eventListeners=[];}
this.eventListeners.push(listener);};signature(addEvtListener,"undefined","string","function",["boolean","undefined"]);method(CERNY.dom.Node.prototype,"addEvtListener",addEvtListener);var removeEvtListener=function(type,listener,capture){if(this.node.detachEvent){this.node.detachEvent("on"+type,listener);}else{this.node.removeEventListener(type,listener,capture);}};signature(removeEvtListener,"undefined","string","function",["boolean","undefined"]);method(CERNY.dom.Node.prototype,"removeEvtListener",removeEvtListener);var removeAllEvtListeners=function(){if(this.eventListeners){this.eventListeners.map(function(listener){this.node[listener]=null;});this.eventListeners=[];}};signature(removeAllEvtListeners,"undefined","undefined");method(CERNY.dom.Node.prototype,"removeAllEvtListeners",removeAllEvtListeners);var domCopy=function(destination,anchor){if(!isNode(anchor)){anchor=null;}
destination=new CERNY.dom.Node(destination);var clone=this.node.cloneNode(true);destination.node.insertBefore(clone,anchor);return clone;};signature(domCopy,"object","object",["object","undefined"]);method(CERNY.dom.Node.prototype,"domCopy",domCopy);var domMove=function(destination,anchor,after){if(!isBoolean(after)){after=true;}
destination=new CERNY.dom.Node(destination);if(!isNode(anchor)){if(after){anchor=destination.lastChild;}else{anchor=destination.firstChild;}}
if(after){if(!anchor||anchor.nextSibling===null){destination.appendChild(this.node);}else{destination.node.insertBefore(this.node,anchor.nextSibling);}}else{destination.node.insertBefore(this.node,anchor);}};signature(domMove,"undefined","object",["object","undefined"],["boolean","undefined"]);method(CERNY.dom.Node.prototype,"domMove",domMove);var domMoveWithin=function(predicate,next){if(!isBoolean(next)){next=true;}
if(!isFunction(predicate)){predicate=isNode;}
var sibling=this.getClosestSibling(predicate,next);if(sibling!==null){this.domMove(this.node.parentNode,sibling,next);}};signature(domMoveWithin,"undefined",["function","undefined"],["boolean","undefined"]);method(CERNY.dom.Node.prototype,"domMoveWithin",domMoveWithin);var domMoveUpWithin=function(predicate){this.domMoveWithin(predicate,false);};signature(domMoveUpWithin,"undefined",["function","undefined"]);method(CERNY.dom.Node.prototype,"domMoveUpWithin",domMoveUpWithin);var domMoveDownWithin=function(predicate){this.domMoveWithin(predicate,true);};signature(domMoveDownWithin,"undefined",["function","undefined"]);method(CERNY.dom.Node.prototype,"domMoveDownWithin",domMoveDownWithin);var domReplace=function(byNode){if(isNode(byNode)){this.node.parentNode.replaceChild(byNode,this.node);}};signature(domReplace,"undefined","object");method(CERNY.dom.Node.prototype,"domReplace",domReplace);var domDelete=function(){if(this.node.parentNode){this.node.parentNode.removeChild(this.node);}};signature(domDelete,"undefined");method(CERNY.dom.Node.prototype,"domDelete",domDelete);post(domDelete,function(){check(isNode(this.node),"this.node must be a dom node");});var insertBefore=function(node,anchor){node=new CERNY.dom.Node(node);if(anchor){anchor=new CERNY.dom.Node(anchor);this.node.insertBefore(node.node,anchor.node);}else{this.node.insertBefore(node.node,this.node.firstChild);}};signature(insertBefore,"undefined",[CERNY.dom.Node,"object"],[CERNY.dom.Node,"object","undefined"]);method(CERNY.dom.Node.prototype,"insertBefore",insertBefore);var insertAfter=function(node,anchor){if(anchor){anchor=new CERNY.dom.Node(anchor);if(anchor.node.nextSibling){this.insertBefore(node,anchor.node.nextSibling);return;}}
this.appendChild(node);};signature(insertAfter,"undefined",[CERNY.dom.Node,"object","undefined"],[CERNY.dom.Node,"object","undefined"]);method(CERNY.dom.Node.prototype,"insertAfter",insertAfter);var insert=function(node,func){node=CERNY.dom.Node(node);if(!func){this.appendChild(node);}else{var climber=this.node.firstChild;while(climber&&func(climber,node.node)<=0){climber=climber.nextSibling;}
if(climber){this.insertBefore(node,climber);}else{this.appendChild(node);}}};signature(insert,"undefined",[CERNY.dom.Node,"object"],["function","undefined"]);method(CERNY.dom.Node.prototype,"insert",insert);})();CERNY.require("CERNY.event.Observable","CERNY.js.Array");(function(){var check=CERNY.check;var method=CERNY.method;var signature=CERNY.signature;var pre=CERNY.pre;var logger=CERNY.Logger("CERNY.event.Observable");function Observable(obj){method(obj,"addObserver",addObserver);method(obj,"removeObserver",removeObserver);method(obj,"removeObservers",removeObservers);method(obj,"notify",notify);method(obj,"addForwarding",addForwarding);method(obj,"removeForwarding",removeForwarding);}
signature(Observable,"undefined","object");method(CERNY.event,"Observable",Observable);pre(Observable,function(obj){check(!obj._observableObservers,"Observable cannot be called on object with observers.");});function addObserver(event,observer){if(!this._observableObservers){this._observableObservers={};}
if(!this._observableObservers[event]){this._observableObservers[event]=[];}
this._observableObservers[event].pushUnique(observer);}
signature(addObserver,"undefined","string","function");function removeObserver(event,observer){if(this._observableObservers[event]){this._observableObservers[event].remove(observer);}}
signature(removeObserver,"undefined","string","function");function removeObservers(event){if(event){delete(this._observableObservers[event]);}else{delete(this._observableObservers);}}
signature(removeObservers,"undefined",["undefined","string"]);function notify(event){var args=[];for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}
if(this._observableObservers&&this._observableObservers[event]){var observers=this._observableObservers[event];for(var i=0,l=observers.length;i<l;i++){observers[i].apply(null,args);}}
var t=this;if(this._observableForwardings){var forwardings=this._observableForwardings;for(var i=0,l=forwardings.length;i<l;i++){var forward=forwardings[i];args.unshift(event);forward.notify.apply(forward,args);}}}
signature(notify,"undefined","string","any");function addForwarding(forwarding){if(!this._observableForwardings){this._observableForwardings=[];}
this._observableForwardings.pushUnique(forwarding);}
signature(addForwarding,"undefined","object");function removeForwarding(forwarding){if(this._observableForwardings){this._observableForwardings.remove(forwarding);}}
signature(removeForwarding,"undefined","object");})();CERNY.require("JSDOMLIB");JSDOMLIB={};Function.prototype.method=function(name,func){this.prototype[name]=func;return this;};Function.method("inherits",function(parent){var d=0;var p=(this.prototype=new parent());this.method('uber',function uber(name){var f;var r;var t=d;var v=parent.prototype;if(t){while(t){v=v.constructor.prototype;t-=1;}
f=v[name];}else{f=p[name];if(f==this[name]){f=v[name];}}
d+=1;r=f.apply(this,Array.prototype.slice.apply(arguments,[1]));d-=1;return r;});return this;});Function.method('swiss',function(parent){for(var i=1;i<arguments.length;i+=1){var name=arguments[i];this.prototype[name]=parent.prototype[name];}});function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else
begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)
end=dc.length;return decodeURI(dc.substring(begin+prefix.length,end));}
function setCookie(name,value,expires,path,domain,secure){var _cookie=name+"="+encodeURI(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=_cookie;}
CERNY.require("CERNY.dom.Element","CERNY.dom.Node","CERNY.dom","CERNY.event.Observable","JSDOMLIB","CERNY.js.String");(function(){CERNY.dom.Element=function(elementOrId){if(elementOrId instanceof CERNY.dom.Element){return elementOrId;}
CERNY.dom.Node.call(this,elementOrId);CERNY.event.Observable(this);return this;};CERNY.signature(CERNY.dom.Element,"object",["string","object"]);CERNY.intercept(CERNY.dom,"Element");CERNY.inherit(CERNY.dom.Element,CERNY.dom.Node);var name="CERNY.dom.Element";CERNY.dom.Element.logger=CERNY.Logger(name);CERNY.dom.Element.prototype.logger=CERNY.Logger(name);var EVT_SHOWN=name+".EVT_SHOWN";var EVT_HIDDEN=name+".EVT_HIDDEN";CERNY.dom.Element.EVT_SHOWN=EVT_SHOWN;CERNY.dom.Element.EVT_HIDDEN=EVT_HIDDEN;var setAttr=function(name,value){switch(name){case"style":this.node.style.cssText=value;break;case"class":this.setCSSClass(value);break;default:this.node.setAttribute(name,value);break;}};CERNY.signature(setAttr,"undefined","string","string");CERNY.method(CERNY.dom.Element.prototype,"setAttr",setAttr);var getAttr=function(name){var value;switch(name){case"style":value=this.node.style.cssText;break;case"class":value=this.getCSSClass();break;default:value=this.node.getAttribute(name);break;}
if(value){return value;}
return"";};CERNY.signature(getAttr,"string","string");CERNY.method(CERNY.dom.Element.prototype,"getAttr",getAttr);var setText=function(text){this.deleteChildren(isTextNode);this.appendChild(document.createTextNode(text));};CERNY.signature(setText,"undefined",["string",String]);CERNY.method(CERNY.dom.Element.prototype,"setText",setText);var getText=function(){var firstTextNode=this.getFirstChild(isTextNode),text=null;if(firstTextNode){text=firstTextNode.data;}
return text;};CERNY.signature(getText,["string","null"]);CERNY.method(CERNY.dom.Element.prototype,"getText",getText);var setInnerHTML=function(html){this.node.innerHTML=html;};CERNY.signature(setInnerHTML,"undefined","string");CERNY.method(CERNY.dom.Element.prototype,"setInnerHTML",setInnerHTML);var show=function(){this.deleteCSSClass("hidden");this.notify(EVT_SHOWN);};CERNY.signature(show,"undefined");CERNY.method(CERNY.dom.Element.prototype,"show",show);var hide=function(){this.addCSSClass("hidden");this.notify(EVT_HIDDEN);};CERNY.signature(hide,"undefined");CERNY.method(CERNY.dom.Element.prototype,"hide",hide);var isVisible=function(){return!this.isHidden();};CERNY.signature(isVisible,"boolean");CERNY.method(CERNY.dom.Element.prototype,"isVisible",isVisible);var isHidden=function(){return this.hasCSSClass("hidden");};CERNY.signature(isHidden,"boolean");CERNY.method(CERNY.dom.Element.prototype,"isHidden",isHidden);var toggleVisibilty=function(){if(this.isVisible()){this.hide();}else{this.show();}};CERNY.signature(toggleVisibilty,"undefined");CERNY.method(CERNY.dom.Element.prototype,"toggleVisibilty",toggleVisibilty);var getCSSClass=function(){return this.node.className;};CERNY.signature(getCSSClass,"string");CERNY.method(CERNY.dom.Element.prototype,"getCSSClass",getCSSClass);var setCSSClass=function(cssClass){cssClass=cssClass.trim();this.node.className=cssClass;};CERNY.signature(setCSSClass,"undefined","string");CERNY.method(CERNY.dom.Element.prototype,"setCSSClass",setCSSClass);var hasCSSClass=function(cssClass){cssClass=cssClass.trim();var regexp=new RegExp("(\\s|^)"+cssClass+"(\\s|$)");return this.getCSSClass().match(regexp)!==null;};CERNY.signature(hasCSSClass,"boolean","string");CERNY.method(CERNY.dom.Element.prototype,"hasCSSClass",hasCSSClass);var addCSSClass=function(cssClass){if(!this.hasCSSClass(cssClass)){this.setCSSClass(this.getCSSClass()+" "+cssClass);}};CERNY.signature(addCSSClass,"undefined","string");CERNY.method(CERNY.dom.Element.prototype,"addCSSClass",addCSSClass);var replaceCSSClass=function(cssClassOld,cssClassNew,force){if(!isBoolean(force)){force=false;}
var currentCssClass=this.getCSSClass();var regexp="/(\\s|^)"+cssClassOld+"(\\s|$)/g";var newClass=currentCssClass.replace(new RegExp(eval(regexp))," "+cssClassNew+" ");this.setCSSClass(newClass);if(force&&!this.hasCSSClass(cssClassNew)){this.addCSSClass(cssClassNew);}};CERNY.signature(replaceCSSClass,"undefined","string","string",["boolean","undefined"]);CERNY.method(CERNY.dom.Element.prototype,"replaceCSSClass",replaceCSSClass);var deleteCSSClass=function(cssClass){this.replaceCSSClass(cssClass,"");};CERNY.signature(deleteCSSClass,"undefined","string");CERNY.method(CERNY.dom.Element.prototype,"deleteCSSClass",deleteCSSClass);var removeStyle=function(){this.setAttr("style","");};CERNY.signature(removeStyle,"undefined");CERNY.method(CERNY.dom.Element.prototype,"removeStyle",removeStyle);function getAbsolute(element,property){var r=element[property];var parent=element.offsetParent;while(parent!==null){r+=parent[property];parent=parent.offsetParent;}
return r;}
var getAbsoluteX=function(){return getAbsolute(this.node,"offsetLeft");};CERNY.signature(getAbsoluteX,"number");CERNY.method(CERNY.dom.Element.prototype,"getAbsoluteX",getAbsoluteX);var getAbsoluteY=function(){return getAbsolute(this.node,"offsetTop");};CERNY.signature(getAbsoluteY,"number");CERNY.method(CERNY.dom.Element.prototype,"getAbsoluteY",getAbsoluteY);var moveTo=function(x,y){this.setAttr("style","position: absolute; "+"top: "+y+"px; "+"left: "+x+"px;");};CERNY.signature(moveTo,"undefined","number","number");CERNY.method(CERNY.dom.Element.prototype,"moveTo",moveTo);var moveOver=function(target,dX,dY){target=new CERNY.dom.Element(target);var x=target.getAbsoluteX()+target.node.offsetWidth*dX;var y=target.getAbsoluteY()+target.node.offsetHeight*dY;this.moveTo(x,y);};CERNY.signature(moveOver,"undefined",[CERNY.dom.Element,"object"],"number","number");CERNY.method(CERNY.dom.Element.prototype,"moveOver",moveOver);var isOver=function(x,y){var tlX=this.getAbsoluteX();var tlY=this.getAbsoluteY();var brX=this.getAbsoluteX()+this.node.offsetWidth;var brY=this.getAbsoluteY()+this.node.offsetHeight;return(tlX<=x&&x<=brX)&&(tlY<=y&&y<=brY);};CERNY.signature(isOver,"boolean","number","number");CERNY.method(CERNY.dom.Element.prototype,"isOver",isOver);var focus=function(){if(this.isFocusable()){this.node.focus();return true;}
return false;};CERNY.signature(focus,"boolean");CERNY.method(CERNY.dom.Element.prototype,"focus",focus);var isFocusable=function(){return!isUndefined(this.node.focus)&&!this.node.disabled&&!this.node.readonly;};CERNY.signature(isFocusable,"boolean");CERNY.method(CERNY.dom.Element.prototype,"isFocusable",isFocusable);var sortChildren=function(comparator,predicate){if(!comparator){comparator=CERNY.dom.Element.compareContent;}
if(!predicate){predicate=isElement;}
var children=this.getChildren(predicate).sort(comparator);this.deleteChildren(predicate);for(var i=0;i<children.length;i++){this.appendChild(children[i]);}};CERNY.signature(sortChildren,"undefined",["function","undefined"],["function","undefined"]);CERNY.method(CERNY.dom.Element.prototype,"sortChildren",sortChildren);var compareContent=function(e1,e2){e1=new CERNY.dom.Element(e1);e2=new CERNY.dom.Element(e2);var t1=e1.getText();var t2=e2.getText();if(!t1||!t2){return 0;}
t1=t1.toLowerCase();t2=t2.toLowerCase();if(t1==t2){return 0;}
if(t1<t2){return-1;}
if(t1>t2){return 1;}};CERNY.signature(compareContent,"number","object","object");CERNY.method(CERNY.dom.Element,"compareContent",compareContent);var create=function(tagName,text){var element=new CERNY.dom.Element(document.createElement(tagName));if(text){element.setText(text);}
for(var i=2;i<arguments.length;++i){var next=arguments[i];if(next!==null){var position=next.indexOf("=");var attributeName="";var attributeValue="";if(position>0){attributeName=next.substring(0,position);attributeValue=next.substring(position+1,next.length);}}
element.setAttr(attributeName,attributeValue);}
return element;};CERNY.signature(create,CERNY.dom.Element,"string",["string","null","undefined"],["string","undefined"]);CERNY.method(CERNY.dom.Element,"create",create);var cssFilter=function(element,cssClass){if(isElement(element)){return new CERNY.dom.Element(element).hasCSSClass(cssClass);}
return false;};CERNY.signature(cssFilter,"boolean","object","string");CERNY.method(CERNY.dom.Element,"cssFilter",cssFilter);})();CERNY.require("CERNY.schema","CERNY.text.DateFormat","CERNY.js.Date","CERNY.js.String","CERNY.js.Array");(function(){var method=CERNY.method;var signature=CERNY.signature;CERNY.namespace("schema");CERNY.schema.strict=false;CERNY.schema.logger=CERNY.Logger("CERNY.schema");function validate(object,schema,parent,root){var constraintName,constraint,value,result={},str,subResult,message,log=CERNY.Logger("CERNY.schema.validate");if(!isObject(object)||isNull(object)){throw new Error("object must be an Object.");}
if(!isObject(schema)||isNull(schema)){throw new Error("schema must be an Object.");}
if(isFunction(object.hasOwnProperty)&&object.hasOwnProperty("_parent")){throw new Error("object to validate may not have a property '_parent'");}
object._parent=parent;if(isFunction(object.hasOwnProperty)&&object.hasOwnProperty("_root")){throw new Error("object to validate may not have a property '_root'");}
object._root=root;for(constraintName in schema){if(schema.hasOwnProperty(constraintName)){constraint=schema[constraintName];value=object[constraintName];log.debug("constraintName: "+constraintName);log.debug("value: "+value);var subResult=validateConstraint(value,constraint,object);log.debug("subResult: "+subResult);if(subResult!==null){result[constraintName]=subResult;}}}
try{delete(object._root);delete(object._parent);}catch(e){}
if(CERNY.schema.strict){for(var name in object){if(object.hasOwnProperty(name)&&!schema.hasOwnProperty(name)){result[name]="is not specified in schema";}}}
return result;};signature(validate,"object","object","object",["undefined","object"]);method(CERNY.schema,"validate",validate);function validateConstraint(value,constraint,object){var result=null,subResult,log=CERNY.Logger("CERNY.schema.validateConstraint");if(constraint&&isRegexp(constraint)){str=value+"";if(!str.match(constraint)){result="'"+str+"' must match "+constraint+".";log.debug("result: "+result);}}else if(isFunction(constraint)){try{subResult=constraint.call(object,value);if(isString(subResult)||isObject(subResult)){result=subResult;}else if(subResult===false){result=CERNY.schema.printValue(value)+" does not conform to constraint.";}}catch(e){result=""+e.message;}}else if(constraint&&isObject(constraint)){if(!isUndefined(value)){var root=object._root;if(isUndefined(root)){root=object;}
subResult=CERNY.schema.validate(value,constraint,object,root);if(!CERNY.schema.isValid(subResult)){log.debug("subResult: "+subResult);result=subResult;}}}else{if(constraint!==value){result="must be "+CERNY.schema.printValue(constraint)+" "+"but is "+CERNY.schema.printValue(value)+".";log.debug("result: "+result);}}
return result;}
function isValid(validationResult){for(var propertyName in validationResult){if(validationResult.hasOwnProperty(propertyName)){return false;}}
return true;};signature(isValid,"boolean","object");method(CERNY.schema,"isValid",isValid);function optional(constraint){return function(value){if(value===null||isUndefined(value)){return true;}else{return validateConstraint(value,constraint,this);}}};signature(optional,"function","any");method(CERNY.schema,"optional",optional);function arrayOf(type,min,max){return function(x){var result=null,subResult;if(!isNumber(min)){min=null;}
if(!isNumber(max)){max=null;}
if(isArray(x)){if(min!==null&&x.length<min){return"must have at least "+min+" items, but has only "+x.length+".";}
if(max!==null&&x.length>max){return"must have no more than "+max+" items, but has "+x.length+".";}
for(var i=0;i<x.length;i++){subResult=validateConstraint(x[i],type,this);if(subResult!==null){if(result==null){result={};}
result[i]=subResult;}}}else{return"must be an array.";}
return result;}};signature(arrayOf,"function","any",["undefined","number"],["undefined","number"]);method(CERNY.schema,"arrayOf",arrayOf);function oneOf(array){return function(x){if(isArray(array)){if(array.contains(x)){return true;}else{return false;}}};};signature(oneOf,"function",Array);function number(x){if(isNumber(x)){return true;}
return CERNY.schema.printValue(x)+" must be a number.";};method(CERNY.schema,"number",number);function nonEmptyString(value){if(value&&isNonEmptyString(value)){return true;}
return CERNY.schema.printValue(value)+" must be a non empty string.";};method(CERNY.schema,"nonEmptyString",nonEmptyString);function isoDate(str){if(str&&Date._parse(str,CERNY.text.DateFormat.ISO)!==null){return true;}
return CERNY.schema.printValue(str)+" must be an ISO date string (yyyy-mm-dd).";};signature(isoDate,["boolean","string"],"string");method(CERNY.schema,"isoDate",isoDate);function printValue(value){return"value "+CERNY.dump(value);};method(CERNY.schema,"printValue",printValue);})();CERNY.require("TOPINCS.misc.browsercheck","CERNY.schema");(function(){var logger="TOPINCS.misc.browsercheck";function browsercheck(accepted,navigator){navigator=navigator||window.navigator;return matchSome(navigator,accepted);}
CERNY.method(TOPINCS.misc,"browsercheck",browsercheck);function match(object,schema){return CERNY.schema.isValid(CERNY.schema.validate(object,schema));}
function matchSome(_object,_patterns){return _match(_object,_patterns,true);}
function matchAll(_object,_patterns){return _match(_object,_patterns,false);}
function _match(_object,_patterns,_truth){for(var i=0;i<_patterns.length;i++){if(match(_object,_patterns[i])===_truth){return _truth;}}
return!_truth;}})();CERNY.require("CERNY.http.Response");(function(){var signature=CERNY.signature;var method=CERNY.method;CERNY.http.Response=Response;var logger=CERNY.Logger("CERNY.http.Response");function Response(request){this.request=request;this.body=request.responseText;this.status=request.status;}
Response.prototype.logger=logger;function getStatus(){return this.status;}
signature(getStatus,"number");method(Response.prototype,"getStatus",getStatus);function getBody(){return this.body;}
signature(getBody,"string");method(Response.prototype,"getBody",getBody);function getHeader(name){return this.request.getResponseHeader(name);}
signature(getHeader,"string","string");method(Response.prototype,"getHeader",getHeader);function getValue(){eval("var o = "+this.body);return o;}
signature(getValue,"any");method(Response.prototype,"getValue",getValue);})();CERNY.require("CERNY.http.Request","CERNY.http.Response");(function(){var signature=CERNY.signature;var method=CERNY.method;var Response=CERNY.http.Response;CERNY.http.Request=Request;var logger=CERNY.Logger("CERNY.http.Request");function Request(method,url){this.method=method;this.url=url;this.headers={};this.body=null;this.contentType=null;}
Request.prototype.logger=logger;Request.UNSENT="0";Request.OPEN="1";Request.SENT="2";Request.LOADING="3";Request.DONE="4";function setBody(body,contentType){this.body=body;this.contentType=contentType;}
signature(setBody,"undefined","string",["undefined","string"]);method(Request.prototype,"setBody",setBody);function setHeader(name,value){this.headers[name]=value;}
signature(setHeader,"undefined","string","string");method(Request.prototype,"setHeader",setHeader);function sendSynch(){this.request=new XMLHttpRequest();this.request.open(this.method,this.url,false);setHeaders(this,this.request);this.request.send(this.body);return new Response(this.request);}
signature(sendSynch,CERNY.http.Response);method(Request.prototype,"sendSynch",sendSynch);function sendAsynch(callback){var handler=callback;if(isFunction(callback)){handler={};handler[Request.DONE]=callback;}
this.request=new XMLHttpRequest();this.request.open(this.method,this.url,true);setHeaders(this,this.request);var req=this.request;this.request.onreadystatechange=function(){if(isFunction(handler[""+req.readyState])){handler[""+req.readyState](req);}}
this.request.send(this.body);}
signature(sendAsynch,"undefined",["function","object"]);method(Request.prototype,"sendAsynch",sendAsynch);function setNoCacheHeaders(){this.setHeader("Pragma","no-cache");this.setHeader("Cache-Control","no-cache");if(this.url.indexOf("?")<0){this.url+="?";}else{this.url+="&";}
this.url+="cernyjsnocache="+Math.random().toString().replace(".","");}
signature(setNoCacheHeaders,"undefined",["function","object"]);method(Request.prototype,"setNoCacheHeaders",setNoCacheHeaders);function setHeaders(t,request){if(t.contentType){request.setRequestHeader("Content-Type",t.contentType);}
for(var name in t.headers){if(t.headers.hasOwnProperty(name)){var value=t.headers[name];if(typeof value=="string"&&value.length>0){request.setRequestHeader(name,t.headers[name]);}}}}})();(function(){var root=this;var previousUnderscore=root._;var wrapper=function(obj){this._wrapped=obj;};var breaker=typeof StopIteration!=='undefined'?StopIteration:'__break__';var _=root._=function(obj){return new wrapper(obj);};if(typeof exports!=='undefined')exports._=_;var slice=Array.prototype.slice,unshift=Array.prototype.unshift,toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,propertyIsEnumerable=Object.prototype.propertyIsEnumerable;_.VERSION='0.5.1';_.each=function(obj,iterator,context){var index=0;try{if(obj.forEach){obj.forEach(iterator,context);}else if(_.isArray(obj)||_.isArguments(obj)){for(var i=0,l=obj.length;i<l;i++)iterator.call(context,obj[i],i,obj);}else{var keys=_.keys(obj),l=keys.length;for(var i=0;i<l;i++)iterator.call(context,obj[keys[i]],keys[i],obj);}}catch(e){if(e!=breaker)throw e;}
return obj;};_.map=function(obj,iterator,context){if(obj&&_.isFunction(obj.map))return obj.map(iterator,context);var results=[];_.each(obj,function(value,index,list){results.push(iterator.call(context,value,index,list));});return results;};_.reduce=function(obj,memo,iterator,context){if(obj&&_.isFunction(obj.reduce))return obj.reduce(_.bind(iterator,context),memo);_.each(obj,function(value,index,list){memo=iterator.call(context,memo,value,index,list);});return memo;};_.reduceRight=function(obj,memo,iterator,context){if(obj&&_.isFunction(obj.reduceRight))return obj.reduceRight(_.bind(iterator,context),memo);var reversed=_.clone(_.toArray(obj)).reverse();_.each(reversed,function(value,index){memo=iterator.call(context,memo,value,index,obj);});return memo;};_.detect=function(obj,iterator,context){var result;_.each(obj,function(value,index,list){if(iterator.call(context,value,index,list)){result=value;_.breakLoop();}});return result;};_.select=function(obj,iterator,context){if(obj&&_.isFunction(obj.filter))return obj.filter(iterator,context);var results=[];_.each(obj,function(value,index,list){iterator.call(context,value,index,list)&&results.push(value);});return results;};_.reject=function(obj,iterator,context){var results=[];_.each(obj,function(value,index,list){!iterator.call(context,value,index,list)&&results.push(value);});return results;};_.all=function(obj,iterator,context){iterator=iterator||_.identity;if(obj&&_.isFunction(obj.every))return obj.every(iterator,context);var result=true;_.each(obj,function(value,index,list){if(!(result=result&&iterator.call(context,value,index,list)))_.breakLoop();});return result;};_.any=function(obj,iterator,context){iterator=iterator||_.identity;if(obj&&_.isFunction(obj.some))return obj.some(iterator,context);var result=false;_.each(obj,function(value,index,list){if(result=iterator.call(context,value,index,list))_.breakLoop();});return result;};_.include=function(obj,target){if(_.isArray(obj))return _.indexOf(obj,target)!=-1;var found=false;_.each(obj,function(value){if(found=value===target)_.breakLoop();});return found;};_.invoke=function(obj,method){var args=_.rest(arguments,2);return _.map(obj,function(value){return(method?value[method]:value).apply(value,args);});};_.pluck=function(obj,key){return _.map(obj,function(value){return value[key];});};_.max=function(obj,iterator,context){if(!iterator&&_.isArray(obj))return Math.max.apply(Math,obj);var result={computed:-Infinity};_.each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed>=result.computed&&(result={value:value,computed:computed});});return result.value;};_.min=function(obj,iterator,context){if(!iterator&&_.isArray(obj))return Math.min.apply(Math,obj);var result={computed:Infinity};_.each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed<result.computed&&(result={value:value,computed:computed});});return result.value;};_.sortBy=function(obj,iterator,context){return _.pluck(_.map(obj,function(value,index,list){return{value:value,criteria:iterator.call(context,value,index,list)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}),'value');};_.sortedIndex=function(array,obj,iterator){iterator=iterator||_.identity;var low=0,high=array.length;while(low<high){var mid=(low+high)>>1;iterator(array[mid])<iterator(obj)?low=mid+1:high=mid;}
return low;};_.toArray=function(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();if(_.isArray(iterable))return iterable;if(_.isArguments(iterable))return slice.call(iterable);return _.map(iterable,function(val){return val;});};_.size=function(obj){return _.toArray(obj).length;};_.first=function(array,n,guard){return n&&!guard?slice.call(array,0,n):array[0];};_.rest=function(array,index,guard){return slice.call(array,_.isUndefined(index)||guard?1:index);};_.last=function(array){return array[array.length-1];};_.compact=function(array){return _.select(array,function(value){return!!value;});};_.flatten=function(array){return _.reduce(array,[],function(memo,value){if(_.isArray(value))return memo.concat(_.flatten(value));memo.push(value);return memo;});};_.without=function(array){var values=_.rest(arguments);return _.select(array,function(value){return!_.include(values,value);});};_.uniq=function(array,isSorted){return _.reduce(array,[],function(memo,el,i){if(0==i||(isSorted===true?_.last(memo)!=el:!_.include(memo,el)))memo.push(el);return memo;});};_.intersect=function(array){var rest=_.rest(arguments);return _.select(_.uniq(array),function(item){return _.all(rest,function(other){return _.indexOf(other,item)>=0;});});};_.zip=function(){var args=_.toArray(arguments);var length=_.max(_.pluck(args,'length'));var results=new Array(length);for(var i=0;i<length;i++)results[i]=_.pluck(args,String(i));return results;};_.indexOf=function(array,item){if(array.indexOf)return array.indexOf(item);for(var i=0,l=array.length;i<l;i++)if(array[i]===item)return i;return-1;};_.lastIndexOf=function(array,item){if(array.lastIndexOf)return array.lastIndexOf(item);var i=array.length;while(i--)if(array[i]===item)return i;return-1;};_.range=function(start,stop,step){var a=_.toArray(arguments);var solo=a.length<=1;var start=solo?0:a[0],stop=solo?a[0]:a[1],step=a[2]||1;var len=Math.ceil((stop-start)/step);if(len<=0)return[];var range=new Array(len);for(var i=start,idx=0;true;i+=step){if((step>0?i-stop:stop-i)>=0)return range;range[idx++]=i;}};_.bind=function(func,obj){var args=_.rest(arguments,2);return function(){return func.apply(obj||root,args.concat(_.toArray(arguments)));};};_.bindAll=function(obj){var funcs=_.rest(arguments);if(funcs.length==0)funcs=_.functions(obj);_.each(funcs,function(f){obj[f]=_.bind(obj[f],obj);});return obj;};_.delay=function(func,wait){var args=_.rest(arguments,2);return setTimeout(function(){return func.apply(func,args);},wait);};_.defer=function(func){return _.delay.apply(_,[func,1].concat(_.rest(arguments)));};_.wrap=function(func,wrapper){return function(){var args=[func].concat(_.toArray(arguments));return wrapper.apply(wrapper,args);};};_.compose=function(){var funcs=_.toArray(arguments);return function(){var args=_.toArray(arguments);for(var i=funcs.length-1;i>=0;i--){args=[funcs[i].apply(this,args)];}
return args[0];};};_.keys=function(obj){if(_.isArray(obj))return _.range(0,obj.length);var keys=[];for(var key in obj)if(hasOwnProperty.call(obj,key))keys.push(key);return keys;};_.values=function(obj){return _.map(obj,_.identity);};_.functions=function(obj){return _.select(_.keys(obj),function(key){return _.isFunction(obj[key]);}).sort();};_.extend=function(destination,source){for(var property in source)destination[property]=source[property];return destination;};_.clone=function(obj){if(_.isArray(obj))return obj.slice(0);return _.extend({},obj);};_.isEqual=function(a,b){if(a===b)return true;var atype=typeof(a),btype=typeof(b);if(atype!=btype)return false;if(a==b)return true;if((!a&&b)||(a&&!b))return false;if(a.isEqual)return a.isEqual(b);if(_.isDate(a)&&_.isDate(b))return a.getTime()===b.getTime();if(_.isNaN(a)&&_.isNaN(b))return true;if(_.isRegExp(a)&&_.isRegExp(b))
return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(atype!=='object')return false;if(a.length&&(a.length!==b.length))return false;var aKeys=_.keys(a),bKeys=_.keys(b);if(aKeys.length!=bKeys.length)return false;for(var key in a)if(!_.isEqual(a[key],b[key]))return false;return true;};_.isEmpty=function(obj){return _.keys(obj).length==0;};_.isElement=function(obj){return!!(obj&&obj.nodeType==1);};_.isArguments=function(obj){return obj&&_.isNumber(obj.length)&&!_.isArray(obj)&&!propertyIsEnumerable.call(obj,'length');};_.isNaN=function(obj){return _.isNumber(obj)&&isNaN(obj);};_.isNull=function(obj){return obj===null;};_.isUndefined=function(obj){return typeof obj=='undefined';};var types=['Array','Date','Function','Number','RegExp','String'];for(var i=0,l=types.length;i<l;i++){(function(){var identifier='[object '+types[i]+']';_['is'+types[i]]=function(obj){return toString.call(obj)==identifier;};})();}
_.noConflict=function(){root._=previousUnderscore;return this;};_.identity=function(value){return value;};_.breakLoop=function(){throw breaker;};var idCounter=0;_.uniqueId=function(prefix){var id=idCounter++;return prefix?prefix+id:id;};_.template=function(str,data){var fn=new Function('obj','var p=[],print=function(){p.push.apply(p,arguments);};'+'with(obj){p.push(\''+
str.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")
+"');}return p.join('');");return data?fn(data):fn;};_.forEach=_.each;_.foldl=_.inject=_.reduce;_.foldr=_.reduceRight;_.filter=_.select;_.every=_.all;_.some=_.any;_.head=_.first;_.tail=_.rest;_.methods=_.functions;var result=function(obj,chain){return chain?_(obj).chain():obj;};_.each(_.functions(_),function(name){var method=_[name];wrapper.prototype[name]=function(){unshift.call(arguments,this._wrapped);return result(method.apply(_,arguments),this._chain);};});_.each(['pop','push','reverse','shift','sort','splice','unshift'],function(name){var method=Array.prototype[name];wrapper.prototype[name]=function(){method.apply(this._wrapped,arguments);return result(this._wrapped,this._chain);};});_.each(['concat','join','slice'],function(name){var method=Array.prototype[name];wrapper.prototype[name]=function(){return result(method.apply(this._wrapped,arguments),this._chain);};});wrapper.prototype.chain=function(){this._chain=true;return this;};wrapper.prototype.value=function(){return this._wrapped;};})();CERNY.require("TOPINCS.util","TOPINCS.cons","CERNY.http.Request","CERNY.http.Response","CERNY.dom.Element","_","CERNY.util");(function(){var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var Request=CERNY.http.Request;var Response=CERNY.http.Response;var fillNumber=CERNY.util.fillNumber;var logger=CERNY.Logger("TOPINCS.util");var util={};util.logger=logger;TOPINCS.util=util;var EL_UI_BLOCKER=Element.create("div",null,"id=uiblocker");var CR="\n";var CRLF="\r\n";function getResult(url,accept,nocache,options){var result;accept=accept||MEDIA_TYPE_JSON;nocache=nocache||false;options=options||{"X-Topincs-Options":"mind_name=1","X-Topincs-Accept-Scope":ACCEPT_SCOPE};var request=new Request("GET",url);for(var key in options){if(options.hasOwnProperty(key)){request.setHeader(key,options[key]);}}
request.setHeader("Accept",accept);if(nocache){request.setNoCacheHeaders();}
var response=request.sendSynch();switch(response.getStatus()){case 404:throw new Error("Resource '"+request.url+"' does not exist.");case 500:TOPINCS.util.fatalError("Server error: "+response.getBody());break;default:try{result=response.getValue();}catch(e){if(e instanceof SyntaxError){throw new Error("Response is not a JSON document: \n"+response.getBody());}
throw e;}}
return result;}
signature(getResult,"object","string",["undefined","string"]);method(util,"getResult",getResult);function fatalError(message){TOPINCS.util.showMessage(message);throw new Error(message);}
signature(fatalError,"undefined","string");method(util,"fatalError",fatalError);function getAssociations(query){return TOPINCS.util.getResult(ROLES_SEARCH_URL+"?"+query,MEDIA_TYPE_ROLE_PROXY_ARRAY);}
signature(getAssociations,Array,"string");method(util,"getAssociations",getAssociations);function getDatatypes(typeId){var url=DATATYPES_URL;if(typeId){url+="?ot=id:"+typeId;}
return TOPINCS.util.getResult(url,MEDIA_TYPE_DATATYPE_ARRAY).sort();}
signature(getDatatypes,Array,["undefined","string"]);method(util,"getDatatypes",getDatatypes);function abortOpenRequests(){var requests=[];OPEN_REQUESTS.map(function(req){requests.push(req);});OPEN_REQUESTS=[];requests.map(function(req){req.abort();});}
signature(abortOpenRequests,"undefined");method(util,"abortOpenRequests",abortOpenRequests);function compareTopicProxiesByName(x,y){return(x.label.toLowerCase()<y.label.toLowerCase())?-1:1;}
signature(compareTopicProxiesByName,"number","object","object");method(util,"compareTopicProxiesByName",compareTopicProxiesByName);function compareTopicProxiesById(x,y){return(Number(x.id)<Number(y.id))?-1:1;}
signature(compareTopicProxiesById,"number","object","object");method(util,"compareTopicProxiesById",compareTopicProxiesById);function getMetaInfo(item){return TOPINCS.util.getResult(META_URL+"?item_type="+item.itemType+"&system_id="+item.id);}
signature(getMetaInfo,"object","string");method(util,"getMetaInfo",getMetaInfo);function meta(_item){var meta,append,iis,date,creation_ts,parts,time;var metaInfo=getMetaInfo(_item);try{meta='<table class="meta" cellpadding="0" cellspacing="0">';append=function(_field,_value){if(_value.indexOf("://")>0||_value.indexOf("wiki")==0){_value='<a href="'+_value+'">'+_value+'</a>';}
meta=meta+'<tr>'
+'<td class="field">'+_field+'</td>'
+'<td class="value">'+_value+'</td>'
+'</tr>';}
append(DICT.lab_item_identifers,_item.getAbsoluteURL());iis=_item.item_identifiers.slice(1,_item.item_identifiers.length);iis.map(function(_ii){append("",_ii);});if(_item.parent){append(DICT.lab_parent,_item.parent);}
append(DICT.lab_meta_creation_tag,metaInfo.creation_tag);parts=metaInfo.creation_ts.split(" ");date=parts[0];time=parts[1];creation_ts='<span><a href="javascript:TOPINCS.editor.Editor.showJournal('+"'"+date+"'"+');"'
+' title="'+DICT.lab_jump_to_journal+'">'
+date+"</a> "+time+"</span>";append(DICT.lab_meta_created,creation_ts);append(DICT.lab_meta_by,metaInfo.creation_user);append(DICT.lab_meta_modified,metaInfo.modification_ts);append(DICT.lab_meta_by,metaInfo.modification_user);if(_item.itemType=="Topic"){append(DICT.lab_wiki_url,createWikiUri(_item.id));}
meta+='</table>';return meta;}catch(_e){logger.error("Exception when generating info: "+_e.message);return DICT.msg_no_information;}}
signature(meta,"string","object");method(util,"meta",meta);function updateAcceptScope(){var scope=CONF.scope;ACCEPT_SCOPE="";var first=true;scope.map(function(_s){if(first){first=false;}else{ACCEPT_SCOPE+=",";}
ACCEPT_SCOPE+=_s.id;});}
signature(updateAcceptScope,"undefined");method(util,"updateAcceptScope",updateAcceptScope);function showMessage(message,error){alert(message);if(error){alert(error);}}
signature(showMessage,"undefined","string");method(util,"showMessage",showMessage);function showConfirmation(message){return confirm(message);}
signature(showConfirmation,"boolean","string");method(util,"showConfirmation",showConfirmation);function getTopics(substring,type,map,limit){var types=[];if(isArray(type)){types=type;}else if(isString(type)){types.push(type);}
var url=TOPIC_SEARCH_URL+"?";if(substring){url+="&string="+encodeURIComponent(substring);}
url=_.reduce(types,url,function(memo,ttId){return memo+"&type="+ttId;});if(map){url+="&map="+map;}
if(limit){url+="&limit="+limit;}
var request=new Request("GET",url);request.setHeader("Accept",MEDIA_TYPE_STORE_SEARCH_RESULT_V2);var response=request.sendSynch();return response.getValue();}
signature(getTopics,"object","string",["undefined","string"],["undefined","string"]);method(util,"getTopics",getTopics);function createWikiUri(topicId,base){base=base||"";if(isNumber(Number(topicId))){topicId="id:"+topicId;return base+"wiki/"+topicId;}}
signature(createWikiUri,"string",["string","undefined"]);method(util,"createWikiUri",createWikiUri);function extractSystemIdFromWikiUri(wikiUri){var matches=wikiUri.match(/\d+$/);if(isArray(matches)){return matches[0];}}
signature(extractSystemIdFromWikiUri,["string","undefined"],"string");method(util,"extractSystemIdFromWikiUri",extractSystemIdFromWikiUri);function compareById(a,b){return a.id===b.id;}
signature(compareById,"boolean","object","object");method(util,"compareById",compareById);function isMultiline(str){return str.indexOf("\r")>=0||str.indexOf("\n")>=0;}
signature(isMultiline,"boolean","string");method(util,"isMultiline",isMultiline);function adjustNewline(str,targetStr){var targetStrNewline=targetStr.indexOf(CRLF)>=0?CRLF:CR;var strNewline=str.indexOf(CRLF)>=0?CRLF:CR;if(strNewline!=targetStrNewline){str=str.replace(new RegExp(strNewline,"g"),targetStrNewline);}
return str;}
signature(adjustNewline,"string","string","string");method(util,"adjustNewline",adjustNewline);function isCode(str){var frequencies=getCharacterFrequencies(str);var lotsOfBraces=frequencies.relative("(",")","{","}","[","]","=")>=0.02;var dotAtTheEnd=str.match(/\.\s*$/)!==null;return lotsOfBraces&&!dotAtTheEnd;}
signature(isCode,"boolean","string");method(util,"isCode",isCode);function getCharacterFrequencies(str,max){max=max||str.length;if(max>str.length){max=str.length;}
var result={};for(var i=0;i<max;i++){var charCode=str.charCodeAt(i);if(isUndefined(result[charCode])){result[charCode]=0;}
result[charCode]+=1;}
method(result,"relative",function(){var total=0;for(var i=0;i<arguments.length;i++){var freq=this[arguments[i].charCodeAt(0)];if(freq){total+=freq/max;}}
return total;});return result;}
signature(getCharacterFrequencies,"object","string",["number","undefined"]);method(util,"getCharacterFrequencies",getCharacterFrequencies);function countLines(str){var count=str.split("\n").length;if(count<2){count=str.split("\r").length;}
return count-1;}
signature(countLines,"number","string");method(util,"countLines",countLines);function setLocation(url){var baseUri=getBaseUri();if(baseUri){url=baseUri+url;}
document.location=url;}
signature(setLocation,"undefined","string");method(util,"setLocation",setLocation);function getJournal(start,end){function format(date){function fill(value){return value<10?"0"+value:value;}
return""+date.getFullYear()+
fill(date.getMonth()+1)+fill(date.getDate())+
fill(date.getHours())+fill(date.getMinutes())+fill(date.getSeconds());}
var query="start="+format(start)+"&end="+format(end);return TOPINCS.util.getResult(JOURNAL_URL+"?"+query);}
signature(getJournal,Array,Date,Date);method(util,"getJournal",getJournal);function cache(object,methodName){var func=object[methodName];if(!isFunction(func)){throw new Error("Function '"+methodName+"' not found on object.");}
var cache={};function cachedFunction(){var key=argumentsToArray(arguments).join("-");var value=cache[key];if(!value){value=func.apply(object,arguments);cache[key]=value;}
return value;}
method(object,methodName,cachedFunction);}
signature(cache,"undefined","object","string","function");method(util,"cache",cache);function blockUiDuring(f){blockUi();setTimeout(function(){f();releaseUi();},200);}
signature(blockUiDuring,"undefined");method(util,"blockUiDuring",blockUiDuring);function blockUi(){var el=EL_UI_BLOCKER.node;document.body.appendChild(el);el.style.visibility="visible";}
signature(blockUi,"undefined");method(util,"blockUi",blockUi);function releaseUi(){EL_UI_BLOCKER.node.style.visibility="hidden";}
signature(releaseUi,"undefined");method(util,"releaseUi",releaseUi);function sendRequest(request,callback,onComplete){if(callback){if(onComplete){callback=CERNY.joinFunctions(function(request){onComplete(new Response(request));},callback);}
request.sendAsynch(callback);}else{var response=request.sendSynch();if(onComplete){onComplete(response);}
return response;}}
signature(sendRequest,["undefined",Response],Request,"function",["undefined","function"]);method(util,"sendRequest",sendRequest);function getBaseUri(){return document.baseURI||document.getElementsByTagName("base")[0].href;}
signature(getBaseUri,["string","undefined"]);method(util,"getBaseUri",getBaseUri);function isLocalLocator(locator){return locator.indexOf(getBaseUri())===0;}
signature(isLocalLocator,"boolean","string");method(util,"isLocalLocator",isLocalLocator);function isDynamicLocator(locator){if(isLocalLocator(locator)){var relUri=locator.replace(getBaseUri(),"");return relUri.match(/^((topics|names|roles|occurrences|associations)\/)?[1-9][0-9]*$/)!==null;}
return false;}
signature(isDynamicLocator,"boolean","string");method(util,"isDynamicLocator",isDynamicLocator);function isRelativeLocator(locator){return isLocalLocator(locator)&&!isDynamicLocator(locator);}
signature(isRelativeLocator,"boolean","string");method(util,"isRelativeLocator",isRelativeLocator);function localizeToolCode(code){var newCode="javascript:("+code+")();";newCode=newCode.replace(/BASE/,TOPINCS.HOST+TOPINCS.BASE);newCode=newCode.replace(new RegExp(" +","g")," ");return newCode;}
signature(localizeToolCode,"string","string");method(util,"localizeToolCode",localizeToolCode);function systemIdToLocalSi(systemId){return getBaseUri()+systemId;}
method(util,"systemIdToLocalSi",systemIdToLocalSi);function argumentsToArray(a){var result=[];for(var i=0;i<a.length;i++){result.push(a[i]);}
return result;}
function filter(array,predicate){var i=array.length;while(i--){if(!predicate(array[i])){array.splice(i,1);}}}
method(util,"filter",filter);})();CERNY.require("TOPINCS.dict");(function(){TOPINCS.dict={};var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.dict");function getDictionary(symbol){var lang=TOPINCS.UI_LANGUAGE||"en";var dictLocation=CERNY.Catalog.lookup(symbol);var dictionaryLocation=dictLocation.replace(/dict\.js$/,lang+".json");return CERNY.getResource(dictionaryLocation);}
method(TOPINCS.dict,"getDictionary",getDictionary);function get(key,replacements,count){if(typeof count==="number"){key=getKeyNoneSgPl(key,count);}
var value=this[key];if(value&&replacements){var i=1;replacements.map(function(replacement){value=value.replace(new RegExp("%"+i,"g"),replacement);i+=1;});}
return value;}
method(TOPINCS.dict,"get",get);function getKeyNoneSgPl(key,count){if(count>1){return key+"_pl";}
if(count==1){return key+"_sg";}
return key+"_none";}})();CERNY.require("TOPINCS.widgets.DICT","TOPINCS.dict");(function(){eval("TOPINCS.widgets.DICT = "+TOPINCS.dict.getDictionary("TOPINCS.widgets.DICT")+";");TOPINCS.widgets.DICT.get=TOPINCS.dict.get;})();CERNY.require("TOPINCS.widgets.util","TOPINCS.util","TOPINCS.widgets.DICT","CERNY.text.TimezoneFormat","CERNY.js.Array","CERNY.dom.Element");CERNY.namespace("widgets.util",TOPINCS);(function(){var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var DICT=TOPINCS.widgets.DICT;var compareById=TOPINCS.util.compareById;var compareTopicProxiesByName=TOPINCS.util.compareTopicProxiesByName;var EL_BODY=new Element(document.body);var logger=CERNY.Logger("TOPINCS.widgets.util");TOPINCS.widgets.util.logger=logger;function setAccessKey(anchor,key){}
signature(setAccessKey,"undefined",["object",Element],"string");method(TOPINCS.widgets.util,"setAccessKey",setAccessKey);function unsetAccessKey(anchor){}
signature(unsetAccessKey,"undefined",["object",Element]);method(TOPINCS.widgets.util,"unsetAccessKey",unsetAccessKey);function TimezoneSelect(){this.el=Element.create("select",null,"class=timezone-select");this.el.appendChild(Element.create("option",DICT.lab_form_no_value,"value="+TimezoneSelect.NO_VALUE));var currentTimezoneOffset=new Date().getTimezoneOffset();for(var i=12;i>-12;i--){var offsetInMinutes=i*60;var tzd=CERNY.text.TimezoneFormat.ISO.format(offsetInMinutes);var el=Element.create("option",tzd,"value="+offsetInMinutes);if(currentTimezoneOffset==offsetInMinutes){el.addCSSClass("current");}
this.el.appendChild(el);}}
TimezoneSelect.NO_VALUE="__NO_VALUE";signature(TimezoneSelect,"object");method(TOPINCS.widgets.util,"TimezoneSelect",TimezoneSelect);var els=[];EL_BODY.addEvtListener("click",function(){var elsCopy=els.copy(),i=elsCopy.length,el;while(i--){el=elsCopy[i];el.hide();els.remove(el);}});function disappearOnOutboundClick(el){el.addEvtListener("mouseover",function(){els.remove(el);});el.addEvtListener("mouseout",function(){if(el.isVisible()){els.pushUnique(el);}});el.addObserver(Element.EVT_SHOWN,function(){setTimeout(function(){els.pushUnique(el);},200);});el.addObserver(Element.EVT_HIDDEN,function(){els.remove(el);});}
signature(disappearOnOutboundClick,Element);method(TOPINCS.widgets.util,"disappearOnOutboundClick",disappearOnOutboundClick);function getTarget(event){var evt=getEvent(event);return evt.target||evt.srcElement;}
signature(getTarget,Element);method(TOPINCS.widgets.util,"getTarget",getTarget);function getEvent(event){if(event){return event;}else{return window.event;}}
signature(getEvent,Element);method(TOPINCS.widgets.util,"getEvent",getEvent);function convertTopicProxyArrayToSelect(array,selected,size,grouping){var select=[];var i=array.length;while(i--){var topicProxy=array[i];if(topicProxy.type){type=topicProxy.type;}else{type={"id":"Untyped","label":DICT.lab_untyped};}
var pos=select.indexOf(type,compareById);if(pos<0){pos=select.sortedInsert({"id":type.id,label:type.label,options:[]},compareTopicProxiesByName);}
select[pos].options.sortedInsert(topicProxy,compareTopicProxiesByName);}
if(!isBoolean(grouping)){grouping=select.length>1;}
var selectEl=Element.create("select",null,"multiple=multiple","size="+size);select.map(function(group){var optionParentEl=selectEl;if(grouping){var optgroupEl=Element.create("optgroup",null,"label="+group.label);optionParentEl=optgroupEl;selectEl.appendChild(optgroupEl);}
group.options.map(function(option){var optionEl=Element.create("option",option.label,"id="+option.id);if(selected.contains(option.id)){optionEl.setAttr("selected","selected");}
optionParentEl.appendChild(optionEl);});});return selectEl;}
signature(convertTopicProxyArrayToSelect,Element,Array,Array,"number");method(TOPINCS.widgets.util,"convertTopicProxyArrayToSelect",convertTopicProxyArrayToSelect);function getSelectedOptions(options){var result=[];var i=options.length;while(i--){if(options[i].selected){result.push(options[i]);}}
return result;}
signature(getSelectedOptions,Array,Array);method(TOPINCS.widgets.util,"getSelectedOptions",getSelectedOptions);})();CERNY.require("TOPINCS.widgets.Actionable","CERNY.dom.Element","TOPINCS.util");(function(){TOPINCS.widgets.Actionable=Actionable;var method=CERNY.method;function Actionable(obj){method(obj,"addEvtListener",addAction);method(obj,"addAction",addAction);method(obj,"activate",activate);method(obj,"deactivate",deactivate);method(obj,"init",init);}
function init(t,param){t.containerEl=param.containerEl;t.aEl=param.aEl;if(isBoolean(param.blockUi)){this.blockUi=param.blockUi;}else{this.blockUi=true;}
if(!isBoolean(param.active)){param.active=true;}
t.containerEl.addCSSClass("sprite sprite-"+param.iconName);t.cssClasses={normal:"sprite-"+param.iconName,light:"sprite-"+param.iconName+"_",inactive:"sprite-"+param.iconName+"__"};t.normal=function(){t.containerEl.deleteCSSClass(t.cssClasses.light);t.containerEl.addCSSClass(t.cssClasses.normal);};t.light=function(){t.containerEl.deleteCSSClass(t.cssClasses.normal);t.containerEl.addCSSClass(t.cssClasses.light);};if(param.active===true){t.activate();}else{t.deactivate();}}
method(Actionable,"init",init);function addAction(action){var t=this;function conditionalAction(e){if(t.active){if(t.blockUi){TOPINCS.util.blockUi();setTimeout(function(){action(e);TOPINCS.util.releaseUi();},50);}else{action(e);}}}
this.aEl.addEvtListener("click",conditionalAction);if(this.setHref){this.setHref(HREF_VOID);}}
function activate(){this.active=true;this.containerEl.addEvtListener("mouseover",this.light);this.containerEl.addEvtListener("mouseout",this.normal);this.containerEl.deleteCSSClass("inactive");this.containerEl.deleteCSSClass(this.cssClasses.inactive);this.containerEl.addCSSClass(this.cssClasses.normal);}
function deactivate(){this.active=false;this.containerEl.removeEvtListener("mouseover",this.light);this.containerEl.removeEvtListener("mouseout",this.normal);this.containerEl.addCSSClass("inactive");this.containerEl.deleteCSSClass(this.cssClasses.light);this.containerEl.deleteCSSClass(this.cssClasses.normal);this.containerEl.addCSSClass(this.cssClasses.inactive);}})();CERNY.require("TOPINCS.widgets.MenuItem","TOPINCS.widgets.util","TOPINCS.widgets.Actionable","TOPINCS.cons","CERNY.dom.Element");(function(){TOPINCS.widgets.MenuItem=MenuItem;var Actionable=TOPINCS.widgets.Actionable;var Element=CERNY.dom.Element;var method=CERNY.method;var util=TOPINCS.widgets.util;var INACTIVE_CLASSNAME="inactive";var logger=CERNY.Logger("TOPINCS.widgets.MenuItem");function MenuItem(_label,_id,_active,_tooltip,_blockUi){this.tooltip=_tooltip;this.el=Element.create("div",null,"class=menu-item");if(this.tooltip){this.el.setAttr("title",this.tooltip);}
this.menuItemE=this.el;this.buttonE=Element.create("a",_label,"tabindex=0","class=menu-label");this.el.appendChild(this.buttonE);var iconName=_id.replace(/[0-9]*$/,"");Actionable.init(this,{containerEl:this.el,aEl:this.el,active:_active,iconName:iconName});}
MenuItem.prototype.logger=logger;Actionable(MenuItem.prototype);function display(targetEl){targetEl.appendChild(this.el);}
method(MenuItem.prototype,"display",display);function render(){return this.el;}
method(MenuItem.prototype,"render",render);function setLabel(label){this.buttonE.setText(label);}
method(MenuItem.prototype,"setLabel",setLabel);function setAccessKey(key){util.setAccessKey(this.buttonE,key);}
method(MenuItem.prototype,"setAccessKey",setAccessKey);function unsetAccessKey(key){util.unsetAccessKey(this.buttonE);}
method(MenuItem.prototype,"unsetAccessKey",unsetAccessKey);function setHref(href){this.buttonE.setAttr("href",href);}
method(MenuItem.prototype,"setHref",setHref);function getHref(href){return this.buttonE.getAttr("href");}
method(MenuItem.prototype,"getHref",getHref);})();CERNY.require("TOPINCS.widgets.Menu","TOPINCS.widgets.MenuItem","CERNY.js.Array","CERNY.dom.Element");(function(){TOPINCS.widgets.Menu=Menu;var check=CERNY.check;var method=CERNY.method;var pre=CERNY.pre;var signature=CERNY.signature;var Element=CERNY.dom.Element;var MenuItem=TOPINCS.widgets.MenuItem;var logger=CERNY.Logger("TOPINCS.widgets.Menu");function Menu(vertical){if(!vertical){vertical=false;}
this.items=[];var cssClassType="menu-horizontal";if(vertical){cssClassType="menu-vertical";}
this.el=Element.create("div",null,"class=menu "+cssClassType);this.vertical=vertical;}
Menu.prototype.logger=logger;function addItem(id,label,active,tooltip,blockUi){this[id]=new MenuItem(label,id,active,tooltip,blockUi);this.items.push(this[id]);}
signature(addItem,"undefined","string","string",["undefined","boolean"],["undefined","string"]);method(Menu.prototype,"addItem",addItem);pre(addItem,function(id,label){check(typeof this[id]==="undefined","Menu already has an item with id '"+id+"'");});function render(){var t=this;this.items.map(function(item){item.display(t.el);});if(!this.vertical){this.el.appendChild(Element.create("div","1","class=menu-dummy-content"));}
return this.el;}
signature(render,Element);method(Menu.prototype,"render",render);function display(el){el.appendChild(this.render());}
signature(display,"undefined",Element);method(Menu.prototype,"display",display);})();CERNY.require("TOPINCS.widgets.DropDiv","CERNY.dom.Element");(function(){var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.widgets.DropDiv");var Element=CERNY.dom.Element;method(TOPINCS.widgets,"DropDiv",DropDiv);function DropDiv(_element,_mindConf){if(!isBoolean(_mindConf)){_mindConf=true;}
this.mindConf=_mindConf;this.element=new Element(_element);if(this.element.getAttr("id")){this.id=this.element.getAttr("id");}else{this.mindConf=false;}
var bar=this.element.getFirstChild(function(o){return Element.cssFilter(o,'bar');});this.barE=new Element(bar);var body=this.element.getFirstChild(function(o){return Element.cssFilter(o,'body');});this.bodyE=new Element(body);var control=this.barE.getFirstChild(function(o){return Element.cssFilter(o,'control');});this.controlE=new Element(control);var t=this;this.controlE.addEvtListener("click",function(e){toggle(t);});if(this.mindConf&&CONF&&CONF.dd&&CONF.dd[this.id]){this.collapse();}}
function toggle(t){if(t.controlE.hasCSSClass("up")){t.collapse();}else{t.expand();}}
function collapse(){this.bodyE.hide();this.controlE.replaceCSSClass("up","down");if(this.mindConf&&CONF){CONF.dd=CONF.dd||{};CONF.dd[this.id]=true;CONF.write();}}
signature(collapse,"undefined");method(TOPINCS.widgets.DropDiv.prototype,"collapse",collapse);function expand(){this.controlE.replaceCSSClass("down","up");this.bodyE.show();if(this.mindConf&&CONF){CONF.dd=CONF.dd||{};CONF.dd[this.id]=false;CONF.write();}}
signature(expand,"undefined");method(TOPINCS.widgets.DropDiv.prototype,"expand",expand);function create(_dropDivE,_headerE,_bodyE,_expanded){_dropDivE.addCSSClass("drop-div");_headerE.addCSSClass("header");_bodyE.addCSSClass("body");var controlE=Element.create("div",null,"class=control");var barE=Element.create("div",null,"class=bar");_dropDivE.appendChild(barE);if(_expanded){_bodyE.show();}else{_bodyE.hide();}
barE.appendChildren(controlE,_headerE);_dropDivE.appendChild(_bodyE);return new DropDiv(_dropDivE.node,false);}
signature(create,"undefined");method(TOPINCS.widgets.DropDiv,"create",create);})();CERNY.require("TOPINCS.CoreTopics","TOPINCS.cons","TOPINCS.util");TOPINCS.CoreTopics=TOPINCS.util.getResult(CORE_TOPICS_URL,MEDIA_TYPE_CORE_TOPIC_PROXY_MAP);TOPINCS.CoreTopics.tool=TOPINCS.CoreTopics["topincs-tool"];TOPINCS.CoreTopics.language=TOPINCS.CoreTopics["34"];CERNY.require("TOPINCS.tmdm.IdMap");(function(){var method=CERNY.method;var signature=CERNY.signature;var name="TOPINCS.tmdm.IdMap";var logger=CERNY.Logger(name);TOPINCS.tmdm.IdMap=IdMap;function IdMap(){}
IdMap.prototype.logger=logger;function registerId(oldId,newId){if(this[oldId]&&this[oldId]!==newId){throw new Error("Old id '"+oldId+"' is already mapped onto '"+this[oldId]+"'. "+"It cannot be mapped onto '"+newId+"'.");}
this[oldId]=newId;}
signature(registerId,"undefined","string","string");method(IdMap.prototype,"registerId",registerId);function resolveId(oldId){var newId=this[oldId];if(newId){return newId;}else{throw new Error("Id could not be resolved: '"+oldId+"'");}}
signature(resolveId,"string","string");method(IdMap.prototype,"resolveId",resolveId);function apply(_item,predicate,deep){var idMap=this;predicate=predicate||function(){return true;}
deep=deep||false;_item.apply(function(item){var refProperties=item.references;var i=refProperties.length;while(i--){var propertyName=refProperties[i];var oldId=item[propertyName];if(predicate(propertyName,oldId)){try{item[propertyName]=idMap.resolveId(oldId);}catch(e){throw RefError(item.id,item.itemType,propertyName,oldId);}}}
if(item.scope){var newScope=[],oldScope=item.scope;i=oldScope.length;while(i--){var oldId=oldScope[i];if(predicate("scope",oldId)){try{newScope.unshift(idMap.resolveId(oldId));}catch(e){throw RefError(item.id,item.itemType,"scope",oldId);}}else{newScope.unshift(oldId);}}
item.scope=newScope;}
if(item.itemType=="Name"||item.itemType=="Occurrence"){if(item.parent){if(predicate("parent",item.parent)){var oldParent=item.parent;try{item.parent=idMap.resolveId(oldParent);}catch(e){throw RefError(item.id,item.itemType,"parent",oldParent);}}}}},deep);}
method(IdMap.prototype,"apply",apply);function RefError(id,type,property,refId){return new Error("An item (id: '"+id+", type: '"+type+"') "+"references in property "+property+" a topic with id '"+refId+"', "+"which cannot be resolved.");}})();CERNY.require("TOPINCS.tmdm.Exception");(function(){TOPINCS.tmdm.Exception=Exception;var signature=CERNY.signature;var method=CERNY.method;function Exception(){}
function replace(message,replacements){var result=message;for(var i=0;i<replacements.length;i++){result=result.replace(new RegExp("%"+(i+1),"g"),replacements[i]);}
return result;}
signature(replace,"string","string",Array);method(Exception.prototype,"replace",replace);})();CERNY.require("TOPINCS.tmdm.NullReferenceException","TOPINCS.tmdm.Exception");(function(){TOPINCS.tmdm.NullReferenceException=NullReferenceException;function NullReferenceException(item,propertyName){this.item=item;this.propertyName=propertyName;this.message=this.replace("The property '%1' of the item with the id '%2' and the type '%3' is null.",[propertyName,item.id,item.itemType]);}
NullReferenceException.prototype=new TOPINCS.tmdm.Exception();})();CERNY.require("TOPINCS.tmdm.ServerResponseException","CERNY.http.Response");(function(){TOPINCS.tmdm.ServerResponseException=ServerResponseException;function ServerResponseException(response){this.message=response.getBody()+" ("+response.getStatus()+")";}})();CERNY.require("TOPINCS.misc.Model","CERNY.js.String");TOPINCS.misc.Model={};function registerDependant(_o){if(isNonEmptyString(_o.id)){this._dependant||(this._dependant={});this._dependant[_o.id]=_o;}else{throw new Error("Dependant must have an id.");}}
function unregisterDependant(_o){if(isNonEmptyString(_o.id)){delete(this._dependant[_o.id]);}else{throw new Error("Dependant must have an id.");}}
function changed(_message){for(var e in this._dependant){if(this._dependant.hasOwnProperty(e)){this._dependant[e].update(_message);}}}
function augmentModel(_o){_o.registerDependant=registerDependant;_o.unregisterDependant=unregisterDependant;_o.changed=changed;}
CERNY.require("CERNY.event.List","CERNY.js.Array","CERNY.event.Observable");(function(){var Observable=CERNY.event.Observable;var method=CERNY.method;var signature=CERNY.signature;var name="CERNY.event.List";var logger=CERNY.Logger(name);var EVT_ITEM_ADDED=name+".EVT_ITEM_ADDED";var EVT_ITEM_INSERTED=name+".EVT_ITEM_INSERTED";var EVT_ITEM_REMOVED=name+".EVT_ITEM_REMOVED";var EVT_REARRANGED=name+".EVT_REARRANGED";function List(array){Observable(array);method(array,"addItem",addItem);method(array,"removeItem",removeItem);method(array,"insertItemAt",insertItemAt);method(array,"sortItems",sortItems);}
signature(List,"undefined",Array);method(CERNY.event,"List",List);CERNY.event.List.EVT_ITEM_ADDED=EVT_ITEM_ADDED;CERNY.event.List.EVT_ITEM_INSERTED=EVT_ITEM_INSERTED;CERNY.event.List.EVT_ITEM_REMOVED=EVT_ITEM_REMOVED;CERNY.event.List.EVT_REARRANGED=EVT_REARRANGED;function addItem(item){this.push(item);this.notify(EVT_ITEM_ADDED);}
signature(addItem,"undefined","any");function removeItem(item){var index=this.remove(item);this.notify(EVT_ITEM_REMOVED,index);}
signature(removeItem,"undefined","any");function insertItemAt(index,item){this.insertAt(index,item);this.notify(EVT_ITEM_INSERTED,index);}
signature(insertItemAt,"number","any");function sortItems(comparator){this.sort(comparator);this.notify(EVT_REARRANGED);}
signature(sortItems,"undefined","function");})();if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;}
Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function stringify(value,whitelist){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case'string':return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c;}
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"':'"'+value+'"';case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
if(typeof value.toJSON==='function'){return stringify(value.toJSON());}
a=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist)||'null');}
return'['+a.join(',')+']';}
if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}else{for(k in value){if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}
return'{'+a.join(',')+'}';}}
return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n;}}}}
return filter(k,v);}
if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j;}
throw new SyntaxError('parseJSON');}};}();}
CERNY.require("TOPINCS.tmdm.Construct","TOPINCS.tmdm.IdMap","TOPINCS.tmdm.NullReferenceException","TOPINCS.tmdm.ServerResponseException","TOPINCS.cons","TOPINCS.util","TOPINCS.misc.Model","CERNY.js.Array","CERNY.js.String","CERNY.event.List","CERNY.http.Request","CERNY.http.Response","JSON");(function(){var IdMap=TOPINCS.tmdm.IdMap;var List=CERNY.event.List;var Request=CERNY.http.Request;var Response=CERNY.http.Response;var ServerResponseException=TOPINCS.tmdm.ServerResponseException;var send=TOPINCS.util.sendRequest;var signature=CERNY.signature;var pre=CERNY.pre;var check=CERNY.check;var method=CERNY.method;var name="TOPINCS.tmdm.Construct";var logger=CERNY.Logger(name);TOPINCS.tmdm.Construct=Construct;var EVT_SAVE_SUCCESS=name+".EVT_SAVE_SUCCESS";var EVT_SAVE_FAILURE=name+".EVT_SAVE_FAILURE";var EVT_DELETE_SUCCESS=name+".EVT_DELETE_SUCCESS";var EVT_DELETE_FAILURE=name+".EVT_DELETE_FAILURE";var EVT_MERGE_ITEM_ADDED=name+".EVT_MERGE_ITEM_ADDED";Construct.baseUri=TOPINCS.util.getBaseUri();var PREFIX_TEMP="temp:";var MAP_TEMP_IDS=new IdMap();function Construct(item,properties,children){if(item){this.init(item,properties,children);}}
Construct.logger=logger;Construct.prototype.logger=logger;Construct.EVT_SAVE_SUCCESS=EVT_SAVE_SUCCESS;Construct.EVT_SAVE_FAILURE=EVT_SAVE_FAILURE;Construct.EVT_DELETE_SUCCESS=EVT_DELETE_SUCCESS;Construct.EVT_DELETE_FAILURE=EVT_DELETE_FAILURE;Construct.EVT_MERGE_ITEM_ADDED=EVT_MERGE_ITEM_ADDED;function init(item,properties,children){augmentModel(this);if(isUndefined(item.id)){if(this.isNew){item.id=Construct.createTempId(this.itemType);}else{try{item.id=Construct.extractSystemIdFromItemIdentifier(item.item_identifiers[0]);}catch(e){item.id=Construct.createTempId(this.itemType);}}}
this.id=item.id;if(item.parent){item.parent=Construct.extractSystemIdFromItemIdentifier(item.parent[0]);}
if(this.itemType!="Topic"&&isUndefined(item.reifier)){item.reifier=null;}
if(item.item_identifiers){this.item_identifiers=CERNY.clone(item.item_identifiers);}else{this.item_identifiers=[];}
var t=this;properties.map(function(name){var value=item[name];if(t.references.contains(name)){value=Construct.extractSystemIdFromItemIdentifier(value);}
t[name]=value;});for(var name in children){var kids=[];List(kids);var type=children[name];if(isArray(item[name])){item[name].map(function(childItem){if(isArray(item.item_identifiers)&&item.item_identifiers.length>0){childItem.parent=[item.item_identifiers[0]];}
var i=new type(childItem);kids.push(i);});}
this[name]=kids;}
if(isArray(item.scope)){this.scope=CERNY.clone(item.scope);this.scope=this.scope.map(function(ref){return Construct.extractSystemIdFromItemIdentifier(ref);});this.scope_names=CERNY.clone(item.scope_names);}
this.foreignProxies=[];}
signature(init,"undefined","object",Array,"object");method(Construct.prototype,"init",init);function isSystemId(id){return isNumber(new Number(id).valueOf());}
signature(isSystemId,"boolean","string");method(Construct,"isSystemId",isSystemId);function getUrl(){return this.dirName+"/"+this.id;}
signature(getUrl,"string");method(Construct.prototype,"getUrl",getUrl);function getParentURL(){return this.parentDirName+"/"+this.parent;}
signature(getParentURL,"string");method(Construct.prototype,"getParentURL",getParentURL);pre(getParentURL,function(){check(isString(this.parent),"this.parent must be a string");});function getAbsoluteURL(){return Construct.baseUri+this.getUrl();}
signature(getAbsoluteURL,"string");method(Construct.prototype,"getAbsoluteURL",getAbsoluteURL);var lastTempId=new Date().getTime();function createTempId(itemType){lastTempId-=1;return PREFIX_TEMP+itemType+"-"+lastTempId;}
signature(createTempId,"string","string");method(Construct,"createTempId",createTempId);function isTempId(id){return id&&id.indexOf(PREFIX_TEMP)==0;}
signature(isTempId,"boolean",["undefined","null","string"]);method(Construct,"isTempId",isTempId);function get(url,scope,callback,options){scope=scope||ACCEPT_SCOPE;options=options||{};var topincsOptions=options.options||"mind_name=1";var nocache=false;if(isBoolean(options.nocache)){nocache=options.nocache;}
var request=new Request("GET",url);request.setHeader("X-Topincs-Options",topincsOptions);request.setHeader("X-Topincs-Accept-Scope",scope);request.setHeader("Accept",MEDIA_TYPE_JSON);if(nocache){request.setNoCacheHeaders();}
var response=send(request,callback);if(response){return response;}
return request;}
signature(get,[Request,Response],"string",["undefined","string"],["undefined","function"]);method(Construct,"get",get);function post(newItem,children,parent,callback,incremental,parentUrl){var core=newItem.core(children,parent);core.version="1.0";core.item_type=newItem.itemType;var url;if(this===Construct){if(parentUrl){url=parentUrl;}else{if(isUndefined(newItem.parent)){if(newItem.itemType=="Topic"||newItem.itemType=="Association"){url=".";}}else{url=newItem.getParentURL();}}}else{url=this.getUrl();}
var request=new Request("POST",url);if(isBoolean(incremental)&&incremental==true){request.setHeader("X-Topincs-Options","replace_locators=0");}
request.setBody(JSON.stringify(core),MEDIA_TYPE_JSON);function onComplete(response){if(response.status==201||response.status==204){delete(newItem.isNew);delete(newItem.isForeign);var systemId=extractSystemIdFromItemIdentifier(response.getHeader("Location"));if(newItem.itemType=="Topic"){MAP_TEMP_IDS.registerId(newItem.id,systemId);}
newItem.id=systemId;newItem.commit();newItem.notify(EVT_SAVE_SUCCESS,systemId);}else{throw new ServerResponseException(response);newItem.notify(EVT_SAVE_FAILURE);}}
return send(request,callback,onComplete);}
signature(post,["undefined",Response],"object",["undefined","boolean"],["undefined","boolean"],["undefined","function"]);method(Construct.prototype,"post",post);method(Construct,"post",post);pre(post,function(newItem,children,parent,callback){if(this===Construct){check(isString(newItem.parent),"when called static, newItem must have a parent.");}});function put(children,parent,callback,incremental){var request=new Request("PUT",this.getUrl());if(isBoolean(incremental)&&incremental==true){request.setHeader("X-Topincs-Options","replace_locators=0");}
var core=this.core(children,parent);core.version="1.0";core.item_type=this.itemType;request.setBody(JSON.stringify(core),MEDIA_TYPE_JSON);var t=this;function onComplete(response){if(response.status==200){t.commit();t.notify(EVT_SAVE_SUCCESS);}else{t.notify(EVT_SAVE_FAILURE);}}
return send(request,callback,onComplete);}
signature(put,["undefined",Response],["undefined","boolean"],["undefined","boolean"],["undefined","function"]);pre(put,function(children,parent,callback){check(this.isNew!==true,"New items cannot be put.");});method(Construct.prototype,"put",put);function _delete(callback){var request=new Request("DELETE",this.getUrl());var t=this;function onComplete(response){if(response.status==204){t.isDeleted=true;t.notify(EVT_DELETE_SUCCESS);}else{t.notify(EVT_DELETE_FAILURE);}}
return send(request,callback,onComplete);}
signature(_delete,["undefined",Response],["undefined","function"]);method(Construct.prototype,"_delete",_delete);function core(children,parent,mindSystemId,idMapPredicate){if(!isBoolean(children)){children=true;}
if(!isBoolean(parent)){parent=false;}
if(!isBoolean(mindSystemId)){mindSystemId=true;}
if(!isFunction(idMapPredicate)){idMapPredicate=function(name,value){return isTempId(value);};}
MAP_TEMP_IDS.apply(this,idMapPredicate);var t=this,selfReference=false,value,core={},special=["scope","subject_identifiers","subject_locators","item_identifiers"];for(var property in this){if(this.hasOwnProperty(property)){if(special.contains(property)||this.properties.contains(property)){if(!property.match(/_name/)&&(property!="parent"||parent)){value=this[property];if(value!==null){if(isArray(value)){if(value.length>0){if(property=="scope"){value=CERNY.clone(value).map(systemIdToTopicReference);}
core[property]=value;}}else{if(this.references.contains(property)){value=systemIdToTopicReference(value);}
core[property]=value;}}}}}}
if(mindSystemId&&isSystemId(this.id)){if(!isArray(core.item_identifiers)){core.item_identifiers=[];}
var publicId=systemIdToPublicId(this.id,this.dirName);core.item_identifiers=core.item_identifiers.unique();core.item_identifiers.remove(publicId);core.item_identifiers.unshift(publicId);}
var topicIdMapPredicate;if(this.itemType=="Topic"){topicIdMapPredicate=function(name,value){if(value==t.id){selfReference=true;}else{return isTempId(value);}}}
if(children){for(var child in this.children){if(this.children.hasOwnProperty(child)&&this[child].length>0){core[child]=[];this[child].map(function(kid){core[child].push(kid.core(children,false,true,topicIdMapPredicate));});}}}
if(selfReference&&isTempId(this.id)){core.item_identifiers=[this.id];}
return core;}
signature(core,"object",["undefined","boolean"],["undefined","boolean"]);method(Construct.prototype,"core",core);function addChild(arrayName,child){if(!isArray(this[arrayName])){this[arrayName]=[];}
if(!this[arrayName].contains(child,identicalByReference)){this[arrayName].push(child);}}
signature(addChild,"undefined","string",Construct);method(Construct.prototype,"addChild",addChild);function removeChild(arrayName,child){this[arrayName].remove(child);}
signature(removeChild,"undefined","string",Construct);method(Construct.prototype,"removeChild",removeChild);pre(removeChild,function(name,child){check(isArray(this[name],"this[name] is not an array"));});function addNames(getName){this.apply(function(item){item.references.map(function(propertyName){if(!item[propertyName+"_name"]){item[propertyName+"_name"]=getName(item[propertyName]);}});});}
signature(addNames,"undefined","function");method(Construct.prototype,"addNames",addNames);function merge(foreignItem){var t=this;var properties=foreignItem.properties;var i=properties.length;while(i--){var propertyName=properties[i];if(propertyName!=="parent"){var localValue=t.get(propertyName);var proxyValue=foreignItem.get(propertyName);if(localValue!==proxyValue){t.set(propertyName,foreignItem.get(propertyName));}}}
t.item_identifiers.append(foreignItem.item_identifiers);t.item_identifiers=t.item_identifiers.unique();if(t.itemType=="Topic"){t.subject_identifiers.append(foreignItem.subject_identifiers);t.subject_identifiers=t.subject_identifiers.unique();t.subject_locators.append(foreignItem.subject_locators);t.subject_locators=t.subject_locators.unique();}
for(var child in foreignItem.children){var childArray=foreignItem[child];i=childArray.length;while(i--){var foreignProxy=childArray[i];var localProxy=t.locateChild(foreignProxy);if(localProxy){localProxy.addForwarding(t);localProxy.merge(foreignProxy);localProxy.foreignProxies.unshift(foreignProxy);localProxy.removeForwarding(t);}else{foreignProxy.replaceSystemIdsByTempIds();foreignProxy.isNew=true;foreignProxy.isForeign=true;t[child].unshift(foreignProxy);t.notify(EVT_MERGE_ITEM_ADDED,foreignProxy,t);}}}}
signature(merge,"undefined","object");method(Construct.prototype,"merge",merge);function replaceSystemIdsByTempIds(){this.apply(function(item){if(Construct.isSystemId(item.id)){item.id=Construct.createTempId(item.itemType);}},true);}
signature(replaceSystemIdsByTempIds,"undefined","object");method(Construct.prototype,"replaceSystemIdsByTempIds",replaceSystemIdsByTempIds);function apply(f,deep){f(this);if(deep){for(var child in this.children){var childArray=this[child];var i=childArray.length;while(i--){childArray[i].apply(f,true);}}}}
signature(apply,"undefined","object","boolean");method(Construct.prototype,"apply",apply);function locateChild(child){var iiIndex=this[child.dirName].iiIndex;var array=child.item_identifiers,item;for(var i=0;i<array.length&&!item;i++){item=iiIndex[array[i]];}
return item;}
signature(locateChild,"undefined");method(Construct.prototype,"locateChild",locateChild);function buildIndex(){var t=this;for(var child in t.children){var idIndex={};var iiIndex={};var childArray=t[child];var i=childArray.length;while(i--){var kid=childArray[i];idIndex[kid.id]=kid;var j=kid.item_identifiers.length;while(j--){var ii=kid.item_identifiers[j];if(!Construct.isSystemId(ii)){iiIndex[ii]=kid;}}
kid.buildIndex();}
childArray.idIndex=idIndex;childArray.iiIndex=iiIndex;}}
signature(buildIndex,"undefined");method(Construct.prototype,"buildIndex",buildIndex);function validate(){this.apply(function(item){item.references.map(function(propertyName){if(!isNonEmptyString(item[propertyName])){throw new TOPINCS.tmdm.NullReferenceException(item,propertyName);}});},true);}
signature(validate,"undefined");method(Construct.prototype,"validate",validate);function collectReferences(deep){if(!isBoolean(deep)){deep=true;}
var result=[];this.apply(function(item){var i=item.references.length;while(i--){result.push(item[item.references[i]]);}
if(item.scope){i=item.scope.length;while(i--){result.push(item.scope[i]);}}},deep);return result.unique();}
signature(collectReferences,Array,["undefined","boolean"]);method(Construct.prototype,"collectReferences",collectReferences);function extractSystemIdFromItemIdentifier(uri){if(isSystemId(uri)){return uri;}
var info=CERNY.util.parseUri(uri);var segments=info.path.split("/");return segments[segments.length-1];}
signature(extractSystemIdFromItemIdentifier,"string","string");method(Construct,"extractSystemIdFromItemIdentifier",extractSystemIdFromItemIdentifier);function locateForeignTopic(foreignTopic,handleLocationResponse){var localId=foreignTopic.locate(CERNY.joinFunctions(makeLocal,handleLocationResponse));if(!handleLocationResponse){return makeLocal(foreignTopic,localId);}}
method(Construct,"locateForeignTopic",locateForeignTopic);function makeLocal(topic,localId){if(localId){MAP_TEMP_IDS.registerId(topic.id,localId);topic.formerTempId=topic.id;topic.id=localId;delete(topic.isNew);delete(topic.isForeign);return localId;}}
function scopeEquals(a,b){return a.isSubArray(b)&&b.isSubArray(a);}
signature(scopeEquals,"boolean",Array,Array);method(Construct,"scopeEquals",scopeEquals);function systemIdToTopicReference(systemId){if(isSystemId(systemId)){return"ii:"+systemIdToPublicId(systemId,"topics");}else if(isTempId(systemId)){return"ii:"+systemId;}else{return systemId;}}
function systemIdToPublicId(systemId,dirName){return Construct.baseUri+dirName+"/"+systemId;}
function isLocalLocator(locator){return locator.match(new RegExp("^"+Construct.baseUri))!==null;}})();CERNY.require("CERNY.event.Revertable","CERNY.event.Observable","CERNY.js.Array");(function(){var check=CERNY.check;var method=CERNY.method;var signature=CERNY.signature;var pre=CERNY.pre;var Observable=CERNY.event.Observable;var name="CERNY.event.Revertable";var logger=CERNY.Logger(name);var EVT_CHANGE=name+".change";var EVT_REVERT=name+".revert";function Revertable(obj,properties){Observable(obj);method(obj,"set",set);method(obj,"get",get);method(obj,"getOriginal",getOriginal);method(obj,"commit",commit);method(obj,"revert",revert);method(obj,"hasChanged",hasChanged);properties=properties.map(function(property){if(isString(property)){return{name:property};}
return property;});if(obj._revertableProperties){properties.append(obj._revertableProperties);}
obj._revertableProperties=properties;createGetterAndSetters(obj);}
signature(Revertable,"undefined","object",Array);method(CERNY.event,"Revertable",Revertable);pre(Revertable,function(obj,properties){check(!obj._revertableChangeCount||obj._revertableChangeCount>0,"Revertable cannot be called on changed objects.");});CERNY.event.Revertable.EVT_CHANGE=EVT_CHANGE;CERNY.event.Revertable.EVT_REVERT=EVT_REVERT;function init(t){delete(t._revertableOriginal);t._revertableOriginal={};t._revertableChangeCount=0;}
function set(name,value,equals){equals=equals||defaultEquals;if(!equals(this[name],value)){var event=EVT_CHANGE;if(!this._revertableOriginal){init(this);}
if(this._revertableOriginal[name]){if(equals(value,this._revertableOriginal[name])){delete(this._revertableOriginal[name]);this._revertableChangeCount-=1;if(this._revertableChangeCount===0){event=EVT_REVERT;}}}else{this._revertableOriginal[name]=this[name];this._revertableChangeCount+=1;}
this[name]=value;this.notify(event);}}
signature(set,"undefined","string","any");pre(set,function(name,value){check(this._revertableProperties.contains({name:name},propertyEquals),"the property '"+name+"' is not revertable");});function get(name){return this[name];}
signature(get,"any","string");function getOriginal(name){if(this._revertableOriginal&&this._revertableOriginal.hasOwnProperty(name)){return this._revertableOriginal[name];}
return this.get(name);}
signature(getOriginal,"any","string");function commit(){init(this);}
signature(commit,"undefined");function revert(){var t=this;if(this._revertableOriginal){this._revertableProperties.map(function(property){var name=property.name;if(t._revertableOriginal.hasOwnProperty(name)){t[name]=t._revertableOriginal[name];}});}
init(this);this.notify(EVT_REVERT);}
signature(revert,"undefined");function hasChanged(){return this._revertableChangeCount>0;}
signature(hasChanged,"boolean");function createGetterAndSetters(obj){obj._revertableProperties.map(function(property){var name=capitalize(property.name);var setterName="set"+name;var getterName="get";if(property.type==="boolean"||property.type===Boolean){getterName="is";}
getterName+=name;function getter(){return this[property];}
function setter(value){this.set(property.name,value,property.equals);}
if(property.type){signature(getter,property.type);signature(setter,"undefined",property.type);}
method(obj,getterName,getter);method(obj,setterName,setter);});}
function cap(str){return str.substring(0,1).toUpperCase()+str.substring(1);}
function capitalize(str){var result="";var segments=str.split("_");for(var i=0;i<segments.length;i++){result+=cap(segments[i]);}
return result;}
function propertyEquals(a,b){return a.name===b.name;}
function defaultEquals(a,b){return a===b;}})();CERNY.require("TOPINCS.tmdm.EmptyValueException","TOPINCS.tmdm.Exception");(function(){TOPINCS.tmdm.EmptyValueException=EmptyValueException;function EmptyValueException(item){this.item=item;this.message=this.replace("There is an empty value on the item of type '%2' and with the id '%1'",[item.id,item.itemType]);}
EmptyValueException.prototype=new TOPINCS.tmdm.Exception();})();CERNY.require("TOPINCS.tmdm.Occurrence","TOPINCS.cons","CERNY.text.DateFormat","CERNY.js.Date","CERNY.js.Array","CERNY.event.Revertable","TOPINCS.tmdm.EmptyValueException","TOPINCS.CoreTopics","TOPINCS.tmdm.Construct");(function(){var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var method=CERNY.method;var require=CERNY.require;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.tmdm.Occurrence");TOPINCS.tmdm.Occurrence=Occurrence;var properties=["value","datatype","type","type_name","reifier","parent"];var children={};function Occurrence(item){if(!item){this.isNew=true;item={value:"",type:CoreTopics.occurrence.id,type_name:CoreTopics.occurrence.label};}
if(isUndefined(item.datatype)){item.datatype=DT_STRING;}
this.init(item,properties,children);if(!this.scope){this.scope=[];}}
Occurrence.prototype=new Construct();Occurrence.prototype.logger=logger;Occurrence.prototype.properties=properties;Occurrence.prototype.children=children;Occurrence.prototype.references=["type"];Occurrence.prototype.dirName="occurrences";Occurrence.prototype.parentDirName="topics";Occurrence.prototype.itemType="Occurrence";var revertableProperties=[{name:"scope",equals:Construct.scopeEquals}];revertableProperties.append(properties);CERNY.event.Revertable(Occurrence.prototype,revertableProperties);function guessDatatype(value){var map={};map['^(http|https|ftp|mailto)://']=DT_ANYURI;for(var regexp in map){if(map.hasOwnProperty(regexp)){if(value.match(new RegExp(regexp))){return map[regexp];}}}
return DT_STRING;}
signature(guessDatatype,"string","string");method(Occurrence,"guessDatatype",guessDatatype);function setValue(value){this.set("value",value);}
signature(setValue,"undefined","string");method(Occurrence.prototype,"setValue",setValue);function validateValueForDatatype(newValue,datatype){switch(datatype){case DT_DATE:if(!Date._parse(newValue,CERNY.text.DateFormat.ISO)){throw new Error("Must be a date in ISO Format.");}
break;default:}}
function validate(){try{validateValueForDatatype(this.value,this.datatype);}catch(e){this.isInvalid=true;throw e;}
this.isInvalid=false;}
signature(validate,"undefined");method(Occurrence.prototype,"validate",validate);})();CERNY.require("TOPINCS.tmdm.Variant","TOPINCS.cons","CERNY.event.Revertable","TOPINCS.tmdm.Construct");(function(){var Construct=TOPINCS.tmdm.Construct;var logger=CERNY.Logger("TOPINCS.tmdm.Variant");TOPINCS.tmdm.Variant=Variant;var properties=["value","datatype","reifier","parent"];var children={};function Variant(item){if(!item){this.isNew=true;item={value:""};}
if(isUndefined(item.datatype)){item.datatype=DT_STRING;}
this.init(item,properties,children);if(!this.scope){this.scope=[];}}
Variant.prototype=new Construct();Variant.prototype.logger=logger;Variant.prototype.properties=properties;Variant.prototype.children=children;Variant.prototype.references=[];Variant.prototype.dirName="variants";Variant.prototype.parentDirName="names";Variant.prototype.itemType="_Variant";CERNY.event.Revertable(Variant.prototype,properties);})();CERNY.require("TOPINCS.tmdm.Name","TOPINCS.cons","TOPINCS.tmdm.Variant","TOPINCS.tmdm.Occurrence","CERNY.event.Revertable","TOPINCS.tmdm.EmptyValueException","TOPINCS.CoreTopics","TOPINCS.tmdm.Construct");(function(){var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var Occurrence=TOPINCS.tmdm.Occurrence;var Variant=TOPINCS.tmdm.Variant;var logger=CERNY.Logger("TOPINCS.tmdm.Name");var signature=CERNY.signature;var method=CERNY.method;var require=CERNY.require;TOPINCS.tmdm.Name=Name;var properties=["value","type","type_name","reifier","parent"];var children={"variants":Variant};function Name(item){if(!item){this.isNew=true;item={value:"",type:CoreTopics["topic-name"].id,type_name:CoreTopics["topic-name"].label};}
this.init(item,properties,children);if(!this.scope){this.scope=[];}}
Name.prototype=new Construct();Name.prototype.logger=logger;Name.prototype.properties=properties;Name.prototype.children=children;Name.prototype.references=["type"];Name.prototype.dirName="names";Name.prototype.parentDirName="topics";Name.prototype.itemType="Name";var revertableProperties=[{name:"scope",equals:Construct.scopeEquals}];revertableProperties.append(properties);CERNY.event.Revertable(Name.prototype,revertableProperties);function validate(){if(!isNonEmptyString(this.value)){this.isInvalid=true;throw new TOPINCS.tmdm.EmptyValueException(this);}
this.isInvalid=false;}
signature(validate,"undefined");method(Name.prototype,"validate",validate);})();CERNY.require("TOPINCS.tmdm.Topic","CERNY.event.Revertable","CERNY.http.Request","CERNY.http.Response","TOPINCS.tmdm.Occurrence","TOPINCS.tmdm.Name","TOPINCS.tmdm.Construct","TOPINCS.util","TOPINCS.cons");(function(){var Construct=TOPINCS.tmdm.Construct;var Name=TOPINCS.tmdm.Name;var Occurrence=TOPINCS.tmdm.Occurrence;var Request=CERNY.http.Request;var Response=CERNY.http.Response;var sendRequest=TOPINCS.util.sendRequest;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.tmdm.Topic");TOPINCS.tmdm.Topic=Topic;var properties=["parent"];var children={"occurrences":Occurrence,"names":Name};function Topic(item){if(!item){this.isNew=true;item={};}
this.subject_identifiers=[];this.subject_locators=[];this.init(item,properties,children);if(item){if(item.subject_identifiers){this.subject_identifiers=CERNY.clone(item.subject_identifiers);}
if(item.subject_locators){this.subject_locators=CERNY.clone(item.subject_locators);}}}
Topic.prototype=new Construct();Topic.logger=logger;Topic.prototype.logger=logger;Topic.prototype.properties=properties;Topic.prototype.children=children;Topic.prototype.references=[];Topic.prototype.dirName="topics";Topic.prototype.parentDirName="topicmaps";Topic.prototype.itemType="Topic";CERNY.event.Revertable(Topic.prototype,properties);function getLabel(scope,language){var names=this.names;if(language){if(language==USCOPE){names=names.filter(function(name){return!name.scope||name.scope.length==0;});}else{names=names.filter(function(name){return name.scope?name.scope.contains(language):false;});}}
if(names.length>0){if(scope&&scope.length>0){var namesInScope=names.filter(function(name){return name.scope?scope.isSubArray(name.scope):false;});if(namesInScope.length>0){return namesInScope[0].value;}else{return this.getLabel(scope.slice(0,scope.length-1),language);}}
if(names[0]){return names[0].value;}}}
signature(getLabel,["undefined","string"],["undefined",Array],["undefined","string"]);method(Topic.prototype,"getLabel",getLabel);function get(id,options){var response=Construct.get(Topic.getUrl(id),null,null,options);if(response.status==200){return new Topic(response.getValue());}
return null;}
signature(get,["null",Topic],"string");method(Topic,"get",get);function getUrl(id){return Topic.prototype.dirName+"/"+id;}
signature(getUrl,"string","string");method(Topic,"getUrl",getUrl);function locate(handleLocationResponse){var url=TOPIC_LOCATE_URL+"?";this.item_identifiers.map(function(ii){url+="ii="+encodeURIComponent(ii)+"&";});this.subject_identifiers.map(function(si){url+="si="+encodeURIComponent(si)+"&";});this.subject_locators.map(function(sl){url+="sl="+encodeURIComponent(sl)+"&";});var request=new Request("GET",url);if(handleLocationResponse){sendRequest(request,handler);}else{var response=sendRequest(request);if(response&&response.getStatus()==200){return response.getBody();}}
var t=this;function handler(_req){var _response=new Response(_req);var id;if(_response&&_response.getStatus()==200){id=_response.getBody();}
handleLocationResponse(t,id);}}
signature(locate,["undefined","string"]);method(Topic.prototype,"locate",locate);function locateBySubjectIdentifier(locator){return serverlocate("si",locator);}
signature(locateBySubjectIdentifier,["string","undefined"],"string");method(Topic,"locateBySubjectIdentifier",locateBySubjectIdentifier);function locateBySubjectLocator(locator){return serverlocate("sl",locator);}
signature(locateBySubjectLocator,["string","undefined"],"string");method(Topic,"locateBySubjectLocator",locateBySubjectLocator);function locateByItemIdentifier(locator){return serverlocate("ii",locator);}
signature(locateByItemIdentifier,["string","undefined"],"string");method(Topic,"locateByItemIdentifier",locateByItemIdentifier);function serverlocate(type,locator){var request=new Request("GET",TOPIC_LOCATE_URL+"?"+type+"="+encodeURIComponent(locator));var response=request.sendSynch();if(response.getStatus()==200){return response.getBody();}}})();CERNY.require("TOPINCS.tmdm.ext.Labeler","CERNY.http.Request","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Topic");(function(){var method=CERNY.method;var signature=CERNY.signature;var name="TOPINCS.tmdm.ext.Labeler";var logger=CERNY.Logger(name);var registeredLabels=[];TOPINCS.tmdm.ext.Labeler=Labeler;function Labeler(conf){this.englishId=conf.englishId;this.uiLanguageId=conf.uiLanguageId;this.acceptedLanguagesIds=conf.acceptedLanguagesIds||[];}
Labeler.prototype.logger=logger;function getTopicLabel(topic,scope){for(var i=0,l=this.acceptedLanguagesIds.length;i<l;i++){label=topic.getLabel(scope,this.acceptedLanguagesIds[i]);if(label){return label;}}
label=topic.getLabel(scope,USCOPE);if(label){return label;}
label=topic.getLabel(scope,this.englishId);if(label){return foreign(label);}
label=topic.getLabel(scope);if(label){return foreign(label);}
return this.getTopicLabelById(topic.id,scope);}
signature(getTopicLabel,"string",TOPINCS.tmdm.Topic,["undefined",Array]);method(Labeler.prototype,"getTopicLabel",getTopicLabel);function getTopicLabelById(topicId,scope){var label=registeredLabels[getRegistryKey(topicId,scope)];if(label){return label;}
return Labeler.getTopicLabelFromServer(topicId,scope,this.uiLanguageId);}
signature(getTopicLabelById,"string","string",["undefined",Array]);method(Labeler.prototype,"getTopicLabelById",getTopicLabelById);function registerLabel(topicId,label,scope){registeredLabels[getRegistryKey(topicId,scope)]=label;}
signature(registerLabel,"undefined","string","string",["undefined","string"]);method(Labeler,"registerLabel",registerLabel);function getTopicLabelFromServer(systemId,scope,language){if(TOPINCS.tmdm.Construct.isTempId(systemId)){return systemId;}
var url=TOPIC_LABEL_URL+"?system_id="+systemId;if(scope&&scope.length>0){url+="&scope="+scope.join(",");}
if(language){url+="&language="+language;}
var response=new CERNY.http.Request("GET",url).sendSynch();if(response.getStatus()==200){return response.getBody();}
return systemId;}
signature(getTopicLabelFromServer,"string","string",["undefined",Array]);method(Labeler,"getTopicLabelFromServer",getTopicLabelFromServer);function foreign(_label){var l=new String(_label);l.foreignLanguage=true;return l;}
function getRegistryKey(id,scope){if(scope){return id+":"+scope.sort().join("-");}else{return id;}}})();CERNY.require("TOPINCS.lang","CERNY.js.Array","TOPINCS.CoreTopics");(function(){var CoreTopics=TOPINCS.CoreTopics;TOPINCS.lang={ids:{ui:CoreTopics.Languages[TOPINCS.UI_LANGUAGE].id,en:CoreTopics.Languages.en.id,accepted:TOPINCS.ACCEPTED_LANGUAGES.map(function(langCode){var proxy=CoreTopics.Languages[langCode];if(proxy&&proxy.id){return proxy.id;}}).filter(function(id){return isString(id);})}};})();CERNY.require("CERNY.dom.html","CERNY.dom");CERNY.namespace("dom.html");CERNY.dom.html.logger=CERNY.Logger("CERNY.dom.html");function isElementWithName(o,name){return isElement(o)&&o.tagName.toLowerCase()===name;}
function isA(o){return isElementWithName(o,"a");}
function isP(o){return isElementWithName(o,"p");}
function isImg(o){return isElementWithName(o,"img");}
function isSpan(o){return isElementWithName(o,"span");}
function isH1(o){return isElementWithName(o,"h1");}
function isDiv(o){return isElementWithName(o,"div");}
function isTable(o){return isElementWithName(o,"table");}
function isTBody(o){return isElementWithName(o,"tbody");}
function isTR(o){return isElementWithName(o,"tr");}
function isTD(o){return isElementWithName(o,"td");}
function isInput(o){return isElementWithName(o,"input");}
function isSelect(o){return isElementWithName(o,"select");}
function isOption(o){return isElementWithName(o,"option");}
function isTextarea(o){return isElementWithName(o,"textarea");}
function isFormField(o){return isInput(o)||isTextarea(o)||isSelect(o);}
function isListItem(o){return isElementWithName(o,"li");}
CERNY.require("TOPINCS.I18NException");(function(){TOPINCS.I18NException=I18NException;var logger=CERNY.Logger("TOPINCS.I18NException");var signature=CERNY.signature;var method=CERNY.method;function I18NException(messageKey,replacements){if(messageKey){this.messageKey=messageKey;this.replacements=replacements;}}
I18NException.prototype.logger=logger;function getMessage(dictionary){return this.dictionary.get(this.messageKey,this.replacements);}
signature(getMessage,"string","object");method(I18NException.prototype,"getMessage",getMessage);})();CERNY.require("TOPINCS.wiki.DICT","TOPINCS.dict");(function(){eval("TOPINCS.wiki.DICT = "+TOPINCS.dict.getDictionary("TOPINCS.wiki.DICT")+";");TOPINCS.wiki.DICT.get=TOPINCS.dict.get;})();CERNY.require("TOPINCS.wiki.Exception","TOPINCS.I18NException","TOPINCS.wiki.DICT");(function(){TOPINCS.wiki.Exception=Exception;function Exception(messageKey,replacements){TOPINCS.I18NException.call(this,messageKey,replacements);}
Exception.prototype=new TOPINCS.I18NException();Exception.prototype.dictionary=TOPINCS.wiki.DICT;})();CERNY.require("TOPINCS.wiki.MainTopicNotFoundException","TOPINCS.wiki.Exception");(function(){TOPINCS.wiki.MainTopicNotFoundException=MainTopicNotFoundException;var logger=CERNY.Logger("TOPINCS.wiki.MainTopicNotFoundException");var Exception=TOPINCS.wiki.Exception;function MainTopicNotFoundException(){Exception.call(this,"msg_main_topic_not_found",[]);}
MainTopicNotFoundException.prototype=new Exception();})();CERNY.require("TOPINCS.misc.Web","CERNY.js.Array");(function(){TOPINCS.misc.Web=Web;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.misc.Web");function Web(){this.nodes={};this.count=0;}
Web.prototype.logger=logger;function size(){return this.count;}
method(Web.prototype,"size",size);function declareSpecial(id){node(this,id).special=true;}
method(Web.prototype,"declareSpecial",declareSpecial);function addLink(a,b){var nodeA=node(this,a);var nodeB=node(this,b);link(nodeA,nodeB);}
signature(addLink,"undefined","string","string");method(Web.prototype,"addLink",addLink);function remove(a){var result=[];var nodeA=node(this,a);if(nodeA){result.pushUnique(removeNode(this,nodeA).id);for(var id in this.nodes){if(this.nodes.hasOwnProperty(id)){var nextNode=this.nodes[id];if(!isLinkedToBySpecial(nextNode)){result.pushUnique(removeNode(this,nextNode).id);}}}}
return result;}
method(Web.prototype,"remove",remove);function node(t,id){var n=t.nodes[id];if(!n){n={id:id,links:[],backlinks:[],special:false};t.nodes[id]=n;t.count+=1;}
return n;}
function removeNode(t,nodeA){nodeA.links.copy().map(function(node){unlink(nodeA,node);});delete(t.nodes[nodeA.id]);t.count-=1;return nodeA;}
function link(nodeA,nodeB){nodeA.links.pushUnique(nodeB);nodeB.backlinks.pushUnique(nodeA);}
function unlink(nodeA,nodeB){nodeA.links.remove(nodeB);nodeB.backlinks.remove(nodeA);}
function isLinkedToBySpecial(n,visited){visited=visited||[];var result=n.special;for(var i=0;i<n.backlinks.length&&result===false;i++){var linkingNode=n.backlinks[i];if(linkingNode.special===true){result=true;}else if(visited.contains(linkingNode)){result=false;}else{visited.pushUnique(linkingNode);result=isLinkedToBySpecial(linkingNode,visited);}}
return result;}})();CERNY.require("TOPINCS.misc.Changes","TOPINCS.misc.Web","CERNY.event.Observable","CERNY.js.Array");(function(){var Logger=CERNY.Logger;var method=CERNY.method;var signature=CERNY.signature;var Web=TOPINCS.misc.Web;var name="TOPINCS.misc.Changes";var logger=Logger(name);var EVT_COUNT_CHANGED=name+".EVT_COUNT_CHANGED";var UPDATE="UPDATE";var CREATE="CREATE";var DELETE="DELETE";function Changes(){CERNY.event.Observable(this);this.init();}
Changes.EVT_COUNT_CHANGED=EVT_COUNT_CHANGED;Changes.UPDATE=UPDATE;Changes.CREATE=CREATE;Changes.DELETE=DELETE;TOPINCS.misc.Changes=Changes;Changes.prototype.logger=logger;function init(){this.data={};this.web=new Web();this._count=0;}
signature(init,"undefined");method(Changes.prototype,"init",init);method(Changes.prototype,"reset",init);method(Changes.prototype,"revert",init);function isEmpty(){return this._count===0;}
signature(isEmpty,"boolean");method(Changes.prototype,"isEmpty",isEmpty);function count(){return this._count;}
signature(count,"number");method(Changes.prototype,"count",count);function setCount(t,count){if(t._count!==count){t._count=count;t.notify(EVT_COUNT_CHANGED,t._count);}}
signature(setCount,"undefined",Changes,"number");function registerUpdate(item){this.register(item,UPDATE);}
signature(registerUpdate,"undefined","object");method(Changes.prototype,"registerUpdate",registerUpdate);function registerCreate(item,supplierId){this.register(item,CREATE);if(supplierId){this.web.addLink(supplierId,item.id);}else{this.web.declareSpecial(item.id);}}
signature(registerCreate,"undefined","object",["undefined","string"]);method(Changes.prototype,"registerCreate",registerCreate);function registerDelete(item){this.register(item,DELETE);}
signature(registerDelete,"undefined","object");method(Changes.prototype,"registerDelete",registerDelete);function register(item,type,independent){var _new=typeof this.data[item.id]=="undefined";this.data[item.id]={item:item,type:type};if(_new){setCount(this,this._count+1);}}
signature(register,"undefined","object","string","boolean");method(Changes.prototype,"register",register);function unregister(item,formerId){var id=formerId||item.id;this.remove(id);var t=this;this.web.remove(id).map(function(removedId){t.remove(removedId);});}
signature(unregister,"undefined","object",["undefined","string"]);method(Changes.prototype,"unregister",unregister);function remove(id){if(this.data[id]){delete(this.data[id]);setCount(this,this._count-1);}}
signature(remove,"undefined","string");method(Changes.prototype,"remove",remove);function getDeletes(){return getChanges(this,DELETE);}
signature(getDeletes,Array);method(Changes.prototype,"getDeletes",getDeletes);function getUpdates(){return getChanges(this,UPDATE);}
signature(getUpdates,Array);method(Changes.prototype,"getUpdates",getUpdates);function getCreates(){return getChanges(this,CREATE);}
signature(getCreates,Array);method(Changes.prototype,"getCreates",getCreates);function getChanges(t,type){var result=[];for(var id in t.data){if(t.data[id].type===type){result.push(t.data[id]);}}
return result;}
function getAllChanges(){var result=[];for(var id in this.data){if(this.data.hasOwnProperty(id)){result.push(this.data[id]);}}
return result;}
signature(getChanges,Array);method(Changes.prototype,"getAllChanges",getAllChanges);function iterate(updateFunc,createFunc,deleteFunc){for(var id in this.data){if(this.data.hasOwnProperty(id)){var changeInfo=this.data[id];switch(changeInfo.type){case UPDATE:updateFunc(changeInfo.item);break;case CREATE:createFunc(changeInfo.item);break;case DELETE:deleteFunc(changeInfo.item);break;}}}}
signature(iterate,"undefined","function","function","function");method(Changes.prototype,"iterate",iterate);})();CERNY.require("TOPINCS.tmdm.Role","TOPINCS.cons","CERNY.event.Revertable","TOPINCS.tmdm.Construct");(function(){var Construct=TOPINCS.tmdm.Construct;var logger=CERNY.Logger("TOPINCS.tmdm.Role");TOPINCS.tmdm.Role=Role;var properties=["player","player_name","type","type_name","reifier","parent"];var children={};function Role(item){if(!item){this.isNew=true;item={player:null,player_name:null,type:null,type_name:null};}
this.init(item,properties,children);}
Role.prototype=new Construct();Role.prototype.logger=logger;Role.prototype.properties=properties;Role.prototype.children=children;Role.prototype.references=["player","type"];Role.prototype.dirName="roles";Role.prototype.parentDirName="associations";Role.prototype.itemType="Role";CERNY.event.Revertable(Role.prototype,properties);})();CERNY.require("TOPINCS.tmdm.Association","TOPINCS.cons","TOPINCS.tmdm.Role","CERNY.event.Revertable","TOPINCS.tmdm.Construct");(function(){var Construct=TOPINCS.tmdm.Construct;var Role=TOPINCS.tmdm.Role;var Request=CERNY.http.Request;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.tmdm.Association");TOPINCS.tmdm.Association=Association;var properties=["type","type_name","reifier","parent"];var children={"roles":Role};function Association(item){if(!item){this.isNew=true;item={type:null,type_name:"",roles:[new Role()]}}
this.init(item,properties,children);if(!this.scope){this.scope=[];}}
Association.prototype=new Construct();Association.prototype.logger=logger;Association.prototype.properties=properties;Association.prototype.children=children;Association.prototype.references=["type"];Association.prototype.dirName="associations";Association.prototype.parentDirName="topicmaps";Association.prototype.itemType="Association";var revertableProperties=[{name:"scope",equals:Construct.scopeEquals}];revertableProperties.append(properties);CERNY.event.Revertable(Association.prototype,revertableProperties);function get(id,scope,callback){var result=Construct.get(Association.getUrl(id),scope,callback);if(result instanceof Request){return result;}
return new Association(result.getValue());}
signature(get,[Request,Association],"string",["undefined","string"],["undefined","function"]);method(Association,"get",get);function getUrl(id){return Association.prototype.dirName+"/"+id;}
signature(getUrl,"string","string");method(Association,"getUrl",getUrl);function getRoleByType(typeId){return(this.roles.filter(function(role){return role.type===typeId;}))[0];}
signature(getRoleByType,["undefined",Role],"string");method(Association.prototype,"getRoleByType",getRoleByType);function getRoleByPlayer(playerId){return this.getRolesByPlayer(playerId)[0];}
signature(getRoleByPlayer,["undefined",Role],"string");method(Association.prototype,"getRoleByPlayer",getRoleByPlayer);function getRolesByPlayer(playerId){return this.roles.filter(function(role){return role.player===playerId;});}
signature(getRolesByPlayer,Array,"string");method(Association.prototype,"getRolesByPlayer",getRolesByPlayer);var hasChangedOld=Association.prototype.hasChanged;function hasChanged(deep){if(!isBoolean(deep)){deep=true;}
var hasChanged=hasChangedOld.call(this);if(hasChanged){return true;}
if(deep){for(var i=0;i<this.roles.length;i++){if(this.roles[i].hasChanged()){return true;}}}
return false;}
signature(hasChanged,"boolean");method(Association.prototype,"hasChanged",hasChanged);var revertOld=Association.prototype.revert;function revert(){this.roles.map(function(role){role.revert();});revertOld.call(this);}
signature(revert,"boolean");method(Association.prototype,"revert",revert);})();CERNY.require("TOPINCS.tmdm.TopicMap","CERNY.event.Revertable","CERNY.http.Request","CERNY.http.Response","TOPINCS.cons","TOPINCS.tmdm.IdMap","TOPINCS.tmdm.Topic","TOPINCS.tmdm.Association","TOPINCS.CoreTopics","TOPINCS.tmdm.Construct");(function(){var Association=TOPINCS.tmdm.Association;var IdMap=TOPINCS.tmdm.IdMap;var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var Request=CERNY.http.Request;var Response=CERNY.http.Response;var Topic=TOPINCS.tmdm.Topic;var getResult=TOPINCS.util.getResult;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.tmdm.TopicMap");TOPINCS.tmdm.TopicMap=TopicMap;var ID_TYPE_INSTANCE=CoreTopics["type-instance"].id;var ID_TYPE=CoreTopics.type.id;var ID_INSTANCE=CoreTopics.instance.id;var properties=[];var children={topics:Topic,associations:Association};function TopicMap(item){if(!item){this.isNew=true;item={};}
this.init(item,properties,children);this.buildIndex();}
TopicMap.logger=logger;TopicMap.prototype=new Construct();TopicMap.prototype.logger=logger;TopicMap.prototype.properties=properties;TopicMap.prototype.children=children;TopicMap.prototype.references=[];TopicMap.prototype.dirName="topicmaps";TopicMap.prototype.parentDirName="";TopicMap.prototype.itemType="TopicMap";CERNY.event.Revertable(TopicMap.prototype,properties);function create(id){var request=new Request("POST",MAPS);request.body=id;return request.sendSynch();}
signature(create,Response,"string");method(TopicMap,"create",create);function get(id){return new TopicMap({id:id});}
signature(get,Response,"string");method(TopicMap,"get",get);function getMaps(){return getResult(MAPS);}
signature(getMaps,"object");method(TopicMap,"getMaps",getMaps);function getUrl(){return MAPS+encodeURIComponent(this.id);}
signature(getUrl,"string");method(TopicMap.prototype,"getUrl",getUrl);function getSummary(){return getResult(this.getUrl()+"?content=summary");}
signature(getSummary,"object");method(TopicMap.prototype,"getSummary",getSummary);function getIndividuals(){return getResult(this.getUrl()+"?content=individuals");}
signature(getIndividuals,"object");method(TopicMap.prototype,"getIndividuals",getIndividuals);function getContent(typeId){var url=TOPICMAPS_CONTENT_URL+"?mapid="+this.id;if(typeId){url+="&typeid="+typeId;}
return getResult(url,MEDIA_TYPE_NODE);}
signature(getContent,"object","string");method(TopicMap.prototype,"getContent",getContent);function getTopicById(id){return this.topics.idIndex[id];}
signature(getTopicById,["undefined",Topic],"string");method(TopicMap.prototype,"getTopicById",getTopicById);function getTopicBySubjectIdentifier(si){return this.locateChild(new Topic({subject_identifiers:[si]}));}
signature(getTopicBySubjectIdentifier,["undefined",Topic],"string");method(TopicMap.prototype,"getTopicBySubjectIdentifier",getTopicBySubjectIdentifier);function getAssociationById(id){return this.associations.idIndex[id];}
signature(getAssociationById,Association,"string");method(TopicMap.prototype,"getAssociationById",getAssociationById);function getAssociationsByType(typeId){return(this.associations.filter(function(association){return association.type===typeId;}));}
signature(getAssociationsByType,Array,"string");method(TopicMap.prototype,"getAssociationsByType",getAssociationsByType);function getAssociations(typeId,roleTypeId,playerId){var result=[],association,role,i,j;i=this.associations.length;while(i--){association=this.associations[i];if(association.type===typeId){j=association.roles.length;while(j--){role=association.roles[j];if(role.player===playerId&&role.type===roleTypeId){result.unshift(association);break;}}}}
return result;}
signature(getAssociations,Array,"string","string","string");method(TopicMap.prototype,"getAssociations",getAssociations);function mergeMap(topicMap){var idMap=new IdMap();var t=this;topicMap.topics.map(function(topic){var foreignId=topic.id;var localId;var localTopic=t.locateChild(topic);if(localTopic){localId=localTopic.id;if(localTopic.isForeign){topic.id=localId;}}else{localId=new String(Construct.createTempId(Topic.prototype.itemType));topic.isForeign=true;topic.foreignId=topic.id;if(topicMap.isHostedByTopincs){localId.foreign={"id":topic.id,"base":topicMap.storeUrl};}
topic.id=localId;delete(topic.parent);}
idMap.registerId(foreignId,localId);});topicMap.buildIndex();idMap.apply(topicMap,undefined,true);this.merge(topicMap);this.buildIndex();}
signature(mergeMap,"undefined",TopicMap);method(TopicMap.prototype,"mergeMap",mergeMap);function locateChild(child){var localProxy=Construct.prototype.locateChild.call(this,child);if(!localProxy&&child instanceof Topic){localProxy=searchIndex(this.topics.siIndex,child.subject_identifiers);if(!localProxy){localProxy=searchIndex(this.topics.slIndex,child.subject_locators);}}
return localProxy;}
signature(locateChild,"undefined");method(TopicMap.prototype,"locateChild",locateChild);function searchIndex(index,array){var item;for(var i=0,l=array.length;i<l&&!item;i++){item=index[array[i]];}
return item;}
function buildIndex(){Construct.prototype.buildIndex.call(this);this.topics.siIndex={};this.topics.slIndex={};var topics=this.topics;var i=topics.length;while(i--){var topic=topics[i];var sis=topic.subject_identifiers;var l=sis.length;while(l--){topics.siIndex[sis[l]]=topic;}
var sls=topic.subject_locators;l=sls.length;while(l--){topics.slIndex[sls[l]]=topic;}}
var typeInstanceTopic=topics.siIndex[PSI_TYPE_INSTANCE];if(typeInstanceTopic){this.idTypeInstance=typeInstanceTopic.id;}else{this.idTypeInstance=ID_TYPE_INSTANCE;}
var instanceTopic=topics.siIndex[PSI_INSTANCE];if(instanceTopic){this.idInstance=instanceTopic.id;}else{this.idInstance=ID_INSTANCE;}
var typeTopic=topics.siIndex[PSI_TYPE];if(typeTopic){this.idType=typeTopic.id;}else{this.idType=ID_TYPE;}}
signature(buildIndex,"undefined");method(TopicMap.prototype,"buildIndex",buildIndex);function getTopicMap(url,options){options=options||{};mediaType=options.mediaType||MEDIA_TYPE_JTM;nocache=options.nocache||false;var mapJsonStr=getResult(url,mediaType,nocache,{});var topicMap=new TopicMap(mapJsonStr);topicMap.location=url;topicMap.isHostedByTopincs=true;topicMap.storeUrl=url.replace(/wiki.*jtm$/,"");return topicMap;}
signature(getTopicMap,TopicMap,"string",["string","undefined"]);method(TopicMap,"getTopicMap",getTopicMap);function getTopicTypes(topicId){var typeAssociations=this.getAssociations(this.idTypeInstance,this.idInstance,topicId);var t=this;var result=typeAssociations.map(function(typeAssociation){var typeRole=typeAssociation.getRoleByType(t.idType);if(typeRole){return typeRole.player;}});return result.filter(function(x){return isString(x)||x instanceof String;});}
signature(getTopicTypes,Array,"string");method(TopicMap.prototype,"getTopicTypes",getTopicTypes);})();CERNY.require("TOPINCS.tmdm.ext.Changes","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Topic","TOPINCS.tmdm.Association","TOPINCS.tmdm.ServerResponseException","TOPINCS.misc.Changes");(function(){var Construct=TOPINCS.tmdm.Construct;var Logger=CERNY.Logger;var Topic=TOPINCS.tmdm.Topic;var Association=TOPINCS.tmdm.Association;var ServerResponseException=TOPINCS.tmdm.ServerResponseException;var method=CERNY.method;var signature=CERNY.signature;var name="TOPINCS.tmdm.ext.Changes";var logger=Logger(name);var EVT_CHANGES_PROCESSED=name+".EVT_CHANGES_PROCESSED";function Changes(topicMapUrl){this.topicMapUrl=topicMapUrl;this.init();}
Changes.prototype=new TOPINCS.misc.Changes();Changes.prototype.logger=logger;Changes.EVT_CHANGES_PROCESSED=EVT_CHANGES_PROCESSED;TOPINCS.tmdm.ext.Changes=Changes;function process(){this.commitedChanges=[];this.uncommitedChanges=[];this.processCreates();this.processUpdates();this.processDeletes();}
signature(process,"undefined");method(Changes.prototype,"process",process);function processCreates(){var t=this;this.getTopicCreates().map(function(change){createTopic(t,change);});this.getStatementCreates().map(function(change){var topicMapUrl;if(change.item instanceof Association){topicMapUrl=t.topicMapUrl;}
Construct.post(change.item,true,false,createChangeProcessor(t,change),null,topicMapUrl);});}
signature(processCreates,"undefined");method(Changes.prototype,"processCreates",processCreates);function processUpdates(){var t=this;this.getUpdates().map(function(change){change.item.put(true,false,createChangeProcessor(t,change));});}
signature(processUpdates,"undefined");method(Changes.prototype,"processUpdates",processUpdates);function processDeletes(){var t=this;this.getDeletes().map(function(change){change.item._delete(createChangeProcessor(t,change));});}
signature(processDeletes,"undefined");method(Changes.prototype,"processDeletes",processDeletes);function getTopicCreates(){return this.getCreates().filter(function(create){return create.item instanceof Topic;});}
method(Changes.prototype,"getTopicCreates",getTopicCreates);function getStatementCreates(){return this.getCreates().filter(function(create){return!(create.item instanceof Topic);});}
method(Changes.prototype,"getStatementCreates",getStatementCreates);function createTopic(t,topicCreate){var topic=topicCreate.item;if(Construct.isTempId(topic.id)||topic.tempId){topic.collectReferences().map(function(topicId){if(Construct.isTempId(topicId)&&t.data[topicId]){createTopicShallow(t,t.data[topicId].item);}});var tempId=topic.tempId||topic.id;var response=Construct.post(topic,true,false,null,true,t.topicMapUrl);changeProcessed(t,topicCreate,response,tempId);}}
function createTopicShallow(t,topic){topic.tempId=topic.id;var response=Construct.post(topic,false,false,null,true,t.topicMapUrl);if(response.status!=201&&response.status!=204){throw new ServerResponseException(response);}
return response;}
function changeProcessed(t,change,response,formerId){if(response.status<300){t.commitedChanges.push(change);t.remove(formerId);}else{t.uncommitedChanges.push(change);}
if(t.isEmpty()){t.notify(EVT_CHANGES_PROCESSED,t.commitedChanges,t.uncommitedChanges);}}
function createChangeProcessor(t,change){var formerId=change.item.id;return function(response){changeProcessed(t,change,response,formerId);}}})();CERNY.require("TOPINCS.wiki.ArticleMap","TOPINCS.wiki.MainTopicNotFoundException","TOPINCS.misc.Changes","TOPINCS.util","CERNY.event.Observable","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Topic","TOPINCS.tmdm.Occurrence","TOPINCS.tmdm.Name","TOPINCS.tmdm.Role","TOPINCS.tmdm.Association","TOPINCS.tmdm.TopicMap","TOPINCS.tmdm.ext.Changes","TOPINCS.CoreTopics");(function(){var Association=TOPINCS.tmdm.Association;var Changes=TOPINCS.tmdm.ext.Changes;var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var Logger=CERNY.Logger;var Name=TOPINCS.tmdm.Name;var Observable=CERNY.event.Observable;var Occurrence=TOPINCS.tmdm.Occurrence;var Role=TOPINCS.tmdm.Role;var Topic=TOPINCS.tmdm.Topic;var TopicMap=TOPINCS.tmdm.TopicMap;var check=CERNY.check;var compareById=TOPINCS.util.compareById;var isDynamicLocator=TOPINCS.util.isDynamicLocator;var method=CERNY.method;var pre=CERNY.pre;var signature=CERNY.signature;var name="TOPINCS.wiki.ArticleMap";var logger=Logger(name);TOPINCS.wiki.ArticleMap=ArticleMap;ArticleMap.prototype.logger=logger;var ID_TYPE_INSTANCE=CoreTopics["type-instance"].id;var ID_INSTANCE=CoreTopics["instance"].id;var ID_TYPE=CoreTopics["type"].id;var EVT_CHANGE=name+".EVT_CHANGE";var EVT_MERGE=name+".EVT_MERGE";function ArticleMap(topicMap,subjectId){this.init(topicMap,subjectId);}
ArticleMap.EVT_CHANGE=EVT_CHANGE;ArticleMap.EVT_MERGE=EVT_MERGE;Observable(ArticleMap.prototype);function init(topicMap,subjectId){var t=this;this.changes=new Changes(topicMap.item_identifiers[0]);this.topicMap=topicMap;this.subjectId=subjectId||this.topicMap.topics[0].id;this.typeId=this.getTopicType(this.subjectId);this.subject=this.topicMap.getTopicById(this.subjectId);this.subjectLocator=null;if(this.subject.subject_locators.length>0){this.subjectLocator=this.subject.subject_locators[0];}
this.httpSubjectIdentifier=null;if(this.subject.subject_identifiers.length>0){this.subject.subject_identifiers.map(function(identifier){if(identifier.match(/^http/)&&t.httpSubjectIdentifier===null&&!isDynamicLocator(identifier)){t.httpSubjectIdentifier=identifier;}});}
this.mergedTopicMaps=[];initAssociations(t);}
signature(init,"undefined",TopicMap,["undefined","string"]);method(ArticleMap.prototype,"init",init);function merge(foreignTopicMap){var t=this,otherSubject;var addedItems={};var foreignTypeInstanceTopic=foreignTopicMap.getTopicBySubjectIdentifier(PSI_TYPE_INSTANCE);var foreignInstanceTopic=foreignTopicMap.getTopicBySubjectIdentifier(PSI_INSTANCE);var otherSubject=foreignTopicMap.locateChild(t.subject);if(!otherSubject){throw new TOPINCS.wiki.MainTopicNotFoundException();}
var changesBefore=this.changes.count();t.topicMap.addObserver(Construct.EVT_MERGE_ITEM_ADDED,itemAdded);t.topicMap.addObserver(Construct.EVT_MERGE_ITEM_UPDATED,itemUpdated);t.topicMap.mergeMap(foreignTopicMap);t.topicMap.removeObserver(Construct.EVT_MERGE_ITEM_UPDATED,itemUpdated);t.topicMap.removeObserver(Construct.EVT_MERGE_ITEM_ADDED,itemAdded);initAssociations(t);t.mergedTopicMaps.pushUnique(foreignTopicMap);if(this.changes.count()-changesBefore>0){t.notify(EVT_MERGE,foreignTopicMap);}
function itemAdded(addedItem,targetItem,supplierId){if(isChangeOfInterest(addedItem,targetItem,t.subject,supplierId)){t.changes.registerCreate(addedItem,supplierId);if(addedItem instanceof Topic||addedItem instanceof Association){}else if(addedItem instanceof Occurrence||addedItem instanceof Name){if(addedItem.parent==otherSubject.id){addedItem.parent=t.subjectId;}}
addReferredTopics(addedItem);}}
function itemUpdated(foreignItem,localItem){localItem.proxy=foreignItem;}
function addReferredTopics(item){if(!(addedItems[item.id])){addedItems[item.id]=item;var references=item.collectReferences();var i=references.length;while(i--){addTopic(references[i],item.id);}
if(item.itemType=="Topic"){var topicId=item.id;var typeAssociations=foreignTopicMap.getAssociations(foreignTypeInstanceTopic.id,foreignInstanceTopic.id,topicId);if(typeAssociations.length==0){logger.warn("No type association present for topic "+item.item_identifiers[0]);}
for(var i=0,l=typeAssociations.length;i<l;i++){var association=typeAssociations[i];association.replaceSystemIdsByTempIds();itemAdded(association,t.topicMap,topicId);}}}}
function addTopic(topicId,supplierId){if(Construct.isTempId(topicId)){var topic=foreignTopicMap.getTopicById(topicId);t.changes.registerCreate(topic,supplierId);addReferredTopics(topic);}}}
signature(merge,"undefined",TopicMap);method(ArticleMap.prototype,"merge",merge);function isChangeOfInterest(addedItem,targetItem,subject,supplierId){if(addedItem instanceof Topic){return false;}
if(!supplierId){if(addedItem instanceof Association){if(!addedItem.getRoleByPlayer(subject.id)){return false;}}else if(addedItem instanceof Name||addedItem instanceof Occurrence){if(targetItem!=subject){return false;}}}
return true;}
function initAssociations(t){t.associations=extractAssociations(t.topicMap.associations,t.subjectId);}
function extractAssociations(associations,subjectId){return associations.filter(function(association){if(association.getRoleByPlayer(subjectId)){return true;}
return false;});}
function apply(changes){var t=this;changes.map(applyChange);this.topicMap.buildIndex();this.associations=extractAssociations(this.topicMap.associations,this.subjectId);this.notify(EVT_CHANGE);function applyChange(change){var item=change.item;switch(change.type){case TOPINCS.misc.Changes.CREATE:applyCreate(item);break;case TOPINCS.misc.Changes.UPDATE:applyUpdate(item);break;case TOPINCS.misc.Changes.DELETE:applyDelete(item);break;default:}}
function determineTarget(item){if(item instanceof Occurrence){return t.subject.occurrences;}
if(item instanceof Name){return t.subject.names;}
if(item instanceof Role){var parentId=Construct.extractSystemIdFromItemIdentifier(item.parent);return t.topicMap.getAssociationById(parentId).roles;}
if(item instanceof Topic){return t.topicMap.topics;}
if(item instanceof Association){return t.topicMap.associations;}}
function applyUpdate(item){determineTarget(item).replace({id:item.id},item,compareById);}
function applyCreate(item){determineTarget(item).push(item);}
function applyDelete(item){determineTarget(item).remove(item,compareById);}}
signature(apply,"undefined",Array);method(ArticleMap.prototype,"apply",apply);function getTopicType(topicId){var types=this.topicMap.getTopicTypes(topicId);if(types.length>0){return types[0];}}
signature(getTopicType,["string","undefined"]);method(ArticleMap.prototype,"getTopicType",getTopicType);function getStatementsAboutSubject(){var result=[];result.append(this.subject.occurrences);result.append(this.subject.names);result.append(this.associations);return result;}
signature(getStatementsAboutSubject,Array);method(ArticleMap.prototype,"getStatementsAboutSubject",getStatementsAboutSubject);function addMergeObserver(observer){this.addObserver(EVT_MERGE,observer);}
signature(addMergeObserver,Array);method(ArticleMap.prototype,"addMergeObserver",addMergeObserver);})();CERNY.require("TOPINCS.wiki.Paragraph","CERNY.event.List");(function(){TOPINCS.wiki.Paragraph=Paragraph;var check=CERNY.check;var method=CERNY.method;var pre=CERNY.pre;var signature=CERNY.signature;var PREFIX_ID="paragraph-";var logger=CERNY.Logger("TOPINCS.wiki.Paragraph");function Paragraph(typeId,article,associationTypeId){var t=[];CERNY.event.List(t);t.logger=logger;t.id=PREFIX_ID+typeId;if(associationTypeId){t.id+="-"+associationTypeId;}
t.typeId=typeId;t.article=article;t.associationTypeId=associationTypeId;method(t,"addNewStatement",addNewStatement);return t;}
function addNewStatement(){var statement=this[0];var newStatement=this.article.createNewStatement(statement.itemType,this.typeId,this.associationTypeId);this.addItem(newStatement);return newStatement;}
signature(addNewStatement,"object");pre(addNewStatement,function(){check(this.length>0,"The paragraph must contain at least one statment.");});})();CERNY.require("TOPINCS.wiki.Article","TOPINCS.wiki.ArticleMap","TOPINCS.wiki.Paragraph","TOPINCS.tmdm.Name","TOPINCS.tmdm.Association","TOPINCS.tmdm.Role","TOPINCS.tmdm.Occurrence","TOPINCS.util","CERNY.util","CERNY.event.List");(function(){TOPINCS.wiki.Article=Article;var Association=TOPINCS.tmdm.Association;var List=CERNY.event.List;var Name=TOPINCS.tmdm.Name;var Occurrence=TOPINCS.tmdm.Occurrence;var Paragraph=TOPINCS.wiki.Paragraph;var Role=TOPINCS.tmdm.Role;var ArticleMap=TOPINCS.wiki.ArticleMap;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.Article");function Article(articleMap,hiddenTypes){hiddenTypes=hiddenTypes||[];var t=[];CERNY.event.List(t);t.logger=logger;method(t,"getParagraph",getParagraph);method(t,"removeParagraph",removeParagraph);method(t,"addStatement",addStatement);method(t,"removeStatement",removeStatement);method(t,"createNewStatement",createNewStatement);method(t,"setArticleMap",setArticleMap);method(t,"setHiddenTypes",setHiddenTypes);method(t,"setTypeOrder",setTypeOrder);method(t,"applyFormation",applyFormation);method(t,"sortItems",sortItems);method(t,"countStatements",countStatements);t.setHiddenTypes(hiddenTypes);t.setTypeOrder([]);if(articleMap){t.setArticleMap(articleMap);}
return t;}
function getParagraph(typeId,associationTypeId){var paragraphKey=getParagraphKey(typeId,associationTypeId);var paragraph=this.paragraphMap[paragraphKey];if(!paragraph){paragraph=new Paragraph(typeId,this,associationTypeId);this.paragraphMap[paragraphKey]=paragraph;var index=this.paragraphTypeIds.getInsertionIndex(paragraphKey,this.typeOrderComperator);this.paragraphTypeIds.insertAt(index,paragraphKey);this.insertItemAt(index,paragraph);}
return paragraph;}
signature(getParagraph,"object","string",["undefined","string"]);function removeParagraph(paragraph){var paragraphKey=getParagraphKey(paragraph.typeId,paragraph.associationTypeId);delete(this.paragraphMap[paragraphKey]);this.paragraphTypeIds.remove(paragraphKey);this.removeItem(paragraph);}
signature(removeParagraph,"undefined","object");function addStatement(typeId,statement){if(!this.hiddenTypes.contains(typeId)){var paragraph;if(statement instanceof Association){paragraph=this.getParagraph(statement.getRoleByPlayer(this.subjectId).type,statement.type);}else{paragraph=this.getParagraph(statement.type);}
paragraph.addItem(statement);}}
signature(addStatement,"undefined","string","object");method(Article,"addStatement",addStatement);function removeStatement(statement){var paragraph;if(statement instanceof Association){paragraph=this.getParagraph(statement.getRoleByPlayer(this.subjectId).type,statement.type);}else{paragraph=this.getParagraph(statement.type);}
paragraph.removeItem(statement);if(paragraph.length===0){this.removeParagraph(paragraph);}}
signature(removeStatement,"undefined","object");function createNewStatement(statementType,typeId,associationTypeId){var statement;switch(statementType){case Occurrence.prototype.itemType:statement=new Occurrence();statement.type=typeId;statement.datatype=TOPINCS.util.getDatatypes(typeId)[0];statement.parent=this.subject.id;break;case Name.prototype.itemType:statement=new Name();statement.type=typeId;statement.parent=this.subject.id;break;case Association.prototype.itemType:statement=new Association();statement.type=associationTypeId;statement.parent=this.subject.parent;var roleOfSubject=statement.roles[0];roleOfSubject.player=this.subjectId;roleOfSubject.type=typeId;var possibleRoleTypes=TOPINCS.util.getResult(ROLES_URL+"?at="+associationTypeId,MEDIA_TYPE_TOPIC_PROXY_ARRAY);if(possibleRoleTypes.length>1){possibleRoleTypes=possibleRoleTypes.filter(function(topicProxy){return topicProxy.id!=typeId;});}
possibleRoleTypes.map(function(topicProxy){var role=new Role();role.type=topicProxy.id;statement.roles.push(role);});break;default:}
return statement;}
signature(createNewStatement,"object","string","string",["string","undefined"]);function setArticleMap(articleMap){this.subjectId=articleMap.subjectId;this.articleMap=articleMap;this.paragraphMap={};this.paragraphTypeIds=[];this.removeAll();var subject=articleMap.subject;this.subject=subject;var t=this;var occurrences=subject.occurrences;for(var i=0,l=occurrences.length;i<l;i++){var occurrence=occurrences[i];t.addStatement(occurrence.type,occurrence);}
var names=subject.names;for(i=0,l=names.length;i<l;i++){var name=names[i];t.addStatement(name.type,name);}
var associations=articleMap.associations;for(i=0,l=associations.length;i<l;i++){var association=associations[i];var roleOfSubject=association.getRoleByPlayer(t.subjectId);if(roleOfSubject){t.addStatement(roleOfSubject.type,association);}}}
signature(setArticleMap,"undefined",ArticleMap);function setHiddenTypes(hiddenTypes){this.hiddenTypes=hiddenTypes.map(flattenTopicProxy);}
signature(setHiddenTypes,"undefined",Array);function setTypeOrder(typeOrder){this.typeOrder=typeOrder.map(flattenTopicProxy);this.typeOrderComperator=CERNY.util.createComparator(this.typeOrder);}
signature(setTypeOrder,"undefined",Array);function applyFormation(typeOrder,hiddenTypes){this.setTypeOrder(typeOrder);this.setHiddenTypes(hiddenTypes);this.sortItems(this.typeOrderComperator);}
signature(applyFormation,"undefined","object",["undefined",Array]);function sortItems(comperator){this.paragraphTypeIds.sort(comperator);var i=0,t=this;this.paragraphTypeIds.map(function(typeId){t[i]=t.getParagraph(typeId);i+=1;});this.notify(List.EVT_REARRANGED);}
signature(sortItems,"undefined","function");function countStatements(f){var result=0;this.map(function(paragraph){paragraph.map(function(statement){if(!f||(f&&f(statement))){result+=1;}});});return result;}
signature(countStatements,"number",["undefined","function"]);function flattenTopicProxy(topicProxy){return Number(topicProxy.id);}
function getParagraphKey(typeId,atId){if(atId){return typeId+"-"+atId;}else{return typeId;}}})();CERNY.require("TOPINCS.tmdm.ext.TopicProxy","TOPINCS.cons","CERNY.dom.Element","TOPINCS.tmdm.ext.Labeler","TOPINCS.lang","TOPINCS.util","_");(function(){TOPINCS.tmdm.ext.TopicProxy={};var TopicProxy=TOPINCS.tmdm.ext.TopicProxy;var signature=CERNY.signature;var method=CERNY.method;var Element=CERNY.dom.Element;var Labeler=TOPINCS.tmdm.ext.Labeler;var labeler=new Labeler({acceptedLanguagesIds:TOPINCS.lang.ids.accepted,englishId:TOPINCS.lang.ids.en,uiLanguageId:TOPINCS.lang.ids.ui});var cache={};function get(trOrId){var tp=cache[trOrId];if(!tp){TopicProxy.prefetch([trOrId]);tp=cache[trOrId];}
return tp;}
signature("get","object","string");method(TopicProxy,"get",get);function prefetch(q){var p=_.clone(q);p.sort();p=_.uniq(p,true);var url=_.reduce(p,TOPIC_PROXY_URL+"?",function(memo,trOrId){return memo+(isNumber(new Number(trOrId).valueOf())?"&id="+trOrId:"&tr="+trOrId);});_.extend(cache,TOPINCS.util.getResult(url));}
signature("prefetch","undefined",Array);method(TopicProxy,"prefetch",prefetch);function addToCache(r){_.extend(cache,r);}
signature("addToCache","undefined",Array);method(TopicProxy,"addToCache",addToCache);function toLinkTyped(tp){var el=Element.create("span",null,"class=topic-link");el.appendChild(Element.create("a",tp.label,"href="+tp.href));if(tp.type){el.appendChildren(document.createTextNode(" ("),Element.create("a",tp.type.label,"href="+tp.type.href,"class=type"),document.createTextNode(")"));}
return el;}
signature("toLinkTyped",Element,"object");method(TopicProxy,"toLinkTyped",toLinkTyped);function toLinkUntyped(tp){var el=Element.create("span",null,"class=topic-link");el.appendChild(Element.create("a",tp.label,"href="+tp.href));return el;}
signature("toLinkUntyped",Element,"object");method(TopicProxy,"toLinkUntyped",toLinkUntyped);function toOptionStrTyped(tp,selected){if(selected===true){selected="selected='selected'";}
return"<option value='"+tp.id+"' "+selected+">"+tp.label
+(tp.type?" ("+tp.type.label+")":"")
+"</option>";}
signature("toOptionStrTyped","string","object");method(TopicProxy,"toOptionStrTyped",toOptionStrTyped);function getFromTopicMap(id,topicmap){var types=topicmap.getTopicTypes(id),typeId=(types.length>0)?types[0]:null;var tp={id:id,label:labeler.getTopicLabel(topicmap.getTopicById(id))};if(typeId){tp.type={id:typeId,label:labeler.getTopicLabel(topicmap.getTopicById(typeId))};}
return tp;}
method(TopicProxy,"getFromTopicMap",getFromTopicMap);})();CERNY.require("TOPINCS.tmdm.TopicReference","CERNY.util","TOPINCS.cons","_","TOPINCS.util");(function(){TOPINCS.tmdm.TopicReference={};var TopicReference=TOPINCS.tmdm.TopicReference;var method=CERNY.method;var parseUri=CERNY.util.parseUri;var baseUri=TOPINCS.util.getBaseUri();var cache={};function resolve(tr){if(!cache[tr]){try{cache[tr]=resolveShallow(tr);}catch(e){prefetch([tr]);if(!cache[tr]){throw new Error("Cannot resolve '"+tr+"'.");}}}
return cache[tr];}
method(TopicReference,"resolve",resolve);function resolveShallow(tr){var type=parseType(tr),locator=tr.substr(3);if(type=="si"){if(locator.match(new RegExp("^"+baseUri+"[1-9][0-9]*$"))){return parseUri(locator).path.split("/").pop();}}
throw new Error("Cannot resolve '"+tr+"'. Only references to dynamic local subject identifiers can be resolved shallow.");}
method(TopicReference,"resolveShallow",resolveShallow);function prefetch(q){var p=_.clone(q);p.sort();p=_.uniq(p);var url=_.reduce(p,RESOLVE_URL+"?",function(memo,tr){return memo+"&tr="+tr;});_.extend(cache,TOPINCS.util.getResult(url));}
method(TopicReference,"prefetch",prefetch);function is(tr){return tr.substr(2,1)==":";}
method(TopicReference,"is",is);function parseType(tr){var type=tr.substr(0,2);if(type!="ii"&&type!="sl"&&type!="si"&&type!="id"){throw new Error("The topic reference '"+tr+"' does not have a valid type ('"+type+"'). It must be 'id','ii','si', or 'sl'.");}
if(tr.substr(2,1)!=":"){throw new Error("Colon expected in topic reference '"+tr+"'");}
return type;}})();CERNY.require("CERNY.js.Number","CERNY.js.Array","CERNY.js.String");(function(){var method=CERNY.method;var signature=CERNY.signature;CERNY.js.Number={};Number.prototype.logger=CERNY.Logger("CERNY.js.Number");Number.logger=CERNY.Logger("CERNY.js.Number");function format(format){var matches=this.toString().match(/([+-])?(\d+)(.(\d+))?/);var sign=matches[1];var integer=matches[2];var fraction=matches[4];var integerF="";if(integer){if(format.digits.grouping===null){integerF=integer;}else{if(integer.length<=format.digits.grouping){integerF=integer;}else{var intArray=[];var intDigits=integer.split("").reverse();var i=0;intDigits.map(function(_digit){intArray.push(_digit);if(((i+1)%format.digits.grouping)===0&&(i+1)!=intDigits.length){intArray.push(format.separators.grouping);}
i+=1;});integerF=intArray.reverse().join("");}}}
var fractionF="";if(fraction){if(format.digits.fraction===null){fractionF=fraction;}else{if(fraction.length==format.digits.fraction){fractionF=fraction;}else if(fraction.length>format.digits.fraction){fractionF=fraction.substr(0,format.digits.fraction);}else{fractionF=fraction;}}}
if(format.digits.fraction){fractionF=fractionF.pad("0",format.digits.fraction,false);}
var r=integerF;if(sign=="-"){r="-"+r;}
if(fractionF!=""){r+=format.separators.decimal+fractionF;}
return r;};signature(format,"string","object");method(Number.prototype,"format",format);function parse(numStr,formats){if(!isArray(formats)&&isObject(formats)&&formats.regexp){formats=[formats];}
var match=null;var i=0;while(i<formats.length&&!match){match=numStr.match(formats[i].regexp);if(match===null){i+=1;}}
if(match){var format=formats[i];return format.parse(numStr);}
return null;};signature(parse,["number","null"],"string","object");method(Number,"_parse",parse);})();var Wiky={version:0.95,blocks:null,rules:{all:["Wiky.rules.pre","Wiky.rules.nonwikiblocks","Wiky.rules.wikiblocks","Wiky.rules.post",],pre:[{rex:/(\r?\n)/g,tmplt:"\xB6"},{rex:/(\r)/g,tmplt:"\xB6"},],post:[{rex:/(^\xB6)|(\xB6$)/g,tmplt:""},{rex:/@([0-9]+)@/g,tmplt:function($0,$1){return Wiky.restore($1);}},{rex:/\xB6/g,tmplt:"\n"}],nonwikiblocks:[{rex:/\\([%])/g,tmplt:function($0,$1){return Wiky.store($1);}},{rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?%(.*?)%\]/g,tmplt:function($0,$1,$2,$3){return":p]"+Wiky.store("<pre"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">"+Wiky.apply($3,$2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code)+"</pre>")+"[p:";}}],wikiblocks:["Wiky.rules.nonwikiinlines","Wiky.rules.escapes",{rex:/(?:^|\xB6)(={1,6})(.*?)[=]*(?=\xB6|$)/g,tmplt:function($0,$1,$2){var h=$1.length;return":p]\xB6<h"+h+">"+$2+"</h"+h+">\xB6[p:";}},{rex:/(?:^|\xB6)[-]{4}(?:\xB6|$)/g,tmplt:"\xB6<hr/>\xB6"},{rex:/\\\\([ \xB6])/g,tmplt:"<br/>$1"},{rex:/(^|\xB6)([*01aAiIg]*[\.*])[ ]/g,tmplt:function($0,$1,$2){var state=$2.replace(/([*])/g,"u").replace(/([\.])/,"");return":"+state+"]"+$1+"["+state+":";}},{rex:/(?:^|\xB6);[ ](.*?):[ ]/g,tmplt:"\xB6:l][l:$1:d][d:"},{rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?\"/g,tmplt:function($0,$1,$2){return":p]<blockquote"+Wiky.attr($2,"cite",0)+Wiky.attr($2,"title",1)+Wiky.style($1)+">[p:";}},{rex:/\"\]/g,tmplt:":p]</blockquote>[p:"},{rex:/\[(\{[^}]*\})?\|/g,tmplt:":t]$1[r:"},{rex:/\|\]/g,tmplt:":r][t:"},{rex:/\|\xB6[ ]?\|/g,tmplt:":r]\xB6[r:"},{rex:/\|/g,tmplt:":c][c:"},{rex:/^(.*)$/g,tmplt:"[p:$1:p]"},{rex:/(([\xB6])([ \t\f\v\xB6]*?)){2,}/g,tmplt:":p]$1[p:"},{rex:/\[([01AIacdgilprtu]+)[:](.*?)[:]([01AIacdgilprtu]+)\]/g,tmplt:function($0,$1,$2,$3){return Wiky.sectionRule($1==undefined?"":$1,"",Wiky.apply($2,Wiky.rules.wikiinlines),!$3?"":$3);}},{rex:/\[[01AIacdgilprtu]+[:]|[:][01AIacdgilprtu]+\]/g,tmplt:""},{rex:/<td>(?:([0-9]*)[>])?([ ]?)(.*?)([ ]?)<\/td>/g,tmplt:function($0,$1,$2,$3,$4){return"<td"+($1?" colspan=\""+$1+"\"":"")+($2==" "?(" style=\"text-align:"+($2==$4?"center":"right")+";\""):($4==" "?" style=\"text-align:left;\"":""))+">"+$2+$3+$4+"</td>";}},{rex:/<(p|table)>(?:\xB6)?(?:\{(.*?)\})/g,tmplt:function($0,$1,$2){return"<"+$1+Wiky.style($2)+">";}},{rex:/<p>([ \t\f\v\xB6]*?)<\/p>/g,tmplt:"$1"},"Wiky.rules.shortcuts"],nonwikiinlines:[{rex:/%(?:\{([^}]*)\})?(?:\(([^)]*)\))?(.*?)%/g,tmplt:function($0,$1,$2,$3){return Wiky.store("<code"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">"+Wiky.apply($3,$2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code)+"</code>");}},{rex:/%(.*?)%/g,tmplt:function($0,$1){return Wiky.store("<code>"+Wiky.apply($2,Wiky.rules.code)+"</code>");}}],wikiinlines:[{rex:/\*([^*]+)\*/g,tmplt:"<strong>$1</strong>"},{rex:/_([^_]+)_/g,tmplt:"<em>$1</em>"},{rex:/\^([^^]+)\^/g,tmplt:"<sup>$1</sup>"},{rex:/~([^~]+)~/g,tmplt:"<sub>$1</sub>"},{rex:/\(-(.+?)-\)/g,tmplt:"<del>$1</del>"},{rex:/\?([^ \t\f\v\xB6]+)\((.+)\)\?/g,tmplt:"<abbr title=\"$2\">$1</abbr>"},{rex:/\[(?:\{([^}]*)\})?[Ii]ma?ge?\:([^ ,\]]*)(?:[, ]([^\]]*))?\]/g,tmplt:function($0,$1,$2,$3){return Wiky.store("<img"+Wiky.style($1)+" src=\""+$2+"\" alt=\""+($3?$3:$2)+"\" title=\""+($3?$3:$2)+"\"/>");}},{rex:/\[([^ ,]+)[, ]([^\]]*)\]/g,tmplt:function($0,$1,$2){return Wiky.store("<a href=\""+$1+"\">"+$2+"</a>");}},{rex:/(((http(s?))\:\/\/)?[A-Za-z0-9\._\/~\-:]+\.(?:png|jpg|jpeg|gif|bmp))/g,tmplt:function($0,$1,$2){return Wiky.store("<img src=\""+$1+"\" alt=\""+$1+"\"/>");}},{rex:/((mailto\:|javascript\:|(news|file|(ht|f)tp(s?))\:\/\/)[A-Za-z0-9\.:_\/~%\-+&#?!=()@\x80-\xB5\xB7\xFF]+)/g,tmplt:"<a href=\"$1\">$1</a>"}],escapes:[{rex:/\\([|*_~\^])/g,tmplt:function($0,$1){return Wiky.store($1);}},{rex:/\\&/g,tmplt:"&amp;"},{rex:/\\>/g,tmplt:"&gt;"},{rex:/\\</g,tmplt:"&lt;"}],shortcuts:[{rex:/---/g,tmplt:"&#8212;"},{rex:/--/g,tmplt:"&#8211;"},{rex:/[\.]{3}/g,tmplt:"&#8230;"},{rex:/<->/g,tmplt:"&#8596;"},{rex:/<-/g,tmplt:"&#8592;"},{rex:/->/g,tmplt:"&#8594;"},],code:[{rex:/&/g,tmplt:"&amp;"},{rex:/</g,tmplt:"&lt;"},{rex:/>/g,tmplt:"&gt;"}],lang:{}},inverse:{all:["Wiky.inverse.pre","Wiky.inverse.nonwikiblocks","Wiky.inverse.wikiblocks","Wiky.inverse.post"],pre:[{rex:/(\r?\n)/g,tmplt:"\xB6"}],post:[{rex:/@([0-9]+)@/g,tmplt:function($0,$1){return Wiky.restore($1);}},{rex:/\xB6/g,tmplt:"\n"}],nonwikiblocks:[{rex:/<pre([^>]*)>(.*?)<\/pre>/mgi,tmplt:function($0,$1,$2){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["lang"]).replace(/x\-/,"")+"%"+Wiky.apply($2,Wiky.hasAttr($1,"lang")?Wiky.inverse.lang[Wiky.attrVal($1,"lang").substr(2)]:Wiky.inverse.code)+"%]");}}],wikiblocks:["Wiky.inverse.nonwikiinlines","Wiky.inverse.escapes","Wiky.inverse.wikiinlines",{rex:/<h1>(.*?)<\/h1>/mgi,tmplt:"=$1="},{rex:/<h2>(.*?)<\/h2>/mgi,tmplt:"==$1=="},{rex:/<h3>(.*?)<\/h3>/mgi,tmplt:"===$1==="},{rex:/<h4>(.*?)<\/h4>/mgi,tmplt:"====$1===="},{rex:/<h5>(.*?)<\/h5>/mgi,tmplt:"=====$1====="},{rex:/<h6>(.*?)<\/h6>/mgi,tmplt:"======$1======"},{rex:/<(p|table)[^>]+(style=\"[^\"]*\")[^>]*>/mgi,tmplt:function($0,$1,$2){return"<"+$1+">"+Wiky.invStyle($2);}},{rex:/\xB6{2}<li/mgi,tmplt:"\xB6<li"},{rex:/<li class=\"?([^ >\"]*)\"?[^>]*?>([^<]*)/mgi,tmplt:function($0,$1,$2){return $1.replace(/u/g,"*").replace(/([01aAiIg])$/,"$1.")+" "+$2;}},{rex:/(^|\xB6)<(u|o)l[^>]*?>\xB6/mgi,tmplt:"$1"},{rex:/(<\/(?:dl|ol|ul|p)>[ \xB6]*<(?:p)>)/gi,tmplt:"\xB6\xB6"},{rex:/<dt>(.*?)<\/dt>[ \f\n\r\t\v]*<dd>/mgi,tmplt:"; $1: "},{rex:/<blockquote([^>]*)>/mgi,tmplt:function($0,$1){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["cite","title"])+"\"");}},{rex:/<\/blockquote>/mgi,tmplt:"\"]"},{rex:/<td class=\"?lft\"?>\xB6*[ ]?|<\/tr>/mgi,tmplt:"|"},{rex:/\xB6<tr(?:[^>]*?)>/mgi,tmplt:"\xB6"},{rex:/<td colspan=\"([0-9]+)\"(?:[^>]*?)>/mgi,tmplt:"|$1>"},{rex:/<td(?:[^>]*?)>/mgi,tmplt:"|"},{rex:/<table>/mgi,tmplt:"["},{rex:/<\/table>/mgi,tmplt:"]"},{rex:/<tr(?:[^>]*?)>\xB6*|<\/td>\xB6*|<tbody>\xB6*|<\/tbody>/mgi,tmplt:""},{rex:/<hr\/?>/mgi,tmplt:"----"},{rex:/<br\/?>/mgi,tmplt:"\\\\"},{rex:/(<p>|<(d|o|u)l[^>]*>|<\/(dl|ol|ul|p)>|<\/(li|dd)>)/mgi,tmplt:""},"Wiky.inverse.shortcuts"],nonwikiinlines:[{rex:/<code>(.*?)<\/code>/g,tmplt:function($0,$1){return Wiky.store("%"+Wiky.apply($1,Wiky.inverse["code"])+"%");}}],wikiinlines:[{rex:/<strong[^>]*?>(.*?)<\/strong>/mgi,tmplt:"*$1*"},{rex:/<b[^>]*?>(.*?)<\/b>/mgi,tmplt:"*$1*"},{rex:/<em[^>]*?>(.*?)<\/em>/mgi,tmplt:"_$1_"},{rex:/<i[^>]*?>(.*?)<\/i>/mgi,tmplt:"_$1_"},{rex:/<sup[^>]*?>(.*?)<\/sup>/mgi,tmplt:"^$1^"},{rex:/<sub[^>]*?>(.*?)<\/sub>/mgi,tmplt:"~$1~"},{rex:/<del[^>]*?>(.*?)<\/del>/mgi,tmplt:"(-$1-)"},{rex:/<abbr title=\"([^\"]*)\">(.*?)<\/abbr>/mgi,tmplt:"?$2($1)?"},{rex:/<a href=\"([^\"]*)\"[^>]*?>(.*?)<\/a>/mgi,tmplt:function($0,$1,$2){return $1==$2?$1:"["+$1+","+$2+"]";}},{rex:/<img([^>]*)\/>/mgi,tmplt:function($0,$1){var a=Wiky.attrVal($1,"alt"),h=Wiky.attrVal($1,"src"),t=Wiky.attrVal($1,"title"),s=Wiky.attrVal($1,"style");return s||(t&&h!=t)?("["+Wiky.invStyle($1)+"img:"+h+(t&&(","+t))+"]"):h;}},],escapes:[{rex:/([|*_~%\^])/g,tmplt:"\\$1"},{rex:/&amp;/g,tmplt:"\\&"},{rex:/&gt;/g,tmplt:"\\>"},{rex:/&lt;/g,tmplt:"\\<"}],shortcuts:[{rex:/&#8211;|\u2013/g,tmplt:"--"},{rex:/&#8212;|\u2014/g,tmplt:"---"},{rex:/&#8230;|\u2026/g,tmplt:"..."},{rex:/&#8596;|\u2194/g,tmplt:"<->"},{rex:/&#8592;|\u2190/g,tmplt:"<-"},{rex:/&#8594;|\u2192/g,tmplt:"->"}],code:[{rex:/&amp;/g,tmplt:"&"},{rex:/&lt;/g,tmplt:"<"},{rex:/&gt;/g,tmplt:">"}],lang:{}},toHtml:function(str){Wiky.blocks=[];return Wiky.apply(str,Wiky.rules.all);},toWiki:function(str){Wiky.blocks=[];return Wiky.apply(str,Wiky.inverse.all);},apply:function(str,rules){if(str&&rules)
for(var i in rules){if(typeof(rules[i])=="string")
str=Wiky.apply(str,eval(rules[i]));else
str=str.replace(rules[i].rex,rules[i].tmplt);}
return str;},store:function(str,unresolved){return unresolved?"@"+(Wiky.blocks.push(str)-1)+"@":"@"+(Wiky.blocks.push(str.replace(/@([0-9]+)@/g,function($0,$1){return Wiky.restore($1);}))-1)+"@";},restore:function(idx){return Wiky.blocks[idx];},attr:function(str,name,idx){var a=str&&str.split(",")[idx||0];return a?(name?(" "+name+"=\""+a+"\""):a):"";},hasAttr:function(str,name){return new RegExp(name+"=").test(str);},attrVal:function(str,name){return str.replace(new RegExp("^.*?"+name+"=\"(.*?)\".*?$"),"$1");},invAttr:function(str,names){var a=[],x;for(var i in names)
if(str.indexOf(names[i]+"=")>=0)
a.push(str.replace(new RegExp("^.*?"+names[i]+"=\"(.*?)\".*?$"),"$1"));return a.length?("("+a.join(",")+")"):"";},style:function(str){var s=str&&str.split(/,|;/),p,style="";for(var i in s){if(typeof s[i]=="string"){p=s[i].split(":");if(p[0]==">")style+="margin-left:4em;";else if(p[0]=="<")style+="margin-right:4em;";else if(p[0]==">>")style+="float:right;";else if(p[0]=="<<")style+="float:left;";else if(p[0]=="=")style+="display:block;margin:0 auto;";else if(p[0]=="_")style+="text-decoration:underline;";else if(p[0]=="b")style+="border:solid 1px;";else if(p[0]=="c")style+="color:"+p[1]+";";else if(p[0]=="C")style+="background:"+p[1]+";";else if(p[0]=="w")style+="width:"+p[1]+";";else style+=p[0]+":"+p[1]+";";}}
return style?" style=\""+style+"\"":"";},invStyle:function(str){var s=/style=/.test(str)?str.replace(/^.*?style=\"(.*?)\".*?$/,"$1"):"",p=s&&s.split(";"),pi,prop=[];for(var i in p){if(typeof p[i]=="string"){pi=p[i].split(":");if(pi[0]=="margin-left"&&pi[1]=="4em")prop.push(">");else if(pi[0]=="margin-right"&&pi[1]=="4em")prop.push("<");else if(pi[0]=="float"&&pi[1]=="right")prop.push(">>");else if(pi[0]=="float"&&pi[1]=="left")prop.push("<<");else if(pi[0]=="margin"&&pi[1]=="0 auto")prop.push("=");else if(pi[0]=="display"&&pi[1]=="block");else if(pi[0]=="text-decoration"&&pi[1]=="underline")prop.push("_");else if(pi[0]=="border"&&pi[1]=="solid 1px")prop.push("b");else if(pi[0]=="color")prop.push("c:"+pi[1]);else if(pi[0]=="background")prop.push("C:"+pi[1]);else if(pi[0]=="width")prop.push("w:"+pi[1]);else if(pi[0])prop.push(pi[0]+":"+pi[1]);}}
return prop.length?("{"+prop.join(",")+"}"):"";},sectionRule:function(fromLevel,style,content,toLevel){var trf={p_p:"<p>$1</p>",p_u:"<p>$1</p><ul$3>",p_o:"<p>$1</p><ol$3>",u_p:"<li$2>$1</li></ul>",u_c:"<li$2>$1</li></ul></td>",u_r:"<li$2>$1</li></ul></td></tr>",uu_p:"<li$2>$1</li></ul></li></ul>",uo_p:"<li$2>$1</li></ol></li></ul>",uuu_p:"<li$2>$1</li></ul></li></ul></li></ul>",uou_p:"<li$2>$1</li></ul></li></ol></li></ul>",uuo_p:"<li$2>$1</li></ol></li></ul></li></ul>",uoo_p:"<li$2>$1</li></ol></li></ol></li></ul>",u_u:"<li$2>$1</li>",uu_u:"<li$2>$1</li></ul></li>",uo_u:"<li$2>$1</li></ol></li>",uuu_u:"<li$2>$1</li></ul></li></ul></li>",uou_u:"<li$2>$1</li></ul></li></ol></li>",uuo_u:"<li$2>$1</li></ol></li></ul></li>",uoo_u:"<li$2>$1</li></ol></li></ol></li>",u_uu:"<li$2>$1<ul$3>",u_o:"<li$2>$1</li></ul><ol$3>",uu_o:"<li$2>$1</li></ul></li></ul><ol$3>",uo_o:"<li$2>$1</li></ol></li></ul><ol$3>",uuu_o:"<li$2>$1</li></ul></li></ul></li></ul><ol$3>",uou_o:"<li$2>$1</li></ul></li></ol></li></ul><ol$3>",uuo_o:"<li$2>$1</li></ol></li></ul></li></ul><ol$3>",uoo_o:"<li$2>$1</li></ol></li></ol></li></ul><ol$3>",u_uo:"<li$2>$1<ol$3>",o_p:"<li$2>$1</li></ol>",oo_p:"<li$2>$1</li></ol></li></ol>",ou_p:"<li$2>$1</li></ul></li></ol>",ooo_p:"<li$2>$1</li></ol></li></ol>",ouo_p:"<li$2>$1</li></ol></li></ul></li></ol>",oou_p:"<li$2>$1</li></ul></li></ol></li></ol>",ouu_p:"<li$2>$1</li></ul></li></ul></li></ol>",o_u:"<li$2>$1</li></ol><ul$3>",oo_u:"<li$2>$1</li></ol></li></ol><ul$3>",ou_u:"<li$2>$1</li></ul></li></ol><ul$3>",ooo_u:"<li$2>$1</li></ol></li></ol></li></ol><ul$3>",ouo_u:"<li$2>$1</li></ol></li></ul></li></ol><ul$3>",oou_u:"<li$2>$1</li></ul></li></ol></li></ol><ul$3>",ouu_u:"<li$2>$1</li></ul></li></ul></li></ol><ul$3>",o_ou:"<li$2>$1<ul$3>",o_o:"<li$2>$1</li>",oo_o:"<li$2>$1</li></ol></li>",ou_o:"<li$2>$1</li></ul></li>",ooo_o:"<li$2>$1</li></ol></li></ol></li>",ouo_o:"<li$2>$1</li></ol></li></ul></li>",oou_o:"<li$2>$1</li></ul></li></ol></li>",ouu_o:"<li$2>$1</li></ul></li></ul></li>",o_oo:"<li$2>$1<ol$3>",l_d:"<dt>$1</dt>",d_l:"<dd>$1</dd>",d_u:"<dd>$1</dd></dl><ul>",d_o:"<dd>$1</dd></dl><ol>",p_l:"<p>$1</p><dl>",u_l:"<li$2>$1</li></ul><dl>",o_l:"<li$2>$1</li></ol><dl>",uu_l:"<li$2>$1</li></ul></li></ul><dl>",uo_l:"<li$2>$1</li></ol></li></ul><dl>",ou_l:"<li$2>$1</li></ul></li></ol><dl>",oo_l:"<li$2>$1</li></ol></li></ol><dl>",d_p:"<dd>$1</dd></dl>",p_t:"<p>$1</p><table>",p_r:"<p>$1</p></td></tr>",p_c:"<p>$1</p></td>",t_p:"</table><p>$1</p>",r_r:"<tr><td>$1</td></tr>",r_p:"<tr><td><p>$1</p>",r_c:"<tr><td>$1</td>",r_u:"<tr><td>$1<ul>",c_p:"<td><p>$1</p>",c_r:"<td>$1</td></tr>",c_c:"<td>$1</td>",u_t:"<li$2>$1</li></ul><table>",o_t:"<li$2>$1</li></ol><table>",d_t:"<dd>$1</dd></dl><table>",t_u:"</table><p>$1</p><ul>",t_o:"</table><p>$1</p><ol>",t_l:"</table><p>$1</p><dl>"};var type={"0":"decimal-leading-zero","1":"decimal","a":"lower-alpha","A":"upper-alpha","i":"lower-roman","I":"upper-roman","g":"lower-greek"};var from="",to="",maxlen=Math.max(fromLevel.length,toLevel.length),sync=true,sectiontype=type[toLevel.charAt(toLevel.length-1)],transition;for(var i=0;i<maxlen;i++)
if(fromLevel.charAt(i+1)!=toLevel.charAt(i+1)||!sync||i==maxlen-1)
{from+=fromLevel.charAt(i)==undefined?" ":fromLevel.charAt(i);to+=toLevel.charAt(i)==undefined?" ":toLevel.charAt(i);sync=false;}
transition=(from+"_"+to).replace(/([01AIagi])/g,"o");return!trf[transition]?("?("+transition+")"):trf[transition].replace(/\$2/," class=\""+fromLevel+"\"").replace(/\$3/,!sectiontype?"":(" style=\"list-style-type:"+sectiontype+";\"")).replace(/\$1/,content).replace(/<p><\/p>/,"");}}
CERNY.require("TOPINCS.widgets.ValueViewer","TOPINCS.cons","TOPINCS.widgets.DICT","TOPINCS.tmdm.ext.TopicProxy","TOPINCS.tmdm.TopicReference","TOPINCS.util","CERNY.util","CERNY.js.Array","CERNY.js.Number","CERNY.text.DateFormat","CERNY.js.Date","CERNY.text.TimeFormat","Wiky","CERNY.dom.Element");(function(){var DICT=TOPINCS.widgets.DICT;var Element=CERNY.dom.Element;var method=CERNY.method;var signature=CERNY.signature;var Logger=CERNY.Logger;var isMultiline=TOPINCS.util.isMultiline;var isCode=TOPINCS.util.isCode;var countLines=TOPINCS.util.countLines;var TopicProxy=TOPINCS.tmdm.ext.TopicProxy;TOPINCS.widgets.ValueViewer=ValueViewer;var logger=Logger("TOPINCS.widgets.ValueViewer");function ValueViewer(value,datatype,locale){var cons=ValueViewer[datatype];if(!cons){cons=ValueViewer._default;}
var viewer=new cons(value,datatype,locale);return viewer;}
ValueViewer.prototype.logger=logger;function init(t,value,datatype,locale){t.value=value;t.datatype=datatype;t.locale=locale;method(t,"getComparable",getComparable);}
function getComparable(){return this.value.toLowerCase();}
signature("getComparable","any");(function(){ValueViewer[DT_ANYURI]=AnyUriViewer;function AnyUriViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("a");}
function render(){this.el.setText(this.value);this.el.setAttr("href",this.value);this.el.addCSSClass("external");return this.el;}
signature("render",Element);method(AnyUriViewer.prototype,"render",render);})();(function(){ValueViewer[DT_STRING]=StringViewer;ValueViewer._default=StringViewer;function StringViewer(value,datatype,locale){init(this,value,datatype,locale);if(isMultiline(value)){this.el=Element.create("div");}else{this.el=Element.create("span");}}
function render(){if(this.value==""){this.el.setText(DICT.lab_empty_string);this.el.addCSSClass("message");}else{var nodes=[document.createTextNode(this.value)];if(isMultiline(this.value)){nodes=[];var paragraphs=this.value.split("\n");for(var j=0,l=paragraphs.length;j<l;j++){nodes.push(Element.create("p",paragraphs[j]));}
this.el.addCSSClass("multiline");}
if(isCode(this.value)){this.el.addCSSClass("code");}
for(var i=0,l=nodes.length;i<l;i++){this.el.appendChild(nodes[i]);}}
return this.el;}
signature("render",Element);method(StringViewer.prototype,"render",render);})();(function(){ValueViewer[DT_DATE]=DateViewer;function DateViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("span");}
function render(){var value=this.value;var t=this;var el;var date=Date.parseDate(value,CERNY.text.DateFormat.ISO);if(date){el=formatDateWithLocalTime(date,function(_date){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(_date)){timezoneFormat=t.locale.formats.timezone;}
return date.formatDate(t.locale.formats.date," ",timezoneFormat);});}
this.el.appendChild(el);return this.el;}
signature("render",Element);method(DateViewer.prototype,"render",render);})();(function(){ValueViewer[DT_BOOLEAN]=BooleanViewer;function BooleanViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("span");}
function render(){if(this.value==="1"){this.el.setText(" "+DICT.lab_yes);}else{this.el.setText(" "+DICT.lab_no);}
return this.el;}
signature("render",Element);method(BooleanViewer.prototype,"render",render);})();(function(){ValueViewer[DT_WIKIMARKUP]=WikiMarkupViewer;function WikiMarkupViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("div",null,"class=wikimarkupviewer");}
function render(){var html;try{html=Wiky.toHtml(CERNY.util.escapeHtml(this.value));}catch(e){html=this.value;}
this.el.node.innerHTML=html;return this.el;}
signature("render",Element);method(WikiMarkupViewer.prototype,"render",render);})();(function(){ValueViewer[DT_DATETIME]=DateTimeViewer;function DateTimeViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("span");}
function render(){var date,el,t=this;try{var dateStr=this.value.substr(0,10);var timeStr=this.value.substr(11);date=Date.parseDateTime(dateStr,CERNY.text.DateFormat.ISO,timeStr,CERNY.text.TimeFormat.ISO);el=formatDateWithLocalTime(date,function(_dateTime){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(_dateTime)){timezoneFormat=t.locale.formats.timezone;}
return _dateTime.formatDateTime(t.locale.formats.date," ",t.locale.formats.time," ",timezoneFormat);});}catch(e){el=Element.create("span",this.value);}
this.el.appendChild(el);return this.el;}
signature("render",Element);method(DateTimeViewer.prototype,"render",render);})();(function(){ValueViewer[DT_TIME]=TimeViewer;function TimeViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("span");}
function render(){var time,el,t=this;try{time=Date.parseTime(this.value,CERNY.text.TimeFormat.ISO);el=formatDateWithLocalTime(time,function(_time){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(_time)){timezoneFormat=t.locale.formats.timezone;}
return _time.formatTime(t.locale.formats.time," ",timezoneFormat);});}catch(e){el=Element.create("span",this.value);}
this.el.appendChild(el);return this.el;}
signature("render",Element);method(TimeViewer.prototype,"render",render);})();(function(){ValueViewer[DT_TOPIC_REFERENCE_LIST]=TopicReferenceListViewer;function TopicReferenceListViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("ol",null,"class=list-viewer");this.list=eval(this.value);TopicProxy.prefetch(this.list);}
function render(){var t=this;this.list.map(function(tr){var liEl=Element.create("li");liEl.appendChild(TopicProxy.toLinkTyped(TopicProxy.get(tr)));t.el.appendChild(liEl);});return t.el;}
signature("render",Element);method(TopicReferenceListViewer.prototype,"render",render);})();(function(){ValueViewer[DT_VALUE_LIST]=ValueListViewer;function ValueListViewer(value,datatype,locale){init(this,value,datatype,locale);this.el=Element.create("ol",null,"class=list-viewer");this.list=eval(this.value);}
function render(){var t=this;this.list.map(function(value){var liEl=Element.create("li",value);t.el.appendChild(liEl);});return t.el;}
signature("render",Element);method(ValueListViewer.prototype,"render",render);})();(function(){ValueViewer[DT_DECIMAL]=DecimalViewer;function DecimalViewer(value,datatype,locale){init(this,value,datatype,locale);method(this,"getComparable",getComparable);this.el=Element.create("span");}
function render(){try{var number=Number._parse(this.value,CERNY.text.NumberFormat.US);this.el.setText(number.format(this.locale.formats.decimal));}catch(e){this.el.setText(this.value);}
return this.el;}
signature("render",Element);method(DecimalViewer.prototype,"render",render);function getComparable(){try{return Number._parse(this.value,CERNY.text.NumberFormat.US);}catch(e){return null;}}
signature("getComparable",["number",undefined]);})();function formatDateWithLocalTime(date,f){var localDate=CERNY.js.Date.convertToLocalTime(date);var el=Element.create("span",f(date));if(date.getTime()!=localDate.getTime()){el.setAttr("title",DICT.lab_local_time+": "+f(localDate));}
return el;}})();CERNY.require("TOPINCS.view.View","CERNY.dom.Element","CERNY.event.Revertable");(function(){var Element=CERNY.dom.Element;var Revertable=CERNY.event.Revertable;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.view.View");TOPINCS.view.View=View;function View(model,context){if(model){setModel(this,model);if(!this.context){this.context=context;}
if(!this.tagName){this.tagName="div";}
this.el=Element.create(this.tagName);if(this.cssClass){this.el.addCSSClass(this.cssClass);}
this.display(context);}}
View.prototype.logger=logger;function setModel(t,model){function redisplay(){t.redisplay();}
model.addObserver(Revertable.EVT_CHANGE,redisplay);model.addObserver(Revertable.EVT_REVERT,redisplay);}
function display(context){}
signature(display,"undefined","object");method(View.prototype,"display",display);function undisplay(){this.el.deleteChildren();}
signature(undisplay,"undefined");method(View.prototype,"undisplay",undisplay);function redisplay(){this.undisplay();this.display(this.context);}
signature(redisplay,"redefined");method(View.prototype,"redisplay",redisplay);function render(){return this.el;}
signature(render,"object");method(View.prototype,"render",render);})();CERNY.require("TOPINCS.view.ListView","TOPINCS.view.View","CERNY.event.List");(function(){TOPINCS.view.ListView=ListView;var List=CERNY.event.List;var View=TOPINCS.view.View;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.view.ListView");function ListView(list,context,viewclass){if(list){this.list=list;this.viewclass=viewclass;this.context=context;this.viewMap={};init(this);var t=this;setModel(t,list);}
View.call(this,list,context);}
ListView.prototype=new View();ListView.prototype.logger=logger;function init(t){t.views=[];t.list.map(function(item){t.views.push(getView(t,item));});}
function display(context){var t=this;this.views.map(function(view){t.el.appendChild(view.render());});}
signature(display,"undefined","object");method(ListView.prototype,"display",display);function getView(t,item){var view=t.viewMap[item.id];if(!view){view=new t.viewclass(item,t.context);view._listViewItemId=item.id;t.viewMap[item.id]=view;}
return view;}
function addView(t,item){var view=getView(t,item);var lastView=t.views[t.views.length-1];if(lastView){t.el.insertAfter(view.render(),lastView.el);}else{t.el.appendChild(view.render());}
t.views.push(view);}
function insertView(t,index,item){var currentView=t.views[index];if(currentView){var view=getView(t,item);t.el.insertBefore(view.render(),currentView.el);t.views.insertAt(index,view);}else{addView(t,item);}}
function removeView(t,index){var view=t.views[index];delete(t.viewMap[view._listViewItemId]);t.el.node.removeChild(view.el.node);t.views.remove(view);}
function setModel(t,list){list.addObserver(List.EVT_ITEM_ADDED,function(){addView(t,t.list[t.list.length-1]);});list.addObserver(List.EVT_ITEM_INSERTED,function(index){insertView(t,index,t.list[index]);});list.addObserver(List.EVT_ITEM_REMOVED,function(index){removeView(t,index);});list.addObserver(List.EVT_REARRANGED,function(){init(t);t.redisplay();});}})();CERNY.require("TOPINCS.widgets.Button","TOPINCS.cons","TOPINCS.util","CERNY.dom.Element");(function(){TOPINCS.widgets.Button=Button;var Element=CERNY.dom.Element;var method=CERNY.method;function Button(conf){this.label=conf.label;this.tooltip=conf.tooltip;this.key=conf.key;this.active=conf.active;this.blockUi=conf.blockUi;if(!isBoolean(this.active)){this.active=true;}
if(!isBoolean(this.blockUi)){this.blockUi=true;}
if(this.blockUi){this.action=function(){TOPINCS.util.blockUi();setTimeout(function(){conf.action();TOPINCS.util.releaseUi();},50);};}else{this.action=conf.action;}
this.el=null;}
function render(){var el=Element.create("button",this.label,"class=button","href="+HREF_VOID);this.el=el;setTitle(this);if(this.active){this.activate();}else{this.deactivate();}
return el;}
method(Button.prototype,"render",render);function activate(){this.el.addEvtListener("click",this.action);this.el.deleteCSSClass("button-inactive");this.el.node.disabled=0;this.active=true;}
method(Button.prototype,"activate",activate);function deactivate(){this.el.removeEvtListener("click",this.action);this.el.addCSSClass("button-inactive");this.el.node.disabled=1;this.active=false;}
method(Button.prototype,"deactivate",deactivate);function setTooltip(tooltip){this.tooltip=tooltip;setTitle(this);}
method(Button.prototype,"setTooltip",setTooltip);function focus(){try{this.el.node.focus();}catch(e){}}
method(Button.prototype,"focus",focus);function setTitle(t){var title;if(t.tooltip){title=t.tooltip;}
if(t.key){if(title){title+="\n"+t.key;}else{title=t.key;}}
if(title){t.el.setAttr("title",title);}}})();CERNY.require("TOPINCS.widgets.Buttons","CERNY.dom.Element","TOPINCS.widgets.Button");(function(){TOPINCS.widgets.Buttons=Buttons;var signature=CERNY.signature;var method=CERNY.method;var Button=TOPINCS.widgets.Button;var Element=CERNY.dom.Element;var logger=CERNY.Logger("TOPINCS.widgets.Buttons");function Buttons(){this.buttons=[];}
Buttons.prototype.logger=logger;function render(){var el=Element.create("div",null,"class=buttons");var first=true;this.buttons.map(function(button){el.appendChild(button.render());});return el;}
signature(render,Element);method(Buttons.prototype,"render",render);function addButton(button){this.buttons.push(button);}
signature(addButton,"undefined",Button);method(Buttons.prototype,"addButton",addButton);})();if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(name){return YAHOO.env.modules[name]||null;};YAHOO.env.ua=function(){var o={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var ua=navigator.userAgent,m;if((/KHTML/).test(ua)){o.webkit=1;}
m=ua.match(/AppleWebKit\/([^\s]*)/);if(m&&m[1]){o.webkit=parseFloat(m[1]);if(/ Mobile\//.test(ua)){o.mobile="Apple";}else{m=ua.match(/NokiaN[^\/]*/);if(m){o.mobile=m[0];}}
m=ua.match(/AdobeAIR\/([^\s]*)/);if(m){o.air=m[0];}}
if(!o.webkit){m=ua.match(/Opera[\s\/]([^\s]*)/);if(m&&m[1]){o.opera=parseFloat(m[1]);m=ua.match(/Opera Mini[^;]*/);if(m){o.mobile=m[0];}}else{m=ua.match(/MSIE\s([^;]*)/);if(m&&m[1]){o.ie=parseFloat(m[1]);}else{m=ua.match(/Gecko\/([^\s]*)/);if(m){o.gecko=1;m=ua.match(/rv:([^\s\)]*)/);if(m&&m[1]){o.gecko=parseFloat(m[1]);}}}}}
return o;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
if(unique){ls.push(l);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var L=YAHOO.lang,ADD=["toString","valueOf"],OB={isArray:function(o){if(o){return L.isNumber(o.length)&&L.isFunction(o.splice);}
return false;},isBoolean:function(o){return typeof o==='boolean';},isFunction:function(o){return typeof o==='function';},isNull:function(o){return o===null;},isNumber:function(o){return typeof o==='number'&&isFinite(o);},isObject:function(o){return(o&&(typeof o==='object'||L.isFunction(o)))||false;},isString:function(o){return typeof o==='string';},isUndefined:function(o){return typeof o==='undefined';},_IEEnumFix:(YAHOO.env.ua.ie)?function(r,s){for(var i=0;i<ADD.length;i=i+1){var fname=ADD[i],f=s[fname];if(L.isFunction(f)&&f!=Object.prototype[fname]){r[fname]=f;}}}:function(){},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("extend failed, please check that "+"all dependencies are included.");}
var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
if(overrides){for(var i in overrides){if(L.hasOwnProperty(overrides,i)){subc.prototype[i]=overrides[i];}}
L._IEEnumFix(subc.prototype,overrides);}},augmentObject:function(r,s){if(!s||!r){throw new Error("Absorb failed, verify dependencies.");}
var a=arguments,i,p,override=a[2];if(override&&override!==true){for(i=2;i<a.length;i=i+1){r[a[i]]=s[a[i]];}}else{for(p in s){if(override||!(p in r)){r[p]=s[p];}}
L._IEEnumFix(r,s);}},augmentProto:function(r,s){if(!s||!r){throw new Error("Augment failed, verify dependencies.");}
var a=[r.prototype,s.prototype];for(var i=2;i<arguments.length;i=i+1){a.push(arguments[i]);}
L.augmentObject.apply(this,a);},dump:function(o,d){var i,len,s=[],OBJ="{...}",FUN="f(){...}",COMMA=', ',ARROW=' => ';if(!L.isObject(o)){return o+"";}else if(o instanceof Date||("nodeType"in o&&"tagName"in o)){return o;}else if(L.isFunction(o)){return FUN;}
d=(L.isNumber(d))?d:3;if(L.isArray(o)){s.push("[");for(i=0,len=o.length;i<len;i=i+1){if(L.isObject(o[i])){s.push((d>0)?L.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
s.push(COMMA);}
if(s.length>1){s.pop();}
s.push("]");}else{s.push("{");for(i in o){if(L.hasOwnProperty(o,i)){s.push(i+ARROW);if(L.isObject(o[i])){s.push((d>0)?L.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
s.push(COMMA);}}
if(s.length>1){s.pop();}
s.push("}");}
return s.join("");},substitute:function(s,o,f){var i,j,k,key,v,meta,saved=[],token,DUMP='dump',SPACE=' ',LBRACE='{',RBRACE='}';for(;;){i=s.lastIndexOf(LBRACE);if(i<0){break;}
j=s.indexOf(RBRACE,i);if(i+1>=j){break;}
token=s.substring(i+1,j);key=token;meta=null;k=key.indexOf(SPACE);if(k>-1){meta=key.substring(k+1);key=key.substring(0,k);}
v=o[key];if(f){v=f(key,v,meta);}
if(L.isObject(v)){if(L.isArray(v)){v=L.dump(v,parseInt(meta,10));}else{meta=meta||"";var dump=meta.indexOf(DUMP);if(dump>-1){meta=meta.substring(4);}
if(v.toString===Object.prototype.toString||dump>-1){v=L.dump(v,parseInt(meta,10));}else{v=v.toString();}}}else if(!L.isString(v)&&!L.isNumber(v)){v="~-"+saved.length+"-~";saved[saved.length]=token;}
s=s.substring(0,i)+v+s.substring(j+1);}
for(i=saved.length-1;i>=0;i=i-1){s=s.replace(new RegExp("~-"+i+"-~"),"{"+saved[i]+"}","g");}
return s;},trim:function(s){try{return s.replace(/^\s+|\s+$/g,"");}catch(e){return s;}},merge:function(){var o={},a=arguments;for(var i=0,l=a.length;i<l;i=i+1){L.augmentObject(o,a[i],true);}
return o;},later:function(when,o,fn,data,periodic){when=when||0;o=o||{};var m=fn,d=data,f,r;if(L.isString(fn)){m=o[fn];}
if(!m){throw new TypeError("method undefined");}
if(!L.isArray(d)){d=[data];}
f=function(){m.apply(o,d);};r=(periodic)?setInterval(f,when):setTimeout(f,when);return{interval:periodic,cancel:function(){if(this.interval){clearInterval(r);}else{clearTimeout(r);}}};},isValue:function(o){return(L.isObject(o)||L.isString(o)||L.isNumber(o)||L.isBoolean(o));}};L.hasOwnProperty=(Object.prototype.hasOwnProperty)?function(o,prop){return o&&o.hasOwnProperty(prop);}:function(o,prop){return!L.isUndefined(o[prop])&&o.constructor.prototype[prop]!==o[prop];};OB.augmentObject(L,OB,true);YAHOO.util.Lang=L;L.augment=L.augmentProto;YAHOO.augment=L.augmentProto;YAHOO.extend=L.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.6.0",build:"1321"});YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}
this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
return found;},fire:function(){this.lastError=null;var errors=[],len=this.subscribers.length;if(!len&&this.silent){return true;}
var args=[].slice.call(arguments,0),ret=true,i,rebuild=false;if(!this.silent){}
var subs=this.subscribers.slice(),throwErrors=YAHOO.util.Event.throwErrors;for(i=0;i<len;++i){var s=subs[i];if(!s){rebuild=true;}else{if(!this.silent){}
var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
try{ret=s.fn.call(scope,param,s.obj);}catch(e){this.lastError=e;if(throwErrors){throw e;}}}else{try{ret=s.fn.call(scope,this.type,args,s.obj);}catch(ex){this.lastError=ex;if(throwErrors){throw ex;}}}
if(false===ret){if(!this.silent){}
break;}}}
return(ret!==false);},unsubscribeAll:function(){for(var i=this.subscribers.length-1;i>-1;i--){this._delete(i);}
this.subscribers=[];return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
this.subscribers.splice(index,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=YAHOO.lang.isUndefined(obj)?null:obj;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var webkitKeymap={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var _FOCUS=YAHOO.env.ua.ie?"focusin":"focus";var _BLUR=YAHOO.env.ua.ie?"focusout":"blur";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,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override,checkContent){var a=(YAHOO.lang.isString(p_id))?[p_id]:p_id;for(var i=0;i<a.length;i=i+1){onAvailStack.push({id:a[i],fn:p_fn,obj:p_obj,override:p_override,checkReady:checkContent});}
retryCount=this.POLL_RETRYS;this.startInterval();},onContentReady:function(p_id,p_fn,p_obj,p_override){this.onAvailable(p_id,p_fn,p_obj,p_override,true);},onDOMReady:function(p_fn,p_obj,p_override){if(this.DOMReady){setTimeout(function(){var s=window;if(p_override){if(p_override===true){s=p_obj;}else{s=p_override;}}
p_fn.call(s,"DOMReady",[],p_obj);},0);}else{this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);}},_addListener:function(el,sType,fn,obj,override,capture){if(!fn||!fn.call){return false;}
if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this._addListener(el[i],sType,fn,obj,override,capture)&&ok;}
return ok;}else if(YAHOO.lang.isString(el)){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event._addListener(el,sType,fn,obj,override,capture);});return true;}}
if(!el){return false;}
if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override,capture];return true;}
var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e,el),obj);};var li=[el,sType,fn,wrappedFn,scope,obj,override,capture];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,capture);}catch(ex){this.lastError=ex;this._removeListener(el,sType,fn,capture);return false;}}
return true;},addListener:function(el,sType,fn,obj,override){return this._addListener(el,sType,fn,obj,override,false);},addFocusListener:function(el,fn,obj,override){return this._addListener(el,_FOCUS,fn,obj,override,true);},removeFocusListener:function(el,fn){return this._removeListener(el,_FOCUS,fn,true);},addBlurListener:function(el,fn,obj,override){return this._addListener(el,_BLUR,fn,obj,override,true);},removeBlurListener:function(el,fn){return this._removeListener(el,_BLUR,fn,true);},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex].slice();for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){return(this.webkit&&this.webkit<419&&("click"==sType||"dblclick"==sType));},_removeListener:function(el,sType,fn,capture){var i,len,li;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=el.length-1;i>-1;i--){ok=(this._removeListener(el[i],sType,fn,capture)&&ok);}
return ok;}
if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
if("unload"==sType){for(i=unloadListeners.length-1;i>-1;i--){li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners.splice(i,1);return true;}}
return false;}
var cacheItem=null;var index=arguments[4];if("undefined"===typeof index){index=this._getCacheIndex(el,sType,fn);}
if(index>=0){cacheItem=listeners[index];}
if(!el||!cacheItem){return false;}
if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist.splice(i,1);break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],capture);}catch(ex){this.lastError=ex;return false;}}
delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners.splice(index,1);return true;},removeListener:function(el,sType,fn){return this._removeListener(el,sType,fn,false);},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(n){try{if(n&&3==n.nodeType){return n.parentNode;}}catch(e){}
return n;},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e,boundEl){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
c=c.caller;}}
return ev;},getCharCode:function(ev){var code=ev.keyCode||ev.charCode||0;if(YAHOO.env.ua.webkit&&(code in webkitKeymap)){code=webkitKeymap[code];}
return code;},_getCacheIndex:function(el,sType,fn){for(var i=0,l=listeners.length;i<l;i=i+1){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
return id;},_isValidCollection:function(o){try{return(o&&typeof o!=="string"&&o.length&&!o.tagName&&!o.alert&&typeof o[0]!=="undefined");}catch(ex){return false;}},elCache:{},getEl:function(id){return(typeof id==="string")?document.getElementById(id):id;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();EU._tryPreloadAttach();}},_ready:function(e){var EU=YAHOO.util.Event;if(!EU.DOMReady){EU.DOMReady=true;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(onAvailStack.length===0){retryCount=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 tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0&&onAvailStack.length>0);}
var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
item.fn.call(scope,item.obj);};var i,len,item,el,ready=[];for(i=0,len=onAvailStack.length;i<len;i=i+1){item=onAvailStack[i];if(item){el=this.getEl(item.id);if(el){if(item.checkReady){if(loadComplete||el.nextSibling||!tryAgain){ready.push(item);onAvailStack[i]=null;}}else{executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
for(i=0,len=ready.length;i<len;i=i+1){item=ready[i];executeItem(this.getEl(item.id),item);}
retryCount--;if(tryAgain){for(i=onAvailStack.length-1;i>-1;i--){item=onAvailStack[i];if(!item||!item.id){onAvailStack.splice(i,1);}}
this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
this.locked=false;},purgeElement:function(el,recurse,sType){var oEl=(YAHOO.lang.isString(el))?this.getEl(el):el;var elListeners=this.getListeners(oEl,sType),i,len;if(elListeners){for(i=elListeners.length-1;i>-1;i--){var l=elListeners[i];this._removeListener(oEl,l.type,l.fn,l.capture);}}
if(recurse&&oEl&&oEl.childNodes){for(i=0,len=oEl.childNodes.length;i<len;++i){this.purgeElement(oEl.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType==="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
var oEl=(YAHOO.lang.isString(el))?this.getEl(el):el;for(var j=0;j<searchLists.length;j=j+1){var searchList=searchLists[j];if(searchList){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===oEl&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.OVERRIDE],scope:l[this.ADJ_SCOPE],capture:l[this.CAPTURE],index:i});}}}}
return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index,ul=unloadListeners.slice();for(i=0,len=unloadListeners.length;i<len;++i){l=ul[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.UNLOAD_OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
l[EU.FN].call(scope,EU.getEvent(e,l[EU.EL]),l[EU.UNLOAD_OBJ]);ul[i]=null;l=null;scope=null;}}
unloadListeners=null;if(listeners){for(j=listeners.length-1;j>-1;j--){l=listeners[j];if(l){EU._removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],l[EU.CAPTURE],j);}}
l=null;}
legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;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(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var evts=this.__yui_events;if(p_type){var ce=evts[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}}else{var ret=true;for(var i in evts){if(YAHOO.lang.hasOwnProperty(evts,i)){ret=ret&&evts[i].unsubscribe(p_fn,p_obj);}}
return ret;}
return false;},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=(opts.silent);var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(!ce){return null;}
var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
return ce.fire.apply(ce,args);},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
if(!keyData.alt){keyData.alt=false;}
if(!keyData.ctrl){keyData.ctrl=false;}
if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
(attachTo.id?"["+attachTo.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.6.0",build:"1321"});(function(){var Y=YAHOO.util,lang=YAHOO.lang,getStyle,setStyle,propertyCache={},reClassNameCache={},document=window.document;YAHOO.env._id_counter=YAHOO.env._id_counter||0;var isOpera=YAHOO.env.ua.opera,isSafari=YAHOO.env.ua.webkit,isGecko=YAHOO.env.ua.gecko,isIE=YAHOO.env.ua.ie;var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}
if(propertyCache[property]){return propertyCache[property];}
var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}
propertyCache[property]=converted;return converted;};var getClassRegEx=function(className){var re=reClassNameCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');reClassNameCache[className]=re;}
return re;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';}
var computed=el.ownerDocument.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}
return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}
return val/100;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}
if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}
break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';}
el.style[property]=val;};}
var testElement=function(node,method){return node&&node.nodeType==1&&(!method||method(node));};YAHOO.util.Dom={get:function(el){if(el){if(el.nodeType||el.item){return el;}
if(typeof el==='string'){return document.getElementById(el);}
if('length'in el){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);}
return c;}
return el;}
return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=el.ownerDocument.body){return false;}
return getXY(el);};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}
var pageXY=this.getXY(el);if(pageXY===false){return false;}
var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}
if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=el.ownerDocument.body){return false;}
var region=Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root,apply){className=lang.trim(className);tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
var nodes=[],elements=root.getElementsByTagName(tag),re=getClassRegEx(className);for(var i=0,len=elements.length;i<len;++i){if(re.test(elements[i].className)){nodes[nodes.length]=elements[i];if(apply){apply.call(elements[i],elements[i]);}}}
return nodes;},hasClass:function(el,className){var re=getClassRegEx(className);var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return false;}
el.className=lang.trim([el.className,className].join(' '));return true;};return Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=getClassRegEx(className);var f=function(el){var ret=false,current=el.className;if(className&&current&&this.hasClass(el,className)){el.className=current.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}
el.className=lang.trim(el.className);if(el.className===''){var attr=(el.hasAttribute)?'class':'className';el.removeAttribute(attr);}
ret=true;}
return ret;};return Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(!newClassName||oldClassName===newClassName){return false;}
var re=getClassRegEx(oldClassName);var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return true;}
el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.removeClass(el,oldClassName);}
el.className=lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';var f=function(el){if(el&&el.id){return el.id;}
var id=prefix+YAHOO.env._id_counter++;if(el){el.id=id;}
return id;};return Y.Dom.batch(el,f,Y.Dom,true)||f.apply(Y.Dom,arguments);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);needle=Y.Dom.get(needle);var ret=false;if((haystack&&needle)&&(haystack.nodeType&&needle.nodeType)){if(haystack.contains&&haystack!==needle){ret=haystack.contains(needle);}
else if(haystack.compareDocumentPosition){ret=!!(haystack.compareDocumentPosition(needle)&16);}}else{}
return ret;},inDocument:function(el){return this.isAncestor(document.documentElement,el);},getElementsBy:function(method,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
var nodes=[],elements=root.getElementsByTagName(tag);for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];if(apply){apply(elements[i]);}}}
return nodes;},batch:function(el,method,o,override){el=(el&&(el.tagName||el.item))?el:Y.Dom.get(el);if(!el||!method){return false;}
var scope=(override)?o:window;if(el.tagName||el.length===undefined){return method.call(scope,el,o);}
var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=method.call(scope,el[i],o);}
return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
return width;},getAncestorBy:function(node,method){while((node=node.parentNode)){if(testElement(node,method)){return node;}}
return null;},getAncestorByClassName:function(node,className){node=Y.Dom.get(node);if(!node){return null;}
var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getAncestorBy(node,method);},getAncestorByTagName:function(node,tagName){node=Y.Dom.get(node);if(!node){return null;}
var method=function(el){return el.tagName&&el.tagName.toUpperCase()==tagName.toUpperCase();};return Y.Dom.getAncestorBy(node,method);},getPreviousSiblingBy:function(node,method){while(node){node=node.previousSibling;if(testElement(node,method)){return node;}}
return null;},getPreviousSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getPreviousSiblingBy(node);},getNextSiblingBy:function(node,method){while(node){node=node.nextSibling;if(testElement(node,method)){return node;}}
return null;},getNextSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getNextSiblingBy(node);},getFirstChildBy:function(node,method){var child=(testElement(node.firstChild,method))?node.firstChild:null;return child||Y.Dom.getNextSiblingBy(node.firstChild,method);},getFirstChild:function(node,method){node=Y.Dom.get(node);if(!node){return null;}
return Y.Dom.getFirstChildBy(node);},getLastChildBy:function(node,method){if(!node){return null;}
var child=(testElement(node.lastChild,method))?node.lastChild:null;return child||Y.Dom.getPreviousSiblingBy(node.lastChild,method);},getLastChild:function(node){node=Y.Dom.get(node);return Y.Dom.getLastChildBy(node);},getChildrenBy:function(node,method){var child=Y.Dom.getFirstChildBy(node,method);var children=child?[child]:[];Y.Dom.getNextSiblingBy(child,function(node){if(!method||method(node)){children[children.length]=node;}
return false;});return children;},getChildren:function(node){node=Y.Dom.get(node);if(!node){}
return Y.Dom.getChildrenBy(node);},getDocumentScrollLeft:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);},getDocumentScrollTop:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);},insertBefore:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
return referenceNode.parentNode.insertBefore(newNode,referenceNode);},insertAfter:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
if(referenceNode.nextSibling){return referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);}else{return referenceNode.parentNode.appendChild(newNode);}},getClientRegion:function(){var t=Y.Dom.getDocumentScrollTop(),l=Y.Dom.getDocumentScrollLeft(),r=Y.Dom.getViewportWidth()+l,b=Y.Dom.getViewportHeight()+t;return new Y.Region(t,r,b,l);}};var getXY=function(){if(document.documentElement.getBoundingClientRect){return function(el){var box=el.getBoundingClientRect(),round=Math.round;var rootNode=el.ownerDocument;return[round(box.left+Y.Dom.getDocumentScrollLeft(rootNode)),round(box.top+
Y.Dom.getDocumentScrollTop(rootNode))];};}else{return function(el){var pos=[el.offsetLeft,el.offsetTop];var parentNode=el.offsetParent;var accountForBody=(isSafari&&Y.Dom.getStyle(el,'position')=='absolute'&&el.offsetParent==el.ownerDocument.body);if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(!accountForBody&&isSafari&&Y.Dom.getStyle(parentNode,'position')=='absolute'){accountForBody=true;}
parentNode=parentNode.offsetParent;}}
if(accountForBody){pos[0]-=el.ownerDocument.body.offsetLeft;pos[1]-=el.ownerDocument.body.offsetTop;}
parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName))
{if(parentNode.scrollTop||parentNode.scrollLeft){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
parentNode=parentNode.parentNode;}
return pos;};}}()})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};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(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(YAHOO.lang.isArray(x)){y=x[1];x=x[0];}
this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.6.0",build:"1321"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event,Dom=YAHOO.util.Dom;return{useShim:false,_shimActive:false,_shimState:false,_debugShim:false,_createShim:function(){var s=document.createElement('div');s.id='yui-ddm-shim';if(document.body.firstChild){document.body.insertBefore(s,document.body.firstChild);}else{document.body.appendChild(s);}
s.style.display='none';s.style.backgroundColor='red';s.style.position='absolute';s.style.zIndex='99999';Dom.setStyle(s,'opacity','0');this._shim=s;Event.on(s,"mouseup",this.handleMouseUp,this,true);Event.on(s,"mousemove",this.handleMouseMove,this,true);Event.on(window,'scroll',this._sizeShim,this,true);},_sizeShim:function(){if(this._shimActive){var s=this._shim;s.style.height=Dom.getDocumentHeight()+'px';s.style.width=Dom.getDocumentWidth()+'px';s.style.top='0';s.style.left='0';}},_activateShim:function(){if(this.useShim){if(!this._shim){this._createShim();}
this._shimActive=true;var s=this._shim,o='0';if(this._debugShim){o='.5';}
Dom.setStyle(s,'opacity',o);this._sizeShim();s.style.display='block';}},_deactivateShim:function(){this._shim.style.display='none';this._shimActive=false;},_shim:null,ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,fromTimeout:false,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
if(!this.ids[sGroup]){this.ids[sGroup]={};}
this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g){var item=this.ids[g];if(item&&item[oDD.id]){delete item[oDD.id];}}}
delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(var j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;i<len;++i){if(targets[i].id==oTargetDD.id){return true;}}
return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(sDDId,sHandleId){return(this.handleIds[sDDId]&&this.handleIds[sDDId][sHandleId]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}
return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);DDM.fromTimeout=true;},this.clickTimeThresh);},startDrag:function(x,y){if(this.dragCurrent&&this.dragCurrent.useShim){this._shimState=this.useShim;this.useShim=true;}
this._activateShim();clearTimeout(this.clickTimeout);var dc=this.dragCurrent;if(dc&&dc.events.b4StartDrag){dc.b4StartDrag(x,y);dc.fireEvent('b4StartDragEvent',{x:x,y:y});}
if(dc&&dc.events.startDrag){dc.startDrag(x,y);dc.fireEvent('startDragEvent',{x:x,y:y});}
this.dragThreshMet=true;},handleMouseUp:function(e){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){if(this.fromTimeout){this.fromTimeout=false;this.handleMouseMove(e);}
this.fromTimeout=false;this.fireEvents(e,true);}else{}
this.stopDrag(e);this.stopEvent(e);}},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}
if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e,silent){var dc=this.dragCurrent;if(dc&&!silent){if(this.dragThreshMet){if(dc.events.b4EndDrag){dc.b4EndDrag(e);dc.fireEvent('b4EndDragEvent',{e:e});}
if(dc.events.endDrag){dc.endDrag(e);dc.fireEvent('endDragEvent',{e:e});}}
if(dc.events.mouseUp){dc.onMouseUp(e);dc.fireEvent('mouseUpEvent',{e:e});}}
if(this._shimActive){this._deactivateShim();if(this.dragCurrent&&this.dragCurrent.useShim){this.useShim=this._shimState;this._shimState=false;}}
this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){var dc=this.dragCurrent;if(dc){if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}else{if(e.clientX<0||e.clientY<0){}}
if(!this.dragThreshMet){var diffX=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var diffY=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(diffX>this.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
if(this.dragThreshMet){if(dc&&dc.events.b4Drag){dc.b4Drag(e);dc.fireEvent('b4DragEvent',{e:e});}
if(dc&&dc.events.drag){dc.onDrag(e);dc.fireEvent('dragEvent',{e:e});}
if(dc){this.fireEvents(e,false);}}
this.stopEvent(e);}},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()||dc.dragOnly){return;}
var x=YAHOO.util.Event.getPageX(e),y=YAHOO.util.Event.getPageY(e),pt=new YAHOO.util.Point(x,y),pos=dc.getTargetCoord(pt.x,pt.y),el=dc.getDragEl(),events=['out','over','drop','enter'],curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x),oldOvers=[],inGroupsObj={},inGroups=[],data={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
if(!this.isOverTarget(pt,ddo,this.mode,curRegion)){data.outEvts.push(ddo);}
oldOvers[i]=true;delete this.dragOvers[i];}
for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode,curRegion)){inGroupsObj[sGroup]=true;if(isDrop){data.dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){data.enterEvts.push(oDD);}else{data.overEvts.push(oDD);}
this.dragOvers[oDD.id]=oDD;}}}}}
this.interactionInfo={out:data.outEvts,enter:data.enterEvts,over:data.overEvts,drop:data.dropEvts,point:pt,draggedRegion:curRegion,sourceRegion:this.locationCache[dc.id],validDrop:isDrop};for(var inG in inGroupsObj){inGroups.push(inG);}
if(isDrop&&!data.dropEvts.length){this.interactionInfo.validDrop=false;if(dc.events.invalidDrop){dc.onInvalidDrop(e);dc.fireEvent('invalidDropEvent',{e:e});}}
for(i=0;i<events.length;i++){var tmp=null;if(data[events[i]+'Evts']){tmp=data[events[i]+'Evts'];}
if(tmp&&tmp.length){var type=events[i].charAt(0).toUpperCase()+events[i].substr(1),ev='onDrag'+type,b4='b4Drag'+type,cev='drag'+type+'Event',check='drag'+type;if(this.mode){if(dc.events[b4]){dc[b4](e,tmp,inGroups);dc.fireEvent(b4+'Event',{event:e,info:tmp,group:inGroups});}
if(dc.events[check]){dc[ev](e,tmp,inGroups);dc.fireEvent(cev,{event:e,info:tmp,group:inGroups});}}else{for(var b=0,len=tmp.length;b<len;++b){if(dc.events[b4]){dc[b4](e,tmp[b].id,inGroups[0]);dc.fireEvent(b4+'Event',{event:e,info:tmp[b].id,group:inGroups[0]});}
if(dc.events[check]){dc[ev](e,tmp[b].id,inGroups[0]);dc.fireEvent(cev,{event:e,info:tmp[b].id,group:inGroups[0]});}}}}}},getBestMatch:function(dds){var winner=null;var len=dds.length;if(len==1){winner=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(this.mode==this.INTERSECT&&dd.cursorIsOver){winner=dd;break;}else{if(!winner||!winner.overlap||(dd.overlap&&winner.overlap.getArea()<dd.overlap.getArea())){winner=dd;}}}}
return winner;},refreshCache:function(groups){var g=groups||this.ids;for(var sGroup in g){if("string"!=typeof sGroup){continue;}
for(var i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var parent=el.offsetParent;if(parent){return true;}}}catch(e){}
return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}
var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=YAHOO.util.Dom.getXY(el);}catch(e){}
if(!pos){return null;}
x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);},isOverTarget:function(pt,oTarget,intersect,curRegion){var loc=this.locationCache[oTarget.id];if(!loc||!this.useCache){loc=this.getLocation(oTarget);this.locationCache[oTarget.id]=loc;}
if(!loc){return false;}
oTarget.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||(!intersect&&!dc.constrainX&&!dc.constrainY)){return oTarget.cursorIsOver;}
oTarget.overlap=null;if(!curRegion){var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);}
var overlap=curRegion.intersect(loc);if(overlap){oTarget.overlap=overlap;return(intersect)?true:oTarget.cursorIsOver;}else{return false;}},_onUnload:function(e,me){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
this._execOnAll("unreg",[]);this.ids={};},elementCache:{},getElWrapper:function(id){var oWrapper=this.elementCache[id];if(!oWrapper||!oWrapper.el){oWrapper=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}
return oWrapper;},getElement:function(id){return YAHOO.util.Dom.get(id);},getCss:function(id){var el=YAHOO.util.Dom.get(id);return(el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return YAHOO.util.Dom.getX(el);},getPosY:function(el){return YAHOO.util.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else{}
return{top:t,left:l};},getStyle:function(el,styleProp){return YAHOO.util.Dom.getStyle(el,styleProp);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(moveEl,targetEl){var aCoord=YAHOO.util.Dom.getXY(targetEl);YAHOO.util.Dom.setXY(moveEl,aCoord);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(a,b){return(a-b);},_timeoutCount:0,_addListeners:function(){var DDM=YAHOO.util.DDM;if(YAHOO.util.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}
return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}
(function(){var Event=YAHOO.util.Event;var Dom=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.util.DragDrop.prototype={events:null,on:function(){this.subscribe.apply(this,arguments);},id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,dragOnly:false,useShim:false,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,cursorIsOver:false,overlap:null,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=Dom.get(this.id);}
return this._domRef;},getDragEl:function(){return Dom.get(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,true);for(var i in this.events){this.createEvent(i+'Event');}},initTarget:function(id,sGroup,config){this.config=config||{};this.events={};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){this._domRef=id;id=Dom.generateId(id);}
this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.events={mouseDown:true,b4MouseDown:true,mouseUp:true,b4StartDrag:true,startDrag:true,b4EndDrag:true,endDrag:true,drag:true,b4Drag:true,invalidDrop:true,b4DragOut:true,dragOut:true,dragEnter:true,b4DragOver:true,dragOver:true,b4DragDrop:true,dragDrop:true};if(this.config.events){for(var i in this.config.events){if(this.config.events[i]===false){this.events[i]=false;}}}
this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);this.dragOnly=((this.config.dragOnly===true)?true:false);this.useShim=((this.config.useShim===true)?true:false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){if(el&&el.style&&(el.style.display=='none')){}else{}
return;}
var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];}
this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
Event.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var button=e.which||e.button;if(this.primaryButtonOnly&&button>1){return;}
if(this.isLocked()){return;}
var b4Return=this.b4MouseDown(e),b4Return2=true;if(this.events.b4MouseDown){b4Return2=this.fireEvent('b4MouseDownEvent',e);}
var mDownReturn=this.onMouseDown(e),mDownReturn2=true;if(this.events.mouseDown){mDownReturn2=this.fireEvent('mouseDownEvent',e);}
if((b4Return===false)||(mDownReturn===false)||(b4Return2===false)||(mDownReturn2===false)){return;}
this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(Event.getPageX(e),Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=YAHOO.util.Event.getTarget(e);return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},getTargetCoord:function(iPageX,iPageY){var x=iPageX-this.deltaX;var y=iPageY-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}
if(x>this.maxX){x=this.maxX;}}
if(this.constrainY){if(y<this.minY){y=this.minY;}
if(y>this.maxY){y=this.maxY;}}
x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==cssClass){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(node){var valid=true;var nodeName;try{nodeName=node.nodeName.toUpperCase();}catch(e){nodeName=node.nodeName;}
valid=valid&&!this.invalidHandleTypes[nodeName];valid=valid&&!this.invalidHandleIds[node.id];for(var i=0,len=this.invalidHandleClasses.length;valid&&i<len;++i){valid=!Dom.hasClass(node,this.invalidHandleClasses[i]);}
return valid;},setXTicks:function(iStartX,iTickSize){this.xTicks=[];this.xTickSize=iTickSize;var tickMap={};for(var i=this.initPageX;i>=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=parseInt(iLeft,10);this.rightConstraint=parseInt(iRight,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);}
this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=parseInt(iUp,10);this.bottomConstraint=parseInt(iDown,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);}
this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}
if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}
if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i<len;++i){var next=i+1;if(tickArray[next]&&tickArray[next]>=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}}
return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};YAHOO.augment(YAHOO.util.DragDrop,YAHOO.util.EventProvider);})();YAHOO.util.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];YAHOO.util.Dom.setXY(el,aCoord);var newLeft=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var newTop=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{YAHOO.util.Dom.setStyle(el,"left",(oCoord.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(oCoord.y+this.deltaSetXY[1])+"px");}
this.cachePosition(oCoord.x,oCoord.y);var self=this;setTimeout(function(){self.autoScroll.call(self,oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);},0);},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=this.DDM.getClientHeight();var clientW=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot<thresh){window.scrollTo(sl,st+scrAmt);}
if(y<st&&st>0&&y-st<thresh){window.scrollTo(sl,st-scrAmt);}
if(right>clientW&&toRight<thresh){window.scrollTo(sl+scrAmt,st);}
if(x<sl&&sl>0&&x-sl<thresh){window.scrollTo(sl-scrAmt,st);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this,body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}
var div=this.getDragEl(),Dom=YAHOO.util.Dom;if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;s.height="25px";s.width="25px";var _data=document.createElement('div');Dom.setStyle(_data,'height','100%');Dom.setStyle(_data,'width','100%');Dom.setStyle(_data,'background-color','#ccc');Dom.setStyle(_data,'opacity','0');div.appendChild(_data);if(YAHOO.env.ua.ie){var ifr=document.createElement('iframe');ifr.setAttribute('src','javascript: false;');ifr.setAttribute('scrolling','no');ifr.setAttribute('frameborder','0');div.insertBefore(ifr,div.firstChild);Dom.setStyle(ifr,'height','100%');Dom.setStyle(ifr,'width','100%');Dom.setStyle(ifr,'position','absolute');Dom.setStyle(ifr,'top','0');Dom.setStyle(ifr,'left','0');Dom.setStyle(ifr,'opacity','0');Dom.setStyle(ifr,'zIndex','-1');Dom.setStyle(ifr.nextSibling,'zIndex','2');}
body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
this.setDragElPos(iPageX,iPageY);YAHOO.util.Dom.setStyle(dragEl,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var dragEl=this.getDragEl();var bt=parseInt(DOM.getStyle(dragEl,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(dragEl,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(dragEl,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(dragEl,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}
if(isNaN(br)){br=0;}
if(isNaN(bb)){bb=0;}
if(isNaN(bl)){bl=0;}
var newWidth=Math.max(0,el.offsetWidth-br-bl);var newHeight=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(dragEl,"width",newWidth+"px");DOM.setStyle(dragEl,"height",newHeight+"px");}},b4MouseDown:function(e){this.setStartPosition();var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.PopUp","TOPINCS.widgets.util","YAHOO.util.DD","CERNY.dom.Element");(function(){var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var EL_BODY=new Element(document.body);function PopUp(positionX,positionY,showCloseButton,draggable,closeOnOutsideClick){if(isUndefined(positionX)){positionX=TOPINCS.widgets.PopUp.RIGHT;}
if(!positionY){positionY=TOPINCS.widgets.PopUp.TOP;}
if(!isBoolean(showCloseButton)){showCloseButton=true;}
if(!isBoolean(draggable)){draggable=true;}
if(!isBoolean(closeOnOutsideClick)){closeOnOutsideClick=true;}
this.containerE=Element.create("div",null,"class=popup hidden");this.el=this.containerE;EL_BODY.appendChild(this.containerE);if(draggable){new YAHOO.util.DD(this.el.node);}
this.positionX=positionX;this.positionY=positionY;this.showCloseButton=showCloseButton;if(closeOnOutsideClick){TOPINCS.widgets.util.disappearOnOutboundClick(this.containerE);}
this.titleEl=Element.create("div",null,"class=popup-title");}
var logger=CERNY.Logger("TOPINCS.widgets.PopUp");PopUp.prototype.logger=logger;TOPINCS.widgets.PopUp=PopUp;PopUp.LEFT=0;PopUp.RIGHT=1;PopUp.TOP=2;PopUp.BOTTOM=3;function displayContent(content,targetE,title){var divE=Element.create("div");var t=this;if(title){divE.appendChild(this.titleEl);this.titleEl.setText(title);}
if(this.showCloseButton){var imgE=Element.create("img",null,"src=4.4.0/images/close.gif","class=icon");imgE.addEvtListener("click",function(){t.hide();});divE.appendChild(imgE);}
var contentE=Element.create("div");if(isString(content)){contentE.node.innerHTML=content;}else{contentE.appendChild(content);}
divE.appendChild(contentE);this.containerE.deleteChildren();this.containerE.appendChild(divE.node);if(targetE){this.position(targetE);}}
signature(displayContent,"undefined",["string",Element],["undefined",Element]);method(PopUp.prototype,"displayContent",displayContent);function show(){this.containerE.show();}
signature(show,"undefined");method(PopUp.prototype,"show",show);function hide(){this.containerE.hide();if(this.focusOnHide){if(isFunction(this.focusOnHide.focus)){this.focusOnHide.focus();}else{this.logger.warn("Object to set focus on closing PopUp does not have a method focus.");}}}
signature(hide,"undefined");method(PopUp.prototype,"hide",hide);function position(_targetE){this.containerE.moveTo(-2000,-2000);this.containerE.show();var width=this.containerE.node.offsetWidth;var height=this.containerE.node.offsetHeight;var x=_targetE.getAbsoluteX();var y=_targetE.getAbsoluteY();if(this.positionX==TOPINCS.widgets.PopUp.LEFT){x=x+_targetE.node.offsetWidth-width;}
if(this.positionY==TOPINCS.widgets.PopUp.BOTTOM){y=y+_targetE.node.offsetHeight-height;}
this.positionAt(x,y);}
signature(position,"undefined","object");method(PopUp.prototype,"position",position);function positionAt(_x,_y){this.containerE.moveTo(_x,_y);}
signature(positionAt,"undefined","number","number");method(PopUp.prototype,"positionAt",positionAt);function setFocusOnHide(obj){this.focusOnHide=obj;}
signature(setFocusOnHide,"undefined","undefined");method(PopUp.prototype,"setFocusOnHide",setFocusOnHide);})();CERNY.require("TOPINCS.widgets.InfoPopUp","TOPINCS.widgets.Buttons","TOPINCS.widgets.Button","TOPINCS.widgets.util","TOPINCS.widgets.DICT","CERNY.dom.Element","TOPINCS.widgets.PopUp");(function(){TOPINCS.widgets.InfoPopUp=InfoPopUp;var Element=CERNY.dom.Element;var PopUp=TOPINCS.widgets.PopUp;var DICT=TOPINCS.widgets.DICT;var getEvent=TOPINCS.widgets.util.getEvent;var method=CERNY.method;var signature=CERNY.signature;function InfoPopUp(conf){if(conf){PopUp.call(this,conf.positionX,conf.positionY,false,conf.draggable,conf.closeOnOutsideClick);this.el.addCSSClass("info-popup");var t=this;if(conf.buttons){this.buttons=conf.buttons;}else{this.buttons=new TOPINCS.widgets.Buttons();function closeAction(){t.hide();}
var closeLabel=conf.closeLabel||DICT.lab_close;this.closeButton=new TOPINCS.widgets.Button({label:closeLabel,action:closeAction,blockUi:false});this.buttons.addButton(this.closeButton);}
var hideOnEsc=true;if(isBoolean(conf.hideOnEsc)){hideOnEsc=conf.hideOnEsc;}
if(hideOnEsc){this.el.addEvtListener("keydown",function(e){var event=getEvent(e);if(event.keyCode==27){t.hide();}});}}}
InfoPopUp.prototype=new PopUp();function setTitle(title){this.title=title;if(title){this.titleEl.setText(title);}}
signature(setTitle,"undefined","string");method(InfoPopUp.prototype,"setTitle",setTitle);function displayContent(content,targetEl){var okCancelContentEl=Element.create("div");var contentEl=Element.create("div",null,"class=popup-content");if(isString(content)){contentEl.node.innerHTML=content;}else{contentEl.appendChild(content);}
okCancelContentEl.appendChildren(contentEl,this.buttons.render());PopUp.prototype.displayContent.call(this,okCancelContentEl,targetEl,this.title);}
signature(displayContent,"undefined",["string",Element],["undefined",Element]);method(InfoPopUp.prototype,"displayContent",displayContent);function focus(){this.closeButton.focus();}
signature(focus,"undefined","undefined");method(InfoPopUp.prototype,"focus",focus);})();CERNY.require("TOPINCS.wiki.StatementViewer","TOPINCS.widgets.ValueViewer","TOPINCS.tmdm.Occurrence","TOPINCS.tmdm.Name","TOPINCS.tmdm.Association","TOPINCS.view.View","TOPINCS.view.ListView","TOPINCS.widgets.Button","TOPINCS.util","TOPINCS.widgets.InfoPopUp","TOPINCS.widgets.PopUp","CERNY.dom.Element");(function(){TOPINCS.wiki.StatementViewer=StatementViewer;var Element=CERNY.dom.Element;var ListView=TOPINCS.view.ListView;var ValueViewer=TOPINCS.widgets.ValueViewer;var View=TOPINCS.view.View;var Button=TOPINCS.widgets.Button;var DICT=TOPINCS.wiki.DICT;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.StatementViewer");var POPUP=new TOPINCS.widgets.InfoPopUp({positionX:TOPINCS.widgets.PopUp.LEFT});POPUP.setTitle(DICT.tit_details);function StatementViewer(statement,context){var cons=StatementViewer[statement.itemType];var viewer=new cons(statement,context);if(statement.isForeign){viewer.el.addCSSClass("foreign");}
return viewer;}
StatementViewer.prototype.logger=logger;function display(){if(this.statement.hasChanged()&&this.statement.foreignProxies.length>0){var originalValue=this.statement.getOriginal("value");var originalDatatype=this.statement.getOriginal("datatype")||DT_STRING;var originalViewer=new ValueViewer(originalValue,originalDatatype,this.context.prefs.locale);this.el.appendChild(renderChange(this.viewer.render(),originalViewer.render()));}else{if(this.context.previewMode!==true){this.el.appendChild(renderMenuButton(this.statement,this.context,this.el));}
this.el.appendChild(this.viewer.render());}}
function renderChange(newEl,originalEl){var el=Element.create("table",null,"class=changed-statement");var tdOriginalEl=Element.create("td",null,"class=changed-statement-original");tdOriginalEl.appendChild(originalEl);var tdNewEl=Element.create("td",null,"class=changed-statement-new");tdNewEl.appendChild(newEl);el.appendChildren(tdOriginalEl,tdNewEl);return el;}
function renderMenuButton(statement,context,statementEl){var scope=statement.scope;var buttonConf={label:DICT.lab_details,tooltip:DICT.tt_details,active:!(statement.isForeign)};var button=new Button(buttonConf);button.action=function(){statementEl.addCSSClass("stmt-hl");POPUP.el.addObserver(Element.EVT_HIDDEN,function(){statementEl.deleteCSSClass("stmt-hl");});POPUP.displayContent(renderStatementDetails(statement,context).node.innerHTML);POPUP.position(button.el);POPUP.setFocusOnHide(button);POPUP.focus();};return button.render();}
function renderStatementDetails(statement,context){var el=Element.create("div");var scopeEl=Element.create("div");var pEl=Element.create("p",DICT.lab_scope+": ");if(statement.scope.length==0){pEl.appendChild(Element.create("span",DICT.msg_no_scope));}else{var first=true;statement.scope.map(function(systemId){if(first){first=false;}else{pEl.appendChild(Element.create("span",", "));}
pEl.appendChild(context.renderTopicLink(systemId,true,true));});}
scopeEl.appendChild(pEl);var reificationEl=Element.create("div");if(isString(statement.reifier)){var uri=TOPINCS.util.createWikiUri(statement.reifier);reificationEl.appendChild(Element.create("a",DICT.lab_reifier,"href="+uri));}else{reificationEl.appendChild(Element.create("span",DICT.msg_no_reifier));}
var metadataEl=Element.create("div");var metaInfo=TOPINCS.util.getMetaInfo(statement);metadataEl.appendChild(Element.create("p",DICT.lab_meta_created+": "+metaInfo.creation_ts+", "+metaInfo.creation_user));metadataEl.appendChild(Element.create("p",DICT.lab_meta_modified+": "+metaInfo.modification_ts+", "+metaInfo.modification_user));el.appendChildren(scopeEl,reificationEl,metadataEl);return el;}
(function(){StatementViewer["Name"]=NameViewer;function NameViewer(name,context){this.cssClass="statement name";this.name=name;this.statement=name;this.context=context;this.viewer=new ValueViewer(this.name.value,DT_STRING,context.prefs.locale);View.call(this,name);}
NameViewer.prototype=new View();NameViewer.prototype.logger=CERNY.Logger("TOPINCS.wiki.NameViewer");method(NameViewer.prototype,"display",display);})();(function(){StatementViewer["Occurrence"]=OccurrenceViewer;var CSS_CLASS_OCCURRENCE="occurrence";function OccurrenceViewer(occurrence,context){this.cssClass="statement occurrence";this.occurrence=occurrence;this.statement=occurrence;this.context=context;this.viewer=new ValueViewer(this.occurrence.value,this.occurrence.datatype,context.prefs.locale);View.call(this,occurrence);}
OccurrenceViewer.prototype=new View();OccurrenceViewer.prototype.logger=CERNY.Logger("TOPINCS.wiki.OccurrenceViewer");method(OccurrenceViewer.prototype,"display",display);})();(function(){StatementViewer["Association"]=AssociationViewer;function AssociationViewer(association,context){this.cssClass="statement association";this.association=association;this.context=CERNY.object(context);this.context.displayLabels=doDisplayRoleLabels(association,context.subjectId);ListView.call(this,association.roles,context,RoleViewer);}
AssociationViewer.prototype=new ListView();AssociationViewer.prototype.logger=CERNY.Logger("TOPINCS.wiki.AssociationViewer");function doDisplayRoleLabels(association,subjectId){var displayRoleLabels=false;var firstRoleType;var roles=association.roles;var i=roles.length;while(i--){var role=roles[i];if(role.player!=subjectId){if(!firstRoleType){firstRoleType=role.type;}else{if(role.type!=firstRoleType){displayRoleLabels=true;}}}}
return displayRoleLabels;}
function display(context){var el=Element.create("table");var associationEl=Element.create("tbody");el.appendChild(associationEl);var views=this.views;for(var i=0,l=views.length;i<l;i++){associationEl.appendChild(views[i].render());}
if(this.context.previewMode!==true){this.el.appendChild(renderMenuButton(this.association,this.context,this.el));}
this.el.appendChild(el);}
method(AssociationViewer.prototype,"display",display);function RoleViewer(role,context){this.role=role;this.tagName="tr";this.cssClass="role";View.call(this,role,context);}
RoleViewer.prototype=new View();RoleViewer.prototype.logger=CERNY.Logger("TOPINCS.wiki.RoleViewer");function displayRole(context){if(this.role.player!==context.subjectId){if(context.displayLabel){this.el.appendChild(Element.create("td",context.getLabel(this.role.type),"class=type"));}
var playerEl=Element.create("td");playerEl.appendChild(renderPlayer(this.role,context));this.el.appendChild(playerEl);}}
method(RoleViewer.prototype,"display",displayRole);function renderPlayer(role,context){return context.renderTopicLink(role.player,context.previewPlayer);}})();})();CERNY.require("TOPINCS.wiki.ParagraphViewer","TOPINCS.wiki.StatementViewer","TOPINCS.view.ListView","TOPINCS.tmdm.Association","TOPINCS.tmdm.Occurrence","CERNY.dom.Element");(function(){TOPINCS.wiki.ParagraphViewer=ParagraphViewer;var Element=CERNY.dom.Element;var ListView=TOPINCS.view.ListView;var StatementViewer=TOPINCS.wiki.StatementViewer;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.wiki.ParagraphViewer");function ParagraphViewer(paragraph,context){if(paragraph){this.paragraph=paragraph;this.cssClass="paragraph";this.initHeadline(paragraph,context);ListView.call(this,paragraph,context,StatementViewer);}}
ParagraphViewer.prototype=new ListView();ParagraphViewer.prototype.logger=logger;function initHeadline(paragraph,context){var typeId,scope;if(paragraph.associationTypeId){scope=[paragraph.typeId];typeId=paragraph.associationTypeId;}else{typeId=paragraph.typeId;}
this.headline=context.getLabel(typeId,scope);}
signature(initHeadline,"undefined","object");method(ParagraphViewer.prototype,"initHeadline",initHeadline);function displayHeadline(){var headlineEl=Element.create("div",this.headline,"class=headline");if(this.paragraph.typeId.foreign){headlineEl.addCSSClass("foreign");}
this.el.appendChild(headlineEl);}
signature(displayHeadline,"undefined");method(ParagraphViewer.prototype,"displayHeadline",displayHeadline);function display(context){if(this.headline.foreignLanguage===true){context.isForeignLanguagePresent=true;this.el.addCSSClass("foreign-language");if(context.displayOnlyInformationInAcceptedLanguages===true){this.el.hide();}}
this.displayHeadline();ListView.prototype.display.call(this,context);}
signature(display,"undefined","object");method(ParagraphViewer.prototype,"display",display);})();CERNY.require("TOPINCS.wiki.Headline","CERNY.dom.Element");(function(){TOPINCS.wiki.Headline=Headline;var Element=CERNY.dom.Element;var logger=CERNY.Logger("TOPINCS.wiki.Headline");function Headline(leftEl,rightEl){if(isString(leftEl)){leftEl=Element.create("p",leftEl);}
this.leftEl=leftEl;this.rightEl=rightEl;}
function render(){var el=Element.create("div",null,"class=first-heading tns-bar");this.leftEl.addCSSClass("left");el.appendChild(this.leftEl);if(this.rightEl){this.rightEl.addCSSClass("right");el.appendChild(this.rightEl);}
return el;}
CERNY.method(Headline.prototype,"render",render);})();CERNY.require("TOPINCS.wiki.ArticleViewer","TOPINCS.wiki.ParagraphViewer","TOPINCS.wiki.Headline","TOPINCS.wiki.DICT","CERNY.dom.Element","CERNY.js.Array","TOPINCS.util","TOPINCS.view.ListView");(function(){TOPINCS.wiki.ArticleViewer=ArticleViewer;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var ListView=TOPINCS.view.ListView;var ParagraphViewer=TOPINCS.wiki.ParagraphViewer;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.wiki.ArticleViewer");function ArticleViewer(article,context){if(article){this.article=article;this.cssClass="article viewer";if(this.article.articleMap.subjectLocator){this.cssClass+=" resource";}
ListView.call(this,article,context,ParagraphViewer);}}
ArticleViewer.prototype=new ListView();ArticleViewer.prototype.logger=logger;function display(context){this.el.appendChild(this.renderHeadline(this.article.articleMap,context));ListView.prototype.display.call(this,this.context);var footerEl=this.renderFooter(context);if(footerEl){this.el.appendChild(footerEl);}}
method(ArticleViewer.prototype,"display",display);function renderHeadline(articleMap,context){var labelEl=this.renderLabel(articleMap,context);labelEl.setAttr("title",context.getLabel(articleMap.subjectId));var headline=new TOPINCS.wiki.Headline(labelEl,this.renderType(articleMap,context));return headline.render();}
signature(renderHeadline,Element,"object");method(ArticleViewer.prototype,"renderHeadline",renderHeadline);function renderLabel(articleMap,context){var topicLabel=context.getLabel(articleMap.subjectId);var subjectLocator=articleMap.subjectLocator;var httpSubjectIdentifier=articleMap.httpSubjectIdentifier;var topicEl;if(subjectLocator){topicEl=Element.create("a",topicLabel,"href="+subjectLocator,"class=external");}else if(httpSubjectIdentifier){topicEl=Element.create("a",topicLabel,"href="+httpSubjectIdentifier,"class=si","title="+DICT.msg_visit_subject_indicator);}else{topicEl=Element.create("p",topicLabel);}
return topicEl;}
signature(renderLabel,Element);method(ArticleViewer.prototype,"renderLabel",renderLabel);function renderType(articleMap,context){var typeId=articleMap.typeId;if(typeId){return Element.create("a",context.getLabel(typeId),"class=topic-type","href="+TOPINCS.util.createWikiUri(typeId));}}
signature(renderType,["undefined",Element]);method(ArticleViewer.prototype,"renderType",renderType);function renderFooter(context){if(context.isForeignLanguagePresent&&!context.previewMode){var el=Element.create("div",null,"class=footer");var elForeignLangDisplayed=Element.create("span",DICT.msg_foreign_lang_displayed);var elHide=Element.create("button",DICT.lab_foreign_lang_hide,"class=button");var t=this;elHide.addEvtListener("click",function(e){setForeignVisible(t.el,false);context.displayOnlyInformationInAcceptedLanguages=true;toggle();});elForeignLangDisplayed.appendChild(elHide);var elForeignLangHidden=Element.create("span",DICT.msg_foreign_lang_hidden);var elShow=Element.create("button",DICT.lab_foreign_lang_show,"class=button");elShow.addEvtListener("click",function(e){setForeignVisible(t.el,true);context.displayOnlyInformationInAcceptedLanguages=false;toggle();});elForeignLangHidden.appendChild(elShow);function toggle(){if(context.displayOnlyInformationInAcceptedLanguages){elForeignLangDisplayed.hide();elForeignLangHidden.show();}else{elForeignLangHidden.hide();elForeignLangDisplayed.show();}}
toggle();el.appendChildren(elForeignLangDisplayed,elForeignLangHidden);return el;}}
signature(renderFooter,["undefined",Element]);method(ArticleViewer.prototype,"renderFooter",renderFooter);function setForeignVisible(el,visible){var funcname=visible?"show":"hide";var foreignEls=el.getChildren(function(o){return o&&Element.cssFilter(o,"foreign-language");});foreignEls.map(function(foreignEl){new Element(foreignEl)[funcname]();});}})();CERNY.require("TOPINCS.widgets.Icon","TOPINCS.widgets.Actionable","CERNY.dom.Element");(function(){TOPINCS.widgets.Icon=Icon;var method=CERNY.method;var Actionable=TOPINCS.widgets.Actionable;var Element=CERNY.dom.Element;var logger=CERNY.Logger("TOPINCS.widgets.Icon");function Icon(label,iconName,active,blockUi){this.el=Element.create("button",null,"class=icon","title="+label);this.aE=this.el;Actionable.init(this,{containerEl:this.el,aEl:this.el,active:active,iconName:iconName});}
Icon.prototype.logger=logger;Actionable(Icon.prototype);function display(targetEl){targetEl.appendChild(this.el);}
method(Icon.prototype,"display",display);function render(){return this.el;}
method(Icon.prototype,"render",render);function focus(){this.el.node.focus();}
method(Icon.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.InputCompleter","JSDOMLIB","TOPINCS.util","TOPINCS.widgets.util","TOPINCS.widgets.Icon","TOPINCS.widgets.DICT","CERNY.event.Observable","CERNY.js.Array","CERNY.js.String","CERNY.dom.html","CERNY.dom.Element");(function(){TOPINCS.widgets.InputCompleter=InputCompleter;var Element=CERNY.dom.Element;var Icon=TOPINCS.widgets.Icon;var method=CERNY.method;var util=TOPINCS.widgets.util;var showMessage=TOPINCS.util.showMessage;var signature=CERNY.signature;var name="TOPINCS.widgets.InputCompleter";var DICT=TOPINCS.widgets.DICT;var logger=CERNY.Logger(name);var KEYS=[8,9,16,17,18,35,36,37,38,46];var EVT_VALUE_SET=name+".valueSet";var EVT_SOME_MATCHES=name+".someMatches";var EVT_NO_MATCHES=name+".noMatches";var EVT_OPTION_FOCUSED=name+".optionFocused";var EVT_OPTION_BLURRED=name+".optionBlurred";function InputCompleter(conf){if(conf){this.completeFunction=conf.completeFunction;if(isNumber(conf.startCompleting)){this.startCompleting=conf.startCompleting;}else{this.startCompleting=3;}
this.value=conf.initialValue||null;this.initialText=conf.initialText||"";this.limit=conf.limit||10;this.iconTooltip=conf.iconTooltip||DICT.tt_ic_icon;this.noMatchesLabel=conf.noMatchesLabel||DICT.msg_no_matches_default;this.moreCharactersMessage=conf.moreCharactersMessage||DICT.msg_ic_more_chars;this.typingThreshold=conf.typingThreshold||600;if(!isBoolean(conf.auto)){this.auto=true;}else{this.auto=conf.auto;}
this.ignoreGrouping=false;this.highlighted=null;this.sizeAtFristNoMatches=-1;this.evtListener=null;this.specialOptions=[];}}
InputCompleter.prototype.logger=logger;CERNY.event.Observable(InputCompleter.prototype);InputCompleter.EVT_SOME_MATCHES=EVT_SOME_MATCHES;InputCompleter.EVT_NO_MATCHES=EVT_NO_MATCHES;InputCompleter.EVT_VALUE_SET=EVT_VALUE_SET;InputCompleter.EVT_OPTION_FOCUSED=EVT_OPTION_FOCUSED;InputCompleter.EVT_OPTION_BLURRED=EVT_OPTION_BLURRED;function render(){this.el=Element.create("span",null,"class=input-completer");this.inputEl=Element.create("input");var t=this;this.icon=new Icon(this.iconTooltip,"search");this.icon.addAction(function(){t.update(true);});this.el.appendChildren(this.inputEl,this.icon.el);if(this.value!==null){setText(this,this.initialText);}
this.optionsEl=Element.create("div",null,"class=input-completer-options hidden");util.disappearOnOutboundClick(this.optionsEl);new Element(document.body).appendChild(this.optionsEl);function keyHandler(evt){var event=util.getEvent(evt);var currentSize=t.getText().length;var matchPossible=true;if(t.noMatches&&(currentSize>=t.sizeAtFristNoMatches)){matchPossible=false;}
switch(event.keyCode){case 38:highlightPrevious(t);break;case 40:highlightNext(t);break;case 13:if(event.shiftKey){if(event.stopPropagation){event.stopPropagation();}
t.update(true);}else{if(t.optionsEl.isHidden()){if(isFunction(t.evtListener)){t.evtListener(event);}}else{if(t.noMatches){hideOptions(t);}else{select(t);}}}
break;case 27:if(t.optionsEl.isHidden()){if(isFunction(t.evtListener)){t.evtListener(event);}}else{hideOptions(t);}
break;default:if(matchPossible&&!event.altKey&&!KEYS.contains(event.keyCode)&&t.auto){if(t.timeoutId){clearTimeout(t.timeoutId);}
t.timeoutId=setTimeout(function(){t.update();},t.typingThreshold);}
break;}}
this.inputEl.addEvtListener("keydown",keyHandler);this.icon.el.addEvtListener("keydown",keyHandler);function blurHandler(){if(t.optionsEl.isVisible()){setTimeout(function(){hideOptions(t);},200);}}
this.inputEl.addEvtListener("blur",blurHandler);this.icon.el.addEvtListener("blur",blurHandler);return this.el;}
signature(render,Element);method(InputCompleter.prototype,"render",render);function display(el){el.appendChild(this.render());}
signature(display,"undefined",Element);method(InputCompleter.prototype,"display",display);function hideOptions(t){t.optionsEl.deleteChildren();t.optionsEl.hide();t.highlighted=null;}
signature(hideOptions,"undefined",InputCompleter);function update(force){if(!isBoolean(force)){force=false;}
if(force){this.auto=true;}
var substring=this.getText();if(force||substring.length>=this.startCompleting){displayOptions(this,this.completeFunction(substring));}else{hideOptions(this);}}
signature(update,"undefined",["undefined","boolean"]);method(InputCompleter.prototype,"update",update);function displayOptions(t,options){dehighlight(t);t.optionsEl.deleteChildren();t.specialOptions.map(function(specialOption){var el=displayOption(t,specialOption.id,specialOption.label);el.addCSSClass("special-option");el.node.specialOption=specialOption;});t.noMatches=true;var optionCount=0;if(isArray(options)){options.map(function(option){displayOption(t,option.id,option.label);optionCount+=1;});}else if(isObject(options)){for(var option in options){if(options.hasOwnProperty(option)){if(isObject(options[option])){var group=options[option];if(!t.ignoreGrouping){var hE=Element.create("div",option,"class=group");t.optionsEl.appendChild(hE);}
for(var item in group){if(group.hasOwnProperty(item)){displayOption(t,item,group[item]);optionCount+=1;}}}else{displayOption(t,option,options[option]);optionCount+=1;}}}}
if(optionCount>0){t.noMatches=false;}
if(optionCount==t.limit){t.optionsEl.appendChild(Element.create("div","..."));}
if(t.noMatches){t.sizeAtFristNoMatches=t.inputEl.node.value.length;t.displayNoMatches();t.set(null,t.getText());t.notify(EVT_NO_MATCHES);}else{t.displayMatches();t.notify(EVT_SOME_MATCHES);}}
signature(displayOptions,"undefined",InputCompleter,["object",Array]);function displayNoMatches(){this.optionsEl.addCSSClass("no-matches");var pE=Element.create("div",this.getNoMatchesLabel(),"class=message");this.optionsEl.moveOver(this.inputEl.node,0,1);this.optionsEl.appendChild(pE);this.optionsEl.node.style.width=this.inputEl.node.offsetWidth+"px";this.optionsEl.show();}
method(InputCompleter.prototype,"displayNoMatches",displayNoMatches);function displayMatches(){this.optionsEl.deleteCSSClass("no-matches");this.optionsEl.moveOver(this.inputEl.node,0,1);this.optionsEl.node.style.width=this.inputEl.node.offsetWidth+"px";this.optionsEl.show();highlightFirst(this);}
method(InputCompleter.prototype,"displayMatches",displayMatches);function displayOption(t,id,text){var pE;if(text instanceof Element){pE=text;}else{pE=Element.create("p",text);}
pE.setAttr("id",id);t.optionsEl.appendChild(pE);pE.addEvtListener("mouseover",function(event){var target=util.getTarget(event);highlight(t,pE.node);});pE.addEvtListener("mouseout",function(event){dehighlight(t);});pE.addEvtListener("click",function(event){select(t);});return pE;}
signature(displayOption,Element,InputCompleter,"string",["string",Element]);function highlight(t,el){if(el){dehighlight(t);t.highlighted=new Element(el);t.highlighted.addCSSClass("highlighted");t.notify(EVT_OPTION_FOCUSED,el.id);}}
signature(highlight,"undefined",InputCompleter,["null","object"]);function dehighlight(t){if(t.highlighted!==null){t.highlighted.deleteCSSClass("highlighted");}
t.highlighted=null;t.notify(EVT_OPTION_BLURRED);}
signature(dehighlight,"undefined",InputCompleter);function highlightPrevious(t){if(t.highlighted){highlight(t,t.highlighted.getClosestSibling(isP,false));}}
signature(highlightPrevious,"undefined",InputCompleter);function highlightNext(t){if(t.highlighted){highlight(t,t.highlighted.getClosestSibling(isP,true));}else{highlightFirst(t);}}
signature(highlightNext,"undefined",InputCompleter);function highlightFirst(t){highlight(t,t.optionsEl.getFirstChild(isP));}
signature(highlightFirst,"undefined",InputCompleter);function select(t){if(t.highlighted&&isElement(t.highlighted.node)){if(t.highlighted.node.specialOption){t.highlighted.node.specialOption.action();}else{t.set(t.highlighted.getAttr("id"),t.highlighted.getText());}
hideOptions(t);t.focus();}}
signature(select,"undefined",InputCompleter);function set(value,text){setText(this,text);setValue(this,value);}
signature(set,"undefined",["null","string"],"string");method(InputCompleter.prototype,"set",set);function reset(){this.set(null,"");}
signature(reset,"undefined");method(InputCompleter.prototype,"reset",reset);function getValue(){if(!isNonEmptyString(this.getText())){this.value=null;}
return this.value;}
signature(getValue,["string","null"]);method(InputCompleter.prototype,"getValue",getValue);function getText(){return this.inputEl.node.value;}
signature(getText,"string");method(InputCompleter.prototype,"getText",getText);function setValue(t,value){t.value=value;t.notify(InputCompleter.EVT_VALUE_SET);}
signature(setValue,"undefined",InputCompleter,"string");function setText(t,text){t.inputEl.node.value=text;}
signature(setText,"undefined",InputCompleter,"string");function focus(){this.inputEl.node.focus();}
signature(focus,"undefined");method(InputCompleter.prototype,"focus",focus);function validate(msg,fct){if(!isFunction(fct)){fct=function(value,text){return!value||!isNonEmptyString(text);};}
if(fct(this.getValue(),this.getText())){showMessage(msg);this.focus();return false;}
return true;}
signature(validate,"boolean","string",["undefined","function"]);method(InputCompleter.prototype,"validate",validate);function activate(){this.inputEl.node.disabled=0;this.inputEl.node.readOnly=0;this.icon.activate();}
method(InputCompleter.prototype,"activate",activate);function deactivate(){this.inputEl.node.disabled=1;this.inputEl.node.readOnly=1;this.icon.deactivate();}
method(InputCompleter.prototype,"deactivate",deactivate);function getNoMatchesLabel(){return this.noMatchesLabel;}
signature(getNoMatchesLabel,"string");method(InputCompleter.prototype,"getNoMatchesLabel",getNoMatchesLabel);function setIgnoreGrouping(ignoreGrouping){this.ignoreGrouping=ignoreGrouping;}
signature(setIgnoreGrouping,"undefined","boolean");method(InputCompleter.prototype,"setIgnoreGrouping",setIgnoreGrouping);})();CERNY.require("TOPINCS.wiki.Preview","CERNY.http.Request","CERNY.http.Response","CERNY.dom.Element","CERNY.dom.html","TOPINCS.wiki.Article","TOPINCS.tmdm.TopicMap","TOPINCS.tmdm.Construct","TOPINCS.wiki.ArticleViewer","TOPINCS.wiki.ArticleMap","TOPINCS.widgets.util","TOPINCS.widgets.InputCompleter","TOPINCS.wiki.DICT");(function(){TOPINCS.wiki.Preview={};var Preview=TOPINCS.wiki.Preview;var Element=CERNY.dom.Element;var Response=CERNY.http.Response;var Request=CERNY.http.Request;var Article=TOPINCS.wiki.Article;var ArticleViewer=TOPINCS.wiki.ArticleViewer;var ArticleMap=TOPINCS.wiki.ArticleMap;var Construct=TOPINCS.tmdm.Construct;var InputCompleter=TOPINCS.widgets.InputCompleter;var util=TOPINCS.widgets.util;var signature=CERNY.signature;var method=CERNY.method;var DICT=TOPINCS.wiki.DICT;var previewEl=new CERNY.dom.Element("preview");var loadingMsgEl=Element.create("p",DICT.msg_loading_preview,"class=message");var errorMsgEl=Element.create("p",DICT.msg_error_preview,"class=message");var cannotPreviewYetMsgEl=Element.create("p",DICT.msg_cannot_preview_yet,"class=message");var displayedTopicId=null;var topicId=null;var timeoutId=null;var logger=CERNY.Logger("TOPINCS.wiki.Preview");Preview.logger=logger;function previewTopic(id,waitingTime,previewFunction){if(!waitingTime&&waitingTime!==0){waitingTime=2000;}
if(!previewFunction){previewFunction=preview;}
if(id!=displayedTopicId){topicId=id;timeoutId=window.setTimeout(function(){previewFunction();},waitingTime);}}
signature(previewTopic,"undefined","string");method(Preview,"previewTopic",previewTopic);function dontPreviewTopic(id,waitingTime){TOPINCS.wiki.Preview.previewTopic(id,waitingTime,dontPreview);}
method(Preview,"dontPreviewTopic",dontPreviewTopic);function cancelPreview(){topicId=null;clearTimeout(timeoutId);timeoutId=null;}
signature(cancelPreview,"undefined");method(Preview,"cancelPreview",cancelPreview);function preview(){if(topicId===null){return;}
var url=TOPINCS.util.createWikiUri(topicId);if(!url){url=topicId;}
var request=new Request("GET",url+".jtm");request.setHeader("Accept",MEDIA_TYPE_JTM);previewEl.deleteChildren();previewEl.appendChild(loadingMsgEl);request.sendAsynch(function(req){var response=new Response(req);if(response.getStatus()==200){var articleMap=new ArticleMap(new TOPINCS.tmdm.TopicMap(response.getValue()));var context=TOPINCS.wiki.getContext(articleMap);context.previewMode=true;var article=Article(articleMap,context.defaultHiddenTypes);var viewer=new ArticleViewer(article,context);previewEl.deleteChildren();previewEl.appendChild(viewer.render().node);displayedTopicId=topicId;}else{previewEl.deleteChildren();previewEl.appendChild(errorMsgEl);}});}
signature(preview,"undefined");method(Preview,"preview",preview);function dontPreview(){if(topicId===null){return;}
previewEl.deleteChildren();previewEl.appendChild(cannotPreviewYetMsgEl);return 1;}
signature(dontPreview,"undefined");function install(element){var el=new CERNY.dom.Element(element);el.addEvtListener("mouseover",function(e){var target=util.getTarget(e);if(isA(target)){var topicId=TOPINCS.util.extractSystemIdFromWikiUri(target.href);if(TOPINCS.tmdm.Construct.isSystemId(topicId)){TOPINCS.wiki.Preview.previewTopic(topicId);}}});el.addEvtListener("mouseout",function(){TOPINCS.wiki.Preview.cancelPreview();});}
signature(install,"undefined",[Element,"string"]);method(Preview,"install",install);function installOnTopicCompleter(tc,dontPreview){tc.addObserver(InputCompleter.EVT_OPTION_BLURRED,cancelPreview);if(dontPreview===true){tc.addObserver(InputCompleter.EVT_OPTION_FOCUSED,_dontPreview);}else{tc.addObserver(InputCompleter.EVT_OPTION_FOCUSED,_preview);}
function _preview(topicId){if(isNumber(new Number(topicId).valueOf())){previewTopic(topicId);}}
function _dontPreview(topicId){if(isNumber(new Number(topicId).valueOf())){dontPreviewTopic(topicId);}}}
signature(installOnTopicCompleter,"undefined",TOPINCS.widgets.InputCompleter);method(Preview,"installOnTopicCompleter",installOnTopicCompleter);})();CERNY.require("TOPINCS.wiki.Context","TOPINCS.CoreTopics","TOPINCS.tmdm.ext.Labeler","TOPINCS.util","TOPINCS.lang","TOPINCS.wiki.Preview","CERNY.dom.Element","TOPINCS.locale","TOPINCS.wiki.DICT");(function(){TOPINCS.wiki.Context=Context;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.Context");var CoreTopics=TOPINCS.CoreTopics;var Element=CERNY.dom.Element;var Labeler=TOPINCS.tmdm.ext.Labeler;var DICT=TOPINCS.wiki.DICT;function Context(conf){conf=conf||{};this.options=conf.options;this.prefs={locale:TOPINCS.getLocale()};this.defaultHiddenTypes=[CoreTopics["instance"],CoreTopics["topic-name"]];if(this.options.displayAllNamesInArticleViewer){this.defaultHiddenTypes.remove(CoreTopics["topic-name"]);}
this.previewPlayer=true;this.isForeignLanguagePresent=false;this.displayOnlyInformationInAcceptedLanguages=this.options.displayOnlyInformationInAcceptedLanguages;if(conf.articleMap){var articleMap=conf.articleMap;this.articleMap=articleMap;this.subjectId=articleMap.subjectId;this.topicmap=articleMap;this.changes=articleMap.changes;this.labeler=new Labeler({acceptedLanguagesIds:TOPINCS.lang.ids.accepted,englishId:TOPINCS.lang.ids.en,uiLanguageId:TOPINCS.lang.ids.ui});var t=this;function mergeHandler(mergedTopicMap){updateAcceptedLanugagesInLabeler(TOPINCS.ACCEPTED_LANGUAGES,mergedTopicMap,t.labeler);}
articleMap.mergedTopicMaps.map(mergeHandler);articleMap.addMergeObserver(mergeHandler);}
TOPINCS.util.cache(this,"getLabel");}
Context.prototype.logger=logger;function getLabel(topicId,scope){var topic=this.articleMap.topicMap.getTopicById(topicId);if(topic){return this.labeler.getTopicLabel(topic,scope);}
return this.labeler.getTopicLabelById(topicId,scope);}
signature(getLabel,["string","undefined"],"string",["undefined",Array]);method(Context.prototype,"getLabel",getLabel);function registerLabel(id,label,scope){return Labeler.registerLabel(id,label,scope);}
signature(registerLabel,"undefined","string","string",["undefined",Array]);method(Context.prototype,"registerLabel",registerLabel);function getTopicType(topicId){return this.articleMap.getTopicType(topicId);}
signature(getTopicType,"undefined","string","string",["undefined",Array]);method(Context.prototype,"getTopicType",getTopicType);function renderTopicLink(topicId,preview,displayType){if(!isBoolean(preview)){preview=false;}
if(!isBoolean(displayType)){displayType=true;}
var id=topicId,foreign=false,temp=false,base;var spanEl=Element.create("span",null,"class=topic-link");if(topicId.foreign){foreign=true;id=topicId.foreign.id;base=topicId.foreign.base;}else{temp=!isNumber(Number(topicId));}
var label=this.getLabel(topicId);var el=Element.create("a",label);if(temp){el.setAttr("href",HREF_VOID);el.addEvtListener("click",function(){TOPINCS.util.showMessage(DICT.msg_topic_is_temp);});}else{el.setAttr("href",TOPINCS.util.createWikiUri(id,base));}
if(preview&&!foreign&&!temp){el.addEvtListener("mouseover",function(){TOPINCS.wiki.Preview.previewTopic(topicId);});el.addEvtListener("mouseout",function(){TOPINCS.wiki.Preview.cancelPreview();});}
spanEl.appendChild(el);if(displayType){var type=this.getTopicType(topicId);if(type){var typeLabel=this.getLabel(type);if(typeLabel){spanEl.appendChild(Element.create("span"," ("+typeLabel+")","class=type"));}}}
return spanEl;}
signature(renderTopicLink,Element,"string",["boolean","undefined"],["boolean","undefined"]);method(Context.prototype,"renderTopicLink",renderTopicLink);function updateAcceptedLanugagesInLabeler(acceptedLanguages,topicMap,labeler){acceptedLanguages.map(function(langCode){var topic=topicMap.getTopicBySubjectIdentifier(PSI_LANG_BASE+langCode);if(topic){labeler.acceptedLanguagesIds.pushUnique(topic.id);}});}})();CERNY.require("TOPINCS.wiki.Options","JSON","JSDOMLIB","TOPINCS.cons","CERNY.event.Observable");(function(){TOPINCS.wiki.Options=Options;var cookieName="topincs.wiki.conf";var path=TOPINCS.BASE;var logger=CERNY.Logger("TOPINCS.wiki.Options");var DEFAULT_OPTIONS={displayAllTypesInContentTree:false,displayOnlyInformationInAcceptedLanguages:false,displayAllNamesInArticleViewer:false};function Options(){var options=CERNY.clone(DEFAULT_OPTIONS);var userOptions=load();for(var name in userOptions){options[name]=userOptions[name];}
CERNY.event.Observable(options);CERNY.method(options,"save",function(){save(options);});return options;}
function save(options){var obj={};for(var propertyName in options){if(DEFAULT_OPTIONS.hasOwnProperty(propertyName)){obj[propertyName]=options[propertyName];}}
setCookie(cookieName,JSON.stringify(obj),new Date(100000000000000),path);}
function load(){var cookie=getCookie(cookieName);if(cookie){return JSON.parse(cookie);}}})();CERNY.require("TOPINCS.wiki.init","TOPINCS.cons","TOPINCS.locale","CERNY.dom.Element","TOPINCS.misc.browsercheck","TOPINCS.widgets.Menu","TOPINCS.widgets.DropDiv","TOPINCS.util","TOPINCS.wiki.Context","TOPINCS.wiki.Options","TOPINCS.wiki.DICT");(function(){var DropDiv=TOPINCS.widgets.DropDiv;var Element=CERNY.dom.Element;var Menu=TOPINCS.widgets.Menu;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.init");var EL_MENU=new Element("dd-menu-body");var EL_CONTENT=new Element("content");var DICT=TOPINCS.wiki.DICT;var URL_SEARCH="wiki/.search?string=";var searchMi=new TOPINCS.widgets.MenuItem(DICT.lab_search_for,"search",true,DICT.tt_search_for);var DEFAULT_PAGE_OPTIONS={focusSearchInput:true};var USER_OPTIONS=TOPINCS.wiki.Options();var optionsEditor=null;function init(pageOptions){pageOptions=pageOptions||DEFAULT_PAGE_OPTIONS;if(!TOPINCS.misc.browsercheck(ACCEPTED)){new Element("wrong-browser").show();return;}
new DropDiv("dd-menu",false);new DropDiv("dd-search",false);new DropDiv("dd-preview",false);initMenu();initSearch(pageOptions);new Element("margin").show();new Element("main").show();}
method(TOPINCS.wiki,"init",init);function initMenu(){var menu=new Menu(true);menu.addItem("content",DICT.mi_content,true,DICT.tt_content);menu.content.setHref("wiki/.content");menu.addItem("create",DICT.mi_new_topic,true,DICT.tt_new_topic);menu.create.setHref("wiki/.new-topic");menu.addItem("journal",DICT.mi_recent_changes,true,DICT.tt_recent_changes);menu.journal.setHref("wiki/.recent-changes");menu.addItem("options",DICT.mi_options,true,DICT.tt_options);menu.options.addEvtListener(function(){CERNY.require("TOPINCS.wiki.init.initMenu.options","TOPINCS.wiki.OptionsEditor");if(!optionsEditor){var OptionsEditor=TOPINCS.wiki.OptionsEditor;optionsEditor=new OptionsEditor(USER_OPTIONS,getBaseContext());optionsEditor.addObserver(OptionsEditor.EVT_HIDDEN,function(){EL_CONTENT.show();});EL_CONTENT.node.parentNode.appendChild(optionsEditor.render().node);}
EL_CONTENT.hide();optionsEditor.show();});menu.addItem("info",DICT.mi_about,true,DICT.tt_about);menu.info.addEvtListener(function(){CERNY.require("TOPINCS.wiki.init.initMenu.about","TOPINCS.misc.Splash");TOPINCS.misc.Splash.show();});menu.display(EL_MENU);}
function initSearch(pageOptions){var searchEl=new Element("search");var searchInputEl=Element.create("input",null,"id=search-input");searchEl.appendChild(searchInputEl);searchInputEl.addEvtListener("keyup",function(_event){var searchInput=searchInputEl.node.value;setSearchUrl(searchInput);if(_event.keyCode==13&&searchInput.length>0){TOPINCS.util.setLocation(searchMi.getHref());}});searchMi.display(searchEl);if(pageOptions.focusSearchInput!==false){setTimeout(function(){searchInputEl.node.focus();},400);}}
function setSearchUrl(str){searchMi.setHref(URL_SEARCH+encodeURIComponent(str));}
method(TOPINCS.wiki,"setSearchUrl",setSearchUrl);function getContext(articleMap){return new TOPINCS.wiki.Context({articleMap:articleMap,options:USER_OPTIONS});}
method(TOPINCS.wiki,"getContext",getContext);function getBaseContext(){return new TOPINCS.wiki.Context({options:USER_OPTIONS});}
method(TOPINCS.wiki,"getBaseContext",getBaseContext);})();CERNY.require("TOPINCS.wiki.PreviewComponent","TOPINCS.wiki.DICT","TOPINCS.widgets.Menu","CERNY.dom.Element");(function(){var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var signature=CERNY.signature;var method=CERNY.method;var wiki=TOPINCS.wiki;var ID_PREVIEW_MENU_EL="preview-menu";TOPINCS.wiki.PreviewComponent=PreviewComponent;function PreviewComponent(obj){method(obj,"clearPreview",clearPreview);method(obj,"renderPreviewMenu",renderPreviewMenu);method(obj,"switchToEditor",switchToEditor);method(obj,"switchToPreview",switchToPreview);obj.previewEl=Element.create("div",null,"class=hidden preview");}
function renderPreviewMenu(){var menu=new TOPINCS.widgets.Menu();var t=this;menu.addItem("back",DICT.mi_back_to_editor);menu.back.addEvtListener(function(){t.switchToEditor()});return menu.render();}
function switchToPreview(menuDisplayer){this.editorEl.node.parentNode.appendChild(this.previewEl.node);menuDisplayer(this.renderPreviewMenu());this.editorEl.hide();this.previewEl.show();}
function switchToEditor(){this.previewEl.hide();this.editorEl.show();}
function clearPreview(){if(this.previewEl){this.previewEl.deleteChildren();}}})();CERNY.require("TOPINCS.widgets.OkCancelPopUp","TOPINCS.widgets.Buttons","TOPINCS.widgets.Button","TOPINCS.widgets.util","TOPINCS.widgets.DICT","CERNY.dom.Element","TOPINCS.widgets.InfoPopUp");(function(){TOPINCS.widgets.OkCancelPopUp=OkCancelPopUp;var Buttons=TOPINCS.widgets.Buttons;var Button=TOPINCS.widgets.Button;var Element=CERNY.dom.Element;var InfoPopUp=TOPINCS.widgets.InfoPopUp;var DICT=TOPINCS.widgets.DICT;var getEvent=TOPINCS.widgets.util.getEvent;var method=CERNY.method;var signature=CERNY.signature;function OkCancelPopUp(conf){var t=this;var okLabel=conf.okLabel||DICT.lab_ok;function okAction(){alert("Attach your own action with setOkAction!");}
this.okButton=new Button({label:okLabel,action:okAction});var cancelLabel=conf.cancelLabel||DICT.lab_cancel;function cancelAction(){t.hide();}
this.cancelButton=new Button({label:cancelLabel,action:cancelAction});var buttons=new Buttons();buttons.addButton(this.cancelButton);buttons.addButton(this.okButton);conf.buttons=buttons;InfoPopUp.call(this,conf);this.el.addCSSClass("ok-cancel-popup");}
OkCancelPopUp.prototype=new InfoPopUp();function setOkAction(ok){this.okButton.action=ok;}
signature(setOkAction,"undefined","function");method(OkCancelPopUp.prototype,"setOkAction",setOkAction);function setCancelAction(cancel){this.cancelButton.action=cancel;}
signature(setCancelAction,"undefined","function");method(OkCancelPopUp.prototype,"setCancelAction",setCancelAction);function focus(){this.okButton.focus();}
signature(focus,"undefined","undefined");method(OkCancelPopUp.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.LinkIcon","TOPINCS.widgets.Actionable","TOPINCS.cons","CERNY.dom.Element");(function(){TOPINCS.widgets.LinkIcon=LinkIcon;var method=CERNY.method;var Actionable=TOPINCS.widgets.Actionable;var Element=CERNY.dom.Element;var logger=CERNY.Logger("TOPINCS.widgets.LinkIcon");function LinkIcon(label,iconName,active,href){this.el=Element.create("a",null,"class=icon","title="+label,"href="+href);this.href=href;Actionable.init(this,{containerEl:this.el,aEl:this.el,active:active,iconName:iconName});var oldDeactivate=this.deactivate;this.deactivate=function(){this.el.setAttr("href",HREF_VOID);oldDeactivate.apply(this);};var oldActivate=this.activate;this.activate=function(){this.el.setAttr("href",this.href);oldActivate.apply(this);};}
LinkIcon.prototype.logger=logger;Actionable(LinkIcon.prototype);function display(targetEl){targetEl.appendChild(this.el);}
method(LinkIcon.prototype,"display",display);function focus(){this.el.node.focus();}
method(LinkIcon.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.Exception","TOPINCS.I18NException","TOPINCS.widgets.DICT");(function(){TOPINCS.widgets.Exception=Exception;function Exception(messageKey,replacements){TOPINCS.I18NException.call(this,messageKey,replacements);}
Exception.prototype=new TOPINCS.I18NException();Exception.prototype.dictionary=TOPINCS.widgets.DICT;})();CERNY.require("TOPINCS.widgets.InvalidDateFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidDateFormatException=InvalidDateFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidDateFormatException(dateFormat){Exception.call(this,"msg_invalid_date_error",[new Date().format(dateFormat)]);}
InvalidDateFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.DateInput","CERNY.dom.Element","TOPINCS.widgets.InvalidDateFormatException");(function(){TOPINCS.widgets.DateInput=DateInput;var Element=CERNY.dom.Element;var InvalidDateFormatException=TOPINCS.widgets.InvalidDateFormatException;var method=CERNY.method;var signature=CERNY.signature;var exception;function DateInput(formats){this.dateFormat=formats.date;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidDateFormatException(this.dateFormat);}
function setValue(date){this.el.node.value=date.format(this.dateFormat," ",this.timezoneFormat);}
signature(setValue,"undefined",Date);method(DateInput.prototype,"setValue",setValue);function getValue(){var input=this.el.node.value;var date=Date.parseDate(input,this.dateFormat);if(!date){throw new InvalidDateFormatException(this.dateFormat);}
return date;}
signature(getValue,Date);method(DateInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(DateInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.InvalidDecimalFormatException","TOPINCS.widgets.Exception","CERNY.js.Number");(function(){TOPINCS.widgets.InvalidDecimalFormatException=InvalidDecimalFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidDecimalFormatException(decimalFormat){Exception.call(this,"msg_invalid_decimal_error",[new Number(3.14).format(decimalFormat)]);}
InvalidDecimalFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.DecimalInput","CERNY.dom.Element","TOPINCS.widgets.InvalidDecimalFormatException");(function(){TOPINCS.widgets.DecimalInput=DecimalInput;var Element=CERNY.dom.Element;var InvalidDecimalFormatException=TOPINCS.widgets.InvalidDecimalFormatException;var method=CERNY.method;var signature=CERNY.signature;var exception;function DecimalInput(formats){this.decimalFormat=formats.decimal;this.el=Element.create("input",null);exception=exception||new InvalidDecimalFormatException(this.decimalFormat);}
function setValue(number){this.el.node.value=number.format(this.decimalFormat);}
signature(setValue,"undefined",Date);method(DecimalInput.prototype,"setValue",setValue);function getValue(){var number=Number._parse(this.el.node.value,this.decimalFormat);if(!isNumber(number)){throw new InvalidDecimalFormatException(this.decimalFormat);}
return number;}
signature(getValue,Date);method(DecimalInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(DecimalInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.InvalidTimeFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidTimeFormatException=InvalidTimeFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidTimeFormatException(timeFormat){Exception.call(this,"msg_invalid_time_error",[new Date().formatTime(timeFormat)]);}
InvalidTimeFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.TimeInput","CERNY.dom.Element","CERNY.util","TOPINCS.util","TOPINCS.widgets.InvalidTimeFormatException");(function(){TOPINCS.widgets.TimeInput=TimeInput;var Element=CERNY.dom.Element;var InvalidTimeFormatException=TOPINCS.widgets.InvalidTimeFormatException;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var exception;function TimeInput(formats){this.timeFormat=formats.time;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidTimeFormatException(this.timeFormat);}
function setValue(date){this.el.node.value=date.formatTime(this.timeFormat," ",this.timezoneFormat);}
signature(setValue,"undefined",Date);method(TimeInput.prototype,"setValue",setValue);function getValue(){try{return Date.parseTime(this.el.node.value,this.timeFormat);}catch(e){throw exception;}}
signature(getValue,Date);method(TimeInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(TimeInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.Time","TOPINCS.widgets.util","CERNY.util","CERNY.text.TimezoneFormat","CERNY.dom.Element");(function(){TOPINCS.widgets.Time=Time;var Element=CERNY.dom.Element;var fillNumber=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var TimezoneSelect=TOPINCS.widgets.util.TimezoneSelect;var logger="TOPINCS.widgets.Time";function Time(locale){this.locale=locale;ampm=this.locale.formats.time.ampm;this.el=Element.create("div",null,"class=time");var formatHourName;if(ampm){formatHourName=function(value){if(value<=12){return value+" a.m";}
value=value-12;return value+" p.m.";}}
this.hourEl=createSelect(23,formatHourName);this.minuteEl=createSelect(59);this.secondEl=createSelect(59);this.timezoneSelect=new TimezoneSelect();this.el.appendChildren(this.hourEl,Element.create("span",":"),this.minuteEl,Element.create("span",":"),this.secondEl,this.timezoneSelect.el);}
Time.prototype.logger=logger;function render(){return this.el;}
method(Time.prototype,"render",render);function getValue(){var date=new Date();date.setHours(this.hourEl.node.value);date.setMinutes(this.minuteEl.node.value);date.setSeconds(this.secondEl.node.value);CERNY.js.Date.setTimezoneOffset(date,Number(this.timezoneSelect.el.node.value));return date;}
method(Time.prototype,"getValue",getValue);function setValue(date){this.hourEl.node.value=date.getHours();this.minuteEl.node.value=date.getMinutes();this.secondEl.node.value=date.getSeconds();this.timezoneSelect.el.node.value=CERNY.js.Date.getTimezoneOffset(date);}
signature(setValue,"number","number","number");method(Time.prototype,"setValue",setValue);function addChangeListener(f){this.hourEl.addEvtListener("change",f);this.minuteEl.addEvtListener("change",f);this.secondEl.addEvtListener("change",f);this.timezoneSelect.el.addEvtListener("change",f);}
method(Time.prototype,"addChangeListener",addChangeListener);function show(){this.el.show();}
method(Time.prototype,"show",show);function hide(){this.el.hide();}
method(Time.prototype,"hide",hide);function createSelect(max,formatName){if(!formatName){formatName=function(value){return fillNumber(value);}}
var el=Element.create("select");for(var i=0;i<=max;i++){el.appendChild(Element.create("option",formatName(i),"value="+i));}
return el;}})();CERNY.require("TOPINCS.widgets.InvalidDateTimeFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidDateTimeFormatException=InvalidDateTimeFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidDateTimeFormatException(dateFormat,timeFormat){Exception.call(this,"msg_invalid_date_time_error",[new Date().format(dateFormat),new Date().formatTime(timeFormat)]);}
InvalidDateTimeFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.DateTimeInput","CERNY.dom.Element","CERNY.util","TOPINCS.util","TOPINCS.widgets.InvalidDateTimeFormatException");(function(){TOPINCS.widgets.DateTimeInput=DateTimeInput;var logger=CERNY.Logger("TOPINCS.widgets.DateTimeInput");var Element=CERNY.dom.Element;var InvalidDateTimeFormatException=TOPINCS.widgets.InvalidDateTimeFormatException;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var exception;function DateTimeInput(formats){this.dateFormat=formats.date;this.timeFormat=formats.time;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidDateTimeFormatException(this.dateFormat,this.timeFormat);}
DateTimeInput.prototype.logger=logger;function setValue(date){this.el.node.value=date.formatDateTime(this.dateFormat," ",this.timeFormat," ",this.timezoneFormat);}
signature(setValue,"undefined",Date);method(DateTimeInput.prototype,"setValue",setValue);function getValue(){try{var input=this.el.node.value;var segments=input.split(/\s/);var dateStr=segments.shift();var timeStr=segments.join(" ");var date=Date._parse(dateStr,this.dateFormat);if(!date){throw new Error();}
date=Date.parseTime(timeStr,this.timeFormat,date);return date;}catch(e){throw exception;}}
signature(getValue,Date);method(DateTimeInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(DateTimeInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.Selector","CERNY.js.Array","CERNY.dom.Element");(function(){TOPINCS.widgets.Selector=Selector;var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var name="TOPINCS.widgets.Selector";var logger=CERNY.Logger(name);var NO_VALUE="__NO_VALUE";function Selector(p){if(p){this.options=p.options||[];this.initialValue=p.initialValue;if(p.noValueOption===true){this.options.unshift({id:NO_VALUE,label:DICT.lab_form_no_value});}
this.index={};}
this.el=Element.create("select");}
Selector.prototype.logger=logger;Selector.NO_VALUE=NO_VALUE;function render(){renderOptions(this);if(this.initialValue){this.setValue(this.initialValue);}
return this.el;}
method(Selector.prototype,"render",render);function renderOptions(t){var i=t.options.length;while(i--){var option=t.options[i];t.el.insertBefore(Element.create("option",option.label,"id="+option.id));t.index[option.id]=i;}
t.el.node.selectedIndex=0;}
function redisplay(){this.el.deleteChildren();renderOptions(this);}
method(Selector.prototype,"redisplay",redisplay);function getText(){var node=this.el.node;return node.options[node.selectedIndex].text;}
method(Selector.prototype,"getText",getText);function getValue(){var node=this.el.node;return node.options[node.selectedIndex].id;}
method(Selector.prototype,"getValue",getValue);function setValue(id){this.el.node.selectedIndex=this.index[id];}
method(Selector.prototype,"setValue",setValue);function hasValue(id){return this.index.hasOwnProperty(id);}
method(Selector.prototype,"hasValue",hasValue);function focus(){this.el.node.focus();}
method(Selector.prototype,"focus",focus);function addChangeListener(f){this.el.addEvtListener("change",f);}
method(Selector.prototype,"addChangeListener",addChangeListener);method(Selector.prototype,"addUserInputObserver",addChangeListener);function addOption(option){this.options.sortedInsert(option,function(a,b){return a.label>b.label;});}
method(Selector.prototype,"addOption",addOption);})();CERNY.require("TOPINCS.widgets.TopicSelector","TOPINCS.util","TOPINCS.widgets.DICT","TOPINCS.tmdm.TopicReference","TOPINCS.widgets.Selector");(function(){TOPINCS.widgets.TopicSelector=TopicSelector;var method=CERNY.method;var signature=CERNY.signature;var Selector=TOPINCS.widgets.Selector;var DICT=TOPINCS.widgets.DICT;var name="TOPINCS.widgets.TopicSelector";var logger=CERNY.Logger(name);function TopicSelector(p){if(p){this.typeIds=p.typeIds||[];if(p.typeId){this.typeIds.push(p.typeId);}
this.instances=p.instances;if(!p.delayInit){this.init();}
if(isUndefined(p.initialValue)){if(p.initialTr){try{p.initialValue=TOPINCS.tmdm.TopicReference.resolve(p.initialTr);this.initialTr=p.initialTr;}catch(e){TOPINCS.util.showMessage(e);}}
if(isUndefined(p.initialValue)){p.initialValue=TopicSelector.NO_VALUE;}}
p.options=this.options;Selector.call(this,p);}}
TopicSelector.prototype=new Selector();TopicSelector.prototype.logger=logger;TopicSelector.NO_VALUE=Selector.NO_VALUE;function init(){if(!this.instances){this.instances=TOPINCS.util.getTopics(null,this.typeIds);}
if(this.typeIds.length==1){this.options=this.instances;}else{this.options=[];var i=this.instances.length;while(i--){var tp=this.instances[i];var label=tp.label;if(tp.type){label+=" ("+tp.type.label+")";}
this.options.unshift({id:tp.id,label:label});}}}
method(TopicSelector.prototype,"init",init);function getValue(){var value=Selector.prototype.getValue.apply(this);if(value==this.initialValue&&this.initialTr){return this.initialTr;}else{return value;}}
method(TopicSelector.prototype,"getValue",getValue);})();(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return!!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return!!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return+new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return!o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return-1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return!!T.firstChild},empty:function(T){return!T.firstChild},has:function(V,U,T){return!!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex"in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return!F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return!!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return!(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return!this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);;(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.2",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;CERNY.require("DICT","TOPINCS.dict");(function(){eval("DICT = "+TOPINCS.dict.getDictionary("DICT")+";");})();CERNY.require("TOPINCS.widgets.ListEditor","_","TOPINCS.widgets.Icon","TOPINCS.widgets.DICT","CERNY.event.Observable","jQuery.ui","DICT","CERNY.dom.Element","CERNY.dom.html");(function(){TOPINCS.widgets.ListEditor=ListEditor;var name="TOPINCS.widgets.ListEditor";var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var Icon=TOPINCS.widgets.Icon;var DICT=TOPINCS.widgets.DICT;var Observable=CERNY.event.Observable;var EVT_USER_INPUT=name+".EVT_USER_INPUT";function ListEditor(values,editorClass){if(values.length==0){values.push(undefined);}
this.initialItems=values;this.editorClass=editorClass;this.el=Element.create("div",null,"class=list-editor");var t=this;function notify(e){t.notify(EVT_USER_INPUT);}
this.el.addEvtListener("click",notify);this.icons=[];this.editors=[];}
Observable(ListEditor.prototype);ListEditor.EVT_USER_INPUT=EVT_USER_INPUT;function getValues(){return _.map(this.listEl.getChildren(isListItem),function(node){return node.editor.getValue();});}
signature(getValues,Array);method(ListEditor.prototype,"getValues",getValues);function focus(){this.listEl.getFirstChild(isListItem).editor.focus();}
signature(focus,Element);method(ListEditor.prototype,"focus",focus);function render(){this.msgEl=Element.create("p",DICT.msg_list_editor_usage,"class=message");this.listEl=renderItems(this);this.el.appendChildren(this.msgEl,this.listEl);var t=this;var options={containment:"parent",stop:function(event,ui){t.notify(EVT_USER_INPUT);}};this.sortableEl=$("ul",this.el.node);this.sortableEl.sortable(options);this.sortableEl.disableSelection();return this.el;}
signature(render,Element);method(ListEditor.prototype,"render",render);function activate(){_.invoke(this.editors,"activate");_.invoke(this.icons,"activate");this.sortableEl.sortable("disable");}
method(ListEditor.prototype,"activate",activate);function deactivate(){_.invoke(this.editors,"deactivate");_.invoke(this.icons,"deactivate");this.sortableEl.sortable("enable");}
method(ListEditor.prototype,"deactivate",deactivate);function renderItems(t){var el=Element.create("ul");_.forEach(t.initialItems,function(item){el.appendChild(renderItem(t,item,el));});return el;}
function renderItem(t,item,listEl){var el=Element.create("li");var deleteIcon=new Icon(DICT.mi_delete,"delete");var addIcon=new Icon(DICT.mi_create,"create");el.node.editor=new t.editorClass(item);var editor=el.node.editor;t.icons.push(deleteIcon,addIcon);t.editors.push(editor);deleteIcon.addAction(function(){el.domDelete();t.editors.remove(editor);t.icons.remove(addIcon);t.icons.remove(deleteIcon);if(listEl.countChildren(isListItem)==0){listEl.appendChild(renderItem(t,null,listEl));}});addIcon.addAction(function(){listEl.insertAfter(renderItem(t,null,listEl),el);});editor.addUserInputObserver(function(){t.notify(EVT_USER_INPUT);});var editorEl=editor.render();editorEl.addCSSClass("list-item-editor");el.appendChildren(editorEl,deleteIcon.render(),addIcon.render());return el;}})();CERNY.require("TOPINCS.widgets.IncompleteListException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.IncompleteListException=IncompleteListException;var Exception=TOPINCS.widgets.Exception;function IncompleteListException(dateFormat){Exception.call(this,"msg_incomplete_list");}
IncompleteListException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.ValueSpaceEditor","TOPINCS.widgets.Selector","_","CERNY.dom.Element");(function(){TOPINCS.widgets.ValueSpaceEditor=ValueSpaceEditor;var method=CERNY.method;var Selector=TOPINCS.widgets.Selector;function ValueSpaceEditor(value,datatype,space){this.value=value;this.datatype=datatype;this.space=space;var options=_.map(space,function(v){return{id:v,label:v};});Selector.call(this,{initialValue:value,options:options,noValueOption:true});}
ValueSpaceEditor.prototype=new Selector();function getValue(){var value=Selector.prototype.getValue.call(this);return value==Selector.NO_VALUE?"":value;}
method(ValueSpaceEditor.prototype,"getValue",getValue);})();(function(){YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Config=YAHOO.util.Config;Config.CONFIG_CHANGED_EVENT="configChanged";Config.BOOLEAN_TYPE="boolean";Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(owner){this.owner=owner;this.configChangedEvent=this.createEvent(Config.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=CustomEvent.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(val){return(typeof val==Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=this.createEvent(key,{scope:this.owner});propertyObject.event.signature=CustomEvent.LIST;propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={},currCfg=this.config,prop,property;for(prop in currCfg){if(Lang.hasOwnProperty(currCfg,prop)){property=currCfg[prop];if(property&&property.event){cfg[prop]=property.value;}}}
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!Lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);return true;}}else{return false;}},setProperty:function(key,value,silent){var property;key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key],foundDuplicate=false,iLen,queueItem,queueItemKey,queueItemValue,sLen,supercedesCheck,qLen,queueItemCheck,queueItemCheckKey,queueItemCheckValue,i,s,q;if(property&&property.event){if(!Lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!Lang.isUndefined(value)){property.value=value;}else{value=property.value;}
foundDuplicate=false;iLen=this.eventQueue.length;for(i=0;i<iLen;i++){queueItem=this.eventQueue[i];if(queueItem){queueItemKey=queueItem[0];queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!Lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&!Lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
if(property.supercedes){sLen=property.supercedes.length;for(s=0;s<sLen;s++){supercedesCheck=property.supercedes[s];qLen=this.eventQueue.length;for(q=0;q<qLen;q++){queueItemCheck=this.eventQueue[q];if(queueItemCheck){queueItemCheckKey=queueItemCheck[0];queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!Lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){var sKey,oConfig;if(init){oConfig={};for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){oConfig[sKey.toLowerCase()]=userConfig[sKey];}}
this.initialConfig=oConfig;}
for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){this.queueProperty(sKey,userConfig[sKey]);}}},refresh:function(){var prop;for(prop in this.config){if(Lang.hasOwnProperty(this.config,prop)){this.refireEvent(prop);}}},fireQueue:function(){var i,queueItem,key,value,property;this.queueInProgress=true;for(i=0;i<this.eventQueue.length;i++){queueItem=this.eventQueue[i];if(queueItem){key=queueItem[0];value=queueItem[1];property=this.config[key];property.value=value;this.fireEvent(key,value);}}
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
return output;},outputEventQueue:function(){var output="",queueItem,q,nQueue=this.eventQueue.length;for(q=0;q<nQueue;q++){queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;},destroy:function(){var oConfig=this.config,sProperty,oProperty;for(sProperty in oConfig){if(Lang.hasOwnProperty(oConfig,sProperty)){oProperty=oConfig[sProperty];oProperty.event.unsubscribeAll();oProperty.event=null;}}
this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};Config.alreadySubscribed=function(evt,fn,obj){var nSubscribers=evt.subscribers.length,subsc,i;if(nSubscribers>0){i=nSubscribers-1;do{subsc=evt.subscribers[i];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
while(i--);}
return false;};YAHOO.lang.augmentProto(Config,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,WEEK_ONE_JAN_DATE:1,add:function(date,field,amount){var d=new Date(date.getTime());switch(field){case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0){newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11){newMonth-=12;years+=1;}}
d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:this._addDays(d,amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:this._addDays(d,(amount*7));break;}
return d;},_addDays:function(d,nDays){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){if(nDays<0){for(var min=-128;nDays<min;nDays-=min){d.setDate(d.getDate()+min);}}else{for(var max=96;nDays>max;nDays-=max){d.setDate(d.getDate()+max);}}}
d.setDate(d.getDate()+nDays);},subtract:function(date,field,amount){return this.add(date,field,(amount*-1));},before:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()<ms){return true;}else{return false;}},after:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()>ms){return true;}else{return false;}},between:function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}},getJan1:function(calendarYear){return this.getDate(calendarYear,0,1);},getDayOffset:function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;},getWeekNumber:function(date,firstDayOfWeek,janDate){firstDayOfWeek=firstDayOfWeek||0;janDate=janDate||this.WEEK_ONE_JAN_DATE;var targetDate=this.clearTime(date),startOfWeek,endOfWeek;if(targetDate.getDay()===firstDayOfWeek){startOfWeek=targetDate;}else{startOfWeek=this.getFirstDayOfWeek(targetDate,firstDayOfWeek);}
var startYear=startOfWeek.getFullYear(),startTime=startOfWeek.getTime();endOfWeek=new Date(startOfWeek.getTime()+6*this.ONE_DAY_MS);var weekNum;if(startYear!==endOfWeek.getFullYear()&&endOfWeek.getDate()>=janDate){weekNum=1;}else{var weekOne=this.clearTime(this.getDate(startYear,0,janDate)),weekOneDayOne=this.getFirstDayOfWeek(weekOne,firstDayOfWeek);var daysDiff=Math.round((targetDate.getTime()-weekOneDayOne.getTime())/this.ONE_DAY_MS);var rem=daysDiff%7;var weeksDiff=(daysDiff-rem)/7;weekNum=weeksDiff+1;}
return weekNum;},getFirstDayOfWeek:function(dt,startOfWeek){startOfWeek=startOfWeek||0;var dayOfWeekIndex=dt.getDay(),dayOfWeek=(dayOfWeekIndex-startOfWeek+7)%7;return this.subtract(dt,this.DAY,dayOfWeek);},isYearOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
return overlaps;},isMonthOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
return overlaps;},findMonthStart:function(date){var start=this.getDate(date.getFullYear(),date.getMonth(),1);return start;},findMonthEnd:function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;},clearTime:function(date){date.setHours(12,0,0,0);return date;},getDate:function(y,m,d){var dt=null;if(YAHOO.lang.isUndefined(d)){d=1;}
if(y>=100){dt=new Date(y,m,d);}else{dt=new Date();dt.setFullYear(y);dt.setMonth(m);dt.setDate(d);dt.setHours(0,0,0,0);}
return dt;}};(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,DateMath=YAHOO.widget.DateMath;function Calendar(id,containerId,config){this.init.apply(this,arguments);}
Calendar.IMG_ROOT=null;Calendar.DATE="D";Calendar.MONTH_DAY="MD";Calendar.WEEKDAY="WD";Calendar.RANGE="R";Calendar.MONTH="M";Calendar.DISPLAY_DAYS=42;Calendar.STOP_RENDER="S";Calendar.SHORT="short";Calendar.LONG="long";Calendar.MEDIUM="medium";Calendar.ONE_CHAR="1char";Calendar._DEFAULT_CONFIG={PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};var DEF_CFG=Calendar._DEFAULT_CONFIG;Calendar._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};Calendar._STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(args){var nArgs={id:null,container:null,config:null};if(args&&args.length&&args.length>0){switch(args.length){case 1:nArgs.id=null;nArgs.container=args[0];nArgs.config=null;break;case 2:if(Lang.isObject(args[1])&&!args[1].tagName&&!(args[1]instanceof String)){nArgs.id=null;nArgs.container=args[0];nArgs.config=args[1];}else{nArgs.id=args[0];nArgs.container=args[1];nArgs.config=null;}
break;default:nArgs.id=args[0];nArgs.container=args[1];nArgs.config=args[2];break;}}else{}
return nArgs;},init:function(id,container,config){var nArgs=this._parseArgs(arguments);id=nArgs.id;container=nArgs.container;config=nArgs.config;if(container){this.oDomContainer=Dom.get(container);if(!this.oDomContainer.id){this.oDomContainer.id=Dom.generateId();}
if(!id){id=this.oDomContainer.id+"_t";}
this.id=id;this.containerId=this.oDomContainer.id;}
this.initEvents();this.today=new Date();DateMath.clearTime(this.today);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();},configIframe:function(type,args,obj){var useIframe=args[0];if(!this.parent){if(Dom.inDocument(this.oDomContainer)){if(useIframe){var pos=Dom.getStyle(this.oDomContainer,"position");if(pos=="absolute"||pos=="relative"){if(!Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";Dom.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){Dom.addClass(this.iframe,"fixedsize");}
this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;}}}}},configTitle:function(type,args,obj){var title=args[0];if(title){this.createTitleBar(title);}else{var close=this.cfg.getProperty(DEF_CFG.CLOSE.key);if(!close){this.removeTitleBar();}else{this.createTitleBar("&#160;");}}},configClose:function(type,args,obj){var close=args[0],title=this.cfg.getProperty(DEF_CFG.TITLE.key);if(close){if(!title){this.createTitleBar("&#160;");}
this.createCloseButton();}else{this.removeCloseButton();if(!title){this.removeTitleBar();}}},initEvents:function(){var defEvents=Calendar._EVENT_TYPES,CE=YAHOO.util.CustomEvent,cal=this;cal.beforeSelectEvent=new CE(defEvents.BEFORE_SELECT);cal.selectEvent=new CE(defEvents.SELECT);cal.beforeDeselectEvent=new CE(defEvents.BEFORE_DESELECT);cal.deselectEvent=new CE(defEvents.DESELECT);cal.changePageEvent=new CE(defEvents.CHANGE_PAGE);cal.beforeRenderEvent=new CE(defEvents.BEFORE_RENDER);cal.renderEvent=new CE(defEvents.RENDER);cal.beforeDestroyEvent=new CE(defEvents.BEFORE_DESTROY);cal.destroyEvent=new CE(defEvents.DESTROY);cal.resetEvent=new CE(defEvents.RESET);cal.clearEvent=new CE(defEvents.CLEAR);cal.beforeShowEvent=new CE(defEvents.BEFORE_SHOW);cal.showEvent=new CE(defEvents.SHOW);cal.beforeHideEvent=new CE(defEvents.BEFORE_HIDE);cal.hideEvent=new CE(defEvents.HIDE);cal.beforeShowNavEvent=new CE(defEvents.BEFORE_SHOW_NAV);cal.showNavEvent=new CE(defEvents.SHOW_NAV);cal.beforeHideNavEvent=new CE(defEvents.BEFORE_HIDE_NAV);cal.hideNavEvent=new CE(defEvents.HIDE_NAV);cal.beforeRenderNavEvent=new CE(defEvents.BEFORE_RENDER_NAV);cal.renderNavEvent=new CE(defEvents.RENDER_NAV);cal.beforeSelectEvent.subscribe(cal.onBeforeSelect,this,true);cal.selectEvent.subscribe(cal.onSelect,this,true);cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect,this,true);cal.deselectEvent.subscribe(cal.onDeselect,this,true);cal.changePageEvent.subscribe(cal.onChangePage,this,true);cal.renderEvent.subscribe(cal.onRender,this,true);cal.resetEvent.subscribe(cal.onReset,this,true);cal.clearEvent.subscribe(cal.onClear,this,true);},doPreviousMonthNav:function(e,cal){Event.preventDefault(e);setTimeout(function(){cal.previousMonth();var navs=Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT,"a",cal.oDomContainer);if(navs&&navs[0]){try{navs[0].focus();}catch(e){}}},0);},doNextMonthNav:function(e,cal){Event.preventDefault(e);setTimeout(function(){cal.nextMonth();var navs=Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT,"a",cal.oDomContainer);if(navs&&navs[0]){try{navs[0].focus();}catch(e){}}},0);},doSelectCell:function(e,cal){var cell,d,date,index;var target=Event.getTarget(e),tagName=target.tagName.toLowerCase(),defSelector=false;while(tagName!="td"&&!Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){if(!defSelector&&tagName=="a"&&Dom.hasClass(target,cal.Style.CSS_CELL_SELECTOR)){defSelector=true;}
target=target.parentNode;tagName=target.tagName.toLowerCase();if(target==this.oDomContainer||tagName=="html"){return;}}
if(defSelector){Event.preventDefault(e);}
cell=target;if(Dom.hasClass(cell,cal.Style.CSS_CELL_SELECTABLE)){index=cal.getIndexFromId(cell.id);if(index>-1){d=cal.cellDates[index];if(d){date=DateMath.getDate(d[0],d[1]-1,d[2]);var link;if(cal.Options.MULTI_SELECT){link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
cal.selectCell(index);}}}}},doCellMouseOver:function(e,cal){var target;if(e){target=Event.getTarget(e);}else{target=this;}
while(target.tagName&&target.tagName.toLowerCase()!="td"){target=target.parentNode;if(!target.tagName||target.tagName.toLowerCase()=="html"){return;}}
if(Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){Dom.addClass(target,cal.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(e,cal){var target;if(e){target=Event.getTarget(e);}else{target=this;}
while(target.tagName&&target.tagName.toLowerCase()!="td"){target=target.parentNode;if(!target.tagName||target.tagName.toLowerCase()=="html"){return;}}
if(Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){Dom.removeClass(target,cal.Style.CSS_CELL_HOVER);}},setupConfig:function(){var cfg=this.cfg;cfg.addProperty(DEF_CFG.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});cfg.addProperty(DEF_CFG.SELECTED.key,{value:[],handler:this.configSelected});cfg.addProperty(DEF_CFG.TITLE.key,{value:DEF_CFG.TITLE.value,handler:this.configTitle});cfg.addProperty(DEF_CFG.CLOSE.key,{value:DEF_CFG.CLOSE.value,handler:this.configClose});cfg.addProperty(DEF_CFG.IFRAME.key,{value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.MINDATE.key,{value:DEF_CFG.MINDATE.value,handler:this.configMinDate});cfg.addProperty(DEF_CFG.MAXDATE.key,{value:DEF_CFG.MAXDATE.value,handler:this.configMaxDate});cfg.addProperty(DEF_CFG.MULTI_SELECT.key,{value:DEF_CFG.MULTI_SELECT.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.START_WEEKDAY.key,{value:DEF_CFG.START_WEEKDAY.value,handler:this.configOptions,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key,{value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key,{value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.configOptions});cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key,{value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.configOptions});cfg.addProperty(DEF_CFG.MONTHS_SHORT.key,{value:DEF_CFG.MONTHS_SHORT.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MONTHS_LONG.key,{value:DEF_CFG.MONTHS_LONG.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key,{value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key,{value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key,{value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key,{value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.configLocale});var refreshLocale=function(){cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);};cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_LONG.key,refreshLocale,this,true);cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key,{value:DEF_CFG.LOCALE_MONTHS.value,handler:this.configLocaleValues});cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key,{value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});cfg.addProperty(DEF_CFG.DATE_DELIMITER.key,{value:DEF_CFG.DATE_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key,{value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key,{value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key,{value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key,{value:DEF_CFG.MD_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key,{value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key,{value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key,{value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key,{value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key,{value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key,{value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key,{value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.NAV.key,{value:DEF_CFG.NAV.value,handler:this.configNavigator});cfg.addProperty(DEF_CFG.STRINGS.key,{value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val){return Lang.isObject(val);},supercedes:DEF_CFG.STRINGS.supercedes});},configStrings:function(type,args,obj){var val=Lang.merge(DEF_CFG.STRINGS.value,args[0]);this.cfg.setProperty(DEF_CFG.STRINGS.key,val,true);},configPageDate:function(type,args,obj){this.cfg.setProperty(DEF_CFG.PAGEDATE.key,this._parsePageDate(args[0]),true);},configMinDate:function(type,args,obj){var val=args[0];if(Lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(DEF_CFG.MINDATE.key,DateMath.getDate(val[0],(val[1]-1),val[2]));}},configMaxDate:function(type,args,obj){var val=args[0];if(Lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(DEF_CFG.MAXDATE.key,DateMath.getDate(val[0],(val[1]-1),val[2]));}},configSelected:function(type,args,obj){var selected=args[0],cfgSelected=DEF_CFG.SELECTED.key;if(selected){if(Lang.isString(selected)){this.cfg.setProperty(cfgSelected,this._parseDates(selected),true);}}
if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(cfgSelected);}},configOptions:function(type,args,obj){this.Options[type.toUpperCase()]=args[0];},configLocale:function(type,args,obj){this.Locale[type.toUpperCase()]=args[0];this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);},configLocaleValues:function(type,args,obj){type=type.toLowerCase();var val=args[0],cfg=this.cfg,Locale=this.Locale;switch(type){case DEF_CFG.LOCALE_MONTHS.key:switch(val){case Calendar.SHORT:Locale.LOCALE_MONTHS=cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();break;case Calendar.LONG:Locale.LOCALE_MONTHS=cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();break;}
break;case DEF_CFG.LOCALE_WEEKDAYS.key:switch(val){case Calendar.ONE_CHAR:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();break;case Calendar.SHORT:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();break;case Calendar.MEDIUM:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();break;case Calendar.LONG:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();break;}
var START_WEEKDAY=cfg.getProperty(DEF_CFG.START_WEEKDAY.key);if(START_WEEKDAY>0){for(var w=0;w<START_WEEKDAY;++w){Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());}}
break;}},configNavigator:function(type,args,obj){var val=args[0];if(YAHOO.widget.CalendarNavigator&&(val===true||Lang.isObject(val))){if(!this.oNavigator){this.oNavigator=new YAHOO.widget.CalendarNavigator(this);this.beforeRenderEvent.subscribe(function(){if(!this.pages){this.oNavigator.erase();}},this,true);}}else{if(this.oNavigator){this.oNavigator.destroy();this.oNavigator=null;}}},initStyles:function(){var defStyle=Calendar._STYLES;this.Style={CSS_ROW_HEADER:defStyle.CSS_ROW_HEADER,CSS_ROW_FOOTER:defStyle.CSS_ROW_FOOTER,CSS_CELL:defStyle.CSS_CELL,CSS_CELL_SELECTOR:defStyle.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:defStyle.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:defStyle.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:defStyle.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:defStyle.CSS_CELL_TODAY,CSS_CELL_OOM:defStyle.CSS_CELL_OOM,CSS_CELL_OOB:defStyle.CSS_CELL_OOB,CSS_HEADER:defStyle.CSS_HEADER,CSS_HEADER_TEXT:defStyle.CSS_HEADER_TEXT,CSS_BODY:defStyle.CSS_BODY,CSS_WEEKDAY_CELL:defStyle.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:defStyle.CSS_WEEKDAY_ROW,CSS_FOOTER:defStyle.CSS_FOOTER,CSS_CALENDAR:defStyle.CSS_CALENDAR,CSS_SINGLE:defStyle.CSS_SINGLE,CSS_CONTAINER:defStyle.CSS_CONTAINER,CSS_NAV_LEFT:defStyle.CSS_NAV_LEFT,CSS_NAV_RIGHT:defStyle.CSS_NAV_RIGHT,CSS_NAV:defStyle.CSS_NAV,CSS_CLOSE:defStyle.CSS_CLOSE,CSS_CELL_TOP:defStyle.CSS_CELL_TOP,CSS_CELL_LEFT:defStyle.CSS_CELL_LEFT,CSS_CELL_RIGHT:defStyle.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:defStyle.CSS_CELL_BOTTOM,CSS_CELL_HOVER:defStyle.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:defStyle.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:defStyle.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:defStyle.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:defStyle.CSS_CELL_HIGHLIGHT4};},buildMonthLabel:function(){return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));},_buildMonthLabel:function(date){var monthLabel=this.Locale.LOCALE_MONTHS[date.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX,yearLabel=date.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return yearLabel+monthLabel;}else{return monthLabel+yearLabel;}},buildDayLabel:function(workingDate){return workingDate.getDate();},createTitleBar:function(strTitle){var tDiv=Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");tDiv.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;tDiv.innerHTML=strTitle;this.oDomContainer.insertBefore(tDiv,this.oDomContainer.firstChild);Dom.addClass(this.oDomContainer,"withtitle");return tDiv;},removeTitleBar:function(){var tDiv=Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(tDiv){Event.purgeElement(tDiv);this.oDomContainer.removeChild(tDiv);}
Dom.removeClass(this.oDomContainer,"withtitle");},createCloseButton:function(){var cssClose=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,DEPR_CLOSE_PATH="us/my/bn/x_d.gif",lnk=Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0],strings=this.cfg.getProperty(DEF_CFG.STRINGS.key),closeStr=(strings&&strings.close)?strings.close:"";if(!lnk){lnk=document.createElement("a");Event.addListener(lnk,"click",function(e,cal){cal.hide();Event.preventDefault(e);},this);}
lnk.href="#";lnk.className="link-close";if(Calendar.IMG_ROOT!==null){var img=Dom.getElementsByClassName(cssClose,"img",lnk)[0]||document.createElement("img");img.src=Calendar.IMG_ROOT+DEPR_CLOSE_PATH;img.className=cssClose;lnk.appendChild(img);}else{lnk.innerHTML='<span class="'+cssClose+' '+this.Style.CSS_CLOSE+'">'+closeStr+'</span>';}
this.oDomContainer.appendChild(lnk);return lnk;},removeCloseButton:function(){var btn=Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(btn){Event.purgeElement(btn);this.oDomContainer.removeChild(btn);}},renderHeader:function(html){var colSpan=7,DEPR_NAV_LEFT="us/tr/callt.gif",DEPR_NAV_RIGHT="us/tr/calrt.gif",cfg=this.cfg,pageDate=cfg.getProperty(DEF_CFG.PAGEDATE.key),strings=cfg.getProperty(DEF_CFG.STRINGS.key),prevStr=(strings&&strings.previousMonth)?strings.previousMonth:"",nextStr=(strings&&strings.nextMonth)?strings.nextMonth:"",monthLabel;if(cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)){colSpan+=1;}
if(cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)){colSpan+=1;}
html[html.length]="<thead>";html[html.length]="<tr>";html[html.length]='<th colspan="'+colSpan+'" class="'+this.Style.CSS_HEADER_TEXT+'">';html[html.length]='<div class="'+this.Style.CSS_HEADER+'">';var renderLeft,renderRight=false;if(this.parent){if(this.index===0){renderLeft=true;}
if(this.index==(this.parent.cfg.getProperty("pages")-1)){renderRight=true;}}else{renderLeft=true;renderRight=true;}
if(renderLeft){monthLabel=this._buildMonthLabel(DateMath.subtract(pageDate,DateMath.MONTH,1));var leftArrow=cfg.getProperty(DEF_CFG.NAV_ARROW_LEFT.key);if(leftArrow===null&&Calendar.IMG_ROOT!==null){leftArrow=Calendar.IMG_ROOT+DEPR_NAV_LEFT;}
var leftStyle=(leftArrow===null)?"":' style="background-image:url('+leftArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_LEFT+'"'+leftStyle+' href="#">'+prevStr+' ('+monthLabel+')'+'</a>';}
var lbl=this.buildMonthLabel();var cal=this.parent||this;if(cal.cfg.getProperty("navigator")){lbl="<a class=\""+this.Style.CSS_NAV+"\" href=\"#\">"+lbl+"</a>";}
html[html.length]=lbl;if(renderRight){monthLabel=this._buildMonthLabel(DateMath.add(pageDate,DateMath.MONTH,1));var rightArrow=cfg.getProperty(DEF_CFG.NAV_ARROW_RIGHT.key);if(rightArrow===null&&Calendar.IMG_ROOT!==null){rightArrow=Calendar.IMG_ROOT+DEPR_NAV_RIGHT;}
var rightStyle=(rightArrow===null)?"":' style="background-image:url('+rightArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_RIGHT+'"'+rightStyle+' href="#">'+nextStr+' ('+monthLabel+')'+'</a>';}
html[html.length]='</div>\n</th>\n</tr>';if(cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)){html=this.buildWeekdays(html);}
html[html.length]='</thead>';return html;},buildWeekdays:function(html){html[html.length]='<tr class="'+this.Style.CSS_WEEKDAY_ROW+'">';if(this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)){html[html.length]='<th>&#160;</th>';}
for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i){html[html.length]='<th class="calweekdaycell">'+this.Locale.LOCALE_WEEKDAYS[i]+'</th>';}
if(this.cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)){html[html.length]='<th>&#160;</th>';}
html[html.length]='</tr>';return html;},renderBody:function(workingDate,html){var startDay=this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);this.preMonthDays=workingDate.getDay();if(startDay>0){this.preMonthDays-=startDay;}
if(this.preMonthDays<0){this.preMonthDays+=7;}
this.monthDays=DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=DateMath.subtract(workingDate,DateMath.DAY,this.preMonthDays);var weekNum,weekClass,weekPrefix="w",cellPrefix="_cell",workingDayPrefix="wd",dayPrefix="d",cellRenderers,renderer,t=this.today,cfg=this.cfg,todayYear=t.getFullYear(),todayMonth=t.getMonth(),todayDate=t.getDate(),useDate=cfg.getProperty(DEF_CFG.PAGEDATE.key),hideBlankWeeks=cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),showWeekFooter=cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),showWeekHeader=cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),mindate=cfg.getProperty(DEF_CFG.MINDATE.key),maxdate=cfg.getProperty(DEF_CFG.MAXDATE.key);if(mindate){mindate=DateMath.clearTime(mindate);}
if(maxdate){maxdate=DateMath.clearTime(maxdate);}
html[html.length]='<tbody class="m'+(useDate.getMonth()+1)+' '+this.Style.CSS_BODY+'">';var i=0,tempDiv=document.createElement("div"),cell=document.createElement("td");tempDiv.appendChild(cell);var cal=this.parent||this;for(var r=0;r<6;r++){weekNum=DateMath.getWeekNumber(workingDate,startDay);weekClass=weekPrefix+weekNum;if(r!==0&&hideBlankWeeks===true&&workingDate.getMonth()!=useDate.getMonth()){break;}else{html[html.length]='<tr class="'+weekClass+'">';if(showWeekHeader){html=this.renderRowHeader(weekNum,html);}
for(var d=0;d<7;d++){cellRenderers=[];this.clearElement(cell);cell.className=this.Style.CSS_CELL;cell.id=this.id+cellPrefix+i;if(workingDate.getDate()==todayDate&&workingDate.getMonth()==todayMonth&&workingDate.getFullYear()==todayYear){cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;}
var workingArray=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];this.cellDates[this.cellDates.length]=workingArray;if(workingDate.getMonth()!=useDate.getMonth()){cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;}else{Dom.addClass(cell,workingDayPrefix+workingDate.getDay());Dom.addClass(cell,dayPrefix+workingDate.getDate());for(var s=0;s<this.renderStack.length;++s){renderer=null;var rArray=this.renderStack[s],type=rArray[0],month,day,year;switch(type){case Calendar.DATE:month=rArray[1][1];day=rArray[1][2];year=rArray[1][0];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day&&workingDate.getFullYear()==year){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case Calendar.MONTH_DAY:month=rArray[1][0];day=rArray[1][1];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case Calendar.RANGE:var date1=rArray[1][0],date2=rArray[1][1],d1month=date1[1],d1day=date1[2],d1year=date1[0],d1=DateMath.getDate(d1year,d1month-1,d1day),d2month=date2[1],d2day=date2[2],d2year=date2[0],d2=DateMath.getDate(d2year,d2month-1,d2day);if(workingDate.getTime()>=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(s,1);}}
break;case Calendar.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}
break;case Calendar.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}
break;}
if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
if(this._indexOfSelectedFieldArray(workingArray)>-1){cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;}
if((mindate&&(workingDate.getTime()<mindate.getTime()))||(maxdate&&(workingDate.getTime()>maxdate.getTime()))){cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=cal.styleCellDefault;cellRenderers[cellRenderers.length]=cal.renderCellDefault;}
for(var x=0;x<cellRenderers.length;++x){if(cellRenderers[x].call(cal,workingDate,cell)==Calendar.STOP_RENDER){break;}}
workingDate.setTime(workingDate.getTime()+DateMath.ONE_DAY_MS);workingDate=DateMath.clearTime(workingDate);if(i>=0&&i<=6){Dom.addClass(cell,this.Style.CSS_CELL_TOP);}
if((i%7)===0){Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}
if(((i+1)%7)===0){Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}
var postDays=this.postMonthDays;if(hideBlankWeeks&&postDays>=7){var blankWeeks=Math.floor(postDays/7);for(var p=0;p<blankWeeks;++p){postDays-=7;}}
if(i>=((this.preMonthDays+postDays+this.monthDays)-7)){Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}
html[html.length]=tempDiv.innerHTML;i++;}
if(showWeekFooter){html=this.renderRowFooter(weekNum,html);}
html[html.length]='</tr>';}}
html[html.length]='</tbody>';return html;},renderFooter:function(html){return html;},render:function(){this.beforeRenderEvent.fire();var workingDate=DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;Event.purgeElement(this.oDomContainer,true);var html=[];html[html.length]='<table cellSpacing="0" class="'+this.Style.CSS_CALENDAR+' y'+workingDate.getFullYear()+'" id="'+this.id+'">';html=this.renderHeader(html);html=this.renderBody(workingDate,html);html=this.renderFooter(html);html[html.length]='</table>';this.oDomContainer.innerHTML=html.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(DEF_CFG.TITLE.key);this.cfg.refireEvent(DEF_CFG.CLOSE.key);this.cfg.refireEvent(DEF_CFG.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var root=this.oDomContainer,cal=this.parent||this,anchor="a",click="click";var linkLeft=Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,anchor,root),linkRight=Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,anchor,root);if(linkLeft&&linkLeft.length>0){this.linkLeft=linkLeft[0];Event.addListener(this.linkLeft,click,this.doPreviousMonthNav,cal,true);}
if(linkRight&&linkRight.length>0){this.linkRight=linkRight[0];Event.addListener(this.linkRight,click,this.doNextMonthNav,cal,true);}
if(cal.cfg.getProperty("navigator")!==null){this.applyNavListeners();}
if(this.domEventMap){var el,elements;for(var cls in this.domEventMap){if(Lang.hasOwnProperty(this.domEventMap,cls)){var items=this.domEventMap[cls];if(!(items instanceof Array)){items=[items];}
for(var i=0;i<items.length;i++){var item=items[i];elements=Dom.getElementsByClassName(cls,item.tag,this.oDomContainer);for(var c=0;c<elements.length;c++){el=elements[c];Event.addListener(el,item.event,item.handler,item.scope,item.correct);}}}}}
Event.addListener(this.oDomContainer,"click",this.doSelectCell,this);Event.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);Event.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);},applyNavListeners:function(){var calParent=this.parent||this,cal=this,navBtns=Dom.getElementsByClassName(this.Style.CSS_NAV,"a",this.oDomContainer);if(navBtns.length>0){Event.addListener(navBtns,"click",function(e,obj){var target=Event.getTarget(e);if(this===target||Dom.isAncestor(this,target)){Event.preventDefault(e);}
var navigator=calParent.oNavigator;if(navigator){var pgdate=cal.cfg.getProperty("pagedate");navigator.setYear(pgdate.getFullYear());navigator.setMonth(pgdate.getMonth());navigator.show();}});}},getDateByCellId:function(id){var date=this.getDateFieldsByCellId(id);return(date)?DateMath.getDate(date[0],date[1]-1,date[2]):null;},getDateFieldsByCellId:function(id){id=this.getIndexFromId(id);return(id>-1)?this.cellDates[id]:null;},getCellIndex:function(date){var idx=-1;if(date){var m=date.getMonth(),y=date.getFullYear(),d=date.getDate(),dates=this.cellDates;for(var i=0;i<dates.length;++i){var cellDate=dates[i];if(cellDate[0]===y&&cellDate[1]===m+1&&cellDate[2]===d){idx=i;break;}}}
return idx;},getIndexFromId:function(strId){var idx=-1,li=strId.lastIndexOf("_cell");if(li>-1){idx=parseInt(strId.substring(li+5),10);}
return idx;},renderOutOfBoundsDate:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},renderRowHeader:function(weekNum,html){html[html.length]='<th class="calrowhead">'+weekNum+'</th>';return html;},renderRowFooter:function(weekNum,html){html[html.length]='<th class="calrowfoot">'+weekNum+'</th>';return html;},renderCellDefault:function(workingDate,cell){cell.innerHTML='<a href="#" class="'+this.Style.CSS_CELL_SELECTOR+'">'+this.buildDayLabel(workingDate)+"</a>";},styleCellDefault:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},renderBodyCellRestricted:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL);Dom.addClass(cell,this.Style.CSS_CELL_RESTRICTED);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},addMonths:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.add(this.cfg.getProperty(cfgPageDate),DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();},subtractMonths:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.subtract(this.cfg.getProperty(cfgPageDate),DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();},addYears:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.add(this.cfg.getProperty(cfgPageDate),DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();},subtractYears:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.subtract(this.cfg.getProperty(cfgPageDate),DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.subtractMonths(1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.subtractYears(1);},reset:function(){this.cfg.resetProperty(DEF_CFG.SELECTED.key);this.cfg.resetProperty(DEF_CFG.PAGEDATE.key);this.resetEvent.fire();},clear:function(){this.cfg.setProperty(DEF_CFG.SELECTED.key,[]);this.cfg.setProperty(DEF_CFG.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(date){var aToBeSelected=this._toFieldArray(date),validDates=[],selected=[],cfgSelected=DEF_CFG.SELECTED.key;for(var a=0;a<aToBeSelected.length;++a){var toSelect=aToBeSelected[a];if(!this.isDateOOB(this._toDate(toSelect))){if(validDates.length===0){this.beforeSelectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toSelect);if(this._indexOfSelectedFieldArray(toSelect)==-1){selected[selected.length]=toSelect;}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.selectEvent.fire(validDates);}
return this.getSelectedDates();},selectCell:function(cellIndex){var cell=this.cells[cellIndex],cellDate=this.cellDates[cellIndex],dCellDate=this._toDate(cellDate),selectable=Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeSelectEvent.fire();var cfgSelected=DEF_CFG.SELECTED.key;var selected=this.cfg.getProperty(cfgSelected);var selectDate=cellDate.concat();if(this._indexOfSelectedFieldArray(selectDate)==-1){selected[selected.length]=selectDate;}
if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.renderCellStyleSelected(dCellDate,cell);this.selectEvent.fire([selectDate]);this.doCellMouseOut.call(cell,null,this);}
return this.getSelectedDates();},deselect:function(date){var aToBeDeselected=this._toFieldArray(date),validDates=[],selected=[],cfgSelected=DEF_CFG.SELECTED.key;for(var a=0;a<aToBeDeselected.length;++a){var toDeselect=aToBeDeselected[a];if(!this.isDateOOB(this._toDate(toDeselect))){if(validDates.length===0){this.beforeDeselectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toDeselect);var index=this._indexOfSelectedFieldArray(toDeselect);if(index!=-1){selected.splice(index,1);}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.deselectEvent.fire(validDates);}
return this.getSelectedDates();},deselectCell:function(cellIndex){var cell=this.cells[cellIndex],cellDate=this.cellDates[cellIndex],cellDateIndex=this._indexOfSelectedFieldArray(cellDate);var selectable=Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeDeselectEvent.fire();var selected=this.cfg.getProperty(DEF_CFG.SELECTED.key),dCellDate=this._toDate(cellDate),selectDate=cellDate.concat();if(cellDateIndex>-1){if(this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth()==dCellDate.getMonth()&&this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear()==dCellDate.getFullYear()){Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}
selected.splice(cellDateIndex,1);}
if(this.parent){this.parent.cfg.setProperty(DEF_CFG.SELECTED.key,selected);}else{this.cfg.setProperty(DEF_CFG.SELECTED.key,selected);}
this.deselectEvent.fire(selectDate);}
return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var cfgSelected=DEF_CFG.SELECTED.key,selected=this.cfg.getProperty(cfgSelected),count=selected.length,sel=selected.concat();if(this.parent){this.parent.cfg.setProperty(cfgSelected,[]);}else{this.cfg.setProperty(cfgSelected,[]);}
if(count>0){this.deselectEvent.fire(sel);}
return this.getSelectedDates();},_toFieldArray:function(date){var returnDate=[];if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(Lang.isString(date)){returnDate=this._parseDates(date);}else if(Lang.isArray(date)){for(var i=0;i<date.length;++i){var d=date[i];returnDate[returnDate.length]=[d.getFullYear(),d.getMonth()+1,d.getDate()];}}
return returnDate;},toDate:function(dateFieldArray){return this._toDate(dateFieldArray);},_toDate:function(dateFieldArray){if(dateFieldArray instanceof Date){return dateFieldArray;}else{return DateMath.getDate(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);}},_fieldArraysAreEqual:function(array1,array2){var match=false;if(array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]){match=true;}
return match;},_indexOfSelectedFieldArray:function(find){var selected=-1,seldates=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var s=0;s<seldates.length;++s){var sArray=seldates[s];if(find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]){selected=s;break;}}
return selected;},isDateOOM:function(date){return(date.getMonth()!=this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth());},isDateOOB:function(date){var minDate=this.cfg.getProperty(DEF_CFG.MINDATE.key),maxDate=this.cfg.getProperty(DEF_CFG.MAXDATE.key),dm=DateMath;if(minDate){minDate=dm.clearTime(minDate);}
if(maxDate){maxDate=dm.clearTime(maxDate);}
var clearedDate=new Date(date.getTime());clearedDate=dm.clearTime(clearedDate);return((minDate&&clearedDate.getTime()<minDate.getTime())||(maxDate&&clearedDate.getTime()>maxDate.getTime()));},_parsePageDate:function(date){var parsedDate;if(date){if(date instanceof Date){parsedDate=DateMath.findMonthStart(date);}else{var month,year,aMonthYear;aMonthYear=date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));month=parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key)-1],10)-1;year=parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key)-1],10);parsedDate=DateMath.getDate(year,month,1);}}else{parsedDate=DateMath.getDate(this.today.getFullYear(),this.today.getMonth(),1);}
return parsedDate;},onBeforeSelect:function(){if(this.cfg.getProperty(DEF_CFG.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}}},onSelect:function(selected){},onBeforeDeselect:function(){},onDeselect:function(deselected){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(sDate){var aDate=sDate.split(this.Locale.DATE_FIELD_DELIMITER),rArray;if(aDate.length==2){rArray=[aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];rArray.type=Calendar.MONTH_DAY;}else{rArray=[aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];rArray.type=Calendar.DATE;}
for(var i=0;i<rArray.length;i++){rArray[i]=parseInt(rArray[i],10);}
return rArray;},_parseDates:function(sDates){var aReturn=[],aDates=sDates.split(this.Locale.DATE_DELIMITER);for(var d=0;d<aDates.length;++d){var sDate=aDates[d];if(sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var aRange=sDate.split(this.Locale.DATE_RANGE_DELIMITER),dateStart=this._parseDate(aRange[0]),dateEnd=this._parseDate(aRange[1]),fullRange=this._parseRange(dateStart,dateEnd);aReturn=aReturn.concat(fullRange);}else{var aDate=this._parseDate(sDate);aReturn.push(aDate);}}
return aReturn;},_parseRange:function(startDate,endDate){var dCurrent=DateMath.add(DateMath.getDate(startDate[0],startDate[1]-1,startDate[2]),DateMath.DAY,1),dEnd=DateMath.getDate(endDate[0],endDate[1]-1,endDate[2]),results=[];results.push(startDate);while(dCurrent.getTime()<=dEnd.getTime()){results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);dCurrent=DateMath.add(dCurrent,DateMath.DAY,1);}
return results;},resetRenderers:function(){this.renderStack=this._renderStack.concat();},removeRenderers:function(){this._renderStack=[];this.renderStack=[];},clearElement:function(cell){cell.innerHTML="&#160;";cell.className="";},addRenderer:function(sDates,fnRender){var aDates=this._parseDates(sDates);for(var i=0;i<aDates.length;++i){var aDate=aDates[i];if(aDate.length==2){if(aDate[0]instanceof Array){this._addRenderer(Calendar.RANGE,aDate,fnRender);}else{this._addRenderer(Calendar.MONTH_DAY,aDate,fnRender);}}else if(aDate.length==3){this._addRenderer(Calendar.DATE,aDate,fnRender);}}},_addRenderer:function(type,aDates,fnRender){var add=[type,aDates,fnRender];this.renderStack.unshift(add);this._renderStack=this.renderStack.concat();},addMonthRenderer:function(month,fnRender){this._addRenderer(Calendar.MONTH,[month],fnRender);},addWeekdayRenderer:function(weekday,fnRender){this._addRenderer(Calendar.WEEKDAY,[weekday],fnRender);},clearAllBodyCellStyles:function(style){for(var c=0;c<this.cells.length;++c){Dom.removeClass(this.cells[c],style);}},setMonth:function(month){var cfgPageDate=DEF_CFG.PAGEDATE.key,current=this.cfg.getProperty(cfgPageDate);current.setMonth(parseInt(month,10));this.cfg.setProperty(cfgPageDate,current);},setYear:function(year){var cfgPageDate=DEF_CFG.PAGEDATE.key,current=this.cfg.getProperty(cfgPageDate);current.setFullYear(parseInt(year,10));this.cfg.setProperty(cfgPageDate,current);},getSelectedDates:function(){var returnDates=[],selected=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;},hide:function(){if(this.beforeHideEvent.fire()){this.oDomContainer.style.display="none";this.hideEvent.fire();}},show:function(){if(this.beforeShowEvent.fire()){this.oDomContainer.style.display="block";this.showEvent.fire();}},browser:(function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}})(),toString:function(){return"Calendar "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var cal=this;if(cal.navigator){cal.navigator.destroy();}
if(cal.cfg){cal.cfg.destroy();}
Event.purgeElement(cal.oDomContainer,true);Dom.removeClass(cal.oDomContainer,"withtitle");Dom.removeClass(cal.oDomContainer,cal.Style.CSS_CONTAINER);Dom.removeClass(cal.oDomContainer,cal.Style.CSS_SINGLE);cal.oDomContainer.innerHTML="";cal.oDomContainer=null;cal.cells=null;this.destroyEvent.fire();}}};YAHOO.widget.Calendar=Calendar;YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;})();(function(){var Dom=YAHOO.util.Dom,DateMath=YAHOO.widget.DateMath,Event=YAHOO.util.Event,Lang=YAHOO.lang,Calendar=YAHOO.widget.Calendar;function CalendarGroup(id,containerId,config){if(arguments.length>0){this.init.apply(this,arguments);}}
CalendarGroup._DEFAULT_CONFIG=Calendar._DEFAULT_CONFIG;CalendarGroup._DEFAULT_CONFIG.PAGES={key:"pages",value:2};var DEF_CFG=CalendarGroup._DEFAULT_CONFIG;CalendarGroup.prototype={init:function(id,container,config){var nArgs=this._parseArgs(arguments);id=nArgs.id;container=nArgs.container;config=nArgs.config;this.oDomContainer=Dom.get(container);if(!this.oDomContainer.id){this.oDomContainer.id=Dom.generateId();}
if(!id){id=this.oDomContainer.id+"_t";}
this.id=id;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];Dom.addClass(this.oDomContainer,CalendarGroup.CSS_CONTAINER);Dom.addClass(this.oDomContainer,CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var cfg=this.cfg;cfg.addProperty(DEF_CFG.PAGES.key,{value:DEF_CFG.PAGES.value,validator:cfg.checkNumber,handler:this.configPages});cfg.addProperty(DEF_CFG.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});cfg.addProperty(DEF_CFG.SELECTED.key,{value:[],handler:this.configSelected});cfg.addProperty(DEF_CFG.TITLE.key,{value:DEF_CFG.TITLE.value,handler:this.configTitle});cfg.addProperty(DEF_CFG.CLOSE.key,{value:DEF_CFG.CLOSE.value,handler:this.configClose});cfg.addProperty(DEF_CFG.IFRAME.key,{value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.MINDATE.key,{value:DEF_CFG.MINDATE.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MAXDATE.key,{value:DEF_CFG.MAXDATE.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MULTI_SELECT.key,{value:DEF_CFG.MULTI_SELECT.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.START_WEEKDAY.key,{value:DEF_CFG.START_WEEKDAY.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key,{value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key,{value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key,{value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MONTHS_SHORT.key,{value:DEF_CFG.MONTHS_SHORT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MONTHS_LONG.key,{value:DEF_CFG.MONTHS_LONG.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key,{value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key,{value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key,{value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key,{value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key,{value:DEF_CFG.LOCALE_MONTHS.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key,{value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_DELIMITER.key,{value:DEF_CFG.DATE_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key,{value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key,{value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key,{value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key,{value:DEF_CFG.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key,{value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key,{value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key,{value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key,{value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key,{value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key,{value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key,{value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.NAV.key,{value:DEF_CFG.NAV.value,handler:this.configNavigator});cfg.addProperty(DEF_CFG.STRINGS.key,{value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val){return Lang.isObject(val);},supercedes:DEF_CFG.STRINGS.supercedes});},initEvents:function(){var me=this,strEvent="Event",CE=YAHOO.util.CustomEvent;var sub=function(fn,obj,bOverride){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].subscribe(fn,obj,bOverride);}};var unsub=function(fn,obj){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].unsubscribe(fn,obj);}};var defEvents=Calendar._EVENT_TYPES;me.beforeSelectEvent=new CE(defEvents.BEFORE_SELECT);me.beforeSelectEvent.subscribe=sub;me.beforeSelectEvent.unsubscribe=unsub;me.selectEvent=new CE(defEvents.SELECT);me.selectEvent.subscribe=sub;me.selectEvent.unsubscribe=unsub;me.beforeDeselectEvent=new CE(defEvents.BEFORE_DESELECT);me.beforeDeselectEvent.subscribe=sub;me.beforeDeselectEvent.unsubscribe=unsub;me.deselectEvent=new CE(defEvents.DESELECT);me.deselectEvent.subscribe=sub;me.deselectEvent.unsubscribe=unsub;me.changePageEvent=new CE(defEvents.CHANGE_PAGE);me.changePageEvent.subscribe=sub;me.changePageEvent.unsubscribe=unsub;me.beforeRenderEvent=new CE(defEvents.BEFORE_RENDER);me.beforeRenderEvent.subscribe=sub;me.beforeRenderEvent.unsubscribe=unsub;me.renderEvent=new CE(defEvents.RENDER);me.renderEvent.subscribe=sub;me.renderEvent.unsubscribe=unsub;me.resetEvent=new CE(defEvents.RESET);me.resetEvent.subscribe=sub;me.resetEvent.unsubscribe=unsub;me.clearEvent=new CE(defEvents.CLEAR);me.clearEvent.subscribe=sub;me.clearEvent.unsubscribe=unsub;me.beforeShowEvent=new CE(defEvents.BEFORE_SHOW);me.showEvent=new CE(defEvents.SHOW);me.beforeHideEvent=new CE(defEvents.BEFORE_HIDE);me.hideEvent=new CE(defEvents.HIDE);me.beforeShowNavEvent=new CE(defEvents.BEFORE_SHOW_NAV);me.showNavEvent=new CE(defEvents.SHOW_NAV);me.beforeHideNavEvent=new CE(defEvents.BEFORE_HIDE_NAV);me.hideNavEvent=new CE(defEvents.HIDE_NAV);me.beforeRenderNavEvent=new CE(defEvents.BEFORE_RENDER_NAV);me.renderNavEvent=new CE(defEvents.RENDER_NAV);me.beforeDestroyEvent=new CE(defEvents.BEFORE_DESTROY);me.destroyEvent=new CE(defEvents.DESTROY);},configPages:function(type,args,obj){var pageCount=args[0],cfgPageDate=DEF_CFG.PAGEDATE.key,sep="_",groupCalClass="groupcal",firstClass="first-of-type",lastClass="last-of-type";for(var p=0;p<pageCount;++p){var calId=this.id+sep+p,calContainerId=this.containerId+sep+p,childConfig=this.cfg.getConfig();childConfig.close=false;childConfig.title=false;childConfig.navigator=null;var cal=this.constructChild(calId,calContainerId,childConfig);var caldate=cal.cfg.getProperty(cfgPageDate);this._setMonthOnDate(caldate,caldate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,caldate);Dom.removeClass(cal.oDomContainer,this.Style.CSS_SINGLE);Dom.addClass(cal.oDomContainer,groupCalClass);if(p===0){Dom.addClass(cal.oDomContainer,firstClass);}
if(p==(pageCount-1)){Dom.addClass(cal.oDomContainer,lastClass);}
cal.parent=this;cal.index=p;this.pages[this.pages.length]=cal;}},configPageDate:function(type,args,obj){var val=args[0],firstPageDate;var cfgPageDate=DEF_CFG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];if(p===0){firstPageDate=cal._parsePageDate(val);cal.cfg.setProperty(cfgPageDate,firstPageDate);}else{var pageDate=new Date(firstPageDate);this._setMonthOnDate(pageDate,pageDate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,pageDate);}}},configSelected:function(type,args,obj){var cfgSelected=DEF_CFG.SELECTED.key;this.delegateConfig(type,args,obj);var selected=(this.pages.length>0)?this.pages[0].cfg.getProperty(cfgSelected):[];this.cfg.setProperty(cfgSelected,selected,true);},delegateConfig:function(type,args,obj){var val=args[0];var cal;for(var p=0;p<this.pages.length;p++){cal=this.pages[p];cal.cfg.setProperty(type,val);}},setChildFunction:function(fnName,fn){var pageCount=this.cfg.getProperty(DEF_CFG.PAGES.key);for(var p=0;p<pageCount;++p){this.pages[p][fnName]=fn;}},callChildFunction:function(fnName,args){var pageCount=this.cfg.getProperty(DEF_CFG.PAGES.key);for(var p=0;p<pageCount;++p){var page=this.pages[p];if(page[fnName]){var fn=page[fnName];fn.call(page,args);}}},constructChild:function(id,containerId,config){var container=document.getElementById(containerId);if(!container){container=document.createElement("div");container.id=containerId;this.oDomContainer.appendChild(container);}
return new Calendar(id,containerId,config);},setMonth:function(month){month=parseInt(month,10);var currYear;var cfgPageDate=DEF_CFG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if(p===0){currYear=pageDate.getFullYear();}else{pageDate.setFullYear(currYear);}
this._setMonthOnDate(pageDate,month+p);cal.cfg.setProperty(cfgPageDate,pageDate);}},setYear:function(year){var cfgPageDate=DEF_CFG.PAGEDATE.key;year=parseInt(year,10);for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if((pageDate.getMonth()+1)==1&&p>0){year+=1;}
cal.setYear(year);}},render:function(){this.renderHeader();for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.render();}
this.renderFooter();},select:function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.select(date);}
return this.getSelectedDates();},selectCell:function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.selectCell(cellIndex);}
return this.getSelectedDates();},deselect:function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselect(date);}
return this.getSelectedDates();},deselectAll:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectAll();}
return this.getSelectedDates();},deselectCell:function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectCell(cellIndex);}
return this.getSelectedDates();},reset:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.reset();}},clear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.clear();}
this.cfg.setProperty(DEF_CFG.SELECTED.key,[]);this.cfg.setProperty(DEF_CFG.PAGEDATE.key,new Date(this.pages[0].today.getTime()));this.render();},nextMonth:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextMonth();}},previousMonth:function(){for(var p=this.pages.length-1;p>=0;--p){var cal=this.pages[p];cal.previousMonth();}},nextYear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextYear();}},previousYear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.previousYear();}},getSelectedDates:function(){var returnDates=[];var selected=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;},addRenderer:function(sDates,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addRenderer(sDates,fnRender);}},addMonthRenderer:function(month,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addMonthRenderer(month,fnRender);}},addWeekdayRenderer:function(weekday,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addWeekdayRenderer(weekday,fnRender);}},removeRenderers:function(){this.callChildFunction("removeRenderers");},renderHeader:function(){},renderFooter:function(){},addMonths:function(count){this.callChildFunction("addMonths",count);},subtractMonths:function(count){this.callChildFunction("subtractMonths",count);},addYears:function(count){this.callChildFunction("addYears",count);},subtractYears:function(count){this.callChildFunction("subtractYears",count);},getCalendarPage:function(date){var cal=null;if(date){var y=date.getFullYear(),m=date.getMonth();var pages=this.pages;for(var i=0;i<pages.length;++i){var pageDate=pages[i].cfg.getProperty("pagedate");if(pageDate.getFullYear()===y&&pageDate.getMonth()===m){cal=pages[i];break;}}}
return cal;},_setMonthOnDate:function(date,iMonth){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(iMonth<0||iMonth>11)){var newDate=DateMath.add(date,DateMath.MONTH,iMonth-date.getMonth());date.setTime(newDate.getTime());}else{date.setMonth(iMonth);}},_fixWidth:function(){var w=0;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];w+=cal.oDomContainer.offsetWidth;}
if(w>0){this.oDomContainer.style.width=w+"px";}},toString:function(){return"CalendarGroup "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var cal=this;if(cal.navigator){cal.navigator.destroy();}
if(cal.cfg){cal.cfg.destroy();}
Event.purgeElement(cal.oDomContainer,true);Dom.removeClass(cal.oDomContainer,CalendarGroup.CSS_CONTAINER);Dom.removeClass(cal.oDomContainer,CalendarGroup.CSS_MULTI_UP);for(var i=0,l=cal.pages.length;i<l;i++){cal.pages[i].destroy();cal.pages[i]=null;}
cal.oDomContainer.innerHTML="";cal.oDomContainer=null;this.destroyEvent.fire();}}};CalendarGroup.CSS_CONTAINER="yui-calcontainer";CalendarGroup.CSS_MULTI_UP="multi";CalendarGroup.CSS_2UPTITLE="title";CalendarGroup.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(CalendarGroup,Calendar,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","configStrings","configNavigator","createTitleBar","createCloseButton","removeTitleBar","removeCloseButton","hide","show","toDate","_toDate","_parseArgs","browser");YAHOO.widget.CalGrp=CalendarGroup;YAHOO.widget.CalendarGroup=CalendarGroup;YAHOO.widget.Calendar2up=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.extend(YAHOO.widget.Calendar2up,CalendarGroup);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;})();YAHOO.widget.CalendarNavigator=function(cal){this.init(cal);};(function(){var CN=YAHOO.widget.CalendarNavigator;CN.CLASSES={NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};CN._DEFAULT_CFG={strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};CN.ID_SUFFIX="_nav";CN.MONTH_SUFFIX="_month";CN.YEAR_SUFFIX="_year";CN.ERROR_SUFFIX="_error";CN.CANCEL_SUFFIX="_cancel";CN.SUBMIT_SUFFIX="_submit";CN.YR_MAX_DIGITS=4;CN.YR_MINOR_INC=1;CN.YR_MAJOR_INC=10;CN.UPDATE_DELAY=50;CN.YR_PATTERN=/^\d+$/;CN.TRIM=/^\s*(.*?)\s*$/;})();YAHOO.widget.CalendarNavigator.prototype={id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(cal){var calBox=cal.oDomContainer;this.cal=cal;this.id=calBox.id+YAHOO.widget.CalendarNavigator.ID_SUFFIX;this._doc=calBox.ownerDocument;var ie=YAHOO.env.ua.ie;this.__isIEQuirks=(ie&&((ie<=6)||(ie===7&&this._doc.compatMode=="BackCompat")));},show:function(){var CLASSES=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeShowNavEvent.fire()){if(!this.__rendered){this.render();}
this.clearErrors();this._updateMonthUI();this._updateYearUI();this._show(this.navEl,true);this.setInitialFocus();this.showMask();YAHOO.util.Dom.addClass(this.cal.oDomContainer,CLASSES.NAV_VISIBLE);this.cal.showNavEvent.fire();}},hide:function(){var CLASSES=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeHideNavEvent.fire()){this._show(this.navEl,false);this.hideMask();YAHOO.util.Dom.removeClass(this.cal.oDomContainer,CLASSES.NAV_VISIBLE);this.cal.hideNavEvent.fire();}},showMask:function(){this._show(this.maskEl,true);if(this.__isIEQuirks){this._syncMask();}},hideMask:function(){this._show(this.maskEl,false);},getMonth:function(){return this._month;},getYear:function(){return this._year;},setMonth:function(nMonth){if(nMonth>=0&&nMonth<12){this._month=nMonth;}
this._updateMonthUI();},setYear:function(nYear){var yrPattern=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(nYear)&&yrPattern.test(nYear+"")){this._year=nYear;}
this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}
this.cal.renderNavEvent.fire();},createNav:function(){var NAV=YAHOO.widget.CalendarNavigator;var doc=this._doc;var d=doc.createElement("div");d.className=NAV.CLASSES.NAV;var htmlBuf=this.renderNavContents([]);d.innerHTML=htmlBuf.join('');this.cal.oDomContainer.appendChild(d);this.navEl=d;this.yearEl=doc.getElementById(this.id+NAV.YEAR_SUFFIX);this.monthEl=doc.getElementById(this.id+NAV.MONTH_SUFFIX);this.errorEl=doc.getElementById(this.id+NAV.ERROR_SUFFIX);this.submitEl=doc.getElementById(this.id+NAV.SUBMIT_SUFFIX);this.cancelEl=doc.getElementById(this.id+NAV.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}
this._setFirstLastElements();},createMask:function(){var C=YAHOO.widget.CalendarNavigator.CLASSES;var d=this._doc.createElement("div");d.className=C.MASK;this.cal.oDomContainer.appendChild(d);this.maskEl=d;},_syncMask:function(){var c=this.cal.oDomContainer;if(c&&this.maskEl){var r=YAHOO.util.Dom.getRegion(c);YAHOO.util.Dom.setStyle(this.maskEl,"width",r.right-r.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",r.bottom-r.top+"px");}},renderNavContents:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES,h=html;h[h.length]='<div class="'+C.MONTH+'">';this.renderMonth(h);h[h.length]='</div>';h[h.length]='<div class="'+C.YEAR+'">';this.renderYear(h);h[h.length]='</div>';h[h.length]='<div class="'+C.BUTTONS+'">';this.renderButtons(h);h[h.length]='</div>';h[h.length]='<div class="'+C.ERROR+'" id="'+this.id+NAV.ERROR_SUFFIX+'"></div>';return h;},renderMonth:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES;var id=this.id+NAV.MONTH_SUFFIX,mf=this.__getCfg("monthFormat"),months=this.cal.cfg.getProperty((mf==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),h=html;if(months&&months.length>0){h[h.length]='<label for="'+id+'">';h[h.length]=this.__getCfg("month",true);h[h.length]='</label>';h[h.length]='<select name="'+id+'" id="'+id+'" class="'+C.MONTH_CTRL+'">';for(var i=0;i<months.length;i++){h[h.length]='<option value="'+i+'">';h[h.length]=months[i];h[h.length]='</option>';}
h[h.length]='</select>';}
return h;},renderYear:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES;var id=this.id+NAV.YEAR_SUFFIX,size=NAV.YR_MAX_DIGITS,h=html;h[h.length]='<label for="'+id+'">';h[h.length]=this.__getCfg("year",true);h[h.length]='</label>';h[h.length]='<input type="text" name="'+id+'" id="'+id+'" class="'+C.YEAR_CTRL+'" maxlength="'+size+'"/>';return h;},renderButtons:function(html){var C=YAHOO.widget.CalendarNavigator.CLASSES;var h=html;h[h.length]='<span class="'+C.BUTTON+' '+C.DEFAULT+'">';h[h.length]='<button type="button" id="'+this.id+'_submit'+'">';h[h.length]=this.__getCfg("submit",true);h[h.length]='</button>';h[h.length]='</span>';h[h.length]='<span class="'+C.BUTTON+'">';h[h.length]='<button type="button" id="'+this.id+'_cancel'+'">';h[h.length]=this.__getCfg("cancel",true);h[h.length]='</button>';h[h.length]='</span>';return h;},applyListeners:function(){var E=YAHOO.util.Event;function yearUpdateHandler(){if(this.validate()){this.setYear(this._getYearFromUI());}}
function monthUpdateHandler(){this.setMonth(this._getMonthFromUI());}
E.on(this.submitEl,"click",this.submit,this,true);E.on(this.cancelEl,"click",this.cancel,this,true);E.on(this.yearEl,"blur",yearUpdateHandler,this,true);E.on(this.monthEl,"change",monthUpdateHandler,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}
this.applyKeyListeners();},purgeListeners:function(){var E=YAHOO.util.Event;E.removeListener(this.submitEl,"click",this.submit);E.removeListener(this.cancelEl,"click",this.cancel);E.removeListener(this.yearEl,"blur");E.removeListener(this.monthEl,"change");if(this.__isIEQuirks){E.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}
this.purgeKeyListeners();},applyKeyListeners:function(){var E=YAHOO.util.Event,ua=YAHOO.env.ua;var arrowEvt=(ua.ie||ua.webkit)?"keydown":"keypress";var tabEvt=(ua.ie||ua.opera||ua.webkit)?"keydown":"keypress";E.on(this.yearEl,"keypress",this._handleEnterKey,this,true);E.on(this.yearEl,arrowEvt,this._handleDirectionKeys,this,true);E.on(this.lastCtrl,tabEvt,this._handleTabKey,this,true);E.on(this.firstCtrl,tabEvt,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var E=YAHOO.util.Event,ua=YAHOO.env.ua;var arrowEvt=(ua.ie||ua.webkit)?"keydown":"keypress";var tabEvt=(ua.ie||ua.opera||ua.webkit)?"keydown":"keypress";E.removeListener(this.yearEl,"keypress",this._handleEnterKey);E.removeListener(this.yearEl,arrowEvt,this._handleDirectionKeys);E.removeListener(this.lastCtrl,tabEvt,this._handleTabKey);E.removeListener(this.firstCtrl,tabEvt,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var cal=this.cal;var delay=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(delay>0){var nav=this;window.setTimeout(function(){nav._update(cal);},delay);}else{this._update(cal);}}},_update:function(cal){cal.setYear(this.getYear());cal.setMonth(this.getMonth());cal.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(msg){if(this.errorEl){this.errorEl.innerHTML=msg;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var el=this.submitEl,f=this.__getCfg("initialFocus");if(f&&f.toLowerCase){f=f.toLowerCase();if(f=="year"){el=this.yearEl;try{this.yearEl.select();}catch(selErr){}}else if(f=="month"){el=this.monthEl;}}
if(el&&YAHOO.lang.isFunction(el.focus)){try{el.focus();}catch(focusErr){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}
var p=this.navEl.parentNode;if(p){p.removeChild(this.navEl);}
this.navEl=null;var pm=this.maskEl.parentNode;if(pm){pm.removeChild(this.maskEl);}
this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(el,bShow){if(el){YAHOO.util.Dom.setStyle(el,"display",(bShow)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var NAV=YAHOO.widget.CalendarNavigator;var yr=null;if(this.yearEl){var value=this.yearEl.value;value=value.replace(NAV.TRIM,"$1");if(NAV.YR_PATTERN.test(value)){yr=parseInt(value,10);}}
return yr;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}
if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(e){var KEYS=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(e)==KEYS.ENTER){YAHOO.util.Event.preventDefault(e);this.submit();}},_handleDirectionKeys:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY,NAV=YAHOO.widget.CalendarNavigator;var value=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(value)){var dir=false;switch(E.getCharCode(e)){case KEYS.UP:this.yearEl.value=value+NAV.YR_MINOR_INC;dir=true;break;case KEYS.DOWN:this.yearEl.value=Math.max(value-NAV.YR_MINOR_INC,0);dir=true;break;case KEYS.PAGE_UP:this.yearEl.value=value+NAV.YR_MAJOR_INC;dir=true;break;case KEYS.PAGE_DOWN:this.yearEl.value=Math.max(value-NAV.YR_MAJOR_INC,0);dir=true;break;default:break;}
if(dir){E.preventDefault(e);try{this.yearEl.select();}catch(err){}}}},_handleTabKey:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY;if(E.getCharCode(e)==KEYS.TAB&&!e.shiftKey){try{E.preventDefault(e);this.firstCtrl.focus();}catch(err){}}},_handleShiftTabKey:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY;if(e.shiftKey&&E.getCharCode(e)==KEYS.TAB){try{E.preventDefault(e);this.lastCtrl.focus();}catch(err){}}},__getCfg:function(prop,bIsStr){var DEF_CFG=YAHOO.widget.CalendarNavigator._DEFAULT_CFG;var cfg=this.cal.cfg.getProperty("navigator");if(bIsStr){return(cfg!==true&&cfg.strings&&cfg.strings[prop])?cfg.strings[prop]:DEF_CFG.strings[prop];}else{return(cfg!==true&&cfg[prop])?cfg[prop]:DEF_CFG[prop];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.Calendar","CERNY.dom.Element","CERNY.text.DateFormat","CERNY.js.Date","TOPINCS.widgets.DICT","TOPINCS.widgets.util","YAHOO.widget.Calendar");(function(){TOPINCS.widgets.Calendar=Calendar;var method=CERNY.method;var signature=CERNY.signature;var TimezoneSelect=TOPINCS.widgets.util.TimezoneSelect;var DICT=TOPINCS.widgets.DICT;var localizedMonthNames=[];for(var i=1;i<13;i++){localizedMonthNames.push(DICT["lab_month_"+i]);}
YAHOO.widget.Calendar._DEFAULT_CONFIG.MONTHS_LONG={key:"months_long",value:localizedMonthNames}
var localizedWeekdayNames=[DICT.lab_weekday_short_7];for(var i=1;i<7;i++){localizedWeekdayNames.push(DICT["lab_weekday_short_"+i]);}
YAHOO.widget.Calendar._DEFAULT_CONFIG.WEEKDAYS_SHORT={key:"weekdays_short",value:localizedWeekdayNames}
function Calendar(locale,id,container,config,timezone){if(id){this.locale=locale;document.body.appendChild(container.node);YAHOO.widget.Calendar.call(this,id,container.node.id,config);this.el=new CERNY.dom.Element(this.oDomContainer);document.body.removeChild(container.node);if(timezone){this.timezoneSelect=new TimezoneSelect();}}}
CERNY.inherit(TOPINCS.widgets.Calendar,YAHOO.widget.Calendar);TOPINCS.widgets.Calendar.prototype.logger=CERNY.Logger("TOPINCS.widgets.Calendar");function setValue(date){this.cfg.setProperty("selected",date.format(CERNY.text.DateFormat.US));var pageDate=(date.getMonth()+1)+"/"+date.getFullYear();this.cfg.setProperty("pagedate",pageDate);if(this.timezoneSelect){var timezoneOffset=CERNY.js.Date.getTimezoneOffset(date);if(timezoneOffset===null){timezoneOffset=TimezoneSelect.NO_VALUE;}
this.timezoneSelect.el.node.value=timezoneOffset;}}
signature(setValue,"undefined",Date);method(Calendar.prototype,"setValue",setValue);function getValue(){var date=this.getSelectedDates()[0];if(this.timezoneSelect){if(this.timezoneSelect.el.node.value==TimezoneSelect.NO_VALUE){CERNY.js.Date.setTimezoneOffset(date,null);}else{CERNY.js.Date.setTimezoneOffset(date,Number(this.timezoneSelect.el.node.value));}}
return date;}
signature(getValue,Date);method(Calendar.prototype,"getValue",getValue);function addChangeListener(f){this.selectEvent.subscribe(f,this,true);if(this.timezoneSelect){this.timezoneSelect.el.addEvtListener("change",f);}}
method(Calendar.prototype,"addChangeListener",addChangeListener);function render(){YAHOO.widget.Calendar.prototype.render.call(this);if(this.timezoneSelect){this.el.appendChild(this.timezoneSelect.el);}}
method(Calendar.prototype,"render",render);})();CERNY.require("TOPINCS.widgets.CalendarTime","TOPINCS.widgets.Calendar","CERNY.js.Date","TOPINCS.widgets.Time");(function(){TOPINCS.widgets.CalendarTime=CalendarTime;var Calendar=TOPINCS.widgets.Calendar;var Time=TOPINCS.widgets.Time;var method=CERNY.method;var signature=CERNY.signature;function CalendarTime(locale,id,container){this.container=container;Calendar.apply(this,arguments);this.time=new Time(locale);this.timeEl=this.time.render();}
CERNY.inherit(TOPINCS.widgets.CalendarTime,TOPINCS.widgets.Calendar);TOPINCS.widgets.CalendarTime.prototype.logger=CERNY.Logger("TOPINCS.widgets.CalendarTime");function setValue(date){Calendar.prototype.setValue.call(this,date);this.time.setValue(date);}
signature(setValue,"undefined",Date);method(CalendarTime.prototype,"setValue",setValue);function getValue(){var value=this.getSelectedDates()[0];var time=this.time.getValue();value.setHours(time.getHours());value.setMinutes(time.getMinutes());value.setSeconds(time.getSeconds());CERNY.js.Date.setTimezoneOffset(value,CERNY.js.Date.getTimezoneOffset(time));return value;}
signature(getValue,Date);method(CalendarTime.prototype,"getValue",getValue);function render(){Calendar.prototype.render.call(this);this.container.appendChild(this.timeEl);}
method(CalendarTime.prototype,"render",render);function addChangeListener(f){this.selectEvent.subscribe(f,this,true);this.time.addChangeListener(f);}
method(CalendarTime.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.ValueEditor","TOPINCS.widgets.ValueViewer","TOPINCS.widgets.OkCancelPopUp","TOPINCS.widgets.Icon","TOPINCS.widgets.LinkIcon","TOPINCS.widgets.DateInput","TOPINCS.widgets.DecimalInput","TOPINCS.widgets.TimeInput","TOPINCS.widgets.Time","TOPINCS.widgets.DateTimeInput","TOPINCS.widgets.TopicSelector","TOPINCS.widgets.ListEditor","TOPINCS.widgets.IncompleteListException","TOPINCS.widgets.ValueSpaceEditor","TOPINCS.cons","TOPINCS.widgets.DICT","CERNY.text.DateFormat","CERNY.text.NumberFormat","CERNY.text.TimeFormat","CERNY.text.TimezoneFormat","CERNY.event.Observable","TOPINCS.widgets.Calendar","TOPINCS.widgets.CalendarTime","CERNY.js.Date","CERNY.util","TOPINCS.util","TOPINCS.tmdm.TopicReference","JSON","CERNY.dom.Element");(function(){var Calendar=TOPINCS.widgets.Calendar;var CalendarTime=TOPINCS.widgets.CalendarTime;var DateInput=TOPINCS.widgets.DateInput;var DecimalInput=TOPINCS.widgets.DecimalInput;var DateTimeInput=TOPINCS.widgets.DateTimeInput;var DICT=TOPINCS.widgets.DICT;var Element=CERNY.dom.Element;var Icon=TOPINCS.widgets.Icon;var ListEditor=TOPINCS.widgets.ListEditor;var Logger=CERNY.Logger;var Observable=CERNY.event.Observable;var OkCancelPopUp=TOPINCS.widgets.OkCancelPopUp;var TimeInput=TOPINCS.widgets.TimeInput;var Time=TOPINCS.widgets.Time;var TopicSelector=TOPINCS.widgets.TopicSelector;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var joinFunctions=CERNY.joinFunctions;var require=CERNY.require;var adjustNewline=TOPINCS.util.adjustNewline;TOPINCS.widgets.ValueEditor=ValueEditor;var name="TOPINCS.widgets.ValueEditor";var logger=Logger(name);var EVT_USER_INPUT=name+".userInput";var EVT_BLUR=name+".blur";var EVT_FOCUS=name+".focus";var NUMBER_ROWS="7";var POPUP=new OkCancelPopUp({positionX:TOPINCS.widgets.PopUp.LEFT,draggable:false});function ValueEditor(value,datatype,locale,misc){misc=misc||{};var editor;if(misc.valueSpace){editor=new TOPINCS.widgets.ValueSpaceEditor(value,datatype,misc.valueSpace);editor.el.addEvtListener("change",function(){editor.notify(EVT_USER_INPUT);});}else{var cons=ValueEditor[datatype];if(!cons){cons=ValueEditor._default;}
editor=new cons(value,locale,misc);}
editor.el.addCSSClass("value-editor");Observable(editor);return editor;}
ValueEditor.prototype.logger=logger;ValueEditor.EVT_USER_INPUT=EVT_USER_INPUT;ValueEditor.EVT_BLUR=EVT_BLUR;ValueEditor.EVT_FOCUS=EVT_FOCUS;ValueEditor.LABEL_SHRINK_ENLARGE=DICT.lab_shrink_enlarge;ValueEditor.LABEL_HELP=DICT.lab_help;ValueEditor.POPUP=POPUP;function init(t,value,locale){t.value=value;t.intialValue=value;t.locale=locale;}
function setDeactivation(t,value){var el=t.el;var formFields=el.getDescendants(isFormField);if(isFormField(el.node)){formFields.push(el.node);}
formFields.map(function(input){input.disabled=value;input.readonly=value;});}
function deactivate(){setDeactivation(this,1);}
function activate(){setDeactivation(this,0);}
(function(){ValueEditor._default=InputEditor;function InputEditor(value,locale){init(this,value,locale);this.el=Element.create("input");var t=this;function update(e){t.notify(EVT_USER_INPUT);}
this.el.addEvtListener("keyup",update);this.el.addEvtListener("blur",update);this.el.addEvtListener("blur",function(){t.notify(EVT_BLUR);});this.el.addEvtListener("focus",function(){t.notify(EVT_FOCUS);});}
InputEditor.prototype.logger=Logger("TOPINCS.widgets.InputEditor");method(InputEditor.prototype,"deactivate",deactivate);method(InputEditor.prototype,"activate",activate);function getValue(){return this.el.node.value;}
signature(getValue,"string");method(InputEditor.prototype,"getValue",getValue);method(InputEditor.prototype,"getInput",getValue);function render(){this.el.setAttr("value",this.value);return this.el;}
method(InputEditor.prototype,"render",render);function focus(){return this.el.focus();}
method(InputEditor.prototype,"focus",focus);})();(function(){ValueEditor[DT_STRING]=TextEditor;ValueEditor[DT_ANYTYPE]=TextEditor;var EVT_MUTLILINE="multiline";var EVT_NOT_MULTILINE="not-multiline";var isMultiline=TOPINCS.util.isMultiline;function TextEditor(value,locale){init(this,value,locale);this.el=Element.create("span",null,"class=texteditor");this.smallEl=Element.create("input");this.bigEl=Element.create("textarea",null,"rows="+NUMBER_ROWS);var multiline=isMultiline(value);this.icon=new Icon(ValueEditor.LABEL_SHRINK_ENLARGE,"shrinkenlarge",!multiline);this.small=!multiline;if(this.small&&value.length>100){this.small=false;}
var t=this;this.blurNotifier=function()