
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.2.0beta(10342)/.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 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_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_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.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));if(timezoneFormat){dateStr+=separator+timezoneFormat.format(CERNY.js.Date.getTimezoneOffset(this));}
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);if(timezoneFormat){result+=separator+timezoneFormat.format(CERNY.js.Date.getTimezoneOffset(this));}
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){return getFirstMatch(str.match(/Z|[+-][0-9][0-9]:[0-9][0-9]/));}
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(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=="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.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":{date:CERNY.text.DateFormat.DE,time:CERNY.text.TimeFormat.DE1,timeShort:CERNY.text.TimeFormat.DE2,timezone:CERNY.text.TimezoneFormat.ISO},"DE":{date:CERNY.text.DateFormat.DE,time:CERNY.text.TimeFormat.DE1,timeShort:CERNY.text.TimeFormat.DE2,timezone:CERNY.text.TimezoneFormat.ISO},"US":{date:CERNY.text.DateFormat.US,time:CERNY.text.TimeFormat.US1,timeShort:CERNY.text.TimeFormat.US2,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");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 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 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;}})();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");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);}}
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,forceGrouping){if(!isBoolean(forceGrouping)){forceGrouping=true;}
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);}
var selectEl=Element.create("select",null,"multiple=multiple","size="+size);select.map(function(group){var optionParentEl=selectEl;if(select.length>1||forceGrouping){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(selectEl,func){if(!isFunction(func)){func=function(option){return option.id;};}
var options=selectEl.node.options;var result=[];var i=options.length;while(i--){if(options[i].selected){result.push(func(options[i]));}}
return result;}
signature(getSelectedOptions,Array,Element);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(){logger.debug("1");Exception.call(this,"msg_main_topic_not_found",[]);logger.debug("2");}
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 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 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;}})();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.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;}
(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){logger.debug("e: "+CERNY.dump(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){logger.debug("e: "+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 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.2.0beta(10342)/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&&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);})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Widget=YAHOO.widget;YAHOO.widget.TreeView=function(id,oConfig){if(id){this.init(id);}
if(oConfig){if(!Lang.isArray(oConfig)){oConfig=[oConfig];}
this.buildTreeFromObject(oConfig);}else if(this._el&&Lang.trim(this._el.innerHTML)){this.buildTreeFromMarkup(id);}};var TV=Widget.TreeView;TV.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,_hasDblClickSubscriber:false,_dblClickTimer:null,setExpandAnim:function(type){this._expandAnim=(Widget.TVAnim.isValid(type))?type:null;},setCollapseAnim:function(type){this._collapseAnim=(Widget.TVAnim.isValid(type))?type:null;},animateExpand:function(el,node){if(this._expandAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._expandAnim,el,function(){tree.expandComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"expand"});a.animate();}
return true;}
return false;},animateCollapse:function(el,node){if(this._collapseAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._collapseAnim,el,function(){tree.collapseComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"collapse"});a.animate();}
return true;}
return false;},expandComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"expand"});},collapseComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"collapse"});},init:function(id){this._el=Dom.get(id);this.id=Dom.generateId(this._el,"yui-tv-auto-id-");this.createEvent("animStart",this);this.createEvent("animComplete",this);this.createEvent("collapse",this);this.createEvent("collapseComplete",this);this.createEvent("expand",this);this.createEvent("expandComplete",this);this.createEvent("enterKeyPressed",this);this.createEvent("clickEvent",this);var self=this;this.createEvent("dblClickEvent",{scope:this,onSubscribeCallback:function(){self._hasDblClickSubscriber=true;}});this.createEvent("labelClick",this);this._nodes=[];TV.trees[this.id]=this;this.root=new Widget.RootNode(this);var LW=Widget.LogWriter;},buildTreeFromObject:function(oConfig){var build=function(parent,oConfig){var i,item,node,children,type,NodeType,ThisType;for(i=0;i<oConfig.length;i++){item=oConfig[i];if(Lang.isString(item)){node=new Widget.TextNode(item,parent);}else if(Lang.isObject(item)){children=item.children;delete item.children;type=item.type||'text';delete item.type;switch(type.toLowerCase()){case'text':node=new Widget.TextNode(item,parent);break;case'menu':node=new Widget.MenuNode(item,parent);break;case'html':node=new Widget.HTMLNode(item,parent);break;default:NodeType=Widget[type];if(Lang.isObject(NodeType)){for(ThisType=NodeType;ThisType&&ThisType!==Widget.Node;ThisType=ThisType.superclass.constructor){}
if(ThisType){node=new NodeType(item,parent);}else{}}else{}}
if(children){build(node,children);}}else{}}};build(this.root,oConfig);},buildTreeFromMarkup:function(id){var build=function(parent,markup){var el,node,child,text;for(el=Dom.getFirstChild(markup);el;el=Dom.getNextSibling(el)){if(el.nodeType==1){switch(el.tagName.toUpperCase()){case'LI':for(child=el.firstChild;child;child=child.nextSibling){if(child.nodeType==3){text=Lang.trim(child.nodeValue);if(text.length){node=new Widget.TextNode(text,parent,false);}}else{switch(child.tagName.toUpperCase()){case'UL':case'OL':build(node,child);break;case'A':node=new Widget.TextNode({label:child.innerHTML,href:child.href,target:child.target,title:child.title||child.alt},parent,false);break;default:node=new Widget.HTMLNode(child.parentNode.innerHTML,parent,false,true);break;}}}
break;case'UL':case'OL':build(node,el);break;}}}};var markup=Dom.getChildrenBy(Dom.get(id),function(el){var tag=el.tagName.toUpperCase();return tag=='UL'||tag=='OL';});if(markup.length){build(this.root,markup[0]);}else{}},render:function(){var html=this.root.getHtml();this.getEl().innerHTML=html;var getTarget=function(ev){var target=Event.getTarget(ev);if(target.tagName.toUpperCase()!='TD'){target=Dom.getAncestorByTagName(target,'td');}
if(Lang.isNull(target)){return null;}
if(target.className.length===0){target=target.previousSibling;if(Lang.isNull(target)){return null;}}
return target;};if(!this._hasEvents){Event.on(this.getEl(),'click',function(ev){var self=this,el=Event.getTarget(ev),node=this.getNodeByElement(el);if(!node){return;}
var toggle=function(){if(node.expanded){node.collapse();}else{node.expand();}
node.focus();};if(Dom.hasClass(el,node.labelStyle)||Dom.getAncestorByClassName(el,node.labelStyle)){this.fireEvent('labelClick',node);}
while(el&&!Dom.hasClass(el.parentNode,'ygtvrow')&&!/ygtv[tl][mp]h?h?/.test(el.className)){el=Dom.getAncestorByTagName(el,'td');}
if(el){if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(/ygtv[tl][mp]h?h?/.test(el.className)){toggle();}else{if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}else{if(this._hasDblClickSubscriber){this._dblClickTimer=window.setTimeout(function(){self._dblClickTimer=null;if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){toggle();}},200);}else{if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){}}}}}},this,true);Event.on(this.getEl(),'dblclick',function(ev){if(!this._hasDblClickSubscriber){return;}
var el=Event.getTarget(ev);while(!Dom.hasClass(el.parentNode,'ygtvrow')){el=Dom.getAncestorByTagName(el,'td');}
if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(!(/ygtv[tl][mp]h?h?/.test(el.className))){this.fireEvent('dblClickEvent',{event:ev,node:this.getNodeByElement(el)});if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}}},this,true);Event.on(this.getEl(),'mouseover',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])/gi,'ygtv$1$2h').replace(/h+/,'h');}});Event.on(this.getEl(),'mouseout',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])h/gi,'ygtv$1$2');}});Event.on(this.getEl(),'keydown',function(ev){var target=Event.getTarget(ev),node=this.getNodeByElement(target),newNode=node,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.UP:do{if(newNode.previousSibling){newNode=newNode.previousSibling;}else{newNode=newNode.parent;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.DOWN:do{if(newNode.nextSibling){newNode=newNode.nextSibling;}else{newNode.expand();newNode=(newNode.children.length||null)&&newNode.children[0];}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.LEFT:do{if(newNode.parent){newNode=newNode.parent;}else{newNode=newNode.previousSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.RIGHT:do{newNode.expand();if(newNode.children.length){newNode=newNode.children[0];}else{newNode=newNode.nextSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.ENTER:if(node.href){if(node.target){window.open(node.href,node.target);}else{window.location(node.href);}}else{node.toggle();}
this.fireEvent('enterKeyPressed',node);Event.preventDefault(ev);break;case KEY.HOME:newNode=this.getRoot();if(newNode.children.length){newNode=newNode.children[0];}
if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case KEY.END:newNode=newNode.parent.children;newNode=newNode[newNode.length-1];if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case 107:if(ev.shiftKey){node.parent.expandAll();}else{node.expand();}
break;case 109:if(ev.shiftKey){node.parent.collapseAll();}else{node.collapse();}
break;default:break;}},this,true);}
this._hasEvents=true;},getEl:function(){if(!this._el){this._el=Dom.get(this.id);}
return this._el;},regNode:function(node){this._nodes[node.index]=node;},getRoot:function(){return this.root;},setDynamicLoad:function(fnDataLoader,iconMode){this.root.setDynamicLoad(fnDataLoader,iconMode);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(nodeIndex){var n=this._nodes[nodeIndex];return(n)?n:null;},getNodeByProperty:function(property,value){for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){return n;}}}
return null;},getNodesByProperty:function(property,value){var values=[];for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){values.push(n);}}}
return(values.length)?values:null;},getNodeByElement:function(el){var p=el,m,re=/ygtv([^\d]*)(.*)/;do{if(p&&p.id){m=p.id.match(re);if(m&&m[2]){return this.getNodeByIndex(m[2]);}}
p=p.parentNode;if(!p||!p.tagName){break;}}
while(p.id!==this.id&&p.tagName.toLowerCase()!=="body");return null;},removeNode:function(node,autoRefresh){if(node.isRoot()){return false;}
var p=node.parent;if(p.parent){p=p.parent;}
this._deleteNode(node);if(autoRefresh&&p&&p.childrenRendered){p.refresh();}
return true;},_removeChildren_animComplete:function(o){this.unsubscribe(this._removeChildren_animComplete);this.removeChildren(o.node);},removeChildren:function(node){if(node.expanded){if(this._collapseAnim){this.subscribe("animComplete",this._removeChildren_animComplete,this,true);Widget.Node.prototype.collapse.call(node);return;}
node.collapse();}
while(node.children.length){this._deleteNode(node.children[0]);}
if(node.isRoot()){Widget.Node.prototype.expand.call(node);}
node.childrenRendered=false;node.dynamicLoadComplete=false;node.updateIcon();},_deleteNode:function(node){this.removeChildren(node);this.popNode(node);},popNode:function(node){var p=node.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=node){a[a.length]=p.children[i];}}
p.children=a;p.childrenRendered=false;if(node.previousSibling){node.previousSibling.nextSibling=node.nextSibling;}
if(node.nextSibling){node.nextSibling.previousSibling=node.previousSibling;}
node.parent=null;node.previousSibling=null;node.nextSibling=null;node.tree=null;delete this._nodes[node.index];},destroy:function(){if(this._destroyEditor){this._destroyEditor();}
var el=this.getEl();Event.removeListener(el,'click');Event.removeListener(el,'dblclick');Event.removeListener(el,'mouseover');Event.removeListener(el,'mouseout');Event.removeListener(el,'keydown');for(var i=0;i<this._nodes.length;i++){var node=this._nodes[i];if(node&&node.destroy){node.destroy();}}
el.parentNode.removeChild(el);this._hasEvents=false;},toString:function(){return"TreeView "+this.id;},getNodeCount:function(){return this.getRoot().getNodeCount();},getTreeDefinition:function(){return this.getRoot().getNodeDefinition();},onExpand:function(node){},onCollapse:function(node){}};var PROT=TV.prototype;PROT.draw=PROT.render;YAHOO.augment(TV,YAHOO.util.EventProvider);TV.nodeCount=0;TV.trees=[];TV.getTree=function(treeId){var t=TV.trees[treeId];return(t)?t:null;};TV.getNode=function(treeId,nodeIndex){var t=TV.getTree(treeId);return(t)?t.getNodeByIndex(nodeIndex):null;};TV.FOCUS_CLASS_NAME='ygtvfocus';TV.preload=function(e,prefix){prefix=prefix||"ygtv";var styles=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=1;i<styles.length;i=i+1){sb[sb.length]='<span class="'+prefix+styles[i]+'">&#160;</span>';}
var f=document.createElement("div");var s=f.style;s.className=prefix+styles[0];s.position="absolute";s.height="1px";s.width="1px";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);Event.removeListener(window,"load",TV.preload);};Event.addListener(window,"load",TV.preload);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.Node=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,isLeaf:false,contentStyle:"",contentElId:null,_type:"Node",init:function(oData,oParent,expanded){this.data=oData;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.contentElId="ygtvcontentel"+this.index;if(Lang.isObject(oData)){for(var property in oData){if(property!="children"&&property.charAt(0)!='_'&&oData.hasOwnProperty(property)&&!Lang.isUndefined(this[property])&&!Lang.isFunction(this[property])){this[property]=oData[property];}}}
if(!Lang.isUndefined(expanded)){this.expanded=expanded;}
this.createEvent("parentChange",this);if(oParent){oParent.appendChild(this);}},applyParent:function(parentNode){if(!parentNode){return false;}
this.tree=parentNode.tree;this.parent=parentNode;this.depth=parentNode.depth+1;this.tree.regNode(this);parentNode.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}
this.fireEvent("parentChange");return true;},appendChild:function(childNode){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=childNode;childNode.previousSibling=sib;}
this.children[this.children.length]=childNode;childNode.applyParent(this);if(this.childrenRendered&&this.expanded){this.getChildrenEl().style.display="";}
return childNode;},appendTo:function(parentNode){return parentNode.appendChild(this);},insertBefore:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);p.children.splice(refIndex,0,this);if(node.previousSibling){node.previousSibling.nextSibling=this;}
this.previousSibling=node.previousSibling;this.nextSibling=node;node.previousSibling=this;this.applyParent(p);}
return this;},insertAfter:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);if(!node.nextSibling){this.nextSibling=null;return this.appendTo(p);}
p.children.splice(refIndex+1,0,this);node.nextSibling.previousSibling=this;this.previousSibling=node;this.nextSibling=node.nextSibling;node.nextSibling=this;this.applyParent(p);}
return this;},isChildOf:function(parentNode){if(parentNode&&parentNode.children){for(var i=0,len=parentNode.children.length;i<len;++i){if(parentNode.children[i]===this){return i;}}}
return-1;},getSiblings:function(){var sib=this.parent.children.slice(0);for(var i=0;i<sib.length&&sib[i]!=this;i++){}
sib.splice(i,1);if(sib.length){return sib;}
return null;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl(),this)){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl(),this)){this.getChildrenEl().style.display="none";}},getElId:function(){return"ygtv"+this.index;},getChildrenElId:function(){return"ygtvc"+this.index;},getToggleElId:function(){return"ygtvt"+this.index;},getEl:function(){return Dom.get(this.getElId());},getChildrenEl:function(){return Dom.get(this.getChildrenElId());},getToggleEl:function(){return Dom.get(this.getToggleElId());},getContentEl:function(){return Dom.get(this.contentElId);},collapse:function(){if(!this.expanded){return;}
var ret=this.tree.onCollapse(this);if(false===ret){return;}
ret=this.tree.fireEvent("collapse",this);if(false===ret){return;}
if(!this.getEl()){this.expanded=false;}else{this.hideChildren();this.expanded=false;this.updateIcon();}
ret=this.tree.fireEvent("collapseComplete",this);},expand:function(lazySource){if(this.expanded&&!lazySource){return;}
var ret=true;if(!lazySource){ret=this.tree.onExpand(this);if(false===ret){return;}
ret=this.tree.fireEvent("expand",this);}
if(false===ret){return;}
if(!this.getEl()){this.expanded=true;return;}
if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}
this.expanded=true;this.updateIcon();if(this.isLoading){this.expanded=false;return;}
if(!this.multiExpand){var sibs=this.getSiblings();for(var i=0;sibs&&i<sibs.length;++i){if(sibs[i]!=this&&sibs[i].expanded){sibs[i].collapse();}}}
this.showChildren();ret=this.tree.fireEvent("expandComplete",this);},updateIcon:function(){if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=el.className.replace(/ygtv(([tl][pmn]h?)|(loading))/,this.getStyle());}}},getStyle:function(){if(this.isLoading){return"ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var type="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){type=(this.expanded)?"m":"p";}
return"ygtv"+loc+type;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}
return s;},expandAll:function(){for(var i=0;i<this.children.length;++i){var c=this.children[i];if(c.isDynamic()){break;}else if(!c.multiExpand){break;}else{c.expand();c.expandAll();}}},collapseAll:function(){for(var i=0;i<this.children.length;++i){this.children[i].collapse();this.children[i].collapseAll();}},setDynamicLoad:function(fnDataLoader,iconMode){if(fnDataLoader){this.dataLoader=fnDataLoader;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}
if(iconMode){this.iconMode=iconMode;}},isRoot:function(){return(this==this.tree.root);},isDynamic:function(){if(this.isLeaf){return false;}else{return(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));}},getIconMode:function(){return(this.iconMode||this.tree.root.iconMode);},hasChildren:function(checkForLazyLoad){if(this.isLeaf){return false;}else{return(this.children.length>0||(checkForLazyLoad&&this.isDynamic()&&!this.dynamicLoadComplete));}},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;var sb=[];sb[sb.length]='<div class="ygtvitem" id="'+this.getElId()+'">';sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]='</div>';return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]='<div class="ygtvchildren"';sb[sb.length]=' id="'+this.getChildrenElId()+'"';if(!this.expanded||!this.hasChildren()){sb[sb.length]=' style="display:none;"';}
sb[sb.length]='>';if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}
sb[sb.length]='</div>';return sb.join("");},renderChildren:function(){var node=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){node.dataLoader(node,function(){node.loadComplete();});},10);}else if(this.tree.root.dataLoader){setTimeout(function(){node.tree.root.dataLoader(node,function(){node.loadComplete();});},10);}else{return"Error: data loader not found or not specified.";}
return"";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i<this.children.length;++i){sb[sb.length]=this.children[i].getHtml();}
this.childrenRendered=true;return sb.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.dynamicLoadComplete=true;this.isLoading=false;this.expand(true);this.tree.locked=false;},getAncestor:function(depth){if(depth>=this.depth||depth<0){return null;}
var p=this.parent;while(p.depth>depth){p=p.parent;}
return p;},getDepthStyle:function(depth){return(this.getAncestor(depth).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){var sb=[];sb[sb.length]='<table border="0" cellpadding="0" cellspacing="0" class="ygtvdepth'+this.depth+'">';sb[sb.length]='<tr class="ygtvrow">';for(var i=0;i<this.depth;++i){sb[sb.length]='<td class="'+this.getDepthStyle(i)+'"><div class="ygtvspacer"></div></td>';}
if(this.hasIcon){sb[sb.length]='<td';sb[sb.length]=' id="'+this.getToggleElId()+'"';sb[sb.length]=' class="'+this.getStyle()+'"';sb[sb.length]='><a href="javascript:void(null)" class="ygtvspacer">&nbsp;</a></td>';}
sb[sb.length]='<td';sb[sb.length]=' id="'+this.contentElId+'"';sb[sb.length]=' class="'+this.contentStyle+' ygtvcontent" ';sb[sb.length]=(this.nowrap)?' nowrap="nowrap" ':'';sb[sb.length]=' >';sb[sb.length]=this.getContentHtml();sb[sb.length]='</td>';sb[sb.length]='</tr>';sb[sb.length]='</table>';return sb.join("");},getContentHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return this._type+" ("+this.index+")";},_focusHighlightedItems:[],_focusedItem:null,focus:function(){var focused=false,self=this;var removeListeners=function(){var el;if(self._focusedItem){Event.removeListener(self._focusedItem,'blur');self._focusedItem=null;}
while((el=self._focusHighlightedItems.shift())){Dom.removeClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);}};removeListeners();Dom.getElementsBy(function(el){return/ygtv(([tl][pmn]h?)|(content))/.test(el.className);},'td',this.getEl().firstChild,function(el){Dom.addClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);if(!focused){var aEl=el.getElementsByTagName('a');if(aEl.length){aEl=aEl[0];aEl.focus();self._focusedItem=aEl;Event.on(aEl,'blur',removeListeners);focused=true;}}
self._focusHighlightedItems.push(el);});if(!focused){removeListeners();}
return focused;},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count+1;},getNodeDefinition:function(){if(this.isDynamic()){return false;}
var def,defs=this.data,children=[];if(this.href){defs.href=this.href;}
if(this.target!='_self'){defs.target=this.target;}
if(this.expanded){defs.expanded=this.expanded;}
if(!this.multiExpand){defs.multiExpand=this.multiExpand;}
if(!this.hasIcon){defs.hasIcon=this.hasIcon;}
if(this.nowrap){defs.nowrap=this.nowrap;}
defs.type=this._type;for(var i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
children.push(def);}
if(children.length){defs.children=children;}
return defs;},getToggleLink:function(){return'return false;';}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.TextNode=function(oData,oParent,expanded){if(oData){if(Lang.isString(oData)){oData={label:oData};}
this.init(oData,oParent,expanded);this.setUpLabel(oData);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,title:null,_type:"TextNode",setUpLabel:function(oData){if(Lang.isString(oData)){oData={label:oData};}else{if(oData.style){this.labelStyle=oData.style;}}
this.label=oData.label;this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return Dom.get(this.labelElId);},getContentHtml:function(){var sb=[];sb[sb.length]=this.href?'<a':'<span';sb[sb.length]=' id="'+this.labelElId+'"';if(this.title){sb[sb.length]=' title="'+this.title+'"';}
sb[sb.length]=' class="'+this.labelStyle+'"';if(this.href){sb[sb.length]=' href="'+this.href+'"';sb[sb.length]=' target="'+this.target+'"';}
sb[sb.length]=' >';sb[sb.length]=this.label;sb[sb.length]=this.href?'</a>':'</span>';return sb.join("");},getNodeDefinition:function(){var def=YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.label=this.label;if(this.labelStyle!='ygtvlabel'){def.style=this.labelStyle;}
if(this.title){def.title=this.title;}
return def;},toString:function(){return YAHOO.widget.TextNode.superclass.toString.call(this)+": "+this.label;},onLabelClick:function(){return false;}});})();YAHOO.widget.RootNode=function(oTree){this.init(null,null,true);this.tree=oTree;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{_type:"RootNode",getNodeHtml:function(){return"";},toString:function(){return this._type;},loadComplete:function(){this.tree.draw();},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count;},getNodeDefinition:function(){for(var def,defs=[],i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
defs.push(def);}
return defs;},collapse:function(){},expand:function(){},getSiblings:function(){return null;},focus:function(){}});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.HTMLNode=function(oData,oParent,expanded,hasIcon){if(oData){this.init(oData,oParent,expanded);this.initContent(oData,hasIcon);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",html:null,_type:"HTMLNode",initContent:function(oData,hasIcon){this.setHtml(oData);this.contentElId="ygtvcontentel"+this.index;if(!Lang.isUndefined(hasIcon)){this.hasIcon=hasIcon;}},setHtml:function(o){this.data=o;this.html=(typeof o==="string")?o:o.html;var el=this.getContentEl();if(el){el.innerHTML=this.html;}},getContentHtml:function(){return this.html;},getNodeDefinition:function(){var def=YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.html=this.html;return def;}});})();YAHOO.widget.MenuNode=function(oData,oParent,expanded){YAHOO.widget.MenuNode.superclass.constructor.call(this,oData,oParent,expanded);this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{_type:"MenuNode"});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,Calendar=YAHOO.widget.Calendar;YAHOO.widget.DateNode=function(oData,oParent,expanded){YAHOO.widget.DateNode.superclass.constructor.call(this,oData,oParent,expanded);};YAHOO.extend(YAHOO.widget.DateNode,YAHOO.widget.TextNode,{_type:"DateNode",calendarConfig:null,fillEditorContainer:function(editorData){var cal,container=editorData.inputContainer;if(Lang.isUndefined(Calendar)){Dom.replaceClass(editorData.editorPanel,'ygtv-edit-DateNode','ygtv-edit-TextNode');YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this,editorData);return;}
if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=false;editorData.node.destroyEditorContents(editorData);editorData.inputObject=cal=new Calendar(container.appendChild(document.createElement('div')));if(this.calendarConfig){cal.cfg.applyConfig(this.calendarConfig,true);cal.cfg.fireQueue();}
cal.selectEvent.subscribe(function(){this.tree._closeEditor(true);},this,true);}else{cal=editorData.inputObject;}
cal.cfg.setProperty("selected",this.label,false);var delim=cal.cfg.getProperty('DATE_FIELD_DELIMITER');var pageDate=this.label.split(delim);cal.cfg.setProperty('pagedate',pageDate[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]+delim+pageDate[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]);cal.cfg.fireQueue();cal.render();cal.oDomContainer.focus();},saveEditorValue:function(editorData){var node=editorData.node,value;if(Lang.isUndefined(Calendar)){value=editorData.inputElement.value;}else{var cal=editorData.inputObject,date=cal.getSelectedDates()[0],dd=[];dd[cal.cfg.getProperty('MDY_DAY_POSITION')-1]=date.getDate();dd[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]=date.getMonth()+1;dd[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]=date.getFullYear();value=dd.join(cal.cfg.getProperty('DATE_FIELD_DELIMITER'));}
node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;}});})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,TV=YAHOO.widget.TreeView,TVproto=TV.prototype;TV.editorData={active:false,whoHasIt:null,nodeType:null,editorPanel:null,inputContainer:null,buttonsContainer:null,node:null,saveOnEnter:true};TVproto._nodeEditing=function(node){if(node.fillEditorContainer&&node.editable){var ed,topLeft,buttons,button,editorData=TV.editorData;editorData.active=true;editorData.whoHasIt=this;if(!editorData.nodeType){editorData.editorPanel=ed=document.body.appendChild(document.createElement('div'));Dom.addClass(ed,'ygtv-label-editor');buttons=editorData.buttonsContainer=ed.appendChild(document.createElement('div'));Dom.addClass(buttons,'ygtv-button-container');button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvok');button.innerHTML=' ';button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvcancel');button.innerHTML=' ';Event.on(buttons,'click',function(ev){var target=Event.getTarget(ev);var node=TV.editorData.node;if(Dom.hasClass(target,'ygtvok')){Event.stopEvent(ev);this._closeEditor(true);}
if(Dom.hasClass(target,'ygtvcancel')){Event.stopEvent(ev);this._closeEditor(false);}},this,true);editorData.inputContainer=ed.appendChild(document.createElement('div'));Dom.addClass(editorData.inputContainer,'ygtv-input');Event.on(ed,'keydown',function(ev){var editorData=TV.editorData,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.ENTER:Event.stopEvent(ev);if(editorData.saveOnEnter){this._closeEditor(true);}
break;case KEY.ESCAPE:Event.stopEvent(ev);this._closeEditor(false);break;}},this,true);}else{ed=editorData.editorPanel;}
editorData.node=node;if(editorData.nodeType){Dom.removeClass(ed,'ygtv-edit-'+editorData.nodeType);}
Dom.addClass(ed,' ygtv-edit-'+node._type);topLeft=Dom.getXY(node.getContentEl());Dom.setStyle(ed,'left',topLeft[0]+'px');Dom.setStyle(ed,'top',topLeft[1]+'px');Dom.setStyle(ed,'display','block');ed.focus();node.fillEditorContainer(editorData);return true;}};TVproto.onEventEditNode=function(oArgs){if(oArgs instanceof YAHOO.widget.Node){oArgs.editNode();}else if(oArgs.node instanceof YAHOO.widget.Node){oArgs.node.editNode();}};TVproto._closeEditor=function(save){var ed=TV.editorData,node=ed.node;if(save){ed.node.saveEditorValue(ed);}
Dom.setStyle(ed.editorPanel,'display','none');ed.active=false;node.focus();};TVproto._destroyEditor=function(){var ed=TV.editorData;if(ed&&ed.nodeType&&(!ed.active||ed.whoHasIt===this)){Event.removeListener(ed.editorPanel,'keydown');Event.removeListener(ed.buttonContainer,'click');ed.node.destroyEditorContents(ed);document.body.removeChild(ed.editorPanel);ed.nodeType=ed.editorPanel=ed.inputContainer=ed.buttonsContainer=ed.whoHasIt=ed.node=null;ed.active=false;}};var Nproto=YAHOO.widget.Node.prototype;Nproto.editable=false;Nproto.editNode=function(){this.tree._nodeEditing(this);};Nproto.fillEditorContainer=null;Nproto.destroyEditorContents=function(editorData){Event.purgeElement(editorData.inputContainer,true);editorData.inputContainer.innerHTML='';};Nproto.saveEditorValue=function(editorData){};var TNproto=YAHOO.widget.TextNode.prototype;TNproto.fillEditorContainer=function(editorData){var input;if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=true;editorData.node.destroyEditorContents(editorData);editorData.inputElement=input=editorData.inputContainer.appendChild(document.createElement('input'));}else{input=editorData.inputElement;}
input.value=this.label;input.focus();input.select();};TNproto.saveEditorValue=function(editorData){var node=editorData.node,value=editorData.inputElement.value;node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;};TNproto.destroyEditorContents=function(editorData){editorData.inputContainer.innerHTML='';};})();YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(type,el,callback){if(YAHOO.widget[type]){return new YAHOO.widget[type](el,callback);}else{return null;}},isValid:function(type){return(YAHOO.widget[type]);}};}();YAHOO.widget.TVFadeIn=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var tvanim=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var tvanim=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}};YAHOO.register("treeview",YAHOO.widget.TreeView,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.TextNode","YAHOO.widget.TextNode");(function(){var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.widgets.TextNode");TOPINCS.widgets.TextNode=TextNode;function TextNode(){YAHOO.widget.TextNode.apply(this,arguments);this.canHaveChildren=true;};CERNY.inherit(TextNode,YAHOO.widget.TextNode);TextNode.prototype.logger=logger;function getStyle(){if(this.isLoading){return"ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var type="n";if(this.canHaveChildren){type=(this.expanded)?"m":"p";}
return"ygtv"+loc+type;}}
signature(getStyle,"string");method(TextNode.prototype,"getStyle",getStyle);})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Widget=YAHOO.widget;YAHOO.widget.TreeView=function(id,oConfig){if(id){this.init(id);}
if(oConfig){if(!Lang.isArray(oConfig)){oConfig=[oConfig];}
this.buildTreeFromObject(oConfig);}else if(this._el&&Lang.trim(this._el.innerHTML)){this.buildTreeFromMarkup(id);}};var TV=Widget.TreeView;TV.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,_hasDblClickSubscriber:false,_dblClickTimer:null,setExpandAnim:function(type){this._expandAnim=(Widget.TVAnim.isValid(type))?type:null;},setCollapseAnim:function(type){this._collapseAnim=(Widget.TVAnim.isValid(type))?type:null;},animateExpand:function(el,node){if(this._expandAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._expandAnim,el,function(){tree.expandComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"expand"});a.animate();}
return true;}
return false;},animateCollapse:function(el,node){if(this._collapseAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._collapseAnim,el,function(){tree.collapseComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"collapse"});a.animate();}
return true;}
return false;},expandComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"expand"});},collapseComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"collapse"});},init:function(id){this._el=Dom.get(id);this.id=Dom.generateId(this._el,"yui-tv-auto-id-");this.createEvent("animStart",this);this.createEvent("animComplete",this);this.createEvent("collapse",this);this.createEvent("collapseComplete",this);this.createEvent("expand",this);this.createEvent("expandComplete",this);this.createEvent("enterKeyPressed",this);this.createEvent("clickEvent",this);var self=this;this.createEvent("dblClickEvent",{scope:this,onSubscribeCallback:function(){self._hasDblClickSubscriber=true;}});this.createEvent("labelClick",this);this._nodes=[];TV.trees[this.id]=this;this.root=new Widget.RootNode(this);var LW=Widget.LogWriter;},buildTreeFromObject:function(oConfig){var build=function(parent,oConfig){var i,item,node,children,type,NodeType,ThisType;for(i=0;i<oConfig.length;i++){item=oConfig[i];if(Lang.isString(item)){node=new Widget.TextNode(item,parent);}else if(Lang.isObject(item)){children=item.children;delete item.children;type=item.type||'text';delete item.type;switch(type.toLowerCase()){case'text':node=new Widget.TextNode(item,parent);break;case'menu':node=new Widget.MenuNode(item,parent);break;case'html':node=new Widget.HTMLNode(item,parent);break;default:NodeType=Widget[type];if(Lang.isObject(NodeType)){for(ThisType=NodeType;ThisType&&ThisType!==Widget.Node;ThisType=ThisType.superclass.constructor){}
if(ThisType){node=new NodeType(item,parent);}else{}}else{}}
if(children){build(node,children);}}else{}}};build(this.root,oConfig);},buildTreeFromMarkup:function(id){var build=function(parent,markup){var el,node,child,text;for(el=Dom.getFirstChild(markup);el;el=Dom.getNextSibling(el)){if(el.nodeType==1){switch(el.tagName.toUpperCase()){case'LI':for(child=el.firstChild;child;child=child.nextSibling){if(child.nodeType==3){text=Lang.trim(child.nodeValue);if(text.length){node=new Widget.TextNode(text,parent,false);}}else{switch(child.tagName.toUpperCase()){case'UL':case'OL':build(node,child);break;case'A':node=new Widget.TextNode({label:child.innerHTML,href:child.href,target:child.target,title:child.title||child.alt},parent,false);break;default:node=new Widget.HTMLNode(child.parentNode.innerHTML,parent,false,true);break;}}}
break;case'UL':case'OL':build(node,el);break;}}}};var markup=Dom.getChildrenBy(Dom.get(id),function(el){var tag=el.tagName.toUpperCase();return tag=='UL'||tag=='OL';});if(markup.length){build(this.root,markup[0]);}else{}},render:function(){var html=this.root.getHtml();this.getEl().innerHTML=html;var getTarget=function(ev){var target=Event.getTarget(ev);if(target.tagName.toUpperCase()!='TD'){target=Dom.getAncestorByTagName(target,'td');}
if(Lang.isNull(target)){return null;}
if(target.className.length===0){target=target.previousSibling;if(Lang.isNull(target)){return null;}}
return target;};if(!this._hasEvents){Event.on(this.getEl(),'click',function(ev){var self=this,el=Event.getTarget(ev),node=this.getNodeByElement(el);if(!node){return;}
var toggle=function(){if(node.expanded){node.collapse();}else{node.expand();}
node.focus();};if(Dom.hasClass(el,node.labelStyle)||Dom.getAncestorByClassName(el,node.labelStyle)){this.fireEvent('labelClick',node);}
while(el&&!Dom.hasClass(el.parentNode,'ygtvrow')&&!/ygtv[tl][mp]h?h?/.test(el.className)){el=Dom.getAncestorByTagName(el,'td');}
if(el){if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(/ygtv[tl][mp]h?h?/.test(el.className)){toggle();}else{if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}else{if(this._hasDblClickSubscriber){this._dblClickTimer=window.setTimeout(function(){self._dblClickTimer=null;if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){toggle();}},200);}else{if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){}}}}}},this,true);Event.on(this.getEl(),'dblclick',function(ev){if(!this._hasDblClickSubscriber){return;}
var el=Event.getTarget(ev);while(!Dom.hasClass(el.parentNode,'ygtvrow')){el=Dom.getAncestorByTagName(el,'td');}
if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(!(/ygtv[tl][mp]h?h?/.test(el.className))){this.fireEvent('dblClickEvent',{event:ev,node:this.getNodeByElement(el)});if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}}},this,true);Event.on(this.getEl(),'mouseover',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])/gi,'ygtv$1$2h').replace(/h+/,'h');}});Event.on(this.getEl(),'mouseout',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])h/gi,'ygtv$1$2');}});Event.on(this.getEl(),'keydown',function(ev){var target=Event.getTarget(ev),node=this.getNodeByElement(target),newNode=node,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.UP:do{if(newNode.previousSibling){newNode=newNode.previousSibling;}else{newNode=newNode.parent;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.DOWN:do{if(newNode.nextSibling){newNode=newNode.nextSibling;}else{newNode.expand();newNode=(newNode.children.length||null)&&newNode.children[0];}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.LEFT:do{if(newNode.parent){newNode=newNode.parent;}else{newNode=newNode.previousSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.RIGHT:do{newNode.expand();if(newNode.children.length){newNode=newNode.children[0];}else{newNode=newNode.nextSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.ENTER:if(node.href){if(node.target){window.open(node.href,node.target);}else{window.location(node.href);}}else{node.toggle();}
this.fireEvent('enterKeyPressed',node);Event.preventDefault(ev);break;case KEY.HOME:newNode=this.getRoot();if(newNode.children.length){newNode=newNode.children[0];}
if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case KEY.END:newNode=newNode.parent.children;newNode=newNode[newNode.length-1];if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case 107:if(ev.shiftKey){node.parent.expandAll();}else{node.expand();}
break;case 109:if(ev.shiftKey){node.parent.collapseAll();}else{node.collapse();}
break;default:break;}},this,true);}
this._hasEvents=true;},getEl:function(){if(!this._el){this._el=Dom.get(this.id);}
return this._el;},regNode:function(node){this._nodes[node.index]=node;},getRoot:function(){return this.root;},setDynamicLoad:function(fnDataLoader,iconMode){this.root.setDynamicLoad(fnDataLoader,iconMode);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(nodeIndex){var n=this._nodes[nodeIndex];return(n)?n:null;},getNodeByProperty:function(property,value){for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){return n;}}}
return null;},getNodesByProperty:function(property,value){var values=[];for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){values.push(n);}}}
return(values.length)?values:null;},getNodeByElement:function(el){var p=el,m,re=/ygtv([^\d]*)(.*)/;do{if(p&&p.id){m=p.id.match(re);if(m&&m[2]){return this.getNodeByIndex(m[2]);}}
p=p.parentNode;if(!p||!p.tagName){break;}}
while(p.id!==this.id&&p.tagName.toLowerCase()!=="body");return null;},removeNode:function(node,autoRefresh){if(node.isRoot()){return false;}
var p=node.parent;if(p.parent){p=p.parent;}
this._deleteNode(node);if(autoRefresh&&p&&p.childrenRendered){p.refresh();}
return true;},_removeChildren_animComplete:function(o){this.unsubscribe(this._removeChildren_animComplete);this.removeChildren(o.node);},removeChildren:function(node){if(node.expanded){if(this._collapseAnim){this.subscribe("animComplete",this._removeChildren_animComplete,this,true);Widget.Node.prototype.collapse.call(node);return;}
node.collapse();}
while(node.children.length){this._deleteNode(node.children[0]);}
if(node.isRoot()){Widget.Node.prototype.expand.call(node);}
node.childrenRendered=false;node.dynamicLoadComplete=false;node.updateIcon();},_deleteNode:function(node){this.removeChildren(node);this.popNode(node);},popNode:function(node){var p=node.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=node){a[a.length]=p.children[i];}}
p.children=a;p.childrenRendered=false;if(node.previousSibling){node.previousSibling.nextSibling=node.nextSibling;}
if(node.nextSibling){node.nextSibling.previousSibling=node.previousSibling;}
node.parent=null;node.previousSibling=null;node.nextSibling=null;node.tree=null;delete this._nodes[node.index];},destroy:function(){if(this._destroyEditor){this._destroyEditor();}
var el=this.getEl();Event.removeListener(el,'click');Event.removeListener(el,'dblclick');Event.removeListener(el,'mouseover');Event.removeListener(el,'mouseout');Event.removeListener(el,'keydown');for(var i=0;i<this._nodes.length;i++){var node=this._nodes[i];if(node&&node.destroy){node.destroy();}}
el.parentNode.removeChild(el);this._hasEvents=false;},toString:function(){return"TreeView "+this.id;},getNodeCount:function(){return this.getRoot().getNodeCount();},getTreeDefinition:function(){return this.getRoot().getNodeDefinition();},onExpand:function(node){},onCollapse:function(node){}};var PROT=TV.prototype;PROT.draw=PROT.render;YAHOO.augment(TV,YAHOO.util.EventProvider);TV.nodeCount=0;TV.trees=[];TV.getTree=function(treeId){var t=TV.trees[treeId];return(t)?t:null;};TV.getNode=function(treeId,nodeIndex){var t=TV.getTree(treeId);return(t)?t.getNodeByIndex(nodeIndex):null;};TV.FOCUS_CLASS_NAME='ygtvfocus';TV.preload=function(e,prefix){prefix=prefix||"ygtv";var styles=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=1;i<styles.length;i=i+1){sb[sb.length]='<span class="'+prefix+styles[i]+'">&#160;</span>';}
var f=document.createElement("div");var s=f.style;s.className=prefix+styles[0];s.position="absolute";s.height="1px";s.width="1px";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);Event.removeListener(window,"load",TV.preload);};Event.addListener(window,"load",TV.preload);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.Node=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,isLeaf:false,contentStyle:"",contentElId:null,_type:"Node",init:function(oData,oParent,expanded){this.data=oData;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.contentElId="ygtvcontentel"+this.index;if(Lang.isObject(oData)){for(var property in oData){if(property!="children"&&property.charAt(0)!='_'&&oData.hasOwnProperty(property)&&!Lang.isUndefined(this[property])&&!Lang.isFunction(this[property])){this[property]=oData[property];}}}
if(!Lang.isUndefined(expanded)){this.expanded=expanded;}
this.createEvent("parentChange",this);if(oParent){oParent.appendChild(this);}},applyParent:function(parentNode){if(!parentNode){return false;}
this.tree=parentNode.tree;this.parent=parentNode;this.depth=parentNode.depth+1;this.tree.regNode(this);parentNode.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}
this.fireEvent("parentChange");return true;},appendChild:function(childNode){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=childNode;childNode.previousSibling=sib;}
this.children[this.children.length]=childNode;childNode.applyParent(this);if(this.childrenRendered&&this.expanded){this.getChildrenEl().style.display="";}
return childNode;},appendTo:function(parentNode){return parentNode.appendChild(this);},insertBefore:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);p.children.splice(refIndex,0,this);if(node.previousSibling){node.previousSibling.nextSibling=this;}
this.previousSibling=node.previousSibling;this.nextSibling=node;node.previousSibling=this;this.applyParent(p);}
return this;},insertAfter:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);if(!node.nextSibling){this.nextSibling=null;return this.appendTo(p);}
p.children.splice(refIndex+1,0,this);node.nextSibling.previousSibling=this;this.previousSibling=node;this.nextSibling=node.nextSibling;node.nextSibling=this;this.applyParent(p);}
return this;},isChildOf:function(parentNode){if(parentNode&&parentNode.children){for(var i=0,len=parentNode.children.length;i<len;++i){if(parentNode.children[i]===this){return i;}}}
return-1;},getSiblings:function(){var sib=this.parent.children.slice(0);for(var i=0;i<sib.length&&sib[i]!=this;i++){}
sib.splice(i,1);if(sib.length){return sib;}
return null;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl(),this)){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl(),this)){this.getChildrenEl().style.display="none";}},getElId:function(){return"ygtv"+this.index;},getChildrenElId:function(){return"ygtvc"+this.index;},getToggleElId:function(){return"ygtvt"+this.index;},getEl:function(){return Dom.get(this.getElId());},getChildrenEl:function(){return Dom.get(this.getChildrenElId());},getToggleEl:function(){return Dom.get(this.getToggleElId());},getContentEl:function(){return Dom.get(this.contentElId);},collapse:function(){if(!this.expanded){return;}
var ret=this.tree.onCollapse(this);if(false===ret){return;}
ret=this.tree.fireEvent("collapse",this);if(false===ret){return;}
if(!this.getEl()){this.expanded=false;}else{this.hideChildren();this.expanded=false;this.updateIcon();}
ret=this.tree.fireEvent("collapseComplete",this);},expand:function(lazySource){if(this.expanded&&!lazySource){return;}
var ret=true;if(!lazySource){ret=this.tree.onExpand(this);if(false===ret){return;}
ret=this.tree.fireEvent("expand",this);}
if(false===ret){return;}
if(!this.getEl()){this.expanded=true;return;}
if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}
this.expanded=true;this.updateIcon();if(this.isLoading){this.expanded=false;return;}
if(!this.multiExpand){var sibs=this.getSiblings();for(var i=0;sibs&&i<sibs.length;++i){if(sibs[i]!=this&&sibs[i].expanded){sibs[i].collapse();}}}
this.showChildren();ret=this.tree.fireEvent("expandComplete",this);},updateIcon:function(){if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=el.className.replace(/ygtv(([tl][pmn]h?)|(loading))/,this.getStyle());}}},getStyle:function(){if(this.isLoading){return"ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var type="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){type=(this.expanded)?"m":"p";}
return"ygtv"+loc+type;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}
return s;},expandAll:function(){for(var i=0;i<this.children.length;++i){var c=this.children[i];if(c.isDynamic()){break;}else if(!c.multiExpand){break;}else{c.expand();c.expandAll();}}},collapseAll:function(){for(var i=0;i<this.children.length;++i){this.children[i].collapse();this.children[i].collapseAll();}},setDynamicLoad:function(fnDataLoader,iconMode){if(fnDataLoader){this.dataLoader=fnDataLoader;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}
if(iconMode){this.iconMode=iconMode;}},isRoot:function(){return(this==this.tree.root);},isDynamic:function(){if(this.isLeaf){return false;}else{return(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));}},getIconMode:function(){return(this.iconMode||this.tree.root.iconMode);},hasChildren:function(checkForLazyLoad){if(this.isLeaf){return false;}else{return(this.children.length>0||(checkForLazyLoad&&this.isDynamic()&&!this.dynamicLoadComplete));}},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;var sb=[];sb[sb.length]='<div class="ygtvitem" id="'+this.getElId()+'">';sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]='</div>';return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]='<div class="ygtvchildren"';sb[sb.length]=' id="'+this.getChildrenElId()+'"';if(!this.expanded||!this.hasChildren()){sb[sb.length]=' style="display:none;"';}
sb[sb.length]='>';if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}
sb[sb.length]='</div>';return sb.join("");},renderChildren:function(){var node=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){node.dataLoader(node,function(){node.loadComplete();});},10);}else if(this.tree.root.dataLoader){setTimeout(function(){node.tree.root.dataLoader(node,function(){node.loadComplete();});},10);}else{return"Error: data loader not found or not specified.";}
return"";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i<this.children.length;++i){sb[sb.length]=this.children[i].getHtml();}
this.childrenRendered=true;return sb.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.dynamicLoadComplete=true;this.isLoading=false;this.expand(true);this.tree.locked=false;},getAncestor:function(depth){if(depth>=this.depth||depth<0){return null;}
var p=this.parent;while(p.depth>depth){p=p.parent;}
return p;},getDepthStyle:function(depth){return(this.getAncestor(depth).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){var sb=[];sb[sb.length]='<table border="0" cellpadding="0" cellspacing="0" class="ygtvdepth'+this.depth+'">';sb[sb.length]='<tr class="ygtvrow">';for(var i=0;i<this.depth;++i){sb[sb.length]='<td class="'+this.getDepthStyle(i)+'"><div class="ygtvspacer"></div></td>';}
if(this.hasIcon){sb[sb.length]='<td';sb[sb.length]=' id="'+this.getToggleElId()+'"';sb[sb.length]=' class="'+this.getStyle()+'"';sb[sb.length]='><a href="javascript:void(null)" class="ygtvspacer">&nbsp;</a></td>';}
sb[sb.length]='<td';sb[sb.length]=' id="'+this.contentElId+'"';sb[sb.length]=' class="'+this.contentStyle+' ygtvcontent" ';sb[sb.length]=(this.nowrap)?' nowrap="nowrap" ':'';sb[sb.length]=' >';sb[sb.length]=this.getContentHtml();sb[sb.length]='</td>';sb[sb.length]='</tr>';sb[sb.length]='</table>';return sb.join("");},getContentHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return this._type+" ("+this.index+")";},_focusHighlightedItems:[],_focusedItem:null,focus:function(){var focused=false,self=this;var removeListeners=function(){var el;if(self._focusedItem){Event.removeListener(self._focusedItem,'blur');self._focusedItem=null;}
while((el=self._focusHighlightedItems.shift())){Dom.removeClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);}};removeListeners();Dom.getElementsBy(function(el){return/ygtv(([tl][pmn]h?)|(content))/.test(el.className);},'td',this.getEl().firstChild,function(el){Dom.addClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);if(!focused){var aEl=el.getElementsByTagName('a');if(aEl.length){aEl=aEl[0];aEl.focus();self._focusedItem=aEl;Event.on(aEl,'blur',removeListeners);focused=true;}}
self._focusHighlightedItems.push(el);});if(!focused){removeListeners();}
return focused;},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count+1;},getNodeDefinition:function(){if(this.isDynamic()){return false;}
var def,defs=this.data,children=[];if(this.href){defs.href=this.href;}
if(this.target!='_self'){defs.target=this.target;}
if(this.expanded){defs.expanded=this.expanded;}
if(!this.multiExpand){defs.multiExpand=this.multiExpand;}
if(!this.hasIcon){defs.hasIcon=this.hasIcon;}
if(this.nowrap){defs.nowrap=this.nowrap;}
defs.type=this._type;for(var i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
children.push(def);}
if(children.length){defs.children=children;}
return defs;},getToggleLink:function(){return'return false;';}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.TextNode=function(oData,oParent,expanded){if(oData){if(Lang.isString(oData)){oData={label:oData};}
this.init(oData,oParent,expanded);this.setUpLabel(oData);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,title:null,_type:"TextNode",setUpLabel:function(oData){if(Lang.isString(oData)){oData={label:oData};}else{if(oData.style){this.labelStyle=oData.style;}}
this.label=oData.label;this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return Dom.get(this.labelElId);},getContentHtml:function(){var sb=[];sb[sb.length]=this.href?'<a':'<span';sb[sb.length]=' id="'+this.labelElId+'"';if(this.title){sb[sb.length]=' title="'+this.title+'"';}
sb[sb.length]=' class="'+this.labelStyle+'"';if(this.href){sb[sb.length]=' href="'+this.href+'"';sb[sb.length]=' target="'+this.target+'"';}
sb[sb.length]=' >';sb[sb.length]=this.label;sb[sb.length]=this.href?'</a>':'</span>';return sb.join("");},getNodeDefinition:function(){var def=YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.label=this.label;if(this.labelStyle!='ygtvlabel'){def.style=this.labelStyle;}
if(this.title){def.title=this.title;}
return def;},toString:function(){return YAHOO.widget.TextNode.superclass.toString.call(this)+": "+this.label;},onLabelClick:function(){return false;}});})();YAHOO.widget.RootNode=function(oTree){this.init(null,null,true);this.tree=oTree;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{_type:"RootNode",getNodeHtml:function(){return"";},toString:function(){return this._type;},loadComplete:function(){this.tree.draw();},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count;},getNodeDefinition:function(){for(var def,defs=[],i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
defs.push(def);}
return defs;},collapse:function(){},expand:function(){},getSiblings:function(){return null;},focus:function(){}});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.HTMLNode=function(oData,oParent,expanded,hasIcon){if(oData){this.init(oData,oParent,expanded);this.initContent(oData,hasIcon);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",html:null,_type:"HTMLNode",initContent:function(oData,hasIcon){this.setHtml(oData);this.contentElId="ygtvcontentel"+this.index;if(!Lang.isUndefined(hasIcon)){this.hasIcon=hasIcon;}},setHtml:function(o){this.data=o;this.html=(typeof o==="string")?o:o.html;var el=this.getContentEl();if(el){el.innerHTML=this.html;}},getContentHtml:function(){return this.html;},getNodeDefinition:function(){var def=YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.html=this.html;return def;}});})();YAHOO.widget.MenuNode=function(oData,oParent,expanded){YAHOO.widget.MenuNode.superclass.constructor.call(this,oData,oParent,expanded);this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{_type:"MenuNode"});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,Calendar=YAHOO.widget.Calendar;YAHOO.widget.DateNode=function(oData,oParent,expanded){YAHOO.widget.DateNode.superclass.constructor.call(this,oData,oParent,expanded);};YAHOO.extend(YAHOO.widget.DateNode,YAHOO.widget.TextNode,{_type:"DateNode",calendarConfig:null,fillEditorContainer:function(editorData){var cal,container=editorData.inputContainer;if(Lang.isUndefined(Calendar)){Dom.replaceClass(editorData.editorPanel,'ygtv-edit-DateNode','ygtv-edit-TextNode');YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this,editorData);return;}
if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=false;editorData.node.destroyEditorContents(editorData);editorData.inputObject=cal=new Calendar(container.appendChild(document.createElement('div')));if(this.calendarConfig){cal.cfg.applyConfig(this.calendarConfig,true);cal.cfg.fireQueue();}
cal.selectEvent.subscribe(function(){this.tree._closeEditor(true);},this,true);}else{cal=editorData.inputObject;}
cal.cfg.setProperty("selected",this.label,false);var delim=cal.cfg.getProperty('DATE_FIELD_DELIMITER');var pageDate=this.label.split(delim);cal.cfg.setProperty('pagedate',pageDate[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]+delim+pageDate[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]);cal.cfg.fireQueue();cal.render();cal.oDomContainer.focus();},saveEditorValue:function(editorData){var node=editorData.node,value;if(Lang.isUndefined(Calendar)){value=editorData.inputElement.value;}else{var cal=editorData.inputObject,date=cal.getSelectedDates()[0],dd=[];dd[cal.cfg.getProperty('MDY_DAY_POSITION')-1]=date.getDate();dd[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]=date.getMonth()+1;dd[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]=date.getFullYear();value=dd.join(cal.cfg.getProperty('DATE_FIELD_DELIMITER'));}
node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;}});})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,TV=YAHOO.widget.TreeView,TVproto=TV.prototype;TV.editorData={active:false,whoHasIt:null,nodeType:null,editorPanel:null,inputContainer:null,buttonsContainer:null,node:null,saveOnEnter:true};TVproto._nodeEditing=function(node){if(node.fillEditorContainer&&node.editable){var ed,topLeft,buttons,button,editorData=TV.editorData;editorData.active=true;editorData.whoHasIt=this;if(!editorData.nodeType){editorData.editorPanel=ed=document.body.appendChild(document.createElement('div'));Dom.addClass(ed,'ygtv-label-editor');buttons=editorData.buttonsContainer=ed.appendChild(document.createElement('div'));Dom.addClass(buttons,'ygtv-button-container');button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvok');button.innerHTML=' ';button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvcancel');button.innerHTML=' ';Event.on(buttons,'click',function(ev){var target=Event.getTarget(ev);var node=TV.editorData.node;if(Dom.hasClass(target,'ygtvok')){Event.stopEvent(ev);this._closeEditor(true);}
if(Dom.hasClass(target,'ygtvcancel')){Event.stopEvent(ev);this._closeEditor(false);}},this,true);editorData.inputContainer=ed.appendChild(document.createElement('div'));Dom.addClass(editorData.inputContainer,'ygtv-input');Event.on(ed,'keydown',function(ev){var editorData=TV.editorData,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.ENTER:Event.stopEvent(ev);if(editorData.saveOnEnter){this._closeEditor(true);}
break;case KEY.ESCAPE:Event.stopEvent(ev);this._closeEditor(false);break;}},this,true);}else{ed=editorData.editorPanel;}
editorData.node=node;if(editorData.nodeType){Dom.removeClass(ed,'ygtv-edit-'+editorData.nodeType);}
Dom.addClass(ed,' ygtv-edit-'+node._type);topLeft=Dom.getXY(node.getContentEl());Dom.setStyle(ed,'left',topLeft[0]+'px');Dom.setStyle(ed,'top',topLeft[1]+'px');Dom.setStyle(ed,'display','block');ed.focus();node.fillEditorContainer(editorData);return true;}};TVproto.onEventEditNode=function(oArgs){if(oArgs instanceof YAHOO.widget.Node){oArgs.editNode();}else if(oArgs.node instanceof YAHOO.widget.Node){oArgs.node.editNode();}};TVproto._closeEditor=function(save){var ed=TV.editorData,node=ed.node;if(save){ed.node.saveEditorValue(ed);}
Dom.setStyle(ed.editorPanel,'display','none');ed.active=false;node.focus();};TVproto._destroyEditor=function(){var ed=TV.editorData;if(ed&&ed.nodeType&&(!ed.active||ed.whoHasIt===this)){Event.removeListener(ed.editorPanel,'keydown');Event.removeListener(ed.buttonContainer,'click');ed.node.destroyEditorContents(ed);document.body.removeChild(ed.editorPanel);ed.nodeType=ed.editorPanel=ed.inputContainer=ed.buttonsContainer=ed.whoHasIt=ed.node=null;ed.active=false;}};var Nproto=YAHOO.widget.Node.prototype;Nproto.editable=false;Nproto.editNode=function(){this.tree._nodeEditing(this);};Nproto.fillEditorContainer=null;Nproto.destroyEditorContents=function(editorData){Event.purgeElement(editorData.inputContainer,true);editorData.inputContainer.innerHTML='';};Nproto.saveEditorValue=function(editorData){};var TNproto=YAHOO.widget.TextNode.prototype;TNproto.fillEditorContainer=function(editorData){var input;if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=true;editorData.node.destroyEditorContents(editorData);editorData.inputElement=input=editorData.inputContainer.appendChild(document.createElement('input'));}else{input=editorData.inputElement;}
input.value=this.label;input.focus();input.select();};TNproto.saveEditorValue=function(editorData){var node=editorData.node,value=editorData.inputElement.value;node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;};TNproto.destroyEditorContents=function(editorData){editorData.inputContainer.innerHTML='';};})();YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(type,el,callback){if(YAHOO.widget[type]){return new YAHOO.widget[type](el,callback);}else{return null;}},isValid:function(type){return(YAHOO.widget[type]);}};}();YAHOO.widget.TVFadeIn=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var tvanim=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var tvanim=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}};YAHOO.register("treeview",YAHOO.widget.TreeView,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.HtmlNode","TOPINCS.widgets.TextNode","YAHOO.widget.HTMLNode");(function(){TOPINCS.widgets.HtmlNode=HtmlNode;function HtmlNode(){YAHOO.widget.HTMLNode.apply(this,arguments);this.canHaveChildren=true;}
CERNY.inherit(HtmlNode,YAHOO.widget.HTMLNode);HtmlNode.prototype.getStyle=TOPINCS.widgets.TextNode.prototype.getStyle;})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Widget=YAHOO.widget;YAHOO.widget.TreeView=function(id,oConfig){if(id){this.init(id);}
if(oConfig){if(!Lang.isArray(oConfig)){oConfig=[oConfig];}
this.buildTreeFromObject(oConfig);}else if(this._el&&Lang.trim(this._el.innerHTML)){this.buildTreeFromMarkup(id);}};var TV=Widget.TreeView;TV.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,_hasDblClickSubscriber:false,_dblClickTimer:null,setExpandAnim:function(type){this._expandAnim=(Widget.TVAnim.isValid(type))?type:null;},setCollapseAnim:function(type){this._collapseAnim=(Widget.TVAnim.isValid(type))?type:null;},animateExpand:function(el,node){if(this._expandAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._expandAnim,el,function(){tree.expandComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"expand"});a.animate();}
return true;}
return false;},animateCollapse:function(el,node){if(this._collapseAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._collapseAnim,el,function(){tree.collapseComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"collapse"});a.animate();}
return true;}
return false;},expandComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"expand"});},collapseComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"collapse"});},init:function(id){this._el=Dom.get(id);this.id=Dom.generateId(this._el,"yui-tv-auto-id-");this.createEvent("animStart",this);this.createEvent("animComplete",this);this.createEvent("collapse",this);this.createEvent("collapseComplete",this);this.createEvent("expand",this);this.createEvent("expandComplete",this);this.createEvent("enterKeyPressed",this);this.createEvent("clickEvent",this);var self=this;this.createEvent("dblClickEvent",{scope:this,onSubscribeCallback:function(){self._hasDblClickSubscriber=true;}});this.createEvent("labelClick",this);this._nodes=[];TV.trees[this.id]=this;this.root=new Widget.RootNode(this);var LW=Widget.LogWriter;},buildTreeFromObject:function(oConfig){var build=function(parent,oConfig){var i,item,node,children,type,NodeType,ThisType;for(i=0;i<oConfig.length;i++){item=oConfig[i];if(Lang.isString(item)){node=new Widget.TextNode(item,parent);}else if(Lang.isObject(item)){children=item.children;delete item.children;type=item.type||'text';delete item.type;switch(type.toLowerCase()){case'text':node=new Widget.TextNode(item,parent);break;case'menu':node=new Widget.MenuNode(item,parent);break;case'html':node=new Widget.HTMLNode(item,parent);break;default:NodeType=Widget[type];if(Lang.isObject(NodeType)){for(ThisType=NodeType;ThisType&&ThisType!==Widget.Node;ThisType=ThisType.superclass.constructor){}
if(ThisType){node=new NodeType(item,parent);}else{}}else{}}
if(children){build(node,children);}}else{}}};build(this.root,oConfig);},buildTreeFromMarkup:function(id){var build=function(parent,markup){var el,node,child,text;for(el=Dom.getFirstChild(markup);el;el=Dom.getNextSibling(el)){if(el.nodeType==1){switch(el.tagName.toUpperCase()){case'LI':for(child=el.firstChild;child;child=child.nextSibling){if(child.nodeType==3){text=Lang.trim(child.nodeValue);if(text.length){node=new Widget.TextNode(text,parent,false);}}else{switch(child.tagName.toUpperCase()){case'UL':case'OL':build(node,child);break;case'A':node=new Widget.TextNode({label:child.innerHTML,href:child.href,target:child.target,title:child.title||child.alt},parent,false);break;default:node=new Widget.HTMLNode(child.parentNode.innerHTML,parent,false,true);break;}}}
break;case'UL':case'OL':build(node,el);break;}}}};var markup=Dom.getChildrenBy(Dom.get(id),function(el){var tag=el.tagName.toUpperCase();return tag=='UL'||tag=='OL';});if(markup.length){build(this.root,markup[0]);}else{}},render:function(){var html=this.root.getHtml();this.getEl().innerHTML=html;var getTarget=function(ev){var target=Event.getTarget(ev);if(target.tagName.toUpperCase()!='TD'){target=Dom.getAncestorByTagName(target,'td');}
if(Lang.isNull(target)){return null;}
if(target.className.length===0){target=target.previousSibling;if(Lang.isNull(target)){return null;}}
return target;};if(!this._hasEvents){Event.on(this.getEl(),'click',function(ev){var self=this,el=Event.getTarget(ev),node=this.getNodeByElement(el);if(!node){return;}
var toggle=function(){if(node.expanded){node.collapse();}else{node.expand();}
node.focus();};if(Dom.hasClass(el,node.labelStyle)||Dom.getAncestorByClassName(el,node.labelStyle)){this.fireEvent('labelClick',node);}
while(el&&!Dom.hasClass(el.parentNode,'ygtvrow')&&!/ygtv[tl][mp]h?h?/.test(el.className)){el=Dom.getAncestorByTagName(el,'td');}
if(el){if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(/ygtv[tl][mp]h?h?/.test(el.className)){toggle();}else{if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}else{if(this._hasDblClickSubscriber){this._dblClickTimer=window.setTimeout(function(){self._dblClickTimer=null;if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){toggle();}},200);}else{if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){}}}}}},this,true);Event.on(this.getEl(),'dblclick',function(ev){if(!this._hasDblClickSubscriber){return;}
var el=Event.getTarget(ev);while(!Dom.hasClass(el.parentNode,'ygtvrow')){el=Dom.getAncestorByTagName(el,'td');}
if(/ygtv(blank)?depthcell/.test(el.className)){return;}
if(!(/ygtv[tl][mp]h?h?/.test(el.className))){this.fireEvent('dblClickEvent',{event:ev,node:this.getNodeByElement(el)});if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}}},this,true);Event.on(this.getEl(),'mouseover',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])/gi,'ygtv$1$2h').replace(/h+/,'h');}});Event.on(this.getEl(),'mouseout',function(ev){var target=getTarget(ev);if(target){target.className=target.className.replace(/ygtv([lt])([mp])h/gi,'ygtv$1$2');}});Event.on(this.getEl(),'keydown',function(ev){var target=Event.getTarget(ev),node=this.getNodeByElement(target),newNode=node,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.UP:do{if(newNode.previousSibling){newNode=newNode.previousSibling;}else{newNode=newNode.parent;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.DOWN:do{if(newNode.nextSibling){newNode=newNode.nextSibling;}else{newNode.expand();newNode=(newNode.children.length||null)&&newNode.children[0];}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.LEFT:do{if(newNode.parent){newNode=newNode.parent;}else{newNode=newNode.previousSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.RIGHT:do{newNode.expand();if(newNode.children.length){newNode=newNode.children[0];}else{newNode=newNode.nextSibling;}}while(newNode&&!newNode.focus());if(!newNode){node.focus();}
Event.preventDefault(ev);break;case KEY.ENTER:if(node.href){if(node.target){window.open(node.href,node.target);}else{window.location(node.href);}}else{node.toggle();}
this.fireEvent('enterKeyPressed',node);Event.preventDefault(ev);break;case KEY.HOME:newNode=this.getRoot();if(newNode.children.length){newNode=newNode.children[0];}
if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case KEY.END:newNode=newNode.parent.children;newNode=newNode[newNode.length-1];if(!newNode.focus()){node.focus();}
Event.preventDefault(ev);break;case 107:if(ev.shiftKey){node.parent.expandAll();}else{node.expand();}
break;case 109:if(ev.shiftKey){node.parent.collapseAll();}else{node.collapse();}
break;default:break;}},this,true);}
this._hasEvents=true;},getEl:function(){if(!this._el){this._el=Dom.get(this.id);}
return this._el;},regNode:function(node){this._nodes[node.index]=node;},getRoot:function(){return this.root;},setDynamicLoad:function(fnDataLoader,iconMode){this.root.setDynamicLoad(fnDataLoader,iconMode);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(nodeIndex){var n=this._nodes[nodeIndex];return(n)?n:null;},getNodeByProperty:function(property,value){for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){return n;}}}
return null;},getNodesByProperty:function(property,value){var values=[];for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if(n.data&&value==n.data[property]){values.push(n);}}}
return(values.length)?values:null;},getNodeByElement:function(el){var p=el,m,re=/ygtv([^\d]*)(.*)/;do{if(p&&p.id){m=p.id.match(re);if(m&&m[2]){return this.getNodeByIndex(m[2]);}}
p=p.parentNode;if(!p||!p.tagName){break;}}
while(p.id!==this.id&&p.tagName.toLowerCase()!=="body");return null;},removeNode:function(node,autoRefresh){if(node.isRoot()){return false;}
var p=node.parent;if(p.parent){p=p.parent;}
this._deleteNode(node);if(autoRefresh&&p&&p.childrenRendered){p.refresh();}
return true;},_removeChildren_animComplete:function(o){this.unsubscribe(this._removeChildren_animComplete);this.removeChildren(o.node);},removeChildren:function(node){if(node.expanded){if(this._collapseAnim){this.subscribe("animComplete",this._removeChildren_animComplete,this,true);Widget.Node.prototype.collapse.call(node);return;}
node.collapse();}
while(node.children.length){this._deleteNode(node.children[0]);}
if(node.isRoot()){Widget.Node.prototype.expand.call(node);}
node.childrenRendered=false;node.dynamicLoadComplete=false;node.updateIcon();},_deleteNode:function(node){this.removeChildren(node);this.popNode(node);},popNode:function(node){var p=node.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=node){a[a.length]=p.children[i];}}
p.children=a;p.childrenRendered=false;if(node.previousSibling){node.previousSibling.nextSibling=node.nextSibling;}
if(node.nextSibling){node.nextSibling.previousSibling=node.previousSibling;}
node.parent=null;node.previousSibling=null;node.nextSibling=null;node.tree=null;delete this._nodes[node.index];},destroy:function(){if(this._destroyEditor){this._destroyEditor();}
var el=this.getEl();Event.removeListener(el,'click');Event.removeListener(el,'dblclick');Event.removeListener(el,'mouseover');Event.removeListener(el,'mouseout');Event.removeListener(el,'keydown');for(var i=0;i<this._nodes.length;i++){var node=this._nodes[i];if(node&&node.destroy){node.destroy();}}
el.parentNode.removeChild(el);this._hasEvents=false;},toString:function(){return"TreeView "+this.id;},getNodeCount:function(){return this.getRoot().getNodeCount();},getTreeDefinition:function(){return this.getRoot().getNodeDefinition();},onExpand:function(node){},onCollapse:function(node){}};var PROT=TV.prototype;PROT.draw=PROT.render;YAHOO.augment(TV,YAHOO.util.EventProvider);TV.nodeCount=0;TV.trees=[];TV.getTree=function(treeId){var t=TV.trees[treeId];return(t)?t:null;};TV.getNode=function(treeId,nodeIndex){var t=TV.getTree(treeId);return(t)?t.getNodeByIndex(nodeIndex):null;};TV.FOCUS_CLASS_NAME='ygtvfocus';TV.preload=function(e,prefix){prefix=prefix||"ygtv";var styles=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=1;i<styles.length;i=i+1){sb[sb.length]='<span class="'+prefix+styles[i]+'">&#160;</span>';}
var f=document.createElement("div");var s=f.style;s.className=prefix+styles[0];s.position="absolute";s.height="1px";s.width="1px";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);Event.removeListener(window,"load",TV.preload);};Event.addListener(window,"load",TV.preload);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.Node=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,isLeaf:false,contentStyle:"",contentElId:null,_type:"Node",init:function(oData,oParent,expanded){this.data=oData;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.contentElId="ygtvcontentel"+this.index;if(Lang.isObject(oData)){for(var property in oData){if(property!="children"&&property.charAt(0)!='_'&&oData.hasOwnProperty(property)&&!Lang.isUndefined(this[property])&&!Lang.isFunction(this[property])){this[property]=oData[property];}}}
if(!Lang.isUndefined(expanded)){this.expanded=expanded;}
this.createEvent("parentChange",this);if(oParent){oParent.appendChild(this);}},applyParent:function(parentNode){if(!parentNode){return false;}
this.tree=parentNode.tree;this.parent=parentNode;this.depth=parentNode.depth+1;this.tree.regNode(this);parentNode.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}
this.fireEvent("parentChange");return true;},appendChild:function(childNode){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=childNode;childNode.previousSibling=sib;}
this.children[this.children.length]=childNode;childNode.applyParent(this);if(this.childrenRendered&&this.expanded){this.getChildrenEl().style.display="";}
return childNode;},appendTo:function(parentNode){return parentNode.appendChild(this);},insertBefore:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);p.children.splice(refIndex,0,this);if(node.previousSibling){node.previousSibling.nextSibling=this;}
this.previousSibling=node.previousSibling;this.nextSibling=node;node.previousSibling=this;this.applyParent(p);}
return this;},insertAfter:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);if(!node.nextSibling){this.nextSibling=null;return this.appendTo(p);}
p.children.splice(refIndex+1,0,this);node.nextSibling.previousSibling=this;this.previousSibling=node;this.nextSibling=node.nextSibling;node.nextSibling=this;this.applyParent(p);}
return this;},isChildOf:function(parentNode){if(parentNode&&parentNode.children){for(var i=0,len=parentNode.children.length;i<len;++i){if(parentNode.children[i]===this){return i;}}}
return-1;},getSiblings:function(){var sib=this.parent.children.slice(0);for(var i=0;i<sib.length&&sib[i]!=this;i++){}
sib.splice(i,1);if(sib.length){return sib;}
return null;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl(),this)){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl(),this)){this.getChildrenEl().style.display="none";}},getElId:function(){return"ygtv"+this.index;},getChildrenElId:function(){return"ygtvc"+this.index;},getToggleElId:function(){return"ygtvt"+this.index;},getEl:function(){return Dom.get(this.getElId());},getChildrenEl:function(){return Dom.get(this.getChildrenElId());},getToggleEl:function(){return Dom.get(this.getToggleElId());},getContentEl:function(){return Dom.get(this.contentElId);},collapse:function(){if(!this.expanded){return;}
var ret=this.tree.onCollapse(this);if(false===ret){return;}
ret=this.tree.fireEvent("collapse",this);if(false===ret){return;}
if(!this.getEl()){this.expanded=false;}else{this.hideChildren();this.expanded=false;this.updateIcon();}
ret=this.tree.fireEvent("collapseComplete",this);},expand:function(lazySource){if(this.expanded&&!lazySource){return;}
var ret=true;if(!lazySource){ret=this.tree.onExpand(this);if(false===ret){return;}
ret=this.tree.fireEvent("expand",this);}
if(false===ret){return;}
if(!this.getEl()){this.expanded=true;return;}
if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}
this.expanded=true;this.updateIcon();if(this.isLoading){this.expanded=false;return;}
if(!this.multiExpand){var sibs=this.getSiblings();for(var i=0;sibs&&i<sibs.length;++i){if(sibs[i]!=this&&sibs[i].expanded){sibs[i].collapse();}}}
this.showChildren();ret=this.tree.fireEvent("expandComplete",this);},updateIcon:function(){if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=el.className.replace(/ygtv(([tl][pmn]h?)|(loading))/,this.getStyle());}}},getStyle:function(){if(this.isLoading){return"ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var type="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){type=(this.expanded)?"m":"p";}
return"ygtv"+loc+type;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}
return s;},expandAll:function(){for(var i=0;i<this.children.length;++i){var c=this.children[i];if(c.isDynamic()){break;}else if(!c.multiExpand){break;}else{c.expand();c.expandAll();}}},collapseAll:function(){for(var i=0;i<this.children.length;++i){this.children[i].collapse();this.children[i].collapseAll();}},setDynamicLoad:function(fnDataLoader,iconMode){if(fnDataLoader){this.dataLoader=fnDataLoader;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}
if(iconMode){this.iconMode=iconMode;}},isRoot:function(){return(this==this.tree.root);},isDynamic:function(){if(this.isLeaf){return false;}else{return(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));}},getIconMode:function(){return(this.iconMode||this.tree.root.iconMode);},hasChildren:function(checkForLazyLoad){if(this.isLeaf){return false;}else{return(this.children.length>0||(checkForLazyLoad&&this.isDynamic()&&!this.dynamicLoadComplete));}},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;var sb=[];sb[sb.length]='<div class="ygtvitem" id="'+this.getElId()+'">';sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]='</div>';return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]='<div class="ygtvchildren"';sb[sb.length]=' id="'+this.getChildrenElId()+'"';if(!this.expanded||!this.hasChildren()){sb[sb.length]=' style="display:none;"';}
sb[sb.length]='>';if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}
sb[sb.length]='</div>';return sb.join("");},renderChildren:function(){var node=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){node.dataLoader(node,function(){node.loadComplete();});},10);}else if(this.tree.root.dataLoader){setTimeout(function(){node.tree.root.dataLoader(node,function(){node.loadComplete();});},10);}else{return"Error: data loader not found or not specified.";}
return"";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i<this.children.length;++i){sb[sb.length]=this.children[i].getHtml();}
this.childrenRendered=true;return sb.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.dynamicLoadComplete=true;this.isLoading=false;this.expand(true);this.tree.locked=false;},getAncestor:function(depth){if(depth>=this.depth||depth<0){return null;}
var p=this.parent;while(p.depth>depth){p=p.parent;}
return p;},getDepthStyle:function(depth){return(this.getAncestor(depth).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){var sb=[];sb[sb.length]='<table border="0" cellpadding="0" cellspacing="0" class="ygtvdepth'+this.depth+'">';sb[sb.length]='<tr class="ygtvrow">';for(var i=0;i<this.depth;++i){sb[sb.length]='<td class="'+this.getDepthStyle(i)+'"><div class="ygtvspacer"></div></td>';}
if(this.hasIcon){sb[sb.length]='<td';sb[sb.length]=' id="'+this.getToggleElId()+'"';sb[sb.length]=' class="'+this.getStyle()+'"';sb[sb.length]='><a href="javascript:void(null)" class="ygtvspacer">&nbsp;</a></td>';}
sb[sb.length]='<td';sb[sb.length]=' id="'+this.contentElId+'"';sb[sb.length]=' class="'+this.contentStyle+' ygtvcontent" ';sb[sb.length]=(this.nowrap)?' nowrap="nowrap" ':'';sb[sb.length]=' >';sb[sb.length]=this.getContentHtml();sb[sb.length]='</td>';sb[sb.length]='</tr>';sb[sb.length]='</table>';return sb.join("");},getContentHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return this._type+" ("+this.index+")";},_focusHighlightedItems:[],_focusedItem:null,focus:function(){var focused=false,self=this;var removeListeners=function(){var el;if(self._focusedItem){Event.removeListener(self._focusedItem,'blur');self._focusedItem=null;}
while((el=self._focusHighlightedItems.shift())){Dom.removeClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);}};removeListeners();Dom.getElementsBy(function(el){return/ygtv(([tl][pmn]h?)|(content))/.test(el.className);},'td',this.getEl().firstChild,function(el){Dom.addClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);if(!focused){var aEl=el.getElementsByTagName('a');if(aEl.length){aEl=aEl[0];aEl.focus();self._focusedItem=aEl;Event.on(aEl,'blur',removeListeners);focused=true;}}
self._focusHighlightedItems.push(el);});if(!focused){removeListeners();}
return focused;},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count+1;},getNodeDefinition:function(){if(this.isDynamic()){return false;}
var def,defs=this.data,children=[];if(this.href){defs.href=this.href;}
if(this.target!='_self'){defs.target=this.target;}
if(this.expanded){defs.expanded=this.expanded;}
if(!this.multiExpand){defs.multiExpand=this.multiExpand;}
if(!this.hasIcon){defs.hasIcon=this.hasIcon;}
if(this.nowrap){defs.nowrap=this.nowrap;}
defs.type=this._type;for(var i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
children.push(def);}
if(children.length){defs.children=children;}
return defs;},getToggleLink:function(){return'return false;';}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.TextNode=function(oData,oParent,expanded){if(oData){if(Lang.isString(oData)){oData={label:oData};}
this.init(oData,oParent,expanded);this.setUpLabel(oData);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,title:null,_type:"TextNode",setUpLabel:function(oData){if(Lang.isString(oData)){oData={label:oData};}else{if(oData.style){this.labelStyle=oData.style;}}
this.label=oData.label;this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return Dom.get(this.labelElId);},getContentHtml:function(){var sb=[];sb[sb.length]=this.href?'<a':'<span';sb[sb.length]=' id="'+this.labelElId+'"';if(this.title){sb[sb.length]=' title="'+this.title+'"';}
sb[sb.length]=' class="'+this.labelStyle+'"';if(this.href){sb[sb.length]=' href="'+this.href+'"';sb[sb.length]=' target="'+this.target+'"';}
sb[sb.length]=' >';sb[sb.length]=this.label;sb[sb.length]=this.href?'</a>':'</span>';return sb.join("");},getNodeDefinition:function(){var def=YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.label=this.label;if(this.labelStyle!='ygtvlabel'){def.style=this.labelStyle;}
if(this.title){def.title=this.title;}
return def;},toString:function(){return YAHOO.widget.TextNode.superclass.toString.call(this)+": "+this.label;},onLabelClick:function(){return false;}});})();YAHOO.widget.RootNode=function(oTree){this.init(null,null,true);this.tree=oTree;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{_type:"RootNode",getNodeHtml:function(){return"";},toString:function(){return this._type;},loadComplete:function(){this.tree.draw();},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count;},getNodeDefinition:function(){for(var def,defs=[],i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
defs.push(def);}
return defs;},collapse:function(){},expand:function(){},getSiblings:function(){return null;},focus:function(){}});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.HTMLNode=function(oData,oParent,expanded,hasIcon){if(oData){this.init(oData,oParent,expanded);this.initContent(oData,hasIcon);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",html:null,_type:"HTMLNode",initContent:function(oData,hasIcon){this.setHtml(oData);this.contentElId="ygtvcontentel"+this.index;if(!Lang.isUndefined(hasIcon)){this.hasIcon=hasIcon;}},setHtml:function(o){this.data=o;this.html=(typeof o==="string")?o:o.html;var el=this.getContentEl();if(el){el.innerHTML=this.html;}},getContentHtml:function(){return this.html;},getNodeDefinition:function(){var def=YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.html=this.html;return def;}});})();YAHOO.widget.MenuNode=function(oData,oParent,expanded){YAHOO.widget.MenuNode.superclass.constructor.call(this,oData,oParent,expanded);this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{_type:"MenuNode"});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,Calendar=YAHOO.widget.Calendar;YAHOO.widget.DateNode=function(oData,oParent,expanded){YAHOO.widget.DateNode.superclass.constructor.call(this,oData,oParent,expanded);};YAHOO.extend(YAHOO.widget.DateNode,YAHOO.widget.TextNode,{_type:"DateNode",calendarConfig:null,fillEditorContainer:function(editorData){var cal,container=editorData.inputContainer;if(Lang.isUndefined(Calendar)){Dom.replaceClass(editorData.editorPanel,'ygtv-edit-DateNode','ygtv-edit-TextNode');YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this,editorData);return;}
if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=false;editorData.node.destroyEditorContents(editorData);editorData.inputObject=cal=new Calendar(container.appendChild(document.createElement('div')));if(this.calendarConfig){cal.cfg.applyConfig(this.calendarConfig,true);cal.cfg.fireQueue();}
cal.selectEvent.subscribe(function(){this.tree._closeEditor(true);},this,true);}else{cal=editorData.inputObject;}
cal.cfg.setProperty("selected",this.label,false);var delim=cal.cfg.getProperty('DATE_FIELD_DELIMITER');var pageDate=this.label.split(delim);cal.cfg.setProperty('pagedate',pageDate[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]+delim+pageDate[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]);cal.cfg.fireQueue();cal.render();cal.oDomContainer.focus();},saveEditorValue:function(editorData){var node=editorData.node,value;if(Lang.isUndefined(Calendar)){value=editorData.inputElement.value;}else{var cal=editorData.inputObject,date=cal.getSelectedDates()[0],dd=[];dd[cal.cfg.getProperty('MDY_DAY_POSITION')-1]=date.getDate();dd[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]=date.getMonth()+1;dd[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]=date.getFullYear();value=dd.join(cal.cfg.getProperty('DATE_FIELD_DELIMITER'));}
node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;}});})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,TV=YAHOO.widget.TreeView,TVproto=TV.prototype;TV.editorData={active:false,whoHasIt:null,nodeType:null,editorPanel:null,inputContainer:null,buttonsContainer:null,node:null,saveOnEnter:true};TVproto._nodeEditing=function(node){if(node.fillEditorContainer&&node.editable){var ed,topLeft,buttons,button,editorData=TV.editorData;editorData.active=true;editorData.whoHasIt=this;if(!editorData.nodeType){editorData.editorPanel=ed=document.body.appendChild(document.createElement('div'));Dom.addClass(ed,'ygtv-label-editor');buttons=editorData.buttonsContainer=ed.appendChild(document.createElement('div'));Dom.addClass(buttons,'ygtv-button-container');button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvok');button.innerHTML=' ';button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvcancel');button.innerHTML=' ';Event.on(buttons,'click',function(ev){var target=Event.getTarget(ev);var node=TV.editorData.node;if(Dom.hasClass(target,'ygtvok')){Event.stopEvent(ev);this._closeEditor(true);}
if(Dom.hasClass(target,'ygtvcancel')){Event.stopEvent(ev);this._closeEditor(false);}},this,true);editorData.inputContainer=ed.appendChild(document.createElement('div'));Dom.addClass(editorData.inputContainer,'ygtv-input');Event.on(ed,'keydown',function(ev){var editorData=TV.editorData,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.ENTER:Event.stopEvent(ev);if(editorData.saveOnEnter){this._closeEditor(true);}
break;case KEY.ESCAPE:Event.stopEvent(ev);this._closeEditor(false);break;}},this,true);}else{ed=editorData.editorPanel;}
editorData.node=node;if(editorData.nodeType){Dom.removeClass(ed,'ygtv-edit-'+editorData.nodeType);}
Dom.addClass(ed,' ygtv-edit-'+node._type);topLeft=Dom.getXY(node.getContentEl());Dom.setStyle(ed,'left',topLeft[0]+'px');Dom.setStyle(ed,'top',topLeft[1]+'px');Dom.setStyle(ed,'display','block');ed.focus();node.fillEditorContainer(editorData);return true;}};TVproto.onEventEditNode=function(oArgs){if(oArgs instanceof YAHOO.widget.Node){oArgs.editNode();}else if(oArgs.node instanceof YAHOO.widget.Node){oArgs.node.editNode();}};TVproto._closeEditor=function(save){var ed=TV.editorData,node=ed.node;if(save){ed.node.saveEditorValue(ed);}
Dom.setStyle(ed.editorPanel,'display','none');ed.active=false;node.focus();};TVproto._destroyEditor=function(){var ed=TV.editorData;if(ed&&ed.nodeType&&(!ed.active||ed.whoHasIt===this)){Event.removeListener(ed.editorPanel,'keydown');Event.removeListener(ed.buttonContainer,'click');ed.node.destroyEditorContents(ed);document.body.removeChild(ed.editorPanel);ed.nodeType=ed.editorPanel=ed.inputContainer=ed.buttonsContainer=ed.whoHasIt=ed.node=null;ed.active=false;}};var Nproto=YAHOO.widget.Node.prototype;Nproto.editable=false;Nproto.editNode=function(){this.tree._nodeEditing(this);};Nproto.fillEditorContainer=null;Nproto.destroyEditorContents=function(editorData){Event.purgeElement(editorData.inputContainer,true);editorData.inputContainer.innerHTML='';};Nproto.saveEditorValue=function(editorData){};var TNproto=YAHOO.widget.TextNode.prototype;TNproto.fillEditorContainer=function(editorData){var input;if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=true;editorData.node.destroyEditorContents(editorData);editorData.inputElement=input=editorData.inputContainer.appendChild(document.createElement('input'));}else{input=editorData.inputElement;}
input.value=this.label;input.focus();input.select();};TNproto.saveEditorValue=function(editorData){var node=editorData.node,value=editorData.inputElement.value;node.label=value;node.data.label=value;node.getLabelEl().innerHTML=value;};TNproto.destroyEditorContents=function(editorData){editorData.inputContainer.innerHTML='';};})();YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(type,el,callback){if(YAHOO.widget[type]){return new YAHOO.widget[type](el,callback);}else{return null;}},isValid:function(type){return(YAHOO.widget[type]);}};}();YAHOO.widget.TVFadeIn=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var tvanim=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var tvanim=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}};YAHOO.register("treeview",YAHOO.widget.TreeView,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.TreeView","TOPINCS.widgets.TextNode","TOPINCS.widgets.HtmlNode","YAHOO.widget.HTMLNode","TOPINCS.util","CERNY.util","YAHOO.widget.TreeView");YAHOO.widget.TreeView.prototype.logger=CERNY.Logger("YAHOO.widget.TreeView");CERNY.intercept(YAHOO.widget.TreeView.prototype);(function(){var method=CERNY.method;var signature=CERNY.signature;TOPINCS.widgets.TreeView=TreeView;var logger=CERNY.Logger("TOPINCS.widgets.TreeView");function TreeView(){YAHOO.widget.TreeView.apply(this,arguments);}
CERNY.inherit(TreeView,YAHOO.widget.TreeView);TreeView.prototype.logger=logger;function setup(rootData,getData,nodeHandler,nodeFilter){if(!nodeFilter){nodeFilter=function(){return true;};}
this.setDynamicLoad(function(node,onComplete){if(node.data.id&&node.doGetData!==false){var data=getData(node.data.id);addData(node,data,function(node,child){if(child.count<-1){node.labelStyle="leave";}
nodeHandler(node,child);},nodeFilter);}
onComplete();},1);addData(this.getRoot(),rootData,nodeHandler,nodeFilter);}
signature(setup,"undefined","object",["function","undefined"],["function","undefined"],["function","undefined"]);method(TreeView.prototype,"setup",setup);function addData(anchor,data,nodeHandler,nodeFilter){if(data.children){data.children.sort(TOPINCS.util.compareTopicProxiesByName);data.children.map(function(child){if(nodeFilter(child)){var node;if(child.html){node=new TOPINCS.widgets.HtmlNode(child,anchor,false);}else{child.label=CERNY.util.escapeHtml(child.label);node=new TOPINCS.widgets.TextNode(child,anchor,false);}
if(child.count<-1){node.canHaveChildren=false;node.doGetData=false;}
if(nodeHandler){nodeHandler(node,child);}
addData(node,child,nodeHandler,nodeFilter);}});}}
function deleteHref(node){delete(node.href);if(isArray(node.children)){var i=node.children.length;while(i--){deleteHref(node.children[i]);}}}
signature(deleteHref,"undefined","object");method(TreeView,"deleteHref",deleteHref);})();CERNY.require("TOPINCS.wiki.Browser","TOPINCS.wiki.init","TOPINCS.cons","TOPINCS.util","TOPINCS.wiki.DICT","TOPINCS.wiki.Preview","TOPINCS.CoreTopics","TOPINCS.widgets.TreeView");(function(){var Logger=CERNY.Logger;var method=CERNY.method;var signature=CERNY.signature;var TreeView=TOPINCS.widgets.TreeView;var getResult=TOPINCS.util.getResult;var Browser={};TOPINCS.wiki.Browser=Browser;var logger=Logger("TOPINCS.wiki.Browser");var DICT=TOPINCS.wiki.DICT;var ID_EL_TREE="tree";var ROOT_CONTENT=TOPINCS.wiki.ROOT_CONTENT;var CoreTopics=TOPINCS.CoreTopics;var blacklist=[CoreTopics["association-type"].id,CoreTopics["association-role-type"].id,CoreTopics["occurrence-type"].id,CoreTopics["topic-name-type"].id,CoreTopics["topic-type"].id,CoreTopics["language"].id,CoreTopics["tool"].id];function getContentOfNode(typeId){var url="topicmaps/.content?typeid="+typeId;return getResult(url,MEDIA_TYPE_NODE);}
function select(topicId){TOPINCS.util.setLocation(TOPINCS.util.createWikiUri(topicId));}
function main(){TOPINCS.wiki.init();var context=TOPINCS.wiki.getBaseContext();var nodeFilter;if(context.options.displayAllTypesInContentTree){nodeFilter=function(node){return true;};}else{nodeFilter=function(node){return!blacklist.contains(node.id);};}
var treeView=new TreeView(ID_EL_TREE);treeView.setup(ROOT_CONTENT,getContentOfNode,nodeHandler,nodeFilter);treeView.draw();TOPINCS.wiki.Preview.install(treeView.getEl());}
signature(main,"undefined");method(Browser,"main",main);function nodeHandler(node,child){node.href=TOPINCS.util.createWikiUri(child.id);}})();