
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - event-registration.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/event-registration.js?original=1
window.onDOMLoadEvents=new Array();window.DOMContentLoadedInitDone=false;
function addDOMLoadEvent(listener){window.onDOMLoadEvents[window.onDOMLoadEvents.length]=listener}
function DOMContentLoadedInit(){if(window.DOMContentLoadedInitDone) return;window.DOMContentLoadedInitDone=true;var exceptions=new Array();for(var i=0;i<window.onDOMLoadEvents.length;i++){var func=window.onDOMLoadEvents[i];try{func()} catch(e){exceptions[exceptions.length]=e}}
for(var i=0;i<exceptions.length;i++){throw exceptions[i]}}
function DOMContentLoadedScheduler(){if(window.DOMContentLoadedInitDone) return true;if(/KHTML|WebKit/i.test(navigator.userAgent)){if(/loaded|complete/.test(document.readyState)){DOMContentLoadedInit()} else{setTimeout("DOMContentLoadedScheduler()",250)}} else if(typeof document.getElementsByTagName!='undefined'){var body=document.getElementsByTagName('body');if(body.length>0||document.body!=null){DOMContentLoadedInit()}} else{setTimeout("DOMContentLoadedScheduler()",250)}
return true}
setTimeout("DOMContentLoadedScheduler()",250);if(window.addEventListener){window.addEventListener("load",DOMContentLoadedInit,false);document.addEventListener("DOMContentLoaded",DOMContentLoadedInit,false)} else if(window.attachEvent){window.attachEvent("onload",DOMContentLoadedInit)} else{var _dummy=function(){var $old_onload=window.onload;window.onload=function(e){DOMContentLoadedInit();$old_onload()}}}
/*@cc_on @*/
/*@if (@_win32)
{var proto="src='javascript:void(0)'";if(location.protocol=="https:") proto="src=//0";document.write("<scr"+"ipt id=__ie_onload defer "+proto+"><\/scr"+"ipt>");var script=document.getElementById("__ie_onload");script.onreadystatechange=function(){if(this.readyState=="complete"){DOMContentLoadedInit()}}};/*@end @*/


/* - register_function.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/register_function.js?original=1
var bugRiddenCrashPronePieceOfJunk=(navigator.userAgent.indexOf('MSIE 5')!=-1&&navigator.userAgent.indexOf('Mac')!=-1)
var W3CDOM=(!bugRiddenCrashPronePieceOfJunk&&typeof document.getElementsByTagName!='undefined'&&typeof document.createElement!='undefined');var registerEventListener=undefined;if(typeof addEvent!='undefined'){registerEventListener=function(elem,event,func){addEvent(elem,event,func);return true}} else if(window.addEventListener){registerEventListener=function(elem,event,func){elem.addEventListener(event,func,false);return true}} else if(window.attachEvent){registerEventListener=function(elem,event,func){var result=elem.attachEvent("on"+event,func);return result}} else{registerEventListener=function(elem,event,func){return false}}
var unRegisterEventListener=undefined;if(typeof removeEvent!='undefined'){unRegisterEventListener=function(elem,event,func){removeEvent(element,event,func);return true}} else if(window.removeEventListener){unRegisterEventListener=function(elem,event,func){elem.removeEventListener(event,func,false);return true}} else if(window.detachEvent){unRegisterEventListener=function(elem,event,func){var result=elem.detachEvent("on"+event,func);return result}} else{unRegisterEventListener=function(elem,event,func){return false}}
var registerPloneFunction=undefined;if(typeof addDOMLoadEvent!='undefined'){registerPloneFunction=function(func){addDOMLoadEvent(func)}} else{registerPloneFunction=function(func){registerEventListener(window,"load",func)}}
function getContentArea(){if(W3CDOM){var node=document.getElementById('region-content');if(!node){node=document.getElementById('content')}
return node}}


/* - cssQuery.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/cssQuery.js?original=1
var cssQuery=function(){var version="2.0.2";var $COMMA=/\s*,\s*/;var cssQuery=function($selector,$$from){try{var $match=[];var $useCache=arguments.callee.caching&&!$$from;var $base=($$from)?($$from.constructor==Array)?$$from:[$$from]:[document];var $$selectors=parseSelector($selector).split($COMMA),i;for(i=0;i<$$selectors.length;i++){$selector=_toStream($$selectors[i]);if(isMSIE&&$selector.slice(0,3).join("")==" *#"){$selector=$selector.slice(2);$$from=_msie_selectById([],$base,$selector[1])} else $$from=$base;var j=0,$token,$filter,$arguments,$cacheSelector="";while(j<$selector.length){$token=$selector[j++];$filter=$selector[j++];$cacheSelector+=$token+$filter;$arguments="";if($selector[j]=="("){while($selector[j++]!=")"&&j<$selector.length){$arguments+=$selector[j]}
$arguments=$arguments.slice(0,-1);$cacheSelector+="("+$arguments+")"}
$$from=($useCache&&cache[$cacheSelector])?cache[$cacheSelector]:select($$from,$token,$filter,$arguments);if($useCache) cache[$cacheSelector]=$$from}
$match=$match.concat($$from)}
delete cssQuery.error;return $match} catch($error){cssQuery.error=$error;return []}};cssQuery.toString=function(){return "function cssQuery() {\n  [version "+version+"]\n}"};var cache={};cssQuery.caching=false;cssQuery.clearCache=function($selector){if($selector){$selector=_toStream($selector).join("");delete cache[$selector]} else cache={}};var modules={};var loaded=false;cssQuery.addModule=function($name,$script){if(loaded) eval("$script="+String($script));modules[$name]=new $script()};cssQuery.valueOf=function($code){return $code?eval($code):this};var selectors={};var pseudoClasses={};var AttributeSelector={match:/\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/};var attributeSelectors=[];selectors[" "]=function($results,$from,$tagName,$namespace){var $element,i,j;for(i=0;i<$from.length;i++){var $subset=getElementsByTagName($from[i],$tagName,$namespace);for(j=0;($element=$subset[j]);j++){if(thisElement($element)&&compareNamespace($element,$namespace))
$results.push($element)}}};selectors["#"]=function($results,$from,$id){var $element,j;for(j=0;($element=$from[j]);j++) if($element.id==$id) $results.push($element)};selectors["."]=function($results,$from,$className){$className=new RegExp("(^|\\s)"+$className+"(\\s|$)");var $element,i;for(i=0;($element=$from[i]);i++)
if($className.test($element.className)) $results.push($element)};selectors[":"]=function($results,$from,$pseudoClass,$arguments){var $test=pseudoClasses[$pseudoClass],$element,i;if($test) for(i=0;($element=$from[i]);i++)
if($test($element,$arguments)) $results.push($element)};pseudoClasses["link"]=function($element){var $document=getDocument($element);if($document.links) for(var i=0;i<$document.links.length;i++){if($document.links[i]==$element) return true}};pseudoClasses["visited"]=function($element){};var thisElement=function($element){return($element&&$element.nodeType==1&&$element.tagName!="!")?$element:null};var previousElementSibling=function($element){while($element&&($element=$element.previousSibling)&&!thisElement($element)) continue;return $element};var nextElementSibling=function($element){while($element&&($element=$element.nextSibling)&&!thisElement($element)) continue;return $element};var firstElementChild=function($element){return thisElement($element.firstChild)||nextElementSibling($element.firstChild)};var lastElementChild=function($element){return thisElement($element.lastChild)||previousElementSibling($element.lastChild)};var childElements=function($element){var $childElements=[];$element=firstElementChild($element);while($element){$childElements.push($element);$element=nextElementSibling($element)}
return $childElements};var isMSIE=true;var isXML=function($element){var $document=getDocument($element);return(typeof $document.mimeType=="unknown")?/\.xml$/i.test($document.URL):Boolean($document.mimeType=="XML Document")};var getDocument=function($element){return $element.ownerDocument||$element.document};var getElementsByTagName=function($element,$tagName){return($tagName=="*"&&$element.all)?$element.all:$element.getElementsByTagName($tagName)};var compareTagName=function($element,$tagName,$namespace){if($tagName=="*") return thisElement($element);if(!compareNamespace($element,$namespace)) return false;if(!isXML($element)) $tagName=$tagName.toUpperCase();return $element.tagName==$tagName};var compareNamespace=function($element,$namespace){return!$namespace||($namespace=="*")||($element.scopeName==$namespace)};var getTextContent=function($element){return $element.innerText};
function _msie_selectById($results,$from,id){var $match,i,j;for(i=0;i<$from.length;i++){if($match=$from[i].all.item(id)){if($match.id==id) $results.push($match);else if($match.length!=null){for(j=0;j<$match.length;j++){if($match[j].id==id) $results.push($match[j])}}}}
return $results};if(![].push) Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i]}
return this.length};var $NAMESPACE=/\|/;
function select($$from,$token,$filter,$arguments){if($NAMESPACE.test($filter)){$filter=$filter.split($NAMESPACE);$arguments=$filter[0];$filter=$filter[1]}
var $results=[];if(selectors[$token]){selectors[$token]($results,$$from,$filter,$arguments)}
return $results};var $STANDARD_SELECT=/^[^\s>+~]/;var $$STREAM=/[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;
function _toStream($selector){if($STANDARD_SELECT.test($selector)) $selector=" "+$selector;return $selector.match($$STREAM)||[]};var $WHITESPACE=/\s*([\s>+~(),]|^|$)\s*/g;var $IMPLIED_ALL=/([\s>+~,]|[^(]\+|^)([#.:@])/g;var parseSelector=function($selector){return $selector.replace($WHITESPACE,"$1").replace($IMPLIED_ALL,"$1*$2")};var Quote={toString: function(){return "'"},match:/^('[^']*')|("[^"]*")$/,test: function($string){return this.match.test($string)},add: function($string){return this.test($string)?$string:this+$string+this},remove: function($string){return this.test($string)?$string.slice(1,-1):$string}};var getText=function($text){return Quote.remove($text)};var $ESCAPE=/([\/()[\]?{}|*+-])/g;
function regEscape($string){return $string.replace($ESCAPE,"\\$1")};cssQuery.addModule("css-standard", function(){isMSIE=eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/");if(!isMSIE){getElementsByTagName=function($element,$tagName,$namespace){return $namespace?$element.getElementsByTagNameNS("*",$tagName):$element.getElementsByTagName($tagName)};compareNamespace=function($element,$namespace){return!$namespace||($namespace=="*")||($element.prefix==$namespace)};isXML=document.contentType? function($element){return/xml/i.test(getDocument($element).contentType)}: function($element){return getDocument($element).documentElement.tagName!="HTML"};getTextContent=function($element){return $element.textContent||$element.innerText||_getTextContent($element)};
function _getTextContent($element){var $textContent="",$node,i;for(i=0;($node=$element.childNodes[i]);i++){switch($node.nodeType){case 11:case 1:$textContent+=_getTextContent($node);break;case 3:$textContent+=$node.nodeValue;break}}
return $textContent}}});cssQuery.addModule("css-level2", function(){selectors[">"]=function($results,$from,$tagName,$namespace){var $element,i,j;for(i=0;i<$from.length;i++){var $subset=childElements($from[i]);for(j=0;($element=$subset[j]);j++)
if(compareTagName($element,$tagName,$namespace))
$results.push($element)}};selectors["+"]=function($results,$from,$tagName,$namespace){for(var i=0;i<$from.length;i++){var $element=nextElementSibling($from[i]);if($element&&compareTagName($element,$tagName,$namespace))
$results.push($element)}};selectors["@"]=function($results,$from,$attributeSelectorID){var $test=attributeSelectors[$attributeSelectorID].test;var $element,i;for(i=0;($element=$from[i]);i++)
if($test($element)) $results.push($element)};pseudoClasses["first-child"]=function($element){return!previousElementSibling($element)};pseudoClasses["lang"]=function($element,$code){$code=new RegExp("^"+$code,"i");while($element&&!$element.getAttribute("lang")) $element=$element.parentNode;return $element&&$code.test($element.getAttribute("lang"))};AttributeSelector.NS_IE=/\\:/g;AttributeSelector.PREFIX="@";AttributeSelector.tests={};AttributeSelector.replace=function($match,$attribute,$namespace,$compare,$value){var $key=this.PREFIX+$match;if(!attributeSelectors[$key]){$attribute=this.create($attribute,$compare||"",$value||"");attributeSelectors[$key]=$attribute;attributeSelectors.push($attribute)}
return attributeSelectors[$key].id};AttributeSelector.parse=function($selector){$selector=$selector.replace(this.NS_IE,"|");var $match;while($match=$selector.match(this.match)){var $replace=this.replace($match[0],$match[1],$match[2],$match[3],$match[4]);$selector=$selector.replace(this.match,$replace)}
return $selector};AttributeSelector.create=function($propertyName,$test,$value){var $attributeSelector={};$attributeSelector.id=this.PREFIX+attributeSelectors.length;$attributeSelector.name=$propertyName;$test=this.tests[$test];$test=$test?$test(this.getAttribute($propertyName),getText($value)):false;$attributeSelector.test=new Function("e","return "+$test);return $attributeSelector};AttributeSelector.getAttribute=function($name){switch($name.toLowerCase()){case "id":return "e.id";case "class":return "e.className";case "for":return "e.htmlFor";case "href":if(isMSIE){return "String((e.outerHTML.match(/href=\\x22?([^\\s\\x22]*)\\x22?/)||[])[1]||'')"}}
return "e.getAttribute('" + $name.replace($NAMESPACE, ":") + "')"};AttributeSelector.tests[""]=function($attribute){return $attribute};AttributeSelector.tests["="]=function($attribute,$value){return $attribute+"=="+Quote.add($value)};AttributeSelector.tests["~="]=function($attribute,$value){return "/(^| )"+regEscape($value)+"( |$)/.test("+$attribute+")"};AttributeSelector.tests["|="]=function($attribute,$value){return "/^"+regEscape($value)+"(-|$)/.test("+$attribute+")"};var _parseSelector=parseSelector;parseSelector=function($selector){return _parseSelector(AttributeSelector.parse($selector))}});cssQuery.addModule("css-level3", function(){selectors["~"]=function($results,$from,$tagName,$namespace){var $element,i;for(i=0;($element=$from[i]);i++){while($element=nextElementSibling($element)){if(compareTagName($element,$tagName,$namespace))
$results.push($element)}}};pseudoClasses["contains"]=function($element,$text){$text=new RegExp(regEscape(getText($text)));return $text.test(getTextContent($element))};pseudoClasses["root"]=function($element){return $element==getDocument($element).documentElement};pseudoClasses["empty"]=function($element){var $node,i;for(i=0;($node=$element.childNodes[i]);i++){if(thisElement($node)||$node.nodeType==3) return false}
return true};pseudoClasses["last-child"]=function($element){return!nextElementSibling($element)};pseudoClasses["only-child"]=function($element){$element=$element.parentNode;return firstElementChild($element)==lastElementChild($element)};pseudoClasses["not"]=function($element,$selector){var $negated=cssQuery($selector,getDocument($element));for(var i=0;i<$negated.length;i++){if($negated[i]==$element) return false}
return true};pseudoClasses["nth-child"]=function($element,$arguments){return nthChild($element,$arguments,previousElementSibling)};pseudoClasses["nth-last-child"]=function($element,$arguments){return nthChild($element,$arguments,nextElementSibling)};pseudoClasses["target"]=function($element){return $element.id==location.hash.slice(1)};pseudoClasses["checked"]=function($element){return $element.checked};pseudoClasses["enabled"]=function($element){return $element.disabled===false};pseudoClasses["disabled"]=function($element){return $element.disabled};pseudoClasses["indeterminate"]=function($element){return $element.indeterminate};AttributeSelector.tests["^="]=function($attribute,$value){return "/^"+regEscape($value)+"/.test("+$attribute+")"};AttributeSelector.tests["$="]=function($attribute,$value){return "/"+regEscape($value)+"$/.test("+$attribute+")"};AttributeSelector.tests["*="]=function($attribute,$value){return "/"+regEscape($value)+"/.test("+$attribute+")"};
function nthChild($element,$arguments,$traverse){switch($arguments){case "n":return true;case "even":$arguments="2n";break;case "odd":$arguments="2n+1"}
var $$children=childElements($element.parentNode);
function _checkIndex($index){var $index=($traverse==nextElementSibling)?$$children.length-$index:$index-1;return $$children[$index]==$element};if(!isNaN($arguments)) return _checkIndex($arguments);$arguments=$arguments.split("n");var $multiplier=parseInt($arguments[0]);var $step=parseInt($arguments[1]);if((isNaN($multiplier)||$multiplier==1)&&$step==0) return true;if($multiplier==0&&!isNaN($step)) return _checkIndex($step);if(isNaN($step)) $step=0;var $count=1;while($element=$traverse($element)) $count++;if(isNaN($multiplier)||$multiplier==1)
return($traverse==nextElementSibling)?($count<=$step):($step>=$count);return($count%$multiplier)==$step}});loaded=true;return cssQuery}();

/* - plone_javascript_variables.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/plone_javascript_variables.js?original=1
var portal_url='http://www.gender.hu-berlin.de';var form_modified_message='Ihr Formular wurde nicht gespeichert. Alle Ihre Änderungen werden verloren gehen!';var form_resubmit_message='Sie haben bereits auf den Senden-Knopf gedrückt. Möchten Sie dieses Formular wirklich noch ein zweites Mal absenden?';var external_links_open_new_window=false;var external_links_in_content_only=true;

/* - nodeutilities.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/nodeutilities.js?original=1
function wrapNode(node,wrappertype,wrapperclass){var wrapper=document.createElement(wrappertype)
wrapper.className=wrapperclass;var innerNode=node.parentNode.replaceChild(wrapper,node);wrapper.appendChild(innerNode)};
function nodeContained(innernode,outernode){var node=innernode.parentNode;while(node!=document){if(node==outernode){return true}
node=node.parentNode}
return false};
function findContainer(node,func){while(node!=null){if(func(node)){return node}
node=node.parentNode}
return false};
function hasClassName(node,class_name){return new RegExp('\\b'+class_name+'\\b').test(node.className)};
function addClassName(node,class_name){if(!node.className){node.className=class_name} else if(!hasClassName(node,class_name)){var className=node.className+" "+class_name;node.className=className.split(/\s+/).join(' ')}};
function removeClassName(node,class_name){var className=node.className;if(className){className=className.replace(new RegExp('\\b'+class_name+'\\b'),'');className=className.replace(/\s+/g,' ');node.className=className.replace(/\s+$/g,'')}};
function replaceClassName(node,old_class,new_class,ignore_missing){if(ignore_missing&&!hasClassName(node,old_class)){addClassName(node,new_class)} else{var className=node.className;if(className){className=className.replace(new RegExp('\\b'+old_class+'\\b'),new_class);className=className.replace(/\s+/g,' ');node.className=className.replace(/\s+$/g,'')}}};
function walkTextNodes(node,func,data){if(!node){return false}
if(node.hasChildNodes){for(var i=0;i<node.childNodes.length;i++){walkTextNodes(node.childNodes[i],func,data)}
if(node.nodeType==3){func(node,data)}}};
function getInnerTextCompatible(node){var result=new Array();walkTextNodes(node,
function(n,d){d.push(n.nodeValue)},result);return result.join("")};
function getInnerTextFast(node){if(node.innerText){return node.innerText} else{return getInnerTextCompatible(node)}};
function sortNodes(nodes,fetch_func,cmp_func){if(!W3CDOM){return false};var SortNodeWrapper=function(node){this.value=fetch_func(node);this.cloned_node=node.cloneNode(true);this.toString=function(){if(this.value.toString){return this.value.toString()} else{return this.value}}}
var items=new Array();for(var i=0;i<nodes.length;i++){items.push(new SortNodeWrapper(nodes[i]))}
if(cmp_func){items.sort(cmp_func)} else{items.sort()}
for(var i=0;i<items.length;i++){var dest=nodes[i];dest.parentNode.replaceChild(items[i].cloned_node,dest)}};

/* - cookie_functions.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/cookie_functions.js?original=1
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()} else{expires=""}
document.cookie=name+"="+escape(value)+expires+"; path=/;"};
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length)}
if(c.indexOf(nameEQ)==0){return unescape(c.substring(nameEQ.length,c.length))}}
return null};

/* - livesearch.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/livesearch.js?original=1
var liveSearchReq=false;var t=null;var liveSearchLast="";var queryTarget="livesearch_reply?q=";var searchForm=null;var searchInput=null;var isIE=false;var _cache=new Object();var widthOffset=1;
function calculateWidth(){}
function getElementDimensions(elemID){var base=document.getElementById(elemID);var offsetTrail=base;var offsetLeft=0;var offsetTop=0;var width=0;while(offsetTrail){offsetLeft+=offsetTrail.offsetLeft;offsetTop+=offsetTrail.offsetTop;offsetTrail=offsetTrail.offsetParent}
if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined"){offsetLeft+=document.body.leftMargin;offsetTop+=document.body.topMargin}
if(!isIE)
width=searchInput.offsetWidth-widthOffset*2;else
width=searchInput.offsetWidth;return{left:offsetLeft,top:offsetTop,width:width,height:base.offsetHeight,bottom:offsetTop+base.offsetHeight,right:offsetLeft+width}}
function liveSearchInit(){searchInput=document.getElementById('searchGadget');if(searchInput==null||searchInput==undefined)
return
if(navigator.userAgent.indexOf("KHTML")>0){searchInput.addEventListener("keydown",liveSearchKeyPress,false);searchInput.addEventListener("focus",liveSearchDoSearch,false);searchInput.addEventListener("keydown",liveSearchStart,false);searchInput.addEventListener("blur",liveSearchHideDelayed,false)} else if(searchInput.addEventListener){searchInput.addEventListener("keypress",liveSearchKeyPress,false);searchInput.addEventListener("blur",liveSearchHideDelayed,false);searchInput.addEventListener("keypress",liveSearchStart,false)} else{searchInput.attachEvent("onkeydown",liveSearchKeyPress);searchInput.attachEvent("onkeydown",liveSearchStart);searchInput.attachEvent("onblur",liveSearchHideDelayed);isIE=true}
searchInput.setAttribute("autocomplete","off");var pos=getElementDimensions('searchGadget');result=document.getElementById('LSResult');if((typeof result.offsetParent!='undefined')&&(result.offsetParent!=null)){pos.left=pos.left-result.offsetParent.offsetLeft+pos.width} else{pos.left=pos.left+pos.width}
result.style.display='none'}
function liveSearchHideDelayed(){window.setTimeout("liveSearchHide()",400)}
function liveSearchHide(){document.getElementById("LSResult").style.display="none";var highlight=document.getElementById("LSHighlight");if(highlight)
highlight.removeAttribute("id")}
function getFirstHighlight(){var set=getHits();return set[0]}
function getLastHighlight(){var set=getHits();return set[set.length-1]}
function getHits(){var res=document.getElementById("LSShadow");var set=res.getElementsByTagName('li');return set}
function findChild(object,specifier){var cur=object.firstChild;try{while(cur!=undefined){cur=cur.nextSibling;if(specifier(cur)==true)
return cur}} catch(e){};return null}
function findNext(object,specifier){var cur=object;try{while(cur!=undefined){cur=cur.nextSibling;if(cur.nodeType==3)
cur=cur.nextSibling;if(cur!=undefined){if(specifier(cur)==true)
return cur} else{break}}} catch(e){};return null}
function findPrev(object,specifier){var cur=object;try{cur=cur.previousSibling;if(cur.nodeType==3)
cur=cur.previousSibling;if(cur!=undefined){if(specifier(cur)==true)
return cur}} catch(e){};return null}
function liveSearchKeyPress(event){var highlight=document.getElementById("LSHighlight");if(event.keyCode==40){if(!highlight){highlight=getFirstHighlight()} else{highlight.removeAttribute("id");highlight=findNext(highlight, function(o){return o.className=="LSRow"})}
if(highlight)
highlight.setAttribute("id","LSHighlight");if(!isIE)
event.preventDefault()}
else if(event.keyCode==38){if(!highlight){highlight=getLastHighlight()}
else{highlight.removeAttribute("id");highlight=findPrev(highlight, function(o){return o.className=='LSRow'})}
if(highlight)
highlight.setAttribute("id","LSHighlight");if(!isIE)
event.preventDefault()}
else if(event.keyCode==27){if(highlight)
highlight.removeAttribute("id");document.getElementById("LSResult").style.display="none"}}
function liveSearchStart(event){if(t){window.clearTimeout(t)}
var code=event.keyCode;if(code!=40&&code!=38&&code!=27&&code!=37&&code!=39){t=window.setTimeout("liveSearchDoSearch()",200)}}
function liveSearchDoSearch(){if(typeof liveSearchRoot=="undefined"){if(typeof portal_url=="undefined"){liveSearchRoot=""} else{if(portal_url[portal_url.length-1]=='/'){liveSearchRoot=portal_url} else{liveSearchRoot=portal_url+'/'}}}
if(typeof liveSearchRootSubDir=="undefined"){liveSearchRootSubDir=""}
if(liveSearchLast!=searchInput.value){if(liveSearchReq&&liveSearchReq.readyState<4){liveSearchReq.abort()}
if(searchInput.value==""){liveSearchHide();return false}
if(searchInput.value.length<2){liveSearchHide();return false}
var result=_cache[searchInput.value];if(result){showResult(result);return}
liveSearchReq=new XMLHttpRequest();liveSearchReq.onreadystatechange=liveSearchProcessReqChange;liveSearchReq.open("GET",liveSearchRoot+queryTarget+encodeURIComponent(searchInput.value));liveSearchLast=searchInput.value;liveSearchReq.send(null)}}
function showResult(result){var res=document.getElementById("LSResult");res.style.display="block";var sh=document.getElementById("LSShadow");sh.innerHTML=result}
function liveSearchProcessReqChange(){if(liveSearchReq.readyState==4){try{if(liveSearchReq.status>299||liveSearchReq.status<200||liveSearchReq.responseText.length<10)
return} catch(e){return}
showResult(liveSearchReq.responseText);_cache[liveSearchLast]=liveSearchReq.responseText}}
function liveSearchSubmit(){var highlight=document.getElementById("LSHighlight");if(highlight){var target=highlight.getElementsByTagName('a')[0];window.location=target;return false} else{return true}}
if(window.addEventListener)
window.addEventListener("load",liveSearchInit,false);else if(window.attachEvent)
window.attachEvent("onload",liveSearchInit);

/* - fullscreenmode.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/fullscreenmode.js?original=1
function toggleFullScreenMode(){var body=cssQuery('body')[0];if(document.getElementById('icon-full_screen')){var fsicon=document.getElementById('icon-full_screen')}
if(hasClassName(body,'fullscreen')){removeClassName(body,'fullscreen');createCookie('fullscreenMode','');if(fsicon){fsicon.src='fullscreenexpand_icon.gif'}} else{addClassName(body,'fullscreen');createCookie('fullscreenMode','1');if(fsicon){fsicon.src='fullscreencollapse_icon.gif'}}};
function fullscreenModeLoad(){if(document.getElementById('icon-full_screen')){var fsicon=document.getElementById('icon-full_screen')}
if(readCookie('fullscreenMode')=='1'){var body=cssQuery('body')[0];addClassName(body,'fullscreen');if(fsicon){fsicon.src='fullscreencollapse_icon.gif'}}};registerPloneFunction(fullscreenModeLoad)


/* - select_all.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/select_all.js?original=1
function selectAll(id,formName){if(formName==null){checkboxes=document.getElementsByName(id)
for(i=0;i<checkboxes.length;i++){checkboxes[i].checked=true }} else{for(i=0;i<document.forms[formName].elements.length;i++){if(document.forms[formName].elements[i].name==id){document.forms[formName].elements[i].checked=true}}}}
function deselectAll(id,formName){if(formName==null){checkboxes=document.getElementsByName(id)
for(i=0;i<checkboxes.length;i++){checkboxes[i].checked=false }} else{for(i=0;i<document.forms[formName].elements.length;i++){if(document.forms[formName].elements[i].name==id){document.forms[formName].elements[i].checked=false}}}}
function toggleSelect(selectbutton,id,initialState,formName){id=id||'ids:list'
if(selectbutton.isSelected==null){initialState=initialState||false;selectbutton.isSelected=initialState}
if(selectbutton.isSelected==false){selectbutton.setAttribute('src',portal_url+'/select_none_icon.gif');selectbutton.isSelected=true;return selectAll(id,formName)} else{selectbutton.setAttribute('src',portal_url+'/select_all_icon.gif');selectbutton.isSelected=false;return deselectAll(id,formName)}}


/* - dropdown.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/dropdown.js?original=1
function isActionMenu(node){if(hasClassName(node,'actionMenu')){return true}
return false};
function hideAllMenus(){var menus=cssQuery('dl.actionMenu');for(var i=0;i<menus.length;i++){replaceClassName(menus[i],'activated','deactivated',true)}};
function toggleMenuHandler(event){if(!event) var event=window.event;if(!W3CDOM){return true}
var container=findContainer(this,isActionMenu);if(!container){return true}
if(hasClassName(container,'activated')){replaceClassName(container,'activated','deactivated',true)} else{replaceClassName(container,'deactivated','activated',true)}
return false};
function hideMenusHandler(event){if(!event) var event=window.event;hideAllMenus();return true};
function actionMenuDocumentMouseDown(event){if(!event) var event=window.event;if(event.target)
targ=event.target;else if(event.srcElement)
targ=event.srcElement;var container=findContainer(targ,isActionMenu);if(container){return true}
hideAllMenus();return true};
function actionMenuMouseOver(event){if(!event) var event=window.event;if(!this.tagName&&(this.tagName=='A'||this.tagName=='a')){return true}
var container=findContainer(this,isActionMenu);if(!container){return true}
var menu_id=container.id;var switch_menu=false;var menus=cssQuery('dl.actionMenu');for(var i=0;i<menus.length;i++){var menu=menus[i]
if(hasClassName(menu,'activated')){switch_menu=true}
if(menu.id!=menu_id){replaceClassName(menu,'activated','deactivated',true)}}
if(switch_menu){var menu=cssQuery('#'+menu_id)[0];if(menu){replaceClassName(menu,'deactivated','activated',true)}}
return true};
function initializeMenus(){if(!W3CDOM){return false}
document.onmousedown=actionMenuDocumentMouseDown;hideAllMenus();var menu_headers=cssQuery('dl.actionMenu > dt.actionMenuHeader > a');for(var i=0;i<menu_headers.length;i++){var menu_header=menu_headers[i];menu_header.onclick=toggleMenuHandler;menu_header.onmouseover=actionMenuMouseOver}
var menu_contents=cssQuery('dl.actionMenu > dd.actionMenuContent');for(var i=0;i<menu_contents.length;i++){menu_contents[i].onclick=hideMenusHandler}};registerPloneFunction(initializeMenus);

/* - dragdropreorder.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/dragdropreorder.js?original=1
var ploneDnDReorder={}
ploneDnDReorder.dragging=null;ploneDnDReorder.table=null;ploneDnDReorder.rows=null;ploneDnDReorder.isDraggable=function(node){return hasClassName(node,'draggable')};ploneDnDReorder.doDown=function(e){if(!e) var e=window.event;var target=findContainer(this,ploneDnDReorder.isDraggable);if(target==null)
return;for(var i=0;i<ploneDnDReorder.rows.length;i++)
ploneDnDReorder.rows[i].onmousemove=ploneDnDReorder.doDrag;ploneDnDReorder.dragging=target;ploneDnDReorder.dragging._position=ploneDnDReorder.getPos(ploneDnDReorder.dragging);addClassName(ploneDnDReorder.dragging,"dragging");return false}
ploneDnDReorder.getPos=function(node){var children=node.parentNode.childNodes;var pos=0;for(var i=0;i<children.length;i++){if(node==children[i])
return pos;if(hasClassName(children[i],"draggable"))
pos++}
return null}
ploneDnDReorder.doDrag=function(e){if(!e) var e=window.event;if(!ploneDnDReorder.dragging)
return;var target=this;if(!target)
return;if(target.id!=ploneDnDReorder.dragging.id){ploneDnDReorder.swapElements(target,ploneDnDReorder.dragging)}
return false}
ploneDnDReorder.swapElements=function(child1,child2){var parent=child1.parentNode;var children=parent.childNodes;var items=new Array();for(var i=0;i<children.length;i++){var node=children[i];items[i]=node;if(node.id){removeClassName(node,"even");removeClassName(node,"odd");if(node.id==child1.id)
items[i]=child2;if(node.id==child2.id)
items[i]=child1}}
Sarissa.clearChildNodes(parent);var pos=0;for(var i=0;i<items.length;i++){var node=parent.appendChild(items[i]);if(node.id){if(pos%2)
addClassName(node,"even");else
addClassName(node,"odd");pos++}}}
ploneDnDReorder.doUp=function(e){if(!e) var e=window.event;if(!ploneDnDReorder.dragging)
return;removeClassName(ploneDnDReorder.dragging,"dragging");ploneDnDReorder.updatePositionOnServer();ploneDnDReorder.dragging._position=null;try{delete ploneDnDReorder.dragging._position} catch(e){}
ploneDnDReorder.dragging=null;for(var i=0;i<ploneDnDReorder.rows.length;i++)
ploneDnDReorder.rows[i].onmousemove=null;return false}
ploneDnDReorder.updatePositionOnServer=function(){var delta=ploneDnDReorder.getPos(ploneDnDReorder.dragging)-ploneDnDReorder.dragging._position;if(delta==0)
return;var req=new XMLHttpRequest();req.open("POST","folder_moveitem",true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var item_id=ploneDnDReorder.dragging.id.substr('folder-contents-item-'.length);req.send("item_id="+item_id+"&delta:int="+delta)}
ploneDnDReorder.initializeDragDrop=function(){ploneDnDReorder.table=cssQuery("table#sortable")[0];if(!ploneDnDReorder.table)
return;ploneDnDReorder.rows=cssQuery("table#sortable > tr,"+"table#sortable > tbody > tr");var targets=cssQuery("table#sortable > tr > td,"+"table#sortable > tbody > tr > td");for(var i=0;i<targets.length;i++){if(hasClassName(targets[i],'notDraggable'))
continue;targets[i].onmousedown=ploneDnDReorder.doDown;targets[i].onmouseup=ploneDnDReorder.doUp;addClassName(targets[i],"draggingHook")}}
registerPloneFunction(ploneDnDReorder.initializeDragDrop);

/* - mark_special_links.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/mark_special_links.js?original=1
function scanforlinks(){if(!W3CDOM){return false}
if((typeof external_links_in_content_only!='undefined')&&(external_links_in_content_only==false)){links=document.getElementsByTagName('a');for(i=0;i<links.length;i++){if((links[i].getAttribute('href'))&&(links[i].className.indexOf('link-plain')==-1)){var linkval=links[i].getAttribute('href');if(linkval.toLowerCase().indexOf(window.location.protocol+'//'+window.location.host)==0){} else if(linkval.indexOf('http:')!=0){} else{links[i].setAttribute('target','_blank')}}}}
contentarea=getContentArea();if(!contentarea)
return false;links=contentarea.getElementsByTagName('a');for(i=0;i<links.length;i++){if((links[i].getAttribute('href'))&&(links[i].className.indexOf('link-plain')==-1)){var linkval=links[i].getAttribute('href');if(linkval.toLowerCase().indexOf(window.location.protocol+'//'+window.location.host)==0){} else if(linkval.indexOf('http:')!=0){protocols=['mailto','ftp','news','irc','h323','sip','callto','https','feed','webcal'];for(p=0;p<protocols.length;p++){if(linkval.indexOf(protocols[p]+':')==0){wrapNode(links[i],'span','link-'+protocols[p]);break}}} else{if(links[i].getElementsByTagName('img').length==0){wrapNode(links[i],'span','link-external')}
if((typeof external_links_open_new_window!='undefined')&&(external_links_open_new_window==true)){links[i].setAttribute('target','_blank')}}}}};registerPloneFunction(scanforlinks);

/* - collapsiblesections.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/collapsiblesections.js?original=1
function isCollapsible(node){if(hasClassName(node,'collapsible')){return true}
return false};
function toggleCollapsible(event){if(!event) var event=window.event;if(!this.tagName&&(this.tagName=='DT'||this.tagName=='dt')){return true}
var container=findContainer(this,isCollapsible);if(!container){return true}
if(hasClassName(container,'collapsedBlockCollapsible')){replaceClassName(container,'collapsedBlockCollapsible','expandedBlockCollapsible')} else if(hasClassName(container,'expandedBlockCollapsible')){replaceClassName(container,'expandedBlockCollapsible','collapsedBlockCollapsible')} else if(hasClassName(container,'collapsedInlineCollapsible')){replaceClassName(container,'collapsedInlineCollapsible','expandedInlineCollapsible')} else if(hasClassName(container,'expandedInlineCollapsible')){replaceClassName(container,'expandedInlineCollapsible','collapsedInlineCollapsible')}};
function activateCollapsibles(){if(!W3CDOM){return false}
var collapsibles=cssQuery('dl.collapsible');for(var i=0;i<collapsibles.length;i++){var collapsible=collapsibles[i];var collapsible_header=cssQuery('dt.collapsibleHeader',collapsible)[0];collapsible_header.onclick=toggleCollapsible;if(hasClassName(collapsible,'inline')){if(hasClassName(collapsible,'collapsedOnLoad')){replaceClassName(collapsible,'collapsedOnLoad','collapsedInlineCollapsible')} else{addClassName(collapsible,'expandedInlineCollapsible')}} else{if(hasClassName(collapsible,'collapsedOnLoad')){replaceClassName(collapsible,'collapsedOnLoad','collapsedBlockCollapsible')} else{addClassName(collapsible,'expandedBlockCollapsible')}}}};registerPloneFunction(activateCollapsibles);

/* - highlightsearchterms.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/highlightsearchterms.js?original=1
function highlightTermInNode(node,word){var contents=node.nodeValue;var index=contents.toLowerCase().indexOf(word.toLowerCase());if(index<0){return false};var parent=node.parentNode;if(parent.className!="highlightedSearchTerm"){var hiword=document.createElement("span");hiword.className="highlightedSearchTerm";hiword.appendChild(document.createTextNode(contents.substr(index,word.length)));parent.insertBefore(document.createTextNode(contents.substr(0,index)),node);parent.insertBefore(hiword,node);parent.insertBefore(document.createTextNode(contents.substr(index+word.length)),node);parent.removeChild(node)}}
function highlightSearchTerms(terms,startnode){if(!W3CDOM){return false};if(!terms){return false};if(!startnode){return false};for(var term_index=0;term_index<terms.length;term_index++){var term=terms[term_index];if(term.length<1)
continue;var term_lower=term.toLowerCase();if(term_lower!='not'&&term_lower!='and'&&term_lower!='or'){walkTextNodes(startnode,highlightTermInNode,term)}}}
function getSearchTermsFromURI(uri){var query;if(typeof decodeURI!='undefined'){query=decodeURI(uri)} else if(typeof unescape!='undefined'){query=unescape(uri)} else{}
var result=new Array();if(window.decodeReferrer){var referrerSearch=decodeReferrer();if(null!=referrerSearch&&referrerSearch.length>0){result=referrerSearch}}
var qfinder=new RegExp("searchterm=([^&]*)","gi");var qq=qfinder.exec(query);if(qq&&qq[1]){var terms=qq[1].replace(/\+/g,' ').split(/\s+/);for(var i=0;i<terms.length;i++){if(terms[i]!=''){result.push(terms[i])}}
return result}
return result.length==0?false:result}
function highlightSearchTermsFromURI(){if(!W3CDOM){return false};var terms=getSearchTermsFromURI(window.location.search);var contentarea=getContentArea();highlightSearchTerms(terms,contentarea)}
registerPloneFunction(highlightSearchTermsFromURI);

/* - se-highlight.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/se-highlight.js?original=1
var searchEngines=[['^http://([^.]+\\.)?google.*','q='],['^http://search\\.yahoo.*','p='],['^http://search\\.msn.*','q='],['^http://search\\.aol.*','userQuery='],['^http://(www\\.)?altavista.*','q='],['^http://(www\\.)?feedster.*','q='],['^http://search\\.lycos.*','query='],['^http://(www\\.)?alltheweb.*','q='],['^http://(www\\.)?ask\\.com.*','q=']]
function decodeReferrer(ref){if(null==ref&&document.referrer){ref=document.referrer}
if(!ref) return null;var match=new RegExp('');var seQuery='';for(var i=0;i<searchEngines.length;i++){if(!match.compile){match=new RegExp(searchEngines[i][0],'i')} else{match.compile(searchEngines[i][0],'i')}
if(ref.match(match)){if(!match.compile){match=new RegExp('^.*'+searchEngines[i][1]+'([^&]+)&?.*$','i')} else{match.compile('^.*'+searchEngines[i][1]+'([^&]+)&?.*$')}
seQuery=ref.replace(match,'$1');if(seQuery){seQuery=decodeURIComponent(seQuery);seQuery=seQuery.replace(/\'|"/, '');return seQuery.split(/[\s,\+\.]+/)}}}
return null}


/* - first_input_focus.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/first_input_focus.js?original=1
function setFocus(){if(!W3CDOM){return false};var xre=new RegExp(/\berror\b/);for(var f=0;(formnode=document.getElementsByTagName('form').item(f));f++){for(var i=0;(node=formnode.getElementsByTagName('div').item(i));i++){if(xre.exec(node.className)){for(var j=0;(inputnode=node.getElementsByTagName('input').item(j));j++){try{if(inputnode.focus){inputnode.focus();return}} catch(e){}}}}}}
registerPloneFunction(setFocus)


/* - folder_contents_filter.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/folder_contents_filter.js?original=1
function submitFolderAction(folderAction){document.folderContentsForm.action=document.folderContentsForm.action+'/'+folderAction;document.folderContentsForm.submit()}
function submitFilterAction(){document.folderContentsForm.action=document.folderContentsForm.action+'/folder_contents';filter_selection=document.getElementById('filter_selection');for(var i=0;i<filter_selection.length;i++){if(filter_selection.options[i].selected){if(filter_selection.options[i].value=='#'){document.folderContentsForm.filter_state.value='clear_view_filter'}
else{document.folderContentsForm.filter_state.value='set_view_filter'}}}
document.folderContentsForm.submit()}


/* - folder_contents_hideAddItems.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/folder_contents_hideAddItems.js?original=1
function hideTraditionalAddItemPullDown(){pullDown=document.getElementById('traditional-add-item-pulldown');if(pullDown){pullDown.style.display='none'}}
registerPloneFunction(hideTraditionalAddItemPullDown)


/* - styleswitcher.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/styleswitcher.js?original=1
function setActiveStyleSheet(title,reset){if(!W3CDOM){return false};var i,a,main;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")){a.disabled=true;if(a.getAttribute("title")==title){a.disabled=false}}}
if(reset==1){createCookie("wstyle",title,365)}};
function setStyle(){var style=readCookie("wstyle");if(style!=null){setActiveStyleSheet(style,0)}};registerPloneFunction(setStyle);

/* - table_sorter.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/table_sorter.js?original=1
function compare(a,b){au=new String(a);bu=new String(b);if(au.charAt(4)!='-'&&au.charAt(7)!='-'){var an=parseFloat(au)
var bn=parseFloat(bu)}
if(isNaN(an)||isNaN(bn)){as=au.toLowerCase()
bs=bu.toLowerCase()
if(as>bs){return 1}
else{return-1}}
else{return an-bn}}
function getConcatenedTextContent(node){var _result="";if(node==null){return _result}
var childrens=node.childNodes;var i=0;while(i<childrens.length){var child=childrens.item(i);switch(child.nodeType){case 1:case 5:_result+=getConcatenedTextContent(child);break;case 3:case 2:case 4:_result+=child.nodeValue;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:break}
i++}
return _result}
function sort(e){var el=window.event?window.event.srcElement:e.currentTarget;var a=new Array();if(el.nodeName=='IMG') el=el.parentNode;var name=el.childNodes.item(1).nodeValue;var dad=el.parentNode;var node;for(var im=0;(node=dad.getElementsByTagName("th").item(im));im++){if(node.lastChild.nodeName=='IMG'){lastindex=node.getElementsByTagName('img').length-1;node.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowBlank.gif')}}
for(var i=0;(node=dad.getElementsByTagName("th").item(i));i++){var xre=new RegExp(/\bnosort\b/);if(!xre.exec(node.className)&&node.childNodes.item(1).nodeValue==name){lastindex=node.getElementsByTagName('img').length-1;node.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowUp.gif');break}}
var tbody=dad.parentNode.parentNode.getElementsByTagName("tbody").item(0);for(var j=0;(node=tbody.getElementsByTagName("tr").item(j));j++){a[j]=new Array();a[j][0]=getConcatenedTextContent(node.getElementsByTagName("td").item(i));a[j][1]=getConcatenedTextContent(node.getElementsByTagName("td").item(1));a[j][2]=getConcatenedTextContent(node.getElementsByTagName("td").item(0));a[j][3]=node}
if(a.length>1){a.sort(compare);if(a[0][0]==getConcatenedTextContent(tbody.getElementsByTagName("tr").item(0).getElementsByTagName("td").item(i))&&a[1][0]==getConcatenedTextContent(tbody.getElementsByTagName("tr").item(1).getElementsByTagName("td").item(i))){a.reverse();lastindex=el.getElementsByTagName('img').length-1;el.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowDown.gif')}}
for(var j=0;j<a.length;j++){a[j][3].className=((j%2)==0)?'odd':'even';tbody.appendChild(a[j][3])}}
function initalizeTableSort(e){if(!W3CDOM){return false};var tbls=document.getElementsByTagName('table');for(var t=0;t<tbls.length;t++){var re=new RegExp(/\blisting\b/)
var xre=new RegExp(/\bnosort\b/)
if(re.exec(tbls[t].className)&&!xre.exec(tbls[t].className)){try{var thead=tbls[t].getElementsByTagName("thead").item(0);var node;blankarrow=document.createElement('img');blankarrow.setAttribute('src',portal_url+'/arrowBlank.gif');blankarrow.setAttribute('height',6);blankarrow.setAttribute('width',9);initialsort=false;for(var i=0;(node=thead.getElementsByTagName("th").item(i));i++){if(!xre.exec(node.className)){node.insertBefore(blankarrow.cloneNode(1),node.firstChild);node.style.cursor='pointer';if(!initialsort){initialsort=true;uparrow=document.createElement('img');uparrow.setAttribute('src',portal_url+'/arrowUp.gif');uparrow.setAttribute('height',6);uparrow.setAttribute('width',9);node.appendChild(uparrow)} else{node.appendChild(blankarrow.cloneNode(1))}
if(node.addEventListener) node.addEventListener("click",sort,false);else if(node.attachEvent) node.attachEvent("onclick",sort)}}} catch(er){}}}}
registerPloneFunction(initalizeTableSort)


/* - calendar_formfield.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/calendar_formfield.js?original=1
function onJsCalendarDateUpdate(cal){var year=cal.params.input_id_year;var month=cal.params.input_id_month;var day=cal.params.input_id_day;var daystr=''+cal.date.getDate();if(daystr.length==1)
daystr='0'+daystr;var monthstr=''+(cal.date.getMonth()+1);if(monthstr.length==1)
monthstr='0'+monthstr;cal.params.inputField.value=''+cal.date.getFullYear()+'/'+monthstr+'/'+daystr
year.value=cal.params.inputField.value.substring(0,4);month.value=cal.params.inputField.value.substring(5,7);day.value=cal.params.inputField.value.substring(8,10)}
function showJsCalendar(input_id_anchor,input_id,input_id_year,input_id_month,input_id_day,input_id_hour,input_id_minute,yearStart,yearEnd){var input_id_anchor=document.getElementById(input_id_anchor);var input_id=document.getElementById(input_id);var input_id_year=document.getElementById(input_id_year);var input_id_month=document.getElementById(input_id_month);var input_id_day=document.getElementById(input_id_day);var format='y/mm/dd';var dateEl=input_id;var mustCreate=false;var cal=window.calendar;var params={'range':[yearStart,yearEnd],inputField:input_id,input_id_year:input_id_year,input_id_month:input_id_month,input_id_day:input_id_day};
function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",1);param_default("align","Bl");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,null,onJsCalendarDateUpdate,
function(cal){cal.hide()});cal.time24=true;cal.weekNumbers=true;mustCreate=true} else{cal.hide()}
cal.showsOtherMonths=false;cal.yearStep=2;cal.setRange(yearStart,yearEnd);cal.params=params;cal.setDateStatusHandler(null);cal.getDateText=null;cal.setDateFormat(format);if(mustCreate)
cal.create();cal.refresh();if(!params.position)
cal.showAtElement(input_id_anchor,null);else
cal.showAt(params.position[0],params.position[1]);return false}
function update_date_field(field,year,month,day,hour,minute,ampm){var field=document.getElementById(field)
var date=document.getElementById(date)
var year=document.getElementById(year)
var month=document.getElementById(month)
var day=document.getElementById(day)
var hour=document.getElementById(hour)
var minute=document.getElementById(minute)
var ampm=document.getElementById(ampm)
if(0<year.value){field.value=year.value+"-"+month.value+"-"+day.value+" "+hour.value+":"+minute.value
if(ampm&&ampm.value)
field.value=field.value+" "+ampm.value}
else{field.value=''
month.options[0].selected=1
day.options[0].selected=1
hour.options[0].selected=1
minute.options[0].selected=1
if(ampm&&ampm.options)
ampm.options[0].selected=1}}


/* - calendarpopup.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/calendarpopup.js?original=1
function showDay(date){document.getElementById('day'+date).style.visibility='visible';return true}
function hideDay(date){document.getElementById('day'+date).style.visibility='hidden';return true}


/* - ie5fixes.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/ie5fixes.js?original=1
function hackPush(el){this[this.length]=el}
function hackPop(){var N=this.length-1,el=this[N];this.length=N
return el}
function hackShift(){var one=this[0],N=this.length;for(var i=1;i<N;i++){this[i-1]=this[i]}
this.length=N-1
return one}
var testPushPop=new Array();if(testPushPop.push){}else{Array.prototype.push=hackPush
Array.prototype.pop=hackPop
Array.prototype.shift=hackShift}


/* - sarissa.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/sarissa.js?original=1
function Sarissa(){};Sarissa.VERSION="${project.version}";Sarissa.PARSED_OK="Document contains no parsing errors";Sarissa.PARSED_EMPTY="Document is empty";Sarissa.PARSED_UNKNOWN_ERROR="Not well-formed or other error";Sarissa.IS_ENABLED_TRANSFORM_NODE=false;var _sarissa_iNsCounter=0;var _SARISSA_IEPREFIX4XSLPARAM="";var _SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation&&true;var _SARISSA_HAS_DOM_CREATE_DOCUMENT=_SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument;var _SARISSA_HAS_DOM_FEATURE=_SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature;var _SARISSA_IS_MOZ=_SARISSA_HAS_DOM_CREATE_DOCUMENT&&_SARISSA_HAS_DOM_FEATURE;var _SARISSA_IS_SAFARI=navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1;var _SARISSA_IS_SAFARI_OLD=_SARISSA_IS_SAFARI&&parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1])<420;var _SARISSA_IS_IE=document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;var _SARISSA_IS_OPERA=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;if(!window.Node||!Node.ELEMENT_NODE){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}};if(_SARISSA_IS_SAFARI_OLD){HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;HTMLDocument=Document=document.constructor;var x=new DOMParser();XMLDocument=x.constructor;Element=x.parseFromString("<Single />","text/xml").documentElement.constructor;x=null}
if(typeof XMLDocument=="undefined"&&typeof Document!="undefined"){XMLDocument=Document}
if(_SARISSA_IS_IE){_SARISSA_IEPREFIX4XSLPARAM="xsl:";var _SARISSA_DOM_PROGID="";var _SARISSA_XMLHTTP_PROGID="";var _SARISSA_DOM_XMLWRITER="";Sarissa.pickRecentProgID=function(idList){var bFound=false,e;for(var i=0;i<idList.length&&!bFound;i++){try{var oDoc=new ActiveXObject(idList[i]);var o2Store=idList[i];bFound=true}catch(objException){e=objException}};if(!bFound){throw "Could not retrieve a valid progID of Class: "+idList[idList.length-1]+". (original exception: "+e+")"};idList=null;return o2Store};_SARISSA_DOM_PROGID=null;_SARISSA_THREADEDDOM_PROGID=null;_SARISSA_XSLTEMPLATE_PROGID=null;_SARISSA_XMLHTTP_PROGID=null;if(!window.XMLHttpRequest){XMLHttpRequest=function(){if(!_SARISSA_XMLHTTP_PROGID){_SARISSA_XMLHTTP_PROGID=Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"])};return new ActiveXObject(_SARISSA_XMLHTTP_PROGID)}};Sarissa.getDomDocument=function(sUri,sName){if(!_SARISSA_DOM_PROGID){_SARISSA_DOM_PROGID=Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"])};var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(sName){var prefix="";if(sUri){if(sName.indexOf(":")>1){prefix=sName.substring(0,sName.indexOf(":"));sName=sName.substring(sName.indexOf(":")+1)}else{prefix="a"+(_sarissa_iNsCounter++)}};if(sUri){oDoc.loadXML('<'+prefix+':'+sName+" xmlns:"+prefix+"=\""+sUri+"\""+" />")} else{oDoc.loadXML('<'+sName+" />")}};return oDoc};Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if(oDoc&&oDoc.parseError&&oDoc.parseError.errorCode&&oDoc.parseError.errorCode!=0){parseErrorText="XML Parsing Error: "+oDoc.parseError.reason+"\nLocation: "+oDoc.parseError.url+"\nLine Number "+oDoc.parseError.line+", Column "+oDoc.parseError.linepos+":\n"+oDoc.parseError.srcText+"\n";for(var i=0;i<oDoc.parseError.linepos;i++){parseErrorText+="-"};parseErrorText+="^\n"}
else if(oDoc.documentElement==null){parseErrorText=Sarissa.PARSED_EMPTY};return parseErrorText};Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc.setProperty("SelectionLanguage","XPath");oDoc.setProperty("SelectionNamespaces",sNsSet)};XSLTProcessor=function(){if(!_SARISSA_XSLTEMPLATE_PROGID){_SARISSA_XSLTEMPLATE_PROGID=Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0","MSXML2.XSLTemplate.3.0"])};this.template=new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);this.processor=null};XSLTProcessor.prototype.importStylesheet=function(xslDoc){if(!_SARISSA_THREADEDDOM_PROGID){_SARISSA_THREADEDDOM_PROGID=Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0","MSXML2.FreeThreadedDOMDocument.3.0"])};xslDoc.setProperty("SelectionLanguage","XPath");xslDoc.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var converted=new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);try{converted.resolveExternals=true;converted.setProperty("AllowDocumentFunction",true)}
catch(e){};if(xslDoc.url&&xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']")!=null){converted.async=false;converted.load(xslDoc.url)} else{converted.loadXML(xslDoc.xml)};converted.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var output=converted.selectSingleNode("//xsl:output");this.outputMethod=output?output.getAttribute("method"):"html";this.template.stylesheet=converted;this.processor=this.template.createProcessor();this.paramsSet=[]};XSLTProcessor.prototype.transformToDocument=function(sourceDoc){if(_SARISSA_THREADEDDOM_PROGID){this.processor.input=sourceDoc;var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);this.processor.output=outDoc;this.processor.transform();return outDoc}
else{if(!_SARISSA_DOM_XMLWRITER){_SARISSA_DOM_XMLWRITER=Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0","Msxml2.MXXMLWriter.3.0","MSXML2.MXXMLWriter","MSXML.MXXMLWriter","Microsoft.XMLDOM"])};this.processor.input=sourceDoc;var outDoc=new ActiveXObject(_SARISSA_DOM_XMLWRITER);this.processor.output=outDoc;this.processor.transform();var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);oDoc.loadXML(outDoc.output+"");return oDoc}};XSLTProcessor.prototype.transformToFragment=function(sourceDoc,ownerDoc){this.processor.input=sourceDoc;this.processor.transform();var s=this.processor.output;var f=ownerDoc.createDocumentFragment();if(this.outputMethod=='text'){f.appendChild(ownerDoc.createTextNode(s))} else if(ownerDoc.body&&ownerDoc.body.innerHTML){var container=ownerDoc.createElement('div');container.innerHTML=s;while(container.hasChildNodes()){f.appendChild(container.firstChild)}}
else{var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(s.substring(0,5)=='<?xml'){s=s.substring(s.indexOf('?>')+2)}
var xml=''.concat('<my>',s,'</my>');oDoc.loadXML(xml);var container=oDoc.documentElement;while(container.hasChildNodes()){f.appendChild(container.firstChild)}}
return f};XSLTProcessor.prototype.setParameter=function(nsURI,name,value){value=value?value:"";if(nsURI){this.processor.addParameter(name,value,nsURI)}else{this.processor.addParameter(name,value)};nsURI=""+(nsURI||"");if(!this.paramsSet[nsURI]){this.paramsSet[nsURI]=new Array()};this.paramsSet[nsURI][name]=value};XSLTProcessor.prototype.getParameter=function(nsURI,name){nsURI=""+(nsURI||"");if(this.paramsSet[nsURI]&&this.paramsSet[nsURI][name]){return this.paramsSet[nsURI][name]}else{return null}};XSLTProcessor.prototype.clearParameters=function(){for(var nsURI in this.paramsSet){for(var name in this.paramsSet[nsURI]){if(nsURI!=""){this.processor.addParameter(name,"",nsURI)}else{this.processor.addParameter(name,"")}}};this.paramsSet=new Array()}}else{if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){Sarissa.__handleLoad__=function(oDoc){Sarissa.__setReadyState__(oDoc,4)};_sarissa_XMLDocument_onload=function(){Sarissa.__handleLoad__(this)};Sarissa.__setReadyState__=function(oDoc,iReadyState){oDoc.readyState=iReadyState;oDoc.readystate=iReadyState;if(oDoc.onreadystatechange!=null&&typeof oDoc.onreadystatechange=="function"){oDoc.onreadystatechange()}};Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(!oDoc.onreadystatechange){oDoc.onreadystatechange=null};if(!oDoc.readyState){oDoc.readyState=0};oDoc.addEventListener("load",_sarissa_XMLDocument_onload,false);return oDoc};if(window.XMLDocument){}
else if(_SARISSA_HAS_DOM_FEATURE&&window.Document&&!Document.prototype.load&&document.implementation.hasFeature('LS','3.0')){Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);return oDoc}}
else{Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(oDoc&&(sUri||sName)&&!oDoc.documentElement){oDoc.appendChild(oDoc.createElementNS(sUri,sName))};return oDoc}}}};if(!window.DOMParser){if(_SARISSA_IS_SAFARI){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(sXml),false);xmlhttp.send(null);return xmlhttp.responseXML}}else if(Sarissa.getDomDocument&&Sarissa.getDomDocument()&&Sarissa.getDomDocument(null,"bar").xml){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var doc=Sarissa.getDomDocument();doc.loadXML(sXml);return doc}}};if((typeof(document.importNode)=="undefined")&&_SARISSA_IS_IE){try{document.importNode=function(oNode,bChildren){var tmp;if(oNode.nodeName=='#text'){return document.createTextNode(oNode.data)}
else{if(oNode.nodeName=="tbody"||oNode.nodeName=="tr"){tmp=document.createElement("table")}
else if(oNode.nodeName=="td"){tmp=document.createElement("tr")}
else if(oNode.nodeName=="option"){tmp=document.createElement("select")}
else{tmp=document.createElement("div")};if(bChildren){tmp.innerHTML=oNode.xml?oNode.xml:oNode.outerHTML}else{tmp.innerHTML=oNode.xml?oNode.cloneNode(false).xml:oNode.cloneNode(false).outerHTML};return tmp.getElementsByTagName("*")[0]}}}catch(e){}};if(!Sarissa.getParseErrorText){Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if(!oDoc.documentElement){parseErrorText=Sarissa.PARSED_EMPTY} else if(oDoc.documentElement.tagName=="parsererror"){parseErrorText=oDoc.documentElement.firstChild.data;parseErrorText+="\n"+oDoc.documentElement.firstChild.nextSibling.firstChild.data} else if(oDoc.getElementsByTagName("parsererror").length>0){var parsererror=oDoc.getElementsByTagName("parsererror")[0];parseErrorText=Sarissa.getText(parsererror,true)+"\n"} else if(oDoc.parseError&&oDoc.parseError.errorCode!=0){parseErrorText=Sarissa.PARSED_UNKNOWN_ERROR};return parseErrorText}};Sarissa.getText=function(oNode,deep){var s="";var nodes=oNode.childNodes;for(var i=0;i<nodes.length;i++){var node=nodes[i];var nodeType=node.nodeType;if(nodeType==Node.TEXT_NODE||nodeType==Node.CDATA_SECTION_NODE){s+=node.data} else if(deep==true&&(nodeType==Node.ELEMENT_NODE||nodeType==Node.DOCUMENT_NODE||nodeType==Node.DOCUMENT_FRAGMENT_NODE)){s+=Sarissa.getText(node,true)}};return s};if(!window.XMLSerializer&&Sarissa.getDomDocument&&Sarissa.getDomDocument("","foo",null).xml){XMLSerializer=function(){};XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml}};Sarissa.stripTags=function(s){return s.replace(/<[^>]+>/g,"")};Sarissa.clearChildNodes=function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild)}};Sarissa.copyChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if(_SARISSA_IS_SAFARI&&nodeTo.nodeType==Node.DOCUMENT_NODE){nodeTo=nodeTo.documentElement}
if((!nodeFrom)||(!nodeTo)){throw "Both source and destination nodes must be provided"};if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo)};var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var nodes=nodeFrom.childNodes;if(typeof(ownerDoc.importNode)!="undefined"){for(var i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true))}} else{for(var i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true))}}};Sarissa.moveChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if((!nodeFrom)||(!nodeTo)){throw "Both source and destination nodes must be provided"};if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo)};var nodes=nodeFrom.childNodes;if(nodeFrom.ownerDocument==nodeTo.ownerDocument){while(nodeFrom.firstChild){nodeTo.appendChild(nodeFrom.firstChild)}} else{var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;if(typeof(ownerDoc.importNode)!="undefined"){for(var i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true))}}else{for(var i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true))}};Sarissa.clearChildNodes(nodeFrom)}};Sarissa.xmlize=function(anyObject,objectName,indentSpace){indentSpace=indentSpace?indentSpace:'';var s=indentSpace+'<'+objectName+'>';var isLeaf=false;if(!(anyObject instanceof Object)||anyObject instanceof Number||anyObject instanceof String||anyObject instanceof Boolean||anyObject instanceof Date){s+=Sarissa.escape(""+anyObject);isLeaf=true}else{s+="\n";var isArrayItem=anyObject instanceof Array;for(var name in anyObject){s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+"   ")};s+=indentSpace};return(s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n"))};Sarissa.escape=function(sXml){return sXml.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g, "&quot;").replace(/'/g,"&apos;")};Sarissa.unescape=function(sXml){return sXml.replace(/&apos;/g,"'").replace(/&quot;/g,"\"").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")};

/* - login.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/login.js?original=1
function cookiesEnabled(){var c="areYourCookiesEnabled=0";document.cookie=c;var dc=document.cookie;if(dc.indexOf(c)==-1) return 0;c="areYourCookiesEnabled=1";document.cookie=c;dc=document.cookie;if(dc.indexOf(c)==-1) return 0;document.cookie="areYourCookiesEnabled=; expires=Thu, 01-Jan-70 00:00:01 GMT";return 1}
function setLoginVars(user_name_id,alt_user_name_id,password_id,empty_password_id,js_enabled_id,cookies_enabled_id){if(js_enabled_id){el=document.getElementById(js_enabled_id);if(el){el.value=1}}
if(cookies_enabled_id){el=document.getElementById(cookies_enabled_id);if(el){el.value=cookiesEnabled()}}
if(user_name_id&&alt_user_name_id){user_name=document.getElementById(user_name_id)
alt_user_name=document.getElementById(alt_user_name_id)
if(user_name&&alt_user_name){alt_user_name.value=user_name.value}}
if(password_id&&empty_password_id){password=document.getElementById(password_id)
empty_password=document.getElementById(empty_password_id)
if(password&&empty_password){if(password.value.length==0){empty_password.value='1'} else{empty_password.value='0'}}}
return 1}
function showCookieMessage(msg_id){msg=document.getElementById(msg_id)
if(msg){if(cookiesEnabled()){msg.style.display='none'} else{msg.style.display='block'}}}
function showEnableCookiesMessage(){showCookieMessage('enable_cookies_message')}
registerPloneFunction(showEnableCookiesMessage);

/* - formsubmithelpers.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/formsubmithelpers.js?original=1
function inputSubmitOnClick(event){if(!event) var event=window.event;if(hasClassName(this,'submitting')){return confirm(window.form_resubmit_message)} else{addClassName(this,'submitting')}
return true}
function registerSubmitHandler(){var nodes=cssQuery('input[type=submit]');for(var i=0;i<nodes.length;i++){var node=nodes[i];if(!node.onclick){node.onclick=inputSubmitOnClick}}}
registerPloneFunction(registerSubmitHandler);

/* - kupunoi18n.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupunoi18n.js?original=1
window._=function(msgid,interpolations){if(interpolations){for(var id in interpolations){var value=interpolations[id];var reg=new RegExp('\\\$\\\{'+id+'\\\}','g');msgid=msgid.replace(reg,""+value)}};return msgid};

/* - sarissa_ieemu_xpath.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/sarissa_ieemu_xpath.js?original=1
if(_SARISSA_HAS_DOM_FEATURE&&document.implementation.hasFeature("XPath","3.0")){
function SarissaNodeList(i){this.length=i};SarissaNodeList.prototype.item=function(i){return(i<0||i>=this.length)?null:this[i]};SarissaNodeList.prototype.expr="";if(window.XMLDocument&&(!XMLDocument.prototype.setProperty)){XMLDocument.prototype.setProperty=function(x,y){}};Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc._sarissa_useCustomResolver=true;var namespaces=sNsSet.indexOf(" ")>-1?sNsSet.split(" "):[sNsSet];oDoc._sarissa_xpathNamespaces=[namespaces.length];for(var i=0;i<namespaces.length;i++){var ns=namespaces[i];var colonPos=ns.indexOf(":");var assignPos=ns.indexOf("=");if(colonPos>0&&assignPos>colonPos+1){var prefix=ns.substring(colonPos+1,assignPos);var uri=ns.substring(assignPos+2,ns.length-1);oDoc._sarissa_xpathNamespaces[prefix]=uri}else{throw "Bad format on namespace declaration(s) given"}}};XMLDocument.prototype._sarissa_useCustomResolver=false;XMLDocument.prototype._sarissa_xpathNamespaces=[];XMLDocument.prototype.selectNodes=function(sExpr,contextNode,returnSingle){var nsDoc=this;var nsresolver=this._sarissa_useCustomResolver?
function(prefix){var s=nsDoc._sarissa_xpathNamespaces[prefix];if(s)return s;else throw "No namespace URI found for prefix: '" + prefix+"'"}:this.createNSResolver(this.documentElement);var result=null;if(!returnSingle){var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new SarissaNodeList(oResult.snapshotLength);nodeList.expr=sExpr;for(var i=0;i<nodeList.length;i++){nodeList[i]=oResult.snapshotItem(i)}
result=nodeList}
else{result=oResult=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue};return result};Element.prototype.selectNodes=function(sExpr){var doc=this.ownerDocument;if(doc.selectNodes){return doc.selectNodes(sExpr,this)}
else{throw "Method selectNodes is only supported by XML Elements"}};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode){var ctx=contextNode?contextNode:null;return this.selectNodes(sExpr,ctx,true)};Element.prototype.selectSingleNode=function(sExpr){var doc=this.ownerDocument;if(doc.selectSingleNode){return doc.selectSingleNode(sExpr,this)} else{throw "Method selectNodes is only supported by XML Elements"}};Sarissa.IS_ENABLED_SELECT_NODES=true}

/* - kupuhelpers.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupuhelpers.js?original=1
function newDocumentElement(doc,tagName,args){if(_SARISSA_IS_IE){var attrs=[tagName];for(var a=1;a<args.length;a++){var arg=args[a];if(arg.length===undefined){for(var attr in arg){var val=arg[attr];if(val===true) val=attr;if(val===false) continue;if(attr=='className') attr='class';attrs.push(attr+'="'+val.replace(/"/,'&quot;')+'"')}}};tagName="<"+attrs.join(' ')+"></"+tagName+">"}
var node=doc.createElement(tagName);for(var a=1;a<args.length;a++){var arg=args[a];if(arg.length===undefined){if(!_SARISSA_IS_IE){for(var attr in arg){if (/^on/.test(attr)){node.setAttribute(attr,arg[attr])} else{node[attr]=arg[attr]}}}} else{for(var i=0;i<arg.length;i++){if(typeof(arg[i])=='string'){node.appendChild(doc.createTextNode(arg[i]))} else{node.appendChild(arg[i])}}}}
return node}
function newElement(tagName){return newDocumentElement(document,tagName,arguments)}
function addEventHandler(element,event,method,context){var wrappedmethod=new ContextFixer(method,context);var args=[null,null];for(var i=4;i<arguments.length;i++){args.push(arguments[i])};wrappedmethod.args=args;try{if(element.addEventListener){element.addEventListener(event,wrappedmethod.execute,false)} else if(element.attachEvent){element.attachEvent("on"+event,wrappedmethod.execute)} else{throw _("Unsupported browser!")};return wrappedmethod.execute} catch(e){var msg=_('exception ${message} while registering an event handler '+'for element ${element}, event ${event}, method ${method}, ',{'message':e.message,'element':element,'event':event,'method':method});if(e.stack){msg+=_('\r\ntraceback:\r\n${traceback}',{'traceback':e.stack})};alert(msg)}};
function removeEventHandler(element,event,method){if(element.removeEventListener){element.removeEventListener(event,method,false)} else if(element.detachEvent){element.detachEvent("on"+event,method)} else{throw _("Unsupported browser!")}};
function getFromSelector(selector){var match=/#(\S+)\s*([^ .]+)\.(\S+)/.exec(selector);if(!match){return window.document.getElementById(selector)}
var id=match[1],tag=match[2],className=match[3];var base=window.document.getElementById(id);return getBaseTagClass(base,tag,className)}
function getBaseTagClass(base,tag,className){var classPat=new RegExp('\\b'+className+'\\b');var nodes=base.getElementsByTagName(tag);for(var i=0;i<nodes.length;i++){if(classPat.test(nodes[i].className)){return nodes[i]}}
return null}
function openPopup(url,width,height,properties){var allprops='width='+width+',height='+height;if(properties){allprops+=','+properties};var win=window.open(url,'someWindow',allprops);return win};
function selectSelectItem(select,item){for(var i=0;i<select.options.length;i++){var option=select.options[i];if(option.value==item){select.selectedIndex=i;return}}
select.selectedIndex=0};
function parentWithStyleChecker(tagnames,style,stylevalue,command){return function(selNode,button,editor,event){if(command){var result=editor.getInnerDocument().queryCommandState(command);if(result||editor.getSelection().getContentLength()==0){return result}};var currnode=selNode;while(currnode&&currnode.style){for(var i=0;i<tagnames.length;i++){if(currnode.nodeName.toLowerCase()==tagnames[i].toLowerCase()){return true}};if(style&&currnode.style[style]==stylevalue){return true};currnode=currnode.parentNode};return false}};
function _load_dict_helper(element){var dict={};for(var i=0;i<element.childNodes.length;i++){var child=element.childNodes[i];if(child.nodeType==1){var value='';for(var j=0;j<child.childNodes.length;j++){if(child.childNodes[j].nodeType==1){value=_load_dict_helper(child);break} else if(typeof(value)==typeof('')){value+=child.childNodes[j].nodeValue}};if(typeof(value)==typeof('')&&!isNaN(parseInt(value))&&parseInt(value).toString().length==value.length){value=parseInt(value)} else if(typeof(value)!=typeof('')){if(value.length==1){value=value[0]}};var name=child.nodeName.toLowerCase();var attr=child.attributes[0];if(attr&&!(/^([^_]|_moz)/.test(attr.name))){name+=attr.name.toLowerCase()}
if(dict[name]!=undefined){if(!dict[name].push){dict[name]=[dict[name],value]} else{dict[name].push(value)}} else{dict[name]=value}}};return dict};
function loadDictFromXML(document,islandid){var dict={};var confnode=getFromSelector(islandid);var root=null;for(var i=0;i<confnode.childNodes.length;i++){if(confnode.childNodes[i].nodeType==1){root=confnode.childNodes[i];break}};if(!root){throw(_('No element found in the config island!'))};dict=_load_dict_helper(root);return dict};
function NodeIterator(node,continueatnextsibling){this.node=node;this.current=node;this.terminator=continueatnextsibling?null:node;this.next=function(){if(this.current===false){this.current=this.node};var current=this.current;if(current.firstChild){this.current=current.firstChild} else{while(current!==this.terminator&&!current.nextSibling){current=current.parentNode};if(current===this.terminator){this.current=false} else{this.current=current.nextSibling}};return this.current};this.reset=function(){this.current=this.node};this.setCurrent=function(node){this.current=node}};
function BaseSelection(){this.splitNodeAtSelection=function(node){if(!this.selectionInsideNode(node)){throw(_('Selection not inside the node!'))};var doc=this.document.getDocument();var br=doc.createElement('br');br.setAttribute('node_splitter','indeed');this.replaceWithNode(br);var clone=node.cloneNode(true);var iterator=new NodeIterator(node);var currnode=iterator.next();var remove=false;while(currnode){if(currnode.nodeName.toLowerCase()=='br'&&currnode.getAttribute('node_splitter')=='indeed'){remove=true};var lastnode=currnode;currnode=iterator.next();if(remove&&(lastnode.nodeType==3||!lastnode.hasChildNodes())){lastnode.parentNode.removeChild(lastnode)}};var iterator=new NodeIterator(clone);var currnode=iterator.next();var remove=true;while(currnode){var lastnode=currnode;currnode=iterator.next();if(lastnode.nodeName.toLowerCase()=='br'&&lastnode.getAttribute('node_splitter')=='indeed'){lastnode.parentNode.removeChild(lastnode);remove=false};if(remove&&(lastnode.nodeType==3||!lastnode.hasChildNodes())){lastnode.parentNode.removeChild(lastnode)}};if(node.nextSibling){node.parentNode.insertBefore(clone,node.nextSibling)} else{node.parentNode.appendChild(clone)};this.reset();return clone};this.selectionInsideNode=function(node){var currnode=this.parentElement();while(currnode){if(currnode==node){return true};currnode=currnode.parentNode};return false}};
function MozillaSelection(document){var win=document.getWindow();this.document=document;this.selection=win.getSelection();this._createRange=function(){return this.document.getDocument().createRange()};this.selectNodeContents=function(node){if(node&&node.parentNode){var sel=this.selection;sel.removeAllRanges();if(sel.selectAllChildren){sel.selectAllChildren(node)} else{var range=this._createRange();try{range.selectNode(node)} catch(e){range.selectNodeContents(node)};sel.addRange(range)}}};this.collapse=function(collapseToEnd){try{if(!collapseToEnd){this.selection.collapseToStart()} else{this.selection.collapseToEnd()}} catch(e){}};this.replaceWithNode=function(node,selectAfterPlace){var range=this.selection.getRangeAt(0);this.selection.removeAllRanges();range.deleteContents();var container=range.startContainer;var pos=range.startOffset;var range=this._createRange();if(container.nodeType==3&&node.nodeType==3){container.insertData(pos,node.nodeValue);range.setEnd(container,pos+node.length);range.setStart(container,pos+node.length)} else{var afterNode;if(container.nodeType==3){var textNode=container;var container=textNode.parentNode;var text=textNode.nodeValue;var textBefore=text.substr(0,pos);var textAfter=text.substr(pos);var beforeNode=this.document.getDocument().createTextNode(textBefore);afterNode=this.document.getDocument().createTextNode(textAfter);container.insertBefore(afterNode,textNode);container.insertBefore(node,afterNode);container.insertBefore(beforeNode,node);container.removeChild(textNode)} else{afterNode=container.childNodes[pos];if(afterNode){container.insertBefore(node,afterNode)} else{container.appendChild(node);afterNode=container.nextSibling}}
range.setEndAfter(node);range.collapse(false)}
if(selectAfterPlace){this.selection=win.getSelection();this.selection.addRange(range);if(selectAfterPlace.nodeType==1){this.selection.selectAllChildren(selectAfterPlace)} else{if(node.hasChildNodes()){this.selection.selectAllChildren(node)} else{var range=this.selection.getRangeAt(0).cloneRange();this.selection.removeAllRanges();range.selectNode(node);this.selection.addRange(range)}};win.focus()};return node};this.startOffset=function(){var startnode=this.startNode();var startnodeoffset=0;if(startnode==this.selection.anchorNode){startnodeoffset=this.selection.anchorOffset} else{startnodeoffset=this.selection.focusOffset};var parentnode=this.parentElement();if(startnode==parentnode){return startnodeoffset};var currnode=parentnode.firstChild;var offset=0;if(!currnode){if(startnodeoffset!=0){throw(_('Start node offset detected in a node without children!'))};return 0};while(currnode!=startnode){if(currnode.nodeType==3){offset+=currnode.nodeValue.length};while(!currnode.nextSibling){currnode=currnode.parentNode};currnode=currnode.nextSibling};return offset+startnodeoffset};this.startNode=function(){var anode=this.selection.anchorNode;var aoffset=this.selection.anchorOffset;var onode=this.selection.focusNode;var ooffset=this.selection.focusOffset;var arange=this._createRange();arange.setStart(anode,aoffset);var orange=this._createRange();orange.setStart(onode,ooffset);return arange.compareBoundaryPoints('START_TO_START',orange)<=0?anode:onode};this.endOffset=function(){var endnode=this.endNode();var endnodeoffset=0;if(endnode==this.selection.focusNode){endnodeoffset=this.selection.focusOffset} else{endnodeoffset=this.selection.anchorOffset};var parentnode=this.parentElement();var currnode=parentnode.firstChild;var offset=0;if(parentnode==endnode){for(var i=0;i<parentnode.childNodes.length;i++){var child=parentnode.childNodes[i];if(i==endnodeoffset){return offset};if(child.nodeType==3){offset+=child.nodeValue.length}}};if(!currnode){if(endnodeoffset!=0){var msg=_('End node offset detected in a node without '+'children!');alert(msg);throw(msg)};return 0};while(currnode&&currnode!=endnode){if(currnode.nodeType==3){offset+=currnode.nodeValue.length};currnode=currnode.nextSibling};return offset+endnodeoffset};this.endNode=function(){var anode=this.selection.anchorNode;var aoffset=this.selection.anchorOffset;var onode=this.selection.focusNode;var ooffset=this.selection.focusOffset;var arange=this._createRange();arange.setStart(anode,aoffset);var orange=this._createRange();orange.setStart(onode,ooffset);return arange.compareBoundaryPoints('START_TO_START',orange)>0?anode:onode};this.getContentLength=function(){return this.selection.toString().length};this.cutChunk=function(startOffset,endOffset){var range=this.selection.getRangeAt(0);var offsetParent=this.parentElement();var currnode=offsetParent.firstChild;var curroffset=0;var startparent=null;var startparentoffset=0;while(currnode){if(currnode.nodeType==3){var nodelength=currnode.nodeValue.length;if(curroffset+nodelength<startOffset){curroffset+=nodelength} else{startparent=currnode;startparentoffset=startOffset-curroffset;break}};currnode=currnode.nextSibling};var currnode=offsetParent.firstChild;var curroffset=0;var endparent=null;var endparentoffset=0;while(currnode){if(currnode.nodeType==3){var nodelength=currnode.nodeValue.length;if(curroffset+nodelength<endOffset){curroffset+=nodelength} else{endparent=currnode;endparentoffset=endOffset-curroffset;break}};currnode=currnode.nextSibling};if(!startparent){throw(_('Start offset out of range!'))};if(!endparent){throw(_('End offset out of range!'))};var newrange=range.cloneRange();newrange.setStart(startparent,startparentoffset);newrange.setEnd(endparent,endparentoffset);return newrange.extractContents()};this.getElementLength=function(element){var length=0;var currnode=element.firstChild;while(currnode){if(currnode.nodeType==3){length+=currnode.nodeValue.length};currnode=currnode.nextSibling};return length};this.parentElement=function(allowmulti){if(this.selection.rangeCount==0){var parent=this.document.getDocument().body;while(parent.firstChild){parent=parent.firstChild}} else{var range=this.selection.getRangeAt(0);var parent=this.parentElementOfRange(range);if(allowmulti){var numRanges=this.selection.rangeCount;for(var i=1;i<numRanges;i=i+1){var parent1=parent;var parent2=null;var range1=this._createRange();var range2=this._createRange();var parent2=this.parentElementOfRange(this.selection.getRangeAt(i));range1.selectNode(parent1);range2.selectNode(parent2);if(range1.compareBoundaryPoints(Range.START_TO_START,range2)<=0&&range1.compareBoundaryPoints(Range.END_TO_END,range2)>=0){parent=parent1} else if(range1.compareBoundaryPoints(Range.START_TO_START,range2)>=0&&range1.compareBoundaryPoints(Range.END_TO_END,range2)<=0){parent=parent2} else if(range1.compareBoundaryPoints(Range.START_TO_END,range2)<=0){var coverRange=this._createRange();coverRange.setStartBefore(parent1);coverRange.setEndAfter(parent2);parent=coverRange.commonAncestorContainer} else{var coverRange=this._createRange();coverRange.setStartBefore(parent2);coverRange.setEndAfter(parent1);parent=coverRange.commonAncestorContainer}}}};if(parent.nodeType==Node.TEXT_NODE){parent=parent.parentNode};return parent};this.parentElementOfRange=function(range){if(range.compareBoundaryPoints(Range.START_TO_END,range)<0){var startNode=range.endContainer;var startOffset=range.endOffset;var endNode=range.startContainer;var endOffset=range.startOffset;range.setStart(startNode,startOffset);range.setEnd(endNode,endOffset)}
var parent=range.commonAncestorContainer;var inv=range.compareBoundaryPoints(Range.START_TO_END,range)<0;var startNode=inv?range.endContainer:range.startContainer;var startOffset=inv?range.endOffset:range.startOffset;var endNode=inv?range.startContainer:range.endContainer;var endOffset=inv?range.startOffset:range.endOffset;var selectedChild=null;var child=parent.firstChild;while(child){if(range.intersectsNode(child)&&!(child==startNode&&startOffset==child.length)&&!(child==endNode&&endOffset==0)){if(selectedChild){selectedChild=null;break} else{selectedChild=child}} else if(selectedChild){break};child=child.nextSibling};if(selectedChild){parent=selectedChild};if(parent.nodeType==Node.TEXT_NODE){parent=parent.parentNode};return parent};this.getSelectedNode=this.parentElement;this.moveStart=function(offset){var offsetparent=this.parentElement();var startoffset=this.startOffset();var realoffset=offset+startoffset;if(realoffset>=0){var currnode=offsetparent.firstChild;var curroffset=0;while(currnode){if(currnode.nodeType==3){var nodelength=currnode.nodeValue.length;if(curroffset+nodelength>=realoffset){var range=this.selection.getRangeAt(0);range.setStart(currnode,realoffset-curroffset);return}};currnode=currnode.nextSibling};var currnode=offsetparent.nextSibling;while(currnode){if(currnode.nodeType==3){var nodelength=currnode.nodeValue.length;if(curroffset+nodelength>=realoffset){var range=this.selection.getRangeAt(0);var endnode=this.endNode();var endoffset=this.endOffset();range.setEnd(currnode,realoffset-curroffset);range.setStart(endnode,endoffset);return};curroffset+=nodelength};currnode=currnode.nextSibling};throw(_('Offset out of document range'))} else if(realoffset<0){var currnode=offsetparent.prevSibling;var curroffset=0;while(currnode){if(currnode.nodeType==3){var currlength=currnode.nodeValue.length;if(curroffset-currlength<realoffset){var range=this.selection.getRangeAt(0);range.setStart(currnode,realoffset-curroffset)};curroffset-=currlength};currnode=currnode.prevSibling}} else{var range=this.selection.getRangeAt(0);range.setStart(offsetparent,0)}};this.moveEnd=function(offset){};this.reset=function(){this.selection=win.getSelection()};this.cloneContents=function(){var range=this.selection.getRangeAt(0);return range.cloneContents()};this.containsNode=function(node){var sel=this.selection;if(sel.containsNode){return sel.containsNode(node,true)} else{for(var i=0;i<sel.rangeCount;i++){if(sel.getRangeAt(i).containsNode(node)){return true}};return false}};this.toString=function(){return this.selection.toString()};this.getRange=function(){if(this.selection){return this.selection.getRangeAt(0)}};this.restoreRange=function(range){var selection=this.selection;if(selection){selection.removeAllRanges();selection.addRange(range)}};if(!win.Range.prototype.intersectsNode){win.Range.prototype.intersectsNode=function(node){var nodeRange=node.ownerDocument.createRange();try{nodeRange.selectNode(node)} catch(e){nodeRange.selectNodeContents(node)};return this.compareBoundaryPoints(Range.END_TO_START,nodeRange)==-1&&this.compareBoundaryPoints(Range.START_TO_END,nodeRange)==1}};this.intersectsNode=function(node){for(var i=0;i<this.selection.rangeCount;i++){if(this.selection.getRangeAt(i).intersectsNode(node)){return true}};return false};if(!win.Range.prototype.containsNode){win.Range.prototype.containsNode=function(node){var nodeRange=node.ownerDocument.createRange();try{nodeRange.selectNode(node)} catch(e){nodeRange.selectNodeContents(node)};return this.compareBoundaryPoints(Range.START_TO_START,nodeRange)!=-1&&this.compareBoundaryPoints(Range.END_TO_END,nodeRange)!=1}}};MozillaSelection.prototype=new BaseSelection;
function IESelection(document){this.document=document;this.selection=document.getDocument().selection;var doc=document.getDocument();var range=this.selection.createRange();var parent=this.selection.type=="Text"?range.parentElement():this.selection.type=="Control"?range.parentElement:null;if(parent&&parent.ownerDocument!=doc){var range=doc.body.createTextRange();range.collapse();range.select();this.reset()}
this.selectNodeContents=function(node){var range=doc.body.createTextRange();range.moveToElementText(node);range.moveStart('character',1);range.moveStart('character',-1);range.moveEnd('character',-1);range.moveEnd('character',1);range.select();this.reset()};this.collapse=function(collapseToEnd){var range=this.selection.createRange();range.collapse(!collapseToEnd);range.select();this.reset()};this.replaceWithNode=function(newnode,selectAfterPlace){if(this.selection.type=='Control'){var range=this.selection.createRange();range.item(0).parentNode.replaceChild(newnode,range.item(0));for(var i=1;i<range.length;i++){range.item(i).parentNode.removeChild(range[i])};if(selectAfterPlace){var range=this.document.getDocument().body.createTextRange();range.moveToElementText(newnode);range.select()}} else{var document=this.document.getDocument();var range=this.selection.createRange();range.pasteHTML('<img id="kupu-tempnode">');var tempnode=document.getElementById('kupu-tempnode');tempnode.replaceNode(newnode);if(selectAfterPlace){if(selectAfterPlace.nodeType==Node.ELEMENT_NODE){range.moveToElementText(selectAfterPlace)} else{range.moveToElementText(newnode)};range.select()}};this.reset();return newnode};this.startOffset=function(){var startoffset=0;var selrange=this.selection.createRange();var parent=selrange.parentElement();var elrange=selrange.duplicate();elrange.moveToElementText(parent);var tempstart=selrange.duplicate();while(elrange.compareEndPoints('StartToStart',tempstart)<0){startoffset++;tempstart.moveStart('character',-1)};return startoffset};this.endOffset=function(){var endoffset=0;var selrange=this.selection.createRange();var parent=selrange.parentElement();var elrange=selrange.duplicate();elrange.moveToElementText(parent);var tempend=selrange.duplicate();while(elrange.compareEndPoints('EndToEnd',tempend)>0){endoffset++;tempend.moveEnd('character',1)};return endoffset};this.getContentLength=function(){if(this.selection.type=='Control'){return this.selection.createRange().length};var contentlength=0;var range=this.selection.createRange();var endrange=range.duplicate();while(range.compareEndPoints('StartToEnd',endrange)<0){range.move('character',1);contentlength++};return contentlength};this.cutChunk=function(startOffset,endOffset){var range=this.selection.createRange().duplicate();range.moveStart('character',startOffset);range.moveEnd('character',-endOffset);range.pasteHTML('')};this.getElementLength=function(element){var length=0;var range=this.selection.createRange().duplicate();range.moveToElementText(element);range.moveStart('character',1);range.moveEnd('character',-1);var endpoint=range.duplicate();endpoint.collapse(false);range.collapse();while(!range.isEqual(endpoint)){range.moveEnd('character',1);range.moveStart('character',1);length++};return length};this.parentElement=function(allowmulti){if(this.selection.type=='Control'){return this.selection.createRange().item(0)} else{return this.selection.createRange().parentElement()}};this.getSelectedNode=this.parentElement;this.moveStart=function(offset){var range=this.selection.createRange();range.moveStart('character',offset);range.select();this.reset()};this.moveEnd=function(offset){var range=this.selection.createRange();range.moveEnd('character',offset);range.select();this.reset()};this.reset=function(){this.selection=this.document.getDocument().selection};this.cloneContents=function(){var contents=this.selection.createRange().htmlText;var doc=this.document.getDocument();var docfrag=doc.createElement('span');docfrag.innerHTML=contents;return docfrag};this.containsNode=function(node){var selected=this.selection.createRange();if(this.selection.type.toLowerCase()=='text'){var range=doc.body.createTextRange();range.moveToElementText(node);if(selected.compareEndPoints('StartToEnd',range)>=0||selected.compareEndPoints('EndToStart',range)<=0){return false}
return true} else{for(var i=0;i<selected.length;i++){if(selected.item(i).contains(node)){return true}}
return false}};this.getRange=function(){return this.selection.createRange()};this.restoreRange=function(range){try{range.select();this.reset()} catch(e){}};this.toString=function(){return this.selection.createRange().text};this.intersectsNode=function(node){var noderange=doc.body.createTextRange();noderange.moveToElementText(node);var selrange=this.selection.createRange();if((selrange.compareEndPoints('StartToStart',noderange)<=0&&selrange.compareEndPoints('EndToStart',noderange)>0)||(selrange.compareEndPoints('StartToStart',noderange)>0&&selrange.compareEndPoints('StartToEnd',noderange)<0)){return true}
return false}};IESelection.prototype=new BaseSelection;
function ContextFixer(func,context){this.func=func;this.context=context;this.args=arguments;var self=this;this.execute=function(){var args=[];for(var i=0;i<self.args.length-2;i++){args.push(self.args[i+2])};for(var i=0;i<arguments.length;i++){args.push(arguments[i])};return self.func.apply(self.context,args)}};
function Timer(){this.lastid=0;this.functions={};this.registerFunction=function(object,func,timeout){var args=[];for(var i=0;i<arguments.length-3;i++){args.push(arguments[i+3])}
var id=this._createUniqueId();this.functions[id]=[object,func,args];setTimeout("timer_instance._handleFunction("+id+")",timeout)};this._handleFunction=function(id){var obj=this.functions[id][0];var func=this.functions[id][1];var args=this.functions[id][2];this.functions[id]=null;func.apply(obj,args)};this._createUniqueId=function(){while(this.lastid in this.functions&&this.functions[this.lastid]){this.lastid++;if(this.lastid>100000){this.lastid=0}}
return this.lastid}};timer_instance=new Timer();Array.prototype.contains=function(element,objectequality){for(var i=0;i<this.length;i++){if(objectequality){if(element===this[i]){return true}} else{if(element==this[i]){return true}}};return false};Array.prototype.removeDoubles=function(){var ret=[];for(var i=0;i<this.length;i++){if(!ret.contains(this[i])){ret.push(this[i])}};return ret};Array.prototype.map=function(func){for(var i=0;i<this.length;i++){this[i]=func(this[i])}};Array.prototype.reversed=function(){var ret=[];for(var i=this.length;i>0;i--){ret.push(this[i-1])};return ret};String.prototype.strip=function(){var stripspace=/^\s*([\s\S]*?)\s*$/;return stripspace.exec(this)[1]};String.prototype.reduceWhitespace=function(){return this.replace(/\s+/g,' ')};String.prototype.truncate=function(len){if(this.length<=len){return this} else{var trimmed=this.substring(0,len+1).replace(/\s[^\s]*$/,'...');return trimmed}};String.prototype.entitize=function(){var ret=this.replace(/&/g,'&amp;');ret=ret.replace(/"/g,'&quot;');ret=ret.replace(/'/g, '&apos;');ret=ret.replace(/</g,'&lt;');ret=ret.replace(/>/g,'&gt;');return ret};String.prototype.deentitize=function(){var ret=this.replace(/&gt;/g,'>');ret=ret.replace(/&lt;/g,'<');ret=ret.replace(/&apos;/g,"'");ret=ret.replace(/&quot;/g,'"');ret=ret.replace(/&amp;/g,'&');return ret};String.prototype.urldecode=function(){var reg=/%([a-fA-F0-9]{2})/g;var str=this;while(true){var match=reg.exec(str);if(!match||!match.length){break};var repl=new RegExp(match[0],'g');str=str.replace(repl,String.fromCharCode(parseInt(match[1],16)))};return str};String.prototype.centerTruncate=function(maxlength){if(this.length<=maxlength){return this};var chunklength=maxlength/2-3;var start=this.substr(0,chunklength);var end=this.substr(this.length-chunklength);return start+' ... '+end};
function debug(str,win){if(!win){win=window};var doc=win.document;var div=doc.createElement('div');div.appendChild(doc.createTextNode(str));doc.getElementsByTagName('body')[0].appendChild(div)};
function Exception(){return};UpdateStateCancelBubble=new Exception();
function kupuFixImage(image){image.removeAttribute('width');image.removeAttribute('height');var width=image.naturalWidth||image.width;var height=image.naturalHeight||image.height;if(height>width){if(height>128){width=width * 128/height;height=128}} else{if(width>128){height=height * 128/width;width=128}};if(width&&height){image.height=height;image.width=width}}
function toggleAltFieldVisibility(me){var label=document.getElementById('image-alt-label');var vis=me.checked?'none':'';if(label){label.style.display=vis;var fld=document.getElementById(label.htmlFor);if(fld){fld.style.display=vis}}}
function getOuterHtml(node){var html='<';html+=node.nodeName.toLowerCase();var attrs=node.attributes;for(var a=0;a<attrs.length;a++){var att=attrs[a];if(att.specified){html+=' '+att.nodeName.toLowerCase()+'="'+att.nodeValue+'"'}}
html+='>';if(!(/hr|br|img|input/i.test(node.nodeName))){html+=node.innerHTML;html+='<\/'+node.nodeName.toLowerCase()+'>'}
return html}


/* - kupueditor.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupueditor.js?original=1
function KupuDocument(iframe){this.editable=iframe;this.window=this.editable.contentWindow;this.document=this.window.document;this._browser=_SARISSA_IS_IE?'IE':'Mozilla';var DEPRECATED={'contentReadOnly':'readonly','styleWithCSS':'useCSS'};this.execCommand=function(command,arg){if(arg===undefined) arg=null;try{this.document.execCommand(command,false,arg)} catch(e){command=DEPRECATED[command];if(command){this.document.execCommand(command,false,!arg)}}};this.reloadSource=function(){document.location=document.location};this.getDocument=function(){return this.document};this.getWindow=function(){return this.window};this.getSelection=function(){if(this._browser=='Mozilla'){return new MozillaSelection(this)} else{return new IESelection(this)}};this.getEditable=function(){return this.editable}};
function KupuEditor(document,config,logger){this.document=document;this.config=config;this.log=logger;this.tools={};this.filters=[];this.serializer=new XMLSerializer();this._designModeSetAttempts=0;this._initialized=false;this._wantDesignMode=false;this._previous_range=null;this.content_changed=false;this.initialize=function(){this._initializeEventHandlers();if(this.getBrowserName()=="IE"){var body=this.getInnerDocument().getElementsByTagName('body')[0];body.setAttribute('contentEditable','true');this._initialized=true;if(this.afterInit){this.afterInit()};this._saveSelection()} else{this._setDesignModeWhenReady()}};this.setContextMenu=function(menu){menu.initialize(this)};this.registerTool=function(id,tool){this.tools[id]=tool;tool.initialize(this)};this.getTool=function(id){return this.tools[id]};this.registerFilter=function(filter){this.filters.push(filter);filter.initialize(this)};this.updateStateHandler=function(event){var interesting_codes=[8,13,37,38,39,40,46];this._saveSelection();if(event.type=='click'||event.type=='mouseup'||(event.type=='keyup'&&interesting_codes.contains(event.keyCode))){this.updateState(event)}};this.updateState=function(event){var selNode=this.getSelectedNode();for(var id in this.tools){try{this.tools[id].updateState(selNode,event)} catch(e){if(e==UpdateStateCancelBubble){this.updateState(event);break} else{this.logMessage('Exception while processing updateState on '+'${id}: ${msg}',{'id':id,'msg':e},2)}}}};this.saveDocument=function(redirect,synchronous){if(!this.config.dst){this.logMessage(_('No destination URL available!'),2);return}
var sourcetool=this.getTool('sourceedittool');if(sourcetool){sourcetool.cancelSourceMode()};if(!this._initialized){return}
this._initialized=false;window.status=_("Please wait while saving document...");for(var id in this.tools){var tool=this.tools[id];if(tool.beforeSave){try{tool.beforeSave()} catch(e){alert(e);this._initialized=true;return}}};this.logMessage(_("Starting HTML cleanup"));var transform=this._filterContent(this.getInnerDocument().documentElement);var contents=this._serializeOutputToString(transform);this.logMessage(_("Cleanup done, sending document to server"));var request=new XMLHttpRequest();if(!synchronous){request.onreadystatechange=(new ContextFixer(this._saveCallback,this,request,redirect)).execute;request.open("PUT",this.config.dst,true);request.setRequestHeader("Content-type",this.config.content_type);request.send(contents);this.logMessage(_("Request sent to server"))} else{this.logMessage(_('Sending request to server'));request.open("PUT",this.config.dst,false);request.setRequestHeader("Content-type",this.config.content_type);request.send(contents);this.handleSaveResponse(request,redirect)}};this.prepareForm=function(form,id){var sourcetool=this.getTool('sourceedittool');if(sourcetool){sourcetool.cancelSourceMode()};if(!this._initialized){return}
this._initialized=false;window.status=_("Please wait while saving document...");for(var tid in this.tools){var tool=this.tools[tid];if(tool.beforeSave){try{tool.beforeSave()} catch(e){alert(e);this._initialized=true;return}}};if(!id){id='kupu'};this.logMessage(_("Starting HTML cleanup"));var transform=this._filterContent(this.getInnerDocument().documentElement);var contents=this._serializeOutputToString(transform);this.logMessage(_("Cleanup done, sending document to server"));var document=form.ownerDocument?form.ownerDocument:window.document;var ta=document.createElement('textarea');ta.style.visibility='hidden';var text=document.createTextNode(contents);ta.appendChild(text);ta.setAttribute('name',id);form.appendChild(ta);return true};this.execCommand=function(command,param){if(!this._initialized){this.logMessage(_('Editor not initialized yet!'));return};if(this.getBrowserName()=="IE"){this._restoreSelection()} else{this.focusDocument();if(command!='styleWithCSS'){this.content_changed=true;this.getDocument().execCommand('styleWithCSS',false)}};this.getDocument().execCommand(command,param);this.updateState()};this.getSelection=function(){this._restoreSelection();return this.getDocument().getSelection()};this.getSelectedNode=function(allowmulti){return this.getSelection().parentElement(allowmulti)};this.getNearestParentOfType=function(node,type){var type=type.toLowerCase();while(node){if(node.nodeName.toLowerCase()==type){return node}
var node=node.parentNode}
return false};this.removeNearestParentOfType=function(node,type){var nearest=this.getNearestParentOfType(node,type);if(!nearest){return false};var parent=nearest.parentNode;while(nearest.childNodes.length){var child=nearest.firstChild;child=nearest.removeChild(child);parent.insertBefore(child,nearest)};parent.removeChild(nearest)};this.getDocument=function(){return this.document};this.getInnerDocument=function(){return this.getDocument().getDocument()};this.insertNodeAtSelection=function(insertNode,selectNode){if(!this._initialized){this.logMessage(_('Editor not initialized yet!'));return};this.content_changed=true;var browser=this.getBrowserName();if(browser!="IE"){this.focusDocument()};var ret=this.getSelection().replaceWithNode(insertNode,selectNode);this._saveSelection();return ret};this.focusDocument=function(){this.getDocument().getWindow().focus()};this.logMessage=function(message,severity){this.log.log(message,severity)};this.registerContentChanger=function(element){addEventHandler(element,'change', function(){this.content_changed=true},this)};this.getBrowserName=function(){if(_SARISSA_IS_MOZ){return "Mozilla"} else if(_SARISSA_IS_IE){return "IE"} else{throw _("Browser not supported!")}};this.handleSaveResponse=function(request,redirect){if(request.status!='200'&&request.status!='204'&&request.status!='1223'){var msg=_('Error saving your data.\nResponse status: '+'${status}.\nCheck your server log for more '+'information.',{'status':request.status});alert(msg);window.status=_("Error saving document")} else if(redirect){window.document.location=redirect;this.content_changed=false} else{this.content_changed=false;if(this.config.reload_after_save){this.reloadSrc()};window.status=_("Document saved")};this._initialized=true};this._addEventHandler=addEventHandler;this._saveCallback=function(request,redirect){if(request.readyState==4){this.handleSaveResponse(request,redirect)}};this.reloadSrc=function(){this.getDocument().reloadSource();if(this.getBrowserName()=="Mozilla"){this.getInnerDocument().designMode="On"}};this.imageInserted=function(event){var node=event.target;if(node&&node.nodeType==1){var nodes=(/^img$/i.test(node.nodeName))?[node]:node.getElementsByTagName('img');for(var i=0;i<nodes.length;i++){node=nodes[i];var src=node.getAttribute('kupu-src');if(src){node.src=src}}}};this.imageModified=function(event){var node=event.target;if(node&&(/^img$/i.test(node.nodeName))){if(event.attrName=="style"&&event.attrChange==1&&(/height|width/.test(event.newValue))){timer_instance.registerFunction(this,this._clearStyle,1,node)}}};this._clearStyle=function(node){var w=node.width;var h=node.height;node.style.width="";node.style.height="";if(this.okresize){if(w){node.width=w};if(h){node.height=h}}};this._cancelResize=function(evt){return false};this._initializeEventHandlers=function(){var win=this.getDocument().getWindow();var idoc=this.getInnerDocument();var e=this._addEventHandler;var validattrs=this.xhtmlvalid.tagAttributes.img;this.okresize=validattrs.contains('width')&&validattrs.contains('height');e(win,'resize',this._resizeHandler,this);e(idoc,"click",this.updateStateHandler,this);e(idoc,"dblclick",this.updateStateHandler,this);e(idoc,"keyup",this.updateStateHandler,this);e(idoc,"keyup", function(){this.content_changed=true},this);e(idoc,"mouseup",this.updateStateHandler,this);if(this.getBrowserName()=="IE"){e(idoc,"selectionchange",this.onSelectionChange,this);if(!this.okresize){e(idoc.documentElement,"resizestart",this._cancelResize,this)}} else{e(idoc,"DOMNodeInserted",this.imageInserted,this);e(idoc,"DOMAttrModified",this.imageModified,this)}};this._resizeHandler=function(){if(this._wantDesignMode){this._setDesignModeWhenReady()}};this._setDesignModeWhenReady=function(){var success=false;try{this._setDesignMode();success=true} catch(e){};if(success){this._wantDesignMode=false;if(this.afterInit){this.afterInit()}} else{this._wantDesignMode=true}};this._setDesignMode=function(){this.getInnerDocument().designMode="On";this.execCommand("undo");this._initialized=true};this._saveSelection=function(){if(this._isDocumentSelected()){var cursel=this.getInnerDocument().selection;var currange=cursel.createRange();if(cursel.type=="Control"&&currange.item(0).nodeName.toLowerCase()=="body"){this._restoreSelection(true);return}
this._previous_range=currange}};this._restoreSelection=function(force){if(this._previous_range&&(force||!this._isDocumentSelected())){try{this._previous_range.select()} catch(e){}}};if(this.getBrowserName()!="IE"){this._saveSelection=function(){};this._restoreSelection=function(){}}
this.onSelectionChange=function(event){this._saveSelection()};this._isDocumentSelected=function(){if(this.suspended) return false;var editable_body=this.getInnerDocument().getElementsByTagName('body')[0];try{var selrange=this.getInnerDocument().selection.createRange()} catch(e){return false}
var someelement=selrange.parentElement?selrange.parentElement():selrange.item(0);while(someelement.nodeName.toLowerCase()!='body'){someelement=someelement.parentNode};return someelement==editable_body};this._clearSelection=function(){this._previous_range=null};this._filterContent=function(documentElement){var xhtmldoc=Sarissa.getDomDocument();var doc=this._convertToSarissaNode(xhtmldoc,documentElement);for(var i=0;i<this.filters.length;i++){var doc=this.filters[i].filter(xhtmldoc,doc)};this._fixXML(doc,xhtmldoc);return doc};this.getXMLBody=function(transform){var bodies=transform.getElementsByTagName('body');var data='';for(var i=0;i<bodies.length;i++){data+=this.serializer.serializeToString(bodies[i])}
return this.layoutsource(this.escapeEntities(data))};this.getHTMLBody=function(){var doc=this.getInnerDocument();var docel=doc.documentElement;var bodies=docel.getElementsByTagName('body');var data='';for(var i=0;i<bodies.length;i++){data+=bodies[i].innerHTML}
return this.layoutsource(this.escapeEntities(data))};this.setHTMLBody=function(text){var doc=this.getInnerDocument().documentElement;var bodies=doc.getElementsByTagName('body');for(var i=0;i<bodies.length-1;i++){bodies[i].parentNode.removeChild(bodies[i])}
if(!_SARISSA_IS_IE){var fixups={'strong':'b','em':'i'};text=text.replace(/<(\/?)(strong|em)\b([^>]*)>/gi, function(all,close,tag,attrs){tag=fixups[tag.toLowerCase()];return '<'+close+tag+attrs+'>'})};text=text.replace(/<p>(<hr.*?>)<\/p>/g,'$1');bodies[bodies.length-1].innerHTML=text;var nodes=doc.getElementsByTagName('img');for(var i=0;i<nodes.length;i++){var node=nodes[i];node.setAttribute('kupu-src',node.src)}};this._fixXML=function(doc,document){var heads=doc.getElementsByTagName('head');var titles=doc.getElementsByTagName('title');if(!heads.length){var body=doc.getElementsByTagName('body')[0];var head=document.createElement('head');body.parentNode.insertBefore(head,body);var title=document.createElement('title');var titletext=document.createTextNode('');head.appendChild(title);title.appendChild(titletext)} else if(!titles.length){var head=heads[0];var title=document.createElement('title');var titletext=document.createTextNode('');head.appendChild(title);title.appendChild(titletext)};var dualtons=['a','abbr','acronym','address','applet','b','bdo','big','blink','blockquote','button','caption','center','cite','comment','del','dfn','dir','div','dl','dt','em','embed','fieldset','font','form','frameset','h1','h2','h3','h4','h5','h6','i','iframe','ins','kbd','label','legend','li','listing','map','marquee','menu','multicol','nobr','noembed','noframes','noscript','object','ol','optgroup','option','p','pre','q','s','script','select','small','span','strike','strong','style','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','u','ul','xmp'];for(var i=0;i<dualtons.length;i++){var elname=dualtons[i];var els=doc.getElementsByTagName(elname);for(var j=0;j<els.length;j++){var el=els[j];if(!el.hasChildNodes()){var child=document.createTextNode('');el.appendChild(child)}}}};this.xhtmlvalid=new XhtmlValidation(this);this._convertToSarissaNode=function(ownerdoc,htmlnode){return this.xhtmlvalid._convertToSarissaNode(ownerdoc,htmlnode)};this._fixupSingletons=function(xml){return xml.replace(/<([^>]+)\/>/g,"<$1 />")};this._serializeOutputToString=function(transform){if(this.config.strict_output){var contents='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'+'<html xmlns="http://www.w3.org/1999/xhtml">'+this.serializer.serializeToString(transform.getElementsByTagName("head")[0])+this.serializer.serializeToString(transform.getElementsByTagName("body")[0])+'</html>'} else{var contents='<html>'+this.serializer.serializeToString(transform.getElementsByTagName("head")[0])+this.serializer.serializeToString(transform.getElementsByTagName("body")[0])+'</html>'};contents=this.escapeEntities(contents);if(this.config.compatible_singletons){contents=this._fixupSingletons(contents)};return contents};this.layoutsource=function(data){data=data.replace(/\s*(<(p|div|h.|ul|ol|dl|menu|dir|pre|blockquote|address|center|table|thead|tbody|tfoot|tr|th|td))\b/ig,'\n$1');data=data.replace(/\s*(<\/(p|div|h.|ul|ol|dl|menu|dir|pre|blockquote|address|center|table|thead|tbody|tfoot|tr|th|td)>)\s*/ig,'$1\n');data=data.replace(/\<pre\>((?:.|\n)*?)\<\/pre\>/gm, function(s){return s.replace(/<br\b[^>]*>/gi,'\n')});return data.strip()};this.escapeEntities=function(xml){xml=xml.replace(/\xa0/g,'&nbsp;');return xml};this.getFullEditor=function(){var fulleditor=this.getDocument().getEditable();while(!(/kupu-fulleditor/.test(fulleditor.className))){fulleditor=fulleditor.parentNode}
return fulleditor};this.setClass=function(name){this.getFullEditor().className+=' '+name};this.clearClass=function(name){var fulleditor=this.getFullEditor();fulleditor.className=fulleditor.className.replace(' '+name,'')};var busycount=0;this.busy=function(){if(busycount<=0){this.setClass('kupu-busy')}
busycount++};this.notbusy=function(force){busycount=force?0:busycount?busycount-1:0;if(busycount<=0){this.clearClass('kupu-busy')}};this.suspendEditing=function(){this._previous_range=this.getSelection().getRange();this.setClass('kupu-modal');for(var id in this.tools){this.tools[id].disable()}
if(this.getBrowserName()=="IE"){var body=this.getInnerDocument().getElementsByTagName('body')[0];body.setAttribute('contentEditable','false')} else{this.getDocument().execCommand('contentReadOnly','true')}
this.suspended=true};this.resumeEditing=function(){if(!this.suspended){return}
this.clearClass('kupu-modal');for(var id in this.tools){this.tools[id].enable()}
if(this.getBrowserName()=="IE"){var body=this.getInnerDocument().getElementsByTagName('body')[0];body.setAttribute('contentEditable','true');this._restoreSelection()} else{var doc=this.getInnerDocument();this.getDocument().execCommand('contentReadOnly','false');doc.designMode="On";this.focusDocument();this.getSelection().restoreRange(this._previous_range)}
this.suspended=false};this.newElement=function(tagName){return newDocumentElement(this.getInnerDocument(),tagName,arguments)};this.newText=function(text){return this.getInnerDocument().createTextNode(text)}}


/* - kupubasetools.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupubasetools.js?original=1
function KupuTool(){this.toolboxes={};addEventHandler=addEventHandler};KupuTool.prototype.initialize=function(editor){this.editor=editor};KupuTool.prototype.registerToolBox=function(id,toolbox){this.toolboxes[id]=toolbox;toolbox.initialize(this,this.editor)};KupuTool.prototype.updateState=function(selNode,event){for(var id in this.toolboxes){this.toolboxes[id].updateState(selNode,event)}};KupuTool.prototype.enable=function(){};KupuTool.prototype.disable=function(){};
function KupuToolBox(){};KupuToolBox.prototype.initialize=function(tool,editor){this.tool=tool;this.editor=editor};KupuToolBox.prototype.updateState=function(selNode,event){};
function noContextMenu(object){object.createContextMenuElements=function(selNode,event){return []};return object}
function kupuButtonDisable(button){button=button||this.button;if(button){button.disabled="disabled";button.className+=' disabled'}};
function kupuButtonEnable(button){button=button||this.button;if(button){button.disabled="";button.className=button.className.replace(/ *\bdisabled\b/g,'')}};
function KupuButton(buttonid,commandfunc,tool){if(arguments.length){this.buttonid=buttonid;this.button=getFromSelector(buttonid);this.commandfunc=commandfunc;this.tool=tool;this.disable=kupuButtonDisable;this.enable=kupuButtonEnable}};KupuButton.prototype=new KupuTool;KupuButton.prototype.initialize=function(editor){this.editor=editor;if(!this.button) return;addEventHandler(this.button,'click',this.execCommand,this)};KupuButton.prototype.execCommand=function(){this.commandfunc(this,this.editor,this.tool)};KupuButton.prototype.updateState=function(selNode,event){};
function KupuStateButton(buttonid,commandfunc,checkfunc,offclass,onclass){this.buttonid=buttonid;this.button=getFromSelector(buttonid);this.commandfunc=commandfunc;this.checkfunc=checkfunc;this.offclass=offclass;this.onclass=onclass;this.pressed=false;this.execCommand=function(){this.button.className=(this.pressed?this.offclass:this.onclass);this.pressed=!this.pressed;this.editor.focusDocument();this.commandfunc(this,this.editor)};this.updateState=function(selNode,event){if(!this.button) return;var currclass=this.button.className;var newclass=null;if(this.checkfunc(selNode,this,this.editor,event)){newclass=this.onclass;this.pressed=true} else{newclass=this.offclass;this.pressed=false};if(currclass!=newclass){this.button.className=newclass}}};KupuStateButton.prototype=new KupuButton;
function KupuLateFocusStateButton(buttonid,commandfunc,checkfunc,offclass,onclass){KupuStateButton.apply(this,[buttonid,commandfunc,checkfunc,offclass,onclass])}
KupuLateFocusStateButton.prototype=new KupuStateButton;KupuLateFocusStateButton.prototype.execCommand=function(){this.button.className=(this.pressed?this.offclass:this.onclass);this.pressed=!this.pressed;this.commandfunc(this,this.editor);this.editor.focusDocument()};
function KupuRemoveElementButton(buttonid,element_name,cssclass){this.button=getFromSelector(buttonid);this.element_name=element_name;this.onclass='invisible';this.offclass=cssclass;this.pressed=false};KupuRemoveElementButton.prototype=new KupuStateButton;KupuRemoveElementButton.prototype.commandfunc=function(button,editor){editor.focusDocument();editor.removeNearestParentOfType(editor.getSelectedNode(),this.element_name);editor.updateState()};KupuRemoveElementButton.prototype.checkfunc=function(currnode,button,editor,event){var element=editor.getNearestParentOfType(currnode,this.element_name);return(element?false:true)};
function KupuUI(textstyleselectid){this.tsselect=getFromSelector(textstyleselectid);this.paraoptions=[];this.tableoptions=[];this.styleoptions=[];this.tableoffset=0;this.styleoffset=0;this.tablegrp=null;this.optionstate=-1;this.otherstyle=null;this.tablestyles={};this.charstyles={};this.styles={};this.blocktagre=/^(p|div|h.|ul|ol|dl|menu|dir|pre|blockquote|address|center)$/i;this.spanre=/^span\b/i;this.tblre=/^thead|tbody|table|t[rdh]\b/i};KupuUI.prototype=new KupuTool;KupuUI.prototype.initialize=function(editor){this.editor=editor;this.cleanStyles();this.enableOptions(false);if(this.tsselect){this._selectevent=addEventHandler(this.tsselect,'change',this.setTextStyleHandler,this)}};KupuUI.prototype.getStyles=function(){if(!this.paraoptions){this.cleanStyles()}
return [this.paraoptions,this.tableoptions]};KupuUI.prototype.setTextStyleHandler=function(event){this.setTextStyle(this.tsselect.options[this.tsselect.selectedIndex].value)};KupuUI.prototype.basicButtonHandler=function(action){this.editor.execCommand(action);this.editor.updateState()};KupuUI.prototype.saveButtonHandler=function(){this.editor.saveDocument()};KupuUI.prototype.saveAndExitButtonHandler=function(redirect_url){this.editor.saveDocument(redirect_url)};KupuUI.prototype.cutButtonHandler=function(){try{this.editor.execCommand('Cut')} catch(e){if(this.editor.getBrowserName()=='Mozilla'){alert(_('Cutting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'))} else{throw e}};this.editor.updateState()};KupuUI.prototype.copyButtonHandler=function(){try{this.editor.execCommand('Copy')} catch(e){if(this.editor.getBrowserName()=='Mozilla'){alert(_('Copying from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'))} else{throw e}};this.editor.updateState()};KupuUI.prototype.pasteButtonHandler=function(){try{this.editor.execCommand('Paste')} catch(e){if(this.editor.getBrowserName()=='Mozilla'){alert(_('Pasting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'))} else{throw e}};this.editor.updateState()};KupuUI.prototype.cleanStyles=function(){if(!this.tsselect) return;var options=this.tsselect.options;var parastyles=this.styles;var tablestyles=this.tablestyles;var charstyles=this.charstyles;var normal=['Normal','p|'];var td=['Plain Cell','td|'];var nostyle=['(remove style)',''];var opts=[];while(options.length){var opt=options[0];options[0]=null;var v=opt.value;if(v.indexOf('|')>-1){var split=v.split('|');v=split[0].toLowerCase()+"|"+split[1]} else{v=v.toLowerCase()+"|"};var optarray=[opt.text,v];if(v=='td|'){td=optarray} else if(v=='p|'){normal=optarray} else if(v==''){nostyle=optarray} else{opts.push([opt.text,v])}}
this.tableoptions.push(td);tablestyles[td[1]]=0;this.paraoptions.push(normal);parastyles[normal[1]]=0;for(var i=0;i<opts.length;i++){optarray=opts[i];v=optarray[1];if(this.spanre.test(v)){charstyles[v]=this.styleoptions.length;this.styleoptions.push(optarray)} else if(this.tblre.test(v)){tablestyles[v]=this.tableoptions.length;this.tableoptions.push(optarray)} else{parastyles[v]=this.paraoptions.length;this.paraoptions.push(optarray)}};this.paraoptions.push(nostyle);this.styleoffset=this.paraoptions.length;this.tableoffset=this.styleoffset+this.styleoptions.length};KupuUI.prototype.enableOptions=function(inTable){if(!this.tsselect) return;var select=this.tsselect;var options=select.options;if(this.otherstyle){options[0]=null;this.otherstyle=null}
if(this.optionstate==inTable) return;
function option(info){return newElement('option',{'value':info[1]},[info[0]])}
if(this.optionstate==-1){for(var i=0;i<this.paraoptions.length;i++){select.appendChild(option(this.paraoptions[i]))}
if(this.styleoptions.length){var grp=document.createElement('optgroup');grp.label='Character styles';for(var i=0;i<this.styleoptions.length;i++){grp.appendChild(option(this.styleoptions[i]))}
select.appendChild(grp)}}
if(inTable){var grp=(this.tablegrp=document.createElement('optgroup'));grp.label='Table elements';for(var i=0;i<this.tableoptions.length;i++){grp.appendChild(option(this.tableoptions[i]))}
select.appendChild(grp)} else{while(select.options[this.tableoffset]){select.options[this.tableoffset]=null};if(this.tablegrp){select.removeChild(this.tablegrp);this.tablegrp=null}};this.optionstate=inTable};KupuUI.prototype.setIndex=function(currnode,tag,index,styles){var className=currnode.className;this.styletag=tag;this.classname=className;var style=tag+'|'+className;if(style in styles){return styles[style]} else if(!className&&tag in styles){return styles[tag]}
return index};KupuUI.prototype.nodeStyle=function(node){var currnode=node;var index=-1;this.styletag=undefined;this.classname='';this.intable=false;while(currnode){var tag=currnode.nodeName;if (/^body$/i.test(tag)) break;if(this.tblre.test(tag)){this.intable=true;break};currnode=currnode.parentNode};currnode=node;while(currnode){var tag=currnode.nodeName.toLowerCase();if (/^body$/.test(tag)){if(!this.styletag){return-1}
break}
if(this.spanre.test(tag)){index=this.setIndex(currnode,tag,index,this.charstyles);if(index>=0) return index+this.styleoffset} else if(this.blocktagre.test(tag)){index=this.setIndex(currnode,tag,index,this.styles)} else if(this.tblre.test(tag)){if(index>0) return index;index=this.setIndex(currnode,tag,index,this.tablestyles);if(index>=0||tag=='table'){return index+this.tableoffset}}
currnode=currnode.parentNode}
return index};KupuUI.prototype.updateState=function(selNode){if(!this.tsselect) return;var index=undefined;var mixed=false;var styletag,classname;var selection=this.editor.getSelection();for(var el=selNode.firstChild;el;el=el.nextSibling){if(el.nodeType==1&&selection.containsNode(el)){var i=this.nodeStyle(el);if(index===undefined){index=i;styletag=this.styletag;classname=this.classname}
if(index!=i||styletag!=this.styletag||classname!=this.classname){mixed=true;break}}};if(index===undefined){index=this.nodeStyle(selNode)}
this.enableOptions(this.intable);if(index<0||mixed){if(mixed){var caption='Mixed styles'} else if(this.styletag){var caption='Other: '+this.styletag+' '+this.classname} else{var caption='<no style>'}
var opt=newElement('option');opt.text=caption;this.otherstyle=opt;this.tsselect.options.add(opt,0);index=0}
this.tsselect.selectedIndex=Math.max(index,0)};KupuUI.prototype._cleanNode=function(node,preserveEmpty){
function stripspace(){var c;while((c=node.lastChild)&&c.nodeType==3&&(/^\s*$/.test(c.data))){node.removeChild(c)}}
stripspace();var c=node.lastChild;if(c&&c.nodeType==1&&c.tagName=='BR'){node.removeChild(c)}
stripspace();if(node.childNodes.length==0&&!preserveEmpty){node.parentNode.removeChild(node)}};KupuUI.prototype._cleanCell=function(eltype,classname,strip){var alttype=eltype=='TD'?'TH':eltype=='TH'?'TD':null;var selNode=this.editor.getSelectedNode(true);var el=this.editor.getNearestParentOfType(selNode,eltype);if(!el&&alttype){el=this.editor.getNearestParentOfType(selNode,alttype)}
if(el){if(eltype!=el.tagName){var node=el.ownerDocument.createElement(eltype);var parent=el.parentNode;parent.insertBefore(node,el);while(el.firstChild){node.appendChild(el.firstChild)}
parent.removeChild(el);el=node}
this._setClass(el,classname);if(strip&&el.childNodes.length==1){var node=el.firstChild;if(this.blocktagre.test(node.nodeName)){for(var n=node.firstChild;n;){var nxt=n.nextSibling;el.insertBefore(n,node);n=nxt};nxt=node.nextSibling;el.removeChild(node);node=nxt}}} else{var selection=this.editor.getSelection();var nodes=selNode.getElementsByTagName(eltype);var cellNodes=[];for(var i=0;i<nodes.length;i++){cellNodes.push(nodes.item(i))};if(alttype){nodes=selNode.getElementsByTagName(alttype);for(var i=0;i<nodes.length;i++){cellNodes.push(nodes.item(i))}};for(var i=0;i<cellNodes.length;i++){el=cellNodes[i];if(selection.intersectsNode(el)){if(eltype!=el.tagName){var node=el.ownerDocument.createElement(eltype);var parent=el.parentNode;parent.insertBefore(node,el);while(el.firstChild){node.appendChild(el.firstChild)};parent.removeChild(el);el=node};this._setClass(el,classname)}}}};KupuUI.prototype._setClass=function(el,classname){var parent=el.parentNode;if(parent.tagName=='DIV'){var gp=parent.parentNode;if(el!=parent.firstChild){var previous=parent.cloneNode(false);while(el!=parent.firstChild){previous.appendChild(parent.firstChild)}
gp.insertBefore(previous,parent);this._cleanNode(previous)}
gp.insertBefore(el,parent);this._cleanNode(parent)};if(classname){el.className=classname} else{el.removeAttribute("class");el.removeAttribute("className")}};KupuUI.prototype._removeStyle=function(){var self=this;
function needbreak(e){if(isblock&&e){if(self.blocktagre.test(e.nodeName)||(/^br$/i.test(e.nodeName))) return;parent.insertBefore(ed.newElement('br'),n)}}
var n=this.editor.getSelectedNode(true);var ed=this.editor;while(n){var tag=n.nodeName.toLowerCase();var isblock=this.blocktagre.test(tag);if(this.tblre.test(tag)&&n.className){n.removeAttribute("class");n.removeAttribute("className");return}
if(isblock||tag=='span'){var parent=n.parentNode;var el;needbreak(n.previousSibling);while((el=n.firstChild)){parent.insertBefore(el,n)}
needbreak(n.nextSibling);parent.removeChild(n);return}
n=n.parentNode}};KupuUI.prototype.setTextStyle=function(style,noupdate){var classname='';var eltype=style.toUpperCase();if(style.indexOf('|')>-1){style=style.split('|');eltype=style[0].toUpperCase();classname=style[1]};var doc=this.editor.getDocument();var command=eltype;if(this.editor.getBrowserName()=='IE'){command='<'+eltype+'>'};if(!style){this._removeStyle()} else if(this.tblre.test(eltype)){this._cleanCell(eltype,classname)} else if(eltype=='SPAN'){doc.execCommand('removeformat',null);if(this.editor.getBrowserName()=='IE'){var selNode=this.editor.getSelectedNode();var selection=this.editor.getSelection();var elements=selNode.getElementsByTagName('span');for(var i=0;i<elements.length;i++){var span=elements[i];if(selection.containsNode(span)){var parent=span.parentNode;while(span.firstChild){parent.insertBefore(span.firstChild,span)};parent.removeChild(span)}}}
if(classname){doc.execCommand('fontsize','2');var inner=doc.getDocument();var elements=inner.getElementsByTagName('FONT');while(elements.length>0){var font=elements[0];var span=inner.createElement('SPAN');span.className=classname;var parent=font.parentNode;parent.replaceChild(span,font);while(font.firstChild){span.appendChild(font.firstChild)}}}}
else{doc.execCommand('formatblock',command);var selNode=this.editor.getSelectedNode(true);var el=this.editor.getNearestParentOfType(selNode,eltype);if(el){this._setClass(el,classname)} else{var selection=this.editor.getSelection();var elements=selNode.getElementsByTagName(eltype);for(var i=0;i<elements.length;i++){el=elements[i];if(selection.containsNode(el)){this._setClass(el,classname)}}}}
if(el){this.editor.getSelection().selectNodeContents(el)}
if(!noupdate){this.editor.updateState()}};KupuUI.prototype.createContextMenuElements=function(selNode,event){var ret=[];ret.push(new ContextMenuElement(_('Cut'),this.cutButtonHandler,this));ret.push(new ContextMenuElement(_('Copy'),this.copyButtonHandler,this));ret.push(new ContextMenuElement(_('Paste'),this.pasteButtonHandler,this));return ret};KupuUI.prototype.disable=function(){if(this.tsselect) this.tsselect.disabled="disabled"};KupuUI.prototype.enable=function(){if(this.tsselect) this.tsselect.disabled=""};
function ColorchooserTool(fgcolorbuttonid,hlcolorbuttonid,colorchooserid){this.fgcolorbutton=getFromSelector(fgcolorbuttonid);this.hlcolorbutton=getFromSelector(hlcolorbuttonid);this.ccwindow=getFromSelector(colorchooserid);this.command=null}
ColorchooserTool.prototype=new KupuTool;ColorchooserTool.prototype.initialize=function(editor){this.editor=editor;if(!(this.fgcolorbutton&&this.hlcolorbutton&&this.ccwindow)) return;this.createColorchooser(this.ccwindow);addEventHandler(this.fgcolorbutton,"click",this.openFgColorChooser,this);addEventHandler(this.hlcolorbutton,"click",this.openHlColorChooser,this);addEventHandler(this.ccwindow,"click",this.chooseColor,this);this.hide()};ColorchooserTool.prototype.updateState=function(selNode){this.hide()};ColorchooserTool.prototype.openFgColorChooser=function(){this.command="forecolor";this.show()};ColorchooserTool.prototype.openHlColorChooser=function(){if(this.editor.getBrowserName()=="IE"){this.command="backcolor"} else{this.command="hilitecolor"}
this.show()};ColorchooserTool.prototype.chooseColor=function(event){var target=_SARISSA_IS_MOZ?event.target:event.srcElement;var cell=this.editor.getNearestParentOfType(target,'td');var ed=this.editor;var doc=ed.getDocument();ed.execCommand('styleWithCSS',true);doc.execCommand(this.command,cell.bgColor);ed.execCommand('styleWithCSS',false);this.hide();this.editor.logMessage(_('Color chosen'))};ColorchooserTool.prototype.show=function(command){this.ccwindow.style.display="block"};ColorchooserTool.prototype.hide=function(){this.ccwindow.style.display="none"};ColorchooserTool.prototype.createColorchooser=function(table){var chunks=['00','33','66','99','CC','FF'];table.setAttribute('id','kupu-colorchooser-table');table.style.borderWidth='2px';table.style.borderStyle='solid';table.style.position='absolute';table.style.cursor='default';table.style.display='none';var tbody=document.createElement('tbody');for(var i=0;i<6;i++){var tr=document.createElement('tr');var r=chunks[i];for(var j=0;j<6;j++){var g=chunks[j];for(var k=0;k<6;k++){var b=chunks[k];var color='#'+r+g+b;var td=document.createElement('td');td.setAttribute('bgColor',color);td.style.backgroundColor=color;td.style.borderWidth='1px';td.style.borderStyle='solid';td.style.fontSize='1px';td.style.width='10px';td.style.height='10px';var text=document.createTextNode('\u00a0');td.appendChild(text);tr.appendChild(td)}}
tbody.appendChild(tr)}
table.appendChild(tbody);return table};ColorchooserTool.prototype.enable=function(){kupuButtonEnable(this.fgcolorbutton);kupuButtonEnable(this.hlcolorbutton)};ColorchooserTool.prototype.disable=function(){kupuButtonDisable(this.fgcolorbutton);kupuButtonDisable(this.hlcolorbutton)};
function PropertyTool(titlefieldid,descfieldid){this.titlefield=getFromSelector(titlefieldid);this.descfield=getFromSelector(descfieldid)};PropertyTool.prototype=new KupuTool;PropertyTool.prototype.initialize=function(editor){this.editor=editor;addEventHandler(this.titlefield,"change",this.updateProperties,this);addEventHandler(this.descfield,"change",this.updateProperties,this);var heads=this.editor.getInnerDocument().getElementsByTagName('head');if(!heads[0]){this.editor.logMessage(_('No head in document!'),1)} else{var head=heads[0];var titles=head.getElementsByTagName('title');if(titles.length){this.titlefield.value=titles[0].text}
var metas=head.getElementsByTagName('meta');if(metas.length){for(var i=0;i<metas.length;i++){var meta=metas[i];if(meta.getAttribute('name')&&meta.getAttribute('name').toLowerCase()=='description'){this.descfield.value=meta.getAttribute('content');break}}}}};PropertyTool.prototype.updateProperties=function(){var doc=this.editor.getInnerDocument();var heads=doc.getElementsByTagName('HEAD');if(!heads){this.editor.logMessage(_('No head in document!'),1);return}
var head=heads[0];var titles=head.getElementsByTagName('title');if(!titles){var title=doc.createElement('title');var text=doc.createTextNode(this.titlefield.value);title.appendChild(text);head.appendChild(title)} else{var title=titles[0];if(title.childNodes.length==0){title.removeNode(true);title=doc.createElement('title');title.innerText=this.titlefield.value;head.appendChild(title)} else{title.childNodes[0].nodeValue=this.titlefield.value}}
document.title=this.titlefield.value;var metas=doc.getElementsByTagName('meta');var descset=0;for(var i=0;i<metas.length;i++){var meta=metas[i];if(meta.getAttribute('name')&&meta.getAttribute('name').toLowerCase()=='description'){meta.setAttribute('content',this.descfield.value);descset=1}}
if(!descset){var meta=doc.createElement('meta');meta.setAttribute('name','description');meta.setAttribute('content',this.descfield.value);head.appendChild(meta)}
this.editor.logMessage(_('Properties modified'))};
function LinkTool(popupurl,popupwidth,popupheight,popupprops){this.popupurl=popupurl||'kupupopups/link.html';this.popupwidth=popupwidth||300;this.popupheight=popupheight||200;this.popupprops=popupprops||''}
LinkTool.prototype=new KupuTool;LinkTool.prototype.initialize=function(editor){this.editor=editor};LinkTool.prototype.createLinkHandler=function(event){var linkWindow=openPopup(this.popupurl,this.popupwidth,this.popupheight,this.popupprops);linkWindow.linktool=this;linkWindow.focus()};LinkTool.prototype.updateLink=function(linkel,url,type,name,target,title,className,bForce){if(type&&type=='anchor'){linkel.removeAttribute('href');linkel.setAttribute('name',name)} else{linkel.href=url;if(linkel.innerHTML==""||(bForce&&linkel.innerHTML==url)){var doc=this.editor.getInnerDocument();while(linkel.firstChild){linkel.removeChild(linkel.firstChild)};linkel.appendChild(doc.createTextNode(title||url))}
if(title){linkel.title=title} else{linkel.removeAttribute('title')}
if(target){linkel.setAttribute('target',target)}
else{linkel.removeAttribute('target')};if(className===undefined){linkel.removeAttribute('className')} else{linkel.className=className}
linkel.style.color=this.linkcolor}};LinkTool.prototype.formatSelectedLink=function(url,type,name,target,title,className,bForce){var currnode=this.editor.getSelectedNode();var linkel=this.editor.getNearestParentOfType(currnode,'A');if(linkel){this.updateLink(linkel,url,type,name,target,title,className,bForce);return true}
if(currnode.nodeType!=1) return false;var linkelements=currnode.getElementsByTagName('A');var selection=this.editor.getSelection();var containsLink=false;for(var i=0;i<linkelements.length;i++){linkel=linkelements[i];if(selection.containsNode(linkel)){this.updateLink(linkel,url,type,name,target,title,className,bForce);containsLink=true}};return containsLink};LinkTool.prototype.createLink=function(url,type,name,target,title,className){url=url.strip();if(!url){this.deleteLink();return};if(!this.formatSelectedLink(url,type,name,target,title,className)){this.editor.execCommand("CreateLink",url);if(!this.formatSelectedLink(url,type,name,target,title,className,true)){var doc=this.editor.getInnerDocument();var linkel=doc.createElement("a");linkel.setAttribute('href',url);linkel.setAttribute('class',className||'generated');this.editor.getSelection().replaceWithNode(linkel,true);this.updateLink(linkel,url,type,name,target,title,className)}}};LinkTool.prototype.deleteLink=function(){var currnode=this.editor.getSelectedNode();var linkel=this.editor.getNearestParentOfType(currnode,'a');if(!linkel){this.editor.logMessage(_('Not inside link'));return};while(linkel.childNodes.length){linkel.parentNode.insertBefore(linkel.childNodes[0],linkel)};linkel.parentNode.removeChild(linkel)};LinkTool.prototype.createContextMenuElements=function(selNode,event){var ret=[];var link=this.editor.getNearestParentOfType(selNode,'a');if(link){ret.push(new ContextMenuElement(_('Delete link'),this.deleteLink,this))} else{ret.push(new ContextMenuElement(_('Create link'),this.createLinkHandler,this))};return ret};
function LinkToolBox(inputid,buttonid,toolboxid,plainclass,activeclass){this.input=getFromSelector(inputid);this.button=getFromSelector(buttonid);this.toolboxel=getFromSelector(toolboxid);this.plainclass=plainclass;this.activeclass=activeclass};LinkToolBox.prototype=new LinkToolBox;LinkToolBox.prototype.initialize=function(tool,editor){this.tool=tool;this.editor=editor;if(!this.button) return;addEventHandler(this.input,"blur",this.updateLink,this);addEventHandler(this.button,"click",this.addLink,this)};LinkToolBox.prototype.updateState=function(selNode){var linkel=this.editor.getNearestParentOfType(selNode,'a');if(linkel){if(this.toolboxel){this.toolboxel.className=this.activeclass};this.input.value=linkel.getAttribute('href')} else{if(this.toolboxel){this.toolboxel.className=this.plainclass};this.input.value=''}};LinkToolBox.prototype.addLink=function(event){var url=this.input.value;this.editor.focusDocument();this.tool.createLink(url);this.editor.updateState()};LinkToolBox.prototype.updateLink=function(){var currnode=this.editor.getSelectedNode();var linkel=this.editor.getNearestParentOfType(currnode,'A');if(!linkel){return}
var url=this.input.value;linkel.setAttribute('href',url);this.editor.updateState()};
function ImageTool(popupurl,popupwidth,popupheight,popupprops){this.popupurl=popupurl||'kupupopups/image.html';this.popupwidth=popupwidth||300;this.popupheight=popupheight||200;this.popupprops=popupprops||''};ImageTool.prototype=new KupuTool;ImageTool.prototype.initialize=function(editor){this.editor=editor};ImageTool.prototype.createImageHandler=function(event){var imageWindow=openPopup(this.popupurl,this.popupwidth,this.popupheight,this.popupprops);imageWindow.imagetool=this;imageWindow.focus()};ImageTool.prototype.newNode=function(name,obj){var ed=this.editor;var currobj=ed.getNearestParentOfType(ed.getSelectedNode(),name);if(currobj){var p=currobj.parentNode;p.insertBefore(obj,currobj);p.removeChild(currobj);return obj} else{return ed.insertNodeAtSelection(obj,1)}};ImageTool.prototype.createImage=function(url,alttext,imgclass){var img=this.editor.getInnerDocument().createElement('img');img.src=url;img.setAttribute('kupu-src',url);img.removeAttribute('height');img.removeAttribute('width');if(alttext){img.alt=alttext};if(imgclass){img.className=imgclass};this.newNode('IMG',img);return img};ImageTool.prototype.create_flash=function(url,alttext,className,width,height){var ed=this.editor;var obj=ed.newElement('object',{src:url,alt:alttext,className:className,width:width,height:height,type:'application/x-shockwave-flash','data':url},[ed.newElement('param',{name:'movie',value:url})]);this.newNode('OBJECT',obj)};ImageTool.prototype.setImageClass=function(imgclass){var currnode=this.editor.getSelectedNode();var currimg=this.editor.getNearestParentOfType(currnode,'IMG');if(currimg){currimg.className=imgclass}};ImageTool.prototype.createContextMenuElements=function(selNode,event){return [new ContextMenuElement(_('Create image'),this.createImageHandler,this)]};
function ImageToolBox(inputfieldid,insertbuttonid,classselectid,toolboxid,plainclass,activeclass){this.inputfield=getFromSelector(inputfieldid);this.insertbutton=getFromSelector(insertbuttonid);this.classselect=getFromSelector(classselectid);this.toolboxel=getFromSelector(toolboxid);this.plainclass=plainclass;this.activeclass=activeclass};ImageToolBox.prototype=new KupuToolBox;ImageToolBox.prototype.initialize=function(tool,editor){this.tool=tool;this.editor=editor;addEventHandler(this.classselect,"change",this.setImageClass,this);addEventHandler(this.insertbutton,"click",this.addImage,this)};ImageToolBox.prototype.updateState=function(selNode,event){var imageel=this.editor.getNearestParentOfType(selNode,'img');if(imageel){if(this.toolboxel){this.toolboxel.className=this.activeclass;this.inputfield.value=imageel.getAttribute('src');var imgclass=imageel.className?imageel.className:'image-inline';selectSelectItem(this.classselect,imgclass)}} else{if(this.toolboxel){this.toolboxel.className=this.plainclass}}};ImageToolBox.prototype.addImage=function(){var url=this.inputfield.value;var sel_class=this.classselect.options[this.classselect.selectedIndex].value;this.editor.focusDocument();this.tool.createImage(url,null,sel_class);this.editor.updateState()};ImageToolBox.prototype.setImageClass=function(){var sel_class=this.classselect.options[this.classselect.selectedIndex].value;this.editor.focusDocument();this.tool.setImageClass(sel_class);this.editor.updateState()};
function TableTool(){};TableTool.prototype=new KupuTool;TableTool.prototype.createContextMenuElements=function(selNode,event){var table=this.editor.getNearestParentOfType(selNode,'table');if(!table){var ret=[];var el=new ContextMenuElement(_('Add table'),this.addPlainTable,this);ret.push(el);return ret} else{var ret=[];ret.push(new ContextMenuElement(_('Add row'),this.addTableRow,this));ret.push(new ContextMenuElement(_('Delete row'),this.delTableRow,this));ret.push(new ContextMenuElement(_('Add column'),this.addTableColumn,this));ret.push(new ContextMenuElement(_('Delete column'),this.delTableColumn,this));ret.push(new ContextMenuElement(_('Delete Table'),this.delTable,this));return ret}};TableTool.prototype.addPlainTable=function(){this.createTable(2,3,1,'plain')};TableTool.prototype.createTable=function(rows,cols,makeHeader,tableclass){if(rows<1||rows>99||cols<1||cols>99){this.editor.logMessage(_('Invalid table size'),1);return};var doc=this.editor.getInnerDocument();var table=doc.createElement("table");table.className=tableclass;if(makeHeader){var tr=doc.createElement("tr");var thead=doc.createElement("thead");for(var i=0;i<cols;i++){var th=doc.createElement("th");th.appendChild(doc.createTextNode("Col "+i+1));tr.appendChild(th)}
thead.appendChild(tr);table.appendChild(thead)}
var tbody=doc.createElement("tbody");for(var i=0;i<rows;i++){var tr=doc.createElement("tr");for(var j=0;j<cols;j++){var td=doc.createElement("td");var content=doc.createTextNode('\u00a0');td.appendChild(content);tr.appendChild(td)}
tbody.appendChild(tr)}
table.appendChild(tbody);this.editor.insertNodeAtSelection(table);this._setTableCellHandlers(table);return table};TableTool.prototype._setTableCellHandlers=function(table){addEventHandler(table,'click',this._selectContentIfEmpty,this);var cells=table.getElementsByTagName('td');for(var i=0;i<cells.length;i++){addEventHandler(cells[i],'click',this._selectContentIfEmpty,this)};var firstcell=cells[0];if(firstcell){var children=firstcell.childNodes;if(children.length==1&&children[0].nodeType==3&&children[0].nodeValue=='\xa0'){var selection=this.editor.getSelection();selection.selectNodeContents(firstcell)}}};TableTool.prototype._selectContentIfEmpty=function(){var selNode=this.editor.getSelectedNode();var cell=this.editor.getNearestParentOfType(selNode,'td');if(!cell){return};var children=cell.childNodes;if(children.length==1&&children[0].nodeType==3&&children[0].nodeValue=='\xa0'){var selection=this.editor.getSelection();selection.selectNodeContents(cell)}};TableTool.prototype.addTableRow=function(){var currnode=this.editor.getSelectedNode();var currtbody=this.editor.getNearestParentOfType(currnode,"TBODY");var bodytype="tbody";if(!currtbody){currtbody=this.editor.getNearestParentOfType(currnode,"THEAD");bodytype="thead"}
var parentrow=this.editor.getNearestParentOfType(currnode,"TR");var nextrow=parentrow.nextSibling;var colcount=0;for(var i=0;i<currtbody.childNodes.length;i++){var el=currtbody.childNodes[i];if(el.nodeType!=1){continue}
if(el.nodeName.toLowerCase()=='tr'){var cols=0;for(var j=0;j<el.childNodes.length;j++){if(el.childNodes[j].nodeType==1){cols++}}
if(cols>colcount){colcount=cols}}}
var newrow=this.editor.getInnerDocument().createElement("TR");for(var i=0;i<colcount;i++){var newcell;if(bodytype=='tbody'){newcell=this.editor.getInnerDocument().createElement("TD")} else{newcell=this.editor.getInnerDocument().createElement("TH")}
var newcellvalue=this.editor.getInnerDocument().createTextNode("\u00a0");newcell.appendChild(newcellvalue);newrow.appendChild(newcell)}
if(!nextrow){currtbody.appendChild(newrow)} else{currtbody.insertBefore(newrow,nextrow)}};TableTool.prototype.delTableRow=function(){var currnode=this.editor.getSelectedNode();var parentrow=this.editor.getNearestParentOfType(currnode,"TR");if(!parentrow){this.editor.logMessage(_('No row to delete'),1);return}
var selection=this.editor.getSelection();if(parentrow.nextSibling){selection.selectNodeContents(parentrow.nextSibling.firstChild)} else if(parentrow.previousSibling){selection.selectNodeContents(parentrow.previousSibling.firstChild)};parentrow.parentNode.removeChild(parentrow)};TableTool.prototype.addTableColumn=function(){var currnode=this.editor.getSelectedNode();var currtd=this.editor.getNearestParentOfType(currnode,'TD');if(!currtd){currtd=this.editor.getNearestParentOfType(currnode,'TH')}
if(!currtd){this.editor.logMessage(_('No parentcolumn found!'),1);return}
var currtable=this.editor.getNearestParentOfType(currnode,'TABLE');var tdindex=this._getColIndex(currtd);var theads=currtable.getElementsByTagName('THEAD');if(theads){for(var i=0;i<theads.length;i++){var currthead=theads[i];for(var j=0;j<currthead.childNodes.length;j++){var tr=currthead.childNodes[j];if(tr.nodeType!=1){continue}
var currindex=0;for(var k=0;k<tr.childNodes.length;k++){var th=tr.childNodes[k];if(th.nodeType!=1){continue}
if(currindex==tdindex){var doc=this.editor.getInnerDocument();var newth=doc.createElement('th');var text=doc.createTextNode('\u00a0');newth.appendChild(text);if(tr.childNodes.length==k+1){tr.appendChild(newth)} else{tr.insertBefore(newth,tr.childNodes[k+1])}
break}
currindex++}}}}
var tbodies=currtable.getElementsByTagName('TBODY');if(tbodies){for(var i=0;i<tbodies.length;i++){var currtbody=tbodies[i];for(var j=0;j<currtbody.childNodes.length;j++){var tr=currtbody.childNodes[j];if(tr.nodeType!=1){continue}
var currindex=0;for(var k=0;k<tr.childNodes.length;k++){var td=tr.childNodes[k];if(td.nodeType!=1){continue}
if(currindex==tdindex){var doc=this.editor.getInnerDocument();var newtd=doc.createElement('td');var text=doc.createTextNode('\u00a0');newtd.appendChild(text);if(tr.childNodes.length==k+1){tr.appendChild(newtd)} else{tr.insertBefore(newtd,tr.childNodes[k+1])}
break}
currindex++}}}}};TableTool.prototype.delTableColumn=function(){var currnode=this.editor.getSelectedNode();var currtd=this.editor.getNearestParentOfType(currnode,'TD');if(!currtd){currtd=this.editor.getNearestParentOfType(currnode,'TH')}
var currcolindex=this._getColIndex(currtd);var currtable=this.editor.getNearestParentOfType(currnode,'TABLE');var selection=this.editor.getSelection();if(currtd.nextSibling){selection.selectNodeContents(currtd.nextSibling)} else if(currtd.previousSibling){selection.selectNodeContents(currtd.previousSibling)};var heads=currtable.getElementsByTagName('THEAD');if(heads.length){for(var i=0;i<heads.length;i++){var thead=heads[i];for(var j=0;j<thead.childNodes.length;j++){var tr=thead.childNodes[j];if(tr.nodeType!=1){continue}
var currindex=0;for(var k=0;k<tr.childNodes.length;k++){var th=tr.childNodes[k];if(th.nodeType!=1){continue}
if(currindex==currcolindex){tr.removeChild(th);break}
currindex++}}}}
var bodies=currtable.getElementsByTagName('TBODY');for(var i=0;i<bodies.length;i++){var currtbody=bodies[i];for(var j=0;j<currtbody.childNodes.length;j++){var tr=currtbody.childNodes[j];if(tr.nodeType!=1){continue}
var currindex=0;for(var k=0;k<tr.childNodes.length;k++){var cell=tr.childNodes[k];if(cell.nodeType!=1){continue}
if(currindex==currcolindex){tr.removeChild(cell);break}
currindex++}}}};TableTool.prototype.delTable=function(){var currnode=this.editor.getSelectedNode();var table=this.editor.getNearestParentOfType(currnode,'table');if(!table){this.editor.logMessage(_('Not inside a table!'));return};table.parentNode.removeChild(table)};TableTool.prototype.setColumnAlign=function(newalign){var currnode=this.editor.getSelectedNode();var currtd=this.editor.getNearestParentOfType(currnode,"TD");var bodytype='tbody';if(!currtd){currtd=this.editor.getNearestParentOfType(currnode,"TH");bodytype='thead'}
var currcolindex=this._getColIndex(currtd);var currtable=this.editor.getNearestParentOfType(currnode,"TABLE");for(var i=0;i<currtable.childNodes.length;i++){var currtbody=currtable.childNodes[i];if(currtbody.nodeType!=1||(/^thead|tbody$/i.test(currtbody.nodeName))){continue}
for(var j=0;j<currtbody.childNodes.length;j++){var row=currtbody.childNodes[j];if(row.nodeType!=1){continue}
var index=0;for(var k=0;k<row.childNodes.length;k++){var cell=row.childNodes[k];if(cell.nodeType!=1){continue}
if(index==currcolindex){if(this.editor.config.use_css){cell.style.textAlign=newalign} else{cell.setAttribute('align',newalign)}
cell.className='align-'+newalign}
index++}}}};TableTool.prototype.setTableClass=function(sel_class){var currnode=this.editor.getSelectedNode();var currtable=this.editor.getNearestParentOfType(currnode,'TABLE');if(currtable){currtable.className=sel_class}};TableTool.prototype._getColIndex=function(currcell){var prevsib=currcell.previousSibling;var currcolindex=0;while(prevsib){if(prevsib.nodeType==1&&(prevsib.tagName.toUpperCase()=="TD"||prevsib.tagName.toUpperCase()=="TH")){var colspan=prevsib.colSpan;if(colspan){currcolindex+=parseInt(colspan)} else{currcolindex++}}
prevsib=prevsib.previousSibling;if(currcolindex>30){alert("Recursion detected when counting column position");return}}
return currcolindex};TableTool.prototype._getColumnAlign=function(selNode){var align;var td=this.editor.getNearestParentOfType(selNode,'td');if(!td){td=this.editor.getNearestParentOfType(selNode,'th')};if(td){align=td.getAttribute('align');if(this.editor.config.use_css){align=td.style.textAlign}};return align};TableTool.prototype.fixTable=function(event){var currnode=this.editor.getSelectedNode();var table=this.editor.getNearestParentOfType(currnode,'TABLE');if(!table){this.editor.logMessage(_('Not inside a table!'));return};this._fixTableHelper(table)};TableTool.prototype._isBodyRow=function(row){for(var node=row.firstChild;node;node=node.nextSibling){if (/^td$/i.test(node.nodeName)){return true}}
return false};TableTool.prototype._cleanCell=function(el){var nxt,n;for(var node=el.firstChild;node;){if (/^div|p$/i.test(node.nodeName)){for(var n=node.firstChild;n;){var nxt=n.nextSibling;el.insertBefore(n,node);n=nxt}
nxt=node.nextSibling;el.removeChild(node);node=nxt} else{node=node.nextSibling}}
var c;while(el.firstChild&&(c=el.firstChild).nodeType==3&&(/^\s+/.test(c.data))){c.data=c.data.replace(/^\s+/,'');if(!c.data){el.removeChild(c)} else{break}};while(el.lastChild&&(c=el.lastChild).nodeType==3&&(/\s+$/.test(c.data))){c.data=c.data.replace(/\s+$/,'');if(!c.data){el.removeChild(c)} else{break}};el.removeAttribute('colSpan');el.removeAttribute('rowSpan')};TableTool.prototype._countCols=function(rows,numcols){for(var i=0;i<rows.length;i++){var row=rows[i];var currnumcols=0;for(var node=row.firstChild;node;node=node.nextSibling){if (/^(td|th)$/i.test(node.nodeName)){currnumcols+=parseInt(node.getAttribute('colSpan')||'1')}};if(currnumcols>numcols){numcols=currnumcols}};return numcols};TableTool.prototype._cleanRows=function(rows,container,numcols){for(var i=0;i<rows.length;i++){var row=rows[i];var doc=this.editor.getInnerDocument();var newrow=doc.createElement('tr');if(row.className){newrow.className=row.className}
for(var node=row.firstChild;node;){var nxt=node.nextSibling;if (/^(td|th)$/i.test(node.nodeName)){this._cleanCell(node);newrow.appendChild(node)};node=nxt};if(newrow.childNodes.length){container.appendChild(newrow)}};for(var row=container.firstChild;row;row=row.nextSibling){var cellname=row.lastChild.nodeName;while(row.childNodes.length<numcols){var cell=doc.createElement(cellname);var nbsp=doc.createTextNode('\u00a0');cell.appendChild(nbsp);row.appendChild(cell)}}};TableTool.prototype._fixTableHelper=function(table){var doc=this.editor.getInnerDocument();var thead=doc.createElement('thead');var tbody=doc.createElement('tbody');var tfoot=doc.createElement('tfoot');var table_classes=this.editor.config.table_classes;
function cleanClassName(name){var allowed_classes=table_classes['class'];for(var i=0;i<allowed_classes.length;i++){var classname=allowed_classes[i];classname=classname.classname||classname;if(classname==name) return name};return allowed_classes[0]}
if(table_classes){table.className=cleanClassName(table.className)} else{table.removeAttribute('class');table.removeAttribute('className')};table.removeAttribute('border');table.removeAttribute('cellpadding');table.removeAttribute('cellPadding');table.removeAttribute('cellspacing');table.removeAttribute('cellSpacing');var hrows=[],brows=[],frows=[];for(var node=table.firstChild;node;node=node.nextSibling){var nodeName=node.nodeName.toLowerCase();if (/tr/i.test(node.nodeName)){brows.push(node)} else if (/thead|tbody|tfoot/i.test(node.nodeName)){var rows=nodeName=='thead'?hrows:nodeName=='tfoot'?frows:brows;for(var inode=node.firstChild;inode;inode=inode.nextSibling){if (/tr/i.test(inode.nodeName)){rows.push(inode)}}}};while(brows.length&&!this._isBodyRow(brows[0])){hrows.push(brows[0]);brows.shift()}
while(brows.length&&!this._isBodyRow(brows[brows.length-1])){var last=brows[brows.length-1];brows.length-=1;frows.unshift(last)}
var numcols=this._countCols(hrows,0);numcols=this._countCols(brows,numcols);numcols=this._countCols(frows,numcols);this._cleanRows(hrows,thead);this._cleanRows(brows,tbody);this._cleanRows(frows,tfoot);while(table.firstChild){table.removeChild(table.firstChild)}
if(hrows.length){table.appendChild(thead)}
if(brows.length){table.appendChild(tbody)}
if(frows.length){table.appendChild(tfoot)}};TableTool.prototype.fixAllTables=function(){var tables=this.editor.getInnerDocument().getElementsByTagName('table');for(var i=0;i<tables.length;i++){this._fixTableHelper(tables[i])}};
function TableToolBox(addtabledivid,edittabledivid,newrowsinputid,newcolsinputid,makeheaderinputid,classselectid,alignselectid,addtablebuttonid,addrowbuttonid,delrowbuttonid,addcolbuttonid,delcolbuttonid,fixbuttonid,delbuttonid,fixallbuttonid,toolboxid,plainclass,activeclass){this.addtablediv=getFromSelector(addtabledivid);this.edittablediv=getFromSelector(edittabledivid);this.newrowsinput=getFromSelector(newrowsinputid);this.newcolsinput=getFromSelector(newcolsinputid);this.makeheaderinput=getFromSelector(makeheaderinputid);this.classselect=getFromSelector(classselectid);this.alignselect=getFromSelector(alignselectid);this.addtablebutton=getFromSelector(addtablebuttonid);this.addrowbutton=getFromSelector(addrowbuttonid);this.delrowbutton=getFromSelector(delrowbuttonid);this.addcolbutton=getFromSelector(addcolbuttonid);this.delcolbutton=getFromSelector(delcolbuttonid);this.fixbutton=getFromSelector(fixbuttonid);this.delbutton=getFromSelector(delbuttonid);this.fixallbutton=getFromSelector(fixallbuttonid);this.toolboxel=getFromSelector(toolboxid);this.plainclass=plainclass;this.activeclass=activeclass};TableToolBox.prototype=new KupuToolBox;TableToolBox.prototype.initialize=function(tool,editor){this.tool=tool;this.editor=editor;if(this.editor.config.table_classes){var classes=this.editor.config.table_classes['class'];while(this.classselect.hasChildNodes()){this.classselect.removeChild(this.classselect.firstChild)};for(var i=0;i<classes.length;i++){var classname=classes[i];classname=classname.classname||classname;var option=document.createElement('option');var content=document.createTextNode(classname);option.appendChild(content);option.setAttribute('value',classname);this.classselect.appendChild(option)}};addEventHandler(this.addtablebutton,"click",this.addTable,this);addEventHandler(this.addrowbutton,"click",this.addTableRow,this);addEventHandler(this.delrowbutton,"click",this.delTableRow,this);addEventHandler(this.addcolbutton,"click",this.addTableColumn,this);addEventHandler(this.delcolbutton,"click",this.delTableColumn,this);addEventHandler(this.alignselect,"change",this.setColumnAlign,this);addEventHandler(this.classselect,"change",this.setTableClass,this);addEventHandler(this.fixbutton,"click",this.fixTable,this);addEventHandler(this.delbutton,"click",this.delTable,this);addEventHandler(this.fixallbutton,"click",this.fixAllTables,this);this.addtablediv.style.display="block";this.edittablediv.style.display="none"};TableToolBox.prototype.updateState=function(selNode){var table=this.editor.getNearestParentOfType(selNode,'table');if(table){this.addtablediv.style.display="none";this.edittablediv.style.display="block";var align=this.tool._getColumnAlign(selNode);selectSelectItem(this.alignselect,align);selectSelectItem(this.classselect,table.className);if(this.toolboxel){this.toolboxel.className=this.activeclass}} else{this.edittablediv.style.display="none";this.addtablediv.style.display="block";this.alignselect.selectedIndex=0;this.classselect.selectedIndex=0;if(this.toolboxel){this.toolboxel.className=this.plainclass}}};TableToolBox.prototype.addTable=function(){var rows=this.newrowsinput.value;var cols=this.newcolsinput.value;var makeHeader=this.makeheaderinput.checked;var tableclass=this.classselect.options[this.classselect.selectedIndex].value;this.tool.createTable(rows,cols,makeHeader,tableclass);this.editor.focusDocument();this.editor.updateState()};TableToolBox.prototype.setColumnAlign=function(){var newalign=this.alignselect.options[this.alignselect.selectedIndex].value;this.editor.focusDocument();this.tool.setColumnAlign(newalign);this.editor.updateState()};TableToolBox.prototype.setTableClass=function(){var sel_class=this.classselect.options[this.classselect.selectedIndex].value;if(sel_class){this.editor.focusDocument();this.tool.setTableClass(sel_class);this.editor.updateState()}};TableToolBox.prototype.addTableRow=function(){this.editor.focusDocument();this.tool.addTableRow();this.editor.updateState()};TableToolBox.prototype.delTableRow=function(){this.editor.focusDocument();this.tool.delTableRow();this.editor.updateState()};TableToolBox.prototype.addTableColumn=function(){this.editor.focusDocument();this.tool.addTableColumn();this.editor.updateState()};TableToolBox.prototype.delTableColumn=function(){this.editor.focusDocument();this.tool.delTableColumn();this.editor.updateState()};TableToolBox.prototype.fixTable=function(){this.editor.focusDocument();this.tool.fixTable();this.editor.updateState()};TableToolBox.prototype.fixAllTables=function(){this.editor.focusDocument();this.tool.fixAllTables();this.editor.updateState()};TableToolBox.prototype.delTable=function(){this.editor.focusDocument();this.tool.delTable();this.editor.updateState()};
function ListTool(addulbuttonid,addolbuttonid,ulstyleselectid,olstyleselectid){this.addulbutton=getFromSelector(addulbuttonid);this.addolbutton=getFromSelector(addolbuttonid);this.ulselect=getFromSelector(ulstyleselectid);this.olselect=getFromSelector(olstyleselectid);this.style_to_type={'decimal':'1','lower-alpha':'a','upper-alpha':'A','lower-roman':'i','upper-roman':'I','disc':'disc','square':'square','circle':'circle','none':'none'};this.type_to_style={'1':'decimal','a':'lower-alpha','A':'upper-alpha','i':'lower-roman','I':'upper-roman','disc':'disc','square':'square','circle':'circle','none':'none'}};ListTool.prototype=new KupuTool;ListTool.prototype.initialize=function(editor){this.editor=editor;if(this.addulbutton){addEventHandler(this.addulbutton,"click",this.addUnorderedList,this)}
if(this.addolbutton){addEventHandler(this.addolbutton,"click",this.addOrderedList,this)}
if(this.ulselect){addEventHandler(this.ulselect,"change",this.setUnorderedListStyle,this);this.ulselect.style.display="none"}
if(this.olselect){addEventHandler(this.olselect,"change",this.setOrderedListStyle,this);this.olselect.style.display="none"}};ListTool.prototype._handleStyles=function(currnode,onselect,offselect){if(this.editor.config.use_css){var currstyle=currnode.style.listStyleType} else{var currstyle=this.type_to_style[currnode.getAttribute('type')]}
if(onselect){selectSelectItem(onselect,currstyle);onselect.style.display="inline"}
if(offselect){offselect.style.display="none";offselect.selectedIndex=0}};ListTool.prototype.updateState=function(selNode){for(var currnode=selNode;currnode;currnode=currnode.parentNode){var tag=currnode.nodeName.toLowerCase();if(tag=='ul'){this._handleStyles(currnode,this.ulselect,this.olselect);return} else if(tag=='ol'){this._handleStyles(currnode,this.olselect,this.ulselect);return}}
if(this.ulselect){this.ulselect.selectedIndex=0;this.ulselect.style.display="none"};if(this.olselect){this.olselect.selectedIndex=0;this.olselect.style.display="none"}};ListTool.prototype.addList=function(command){if(this.ulselect) this.ulselect.style.display="inline";if(this.olselect) this.olselect.style.display="none";this.editor.execCommand(command);this.editor.focusDocument()};ListTool.prototype.addUnorderedList=function(){this.addList("insertunorderedlist")};ListTool.prototype.addOrderedList=function(){this.addList("insertorderedlist")};ListTool.prototype.setListStyle=function(tag,select){if(!select) return;var currnode=this.editor.getSelectedNode();var l=this.editor.getNearestParentOfType(currnode,tag);var style=select.options[select.selectedIndex].value;if(this.editor.config.use_css){l.style.listStyleType=style} else{l.setAttribute('type',this.style_to_type[style])}
this.editor.focusDocument()};ListTool.prototype.setUnorderedListStyle=function(){this.setListStyle('ul',this.ulselect)};ListTool.prototype.setOrderedListStyle=function(){this.setListStyle('ol',this.olselect)};ListTool.prototype.enable=function(){kupuButtonEnable(this.addulbutton);kupuButtonEnable(this.addolbutton);if(this.ulselect) this.ulselect.disabled="";if(this.olselect) this.olselect.disabled=""};ListTool.prototype.disable=function(){kupuButtonDisable(this.addulbutton);kupuButtonDisable(this.addolbutton);if(this.ulselect) this.ulselect.disabled="disabled";if(this.olselect) this.olselect.disabled="disabled"};
function ShowPathTool(){};ShowPathTool.prototype=new KupuTool;ShowPathTool.prototype.updateState=function(selNode){var path='';var url=null;var currnode=selNode;var nn;while(currnode!=null&&(nn=currnode.nodeName.toLowerCase())!='#document'){if(nn=='a'){url=currnode.getAttribute('href')};path='/'+nn+path;currnode=currnode.parentNode}
try{window.status=url?(path.toString()+' - contains link to \''+url.toString()+'\''):path} catch(e){this.editor.logMessage(_('Could not set status bar message, '+'check your browser\'s security settings.'),1)}};
function ViewSourceTool(){this.sourceWindow=null};ViewSourceTool.prototype=new KupuTool;ViewSourceTool.prototype.viewSource=function(){if(this.sourceWindow){this.sourceWindow.close()};this.sourceWindow=window.open('#','sourceWindow');var contents='<html>\n'+this.editor.getInnerDocument().documentElement.innerHTML+'\n</html>';var doc=this.sourceWindow.document;doc.write('\xa0');doc.close();var body=doc.getElementsByTagName("body")[0];while(body.hasChildNodes()){body.removeChild(body.firstChild)};var pre=doc.createElement('pre');var textNode=doc.createTextNode(contents);body.appendChild(pre);pre.appendChild(textNode)};ViewSourceTool.prototype.createContextMenuElements=function(selNode,event){return [new ContextMenuElement(_('View source'),this.viewSource,this)]};
function DefinitionListTool(dlbuttonid){this.dlbutton=getFromSelector(dlbuttonid)};DefinitionListTool.prototype=new KupuTool;DefinitionListTool.prototype.initialize=function(editor){this.editor=editor;if(!this.dlbutton) return;addEventHandler(this.dlbutton,'click',this.createDefinitionList,this);addEventHandler(editor.getInnerDocument(),'keyup',this._keyDownHandler,this);addEventHandler(editor.getInnerDocument(),'keypress',this._keyPressHandler,this)};DefinitionListTool.prototype.handleEnterPress=function(selNode){var dl=this.editor.getNearestParentOfType(selNode,'dl');if(dl){var dt=this.editor.getNearestParentOfType(selNode,'dt');if(dt){if(dt.childNodes.length==1&&dt.childNodes[0].nodeValue=='\xa0'){this.escapeFromDefinitionList(dl,dt,selNode);return};var selection=this.editor.getSelection();var startoffset=selection.startOffset();var endoffset=selection.endOffset();if(endoffset>startoffset){selection.cutChunk(startoffset,endoffset);selection=this.editor.getSelection();startoffset=selection.startOffset()};var ellength=selection.getElementLength(selection.parentElement());if(startoffset>=ellength-1){this.createDefinition(dl,dt)} else{var doc=this.editor.getInnerDocument();var newdt=selection.splitNodeAtSelection(dt);var newdd=doc.createElement('dd');while(newdt.hasChildNodes()){if(newdt.firstChild!=newdt.lastChild||newdt.firstChild.nodeName.toLowerCase()!='br'){newdd.appendChild(newdt.firstChild)}};newdt.parentNode.replaceChild(newdd,newdt);selection.selectNodeContents(newdd);selection.collapse()}} else{var dd=this.editor.getNearestParentOfType(selNode,'dd');if(!dd){this.editor.logMessage(_('Not inside a definition list element!'));return};if(dd.childNodes.length==1&&dd.childNodes[0].nodeValue=='\xa0'){this.escapeFromDefinitionList(dl,dd,selNode);return};var selection=this.editor.getSelection();var startoffset=selection.startOffset();var endoffset=selection.endOffset();if(endoffset>startoffset){selection.cutChunk(startoffset,endoffset);selection=this.editor.getSelection();startoffset=selection.startOffset()};var ellength=selection.getElementLength(selection.parentElement());if(startoffset>=ellength-1){this.createDefinitionTerm(dl,dd)} else{var br=this.editor.getInnerDocument().createElement('br');this.editor.insertNodeAtSelection(br,1);selection.collapse(true)}}}};DefinitionListTool.prototype.handleTabPress=function(selNode){};DefinitionListTool.prototype._keyDownHandler=function(event){var selNode=this.editor.getSelectedNode();var dl=this.editor.getNearestParentOfType(selNode,'dl');if(!dl){return};if(event.keyCode){if(event.preventDefault){event.preventDefault()} else{event.returnValue=false}}};DefinitionListTool.prototype._keyPressHandler=function(event){var selNode=this.editor.getSelectedNode();var dl=this.editor.getNearestParentOfType(selNode,'dl');if(!dl){return};switch(event.keyCode){case 13:this.handleEnterPress(selNode);if(event.preventDefault){event.preventDefault()} else{event.returnValue=false};break;case 9:if(event.preventDefault){event.preventDefault()} else{event.returnValue=false};this.handleTabPress(selNode)}};DefinitionListTool.prototype.createDefinitionList=function(){var selection=this.editor.getSelection();var doc=this.editor.getInnerDocument();var selection=this.editor.getSelection();var cloned=selection.cloneContents();var iterator=new NodeIterator(cloned);var currnode=null;var remove=false;while((currnode=iterator.next())){if(currnode.nodeName.toLowerCase()=='br'){remove=true};if(remove){var next=currnode;while(!next.nextSibling){next=next.parentNode};next=next.nextSibling;iterator.setCurrent(next);currnode.parentNode.removeChild(currnode)}};var dtcontentcontainer=cloned;var collapsetoend=false;var dl=doc.createElement('dl');this.editor.insertNodeAtSelection(dl);var dt=this.createDefinitionTerm(dl);if(dtcontentcontainer.hasChildNodes()){collapsetoend=true;while(dt.hasChildNodes()){dt.removeChild(dt.firstChild)};while(dtcontentcontainer.hasChildNodes()){dt.appendChild(dtcontentcontainer.firstChild)}};var selection=this.editor.getSelection();selection.selectNodeContents(dt);selection.collapse(collapsetoend)};DefinitionListTool.prototype.createDefinitionTerm=function(dl,dd){var doc=this.editor.getInnerDocument();var dt=doc.createElement('dt');if(dd){if(dd.lastChild.nodeName.toLowerCase()=='br'){dd.removeChild(dd.lastChild)}};if(!dd||dl==dd.lastChild){dl.appendChild(dt)} else{var nextsibling=dd.nextSibling;if(nextsibling){dl.insertBefore(dt,nextsibling)} else{dl.appendChild(dt)}};var nbsp=doc.createTextNode('\xa0');dt.appendChild(nbsp);var selection=this.editor.getSelection();selection.selectNodeContents(dt);selection.collapse();this.editor.focusDocument();return dt};DefinitionListTool.prototype.createDefinition=function(dl,dt,initial_content){var doc=this.editor.getInnerDocument();var dd=doc.createElement('dd');var nextsibling=dt.nextSibling;if(dt){if(dt.lastChild.nodeName.toLowerCase()=='br'){dt.removeChild(dt.lastChild)}};while(nextsibling){var name=nextsibling.nodeName.toLowerCase();if(name=='dd'||name=='dt'){break} else{nextsibling=nextsibling.nextSibling}};if(nextsibling){dl.insertBefore(dd,nextsibling)} else{dl.appendChild(dd)};if(initial_content){for(var i=0;i<initial_content.length;i++){dd.appendChild(initial_content[i])}};var nbsp=doc.createTextNode('\xa0');dd.appendChild(nbsp);var selection=this.editor.getSelection();selection.selectNodeContents(dd);selection.collapse()};DefinitionListTool.prototype.escapeFromDefinitionList=function(dl,currel,selNode){var doc=this.editor.getInnerDocument();var p=doc.createElement('p');var nbsp=doc.createTextNode('\xa0');p.appendChild(nbsp);if(dl.lastChild==currel){dl.parentNode.insertBefore(p,dl.nextSibling)} else{for(var i=0;i<dl.childNodes.length;i++){var child=dl.childNodes[i];if(child==currel){var newdl=this.editor.getInnerDocument().createElement('dl');while(currel.nextSibling){newdl.appendChild(currel.nextSibling)};dl.parentNode.insertBefore(newdl,dl.nextSibling);dl.parentNode.insertBefore(p,dl.nextSibling)}}};currel.parentNode.removeChild(currel);var selection=this.editor.getSelection();selection.selectNodeContents(p);selection.collapse();this.editor.focusDocument()};DefinitionListTool.prototype._fixStructure=function(doc,dl,offsetnode){var currname=offsetnode.nodeName.toLowerCase();var currnode=offsetnode.nextSibling;while(currnode){if(currnode.nodeType==1){var nodename=currnode.nodeName.toLowerCase();if(currname=='dt'&&nodename=='dt'){var dd=doc.createElement('dd');while(currnode.hasChildNodes()){dd.appendChild(currnode.childNodes[0])};currnode.parentNode.replaceChild(dd,currnode)} else if(currname=='dd'&&nodename=='dd'){var dt=doc.createElement('dt');while(currnode.hasChildNodes()){dt.appendChild(currnode.childNodes[0])};currnode.parentNode.replaceChild(dt,currnode)}};currnode=currnode.nextSibling}};
function KupuZoomTool(buttonid,firsttab,lasttab){this.button=getFromSelector(buttonid);firsttab=firsttab||'kupu-tb-styles';lasttab=lasttab||'kupu-logo-button';this.initialize=function(editor){this.offclass='kupu-zoom';this.onclass='kupu-zoom-pressed';this.pressed=false;if(!this.button) return;this.baseinitialize(editor);addEventHandler(window,"resize",this.onresize,this);addEventHandler(window,"scroll",this.onscroll,this);var lastbutton=getFromSelector(lasttab);var firstbutton=getFromSelector(firsttab);var iframe=editor.getInnerDocument();this.setTabbing(iframe,firstbutton,lastbutton);this.setTabbing(firstbutton,null,editor.getDocument().getWindow())}};KupuZoomTool.prototype=new KupuLateFocusStateButton;KupuZoomTool.prototype.baseinitialize=KupuZoomTool.prototype.initialize;KupuZoomTool.prototype.onscroll=function(){if(!this.zoomed) return;var top=window.pageYOffset!=undefined?window.pageYOffset:document.documentElement.scrollTop;var left=window.pageXOffset!=undefined?window.pageXOffset:document.documentElement.scrollLeft;if(top||left) window.scrollTo(0,0)};KupuZoomTool.prototype.setTabbing=function(control,forward,backward){
function TabDown(event){if(event.keyCode!=9||!this.zoomed) return;var target=event.shiftKey?backward:forward;if(!target) return;if(event.stopPropogation) event.stopPropogation();event.cancelBubble=true;event.returnValue=false;target.focus();return false}
addEventHandler(control,"keydown",TabDown,this)};KupuZoomTool.prototype.onresize=function(){if(!this.zoomed) return;var editor=this.editor;var iframe=editor.getDocument().editable;var sourcetool=editor.getTool('sourceedittool');var sourceArea=sourcetool?sourcetool.getSourceArea():null;var fulleditor=iframe.parentNode;if(window.innerWidth){var width=window.innerWidth;var height=window.innerHeight} else if(document.documentElement){if(!window._IE_VERSION){_IE_VERSION=/MSIE\s*([0-9.]*)/.exec(navigator.appVersion)};var kludge=(_IE_VERSION[1]<7)?5:0;var width=document.documentElement.offsetWidth-kludge;var height=document.documentElement.offsetHeight-kludge} else{var width=document.body.offsetWidth-5;var height=document.body.offsetHeight-5}
var offset=fulleditor.offsetTop;var nheight=Math.max(height-offset-1,10)+'px';width=width+'px';fulleditor.style.width=width;iframe.style.width=width;iframe.style.height=nheight;if(sourceArea){sourceArea.style.width=width;sourceArea.style.height=nheight}};KupuZoomTool.prototype.checkfunc=function(selNode,button,editor,event){return this.zoomed};KupuZoomTool.prototype.commandfunc=function(button,editor){var zoom=button.pressed;this.zoomed=zoom;var zoomClass='kupu-fulleditor-zoomed';var iframe=editor.getDocument().getEditable();var body=document.body;var html=document.getElementsByTagName('html')[0];var doc=editor.getInnerDocument();if(zoom){html.style.overflow='hidden';window.scrollTo(0,0);editor.setClass(zoomClass);body.className+=' '+zoomClass;doc.body.className+=' '+zoomClass;this.onresize()} else{html.style.overflow='';var fulleditor=iframe.parentNode;fulleditor.style.width='';body.className=body.className.replace(/ *kupu-fulleditor-zoomed/,'');doc.body.className=doc.body.className.replace(/ *kupu-fulleditor-zoomed/,'');editor.clearClass(zoomClass);iframe.style.width='';iframe.style.height='';var sourcetool=editor.getTool('sourceedittool');var sourceArea=sourcetool?sourcetool.getSourceArea():null;if(sourceArea){sourceArea.style.width='';sourceArea.style.height=''}}
doc.designMode=doc.designMode;window.scrollTo(0,iframe.offsetTop);editor.focusDocument()};
function AnchorTool(){};AnchorTool.prototype=new LinkTool;var proto=AnchorTool.prototype;proto.fillStyleSelect=function(select){var ui=this.editor.getTool('ui');var options=ui.getStyles()[0];for(var i=1;i<options.length-1;i++){var cur=options[i];var opt=document.createElement('option');opt.text=cur[0];opt.value=cur[1];select.options.add(opt)}};proto.grubParas=function(style1,style2){var doc=this.editor.getInnerDocument();var body=doc.body;var paras=[];var pat=/(.*?)(\|.*|$)/;var tag1=style1.replace(pat,'$1');var tag2=style2.replace(pat,'$1');if(tag2&&tag2!=tag1){tag1="*"}
if(tag1){var nodes=body.getElementsByTagName(tag1);for(var i=0;i<nodes.length;i++){var node=nodes[i];var style=node.nodeName.toLowerCase()+"|"+node.className;if(style==style1){paras.push([node,0])}
if(style==style2){paras.push([node,1])}}}
return paras};proto.getAnchorsInUse=function(){var doc=this.editor.getInnerDocument();var anchors=doc.getElementsByTagName('a');var inuse={};for(var i=0;i<anchors.length;i++){var m=(/(.*)(#.*)$/.exec(anchors[i].href));if(m){inuse[decodeURIComponent(m[2])]=1}}
return inuse};proto.removeAnchor=function(node){var anchors=node.getElementsByTagName('a');if(anchors.length>0){var anchor=anchors[0];anchor.removeAttribute('name');if(anchor.href) return;anchor.parentNode.removeChild(anchor)}};proto.getAnchor=function(node,ifexists){var anchors=node.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){if(anchors[i].name){return anchors[i].name}}
if(ifexists) return;var anchor=Sarissa.getText(node,true).strip().truncate(40).
replace(/[^\w]+/g,'-').toLowerCase().replace(/-$/,'')||'anchor';anchor=anchor.replace(/^((?:[^-]*-){0,3}[^-]*)(.*)$/,'$1');var unique=0;var existing=this.editor.getInnerDocument().anchors;for(var i=0;i<existing.length;i++){var name=existing[i].name;if(name==anchor){if(unique==0) unique=-1} else if(name.length>anchor.length&&name.substring(0,anchor.length)==anchor){var tail=name.substring(anchor.length);tail=parseInt(tail);if(tail<=unique){unique=tail-1}}}
if(unique) anchor+=unique.toString();node.insertBefore(this.editor.newElement('a',{'name':anchor}),node.firstChild);return anchor};if(window.dump===undefined){var dump=function(msg){}};proto.createContextMenuElements=function(){return []};

/* - kupuloggers.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupuloggers.js?original=1
function DebugLogger(){this.log=function(message,severity){if(severity>1){alert("Error: "+message)} else if(severity==1){alert("Warning: "+message)} else{alert("Log message: "+message)}}}
function PlainLogger(debugelid,maxlength){this.debugel=getFromSelector(debugelid);this.maxlength=maxlength;this.log=function(message,severity){if(severity>1){throw message} else{if(this.maxlength){if(this.debugel.childNodes.length>this.maxlength-1){this.debugel.removeChild(this.debugel.childNodes[0])}}
var now=new Date();var time=now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();var div=document.createElement('div');var text=document.createTextNode(time+' - '+message);div.appendChild(text);this.debugel.appendChild(div)}}}
function DummyLogger(){this.log=function(message,severity){if(severity>1){throw message}}}


/* - kupucontentfilters.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupucontentfilters.js?original=1
function NonXHTMLTagFilter(){if(arguments.length){this.filterdata=arguments[0]} else{this.filterdata={'html':1,'body':1,'head':1,'title':1,'a':1,'abbr':1,'acronym':1,'address':1,'b':1,'base':1,'big':1,'blockquote':1,'br':1,'caption':1,'cite':1,'code':1,'col':1,'colgroup':1,'dd':1,'dfn':1,'div':1,'dl':1,'dt':1,'em':1,'h1':1,'h2':1,'h3':1,'h4':1,'h5':1,'h6':1,'i':1,'img':1,'kbd':1,'li':1,'link':1,'meta':1,'ol':1,'p':1,'pre':1,'q':1,'samp':1,'script':1,'small':1,'span':1,'strong':1,'style':1,'sub':1,'sup':1,'table':1,'tbody':1,'td':1,'tfoot':1,'th':1,'thead':1,'tr':1,'tt':1,'ul':1,'u':1,'var':1,'font':1,'center':0}};this.initialize=function(editor){this.editor=editor};this.filter=function(ownerdoc,htmlnode){return this._filterHelper(ownerdoc,htmlnode)};this._filterHelper=function(ownerdoc,node){if(node.nodeType==3){return ownerdoc.createTextNode(node.nodeValue)} else if(node.nodeType==4){return ownerdoc.createCDATASection(node.nodeValue)};var newnode=ownerdoc.createElement(node.nodeName);for(var i=0;i<node.attributes.length;i++){var attr=node.attributes[i];newnode.setAttribute(attr.nodeName,attr.nodeValue)};for(var i=0;i<node.childNodes.length;i++){var child=node.childNodes[i];var nodeType=child.nodeType;var nodeName=child.nodeName.toLowerCase();if(nodeType==3||nodeType==4){newnode.appendChild(this._filterHelper(ownerdoc,child))};if(nodeName in this.filterdata&&this.filterdata[nodeName]){newnode.appendChild(this._filterHelper(ownerdoc,child))} else if(nodeName in this.filterdata){for(var j=0;j<child.childNodes.length;j++){newnode.appendChild(this._filterHelper(ownerdoc,child.childNodes[j]))}}};return newnode}};
function XhtmlValidation(editor){
function asList(s){if(typeof(s)==typeof('')||!s.length) s=[s];return s}
this.Set=function(ary){if(typeof(ary)==typeof('')) ary=[ary];if(ary instanceof Array){for(var i=0;i<ary.length;i++){this[ary[i]]=1}}
else{for(var v in ary){this[v]=1}}};this._exclude=function(array,exceptions){var ex;if(exceptions.split){ex=exceptions.split("|")} else{ex=exceptions}
var exclude=new this.Set(ex);var res=[];for(var k=0;k<array.length;k++){if(!exclude[array[k]]) res.push(array[k])}
return res};this.setAttrFilter=function(attributes,filter){for(var j=0;j<attributes.length;j++){var attr=attributes[j];this.attrFilters[attr]=filter||this._defaultCopyAttribute}};this.setTagAttributes=function(tags,attributes){for(var j=0;j<tags.length;j++){this.tagAttributes[tags[j]]=attributes}};this.includeTagAttributes=function(tags,attributes){for(var j=0;j<tags.length;j++){var tag=tags[j];this.tagAttributes[tag]=this.tagAttributes[tag].concat(attributes)}};this.excludeTagAttributes=function(tags,attributes){var bad=new this.Set(attributes);var tagset=new this.Set(tags);for(var tag in tagset){var val=this.tagAttributes[tag];if(val){for(var i=val.length;i>=0;i--){if(bad[val[i]]){val=val.concat();val.splice(i,1)}}}
this.tagAttributes[tag]=val;this.badTagAttributes[tag]=attributes}};this.excludeTags=function(badtags){if(typeof(badtags)==typeof('')) badtags=[badtags];for(var i=0;i<badtags.length;i++){delete this.tagAttributes[badtags[i]]}};this.excludeAttributes=function(badattrs){this.excludeTagAttributes(this.tagAttributes,badattrs);for(var i=0;i<badattrs.length;i++){delete this.attrFilters[badattrs[i]]}};var replaceNodes={'b':'strong','i':'em'};if(editor.getBrowserName()=="IE"){this._getTagName=function(htmlnode){var nodename=htmlnode.nodeName.toLowerCase();if(htmlnode.scopeName&&htmlnode.scopeName!="HTML"){nodename=htmlnode.scopeName+':'+nodename}
return replaceNodes[nodename]||nodename}} else{this._getTagName=function(htmlnode){var nodename=htmlnode.nodeName.toLowerCase();return replaceNodes[nodename]||nodename}};this.elements=new function(validation){this.attributes=['abbr','accept','accept-charset','accesskey','action','align','alink','alt','archive','axis','background','bgcolor','border','cellpadding','cellspacing','char','charoff','charset','checked','cite','class','classid','clear','code','codebase','codetype','color','cols','colspan','compact','content','coords','data','datetime','declare','defer','dir','disabled','enctype','face','for','frame','frameborder','headers','height','href','hreflang','hspace','http-equiv','id','ismap','label','lang','language','link','longdesc','marginheight','marginwidth','maxlength','media','method','multiple','name','nohref','noshade','nowrap','object','onblur','onchange','onclick','ondblclick','onfocus','onkeydown','onkeypress','onkeyup','onload','onmousedown','onmousemove','onmouseout','onmouseover','onmouseup','onreset','onselect','onsubmit','onunload','profile','prompt','readonly','rel','rev','rows','rowspan','rules','scheme','scope','scrolling','selected','shape','size','span','src','standby','start','style','summary','tabindex','target','text','title','type','usemap','valign','value','valuetype','vlink','vspace','width','xml:lang','xml:space','xmlns'];this.coreattrs=['id','title','style','class'];this.i18n=['lang','dir','xml:lang'];this.events=[];this.focusevents=[];this.loadevents=[];this.formevents=[];this.inputevents=[] ;this.focus=['accesskey','tabindex'].concat(this.focusevents);this.attrs=[].concat(this.coreattrs,this.i18n,this.events);this.special_extra=['object','applet','img','map','iframe','embed'];this.special_basic=['br','span','bdo'];this.special=[].concat(this.special_basic,this.special_extra);this.fontstyle_extra=['big','small','font','basefont'];this.fontstyle_basic=['tt','i','b','u','s','strike'];this.fontstyle=[].concat(this.fontstyle_basic,this.fontstyle_extra);this.phrase_extra=['sub','sup'];this.phrase_basic=['em','strong','dfn','code','q','samp','kbd','var','cite','abbr','acronym'];this.phrase=[].concat(this.phrase_basic,this.phrase_extra);this.inline_forms=['input','select','textarea','label','button'];this.misc_inline=['ins','del','script'];this.misc=['noscript'].concat(this.misc_inline);this.inline=['a'].concat(this.special,this.fontstyle,this.phrase,this.inline_forms);this.Inline=['#text','#comment'].concat(this.inline,this.misc_inline);this.heading=['h1','h2','h3','h4','h5','h6'];this.lists=['ul','ol','dl','menu','dir'];this.blocktext=['pre','hr','blockquote','address','center','noframes'];this.block=['p','div','isindex','fieldset','table'].concat(this.heading,this.lists,this.blocktext);this.Flow=['#text','form'].concat(this.block,this.inline,this.misc)}(this);this._commonsetting=function(self,names,value){for(var n=0;n<names.length;n++){self[names[n]]=value}};this.tagAttributes=new function(el,validation){this.title=el.i18n.concat('id');this.html=this.title.concat('xmlns');this.head=this.title.concat('profile');this.base=['id','href','target'];this.meta=this.title.concat('http-equiv','name','content','scheme');this.link=el.attrs.concat('charset','href','hreflang','type','rel','rev','media','target');this.style=this.title.concat('type','media','title','xml:space');this.script=['id','charset','type','language','src','defer','xml:space'];this.iframe=['longdesc','name','src','frameborder','marginwidth','marginheight','scrolling','align','height','width'].concat(el.coreattrs);this.body=['background','bgcolor','text','link','vlink','alink'].concat(el.attrs,el.loadevents);validation._commonsetting(this,['p','div'].concat(el.heading),['align'].concat(el.attrs));this.dl=this.dir=this.menu=el.attrs.concat('compact');this.ul=this.menu.concat('type');this.ol=this.ul.concat('start');this.li=el.attrs.concat('type','value');this.hr=el.attrs.concat('align','noshade','size','width');this.pre=el.attrs.concat('width','xml:space');this.blockquote=this.q=el.attrs.concat('cite');this.ins=this.del=this.blockquote.concat('datetime');this.a=el.attrs.concat(el.focus,'charset','type','name','href','hreflang','rel','rev','shape','coords','target');this.bdo=el.coreattrs.concat(el.events,'lang','xml:lang','dir');this.br=el.coreattrs.concat('clear');validation._commonsetting(this,['noscript','noframes','dt','dd','address','center','span','em','strong','dfn','code','samp','kbd','var','cite','abbr','acronym','sub','sup','tt','i','b','big','small','u','s','strike','fieldset'],el.attrs);this.basefont=['id','size','color','face'];this.font=el.coreattrs.concat(el.i18n,'size','color','face');this.object=el.attrs.concat('declare','classid','codebase','data','type','codetype','archive','standby','height','width','usemap','name','tabindex','align','border','hspace','vspace');this.embed=['*'];this.param=['id','name','value','valuetype','type'];this.applet=el.coreattrs.concat('codebase','archive','code','object','alt','name','width','height','align','hspace','vspace');this.img=el.attrs.concat('src','alt','name','longdesc','height','width','usemap','ismap','align','border','hspace','vspace');this.map=this.title.concat('title','name','style','class',el.events);this.area=el.attrs.concat('shape','coords','href','nohref','alt','target',el.focus);this.form=el.attrs.concat('action','method','name','enctype',el.formevents,'accept','accept-charset','target');this.label=el.attrs.concat('for','accesskey',el.focusevents);this.input=el.attrs.concat('type','name','value','checked','disabled','readonly','size','maxlength','src','alt','usemap',el.input,'accept','align',el.focus);this.select=el.attrs.concat('name','size','multiple','disabled','tabindex',el.focusevents,el.input);this.optgroup=el.attrs.concat('disabled','label');this.option=el.attrs.concat('selected','disabled','label','value');this.textarea=el.attrs.concat('name','rows','cols','disabled','readonly',el.inputevents,el.focus);this.legend=el.attrs.concat('accesskey','align');this.button=el.attrs.concat('name','value','type','disabled',el.focus);this.isindex=el.coreattrs.concat('prompt',el.i18n);this.table=el.attrs.concat('summary','width','border','frame','rules','cellspacing','cellpadding','align','bgcolor');this.caption=el.attrs.concat('align');this.col=this.colgroup=el.attrs.concat('span','width','align','char','charoff','valign');this.thead=el.attrs.concat('align','char','charoff','valign');this.tfoot=this.tbody=this.thead;this.tr=this.thead.concat('bgcolor');this.td=this.th=this.tr.concat('abbr','axis','headers','scope','rowspan','colspan','nowrap','width','height')}(this.elements,this);this.badTagAttributes=new this.Set({});this.nastyTags=new this.Set({'script':1,'style':1,'meta':1,'title':1});this.States=new function(el,validation){var here=this;
function setStates(tags,value){var valset=new validation.Set(value);for(var i=0;i<tags.length;i++){here[tags[i]]=valset}}
setStates(['html'],['head','body']);setStates(['head'],['title','base','script','style','meta','link','object','isindex']);setStates(['base','meta','link','hr','param','img','area','input','br','basefont','isindex','col'],[]);setStates(['title','style','script','option','textarea'],['#text']);setStates(['noscript','iframe','noframes','body','div','li','dd','blockquote','center','ins','del','td','th'],el.Flow);setStates(el.heading,el.Inline);setStates(['p','dt','address','span','bdo','caption','em','strong','dfn','code','samp','kbd','var','cite','abbr','acronym','q','sub','sup','tt','i','b','big','small','u','s','strike','font','label','legend'],el.Inline);setStates(['ul','ol','menu','dir','ul'],['li']);setStates(['dl'],['dt','dd']);setStates(['pre'],validation._exclude(el.Inline,"img|object|embed|applet|big|small|sub|sup|font|basefont"));setStates(['a'],validation._exclude(el.Inline,"a"));setStates(['applet','object','embed'],['#text','param','form'].concat(el.block,el.inline,el.misc));setStates(['map'],['form','area'].concat(el.block,el.misc));setStates(['form'],validation._exclude(el.Flow,['form']));setStates(['select'],['optgroup','option']);setStates(['optgroup'],['option']);setStates(['fieldset'],['#text','legend','form'].concat(el.block,el.inline,el.misc));setStates(['button'],validation._exclude(el.Flow,['a','form','iframe'].concat(el.inline_forms)));setStates(['table'],['caption','col','colgroup','thead','tfoot','tbody','tr']);setStates(['thead','tfoot','tbody'],['tr']);setStates(['colgroup'],['col']);setStates(['tr'],['th','td'])}(this.elements,this);this.styleWhitelist=new this.Set(['text-align','list-style-type','float']);this.classBlacklist=new this.Set(['MsoNormal','MsoTitle','MsoHeader','MsoFootnoteText','Bullet1','Bullet2','Apple-span-style']);this.classFilter=function(value){var classes=value.split(' ');var filtered=[];for(var i=0;i<classes.length;i++){var c=classes[i];if(c&&!this.classBlacklist[c]){filtered.push(c)}}
return filtered.join(' ')};this._defaultCopyAttribute=function(name,htmlnode,xhtmlnode){var val=htmlnode.getAttribute(name);if(val) xhtmlnode.setAttribute(name,val);return!!val};var filter=this;this.attrFilters=new function(validation,editor){var attrs=validation.elements.attributes;for(var i=0;i<attrs.length;i++){this[attrs[i]]=validation._defaultCopyAttribute}
this['class']=function(name,htmlnode,xhtmlnode){var val=htmlnode.getAttribute('class');if(val) val=validation.classFilter(val);if(val) xhtmlnode.setAttribute('class',val);return!!val};this['*']=function(name,htmlnode,xhtmlnode){var res=false;var nodeName=filter._getTagName(htmlnode);var bad=filter.badTagAttributes[nodeName];for(var i=0;i<htmlnode.attributes.length;i++){var attr=htmlnode.attributes[i];var name=attr.name;if(bad&&bad.contains(name)){continue};if(attr.specified){xhtmlnode.setAttribute(name,attr.value);res=true}};return res};if(editor.getBrowserName()=="IE"){this['class']=function(name,htmlnode,xhtmlnode){var val=htmlnode.className;if(val){val=validation.classFilter(val);if(val) xhtmlnode.setAttribute('class',val)} else{val=htmlnode.getAttribute("class");if(val) val=validation.classFilter(val);if(val) xhtmlnode.setAttribute('class',val)}
return!!val};this['http-equiv']=function(name,htmlnode,xhtmlnode){var val=htmlnode.httpEquiv;if(val) xhtmlnode.setAttribute('http-equiv',val);return!!val};this['xml:lang']=this['xml:space']=function(name,htmlnode,xhtmlnode){try{var val=htmlnode.getAttribute(name);if(val) xhtmlnode.setAttribute(name,val);return!!val} catch(e){}}}
this.alt=function(name,htmlnode,xhtmlnode){var val=htmlnode.getAttribute(name);var ok=val||xhtmlnode.tagName=='img';if(ok) xhtmlnode.setAttribute(name,val);return ok};this.rowspan=this.colspan=function(name,htmlnode,xhtmlnode){var val=htmlnode.getAttribute(name);var ok=val&&val!='1';if(ok) xhtmlnode.setAttribute(name,val);return ok};this.style=function(name,htmlnode,xhtmlnode){var val=htmlnode.style.cssText;if(val){var styles=val.split(/; */);for(var i=styles.length;i>=0;i--) if(styles[i]){var parts=/^([^:]+): *(.*)$/.exec(styles[i]);var name=parts[1].toLowerCase();if(validation.styleWhitelist[name]){styles[i]=name+': '+parts[2]} else{styles.splice(i,1)}}
if(styles[styles.length-1]) styles.push('');val=styles.join('; ').strip()};if(val) xhtmlnode.setAttribute('style',val);return!!val}}(this,editor);this.excludeTags(['center','meta','title']);if(editor.config&&editor.config.htmlfilter){this.filterStructure=editor.config.htmlfilter.filterstructure;var exclude=editor.config.htmlfilter;if(exclude.a){this.excludeAttributes(exclude.a)}
if(exclude.t){this.excludeTags(exclude.t)}
if(exclude.c){var c=asList(exclude.c);for(var i=0;i<c.length;i++){this.excludeTagAttributes(c[i].t,c[i].a)}}
if(exclude.xstyle){var s=asList(exclude.xstyle);for(var i=0;i<s.length;i++){this.styleWhitelist[s[i]]=1}}
if(exclude['class']){var c=asList(exclude['class']);for(var i=0;i<c.length;i++){this.classBlacklist[c[i]]=1}}};this._copyAttributes=function(htmlnode,xhtmlnode,valid){var name;var res=false;if(valid.contains('*')){res=this.attrFilters['*'](name,htmlnode,xhtmlnode);if(res===undefined) res=true} else{for(var i=0;i<valid.length;i++){name=valid[i];var filter=this.attrFilters[name];if(filter){var f=filter(name,htmlnode,xhtmlnode);res|=(f||f===undefined)}}}
return res};this._xmlCopyAttr=function(srcnode,target){var valid=this.tagAttributes[srcnode.nodeName];for(var i=0;i<valid.length;i++){var val=srcnode.getAttribute(valid[i]);if(val){target.setAttribute(valid[i],val)}}};this._convertToSarissaNode=function(ownerdoc,htmlnode){var root=this._convertNodes(ownerdoc,htmlnode,null,new this.Set(['html']));this._cleanupBr(ownerdoc,root);this._cleanupParas(ownerdoc,root);return root};this._cleanupPara=function(ownerdoc,para){var permitted=this.States.p;var nodes=[[]];var idx=0;for(var child=para.firstChild;child;child=child.nextSibling){var nn=child.nodeName.toLowerCase();if(permitted[nn]&&(nn!='img'||!(/\bcaptioned\b/i.test(child.getAttribute('class'))))){nodes[idx].push(child)} else{if(nodes[idx].length){nodes.push(child)} else{nodes[idx]=child}
nodes.push([]);idx=nodes.length-1}}
if(!nodes[idx].length){nodes.splice(idx,1)};if(nodes.length>0&&nodes[0] instanceof Array&&!nodes[0].length){nodes.splice(0,1)}
if(nodes.length==0||(nodes.length==1&&nodes[0] instanceof Array)){return}
var parentnode=para.parentNode;for(var idx=0;idx<nodes.length;idx++){var n=nodes[idx];if(n instanceof Array){var newp=ownerdoc.createElement('p');this._xmlCopyAttr(para,newp);for(var ln=n.length-1;ln>=0;ln--){var nn=n[ln].nodeName.toLowerCase();if(nn=='br'||(nn=='#text'&&(/^\s*$/.test(n[ln].nodeValue)))){n.splice(ln,1)} else{break}}
if(n.length==0){continue}
for(var j=0;j<n.length;j++){newp.appendChild(n[j])}
n=newp}
parentnode.insertBefore(n,para)}
parentnode.removeChild(para)};this._cleanupParas=function(ownerdoc,root){var paras=root.getElementsByTagName('p');for(var i=paras.length-1;i>=0;i--){this._cleanupPara(ownerdoc,paras[i])}};this._cleanupBr=function(ownerdoc,root){var breaks=root.getElementsByTagName('br');for(var i=breaks.length-1;i>=0;i--){var node=breaks[i];var parentNode=node.parentNode;if(parentNode.tagName=='body'){var p=ownerdoc.createElement('p');var prev=node.previousSibling;if(prev&&prev.nodeType==3){p.appendChild(prev)}
parentNode.insertBefore(p,node);parentNode.removeChild(node)} else if(!node.nextSibling&&(/(p|div)\b/i.test(parentNode.nodeName)&&!(node.previousSibling&&node.previousSibling.nodeName=='br'))){parentNode.removeChild(node)}}};this._convertNodes=function(ownerdoc,htmlnode,xhtmlparent,permitted){var parentnode=xhtmlparent;var nodename=this._getTagName(htmlnode);var nostructure=!this.filterstructure;var validattrs=this.tagAttributes[nodename];if(validattrs&&(nostructure||permitted[nodename])){try{var xhtmlnode=ownerdoc.createElement(nodename);parentnode=xhtmlnode} catch(e){};if(validattrs&&xhtmlnode){if(!this._copyAttributes(htmlnode,xhtmlnode,validattrs)&&nodename=='span'){parentnode=xhtmlparent;xhtmlnode=null}}} else{if(this.nastyTags[nodename]){return null}}
var kids=htmlnode.childNodes;var permittedChildren=this.States[parentnode.tagName]||permitted;if(kids.length==0){if(htmlnode.text&&htmlnode.text!=""&&(nostructure||permittedChildren['#text'])){var text=htmlnode.text;var tnode=ownerdoc.createTextNode(text);parentnode.appendChild(tnode)}} else{for(var i=0;i<kids.length;i++){var kid=kids[i];if(kid.parentNode!==htmlnode){if(kid.tagName.toLowerCase()=='body'){if(nodename!='html') continue} else if(kid.parentNode.tagName===htmlnode.tagName){continue}}
if(kid.nodeType==1){var newkid=this._convertNodes(ownerdoc,kid,parentnode,permittedChildren);if(newkid!=null){parentnode.appendChild(newkid)}} else if(kid.nodeType==3){if(nostructure||permittedChildren['#text']){parentnode.appendChild(ownerdoc.createTextNode(kid.nodeValue))}} else if(kid.nodeType==4){if(nostructure||permittedChildren['#text']){parentnode.appendChild(ownerdoc.createCDATASection(kid.nodeValue))}} else if(kid.nodeType==8){parentnode.appendChild(ownerdoc.createComment(kid.nodeValue))}}}
return xhtmlnode}}


/* - kupucontextmenu.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupucontextmenu.js?original=1
function ContextMenu(){this.contextmenu=null;this.seperator=1;this.initialize=function(editor){this.editor=editor;addEventHandler(this.editor.getInnerDocument(),"contextmenu",this.createContextMenu,this);addEventHandler(document,"focus",this.hideContextMenu,this);addEventHandler(editor.getInnerDocument(),"mousedown",this.hideContextMenu,this);addEventHandler(document,"mousedown",this.hideContextMenu,this)};this.createContextMenu=function(event){if(event.stopPropagation){event.stopPropagation()};event.returnValue=false;if(this.editor.getBrowserName()=='IE'){this.editor._saveSelection()};if(this.editor.getBrowserName()=='Mozilla'&&this.contextmenu){return false};this.hideContextMenu();var selNode=this.editor.getSelectedNode();var elements=[];for(var id in this.editor.tools){var tool=this.editor.tools[id];if(tool.createContextMenuElements){var els=tool.createContextMenuElements(selNode,event);elements=elements.concat(els)}};this._createNewContextMenu(elements,event);this.last_event=event;return false};this.hideContextMenu=function(event){if(this.contextmenu){try{window.document.getElementsByTagName('body')[0].removeChild(this.contextmenu)} catch(e){};this.contextmenu=null}};this._createNewContextMenu=function(elements,event){var doc=window.document;var menu=doc.createElement('div');menu.contentEditable=false;menu.designMode='Off';this._setMenuStyle(menu);for(var i=0;i<elements.length;i++){var element=elements[i];if(element!==this.seperator){var div=doc.createElement('div');div.style.width='100%';var label=doc.createTextNode('\u00a0'+element.label);div.appendChild(label);menu.appendChild(div);element.element=div;addEventHandler(div,"mousedown",element.action,element.context);addEventHandler(div,"mouseover",element.changeOverStyle,element);addEventHandler(div,"mouseout",element.changeNormalStyle,element);addEventHandler(div,"mouseup",this.hideContextMenu,this)} else{var hr=doc.createElement('hr');menu.appendChild(hr)}};var iframe=this.editor.getDocument().getEditable();var left=event.clientX;var top=event.clientY;var currnode=iframe;if(this.editor.getBrowserName()=='IE'){while(currnode){left+=currnode.offsetLeft+currnode.clientLeft;top+=currnode.offsetTop+currnode.clientTop;currnode=currnode.offsetParent}} else{while(currnode){left+=currnode.offsetLeft;top+=currnode.offsetTop;currnode=currnode.offsetParent}};menu.style.left=left+'px';menu.style.top=top+'px';menu.style.visibility='visible';addEventHandler(menu,'focus', function(){this.blur()},menu);doc.getElementsByTagName('body')[0].appendChild(menu);this.contextmenu=menu};this._setMenuStyle=function(menu){menu.style.position='absolute';menu.style.backgroundColor='white';menu.style.fontFamily='Verdana, Arial, Helvetica, sans-serif';menu.style.fontSize='12px';menu.style.lineHeight='16px';menu.style.borderWidth='1px';menu.style.borderStyle='solid';menu.style.borderColor='black';menu.style.cursor='default';menu.style.width="8em"};this._showOriginalMenu=function(event){window.document.dispatchEvent(this._last_event)}};
function ContextMenuElement(label,action,context){this.label=label;this.action=action;this.context=context;this.element=null;this.changeOverStyle=function(event){this.element.style.backgroundColor='blue'};this.changeNormalStyle=function(event){this.element.style.backgroundColor='white'}}


/* - kupuploneeditor.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupuploneeditor.js?original=1
KupuEditor.prototype._getBase=function(dom){var base=dom.getElementsByTagName('base');if(base.length){return base[0].getAttribute('href')} else{return ''}};KupuEditor.prototype.makeLinksRelative=function(contents,base,debug){var href=base.replace(/\/[^\/]*$/,'/');var pageid=/.*\/([^\/]*)$/.exec(base)[1];var hrefparts=href.split('/');contents=contents.replace(/(<[^>]* (?:src|href)=")([^"]*)"/g,
function(str,tag,url,offset,contents){var resolveuid=url.indexOf('/resolveuid/');if(resolveuid!=-1){str=tag+url.substr(resolveuid+1)+'"';return str}
var urlparts=url.split('#');var anchor=urlparts[1]||'';url=urlparts[0];var urlparts=url.split('/');var common=0;while(common<urlparts.length&&common<hrefparts.length&&urlparts[common]==hrefparts[common]){common++}
var last=urlparts[common];if(common==urlparts.length){urlparts[common]='.'}
else if(common+1==urlparts.length&&(last=='emptypage'||last==pageid)){urlparts[common]=''}
if(common>2){var path=[];var i=0;for(;i+common<hrefparts.length-1;i++){path[i]='..'};while(common<urlparts.length){path[i++]=urlparts[common++]};if(i==0&&!anchor){path[i++]='#'}
str=path.join('/');if(anchor||str==""){str=[str,anchor].join('#')}
str=tag+str+'"'};return str});contents=contents.replace(/<a\s+href="[^"]*"\s*>\s*<\/a>/g,'');contents=contents.replace(/<((p|div)\b[^>]*)>\s*<\/\2>(<br \/>)*/g,'<$1>&nbsp;</$2>').strip();return contents};KupuEditor.prototype.saveDataToField=function(form,field){var sourcetool=this.getTool('sourceedittool');if(sourcetool){sourcetool.cancelSourceMode()};if(!this._initialized){return};this._initialized=false;window.status="Please wait while saving document...";this.logMessage("Starting HTML cleanup");var transform=this._filterContent(this.getInnerDocument().documentElement);var contents=this.getXMLBody(transform);if (/^<body[^>]*>(<\/?(p|br)[^>]*>|\&nbsp;|\s)*<\/body>$/.test(contents)){contents=''}
var base=this._getBase(transform);contents=this._fixupSingletons(contents);contents=this.makeLinksRelative(contents,base).replace(/<\/?body[^>]*>/g,"");this.logMessage("Cleanup done, sending document to server");field.value=contents;this.content_changed=false};

/* - kupuploneui.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupuploneui.js?original=1


/* - kupusourceedit.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupusourceedit.js?original=1
function SourceEditTool(sourcebuttonid,sourceareaid){this.sourceButton=getFromSelector(sourcebuttonid);this.sourcemode=false;this._currently_editing=null;this.getSourceArea=function(){return getFromSelector(sourceareaid)}};SourceEditTool.prototype=new KupuTool;SourceEditTool.prototype.cancelSourceMode=function(){if(this._currently_editing){this.switchSourceEdit(null,true)}};SourceEditTool.prototype.updateState=SourceEditTool.prototype.cancelSourceMode;SourceEditTool.prototype.initialize=function(editor){this.editor=editor;if(!this.sourceButton) return;addEventHandler(this.sourceButton,"click",this.switchSourceEdit,this);this.editor.logMessage(_('Source edit tool initialized'))};SourceEditTool.prototype.switchSourceEdit=function(event,nograb){var kupu=this.editor;var docobj=this._currently_editing||kupu.getDocument();var editorframe=docobj.getEditable();var sourcearea=this.getSourceArea();var kupudoc=docobj.getDocument();var sourceClass='kupu-sourcemode';if(!this.sourcemode){if(window.drawertool){window.drawertool.closeDrawer()}
if (/on/i.test(kupudoc.designMode)){kupudoc.designMode='Off'};kupu._initialized=false;var data='';if(kupu.config.filtersourceedit){window.status=_('Cleaning up HTML...');var transform=kupu._filterContent(kupu.getInnerDocument().documentElement);data=kupu.getXMLBody(transform);data=kupu._fixupSingletons(data).replace(/<\/?body[^>]*>/g,"");if(kupu._getBase&&kupu.makeLinksRelative){var base=kupu._getBase(transform);data=kupu.makeLinksRelative(data,base).replace(/<\/?body[^>]*>/g,"")};window.status=''} else{data=kupu.getHTMLBody()}
sourcearea.value=data.strip();kupu.setClass(sourceClass);editorframe.style.display='none';sourcearea.style.display='block';if(!nograb){sourcearea.focus()};this._currently_editing=docobj} else{kupu.setHTMLBody(sourcearea.value);kupu.clearClass(sourceClass);sourcearea.style.display='none';editorframe.style.display='block';if (/off/i.test(kupudoc.designMode)){kupudoc.designMode='On'};if(!nograb){docobj.getWindow().focus();var selection=this.editor.getSelection();selection.collapse()};kupu._initialized=true;this._currently_editing=null;this.editor.updateState()};this.sourcemode=!this.sourcemode};SourceEditTool.prototype.enable=function(){kupuButtonEnable(this.sourceButton)};SourceEditTool.prototype.disable=function(){kupuButtonDisable(this.sourceButton)};
function MultiSourceEditTool(sourcebuttonid,textareaprefix){this.sourceButton=getFromSelector(sourcebuttonid);this.textareaprefix=textareaprefix;this._currently_editing=null};MultiSourceEditTool.prototype=new SourceEditTool;MultiSourceEditTool.prototype.getSourceArea=function(){var docobj=this._currently_editing||kupu.getDocument();var sourceareaid=this.textareaprefix+docobj.getEditable().id;return getFromSelector(sourceareaid)};

/* - kupudrawers.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupudrawers.js?original=1
function kupu_busy(ed){if(ed.busy) ed.busy()}
function kupu_notbusy(ed,force){if(ed.notbusy) ed.notbusy(force)}
function DrawerTool(){this.drawers={};this.current_drawer=null;this.initialize=function(editor){this.editor=editor;this.isIE=this.editor.getBrowserName()=='IE';window.drawertool=this};this.registerDrawer=function(id,drawer,editor){this.drawers[id]=drawer;drawer.initialize(editor||this.editor,this)};this.openDrawer=function(id,args){if(this.current_drawer){this.closeDrawer()};var drawer=this.drawers[id];if(this.isIE){drawer.editor._saveSelection()}
this.current_drawer=drawer;if(args===undefined) args=[];if(this.isIE){drawer.initMask(drawer.element)}
drawer.createContent.apply(drawer,args);drawer.editor.suspendEditing();drawer.fixMask()};this.updateState=function(selNode){};this.closeDrawer=function(button){if(!this.current_drawer){return};this.current_drawer.hide();this.current_drawer.editor.resumeEditing();this.current_drawer=null;kupu_notbusy(this.editor,true)}};DrawerTool.prototype=new KupuTool;
function Drawer(elementid,tool){this.element=getFromSelector(elementid);this.tool=tool}
var proto=Drawer.prototype;proto.initialize=function(editor,drawertool){this.editor=editor;this.drawertool=drawertool};proto.createContent=function(){this.element.style.display='block';this.focusElement()};proto.hide=function(){if(this.maskframe){this.maskframe.style.display='none'}
this.element.style.display='none';this.focussed=false};proto.focusElement=function(){this.focussed=false;var iterator=new NodeIterator(this.element);var currnode=iterator.next();while(currnode){if(currnode.tagName&&(currnode.tagName.toUpperCase()=='BUTTON'||(currnode.tagName.toUpperCase()=='INPUT'&&!(/nofocus/.test(currnode.className))))){this.focussed=true;
function focusit(){try{currnode.focus()}catch(e){}}
timer_instance.registerFunction(this,focusit,100);return}
currnode=iterator.next()}};proto.initMask=function(el){var e=(this.maskframe=document.getElementById('kupu-maskframe'));if(!this.maskframe){e=this.maskframe=newElement('iframe',{'id':'kupu-maskframe','src':"javascript:false;",'frameBorder':"0",'scrolling':"no"});var style=e.style;style.display='none'}
el.parentNode.insertBefore(e,el)};proto.fixMask=function(){var mask=this.maskframe;if(mask){if(mask.parentNode!=this.element.parentNode){this.element.parentNode.insertBefore(mask,this.element)}
var el=this.element;var st=mask.style;var st1=el.style;st.top=st1.top;st.left=st1.left;st.width=el.offsetWidth+'px';st.height=el.offsetHeight+'px';st.left=(el.offsetLeft)+'px';st.position='absolute';st.display=''}};proto.switchMode=function(event){event=event||window.event;var target=event.currentTarget||event.srcElement;var el=target;while(!(/^li$/i.test(el.nodeName))){el=el.parentNode};var thistab=el;while(!(/^ul$/i.test(el.nodeName))){el=el.parentNode};var tabs=el.getElementsByTagName('li');for(var i=0;i<tabs.length;i++){var el=tabs[i];var cls=el.className.replace(/\s*selected/g,'');if(el===thistab){this.panel.className='kupu-panels '+cls;cls+=' selected'}
if(el.className!=cls){el.className=cls}}
if(this.fillList) this.fillList();this.fixMask();if(event.preventDefault){event.preventDefault()}
event.returnValue=false;return false};
function DrawerWithAnchors(editor,drawertool,anchorui){Drawer.call(this,editor,drawertool);this.anchorui=anchorui;this.anchorframe=null}
DrawerWithAnchors.prototype=new Drawer;proto=DrawerWithAnchors.prototype;proto.initAnchors=function(){var limit=40;var anchorframe=this.anchorframe;var ed=this.editor;
function onloadEvent(){var state=anchorframe.readyState;if(state&&!(/complete/.test(state))){if(limit--&&anchorframe.src==src){timer_instance.registerFunction(this,onloadEvent,500)} else{kupu_notbusy(ed,true)}
return};if(window.drawertool&&window.drawertool.current_drawer){window.drawertool.current_drawer.anchorframe_loaded()};kupu_notbusy(ed)};var id='kupu-linkdrawer-anchors';var base=(this.anchorui=getBaseTagClass(this.element,'div',id));if(base){var inp=base.getElementsByTagName('input');if(inp.length>1){inp[1].disabled=true}
var src=inp[0].value;inp[0].value="";if(!src){return}
kupu_busy(ed);if(this.anchorframe.readyState){anchorframe.src=src;onloadEvent()} else{this.anchorframe.onload=onloadEvent;anchorframe.src=src}}};proto.anchorSelect=function(){return this.anchorui&&this.anchorui.getElementsByTagName('select')[0]};proto.addSelectEvent=function(){var s=this.anchorSelect();if(s){addEventHandler(s,'change',this.selChange,this)}};proto.hideAnchors=function(){this.anchorui.style.display='none'};proto.anchorText=function(a){var blocktag=/^div|p|body|td|h.$/i;var txt='';var prefix='#'+a.name;for(var node=a;node&&!txt;node=node.parentNode){var txt=node.textContent||node.innerText||'';if(txt||blocktag.test(node.nodeName)){break}
for(var sibling=node.nextSibling;sibling&&!txt;sibling=sibling.nextSibling){if(sibling.nodeName.toLowerCase()=='#text'){txt=sibling.data.strip()} else{txt+=sibling.textContent||sibling.innerText||''};txt=txt.strip()}}
if(txt){txt=' ('+(txt||'').substring(0,80).reduceWhitespace().strip()+')'}
return prefix+txt};proto.selChange=function(){};proto.anchorframe_loaded=function(){this.showAnchors('')};proto.showAnchors=function(selected){var select=this.anchorSelect();var opts=select.options;while(opts.length>1) opts[1]=null;try{var doc=this.anchorframe.contentWindow.document;var anchors=doc.anchors} catch(e){this.hideAnchors();return}
for(var i=0;i<anchors.length;i++){var a=anchors[i];if(a.name){var opt=document.createElement('option');opt.text=this.anchorText(anchors[i]);var v=anchors[i].name;opt.value=v;if(v==selected) opt.selected=true;select.options.add(opt)}}
select.disabled=false;if(opts.length>1){this.anchorui.style.display=''}};proto.getFragment=function(){var select=this.anchorSelect();if(select){var anchor=select.options[select.selectedIndex].value;if(anchor) return '#'+anchor}
return ''};
function LinkDrawer(elementid,tool){DrawerWithAnchors.call(this,elementid,tool);var input=getBaseTagClass(this.element,'input','kupu-linkdrawer-input');var embed=getBaseTagClass(this.element,'textarea','kupu-embed-input');var preview=getBaseTagClass(this.element,'iframe','kupu-linkdrawer-preview');var watermark=getBaseTagClass(this.element,'div','watermark');this.anchorframe=preview;this.anchorui=getBaseTagClass(this.element,'tr','kupu-linkdrawer-anchors');this.target='';this.panel=getBaseTagClass(this.element,'div','kupu-panels');var kuputabs=getBaseTagClass(this.element,'ul','kupu-tabs');if(kuputabs){var tabs=kuputabs.getElementsByTagName('a');for(var i=0;i<tabs.length;i++){addEventHandler(tabs[i],'click',this.switchMode,this)}}
if(embed){addEventHandler(embed,'click', function(){if(embed.defaultValue==embed.value){embed.select()}})}
this.selChange=function(){var anchor=this.getFragment();input.value=input.value.replace(/#[^#]*$/,'');if(anchor){input.value+=anchor}};this.addSelectEvent();this.createContent=function(){var ed=this.editor;var currnode=ed.getSelectedNode();var linkel=ed.getNearestParentOfType(currnode,'a');input.value="";this.preview();if(linkel){input.value=linkel.getAttribute('href')} else{input.value='http://'};var obj=ed.getNearestParentOfType(currnode,'object')||ed.getNearestParentOfType(currnode,'embed');if(obj){embed.value=getOuterHtml(obj)} else{embed.value=embed.defaultValue}
this.element.style.display='block';this.hideAnchors();this.focusElement()};this.save=function(){this.editor.resumeEditing();if(this.getMode()){var url=input.value;this.tool.createLink(url,null,null,this.target,null,'external-link');input.value=''} else{var doc=this.editor.getInnerDocument();var selection=this.editor.getSelection();var dummy=doc.createElement("div");dummy.innerHTML=embed.value;try{for(var j=dummy.childNodes.length-1;j>=0;j--){var c=dummy.childNodes[j];if (/^\//.test(c.nodeName)){dummy.removeChild(c)}}
while(dummy.firstChild){var c=dummy.firstChild;selection.replaceWithNode(c,!c.nextSibling)}} catch(e){}}
this.drawertool.closeDrawer()};
function currentAnchor(){var bits=input.value.split('#');var current=bits.length>1?bits[bits.length-1]:'';return current}
this.getMode=function(){return!!(/addlink/.test(this.panel.className))};this.preview=function(){if(this.getMode()){var ok=false;watermark.style.display='';if (/^http(s?):\x2f\x2f./.test(input.value)){try{preview.src=input.value;ok=true} catch(e){alert('Preview blew up"'+input.value+'"')}} else{preview.src='';if(input.value.strip()){alert(_('Can only preview web urls'))}}
if(ok){this.showAnchors(currentAnchor());if(this.editor.getBrowserName()=='IE'){preview.width="800";preview.height="365";preview.style.zoom="60%"}}}};this.preview_loaded=function(){watermark.style.display=(/^http(s?):\x2f\x2f./.test(input.value))?'none':'';var here=input.value;try{var there=preview.contentWindow.location.href} catch(e){return}
if(there&&here!=there&&!(/^about:/.test(there))){input.value=there}
this.showAnchors(currentAnchor())};addEventHandler(preview,"load",this.preview_loaded,this)};LinkDrawer.prototype=new DrawerWithAnchors;
function TableDrawer(elementid,tool){this.element=getFromSelector(elementid);this.tool=tool;this.addpanel=getBaseTagClass(this.element,'div','kupu-tabledrawer-addtable');this.editpanel=getBaseTagClass(this.element,'div','kupu-tabledrawer-edittable');var editclassselect=getBaseTagClass(this.element,'select','kupu-tabledrawer-editclasschooser');var addclassselect=getBaseTagClass(this.element,'select','kupu-tabledrawer-addclasschooser');var alignselect=getBaseTagClass(this.element,'select','kupu-tabledrawer-alignchooser');var newrowsinput=getBaseTagClass(this.element,'input','kupu-tabledrawer-newrows');var newcolsinput=getBaseTagClass(this.element,'input','kupu-tabledrawer-newcols');var makeheadercheck=getBaseTagClass(this.element,'input','kupu-tabledrawer-makeheader');this.createContent=function(){var editor=this.editor;var selNode=editor.getSelectedNode();
function fixClasses(classselect){if(editor.config.table_classes){var classes=editor.config.table_classes['class'];while(classselect.hasChildNodes()){classselect.removeChild(classselect.firstChild)};for(var i=0;i<classes.length;i++){var classinfo=classes[i];var caption=classinfo.xcaption||classinfo;var classname=classinfo.classname||classinfo;var option=document.createElement('option');var content=document.createTextNode(caption);option.appendChild(content);option.setAttribute('value',classname);classselect.appendChild(option)}}};fixClasses(addclassselect);fixClasses(editclassselect);var table=editor.getNearestParentOfType(selNode,'table');var show,hide;if(!table){show=this.addpanel;hide=this.editpanel} else{show=this.editpanel;hide=this.addpanel;var align=this.tool._getColumnAlign(selNode);selectSelectItem(alignselect,align);selectSelectItem(editclassselect,table.className)};hide.style.display='none';show.style.display='block';this.element.style.display='block';this.focusElement()};this.createTable=function(){this.editor.resumeEditing();var rows=newrowsinput.value;var cols=newcolsinput.value;var style=addclassselect.value;var add_header=makeheadercheck.checked;this.tool.createTable(parseInt(rows),parseInt(cols),add_header,style);this.drawertool.closeDrawer()};this.delTableRow=function(){this.editor.resumeEditing();this.tool.delTableRow();this.editor.suspendEditing()};this.addTableRow=function(){this.editor.resumeEditing();this.tool.addTableRow();this.editor.suspendEditing()};this.delTableColumn=function(){this.editor.resumeEditing();this.tool.delTableColumn();this.editor.suspendEditing()};this.addTableColumn=function(){this.editor.resumeEditing();this.tool.addTableColumn();this.editor.suspendEditing()};this.fixTable=function(){this.editor.resumeEditing();this.tool.fixTable();this.editor.suspendEditing()};this.fixAllTables=function(){this.editor.resumeEditing();this.tool.fixAllTables();this.editor.suspendEditing()};this.delTable=function(){this.editor.resumeEditing();this.tool.delTable();this.drawertool.closeDrawer()};this.setTableClass=function(className){this.editor.resumeEditing();this.tool.setTableClass(className);this.editor.suspendEditing()};this.setColumnAlign=function(align){this.editor.resumeEditing();this.tool.setColumnAlign(align);this.editor.suspendEditing()}};TableDrawer.prototype=new Drawer;
function LibraryDrawer(tool,xsluri,libsuri,searchuri,baseelement,selecturi){this.showupload='';this.showanchors='';this.multiple=false;this.currentSelection=[];this.init=function(tool,xsluri,libsuri,searchuri,baseelement,selecturi){this.drawerid='kupu-librarydrawer';this.librariespanelid='kupu-librariespanel';this.resourcespanelid='kupu-resourcespanel';this.propertiespanelid='kupu-propertiespanel';this.breadcrumbsid='kupu-breadcrumbs';if(baseelement){this.baseelement=getFromSelector(baseelement)} else{this.baseelement=getBaseTagClass(document.body,'div','kupu-librarydrawer-parent')}
this.anchorframe=getBaseTagClass(this.baseelement,'iframe','kupu-anchorframe');var e;this.tool=tool;this.element=document.getElementById(this.drawerid);if(!this.element){e=document.createElement('div');e.id=this.drawerid;e.className='kupu-drawer '+this.drawerid;this.baseelement.appendChild(e);this.element=e}
this.shared.xsluri=xsluri;this.libsuri=libsuri;this.searchuri=searchuri;this.selecturi=selecturi;this.shared.newimages=null;this.shared.xsl=null;this.xmldata=null};if(tool){this.init(tool,xsluri,libsuri,searchuri,baseelement,selecturi)}
this.initialize=function(editor,drawertool){this.editor=editor;this.drawertool=drawertool;this._loadXML(this.shared.xsluri,this._libsXslCallback)};this.hide=function(){var el=this.element;el.style.left=el.style.top='';LibraryDrawer.prototype.hide.call(this)};this._libsXslCallback=function(dom){this.shared.xsl=dom;Sarissa.getDomDocument();try{var xsltproc=new XSLTProcessor();this.shared.xsltproc=xsltproc;xsltproc.importStylesheet(dom);xsltproc.setParameter("","ie",this.editor.getBrowserName()=='IE');xsltproc.setParameter("","drawertype",this.drawertype);xsltproc.setParameter("","drawertitle",this.drawertitle);xsltproc.setParameter("","showupload",this.showupload);xsltproc.setParameter("","showanchors",this.showanchors);if(this.target!==undefined){xsltproc.setParameter("","link_target",this.target)}
if(this.editor.config&&!!this.editor.config.captions){xsltproc.setParameter("","usecaptions",'yes')}} catch(e){if(e&&e.name&&e.message) e=e.name+': '+e.message;alert("xlstproc error:"+e);return}
if(this.xmldata){this.updateDisplay(this.drawerid)}};this.setTitle=function(t){this.drawertitle=t;var xsltproc=this.shared.xsltproc;if(xsltproc){xsltproc.setParameter("","drawertitle",this.drawertitle)}};this.createContent=function(){this.removeSelection();if(this.element.parentNode!=this.baseelement){this.baseelement.appendChild(this.element)}
if(!this.xmldata){if(!window.XSLTProcessor){alert("This function requires better XML support in your browser.");return}
this.loadLibraries()} else{var libraries=this.xmldata.selectSingleNode("/libraries");var old=libraries.selectSingleNode("library[@id='kupu-current-selection']");if(old){libraries.removeChild(old)}
if(this.shared.newimages){this.reloadCurrent();this.shared.newimages=null};this.updateDisplay();this.initialSelection()};this.element.style.display='block'};this._singleLibsXslCallback=function(dom){this.singlelibxsl=dom};this.loadLibraries=function(){this._loadXML(this.libsuri,this._libsContentCallback)};this._libsContentCallback=function(dom){this.xmldata=dom;this.xmldata.setProperty("SelectionLanguage","XPath");this.updateDisplay(this.drawerid);this.initialSelection()};this.initialSelection=function(){if(this.selectedSrc&&this.selecturi){this.selectCurrent();return}
var libnode_path='/libraries/library[@selected]';var libnode=this.xmldata.selectSingleNode(libnode_path);if(libnode){var id=libnode.getAttribute('id');this.selectLibrary(id)}};this.updateDisplay=function(id){if(!id){id=this.drawerid};var xsltproc=this.shared.xsltproc;if(!xsltproc){return}
for(var k in this.options){xsltproc.setParameter("",k,this.options[k])}
xsltproc.setParameter("","multiple",this.multiple?"yes":"");xsltproc.setParameter("","showupload",this.showupload);xsltproc.setParameter("","showanchors",this.showanchors);var doc=this._transformXml();var sourcenode=doc.selectSingleNode('//*[@id="'+id+'"]');var targetnode=document.getElementById(id);if(!sourcenode||!targetnode) return;var cls=sourcenode.getAttribute('class');if(cls){targetnode.className=cls}
Sarissa.copyChildNodes(sourcenode,targetnode);if(!this.focussed){this.focusElement()}
var el=document.getElementById('kupu-preview-image');if(el&&el.width=='1'){kupuFixImage(el)}
var el=this.element;el.className=el.className.replace(' kupu-has-selection','');if(this.xmldata.selectSingleNode("//*[@selected]//*[@checked]")){this.element.className+=' kupu-has-selection'};if(this.editor.getBrowserName()=='IE'&&id==this.resourcespanelid){this.updateDisplay(this.drawerid)};this.fixMask()};this.updateResources=function(){if(this.editor.getBrowserName()=='IE'){this.updateDisplay(this.drawerid)} else{this.updateDisplay(this.breadcrumbsid);this.updateDisplay(this.resourcespanelid);this.updateDisplay(this.propertiespanelid)}};this.deselectActiveCollection=function(){var librariespanel=document.getElementById(this.librariespanelid);if(!librariespanel) return;var divs=librariespanel.getElementsByTagName('div');for(var i=0;i<divs.length;i++){var div=divs[i];div.className=div.className.replace(/[ -]*selected/,'')}
var selected;while((selected=this.xmldata.selectSingleNode('//*[@selected]'))){selected.removeAttribute('selected')}};this.selectLibrary=function(id){this.deselectActiveCollection();var divs=this.element.getElementsByTagName('div');for(var i=0;i<divs.length;i++){if(divs[i].className=='kupu-libsource-selected'){divs[i].className='kupu-libsource'}};var libnode_path='/libraries/library[@id="'+id+'"]';var libnode=this.xmldata.selectSingleNode(libnode_path);libnode.setAttribute('selected','1');var items_xpath="items";var items_node=libnode.selectSingleNode(items_xpath);if(items_node&&!this.shared.newimages){this.useCollection(libnode)} else{var src_uri=libnode.selectSingleNode('src/text()').nodeValue;src_uri=src_uri.strip();this._loadXML(src_uri,this._libraryContentCallback,null,false,libnode);this.shared.newimages=null}};this.flagSelectedLib=function(id){var newseldiv=document.getElementById(id);if(newseldiv){newseldiv.className='kupu-libsource-selected'}};this._libraryContentCallback=function(dom,src_uri,libnode){var itemsnode=libnode.selectSingleNode("items");var bcnode=libnode.selectSingleNode("breadcrumbs");var newitemsnode=dom.selectSingleNode("//items");var newbc=dom.selectSingleNode("//breadcrumbs");if(this.editor.getBrowserName()=='IE'){newitemsnode=newitemsnode.cloneNode(true);if(newbc) newbc=newbc.cloneNode(true)} else{newitemsnode=this.xmldata.importNode(newitemsnode,true);if(newbc) newbc=this.xmldata.importNode(newbc,true)}
if(newbc){if(bcnode){libnode.replaceChild(newbc,bcnode)} else{libnode.appendChild(newbc)}};if(!itemsnode){libnode.appendChild(newitemsnode)} else{libnode.replaceChild(newitemsnode,itemsnode)};this.useCollection(libnode)};this.selectBreadcrumb=function(item){var src_uri=item.href;if (/\$src\$$/.test(src_uri)){var target=this.xmldata.selectSingleNode('//resource[@selected]/uri/text()');if(target){target=target.nodeValue.strip();src_uri=src_uri.replace(/\$src\$/,encodeURIComponent(target))} else{return false}};this.deselectActiveCollection();this.removeSelection();var collnode_path="/libraries/*[src/text()='" + src_uri + "']";var collnode=this.xmldata.selectSingleNode(collnode_path);if(collnode){var items_node=collnode.selectSingleNode("items");if(items_node){collnode.setAttribute('selected','1');this.useCollection(collnode);return}};this._loadXML(src_uri,this._collectionContentCallback,null);return false};this.useCollection=function(collnode){if(this.currentSelection){var leafnodes=collnode.selectNodes("//*[@checked]");for(var j=0;j<leafnodes.length;j++){leafnodes[j].removeAttribute('checked')};var sel=this.currentSelection;for(var i=0;i<sel.length;i++){var leafnodes=collnode.selectNodes("//*[@id='"+sel[i]+"']");for(var j=0;j<leafnodes.length;j++){leafnodes[j].setAttribute('checked','1');if(!this.multiple){leafnodes[j].setAttribute('selected','1')}}}};collnode.setAttribute('selected','1');this.flagSelectedLib(collnode.getAttribute('id'));this.updateResources()};this.selectCollection=function(item,tag){var id=item.id;tag=tag||'collection';this.deselectActiveCollection();this.removeSelection();var leafnode_path="//"+tag+"[@id='" + id + "']";var leafnode=this.xmldata.selectSingleNode(leafnode_path);var loadedInNode=leafnode.getAttribute('loadedInNode');if(loadedInNode){var collnode_path="/libraries/*[@id='" + loadedInNode + "']";var collnode=this.xmldata.selectSingleNode(collnode_path);if(collnode){this.useCollection(collnode);return}};var src_uri=leafnode.selectSingleNode('src/text()').nodeValue.strip();var collnode_path="/libraries/*[src/text()='" + src_uri + "'][items]";var collnode=this.xmldata.selectSingleNode(collnode_path);if(collnode){id=collnode.getAttribute('id');leafnode.setAttribute('loadedInNode',id);this.useCollection(collnode);return};leafnode.setAttribute('selected','1');src_uri=leafnode.selectSingleNode('src/text()').nodeValue.strip();this._loadXML(src_uri,this._collectionContentCallback,null)};this._collectionContentCallback=function(dom,src_uri){var date=new Date();var time=date.getTime();var leafnode=this.xmldata.selectSingleNode('//*[@selected]');if(leafnode){leafnode.setAttribute('loadedInNode',time)}
this.deselectActiveCollection();var collnode=dom.selectSingleNode('/collection');collnode.setAttribute('id',time);collnode.setAttribute('selected','1');var libraries=this.xmldata.selectSingleNode('/libraries');if(this.editor.getBrowserName()=='IE'){collnode=collnode.cloneNode(true)} else{collnode=this.xmldata.importNode(collnode,true)}
libraries.appendChild(collnode);this.useCollection(collnode)};this.reloadCurrent=function(){this.showupload='';var current=this.xmldata.selectSingleNode('//*[@selected]');if(current.tagName=="resource"){current.removeAttribute("selected");current=current.parentNode;current.setAttribute("selected","1")};var src_node=current.selectSingleNode('src');if(!src_node){return};var src_uri=src_node.selectSingleNode('text()').nodeValue;src_uri=src_uri.strip();this._loadXML(src_uri,this._libraryContentCallback,null,true,current)};this.removeSelection=function(){if(!this.xmldata) return;if(!this.multiple){var items=this.xmldata.selectNodes('//resource[@checked]');for(var i=0;i<items.length;i++){items[i].removeAttribute('checked')}};var oldselxpath='//resource[@selected]';var oldselitems=this.xmldata.selectNodes(oldselxpath);for(var i=0;i<oldselitems.length;i++){oldselitems[i].removeAttribute("selected");var id=oldselitems[i].getAttribute('id');var item=document.getElementById(id);if(item){var spans=item.getElementsByTagName('span');for(var j=0;j<spans.length;j++){var p=spans[j].parentNode;p.className=p.className.replace(/(\s+|^)selected-item/,'')}}}
this.showupload=''};this.selectUpload=function(){this.removeSelection();this.showupload='yes';this.updateResources()};this.selectItem=function(item,event){var id=item.id;var newselxpath='/libraries/*[@selected]//resource[@id="'+id+'"]';var src=this.xmldata.selectSingleNode(newselxpath+'/src');if(src){event=event||window.event;if(event){var target=event.target||event.srcElement}
if(target.nodeName.toLowerCase()!='input'){this.selectCollection(item,'resource');return}}
this.removeSelection();var newselitem=this.xmldata.selectSingleNode(newselxpath);newselitem.setAttribute("selected","1");var check=true;if(this.multiple){if(newselitem.getAttribute('checked')){check=false;var sel=this.currentSelection;for(var i=0;i<sel.length;i++){if(sel[i]==id){sel.splice(i,1);break}}} else{this.currentSelection.push(id)}} else{this.currentSelection=[id]};if(check){newselitem.setAttribute('checked','1')} else{newselitem.removeAttribute('checked')};this.updateDisplay(this.propertiespanelid);var span=item.getElementsByTagName('span');if(span.length>0){span=span[0];var p=span.parentNode;p.className+=' selected-item';var inp=p.getElementsByTagName('input');if(inp) inp[0].checked=check}
if(this.editor.getBrowserName()=='IE'){var ppanel=document.getElementById(this.propertiespanelid);var height=ppanel.clientHeight;if(height>ppanel.scrollHeight) height=ppanel.scrollHeight;if(height<260) height=260;document.getElementById(this.resourcespanelid).style.height=height+'px'}
return};this.search=function(){this.removeSelection();var searchvalue=getFromSelector('kupu-searchbox-input').value;var body='SearchableText='+encodeURIComponent(searchvalue);var chunks=this.searchuri.split('?');var searchuri=chunks[0];if(chunks[1]){body+="&"+chunks[1]};this._loadXML(searchuri,this._searchCallback,body)};this._searchCallback=function(dom){var resultlib=dom.selectSingleNode("/library");var items=resultlib.selectNodes("items/*");if(!items.length){alert("No results found.");return};var date=new Date();var time=date.getTime();resultlib.setAttribute("id",time);this.deselectActiveCollection();resultlib.setAttribute("selected","1");if(this.editor.getBrowserName()=='IE'){resultlib=resultlib.cloneNode(true)} else{this.xmldata.importNode(resultlib,true)}
var libraries=this.xmldata.selectSingleNode("/libraries");libraries.appendChild(resultlib);this.updateDisplay(this.drawerid);var newseldiv=getFromSelector(time);newseldiv.className='kupu-libsource-selected'};this.selectCurrent=function(){var src=this.selectedSrc;var body='src='+encodeURIComponent(src);var chunks=this.selecturi.split('?');var uri=chunks[0];if(chunks[1]){body+="&"+chunks[1]};this._loadXML(uri,this._selectedCallback,body)};this._selectedCallback=function(dom){var resultlib=dom.selectSingleNode("/library");var id="kupu-current-selection";resultlib.setAttribute("id",id);var leafnodes=resultlib.selectNodes("//resource");this.currentSelection=[];for(var i=0;i<leafnodes.length;i++){this.currentSelection.push(leafnodes[i].getAttribute('id'))};this.deselectActiveCollection();resultlib.setAttribute("selected","1");if(this.editor.getBrowserName()=='IE'){resultlib=resultlib.cloneNode(true)} else{resultlib=this.xmldata.importNode(resultlib,true)}
var libraries=this.xmldata.selectSingleNode("/libraries");libraries.appendChild(resultlib);this.useCollection(resultlib);this.updateDisplay(this.librariespanelid);this.flagSelectedLib(id);this.updateDisplay(this.breadcrumbsid)};this.save=function(){throw "Not yet implemented"};this._transformXml=function(){var result=this.shared.xsltproc.transformToDocument(this.xmldata);return result};this._loadXML=function(uri,callback,body,reload,extra){
function _sarissaCallback(){if(xmlhttp.readyState==4){if(xmlhttp.status&&xmlhttp.status!=200){var errmessage='Error '+xmlhttp.status+' loading '+(uri||'XML');kupu_notbusy(ed,true);alert(errmessage);throw "Error loading XML"};var dom=xmlhttp.responseXML;if(!dom||!dom.documentElement){dom=Sarissa.getDomDocument();dom.loadXML(xmlhttp.responseText)}
callback.apply(self,[dom,uri,extra]);kupu_notbusy(ed)}};var self=this;var ed=this.editor;var xmlhttp=new XMLHttpRequest();var method=body?'POST':'GET';body=body?body:null;kupu_busy(ed);try{xmlhttp.open(method,uri,true);xmlhttp.onreadystatechange=_sarissaCallback;if(method=="POST"){xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded')};if(reload){xmlhttp.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT")}
xmlhttp.send(body)} catch(e){if(e&&e.name&&e.message){e=e.name+': '+e.message}
kupu_notbusy(ed,true);alert(e)}}};LibraryDrawer.prototype=new DrawerWithAnchors;LibraryDrawer.prototype.shared={};
function ImageLibraryDrawer(tool,xsluri,libsuri,searchuri,baseelement,selecturi){this.drawertitle="Insert Image";this.drawertype="image";if(tool){this.init(tool,xsluri,libsuri,searchuri,baseelement,selecturi)}
this.createContent=function(){
function getSel(sel,p,t){var nodes=p.getElementsByTagName(t);for(var i=0;i<nodes.length;i++){if(sel.containsNode(nodes[i])){return nodes[i]}}}
var ed=this.editor;var sel=ed.getSelection();var currnode=ed.getSelectedNode();var currimg=ed.getNearestParentOfType(currnode,'OBJECT')||ed.getNearestParentOfType(currnode,'IMG')||getSel(sel,currnode,'object')||getSel(sel,currnode,'img');this.selectedSrc=currimg?(currimg.data||currimg.src||null):null;this.options={};if(currimg){ed.getSelection().selectNodeContents(currimg);var className=currimg.className;var align=/\bimage-(left|right|inline)\b/.exec(className);if(align&&align.length>1){this.options['image-align']=align[1]};this.options['image-caption']=/\bcaptioned\b/.test(className);this.options['image-class']=className.replace(/\b(image-(left|right|inline)|captioned)\b/g,'').strip()}
ImageLibraryDrawer.prototype.createContent.call(this)};this.uploadImage=function(){var form=document.getElementById('kupu_upload_form');if(!form||form.node_prop_image.value=='') return;if(form.node_prop_title.value==""){alert("Please enter a title for the image you are uploading");return};this.upload_title=form.node_prop_title.value;form.node_prop_desc.value=form.node_prop_desc.value.replace(/^\xa0|\xa0$/g,'');form.submit()};this.cancelUpload=function(msg){var s=this.xmldata.selectSingleNode('/libraries/*[@selected]');s.removeAttribute("selected");this.updateDisplay();if(msg!=''){alert(msg)}};this.finishUpload=function(uri){this.editor.resumeEditing();var sizeselector=document.getElementsByName('image-size-selector');if(sizeselector&&sizeselector.length>0){sizeselector=sizeselector[0];var index=sizeselector.selectedIndex;if(sizeselector.length>0&&index>=0){uri+=sizeselector.options[index].value}}
var radios=document.getElementsByName('image-align');var imgclass="";for(var i=0;i<radios.length;i++){if(radios[i].checked){imgclass=radios[i].value}};var caption=document.getElementsByName('image-caption');if(caption&&caption.length>0&&caption[0].checked){imgclass+=" captioned"};var classnames=document.getElementById('kupu-image-class');if(classnames&&classnames.selectedIndex>=0){imgclass+=" "+classnames.options[classnames.selectedIndex].value} else{imgclass+=' image-inline'}
imgclass=imgclass.strip();this.tool.createImage(uri,this.upload_title,imgclass);this.shared.newimages=1;this.drawertool.closeDrawer()};this.save=function(){this.editor.resumeEditing();var selxpath='//resource[@selected]';var selnode=this.xmldata.selectSingleNode(selxpath);if(!selnode){var uploadbutton=this.xmldata.selectSingleNode("/libraries/*[@selected]//uploadbutton");if(uploadbutton){this.uploadImage()};return};var sizeselector=document.getElementsByName('image-size-selector');if(sizeselector&&sizeselector.length>0){sizeselector=sizeselector[0];var uri=sizeselector.options[sizeselector.selectedIndex].value} else{var uri=selnode.selectSingleNode('uri/text()').nodeValue}
uri=uri.strip();var alt=getFromSelector('image-alt');alt=alt?alt.value:undefined;var radios=document.getElementsByName('image-align');for(var i=0;i<radios.length;i++){if(radios[i].checked){var imgclass=radios[i].value}};var caption=document.getElementsByName('image-caption');if(caption&&caption.length>0&&caption[0].checked){imgclass+=" captioned"};var classnames=document.getElementById('kupu-image-class');if(classnames&&classnames.selectedIndex>=0){imgclass+=" "+classnames.options[classnames.selectedIndex].value}
var media=document.getElementById('kupu-media').value;var width=document.getElementById('kupu-width').value;var height=document.getElementById('kupu-height').value;if(this.tool['create_'+media]){this.tool['create_'+media](uri,alt,imgclass,width,height)} else{this.tool.createImage(uri,alt,imgclass)}
this.drawertool.closeDrawer()}};ImageLibraryDrawer.prototype=new LibraryDrawer;ImageLibraryDrawer.prototype.shared={};
function LinkLibraryDrawer(tool,xsluri,libsuri,searchuri,baseelement,selecturi){this.drawertitle="Insert Link";this.drawertype="link";this.showanchors="yes";if(tool){this.init(tool,xsluri,libsuri,searchuri,baseelement,selecturi)}
this.createContent=function(){var currnode=this.editor.getSelectedNode();var curranchor=this.editor.getNearestParentOfType(currnode,'A');this.selectedSrc=curranchor?curranchor.href:null;this.options={};if(curranchor){this.options.link_name=curranchor.name||'';this.options.link_target=curranchor.target||''}
LinkLibraryDrawer.prototype.createContent.call(this)};this.save=function(){this.editor.resumeEditing();var selxpath='//resource[@selected]';var selnode=this.xmldata.selectSingleNode(selxpath);if(!selnode){return};var uri=selnode.selectSingleNode('uri/text()').nodeValue;uri=uri.strip()+this.getFragment();var title='';title=selnode.selectSingleNode('title/text()').nodeValue;title=title.strip();var name=getFromSelector('link_name').value;var node=getFromSelector('link_target');var target=node&&node.value;this.tool.createLink(uri,null,name,target,title,'internal-link');this.drawertool.closeDrawer()}};LinkLibraryDrawer.prototype=new LibraryDrawer;LinkLibraryDrawer.prototype.shared={};
function AnchorDrawer(elementid,tool){Drawer.call(this,elementid,tool);this.initialize=function(editor,tool){Drawer.prototype.initialize.apply(this,[editor,tool]);this.panel=getBaseTagClass(this.element,'div','kupu-panels');this.style1=getFromSelector('kupu-bm-sel1');this.style2=getFromSelector('kupu-bm-sel2');this.ostyle=getFromSelector('kupu-bm-outcls');this.nstyle=getFromSelector('kupu-bm-number');var tabs=getBaseTagClass(this.element,'ul','kupu-tabs').getElementsByTagName('a');this.paralist=getBaseTagClass(this.element,'div','kupu-bm-paras');this.checkall=getFromSelector('kupu-bm-checkall');for(var i=0;i<tabs.length;i++){addEventHandler(tabs[i],'click',this.switchMode,this)}
addEventHandler(this.checkall,'click',this.checkAll,this);addEventHandler(this.style1,'change',this.fillList,this);addEventHandler(this.style2,'change',this.fillList,this);this.tool.fillStyleSelect(this.style1);this.tool.fillStyleSelect(this.style2);this.tool.fillStyleSelect(this.ostyle)};this.getMode=function(){if (/kupu-ins-bm/.test(this.panel.className)) return 0;if (/kupu-anchor/.test(this.panel.className)) return 1;return 2};this.checkAll=function(){var nodes=this.paralist.getElementsByTagName('input');var state=this.checkall.checked;for(var i=0;i<nodes.length;i++){var n=nodes[i];if(n.type=="checkbox"&&!n.disabled){nodes[i].checked=state}}};this.fillList=function(){var el=newElement;while(this.paralist.firstChild){this.paralist.removeChild(this.paralist.firstChild)}
this.styleNames=['',''];var mode=this.getMode();var s=['',''];for(var idx=0;idx<(mode==2?2:1);idx++){var sel=this['style'+(idx+1)];var i=sel.selectedIndex;if(i>=0){s[idx]=sel.options[i].value;this.styleNames[idx]=sel.options[i].firstChild.data}}
if(mode==1){var inuse=this.tool.getAnchorsInUse()}
var paras=(this.nodelist=this.tool.grubParas(s[0],s[1]));for(var i=0;i<paras.length;i++){var node=paras[i][0];var text=Sarissa.getText(node,true).strip().truncate(60);if(!text) continue;var content=document.createTextNode(text);var anchor='';if(mode==1){anchor=this.tool.getAnchor(node,true);if(anchor){anchor='#'+anchor}}
var checked;switch(mode){case 0:checked=i==0;break;case 1:checked=!!anchor;break;case 2:checked=this.checkall.checked;break}
var control=el('input',{'type':(mode==0)?"radio":"checkbox",checked:checked,title:'hello',name:"kupu-bm-paralist"});if(anchor&&inuse&&inuse[decodeURIComponent(anchor)]){control.disabled=true}
var inner=[control,el('span',[content])];if(anchor){inner.push(el('a',{href:anchor,className:'kupu-anchor-link',onclick:'return false;',title:_('Right click to copy link')},[anchor]))};var div=el('div',{className:"kupu-bm-level"+paras[i][1]},[el('label',inner)]);this.paralist.appendChild(div)}};this.createContent=function(){this.fillList();this.element.style.display='block';this.focusElement()};this.save=function(){var mode=this.getMode();var selected=this.paralist.getElementsByTagName('input');var ed=this.editor;ed.resumeEditing();if(mode==2){var toc=ed.newElement('ul')};var lvl1=0,lvl2=0;for(var i=0;i<selected.length;i++){var nodeinfo=this.nodelist[i];var node=nodeinfo[0];var level=nodeinfo[1];if(selected[i].checked){var a=this.tool.getAnchor(node);var caption=Sarissa.getText(node,true).strip().truncate(140);switch(mode){case 0:this.tool.createLink('#'+a,null,null,null,caption);break;case 1:break;case 2:var number;if(level==0){number=++lvl1;lvl2=0} else{number=lvl1+'.'+(++lvl2)};var li=ed.newElement('li',{'className':'level'+level},[ed.newElement('a',{'href':'#'+a},[ed.newText((this.nstyle.checked?number+' ':'')+caption)])]);if(level==0){toc.appendChild(li)} else{if(!toc.lastChild||toc.lastChild.nodeName.toLowerCase()!='ul'){toc.appendChild(ed.newElement('ul'))}
toc.lastChild.appendChild(li)};break}} else{if(mode==1){this.tool.removeAnchor(node)}}};if(mode==2&&toc.firstChild){var o=this.ostyle.selectedIndex;if(o>0){var ostyle=this.ostyle.options[o].value.split('|');if(ostyle[0]=='ul'){toc.className=ostyle[1]} else{toc=ed.newElement(ostyle[0],{'className':ostyle[1]},[toc])}}
var node=ed.getSelection().parentElement();if(node.nodeName.toLowerCase()=='body'){node.insertBefore(toc,node.firstChild)} else{while(node.parentNode.nodeName.toLowerCase()!='body'){node=node.parentNode}
node.parentNode.insertBefore(toc,node)}}
this.nodelist=null;this.drawertool.closeDrawer()};this.hide=function(){this.nodelist=null;Drawer.prototype.hide.apply(this,[])}};AnchorDrawer.prototype=new Drawer;
function HandleDrawerEnter(event,clickid){event=event||window.event;var key=event.which||event.keyCode;var button;if(key==13){if(clickid){button=document.getElementById(clickid);if(button&&!button.disabled){button.click()}}
event.cancelBubble=true;if(event.stopPropogation) event.stopPropogation();event.returnValue=false;return false}
return true}


/* - kupuploneinit.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/kupuploneinit.js?original=1
function initPloneKupu(editorId){var prefix='#'+editorId+' ';var iframe=getFromSelector(prefix+'iframe.kupu-editor-iframe');if(iframe._kupuIsInitialized){return window.kupu};iframe._kupuIsInitialized=true;var textarea=getFromSelector(prefix+'textarea.kupu-editor-textarea');var form=textarea.form;var initialtext=textarea.value||(_SARISSA_IS_IE?'<p></p>':'<p><br></p>');var l=new DummyLogger();var conf=loadDictFromXML(document,prefix+'xml.kupuconfig');var doc=new KupuDocument(iframe);var kupu=(window.kupu=new KupuEditor(doc,conf,l));kupu.setHTMLBody(initialtext);var ui=new KupuUI(prefix+'select.kupu-tb-styles');window.kupuui=ui;kupu.registerTool('ui',ui);var execCommand=function(cmd){return function(button,editor){editor.execCommand(cmd)}};var boldchecker=parentWithStyleChecker(['b','strong'],'font-weight','bold');var boldbutton=new KupuStateButton(prefix+'button.kupu-bold',execCommand('bold'),boldchecker,'kupu-bold','kupu-bold-pressed');kupu.registerTool('boldbutton',boldbutton);var italicschecker=parentWithStyleChecker(['i','em'],'font-style','italic');var italicsbutton=new KupuStateButton(prefix+'button.kupu-italic',execCommand('italic'),italicschecker,'kupu-italic','kupu-italic-pressed');kupu.registerTool('italicsbutton',italicsbutton);var subscriptchecker=parentWithStyleChecker(['sub']);var subscriptbutton=new KupuStateButton(prefix+'button.kupu-subscript',execCommand('subscript'),subscriptchecker,'kupu-subscript','kupu-subscript-pressed');kupu.registerTool('subscriptbutton',subscriptbutton);var superscriptchecker=parentWithStyleChecker(['super','sup']);var superscriptbutton=new KupuStateButton(prefix+'button.kupu-superscript',execCommand('superscript'),superscriptchecker,'kupu-superscript','kupu-superscript-pressed');kupu.registerTool('superscriptbutton',superscriptbutton);var justifyleftbutton=new KupuButton(prefix+'button.kupu-justifyleft',execCommand('justifyleft'));kupu.registerTool('justifyleftbutton',justifyleftbutton);var justifycenterbutton=new KupuButton(prefix+'button.kupu-justifycenter',execCommand('justifycenter'));kupu.registerTool('justifycenterbutton',justifycenterbutton);var justifyrightbutton=new KupuButton(prefix+'button.kupu-justifyright',execCommand('justifyright'));kupu.registerTool('justifyrightbutton',justifyrightbutton);var outdentbutton=new KupuButton(prefix+'button.kupu-outdent',execCommand('outdent'));kupu.registerTool('outdentbutton',outdentbutton);var indentbutton=new KupuButton(prefix+'button.kupu-indent',execCommand('indent'));kupu.registerTool('indentbutton',indentbutton);var undobutton=new KupuButton(prefix+'button.kupu-undo',execCommand('undo'));kupu.registerTool('undobutton',undobutton);var redobutton=new KupuButton(prefix+'button.kupu-redo',execCommand('redo'));kupu.registerTool('redobutton',redobutton);var removeimagebutton=new KupuRemoveElementButton(prefix+'button.kupu-removeimage','img','kupu-removeimage');kupu.registerTool('removeimagebutton',removeimagebutton);var removelinkbutton=new KupuRemoveElementButton(prefix+'button.kupu-removelink','a','kupu-removelink');kupu.registerTool('removelinkbutton',removelinkbutton);var colorchoosertool=new ColorchooserTool(prefix+'button.kupu-forecolor',prefix+'button.kupu-hilitecolor',prefix+'table.kupu-colorchooser');kupu.registerTool('colorchooser',colorchoosertool);var listtool=new ListTool(prefix+'button.kupu-insertunorderedlist',prefix+'button.kupu-insertorderedlist',prefix+'select.kupu-ulstyles',prefix+'select.kupu-olstyles');kupu.registerTool('listtool',listtool);var definitionlisttool=new DefinitionListTool(prefix+'button.kupu-insertdefinitionlist');kupu.registerTool('definitionlisttool',definitionlisttool);var tabletool=new TableTool();kupu.registerTool('tabletool',tabletool);var anchortool=new AnchorTool();kupu.registerTool('anchortool',anchortool);var showpathtool=new ShowPathTool('kupu-showpath-field');kupu.registerTool('showpathtool',showpathtool);var sourceedittool=new SourceEditTool(prefix+'button.kupu-source',prefix+'textarea.kupu-editor-textarea');kupu.registerTool('sourceedittool',sourceedittool);var imagetool=noContextMenu(new ImageTool());kupu.registerTool('imagetool',imagetool);var linktool=noContextMenu(new LinkTool());kupu.registerTool('linktool',linktool);var zoom=new KupuZoomTool(prefix+'button.kupu-zoom',prefix+'select.kupu-tb-styles',prefix+'button.kupu-logo');kupu.registerTool('zoomtool',zoom);if(typeof KupuSpellChecker!='undefined'){var spellchecker=new KupuSpellChecker('kupu-spellchecker-button','kupu_library_tool/spellcheck');kupu.registerTool('spellchecker',spellchecker)} else{var sc=getFromSelector(prefix+'span.kupu-spellchecker-span');if(sc) sc.style.display='none'}
var beforeunloadTool=window.onbeforeunload&&window.onbeforeunload.tool;if(beforeunloadTool){var initialBody=kupu.getHTMLBody();beforeunloadTool.addHandler(function(){for(var n=textarea;n;n=n.parentNode){if(n===document){return kupu.getHTMLBody()!=initialBody}}
return false});beforeunloadTool.chkId[textarea.id]=function(){return false};beforeunloadTool.addForm(form)}
var fmtname=textarea.name+'_text_format';var pulldown=form[fmtname];if(pulldown&&pulldown.type=='select-one'){for(var i=0 ;i<pulldown.length;i++){var opt=pulldown.options[i];opt.selected=opt.defaultSelected=(opt.value=='text/html')}
pulldown.disabled=true;pulldown.removeAttribute('name');var hidden=document.createElement('input');hidden.type='hidden';hidden.name=fmtname;hidden.value='text/html';pulldown.parentNode.appendChild(hidden)};var opendrawer=function(drawerid){return function(button,editor){drawertool.openDrawer(prefix+drawerid)}};var imagelibdrawerbutton=new KupuButton(prefix+'button.kupu-image',opendrawer('imagelibdrawer'));kupu.registerTool('imagelibdrawerbutton',imagelibdrawerbutton);var linklibdrawerbutton=new KupuButton(prefix+'button.kupu-inthyperlink',opendrawer('linklibdrawer'));kupu.registerTool('linklibdrawerbutton',linklibdrawerbutton);var linkdrawerbutton=new KupuButton(prefix+'button.kupu-exthyperlink',opendrawer('linkdrawer'));kupu.registerTool('linkdrawerbutton',linkdrawerbutton);var anchorbutton=new KupuButton(prefix+'button.kupu-anchors',opendrawer('anchordrawer'));kupu.registerTool('anchorbutton',anchorbutton);var tabledrawerbutton=new KupuButton(prefix+'button.kupu-table',opendrawer('tabledrawer'));kupu.registerTool('tabledrawerbutton',tabledrawerbutton);var drawertool=window.drawertool||new DrawerTool();window.drawertool=drawertool;kupu.registerTool('drawertool',drawertool);var drawerparent=prefix+'div.kupu-librarydrawer-parent';var xsl_uri=conf.xsl_uri;var link_resource=conf.link_resource;var image_resource=conf.image_resource;var lib_prefix=conf.lib_prefix;var search_prefix=conf.search_prefix;var select_prefix=conf.select_prefix;var linklibdrawer=new LinkLibraryDrawer(linktool,xsl_uri,lib_prefix+link_resource,search_prefix+link_resource,drawerparent,select_prefix+link_resource);drawertool.registerDrawer(prefix+'linklibdrawer',linklibdrawer,kupu);var imagelibdrawer=new ImageLibraryDrawer(imagetool,xsl_uri,lib_prefix+image_resource,search_prefix+image_resource,drawerparent,select_prefix+image_resource);drawertool.registerDrawer(prefix+'imagelibdrawer',imagelibdrawer,kupu);var linkdrawer=new LinkDrawer(prefix+'div.kupu-linkdrawer',linktool);drawertool.registerDrawer(prefix+'linkdrawer',linkdrawer,kupu);var anchordrawer=new AnchorDrawer(prefix+'div.kupu-anchordrawer',anchortool);drawertool.registerDrawer(prefix+'anchordrawer',anchordrawer,kupu);var tabledrawer=new TableDrawer(prefix+'div.kupu-tabledrawer',tabletool);drawertool.registerDrawer(prefix+'tabledrawer',tabledrawer,kupu);
function prepareForm(event){kupu.saveDataToField(this.form,this);var drawer=window.document.getElementById('kupu-librarydrawer');if(drawer){drawer.parentNode.removeChild(drawer)}};addEventHandler(textarea.form,'submit',prepareForm,textarea);
function tabHandler(event){event=event||window.event;if(event.keyCode!=9){return}
if(!(/kupu-fulleditor-zoomed/.test(document.body.className))){var form=textarea.form;var els=form.elements;var target;if(event.shiftKey){for(var i=0;i<els.length;i++){var el=els[i];if(!el.disabled&&el.offsetWidth&&el.offsetHeight){target=el}
if(els[i]===textarea) break}} else{for(var i=0;i<els.length;i++){if(els[i]===textarea) break}
for(;i<els.length;i++){var el=els[i];if(!el.disabled&&el.offsetWidth&&el.offsetHeight){target=el;break}}}
if(target){window.focus();target.focus()} else{return}}
if(event.preventDefault){event.preventDefault();event.stopPropagation()}
event.returnValue=false;return false}
var inner=kupu.getInnerDocument();kupu._addEventHandler(inner.documentElement,"keydown",tabHandler);kupu.initialize();return kupu};LinkDrawer.prototype.target='';LinkLibraryDrawer.prototype.target='';if(!window.console){window.console=new function(){this.log=function(){}}}


/* - menu-enable.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/menu-enable.js?original=1
/*@cc_on
@if(@_win32&&@_jscript_version>4&&@_jscript_version<5.7)
function menues_enable(){if(document.all){uls=document.getElementsByTagName('UL');for(i=0;i<uls.length;i++){if(uls[i].className=='hu_menu'){var lis=uls[i].getElementsByTagName('li');for(j=0;j<lis.length;j++){if(lis[j].lastChild.tagName=='UL'){lis[j].onmouseover=function(){this.lastChild.style.display='block'}
lis[j].onmouseout=function(){this.lastChild.style.display='none'}}}}}}}
window.onload=menues_enable;@end @*/

/* - quickbar.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/quickbar.js?original=1
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore) selObj.selectedIndex=0}

/* - quicklinks.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/quicklinks.js?original=1
menu_status=new Array();
function showHide(theid){if(document.getElementById){var switch_id=document.getElementById(theid);if(menu_status[theid]!='show'){switch_id.className='show';menu_status[theid]='show';if(theid=='mymenu1'){document.getElementById("menu1").setAttribute("class","minus")}
if(theid=='mymenu2'){document.getElementById("menu2").setAttribute("class","minus")}
else{document.getElementById("menu3").setAttribute("class","minus")}}else{switch_id.className='hide';menu_status[theid]='hide';if(theid=='mymenu1'){document.getElementById("menu1").setAttribute("class","plus")}
if(theid=='mymenu2'){document.getElementById("menu2").setAttribute("class","plus")}
else{document.getElementById("menu3").setAttribute("class","plus")}}}}

/* - jquery.min.js - */
/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();

/* - slimbox2.js - */
// http://www.gender.hu-berlin.de/portal_javascripts/slimbox2.js?original=1
(function(w){var E=w(window),u,f,F=-1,n,x,D,v,y,L,r,m=!window.XMLHttpRequest,s=[],l=document.documentElement,k={},t=new Image(),J=new Image(),H,a,g,p,I,d,G,c,A,K;w(function(){w("body").append(w([H=w('<div id="lbOverlay" />')[0],a=w('<div id="lbCenter" />')[0],G=w('<div id="lbBottomContainer" />')[0]]).css("display","none"));g=w('<div id="lbImage" />').appendTo(a).append(p=w('<div style="position: relative;" />').append([I=w('<a id="lbPrevLink" href="#" />').click(B)[0],d=w('<a id="lbNextLink" href="#" />').click(e)[0]])[0])[0];c=w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="#" />').add(H).click(C)[0],A=w('<div id="lbCaption" />')[0],K=w('<div id="lbNumber" />')[0],w('<div style="clear: both;" />')[0]])[0]});w.slimbox=function(O,N,M){u=w.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},M);if(typeof O=="string"){O=[[O,N]];N=0}y=E.scrollTop()+(E.height()/2);L=u.initialWidth;r=u.initialHeight;w(a).css({top:Math.max(0,y-(r/2)),width:L,height:r,marginLeft:-L/2}).show();v=m||(H.currentStyle&&(H.currentStyle.position!="fixed"));if(v){H.style.position="absolute"}w(H).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);z();j(1);f=O;u.loop=u.loop&&(f.length>1);return b(N)};w.fn.slimbox=function(M,P,O){P=P||function(Q){return[Q.href,Q.title]};O=O||function(){return true};var N=this;return N.unbind("click").click(function(){var S=this,U=0,T,Q=0,R;T=w.grep(N,function(W,V){return O.call(S,W,V)});for(R=T.length;Q<R;++Q){if(T[Q]==S){U=Q}T[Q]=P(T[Q],Q)}return w.slimbox(T,U,M)})};function z(){var N=E.scrollLeft(),M=E.width();w([a,G]).css("left",N+(M/2));if(v){w(H).css({left:N,top:E.scrollTop(),width:M,height:E.height()})}}function j(M){if(M){w("object").add(m?"select":"embed").each(function(O,P){s[O]=[P,P.style.visibility];P.style.visibility="hidden"})}else{w.each(s,function(O,P){P[0].style.visibility=P[1]});s=[]}var N=M?"bind":"unbind";E[N]("scroll resize",z);w(document)[N]("keydown",o)}function o(O){var N=O.keyCode,M=w.inArray;return(M(N,u.closeKeys)>=0)?C():(M(N,u.nextKeys)>=0)?e():(M(N,u.previousKeys)>=0)?B():false}function B(){return b(x)}function e(){return b(D)}function b(M){if(M>=0){F=M;n=f[F][0];x=(F||(u.loop?f.length:0))-1;D=((F+1)%f.length)||(u.loop?0:-1);q();a.className="lbLoading";k=new Image();k.onload=i;k.src=n}return false}function i(){a.className="";w(g).css({backgroundImage:"url("+n+")",visibility:"hidden",display:""});w(p).width(k.width);w([p,I,d]).height(k.height);w(A).html(f[F][1]||"");w(K).html((((f.length>1)&&u.counterText)||"").replace(/{x}/,F+1).replace(/{y}/,f.length));if(x>=0){t.src=f[x][0]}if(D>=0){J.src=f[D][0]}L=g.offsetWidth;r=g.offsetHeight;var M=Math.max(0,y-(r/2));if(a.offsetHeight!=r){w(a).animate({height:r,top:M},u.resizeDuration,u.resizeEasing)}if(a.offsetWidth!=L){w(a).animate({width:L,marginLeft:-L/2},u.resizeDuration,u.resizeEasing)}w(a).queue(function(){w(G).css({width:L,top:M+r,marginLeft:-L/2,visibility:"hidden",display:""});w(g).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,h)})}function h(){if(x>=0){w(I).show()}if(D>=0){w(d).show()}w(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);G.style.visibility=""}function q(){k.onload=null;k.src=t.src=J.src=n;w([a,g,c]).stop(true);w([I,d,g,G]).hide()}function C(){if(F>=0){q();F=x=D=-1;w(a).hide();w(H).stop().fadeOut(u.overlayFadeDuration,j)}return false}})(jQuery);if(!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)){jQuery(function($){$("a[rel^='lightbox']").slimbox({},null, function(el){return(this==el)||((this.rel.length>8)&&(this.rel==el.rel))})})}

