// (c) 2006-2008 Robert Cerny
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="3.6.1/.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 USERS_URL=TOPINCS.BASE+"/users/";var INCLUDE_URL="wiki/.include";var ACCEPT_SCOPE="";var USCOPE="uc";var ASCOPE="*";var TOPIC_SELF_REFERENCE="_self_";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_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 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]);}}}}})();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.");break;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 url=TOPIC_SEARCH_URL+"?";if(substring){url+="&string="+encodeURIComponent(substring);}
if(type){url+="&type="+type;}
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 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--){var 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){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 optgroupEl=Element.create("optgroup",null,"label="+group.label);group.options.map(function(option){var optionEl=Element.create("option",option.label,"id="+option.id);if(selected.contains(option.id)){optionEl.setAttr("selected","selected");}
optgroupEl.appendChild(optionEl);});selectEl.appendChild(optgroupEl);});return selectEl;}
signature(convertTopicProxyArrayToSelect,Element,Array,Array,"number");method(TOPINCS.widgets.util,"convertTopicProxyArrayToSelect",convertTopicProxyArrayToSelect);function getSelectedOptions(selectEl){var options=selectEl.node.options;var result=[];var i=options.length;while(i--){if(options[i].selected){result.push(options[i].id);}}
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 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;}},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 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");}
var core=newItem.core(children,parent);core.version="1.0";core.item_type=newItem.itemType;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){if(!isBoolean(children)){children=true;}
if(!isBoolean(parent)){parent=false;}
if(!isBoolean(mindSystemId)){mindSystemId=true;}
MAP_TEMP_IDS.apply(this,function(name,value){return isTempId(value);});var 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);}
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));});}}}
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(systemId==TOPIC_SELF_REFERENCE){return systemId;}else{return"ii:"+systemIdToPublicId(systemId,"topics");}}
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 handleSelfReference(){var topicId=this.id;this.apply(function(item){var i=item.references.length;while(i--){if(item[item.references[i]]==topicId){item[item.references[i]]=TOPIC_SELF_REFERENCE;}}
if(item.scope){i=item.scope.length;while(i--){if(item.scope[i]==topicId){item.scope[i]=TOPIC_SELF_REFERENCE;}}}},true);}
signature(handleSelfReference,"undefined");method(Topic.prototype,"handleSelfReference",handleSelfReference);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);}
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.handleSelfReference();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;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,"getType",getType);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 paragraph=this.paragraphMap[typeId];if(!paragraph){paragraph=new Paragraph(typeId,this,associationTypeId);this.paragraphMap[typeId]=paragraph;var nrTypeId=Number(typeId);var index=this.paragraphTypeIds.getInsertionIndex(nrTypeId,this.typeOrderComperator);this.paragraphTypeIds.insertAt(index,nrTypeId);this.insertItemAt(index,paragraph);}
return paragraph;}
signature(getParagraph,"object","string",["undefined","string"]);function removeParagraph(paragraph){delete(this.paragraphMap[paragraph.typeId]);this.paragraphTypeIds.remove(paragraph.typeId);this.removeItem(paragraph);}
signature(removeParagraph,"undefined","object");function addStatement(typeId,statement){if(!this.hiddenTypes.contains(typeId)){var associationTypeId;if(statement instanceof Association){associationTypeId=statement.type;}
var paragraph=this.getParagraph(typeId,associationTypeId);paragraph.addItem(statement);}}
signature(addStatement,"undefined","string","object");method(Article,"addStatement",addStatement);function removeStatement(statement){var paragraph=this.getParagraph(this.getType(statement));paragraph.removeItem(statement);if(paragraph.length===0){this.removeParagraph(paragraph);}}
signature(removeStatement,"undefined","object");function getType(statement){if(statement instanceof Association){var roleOfSubject=statement.getRoleByPlayer(this.subjectId);return roleOfSubject.type;}
return statement.type;}
signature(getType,"string",[Association,Occurrence,Name]);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);}})();CERNY.require("TOPINCS.widgets.ValueViewer","TOPINCS.cons","TOPINCS.widgets.DICT","TOPINCS.util","CERNY.util","CERNY.text.DateFormat","CERNY.js.Date","CERNY.text.TimeFormat","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;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",CERNY.dom.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",CERNY.dom.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",CERNY.dom.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",CERNY.dom.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",CERNY.dom.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",CERNY.dom.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){logger.debug("e: "+e);el=Element.create("span",this.value);}
this.el.appendChild(el);return this.el;}
signature("render",CERNY.dom.Element);method(TimeViewer.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);}}
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){var divE=Element.create("div");var t=this;if(this.showCloseButton){var imgE=Element.create("img",null,"src=3.6.1/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);}
this.titleEl=Element.create("div",null,"class=popup-title");this.title=conf.title||"";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");if(this.title){okCancelContentEl.appendChildren(this.titleEl);}
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);}
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 focus(){this.el.node.focus();}
method(Icon.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.InputCompleter","JSDOMLIB","TOPINCS.util","TOPINCS.widgets.util","TOPINCS.widgets.Icon","TOPINCS.widgets.DICT","CERNY.event.Observable","CERNY.js.Array","CERNY.js.String","CERNY.dom.html","CERNY.dom.Element");(function(){TOPINCS.widgets.InputCompleter=InputCompleter;var Element=CERNY.dom.Element;var Icon=TOPINCS.widgets.Icon;var method=CERNY.method;var util=TOPINCS.widgets.util;var showMessage=TOPINCS.util.showMessage;var signature=CERNY.signature;var name="TOPINCS.widgets.InputCompleter";var DICT=TOPINCS.widgets.DICT;var logger=CERNY.Logger(name);var KEYS=[8,9,16,17,18,35,36,37,38,46];var EVT_VALUE_SET=name+".valueSet";var EVT_SOME_MATCHES=name+".someMatches";var EVT_NO_MATCHES=name+".noMatches";var EVT_OPTION_FOCUSED=name+".optionFocused";var EVT_OPTION_BLURRED=name+".optionBlurred";function InputCompleter(conf){if(conf){this.completeFunction=conf.completeFunction;if(isNumber(conf.startCompleting)){this.startCompleting=conf.startCompleting;}else{this.startCompleting=3;}
this.value=conf.initialValue||null;this.initialText=conf.initialText||"";this.limit=conf.limit||10;this.iconTooltip=conf.iconTooltip||DICT.tt_ic_icon;this.noMatchesLabel=conf.noMatchesLabel||DICT.msg_no_matches_default;this.moreCharactersMessage=conf.moreCharactersMessage||DICT.msg_ic_more_chars;this.typingThreshold=conf.typingThreshold||600;if(!isBoolean(conf.auto)){this.auto=true;}else{this.auto=conf.auto;}
this.ignoreGrouping=false;this.highlighted=null;this.sizeAtFristNoMatches=-1;this.evtListener=null;this.specialOptions=[];}}
InputCompleter.prototype.logger=logger;CERNY.event.Observable(InputCompleter.prototype);InputCompleter.EVT_SOME_MATCHES=EVT_SOME_MATCHES;InputCompleter.EVT_NO_MATCHES=EVT_NO_MATCHES;InputCompleter.EVT_VALUE_SET=EVT_VALUE_SET;InputCompleter.EVT_OPTION_FOCUSED=EVT_OPTION_FOCUSED;InputCompleter.EVT_OPTION_BLURRED=EVT_OPTION_BLURRED;function render(){this.el=Element.create("span",null,"class=input-completer");this.inputEl=Element.create("input");var t=this;this.icon=new Icon(this.iconTooltip,"search");this.icon.addAction(function(){t.update(true);});this.el.appendChildren(this.inputEl,this.icon.el);if(this.value!==null){setText(this,this.initialText);}
this.optionsEl=Element.create("div",null,"class=input-completer-options hidden");util.disappearOnOutboundClick(this.optionsEl);new Element(document.body).appendChild(this.optionsEl);function keyHandler(evt){var event=util.getEvent(evt);var currentSize=t.getText().length;var matchPossible=true;if(t.noMatches&&(currentSize>=t.sizeAtFristNoMatches)){matchPossible=false;}
switch(event.keyCode){case 38:highlightPrevious(t);break;case 40:highlightNext(t);break;case 13:if(event.shiftKey){if(event.stopPropagation){event.stopPropagation();}
t.update(true);}else{if(t.optionsEl.isHidden()){if(isFunction(t.evtListener)){t.evtListener(event);}}else{if(t.noMatches){hideOptions(t);}else{select(t);}}}
break;case 27:if(t.optionsEl.isHidden()){if(isFunction(t.evtListener)){t.evtListener(event);}}else{hideOptions(t);}
break;default:if(matchPossible&&!event.altKey&&!KEYS.contains(event.keyCode)&&t.auto){if(t.timeoutId){clearTimeout(t.timeoutId);}
t.timeoutId=setTimeout(function(){t.update();},t.typingThreshold);}
break;}}
this.inputEl.addEvtListener("keydown",keyHandler);this.icon.el.addEvtListener("keydown",keyHandler);function blurHandler(){if(t.optionsEl.isVisible()){setTimeout(function(){hideOptions(t);},200);}}
this.inputEl.addEvtListener("blur",blurHandler);this.icon.el.addEvtListener("blur",blurHandler);return this.el;}
signature(render,Element);method(InputCompleter.prototype,"render",render);function display(el){el.appendChild(this.render());}
signature(display,"undefined",Element);method(InputCompleter.prototype,"display",display);function hideOptions(t){t.optionsEl.deleteChildren();t.optionsEl.hide();t.highlighted=null;}
signature(hideOptions,"undefined",InputCompleter);function update(force){if(!isBoolean(force)){force=false;}
if(force){this.auto=true;}
var substring=this.getText();if(force||substring.length>=this.startCompleting){displayOptions(this,this.completeFunction(substring));}else{hideOptions(this);}}
signature(update,"undefined",["undefined","boolean"]);method(InputCompleter.prototype,"update",update);function displayOptions(t,options){dehighlight(t);t.optionsEl.deleteChildren();t.specialOptions.map(function(specialOption){var el=displayOption(t,specialOption.id,specialOption.label);el.addCSSClass("special-option");el.node.specialOption=specialOption;});t.noMatches=true;var optionCount=0;if(isArray(options)){options.map(function(option){displayOption(t,option.id,option.label);optionCount+=1;});}else if(isObject(options)){for(var option in options){if(options.hasOwnProperty(option)){if(isObject(options[option])){var group=options[option];if(!t.ignoreGrouping){var hE=Element.create("div",option,"class=group");t.optionsEl.appendChild(hE);}
for(var item in group){if(group.hasOwnProperty(item)){displayOption(t,item,group[item]);optionCount+=1;}}}else{displayOption(t,option,options[option]);optionCount+=1;}}}}
if(optionCount>0){t.noMatches=false;}
if(optionCount==t.limit){t.optionsEl.appendChild(Element.create("div","..."));}
if(t.noMatches){t.sizeAtFristNoMatches=t.inputEl.node.value.length;t.displayNoMatches();t.set(null,t.getText());t.notify(EVT_NO_MATCHES);}else{t.displayMatches();t.notify(EVT_SOME_MATCHES);}}
signature(displayOptions,"undefined",InputCompleter,["object",Array]);function displayNoMatches(){this.optionsEl.addCSSClass("no-matches");var pE=Element.create("div",this.getNoMatchesLabel(),"class=message");this.optionsEl.moveOver(this.inputEl.node,0,1);this.optionsEl.appendChild(pE);this.optionsEl.node.style.width=this.inputEl.node.offsetWidth+"px";this.optionsEl.show();}
method(InputCompleter.prototype,"displayNoMatches",displayNoMatches);function displayMatches(){this.optionsEl.deleteCSSClass("no-matches");this.optionsEl.moveOver(this.inputEl.node,0,1);this.optionsEl.node.style.width=this.inputEl.node.offsetWidth+"px";this.optionsEl.show();highlightFirst(this);}
method(InputCompleter.prototype,"displayMatches",displayMatches);function displayOption(t,id,text){var pE;if(text instanceof Element){pE=text;}else{pE=Element.create("p",text);}
pE.setAttr("id",id);t.optionsEl.appendChild(pE);pE.addEvtListener("mouseover",function(event){var target=util.getTarget(event);highlight(t,pE.node);});pE.addEvtListener("mouseout",function(event){dehighlight(t);});pE.addEvtListener("click",function(event){select(t);});return pE;}
signature(displayOption,Element,InputCompleter,"string",["string",Element]);function highlight(t,el){if(el){dehighlight(t);t.highlighted=new Element(el);t.highlighted.addCSSClass("highlighted");t.notify(EVT_OPTION_FOCUSED,el.id);}}
signature(highlight,"undefined",InputCompleter,["null","object"]);function dehighlight(t){if(t.highlighted!==null){t.highlighted.deleteCSSClass("highlighted");}
t.highlighted=null;t.notify(EVT_OPTION_BLURRED);}
signature(dehighlight,"undefined",InputCompleter);function highlightPrevious(t){if(t.highlighted){highlight(t,t.highlighted.getClosestSibling(isP,false));}}
signature(highlightPrevious,"undefined",InputCompleter);function highlightNext(t){if(t.highlighted){highlight(t,t.highlighted.getClosestSibling(isP,true));}else{highlightFirst(t);}}
signature(highlightNext,"undefined",InputCompleter);function highlightFirst(t){highlight(t,t.optionsEl.getFirstChild(isP));}
signature(highlightFirst,"undefined",InputCompleter);function select(t){if(t.highlighted&&isElement(t.highlighted.node)){if(t.highlighted.node.specialOption){t.highlighted.node.specialOption.action();}else{t.set(t.highlighted.getAttr("id"),t.highlighted.getText());}
hideOptions(t);t.focus();}}
signature(select,"undefined",InputCompleter);function set(value,text){setText(this,text);setValue(this,value);}
signature(set,"undefined",["null","string"],"string");method(InputCompleter.prototype,"set",set);function reset(){this.set(null,"");}
signature(reset,"undefined");method(InputCompleter.prototype,"reset",reset);function getValue(){if(!isNonEmptyString(this.getText())){this.value=null;}
return this.value;}
signature(getValue,["string","null"]);method(InputCompleter.prototype,"getValue",getValue);function getText(){return this.inputEl.node.value;}
signature(getText,"string");method(InputCompleter.prototype,"getText",getText);function setValue(t,value){t.value=value;t.notify(InputCompleter.EVT_VALUE_SET);}
signature(setValue,"undefined",InputCompleter,"string");function setText(t,text){t.inputEl.node.value=text;}
signature(setText,"undefined",InputCompleter,"string");function focus(){this.inputEl.node.focus();}
signature(focus,"undefined");method(InputCompleter.prototype,"focus",focus);function validate(msg,fct){if(!isFunction(fct)){fct=function(value,text){return!value||!isNonEmptyString(text);};}
if(fct(this.getValue(),this.getText())){showMessage(msg);this.focus();return false;}
return true;}
signature(validate,"boolean","string",["undefined","function"]);method(InputCompleter.prototype,"validate",validate);function activate(){this.inputEl.node.disabled=0;this.inputEl.node.readOnly=0;this.icon.activate();}
method(InputCompleter.prototype,"activate",activate);function deactivate(){this.inputEl.node.disabled=1;this.inputEl.node.readOnly=1;this.icon.deactivate();}
method(InputCompleter.prototype,"deactivate",deactivate);function getNoMatchesLabel(){return this.noMatchesLabel;}
signature(getNoMatchesLabel,"string");method(InputCompleter.prototype,"getNoMatchesLabel",getNoMatchesLabel);function setIgnoreGrouping(ignoreGrouping){this.ignoreGrouping=ignoreGrouping;}
signature(setIgnoreGrouping,"undefined","boolean");method(InputCompleter.prototype,"setIgnoreGrouping",setIgnoreGrouping);})();CERNY.require("TOPINCS.wiki.Preview","CERNY.http.Request","CERNY.http.Response","CERNY.dom.Element","CERNY.dom.html","TOPINCS.wiki.Article","TOPINCS.tmdm.TopicMap","TOPINCS.tmdm.Construct","TOPINCS.wiki.ArticleViewer","TOPINCS.wiki.ArticleMap","TOPINCS.widgets.util","TOPINCS.widgets.InputCompleter","TOPINCS.wiki.DICT");(function(){TOPINCS.wiki.Preview={};var Preview=TOPINCS.wiki.Preview;var Element=CERNY.dom.Element;var Response=CERNY.http.Response;var Request=CERNY.http.Request;var Article=TOPINCS.wiki.Article;var ArticleViewer=TOPINCS.wiki.ArticleViewer;var ArticleMap=TOPINCS.wiki.ArticleMap;var Construct=TOPINCS.tmdm.Construct;var InputCompleter=TOPINCS.widgets.InputCompleter;var util=TOPINCS.widgets.util;var signature=CERNY.signature;var method=CERNY.method;var DICT=TOPINCS.wiki.DICT;var previewEl=new CERNY.dom.Element("preview");var loadingMsgEl=Element.create("p",DICT.msg_loading_preview,"class=message");var errorMsgEl=Element.create("p",DICT.msg_error_preview,"class=message");var cannotPreviewYetMsgEl=Element.create("p",DICT.msg_cannot_preview_yet,"class=message");var displayedTopicId=null;var topicId=null;var timeoutId=null;var logger=CERNY.Logger("TOPINCS.wiki.Preview");Preview.logger=logger;function previewTopic(id,waitingTime,previewFunction){if(!waitingTime&&waitingTime!==0){waitingTime=2000;}
if(!previewFunction){previewFunction=preview;}
if(id!=displayedTopicId){topicId=id;timeoutId=window.setTimeout(function(){previewFunction();},waitingTime);}}
signature(previewTopic,"undefined","string");method(Preview,"previewTopic",previewTopic);function dontPreviewTopic(id,waitingTime){TOPINCS.wiki.Preview.previewTopic(id,waitingTime,dontPreview);}
method(Preview,"dontPreviewTopic",dontPreviewTopic);function cancelPreview(){topicId=null;clearTimeout(timeoutId);timeoutId=null;}
signature(cancelPreview,"undefined");method(Preview,"cancelPreview",cancelPreview);function preview(){if(topicId===null){return;}
var url=TOPINCS.util.createWikiUri(topicId);if(!url){url=topicId;}
var request=new Request("GET",url+".jtm");request.setHeader("Accept",MEDIA_TYPE_JTM);previewEl.deleteChildren();previewEl.appendChild(loadingMsgEl);request.sendAsynch(function(req){var response=new Response(req);if(response.getStatus()==200){var articleMap=new ArticleMap(new TOPINCS.tmdm.TopicMap(response.getValue()));var context=TOPINCS.wiki.getContext(articleMap);context.previewMode=true;var article=Article(articleMap,context.defaultHiddenTypes);var viewer=new ArticleViewer(article,context);previewEl.deleteChildren();previewEl.appendChild(viewer.render().node);displayedTopicId=topicId;}else{previewEl.deleteChildren();previewEl.appendChild(errorMsgEl);}});}
signature(preview,"undefined");method(Preview,"preview",preview);function dontPreview(){if(topicId===null){return;}
previewEl.deleteChildren();previewEl.appendChild(cannotPreviewYetMsgEl);return 1;}
signature(dontPreview,"undefined");function install(element){var el=new CERNY.dom.Element(element);el.addEvtListener("mouseover",function(e){var target=util.getTarget(e);if(isA(target)){var topicId=TOPINCS.util.extractSystemIdFromWikiUri(target.href);if(TOPINCS.tmdm.Construct.isSystemId(topicId)){TOPINCS.wiki.Preview.previewTopic(topicId);}}});el.addEvtListener("mouseout",function(){TOPINCS.wiki.Preview.cancelPreview();});}
signature(install,"undefined",[Element,"string"]);method(Preview,"install",install);function installOnTopicCompleter(tc,dontPreview){tc.addObserver(InputCompleter.EVT_OPTION_BLURRED,cancelPreview);if(dontPreview===true){tc.addObserver(InputCompleter.EVT_OPTION_FOCUSED,_dontPreview);}else{tc.addObserver(InputCompleter.EVT_OPTION_FOCUSED,_preview);}
function _preview(topicId){if(isNumber(new Number(topicId).valueOf())){previewTopic(topicId);}}
function _dontPreview(topicId){if(isNumber(new Number(topicId).valueOf())){dontPreviewTopic(topicId);}}}
signature(installOnTopicCompleter,"undefined",TOPINCS.widgets.InputCompleter);method(Preview,"installOnTopicCompleter",installOnTopicCompleter);})();CERNY.require("TOPINCS.wiki.Context","TOPINCS.CoreTopics","TOPINCS.tmdm.ext.Labeler","TOPINCS.util","TOPINCS.lang","TOPINCS.wiki.Preview","CERNY.dom.Element","TOPINCS.locale","TOPINCS.wiki.DICT");(function(){TOPINCS.wiki.Context=Context;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.Context");var CoreTopics=TOPINCS.CoreTopics;var Element=CERNY.dom.Element;var Labeler=TOPINCS.tmdm.ext.Labeler;var DICT=TOPINCS.wiki.DICT;function Context(conf){conf=conf||{};this.options=conf.options;this.prefs={locale:TOPINCS.getLocale()};this.defaultHiddenTypes=[CoreTopics["instance"],CoreTopics["topic-name"]];if(this.options.displayAllNamesInArticleViewer){this.defaultHiddenTypes.remove(CoreTopics["topic-name"]);}
this.previewPlayer=true;this.isForeignLanguagePresent=false;this.displayOnlyInformationInAcceptedLanguages=this.options.displayOnlyInformationInAcceptedLanguages;if(conf.articleMap){var articleMap=conf.articleMap;this.articleMap=articleMap;this.subjectId=articleMap.subjectId;this.topicmap=articleMap;this.changes=articleMap.changes;this.labeler=new Labeler({acceptedLanguagesIds:TOPINCS.lang.ids.accepted,englishId:TOPINCS.lang.ids.en,uiLanguageId:TOPINCS.lang.ids.ui});var t=this;function mergeHandler(mergedTopicMap){updateAcceptedLanugagesInLabeler(TOPINCS.ACCEPTED_LANGUAGES,mergedTopicMap,t.labeler);}
articleMap.mergedTopicMaps.map(mergeHandler);articleMap.addMergeObserver(mergeHandler);}
TOPINCS.util.cache(this,"getLabel");}
Context.prototype.logger=logger;function getLabel(topicId,scope){var topic=this.articleMap.topicMap.getTopicById(topicId);if(topic){return this.labeler.getTopicLabel(topic,scope);}
return this.labeler.getTopicLabelById(topicId,scope);}
signature(getLabel,["string","undefined"],"string",["undefined",Array]);method(Context.prototype,"getLabel",getLabel);function registerLabel(id,label,scope){return Labeler.registerLabel(id,label,scope);}
signature(registerLabel,"undefined","string","string",["undefined",Array]);method(Context.prototype,"registerLabel",registerLabel);function getTopicType(topicId){return this.articleMap.getTopicType(topicId);}
signature(getTopicType,"undefined","string","string",["undefined",Array]);method(Context.prototype,"getTopicType",getTopicType);function renderTopicLink(topicId,preview,displayType){if(!isBoolean(preview)){preview=false;}
if(!isBoolean(displayType)){displayType=true;}
var id=topicId,foreign=false,temp=false,base;var spanEl=Element.create("span",null,"class=topic-link");if(topicId.foreign){foreign=true;id=topicId.foreign.id;base=topicId.foreign.base;}else{temp=!isNumber(Number(topicId));}
var label=this.getLabel(topicId);var el=Element.create("a",label);if(temp){el.setAttr("href",HREF_VOID);el.addEvtListener("click",function(){TOPINCS.util.showMessage(DICT.msg_topic_is_temp);});}else{el.setAttr("href",TOPINCS.util.createWikiUri(id,base));}
if(preview&&!foreign&&!temp){el.addEvtListener("mouseover",function(){TOPINCS.wiki.Preview.previewTopic(topicId);});el.addEvtListener("mouseout",function(){TOPINCS.wiki.Preview.cancelPreview();});}
spanEl.appendChild(el);if(displayType){var type=this.getTopicType(topicId);if(type){var typeLabel=this.getLabel(type);if(typeLabel){spanEl.appendChild(Element.create("span"," ("+typeLabel+")","class=type"));}}}
return spanEl;}
signature(renderTopicLink,Element,"string",["boolean","undefined"],["boolean","undefined"]);method(Context.prototype,"renderTopicLink",renderTopicLink);function updateAcceptedLanugagesInLabeler(acceptedLanguages,topicMap,labeler){acceptedLanguages.map(function(langCode){var topic=topicMap.getTopicBySubjectIdentifier(PSI_LANG_BASE+langCode);if(topic){labeler.acceptedLanguagesIds.pushUnique(topic.id);}});}})();CERNY.require("TOPINCS.wiki.Options","JSON","JSDOMLIB","TOPINCS.cons","CERNY.event.Observable");(function(){TOPINCS.wiki.Options=Options;var cookieName="topincs.wiki.conf";var path=TOPINCS.BASE;var logger=CERNY.Logger("TOPINCS.wiki.Options");var DEFAULT_OPTIONS={displayAllTypesInContentTree:false,displayOnlyInformationInAcceptedLanguages:false,displayAllNamesInArticleViewer:false};function Options(){var options=CERNY.clone(DEFAULT_OPTIONS);var userOptions=load();for(var name in userOptions){options[name]=userOptions[name];}
CERNY.event.Observable(options);CERNY.method(options,"save",function(){save(options);});return options;}
function save(options){var obj={};for(var propertyName in options){if(DEFAULT_OPTIONS.hasOwnProperty(propertyName)){obj[propertyName]=options[propertyName];}}
setCookie(cookieName,JSON.stringify(obj),new Date(100000000000000),path);}
function load(){var cookie=getCookie(cookieName);if(cookie){return JSON.parse(cookie);}}})();CERNY.require("TOPINCS.wiki.init","TOPINCS.cons","TOPINCS.locale","CERNY.dom.Element","TOPINCS.misc.browsercheck","TOPINCS.widgets.Menu","TOPINCS.widgets.DropDiv","TOPINCS.util","TOPINCS.wiki.Context","TOPINCS.wiki.Options","TOPINCS.wiki.DICT");(function(){var DropDiv=TOPINCS.widgets.DropDiv;var Element=CERNY.dom.Element;var Menu=TOPINCS.widgets.Menu;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.init");var EL_MENU=new Element("dd-menu-body");var EL_CONTENT=new Element("content");var DICT=TOPINCS.wiki.DICT;var URL_SEARCH="wiki/.search?string=";var searchMi=new TOPINCS.widgets.MenuItem(DICT.lab_search_for,"search",true,DICT.tt_search_for);var DEFAULT_PAGE_OPTIONS={focusSearchInput:true};var USER_OPTIONS=TOPINCS.wiki.Options();var optionsEditor=null;function init(pageOptions){pageOptions=pageOptions||DEFAULT_PAGE_OPTIONS;if(!TOPINCS.misc.browsercheck(ACCEPTED)){new Element("wrong-browser").show();return;}
new DropDiv("dd-menu",false);new DropDiv("dd-search",false);new DropDiv("dd-preview",false);initMenu();initSearch(pageOptions);new Element("margin").show();new Element("main").show();}
method(TOPINCS.wiki,"init",init);function initMenu(){var menu=new Menu(true);menu.addItem("content",DICT.mi_content,true,DICT.tt_content);menu.content.setHref("wiki/.content");menu.addItem("create",DICT.mi_new_topic,true,DICT.tt_new_topic);menu.create.setHref("wiki/.new-topic");menu.addItem("journal",DICT.mi_recent_changes,true,DICT.tt_recent_changes);menu.journal.setHref("wiki/.recent-changes");menu.addItem("options",DICT.mi_options,true,DICT.tt_options);menu.options.addEvtListener(function(){CERNY.require("TOPINCS.wiki.init.initMenu.options","TOPINCS.wiki.OptionsEditor");if(!optionsEditor){var OptionsEditor=TOPINCS.wiki.OptionsEditor;optionsEditor=new OptionsEditor(USER_OPTIONS,getBaseContext());optionsEditor.addObserver(OptionsEditor.EVT_HIDDEN,function(){EL_CONTENT.show();});EL_CONTENT.node.parentNode.appendChild(optionsEditor.render().node);}
EL_CONTENT.hide();optionsEditor.show();});menu.addItem("info",DICT.mi_about,true,DICT.tt_about);menu.info.addEvtListener(function(){CERNY.require("TOPINCS.wiki.init.initMenu.about","TOPINCS.misc.Splash");TOPINCS.misc.Splash.show();});menu.display(EL_MENU);}
function initSearch(pageOptions){var searchEl=new Element("search");var searchInputEl=Element.create("input",null,"id=search-input");searchEl.appendChild(searchInputEl);searchInputEl.addEvtListener("keyup",function(_event){var searchInput=searchInputEl.node.value;setSearchUrl(searchInput);if(_event.keyCode==13&&searchInput.length>0){TOPINCS.util.setLocation(searchMi.getHref());}});searchMi.display(searchEl);if(pageOptions.focusSearchInput!==false){setTimeout(function(){searchInputEl.node.focus();},400);}}
function setSearchUrl(str){searchMi.setHref(URL_SEARCH+encodeURIComponent(str));}
method(TOPINCS.wiki,"setSearchUrl",setSearchUrl);function getContext(articleMap){return new TOPINCS.wiki.Context({articleMap:articleMap,options:USER_OPTIONS});}
method(TOPINCS.wiki,"getContext",getContext);function getBaseContext(){return new TOPINCS.wiki.Context({options:USER_OPTIONS});}
method(TOPINCS.wiki,"getBaseContext",getBaseContext);})();CERNY.require("TOPINCS.wiki.PreviewComponent","TOPINCS.wiki.DICT","TOPINCS.widgets.Menu","CERNY.dom.Element");(function(){var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var signature=CERNY.signature;var method=CERNY.method;var wiki=TOPINCS.wiki;var ID_PREVIEW_MENU_EL="preview-menu";TOPINCS.wiki.PreviewComponent=PreviewComponent;function PreviewComponent(obj){method(obj,"clearPreview",clearPreview);method(obj,"renderPreviewMenu",renderPreviewMenu);method(obj,"switchToEditor",switchToEditor);method(obj,"switchToPreview",switchToPreview);obj.previewEl=Element.create("div",null,"class=hidden preview");}
function renderPreviewMenu(){var menu=new TOPINCS.widgets.Menu();var t=this;menu.addItem("back",DICT.mi_back_to_editor);menu.back.addEvtListener(function(){t.switchToEditor()});return menu.render();}
function switchToPreview(menuDisplayer){this.editorEl.node.parentNode.appendChild(this.previewEl.node);menuDisplayer(this.renderPreviewMenu());this.editorEl.hide();this.previewEl.show();}
function switchToEditor(){this.previewEl.hide();this.editorEl.show();}
function clearPreview(){if(this.previewEl){this.previewEl.deleteChildren();}}})();CERNY.require("TOPINCS.widgets.OkCancelPopUp","TOPINCS.widgets.Buttons","TOPINCS.widgets.Button","TOPINCS.widgets.util","TOPINCS.widgets.DICT","CERNY.dom.Element","TOPINCS.widgets.InfoPopUp");(function(){TOPINCS.widgets.OkCancelPopUp=OkCancelPopUp;var Buttons=TOPINCS.widgets.Buttons;var Button=TOPINCS.widgets.Button;var Element=CERNY.dom.Element;var InfoPopUp=TOPINCS.widgets.InfoPopUp;var DICT=TOPINCS.widgets.DICT;var getEvent=TOPINCS.widgets.util.getEvent;var method=CERNY.method;var signature=CERNY.signature;function OkCancelPopUp(conf){var t=this;var okLabel=conf.okLabel||DICT.lab_ok;function okAction(){alert("Attach your own action with setOkAction!");}
this.okButton=new Button({label:okLabel,action:okAction});var cancelLabel=conf.cancelLabel||DICT.lab_cancel;function cancelAction(){t.hide();}
this.cancelButton=new Button({label:cancelLabel,action:cancelAction});var buttons=new Buttons();buttons.addButton(this.cancelButton);buttons.addButton(this.okButton);conf.buttons=buttons;InfoPopUp.call(this,conf);this.el.addCSSClass("ok-cancel-popup");}
OkCancelPopUp.prototype=new InfoPopUp();function setOkAction(ok){this.okButton.action=ok;}
signature(setOkAction,"undefined","function");method(OkCancelPopUp.prototype,"setOkAction",setOkAction);function setCancelAction(cancel){this.cancelButton.action=cancel;}
signature(setCancelAction,"undefined","function");method(OkCancelPopUp.prototype,"setCancelAction",setCancelAction);function focus(){this.okButton.focus();}
signature(focus,"undefined","undefined");method(OkCancelPopUp.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.LinkIcon","TOPINCS.widgets.Actionable","TOPINCS.cons","CERNY.dom.Element");(function(){TOPINCS.widgets.LinkIcon=LinkIcon;var method=CERNY.method;var Actionable=TOPINCS.widgets.Actionable;var Element=CERNY.dom.Element;var logger=CERNY.Logger("TOPINCS.widgets.LinkIcon");function LinkIcon(label,iconName,active,href){this.el=Element.create("a",null,"class=icon","title="+label,"href="+href);this.href=href;Actionable.init(this,{containerEl:this.el,aEl:this.el,active:active,iconName:iconName});var oldDeactivate=this.deactivate;this.deactivate=function(){this.el.setAttr("href",HREF_VOID);oldDeactivate.apply(this);}
var oldActivate=this.activate;this.activate=function(){this.el.setAttr("href",this.href);oldActivate.apply(this);}}
LinkIcon.prototype.logger=logger;Actionable(LinkIcon.prototype);function display(targetEl){targetEl.appendChild(this.el);}
method(LinkIcon.prototype,"display",display);function focus(){this.el.node.focus();}
method(LinkIcon.prototype,"focus",focus);})();CERNY.require("TOPINCS.widgets.Exception","TOPINCS.I18NException","TOPINCS.widgets.DICT");(function(){TOPINCS.widgets.Exception=Exception;function Exception(messageKey,replacements){TOPINCS.I18NException.call(this,messageKey,replacements);}
Exception.prototype=new TOPINCS.I18NException();Exception.prototype.dictionary=TOPINCS.widgets.DICT;})();CERNY.require("TOPINCS.widgets.InvalidDateFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidDateFormatException=InvalidDateFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidDateFormatException(dateFormat){Exception.call(this,"msg_invalid_date_error",[new Date().format(dateFormat)]);}
InvalidDateFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.DateInput","CERNY.dom.Element","TOPINCS.widgets.InvalidDateFormatException");(function(){TOPINCS.widgets.DateInput=DateInput;var Element=CERNY.dom.Element;var InvalidDateFormatException=TOPINCS.widgets.InvalidDateFormatException;var method=CERNY.method;var signature=CERNY.signature;var exception;function DateInput(formats){this.dateFormat=formats.date;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidDateFormatException(this.dateFormat);}
function setValue(date){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(date)){timezoneFormat=this.timezoneFormat;}
this.el.node.value=date.format(this.dateFormat," ",timezoneFormat);}
signature(setValue,"undefined",Date);method(DateInput.prototype,"setValue",setValue);function getValue(){var input=this.el.node.value;var date=Date.parseDate(input,this.dateFormat);if(!date){throw new InvalidDateFormatException(this.dateFormat);}
return date;}
signature(getValue,Date);method(DateInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(DateInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.InvalidTimeFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidTimeFormatException=InvalidTimeFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidTimeFormatException(timeFormat){Exception.call(this,"msg_invalid_time_error",[new Date().formatTime(timeFormat)]);}
InvalidTimeFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.TimeInput","CERNY.dom.Element","CERNY.util","TOPINCS.util","TOPINCS.widgets.InvalidTimeFormatException");(function(){TOPINCS.widgets.TimeInput=TimeInput;var Element=CERNY.dom.Element;var InvalidTimeFormatException=TOPINCS.widgets.InvalidTimeFormatException;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var exception;function TimeInput(formats){this.timeFormat=formats.time;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidTimeFormatException(this.timeFormat);}
function setValue(date){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(date)){timezoneFormat=this.timezoneFormat;}
this.el.node.value=date.formatTime(this.timeFormat," ",timezoneFormat);}
signature(setValue,"undefined",Date);method(TimeInput.prototype,"setValue",setValue);function getValue(){try{return Date.parseTime(this.el.node.value,this.timeFormat);}catch(e){throw exception;}}
signature(getValue,Date);method(TimeInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(TimeInput.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.Time","TOPINCS.widgets.util","CERNY.util","CERNY.text.TimezoneFormat","CERNY.dom.Element");(function(){TOPINCS.widgets.Time=Time;var Element=CERNY.dom.Element;var fillNumber=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var TimezoneSelect=TOPINCS.widgets.util.TimezoneSelect;var logger="TOPINCS.widgets.Time";function Time(locale){this.locale=locale;ampm=this.locale.formats.time.ampm;this.el=Element.create("div",null,"class=time");var formatHourName;if(ampm){formatHourName=function(value){if(value<=12){return value+" a.m";}
value=value-12;return value+" p.m.";}}
this.hourEl=createSelect(23,formatHourName);this.minuteEl=createSelect(59);this.secondEl=createSelect(59);this.timezoneSelect=new TimezoneSelect();this.el.appendChildren(this.hourEl,Element.create("span",":"),this.minuteEl,Element.create("span",":"),this.secondEl,this.timezoneSelect.el);}
Time.prototype.logger=logger;function render(){return this.el;}
method(Time.prototype,"render",render);function getValue(){var date=new Date();date.setHours(this.hourEl.node.value);date.setMinutes(this.minuteEl.node.value);date.setSeconds(this.secondEl.node.value);CERNY.js.Date.setTimezoneOffset(date,Number(this.timezoneSelect.el.node.value));return date;}
method(Time.prototype,"getValue",getValue);function setValue(date){this.hourEl.node.value=date.getHours();this.minuteEl.node.value=date.getMinutes();this.secondEl.node.value=date.getSeconds();this.timezoneSelect.el.node.value=CERNY.js.Date.getTimezoneOffset(date);}
signature(setValue,"number","number","number");method(Time.prototype,"setValue",setValue);function addChangeListener(f){this.hourEl.addEvtListener("change",f);this.minuteEl.addEvtListener("change",f);this.secondEl.addEvtListener("change",f);this.timezoneSelect.el.addEvtListener("change",f);}
method(Time.prototype,"addChangeListener",addChangeListener);function show(){this.el.show();}
method(Time.prototype,"show",show);function hide(){this.el.hide();}
method(Time.prototype,"hide",hide);function createSelect(max,formatName){if(!formatName){formatName=function(value){return fillNumber(value);}}
var el=Element.create("select");for(var i=0;i<=max;i++){el.appendChild(Element.create("option",formatName(i),"value="+i));}
return el;}})();CERNY.require("TOPINCS.widgets.InvalidDateTimeFormatException","TOPINCS.widgets.Exception","CERNY.js.Date");(function(){TOPINCS.widgets.InvalidDateTimeFormatException=InvalidDateTimeFormatException;var Exception=TOPINCS.widgets.Exception;function InvalidDateTimeFormatException(dateFormat,timeFormat){Exception.call(this,"msg_invalid_date_time_error",[new Date().format(dateFormat),new Date().formatTime(timeFormat)]);}
InvalidDateTimeFormatException.prototype=new Exception();})();CERNY.require("TOPINCS.widgets.DateTimeInput","CERNY.dom.Element","CERNY.util","TOPINCS.util","TOPINCS.widgets.InvalidDateTimeFormatException");(function(){TOPINCS.widgets.DateTimeInput=DateTimeInput;var logger=CERNY.Logger("TOPINCS.widgets.DateTimeInput");var Element=CERNY.dom.Element;var InvalidDateTimeFormatException=TOPINCS.widgets.InvalidDateTimeFormatException;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var exception;function DateTimeInput(formats){this.dateFormat=formats.date;this.timeFormat=formats.time;this.timezoneFormat=formats.timezone;this.el=Element.create("input",null);exception=exception||new InvalidDateTimeFormatException(this.dateFormat,this.timeFormat);}
DateTimeInput.prototype.logger=logger;function setValue(date){var timezoneFormat;if(!CERNY.js.Date.isInLocalTimezone(date)){timezoneFormat=this.timezoneFormat;}
this.el.node.value=date.formatDateTime(this.dateFormat," ",this.timeFormat," ",timezoneFormat);}
signature(setValue,"undefined",Date);method(DateTimeInput.prototype,"setValue",setValue);function getValue(){try{var input=this.el.node.value;var segments=input.split(/\s/);var dateStr=segments.shift();var timeStr=segments.join(" ");var date=Date._parse(dateStr,this.dateFormat);if(!date){throw new Error();}
date=Date.parseTime(timeStr,this.timeFormat,date);return date;}catch(e){throw exception;}}
signature(getValue,Date);method(DateTimeInput.prototype,"getValue",getValue);function addChangeListener(f){this.el.addEvtListener("blur",f);this.el.addEvtListener("keyup",f);}
signature(addChangeListener,"undefined","function");method(DateTimeInput.prototype,"addChangeListener",addChangeListener);})();(function(){YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Config=YAHOO.util.Config;Config.CONFIG_CHANGED_EVENT="configChanged";Config.BOOLEAN_TYPE="boolean";Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(owner){this.owner=owner;this.configChangedEvent=this.createEvent(Config.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=CustomEvent.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(val){return(typeof val==Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=this.createEvent(key,{scope:this.owner});propertyObject.event.signature=CustomEvent.LIST;propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={},currCfg=this.config,prop,property;for(prop in currCfg){if(Lang.hasOwnProperty(currCfg,prop)){property=currCfg[prop];if(property&&property.event){cfg[prop]=property.value;}}}
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!Lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);return true;}}else{return false;}},setProperty:function(key,value,silent){var property;key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key],foundDuplicate=false,iLen,queueItem,queueItemKey,queueItemValue,sLen,supercedesCheck,qLen,queueItemCheck,queueItemCheckKey,queueItemCheckValue,i,s,q;if(property&&property.event){if(!Lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!Lang.isUndefined(value)){property.value=value;}else{value=property.value;}
foundDuplicate=false;iLen=this.eventQueue.length;for(i=0;i<iLen;i++){queueItem=this.eventQueue[i];if(queueItem){queueItemKey=queueItem[0];queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!Lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&!Lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
if(property.supercedes){sLen=property.supercedes.length;for(s=0;s<sLen;s++){supercedesCheck=property.supercedes[s];qLen=this.eventQueue.length;for(q=0;q<qLen;q++){queueItemCheck=this.eventQueue[q];if(queueItemCheck){queueItemCheckKey=queueItemCheck[0];queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!Lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){var sKey,oConfig;if(init){oConfig={};for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){oConfig[sKey.toLowerCase()]=userConfig[sKey];}}
this.initialConfig=oConfig;}
for(sKey in userConfig){if(Lang.hasOwnProperty(userConfig,sKey)){this.queueProperty(sKey,userConfig[sKey]);}}},refresh:function(){var prop;for(prop in this.config){if(Lang.hasOwnProperty(this.config,prop)){this.refireEvent(prop);}}},fireQueue:function(){var i,queueItem,key,value,property;this.queueInProgress=true;for(i=0;i<this.eventQueue.length;i++){queueItem=this.eventQueue[i];if(queueItem){key=queueItem[0];value=queueItem[1];property=this.config[key];property.value=value;this.fireEvent(key,value);}}
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
return output;},outputEventQueue:function(){var output="",queueItem,q,nQueue=this.eventQueue.length;for(q=0;q<nQueue;q++){queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;},destroy:function(){var oConfig=this.config,sProperty,oProperty;for(sProperty in oConfig){if(Lang.hasOwnProperty(oConfig,sProperty)){oProperty=oConfig[sProperty];oProperty.event.unsubscribeAll();oProperty.event=null;}}
this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};Config.alreadySubscribed=function(evt,fn,obj){var nSubscribers=evt.subscribers.length,subsc,i;if(nSubscribers>0){i=nSubscribers-1;do{subsc=evt.subscribers[i];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
while(i--);}
return false;};YAHOO.lang.augmentProto(Config,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,WEEK_ONE_JAN_DATE:1,add:function(date,field,amount){var d=new Date(date.getTime());switch(field){case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0){newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11){newMonth-=12;years+=1;}}
d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:this._addDays(d,amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:this._addDays(d,(amount*7));break;}
return d;},_addDays:function(d,nDays){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){if(nDays<0){for(var min=-128;nDays<min;nDays-=min){d.setDate(d.getDate()+min);}}else{for(var max=96;nDays>max;nDays-=max){d.setDate(d.getDate()+max);}}}
d.setDate(d.getDate()+nDays);},subtract:function(date,field,amount){return this.add(date,field,(amount*-1));},before:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()<ms){return true;}else{return false;}},after:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()>ms){return true;}else{return false;}},between:function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}},getJan1:function(calendarYear){return this.getDate(calendarYear,0,1);},getDayOffset:function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;},getWeekNumber:function(date,firstDayOfWeek,janDate){firstDayOfWeek=firstDayOfWeek||0;janDate=janDate||this.WEEK_ONE_JAN_DATE;var targetDate=this.clearTime(date),startOfWeek,endOfWeek;if(targetDate.getDay()===firstDayOfWeek){startOfWeek=targetDate;}else{startOfWeek=this.getFirstDayOfWeek(targetDate,firstDayOfWeek);}
var startYear=startOfWeek.getFullYear(),startTime=startOfWeek.getTime();endOfWeek=new Date(startOfWeek.getTime()+6*this.ONE_DAY_MS);var weekNum;if(startYear!==endOfWeek.getFullYear()&&endOfWeek.getDate()>=janDate){weekNum=1;}else{var weekOne=this.clearTime(this.getDate(startYear,0,janDate)),weekOneDayOne=this.getFirstDayOfWeek(weekOne,firstDayOfWeek);var daysDiff=Math.round((targetDate.getTime()-weekOneDayOne.getTime())/this.ONE_DAY_MS);var rem=daysDiff%7;var weeksDiff=(daysDiff-rem)/7;weekNum=weeksDiff+1;}
return weekNum;},getFirstDayOfWeek:function(dt,startOfWeek){startOfWeek=startOfWeek||0;var dayOfWeekIndex=dt.getDay(),dayOfWeek=(dayOfWeekIndex-startOfWeek+7)%7;return this.subtract(dt,this.DAY,dayOfWeek);},isYearOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
return overlaps;},isMonthOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
return overlaps;},findMonthStart:function(date){var start=this.getDate(date.getFullYear(),date.getMonth(),1);return start;},findMonthEnd:function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;},clearTime:function(date){date.setHours(12,0,0,0);return date;},getDate:function(y,m,d){var dt=null;if(YAHOO.lang.isUndefined(d)){d=1;}
if(y>=100){dt=new Date(y,m,d);}else{dt=new Date();dt.setFullYear(y);dt.setMonth(m);dt.setDate(d);dt.setHours(0,0,0,0);}
return dt;}};(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,DateMath=YAHOO.widget.DateMath;function Calendar(id,containerId,config){this.init.apply(this,arguments);}
Calendar.IMG_ROOT=null;Calendar.DATE="D";Calendar.MONTH_DAY="MD";Calendar.WEEKDAY="WD";Calendar.RANGE="R";Calendar.MONTH="M";Calendar.DISPLAY_DAYS=42;Calendar.STOP_RENDER="S";Calendar.SHORT="short";Calendar.LONG="long";Calendar.MEDIUM="medium";Calendar.ONE_CHAR="1char";Calendar._DEFAULT_CONFIG={PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};var DEF_CFG=Calendar._DEFAULT_CONFIG;Calendar._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};Calendar._STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(args){var nArgs={id:null,container:null,config:null};if(args&&args.length&&args.length>0){switch(args.length){case 1:nArgs.id=null;nArgs.container=args[0];nArgs.config=null;break;case 2:if(Lang.isObject(args[1])&&!args[1].tagName&&!(args[1]instanceof String)){nArgs.id=null;nArgs.container=args[0];nArgs.config=args[1];}else{nArgs.id=args[0];nArgs.container=args[1];nArgs.config=null;}
break;default:nArgs.id=args[0];nArgs.container=args[1];nArgs.config=args[2];break;}}else{}
return nArgs;},init:function(id,container,config){var nArgs=this._parseArgs(arguments);id=nArgs.id;container=nArgs.container;config=nArgs.config;if(container){this.oDomContainer=Dom.get(container);if(!this.oDomContainer.id){this.oDomContainer.id=Dom.generateId();}
if(!id){id=this.oDomContainer.id+"_t";}
this.id=id;this.containerId=this.oDomContainer.id;}
this.initEvents();this.today=new Date();DateMath.clearTime(this.today);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();},configIframe:function(type,args,obj){var useIframe=args[0];if(!this.parent){if(Dom.inDocument(this.oDomContainer)){if(useIframe){var pos=Dom.getStyle(this.oDomContainer,"position");if(pos=="absolute"||pos=="relative"){if(!Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";Dom.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){Dom.addClass(this.iframe,"fixedsize");}
this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;}}}}},configTitle:function(type,args,obj){var title=args[0];if(title){this.createTitleBar(title);}else{var close=this.cfg.getProperty(DEF_CFG.CLOSE.key);if(!close){this.removeTitleBar();}else{this.createTitleBar("&#160;");}}},configClose:function(type,args,obj){var close=args[0],title=this.cfg.getProperty(DEF_CFG.TITLE.key);if(close){if(!title){this.createTitleBar("&#160;");}
this.createCloseButton();}else{this.removeCloseButton();if(!title){this.removeTitleBar();}}},initEvents:function(){var defEvents=Calendar._EVENT_TYPES,CE=YAHOO.util.CustomEvent,cal=this;cal.beforeSelectEvent=new CE(defEvents.BEFORE_SELECT);cal.selectEvent=new CE(defEvents.SELECT);cal.beforeDeselectEvent=new CE(defEvents.BEFORE_DESELECT);cal.deselectEvent=new CE(defEvents.DESELECT);cal.changePageEvent=new CE(defEvents.CHANGE_PAGE);cal.beforeRenderEvent=new CE(defEvents.BEFORE_RENDER);cal.renderEvent=new CE(defEvents.RENDER);cal.beforeDestroyEvent=new CE(defEvents.BEFORE_DESTROY);cal.destroyEvent=new CE(defEvents.DESTROY);cal.resetEvent=new CE(defEvents.RESET);cal.clearEvent=new CE(defEvents.CLEAR);cal.beforeShowEvent=new CE(defEvents.BEFORE_SHOW);cal.showEvent=new CE(defEvents.SHOW);cal.beforeHideEvent=new CE(defEvents.BEFORE_HIDE);cal.hideEvent=new CE(defEvents.HIDE);cal.beforeShowNavEvent=new CE(defEvents.BEFORE_SHOW_NAV);cal.showNavEvent=new CE(defEvents.SHOW_NAV);cal.beforeHideNavEvent=new CE(defEvents.BEFORE_HIDE_NAV);cal.hideNavEvent=new CE(defEvents.HIDE_NAV);cal.beforeRenderNavEvent=new CE(defEvents.BEFORE_RENDER_NAV);cal.renderNavEvent=new CE(defEvents.RENDER_NAV);cal.beforeSelectEvent.subscribe(cal.onBeforeSelect,this,true);cal.selectEvent.subscribe(cal.onSelect,this,true);cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect,this,true);cal.deselectEvent.subscribe(cal.onDeselect,this,true);cal.changePageEvent.subscribe(cal.onChangePage,this,true);cal.renderEvent.subscribe(cal.onRender,this,true);cal.resetEvent.subscribe(cal.onReset,this,true);cal.clearEvent.subscribe(cal.onClear,this,true);},doPreviousMonthNav:function(e,cal){Event.preventDefault(e);setTimeout(function(){cal.previousMonth();var navs=Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT,"a",cal.oDomContainer);if(navs&&navs[0]){try{navs[0].focus();}catch(e){}}},0);},doNextMonthNav:function(e,cal){Event.preventDefault(e);setTimeout(function(){cal.nextMonth();var navs=Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT,"a",cal.oDomContainer);if(navs&&navs[0]){try{navs[0].focus();}catch(e){}}},0);},doSelectCell:function(e,cal){var cell,d,date,index;var target=Event.getTarget(e),tagName=target.tagName.toLowerCase(),defSelector=false;while(tagName!="td"&&!Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){if(!defSelector&&tagName=="a"&&Dom.hasClass(target,cal.Style.CSS_CELL_SELECTOR)){defSelector=true;}
target=target.parentNode;tagName=target.tagName.toLowerCase();if(target==this.oDomContainer||tagName=="html"){return;}}
if(defSelector){Event.preventDefault(e);}
cell=target;if(Dom.hasClass(cell,cal.Style.CSS_CELL_SELECTABLE)){index=cal.getIndexFromId(cell.id);if(index>-1){d=cal.cellDates[index];if(d){date=DateMath.getDate(d[0],d[1]-1,d[2]);var link;if(cal.Options.MULTI_SELECT){link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
cal.selectCell(index);}}}}},doCellMouseOver:function(e,cal){var target;if(e){target=Event.getTarget(e);}else{target=this;}
while(target.tagName&&target.tagName.toLowerCase()!="td"){target=target.parentNode;if(!target.tagName||target.tagName.toLowerCase()=="html"){return;}}
if(Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){Dom.addClass(target,cal.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(e,cal){var target;if(e){target=Event.getTarget(e);}else{target=this;}
while(target.tagName&&target.tagName.toLowerCase()!="td"){target=target.parentNode;if(!target.tagName||target.tagName.toLowerCase()=="html"){return;}}
if(Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){Dom.removeClass(target,cal.Style.CSS_CELL_HOVER);}},setupConfig:function(){var cfg=this.cfg;cfg.addProperty(DEF_CFG.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});cfg.addProperty(DEF_CFG.SELECTED.key,{value:[],handler:this.configSelected});cfg.addProperty(DEF_CFG.TITLE.key,{value:DEF_CFG.TITLE.value,handler:this.configTitle});cfg.addProperty(DEF_CFG.CLOSE.key,{value:DEF_CFG.CLOSE.value,handler:this.configClose});cfg.addProperty(DEF_CFG.IFRAME.key,{value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.MINDATE.key,{value:DEF_CFG.MINDATE.value,handler:this.configMinDate});cfg.addProperty(DEF_CFG.MAXDATE.key,{value:DEF_CFG.MAXDATE.value,handler:this.configMaxDate});cfg.addProperty(DEF_CFG.MULTI_SELECT.key,{value:DEF_CFG.MULTI_SELECT.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.START_WEEKDAY.key,{value:DEF_CFG.START_WEEKDAY.value,handler:this.configOptions,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key,{value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key,{value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.configOptions});cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key,{value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.configOptions});cfg.addProperty(DEF_CFG.MONTHS_SHORT.key,{value:DEF_CFG.MONTHS_SHORT.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MONTHS_LONG.key,{value:DEF_CFG.MONTHS_LONG.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key,{value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key,{value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key,{value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key,{value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.configLocale});var refreshLocale=function(){cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);};cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key,refreshLocale,this,true);cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_LONG.key,refreshLocale,this,true);cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key,{value:DEF_CFG.LOCALE_MONTHS.value,handler:this.configLocaleValues});cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key,{value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});cfg.addProperty(DEF_CFG.DATE_DELIMITER.key,{value:DEF_CFG.DATE_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key,{value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key,{value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key,{value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key,{value:DEF_CFG.MD_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key,{value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key,{value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key,{value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key,{value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key,{value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key,{value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key,{value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});cfg.addProperty(DEF_CFG.NAV.key,{value:DEF_CFG.NAV.value,handler:this.configNavigator});cfg.addProperty(DEF_CFG.STRINGS.key,{value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val){return Lang.isObject(val);},supercedes:DEF_CFG.STRINGS.supercedes});},configStrings:function(type,args,obj){var val=Lang.merge(DEF_CFG.STRINGS.value,args[0]);this.cfg.setProperty(DEF_CFG.STRINGS.key,val,true);},configPageDate:function(type,args,obj){this.cfg.setProperty(DEF_CFG.PAGEDATE.key,this._parsePageDate(args[0]),true);},configMinDate:function(type,args,obj){var val=args[0];if(Lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(DEF_CFG.MINDATE.key,DateMath.getDate(val[0],(val[1]-1),val[2]));}},configMaxDate:function(type,args,obj){var val=args[0];if(Lang.isString(val)){val=this._parseDate(val);this.cfg.setProperty(DEF_CFG.MAXDATE.key,DateMath.getDate(val[0],(val[1]-1),val[2]));}},configSelected:function(type,args,obj){var selected=args[0],cfgSelected=DEF_CFG.SELECTED.key;if(selected){if(Lang.isString(selected)){this.cfg.setProperty(cfgSelected,this._parseDates(selected),true);}}
if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(cfgSelected);}},configOptions:function(type,args,obj){this.Options[type.toUpperCase()]=args[0];},configLocale:function(type,args,obj){this.Locale[type.toUpperCase()]=args[0];this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);},configLocaleValues:function(type,args,obj){type=type.toLowerCase();var val=args[0],cfg=this.cfg,Locale=this.Locale;switch(type){case DEF_CFG.LOCALE_MONTHS.key:switch(val){case Calendar.SHORT:Locale.LOCALE_MONTHS=cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();break;case Calendar.LONG:Locale.LOCALE_MONTHS=cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();break;}
break;case DEF_CFG.LOCALE_WEEKDAYS.key:switch(val){case Calendar.ONE_CHAR:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();break;case Calendar.SHORT:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();break;case Calendar.MEDIUM:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();break;case Calendar.LONG:Locale.LOCALE_WEEKDAYS=cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();break;}
var START_WEEKDAY=cfg.getProperty(DEF_CFG.START_WEEKDAY.key);if(START_WEEKDAY>0){for(var w=0;w<START_WEEKDAY;++w){Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());}}
break;}},configNavigator:function(type,args,obj){var val=args[0];if(YAHOO.widget.CalendarNavigator&&(val===true||Lang.isObject(val))){if(!this.oNavigator){this.oNavigator=new YAHOO.widget.CalendarNavigator(this);this.beforeRenderEvent.subscribe(function(){if(!this.pages){this.oNavigator.erase();}},this,true);}}else{if(this.oNavigator){this.oNavigator.destroy();this.oNavigator=null;}}},initStyles:function(){var defStyle=Calendar._STYLES;this.Style={CSS_ROW_HEADER:defStyle.CSS_ROW_HEADER,CSS_ROW_FOOTER:defStyle.CSS_ROW_FOOTER,CSS_CELL:defStyle.CSS_CELL,CSS_CELL_SELECTOR:defStyle.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:defStyle.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:defStyle.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:defStyle.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:defStyle.CSS_CELL_TODAY,CSS_CELL_OOM:defStyle.CSS_CELL_OOM,CSS_CELL_OOB:defStyle.CSS_CELL_OOB,CSS_HEADER:defStyle.CSS_HEADER,CSS_HEADER_TEXT:defStyle.CSS_HEADER_TEXT,CSS_BODY:defStyle.CSS_BODY,CSS_WEEKDAY_CELL:defStyle.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:defStyle.CSS_WEEKDAY_ROW,CSS_FOOTER:defStyle.CSS_FOOTER,CSS_CALENDAR:defStyle.CSS_CALENDAR,CSS_SINGLE:defStyle.CSS_SINGLE,CSS_CONTAINER:defStyle.CSS_CONTAINER,CSS_NAV_LEFT:defStyle.CSS_NAV_LEFT,CSS_NAV_RIGHT:defStyle.CSS_NAV_RIGHT,CSS_NAV:defStyle.CSS_NAV,CSS_CLOSE:defStyle.CSS_CLOSE,CSS_CELL_TOP:defStyle.CSS_CELL_TOP,CSS_CELL_LEFT:defStyle.CSS_CELL_LEFT,CSS_CELL_RIGHT:defStyle.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:defStyle.CSS_CELL_BOTTOM,CSS_CELL_HOVER:defStyle.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:defStyle.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:defStyle.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:defStyle.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:defStyle.CSS_CELL_HIGHLIGHT4};},buildMonthLabel:function(){return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));},_buildMonthLabel:function(date){var monthLabel=this.Locale.LOCALE_MONTHS[date.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX,yearLabel=date.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return yearLabel+monthLabel;}else{return monthLabel+yearLabel;}},buildDayLabel:function(workingDate){return workingDate.getDate();},createTitleBar:function(strTitle){var tDiv=Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");tDiv.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;tDiv.innerHTML=strTitle;this.oDomContainer.insertBefore(tDiv,this.oDomContainer.firstChild);Dom.addClass(this.oDomContainer,"withtitle");return tDiv;},removeTitleBar:function(){var tDiv=Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(tDiv){Event.purgeElement(tDiv);this.oDomContainer.removeChild(tDiv);}
Dom.removeClass(this.oDomContainer,"withtitle");},createCloseButton:function(){var cssClose=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,DEPR_CLOSE_PATH="us/my/bn/x_d.gif",lnk=Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0],strings=this.cfg.getProperty(DEF_CFG.STRINGS.key),closeStr=(strings&&strings.close)?strings.close:"";if(!lnk){lnk=document.createElement("a");Event.addListener(lnk,"click",function(e,cal){cal.hide();Event.preventDefault(e);},this);}
lnk.href="#";lnk.className="link-close";if(Calendar.IMG_ROOT!==null){var img=Dom.getElementsByClassName(cssClose,"img",lnk)[0]||document.createElement("img");img.src=Calendar.IMG_ROOT+DEPR_CLOSE_PATH;img.className=cssClose;lnk.appendChild(img);}else{lnk.innerHTML='<span class="'+cssClose+' '+this.Style.CSS_CLOSE+'">'+closeStr+'</span>';}
this.oDomContainer.appendChild(lnk);return lnk;},removeCloseButton:function(){var btn=Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(btn){Event.purgeElement(btn);this.oDomContainer.removeChild(btn);}},renderHeader:function(html){var colSpan=7,DEPR_NAV_LEFT="us/tr/callt.gif",DEPR_NAV_RIGHT="us/tr/calrt.gif",cfg=this.cfg,pageDate=cfg.getProperty(DEF_CFG.PAGEDATE.key),strings=cfg.getProperty(DEF_CFG.STRINGS.key),prevStr=(strings&&strings.previousMonth)?strings.previousMonth:"",nextStr=(strings&&strings.nextMonth)?strings.nextMonth:"",monthLabel;if(cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)){colSpan+=1;}
if(cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)){colSpan+=1;}
html[html.length]="<thead>";html[html.length]="<tr>";html[html.length]='<th colspan="'+colSpan+'" class="'+this.Style.CSS_HEADER_TEXT+'">';html[html.length]='<div class="'+this.Style.CSS_HEADER+'">';var renderLeft,renderRight=false;if(this.parent){if(this.index===0){renderLeft=true;}
if(this.index==(this.parent.cfg.getProperty("pages")-1)){renderRight=true;}}else{renderLeft=true;renderRight=true;}
if(renderLeft){monthLabel=this._buildMonthLabel(DateMath.subtract(pageDate,DateMath.MONTH,1));var leftArrow=cfg.getProperty(DEF_CFG.NAV_ARROW_LEFT.key);if(leftArrow===null&&Calendar.IMG_ROOT!==null){leftArrow=Calendar.IMG_ROOT+DEPR_NAV_LEFT;}
var leftStyle=(leftArrow===null)?"":' style="background-image:url('+leftArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_LEFT+'"'+leftStyle+' href="#">'+prevStr+' ('+monthLabel+')'+'</a>';}
var lbl=this.buildMonthLabel();var cal=this.parent||this;if(cal.cfg.getProperty("navigator")){lbl="<a class=\""+this.Style.CSS_NAV+"\" href=\"#\">"+lbl+"</a>";}
html[html.length]=lbl;if(renderRight){monthLabel=this._buildMonthLabel(DateMath.add(pageDate,DateMath.MONTH,1));var rightArrow=cfg.getProperty(DEF_CFG.NAV_ARROW_RIGHT.key);if(rightArrow===null&&Calendar.IMG_ROOT!==null){rightArrow=Calendar.IMG_ROOT+DEPR_NAV_RIGHT;}
var rightStyle=(rightArrow===null)?"":' style="background-image:url('+rightArrow+')"';html[html.length]='<a class="'+this.Style.CSS_NAV_RIGHT+'"'+rightStyle+' href="#">'+nextStr+' ('+monthLabel+')'+'</a>';}
html[html.length]='</div>\n</th>\n</tr>';if(cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)){html=this.buildWeekdays(html);}
html[html.length]='</thead>';return html;},buildWeekdays:function(html){html[html.length]='<tr class="'+this.Style.CSS_WEEKDAY_ROW+'">';if(this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)){html[html.length]='<th>&#160;</th>';}
for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i){html[html.length]='<th class="calweekdaycell">'+this.Locale.LOCALE_WEEKDAYS[i]+'</th>';}
if(this.cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)){html[html.length]='<th>&#160;</th>';}
html[html.length]='</tr>';return html;},renderBody:function(workingDate,html){var startDay=this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);this.preMonthDays=workingDate.getDay();if(startDay>0){this.preMonthDays-=startDay;}
if(this.preMonthDays<0){this.preMonthDays+=7;}
this.monthDays=DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=DateMath.subtract(workingDate,DateMath.DAY,this.preMonthDays);var weekNum,weekClass,weekPrefix="w",cellPrefix="_cell",workingDayPrefix="wd",dayPrefix="d",cellRenderers,renderer,t=this.today,cfg=this.cfg,todayYear=t.getFullYear(),todayMonth=t.getMonth(),todayDate=t.getDate(),useDate=cfg.getProperty(DEF_CFG.PAGEDATE.key),hideBlankWeeks=cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),showWeekFooter=cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),showWeekHeader=cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),mindate=cfg.getProperty(DEF_CFG.MINDATE.key),maxdate=cfg.getProperty(DEF_CFG.MAXDATE.key);if(mindate){mindate=DateMath.clearTime(mindate);}
if(maxdate){maxdate=DateMath.clearTime(maxdate);}
html[html.length]='<tbody class="m'+(useDate.getMonth()+1)+' '+this.Style.CSS_BODY+'">';var i=0,tempDiv=document.createElement("div"),cell=document.createElement("td");tempDiv.appendChild(cell);var cal=this.parent||this;for(var r=0;r<6;r++){weekNum=DateMath.getWeekNumber(workingDate,startDay);weekClass=weekPrefix+weekNum;if(r!==0&&hideBlankWeeks===true&&workingDate.getMonth()!=useDate.getMonth()){break;}else{html[html.length]='<tr class="'+weekClass+'">';if(showWeekHeader){html=this.renderRowHeader(weekNum,html);}
for(var d=0;d<7;d++){cellRenderers=[];this.clearElement(cell);cell.className=this.Style.CSS_CELL;cell.id=this.id+cellPrefix+i;if(workingDate.getDate()==todayDate&&workingDate.getMonth()==todayMonth&&workingDate.getFullYear()==todayYear){cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;}
var workingArray=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];this.cellDates[this.cellDates.length]=workingArray;if(workingDate.getMonth()!=useDate.getMonth()){cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;}else{Dom.addClass(cell,workingDayPrefix+workingDate.getDay());Dom.addClass(cell,dayPrefix+workingDate.getDate());for(var s=0;s<this.renderStack.length;++s){renderer=null;var rArray=this.renderStack[s],type=rArray[0],month,day,year;switch(type){case Calendar.DATE:month=rArray[1][1];day=rArray[1][2];year=rArray[1][0];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day&&workingDate.getFullYear()==year){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case Calendar.MONTH_DAY:month=rArray[1][0];day=rArray[1][1];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day){renderer=rArray[2];this.renderStack.splice(s,1);}
break;case Calendar.RANGE:var date1=rArray[1][0],date2=rArray[1][1],d1month=date1[1],d1day=date1[2],d1year=date1[0],d1=DateMath.getDate(d1year,d1month-1,d1day),d2month=date2[1],d2day=date2[2],d2year=date2[0],d2=DateMath.getDate(d2year,d2month-1,d2day);if(workingDate.getTime()>=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(s,1);}}
break;case Calendar.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}
break;case Calendar.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}
break;}
if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
if(this._indexOfSelectedFieldArray(workingArray)>-1){cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;}
if((mindate&&(workingDate.getTime()<mindate.getTime()))||(maxdate&&(workingDate.getTime()>maxdate.getTime()))){cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=cal.styleCellDefault;cellRenderers[cellRenderers.length]=cal.renderCellDefault;}
for(var x=0;x<cellRenderers.length;++x){if(cellRenderers[x].call(cal,workingDate,cell)==Calendar.STOP_RENDER){break;}}
workingDate.setTime(workingDate.getTime()+DateMath.ONE_DAY_MS);workingDate=DateMath.clearTime(workingDate);if(i>=0&&i<=6){Dom.addClass(cell,this.Style.CSS_CELL_TOP);}
if((i%7)===0){Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}
if(((i+1)%7)===0){Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}
var postDays=this.postMonthDays;if(hideBlankWeeks&&postDays>=7){var blankWeeks=Math.floor(postDays/7);for(var p=0;p<blankWeeks;++p){postDays-=7;}}
if(i>=((this.preMonthDays+postDays+this.monthDays)-7)){Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}
html[html.length]=tempDiv.innerHTML;i++;}
if(showWeekFooter){html=this.renderRowFooter(weekNum,html);}
html[html.length]='</tr>';}}
html[html.length]='</tbody>';return html;},renderFooter:function(html){return html;},render:function(){this.beforeRenderEvent.fire();var workingDate=DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;Event.purgeElement(this.oDomContainer,true);var html=[];html[html.length]='<table cellSpacing="0" class="'+this.Style.CSS_CALENDAR+' y'+workingDate.getFullYear()+'" id="'+this.id+'">';html=this.renderHeader(html);html=this.renderBody(workingDate,html);html=this.renderFooter(html);html[html.length]='</table>';this.oDomContainer.innerHTML=html.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(DEF_CFG.TITLE.key);this.cfg.refireEvent(DEF_CFG.CLOSE.key);this.cfg.refireEvent(DEF_CFG.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var root=this.oDomContainer,cal=this.parent||this,anchor="a",click="click";var linkLeft=Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,anchor,root),linkRight=Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,anchor,root);if(linkLeft&&linkLeft.length>0){this.linkLeft=linkLeft[0];Event.addListener(this.linkLeft,click,this.doPreviousMonthNav,cal,true);}
if(linkRight&&linkRight.length>0){this.linkRight=linkRight[0];Event.addListener(this.linkRight,click,this.doNextMonthNav,cal,true);}
if(cal.cfg.getProperty("navigator")!==null){this.applyNavListeners();}
if(this.domEventMap){var el,elements;for(var cls in this.domEventMap){if(Lang.hasOwnProperty(this.domEventMap,cls)){var items=this.domEventMap[cls];if(!(items instanceof Array)){items=[items];}
for(var i=0;i<items.length;i++){var item=items[i];elements=Dom.getElementsByClassName(cls,item.tag,this.oDomContainer);for(var c=0;c<elements.length;c++){el=elements[c];Event.addListener(el,item.event,item.handler,item.scope,item.correct);}}}}}
Event.addListener(this.oDomContainer,"click",this.doSelectCell,this);Event.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);Event.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);},applyNavListeners:function(){var calParent=this.parent||this,cal=this,navBtns=Dom.getElementsByClassName(this.Style.CSS_NAV,"a",this.oDomContainer);if(navBtns.length>0){Event.addListener(navBtns,"click",function(e,obj){var target=Event.getTarget(e);if(this===target||Dom.isAncestor(this,target)){Event.preventDefault(e);}
var navigator=calParent.oNavigator;if(navigator){var pgdate=cal.cfg.getProperty("pagedate");navigator.setYear(pgdate.getFullYear());navigator.setMonth(pgdate.getMonth());navigator.show();}});}},getDateByCellId:function(id){var date=this.getDateFieldsByCellId(id);return(date)?DateMath.getDate(date[0],date[1]-1,date[2]):null;},getDateFieldsByCellId:function(id){id=this.getIndexFromId(id);return(id>-1)?this.cellDates[id]:null;},getCellIndex:function(date){var idx=-1;if(date){var m=date.getMonth(),y=date.getFullYear(),d=date.getDate(),dates=this.cellDates;for(var i=0;i<dates.length;++i){var cellDate=dates[i];if(cellDate[0]===y&&cellDate[1]===m+1&&cellDate[2]===d){idx=i;break;}}}
return idx;},getIndexFromId:function(strId){var idx=-1,li=strId.lastIndexOf("_cell");if(li>-1){idx=parseInt(strId.substring(li+5),10);}
return idx;},renderOutOfBoundsDate:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},renderRowHeader:function(weekNum,html){html[html.length]='<th class="calrowhead">'+weekNum+'</th>';return html;},renderRowFooter:function(weekNum,html){html[html.length]='<th class="calrowfoot">'+weekNum+'</th>';return html;},renderCellDefault:function(workingDate,cell){cell.innerHTML='<a href="#" class="'+this.Style.CSS_CELL_SELECTOR+'">'+this.buildDayLabel(workingDate)+"</a>";},styleCellDefault:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},renderBodyCellRestricted:function(workingDate,cell){Dom.addClass(cell,this.Style.CSS_CELL);Dom.addClass(cell,this.Style.CSS_CELL_RESTRICTED);cell.innerHTML=workingDate.getDate();return Calendar.STOP_RENDER;},addMonths:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.add(this.cfg.getProperty(cfgPageDate),DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();},subtractMonths:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.subtract(this.cfg.getProperty(cfgPageDate),DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();},addYears:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.add(this.cfg.getProperty(cfgPageDate),DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();},subtractYears:function(count){var cfgPageDate=DEF_CFG.PAGEDATE.key;this.cfg.setProperty(cfgPageDate,DateMath.subtract(this.cfg.getProperty(cfgPageDate),DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.subtractMonths(1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.subtractYears(1);},reset:function(){this.cfg.resetProperty(DEF_CFG.SELECTED.key);this.cfg.resetProperty(DEF_CFG.PAGEDATE.key);this.resetEvent.fire();},clear:function(){this.cfg.setProperty(DEF_CFG.SELECTED.key,[]);this.cfg.setProperty(DEF_CFG.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(date){var aToBeSelected=this._toFieldArray(date),validDates=[],selected=[],cfgSelected=DEF_CFG.SELECTED.key;for(var a=0;a<aToBeSelected.length;++a){var toSelect=aToBeSelected[a];if(!this.isDateOOB(this._toDate(toSelect))){if(validDates.length===0){this.beforeSelectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toSelect);if(this._indexOfSelectedFieldArray(toSelect)==-1){selected[selected.length]=toSelect;}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.selectEvent.fire(validDates);}
return this.getSelectedDates();},selectCell:function(cellIndex){var cell=this.cells[cellIndex],cellDate=this.cellDates[cellIndex],dCellDate=this._toDate(cellDate),selectable=Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeSelectEvent.fire();var cfgSelected=DEF_CFG.SELECTED.key;var selected=this.cfg.getProperty(cfgSelected);var selectDate=cellDate.concat();if(this._indexOfSelectedFieldArray(selectDate)==-1){selected[selected.length]=selectDate;}
if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.renderCellStyleSelected(dCellDate,cell);this.selectEvent.fire([selectDate]);this.doCellMouseOut.call(cell,null,this);}
return this.getSelectedDates();},deselect:function(date){var aToBeDeselected=this._toFieldArray(date),validDates=[],selected=[],cfgSelected=DEF_CFG.SELECTED.key;for(var a=0;a<aToBeDeselected.length;++a){var toDeselect=aToBeDeselected[a];if(!this.isDateOOB(this._toDate(toDeselect))){if(validDates.length===0){this.beforeDeselectEvent.fire();selected=this.cfg.getProperty(cfgSelected);}
validDates.push(toDeselect);var index=this._indexOfSelectedFieldArray(toDeselect);if(index!=-1){selected.splice(index,1);}}}
if(validDates.length>0){if(this.parent){this.parent.cfg.setProperty(cfgSelected,selected);}else{this.cfg.setProperty(cfgSelected,selected);}
this.deselectEvent.fire(validDates);}
return this.getSelectedDates();},deselectCell:function(cellIndex){var cell=this.cells[cellIndex],cellDate=this.cellDates[cellIndex],cellDateIndex=this._indexOfSelectedFieldArray(cellDate);var selectable=Dom.hasClass(cell,this.Style.CSS_CELL_SELECTABLE);if(selectable){this.beforeDeselectEvent.fire();var selected=this.cfg.getProperty(DEF_CFG.SELECTED.key),dCellDate=this._toDate(cellDate),selectDate=cellDate.concat();if(cellDateIndex>-1){if(this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth()==dCellDate.getMonth()&&this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear()==dCellDate.getFullYear()){Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}
selected.splice(cellDateIndex,1);}
if(this.parent){this.parent.cfg.setProperty(DEF_CFG.SELECTED.key,selected);}else{this.cfg.setProperty(DEF_CFG.SELECTED.key,selected);}
this.deselectEvent.fire(selectDate);}
return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var cfgSelected=DEF_CFG.SELECTED.key,selected=this.cfg.getProperty(cfgSelected),count=selected.length,sel=selected.concat();if(this.parent){this.parent.cfg.setProperty(cfgSelected,[]);}else{this.cfg.setProperty(cfgSelected,[]);}
if(count>0){this.deselectEvent.fire(sel);}
return this.getSelectedDates();},_toFieldArray:function(date){var returnDate=[];if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(Lang.isString(date)){returnDate=this._parseDates(date);}else if(Lang.isArray(date)){for(var i=0;i<date.length;++i){var d=date[i];returnDate[returnDate.length]=[d.getFullYear(),d.getMonth()+1,d.getDate()];}}
return returnDate;},toDate:function(dateFieldArray){return this._toDate(dateFieldArray);},_toDate:function(dateFieldArray){if(dateFieldArray instanceof Date){return dateFieldArray;}else{return DateMath.getDate(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);}},_fieldArraysAreEqual:function(array1,array2){var match=false;if(array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]){match=true;}
return match;},_indexOfSelectedFieldArray:function(find){var selected=-1,seldates=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var s=0;s<seldates.length;++s){var sArray=seldates[s];if(find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]){selected=s;break;}}
return selected;},isDateOOM:function(date){return(date.getMonth()!=this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth());},isDateOOB:function(date){var minDate=this.cfg.getProperty(DEF_CFG.MINDATE.key),maxDate=this.cfg.getProperty(DEF_CFG.MAXDATE.key),dm=DateMath;if(minDate){minDate=dm.clearTime(minDate);}
if(maxDate){maxDate=dm.clearTime(maxDate);}
var clearedDate=new Date(date.getTime());clearedDate=dm.clearTime(clearedDate);return((minDate&&clearedDate.getTime()<minDate.getTime())||(maxDate&&clearedDate.getTime()>maxDate.getTime()));},_parsePageDate:function(date){var parsedDate;if(date){if(date instanceof Date){parsedDate=DateMath.findMonthStart(date);}else{var month,year,aMonthYear;aMonthYear=date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));month=parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key)-1],10)-1;year=parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key)-1],10);parsedDate=DateMath.getDate(year,month,1);}}else{parsedDate=DateMath.getDate(this.today.getFullYear(),this.today.getMonth(),1);}
return parsedDate;},onBeforeSelect:function(){if(this.cfg.getProperty(DEF_CFG.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}}},onSelect:function(selected){},onBeforeDeselect:function(){},onDeselect:function(deselected){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(sDate){var aDate=sDate.split(this.Locale.DATE_FIELD_DELIMITER),rArray;if(aDate.length==2){rArray=[aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];rArray.type=Calendar.MONTH_DAY;}else{rArray=[aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];rArray.type=Calendar.DATE;}
for(var i=0;i<rArray.length;i++){rArray[i]=parseInt(rArray[i],10);}
return rArray;},_parseDates:function(sDates){var aReturn=[],aDates=sDates.split(this.Locale.DATE_DELIMITER);for(var d=0;d<aDates.length;++d){var sDate=aDates[d];if(sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var aRange=sDate.split(this.Locale.DATE_RANGE_DELIMITER),dateStart=this._parseDate(aRange[0]),dateEnd=this._parseDate(aRange[1]),fullRange=this._parseRange(dateStart,dateEnd);aReturn=aReturn.concat(fullRange);}else{var aDate=this._parseDate(sDate);aReturn.push(aDate);}}
return aReturn;},_parseRange:function(startDate,endDate){var dCurrent=DateMath.add(DateMath.getDate(startDate[0],startDate[1]-1,startDate[2]),DateMath.DAY,1),dEnd=DateMath.getDate(endDate[0],endDate[1]-1,endDate[2]),results=[];results.push(startDate);while(dCurrent.getTime()<=dEnd.getTime()){results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);dCurrent=DateMath.add(dCurrent,DateMath.DAY,1);}
return results;},resetRenderers:function(){this.renderStack=this._renderStack.concat();},removeRenderers:function(){this._renderStack=[];this.renderStack=[];},clearElement:function(cell){cell.innerHTML="&#160;";cell.className="";},addRenderer:function(sDates,fnRender){var aDates=this._parseDates(sDates);for(var i=0;i<aDates.length;++i){var aDate=aDates[i];if(aDate.length==2){if(aDate[0]instanceof Array){this._addRenderer(Calendar.RANGE,aDate,fnRender);}else{this._addRenderer(Calendar.MONTH_DAY,aDate,fnRender);}}else if(aDate.length==3){this._addRenderer(Calendar.DATE,aDate,fnRender);}}},_addRenderer:function(type,aDates,fnRender){var add=[type,aDates,fnRender];this.renderStack.unshift(add);this._renderStack=this.renderStack.concat();},addMonthRenderer:function(month,fnRender){this._addRenderer(Calendar.MONTH,[month],fnRender);},addWeekdayRenderer:function(weekday,fnRender){this._addRenderer(Calendar.WEEKDAY,[weekday],fnRender);},clearAllBodyCellStyles:function(style){for(var c=0;c<this.cells.length;++c){Dom.removeClass(this.cells[c],style);}},setMonth:function(month){var cfgPageDate=DEF_CFG.PAGEDATE.key,current=this.cfg.getProperty(cfgPageDate);current.setMonth(parseInt(month,10));this.cfg.setProperty(cfgPageDate,current);},setYear:function(year){var cfgPageDate=DEF_CFG.PAGEDATE.key,current=this.cfg.getProperty(cfgPageDate);current.setFullYear(parseInt(year,10));this.cfg.setProperty(cfgPageDate,current);},getSelectedDates:function(){var returnDates=[],selected=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;},hide:function(){if(this.beforeHideEvent.fire()){this.oDomContainer.style.display="none";this.hideEvent.fire();}},show:function(){if(this.beforeShowEvent.fire()){this.oDomContainer.style.display="block";this.showEvent.fire();}},browser:(function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}})(),toString:function(){return"Calendar "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var cal=this;if(cal.navigator){cal.navigator.destroy();}
if(cal.cfg){cal.cfg.destroy();}
Event.purgeElement(cal.oDomContainer,true);Dom.removeClass(cal.oDomContainer,"withtitle");Dom.removeClass(cal.oDomContainer,cal.Style.CSS_CONTAINER);Dom.removeClass(cal.oDomContainer,cal.Style.CSS_SINGLE);cal.oDomContainer.innerHTML="";cal.oDomContainer=null;cal.cells=null;this.destroyEvent.fire();}}};YAHOO.widget.Calendar=Calendar;YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;})();(function(){var Dom=YAHOO.util.Dom,DateMath=YAHOO.widget.DateMath,Event=YAHOO.util.Event,Lang=YAHOO.lang,Calendar=YAHOO.widget.Calendar;function CalendarGroup(id,containerId,config){if(arguments.length>0){this.init.apply(this,arguments);}}
CalendarGroup._DEFAULT_CONFIG=Calendar._DEFAULT_CONFIG;CalendarGroup._DEFAULT_CONFIG.PAGES={key:"pages",value:2};var DEF_CFG=CalendarGroup._DEFAULT_CONFIG;CalendarGroup.prototype={init:function(id,container,config){var nArgs=this._parseArgs(arguments);id=nArgs.id;container=nArgs.container;config=nArgs.config;this.oDomContainer=Dom.get(container);if(!this.oDomContainer.id){this.oDomContainer.id=Dom.generateId();}
if(!id){id=this.oDomContainer.id+"_t";}
this.id=id;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];Dom.addClass(this.oDomContainer,CalendarGroup.CSS_CONTAINER);Dom.addClass(this.oDomContainer,CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var cfg=this.cfg;cfg.addProperty(DEF_CFG.PAGES.key,{value:DEF_CFG.PAGES.value,validator:cfg.checkNumber,handler:this.configPages});cfg.addProperty(DEF_CFG.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});cfg.addProperty(DEF_CFG.SELECTED.key,{value:[],handler:this.configSelected});cfg.addProperty(DEF_CFG.TITLE.key,{value:DEF_CFG.TITLE.value,handler:this.configTitle});cfg.addProperty(DEF_CFG.CLOSE.key,{value:DEF_CFG.CLOSE.value,handler:this.configClose});cfg.addProperty(DEF_CFG.IFRAME.key,{value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.MINDATE.key,{value:DEF_CFG.MINDATE.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MAXDATE.key,{value:DEF_CFG.MAXDATE.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MULTI_SELECT.key,{value:DEF_CFG.MULTI_SELECT.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.START_WEEKDAY.key,{value:DEF_CFG.START_WEEKDAY.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key,{value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key,{value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key,{value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MONTHS_SHORT.key,{value:DEF_CFG.MONTHS_SHORT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MONTHS_LONG.key,{value:DEF_CFG.MONTHS_LONG.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key,{value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key,{value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key,{value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key,{value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key,{value:DEF_CFG.LOCALE_MONTHS.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key,{value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_DELIMITER.key,{value:DEF_CFG.DATE_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key,{value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key,{value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key,{value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key,{value:DEF_CFG.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key,{value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key,{value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key,{value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key,{value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key,{value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key,{value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key,{value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});cfg.addProperty(DEF_CFG.NAV.key,{value:DEF_CFG.NAV.value,handler:this.configNavigator});cfg.addProperty(DEF_CFG.STRINGS.key,{value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val){return Lang.isObject(val);},supercedes:DEF_CFG.STRINGS.supercedes});},initEvents:function(){var me=this,strEvent="Event",CE=YAHOO.util.CustomEvent;var sub=function(fn,obj,bOverride){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].subscribe(fn,obj,bOverride);}};var unsub=function(fn,obj){for(var p=0;p<me.pages.length;++p){var cal=me.pages[p];cal[this.type+strEvent].unsubscribe(fn,obj);}};var defEvents=Calendar._EVENT_TYPES;me.beforeSelectEvent=new CE(defEvents.BEFORE_SELECT);me.beforeSelectEvent.subscribe=sub;me.beforeSelectEvent.unsubscribe=unsub;me.selectEvent=new CE(defEvents.SELECT);me.selectEvent.subscribe=sub;me.selectEvent.unsubscribe=unsub;me.beforeDeselectEvent=new CE(defEvents.BEFORE_DESELECT);me.beforeDeselectEvent.subscribe=sub;me.beforeDeselectEvent.unsubscribe=unsub;me.deselectEvent=new CE(defEvents.DESELECT);me.deselectEvent.subscribe=sub;me.deselectEvent.unsubscribe=unsub;me.changePageEvent=new CE(defEvents.CHANGE_PAGE);me.changePageEvent.subscribe=sub;me.changePageEvent.unsubscribe=unsub;me.beforeRenderEvent=new CE(defEvents.BEFORE_RENDER);me.beforeRenderEvent.subscribe=sub;me.beforeRenderEvent.unsubscribe=unsub;me.renderEvent=new CE(defEvents.RENDER);me.renderEvent.subscribe=sub;me.renderEvent.unsubscribe=unsub;me.resetEvent=new CE(defEvents.RESET);me.resetEvent.subscribe=sub;me.resetEvent.unsubscribe=unsub;me.clearEvent=new CE(defEvents.CLEAR);me.clearEvent.subscribe=sub;me.clearEvent.unsubscribe=unsub;me.beforeShowEvent=new CE(defEvents.BEFORE_SHOW);me.showEvent=new CE(defEvents.SHOW);me.beforeHideEvent=new CE(defEvents.BEFORE_HIDE);me.hideEvent=new CE(defEvents.HIDE);me.beforeShowNavEvent=new CE(defEvents.BEFORE_SHOW_NAV);me.showNavEvent=new CE(defEvents.SHOW_NAV);me.beforeHideNavEvent=new CE(defEvents.BEFORE_HIDE_NAV);me.hideNavEvent=new CE(defEvents.HIDE_NAV);me.beforeRenderNavEvent=new CE(defEvents.BEFORE_RENDER_NAV);me.renderNavEvent=new CE(defEvents.RENDER_NAV);me.beforeDestroyEvent=new CE(defEvents.BEFORE_DESTROY);me.destroyEvent=new CE(defEvents.DESTROY);},configPages:function(type,args,obj){var pageCount=args[0],cfgPageDate=DEF_CFG.PAGEDATE.key,sep="_",groupCalClass="groupcal",firstClass="first-of-type",lastClass="last-of-type";for(var p=0;p<pageCount;++p){var calId=this.id+sep+p,calContainerId=this.containerId+sep+p,childConfig=this.cfg.getConfig();childConfig.close=false;childConfig.title=false;childConfig.navigator=null;var cal=this.constructChild(calId,calContainerId,childConfig);var caldate=cal.cfg.getProperty(cfgPageDate);this._setMonthOnDate(caldate,caldate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,caldate);Dom.removeClass(cal.oDomContainer,this.Style.CSS_SINGLE);Dom.addClass(cal.oDomContainer,groupCalClass);if(p===0){Dom.addClass(cal.oDomContainer,firstClass);}
if(p==(pageCount-1)){Dom.addClass(cal.oDomContainer,lastClass);}
cal.parent=this;cal.index=p;this.pages[this.pages.length]=cal;}},configPageDate:function(type,args,obj){var val=args[0],firstPageDate;var cfgPageDate=DEF_CFG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];if(p===0){firstPageDate=cal._parsePageDate(val);cal.cfg.setProperty(cfgPageDate,firstPageDate);}else{var pageDate=new Date(firstPageDate);this._setMonthOnDate(pageDate,pageDate.getMonth()+p);cal.cfg.setProperty(cfgPageDate,pageDate);}}},configSelected:function(type,args,obj){var cfgSelected=DEF_CFG.SELECTED.key;this.delegateConfig(type,args,obj);var selected=(this.pages.length>0)?this.pages[0].cfg.getProperty(cfgSelected):[];this.cfg.setProperty(cfgSelected,selected,true);},delegateConfig:function(type,args,obj){var val=args[0];var cal;for(var p=0;p<this.pages.length;p++){cal=this.pages[p];cal.cfg.setProperty(type,val);}},setChildFunction:function(fnName,fn){var pageCount=this.cfg.getProperty(DEF_CFG.PAGES.key);for(var p=0;p<pageCount;++p){this.pages[p][fnName]=fn;}},callChildFunction:function(fnName,args){var pageCount=this.cfg.getProperty(DEF_CFG.PAGES.key);for(var p=0;p<pageCount;++p){var page=this.pages[p];if(page[fnName]){var fn=page[fnName];fn.call(page,args);}}},constructChild:function(id,containerId,config){var container=document.getElementById(containerId);if(!container){container=document.createElement("div");container.id=containerId;this.oDomContainer.appendChild(container);}
return new Calendar(id,containerId,config);},setMonth:function(month){month=parseInt(month,10);var currYear;var cfgPageDate=DEF_CFG.PAGEDATE.key;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if(p===0){currYear=pageDate.getFullYear();}else{pageDate.setFullYear(currYear);}
this._setMonthOnDate(pageDate,month+p);cal.cfg.setProperty(cfgPageDate,pageDate);}},setYear:function(year){var cfgPageDate=DEF_CFG.PAGEDATE.key;year=parseInt(year,10);for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];var pageDate=cal.cfg.getProperty(cfgPageDate);if((pageDate.getMonth()+1)==1&&p>0){year+=1;}
cal.setYear(year);}},render:function(){this.renderHeader();for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.render();}
this.renderFooter();},select:function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.select(date);}
return this.getSelectedDates();},selectCell:function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.selectCell(cellIndex);}
return this.getSelectedDates();},deselect:function(date){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselect(date);}
return this.getSelectedDates();},deselectAll:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectAll();}
return this.getSelectedDates();},deselectCell:function(cellIndex){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.deselectCell(cellIndex);}
return this.getSelectedDates();},reset:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.reset();}},clear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.clear();}
this.cfg.setProperty(DEF_CFG.SELECTED.key,[]);this.cfg.setProperty(DEF_CFG.PAGEDATE.key,new Date(this.pages[0].today.getTime()));this.render();},nextMonth:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextMonth();}},previousMonth:function(){for(var p=this.pages.length-1;p>=0;--p){var cal=this.pages[p];cal.previousMonth();}},nextYear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.nextYear();}},previousYear:function(){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.previousYear();}},getSelectedDates:function(){var returnDates=[];var selected=this.cfg.getProperty(DEF_CFG.SELECTED.key);for(var d=0;d<selected.length;++d){var dateArray=selected[d];var date=DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort(function(a,b){return a-b;});return returnDates;},addRenderer:function(sDates,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addRenderer(sDates,fnRender);}},addMonthRenderer:function(month,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addMonthRenderer(month,fnRender);}},addWeekdayRenderer:function(weekday,fnRender){for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];cal.addWeekdayRenderer(weekday,fnRender);}},removeRenderers:function(){this.callChildFunction("removeRenderers");},renderHeader:function(){},renderFooter:function(){},addMonths:function(count){this.callChildFunction("addMonths",count);},subtractMonths:function(count){this.callChildFunction("subtractMonths",count);},addYears:function(count){this.callChildFunction("addYears",count);},subtractYears:function(count){this.callChildFunction("subtractYears",count);},getCalendarPage:function(date){var cal=null;if(date){var y=date.getFullYear(),m=date.getMonth();var pages=this.pages;for(var i=0;i<pages.length;++i){var pageDate=pages[i].cfg.getProperty("pagedate");if(pageDate.getFullYear()===y&&pageDate.getMonth()===m){cal=pages[i];break;}}}
return cal;},_setMonthOnDate:function(date,iMonth){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(iMonth<0||iMonth>11)){var newDate=DateMath.add(date,DateMath.MONTH,iMonth-date.getMonth());date.setTime(newDate.getTime());}else{date.setMonth(iMonth);}},_fixWidth:function(){var w=0;for(var p=0;p<this.pages.length;++p){var cal=this.pages[p];w+=cal.oDomContainer.offsetWidth;}
if(w>0){this.oDomContainer.style.width=w+"px";}},toString:function(){return"CalendarGroup "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var cal=this;if(cal.navigator){cal.navigator.destroy();}
if(cal.cfg){cal.cfg.destroy();}
Event.purgeElement(cal.oDomContainer,true);Dom.removeClass(cal.oDomContainer,CalendarGroup.CSS_CONTAINER);Dom.removeClass(cal.oDomContainer,CalendarGroup.CSS_MULTI_UP);for(var i=0,l=cal.pages.length;i<l;i++){cal.pages[i].destroy();cal.pages[i]=null;}
cal.oDomContainer.innerHTML="";cal.oDomContainer=null;this.destroyEvent.fire();}}};CalendarGroup.CSS_CONTAINER="yui-calcontainer";CalendarGroup.CSS_MULTI_UP="multi";CalendarGroup.CSS_2UPTITLE="title";CalendarGroup.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(CalendarGroup,Calendar,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","configStrings","configNavigator","createTitleBar","createCloseButton","removeTitleBar","removeCloseButton","hide","show","toDate","_toDate","_parseArgs","browser");YAHOO.widget.CalGrp=CalendarGroup;YAHOO.widget.CalendarGroup=CalendarGroup;YAHOO.widget.Calendar2up=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.extend(YAHOO.widget.Calendar2up,CalendarGroup);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;})();YAHOO.widget.CalendarNavigator=function(cal){this.init(cal);};(function(){var CN=YAHOO.widget.CalendarNavigator;CN.CLASSES={NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};CN._DEFAULT_CFG={strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};CN.ID_SUFFIX="_nav";CN.MONTH_SUFFIX="_month";CN.YEAR_SUFFIX="_year";CN.ERROR_SUFFIX="_error";CN.CANCEL_SUFFIX="_cancel";CN.SUBMIT_SUFFIX="_submit";CN.YR_MAX_DIGITS=4;CN.YR_MINOR_INC=1;CN.YR_MAJOR_INC=10;CN.UPDATE_DELAY=50;CN.YR_PATTERN=/^\d+$/;CN.TRIM=/^\s*(.*?)\s*$/;})();YAHOO.widget.CalendarNavigator.prototype={id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(cal){var calBox=cal.oDomContainer;this.cal=cal;this.id=calBox.id+YAHOO.widget.CalendarNavigator.ID_SUFFIX;this._doc=calBox.ownerDocument;var ie=YAHOO.env.ua.ie;this.__isIEQuirks=(ie&&((ie<=6)||(ie===7&&this._doc.compatMode=="BackCompat")));},show:function(){var CLASSES=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeShowNavEvent.fire()){if(!this.__rendered){this.render();}
this.clearErrors();this._updateMonthUI();this._updateYearUI();this._show(this.navEl,true);this.setInitialFocus();this.showMask();YAHOO.util.Dom.addClass(this.cal.oDomContainer,CLASSES.NAV_VISIBLE);this.cal.showNavEvent.fire();}},hide:function(){var CLASSES=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeHideNavEvent.fire()){this._show(this.navEl,false);this.hideMask();YAHOO.util.Dom.removeClass(this.cal.oDomContainer,CLASSES.NAV_VISIBLE);this.cal.hideNavEvent.fire();}},showMask:function(){this._show(this.maskEl,true);if(this.__isIEQuirks){this._syncMask();}},hideMask:function(){this._show(this.maskEl,false);},getMonth:function(){return this._month;},getYear:function(){return this._year;},setMonth:function(nMonth){if(nMonth>=0&&nMonth<12){this._month=nMonth;}
this._updateMonthUI();},setYear:function(nYear){var yrPattern=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(nYear)&&yrPattern.test(nYear+"")){this._year=nYear;}
this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}
this.cal.renderNavEvent.fire();},createNav:function(){var NAV=YAHOO.widget.CalendarNavigator;var doc=this._doc;var d=doc.createElement("div");d.className=NAV.CLASSES.NAV;var htmlBuf=this.renderNavContents([]);d.innerHTML=htmlBuf.join('');this.cal.oDomContainer.appendChild(d);this.navEl=d;this.yearEl=doc.getElementById(this.id+NAV.YEAR_SUFFIX);this.monthEl=doc.getElementById(this.id+NAV.MONTH_SUFFIX);this.errorEl=doc.getElementById(this.id+NAV.ERROR_SUFFIX);this.submitEl=doc.getElementById(this.id+NAV.SUBMIT_SUFFIX);this.cancelEl=doc.getElementById(this.id+NAV.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}
this._setFirstLastElements();},createMask:function(){var C=YAHOO.widget.CalendarNavigator.CLASSES;var d=this._doc.createElement("div");d.className=C.MASK;this.cal.oDomContainer.appendChild(d);this.maskEl=d;},_syncMask:function(){var c=this.cal.oDomContainer;if(c&&this.maskEl){var r=YAHOO.util.Dom.getRegion(c);YAHOO.util.Dom.setStyle(this.maskEl,"width",r.right-r.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",r.bottom-r.top+"px");}},renderNavContents:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES,h=html;h[h.length]='<div class="'+C.MONTH+'">';this.renderMonth(h);h[h.length]='</div>';h[h.length]='<div class="'+C.YEAR+'">';this.renderYear(h);h[h.length]='</div>';h[h.length]='<div class="'+C.BUTTONS+'">';this.renderButtons(h);h[h.length]='</div>';h[h.length]='<div class="'+C.ERROR+'" id="'+this.id+NAV.ERROR_SUFFIX+'"></div>';return h;},renderMonth:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES;var id=this.id+NAV.MONTH_SUFFIX,mf=this.__getCfg("monthFormat"),months=this.cal.cfg.getProperty((mf==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),h=html;if(months&&months.length>0){h[h.length]='<label for="'+id+'">';h[h.length]=this.__getCfg("month",true);h[h.length]='</label>';h[h.length]='<select name="'+id+'" id="'+id+'" class="'+C.MONTH_CTRL+'">';for(var i=0;i<months.length;i++){h[h.length]='<option value="'+i+'">';h[h.length]=months[i];h[h.length]='</option>';}
h[h.length]='</select>';}
return h;},renderYear:function(html){var NAV=YAHOO.widget.CalendarNavigator,C=NAV.CLASSES;var id=this.id+NAV.YEAR_SUFFIX,size=NAV.YR_MAX_DIGITS,h=html;h[h.length]='<label for="'+id+'">';h[h.length]=this.__getCfg("year",true);h[h.length]='</label>';h[h.length]='<input type="text" name="'+id+'" id="'+id+'" class="'+C.YEAR_CTRL+'" maxlength="'+size+'"/>';return h;},renderButtons:function(html){var C=YAHOO.widget.CalendarNavigator.CLASSES;var h=html;h[h.length]='<span class="'+C.BUTTON+' '+C.DEFAULT+'">';h[h.length]='<button type="button" id="'+this.id+'_submit'+'">';h[h.length]=this.__getCfg("submit",true);h[h.length]='</button>';h[h.length]='</span>';h[h.length]='<span class="'+C.BUTTON+'">';h[h.length]='<button type="button" id="'+this.id+'_cancel'+'">';h[h.length]=this.__getCfg("cancel",true);h[h.length]='</button>';h[h.length]='</span>';return h;},applyListeners:function(){var E=YAHOO.util.Event;function yearUpdateHandler(){if(this.validate()){this.setYear(this._getYearFromUI());}}
function monthUpdateHandler(){this.setMonth(this._getMonthFromUI());}
E.on(this.submitEl,"click",this.submit,this,true);E.on(this.cancelEl,"click",this.cancel,this,true);E.on(this.yearEl,"blur",yearUpdateHandler,this,true);E.on(this.monthEl,"change",monthUpdateHandler,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}
this.applyKeyListeners();},purgeListeners:function(){var E=YAHOO.util.Event;E.removeListener(this.submitEl,"click",this.submit);E.removeListener(this.cancelEl,"click",this.cancel);E.removeListener(this.yearEl,"blur");E.removeListener(this.monthEl,"change");if(this.__isIEQuirks){E.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}
this.purgeKeyListeners();},applyKeyListeners:function(){var E=YAHOO.util.Event,ua=YAHOO.env.ua;var arrowEvt=(ua.ie||ua.webkit)?"keydown":"keypress";var tabEvt=(ua.ie||ua.opera||ua.webkit)?"keydown":"keypress";E.on(this.yearEl,"keypress",this._handleEnterKey,this,true);E.on(this.yearEl,arrowEvt,this._handleDirectionKeys,this,true);E.on(this.lastCtrl,tabEvt,this._handleTabKey,this,true);E.on(this.firstCtrl,tabEvt,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var E=YAHOO.util.Event,ua=YAHOO.env.ua;var arrowEvt=(ua.ie||ua.webkit)?"keydown":"keypress";var tabEvt=(ua.ie||ua.opera||ua.webkit)?"keydown":"keypress";E.removeListener(this.yearEl,"keypress",this._handleEnterKey);E.removeListener(this.yearEl,arrowEvt,this._handleDirectionKeys);E.removeListener(this.lastCtrl,tabEvt,this._handleTabKey);E.removeListener(this.firstCtrl,tabEvt,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var cal=this.cal;var delay=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(delay>0){var nav=this;window.setTimeout(function(){nav._update(cal);},delay);}else{this._update(cal);}}},_update:function(cal){cal.setYear(this.getYear());cal.setMonth(this.getMonth());cal.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(msg){if(this.errorEl){this.errorEl.innerHTML=msg;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var el=this.submitEl,f=this.__getCfg("initialFocus");if(f&&f.toLowerCase){f=f.toLowerCase();if(f=="year"){el=this.yearEl;try{this.yearEl.select();}catch(selErr){}}else if(f=="month"){el=this.monthEl;}}
if(el&&YAHOO.lang.isFunction(el.focus)){try{el.focus();}catch(focusErr){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}
var p=this.navEl.parentNode;if(p){p.removeChild(this.navEl);}
this.navEl=null;var pm=this.maskEl.parentNode;if(pm){pm.removeChild(this.maskEl);}
this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(el,bShow){if(el){YAHOO.util.Dom.setStyle(el,"display",(bShow)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var NAV=YAHOO.widget.CalendarNavigator;var yr=null;if(this.yearEl){var value=this.yearEl.value;value=value.replace(NAV.TRIM,"$1");if(NAV.YR_PATTERN.test(value)){yr=parseInt(value,10);}}
return yr;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}
if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(e){var KEYS=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(e)==KEYS.ENTER){YAHOO.util.Event.preventDefault(e);this.submit();}},_handleDirectionKeys:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY,NAV=YAHOO.widget.CalendarNavigator;var value=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(value)){var dir=false;switch(E.getCharCode(e)){case KEYS.UP:this.yearEl.value=value+NAV.YR_MINOR_INC;dir=true;break;case KEYS.DOWN:this.yearEl.value=Math.max(value-NAV.YR_MINOR_INC,0);dir=true;break;case KEYS.PAGE_UP:this.yearEl.value=value+NAV.YR_MAJOR_INC;dir=true;break;case KEYS.PAGE_DOWN:this.yearEl.value=Math.max(value-NAV.YR_MAJOR_INC,0);dir=true;break;default:break;}
if(dir){E.preventDefault(e);try{this.yearEl.select();}catch(err){}}}},_handleTabKey:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY;if(E.getCharCode(e)==KEYS.TAB&&!e.shiftKey){try{E.preventDefault(e);this.firstCtrl.focus();}catch(err){}}},_handleShiftTabKey:function(e){var E=YAHOO.util.Event,KEYS=YAHOO.util.KeyListener.KEY;if(e.shiftKey&&E.getCharCode(e)==KEYS.TAB){try{E.preventDefault(e);this.lastCtrl.focus();}catch(err){}}},__getCfg:function(prop,bIsStr){var DEF_CFG=YAHOO.widget.CalendarNavigator._DEFAULT_CFG;var cfg=this.cal.cfg.getProperty("navigator");if(bIsStr){return(cfg!==true&&cfg.strings&&cfg.strings[prop])?cfg.strings[prop]:DEF_CFG.strings[prop];}else{return(cfg!==true&&cfg[prop])?cfg[prop]:DEF_CFG[prop];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.widgets.Calendar","CERNY.dom.Element","CERNY.text.DateFormat","CERNY.js.Date","TOPINCS.widgets.DICT","TOPINCS.widgets.util","YAHOO.widget.Calendar");(function(){TOPINCS.widgets.Calendar=Calendar;var method=CERNY.method;var signature=CERNY.signature;var TimezoneSelect=TOPINCS.widgets.util.TimezoneSelect;var DICT=TOPINCS.widgets.DICT;var localizedMonthNames=[];for(var i=1;i<13;i++){localizedMonthNames.push(DICT["lab_month_"+i]);}
YAHOO.widget.Calendar._DEFAULT_CONFIG.MONTHS_LONG={key:"months_long",value:localizedMonthNames}
function Calendar(locale,id,container,config,timezone){if(id){this.locale=locale;document.body.appendChild(container.node);YAHOO.widget.Calendar.call(this,id,container.node.id,config);this.el=new CERNY.dom.Element(this.oDomContainer);document.body.removeChild(container.node);if(timezone){this.timezoneSelect=new TimezoneSelect();}}};CERNY.inherit(TOPINCS.widgets.Calendar,YAHOO.widget.Calendar);TOPINCS.widgets.Calendar.prototype.logger=CERNY.Logger("TOPINCS.widgets.Calendar");function setValue(date){this.cfg.setProperty("selected",date.format(CERNY.text.DateFormat.US));var pageDate=(date.getMonth()+1)+"/"+date.getFullYear();this.cfg.setProperty("pagedate",pageDate);if(this.timezoneSelect){this.timezoneSelect.el.node.value=CERNY.js.Date.getTimezoneOffset(date);}}
signature(setValue,"undefined",Date);method(Calendar.prototype,"setValue",setValue);function getValue(){var date=this.getSelectedDates()[0];if(this.timezoneSelect){CERNY.js.Date.setTimezoneOffset(date,Number(this.timezoneSelect.el.node.value));}
return date;}
signature(getValue,Date);method(Calendar.prototype,"getValue",getValue);function addChangeListener(f){this.selectEvent.subscribe(f,this,true);if(this.timezoneSelect){this.timezoneSelect.el.addEvtListener("change",f);}}
method(Calendar.prototype,"addChangeListener",addChangeListener);function render(){YAHOO.widget.Calendar.prototype.render.call(this);if(this.timezoneSelect){this.el.appendChild(this.timezoneSelect.el);}}
method(Calendar.prototype,"render",render);})();CERNY.require("TOPINCS.widgets.CalendarTime","TOPINCS.widgets.Calendar","CERNY.js.Date","TOPINCS.widgets.Time");(function(){TOPINCS.widgets.CalendarTime=CalendarTime;var Calendar=TOPINCS.widgets.Calendar;var Time=TOPINCS.widgets.Time;var method=CERNY.method;var signature=CERNY.signature;function CalendarTime(locale,id,container){this.container=container;Calendar.apply(this,arguments);this.time=new Time(locale);this.timeEl=this.time.render();};CERNY.inherit(TOPINCS.widgets.CalendarTime,TOPINCS.widgets.Calendar);TOPINCS.widgets.CalendarTime.prototype.logger=CERNY.Logger("TOPINCS.widgets.CalendarTime");function setValue(date){Calendar.prototype.setValue.call(this,date);this.time.setValue(date);}
signature(setValue,"undefined",Date);method(CalendarTime.prototype,"setValue",setValue);function getValue(){var value=this.getSelectedDates()[0];var time=this.time.getValue();value.setHours(time.getHours());value.setMinutes(time.getMinutes());value.setSeconds(time.getSeconds());CERNY.js.Date.setTimezoneOffset(value,CERNY.js.Date.getTimezoneOffset(time));return value;}
signature(getValue,Date);method(CalendarTime.prototype,"getValue",getValue);function render(){Calendar.prototype.render.call(this);this.container.appendChild(this.timeEl);}
method(CalendarTime.prototype,"render",render);function addChangeListener(f){this.selectEvent.subscribe(f,this,true);this.time.addChangeListener(f);}
method(CalendarTime.prototype,"addChangeListener",addChangeListener);})();CERNY.require("TOPINCS.widgets.ValueEditor","TOPINCS.widgets.ValueViewer","TOPINCS.widgets.OkCancelPopUp","TOPINCS.widgets.Icon","TOPINCS.widgets.LinkIcon","TOPINCS.widgets.DateInput","TOPINCS.widgets.TimeInput","TOPINCS.widgets.Time","TOPINCS.widgets.DateTimeInput","TOPINCS.widgets.InvalidDateFormatException","TOPINCS.cons","TOPINCS.widgets.DICT","CERNY.text.DateFormat","CERNY.text.TimeFormat","CERNY.text.TimezoneFormat","CERNY.event.Observable","TOPINCS.widgets.Calendar","TOPINCS.widgets.CalendarTime","CERNY.js.Date","CERNY.util","TOPINCS.util","CERNY.dom.Element");(function(){var Calendar=TOPINCS.widgets.Calendar;var CalendarTime=TOPINCS.widgets.CalendarTime;var DateInput=TOPINCS.widgets.DateInput;var DateTimeInput=TOPINCS.widgets.DateTimeInput;var DICT=TOPINCS.widgets.DICT;var Element=CERNY.dom.Element;var Icon=TOPINCS.widgets.Icon;var Logger=CERNY.Logger;var Observable=CERNY.event.Observable;var OkCancelPopUp=TOPINCS.widgets.OkCancelPopUp;var InvalidDateFormatException=TOPINCS.widgets.InvalidDateFormatException;var TimeInput=TOPINCS.widgets.TimeInput;var Time=TOPINCS.widgets.Time;var fill=CERNY.util.fillNumber;var method=CERNY.method;var signature=CERNY.signature;var joinFunctions=CERNY.joinFunctions;var require=CERNY.require;TOPINCS.widgets.ValueEditor=ValueEditor;var name="TOPINCS.widgets.ValueEditor";var logger=Logger(name);var EVT_USER_INPUT=name+".userInput";var EVT_BLUR=name+".blur";var EVT_FOCUS=name+".focus";var NUMBER_ROWS="7";var POPUP=new OkCancelPopUp({positionX:TOPINCS.widgets.PopUp.LEFT,draggable:false});function ValueEditor(value,datatype,locale){var cons=ValueEditor[datatype];if(!cons){cons=ValueEditor._default;}
var editor=new cons(value,locale);editor.el.addCSSClass("value-editor");Observable(editor);return editor;}
ValueEditor.prototype.logger=logger;ValueEditor.EVT_USER_INPUT=EVT_USER_INPUT;ValueEditor.EVT_BLUR=EVT_BLUR;ValueEditor.EVT_FOCUS=EVT_FOCUS;ValueEditor.LABEL_SHRINK_ENLARGE=DICT.lab_shrink_enlarge;ValueEditor.LABEL_HELP=DICT.lab_help;ValueEditor.POPUP=POPUP;function init(t,value,locale){t.value=value;t.locale=locale;}
function setDeactivation(t,value){var el=t.el;var formFields=el.getDescendants(isFormField);if(isFormField(el.node)){formFields.push(el.node);}
formFields.map(function(input){input.disabled=value;input.readonly=value;});}
function deactivate(){setDeactivation(this,1);}
function activate(){setDeactivation(this,0);}
(function(){ValueEditor._default=InputEditor;function InputEditor(value,locale){init(this,value,locale);this.el=Element.create("input");var t=this;function update(e){t.notify(EVT_USER_INPUT);}
this.el.addEvtListener("keyup",update);this.el.addEvtListener("blur",update);this.el.addEvtListener("blur",function(){t.notify(EVT_BLUR);});this.el.addEvtListener("focus",function(){t.notify(EVT_FOCUS);});};InputEditor.prototype.logger=Logger("TOPINCS.widgets.InputEditor");method(InputEditor.prototype,"deactivate",deactivate);method(InputEditor.prototype,"activate",activate);function getValue(){return this.el.node.value;}
signature(getValue,"string");method(InputEditor.prototype,"getValue",getValue);function render(){this.el.setAttr("value",this.value);return this.el;}
method(InputEditor.prototype,"render",render);function focus(){this.el.node.focus();}
method(InputEditor.prototype,"focus",focus);})();(function(){ValueEditor[DT_STRING]=TextEditor;ValueEditor[DT_ANYTYPE]=TextEditor;var EVT_MUTLILINE="multiline";var EVT_NOT_MULTILINE="not-multiline";var isMultiline=TOPINCS.util.isMultiline;function TextEditor(value,locale){init(this,value,locale);this.el=Element.create("span",null,"class=texteditor");this.smallEl=Element.create("input");this.bigEl=Element.create("textarea",null,"rows="+NUMBER_ROWS);var multiline=isMultiline(value);this.icon=new Icon(ValueEditor.LABEL_SHRINK_ENLARGE,"shrinkenlarge",!multiline);this.small=!multiline;if(this.small&&value.length>100){this.small=false;}
var t=this;this.blurNotifier=function(){t.notify(EVT_BLUR);};this.focusNotifier=function(){t.notify(EVT_FOCUS);};Observable(this);this.addObserver(EVT_MUTLILINE,function(){t.icon.deactivate();});this.addObserver(EVT_NOT_MULTILINE,function(){t.icon.activate();});function update(){var value=t.getValue();if(isMultiline(value)){t.notify(EVT_MUTLILINE);}else{t.notify(EVT_NOT_MULTILINE);}
t.notify(EVT_USER_INPUT);}
this.el.addEvtListener("keyup",update);this.smallEl.addEvtListener("blur",update);this.bigEl.addEvtListener("blur",update);this.icon.addAction(function(){toggle(t,t.getValue());});};TextEditor.prototype.logger=Logger("TOPINCS.widgets.TextEditor");method(TextEditor.prototype,"deactivate",joinFunctions(deactivate,function(){this.icon.deactivate()}));method(TextEditor.prototype,"activate",joinFunctions(activate,function(){this.icon.activate()}));function getValue(){if(this.small===true){return this.smallEl.node.value;}
return this.bigEl.node.value;}
signature(getValue,"string");method(TextEditor.prototype,"getValue",getValue);function render(){display(this);return this.el;}
method(TextEditor.prototype,"render",render);function focus(){if(this.small){this.smallEl.node.focus();}else{this.bigEl.node.focus();}}
method(TextEditor.prototype,"focus",focus);function toggle(t,value){t.value=value;if(t.small===true){t.small=false;}else{if(!isMultiline(t.value)){t.small=true;}}
redisplay(t);}
function renderSmall(t){t.smallEl.node.value=t.value;t.smallEl.addEvtListener("blur",t.blurNotifier);t.bigEl.removeEvtListener("blur",t.blurNotifier);t.smallEl.addEvtListener("focus",t.focusNotifier);t.bigEl.removeEvtListener("focus",t.focusNotifier);return t.smallEl;}
function renderBig(t){t.bigEl.node.value=t.value;t.bigEl.addEvtListener("blur",t.blurNotifier);t.smallEl.removeEvtListener("blur",t.blurNotifier);t.bigEl.addEvtListener("focus",t.focusNotifier);t.smallEl.removeEvtListener("focus",t.focusNotifier);return t.bigEl;}
function display(t){var resultEl;if(t.small===true){resultEl=renderSmall(t);}else{resultEl=renderBig(t);}
t.el.appendChildren(resultEl);resultEl.node.focus();t.icon.display(t.el);}
function redisplay(t){t.el.deleteChildren();display(t);}})();(function(){ValueEditor[DT_BOOLEAN]=CheckboxEditor;function CheckboxEditor(value,locale){init(this,value,locale);this.el=Element.create("input",null,"type=checkbox");var t=this;this.el.addEvtListener("click",function(e){t.notify(EVT_USER_INPUT);});}
CheckboxEditor.prototype.logger=Logger("TOPINCS.widgets.CheckboxEditor");method(CheckboxEditor.prototype,"deactivate",deactivate);method(CheckboxEditor.prototype,"activate",activate);function render(){if(this.value==="1"){this.el.setAttr("checked","checked");}
this.el.setAttr("value",this.value);return this.el;}
method(CheckboxEditor.prototype,"render",render);function getValue(){return this.el.node.checked?"1":"0";}
signature(getValue,"string");method(CheckboxEditor.prototype,"getValue",getValue);function focus(){this.el.node.focus();}
method(CheckboxEditor.prototype,"focus",focus);})();(function(){ValueEditor[DT_DATE]=DateEditor;function DateEditor(value,locale){init(this,value,locale);var id="DateEditor_"+new Date().getTime();this.calContainer=Element.create("div",null,"id="+id+"_CalendarContainer","class=hidden");initDateEditor(this,id,new DateInput(locale.formats),new Calendar(locale,id+"_Calendar",this.calContainer,null,true),"tit_enter_date");}
function initDateEditor(t,elId,inputControl,popupControl,titleKey){t.elId=elId;t.el=Element.create("div",null,"id="+elId);t.dateInput=inputControl;t.dateInput.addChangeListener(function(){t.notify(EVT_USER_INPUT);try{t.calendar.setValue(t.valueToObject(t.getValue()));}catch(e){}});t.calendar=popupControl;if(t.value){var date=t.valueToObject(t.value);if(date){t.dateInput.setValue(date);t.calendar.setValue(date);}}
t.calIcon=new Icon("","calendar");t.calIcon.addEvtListener(function(e){try{t.calendar.setValue(t.valueToObject(t.getValue()));}catch(e){t.calendar.setValue(new Date());}
if(t.calContainer){t.calContainer.show();}
t.calendar.render();t.calendar.show();function ok(){t.dateInput.setValue(t.calendar.getValue());t.notify(EVT_USER_INPUT);POPUP.hide();t.calIcon.focus();}
POPUP.setOkAction(ok);function cancel(){POPUP.hide();t.calIcon.focus();}
POPUP.setCancelAction(cancel);POPUP.setTitle(DICT[titleKey]);POPUP.displayContent(t.calendar.el.node,t.calIcon.el);POPUP.setFocusOnHide(t.calIcon);POPUP.focus();});}
DateEditor.prototype.logger=Logger("TOPINCS.widgets.DateEditor");function deactivateDateEditor(){deactivate.call(this);this.calIcon.deactivate();}
method(DateEditor.prototype,"deactivate",deactivateDateEditor);function activateDateEditor(){activate.call(this);this.calIcon.activate();}
method(DateEditor.prototype,"activate",activateDateEditor);function valueToObject(value){return Date.parseDate(value,CERNY.text.DateFormat.ISO);}
method(DateEditor.prototype,"valueToObject",valueToObject);function objectToValue(object){return object.format(CERNY.text.DateFormat.ISO,"",CERNY.text.TimezoneFormat.ISO);}
method(DateEditor.prototype,"objectToValue",objectToValue);function render(){this.el.appendChildren(this.dateInput.el,this.calIcon.aE);return this.el;}
method(DateEditor.prototype,"render",render);function focus(){this.dateInput.el.node.focus();}
method(DateEditor.prototype,"focus",focus);function getValue(){return this.objectToValue(this.dateInput.getValue());}
signature(getValue,["undefined","string"]);method(DateEditor.prototype,"getValue",getValue);(function(){ValueEditor[DT_DATETIME]=DateTimeEditor;function DateTimeEditor(value,locale){init(this,value,locale);var id="DateTimeEditor_"+new Date().getTime();this.calContainer=Element.create("div",null,"id="+id+"_CalendarContainer","class=hidden");initDateEditor(this,id,new DateTimeInput(locale.formats),new CalendarTime(locale,id,this.calContainer),"tit_enter_date_time");}
method(DateTimeEditor.prototype,"render",render);method(DateTimeEditor.prototype,"focus",focus);method(DateTimeEditor.prototype,"getValue",getValue);method(DateTimeEditor.prototype,"deactivate",deactivateDateEditor);method(DateTimeEditor.prototype,"activate",activateDateEditor);function valueToObject(value){var dateStr=value.substr(0,10);var timeStr=value.substr(11);return Date.parseDateTime(dateStr,CERNY.text.DateFormat.ISO,timeStr,CERNY.text.TimeFormat.ISO);}
signature(valueToObject,Date,"string");method(DateTimeEditor.prototype,"valueToObject",valueToObject);function objectToValue(object){return object.formatDateTime(CERNY.text.DateFormat.ISO,"T",CERNY.text.TimeFormat.ISO,"",CERNY.text.TimezoneFormat.ISO);}
method(DateTimeEditor.prototype,"objectToValue",objectToValue);})();(function(){ValueEditor[DT_TIME]=TimeEditor;var logger=CERNY.Logger("TOPINCS.widgets.TimeEditor");function TimeEditor(value,locale){init(this,value,locale);var id="TimeEditor_"+new Date().getTime();initDateEditor(this,id,new TimeInput(locale.formats),new Time(locale),"tit_enter_time");}
TimeEditor.prototype.logger=logger;method(TimeEditor.prototype,"render",render);method(TimeEditor.prototype,"focus",focus);method(TimeEditor.prototype,"getValue",getValue);method(TimeEditor.prototype,"deactivate",deactivateDateEditor);method(TimeEditor.prototype,"activate",activateDateEditor);function valueToObject(value){return Date.parseTime(value,CERNY.text.TimeFormat.ISO);}
signature(valueToObject,Date,"string");method(TimeEditor.prototype,"valueToObject",valueToObject);function objectToValue(object){return object.formatTime(CERNY.text.TimeFormat.ISO,"",CERNY.text.TimezoneFormat.ISO);}
method(TimeEditor.prototype,"objectToValue",objectToValue);})();})();(function(){ValueEditor[DT_WIKIMARKUP]=WikiMarkupEditor;function WikiMarkupEditor(value,locale){init(this,value,locale);this.el=Element.create("div");this.textareaEl=Element.create("textarea",null,"rows="+NUMBER_ROWS,"class=wiki-markup");this.icon=new TOPINCS.widgets.LinkIcon(ValueEditor.LABEL_HELP,"help",true,"http://goessner.net/articles/wiky/index.html#e2");this.el.appendChild(this.textareaEl);this.icon.display(this.el);var t=this;this.textareaEl.addEvtListener("keyup",function(e){t.notify(EVT_USER_INPUT);});this.textareaEl.addEvtListener("blur",function(){t.notify(EVT_BLUR);});this.textareaEl.addEvtListener("focus",function(){t.notify(EVT_FOCUS);});};WikiMarkupEditor.prototype.logger=Logger("TOPINCS.widgets.WikiMarkupEditor");method(WikiMarkupEditor.prototype,"deactivate",joinFunctions(deactivate,function(){this.icon.deactivate()}));method(WikiMarkupEditor.prototype,"activate",joinFunctions(activate,function(){this.icon.activate()}));function getValue(){return this.textareaEl.node.value;}
signature(getValue,"string");method(WikiMarkupEditor.prototype,"getValue",getValue);function render(){this.textareaEl.node.value=this.value;return this.el;}
method(WikiMarkupEditor.prototype,"render",render);function focus(){this.textareaEl.node.focus();}
method(WikiMarkupEditor.prototype,"focus",focus);})();})();CERNY.require("TOPINCS.wiki.OccurrenceEditor","TOPINCS.widgets.ValueEditor","TOPINCS.util","TOPINCS.widgets.util","TOPINCS.widgets.Button","TOPINCS.widgets.OkCancelPopUp","TOPINCS.tmdm.Construct","TOPINCS.wiki.DICT","CERNY.dom.Element","TOPINCS.view.View","CERNY.event.Revertable");(function(){TOPINCS.wiki.OccurrenceEditor=OccurrenceEditor;var logger=CERNY.Logger("TOPINCS.wiki.OccurrenceEditor");var Button=TOPINCS.widgets.Button;var View=TOPINCS.view.View;var ValueEditor=TOPINCS.widgets.ValueEditor;var signature=CERNY.signature;var method=CERNY.method;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var Revertable=CERNY.event.Revertable;var util=TOPINCS.widgets.util;function OccurrenceEditor(occurrence,context){if(occurrence){this.tagName="table";this.cssClass="statement occurrence";this.occurrence=occurrence;this.statement=occurrence;renderRow(this,context);View.call(this,occurrence,context);}}
OccurrenceEditor.prototype=new View();OccurrenceEditor.prototype.logger=logger;function display(context){var tbodyEl=Element.create("tbody");this.el.appendChild(tbodyEl);initMessageContainer(this);initEditor(this,this.statement.value,this.statement.datatype||DT_STRING,context);this.valueTdEl.appendChildren(this.editor.render(),this.validationMessageEl);tbodyEl.appendChild(this.trEl);if(this.statement.isNew){var t=this;setTimeout(function(){t.editor.focus();},100);}}
signature(display,"undefined","object");method(OccurrenceEditor.prototype,"display",display);function updateStatement(){this.statement.setValue(this.editor.getValue());}
method(OccurrenceEditor.prototype,"updateStatement",updateStatement);function register(){var statement=this.statement;var changes=this.context.changes;if(statement.isNew){changes.registerCreate(statement);}else if(statement.hasChanged(false)){changes.registerUpdate(statement);}else{changes.unregister(statement);}}
method(OccurrenceEditor.prototype,"register",register);function deactivate(excludingSelector){if(!isBoolean(excludingSelector)){excludingSelector=false;}
if(this.statement.hasChanged()){this.unmarkChanged();}
this.el.addCSSClass("inactive");this.deactivateProper();if(!excludingSelector){setDeactivationSelector(this.el,1);}}
signature(deactivate,"undefined");method(OccurrenceEditor.prototype,"deactivate",deactivate);function deactivateProper(){this.editor.deactivate();}
signature(deactivateProper,"undefined");method(OccurrenceEditor.prototype,"deactivateProper",deactivateProper);function activate(){this.el.deleteCSSClass("inactive");this.activateProper();setDeactivationSelector(this.el,0);}
signature(activate,"undefined");method(OccurrenceEditor.prototype,"activate",activate);function activateProper(){this.editor.activate();}
signature(activateProper,"undefined");method(OccurrenceEditor.prototype,"activateProper",activateProper);function initEditor(t,value,datatype,context){if(t.editor){t.editor.el.domDelete();}
var editor=new ValueEditor(value,datatype,context.prefs.locale);editor.addObserver(ValueEditor.EVT_USER_INPUT,function(){t.update(context);});t.editor=editor;}
function setDeactivationSelector(el,value){el.getDescendants(function(desc){return Element.cssFilter(desc,"selector");}).map(function(selectorInput){selectorInput.disabled=1;selectorInput.readonly=1;});}
function renderRow(t,context){t.trEl=Element.create("tr");t.valueTdEl=Element.create("td",null,"class=value");t.menuTdEl=Element.create("td",null,"class=stmt-menu");var buttonConf={label:DICT.lab_statement_more,tooltip:DICT.tt_statement_more_view,action:createOpenPopUpAction(t,t.menuTdEl)};t.menuButton=new Button(buttonConf);t.menuTdEl.appendChild(t.menuButton.render());t.statusTdEl=Element.create("td",null,"class=attr");var selectTdEl=Element.create("td",null,"class=attr selected");var selectorEl=Element.create("input",null,"type=checkbox","class=selector");selectTdEl.appendChild(selectorEl);selectorEl.addEvtListener("click",function(e){var evt=util.getEvent(e);var target=util.getTarget(evt);if(target.checked==1){context.selection.addEntry(t.statement,t);}else{context.selection.removeEntry(t.statement,t);}
if(evt.stopPropagation){evt.stopPropagation();}});t.selectorEl=selectorEl;t.trEl.appendChildren(t.valueTdEl,t.menuTdEl,t.statusTdEl,selectTdEl);return t.trEl;}
signature(renderRow,Element,"object");method(OccurrenceEditor,"renderRow",renderRow);function initMessageContainer(t){if(t.validationMessageEl){t.validationMessageEl.deleteChildren();}
t.validationMessageEl=Element.create("div",null,"class=message validation-message hidden");}
method(OccurrenceEditor,"initMessageContainer",initMessageContainer);function makeChangeAware(viewer,item){if(!item){item=viewer.statement;}
item.addObserver(Revertable.EVT_CHANGE,function(){viewer.markChanged();});item.addObserver(Revertable.EVT_REVERT,function(){viewer.unmarkChanged();});item.addObserver(TOPINCS.tmdm.Construct.EVT_SAVE_SUCCESS,function(){viewer.unmarkNew();viewer.unmarkChanged();});}
signature(makeChangeAware,"undefined","object","object");method(OccurrenceEditor,"makeChangeAware",makeChangeAware);function createOpenPopUpAction(t,targetEl){return function(){TOPINCS.util.blockUi();var statement=t.statement;var popup=new TOPINCS.widgets.OkCancelPopUp({positionX:TOPINCS.widgets.PopUp.LEFT,draggable:false});popup.setTitle(DICT.tit_statement_more_dialog);var scopeHeadingEl=Element.create("h4",DICT.lab_scope);var url=POSSIBLE_SCOPING_TOPINCS_URL+"?item_type="+statement.itemType.toLowerCase()+"&type="+statement.type;var possibleScopingTopics=TOPINCS.util.getResult(url);if(possibleScopingTopics.length===0){scopeSelectEl=Element.create("p",DICT.msg_no_selection);popup.setOkAction(function(){popup.hide();t.menuButton.focus();});}else{possibleScopingTopics.sort(TOPINCS.util.compareTopicProxiesByName);scopeSelectEl=util.convertTopicProxyArrayToSelect(possibleScopingTopics,statement.scope,10);popup.setOkAction(function(){var selectedOptions=util.getSelectedOptions(scopeSelectEl);statement.setScope(selectedOptions);t.register();popup.hide();t.menuButton.focus();});}
t.trEl.addCSSClass("stmt-hl");popup.el.addObserver(Element.EVT_HIDDEN,function(){t.trEl.deleteCSSClass("stmt-hl");});popup.setFocusOnHide(t.menuButton);var el=Element.create("div");el.appendChildren(scopeHeadingEl,scopeSelectEl);popup.displayContent(el);popup.position(targetEl);popup.show();popup.focus();TOPINCS.util.releaseUi();};}})();CERNY.require("TOPINCS.wiki.EmptyNameException","TOPINCS.wiki.Exception");(function(){TOPINCS.wiki.EmptyNameException=EmptyNameException;var Exception=TOPINCS.wiki.Exception;function EmptyNameException(){Exception.call(this,"msg_empty_name");}
EmptyNameException.prototype=new Exception();})();CERNY.require("TOPINCS.wiki.NameEditor","TOPINCS.wiki.EmptyNameException");(function(){TOPINCS.wiki.NameEditor=NameEditor;var OccurrenceEditor=TOPINCS.wiki.OccurrenceEditor;var signature=CERNY.signature;var method=CERNY.method;var logger=CERNY.Logger("TOPINCS.wiki.NameEditor");function NameEditor(name,context){this.tagName="table";this.cssClass="statement name";this.datatype=DT_STRING;this.name=name;this.statement=name;OccurrenceEditor.call(this,name,context);}
NameEditor.prototype=new OccurrenceEditor();NameEditor.prototype.logger=logger;function updateStatement(){var value=this.editor.getValue();if(value===""){throw new TOPINCS.wiki.EmptyNameException();}
this.statement.setValue(value);}
method(NameEditor.prototype,"updateStatement",updateStatement);})();CERNY.require("TOPINCS.widgets.TopicCompleter","TOPINCS.widgets.DICT","TOPINCS.util","TOPINCS.widgets.InputCompleter","CERNY.dom.Element");(function(){TOPINCS.widgets.TopicCompleter=TopicCompleter;var InputCompleter=TOPINCS.widgets.InputCompleter;var Element=CERNY.dom.Element;var signature=CERNY.signature;var method=CERNY.method;var name="TOPINCS.widgets.TopicCompleter";var logger=CERNY.Logger(name);var EVT_TOPIC_SET=name+".EVT_TOPIC_SET";var EVT_NO_TOPIC_SET=name+".EVT_NO_TOPIC_SET";var DICT=TOPINCS.widgets.DICT;function TopicCompleter(conf){if(conf){limit=conf.limit||10;conf.completeFunction=createCompleteFunction(conf.type,limit,true);InputCompleter.call(this,conf);var t=this;this.specialOptions.push({id:"undo-selection",label:DICT.lab_ic_special_option_undo_selection,action:function(){t.set(null,"");}});}}
TopicCompleter.prototype=new InputCompleter();TopicCompleter.prototype.logger=logger;TopicCompleter.EVT_TOPIC_SET=EVT_TOPIC_SET;TopicCompleter.EVT_NO_TOPIC_SET=EVT_NO_TOPIC_SET;function set(value,text){var event;if(value===null){event=EVT_NO_TOPIC_SET;}else{event=EVT_TOPIC_SET;}
InputCompleter.prototype.set.call(this,value,text);if(event){this.notify(event);}}
signature(set,"undefined",["null","string"],"string");method(TopicCompleter.prototype,"set",set);function createCompleteFunction(type,lim,displayType){return function completeFunction(string){var storeResult=TOPINCS.util.getTopics(string,type,null,lim);return convertTopicProxyArrayToIcArray(storeResult,displayType);}}
function convertTopicProxyArrayToIcArray(array,displayType){var tempResult={},result=[];array.map(function(topicProxy){var el=Element.create("p",topicProxy.label,"class=individual");if(topicProxy.type&&displayType){el.appendChild(Element.create("span"," ("+topicProxy.type.label+")","class=type"));}
if(!tempResult[topicProxy.id]){tempResult[topicProxy.id]=true;result.push({id:topicProxy.id,label:el});}});return result;}
signature(convertTopicProxyArrayToIcArray,Array,Array);method(TopicCompleter,"convertTopicProxyArrayToIcArray",convertTopicProxyArrayToIcArray);})();CERNY.require("TOPINCS.widgets.NewTopicCompleter","TOPINCS.widgets.DICT","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Topic","TOPINCS.tmdm.Name","TOPINCS.widgets.InputCompleter","TOPINCS.widgets.TopicCompleter","TOPINCS.util","CERNY.dom.Element");(function(){TOPINCS.widgets.NewTopicCompleter=NewTopicCompleter;var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;var InputCompleter=TOPINCS.widgets.InputCompleter;var Name=TOPINCS.tmdm.Name;var Topic=TOPINCS.tmdm.Topic;var TopicCompleter=TOPINCS.widgets.TopicCompleter;var name="TOPINCS.widgets.NewTopicCompleter";var logger=CERNY.Logger(name);var EVT_NEW_TOPIC_SET=name+".EVT_NEW_TOPIC_SET";var EVT_NEW_ITEM_ADDED=name+".EVT_NEW_ITEM_ADDED";var EVT_NEW_ITEM_REMOVED=name+".EVT_NEW_ITEM_REMOVED";var DICT=TOPINCS.widgets.DICT;function NewTopicCompleter(conf){if(conf){conf.noMatchesLabel=DICT.lab_no_matches_new_topic;TopicCompleter.call(this,conf);this.map=conf.map;this.initNewTopic();this.newItems=[];this.noMatchesSpan=Element.create("span",this.getNoMatchesLabel(),"class=new-topic");var t=this;this.specialOptions.push({id:"new-option",label:DICT.lab_ic_special_option_new_topic,action:function(){t.set(null,t.getText());t.auto=false;}});}}
NewTopicCompleter.prototype=new TopicCompleter();NewTopicCompleter.prototype.logger=logger;NewTopicCompleter.EVT_NEW_TOPIC_SET=EVT_NEW_TOPIC_SET;NewTopicCompleter.EVT_NEW_ITEM_ADDED=EVT_NEW_ITEM_ADDED;NewTopicCompleter.EVT_NEW_ITEM_REMOVED=EVT_NEW_ITEM_REMOVED;function isNewTopicSet(){return TOPINCS.tmdm.Construct.isTempId(this.getValue());}
signature(isNewTopicSet,"boolean");method(NewTopicCompleter.prototype,"isNewTopicSet",isNewTopicSet);function set(value,text){if(value==null){value=this.newTopic.id;}
InputCompleter.prototype.set.call(this,value,text);var t=this;function updateName(){t.newTopicName.setValue(t.getText());};if(this.isNewTopicSet()){this.addNewItem(this.newTopic);updateName();this.inputEl.addEvtListener("keyup",updateName);this.displayNoMatches();this.notify(EVT_NEW_TOPIC_SET);}else{this.removeNewItem(this.newTopic);this.inputEl.removeEvtListener("keyup",updateName);this.notify(TopicCompleter.EVT_TOPIC_SET);}}
signature(set,"undefined",["null","string"],"string");method(NewTopicCompleter.prototype,"set",set);function initNewTopic(){this.newTopic=new Topic();this.newTopic.parent=this.map;var t=this;this.newTopic.addObserver(TOPINCS.tmdm.Construct.EVT_SAVE_SUCCESS,function(systemId){t.noMatchesSpan.domDelete();t.value=systemId;t.initNewTopic();});this.newTopicName=new Name();this.newTopic.names.push(this.newTopicName);this.newTopicName.setValue("");}
signature(initNewTopic,"undefined");method(NewTopicCompleter.prototype,"initNewTopic",initNewTopic);function addNewItem(item){if(!this.newItems.contains(item)){if(item instanceof Topic){this.newItems.unshift(item);}else{this.newItems.push(item);}
this.notify(EVT_NEW_ITEM_ADDED,item);}}
signature(addNewItem,"undefined","object");method(NewTopicCompleter.prototype,"addNewItem",addNewItem);function removeNewItem(item){if(this.newItems.remove(item)>=0){this.notify(EVT_NEW_ITEM_REMOVED,item);}}
signature(removeNewItem,"undefined",["undefined","object"]);method(NewTopicCompleter.prototype,"removeNewItem",removeNewItem);function getNewItems(){return this.newItems;}
signature(getNewItems,Array);method(NewTopicCompleter.prototype,"getNewItems",getNewItems);function displayNoMatches(){this.noMatchesSpan.domMove(this.el,this.icon.el.node);this.optionsEl.hide();}
method(NewTopicCompleter.prototype,"displayNoMatches",displayNoMatches);function displayMatches(){this.noMatchesSpan.domDelete();InputCompleter.prototype.displayMatches.apply(this);}
method(NewTopicCompleter.prototype,"displayMatches",displayMatches);function render(){var el=InputCompleter.prototype.render.call(this);var t=this;this.inputEl.addEvtListener("blur",function(){if(t.isNewTopicSet()){var topics=TOPINCS.util.getTopics("^"+t.getText()+"$",null,null,1);if(topics.length!=0){var topic=topics[0];var msg=DICT.get("prm_topic_exists",[topic.label]);if(!TOPINCS.util.showConfirmation(msg)){t.set(topic.id,topic.label);t.noMatchesSpan.domDelete();}}}});return el;}
signature(render,Element);method(NewTopicCompleter.prototype,"render",render);})();CERNY.require("TOPINCS.tmdm.TypeInstanceAssociation","TOPINCS.CoreTopics","TOPINCS.tmdm.Association");(function(){TOPINCS.tmdm.TypeInstanceAssociation=TypeInstanceAssociation;var Association=TOPINCS.tmdm.Association;var Role=TOPINCS.tmdm.Role;var method=CERNY.method;var signature=CERNY.signature;var CoreTopics=TOPINCS.CoreTopics
var logger=CERNY.Logger("TOPINCS.tmdm.TypeInstanceAssociation");var ID_TYPE_INSTANCE=CoreTopics["type-instance"].id;var ID_TYPE=CoreTopics["type"].id;var ID_INSTANCE=CoreTopics["instance"].id;function TypeInstanceAssociation(assoc){var association=assoc;if(association){association.typeRole=association.getRoleByType(ID_TYPE);if(!association.typeRole){throw new Error("Passed Association does not have a type role.");}
association.instanceRole=association.getRoleByType(ID_INSTANCE);if(!association.instanceRole){throw new Error("Passed Association does not have a type instance.");}}else{association=new Association();association.setType(ID_TYPE_INSTANCE);association.typeRole=association.roles[0];association.typeRole.setType(ID_TYPE);association.instanceRole=new Role();association.instanceRole.setType(ID_INSTANCE);association.roles.push(association.instanceRole);}
method(association,"setTypePlayer",setTypePlayer);method(association,"setInstancePlayer",setInstancePlayer);return association;}
function setTypePlayer(id,name){this.typeRole.setPlayer(id);this.typeRole.setPlayerName(name);}
signature(setTypePlayer,"undefined","string","string");function setInstancePlayer(id,name){this.instanceRole.setPlayer(id);this.instanceRole.setPlayerName(name);}
signature(setInstancePlayer,"undefined","string","string");})();CERNY.require("TOPINCS.widgets.TypedTopicCompleter","TOPINCS.widgets.TopicCompleter","TOPINCS.widgets.DICT","TOPINCS.tmdm.TypeInstanceAssociation","CERNY.dom.Element","TOPINCS.CoreTopics","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Topic","TOPINCS.tmdm.Name","TOPINCS.widgets.NewTopicCompleter");(function(){TOPINCS.widgets.TypedTopicCompleter=TypedTopicCompleter;var method=CERNY.method;var signature=CERNY.signature;var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var Element=CERNY.dom.Element;var NewTopicCompleter=TOPINCS.widgets.NewTopicCompleter;var TopicCompleter=TOPINCS.widgets.TopicCompleter;var TypeInstanceAssociation=TOPINCS.tmdm.TypeInstanceAssociation;var name="TOPINCS.widgets.TypedTopicCompleter";var logger=CERNY.Logger(name);var ID_TOPIC_TYPE=CoreTopics["topic-type"].id;var LABEL_TOPIC_TYPE=CoreTopics["topic-type"].label;var DICT=TOPINCS.widgets.DICT;function TypedTopicCompleter(conf){NewTopicCompleter.call(this,conf);this.typingTopicCompleter=new TypingTopicCompleter(this);this.typingTopicCompleter.displayType=false;this.promptEl=Element.create("p",DICT.prm_choose_topic_type);}
TypedTopicCompleter.prototype=new NewTopicCompleter();TypedTopicCompleter.prototype.logger=logger;function initNewTopicTypInsAss(t){if(!t.newTopicTypInsAss){var a=TypeInstanceAssociation();a.parent=t.map;a.setInstancePlayer(t.getValue(),t.getText());a.addObserver(Construct.EVT_SAVE_SUCCESS,function(systemId){t.removeNewItem(a);t.newTopicTypInsAss=null;t.hideTypingTopicCompleter();});t.newTopicTypInsAss=a;}}
function initTypingTopicTypInsAss(t){if(!t.newTypingTopicTypInsAss){var a=TypeInstanceAssociation();a.parent=t.map;a.setTypePlayer(ID_TOPIC_TYPE,LABEL_TOPIC_TYPE);a.addObserver(Construct.EVT_SAVE_SUCCESS,function(systemId){t.removeNewItem(a);t.newTypingTopicTypInsAss=null;});t.newTypingTopicTypInsAss=a;}}
function set(value,text){NewTopicCompleter.prototype.set.call(this,value,text);if(Construct.isTempId(this.getValue())){this.showTypingTopicCompleter();}else{this.removeNewItem(this.newTopic);this.removeNewItem(this.newTypingTopicTypInsAss);this.removeNewItem(this.newTopicTypInsAss);this.hideTypingTopicCompleter();}}
signature(set,"undefined",["null","string"],"string");method(TypedTopicCompleter.prototype,"set",set);function setIgnoreGrouping(ignoreGrouping){this.ignoreGrouping=ignoreGrouping;this.typingTopicCompleter.ignoreGrouping=ignoreGrouping;}
method(TypedTopicCompleter.prototype,"setIgnoreGrouping",setIgnoreGrouping);function showTypingTopicCompleter(){if(!this.typingTopicCompleter.el){this.typingTopicCompleter.display(this.el);}
this.typingTopicCompleter.el.show();this.typingTopicCompleter.el.insertBefore(this.promptEl);}
method(TypedTopicCompleter.prototype,"showTypingTopicCompleter",showTypingTopicCompleter);function hideTypingTopicCompleter(){if(this.typingTopicCompleter.el){this.typingTopicCompleter.el.hide();}
this.promptEl.domDelete();}
method(TypedTopicCompleter.prototype,"hideTypingTopicCompleter",hideTypingTopicCompleter);function isTypeSet(){var result=false;if(this.newItems.contains(this.newTopicTypInsAss)){result=true;this.newTopicTypInsAss.roles.map(function(role){if(role.player==null){result=false;}});}
return result;}
signature(isTypeSet,"boolean");method(TypedTopicCompleter.prototype,"isTypeSet",isTypeSet);function setType(t,id,name,topic){initNewTopicTypInsAss(t);t.addNewItem(t.newTopicTypInsAss);t.newTopicTypInsAss.setTypePlayer(id,name);initTypingTopicTypInsAss(t);if(Construct.isTempId(id)){t.addNewItem(topic);t.addNewItem(t.newTypingTopicTypInsAss);t.newTypingTopicTypInsAss.setInstancePlayer(id,name);}else{t.removeNewItem(topic);t.removeNewItem(t.newTypingTopicTypInsAss);}}
function unsetType(t,topic){t.removeNewItem(topic);t.removeNewItem(t.newTypingTopicTypInsAss);t.removeNewItem(t.newTopicTypInsAss);}
function TypingTopicCompleter(topicCompleter){var conf={map:topicCompleter.map,type:ID_TOPIC_TYPE,iconTooltip:DICT.tt_ic_icon_typing_topic,limit:100};NewTopicCompleter.call(this,conf);var t=this;this.addObserver(NewTopicCompleter.EVT_NEW_TOPIC_SET,function(){setType(topicCompleter,t.getValue(),t.getText(),t.newTopic);});this.addObserver(TopicCompleter.EVT_TOPIC_SET,function(){setType(topicCompleter,t.getValue(),t.getText(),t.newTopic);});this.addObserver(TopicCompleter.EVT_NO_TOPIC_SET,function(){unsetType(topicCompleter,t.newTopic);});}
TypingTopicCompleter.prototype=new NewTopicCompleter();TypingTopicCompleter.prototype.logger=logger;})();CERNY.require("TOPINCS.wiki.AssociationEditor","TOPINCS.wiki.OccurrenceEditor","TOPINCS.CoreTopics","TOPINCS.view.View","TOPINCS.wiki.DICT","CERNY.dom.Element","CERNY.event.Revertable","TOPINCS.widgets.InputCompleter","TOPINCS.widgets.NewTopicCompleter","TOPINCS.wiki.Exception","TOPINCS.widgets.TypedTopicCompleter","TOPINCS.view.ListView");(function(){TOPINCS.wiki.AssociationEditor=AssociationEditor;var CoreTopics=TOPINCS.CoreTopics;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var Exception=TOPINCS.wiki.Exception;var InputCompleter=TOPINCS.widgets.InputCompleter;var ListView=TOPINCS.view.ListView;var NewTopicCompleter=TOPINCS.widgets.NewTopicCompleter;var OccurrenceEditor=TOPINCS.wiki.OccurrenceEditor;var Revertable=CERNY.event.Revertable;var TypedTopicCompleter=TOPINCS.widgets.TypedTopicCompleter;var TopicCompleter=TOPINCS.widgets.TopicCompleter;var View=TOPINCS.view.View;var logger=CERNY.Logger("TOPINCS.wiki.AssociationEditor");var method=CERNY.method;var signature=CERNY.signature;var initMessageContainer=OccurrenceEditor.initMessageContainer;var renderRow=OccurrenceEditor.renderRow;var makeChangeAware=OccurrenceEditor.makeChangeAware;function AssociationEditor(association,context){this.tagName="table";this.cssClass="statement association";this.association=association;this.statement=association;this.context=CERNY.object(context);this.context.displayLabels=doDisplayRoleLabels(association,context.subjectId);this.context.isTypeInstanceAssociation=association.type==CoreTopics["type-instance"].id;this.context.association=association;initMessageContainer(this);renderRow(this,context);var t=this;ListView.call(this,association.roles,this.context,RoleEditor);this.views.map(function(view){view.associationEditor=t;});association.roles.map(function(role){makeChangeAware(t,role);});}
AssociationEditor.prototype=new ListView();AssociationEditor.prototype.logger=logger;method(AssociationEditor.prototype,"deactivate",OccurrenceEditor.prototype.deactivate);method(AssociationEditor.prototype,"activate",OccurrenceEditor.prototype.activate);function updateStatement(){this.views.map(function(view){view.validate();});this.views.map(function(view){view.updateRole();});}
method(AssociationEditor.prototype,"updateStatement",updateStatement);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);this.views.map(function(roleEditor){roleEditor.redisplay();associationEl.appendChild(roleEditor.render());});this.valueTdEl.appendChildren(el,this.validationMessageEl);var tbodyEl=Element.create("tbody");tbodyEl.appendChild(this.trEl);this.el.appendChild(tbodyEl);}
method(AssociationEditor.prototype,"display",display);function deactivateProper(){this.views.map(function(roleEditor){roleEditor.deactivate();});}
signature(deactivateProper,"undefined",["undefined","boolean"]);method(AssociationEditor.prototype,"deactivateProper",deactivateProper);function activateProper(){this.views.map(function(roleEditor){roleEditor.activate();});}
signature(activateProper,"undefined");method(AssociationEditor.prototype,"activateProper",activateProper);function register(){OccurrenceEditor.prototype.register.call(this);var t=this;this.views.map(function(view){view.registerNewItemsOfPlayer(t.association);});}
method(AssociationEditor.prototype,"register",register);function RoleEditor(role,context){this.role=role;this.tagName="tr";this.cssClass="role";View.call(this,role,context);role.removeObservers();role.addObserver(Revertable.EVT_CHANGE,function(){if(!context.association.isNew){context.changes.registerUpdate(role);}});role.addObserver(Revertable.EVT_REVERT,function(){if(!context.association.isNew){context.changes.unregister(role);}});}
RoleEditor.prototype=new View();RoleEditor.prototype.logger=CERNY.Logger("TOPINCS.wiki.RoleEditor");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,context));this.el.appendChild(playerEl);}}
method(RoleEditor.prototype,"display",displayRole);function renderPlayer(t,context){var role=t.role;var player=role.player;var label;if(player){label=context.getLabel(player);}
var tc;var tcConf={initialValue:player,initialText:label,map:context.association.parent};if(role.type==CoreTopics["type"].id){tcConf.type=CoreTopics["topic-type"].id;}
if(context.isTypeInstanceAssociation){tc=new NewTopicCompleter(tcConf);}else{tc=new TypedTopicCompleter(tcConf);var oldCompleteFunction=tc.completeFunction;tc.completeFunction=function(substr){if(tc.getText()==""){var url=POSSIBLE_PLAYERS_URL+"?rt=id:"+role.type+"&at=id:"+context.association.type;var result=TOPINCS.util.getResult(url,MEDIA_TYPE_TOPIC_PROXY_ARRAY,false,{});return TopicCompleter.convertTopicProxyArrayToIcArray(result,true);}else{return oldCompleteFunction.call(tc,substr);}};}
t.tc=tc;tc.setIgnoreGrouping(true);tc.addObserver(NewTopicCompleter.EVT_NEW_ITEM_ADDED,function(newItem){if(newItem.isNew){t.associationEditor.update(context);}});tc.addObserver(NewTopicCompleter.EVT_NEW_ITEM_REMOVED,function(newItem){if(newItem.isNew){t.associationEditor.update(context);}});tc.addObserver(TopicCompleter.EVT_TOPIC_SET,function(){t.associationEditor.update(context);TOPINCS.wiki.Preview.cancelPreview();});tc.addObserver(NewTopicCompleter.EVT_NEW_TOPIC_SET,function(){t.associationEditor.update(context);TOPINCS.wiki.Preview.cancelPreview();});if(tc.typingTopicCompleter){tc.typingTopicCompleter.addObserver(TopicCompleter.EVT_TOPIC_SET,function(){t.associationEditor.update(context);TOPINCS.wiki.Preview.cancelPreview();});}
TOPINCS.wiki.Preview.installOnTopicCompleter(tc);if(tc.typingTopicCompleter){TOPINCS.wiki.Preview.installOnTopicCompleter(tc.typingTopicCompleter,true);}
if(role.isNew){setTimeout(function(){tc.focus();},100);}
return tc.render();}
function activate(){if(this.tc){this.tc.activate();}}
method(RoleEditor.prototype,"activate",activate);function RoleEditor_deactivate(){if(this.tc){this.tc.deactivate();}}
method(RoleEditor.prototype,"deactivate",RoleEditor_deactivate);function validate(){if(this.tc){if(this.tc.getValue()===null){throw new Exception("msg_provide_player");}
if(this.tc instanceof TypedTopicCompleter&&this.tc.isNewTopicSet()&&!(this.tc.isTypeSet())){throw new Exception("msg_no_type_set");}}}
method(RoleEditor.prototype,"validate",validate);function updateRole(){if(this.tc){this.role.setPlayer(this.tc.getValue());this.context.registerLabel(this.tc.getValue(),this.tc.getText());}}
method(RoleEditor.prototype,"updateRole",updateRole);function registerNewItemsOfPlayer(association){var t=this,tc=this.tc,changes=t.context.changes,role=t.role;if(role.isNew||role.hasChanged()){if(tc){tc.getNewItems().map(function(newItem){changes.registerCreate(newItem,association.id);});}}}
method(RoleEditor.prototype,"registerNewItemsOfPlayer",registerNewItemsOfPlayer);})();CERNY.require("TOPINCS.wiki.StatementEditor","TOPINCS.wiki.OccurrenceEditor","TOPINCS.wiki.NameEditor","TOPINCS.wiki.AssociationEditor","TOPINCS.wiki.DICT","CERNY.event.Revertable");(function(){TOPINCS.wiki.StatementEditor=StatementEditor;StatementEditor["Name"]=TOPINCS.wiki.NameEditor;StatementEditor["Occurrence"]=TOPINCS.wiki.OccurrenceEditor;StatementEditor["Association"]=TOPINCS.wiki.AssociationEditor;var DICT=TOPINCS.wiki.DICT;var OccurrenceEditor=TOPINCS.wiki.OccurrenceEditor;var Revertable=CERNY.event.Revertable;var initMessageContainer=OccurrenceEditor.initMessageContainer;var makeChangeAware=OccurrenceEditor.makeChangeAware;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.wiki.StatementEditor");function StatementEditor(statement,context){var cons=StatementEditor[statement.itemType];var editor=new cons(statement,context);editor.invalid=false;method(editor,"markChanged",markChanged);method(editor,"unmarkChanged",unmarkChanged);method(editor,"isMarkedChanged",isMarkedChanged);method(editor,"markNew",markNew);method(editor,"unmarkNew",unmarkNew);method(editor,"isMarkedNew",isMarkedNew);method(editor,"markInvalid",markInvalid);method(editor,"unmarkInvalid",unmarkInvalid);method(editor,"isMarkedInvalid",isMarkedInvalid);method(editor,"select",select);method(editor,"deselect",deselect);method(editor,"update",update);statement.removeObservers();makeChangeAware(editor);statement.addObserver(Revertable.EVT_REVERT,function(){editor.redisplay();if(editor.editor){editor.editor.focus();}
editor.update(context);});if(statement.isNew){editor.markNew();}
if(statement.hasChanged()){editor.markChanged();}
editor.update(context);if(statement.isForeign){editor.el.addCSSClass("foreign");editor.deactivate(true);}
return editor;}
StatementEditor.prototype.logger=logger;function select(){genericSelectDeselect.call(this,0);}
function deselect(){genericSelectDeselect.call(this,1);}
function genericSelectDeselect(value){var selectorNode=this.selectorEl.node;if(selectorNode.checked==value){selectorNode.click();}}
function update(context){var t=this;var statement=t.statement;if(statement.isForeign){return;}
try{context.changes.unregister(statement);t.updateStatement();statement.validate();t.unmarkInvalid();t.register();}catch(e){var message;if(e.getMessage){message=e.getMessage();}else{message=e.message;}
t.markInvalid(message);context.changes.unregister(statement);}}
function markChanged(){if(!this.statement.isNew){mark(this.el,this.statusTdEl,"changed",DICT.tt_item_changed,DICT.lab_item_changed);}}
function unmarkChanged(){unmark(this.el,this.statusTdEl,"changed");}
function isMarkedChanged(){return this.el.hasCSSClass("changed");}
function markNew(){mark(this.el,this.statusTdEl,"new",DICT.tt_item_new,DICT.lab_item_new);}
function unmarkNew(){unmark(this.el,this.statusTdEl,"new");}
function isMarkedNew(){return this.el.hasCSSClass("new");}
function markInvalid(message){this.invalid=true;this.validationMessageEl.setText(message);this.validationMessageEl.show();}
function unmarkInvalid(){this.invalid=false;this.validationMessageEl.setText("");this.validationMessageEl.hide();}
function isMarkedInvalid(){return this.el.hasCSSClass("invalid");}
function mark(el,tdEl,cssClass,tooltip,text){el.addCSSClass(cssClass);tdEl.addCSSClass(cssClass);tdEl.setAttr("title",tooltip);tdEl.setText(text);}
function unmark(el,tdEl,cssClass){el.deleteCSSClass(cssClass);tdEl.deleteCSSClass(cssClass);tdEl.setAttr("title","");tdEl.setText("");}})();CERNY.require("TOPINCS.wiki.ParagraphEditor","TOPINCS.wiki.ParagraphViewer","TOPINCS.wiki.StatementEditor","TOPINCS.wiki.DICT","TOPINCS.view.ListView","TOPINCS.tmdm.Association","TOPINCS.tmdm.Occurrence","TOPINCS.widgets.Menu","CERNY.dom.Element");(function(){TOPINCS.wiki.ParagraphEditor=ParagraphEditor;var Association=TOPINCS.tmdm.Association;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var ListView=TOPINCS.view.ListView;var ParagraphViewer=TOPINCS.wiki.ParagraphViewer;var StatementEditor=TOPINCS.wiki.StatementEditor;var method=CERNY.method;var signature=CERNY.signature;var logger=CERNY.Logger("TOPINCS.wiki.ParagraphEditor");function ParagraphEditor(paragraph,context){this.paragraph=paragraph;this.cssClass="paragraph";this.initHeadline(paragraph,context);ListView.call(this,paragraph,context,StatementEditor);}
ParagraphEditor.prototype=new ParagraphViewer();ParagraphEditor.prototype.logger=logger;function display(context){if(this.headline.foreignLanguage===true){context.isForeignLanguagePresent=true;this.el.addCSSClass("foreign-language");if(context.displayOnlyInformationInAcceptedLanguages===true){this.el.hide();}}
var statement=this.paragraph[0];var roleTypeId,roleTypeLabel;if(statement instanceof Association){var role=statement.getRoleByPlayer(context.subjectId);roleTypeId=role.type;roleTypeLabel=context.getLabel(roleTypeId);}
var t=this;var headlineEl=Element.create("div",null,"class=headline");if(this.paragraph.typeId.foreign){headlineEl.addCSSClass("foreign");}
var spanEl=Element.create("span",this.headline.toString());headlineEl.appendChild(spanEl);if(!this.paragraph.typeId.foreign){addMenu(this,headlineEl,spanEl,context);}
this.el.appendChild(headlineEl);ListView.prototype.display.call(this,context);}
signature(display,"undefined","object");method(ParagraphEditor.prototype,"display",display);function addMenu(t,headlineEl,spanEl,context){var menu=new TOPINCS.widgets.Menu();menu.addItem("create",DICT.mi_new);menu.create.addEvtListener(function(){t.paragraph.addNewStatement();});var menuEl=menu.render();menuEl.hide();headlineEl.appendChild(menuEl);headlineEl.addEvtListener("mouseover",function(){var top=spanEl.node.offsetTop;if(top>10){top=0;}
menuEl.setAttr("style","left: "+spanEl.node.offsetWidth+"px; top: "+top+"px;");menuEl.show();});headlineEl.addEvtListener("mouseout",function(){menuEl.hide();});}
signature(addMenu,Element,Element);})();CERNY.require("TOPINCS.wiki.Selection","CERNY.dom.Element","CERNY.event.Observable");(function(){TOPINCS.wiki.Selection=Selection;var Element=CERNY.dom.Element;var Observable=CERNY.event.Observable;var method=CERNY.method;var signature=CERNY.signature;var name="TOPINCS.wiki.Selection";var logger=CERNY.Logger(name);var EVT_COUNT_CHANGED=name+".EVT_COUNT_CHANGED";var EVT_ENTRY_ADDED=name+".EVT_ENTRY_ADDED";var EVT_ENTRY_REMOVED=name+".EVT_ENTRY_REMOVED";function Selection(){this.data=[];}
Selection.prototype.logger=logger;Selection.EVT_COUNT_CHANGED=EVT_COUNT_CHANGED;Selection.EVT_ENTRY_ADDED=EVT_ENTRY_ADDED;Selection.EVT_ENTRY_REMOVED=EVT_ENTRY_REMOVED;Observable(Selection.prototype);function addEntry(item,view){this.data.push({item:item,view:view});this.notify(EVT_ENTRY_ADDED,item,view);this.notify(EVT_COUNT_CHANGED,this.count());}
signature(addEntry,"undefined","object",Element);method(Selection.prototype,"addEntry",addEntry);function removeEntry(item,view){var index=this.data.remove(view,function(a,b){return a.view===b;});if(index>=0){this.notify(EVT_ENTRY_REMOVED,item,view);this.notify(EVT_COUNT_CHANGED,this.count());}else{logger.debug("No entry not located in this selection.");}}
signature(removeEntry,"undefined",Element);method(Selection.prototype,"removeEntry",removeEntry);function clear(){var t=this;this.data.map(function(entry){uncheckSelector(entry.view);});this.data=[];this.notify(EVT_COUNT_CHANGED,this.count());}
signature(clear,"undefined");method(Selection.prototype,"clear",clear);function count(){return this.data.length;}
signature(count,"number");method(Selection.prototype,"count",count);function isEmpty(){return this.count()===0;}
signature(isEmpty,"boolean");method(Selection.prototype,"isEmpty",isEmpty);function uncheckSelector(view){var inputs=view.el.getDescendants(function(el){return isInput(el)&&Element.cssFilter(el,"selector");});inputs[0].checked=0;}})();CERNY.require("TOPINCS.wiki.MergeDialog","TOPINCS.widgets.OkCancelPopUp","TOPINCS.widgets.TopicCompleter","TOPINCS.util","TOPINCS.tmdm.Topic","TOPINCS.wiki.Preview","CERNY.dom.Element");(function(){TOPINCS.wiki.MergeDialog=MergeDialog;var signature=CERNY.signature;var method=CERNY.method;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var TopicCompleter=TOPINCS.widgets.TopicCompleter;var logger=CERNY.Logger("TOPINCS.wiki.MergeDialog");var result={count:0};var popup=new TOPINCS.widgets.OkCancelPopUp({draggable:false,cancelOnEsc:false,closeOnOutsideClick:false});popup.setTitle(DICT.tit_merge_dialog);popup.el.addCSSClass("merge-dialog");popup.setCancelAction(function(){if(result.count>0){if(!TOPINCS.util.showConfirmation(DICT.prm_merge_dialog_confirm_cancel)){return;}}
result={count:0};popup.hide();});function MergeDialog(topics,okAction,context){this.topics=topics;this.topics.sort(function(topic1,topic2){if(topic1.getLabel()>topic2.getLabel()){return 1;}
return-1;});this.topicIndex={};var el=Element.create("table");var trMsgEl=Element.create("tr");var tdMsgEl=Element.create("td",DICT.msg_merge_dialog,"class=message");trMsgEl.appendChild(tdMsgEl);el.appendChild(trMsgEl);for(var i=0,l=this.topics.length;i<l;i++){var topic=this.topics[i];this.topicIndex[topic.id]=topic;el.appendChild(renderTopic(topic,context));}
this.el=el;var t=this;popup.setOkAction(function(){for(var tempTopicId in result){if(tempTopicId!=="count"&&result.hasOwnProperty(tempTopicId)){var foreignTopic=t.topicIndex[tempTopicId];var localId=result[tempTopicId];var topic=new TOPINCS.tmdm.Topic({id:localId,item_identifiers:foreignTopic.item_identifiers,subject_identifiers:foreignTopic.subject_identifiers,subject_locators:foreignTopic.subject_locators});topic.put(false,null,null,false);}}
popup.hide();okAction();});}
MergeDialog.prototype.logger=logger;function renderTopic(topic,context){var el=Element.create("tr",null,"class=merge-dialog-topic");var tdEl=Element.create("td");el.appendChild(tdEl);var foreignLabelEl=Element.create("div");foreignLabelEl.appendChild(context.renderTopicLink(topic.id));var tc=new TopicCompleter({});tc.addObserver(TopicCompleter.EVT_TOPIC_SET,function(){var value=tc.getValue();result[topic.id]=value;result.count+=1;});tc.addObserver(TopicCompleter.EVT_NO_TOPIC_SET,function(){delete(result[topic.id]);result.count-=1;});TOPINCS.wiki.Preview.installOnTopicCompleter(tc);tdEl.appendChildren(foreignLabelEl,tc.render());return el;}
function display(){popup.displayContent(this.el);popup.show();}
method(MergeDialog.prototype,"display",display);})();CERNY.require("TOPINCS.widgets.SubMenu","TOPINCS.widgets.PopUp","CERNY.dom.Element");(function(){var Logger=CERNY.Logger;var PopUp=TOPINCS.widgets.PopUp;var method=CERNY.method;var signature=CERNY.signature;var Element=CERNY.dom.Element;function SubMenu(menuEl){this.popUp=new PopUp(null,null,false,false);this.popUp.containerE.addCSSClass("submenu");this.popUp.position=position;this.menuEl=menuEl;}
var logger=Logger("TOPINCS.widgets.SubMenu");SubMenu.prototype.logger=logger;TOPINCS.widgets.SubMenu=SubMenu;function display(contentEl){this.popUp.displayContent(contentEl,this.menuEl);}
signature(display,"undefined",Element);method(SubMenu.prototype,"display",display);function position(targetEl){this.containerE.moveOver(targetEl,0,1.2);}})();CERNY.require("TOPINCS.widgets.ProgressBar","CERNY.dom.Element");(function(){var Element=CERNY.dom.Element;var signature=CERNY.signature;var method=CERNY.method;TOPINCS.widgets.ProgressBar=ProgressBar;var logger=CERNY.Logger("TOPINCS.widgets.ProgressBar");function ProgressBar(){this.containerE=Element.create("div",null,"class=progress-bar-div-o hidden");this.innerE=Element.create("div",null,"class=progress-bar-div-i");this.containerE.appendChild(this.innerE);this.textE=Element.create("p",null,"class=progress-bar-text");this.innerE.appendChild(this.textE);this.counterE=Element.create("span",null,"class=progress-bar-counter");this.barE=Element.create("p"," ","class=progress-bar");this.innerE.appendChild(this.barE);new Element(document.body).appendChild(this.containerE);}
ProgressBar.prototype.logger=logger;function show(_text,_total){if(!isNonEmptyString(_text)){_text="";}
_text=_text.replace("%1",_total)
this.total=_total;this.textE.setText(_text);this.counterE.setText("");this.textE.appendChild(this.counterE);this.containerE.show();}
signature(show,"undefined","string","number");method(ProgressBar.prototype,"show",show);function hide(){this.containerE.hide();this.barE.removeStyle();}
signature(hide,"undefined");method(ProgressBar.prototype,"hide",hide);function update(_counter){var perc=Math.round(_counter/this.total*100);this.barE.setAttr("style","width: "+perc+"%");this.counterE.setText(""+_counter);}
signature(update,"undefined","number");method(ProgressBar.prototype,"update",update);})();CERNY.require("TOPINCS.wiki.AutoTopicMapper","TOPINCS.wiki.DICT","TOPINCS.tmdm.Construct","TOPINCS.widgets.ProgressBar","TOPINCS.util");(function(){TOPINCS.wiki.AutoTopicMapper=AutoTopicMapper;var logger=CERNY.Logger("TOPINCS.wiki.AutoTopicMapper");var signature=CERNY.signature;var method=CERNY.method;var DICT=TOPINCS.wiki.DICT;var PROGRESS_BAR=new TOPINCS.widgets.ProgressBar();function AutoTopicMapper(foreignTopics){this.foreignTopics=foreignTopics;}
AutoTopicMapper.prototype.logger=logger;function run(onSuccess,onFailure,onComplete){TOPINCS.util.blockUi();TOPINCS.util.showMessage(DICT.msg_foreign_topics_present);var total=this.foreignTopics.length;var count=0;PROGRESS_BAR.show(DICT.msg_automapping_topics,total);this.foreignTopics.map(function(foreignTopic){TOPINCS.tmdm.Construct.locateForeignTopic(foreignTopic,handleLocationResponse);});function handleLocationResponse(topic,localId){if(localId){onSuccess(topic,localId);}else{onFailure(topic);}
count+=1;PROGRESS_BAR.update(count);if(count==total){onComplete();PROGRESS_BAR.hide();TOPINCS.util.releaseUi();}}}
method(AutoTopicMapper.prototype,"run",run);})();CERNY.require("TOPINCS.wiki.ArticleEditor","TOPINCS.wiki.Article","TOPINCS.wiki.ArticleViewer","TOPINCS.wiki.PreviewComponent","TOPINCS.wiki.ParagraphEditor","TOPINCS.wiki.ArticleMap","TOPINCS.wiki.Selection","TOPINCS.wiki.DICT","TOPINCS.wiki.MergeDialog","TOPINCS.widgets.Menu","TOPINCS.widgets.SubMenu","TOPINCS.widgets.ProgressBar","TOPINCS.view.ListView","TOPINCS.tmdm.Name","TOPINCS.tmdm.Association","TOPINCS.tmdm.Construct","TOPINCS.tmdm.Role","TOPINCS.tmdm.Occurrence","TOPINCS.tmdm.TopicMap","TOPINCS.tmdm.ext.Changes","TOPINCS.tmdm.ext.Labeler","TOPINCS.misc.Changes","TOPINCS.util","TOPINCS.CoreTopics","TOPINCS.wiki.AutoTopicMapper","CERNY.dom.Element","CERNY.event.Revertable");(function(){TOPINCS.wiki.ArticleEditor=ArticleEditor;var Article=TOPINCS.wiki.Article;var Association=TOPINCS.tmdm.Association;var Construct=TOPINCS.tmdm.Construct;var CoreTopics=TOPINCS.CoreTopics;var Changes=TOPINCS.tmdm.ext.Changes;var DICT=TOPINCS.wiki.DICT;var Element=CERNY.dom.Element;var ListView=TOPINCS.view.ListView;var Menu=TOPINCS.widgets.Menu;var Name=TOPINCS.tmdm.Name;var Occurrence=TOPINCS.tmdm.Occurrence;var ParagraphEditor=TOPINCS.wiki.ParagraphEditor;var Revertable=CERNY.event.Revertable;var Selection=TOPINCS.wiki.Selection;var SubMenu=TOPINCS.widgets.SubMenu;var TopicMap=TOPINCS.tmdm.TopicMap;var ArticleMap=TOPINCS.wiki.ArticleMap;var blockUi=TOPINCS.util.blockUi;var releaseUi=TOPINCS.util.releaseUi;var method=CERNY.method;var signature=CERNY.signature;var DEFAULT_OPTIONS={};DEFAULT_OPTIONS[Name.prototype.itemType]=[CoreTopics["topic-name"]];;DEFAULT_OPTIONS[Occurrence.prototype.itemType]=[CoreTopics["description"]];;var instanceOfRoleType=CERNY.clone(CoreTopics["instance"]);instanceOfRoleType.associationType=CoreTopics["type-instance"];DEFAULT_OPTIONS[Association.prototype.itemType]=[instanceOfRoleType];var logger=CERNY.Logger("TOPINCS.wiki.ArticleEditor");function ArticleEditor(article,context){this.article=article;this.cssClass="article editor";if(this.article.articleMap.subjectLocator){this.cssClass+=" resource";}
this.selection=new Selection();this.changes=context.changes;this.context=CERNY.object(context);this.context.selection=this.selection;this.context.changes=this.changes;ListView.call(this,article,this.context,ParagraphEditor);this.editorEl=this.el;}
ArticleEditor.prototype=new ListView();ArticleEditor.prototype.logger=logger;TOPINCS.wiki.PreviewComponent(ArticleEditor.prototype);method(ArticleEditor.prototype,"renderHeadline",TOPINCS.wiki.ArticleViewer.prototype.renderHeadline);method(ArticleEditor.prototype,"renderLabel",TOPINCS.wiki.ArticleViewer.prototype.renderLabel);method(ArticleEditor.prototype,"renderType",TOPINCS.wiki.ArticleViewer.prototype.renderType);method(ArticleEditor.prototype,"renderFooter",TOPINCS.wiki.ArticleViewer.prototype.renderFooter);method(ArticleEditor.prototype,"setForeignVisible",TOPINCS.wiki.ArticleViewer.prototype.setForeignVisible);function display(context){this.el.appendChild(this.renderHeadline(this.article.articleMap,context));this.el.appendChild(this.renderMenu(context));ListView.prototype.display.call(this,this.context);var footerEl=this.renderFooter(context);if(footerEl){this.el.appendChild(footerEl);}}
method(ArticleEditor.prototype,"display",display);function renderMenu(context){var t=this;var changesEmpty=this.changes.isEmpty();var selectionEmpty=this.selection.isEmpty();var menu=new Menu();menu.addItem("create",DICT.mi_new_info,true,DICT.tt_new_info);menu.create.addEvtListener(function(){menuNew(t,context)});this.subMenuNew=new SubMenu(menu.create.menuItemE);menu.addItem("selection",DICT.mi_selection,true,DICT.tt_selection);menu.selection.addEvtListener(function(){menuSelection(t,context)});this.subMenuSelection=new SubMenu(menu.selection.menuItemE);var selectionMenu=new Menu(true);selectionMenu.addItem("delete",DICT.mi_delete,!selectionEmpty,DICT.tt_delete);selectionMenu["delete"].addEvtListener(function(){menuDelete(t)});this.selection.addObserver(Selection.EVT_COUNT_CHANGED,function(newCount){if(newCount===0){selectionMenu["delete"].deactivate();}else{selectionMenu["delete"].activate();}});selectionMenu.addItem("revert",DICT.mi_revert,getEntriesWithChangedItems(t.selection).length!=0,DICT.tt_revert);selectionMenu["revert"].addEvtListener(function(){menuRevert(t)});function revertChangeObserver(){var changedCount=getEntriesWithChangedItems(t.selection).length;if(changedCount===0){selectionMenu["revert"].deactivate();}else{selectionMenu["revert"].activate();}}
this.selection.addObserver(Selection.EVT_COUNT_CHANGED,revertChangeObserver);this.selection.addObserver(Selection.EVT_ENTRY_ADDED,function(item,view){item.addObserver(Revertable.EVT_CHANGE,revertChangeObserver);item.addObserver(Revertable.EVT_REVERT,revertChangeObserver);});this.selection.addObserver(Selection.EVT_ENTRY_REMOVED,function(item,view){item.removeObserver(Revertable.EVT_CHANGE,revertChangeObserver);item.removeObserver(Revertable.EVT_REVERT,revertChangeObserver);});selectionMenu.addItem("selectall",DICT.mi_select_all,true,DICT.tt_select_all);selectionMenu["selectall"].addEvtListener(function(){menuSelectAll(t)});selectionMenu["selectall"].el.addCSSClass("separator");selectionMenu.addItem("deselectall",DICT.mi_deselect_all,true,DICT.tt_deselect_all);selectionMenu["deselectall"].addEvtListener(function(){menuDeselectAll(t)});selectionMenu.addItem("selectchanged",DICT.mi_select_changed,true,DICT.tt_select_changed);selectionMenu["selectchanged"].addEvtListener(function(){menuSelectChanged(t)});selectionMenu.addItem("deselectchanged",DICT.mi_deselect_changed,true,DICT.tt_deselect_changed);selectionMenu["deselectchanged"].addEvtListener(function(){menuDeselectChanged(t)});selectionMenu.addItem("selectnew",DICT.mi_select_new,true,DICT.tt_select_new);selectionMenu["selectnew"].addEvtListener(function(){menuSelectNew(t)});selectionMenu.addItem("deselectnew",DICT.mi_deselect_new,true,DICT.tt_deselect_new);selectionMenu["deselectnew"].addEvtListener(function(){menuDeselectNew(t)});this.selectionMenuEl=selectionMenu.render();menu.addItem("preview",DICT.mi_preview,!changesEmpty,DICT.tt_preview);menu.preview.addEvtListener(function(){menuPreview(t)});addObservers(menu.preview);menu.addItem("save",DICT.mi_save,!changesEmpty,null,false);menu.save.addEvtListener(function(){menuSave(t)});updateSaveTitle(menu.save,t.changes.count());addObservers(menu.save);t.changes.addObserver(TOPINCS.misc.Changes.EVT_COUNT_CHANGED,function(newCount){updateSaveTitle(menu.save,newCount);});function updateSaveTitle(mi,changeCount){mi.menuItemE.setAttr("title",DICT.get("msg_unsaved_changes",[changeCount],changeCount));}
function addObservers(menuItem){t.changes.addObserver(TOPINCS.misc.Changes.EVT_COUNT_CHANGED,function(newCount){if(newCount==0){menuItem.deactivate();}else{menuItem.activate();}});}
return menu.render();}
method(ArticleEditor.prototype,"renderMenu",renderMenu);function menuNew(t,context){initMenuNew(t,context);t.subMenuNew.popUp.show();}
function menuSelection(t){t.subMenuSelection.display(t.selectionMenuEl);t.subMenuSelection.popUp.show();}
function menuSelectAll(t){generic(t,"select");}
function menuDeselectAll(t){generic(t,"deselect");}
function menuSelectChanged(t){generic(t,"select","isMarkedChanged");}
function menuDeselectChanged(t){generic(t,"deselect","isMarkedChanged");}
function menuSelectNew(t){generic(t,"select","isMarkedNew");}
function menuDeselectNew(t){generic(t,"deselect","isMarkedNew");}
function generic(t,action,predicateName){getAllStatementViews(t).map(function(view){if(!predicateName||(view[predicateName]()==true)){view[action]();}});}
function getAllStatementViews(t){var views=[];t.views.map(function(paragraphView){views.append(paragraphView.views);});return views;}
function menuDelete(t){t.selection.data.map(function(selected){var item=selected.item;if(item.isNew){t.article.removeStatement(item);t.changes.unregister(item);item.isDeleted=true;}else{t.changes.registerDelete(item);selected.view.deactivate();item.addObserver(Construct.EVT_DELETE_SUCCESS,function(){t.article.removeStatement(item);});}});t.selection.clear();t.subMenuSelection.popUp.hide();}
function menuRevert(t){getEntriesWithChangedItems(t.selection).map(function(selected){selected.item.revert();selected.view.deselect();});t.subMenuSelection.popUp.hide();}
function menuPreview(t){t.clearPreview();var articleMap=t.context.articleMap;var previewArticleMap=new ArticleMap(new TopicMap(articleMap.topicMap),articleMap.subjectId);previewArticleMap.apply(t.changes.getAllChanges());var previewArticle=new Article(previewArticleMap,t.context.defaultHiddenTypes);var previewContext=TOPINCS.wiki.getContext(previewArticleMap);previewContext.labels=t.context.labels;var viewer=new TOPINCS.wiki.ArticleViewer(previewArticle,previewContext);t.previewEl.appendChild(viewer.render());t.switchToPreview(function(previewMenuEl){viewer.el.insertAfter(previewMenuEl.node,viewer.el.node.firstChild);});}
method(ArticleEditor.prototype,"menuPreview",menuPreview);function displayPreviewMenu(){this.previewEl.appendChildren(this.renderPreviewMenu());}
method(ArticleEditor.prototype,"displayPreviewMenu",displayPreviewMenu);function menuSave(t){var bar,total,mergeDialog,foreignTopics,foreignUnkownTopics=[],foreignKnownTopics=[];foreignTopics=t.changes.getTopicCreates().map(function(create){return create.item;}).filter(function(topic){return topic.isForeign;});if(foreignTopics.length>0){var autoTopicMapper=new TOPINCS.wiki.AutoTopicMapper(foreignTopics);autoTopicMapper.run(onSuccess,onFailure,save);}else{save();}
function onSuccess(topic,localId){foreignKnownTopics.push(topic);}
function onFailure(topic){foreignUnkownTopics.push(topic);}
function save(){foreignKnownTopics.map(function(knownTopic){t.changes.unregister(knownTopic,knownTopic.formerTempId);});if(foreignUnkownTopics.length>0){var mergeDialog=new TOPINCS.wiki.MergeDialog(foreignUnkownTopics,saveChanges,t.context);mergeDialog.display();}else{saveChanges();}
function saveChanges(){blockUi();bar=initProgressBar(t);total=t.changes.count();bar.show(DICT.msg_saving_changes,total);t.changes.addObserver(TOPINCS.misc.Changes.EVT_COUNT_CHANGED,updateProgressBar);t.changes.addObserver(TOPINCS.tmdm.ext.Changes.EVT_CHANGES_PROCESSED,finish);t.changes.process();function updateProgressBar(newCount){bar.update(total-newCount);}
function finish(commitedChanges,uncommitedChanges){bar.hide();t.context.topicmap.apply(commitedChanges);t.changes.removeObserver(TOPINCS.misc.Changes.EVT_COUNT_CHANGED,updateProgressBar);t.changes.removeObserver(TOPINCS.tmdm.ext.Changes.EVT_CHANGES_PROCESSED,finish);releaseUi();}}}}
method(ArticleEditor.prototype,"menuSave",menuSave);function initProgressBar(t){if(!t.progressBar){t.progressBar=new TOPINCS.widgets.ProgressBar();}
return t.progressBar;}
signature(initProgressBar,"object",ArticleEditor);function activateViews(t){t.views.map(function(view){view.activate();});}
function initMenuNew(t,context){if(!t.menuNewEl){t.menuNewEl=Element.create("div");initOptions(t,t.article.subjectId);t.options.map(function(option){var label=option.label;if(option.type===Association.prototype.itemType){label=option.associationType.label;context.registerLabel(option.associationType.id,label,[option.id]);}else{context.registerLabel(option.id,label);}
var optionEl=Element.create("a",label);optionEl.addEvtListener("click",function(){var associationTypeId;if(option.associationType){associationTypeId=option.associationType.id;}
var newStatement=t.article.createNewStatement(option.type,option.id,associationTypeId);t.article.addStatement(option.id,newStatement);});t.menuNewEl.appendChild(optionEl);});t.subMenuNew.display(t.menuNewEl);}}
function initOptions(t,topicId){if(!t.options){t.options=getOptions(POSSIBLE_OCCURRENCE_TYPES_URL,MEDIA_TYPE_TOPIC_PROXY_ARRAY,Occurrence.prototype.itemType,topicId);t.options.append(getOptions(POSSIBLE_NAME_TYPES_URL,MEDIA_TYPE_TOPIC_PROXY_ARRAY,Name.prototype.itemType,topicId));t.options.append(getOptions(POSSIBLE_ROLE_TYPES_URL,MEDIA_TYPE_ROLE_TYPE_PROXY_ARRAY,Association.prototype.itemType,topicId));t.options.sort(compareOptions);}}
signature(initOptions,"undefined",ArticleEditor,"string");function getOptions(url,contentType,type,topicId){var options=TOPINCS.util.getResult(url+"?t="+topicId,contentType);var defaultOptions=DEFAULT_OPTIONS[type];var missingDefaultOptions=defaultOptions.filter(function(defaultOption){return!(options.contains(defaultOption,function(x,y){return x.id===y.id;}));});if(type==Association.prototype.itemType){var i=missingDefaultOptions.indexOf(instanceOfRoleType);if(i>=0){missingDefaultOptions[i].associationType.label=TOPINCS.tmdm.ext.Labeler.getTopicLabelFromServer(CoreTopics["type-instance"].id,[CoreTopics["instance"].id]);}}
options.append(missingDefaultOptions);return options.map(function(item){item.type=type;return item;});}
function compareOptions(x,y){var a=x.associationType?x.associationType:x;var b=y.associationType?y.associationType:y;return(a.label.toLowerCase()<b.label.toLowerCase())?-1:1;}
function getEntriesWithChangedItems(selection){return selection.data.filter(function(entry){return entry.item.hasChanged()&&!entry.item.isNew;});}})();CERNY.require("TOPINCS.wiki.IncludeEditor","TOPINCS.wiki.DICT","CERNY.dom.Element","TOPINCS.widgets.Button","TOPINCS.I18NException","CERNY.dom.html","TOPINCS.util","TOPINCS.wiki.ArticleViewer");(function(){var ArticleViewer=TOPINCS.wiki.ArticleViewer;var Button=TOPINCS.widgets.Button;var Element=CERNY.dom.Element;var I18NException=TOPINCS.I18NException;var method=CERNY.method;var signature=CERNY.signature;var showMessage=TOPINCS.util.showMessage;TOPINCS.wiki.IncludeEditor=IncludeEditor;var logger=CERNY.Logger("TOPINCS.wiki.IncludeEditor");var DICT=TOPINCS.wiki.DICT;function IncludeEditor(articleMap,context,include,includedTopicMaps){if(articleMap){this.articleMap=articleMap;this.include=include;this.includedTopicMaps=includedTopicMaps;this.el=Element.create("div",null,"class=article editor");if(this.articleMap.subjectLocator){this.el.addCSSClass("resource");}}}
IncludeEditor.prototype.logger=logger;method(IncludeEditor.prototype,"renderHeadline",ArticleViewer.prototype.renderHeadline);method(IncludeEditor.prototype,"renderLabel",ArticleViewer.prototype.renderLabel);method(IncludeEditor.prototype,"renderType",ArticleViewer.prototype.renderType);function render(context){this.el.appendChild(this.renderHeadline(this.articleMap,context));var topic=this.articleMap.subject;var t=this;var pEl=Element.create("div",null,"class=wiki-paragraph");var currentIi=topic.getAbsoluteURL();topic.item_identifiers.map(function(ii){if(ii!=currentIi){var url=calculateWikiUrl(ii);var el=Element.create("div",null,"class=wiki-line");var button=new Button({label:DICT.lab_include_btn,tooltip:DICT.tt_include_btn_active,blockUi:false,active:!t.includedTopicMaps.contains(url)});function action(){TOPINCS.util.blockUi();var countNew,message,exception;try{countNew=t.include(url);message=DICT.get("msg_success_including_map",[url])+"\n"+
DICT.get("msg_change_number",[countNew],countNew);}catch(e){message=DICT.get("msg_problem_including_map",[url]);exception=e;if(e instanceof I18NException){exception=e.getMessage(DICT);}}
showMessage(message,exception);button.deactivate();button.setTooltip(DICT.tt_include_btn_inactive);TOPINCS.util.releaseUi();}
button.action=action;el.appendChildren(Element.create("span",ii,"class=include-entry"),button.render());pEl.appendChild(el);}});if(pEl.countChildren(isDiv)===0){pEl.appendChild(Element.create("span",DICT.msg_no_includes_present,"class=message"));}
this.el.appendChild(pEl);return this.el;}
method(IncludeEditor.prototype,"render",render);function calculateWikiUrl(topicIi){return topicIi.replace(/\/topics\/(\d+)$/,"/wiki/id:$1.jtm");}})();YAHOO.util.Attribute=function(hash,owner){if(owner){this.owner=owner;this.configure(hash,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(value,silent){var beforeRetVal;var owner=this.owner;var name=this.name;var event={type:name,prevValue:this.getValue(),newValue:value};if(this.readOnly||(this.writeOnce&&this._written)){return false;}
if(this.validator&&!this.validator.call(owner,value)){return false;}
if(!silent){beforeRetVal=owner.fireBeforeChangeEvent(event);if(beforeRetVal===false){return false;}}
if(this.method){this.method.call(owner,value);}
this.value=value;this._written=true;event.type=name;if(!silent){this.owner.fireChangeEvent(event);}
return true;},configure:function(map,init){map=map||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var key in map){if(map.hasOwnProperty(key)){this[key]=map[key];if(init){this._initialConfig[key]=map[key];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(silent){this.setValue(this.value,silent);}};(function(){var Lang=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(key){this._configs=this._configs||{};var config=this._configs[key];if(!config||!this._configs.hasOwnProperty(key)){return undefined;}
return config.value;},set:function(key,value,silent){this._configs=this._configs||{};var config=this._configs[key];if(!config){return false;}
return config.setValue(value,silent);},getAttributeKeys:function(){this._configs=this._configs;var keys=[];var config;for(var key in this._configs){config=this._configs[key];if(Lang.hasOwnProperty(this._configs,key)&&!Lang.isUndefined(config)){keys[keys.length]=key;}}
return keys;},setAttributes:function(map,silent){for(var key in map){if(Lang.hasOwnProperty(map,key)){this.set(key,map[key],silent);}}},resetValue:function(key,silent){this._configs=this._configs||{};if(this._configs[key]){this.set(key,this._configs[key]._initialConfig.value,silent);return true;}
return false;},refresh:function(key,silent){this._configs=this._configs||{};var configs=this._configs;key=((Lang.isString(key))?[key]:key)||this.getAttributeKeys();for(var i=0,len=key.length;i<len;++i){if(configs.hasOwnProperty(key[i])){this._configs[key[i]].refresh(silent);}}},register:function(key,map){this.setAttributeConfig(key,map);},getAttributeConfig:function(key){this._configs=this._configs||{};var config=this._configs[key]||{};var map={};for(key in config){if(Lang.hasOwnProperty(config,key)){map[key]=config[key];}}
return map;},setAttributeConfig:function(key,map,init){this._configs=this._configs||{};map=map||{};if(!this._configs[key]){map.name=key;this._configs[key]=this.createAttribute(map);}else{this._configs[key].configure(map,init);}},configureAttribute:function(key,map,init){this.setAttributeConfig(key,map,init);},resetAttributeConfig:function(key){this._configs=this._configs||{};this._configs[key].resetConfig();},subscribe:function(type,callback){this._events=this._events||{};if(!(type in this._events)){this._events[type]=this.createEvent(type);}
YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){this.subscribe.apply(this,arguments);},addListener:function(){this.subscribe.apply(this,arguments);},fireBeforeChangeEvent:function(e){var type='before';type+=e.type.charAt(0).toUpperCase()+e.type.substr(1)+'Change';e.type=type;return this.fireEvent(e.type,e);},fireChangeEvent:function(e){e.type+='Change';return this.fireEvent(e.type,e);},createAttribute:function(map){return new YAHOO.util.Attribute(map,this);}};YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,AttributeProvider=YAHOO.util.AttributeProvider;YAHOO.util.Element=function(el,map){if(arguments.length){this.init(el,map);}};YAHOO.util.Element.prototype={DOM_EVENTS:null,appendChild:function(child){child=child.get?child.get('element'):child;return this.get('element').appendChild(child);},getElementsByTagName:function(tag){return this.get('element').getElementsByTagName(tag);},hasChildNodes:function(){return this.get('element').hasChildNodes();},insertBefore:function(element,before){element=element.get?element.get('element'):element;before=(before&&before.get)?before.get('element'):before;return this.get('element').insertBefore(element,before);},removeChild:function(child){child=child.get?child.get('element'):child;return this.get('element').removeChild(child);},replaceChild:function(newNode,oldNode){newNode=newNode.get?newNode.get('element'):newNode;oldNode=oldNode.get?oldNode.get('element'):oldNode;return this.get('element').replaceChild(newNode,oldNode);},initAttributes:function(map){},addListener:function(type,fn,obj,scope){var el=this.get('element')||this.get('id');scope=scope||this;var self=this;if(!this._events[type]){if(el&&this.DOM_EVENTS[type]){YAHOO.util.Event.addListener(el,type,function(e){if(e.srcElement&&!e.target){e.target=e.srcElement;}
self.fireEvent(type,e);},obj,scope);}
this.createEvent(type,this);}
return YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){return this.addListener.apply(this,arguments);},subscribe:function(){return this.addListener.apply(this,arguments);},removeListener:function(type,fn){return this.unsubscribe.apply(this,arguments);},addClass:function(className){Dom.addClass(this.get('element'),className);},getElementsByClassName:function(className,tag){return Dom.getElementsByClassName(className,tag,this.get('element'));},hasClass:function(className){return Dom.hasClass(this.get('element'),className);},removeClass:function(className){return Dom.removeClass(this.get('element'),className);},replaceClass:function(oldClassName,newClassName){return Dom.replaceClass(this.get('element'),oldClassName,newClassName);},setStyle:function(property,value){var el=this.get('element');if(!el){return this._queue[this._queue.length]=['setStyle',arguments];}
return Dom.setStyle(el,property,value);},getStyle:function(property){return Dom.getStyle(this.get('element'),property);},fireQueue:function(){var queue=this._queue;for(var i=0,len=queue.length;i<len;++i){this[queue[i][0]].apply(this,queue[i][1]);}},appendTo:function(parent,before){parent=(parent.get)?parent.get('element'):Dom.get(parent);this.fireEvent('beforeAppendTo',{type:'beforeAppendTo',target:parent});before=(before&&before.get)?before.get('element'):Dom.get(before);var element=this.get('element');if(!element){return false;}
if(!parent){return false;}
if(element.parent!=parent){if(before){parent.insertBefore(element,before);}else{parent.appendChild(element);}}
this.fireEvent('appendTo',{type:'appendTo',target:parent});return element;},get:function(key){var configs=this._configs||{};var el=configs.element;if(el&&!configs[key]&&!YAHOO.lang.isUndefined(el.value[key])){return el.value[key];}
return AttributeProvider.prototype.get.call(this,key);},setAttributes:function(map,silent){var el=this.get('element');for(var key in map){if(!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){this.setAttributeConfig(key);}}
for(var i=0,len=this._configOrder.length;i<len;++i){if(map[this._configOrder[i]]!==undefined){this.set(this._configOrder[i],map[this._configOrder[i]],silent);}}},set:function(key,value,silent){var el=this.get('element');if(!el){this._queue[this._queue.length]=['set',arguments];if(this._configs[key]){this._configs[key].value=value;}
return;}
if(!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key);}
return AttributeProvider.prototype.set.apply(this,arguments);},setAttributeConfig:function(key,map,init){var el=this.get('element');if(el&&!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key,map);}else{AttributeProvider.prototype.setAttributeConfig.apply(this,arguments);}
this._configOrder.push(key);},getAttributeKeys:function(){var el=this.get('element');var keys=AttributeProvider.prototype.getAttributeKeys.call(this);for(var key in el){if(!this._configs[key]){keys[key]=keys[key]||el[key];}}
return keys;},createEvent:function(type,scope){this._events[type]=true;AttributeProvider.prototype.createEvent.apply(this,arguments);},init:function(el,attr){_initElement.apply(this,arguments);}};var _initElement=function(el,attr){this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};this._configOrder=[];attr=attr||{};attr.element=attr.element||el||null;this.DOM_EVENTS={'click':true,'dblclick':true,'keydown':true,'keypress':true,'keyup':true,'mousedown':true,'mousemove':true,'mouseout':true,'mouseover':true,'mouseup':true,'focus':true,'blur':true,'submit':true};var isReady=false;if(typeof attr.element==='string'){_registerHTMLAttr.call(this,'id',{value:attr.element});}
if(Dom.get(attr.element)){isReady=true;_initHTMLElement.call(this,attr);_initContent.call(this,attr);}
YAHOO.util.Event.onAvailable(attr.element,function(){if(!isReady){_initHTMLElement.call(this,attr);}
this.fireEvent('available',{type:'available',target:Dom.get(attr.element)});},this,true);YAHOO.util.Event.onContentReady(attr.element,function(){if(!isReady){_initContent.call(this,attr);}
this.fireEvent('contentReady',{type:'contentReady',target:Dom.get(attr.element)});},this,true);};var _initHTMLElement=function(attr){this.setAttributeConfig('element',{value:Dom.get(attr.element),readOnly:true});};var _initContent=function(attr){this.initAttributes(attr);this.setAttributes(attr,true);this.fireQueue();};var _registerHTMLAttr=function(key,map){var el=this.get('element');map=map||{};map.name=key;map.method=map.method||function(value){if(el){el[key]=value;}};map.value=map.value||el[key];this._configs[key]=new YAHOO.util.Attribute(map,this);};YAHOO.augment(YAHOO.util.Element,AttributeProvider);})();YAHOO.register("element",YAHOO.util.Element,{version:"2.6.0",build:"1321"});(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Tab=YAHOO.widget.Tab,doc=document;var ELEMENT='element';var TabView=function(el,attr){attr=attr||{};if(arguments.length==1&&!YAHOO.lang.isString(el)&&!el.nodeName){attr=el;el=attr.element||null;}
if(!el&&!attr.element){el=_createTabViewElement.call(this,attr);}
TabView.superclass.constructor.call(this,el,attr);};YAHOO.extend(TabView,YAHOO.util.Element,{CLASSNAME:'yui-navset',TAB_PARENT_CLASSNAME:'yui-nav',CONTENT_PARENT_CLASSNAME:'yui-content',_tabParent:null,_contentParent:null,addTab:function(tab,index){var tabs=this.get('tabs');if(!tabs){this._queue[this._queue.length]=['addTab',arguments];return false;}
index=(index===undefined)?tabs.length:index;var before=this.getTab(index);var self=this;var el=this.get(ELEMENT);var tabParent=this._tabParent;var contentParent=this._contentParent;var tabElement=tab.get(ELEMENT);var contentEl=tab.get('contentEl');if(before){tabParent.insertBefore(tabElement,before.get(ELEMENT));}else{tabParent.appendChild(tabElement);}
if(contentEl&&!Dom.isAncestor(contentParent,contentEl)){contentParent.appendChild(contentEl);}
if(!tab.get('active')){tab.set('contentVisible',false,true);}else{this.set('activeTab',tab,true);}
var activate=function(e){YAHOO.util.Event.preventDefault(e);var silent=false;if(this==self.get('activeTab')){silent=true;}
self.set('activeTab',this,silent);};tab.addListener(tab.get('activationEvent'),activate);tab.addListener('activationEventChange',function(e){if(e.prevValue!=e.newValue){tab.removeListener(e.prevValue,activate);tab.addListener(e.newValue,activate);}});tabs.splice(index,0,tab);},DOMEventHandler:function(e){var el=this.get(ELEMENT);var target=YAHOO.util.Event.getTarget(e);var tabParent=this._tabParent;if(Dom.isAncestor(tabParent,target)){var tabEl;var tab=null;var contentEl;var tabs=this.get('tabs');for(var i=0,len=tabs.length;i<len;i++){tabEl=tabs[i].get(ELEMENT);contentEl=tabs[i].get('contentEl');if(target==tabEl||Dom.isAncestor(tabEl,target)){tab=tabs[i];break;}}
if(tab){tab.fireEvent(e.type,e);}}},getTab:function(index){return this.get('tabs')[index];},getTabIndex:function(tab){var index=null;var tabs=this.get('tabs');for(var i=0,len=tabs.length;i<len;++i){if(tab==tabs[i]){index=i;break;}}
return index;},removeTab:function(tab){var tabCount=this.get('tabs').length;var index=this.getTabIndex(tab);var nextIndex=index+1;if(tab==this.get('activeTab')){if(tabCount>1){if(index+1==tabCount){this.set('activeIndex',index-1);}else{this.set('activeIndex',index+1);}}}
this._tabParent.removeChild(tab.get(ELEMENT));this._contentParent.removeChild(tab.get('contentEl'));this._configs.tabs.value.splice(index,1);},toString:function(){var name=this.get('id')||this.get('tagName');return"TabView "+name;},contentTransition:function(newTab,oldTab){newTab.set('contentVisible',true);oldTab.set('contentVisible',false);},initAttributes:function(attr){TabView.superclass.initAttributes.call(this,attr);if(!attr.orientation){attr.orientation='top';}
var el=this.get(ELEMENT);if(!Dom.hasClass(el,this.CLASSNAME)){Dom.addClass(el,this.CLASSNAME);}
this.setAttributeConfig('tabs',{value:[],readOnly:true});this._tabParent=this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,'ul')[0]||_createTabParent.call(this);this._contentParent=this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,'div')[0]||_createContentParent.call(this);this.setAttributeConfig('orientation',{value:attr.orientation,method:function(value){var current=this.get('orientation');this.addClass('yui-navset-'+value);if(current!=value){this.removeClass('yui-navset-'+current);}
switch(value){case'bottom':this.appendChild(this._tabParent);break;}}});this.setAttributeConfig('activeIndex',{value:attr.activeIndex,method:function(value){},validator:function(value){return!this.getTab(value).get('disabled');}});this.setAttributeConfig('activeTab',{value:attr.activeTab,method:function(tab){var activeTab=this.get('activeTab');if(tab){tab.set('active',true);}
if(activeTab&&activeTab!=tab){activeTab.set('active',false);}
if(activeTab&&tab!=activeTab){this.contentTransition(tab,activeTab);}else if(tab){tab.set('contentVisible',true);}},validator:function(value){return!value.get('disabled');}});this.on('activeTabChange',this._handleActiveTabChange);this.on('activeIndexChange',this._handleActiveIndexChange);if(this._tabParent){_initTabs.call(this);}
this.DOM_EVENTS.submit=false;this.DOM_EVENTS.focus=false;this.DOM_EVENTS.blur=false;for(var type in this.DOM_EVENTS){if(YAHOO.lang.hasOwnProperty(this.DOM_EVENTS,type)){this.addListener.call(this,type,this.DOMEventHandler);}}},_handleActiveTabChange:function(e){var activeIndex=this.get('activeIndex'),newIndex=this.getTabIndex(e.newValue);if(activeIndex!==newIndex){if(!(this.set('activeIndex',newIndex))){this.set('activeTab',e.prevValue);}}},_handleActiveIndexChange:function(e){if(e.newValue!==this.getTabIndex(this.get('activeTab'))){if(!(this.set('activeTab',this.getTab(e.newValue)))){this.set('activeIndex',e.prevValue);}}}});var _initTabs=function(){var tab,attr,contentEl;var el=this.get(ELEMENT);var tabs=Dom.getChildren(this._tabParent);var contentElements=Dom.getChildren(this._contentParent);for(var i=0,len=tabs.length;i<len;++i){attr={};if(contentElements[i]){attr.contentEl=contentElements[i];}
tab=new YAHOO.widget.Tab(tabs[i],attr);this.addTab(tab);if(tab.hasClass(tab.ACTIVE_CLASSNAME)){this._configs.activeTab.value=tab;this._configs.activeIndex.value=this.getTabIndex(tab);}}};var _createTabViewElement=function(attr){var el=doc.createElement('div');if(this.CLASSNAME){el.className=this.CLASSNAME;}
return el;};var _createTabParent=function(attr){var el=doc.createElement('ul');if(this.TAB_PARENT_CLASSNAME){el.className=this.TAB_PARENT_CLASSNAME;}
this.get(ELEMENT).appendChild(el);return el;};var _createContentParent=function(attr){var el=doc.createElement('div');if(this.CONTENT_PARENT_CLASSNAME){el.className=this.CONTENT_PARENT_CLASSNAME;}
this.get(ELEMENT).appendChild(el);return el;};YAHOO.widget.TabView=TabView;})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang;var CONTENT_EL='contentEl',LABEL_EL='labelEl',CONTENT='content',ELEMENT='element',CACHE_DATA='cacheData',DATA_SRC='dataSrc',DATA_LOADED='dataLoaded',DATA_TIMEOUT='dataTimeout',LOAD_METHOD='loadMethod',POST_DATA='postData',DISABLED='disabled';var Tab=function(el,attr){attr=attr||{};if(arguments.length==1&&!Lang.isString(el)&&!el.nodeName){attr=el;el=attr.element;}
if(!el&&!attr.element){el=_createTabElement.call(this,attr);}
this.loadHandler={success:function(o){this.set(CONTENT,o.responseText);},failure:function(o){}};Tab.superclass.constructor.call(this,el,attr);this.DOM_EVENTS={};};YAHOO.extend(Tab,YAHOO.util.Element,{LABEL_TAGNAME:'em',ACTIVE_CLASSNAME:'selected',HIDDEN_CLASSNAME:'yui-hidden',ACTIVE_TITLE:'active',DISABLED_CLASSNAME:DISABLED,LOADING_CLASSNAME:'loading',dataConnection:null,loadHandler:null,_loading:false,toString:function(){var el=this.get(ELEMENT);var id=el.id||el.tagName;return"Tab "+id;},initAttributes:function(attr){attr=attr||{};Tab.superclass.initAttributes.call(this,attr);var el=this.get(ELEMENT);this.setAttributeConfig('activationEvent',{value:attr.activationEvent||'click'});this.setAttributeConfig(LABEL_EL,{value:attr.labelEl||_getlabelEl.call(this),method:function(value){var current=this.get(LABEL_EL);if(current){if(current==value){return false;}
this.replaceChild(value,current);}else if(el.firstChild){this.insertBefore(value,el.firstChild);}else{this.appendChild(value);}}});this.setAttributeConfig('label',{value:attr.label||_getLabel.call(this),method:function(value){var labelEl=this.get(LABEL_EL);if(!labelEl){this.set(LABEL_EL,_createlabelEl.call(this));}
_setLabel.call(this,value);}});this.setAttributeConfig(CONTENT_EL,{value:attr.contentEl||document.createElement('div'),method:function(value){var current=this.get(CONTENT_EL);if(current){if(current==value){return false;}
this.replaceChild(value,current);}}});this.setAttributeConfig(CONTENT,{value:attr.content,method:function(value){this.get(CONTENT_EL).innerHTML=value;}});var _dataLoaded=false;this.setAttributeConfig(DATA_SRC,{value:attr.dataSrc});this.setAttributeConfig(CACHE_DATA,{value:attr.cacheData||false,validator:Lang.isBoolean});this.setAttributeConfig(LOAD_METHOD,{value:attr.loadMethod||'GET',validator:Lang.isString});this.setAttributeConfig(DATA_LOADED,{value:false,validator:Lang.isBoolean,writeOnce:true});this.setAttributeConfig(DATA_TIMEOUT,{value:attr.dataTimeout||null,validator:Lang.isNumber});this.setAttributeConfig(POST_DATA,{value:attr.postData||null});this.setAttributeConfig('active',{value:attr.active||this.hasClass(this.ACTIVE_CLASSNAME),method:function(value){if(value===true){this.addClass(this.ACTIVE_CLASSNAME);this.set('title',this.ACTIVE_TITLE);}else{this.removeClass(this.ACTIVE_CLASSNAME);this.set('title','');}},validator:function(value){return Lang.isBoolean(value)&&!this.get(DISABLED);}});this.setAttributeConfig(DISABLED,{value:attr.disabled||this.hasClass(this.DISABLED_CLASSNAME),method:function(value){if(value===true){Dom.addClass(this.get(ELEMENT),this.DISABLED_CLASSNAME);}else{Dom.removeClass(this.get(ELEMENT),this.DISABLED_CLASSNAME);}},validator:Lang.isBoolean});this.setAttributeConfig('href',{value:attr.href||this.getElementsByTagName('a')[0].getAttribute('href',2)||'#',method:function(value){this.getElementsByTagName('a')[0].href=value;},validator:Lang.isString});this.setAttributeConfig('contentVisible',{value:attr.contentVisible,method:function(value){if(value){Dom.removeClass(this.get(CONTENT_EL),this.HIDDEN_CLASSNAME);if(this.get(DATA_SRC)){if(!this._loading&&!(this.get(DATA_LOADED)&&this.get(CACHE_DATA))){this._dataConnect();}}}else{Dom.addClass(this.get(CONTENT_EL),this.HIDDEN_CLASSNAME);}},validator:Lang.isBoolean});},_dataConnect:function(){if(!YAHOO.util.Connect){return false;}
Dom.addClass(this.get(CONTENT_EL).parentNode,this.LOADING_CLASSNAME);this._loading=true;this.dataConnection=YAHOO.util.Connect.asyncRequest(this.get(LOAD_METHOD),this.get(DATA_SRC),{success:function(o){this.loadHandler.success.call(this,o);this.set(DATA_LOADED,true);this.dataConnection=null;Dom.removeClass(this.get(CONTENT_EL).parentNode,this.LOADING_CLASSNAME);this._loading=false;},failure:function(o){this.loadHandler.failure.call(this,o);this.dataConnection=null;Dom.removeClass(this.get(CONTENT_EL).parentNode,this.LOADING_CLASSNAME);this._loading=false;},scope:this,timeout:this.get(DATA_TIMEOUT)},this.get(POST_DATA));}});var _createTabElement=function(attr){var el=document.createElement('li');var a=document.createElement('a');a.href=attr.href||'#';el.appendChild(a);var label=attr.label||null;var labelEl=attr.labelEl||null;if(labelEl){if(!label){label=_getLabel.call(this,labelEl);}}else{labelEl=_createlabelEl.call(this);}
a.appendChild(labelEl);return el;};var _getlabelEl=function(){return this.getElementsByTagName(this.LABEL_TAGNAME)[0];};var _createlabelEl=function(){var el=document.createElement(this.LABEL_TAGNAME);return el;};var _setLabel=function(label){var el=this.get(LABEL_EL);el.innerHTML=label;};var _getLabel=function(){var label,el=this.get(LABEL_EL);if(!el){return undefined;}
return el.innerHTML;};YAHOO.widget.Tab=Tab;})();YAHOO.register("tabview",YAHOO.widget.TabView,{version:"2.6.0",build:"1321"});CERNY.require("TOPINCS.login","CERNY.http.Request","TOPINCS.cons");(function(){function login(onsuccess,onfailure){var elId="loginiframe";var el=document.createElement("iframe");var onLoadHandler=function(){var contentDocument;if(el.contentDocument){contentDocument=el.contentDocument;}else{contentDocument=document.frames[elId].document;}
if(contentDocument.body.innerHTML.length==0){onsuccess();}else{onfailure();document.body.removeChild(el);}};if(el.attachEvent){el.attachEvent("onload",onLoadHandler);}else{el.onload=onLoadHandler;}
el.setAttribute("id",elId);el.setAttribute("src",".login");document.body.appendChild(el);}
CERNY.signature(login,"undefined","function","function");CERNY.method(TOPINCS,"login",login);})();CERNY.require("TOPINCS.wiki.Wiki","TOPINCS.wiki.init","TOPINCS.wiki.DICT","TOPINCS.wiki.Article","TOPINCS.wiki.ArticleViewer","TOPINCS.wiki.ArticleEditor","TOPINCS.wiki.ArticleMap","TOPINCS.wiki.IncludeEditor","TOPINCS.I18NException","TOPINCS.tmdm.Topic","TOPINCS.tmdm.TopicMap","YAHOO.widget.TabView","TOPINCS.util","TOPINCS.login","TOPINCS.cons","CERNY.util","CERNY.dom.Element");(function(){var Article=TOPINCS.wiki.Article;var ArticleViewer=TOPINCS.wiki.ArticleViewer;var IncludeEditor=TOPINCS.wiki.IncludeEditor;var I18NException=TOPINCS.I18NException;var Element=CERNY.dom.Element;var Logger=CERNY.Logger;var Tab=YAHOO.widget.Tab;var Topic=TOPINCS.tmdm.Topic;var TopicMap=TOPINCS.tmdm.TopicMap;var TabView=YAHOO.widget.TabView;var blockUi=TOPINCS.util.blockUi;var releaseUi=TOPINCS.util.releaseUi;var getResult=TOPINCS.util.getResult;var method=CERNY.method;var signature=CERNY.signature;var showMessage=TOPINCS.util.showMessage;var wiki=TOPINCS.wiki;var ArticleMap=wiki.ArticleMap;var parameters=CERNY.util.getUriParameters();var tabView,viewerTab,editorTab,includeTab;var contentEl=new Element("wiki-article");var viewerEl=Element.create("div",null,"id=viewer");var editorEl=Element.create("div",null,"id=editor");var includeEl=Element.create("div",null,"id=include");var logger=Logger("TOPINCS.wiki.Wiki");var Wiki={articleMap:null,includedTopicMaps:[],logger:logger};TOPINCS.wiki.Wiki=Wiki;var DICT=wiki.DICT;TOPINCS.util.cache(TopicMap,"getTopicMap");function displayViewer(context){var article=new Article(this.articleMap,context.defaultHiddenTypes);var viewer=new ArticleViewer(article,context);viewerEl.appendChild(viewer.render().node);}
signature(displayViewer,"undefined","object");method(Wiki,"displayViewer",displayViewer);function redisplayViewer(context){if(viewerTab.myinit===true){viewerEl.deleteChildren();this.displayViewer(context);}}
signature(redisplayViewer,"undefined","object");method(Wiki,"redisplayViewer",redisplayViewer);function displayEditor(context){var article=new Article(this.articleMap,[]);var editor=new TOPINCS.wiki.ArticleEditor(article,context);editorEl.appendChild(editor.render().node);}
signature(displayEditor,"undefined","object");method(Wiki,"displayEditor",displayEditor);function redisplayEditor(context){if(editorTab.myinit===true){editorEl.deleteChildren();this.displayEditor(context);}}
signature(redisplayEditor,"undefined","object");method(Wiki,"redisplayEditor",redisplayEditor);function displayIncludeEditor(tab,context){var t=this;var editor=new IncludeEditor(this.articleMap,context,function(url){var countBefore=t.articleMap.changes.count();t.includeTopicMap(url);return t.articleMap.changes.count()-countBefore;},t.includedTopicMaps);tab.get("contentEl").appendChild(editor.render(context).node);}
signature(displayIncludeEditor,"undefined",Tab,"object");method(Wiki,"displayIncludeEditor",displayIncludeEditor);function includeTopicMap(url){this.articleMap.merge(TopicMap.getTopicMap(url));this.includedTopicMaps.push(url);}
signature(includeTopicMap,"boolean","string");method(Wiki,"includeTopicMap",includeTopicMap);function main(topicId){TOPINCS.wiki.init();this.setMainTopic(topicId);}
signature(main,"undefined");method(Wiki,"main",main);function setMainTopic(topicId){blockUi();var t=this;TOPINCS.wiki.Wiki.MAIN_TOPIC_ID=topicId;var nocache=isReferrerInclude();var topicMapUrl=TOPINCS.util.createWikiUri(topicId)+".jtm";var topicMap=TopicMap.getTopicMap(topicMapUrl,{nocache:nocache});this.articleMap=new ArticleMap(topicMap);var includeUrls=parameters.include;if(includeUrls){includeUrls.map(function(url){try{t.includeTopicMap(url);}catch(e){var exc=e;if(e instanceof I18NException){exc=e.getMessage(DICT);}
showMessage(DICT.get("msg_problem_including_map",[url]),exc);}});}
var context=TOPINCS.wiki.getContext(this.articleMap);initTabView(this);augmentTabs(this,context);displayTab(parameters.tab);this.articleMap.addObserver(ArticleMap.EVT_CHANGE,function(){t.redisplayViewer(context);});this.articleMap.addObserver(ArticleMap.EVT_MERGE,function(){t.redisplayViewer(context);t.redisplayEditor(context);});var footerEl=Element.create("div",null,"id=footer");var aEl=Element.create("a",DICT.lab_open_in_web,"href="+topicId);footerEl.appendChild(aEl);var realContentEl=new Element(contentEl.node.parentNode);realContentEl.appendChild(footerEl);releaseUi();}
signature(setMainTopic,"undefined");method(Wiki,"setMainTopic",setMainTopic);function initTabView(t){var viewerConf={label:DICT.lab_viewer,contentEl:viewerEl.node};viewerTab=new Tab(viewerConf);var editorConf={label:DICT.lab_editor,contentEl:editorEl.node};editorTab=new Tab(editorConf);var includeConf={label:DICT.lab_include,contentEl:includeEl.node};includeTab=new Tab(includeConf);tabView=new TabView(contentEl.node.id);tabView.addTab(viewerTab);tabView.addTab(editorTab);tabView.addTab(includeTab);}
function augmentTabs(t,context){augmentTab(viewerTab,DICT.tt_viewer_tab,function(){t.displayViewer(context);});augmentTab(editorTab,DICT.tt_editor_tab,function(){function onsuccess(){t.displayEditor(context);}
function onfailure(){showMessage(DICT.msg_login_failed);tabView.set('activeIndex',0);editorTab.myinit=false;}
TOPINCS.login(onsuccess,onfailure);});augmentTab(includeTab,DICT.tt_include_tab,function(){t.displayIncludeEditor(includeTab,context);});}
function augmentTab(tab,tooltip,init){tab.myinit=false;tab.addListener("activeChange",function(eventInfo){if(tab.myinit===false&&eventInfo.newValue===true){init();tab.myinit=true;}});setTitleOnTab(tab,tooltip);}
function displayTab(tabName){if(isString(tabName)){tabName=[tabName];}
var activeIndex=0;try{switch(tabName[0]){case"editor":case"edit":activeIndex=1;break;case"include":activeIndex=2;break;}}catch(e){}
tabView.set('activeIndex',activeIndex);}
function setTitleOnTab(tab,title){var el=new Element(tab.get('element'));var aEl=new Element(el.getChildren(isA)[0]);aEl.setAttr("title",title);}
function isReferrerInclude(){return document.referrer.indexOf(INCLUDE_URL)>=0;}})();