
Function.prototype.inheritsFrom=function(parentClass)
{this.prototype=new parentClass;this.prototype.constructor=this;this.prototype._parent=parentClass.prototype;}
var dhtmlapi={_isCSS:false,_isW3C:false,_isIE4:false,_isNN4:false,_isIE6CSS:false,isIE:false,isGecko:false,isSafari:false,isFirefox:false,isKonqueror:false,version:0,initialize:function()
{BrowserDetect.init();if(document.images){this._isCSS=(document.body&&document.body.style)?true:false;this._isW3C=(this._isCSS&&document.getElementById)?true:false;this._isIE4=(this._isCSS&&document.all)?true:false;this._isNN4=(document.layers)?true:false;this._isIE6CSS=(document.compatMode&&document.compatMode.indexOf("CSS1")>=0)?true:false;}
var ua=navigator.userAgent.toLowerCase();dhtmlapi.isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));dhtmlapi.isGecko=(ua.indexOf("gecko")!=-1);dhtmlapi.isFirefox=(ua.toLowerCase().indexOf("firefox")!=-1);dhtmlapi.isKonqueror=(ua.indexOf("konqueror")!=-1);dhtmlapi.isSafari=(ua.toLowerCase().indexOf("safari")!=-1||ua.toLowerCase().indexOf("applewebkit")!=-1||BrowserDetect.browser=="Safari");var idx;var idxStart;var ch;var verstr;if(dhtmlapi.isIE==true){var offset=ua.indexOf("msie ");dhtmlapi.version=parseFloat(ua.substring(offset+5,ua.indexOf(";",offset)));}
if(dhtmlapi.isSafari==true){dhtmlapi.version=100;idx=ua.toLowerCase().indexOf('applewebkit/');if(idx!=-1){idx+=12;idxStart=idx;ch=ua.charAt(idx);while(ch>='0'&&ch<='9'){idx++;ch=ua.charAt(idx);}
verstr=ua.substring(idxStart,idx);dhtmlapi.version=parseInt(verstr);}
if(ua.indexOf("522")!=-1)
dhtmlapi.version=522;}
if(dhtmlapi.isFirefox==true){dhtmlapi.version=1;idx=ua.toLowerCase().indexOf('firefox/');if(idx!=-1){idx+=8;idxStart=idx;ch=ua.charAt(idx);while(ch>='0'&&ch<='9'){idx++;ch=ua.charAt(idx);}
verstr=ua.substring(idxStart,idx);dhtmlapi.version=parseInt(verstr);}}},isIE7:function()
{var plat=BrowserDetect.OS;var browser=BrowserDetect.browser;var version=BrowserDetect.version;if(plat=="Windows")
{if(browser=="Explorer"){if(version>6){return true;}}}
return false;},isMSIE:function()
{var plat=BrowserDetect.OS;var browser=BrowserDetect.browser;var version=BrowserDetect.version;if(plat=="Windows")
{if(browser=="Explorer"){return true;}}
return false;},isMac:function()
{var plat=BrowserDetect.OS;if(plat!="Windows"&&plat!="Linux")
{return true;}
return false;},isSecureBrowser:function(){var plat=BrowserDetect.OS;var browser=BrowserDetect.browser;var version=BrowserDetect.version;if(browser=="Explorer"){if(version>6){return true;}
else
return false;}
if(browser=="Firefox"){return true;}
if(browser="Safari"){return true;}
return false;},seekLayer:function(doc,name)
{var theObj;for(var i=0;i<doc.layers.length;i++){if(doc.layers[i].name==name){theObj=doc.layers[i];break;}
if(doc.layers[i].document.layers.length>0){theObj=seekLayer(document.layers[i].document,name);}}
return theObj;},getObject:function(obj)
{var theObj;if(typeof obj=="string"){if(this._isW3C){theObj=document.getElementById(obj);}
else if(this._isIE4){theObj=document.all(obj);}
else if(this._isNN4){theObj=seekLayer(document,obj);}}
else{theObj=obj;}
return theObj;},clearObject:function(obj)
{var elem=obj.firstChild;while(elem!=null){obj.removeChild(elem);elem=obj.firstChild;}},getStyleObject:function(obj)
{var theObj=this.getObject(obj);if(theObj&&this._isCSS){theObj=theObj.style;}
return theObj;},shiftTo:function(obj,x,y)
{var theObj=this.getStyleObject(obj);if(theObj){if(this._isCSS){var units=(typeof theObj.left=="string")?"px":0;theObj.left=x+units;theObj.top=y+units;}
else if(this._isNN4){theObj.moveTo(x,y);}}},shiftBy:function(obj,deltaX,deltaY)
{var theObj=this.getStyleObject(obj);if(theObj){if(this._isCSS){var units=(typeof theObj.left=="string")?"px":0;theObj.left=this.getObjectLeft(obj)+deltaX+units;theObj.top=this.getObjectTop(obj)+deltaY+units;}
else if(this._isNN4){theObj.moveBy(deltaX,deltaY);}}},setZIndex:function(obj,zOrder)
{var theObj=this.getStyleObject(obj);if(theObj){theObj.zIndex=zOrder;}},getZIndex:function(obj)
{var theObj=this.getStyleObject(obj);if(theObj){return theObj.zIndex;}
else{return 0;}},setBGColor:function(obj,color)
{var theObj=this.getStyleObject(obj);if(theObj){if(this._isNN4){theObj.bgColor=color;}
else if(this._isCSS){theObj.backgroundColor=color;}}},show:function(obj)
{var theObj=this.getStyleObject(obj);if(theObj){theObj.visibility="visible";}},hide:function(obj)
{var theObj=this.getStyleObject(obj);if(theObj){theObj.visibility="hidden";}},getObjectLeft:function(obj)
{var elem=this.getObject(obj);var result=0;if(elem.style["left"]){result=elem.style["left"];}
else if(elem.currentStyle){result=elem.currentStyle["left"];}
else if(document.defaultView&&document.defaultView.getComputedStyle){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("left");}
return parseInt(result);},getObjectStyle:function(obj,property)
{var elem=this.getObject(obj);var result=0;if(elem.style[property]){result=elem.style[property];}
else if(elem.currentStyle){result=elem.currentStyle[property];}
else if(document.defaultView&&document.defaultView.getComputedStyle){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue(property);}
return parseInt(result);},getObjectTop:function(obj)
{var elem=this.getObject(obj);var result=0;if(elem.style["left"]){result=elem.style["top"];}
else if(elem.currentStyle){result=elem.currentStyle["top"];}
else if(document.defaultView&&document.defaultView.getComputedStyle){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("top");}
return parseInt(result);},getObjectWidth:function(obj)
{var elem=this.getObject(obj);var result=0;if(elem.offsetWidth){result=elem.offsetWidth;}
else if(elem.clip&&elem.clip.width){result=elem.clip.width;}
else if(elem.style){if(elem.style.pixelWidth)
result=elem.style.pixelWidth;else if(elem.style.width)
result=elem.style.width;}
return parseInt(result);},getObjectHeight:function(obj)
{var elem=this.getObject(obj);var result=0;if(elem.offsetHeight){result=elem.offsetHeight;}
else if(elem.clip&&elem.clip.height){result=elem.clip.height;}
else if(elem.style){if(elem.style.pixelHeight)
result=elem.style.pixelHeight;else if(elem.style.height)
result=elem.style.height;}
return parseInt(result);},getWindowLocation:function()
{var t=null;var l=null;if(this.isIE){t=window.screenTop;l=window.screenLeft;}
else{top=window.screenY;l=window.screenX;}
return{top:t,left:l};},getInsideWindowWidth:function()
{if(window.innerWidth){return window.innerWidth;}
else if(this._isIE6CSS){return document.body.parentNode.clientWidth;}
else if(document.body&&document.body.clientWidth){return document.body.clientWidth;}
return 0;},getInsideWindowHeight:function()
{if(window.innerHeight){return window.innerHeight;}
else if(this._isIE6CSS){return document.body.parentNode.clientHeight;}
else if(document.body&&document.body.clientHeight){return document.body.clientHeight;}
return 0;},centerOnElement:function(base,child)
{baseElem=this.getObject(base);childElem=this.getObject(child);var offsetTrail=baseElem;var offsetLeft=0;var offsetTop=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;}
childElem.style.left=offsetLeft+parseInt(baseElem.offsetWidth/2)-
parseInt(childElem.offsetWidth/2)+"px";childElem.style.top=offsetTop+parseInt(baseElem.offsetHeight/2)-
parseInt(childElem.offsetHeight/2)+"px";},centerOnWindow:function(elem)
{var obj=this.getObject(elem);var scrollX=0;var scrollY=0;if(document.body&&typeof document.body.scrollTop!="undefined"){scrollX+=document.body.scrollLeft;scrollY+=document.body.scrollTop;if(document.body.parentNode&&typeof document.body.parentNode.scrollTop!="undefined"){scrollX+=document.body.parentNode.scrollLeft;scrollY+=document.body.parentNode.scrollTop;}}
else if(typeof window.pageXOffset!="undefined"){scrollX+=window.pageXOffset;scrollY+=window.apgeYOffset;}
var x=Math.round((this.getInsideWindowWidth()/2)-
(this.getObjectWidth(obj)/2))+scrollX;var y=Math.round((this.getInsideWindowHeight()/2)-
(this.getObjectHeight(obj)/2))+scrollY;this.shiftTo(obj,x,y);this.show(obj);},getElementPosition:function(elem)
{var offsetTrail=this.getObject(elem);var offsetLeft=0;var offsetTop=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;}
return{left:offsetLeft,top:offsetTop};},getPageScroll:function()
{var yScroll;var xScroll;if(self.pageXOffset)
xScroll=self.pageXOffset;else if(document.documentElement&&document.documentElement.scrollLeft)
xScroll=document.documentElement.scrollLeft;else if(document.body)
xScroll=document.body.scrollLeft;if(self.pageYOffset)
yScroll=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)
yScroll=document.documentElement.scrollTop;else if(document.body)
yScroll=document.body.scrollTop;var obj={scrollX:xScroll,scrollY:yScroll}
return obj;},getPageSize:function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
return{pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight};},getOpacity:function(obj)
{var opacity=null;if(this.isIE){var elem=dhtmlapi.getObject(obj);opacity=elem.style.filter;if(opacity==null||opacity=='')
return parseFloat("0.0");var arr=opacity.match(/alpha\(opacity=(.*)\)/);if(arr.length!=0){return parseFloat(arr[1])/100;}}
else{opacity=this.getObjectStyle(obj,'opacity');if(opacity!=null)
return parseFloat(opacity);}
return 1.0;},setOpacity:function(obj,value)
{var elem=dhtmlapi.getObject(obj);if(value==1)
{if(this.isIE){var old=elem.style.filter;elem.style.filter=old.replace(/alpha\([^\)]*\)/gi,'');}
else{if(this.isGecko&&!(this.isKonqueror||this.isSafari))
elem.style.opacity=0.999999;else
elem.style.opacity=null;}}else{if(value<0.00001)
value=0;elem.style.opacity=value;if(this.isIE){var old=elem.style.filter;old=old.replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+(value*100)+')';elem.style.filter=old;}}},getRangeText:function(rng)
{if(rng==null)
return null;if(this.isIE)
return rng.text;else
return rng.toString();}};if(String.prototype.localeCompare==null)
{String.prototype.localeCompare=function(dst){return((this==dst)?0:((this<dst)?-1:1));};}
var arrayUtils={append:function(array,element){array[array.length]=element;},insert:function(array,i,x){if(i<=0){return[x].concat(array);}else if(i>=array.length){return array.concat([x]);}else{return array.slice(0,i).concat([x],array.slice(i,array.length));}},insertAt:function(array,i,x){var save=null;for(var j=array.length-1;j>i;j--)
{array[j]=array[j-1];}
array[i]=x;},del:function(array,i){if(i==0){return array.slice(1);}else{return array.slice(0,i).concat(array.slice(i+1,array.length));}},clone:function(array){return array.concat();},push:function(array,x){return arrayUtils.insert(array,0,x);},pop:function(array){return arrayUtils.del(array,0);},find:function(array,x,compareFunc){for(var i in array){if((compareFunc!=null&&compareFunc(array[i],x)==0)||array[i]==x){return i-0;}}
return-1;},remove:function(array,x,compareFunc){var i=arrayUtils.find(array,x,compareFunc);return arrayUtils.del(array,i);},hasItem:function(array,x){for(var i in array){if(array[i]==x)
return true;}
return false;},addIfUnique:function(array,x){if(!arrayUtils.hasItem(array,x))
arrayUtils.append(array,x);}};function encode_base64(what)
{var base64_encodetable="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var result="";var len=what.length;var x,y;var ptr=0;while(len-->0)
{x=what.charCodeAt(ptr++);result+=base64_encodetable.charAt((x>>2)&63);if(len--<=0)
{result+=base64_encodetable.charAt((x<<4)&63);result+="==";break;}
y=what.charCodeAt(ptr++);result+=base64_encodetable.charAt(((x<<4)|((y>>4)&15))&63);if(len--<=0)
{result+=base64_encodetable.charAt((y<<2)&63);result+="=";break;}
x=what.charCodeAt(ptr++);result+=base64_encodetable.charAt(((y<<2)|((x>>6)&3))&63);result+=base64_encodetable.charAt(x&63);}
return result;}
function decode_base64(what)
{var base64_decodetable=new Array(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,52,53,54,55,56,57,58,59,60,61,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,63,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,255,255,255,255,255);var result="";var len=what.length;var x,y;var ptr=0;while(!isNaN(x=what.charCodeAt(ptr++)))
{if(x==13||x==10)
continue;if((x>127)||((x=base64_decodetable[x])==255))
return false;if((isNaN(y=what.charCodeAt(ptr++)))||((y=base64_decodetable[y])==255))
return false;result+=String.fromCharCode((x<<2)|(y>>4));if((x=what.charCodeAt(ptr++))==61)
{if((what.charCodeAt(ptr++)!=61)||(!isNaN(what.charCodeAt(ptr))))
return false;}
else
{if((x>127)||((x=base64_decodetable[x])==255))
return false;result+=String.fromCharCode((y<<4)|(x>>2));if((y=what.charCodeAt(ptr++))==61)
{if(!isNaN(what.charCodeAt(ptr)))
return false;}
else
{if((y>127)||((y=base64_decodetable[y])==255))
return false;result+=String.fromCharCode((x<<6)|y);}}}
return result;}
function wrap76(what)
{var result="";var i;for(i=0;i<what.length;i+=76)
{result+=what.substring(i,i+76)+String.fromCharCode(13)+String.fromCharCode(10);}
return result;}
function encryptURLParams(msg)
{var mode=0;var key="pikiwiki";var iv=null;var padding=1;var encrypt=1;var ciphertext=des(key,msg,encrypt,mode,iv,padding);var b64=encode_base64(ciphertext);return b64;}
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserWarning.object=null;BrowserWarning.prototype._cbFunc;BrowserWarning.prototype._dialog;function BrowserWarning(cbFunc)
{this._cbFunc=cbFunc;this._dialog=null;}
BrowserWarning.report=function(cbFunc)
{showWarn=Cookie.getCookie("pw_browserwarn");if(showWarn==null||showWarn==""||showWarn=="true"){var bw=new BrowserWarning(cbFunc);BrowserWarning.object=bw;bw.alert();}
else if(cbFunc!=null)
cbFunc(false);}
BrowserWarning.dialogCB=function()
{var bw=BrowserWarning.object;var elem=bw._dialog.getElementById("hidemessage");var exp=new Date();var now_plus_one_year=exp.getTime()+(365*24*3600*1000);exp.setTime(now_plus_one_year);Cookie.setCookie("pw_browserwarn",((elem.checked==true)?"false":"true"));if(bw._cbFunc!=null)
bw._cbFunc(true);}
BrowserWarning.prototype.alert=function()
{var plat=BrowserDetect.OS;var browser=BrowserDetect.browser;var version=BrowserDetect.version;var showWarn=false;var msg;if(httpuseragent!=null){var usera=httpuseragent.toLowerCase();if(usera.indexOf("yplus")!=-1)
browser="Yahoo";}
if(plat=="Mac"){if(browser=="Safari"){var ua=navigator.userAgent.toLowerCase();var isSafari3=false;if(ua.indexOf("522")!=-1)
isSafari3=true;if(ua.indexOf("")!=-1)
browser
if(isSafari3){showWarn=true;msg="Safari 3 does NOT support all PikiWiki features!<br/><br/>"+"Basic features, including viewing and editing pages work fine.  However:<br/><br/>"+"* You CANNOT directly drag & drop pictures, video, and other files onto PikiWiki pages.<br/>   "+"* INSTEAD, you CAN add files with our file upload tool.<br/>"+"* You CANNOT record audio or video to PikiWiki pages.<br/>"+"We are working hard to bring full support to the Mac.  Stay Tuned! ";}
else{showWarn=true;msg="Safari 2 is not fully supported!<br/><br/>"+"Safari 2 works OK to view PikiWiki pages.  However:<br/><br/>"+"* You CANNOT edit or make new PikiWiki pages.<br/>"+"* Your PikiWiki Home Page will be buggy.<br/><br/>"+"If you wish to edit pages, try PikiWiki with Safari 3 (Beta) or Firefox on the Mac.";}}
else{if(browser=="Firefox"){if(version=="2"){showWarn=true;msg="Firefox on the Mac is not fully supported!<br/><br/>"+"Basic features, including viewing and editing pages work fine.  However:<br/><br/>"+"* You CANNOT directly drag & drop pictures, video, and other files onto PikiWiki pages. <br/>"+"* INSTEAD, you CAN add files with our file upload tool.<br/>"+"* Recording Audio and Video may cause Firefox to close unexpectedly for some users. <br/><br/>"+"We are working hard to bring full support to the Mac.  Stay Tuned! ";}
else{showWarn=true;msg=msg="Your web browser, Firefox"+version+" is not supported by PikiWiki!<br/><br/>"+"It may work to some degree, but you will probably run into problems using your current browser.<br/>"+"We recommend the following browsers for the best PikiWiki experience:<br/><br/>"+"Windows:<br/>"+"Internet Explorer 6 or 7<br/>"+"Firefox 2<br/><br/>"+"Mac:<br/>"+"Safari 3<br/>"+"Firefox 2";}}
else{showWarn=true;msg="Your web browser is not supported by PikiWiki!<br/><br/>"+"It may work to some degree, but you will probably run into problems using your current browser.<br/>"+"We recommend the following browsers for the best PikiWiki experience:<br/><br/>"+"Windows:<br/>"+"Internet Explorer 6 or 7<br/>"+"Firefox 2<br/><br/>"+"Mac:<br/>"+"Safari 3<br/>"+"Firefox 2";}}}
else{if(plat=="Windows"){if(browser!="Firefox"&&browser!="Explorer"&&browser!="Safari"&&browser!="Yahoo"){showWarn=true;msg=msg="Your web browser is not supported by PikiWiki!<br/><br/>"+"It may work to some degree, but you will probably run into problems using your current browser.<br/>"+"We recommend the following browsers for the best PikiWiki experience:<br/><br/>"+"Windows:<br/>"+"Internet Explorer 6 or 7<br/>"+"Firefox 2<br/><br/>"+"Mac:<br/>"+"Safari 3<br/>"+"Firefox 2";}
else{if(browser=="Safari"){showWarn=true;msg="Safari 3 does NOT support all PikiWiki features!<br/><br/>"+"Basic features, including viewing and editing pages work fine.  However:<br/><br/>"+"* You CANNOT directly drag & drop pictures, video, and other files onto PikiWiki pages.<br/>   "+"* INSTEAD, you CAN add files with our file upload tool.<br/>"+"We are working hard to bring full support to Safari. Stay Tuned! ";}
if(browser=="Yahoo"&&version=="6"){showWarn=true;msg="The AT&T/Yahoo SBC browser does NOT support all PikiWiki features!<br/><br/>"+"Basic features, including viewing and editing pages work fine.  However:<br/><br/>"+"* You CANNOT directly drag & drop pictures, video, and other files onto PikiWiki pages.<br/>   "+"* INSTEAD, you CAN add files with our file upload tool.<br/>"+"There is a known bug by the Yahoo Browser dev team related with Java and Javascript.  <br/><br/> "+"Please use either Internet Explorer 6/7, or Firefox 2 if you'd like to use our drag and drop feature.";}}}
else{showWarn=true;msg="Your web browser is not supported by PikiWiki!<br/><br/>"+"It may work to some degree, but you will probably run into problems using your current browser.<br/>"+"We recommend the following browsers for the best PikiWiki experience:<br/><br/>"+"Windows:<br/>"+"Internet Explorer 6 or 7<br/>"+"Firefox 2<br/><br/>"+"Mac:<br/>"+"Safari 3<br/>"+"Firefox 2";}}
if(!showWarn){if(this._cbFunc!=null)
this._cbFunc(false);}
else{var options=["okButton","width=600"];this._dialog=ModalDialog.createInstance(options,BrowserWarning.dialogCB,null);var s='<table width="95%">'+'<tr valign=center><td align=left><div class=mediumText>'+msg+'<br><br></div></td></tr>'+'<tr><td align=center>'+'<input class=smallText type=checkbox id=hidemessage>'+'<span class=smallText>Don\'t show this message again</span>'+'</td></tr></table>';this._dialog.render(s);}}
ColorSelection.prototype._title;ColorSelection.prototype._colors;function ColorSelection(title,c1,c2,c3,c4,c5,c6)
{this._title=title;this._colors=new Array(6);this._colors[0]=c1;this._colors[1]=c2;this._colors[2]=c3;this._colors[3]=c4;this._colors[4]=c5;this._colors[5]=c6;}
ColorSelection.parse=function(xml)
{var list=xml.getElementsByTagName("color");if(list==null)return null;var color=list.item(0);if(color==null)return null;var title=color.getAttribute("title");var cs=new ColorSelection();cs._title=title;cs._colors=new Array(6);var idx=0;for(var elem=color.firstChild;elem;elem=elem.nextSibling){cs._colors[idx++]=xmlutils.getNodeText(elem);}
for(;idx<6;idx++)
cs._colors[idx]='black';return cs;}
ColorSelection.prototype.setColors=function(list)
{for(var i=0;i<6;i++)
this._colors[i]=list[i];}
ColorSelection.prototype.getData=function(columnId,clientData)
{var lc=null;var str='<div style="position:relative;height:16px;width:144px;">'+'  <div style="position:absolute;top:0px;left:0px;width:48;height:16;background-color:"'+this._colors[0]+';"></div>'+'  <div style="position:absolute;top:0px;left:48px;width:48;height:16;background-color:"'+this._colors[1]+';"></div>'+'  <div style="position:absolute;top:0px;left:96px;width:48;height:16;background-color:"'+this._colors[2]+';"></div>';str+='</div>';lc=new ListCell(ListCell.TYPE_CONTAINER,str,16,144);return lc;}
ColorSelection.prototype.toXmlString=function()
{var str='<color title="'+this._title+'">'+'<c1>'+this._colors[0]+'</c1>'+'<c2>'+this._colors[1]+'</c2>'+'<c3>'+this._colors[2]+'</c3>'+'<c4>'+this._colors[3]+'</c4>'+'<c5>'+this._colors[4]+'</c5>'+'<c6>'+this._colors[5]+'</c6>'+'</color>';return str;}
function Cookie()
{}
Cookie.clearCookie=function(cookieName){var now=new Date();var yesterday=new Date(now.getTime()-1000*60*60*24);this.setCookie(cookieName,'cookieValue',yesterday);};Cookie.setCookie=function(cookieName,cookieValue,expires,path,domain,secure){document.cookie=escape(cookieName)+'='+escape(cookieValue)
+(expires?'; expires='+expires.toGMTString():'')
+(path?'; path='+path:'')
+(domain?'; domain='+domain:'')
+(secure?'; secure':'');};Cookie.getCookie=function(cookieName){var cookieValue='';var posName=document.cookie.indexOf(escape(cookieName)+'=');if(posName!=-1){var posValue=posName+(escape(cookieName)+'=').length;var endPos=document.cookie.indexOf(';',posValue);if(endPos!=-1)cookieValue=unescape(document.cookie.substring(posValue,endPos));else cookieValue=unescape(document.cookie.substring(posValue));}
return(cookieValue);};var gDebugWindow=null;var gDebugMode=false;var gDebugWindowReady=false;function createDebugWindow()
{var params="height=450, width=700, resizable, scrollbars";gDebugWindow=window.open("debug.htm","debug",params);gDebugMode=true;}
function debugLog(str,doNotEscape)
{var mainWindow=window;if(!mainWindow.gDebugMode)
return;if(mainWindow.gDebugWindow==null||mainWindow.gDebugWindow!=null&&mainWindow.gDebugWindow.closed)
return;if(!mainWindow.gDebugWindowReady)
return;mainWindow.gDebugWindow.log(str,doNotEscape);}
function toggleDebugMode()
{ASSERT(isMainWindow(window));if(!gDebugMode)
{gDebugMode=true;if(gDebugWindow==null||gDebugWindow!=null&&gDebugWindow.closed)
{gDebugWindow=window.open("debugWindow.html","debug","height=450, width=700, resizable, scrollbars");}}
else
{gDebugMode=false;if(gDebugWindow!=null&&!gDebugWindow.closed)
gDebugWindow.close();gDebugWindow=null;}}
function des(key,message,encrypt,mode,iv,padding){var spfunction1=new Array(0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004);var spfunction2=new Array(-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000);var spfunction3=new Array(0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200);var spfunction4=new Array(0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080);var spfunction5=new Array(0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100);var spfunction6=new Array(0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010);var spfunction7=new Array(0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002);var spfunction8=new Array(0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000);var keys=des_createKeys(key);var m=0,i,j,temp,temp2,right1,right2,left,right,looping;var cbcleft,cbcleft2,cbcright,cbcright2
var endloop,loopinc;var len=message.length;var chunk=0;var iterations=keys.length==32?3:9;if(iterations==3){looping=encrypt?new Array(0,32,2):new Array(30,-2,-2);}
else{looping=encrypt?new Array(0,32,2,62,30,-2,64,96,2):new Array(94,62,-2,32,64,2,30,-2,-2);}
if(padding==2)message+="        ";else if(padding==1){temp=8-(len%8);message+=String.fromCharCode(temp,temp,temp,temp,temp,temp,temp,temp);}
else if(!padding)message+="\0\0\0\0\0\0\0\0";result="";tempresult="";if(mode==1){cbcleft=(iv.charCodeAt(m++)<<24)|(iv.charCodeAt(m++)<<16)|(iv.charCodeAt(m++)<<8)|iv.charCodeAt(m++);cbcright=(iv.charCodeAt(m++)<<24)|(iv.charCodeAt(m++)<<16)|(iv.charCodeAt(m++)<<8)|iv.charCodeAt(m++);m=0;}
while(m<len){left=(message.charCodeAt(m++)<<24)|(message.charCodeAt(m++)<<16)|(message.charCodeAt(m++)<<8)|message.charCodeAt(m++);right=(message.charCodeAt(m++)<<24)|(message.charCodeAt(m++)<<16)|(message.charCodeAt(m++)<<8)|message.charCodeAt(m++);if(mode==1){if(encrypt){left^=cbcleft;right^=cbcright;}else{cbcleft2=cbcleft;cbcright2=cbcright;cbcleft=left;cbcright=right;}}
temp=((left>>>4)^right)&0x0f0f0f0f;right^=temp;left^=(temp<<4);temp=((left>>>16)^right)&0x0000ffff;right^=temp;left^=(temp<<16);temp=((right>>>2)^left)&0x33333333;left^=temp;right^=(temp<<2);temp=((right>>>8)^left)&0x00ff00ff;left^=temp;right^=(temp<<8);temp=((left>>>1)^right)&0x55555555;right^=temp;left^=(temp<<1);left=((left<<1)|(left>>>31));right=((right<<1)|(right>>>31));for(j=0;j<iterations;j+=3){endloop=looping[j+1];loopinc=looping[j+2];for(i=looping[j];i!=endloop;i+=loopinc){right1=right^keys[i];right2=((right>>>4)|(right<<28))^keys[i+1];temp=left;left=right;right=temp^(spfunction2[(right1>>>24)&0x3f]|spfunction4[(right1>>>16)&0x3f]|spfunction6[(right1>>>8)&0x3f]|spfunction8[right1&0x3f]|spfunction1[(right2>>>24)&0x3f]|spfunction3[(right2>>>16)&0x3f]|spfunction5[(right2>>>8)&0x3f]|spfunction7[right2&0x3f]);}
temp=left;left=right;right=temp;}
left=((left>>>1)|(left<<31));right=((right>>>1)|(right<<31));temp=((left>>>1)^right)&0x55555555;right^=temp;left^=(temp<<1);temp=((right>>>8)^left)&0x00ff00ff;left^=temp;right^=(temp<<8);temp=((right>>>2)^left)&0x33333333;left^=temp;right^=(temp<<2);temp=((left>>>16)^right)&0x0000ffff;right^=temp;left^=(temp<<16);temp=((left>>>4)^right)&0x0f0f0f0f;right^=temp;left^=(temp<<4);if(mode==1){if(encrypt){cbcleft=left;cbcright=right;}else{left^=cbcleft2;right^=cbcright2;}}
tempresult+=String.fromCharCode((left>>>24),((left>>>16)&0xff),((left>>>8)&0xff),(left&0xff),(right>>>24),((right>>>16)&0xff),((right>>>8)&0xff),(right&0xff));chunk+=8;if(chunk==512){result+=tempresult;tempresult="";chunk=0;}}
return result+tempresult;}
function des_createKeys(key){pc2bytes0=new Array(0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204);pc2bytes1=new Array(0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101);pc2bytes2=new Array(0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808);pc2bytes3=new Array(0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000);pc2bytes4=new Array(0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010);pc2bytes5=new Array(0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420);pc2bytes6=new Array(0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002);pc2bytes7=new Array(0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800);pc2bytes8=new Array(0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002);pc2bytes9=new Array(0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408);pc2bytes10=new Array(0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020);pc2bytes11=new Array(0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200);pc2bytes12=new Array(0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010);pc2bytes13=new Array(0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105);var iterations=key.length>8?3:1;var keys=new Array(32*iterations);var shifts=new Array(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0);var lefttemp,righttemp,m=0,n=0,temp;for(var j=0;j<iterations;j++){left=(key.charCodeAt(m++)<<24)|(key.charCodeAt(m++)<<16)|(key.charCodeAt(m++)<<8)|key.charCodeAt(m++);right=(key.charCodeAt(m++)<<24)|(key.charCodeAt(m++)<<16)|(key.charCodeAt(m++)<<8)|key.charCodeAt(m++);temp=((left>>>4)^right)&0x0f0f0f0f;right^=temp;left^=(temp<<4);temp=((right>>>-16)^left)&0x0000ffff;left^=temp;right^=(temp<<-16);temp=((left>>>2)^right)&0x33333333;right^=temp;left^=(temp<<2);temp=((right>>>-16)^left)&0x0000ffff;left^=temp;right^=(temp<<-16);temp=((left>>>1)^right)&0x55555555;right^=temp;left^=(temp<<1);temp=((right>>>8)^left)&0x00ff00ff;left^=temp;right^=(temp<<8);temp=((left>>>1)^right)&0x55555555;right^=temp;left^=(temp<<1);temp=(left<<8)|((right>>>20)&0x000000f0);left=(right<<24)|((right<<8)&0xff0000)|((right>>>8)&0xff00)|((right>>>24)&0xf0);right=temp;for(i=0;i<shifts.length;i++){if(shifts[i]){left=(left<<2)|(left>>>26);right=(right<<2)|(right>>>26);}
else{left=(left<<1)|(left>>>27);right=(right<<1)|(right>>>27);}
left&=-0xf;right&=-0xf;lefttemp=pc2bytes0[left>>>28]|pc2bytes1[(left>>>24)&0xf]|pc2bytes2[(left>>>20)&0xf]|pc2bytes3[(left>>>16)&0xf]|pc2bytes4[(left>>>12)&0xf]|pc2bytes5[(left>>>8)&0xf]|pc2bytes6[(left>>>4)&0xf];righttemp=pc2bytes7[right>>>28]|pc2bytes8[(right>>>24)&0xf]|pc2bytes9[(right>>>20)&0xf]|pc2bytes10[(right>>>16)&0xf]|pc2bytes11[(right>>>12)&0xf]|pc2bytes12[(right>>>8)&0xf]|pc2bytes13[(right>>>4)&0xf];temp=((righttemp>>>16)^lefttemp)&0x0000ffff;keys[n++]=lefttemp^temp;keys[n++]=righttemp^(temp<<16);}}
return keys;}
function stringToHex(s){var r="0x";var hexes=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");for(var i=0;i<s.length;i++){r+=hexes[s.charCodeAt(i)>>4]+hexes[s.charCodeAt(i)&0xf];}
return r;}
var EventUtils={x:0,y:0,operation:"",getEvent:function(e){return(e)?e:window.event;},getTargetElement:function(evt){return(evt.target)?evt.target:evt.srcElement;},getCurrentTarget:function(evt){return(evt.currentTarget)?evt.currentTarget:evt.srcElement;},getFromElement:function(evt){return(evt.relatedTarget)?evt.relatedTarget:evt.fromElement;},getToElement:function(evt){return(evt.relatedTarget)?evt.relatedTarget:evt.toElement;},preventDefault:function(evt){if(evt.returnValue)
evt.returnValue=false;else if(evt.preventDefault)
evt.preventDefault();else
return false;},stopPropagation:function(evt){evt.cancelBubble=true;if(evt.stopPropagation)
evt.stopPropagation();},getIframeEvent:function(e,frameId,etype){if(e!=null)
return e;for(var i=0;i<window.frames.length;i++)
{var fr=window.frames[i];if(fr.frameElement.id==frameId)
return fr.event;}
return null;}};Logger.object=null;Logger.prototype._window=null;Logger.prototype._table=null;Logger.prototype._rows=0;Logger.prototype._dateCache=null;Logger.prototype._msgCache=null;function Logger(options)
{this._window=window.open("","logwindow",options);var str='<html><head><title>Log Window</title></head><body>'+'<table id="logTable" bgcolor="white" width="720" border="1" align="center" cellspacing=0 cellpadding=1>'+'<tr>'+'  <td style="width:200px;font-size:10px;color:blue;">Date</td>'+'  <td style="width:500px;font-size:10px;color:blue;">Message</td>'+'</tr>'+'</table>'+'</body></html>';this._window.document.write(str);this._dateCache=new Array();this._msgCache=new Array();this._table=this._window.document.getElementById("logTable");}
Logger.getInstance=function(options)
{if(Logger.object!=null){try{Logger.object.clear();}catch(e){Logger.object=new Logger(options);}
finally{return Logger.object;}}
Logger.object=new Logger(options);return Logger.object;}
Logger.initialize=function()
{var logger=Logger.object;logger._table=logger._window.document.getElementById("logTable");if(logger._table==null){setTimeout("Logger.initialize()",25);return;}
for(var idx=0;idx<logger._msgCache.length;idx++){logger.appendMessage(logger._msgCache[idx],logger._dateCache[idx]);}}
Logger.prototype.clear=function()
{while(this._table.rows.length>0){this._table.deleteRow(0);}}
Logger.prototype.focus=function()
{this._window.focus();}
Logger.prototype.log=function(str)
{if(str==null||str==undefined)
return;if(this._table==null){setTimeout("Logger.initialize()",25);this.appendMessageToCache(str);return;}
var dstr=new Date().toLocaleString();this.appendMessage(str,dstr);this._table.scrollIntoView(false);}
Logger.prototype.appendMessageToCache=function(str)
{this._dateCache[this._dateCache.length]=new Date().toLocaleString();this._msgCache[this._msgCache.length]=str;}
Logger.prototype.appendMessage=function(str,dstr)
{var trow=this._table.insertRow(-1);this.appendDateCell(trow,dstr);this.appendTextCell(trow,str);this._rows++;}
Logger.prototype.appendDateCell=function(row,dstr)
{var cell=row.insertCell(-1);cell.style.fontSize="10px";var txt=this._window.document.createTextNode(dstr);cell.appendChild(txt);}
Logger.prototype.appendTextCell=function(row,str)
{var cell=row.insertCell(-1);cell.style.fontSize="10px";cell.innerHTML=this.escapeHtml(str);}
Logger.prototype.escapeHtml=function(text)
{if(text==null)
return"";text=text.replace(/&/g,"&amp;");text=text.replace(/</g,"&lt;");text=text.replace(/>/g,"&gt;");return text;}
var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}
function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}
function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}
function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}
function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}
function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}
function md5_vm_test()
{return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}
function core_md5(x,len)
{x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16)
{var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
return Array(a,b,c,d);}
function md5_cmn(q,a,b,x,s,t)
{return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}
function md5_ff(a,b,c,d,x,s,t)
{return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}
function md5_gg(a,b,c,d,x,s,t)
{return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}
function md5_hh(a,b,c,d,x,s,t)
{return md5_cmn(b^c^d,a,b,x,s,t);}
function md5_ii(a,b,c,d,x,s,t)
{return md5_cmn(c^(b|(~d)),a,b,x,s,t);}
function core_hmac_md5(key,data)
{var bkey=str2binl(key);if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++)
{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}
function safe_add(x,y)
{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}
function bit_rol(num,cnt)
{return(num<<cnt)|(num>>>(32-cnt));}
function str2binl(str)
{var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;}
function binl2str(bin)
{var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;}
function binl2hex(binarray)
{var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;}
function binl2b64(binarray)
{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3)
{var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++)
{if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
return str;}
MimeTypes.DEFAULT_MIME_TYPE="application/octet-stream";MimeTypes.mimeTypeList=null;MimeTypes.prototype._type;MimeTypes.prototype._subtype;MimeTypes.prototype._data;function MimeTypes(type,subtype,data)
{this._type=type;this._subtype=subtype;this._data=data;}
MimeTypes.add=function(suffix,mtype)
{if(suffix==null||mtype==null)
return;if(MimeTypes.mimeTypeList==null)
MimeTypes.mimeTypeList=new Object();MimeTypes.mimeTypeList[suffix]=mtype;}
MimeTypes.prototype.equals=function(typ,subtype)
{if(typ!=null){if(typ!=this._type)
return false;if(subtype!=null){if(subtype!=this._subtype)
return false;}
return true;}
else{return false;}}
MimeTypes.get=function(suffix)
{return MimeTypes.mimeTypeList[suffix];}
MimeTypes.getName=function(filename)
{var idx=filename.lastIndexOf("/");var name=null;if(idx==-1)
name=filename;else
name=filename.substr(idx+1);return name;}
MimeTypes.getMimeType=function(filename)
{if(filename==null)
return null;try{var name=MimeTypes.getName(filename);var idx=name.lastIndexOf('.');if(idx==-1)
return MimeTypes.DEFAULT_MIME_TYPE
var suffix=name.substring(idx+1).toLowerCase();var mt=MimeTypes.get(suffix);if(mt==null)
mt=MimeTypes.DEFAULT_MIME_TYPE;return mt;}catch(e){return MimeTypes.DEFAULT_MIME_TYPE}}
MimeTypes.isFileSuffix=function(filename,suffix)
{if(filename==null||suffix==null)
return false;var idx=filename.lastIndexOf(".");if(idx==-1)
return false;var str=filename.substr(idx+1);if(str.toUpperCase()==suffix.toUpperCase())
return true;else
return false;}
MimeTypes.isMimeType=function(elem,mtype)
{if(elem==null||mtype==null)
return false;var attr=null;if(typeof elem=="string")
attr=elem;else{attr=elem.getAttribute("mimeType");if(attr==null||attr=="")
return false;}
var str=null;if(mtype.indexOf("/")!=-1){str=attr;}
else{var idx=attr.indexOf("/");str=(idx==-1)?attr:attr.substring(0,idx);}
return(mtype==str)?true:false;}
MimeTypes.add('ai','application/postscript');MimeTypes.add('asf','video/x-ms-asf');MimeTypes.add('au','audio/basic');MimeTypes.add('avi','video/avi');MimeTypes.add('bm','image/bmp');MimeTypes.add('bmp','image/bmp');MimeTypes.add('css','text/css');MimeTypes.add('doc','application/msword');MimeTypes.add('dot','application/msword');MimeTypes.add('dvi','application/x-dvi');MimeTypes.add('eps','application/postscript');MimeTypes.add('exe','application/octet-stream');MimeTypes.add('gif','image/gif');MimeTypes.add('gz','application/x-compressed');MimeTypes.add('htm','text/href');MimeTypes.add('html','text/href');MimeTypes.add('htmls','text/href');MimeTypes.add('htx','text/href');MimeTypes.add('ico','image/x-icon');MimeTypes.add('jam','audio/x-jam');MimeTypes.add('java','text/plain');MimeTypes.add('jfif','image/jpeg');MimeTypes.add('jpe','image/jpeg');MimeTypes.add('jpeg','image/jpeg');MimeTypes.add('jpg','image/jpeg');MimeTypes.add('js','application/x-javascript');MimeTypes.add('kar','music/x-karaoke');MimeTypes.add('log','text/plain');MimeTypes.add('lst','text/plain');MimeTypes.add('m1v','video/mpeg');MimeTypes.add('m2a','audio/mpeg');MimeTypes.add('m2v','video/mpeg');MimeTypes.add('mjpg','video/x-motion-jpeg');MimeTypes.add('moov','video/quicktime');MimeTypes.add('mov','video/quicktime');MimeTypes.add('mp2','audio/mpeg');MimeTypes.add('mp3','application/mpeg3');MimeTypes.add('mpa','audio/mpeg');MimeTypes.add('mpa','video/mpeg');MimeTypes.add('mpe','video/mpeg');MimeTypes.add('mpeg','video/mpeg');MimeTypes.add('mpg','video/mpeg');MimeTypes.add('mpga','audio/mpeg');MimeTypes.add('pdf','application/pdf');MimeTypes.add('png','image/png');MimeTypes.add('ppt','application/powerpoint');MimeTypes.add('ps','application/postscript');MimeTypes.add('qif','image/x-quicktime');MimeTypes.add('qt','video/quicktime');MimeTypes.add('ra','audio/x-pn-realaudio');MimeTypes.add('rng','application/ringing-tones');MimeTypes.add('rt','text/richtext');MimeTypes.add('rtf','application/rtf');MimeTypes.add('swf','application/x-shockwave-flash');MimeTypes.add('tar','application/x-tar');MimeTypes.add('text','text/plain');MimeTypes.add('txt','text/plain');MimeTypes.add('wav','audio/wav');MimeTypes.add('xla','application/excel');MimeTypes.add('xlb','application/excel');MimeTypes.add('xlc','application/excel');MimeTypes.add('xld','application/excel');MimeTypes.add('xlk','application/excel');MimeTypes.add('xll','application/excel');MimeTypes.add('xlm','application/excel');MimeTypes.add('xls','application/excel');MimeTypes.add('xlt','application/excel');MimeTypes.add('xlv','application/excel');MimeTypes.add('xlw','application/excel');MimeTypes.add('xm','audio/xm');MimeTypes.add('xml','application/xml');MimeTypes.add('x-png','image/png');MimeTypes.add('zip','application/zip');Preferences.prototype._root;function Preferences()
{this._root=new Preference(null,null);}
Preferences.createInstance=function(preferences)
{var prefs=new Preferences();for(var i in preferences._list){var p=preferences._list[i];prefs.setPreference(p.getName(),p.getValue());}
return prefs;}
Preferences.parseXml=function(preferences)
{var p=new Preferences();var root=preferences;if(typeof preferences=="string"){xmlutils.loadXml(xmlutils.dom,preferences);root=xmlutils.dom.documentElement;}
var prefs=root.getElementsByTagName("preference");var elem=null;var name=null;var val=null;var pref=null;for(var i=0;i<prefs.length;i++){elem=prefs.item(i);name=elem.getAttribute("name");if(elem.firstChild.nodeType==3)
val=xmlutils.getNodeText(elem);else
val=elem;p.add(name,val);}
return p;}
Preferences.prototype.add=function(name,value)
{var node=this.get(name);if(node!=null){node.setValue(value);return;}
var namespace=name.split(".");var branch=this._root;var leaf=null;for(var i=0;i<namespace.length;i++)
{leaf=branch.get(namespace[i]);if(leaf==null)
{leaf=branch.add(namespace[i]);}
branch=leaf;}
branch.setValue(value);}
Preferences.prototype.get=function(name)
{var namespace=name.split('.');var leaf=null;var branch=this._root;for(var i=0;i<namespace.length;i++)
{leaf=branch.get(namespace[i]);if(leaf==null){return null;}
else
branch=leaf;}
return branch;}
Preferences.prototype.getPreferenceValue=function(name,defaultValue)
{var value=null;var pref=this.get(name);if(pref!=null)
value=pref.getValue();if(value==null&&defaultValue!=null)
value=defaultValue;return value;}
Preferences.prototype.setPreferenceValue=function(name,value)
{var pref=this.get(name);if(pref!=null){pref.setValue(value);return true;}
else{this.add(name,value);}
return false;}
Preferences.prototype.toXmlString=function()
{var str="<preferences>"+this._root.toXmlString(null)+"</preferences>";return str;}
Preference.prototype._name;Preference.prototype._value;Preference.prototype._leaves;function Preference(name,value)
{this._name=name;this._value=value;this._leaves=new Array(0);}
Preference.createCopy=function(preference)
{var pref=new Preference(preference.getName(),preference.getValue());return pref;}
Preference.prototype.add=function(name)
{var p=new Preference(name,null);this._leaves[this._leaves.length]=p;return p;}
Preference.prototype.equals=function(name)
{return(this._name==name);}
Preference.prototype.get=function(name)
{for(var i=0;i<this._leaves.length;i++)
{if(this._leaves[i].equals(name)==true)
return this._leaves[i];}
return null;}
Preference.prototype.getName=function()
{return this._name;}
Preference.prototype.getValue=function()
{return this._value;}
Preference.prototype.setValue=function(val)
{this._value=val;}
Preference.prototype.toXmlString=function(namespace)
{var ns=null;if(namespace!=null)
ns=namespace+"."+this._name;else
ns=this._name;var s="";if(this._value!=null){if(typeof this._value=="string")
s+='<preference name="'+ns+'">'+this._value+'</preference>';else
s+=xmlutils.getNodeXML(this._value);}
for(var i=0;i<this._leaves.length;i++)
{s+=this._leaves[i].toXmlString(ns);}
return s;}
Preference.prototype.toXml=function(elem,namespace)
{var ns=null;if(namespace!=null)
ns=namespace+"."+this._name;else
ns=this._name;var s="";if(this._value!=null){var prop=xmlutils.createTextElement("property",this._value);prop.setAttribute("name",ns);elem.appendChild(prop);}
for(var i=0;i<this._leaves.length;i++)
{this._leaves[i].toXml(elem,ns);}
return;}
RecordSet.prototype._data;RecordSet.prototype._sortfunc;function RecordSet(data,sortfunc)
{if(data==null){this._data=new Array(0);}
else{this._data=new Array(data.length);for(var i=0;i<data.length;i++)
{this._data[i]=data[i];}}
this._sortfunc=(sortfunc==null)?null:sortfunc;}
RecordSet.prototype.indexOf=function(item)
{if(this._data==null)
return-1;for(var i=0;i<this._data.length;i++){var obj=this._data[i];if(item.getOid()==obj.getOid()){return i;}}
return-1;}
RecordSet.prototype.item=function(idx)
{return this._data[idx];}
RecordSet.prototype.size=function()
{return this._data.length;}
RecordSet.prototype.sort=function(sortType)
{if(this._sortfunc!=null)
this._sortfunc(this,sortType);}
Soap.PARAMETER_STRING="string";Soap.PARAMETER_INTEGER="integer";Soap.PARAMETER_LONG="long";Soap.PARAMETER_BINARY="binary";Soap.PARAMETER_BOOLEAN="boolean";Soap.PARAMETER_XML="xml";Soap.prototype.header;Soap.prototype.body;Soap.prototype.fault;Soap.prototype.authentication;Soap.prototype.module;Soap.prototype.operation;Soap.prototype.parameters;function Soap()
{this.header=null;this.body=null;this.fault=null;this.authentication=null;this.module=null;this.operation=null;this.parameters=null;}
Soap.createSoapRequest=function(module,operation)
{var soap=new Soap();soap.module=module;soap.operation=operation;soap.authentication=null;return soap;}
Soap.createSoapResponse=function(xmlstr)
{var soap=new Soap();xmlutils.loadXml(xmlutils.dom,xmlstr);var env=xmlutils.dom.documentElement;var hdr=env.firstChild;var bdy=env.lastChild;var auth=hdr.getElementsByTagName("m_auth").item(0);soap.authentication=xmlutils.getNodeText(auth);var flt=Soap.parseFault(bdy);var elem=null;if(flt!=null)
{soap.fault=new SoapFault();for(elem=flt.firstChild;elem;elem=elem.nextSibling)
{var tagName=elem.tagName;var txt=xmlutils.getNodeText(elem);switch(tagName){case"faultcode":soap.fault.code=txt;break;case"faultstring":soap.fault.string=txt;break;case"faultactor":soap.fault.actor=txt;break;case"faultdetail":soap.fault.detail=txt;break;}}}
else{var elem=env.getElementsByTagName("response").item(0);soap.module=elem.getAttribute("module");soap.operation=elem.getAttribute("op");elem=elem.getElementsByTagName("param");soap.parameters=new Object();for(var i=0;i<elem.length;i++){var sp=SoapParameter.createInstance(elem.item(i));var n=sp.getName();soap.parameters[n]=sp;}}
return soap;}
Soap.parseFault=function(bdy)
{for(var elem=bdy.firstChild;elem!=null;elem=elem.nextSibling)
{var tagName=elem.tagName;if(tagName=="soap:Fault")
return elem;}
return null;}
Soap.prototype.toXmlString=function()
{var xmlstr=null;xmlstr='<?xml version="1.0" encoding="UTF-8"?>'+'<soap:Envelope '+'xmlns:soap="http://www.w3.org/2001/12/soap-envelope" '+'soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding" >';if(this.authentication!=null)
{xmlstr+='<soap:Header>'+' <m_auth xmlns:m="http://www.pikiwiki.com/soap" soap:mustUnderstand="1">'+
this.authentication+'</m_auth></soap:Header>';}
xmlstr+='<soap:Body>'+'<request module="'+this.module+'" op="'+this.operation+'">';for(var i in this.parameters){var sp=this.parameters[i];xmlstr+='<param name="'+sp.getName()+'" type="'+sp.getType()+'">'+
sp.getValue()+'</param>';}
xmlstr+='</request></soap:Body></soap:Envelope>';return xmlstr;}
Soap.prototype.isFault=function()
{return(this.fault!=null)?true:false;}
Soap.prototype.getFault=function()
{return this.fault;}
Soap.prototype.getAuthentication=function()
{return this.authentication;}
Soap.prototype.getParameter=function(name)
{if(this.parameters==null||name==null)
return null;return this.parameters[name];}
Soap.prototype.setAuthentication=function(value)
{this.authentication=value;}
Soap.prototype.setParameter=function(name,typ,value)
{var sp=new SoapParameter(name,typ,value);if(this.parameters==null)
this.parameters=new Object();this.parameters[name]=sp;}
SoapFault.prototype.code;SoapFault.prototype.string;SoapFault.prototype.actor;SoapFault.prototype.detail;function SoapFault()
{this.code=null;this.string=null;this.actor=null;this.detail=null;}
SoapParameter.prototype.name;SoapParameter.prototype.type;SoapParameter.prototype.value;function SoapParameter(name,typ,value)
{this.name=name;this.type=typ;this.value=value;}
SoapParameter.createInstance=function(elem)
{var typ=elem.getAttribute("type");var val=xmlutils.getNodeText(elem);if(typ=="xml")
val=xmlutils.getNodeXML(elem.firstChild);var sp=new SoapParameter(elem.getAttribute("name"),elem.getAttribute("type"),val);return sp;}
SoapParameter.prototype.getName=function(){return this.name;}
SoapParameter.prototype.getType=function(){return this.type;}
SoapParameter.prototype.getValue=function(){return this.value;}
SoapRequest.prototype.soapMsg;SoapRequest.prototype.authentication;SoapRequest.prototype.appCbFunc;SoapRequest.prototype.userCbFunc;SoapRequest.prototype.userData;SoapRequest.prototype.count;SoapRequest.prototype.host;SoapRequest.prototype.servletPath;function SoapRequest(soapMsg,host,servletPath,auth,appCbFunc,userCbFunc,userData)
{this.soapMsg=soapMsg;this.authentication=auth;this.appCbFunc=appCbFunc;this.userCbFunc=userCbFunc;this.userData=userData;this.host=host;this.servletPath=servletPath;this.count=0;}
Tree.TREE=parseInt("0x01");Tree.BINARY_TREE=parseInt("0x02");function Tree()
{}
Tree.find=function(tree_type,node,item,arg)
{var ret=false;if(tree_type==Tree.TREE)
{if(node.isEqual(item,arg)==true)
return node;if(node._children!=null)
{for(var i=0;i<node._children.length;i++)
{var childNode=node._children[i]
var foundNode=Tree.find(tree_type,childNode,item,arg);if(foundNode!=null)
return foundNode;}}
return null;}
return null;}
Tree.findChildren=function(list,parentNode)
{if(list==null)
return false;for(var i=0;i<list.length;i++){var obj=list[i];var oid=parentNode.getOid();if(parentNode.isParent(list[i])==true){parentNode.appendChild(obj);list.splice(i,1);i--;}}
for(var j=0;j<parentNode._children.length;j++){Tree.findChildren(list,parentNode._children[j]);}
return true;}
Tree.flatten=function(tree,list)
{if(tree!=null)
{if(tree.__left!=null){Tree.flatten(tree.__left,list);tree.__left=null;}
list[list.length]=tree;if(tree.__right!=null){Tree.flatten(tree.__right,list);tree.__right=null;}}}
Tree.remove=function(tree_type,node,itemOid)
{if(tree_type==Tree.TREE)
{if(node._children!=null)
{for(var i=0;i<node._children.length;i++)
{var childNode=node._children[i]
if(childNode.isEqual(itemOid)){node._children=arrayUtils.del(node._children,i);return childNode;}
else
Tree.remove(tree_type,childNode,itemOid);}}
return null;}}
Tree.sort=function(list,sortfunc)
{var top=null;var left_most_branch=null;var right_most_branch=null;var result=0;if(list==null||list.length==0)
return new Array(0);top=list[0];top.__left=null;top.__right=null;left_most_branch=top;right_most_branch=top;for(var i=1;i<list.length;i++){var ptr=top;var item=list[i];result=sortfunc(item,left_most_branch);if(result<=0){left_most_branch.__left=item;item.__left=null;item.__right=null;left_most_branch=item;continue;}
result=sortfunc(item,right_most_branch);if(result>0){right_most_branch.__right=item;item.__left=null;item.__right=null;right_most_branch=item;continue;}
while(true){result=sortfunc(item,ptr);if(result<=0){if(ptr.__left==null){ptr.__left=item;item.__left=null;item.__right=null;break;}
else
ptr=ptr.__left;}
else{if(ptr.__right==null){ptr.__right=item;item.__left=null;item.__right=null;break;}
else
ptr=ptr.__right;}}}
sorted_list=new Array();Tree.flatten(top,sorted_list);return sorted_list;}
Tree.traverse=function(tree_type,node,func,data)
{if(tree_type==Tree.TREE)
{func(node,data);if(node._children!=null)
{for(var i=0;i<node._children.length;i++)
{var childNode=node._children[i]
Tree.traverse(tree_type,childNode,func,data);}}
return null;}
return null;}
var UFO={req:["movie","width","height","majorversion","build"],opt:["play","loop","menu","quality","scale","salign","wmode","bgcolor","base","flashvars","devicefont","allowscriptaccess","seamlesstabbing","allowfullscreen","allownetworking"],optAtt:["id","name","align"],optExc:["swliveconnect"],ximovie:"ufo.swf",xiwidth:"400",xiheight:"260",ua:navigator.userAgent.toLowerCase(),pluginType:"",fv:[0,0],foList:[],create:function(FO,id){if(!UFO.uaHas("w3cdom")||UFO.uaHas("ieMac"))return;UFO.getFlashVersion();UFO.foList[id]=UFO.updateFO(FO);UFO.createCSS("#"+id,"visibility:hidden;");UFO.domLoad(id);},updateFO:function(FO){if(typeof FO.xi!="undefined"&&FO.xi=="true"){if(typeof FO.ximovie=="undefined")FO.ximovie=UFO.ximovie;if(typeof FO.xiwidth=="undefined")FO.xiwidth=UFO.xiwidth;if(typeof FO.xiheight=="undefined")FO.xiheight=UFO.xiheight;}
FO.mainCalled=false;return FO;},domLoad:function(id){var _t=setInterval(function(){if((document.getElementsByTagName("body")[0]!=null||document.body!=null)&&document.getElementById(id)!=null){UFO.main(id);clearInterval(_t);}},250);if(typeof document.addEventListener!="undefined"){document.addEventListener("DOMContentLoaded",function(){UFO.main(id);clearInterval(_t);},null);}},main:function(id){var _fo=UFO.foList[id];if(_fo.mainCalled)return;UFO.foList[id].mainCalled=true;document.getElementById(id).style.visibility="hidden";if(UFO.hasRequired(id)){if(UFO.hasFlashVersion(parseInt(_fo.majorversion,10),parseInt(_fo.build,10))){if(typeof _fo.setcontainercss!="undefined"&&_fo.setcontainercss=="true")UFO.setContainerCSS(id);UFO.writeSWF(id);}
else if(_fo.xi=="true"&&UFO.hasFlashVersion(6,65)){UFO.createDialog(id);}}
document.getElementById(id).style.visibility="visible";},createCSS:function(selector,declaration){var _h=document.getElementsByTagName("head")[0];var _s=UFO.createElement("style");if(!UFO.uaHas("ieWin"))_s.appendChild(document.createTextNode(selector+" {"+declaration+"}"));_s.setAttribute("type","text/css");_s.setAttribute("media","screen");_h.appendChild(_s);if(UFO.uaHas("ieWin")&&document.styleSheets&&document.styleSheets.length>0){var _ls=document.styleSheets[document.styleSheets.length-1];if(typeof _ls.addRule=="object")_ls.addRule(selector,declaration);}},setContainerCSS:function(id){var _fo=UFO.foList[id];var _w=/%/.test(_fo.width)?"":"px";var _h=/%/.test(_fo.height)?"":"px";UFO.createCSS("#"+id,"width:"+_fo.width+_w+"; height:"+_fo.height+_h+";");if(_fo.width=="100%"){UFO.createCSS("body","margin-left:0; margin-right:0; padding-left:0; padding-right:0;");}
if(_fo.height=="100%"){UFO.createCSS("html","height:100%; overflow:hidden;");UFO.createCSS("body","margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");}},createElement:function(el){return(UFO.uaHas("xml")&&typeof document.createElementNS!="undefined")?document.createElementNS("http://www.w3.org/1999/xhtml",el):document.createElement(el);},createObjParam:function(el,aName,aValue){var _p=UFO.createElement("param");_p.setAttribute("name",aName);_p.setAttribute("value",aValue);el.appendChild(_p);},uaHas:function(ft){var _u=UFO.ua;switch(ft){case"w3cdom":return(typeof document.getElementById!="undefined"&&typeof document.getElementsByTagName!="undefined"&&(typeof document.createElement!="undefined"||typeof document.createElementNS!="undefined"));case"xml":var _m=document.getElementsByTagName("meta");var _l=_m.length;for(var i=0;i<_l;i++){if(/content-type/i.test(_m[i].getAttribute("http-equiv"))&&/xml/i.test(_m[i].getAttribute("content")))return true;}
return false;case"ieMac":return/msie/.test(_u)&&!/opera/.test(_u)&&/mac/.test(_u);case"ieWin":return/msie/.test(_u)&&!/opera/.test(_u)&&/win/.test(_u);case"gecko":return/gecko/.test(_u)&&!/applewebkit/.test(_u);case"opera":return/opera/.test(_u);case"safari":return/applewebkit/.test(_u);default:return false;}},getFlashVersion:function(){if(UFO.fv[0]!=0)return;if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){UFO.pluginType="npapi";var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;UFO.fv=[_m,_r];}}
else if(window.ActiveXObject){UFO.pluginType="ax";try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");UFO.fv=[6,0];_a.AllowScriptAccess="always";}
catch(e){if(UFO.fv[0]==6)return;}
try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}
if(typeof _a=="object"){var _d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");UFO.fv=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}},hasRequired:function(id){var _l=UFO.req.length;for(var i=0;i<_l;i++){if(typeof UFO.foList[id][UFO.req[i]]=="undefined")return false;}
return true;},hasFlashVersion:function(major,release){return(UFO.fv[0]>major||(UFO.fv[0]==major&&UFO.fv[1]>=release))?true:false;},writeSWF:function(id){var _fo=UFO.foList[id];var _e=document.getElementById(id);if(UFO.pluginType=="npapi"){if(UFO.uaHas("gecko")||UFO.uaHas("xml")){while(_e.hasChildNodes()){_e.removeChild(_e.firstChild);}
var _obj=UFO.createElement("object");_obj.setAttribute("type","application/x-shockwave-flash");_obj.setAttribute("data",_fo.movie);_obj.setAttribute("width",_fo.width);_obj.setAttribute("height",_fo.height);var _l=UFO.optAtt.length;for(var i=0;i<_l;i++){if(typeof _fo[UFO.optAtt[i]]!="undefined")_obj.setAttribute(UFO.optAtt[i],_fo[UFO.optAtt[i]]);}
var _o=UFO.opt.concat(UFO.optExc);var _l=_o.length;for(var i=0;i<_l;i++){if(typeof _fo[_o[i]]!="undefined")UFO.createObjParam(_obj,_o[i],_fo[_o[i]]);}
_e.appendChild(_obj);}
else{var _emb="";var _o=UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);var _l=_o.length;for(var i=0;i<_l;i++){if(typeof _fo[_o[i]]!="undefined")_emb+=' '+_o[i]+'="'+_fo[_o[i]]+'"';}
_e.innerHTML='<embed type="application/x-shockwave-flash" src="'+_fo.movie+'" width="'+_fo.width+'" height="'+_fo.height+'" pluginspage="http://www.macromedia.com/go/getflashplayer"'+_emb+'></embed>';}}
else if(UFO.pluginType=="ax"){var _objAtt="";var _l=UFO.optAtt.length;for(var i=0;i<_l;i++){if(typeof _fo[UFO.optAtt[i]]!="undefined")_objAtt+=' '+UFO.optAtt[i]+'="'+_fo[UFO.optAtt[i]]+'"';}
var _objPar="";var _l=UFO.opt.length;for(var i=0;i<_l;i++){if(typeof _fo[UFO.opt[i]]!="undefined")_objPar+='<param name="'+UFO.opt[i]+'" value="'+_fo[UFO.opt[i]]+'" />';}
var _p=window.location.protocol=="https:"?"https:":"http:";_e.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+_objAtt+' width="'+_fo.width+'" height="'+_fo.height+'" codebase="'+_p+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+_fo.majorversion+',0,'+_fo.build+',0"><param name="movie" value="'+_fo.movie+'" />'+_objPar+'</object>';}},createDialog:function(id){var _fo=UFO.foList[id];UFO.createCSS("html","height:100%; overflow:hidden;");UFO.createCSS("body","height:100%; overflow:hidden;");UFO.createCSS("#xi-con","position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");UFO.createCSS("#xi-dia","position:absolute; left:50%; top:50%; margin-left: -"+Math.round(parseInt(_fo.xiwidth,10)/2)+"px; margin-top: -"+Math.round(parseInt(_fo.xiheight,10)/2)+"px; width:"+_fo.xiwidth+"px; height:"+_fo.xiheight+"px;");var _b=document.getElementsByTagName("body")[0];var _c=UFO.createElement("div");_c.setAttribute("id","xi-con");var _d=UFO.createElement("div");_d.setAttribute("id","xi-dia");_c.appendChild(_d);_b.appendChild(_c);var _mmu=window.location;if(UFO.uaHas("xml")&&UFO.uaHas("safari")){var _mmd=document.getElementsByTagName("title")[0].firstChild.nodeValue=document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0,47)+" - Flash Player Installation";}
else{var _mmd=document.title=document.title.slice(0,47)+" - Flash Player Installation";}
var _mmp=UFO.pluginType=="ax"?"ActiveX":"PlugIn";var _uc=typeof _fo.xiurlcancel!="undefined"?"&xiUrlCancel="+_fo.xiurlcancel:"";var _uf=typeof _fo.xiurlfailed!="undefined"?"&xiUrlFailed="+_fo.xiurlfailed:"";UFO.foList["xi-dia"]={movie:_fo.ximovie,width:_fo.xiwidth,height:_fo.xiheight,majorversion:"6",build:"65",scale:"noborder",flashvars:"MMredirectURL="+_mmu+"&MMplayerType="+_mmp+"&MMdoctitle="+_mmd+_uc+_uf};UFO.writeSWF("xi-dia");},expressInstallCallback:function(){var _b=document.getElementsByTagName("body")[0];var _c=document.getElementById("xi-con");_b.removeChild(_c);UFO.createCSS("body","height:auto; overflow:auto;");UFO.createCSS("html","height:auto; overflow:auto;");},cleanupIELeaks:function(){var _o=document.getElementsByTagName("object");var _l=_o.length
for(var i=0;i<_l;i++){_o[i].style.display="none";for(var x in _o[i]){if(typeof _o[i][x]=="function"){_o[i][x]=null;}}}}};if(typeof window.attachEvent!="undefined"&&UFO.uaHas("ieWin")){window.attachEvent("onunload",UFO.cleanupIELeaks);}
var DAYTABLE=new Array("Sun ","Mon ","Tue ","Wed ","Thu ","Fri ","Sat ");var MONTHTABLE=new Array("Jan ","Feb ","Mar ","Apr ","May ","Jun ","Jul ","Aug ","Sep ","Oct ","Nov ","Dec ");var util={urlToString:function(val)
{var str=decodeURIComponent(val);return str;},dateToString:function(d)
{var s='';switch(d.getMonth()){case 0:s+='Jan';break;case 1:s+='Feb';break;case 2:s+='Mar';break;case 3:s+='Apr';break;case 4:s+='May';break;case 5:s+='Jun';break;case 6:s+='Jul';break;case 7:s+='Aug';break;case 8:s+='Sep';break;case 9:s+='Oct';break;case 10:s+='Nov';break;case 11:s+='Dec';break;}
s+=' '+d.getDate()+', '+d.getFullYear();return s;},isWhitespace:function(c){return(c==' '||c=='\t'||c=='\n'||c=='\r'||c=='\f'||c=='\v');},isEmpty:function(s){for(var i=0;i<s.length;i++){var c=s.charAt(i);if(!this.isWhitespace(c))return false;}
return true;},formatDate:function(dt)
{var str;var hr=dt.getHours();var hm=(hr<12)?" AM":" PM";if(hr>12)
hr-=12;else if(hr==0)
hr=12;var min=dt.getMinutes();var strmin=(min<10)?"0"+min:min;str=DAYTABLE[dt.getDay()]+MONTHTABLE[dt.getMonth()]+dt.getDate()+" "+dt.getFullYear()+" ";str+=hr+":"+strmin+hm;return str;},escapeHtmlString:function(val)
{var str=val.replace(/&/g,"&amp;");str=str.replace(/</g,"&lt;");str=str.replace(/>/g,"&gt;");return str;},titleFromUrl:function(url)
{var durl=decodeURI(url);var prefix=durl.lastIndexOf("/");var suffix=durl.lastIndexOf(".");if(prefix==-1)
return(suffix==-1)?durl:url.substring(0,suffix);else
return(suffix==-1)?durl.substr(prefix+1):durl.substring(prefix+1,suffix);},validEmailAddress:function(addr)
{if(addr==null||addr=="")
return false;if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(addr))
return true;else
return false;},validEmailAddress2:function(emailStr)
{var checkTLD=1;var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s"+specialChars+"\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom=validChars+'+';var word="("+atom+"|"+quotedUser+")";var userPat=new RegExp("^"+word+"(\\."+word+")*$");var domainPat=new RegExp("^"+atom+"(\\."+atom+")*$");var matchArray=emailStr.match(emailPat);if(matchArray==null){return"Email address seems incorrect (check @ and .'s)";}
var user=matchArray[1];var domain=matchArray[2];for(i=0;i<user.length;i++){if(user.charCodeAt(i)>127)
return"Ths username contains invalid characters.";}
for(i=0;i<domain.length;i++){if(domain.charCodeAt(i)>127)
return"Ths domain name contains invalid characters.";}
if(user.match(userPat)==null)
return"The username doesn't seem to be valid.";var IPArray=domain.match(ipDomainPat);if(IPArray!=null){for(var i=1;i<=4;i++){if(IPArray[i]>255)
return"Destination IP address is invalid!";}
return null;}
var atomPat=new RegExp("^"+atom+"$");var domArr=domain.split(".");var len=domArr.length;for(i=0;i<len;i++){if(domArr[i].search(atomPat)==-1)
return"The domain name does not seem to be valid.";}
if(checkTLD&&domArr[domArr.length-1].length!=2&&domArr[domArr.length-1].search(knownDomsPat)==-1){return"The address must end in a well-known domain or two letter "+"country.";}
if(len<2)
return"This address is missing a hostname!";return null;},navigate:function(url)
{window.location.href=url;},openWindow:function(url)
{window.open(url);},openEditorCreatenSend:function()
{var url="editor.jsp?userOid=2&groupOid=1&topicOid=1&rw=true&new=true&title=My%20first%20page";var features="resizable,scrollbars,width=700,height=770";window.open(url,"",features);},openFeedback:function()
{var url="feedbackForm.jsp?url="+location.href+"&title="+document.title;var params="height=450,width=600";window.open(url,"feedbackWin",params);},openDemoVideo:function()
{window.open("demoVideo.jsp","demoVideo","height=600,width=800,resizable");},openWarning:function(urlt)
{var url=urlt;var params="height=400,width=400,resizable";window.open(url,"warning",params);},createPngHtml:function(id,src,alt,h,w)
{if(dhtmlapi.isIE==true&&dhtmlapi.version<7)
{str='<span id="'+id+'" style="display:inline-block; height:'+h+'px; width:'+w+'px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+
src+'\', sizingMethod=\'scale\');"></span>';}
else{str='<img id="'+id+'" src="'+src+'" alt="'+alt+'" height='+h+' width='+w+'>';}
return str;},createPngElement:function(src,alt,h,w)
{if(dhtmlapi.isIE==true&&dhtmlapi.version<7)
{elem=document.createElement("span");elem.style.display="inline-block";elem.style.height=h+'px';elem.style.width=w+'px';elem.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')";elem.title=(alt!=null)?alt:"";}
else{elem=document.createElement("img");elem.setAttribute("src",src);elem.title=elem.alt=(alt!=null)?alt:"";elem.height=h;elem.width=w;}
return elem;},setPngImage:function(elem,src)
{if(elem.tagName.toLowerCase()=="span")
elem.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
src+"', sizingMethod='scale')";else
elem.src=src;},decodeAndDecrypt:function(val)
{var url='userOid=2&groupOid=1&topicOid=1&location=sandbox1&rw=true&new=true&title=My%20first%20page';return url;}};var NodeTypeEnum={NODE_ELEMENT:1,NODE_ATTRIBUTE:2,NODE_TEXT:3,NODE_CDATA_SECTION:4,NODE_ENTITY_REFERENCE:5,NODE_ENTITY:6,NODE_PROCESSING_INSTRUCTION:7,NODE_COMMENT:8,NODE_DOCUMENT:9,NODE_DOCUMENT_TYPE:10,NODE_DOCUMENT_FRAGMENT:11,NODE_NOTATION:12};var xmlutils={dom:null,initialize:function(){xmlutils.dom=xmlutils.getXMLDocument();},getXMLDocument:function(){var result=null;if(dhtmlapi.isIE){return new ActiveXObject("Microsoft.XMLDOM");}else if(dhtmlapi.isGecko){return document.implementation.createDocument("","",null);}},loadXml:function(xmldoc,xml){if(dhtmlapi.isIE){xmldoc.loadXML(xml);}else if(dhtmlapi.isGecko){var parser=new DOMParser();var doc=parser.parseFromString(xml,"text/xml");xmlutils.removeChildren(xmldoc);for(var i=0,len=doc.childNodes.length;i<len;i++)
{var importedNode=xmldoc.importNode(doc.childNodes.item(i),true);xmldoc.appendChild(importedNode);}}},getChildNode:function(node,nodeName,create){var result=null;if(dhtmlapi.isIE){result=node.selectSingleNode(nodeName);}else if(dhtmlapi.isGecko){var child=node.childNodes.item(0);while(child!=null){if(child.nodeName==nodeName){result=child;break;}
child=child.nextSibling;}}
if(result==null&&create){result=xmlutils.dom.createElement(nodeName);node.appendChild(result);}
return result;},getNodeText:function(node){var result="";var type=node.nodeType;if(type==NodeTypeEnum.NODE_TEXT||type==NodeTypeEnum.NODE_CDATA_SECTION){result+=node.nodeValue;}else if(type==NodeTypeEnum.NODE_ELEMENT){var child=node.childNodes.item(0);while(child!=null){result+=xmlutils.getNodeText(child);child=child.nextSibling;}}
return result;},getElementText:function(node,nodeName){var elem=xmlutils.getChildNode(node,nodeName);if(elem!=null)
return xmlutils.getNodeText(elem);else
return null;},setNodeText:function(node,text){xmlutils.removeChildren(node);node.appendChild(xmlutils.dom.createTextNode(text));},getNodeXML:function(node){if(dhtmlapi.isIE){return node.xml;}else if(dhtmlapi.isGecko){var objXMLSerializer=new XMLSerializer();return objXMLSerializer.serializeToString(node);}},createTextElement:function(nodeName,text){var node=xmlutils.dom.createElement(nodeName);xmlutils.setNodeText(node,text);return node;},prependChild:function(node,child){if(node.childNodes.length){node.insertBefore(child,node.childNodes.item(0));}else{node.appendChild(child);}},removeChildren:function(node){var child=node.childNodes.item(0);while(child!=null){var tmp=child.nextSibling;node.removeChild(child);child=tmp;}},selectSingleNode:function(node,nodeName,namespacePrefix){if(namespacePrefix==null){var nodes=node.getElementsByTagName(nodeName);return(nodes.length>0?nodes[0]:null);}else if(dhtmlapi.isIE){var nodes=node.getElementsByTagName(namespacePrefix+":"+nodeName);return(nodes.length>0?nodes[0]:null);}else if(dhtmlapi.isGecko){var nodes=node.getElementsByTagName(nodeName);if(nodes.length>0){var actualNodeName=namespacePrefix+":"+nodeName;for(var i=0,len=nodes.length;i<len;i++){var result=nodes[i];if(result.nodeName==actualNodeName)
return result;}}}
return null;},trim:function(value){var re=/\s*((\S+\s*)*)/;var le=/((\S+)*)\s*/;var trimR=value.replace(re,"$1");return trimR.replace(le,"$1");},encodeUTF:function(str,escapeURI)
{if(str==null)
return null;var escapedString="";var cc=0;for(var i=0;i<str.length;i++){cc=str.charCodeAt(i);if(cc<=127){if(escapeURI!=null&&cc==38)
escapedString+='&#38;'
else
escapedString+=str.charAt(i);}
else{escapedString+="&#"+cc+";";}}
return escapedString;}};ZIndex.BOTTOM_FIRST=0;ZIndex.BOTTOM_LAST=1023;ZIndex.WIDGET_FIRST=1024;ZIndex.WIDGET_LAST=60000;ZIndex.TOP_FIRST=60001;ZIndex.TOP_LAST=65535;ZIndex.PROGRESS_BAR=65520;ZIndex.MODAL_ALERT=65510;ZIndex.MODELESS_ALERT=65500;ZIndex.RIGHT_MENU=65495;ZIndex.WIDGET_FRAME=65490;ZIndex.MEDIA_EDIT=65490;ZIndex.IMAGE_MAGNIFY=65485;ZIndex.CHAT_EDIT=65480;ZIndex.TEXT_EDIT_PALETTE=65475;ZIndex.TEXT_EDIT=65470;ZIndex.CHAT_EXPANDED=65460;ZIndex.IMAGE_TOOLBAR=65450;ZIndex.EDITOR_TOOLBAR=65445;ZIndex.BACKGROUND=20;ZIndex.OPTOP=1;ZIndex.OPBOTTOM=2;ZIndex.OPFORWARD=3;ZIndex.OPBACKWARD=4;function ZIndex(top,bottom,forward,backward)
{this._top=top;this._bottom=bottom;this._forward=forward;this._backward=backward;}
ZIndex.createInstance=function(top,bottom,forward,backward)
{var zid=new ZIndex(top,bottom,forward,backward);return zid;}
Toolbar.toolbars=null;Toolbar.HORIZONTAL=parseInt("0x01");Toolbar.VERTICAL=parseInt("0x02");Toolbar.prototype._buttons;Toolbar.prototype._locations;Toolbar.prototype._name;Toolbar.prototype._container;Toolbar.prototype._orientation;Toolbar.prototype._table;Toolbar.prototype._defaultButton;Toolbar.prototype._listeners;Toolbar.prototype._padding;Toolbar.prototype._spacing;Toolbar.prototype._highlight;function Toolbar(name,container,height,width)
{this.initialize(name,container,height,width);}
Toolbar.removeInstance=function(tb)
{var name=tb._name;for(var i in Toolbar.toolbars)
{var ptr=Toolbar.toolbars[i];if(ptr._name==name){delete Toolbar.toolbars[i];return true;}}
return false;}
Toolbar.getToolbar=function(name)
{if(Toolbar.toolbars==null)
return null;var val=name;if(typeof name!="string"){var elem=name;while(elem!=null){if(elem.className=="toolbar"){val=elem.id;break;}
elem=elem.parentNode;}}
for(var i in Toolbar.toolbars)
{var tb=Toolbar.toolbars[i];if(tb._name==val)
return tb;}
return null;}
Toolbar.noop=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var typ=evt.type;evt.cancelBubble=true;}
Toolbar.handleMouseOver=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);if(target.className=="btnContainer")
target=target.firstChild;var tb=Toolbar.getToolbar(target);if(tb!=null&&tb._highlight==true)
tb.highlightButton(target);evt.cancelBubble=true;}
Toolbar.handleMouseOut=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);if(target.className=="btnContainer")
target=target.firstChild;var tb=Toolbar.getToolbar(target);if(tb!=null&&tb._highlight==true)
tb.unhighlightButton(target);evt.cancelBubble=true;}
Toolbar.handleMouseDown=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);if(target.className=="btnContainer")
target=target.firstChild;var tb=Toolbar.getToolbar(target);if(tb!=null)
tb.preselect(target);evt.cancelBubble=true;}
Toolbar.handleMouseUp=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);if(target.className=="btnContainer")
target=target.firstChild;var tb=Toolbar.getToolbar(target);if(tb!=null)
tb.processButton(target,evt.clientX,evt.clientY);evt.cancelBubble=true;}
Toolbar.handleDragStart=function(e)
{var evt=EventUtils.getEvent(e);evt.cancelBubble=true;return false;}
Toolbar.prototype.initialize=function(name,container,height,width)
{if(Toolbar.toolbars==null)
Toolbar.toolbars=new Object();this._name=name;this._container=container;this._orientation=Toolbar.HORIZONTAL;this._buttons=new Array();this._locations=new Array();this._defaultButton=null;this._listeners=new Array();this._padding=2;this._spacing=2;this._highlight=true;if(container==null)
return;var elem=document.createElement("div");elem.className="toolbar";elem.id=name;if(height!=null)
elem.style.height=height+'px';if(width!=null)
elem.style.width=width+'px';elem.onmouseup=Toolbar.noop;elem.onmousedown=Toolbar.noop;elem.onmousemove=Toolbar.noop;elem.ondragenter=Toolbar.disableDnD;elem.ondragover=Toolbar.disableDnD;this._container.appendChild(elem);this._table=elem;if(name!=null)
Toolbar.toolbars[this._name]=this;}
Toolbar.disableDnD=function(e){event.returnValue=false;}
Toolbar.prototype.addEventHandlers=function(obj)
{if(obj==null)
return false;obj.onmouseover=Toolbar.handleMouseOver;obj.onmouseout=Toolbar.handleMouseOut;obj.onmouseup=Toolbar.handleMouseUp;obj.onmousedown=Toolbar.handleMouseDown;obj.ondblclick=Toolbar.handleMouseDown;obj.ondragstart=Toolbar.handleDragStart;return true;}
Toolbar.prototype.add=function(btn)
{this.addX(btn,true);}
Toolbar.prototype.addRight=function(btn)
{this.addX(btn,false);}
Toolbar.prototype.addX=function(btn,left)
{var elem=btn.getElement();var container=btn.getContainer();var xcoord=0;var ycoord=0;var obj=null;if(this._orientation==Toolbar.VERTICAL){xcoord=this._padding;if(this._buttons.length==0){ycoord=this._spacing;}
else{obj=this._buttons[this._buttons.length-1].getContainer();ycoord=dhtmlapi.getObjectTop(obj)+dhtmlapi.getObjectHeight(obj)+this._spacing;}}
else{ycoord=this._padding;xcoord=this.getButtonLocation(left);if(left)
this.moveRightButtons(dhtmlapi.getObjectWidth(container)+this._spacing);}
container.style.position="absolute";container.style.top=ycoord+"px";container.style.left=xcoord+"px";if(btn.isActive()==true)
this.addEventHandlers(container);this._table.appendChild(container);this._buttons[this._buttons.length]=btn;this._locations[this._locations.length]=left;}
Toolbar.prototype.getButtonLocation=function(left)
{var xcoord;var obj;var btnLeft;var btnRight;btnLeft=this.getLastButton(true);btnRight=this.getLastButton(false);if(left){if(btnLeft!=null){obj=btnLeft.getContainer();xcoord=dhtmlapi.getObjectLeft(obj)+dhtmlapi.getObjectWidth(obj)+this._spacing;}
else{xcoord=this._spacing;}}
else{if(btnRight!=null){obj=btnRight.getContainer();xcoord=dhtmlapi.getObjectLeft(obj)+dhtmlapi.getObjectWidth(obj)+this._spacing;}
else{if(btnLeft!=null){obj=btnLeft.getContainer();xcoord=dhtmlapi.getObjectLeft(obj)+dhtmlapi.getObjectWidth(obj)+this._spacing;}
else{xcoord=this._spacing;}}}
return xcoord;}
Toolbar.prototype.clearButton=function(name)
{var btn=this.getButton(name);this.unselectButton(btn);}
Toolbar.prototype.setButton=function(name)
{var btn=this.getButton(name);this.selectButton(btn);}
Toolbar.prototype.getButtonById=function(elem)
{return this.getButton(elem.id.substr(4));}
Toolbar.prototype.getButton=function(name)
{for(var i=0;i<this._buttons.length;i++)
{if(this._buttons[i]._name==name)
return this._buttons[i];}
return null;}
Toolbar.prototype.getDefaultButton=function()
{return this._defaultButton;}
Toolbar.prototype.getSelectedButton=function()
{return this._selected;}
Toolbar.prototype.getMinimumWidth=function()
{var width=0;for(var i=0;i<this._buttons.length;i++)
{var obj=this._buttons[i].getContainer();width+=dhtmlapi.getObjectWidth(obj)+this._spacing;}
return width;}
Toolbar.prototype.getMinimumHeight=function()
{var height=0;for(var i=0;i<this._buttons.length;i++)
{var obj=this._buttons[i].getContainer();var cur=dhtmlapi.getObjectHeight(obj)+(this._padding*2);if(cur>height)
height=cur;}
return height;}
Toolbar.prototype.getLastButton=function(left)
{var btn=null;for(var i=0;i<this._buttons.length;i++)
{if(this._locations[i]==left)
btn=this._buttons[i];}
return btn;}
Toolbar.prototype.moveRightButtons=function(deltax)
{for(var i=0;i<this._buttons.length;i++)
{if(this._locations[i]==false){var container=this._buttons[i].getContainer();var oldx=dhtmlapi.getObjectLeft(container);var newx=oldx+deltax;container.style.left=newx+"px";}}}
Toolbar.prototype.getSelectedOperations=function()
{var list=new Array(0);var btn=null;for(var i=0;i<this._buttons.length;i++)
{btn=this._buttons[i];if(btn.isSelected())
list[list.length]=btn.getOperation();}
return list;}
Toolbar.prototype.highlightButton=function(elem)
{var btn=this.getButtonById(elem);var btnType=btn.getType();if(btnType==Button.BUTTON||btnType==Button.TOGGLE_BUTTON||btnType==Button.RADIO_BUTTON||btnType==Button.SELECTION_BUTTON)
{if(!btn.isEnabled()){elem.style.cursor="pointer";}
else if(btn.isSelected())
{}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="1px";elem.style.borderStyle="outset";elem.style.cursor="pointer";}}}
Toolbar.prototype.preselect=function(elem)
{var btn=this.getButtonById(elem);var btnType=btn.getType();var pressedImage=btn.getPressedImage();if(!btn.isEnabled())return;if(btnType==Button.BUTTON){if(pressedImage!=null){util.setPngImage(elem,pressedImage);}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="1px";elem.style.borderStyle="inset";elem.style.cursor="pointer";}}}
Toolbar.prototype.processButton=function(elem,clientX,clientY)
{var btn=this.getButtonById(elem);var btnType=btn.getType();var state="select";var pressedImage=btn.getPressedImage();if((btn==null)||(!btn.isEnabled()))return;if(btnType==Button.TOGGLE_BUTTON){if(btn.isSelected()){state="unselect";this.unselectButton(btn);}
else{this.selectButton(btn);}}
else if(btnType==Button.RADIO_BUTTON){for(var i=0;i<this._buttons.length;i++){var b=this._buttons[i];if(b.getType()==Button.RADIO_BUTTON&&b.isSelected()){this.unselectButton(b);}}
this.selectButton(btn);}
else{if(pressedImage!=null){util.setPngImage(elem,btn.getUnpressedImage());}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="0px";elem.style.borderStyle="none";elem.style.cursor="pointer";}}
if(elem.style.visibility=='hidden')
return;var btnObject=btn.getObject();if(btnObject!=null){btnObject.create(this,btn,this._container,clientX,clientY);}
else{for(var i=0;i<this._listeners.length;i++){var obj=this._listeners[i];obj.toolbarCB(this._name,state,btn.getOperation(),null,clientX,clientY);}}}
Toolbar.prototype.setOrientation=function(val)
{this._orientation=val;}
Toolbar.prototype.unregisterCallback=function(obj)
{if(obj!=null){;}
else{this._listeners=new Array(0);}}
Toolbar.prototype.registerCallback=function(obj)
{this._listeners[this._listeners.length]=obj;}
Toolbar.prototype.selectButtonCB=function(btn,state,value)
{for(var i=0;i<this._listeners.length;i++){var obj=this._listeners[i];obj.toolbarCB(this._name,state,btn.getOperation(),value);}
btn._object.destroy();}
Toolbar.prototype.selectDefaultButton=function()
{var elem=null;var defaultBtn=this.getDefaultButton();if(defaultBtn==null)
return;for(var i=0;i<this._buttons.length;i++){var b=this._buttons[i];if(b.getType()==Button.RADIO_BUTTON&&b.isSelected()){this.unselectButton(b);}}
this.processButton(defaultBtn.getElement());}
Toolbar.prototype.setDefaultButton=function(name)
{var button=this.getButton(name);if(button!=null)
this._defaultButton=button;}
Toolbar.prototype.setHighlight=function(val)
{if(val==false||val=="false")
this._highlight=false;else
this._highlight=true;}
Toolbar.prototype.setOpacity=function(fp)
{try{var x=parseFloat(fp);this._table.style.opacity=x;}
catch(e){;}}
Toolbar.prototype.setPadding=function(v)
{this._padding=v;}
Toolbar.prototype.setSpacing=function(v)
{this._spacing=v;}
Toolbar.prototype.getContainer=function()
{return this._container;}
Toolbar.prototype.unhighlightButton=function(elem)
{var btn=this.getButtonById(elem);var btnType=btn.getType();if(btnType==Button.VERTICAL_BAR)
return;if(!btn.isEnabled()){elem.style.cursor="pointer";}
else if(btn.isSelected())
{}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="0px";elem.style.borderStyle="none";elem.style.cursor="pointer";}}
Toolbar.prototype.selectButton=function(btn)
{if(btn==null)
return;if(!btn.isEnabled())return;var elem=btn.getElement();var pressedImage=btn.getPressedImage();var pressedSprite=btn.getPressedSprite();if(pressedImage!=null){util.setPngImage(elem,pressedImage);}
else if(pressedSprite!=null){elem.style.backgroundImage="url("+pressedSprite+")";elem.style.backgroundPosition=btn.getPressedSpriteOffset();}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="1px";elem.style.borderStyle="inset";elem.style.cursor="pointer";}
btn.select();}
Toolbar.prototype.unselectButton=function(btn)
{if(btn==null)
return;if(!btn.isEnabled())return;var elem=btn.getElement();var unpressedImage=btn.getUnpressedImage();var unpressedSprite=btn.getUnpressedSprite();if(unpressedImage!=null)
util.setPngImage(elem,unpressedImage);else if(unpressedSprite!=null){elem.style.backgroundImage="url("+unpressedSprite+")";elem.style.backgroundPosition=btn.getUnpressedSpriteOffset();}
else{elem.style.backgroundColor="#D3D3D3";elem.style.borderWidth="0px";elem.style.borderStyle="none";elem.style.cursor="pointer";}
btn.unSelect();}
Toolbar.prototype.hideButton=function(name)
{var btn=this.getButton(name);var elem=btn.getElement();elem.style.visibility="hidden";}
AddButton.prototype._html;function AddButton()
{this._html=null;}
AddButton.prototype.getContainer=function()
{return this._html;}
AddButton.createInstance=function()
{var container=null;var button=new AddButton();container=util.createPngElement('images/homepage/addbuttonnormal.png','',29,31);container.style.cursor='pointer';button._html=container;return button;}
AddButton.prototype.animate=function(normal)
{var srcImg=(normal)?"images/homepage/addbuttonnormal.png":"images/homepage/addbuttonrollover.png";util.setPngImage(this._html,srcImg);}
Button.IMAGE="Image";Button.TEXT="Text";Button.BUTTON=parseInt("0x0001",16);Button.TOGGLE_BUTTON=parseInt("0x0002",16);Button.RADIO_BUTTON=parseInt("0x0004",16);Button.SPACER_BUTTON=parseInt("0x0008",16);Button.VERTICAL_BAR=parseInt("0x0010",16);Button.defaultHeight=20;Button.defaultWidth=20;Button.randomValue=1;Button.prototype._name;Button.prototype._type;Button.prototype._height;Button.prototype._width;Button.prototype._operation;Button.prototype._container;Button.prototype._element;Button.prototype._selected;Button.prototype._object;Button.prototype._unpressedImage;Button.prototype._pressedImage;Button.prototype._disabledImage;Button.prototype._group;Button.prototype._enabled;Button.createButtonContainer=function(name,h,w)
{var c=document.createElement("div");var height=parseInt((h!=null)?h:this.defaultHeight);var width=parseInt((w!=null)?w:this.defaultWidth);c.setAttribute("id",name);c.className="btnContainer";c.style.position="absolute";if(h!=-1)
c.style.height=height+'px';if(w!=-1)
c.style.width=width+'px';return c;}
Button.createText=function(name,type,operation,text,obj,width)
{var w=null;try{w=parseInt(width);if(isNan(w))
w=parseInt(Button.defaultWidth);}
catch(ex){w=parseInt(Button.defaultWidth);}
var c=this.createButtonContainer(name,Button.defaultHeight,w);var elem=document.createElement("span");elem.id="btn_"+name;elem.innerHTML=text;elem.className="normalText";c.appendChild(elem);var b=new Button(name,type,operation,c,elem,obj);return b;}
Button.createImage=function(name,type,operation,src,h,w,alt,obj)
{var c=this.createButtonContainer(name,h,w);var elem=null;var srctype=src.toLowerCase().substr(src.length-3);if(srctype=='png')
elem=util.createPngElement(src,((alt!=null)?alt:''),h,w);else{elem=document.createElement("img");elem.setAttribute("src",src);elem.title=elem.alt=(alt!=null)?alt:"";elem.height=h;elem.width=w;}
elem.ondragenter=Toolbar.disableDnD;elem.ondragover=Toolbar.disableDnD;elem.ondragstart=Toolbar.handleDragStart;elem.onmousedown=Toolbar.handleDragStart;elem.id="btn_"+name;elem.className="btnImage";c.appendChild(elem);var b=new Button(name,type,operation,c,elem,obj);b.setUnPressedImage(src);b._height=h;b._width=w;return b;}
Button.createSprite=function(name,type,operation,src,h,w,ypos,xpos,title)
{var c=this.createButtonContainer(name,h,w);var elem=document.createElement("div");elem.id="btn_"+name;elem.style.height=h+"px";elem.style.width=w+"px";elem.style.cursor='pointer';elem.className="btnSprite";elem.style.backgroundImage="url("+src+")";elem.title=(title!=null)?title:"";var str=xpos+"px "+ypos+"px";elem.style.backgroundPosition=xpos+"px "+ypos+"px";c.appendChild(elem);var b=new Button(name,type,operation,c,elem,null);b._height=h;b._width=w;b.setUnPressedSprite(src,ypos,xpos);return b;}
Button.createObject=function(name,html)
{var c=this.createButtonContainer(name);c.innerHTML=html;}
Button.createOptionList=function(name,list,idx)
{if(list==null||list.length==0)
return;var c=this.createButtonContainer(name);var sel=document.createElement("select");sel.id="btn_"+name;sel.className="btnSelect";for(var i=0;i<list.length;i++){var obj=document.createElement("option");obj.text=list[i].text;obj.value=list[i].value;sel.add(obj);}
c.appendChild(sel);return null;}
Button.createSpacer=function(width,txt)
{var name="spacer"+Button.randomValue++;var c=this.createButtonContainer(name,Button.defaultHeight,width);var w=null;try{w=parseInt(width);}
catch(ex){w=parseInt(30);}
var span=document.createElement("span");span.id="btn_"+name;span.style.width=w+'px';if(txt!=null){span.style.textAlign="center";span.innerHTML=txt;}
c.appendChild(span);var b=new Button(name,Button.SPACER_BUTTON,"noop",c,span,null);return b;}
Button.createVerticalBar=function(height)
{var name="vbar"+Button.randomValue++;var c=this.createButtonContainer(name,height,5);var elem=document.createElement("div");var h=Math.round(height*0.80);elem.id="btn_"+name;elem.className="btnVerticalSeparator";elem.style.position="absolute";elem.style.width='1px';elem.style.height=h+'px';elem.style.top=0;elem.style.left=0;elem.style.backgroundColor="black";c.appendChild(elem);var b=new Button(name,Button.VERTICAL_BAR,"noop",c,elem,null);return b;}
function Button(name,type,operation,container,element,obj)
{this._name=name;this._type=type;this._operation=operation;this._container=container;this._element=element;this._selected=false;this._pressedImage=null;this._unpressedImage=null;this._disabledImage=null;this._group=null;this._enabled=true;if(obj==null||obj==undefined)
this._object=null;else
this._object=obj;}
Button.prototype.getContainer=function()
{return this._container;}
Button.prototype.getElement=function()
{return this._element;}
Button.prototype.getName=function()
{return this._name;}
Button.prototype.getObject=function()
{return this._object;}
Button.prototype.getOperation=function()
{return this._operation;}
Button.prototype.getPressedSprite=function()
{if(this._pressedSpriteSrc!=null)
return this._pressedSpriteSrc;else
return null;}
Button.prototype.getPressedSpriteOffset=function()
{return this._pressedSpriteXpos+"px "+this._pressedSpriteYpos+"px";}
Button.prototype.getPressedImage=function()
{if(this._pressedImage!=null)
return this._pressedImage.src;else
return null;}
Button.prototype.getType=function()
{return this._type;}
Button.prototype.getUnpressedImage=function()
{return this._unpressedImage;}
Button.prototype.getUnpressedSprite=function()
{return this._unpressedSpriteSrc;}
Button.prototype.getDisabledSpriteOffset=function()
{return this._disabledSpriteXpos+"px "+this._disabledSpriteYpos+"px";}
Button.prototype.getUnpressedSpriteOffset=function()
{return this._unpressedSpriteXpos+"px "+this._unpressedSpriteYpos+"px";}
Button.prototype.getDisabledImage=function()
{return this._disabledImage;}
Button.prototype.isActive=function()
{if(this._type==Button.SPACER_BUTTON||this._type==Button.VERTICAL_BAR)
return false;else
return true;}
Button.prototype.isSelected=function()
{return this._selected;}
Button.prototype.isEnabled=function()
{return this._enabled;}
Button.prototype.select=function()
{this._selected=true;}
Button.prototype.setGroupOid=function(grp)
{this._group=grp;}
Button.prototype.setPressedImage=function(pressedImage)
{this._pressedImage=new Image(this._width,this._height);this._pressedImage.src=pressedImage;}
Button.prototype.setUnPressedImage=function(src)
{this._unpressedImage=src;}
Button.prototype.setDisabledImage=function(src)
{this._disabledImage=src;}
Button.prototype.setDisabledSprite=function(src,ypos,xpos)
{this._disabledSpriteSrc=src;this._disabledSpriteXpos=xpos;this._disabledSpriteYpos=ypos;}
Button.prototype.setPressedSprite=function(src,ypos,xpos)
{this._pressedSpriteSrc=src;this._pressedSpriteXpos=xpos;this._pressedSpriteYpos=ypos;}
Button.prototype.setUnPressedSprite=function(src,ypos,xpos)
{this._unpressedSpriteSrc=src;this._unpressedSpriteXpos=xpos;this._unpressedSpriteYpos=ypos;}
Button.prototype.setDisabledSprite=function(src,ypos,xpos)
{this._disabledSpriteSrc=src;this._disabledSpriteXpos=xpos;this._disabledSpriteYpos=ypos;}
Button.prototype.unSelect=function()
{this._selected=false;}
Button.prototype.enable=function(enable)
{if(enable!=this._enabled){this._enabled=enable;if(enable==true){if(this._unpressedImage!=null)
util.setPngImage(this._element,this._unpressedImage);else if(this._unpressedSpriteSrc!=null){this._element.style.backgroundImage="url("+this._unpressedSpriteSrc+")";this._element.style.backgroundPosition=this.getUnpressedSpriteOffset();}
this._element.style.cursor="pointer";}
else{if(this._disabledImage!=null)
util.setPngImage(this._element,this._disabledImage);else if(this._disabledSpriteSrc!=null){this._element.style.backgroundImage="url("+this._disabledSpriteSrc+")";this._element.style.backgroundPosition=this.getDisabledSpriteOffset();}
this._element.style.cursor="default";}}}
FileUpload.object=null;FileUpload.prototype._parentElement=null;FileUpload.prototype._container=null;FileUpload.prototype._iframe=null;FileUpload.prototype._flashdiv=null;FileUpload.prototype._height;FileUpload.prototype._width;FileUpload.prototype._isOpened=false;var flashUpload=null;function FileUpload(parentElement,top,left)
{this._parentElement=parentElement;this._top=parseInt(top);this._left=parseInt(left);}
FileUpload.createInstance=function(parentElement,top,left)
{FileUpload.object=new FileUpload(parentElement,top,left);return FileUpload.object;}
FileUpload.prototype.initialize=function()
{var row;var col;var col2;var rowCounter=0;this._width=425;this._height=200;this._container=document.createElement("div");this._container.style.position="absolute";this._container.style.top=this._top+"px";this._container.style.left=this._left+"px";this._container.style.width=this._width+"px";this._container.style.height=this._height+"px";this._container.style.backgroundColor="#E4EDF2";this._container.style.border='solid black 2px';this._container.style.margin='0px';this._container.style.overflow="hidden";this._container.style.zIndex=ZIndex.PROGRESS_BAR;this._parentElement.appendChild(this._container);this._flashdiv=document.createElement("div");this._flashdiv.id="flashdiv";this._flashdiv.style.height="100%";this._flashdiv.style.width="100%";this._flashdiv.innerHTML="Flash failed loading or is not installed. Please click <a href='failedflashInstallation.html' target='_blank'>here for further instructions.</a>";this._isOpened=true;}
FileUpload.prototype.execute=function(host,context,pathOid,pageOid,objId,pageVersion,maxHeight,maxWidth)
{this._container.appendChild(this._flashdiv);var upload=0;if(groupOid==1)
upload=uploadBuildNShareMax;else
upload=uploadMax;var swfurl="flashUpload.swf?host="+host+"\u0026context="+context+"\u0026pathOid="+pathOid+"\u0026pageOid="+pageOid+"\u0026objId="+objId+"\u0026pageVersion="+pageVersion+"\u0026maxHeight="+maxHeight+"\u0026maxWidth="+maxWidth+"\u0026uploadMax="+upload+"\u0026groupOid="+groupOid+"\u0026uploadMaxRe="+uploadMax;var FO={movie:swfurl,width:"100%",height:"100%",majorversion:"8",build:"0"};UFO.create(FO,"flashdiv");}
FileUpload.prototype.close=function()
{this._flashdiv.innerHTML="";this._container.removeChild(this._flashdiv);this._parentElement.removeChild(this._container);this._isOpened=false;}
var FloatLayers=new Array();var FloatLayersByName=new Array();function addFloatLayer(n,offX,offY,spd){new FloatLayer(n,offX,offY,spd);}
function getFloatLayer(n){return FloatLayersByName[n];}
function alignFloatLayers(){for(var i=0;i<FloatLayers.length;i++)FloatLayers[i].align();}
function getXCoord(el){x=0;while(el){x+=el.offsetLeft;el=el.offsetParent;}
return x;}
function getYCoord(el){y=0;while(el){y+=el.offsetTop;el=el.offsetParent;}
return y;}
FloatLayer.prototype.setFloatToTop=setTopFloater;FloatLayer.prototype.setFloatToBottom=setBottomFloater;FloatLayer.prototype.setFloatToLeft=setLeftFloater;FloatLayer.prototype.setFloatToRight=setRightFloater;FloatLayer.prototype.initialize=defineFloater;FloatLayer.prototype.adjust=adjustFloater;FloatLayer.prototype.align=alignFloater;function FloatLayer(n,offX,offY,spd){this.index=FloatLayers.length;FloatLayers.push(this);FloatLayersByName[n]=this;this.name=n;this.floatX=0;this.floatY=0;this.tm=null;this.steps=spd;this.alignHorizontal=(offX>=0)?leftFloater:rightFloater;this.alignVertical=(offY>=0)?topFloater:bottomFloater;this.ifloatX=Math.abs(offX);this.ifloatY=Math.abs(offY);}
function defineFloater(){this.layer=document.getElementById(this.name);if(this.layer!=null){this.width=this.layer.offsetWidth;this.height=this.layer.offsetHeight;this.prevX=this.layer.offsetLeft;this.prevY=this.layer.offsetTop;}}
function adjustFloater(){this.tm=null;if(this.layer.style.position!='absolute')return;var dx=Math.abs(this.floatX-this.prevX);var dy=Math.abs(this.floatY-this.prevY);if(dx<this.steps/2)
cx=(dx>=1)?1:0;else
cx=Math.round(dx/this.steps);if(dy<this.steps/2)
cy=(dy>=1)?1:0;else
cy=Math.round(dy/this.steps);if(this.floatX>this.prevX)
this.prevX+=cx;else if(this.floatX<this.prevX)
this.prevX-=cx;if(this.floatY>this.prevY)
this.prevY+=cy;else if(this.floatY<this.prevY)
this.prevY-=cy;this.layer.style.left=this.prevX;this.layer.style.top=this.prevY;if(cx!=0||cy!=0){if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',50);}else
alignFloatLayers();}
function setLeftFloater(){this.alignHorizontal=leftFloater;}
function setRightFloater(){this.alignHorizontal=rightFloater;}
function setTopFloater(){this.alignVertical=topFloater;}
function setBottomFloater(){this.alignVertical=bottomFloater;}
function leftFloater(){this.floatX=document.body.scrollLeft+this.ifloatX;}
function topFloater(){this.floatY=document.body.scrollTop+this.ifloatY;}
function rightFloater(){this.floatX=document.body.scrollLeft+document.body.clientWidth-this.ifloatX-this.width;}
function bottomFloater(){this.floatY=document.body.scrollTop+document.body.clientHeight-this.ifloatY-this.height;}
function alignFloater(){if(this.layer==null)this.initialize();this.alignHorizontal();this.alignVertical();if(this.prevX!=this.floatX||this.prevY!=this.floatY){if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',50);}}
List.index=0;List.objects;List.prototype._id;List.prototype._height;List.prototype._width;List.prototype._columns;List.prototype._disabledColumn;List.prototype._data;List.prototype._clientData;List.prototype._clip;List.prototype._table;List.prototype._title;List.prototype._displayTitle;List.prototype._container;function List(columns,clip)
{this._id=List.generateName();this._height=0;this._width=0;this._columns=columns;this._data=null;this._clientData=null;this._clip=clip;this._table=null;this._container=null;this._title=null;this._displayTitle=true;this._disabledColumn=-1;}
List.getList=function(id)
{for(var i=0;i<List.objects.length;i++){if(List.objects[i]._id==id)
return List.objects[i];}
return null;}
List.generateName=function(uniqueId)
{var str="listComponent_"+((uniqueId!=null)?uniqueId:List.index++);return str;}
List.handleClick=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var selectedColumn=-1;var selectedRow=-1;var widgetId=null;for(var elem=target;;elem=elem.parentNode){widgetId=elem.getAttribute('widgetId');if(widgetId!=null){selectedColumn=elem.cellIndex;selectedRow=elem.parentNode.rowIndex;break;}}
var list=List.getList(widgetId);if(list==null)
return;var column=list._columns[selectedColumn];if(column._cbfunc!=null){column._cbfunc(list,selectedRow,list._data[selectedRow],column._cbfuncdata);}
return false;}
List.createInstance=function(columns,clip)
{var l=new List(columns,clip);if(List.objects==null)
List.objects=new Array();List.objects[List.objects.length]=l;return l;}
List.prototype.addRow=function(item)
{var table=this._table;var row=table.insertRow(table.rows.length);this._data[this._data.length]=item;this.createRow(row,this._columns,item);}
List.prototype.deleteRow=function(rowIdx)
{this._table.deleteRow(rowIdx);this._data.splice(rowIdx,1);}
List.prototype.disableColumn=function(idx)
{var row=this._title.rows[0];var col=row.cells[idx];var spn=col.firstChild;spn.innerHTML='&nbsp;';this._disabledColumn=idx;}
List.prototype.displayTitle=function(b)
{this._displayTitle=(b==false)?false:true;}
List.prototype.setData=function(data,userData)
{this._data=data;this._clientData=userData;this.redraw();}
List.prototype.enableColumn=function(idx)
{if(this._disabledColumn==-1)
return;var row=this._title.rows[0];var col=row.cells[this._disabledColumn];var spn=col.firstChild;spn.innerHTML=this._columns[this._disabledColumn]._title;this._disabledColumn=-1;}
List.prototype.toHtml=function(container)
{try{var height=dhtmlapi.getObjectHeight(container);var width=dhtmlapi.getObjectWidth(container);width=(width-15)/width;width=Math.floor(width*100)+"%";if(this._displayTitle==true){this._title=this.createTitleBar(container,width,this._columns);height-=dhtmlapi.getObjectHeight(this._title);}
var subcontainer=document.createElement("div");subcontainer.id="subcontainer";subcontainer.setAttribute('widgetId',this._id);subcontainer.className="listComponentContainer";subcontainer.style.border="solid black 0px";subcontainer.style.width="100%";subcontainer.style.height=(height-15)+'px';subcontainer.style.overflowY="auto";subcontainer.style.overflowX="hidden";this.populate(subcontainer,width,this._columns,this._data);container.appendChild(subcontainer);this._container=subcontainer;}catch(e){alert(e.message);return;}}
List.prototype.updateRow=function(rowIdx,item)
{this._data[rowIdx]=item;this._table.deleteRow(rowIdx);var row=this._table.insertRow(rowIdx);this.createRow(row,this._columns,item);}
List.prototype.createRow=function(row,columns,dataItem)
{var cdata=null;for(var j=0;j<columns.length;j++)
{cdata=columns[j];var col=row.insertCell(j);col.width=columns[j]._width;col.className=columns[j]._class;if(this._disabledColumn==j){var spn=document.createElement("span");spn.innerHTML='&nbsp;';continue;}
var lc=dataItem.getData(columns[j]._id,this._clientData);if(lc._type==ListCell.TYPE_STRING||lc._type==ListCell.TYPE_NUMBER)
{var spn=document.createElement("span");spn.innerHTML=lc._value;if(cdata._cbfunc!=null){spn.style.cursor='pointer';spn.onclick=List.handleClick;col.setAttribute('widgetId',this._id);}
col.appendChild(spn);}else if(lc._type==ListCell.TYPE_IMAGE){var img=document.createElement("img");img.src=lc._value;img.width=lc._width;img.height=lc._height;if(cdata._cbfunc!=null){img.style.cursor='pointer';img.onclick=List.handleClick;col.setAttribute('widgetId',this._id);}
col.appendChild(img);}else if(lc._type==ListCell.TYPE_CONTAINER){var div=document.createElement("div");div.innerHTML=lc._value;div.width=lc._width;div.height=lc._height;if(cdata._cbfunc!=null){div.style.cursor='pointer';div.onclick=List.handleClick;col.setAttribute('widgetId',this._id);}
col.appendChild(div);}else if(lc._type==ListCell.TYPE_BUTTON){var button=document.createElement("button");button.innerHTML=lc._value;button.className=columns[j]._class;if(cdata._cbfunc!=null){button.style.cursor='pointer';button.onclick=List.handleClick;col.setAttribute('widgetId',this._id);}
col.appendChild(button);}}}
List.prototype.createTitleBar=function(container,width,columns)
{if(columns!=null&&columns.length!=null)
{var tbar=document.createElement("table");tbar.id="titleBar";tbar.cellSpacing=0;tbar.cellPadding=0;tbar.border=0;tbar.width=width;tbar.className="listComponentTitleBar";var row=tbar.insertRow(0);for(var i=0;i<columns.length;i++)
{var col=row.insertCell(i);col.width=columns[i]._width;col.className=columns[i]._classHdr;var spn=document.createElement("span");spn.innerHTML=columns[i]._title;spn.noWrap=true;col.appendChild(spn);}
container.appendChild(tbar);return tbar;}}
List.prototype.defineColumns=function(columns)
{var colgroup=document.createElement("colgroup");for(var i=0;i<columns.length;i++)
{var col=document.createElement("col");if(columns[i].width!=null)
col.width=columns[i].width;colgroup.appendChild(col);}
this._table.appendChild(colgroup);}
List.prototype.populate=function(container,width,columns,data)
{this._table=document.createElement("table");this._table.id="list";this._table.className="listComponentList";this._table.border=0;this._table.cellSpacing=0;this._table.cellPadding=0;this._table.width=width;this.defineColumns(columns);container.appendChild(this._table);}
List.prototype.redraw=function()
{if(this._table!=null){while(this._table.rows.length>0)
this._table.deleteRow(0);}
if(this._data!=null){for(var i=0;i<this._data.length;i++)
{var row=this._table.insertRow(i);this.createRow(row,this._columns,this._data[i]);}}}
ListColumn.prototype._id;ListColumn.prototype._title;ListColumn.prototype._class;ListColumn.prototype._classHdr;ListColumn.prototype._width;ListColumn.prototype._cbfunc;ListColumn.prototype._cbfuncdata;function ListColumn(id,title,classname,classnameHdr,width,cbfunc,cbfuncdata)
{this._id=id;this._title=title;this._class=(classname!=null)?classname:"listComponentColumn";this._classHdr=(classnameHdr!=null)?classnameHdr:"listComponentColumn";this._width=width;this._cbfunc=cbfunc;this._cbfuncdata=cbfuncdata;}
ListCell.TYPE_STRING=parseInt("0x01");ListCell.TYPE_NUMBER=parseInt("0x02");ListCell.TYPE_IMAGE=parseInt("0x04");ListCell.TYPE_CONTAINER=parseInt("0x08");ListCell.TYPE_BUTTON=parseInt("0x10");ListCell.prototype._type;ListCell.prototype._value;ListCell.prototype._width;ListCell.prototype._height;function ListCell(type,value,height,width)
{this._type=type;this._value=value;this._height=height;this._width=width;}
function hideLoading()
{var obj=document.getElementById("loading-status");obj.style.visibility="hidden";removeLoadingLayer();}
function setLoadingDimensions()
{var obj=document.getElementById("loading-status");var dim=dhtmlapi.getPageScroll();obj.style.position="absolute";obj.style.left=dim.scrollX+(dhtmlapi.getInsideWindowWidth()*0.3)+'px';obj.style.top=dim.scrollY+200+'px';}
function showLoading(h,w)
{loadingLayer(h,w);var obj=document.getElementById("loading-status");obj.style.visibility="visible";var div=document.createElement('DIV');div.setAttribute('id','loading-refresher');document.body.appendChild(div);div.parentNode.removeChild(div);}
function loadingLayer(h,w)
{var layerlock=document.createElement("div");layerlock.setAttribute('id','layerlock');layerlock.style.position="absolute";layerlock.style.display="";layerlock.style.top="0px";layerlock.style.left="0px";layerlock.style.height=(h!=null)?h+"px":"100%";layerlock.style.width=(w!=null)?w+"px":"100%";layerlock.style.backgroundColor="white";layerlock.style.zIndex=ZIndex.PROGRESS_BAR-1;dhtmlapi.setOpacity(layerlock,0.4);document.body.appendChild(layerlock);}
function resizeLoadingLayer(h,w)
{var obj=document.getElementById('layerlock');if(obj!=null){obj.style.height=h+'px';obj.style.width=w+'px';}}
function removeLoadingLayer(){var obj=document.getElementById("layerlock");if(obj!=null)
document.body.removeChild(obj);}
ModalDialog.object=null;ModalDialog.prototype.id;ModalDialog.prototype.container;ModalDialog.prototype.dlg;ModalDialog.prototype.content;ModalDialog.prototype.top;ModalDialog.prototype.left;ModalDialog.prototype.height;ModalDialog.prototype.width;ModalDialog.prototype.attributes;ModalDialog.prototype.okButton;ModalDialog.prototype.okCallback;ModalDialog.prototype.cancelCallback;ModalDialog.prototype.options;function ModalDialog(options,okCallback,cancelCallback)
{this.id="dlg1";this.top=-1;this.left=-1;this.height=-1;this.width=400;this.dlg=null;this.content=null;this.container=null;this.attributes=new Object();this.okButton=false;this.okCallback=okCallback;this.cancelCallback=cancelCallback;this.options=""
if(options!=null)
{for(var i=0;i<options.length;i++)
{var nv=options[i].split('=');switch(nv[0])
{case'okButton':this.okButton=true;break;case'height':this.height=parseInt(nv[1]);break;case'width':this.width=parseInt(nv[1]);break;case'top':this.top=parseInt(nv[1]);break;case'left':this.left=parseInt(nv[1]);break;default:this.options+="&"+options[i];break;}}}}
ModalDialog.createInstance=function(options,okCallback,cancelCallback)
{if(ModalDialog.object!=null){alert("A Modal Dialog is already open");return null;}
ModalDialog.object=new ModalDialog(options,okCallback,cancelCallback);return ModalDialog.object;}
ModalDialog.alert=function(msg)
{var options=["okButton","width=400"];var dlg=ModalDialog.createInstance(options);var s='<table width="95%">'+'<tr valign=center>'+'  <td><img src="images/gui/hazard_icon.jpg" style="height:32px;width:32px;" alt="error dialog"></td>'+'  <td align=left><span class=mediumText>'+msg+'</span></td>'+'</tr></table>';dlg.render(s);}
ModalDialog.getElementById=function(id)
{return ModalDialog.object.getElementById(id);}
ModalDialog.getElementValue=function(id)
{return ModalDialog.object.getElementValue(id);}
ModalDialog.handleClick=function(e)
{}
ModalDialog.handleKeyPress=function(e)
{var dlg=ModalDialog.object;var evt=EventUtils.getIframeEvent(e,dlg.id,"keypress");var charnum=evt.keyCode;if(charnum==13){setTimeout("ModalDialog.invoke('ok')",0);}}
ModalDialog.handleBtnPress=function(val)
{var func="ModalDialog.invoke('"+val+"')";setTimeout(func,0);}
ModalDialog.invoke=function(val)
{var dlg=ModalDialog.object;if(val=='ok'&&dlg.okCallback!=null)
dlg.okCallback(dlg,val);else if(val=='cancel'&&dlg.cancelCallback!=null)
dlg.cancelCallback(dlg,val);dlg.close();delete ModalDialog.object;ModalDialog.object=null;}
ModalDialog.closeDialog=function(id)
{setTimeout("ModalDialog.invoke('cancel')",0);}
ModalDialog.prototype.close=function()
{document.body.removeChild(this.container);}
ModalDialog.prototype.render=function(str)
{this.content=str;var container=document.createElement("div");container.style.position='absolute';container.style.top='0px';container.style.left='0px';container.style.height=dhtmlapi.getInsideWindowHeight()+'px';container.style.width=dhtmlapi.getInsideWindowWidth()+'px';container.style.zIndex=50000;container.style.cursor='wait';container.style.backgroundImage="url(images/homepage/transparentw.gif)";container.style.backgroundRepeat="repeat";container.onmousedown=ModalDialog.handleClick;container.onmouseup=ModalDialog.handleClick;container.onclick=ModalDialog.handleClick;var dlg=document.createElement('iframe');dlg.id=this.id;dlg.className='normalText';dlg.src="modalDialog.htm?"+this.id+encodeURIComponent(this.options);dlg.frameBorder="no";dlg.scrolling="no";dlg.style.position='absolute';dlg.style.backgroundColor='#E4EDF2';if(this.height!=-1)
dlg.style.height=this.height+'px';if(this.width!=-1)
dlg.style.width=this.width+'px';container.appendChild(dlg);this.container=container;this.dlg=dlg;this.position();document.body.appendChild(container);}
ModalDialog.prototype.focus=function(id)
{var cd=ModalDialog.dlg.contentWindow.document;var obj=cd.getElementById(id);obj.focus();}
ModalDialog.loaded=function(id)
{var dialog=ModalDialog.object;var dlg=dialog.dlg;var doc=dlg.contentWindow.document;var ctr=doc.getElementById("dlgContainer");var v=dialog.content;if(dialog.okCallback!=null||dialog.cancelCallback!=null||dialog.okButton==true)
{v+='<div style="margin-top:10px;margin-bottom:10px;"><center>';if(dialog.okCallback!=null||dialog.okButton==true){v+='  <button id=dlgBtnOk class=normalText onclick="parent.ModalDialog.handleBtnPress(\'ok\')" style="width:70px;">Ok</button>';}
if(dialog.cancelCallback!=null)
{v+='<button id=dlgBtnCancel class=normalText onclick="parent.ModalDialog.handleBtnPress(\'cancel\')" style="width:70px;">Cancel</button>';}
v+='</div>';}
ctr.innerHTML=v;if(dialog.height==-1){var body_h=dhtmlapi.getObjectHeight(doc.body);dlg.style.height=parseInt(body_h)+'px';}
if(dialog.width==-1){var body_w=dhtmlapi.getObjectWidth(doc.body);dlg.style.width=parseInt(body_w)+'px';}
var list=ctr.getElementsByTagName("input");if(list==null||list.length==0)
list=ctr.getElementsByTagName("select");if(list==null||list.length==0)
list=ctr.getElementsByTagName("button");if(list!=null&&list.length!=0){list[0].focus();list[0].onkeyup=ModalDialog.handleKeyPress;}}
ModalDialog.prototype.setAttribute=function(name,value)
{this.attributes[name]=value;}
ModalDialog.prototype.getAttribute=function(name)
{return this.attributes[name];}
ModalDialog.prototype.getElementById=function(name)
{return this.dlg.contentWindow.document.getElementById(name);}
ModalDialog.prototype.getElementValue=function(name)
{var obj=this.dlg.contentWindow.document.getElementById(name);if(obj.tagName.toUpperCase()=="INPUT")
return obj.value;else if(obj.tagName.toUpperCase()=="SELECT")
return obj.options[obj.selectedIndex].value;else
return xmlutils.getNodeText(obj);}
ModalDialog.prototype.position=function()
{var t=0;var l=0;if(this.top==-1){var win_h=dhtmlapi.getInsideWindowHeight();t=parseInt((win_h-this.height)*.40);}
else
t=this.top;if(this.left==-1){var win_w=dhtmlapi.getInsideWindowWidth();l=parseInt((win_w-this.width)/2);}
else
l=this.left;this.dlg.style.top=t+'px';this.dlg.style.left=l+'px';}
PopupMenu.menu=null;PopupMenu.prototype._isVisible=null;PopupMenu.prototype._isItemSelected=null;PopupMenu.prototype._title=null;PopupMenu.prototype._items=null;PopupMenu.prototype._table=null;PopupMenu.prototype._container=null;PopupMenu.prototype._cbfunc=null;PopupMenu.prototype._cbobj=null;PopupMenu.prototype._fontFamily=null;PopupMenu.prototype._fontSize=null;function PopupMenu(title,cbfunc,cbobj)
{this._isVisible=false;this._isItemSelected=false;this._title=title;this._items=new Array(0);this._table=null;this._container=null;this._cbfunc=cbfunc;this._cbobj=cbobj;this._fontFamily=null;this._fontSize=null;}
PopupMenu.createInstance=function(parent,title,cbFunc,cbObj,width)
{var pmenu=new PopupMenu(title,cbFunc,cbObj);pmenu.createMenu(parent,width);if(PopupMenu.menu==null)
PopupMenu.menu=new Object();PopupMenu.menu[title]=pmenu;return pmenu;}
PopupMenu.getInstance=function(elem)
{var target=elem;while(target!=null&&target.className!='popupMenu')
target=target.parentNode;return PopupMenu.menu[target.id];}
PopupMenu.handleMenuItemMouseOver=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var pmenu=PopupMenu.getInstance(target);if(target.tagName!='TD')
target=target.parentNode;pmenu.highlightItem(target);}
PopupMenu.prototype.highlightItem=function(elem)
{var obj=null;if(typeof elem=="number"){var row=this._table.rows[elem];obj=row.cells[0];}
else
obj=elem;obj.style.backgroundColor='#EFEFEF';obj.style.border='none';obj.style.borderBottom='1px solid lightgrey';this._isItemSelected=true;}
PopupMenu.handleMenuItemMouseOut=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var pmenu=PopupMenu.getInstance(target);if(target.tagName!='TD')
target=target.parentNode;target.style.backgroundColor='#FFFFFF';target.style.border='solid lightgrey 1px';pmenu._isItemSelected=false;}
PopupMenu.handleMenuItemSelection=function(e)
{var evt=EventUtils.getEvent(e);var obj=EventUtils.getTargetElement(evt);var pmenu=PopupMenu.getInstance(obj);var cell=null;var span=null;if(obj.tagName=='TD')
{cell=obj;span=cell.firstChild;}
else if(obj.tagName=='SPAN')
{cell=obj.parentNode;span=obj;}
else{return;}
var idx=parseInt(cell.id.split('_')[1]);var op=pmenu._items[idx];if(op.operation==null)
return;pmenu.popdown();evt.cancelBubble=true;var x=dhtmlapi.getObjectLeft(pmenu._container);var y=dhtmlapi.getObjectTop(pmenu._container);if(pmenu._cbobj)
pmenu._cbfunc.call(pmenu._cbobj,op.title,op.operation,x,y);else
pmenu._cbfunc(op.title,op.operation,x,y);return false;}
PopupMenu.prototype.addMenuItem=function(title,operation)
{var idx=this._items.length;var row=this._table.insertRow(idx);var col=row.insertCell(0);col.id='item_'+idx;col.align='left';col.className='popupMenuItem';col.onmouseover=PopupMenu.handleMenuItemMouseOver;col.onmouseout=PopupMenu.handleMenuItemMouseOut;var spn=document.createElement("span");spn.innerHTML=title;if(this._fontFamily!=null)
spn.style.fontFamily=this._fontFamily;if(this._fontSize!=null)
spn.style.fontSize=this._fontSize;col.appendChild(spn);this._items[idx]={title:title,operation:operation};if(operation==null){col.style.color='lightgrey';}}
PopupMenu.prototype.createMenu=function(parent,width)
{var div=document.createElement("div");div.id=this._title;div.className='popupMenu';parent.appendChild(div);var t1=document.createElement("table");t1.width=width;t1.cellSpacing=1;t1.cellPadding=0;t1.bgcolor='lightgray';div.appendChild(t1);var row=t1.insertRow(0);var col=row.insertCell(0);var t2=document.createElement("table");t2.width=width-2;t2.cellSpacing=0;t2.cellPadding=0;col.appendChild(t2);this._table=t2;this._container=div;}
PopupMenu.prototype.isVisible=function()
{return this._isVisible;}
PopupMenu.prototype.isItemSelected=function()
{return this._isItemSelected;}
PopupMenu.prototype.popup=function(top,left)
{if(dhtmlapi.isIE){this._container.style.pixelLeft=left;this._container.style.pixelTop=top;}
else{this._container.style.left=left+'px';this._container.style.top=top+'px';}
this._container.style.visibility="visible";this._container.onclick=PopupMenu.handleMenuItemSelection;this._isVisible=true;return false;}
PopupMenu.prototype.popdown=function()
{this._isVisible=false;this._overpopupmenu=false;this._container.style.visibility="hidden";return true;}
PopupMenu.prototype.setFont=function(family,size)
{if(family!=null)
this._fontFamily=family;if(size!=null)
this._fontSize=size;}
ProgressBar.object=null;ProgressBar.SliderHeight=parseInt("25");ProgressBar.prototype._parentElement=null;ProgressBar.prototype._top;ProgressBar.prototype._left;ProgressBar.prototype._window=null;ProgressBar.prototype._interval=null;ProgressBar.prototype._container=null;ProgressBar.prototype._status=null;ProgressBar.prototype._footer=null;ProgressBar.prototype._dlgbtn=null;ProgressBar.prototype._details=null;ProgressBar.prototype._msgList=null;ProgressBar.prototype._slider1Container=null;ProgressBar.prototype._slider1=null;ProgressBar.prototype._slider1Header=null;ProgressBar.prototype._slider1Limit=0;ProgressBar.prototype._slider1Width=0;ProgressBar.prototype._slider2Container=null;ProgressBar.prototype._slider2=null;ProgressBar.prototype._slider2Header=null;ProgressBar.prototype._slider2Limit=0;ProgressBar.prototype._slider2Width=0;ProgressBar.prototype._toggle=null;ProgressBar.prototype._height;ProgressBar.prototype._width;ProgressBar.prototype._chunk=null;ProgressBar.prototype._btnfunc;ProgressBar.prototype._isOpened=false;ProgressBar.prototype._currentMessage=null;ProgressBar.prototype._messageLog=null;function ProgressBar(parentElement,top,left)
{this._parentElement=parentElement;this._top=parseInt(top);this._left=parseInt(left);}
ProgressBar.createInstance=function(parentElement,top,left)
{if(ProgressBar.object!=null)
return ProgressBar.object;ProgressBar.object=new ProgressBar(parentElement,top,left);return ProgressBar.object;}
ProgressBar.prototype.initialize=function(expanded,btnfunc,btntext,initialMsg)
{var row;var col;var col2;var rowCounter=0;this._width=425;this._currentMessage=null;this._btnfunc=btnfunc;this._messageLog=new Array(0);this._container=document.createElement("div");this._container.style.position="absolute";this._container.style.top=this._top+"px";this._container.style.left=this._left+"px";this._container.style.width=this._width+"px";this._container.style.border="solid lightblue 1px";this._container.style.backgroundColor="#3399CC";this._container.style.border='solid black 2px';this._container.style.margin='5px';this._container.style.overflow="hidden";this._container.style.zIndex=ZIndex.PROGRESS_BAR;this._parentElement.appendChild(this._container);this._isOpened=true;var tbl=document.createElement("table");tbl.border=0;tbl.cellPadding=5;tbl.cellSpacing=0;tbl.width="97%";this._container.appendChild(tbl);row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._status=this.createText((initialMsg!=null)?initialMsg:"");col.appendChild(this._status);if(expanded){row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._slider1Header=this.createSliderHeader();col.appendChild(this._slider1Header);row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._slider1Container=this.createSliderContainer();this._slider1=this.addSlider(this._slider1Container);col.appendChild(this._slider1Container);this._slider1Width=dhtmlapi.getObjectWidth(this._slider1Container)-2;this._slider1Limit=0;row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._slider2Header=this.createSliderHeader();col.appendChild(this._slider2Header);row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._slider2Container=this.createSliderContainer();this._slider2=this.addSlider(this._slider2Container);col.appendChild(this._slider2Container);this._slider2Width=dhtmlapi.getObjectWidth(this._slider2Container)-2;this._slider2Limit=0;}
else{this._slider1Header=this._slider2Header=null;this._slider1Container=this._slider2Container=null;this._slider1=this._slider2=null;this._slider1Width=this._slider2Width=0;this._slider1Limit=this._slider2Limit=0;}
row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._toggle=this.createButton(ProgressBar.handleToggle,"progressBarToggle","Show Details");col.appendChild(this._toggle);row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col.colSpan=2;this._details=document.createElement("div");this._details.className='normalText';this._details.style.display="none";this._details.style.height="200px";this._details.style.width="100%";this._details.style.overflow="scroll";this._details.style.border="inset lightgrey 1px";this._container.style.color="#FFFFFF";col.appendChild(this._details);this._msgList=document.createElement("table");this._msgList.align='right';this._msgList.style.width="100%";this._details.appendChild(this._msgList);row=tbl.insertRow(rowCounter++);col=row.insertCell(0);col2=row.insertCell(1);col2.align="right";this._footer=this.createText("");col.appendChild(this._footer);this._dlgbtn=this.createButton(ProgressBar.handlePress,"progressBarButton",btntext);col2.appendChild(this._dlgbtn);}
ProgressBar.prototype.createSliderHeader=function()
{var header=document.createElement("span");header.style.fontFamily="Century Gothic, Verdana, Arial, Helvetica, sans-serif";header.style.fontSize="10pt";header.style.color="#FFFFFF";header.innerHTML="";return header;}
ProgressBar.prototype.createSliderContainer=function()
{var container=document.createElement("div");container.style.position="relative";container.style.backgroundColor="white";container.style.border="solid black 1px";container.style.height=ProgressBar.SliderHeight+"px";container.style.width="100%";return container;}
ProgressBar.prototype.addSlider=function(container)
{var slider=document.createElement("div");var height=ProgressBar.SliderHeight;slider.style.position="absolute";slider.style.left="0px";slider.style.top="0px";slider.style.height=height+"px";slider.style.width="0px";slider.style.backgroundColor="#66CCFF";container.appendChild(slider);return slider;}
ProgressBar.prototype.createButton=function(handler,id,text)
{var btn=document.createElement("button");btn.id=id;btn.className='normalText';btn.onclick=handler;btn.innerHTML=text;btn.setAttribute('op',text);return btn;}
ProgressBar.prototype.createText=function(str)
{var text=document.createElement("span");text.className='normalText';text.style.color="#FFFFFF";text.innerHTML=str;return text;}
ProgressBar.handlePress=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var pbar=ProgressBar.object;pbar._btnfunc(pbar._dlgbtn.innerHTML);}
ProgressBar.handleToggle=function()
{var obj=ProgressBar.object;var btn=obj._toggle;var win=obj._window;var disp=ProgressBar.object._details.style.display;if(disp=='none'){btn.innerHTML="Hide Details";btn.setAttribute('op','hide');ProgressBar.object._details.style.display="block";}else{btn.innerHTML="Show Details";ProgressBar.object._details.style.display="none";}}
ProgressBar.prototype.setTitle=function(title)
{}
ProgressBar.prototype.log=function(msg)
{this._messageLog[this._messageLog.length]=msg;var tr=this._msgList.insertRow(this._msgList.rows.length);var td=tr.insertCell(0);td.innerHTML='<span class=normalText>'+msg+'</span><br>';}
ProgressBar.prototype.updateStatus=function(msg)
{if(msg==null)
return;var status_msg=msg;if(status_msg.length>64)
status_msg=msg.substring(0,61)+"...";this._status.innerHTML=status_msg;this._currentMessage=msg;this.log(msg);}
ProgressBar.prototype.updateFooter=function(msg)
{this._footer.innerHTML=msg;}
ProgressBar.prototype.resetSlider=function(which,limit)
{if((which==1)&&(this._slider1!=null)){this._slider1Limit=limit;this._slider1.style.width="0px";}
else if((which==2)&&(this._slider2!=null)){this._slider2Limit=limit;this._slider2.style.width="0px";}}
ProgressBar.prototype.setSliderText=function(which,msg)
{if((which==1)&&(this._slider1Header!=null)){this._slider1Header.innerHTML=msg;}
else if((which==2)&&(this._slider2Header!=null)){this._slider2Header.innerHTML=msg;}}
ProgressBar.prototype.setSliderPos=function(which,pos)
{var wd;if((which==1)&&(this._slider1!=null)){wd=Math.floor((pos*this._slider1Width)/this._slider1Limit);this._slider1.style.width=wd+"px";}
else if((which==2)&&(this._slider2!=null)){wd=Math.floor((pos*this._slider2Width)/this._slider2Limit);this._slider2.style.width=wd+"px";}}
ProgressBar.prototype.getSliderWidth=function(which)
{if(which==1)
return this._slider1Width;else if(which==2)
return this._slider2Width;else
return 0;}
ProgressBar.prototype.getSliderLimit=function(which)
{if(which==1)
return this._slider1Limit;else if(which==2)
return this._slider2Limit;else
return 0;}
ProgressBar.prototype.setButtonText=function(str)
{this._dlgbtn.innerHTML=str;}
ProgressBar.prototype.enableButton=function(enable)
{this._dlgbtn.disabled=!enable;}
ProgressBar.prototype.focusButton=function()
{this._dlgbtn.focus();}
ProgressBar.prototype.close=function()
{this._parentElement.removeChild(this._container);this._isOpened=false;}
ProgressBar.prototype.isOpened=function()
{return this._isOpened;}
SimpleList.CLASS_NAVIGATION="listNavItem";SimpleList.CLASS_TITLE="listTitle";SimpleList.counter=0;SimpleList.defaultColors=null;SimpleList.prototype._id;SimpleList.prototype._list;SimpleList.prototype._selectedIndex;SimpleList.prototype._colors;SimpleList.prototype._coxtentMenuOptions;SimpleList.prototype._table;SimpleList.prototype._iconColumn
SimpleList.prototype._dimensions;SimpleList.prototype._cbfunc;SimpleList.prototype._sortfunc;SimpleList.prototype._currentSortType;SimpleList.prototype._popupMenu;SimpleList.prototype._listContainerWidget;function SimpleList(width,colors,iconColumn,sortfunc,sortType)
{this._id="simpleList"+SimpleList.counter++;this._list=new RecordSet();this._selectedIndex=0;this._table=null;this._cbfunc=null;this._sortfunc=sortfunc;this._currentSortType=sortType;this._popupMenu=null;this._contextMenuOptions=null;this._iconColumn=iconColumn;this._colors=(colors!=null)?colors:SimpleList.defaultColors;this._dimensions=new Object();this._dimensions._height=21;this._dimensions._width=width;this._dimensions._indent=30;this._listContainerWidget=null;}
SimpleList.createInstance=function(width,colors,iconColumn,sortfunc,sortType)
{if(SimpleList.objects==null){SimpleList.objects=new Object();var obj=new Object();obj.backgroundColor='white';obj.textColor='black';obj.selectedBackgroundColor='lightblue';obj.selectedTextColor='blue';SimpleList.defaultColors=obj;}
var sl=new SimpleList(width,colors,iconColumn,sortfunc,sortType);SimpleList.objects[sl._id]=sl;return sl;}
SimpleList.getInstance=function(elem)
{while(elem!=null){var id=elem.getAttribute("simplelistid");if(id!=null)
return SimpleList.objects[id];else
elem=elem.parentNode;}
return null;}
SimpleList.handleClick=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var tc=SimpleList.getInstance(target);var etype=(evt.type=='click')?'select':'launch';while(target!=null&&target.tagName!="TR")
target=target.parentNode;var cellIdx=target.rowIndex
tc.unselectItem(tc._selectedIndex);tc._selectedIndex=cellIdx;tc.selectItem(tc._selectedIndex);if(tc._cbfunc)
tc._cbfunc(etype,tc._list.item(tc._selectedIndex));}
SimpleList.handleMouseDown=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var slist=SimpleList.getInstance(target);if(evt.button==2){return false;}
if(slist._popupMenu!=null&&slist._popupMenu.isVisible()){if(slist._popupMenu.isItemSelected()){return false;}
else{slist._popupMenu.popdown();return false;}}}
SimpleList.handleContextMenu=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var slist=SimpleList.getInstance(target);if(slist._popupMenu==null)
return false;var top=evt.clientY+document.body.scrollTop;var left=evt.clientX+document.body.scrollLeft;slist._popupMenu.popup(top-10,left-10);slist._popupMenu.highlightItem(0);evt.returnValue=false;return false;}
SimpleList.contextMenuCB=function(title,operation,x,y){if(this._cbfunc!=null){var recordset=this._list;var item=recordset.item(this._selectedIndex);this._cbfunc(operation,item,this._selectedIndex);}}
SimpleList.prototype.getSelectedItem=function()
{if(this._selectedIndex>=0)
return this._list.item(this._selectedIndex);else
return null;}
SimpleList.prototype.redraw=function()
{if(this._table!=null){while(this._table.rows.length>0)
this._table.deleteRow(0);}
var spn=null;for(var i=0;i<this._list.size();i++)
{var obj=this._list.item(i);var name=obj.getName();var colIndex=0;tr=this._table.insertRow(i);tr.height=this._dimensions._height;tr.style.backgroundColor=this._colors.backgroundColor;td=tr.insertCell(colIndex);if(this._iconColumn==true){td.innerHTML="&nbsp;";}
else{td.innerHTML="&nbsp;";}
td=tr.insertCell(++colIndex);spn=document.createElement("span");spn.className=SimpleList.CLASS_NAVIGATION;spn.innerHTML=util.escapeHtmlString(obj.getName());td.appendChild(spn);if(i==this._selectedIndex)
this.selectItem(i);else
this.unselectItem(i);}}
SimpleList.prototype.setCallback=function(cbfunc)
{this._cbfunc=cbfunc;}
SimpleList.prototype.setHeight=function(val)
{this._dimensions._height=val;}
SimpleList.prototype.setWidth=function(val)
{this._dimensions._width=val;}
SimpleList.prototype.setData=function(list,defaultIndex,defaultItem)
{this._list=new RecordSet(list,this._sortfunc);if(defaultIndex!=null&&defaultIndex>=0&&defaultIndex<this._list.size())
this._selectedIndex=defaultIndex;this._list.sort(this._currentSortType);if(defaultItem!=null)
this._selectedIndex=this._list.indexOf(defaultItem);this.redraw();}
SimpleList.prototype.setColors=function(colors)
{if(colors!=null){this._colors=colors;this._listContainerWidget.style.backgroundColor=this._colors.backgroundColor;this.redraw();}}
SimpleList.prototype.setContextMenu=function(options)
{this._contextMenuOptions=options;}
SimpleList.prototype.sort=function(sortType,item)
{var selectedItem=this._list.item(this._selectedIndex);if(sortType!=null)
this._currentSortType=sortType;this._list.sort(sortType);this._selectedIndex=this._list.indexOf((item!=null)?item:selectedItem);this.redraw();}
SimpleList.prototype.update=function()
{}
SimpleList.prototype.toHtml=function(container)
{this._listContainerWidget=document.createElement("div");this._listContainerWidget.style.height=dhtmlapi.getObjectHeight(container)+"px";this._listContainerWidget.style.width=dhtmlapi.getObjectWidth(container)+"px";this._listContainerWidget.onmousedown=SimpleList.handleMouseDown;this._listContainerWidget.setAttribute('simplelistid',this._id);this._listContainerWidget.style.backgroundColor=this._colors.backgroundColor;container.appendChild(this._listContainerWidget);this._table=document.createElement("table");this._table.id=this._id;this._listContainerWidget.appendChild(this._table);var tr=null;var td=null;var span=null;var col=null;if(this._popupMenu==null&&this._contextMenuOptions!=null){this._popupMenu=PopupMenu.createInstance(document.body,this._id+"PopupMenu",SimpleList.contextMenuCB,this,82);this._popupMenu.setFont('Century Gothic, Verdana, Arial, Helvetica, sans-serif',"10px");for(var i=0;i<this._contextMenuOptions.length;i++)
this._popupMenu.addMenuItem(this._contextMenuOptions[i].name,this._contextMenuOptions[i].operation);}
this._table.border=0;this._table.cellPadding=0;this._table.cellSpacing=0;this._table.width="100%"
var colgroup=document.createElement("colgroup");var col=document.createElement("col");var width=this._dimensions._width;if(this._iconColumn==true){col.width=this._dimensions._indent;colgroup.appendChild(col);width-=this._dimensions._indent;}
else{col.width=5;colgroup.appendChild(col);width-=5;}
col=document.createElement("col");col.width=width;colgroup.appendChild(col);this._table.appendChild(colgroup);this.redraw();}
SimpleList.prototype.selectItem=function(idx)
{var tr=this._table.rows[idx];var td=tr.cells[1];var spn=td.firstChild;tr.style.backgroundColor=this._colors.selectedBackgroundColor;tr.onclick=null;tr.oncontextmenu=SimpleList.handleContextMenu;spn.style.color=this._colors.selectedTextColor;}
SimpleList.prototype.unselectItem=function(idx)
{var tr=this._table.rows[idx];var td=tr.cells[1];var spn=td.firstChild;tr.style.backgroundColor=this._colors.backgroundColor;tr.style.color=this._colors.textColor;tr.onclick=SimpleList.handleClick;tr.ondblclick=SimpleList.handleClick;tr.oncontextmenu=null;spn.style.color=this._colors.textColor;}
function Titlebar(name,container,height,width)
{this._parent.initialize.call(this,name,container,height,width);}
Titlebar.inheritsFrom(Toolbar);Titlebar.createInstance=function(name,container,height,width)
{var tb=new Titlebar(name,container,height,width);return tb;}
Titlebar.prototype.resize=function(newWidth)
{var rx=-1;var curWidth=dhtmlapi.getObjectWidth(this._container);var minWidth=this.getMinimumWidth();if(curWidth==newWidth)
return;if(newWidth<=minWidth&&curWidth>minWidth){rx=this.getButtonAreaWidth(true);}
else if(newWidth>minWidth){rx=newWidth-this.getButtonAreaWidth(false);}
if(rx>=0)
this.moveRightButtonsTo(rx);if(newWidth<=minWidth)
newWidth=minWidth;this.getContainer().style.width=newWidth+"px";}
Titlebar.prototype.moveRightButtons=function(deltax)
{var curWidth=dhtmlapi.getObjectWidth(this._container);var minWidth=this.getMinimumWidth()+deltax;if(minWidth>=curWidth)
this._parent.moveRightButtons.call(this,deltax);}
Titlebar.prototype.getButtonLocation=function(left)
{var loc=this._parent.getButtonLocation.call(this,left);return loc;}
Titlebar.prototype.setHandlers=function(handlerMouseUp,handlerMouseDown,handlerMouseMove)
{if(handlerMouseUp!=null)
this._container.onmouseup=handlerMouseUp;if(handlerMouseDown!=null)
this._container.onmousedown=handlerMouseDown;if(handlerMouseMove!=null)
this._container.onmousemove=handlerMouseMove;}
Titlebar.prototype.getButtonAreaWidth=function(left)
{var total=0;for(var i=0;i<this._buttons.length;i++)
{if(this._locations[i]==left)
total+=dhtmlapi.getObjectWidth(this._buttons[i].getContainer())+this._spacing;}
return total;}
Toolbar.prototype.moveRightButtonsTo=function(newx)
{for(var i=0;i<this._buttons.length;i++)
{if(this._locations[i]==false){var container=this._buttons[i].getContainer();var oldwidth=dhtmlapi.getObjectWidth(container);container.style.left=newx+"px";newx+=oldwidth+this._spacing;}}}
if(typeof YAHOO=="undefined"){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.init=function(){this.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
if(unique){ls.push(l);}}}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[],getVersion:function(name){return YAHOO.env.modules[name]||null;}};YAHOO.lang={isArray:function(obj){if(obj&&obj.constructor&&obj.constructor.toString().indexOf('Array')>-1){return true;}else{return YAHOO.lang.isObject(obj)&&obj.constructor==Array;}},isBoolean:function(obj){return typeof obj=='boolean';},isFunction:function(obj){return typeof obj=='function';},isNull:function(obj){return obj===null;},isNumber:function(obj){return typeof obj=='number'&&isFinite(obj);},isObject:function(obj){return obj&&(typeof obj=='object'||YAHOO.lang.isFunction(obj));},isString:function(obj){return typeof obj=='string';},isUndefined:function(obj){return typeof obj=='undefined';},hasOwnProperty:function(obj,prop){if(Object.prototype.hasOwnProperty){return obj.hasOwnProperty(prop);}
return!YAHOO.lang.isUndefined(obj[prop])&&obj.constructor.prototype[prop]!==obj[prop];},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}
var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}}},augment:function(r,s){if(!s||!r){throw new Error("YAHOO.lang.augment failed, please check that "+"all dependencies are included.");}
var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;i=i+1){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}}};YAHOO.init();YAHOO.util.Lang=YAHOO.lang;YAHOO.augment=YAHOO.lang.augment;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.2.2",build:"204"});YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',_use_default_xhr_header:true,_default_xhr_header:'XMLHttpRequest',_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function()
{if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,'click',function(e){var obj=YAHOO.util.Event.getTarget(e);if(obj.type=='submit'){YAHOO.util.Connect._submitElementValue=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.value);}})
return true;}
return false;})(),setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
{this._use_default_xhr_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
if(method.toUpperCase()=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
else{uri+="?"+this._sFormData;}}
else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},syncRequest:function(method,uri,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{o.conn.open(method,uri,false);if(postData&&this._use_default_post_header){this.initHeader('Content-Type',this._default_post_header);}
if(this._has_http_headers){this.setHeader(o);}
o.conn.send(postData?postData:null);var isSync=true;var callback=new Object();callback.argument=null;return this.handleTransactionResponse(o,callback,null,isSync);}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort,isSync)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!==0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300||httpStatus===1223){responseObject=this.createResponseObject(o,callback.argument);if(isSync){this.releaseObject(o);return responseObject;}
if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=(o.conn.status==1223)?204:o.conn.status;obj.statusText=(o.conn.status==1223)?"No Content":o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value,isDefault)
{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
else{headerObj[label]=value+","+headerObj[label];}
if(isDefault){this._has_default_headers=true;}
else{this._has_http_headers=true;}},setHeader:function(o)
{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers
this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){oForm=formId;}
else{return;}
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit===false){if(this._hasSubmitListener){this._sFormData+=this._submitElementValue+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else if(typeof secureURI=='string'){io.src=secureUri;}}
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);this._formNode.setAttribute('action',uri);this._formNode.setAttribute('method','POST');this._formNode.setAttribute("target",frameId);if(this._formNode.encoding){this._formNode.encoding=uploadEncoding;}
else{this._formNode.enctype=uploadEncoding;}
if(postData){var oElements=this.appendPostData(postData);}
this._formNode.submit();if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
this.resetFormState();var uploadCallback=function()
{var obj={};obj.tId=id;obj.argument=callback.argument;try
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
catch(e){}
if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!==4&&o.conn.readyState!==0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.2.2",build:"204"});Application.SOAP_MODULE_USER="userGroup";Application.SOAP_MODULE_CONTENT="content";Application.SOAP_MODULE_RESOURCE="resource";Application.prototype._name;Application.prototype._servletPath;Application.prototype._currentlyEditingPage;Application.prototype._connection;Application.prototype._currentSoapRequest;Application.prototype._currentSoapRequestType;Application.prototype._currentSoapRequestRetry;Application.prototype._soapRequests;Application._application=null;function Application(name)
{this._name=name;this._currentlyEditingPage=null;this._soapRequests=new Object();var idx=location.pathname.lastIndexOf("/");this._servletPath=location.pathname.slice(0,idx);Application._application=this;}
Application.getApplication=function()
{var win=window.opener;while(win!=undefined)
{var app=win.Application._application;if(app!=null)
return app;}
return null;}
Application.prototype.processSoapRequest=function(soapMsg,userCbFunc,appCbFunc,userData)
{this.processSoapRequestHostPath(location.host,this._servletPath,soapMsg,userCbFunc,appCbFunc,userData);}
Application.prototype.processSoapRequestHost=function(host,soapMsg,userCbFunc,appCbFunc,userData)
{this.processSoapRequestHostPath(host,this._servletPath,soapMsg,userCbFunc,appCbFunc,userData);}
Application.prototype.processSoapRequestHostPath=function(host,servletPath,soapMsg,userCbFunc,appCbFunc,userData)
{var uuid=Application.getUuid();var url=this.constructURL("/servlet/soapRequest",host,servletPath,uuid);soapMsg.setAuthentication(uuid);var callback={success:Application.handleSuccess,failure:Application.handleFailure,scope:Application,argument:null};var x=new Object();x.obj=this;x.uuid=uuid;callback.argument=x;var str=soapMsg.toXmlString();var sr=new SoapRequest(soapMsg,host,servletPath,uuid,appCbFunc,userCbFunc,userData);this._soapRequests[uuid]=sr;this._connection=YAHOO.util.Connect.asyncRequest('POST',url,callback,str);}
Application.prototype.retrySoapRequest=function(soapRequest)
{var count=soapRequest.count;if(soapRequest.count>2){alert("already retried - generate a fault here");return;}
soapRequest.count++;var uuid=Application.getUuid();var url=this.constructURL("/servlet/soapRequest",soapRequest.host,soapRequest.servletPath,uuid);soapRequest.soapMsg.setAuthentication(uuid);var callback={success:Application.handleSuccess,failure:Application.handleFailure,scope:Application,argument:null};var x=new Object();x.obj=this;x.uuid=uuid;callback.argument=x;var str=soapRequest.soapMsg.toXmlString();this._soapRequests[uuid]=soapRequest;this._connection=YAHOO.util.Connect.asyncRequest('POST',url,callback,str);}
Application.noop=function()
{}
Application.handleSuccess=function(o)
{var obj=o.argument.obj;var uuid=o.argument.uuid;var soapMsg=null;var auth=null;var sr=obj._soapRequests[uuid];obj._soapRequests[uuid]=null;delete obj._soapRequests[uuid];try{soapMsg=Soap.createSoapResponse(o.responseText);auth=soapMsg.getAuthentication();}catch(e){if(obj._connection!=null&&obj._connection.conn!=null){obj._connection.conn.abort();obj._connection.conn=null;obj._connection=null;}
obj.retrySoapRequest(sr);return;}
obj._connection=null;sr.appCbFunc.call(obj,soapMsg,sr.userCbFunc,sr.userData);}
Application.handleFailure=function(o)
{var obj=o.argument.obj;var status=o.status;var statusText=o.statusText;try{var uuid=o.argument.uuid;var sr=obj._soapRequests[uuid];var operation=sr.soapMsg.operation;if(operation=='logoutUser')
return;if(obj._connection!=null&&obj._connection.conn!=null){obj._connection.conn.abort();obj._connection.conn=null;obj._connection=null;}
obj.retrySoapRequest(sr);return;}catch(e){alert("There was a problem connecting to PikiWiki. Retry the operation, or exit PikiWiki and log back in.\n"+"status = "+status+" ["+statusText+"]");}}
Application.getUuid=function()
{var random=Math.floor(Math.random()*1000000000);return random;}
Application.prototype.constructURL=function(request,host,path,uuid)
{var str=location.protocol+"//"+host+path+request+"?__uuid__="+uuid;return str;}
Application.prototype.getUserData=function(userOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"getUserData");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);return this.processSoapRequest(soap,cbfunc,this.getUserDataResponse);}
Application.prototype.getUserDataResponse=function(soapMsg,cbfunc)
{try{var userData=new Object();if(soapMsg.isFault()){userData.user=null;userData.fault="SoapFault from calling getUserData";}
else{userData.user=soapMsg.getParameter("user").getValue();userData.groups=soapMsg.getParameter("groups").getValue();}}catch(e){userData.user=null;userData.fault="An error occurred while trying to retrieve user profile data";}
cbfunc(userData);}
Application.prototype.updateUser=function(userOid,fname,lname,preferencesXml,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"updateUserProfile");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("firstName",Soap.PARAMETER_STRING,xmlutils.encodeUTF(fname,true));soap.setParameter("lastName",Soap.PARAMETER_STRING,xmlutils.encodeUTF(lname,true));soap.setParameter("userPreferences","xml",preferencesXml);return this.processSoapRequest(soap,cbfunc,this.updateUserPreferencesResponse);}
Application.prototype.updateUserPreferences=function(userOid,preferencesXml,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"updateUserProfile");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("userPreferences","xml",preferencesXml);soap.setParameter("preferencesOnly",Soap.PARAMETER_BOOLEAN,true);return this.processSoapRequest(soap,cbfunc,this.updateUserPreferencesResponse);}
Application.prototype.updateUserPreferencesResponse=function(soapMsg,cbfunc)
{var status=true;try{if(soapMsg.isFault()){status=false;}}catch(e){status=false;}
cbfunc(status);}
Application.prototype.login=function(email,password,cbfunc)
{var md5_pwd=hex_md5(password);var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"login");soap.setParameter("username",Soap.PARAMETER_STRING,email);soap.setParameter("pwd",Soap.PARAMETER_BINARY,md5_pwd);return this.processSoapRequest(soap,cbfunc,this.loginResponse);}
Application.prototype.loginResponse=function(soapMsg,cbfunc)
{var loginData=new Object();try{if(soapMsg.isFault()==false){loginData.authcode=soapMsg.getParameter("authcode").getValue();loginData.serverTimestamp=soapMsg.getParameter("serverTimestamp").getValue();loginData.userOid=soapMsg.getParameter("userOid").getValue();}
else{loginData.authcode=null;loginData.serverTimestamp=null;loginData.userOid=null;}}catch(e){loginData.authcode=null;loginData.serverTimestamp=null;}
cbfunc(loginData);}
Application.prototype.logoutUser=function(cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"logoutUser");return this.processSoapRequest(soap,cbfunc,this.logoutUserResponse);}
Application.prototype.logoutUserResponse=function(soapMsg,cbfunc)
{cbfunc("ok");}
Application.prototype.convertUser=function(action,oid,email,password,first,last,updates,cbfunc)
{var md5_pwd=hex_md5(password);var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"convertUser");soap.setParameter("action",Soap.PARAMETER_STRING,action);soap.setParameter("oid",Soap.PARAMETER_INTEGER,oid);soap.setParameter("email",Soap.PARAMETER_STRING,email);soap.setParameter("pwd",Soap.PARAMETER_STRING,md5_pwd);soap.setParameter("first",Soap.PARAMETER_STRING,first);soap.setParameter("last",Soap.PARAMETER_STRING,last);soap.setParameter("updates",Soap.PARAMETER_STRING,updates);return this.processSoapRequest(soap,cbfunc,this.convertUserResponse);}
Application.prototype.convertUserResponse=function(soapMsg,cbfunc)
{var obj=new Object();try{if(soapMsg.isFault()){obj.user=null;obj.fault=soapMsg.getFault();}
else{obj.user=soapMsg.getParameter("user").getValue();obj.fault=null;}}catch(e){obj.user=null;obj.fault=null;}
cbfunc(obj);}
Application.prototype.createURL=function(groupOid,pageOid,editable,cbfunc)
{if(pageOid==null)
pageOid=-1;var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"createURL");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("public",Soap.PARAMETER_BOOLEAN,true);return this.processSoapRequest(soap,cbfunc,this.createUrlResponse);}
Application.prototype.createUrlResponse=function(soapMsg,cbfunc)
{var obj=new Object();try{if(!soapMsg.isFault()){obj.url=soapMsg.getParameter("url").getValue();obj.url_ro=soapMsg.getParameter("url_ro").getValue();}}catch(e){obj=null;}
cbfunc(obj);}
Application.prototype.getPageContents=function(userOid,groupOid,pageOid,lockId,pageVersion,writeTimeout,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"getPageHtml");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);soap.setParameter("pageVersion",Soap.PARAMETER_INTEGER,pageVersion);soap.setParameter("writeLock",Soap.PARAMETER_INTEGER,writeTimeout);return this.processSoapRequest(soap,cbfunc,this.getPageContentsResponse);}
Application.prototype.generatePageThumbnail=function(userOid,groupOid,pageOid)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"generatePageThumb");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);return this.processSoapRequest(soap,Application.noop,this.generatePageThumbnailResponse);}
Application.prototype.generatePageThumbnailResponse=function(soapMsg,cbfunc)
{var pageData=null;try{if(!soapMsg.isFault()){var status=soapMsg.getParameter("status").getValue();}
else{var fault=soapMsg.getFault();}}catch(e){pageData=null;}}
Application.prototype.getPageContentsFromUrl=function(url,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"getPageFromUrl");soap.setParameter("url",Soap.PARAMETER_STRING,url);return this.processSoapRequest(soap,cbfunc,this.getPageContentsResponse);}
Application.prototype.getPageContentsResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData=new Object();pageData.contents=soapMsg.getParameter("contents").getValue();pageData.status=soapMsg.getParameter("status").getValue();pageData.lock=soapMsg.getParameter("lock").getValue();pageData.lockOwner=soapMsg.getParameter("lockowner").getValue();pageData.version=soapMsg.getParameter("version").getValue();pageData.history=soapMsg.getParameter("history").getValue();pageData.users=soapMsg.getParameter("users").getValue();pageData.lastViewed=soapMsg.getParameter("lastviewed").getValue();pageData.readonly=false;sp=soapMsg.getParameter("readonly");if(sp!=null&&sp.getValue()=="true")
pageData.readonly=true;pageData.storageHost=soapMsg.getParameter("storageHost").getValue();pageData.storageContext=soapMsg.getParameter("storageContext").getValue();pageData.storagePath=soapMsg.getParameter("storagePath").getValue();var sp=soapMsg.getParameter("pageOid");if(sp!=null)
pageData.pageOid=sp.getValue();sp=soapMsg.getParameter("groupOid");if(sp!=null)
pageData.groupOid=sp.getValue();sp=soapMsg.getParameter("urltype");if(sp!=null&&sp.getValue()=="rw")
pageData.urltype='rw';else
pageData.urltype='ro';}
else{pageData.fault=soapMsg.getFault();}}catch(e){pageData=null;}
if(cbfunc!=null)
cbfunc(pageData);else
return pageData;}
Application.prototype.getPageXml=function(host,context,pageOid,storagePathOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_RESOURCE,"getPageXml");soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("storagePathOid",Soap.PARAMETER_INTEGER,storagePathOid);return this.processSoapRequestHostPath(host,context,soap,cbfunc,this.getPageXmlResponse);}
Application.prototype.getPageXmlResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.contents=soapMsg.getParameter("contents").getValue();}
else{pageData.fault=soapMsg.getFault();}}catch(e){pageData=null;}
if(cbfunc!=null)
cbfunc(pageData);else
return pageData;}
Application.prototype.createPageMetadata=function(userOid,groupOid,topicOid,title,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"createPage");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(title,true));return this.processSoapRequest(soap,cbfunc,this.createPageStartResponse);}
Application.prototype.createPageStartResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.info=soapMsg.getParameter("info").getValue();pageData.status=soapMsg.getParameter("status").getValue();pageData.lock=soapMsg.getParameter("lock").getValue();pageData.lockOwner=soapMsg.getParameter("lockowner").getValue();pageData.version=soapMsg.getParameter("version").getValue();pageData.storageHost=soapMsg.getParameter("storageHost").getValue();pageData.storageContext=soapMsg.getParameter("storageContext").getValue();pageData.storagePath=soapMsg.getParameter("storagePath").getValue();}
else
pageData.fault=soapMsg.getFault();}catch(e){pageData=null;}
cbfunc(pageData);}
Application.prototype.registerUser=function(first,last,email,pwd,pageOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"createUserX");soap.setParameter("pwd",Soap.PARAMETER_STRING,pwd);soap.setParameter("email",Soap.PARAMETER_STRING,email);soap.setParameter("updates",Soap.PARAMETER_STRING,"weekly");soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("createGroup",Soap.PARAMETER_BOOLEAN,"false");if(first!=null)
soap.setParameter("first",Soap.PARAMETER_STRING,first);if(last!=null)
soap.setParameter("last",Soap.PARAMETER_STRING,last);return this.processSoapRequest(soap,cbfunc,this.registerUserResponse);}
Application.prototype.registerUserResponse=function(soapMsg,cbfunc)
{var data=new Object();try{if(!soapMsg.isFault()){data.groupName=soapMsg.getParameter("groupName").getValue();data.userOid=parseInt(soapMsg.getParameter("userOid").getValue());}
else{data.groupName=null;data.userOid=parseInt("-1");data.fault=soapMsg.getFault();}}catch(e){data.fault=new Object();data.fault.detail="An exception occurred during registerUser: "+e.getMessage();}
cbfunc(data);}
Application.prototype.setPageReadOnly=function(groupOid,topicOid,pageOid,readonly,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"updateReadOnlyStatus");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("readonly",Soap.PARAMETER_BOOLEAN,readonly);return this.processSoapRequest(soap,cbfunc,this.setPageReadOnlyResponse);}
Application.prototype.setPageReadOnlyResponse=function(soapMsg,cbfunc)
{var pageData=null;try{if(!soapMsg.isFault()){pageData=new Object();pageData.groupOid=soapMsg.getParameter("groupOid").getValue();pageData.topicOid=soapMsg.getParameter("topicOid").getValue();pageData.pageOid=soapMsg.getParameter("pageOid").getValue();pageData.readonly=soapMsg.getParameter("readonly").getValue();pageData.status=soapMsg.getParameter("status").getValue();}}catch(e){pageData=null;}
cbfunc(pageData);}
Application.prototype.savePageStart=function(userOid,groupOid,pageOid,lockId,pageVersion,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"savePageStart");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);soap.setParameter("pageVersion",Soap.PARAMETER_INTEGER,pageVersion);return this.processSoapRequest(soap,cbfunc,this.savePageStartResponse);}
Application.prototype.savePageStartResponse=function(soapMsg,cbfunc)
{var pageData=null;try{if(!soapMsg.isFault()){pageData=new Object();pageData.info=soapMsg.getParameter("info").getValue();pageData.status=soapMsg.getParameter("status").getValue();pageData.lock=soapMsg.getParameter("lock").getValue();pageData.lockOwner=soapMsg.getParameter("lockowner").getValue();pageData.version=soapMsg.getParameter("version").getValue();pageData.serveralias=soapMsg.getParameter("serveralias").getValue();}}catch(e){pageData=null;}
cbfunc(pageData);}
Application.prototype.updatePageMetadata=function(host,userOid,groupOid,pageOid,lockId,html,title,changeList,thumbGenList,nextId,thumbnail,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"updatePage");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(title,true));soap.setParameter("nextobjectid",Soap.PARAMETER_INTEGER,nextId);soap.setParameter("changelist",Soap.PARAMETER_XML,changeList);soap.setParameter("thumbgenlist",Soap.PARAMETER_XML,xmlutils.encodeUTF(thumbGenList,true));soap.setParameter("thumbnail",Soap.PARAMETER_STRING,xmlutils.encodeUTF(thumbnail,true));soap.setParameter("html",Soap.PARAMETER_STRING,"<![CDATA["+html+"]]>");return this.processSoapRequestHost(host==null?location.host:host,soap,cbfunc,this.updatePageMetadataResponse);}
Application.prototype.updatePageMetadataResponse=function(soapMsg,cbfunc)
{var pageData=null;try{if(!soapMsg.isFault()){pageData=new Object();pageData.version=soapMsg.getParameter("version").getValue();}}catch(e){pageData=null;}
if(cbfunc!=null)
cbfunc(pageData);else
return pageData;}
Application.prototype.getViewDetails=function(userOid,groupOid,pageOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"getViewDetails");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);return this.processSoapRequest(soap,cbfunc,this.getViewDetailsResponse);}
Application.prototype.getViewDetailsResponse=function(soapMsg,cbfunc)
{var pageData=null;try{if(!soapMsg.isFault()){pageData=new Object();pageData.status=soapMsg.getParameter("status").getValue();pageData.details=soapMsg.getParameter("viewdetails").getValue();}}catch(e){pageData=null;}
cbfunc(pageData);}
Application.prototype.releasePageLock=function(userOid,groupOid,pageOid,lockId,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"releaseLock");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);return this.processSoapRequest(soap,cbfunc,this.releasePageLockResponse);}
Application.prototype.releasePageLockResponse=function(soapMsg,cbfunc)
{var ret=false;try{if(!soapMsg.isFault()){var status=soapMsg.getParameter("status").getValue();if(status=="ok")
ret=true;}}catch(e){ret=false;}
cbfunc(ret);}
Application.prototype.refreshPageLock=function(userOid,groupOid,pageOid,lockId,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"refreshLock");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);return this.processSoapRequest(soap,cbfunc,this.refreshPageLockResponse);}
Application.prototype.refreshPageLockResponse=function(soapMsg,cbfunc)
{var ret=false;try{if(!soapMsg.isFault()){var status=soapMsg.getParameter("status").getValue();var lock=soapMsg.getParameter("lock").getValue();if(status=="ok")
ret=true;}}catch(e){ret=false;}
cbfunc(ret);}
Application.prototype.releasePageSaveLock=function(userOid,groupOid,pageOid,lockId,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"releaseSaveLock");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("lockId",Soap.PARAMETER_INTEGER,lockId);return this.processSoapRequest(soap,cbfunc,this.releasePageSaveLockResponse);}
Application.prototype.releasePageSaveLockResponse=function(soapMsg,cbfunc)
{var status=true;try{if(soapMsg.isFault()){status=false;}
else{var s=soapMsg.getParameter("status").getValue();var lock=soapMsg.getParameter("lock").getValue();if(status!="ok")
status=false;}}catch(e){status=false;}
cbfunc(status);}
Application.prototype.renamePage=function(userOid,groupOid,topicOid,pageOid,newPageName,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"renamePage");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(newPageName,true));return this.processSoapRequest(soap,cbfunc,this.renamePageResponse);}
Application.prototype.renamePageResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.oid=soapMsg.getParameter("pageOid").getValue();pageData.groupOid=soapMsg.getParameter("groupOid").getValue();pageData.topicOid=soapMsg.getParameter("topicOid").getValue();pageData.name=soapMsg.getParameter("pageName").getValue();}
else{pageData.oid=-1;}}catch(e){pageData.oid=-1;}
cbfunc(pageData);}
Application.prototype.movePage=function(userOid,groupOid,topicOid,newTopicOid,pageOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"movePage");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("newTopicOid",Soap.PARAMETER_INTEGER,newTopicOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);return this.processSoapRequest(soap,cbfunc,this.movePageResponse);}
Application.prototype.movePageResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.oid=soapMsg.getParameter("pageOid").getValue();pageData.groupOid=soapMsg.getParameter("groupOid").getValue();pageData.topicOid=soapMsg.getParameter("topicOid").getValue();pageData.newTopicOid=soapMsg.getParameter("newTopicOid").getValue();}
else{pageData.oid=-1;}}catch(e){pageData.oid=-1;}
cbfunc(pageData);}
Application.prototype.deletePage=function(userOid,groupOid,topicOid,pageOid,title,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_CONTENT,"deletePage");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(title,true));return this.processSoapRequest(soap,cbfunc,this.deletePageResponse);}
Application.prototype.deletePageResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.oid=soapMsg.getParameter("pageOid").getValue();pageData.groupOid=soapMsg.getParameter("groupOid").getValue();pageData.topicOid=soapMsg.getParameter("topicOid").getValue();}
else{pageData.oid=-1;}}catch(e){pageData.oid=-1;}
cbfunc(pageData);}
Application.prototype.getUploadedWidgetInfo=function(host,context,pageOid,storagePathOid,pageVersion,objId,filename,cbfunc)
{var file=escape(filename);var soap=Soap.createSoapRequest(Application.SOAP_MODULE_RESOURCE,"getUploadedWidgetInfo");soap.setParameter("storagePathOid",Soap.PARAMETER_INTEGER,storagePathOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("pageVersion",Soap.PARAMETER_INTEGER,pageVersion);soap.setParameter("objId",Soap.PARAMETER_INTEGER,objId);soap.setParameter("filename",Soap.PARAMETER_STRING,xmlutils.encodeUTF(filename,true));return this.processSoapRequestHostPath(host,context,soap,cbfunc,this.getUploadedWidgetInfoResponse);}
Application.prototype.getUploadedWidgetInfoResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.errcode=soapMsg.getParameter("errcode").getValue();pageData.url=soapMsg.getParameter("url").getValue();pageData.urlmaster=soapMsg.getParameter("urlmaster").getValue();pageData.urlarchive=soapMsg.getParameter("urlarchive").getValue();pageData.name=soapMsg.getParameter("name").getValue();pageData.width=soapMsg.getParameter("width").getValue();pageData.height=soapMsg.getParameter("height").getValue();pageData.image=soapMsg.getParameter("image").getValue();pageData.objid=soapMsg.getParameter("objid").getValue();}
else{pageData.errcode=2;}}catch(e){pageData.errcode=2;}
cbfunc(pageData);}
Application.prototype.rotateNoJava=function(host,context,srcurl,rotation,pageOid,storagePathOid,objId,pageVersion,logicalName,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_RESOURCE,"rotateNoJava");soap.setParameter("storagePathOid",Soap.PARAMETER_INTEGER,storagePathOid);soap.setParameter("pageOid",Soap.PARAMETER_INTEGER,pageOid);soap.setParameter("pageVersion",Soap.PARAMETER_INTEGER,pageVersion);soap.setParameter("objId",Soap.PARAMETER_INTEGER,objId);soap.setParameter("srcurl",Soap.PARAMETER_STRING,xmlutils.encodeUTF(srcurl,true));soap.setParameter("rotation",Soap.PARAMETER_STRING,rotation);soap.setParameter("logname",Soap.PARAMETER_STRING,xmlutils.encodeUTF(logicalName,true));return this.processSoapRequestHostPath(host,context,soap,cbfunc,this.rotateNoJavaResponse);}
Application.prototype.rotateNoJavaResponse=function(soapMsg,cbfunc)
{var pageData=new Object();try{if(!soapMsg.isFault()){pageData.errcode=soapMsg.getParameter("errcode").getValue();pageData.url=soapMsg.getParameter("url").getValue();pageData.urlmaster=soapMsg.getParameter("urlmaster").getValue();}
else{pageData.errcode=2;}}catch(e){pageData.errcode=2;}
cbfunc(pageData);}
Application.prototype.createGroup=function(userOid,title,defaultTopic,type,perms,pwd,cbfunc,userData)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"createGroup");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(title,true));soap.setParameter("defaultTopic",Soap.PARAMETER_STRING,defaultTopic);soap.setParameter("type",Soap.PARAMETER_STRING,type);soap.setParameter("pwd",Soap.PARAMETER_STRING,pwd);return this.processSoapRequest(soap,cbfunc,this.createGroupResponse,userData);}
Application.prototype.createGroupResponse=function(soapMsg,cbfunc,userData)
{var obj=new Object();obj.groupOid=-1;try{if(!soapMsg.isFault()){obj.groupOid=parseInt(soapMsg.getParameter("groupOid").getValue());obj.defaultTopicOid=parseInt(soapMsg.getParameter("defaultTopicOid").getValue());obj.creationDate=parseInt(soapMsg.getParameter("creationDate").getValue());obj.modificationDate=parseInt(soapMsg.getParameter("modificationDate").getValue());}}catch(e){obj.groupOid=-1;}
cbfunc(obj,userData);}
Application.prototype.renameGroup=function(userOid,groupOid,newGroupName,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"renameGroup");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("name",Soap.PARAMETER_STRING,xmlutils.encodeUTF(newGroupName,true));return this.processSoapRequest(soap,cbfunc,this.renameGroupResponse);}
Application.prototype.renameGroupResponse=function(soapMsg,cbfunc)
{var groupData=new Object();try{if(!soapMsg.isFault()){groupData.oid=soapMsg.getParameter("groupOid").getValue();groupData.name=soapMsg.getParameter("name").getValue();}
else{groupData.oid=-1;}}catch(e){groupData.oid=-1;}
cbfunc(groupData);}
Application.prototype.createGroupMember=function(userOid,groupOid,type,value,perms,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"createGroupMember");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("type",Soap.PARAMETER_INTEGER,type);soap.setParameter("value",Soap.PARAMETER_STRING,value);soap.setParameter("permissions",Soap.PARAMETER_INTEGER,perms);return this.processSoapRequest(soap,cbfunc,this.createGroupMemberResponse);}
Application.prototype.createGroupMemberResponse=function(soapMsg,cbfunc)
{var obj=new Object();obj.oid=-1;try{if(soapMsg.isFault()){obj.oid=-1;obj.fault=soapMsg.getFault();}
else{obj.oid=parseInt(soapMsg.getParameter("groupMemberOid").getValue());obj.member=soapMsg.getParameter("groupMember").getValue();}}catch(e){obj.oid=-1;obj.fault=null;}
cbfunc(obj);}
Application.prototype.deleteGroupMember=function(groupOid,oid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"deleteGroupMember");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("groupMemberOid",Soap.PARAMETER_INTEGER,oid);return this.processSoapRequest(soap,cbfunc,this.deleteGroupMemberResponse,cbfunc);}
Application.prototype.deleteGroupMemberResponse=function(soapMsg,cbfunc)
{var oid=-1;try{if(!soapMsg.isFault())
oid=parseInt(soapMsg.getParameter("groupMemberOid").getValue());}catch(e){oid=-1;}
cbfunc(oid);}
Application.prototype.updateGroupMember=function(groupOid,oid,typ,name,permissions,status,update,cbfunc,userData)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"updateGroupMember");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("groupMemberOid",Soap.PARAMETER_INTEGER,oid);soap.setParameter("type",Soap.PARAMETER_INTEGER,typ);soap.setParameter("permissions",Soap.PARAMETER_INTEGER,permissions);soap.setParameter("update",Soap.PARAMETER_INTEGER,update);return this.processSoapRequest(soap,cbfunc,this.updateGroupMemberResponse,cbfunc,userData);}
Application.prototype.updateGroupMemberResponse=function(soapMsg,cbfunc,userData)
{var obj=new Object();obj.oid=-1;try{if(!soapMsg.isFault()){obj.oid=parseInt(soapMsg.getParameter("groupMemberOid").getValue());obj.member=soapMsg.getParameter("groupMember").getValue();}}catch(e){obj.oid=-1;}
cbfunc(obj,userData);}
Application.prototype.retrieveGroupInvite=function(oid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"getGroupInvite");soap.setParameter("groupMemberOid",Soap.PARAMETER_INTEGER,oid);return this.processSoapRequest(soap,cbfunc,this.retrieveGroupInviteResponse);}
Application.prototype.retrieveGroupInviteResponse=function(soapMsg,cbfunc)
{var obj=new Object();obj.groupMember=null;obj.userIdentities=null;try{if(!soapMsg.isFault()){obj.groupMember=soapMsg.getParameter("groupMember").getValue();obj.userIdentities=soapMsg.getParameter("userIdentities").getValue();}}catch(e){obj.groupMember=null;obj.userIdentities=null;}
cbfunc(obj);}
Application.prototype.retrieveGroupInfo=function(oid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"getGroupInformation");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,oid);return this.processSoapRequest(soap,cbfunc,this.retrieveGroupInfoResponse);}
Application.prototype.retrieveGroupInfoResponse=function(soapMsg,cbfunc)
{var groupInfo=null;try{if(!soapMsg.isFault()){groupInfo=soapMsg.getParameter("groupInfo").getValue();}}catch(e){groupInfo=null;}
cbfunc(groupInfo);}
Application.prototype.retrieveGroupContents=function(userOid,groupOid,timestamp,cbfunc,userData)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"getGroupContents");soap.setParameter("userOid",Soap.PARAMETER_INTEGER,userOid);soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("timestamp",Soap.PARAMETER_LONG,((timestamp!=null)?timestamp.getTime():-1));return this.processSoapRequest(soap,cbfunc,this.retrieveGroupContentsResponse,userData);}
Application.prototype.retrieveGroupContentsResponse=function(soapMsg,cbfunc,userData)
{var oid=-1;var info=null;try{if(!soapMsg.isFault()){oid=soapMsg.getParameter("groupOid").getValue();var x=soapMsg.getParameter("groupInfo");info=(x==null)?null:x.getValue();}
else
oid=-1;}catch(e){oid=-1;}
cbfunc(oid,info,userData);}
Application.prototype.createTopic=function(title,groupOid,parentTopicOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"createTopic");soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(title,true));soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("parentOid",Soap.PARAMETER_INTEGER,parentTopicOid);return this.processSoapRequest(soap,cbfunc,this.createTopicResponse);}
Application.prototype.createTopicResponse=function(soapMsg,cbfunc)
{var topicData=new Object();try{if(!soapMsg.isFault()){topicData.oid=soapMsg.getParameter("topicOid").getValue();topicData.name=soapMsg.getParameter("topicName").getValue();topicData.parentOid=soapMsg.getParameter("parentOid").getValue();topicData.groupOid=soapMsg.getParameter("groupOid").getValue();}
else{topicData.oid=-1;}}catch(e){topicData.oid=-1;}
cbfunc(topicData);}
Application.prototype.renameTopic=function(groupOid,topicOid,newTopicName,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"renameTopic");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);soap.setParameter("title",Soap.PARAMETER_STRING,xmlutils.encodeUTF(newTopicName,true));return this.processSoapRequest(soap,cbfunc,this.renameTopicResponse);}
Application.prototype.renameTopicResponse=function(soapMsg,cbfunc)
{var topicData=new Object();try{if(!soapMsg.isFault()){topicData.oid=soapMsg.getParameter("topicOid").getValue();topicData.name=soapMsg.getParameter("topicName").getValue();topicData.groupOid=soapMsg.getParameter("groupOid").getValue();}}catch(e){topicData.oid=-1;}
cbfunc(topicData);}
Application.prototype.deleteTopic=function(groupOid,topicOid,cbfunc)
{var soap=Soap.createSoapRequest(Application.SOAP_MODULE_USER,"deleteTopic");soap.setParameter("groupOid",Soap.PARAMETER_INTEGER,groupOid);soap.setParameter("topicOid",Soap.PARAMETER_INTEGER,topicOid);return this.processSoapRequest(soap,cbfunc,this.deleteTopicResponse);}
Application.prototype.deleteTopicResponse=function(soapMsg,cbfunc)
{var topicData=new Object();try{if(!soapMsg.isFault()){topicData.oid=soapMsg.getParameter("topicOid").getValue();topicData.groupOid=soapMsg.getParameter("groupOid").getValue();}
else{topicData.oid=-1;}}catch(e){topicData.oid=-1;}
cbfunc(topicData);}
Group.FILTER_PAGES_NONE=parseInt("0");Group.FILTER_PAGES_ALL=parseInt("-1");Group.FILTER_PAGES_MOST_POPULAR=parseInt("-2");Group.FILTER_PAGES_RECENTLY_CHANGED=parseInt("-3");Group.FILTER_PAGES_NEWEST=parseInt("-4");Group.prototype._oid;Group.prototype._title;Group.prototype._owner;Group.prototype._creation;Group.prototype._modification;Group.prototype._type;Group.prototype._pwd;Group.prototype._permissions;Group.prototype._location;Group.prototype._topics;Group.prototype._members;function Group(oid,title,owner,cdate,mdate,type,pwd,perm)
{this._oid=parseInt(oid);this._title=title;this._owner=owner;if(cdate!=-1)
this._creation=new Date(parseInt(cdate));else
this._creation=null;if(mdate!=-1)
this._modification=new Date(parseInt(mdate));else
this._modification=null;this._type=type;this._pwd=pwd;this._permissions=parseInt(perm);this._topics=null;this._members=new Array(0);}
Group.createGroupList=function(xmlstr)
{var idx=0;var end_idx=null;var list=new Array();while((idx=xmlstr.indexOf("<group>",idx))!=-1){end_idx=xmlstr.indexOf("</group>",idx+7);var str=xmlstr.substring(idx,end_idx+8);list.push(Group.createInstance(str));idx=end_idx+8;}
return list;}
Group.createInstance=function(xmlstr)
{var g=new Group();var ms=null;var env=null;var elem=null;try{if(typeof xmlstr=="string"){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}
else
env=xmlstr;for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(elem.nodeName){case'oid':g._oid=parseInt(val);break;case'title':g._title=val;break;case'owner':g._owner=parseInt(val);break;case'creation':if((ms=parseInt(val))==0)
g._creation=null;else{g._creation=new Date();g._creation.setTime(ms);}
break;case'modification':if((ms=parseInt(val))==0)
g._modification=null;else{g._modification=new Date();g._modification.setTime(ms);}
break;case'type':g._type=val;break;case'password':g._pwd=val;break;case'permissions':g._permissions=val;break;case'location':g._location=val;break;default:break;}}
g._topics=null;return g;}
catch(e){alert("Exception in Group.createInstance: "+e);return null;}}
Group.sort=function(g1,g2)
{var t1=g1.getTitle();var t2=g2.getTitle();if(t1==null)
return 1;else if(t2==null)
return-1;else
return t1.localeCompare(t2);}
Group.getGroup=function(glist,oid)
{try{var o=parseInt(oid);for(var i=0;i<glist.length;i++)
{if(glist[i].getOid()==oid)
return glist[i];}
return null;}
catch(e){return null;}}
Group.prototype.addTopic=function(topic)
{var parentTopic=this.getTopic(topic.getParentOid());if(parentTopic!=null){parentTopic.appendChild(topic);return true;}
else
return false;}
Group.prototype.addMember=function(member)
{var members=this._members;members[members.length]=member;}
Group.prototype.deleteMember=function(member)
{var members=this._members;for(var i=0;i<members.length;i++){var m=members[i];if(m.isEqual(member)){members.splice(i,1);return true;}}
return false;}
Group.prototype.clear=function()
{delete this._topics;delete this._members;this._topics=new Array();this._members=new Array();}
Group.prototype.createMembers=function(elem)
{try{var members=elem.getElementsByTagName("members");for(var member=elem.firstChild;member!=null;member=member.nextSibling)
{var m=Member.createInstance(member);this._members[this._members.length]=m;}
return true;}catch(e){return false;}}
Group.prototype.createStoragePaths=function(elem)
{var paths=new Array();try{var iPath=0;for(var path=elem.firstChild;path!=null;path=path.nextSibling)
{var storagePath=StoragePath.createInstance(path);if(storagePath!=null)
paths[iPath++]=storagePath;}
return paths;}catch(e){return paths;}}
Group.prototype.createPages=function(elem,paths)
{try{for(var page=elem.firstChild;page!=null;page=page.nextSibling)
{var p=PageX.createInstance(page);for(var i=0;i<paths.length;i++){if(paths[i].getOid()==p.getStoragePathOid())
p.setStoragePath(paths[i]);}
topic=Tree.find(Tree.TREE,this._topics,p.getTopicOid());if(topic!=null)
topic.addPage(p);}
return true;}catch(e){return false;}}
Group.prototype.createTopics=function(elem)
{var list=new Array();try{for(var topic=elem.firstChild;topic!=null;topic=topic.nextSibling){list.push(Topic.createInstance(topic));}
this._topics=new Topic(0,this._oid,"root",0);Tree.findChildren(list,this._topics);return true;}catch(e){return false;}}
Group.prototype.deleteTopic=function(topicOid)
{return Tree.remove(Tree.TREE,this._topics,topicOid);}
Group.prototype.getMemberList=function()
{return this._members;}
Group.prototype.getOid=function()
{return this._oid;}
Group.prototype.getName=function(){return this._title;}
Group.prototype.getTitle=function()
{return this._title;}
Group.prototype.getOwner=function()
{return this._owner;}
Group.prototype.getModificationDate=function()
{return this._modification;}
Group.prototype.getLocation=function()
{return this._location;}
Group.prototype.getTopics=function(recursive)
{var list=new Array(0);Tree.traverse(Tree.TREE,this._topics,Group.alltopics,list);return list;}
Group.prototype.getTopic=function(oid)
{return Tree.find(Tree.TREE,this._topics,oid);}
Group.prototype.getTopicByTitle=function(title)
{return Tree.find(Tree.TREE,this._topics,title,"title");}
Group.prototype.getDefaultTopic=function()
{return Tree.find(Tree.TREE,this._topics,0,"default");}
Group.prototype.setTitle=function(title)
{this._title=title;}
Group.prototype.update=function(groupData)
{this.clear();xmlutils.loadXml(xmlutils.dom,groupData);var env=xmlutils.dom.documentElement;var paths=null;for(var elem=env.firstChild;elem!=null;elem=elem.nextSibling){switch(elem.nodeName){case'members':this.createMembers(elem);break;case'storagePaths':paths=this.createStoragePaths(elem);break;case'topics':this.createTopics(elem);break;case'pages':this.createPages(elem,paths);break;default:break;}}}
Group.prototype.getPages=function(topicOid)
{var list=new Array(0);if(topicOid!=-1){var topic=this.getTopic(topicOid);Group.allpages(topic,list);}
else{Tree.traverse(Tree.TREE,this._topics,Group.allpages,list);}
return list;}
Group.prototype.getPage=function(pageOid)
{var list=new Array(0);Tree.traverse(Tree.TREE,this._topics,Group.allpages,list);var pg=null;for(var i=0;i<list.length;i++){if(list[i].getOid()==pageOid)
return list[i];}
return null;}
Group.prototype.getMostPopularPages=function(topicOid,howmany)
{var list=new Array(howmany);var i=null;for(i=0;i<list.length;i++)
list[i]=null;if(topicOid!=-1){var topic=this.getTopic(topicOid);Group.mostViewed(topic,list);}
else{Tree.traverse(Tree.TREE,this._topics,Group.mostViewed,list);}
for(i=0;i<list.length;i++){if(list[i]==null)
break;}
list.length=i;return list;}
Group.prototype.getRecentlyChangedPages=function(topicOid,lastDate)
{var list=new Array();var mdate=null;var pages=this.getPages(topicOid);for(var j=0;j<pages.length;j++){mdate=pages[j].getModificationDate();if(mdate.getTime()>=lastDate.getTime())
list[list.length]=pages[j];}
return list;}
Group.mostViewed=function(topic,list)
{var pages=topic.getPages();var i=0;var j=0;if(pages!=null){for(i=0;i<pages.length;i++){var page=pages[i];var vc=parseInt(page.getViewCount());var inserted=false;for(j=0;j<list.length;j++)
{if(list[j]==null)
break;var listvc=parseInt(list[j].getViewCount());if(vc>=listvc){arrayUtils.insertAt(list,j,page);inserted=true;break;}}
if(inserted==false)
list[j]=page;}}}
Group.allpages=function(topic,list)
{var pages=topic.getPages();if(pages!=null){for(var i=0;i<pages.length;i++){var status=pages[i].getStatus();if(status!=null&&status=="deleted")
continue;list[list.length]=pages[i];}}}
Group.alltopics=function(topic,list)
{if(topic.isRoot()==false)
list[list.length]=topic;}
Member.TYPE_REGISTERED_USER=parseInt("0x0001");Member.TYPE_EMAIL=parseInt("0x0002");Member.TYPE_URL=parseInt("0x0004");Member.UPDATE_DAILY=parseInt("0x0008");Member.UPDATE_WEEKLY=parseInt("0x0010");Member.prototype._oid
Member.prototype._groupOid;Member.prototype._type;Member.prototype._permissions;Member.prototype._status;Member.prototype._email;Member.prototype._registeredUserName;Member.prototype._registeredUserOid;Member.prototype._update;Member.prototype._lastEdit;Member.prototype._filesContributed;function Member(oid,groupOid,type,value,permissions,status)
{this._oid=oid;this._groupOid=groupOid;this._type=parseInt("-1");this._permissions=permissions;this._status=status;if(typeof type=="string")
this._type=parseInt(type);else if(typeof type=="number")
this._type=type;if(this._type==Member.TYPE_REGISTERED_USER)
this._registeredUserName=value;else if(this._type==Member.TYPE_EMAIL)
this._email=value;this._filesContributed=Math.round(5000*Math.random());var now=new Date();var dateInMS=now.getTime()-(Math.round(1000*60*60*24*30*Math.random()));this._lastEdit=new Date(dateInMS);}
Member.createInstance=function(xml)
{var m=new Member();var env=null;var elem=null;try{if(typeof xml=="string"){xmlutils.loadXml(xmlutils.dom,xml);env=xmlutils.dom.documentElement;}
else
env=xml;for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(elem.nodeName){case'oid':m._oid=val;break;case'groupOid':m._groupOid=val;break;case'type':m._type=parseInt(val);break;case'permissions':m._permissions=val;break;case'status':m._status=parseInt(val);break;default:break;}}
if(m._type==Member.TYPE_REGISTERED_USER){elem=env.getElementsByTagName("registeredUserName").item(0);m._registeredUserName=xmlutils.getNodeText(elem);elem=env.getElementsByTagName("registeredUserOid").item(0);m._registeredUserOid=parseInt(xmlutils.getNodeText(elem));elem=env.getElementsByTagName("updates").item(0);m._update=xmlutils.getNodeText(elem);elem=env.getElementsByTagName("preferences").item(0);elem=env.getElementsByTagName("email").item(0);m._email=xmlutils.getNodeText(elem);}
else if(m._type==Member.TYPE_EMAIL){elem=env.getElementsByTagName("email").item(0);m._email=xmlutils.getNodeText(elem);}
else if(m._type==Member.TYPE_URL){elem=env.getElementsByTagName("url").item(0);}
this._filesContributed=Math.round(5000*Math.random());var now=new Date();var dateInMS=now.getTime()-(Math.round(1000*60*60*24*30*Math.random()));this._lastEdit=new Date(dateInMS);return m;}catch(e){alert("Member.createInstance: "+e);return null;}}
Member.prototype.formatDate=function(d)
{var str="";var month=d.getMonth()+1;var day=d.getDate();var year=d.getFullYear();if(month<10)
str+="0";str+=month+"/";if(day<10)
str+="0";str+=day+"/"+year;return str;}
Member.prototype.getData=function(columnId,clientData)
{var lc=null;var dataValue=null;if(columnId=="delete"){if((this._type==Member.TYPE_REGISTERED_USER)&&(clientData.getOwner()==this._registeredUserOid))
lc=new ListCell(ListCell.TYPE_STRING,"");else
lc=new ListCell(ListCell.TYPE_STRING,"Delete");}
else if(columnId=="memberstatus"){if(this._status==1||this._type==Member.TYPE_EMAIL)
dataValue="pending";else if(this._type==Member.TYPE_REGISTERED_USER)
dataValue="active";lc=new ListCell(ListCell.TYPE_STRING,dataValue);}
else if(columnId=="email"){if((this._type==Member.TYPE_REGISTERED_USER)||(this._type==Member.TYPE_EMAIL)){dataValue=this._email;if(this._type==Member.TYPE_REGISTERED_USER){if(clientData.getOwner()==this._registeredUserOid)
dataValue+=" *";}}
else
dataValue="---";lc=new ListCell(ListCell.TYPE_STRING,dataValue);}
else if(columnId=="type"){var t=null;if(this._type==Member.TYPE_REGISTERED_USER)
t="user";else if(this._type==Member.TYPE_EMAIL)
t="email";else if(this._type==Member.TYPE_URL)
t="url";lc=new ListCell(ListCell.TYPE_STRING,t);}
else if(columnId=="permissions"){switch(this._status){case 2:var str1=(this._permissions&2)!=0?'<img src="images/readactive.gif">':'<img src="images/readdisabled.gif">'
var str2=(this._permissions&13)!=0?'<img src="images/writeactive.gif">':'<img src="images/writedisabled.gif">'
lc=new ListCell(ListCell.TYPE_CONTAINER,str1+str2);break;case 1:lc=new ListCell(ListCell.TYPE_STRING,"PENDING");break;case 3:lc=new ListCell(ListCell.TYPE_STRING,"INACTIVE");break;default:lc=new ListCell(ListCell.TYPE_STRING,"UNKNOWN");break;}}
else if(columnId=="updates"){var t1="";if(this._type==Member.TYPE_REGISTERED_USER&&this._status==2)
t1=this._update;lc=new ListCell(ListCell.TYPE_STRING,t1);}
else if(columnId=="lastEdit"){var strx=(this._status==2)?this.formatDate(this._lastEdit):"";lc=new ListCell(ListCell.TYPE_STRING,strx);}
else if(columnId=="filesContributed"){if(this._status!=2)
lc=new ListCell(ListCell.TYPE_STRING,"");else
lc=new ListCell(ListCell.TYPE_NUMBER,this._filesContributed);}
else if(columnId=="allowwrite"){switch(this._status){case 2:case 1:lc=new ListCell(ListCell.TYPE_STRING,(this._permissions&13)!=0?"yes":"no");break;default:lc=new ListCell(ListCell.TYPE_STRING,"no");break;}}
return lc;}
Member.prototype.getOid=function()
{return this._oid;}
Member.prototype.getMemberStatus=function()
{return this._status;}
Member.prototype.isEqual=function(m)
{if(this._groupOid==m._groupOid&&this._type==m._type&&this._value==m._value){return true;}
else
return false;}
MsgCatalog.prototype._locale;MsgCatalog.prototype._messages;function MsgCatalog(locale)
{this._locale=locale;this._messages=new Object();}
MsgCatalog.prototype.addMessage=function(name,value)
{this._messages[name]=value;}
MsgCatalog.prototype.loadCatalog=function(data)
{var dom=xmlutils.getXMLDocument();xmlutils.loadXml(dom,data);var msgs=dom.getElementsByTagName("msg");for(var i=0;i<msgs.length;i++){var msg=msgs.item(i);var id=msg.getAttribute("id");var val=xmlutils.getNodeText(msg);this.addMessage(id,val);}}
MsgCatalog.prototype.getMessage=function(name)
{return this._messages[name];}
PageX.THUMBNAIL_UNAVAILABLE="images/homepage/thumbnail_unavailable.jpg";PageX.prototype._oid;PageX.prototype._title;PageX.prototype._topic;PageX.prototype._thumbnail;PageX.prototype._owner;PageX.prototype._group;PageX.prototype._creationDate;PageX.prototype._modificationDate;PageX.prototype._lastViewed;PageX.prototype._viewcount;PageX.prototype._editcount;PageX.prototype._latestEdit;PageX.prototype._latestView;PageX.prototype._status;PageX.prototype._readonly;PageX.prototype._storagePath;PageX.prototype._storagePathOid;function PageX(title,oid,owner,group,topic,create,modify,status,lastViewed,viewcount,editcount,latestEdit,latestView)
{this._oid=oid;this._title=title;this._thumbnail=PageX.THUMBNAIL_UNAVAILABLE;this._owner=owner;this._group=group;this._topic=topic;this._creationDate=new Date(parseInt(create));this._modificationDate=new Date(parseInt(modify));this._status=status;this._readonly=false;this._lastViewed=lastViewed;this._viewcount=viewcount;this._editcount=editcount;this._latestEdit=latestEdit;this._latestView=latestView;this._storagePath=null;this._storagePathOid=-1;}
PageX.createInstance=function(xmlstr)
{var p=new PageX();var ms=null;var env=null;var summary=null;var elem=null;try{if(typeof xmlstr=="string"){if(xmlstr!=null){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}}
else
env=xmlstr;for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(elem.nodeName){case'title':p._title=val;break;case'oid':p._oid=parseInt(val);break;case'thumbnail':p._thumbnail=val;break;case'owneroid':p._owner=parseInt(val);break;case'groupoid':p._group=parseInt(val);break;case'topicoid':p._topic=parseInt(val);break;case'storagePathOid':p._storagePathOid=parseInt(val);break;case'created':ms=parseInt(val);p._creationDate=(ms==0)?null:new Date(ms);break;case'modified':ms=parseInt(val);p._modificationDate=(ms==0)?null:new Date(ms);break;case'viewed':ms=parseInt(val);p._lastViewed=(ms==0)?null:new Date(ms);break;case'status':p._status=val;break;case'readonly':p._readonly=(val=='true')?true:false;break;case'summary':summary=elem;break;default:break;}}
if(summary!=null)
{if((elem=summary.getElementsByTagName("views").item(0))!=null)
p._viewcount=parseInt(xmlutils.getNodeText(elem));if((elem=summary.getElementsByTagName("edits").item(0))!=null)
p._editcount=parseInt(xmlutils.getNodeText(elem));if((elem=summary.getElementsByTagName("version"))!=null)
p._latestEdit=PageVersion.createInstance(xmlutils.getNodeText(elem));if((elem=summary.getElementsByTagName("view").item(0))!=null)
p._latestView=PageView.createInstance(xmlutils.getNodeText(elem));}
return p;}catch(e){alert("Page.createInstance: "+e);}}
PageX.prototype.getCreationDate=function(){return this._creationDate;}
PageX.getGridTitleMostPopular=function(pageObj)
{var str=pageObj.getTitle()+"&nbsp;("+pageObj.getViewCount()+")";return str;}
PageX.getGridTitleRecentlyChanged=function(pageObj)
{var str=pageObj.getTitle()+"&nbsp;("+pageObj.getModificationDate()+")";return str;}
PageX.prototype.getGroupOid=function(){return this._group;}
PageX.prototype.getStoragePathOid=function(){return this._storagePathOid;}
PageX.prototype.getModificationDate=function(){return this._modificationDate;}
PageX.prototype.getName=function(){return this.getTitle();}
PageX.prototype.getOid=function(){return this._oid;}
PageX.prototype.getOwner=function(){return this._owner;}
PageX.prototype.getReadOnly=function(){return this._readonly;}
PageX.prototype.getStatus=function(){return this._status;}
PageX.prototype.getThumbnail=function(){return this._thumbnail;}
PageX.prototype.getTitle=function(){return this._title;}
PageX.prototype.getTopicOid=function(){return this._topic;}
PageX.prototype.getViewCount=function(){return this._viewcount;}
PageX.prototype.getViewedDate=function(){return this._lastViewed;}
PageX.prototype.getEditCount=function(){return this._editCount;}
PageX.prototype.getLatestEdit=function(){return this._latestEdit;}
PageX.prototype.getLatestView=function(){return this._latestView;}
PageX.prototype.getStoragePath=function(){return this._storagePath;}
PageX.prototype.setStoragePath=function(val){this._storagePath=val;}
PageX.prototype.setReadOnly=function(val){this._readonly=val;}
PageX.prototype.setThumbnail=function(val){this._thumbnail=val;}
PageX.prototype.setTitle=function(val){this._title=val;}
PageX.prototype.setViewedDate=function(val)
{try{this._lastViewed=new Date(val);}catch(e){this._lastViewed=null;}}
PageX.sortByCreationDate=function(p1,p2)
{if(p1._creationDate==null)
return-1;if(p2._creationDate==null)
return 1;p1_ms=p1._creationDate.getTime();p2_ms=p2._creationDate.getTime();if(p1_ms==p2_ms)
return p1.getTitle().localeCompare(p2.getTitle());else
return(p1_ms>p2_ms)?1:-1;}
PageX.sortByModificationDate=function(p1,p2)
{if(p1._modificationDate==null)
return-1;if(p2._modificationDate==null)
return 1;p1_ms=p1._modificationDate.getTime();p2_ms=p2._modificationDate.getTime();if(p1_ms==p2_ms)
return p1.getTitle().localeCompare(p2.getTitle());else
return(p1_ms>p2_ms)?-1:1;}
PageX.sortByMostPopular=function(p1,p2)
{var p1_vc=p1.getViewCount();var p2_vc=p2.getViewCount();if(p1_vc==null)
return-1;if(p2_vc==null)
return 1;if(p1_vc==p2_vc)
return p1.getTitle().localeCompare(p2.getTitle());else
return(p1_vc>p2_vc)?-1:1;}
PageX.sortByTitle=function(p1,p2)
{var t1=p1.getTitle();var t2=p2.getTitle();if(t1==null)
return-1;if(t2==null)
return 1;return t1.localeCompare(t2);}
PageX.sortRecordSet=function(recordset,sortType)
{var sortfunc=PageX.sortByTitle;switch(sortType){case'orderCreated':sortfunc=PageX.sortByCreationDate;break;case'mostPopular':sortfunc=PageX.sortByMostPopular;break;case'recentlyChanged':sortfunc=PageX.sortByModificationDate;break;case'title':sortfunc=PageX.sortByTitle;break;default:break;}
recordset._data.sort(sortfunc);}
PageDetail.counter=0;PageDetail.objects=null;PageDetail.prototype._id;PageDetail.prototype._dimensions;PageDetail.prototype._colors;PageDetail.prototype._title;PageDetail.prototype._subtitle;PageDetail.prototype._page;PageDetail.prototype._cbfunc;PageDetail.prototype._thumbnail;PageDetail.prototype._titleWidget;PageDetail.prototype._subtitleWidget;PageDetail.prototype._advancedWidget;PageDetail.prototype._readonlyWidget;PageDetail.prototype._readonlyCheckBoxWidget;PageDetail.prototype._detailContainerWidget;PageDetail.prototype._ownerWidget;PageDetail.prototype._bottomContainerWidget;PageDetail.prototype._sharePageWidget;PageDetail.prototype._viewPageWidget;function PageDetail(title,dimensions,colors,cbfunc)
{this._id="pageDetail_"+PageDetail.counter++;this._dimensions=dimensions;this._title=title;this._subtitle="";this._colors=colors;this._page=null;this._cbfunc=cbfunc;this._thumbnail=null;this._titleWidget=null;this._subtitleWidget=null;this._advancedWidget=null;this._readonlyWidget=null;this._readonlyCheckBoxWidget=null;this._detailContainerWidget=null;this._ownerWidget=null;this._bottomContainerWidget=null;this._sharePageWidget=null;this._viewPageWidget=null;}
PageDetail.createInstance=function(title,dimensions,colors,cbfunc)
{var pd=new PageDetail(title,dimensions,colors,cbfunc);if(PageDetail.objects==null)
PageDetail.objects=new Object();PageDetail.objects[pd._id]=pd;return pd;}
PageDetail.getInstance=function(id)
{return PageDetail.objects[id];}
PageDetail.handleClick=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var id=target.getAttribute('widgetid');var op=target.getAttribute('op');var pd=PageDetail.getInstance(id);if(pd._cbfunc!=null)
pd._cbfunc(op,pd._page);}
PageDetail.handleLoadedImage=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getCurrentTarget(evt);var id=target.getAttribute('widgetid');var pd=PageDetail.getInstance(id);pd.loadThumbnail();}
PageDetail.handleErrorImage=function(e)
{if(this.src.indexOf('pagethumb.jpg')!=-1){var evt=EventUtils.getEvent(e);var target=EventUtils.getCurrentTarget(evt);var st=target.getAttribute('secondaryThumbnail');var loc=target.getAttribute('storageLocation');this.src=loc+st;}else{this.src=PageX.THUMBNAIL_UNAVAILABLE;}}
PageDetail.prototype.redraw=function()
{var parent=this._thumbnail.parentNode;parent.removeChild(this._thumbnail);this._thumbnail=document.createElement('img');parent.appendChild(this._thumbnail);if(this._page==null||this._page==undefined)
{this._ownerWidget.innerHTML="";this._viewPageWidget.innerHTML='';this._sharePageWidget.innerHTML='';this._advancedWidget.style.visibility='hidden';this._readonlyWidget.style.visibility='hidden';this._readonlyCheckBoxWidget.style.visibility='hidden';this._thumbnail.src=PageX.THUMBNAIL_UNAVAILABLE;}
else{var d=this._page.getModificationDate();this._ownerWidget.innerHTML='&nbsp;Total Views:&nbsp;'+this._page.getViewCount();this._sharePageWidget.innerHTML='Share Page';this._viewPageWidget.innerHTML='View Page';this._advancedWidget.style.visibility='visible';this._readonlyWidget.style.visibility='visible';this._readonlyCheckBoxWidget.style.visibility='visible';this.setReadOnly(this._page.getReadOnly());var groupOwner=Group.getGroup(groups,this._page._group).getOwner();if(this._page._owner==user.getOid()||groupOwner==user.getOid())
this._readonlyCheckBoxWidget.disabled=false;else
this._readonlyCheckBoxWidget.disabled=true;this._thumbnail.style.visiblity='hidden';this._thumbnail.onerror=PageDetail.handleErrorImage;var idx=this._page.getThumbnail().lastIndexOf("/");var thumbpath=this._page.getThumbnail().substring(0,idx);this._thumbnail.src=thumbpath+'/pagethumb.jpg';this._thumbnail.setAttribute('widgetid',this._id);this._thumbnail.setAttribute('op','editro');this._thumbnail.setAttribute('secondaryThumbnail',this._page.getThumbnail());this._thumbnail.setAttribute('storageLocation',this.getStorageLocation(this._page));this._thumbnail.style.cursor='pointer';this._thumbnail.onload=PageDetail.handleLoadedImage;this._thumbnail.onclick=PageDetail.handleClick;}
if(this._thumbnail.complete==true)
this.loadThumbnail();}
PageDetail.prototype.setColors=function(colors)
{if(colors!=null){this._colors=colors;this._detailContainerWidget.style.backgroundColor=this._colors.backgroundColor;this._bottomContainerWidget.style.backgroundColor=this._colors.footerColor;this._titleWidget.style.color=this._colors.titleColor;this._subtitleWidget.style.color=this._colors.subtitleColor;this._ownerWidget.style.color=this._colors.textColor;this._advancedWidget.style.color=this._colors.textColor;this._sharePageWidget.style.color=this._colors.textColor;this._viewPageWidget.style.color=this._colors.textColor;this._readonlyWidget.style.color=this._colors.textColor;}}
PageDetail.prototype.setData=function(p)
{this._page=p;this.redraw();}
PageDetail.prototype.setReadOnly=function(ro)
{if(ro==true||ro=="true")
this._readonlyCheckBoxWidget.checked=false;else
this._readonlyCheckBoxWidget.checked=true;}
PageDetail.prototype.setSubtitle=function(str)
{this._subtitle=str;if(this._subtitle!=null)
this._subtitleWidget.innerHTML=this._subtitle;}
PageDetail.prototype.toHtml=function(parent,top,left)
{var container=document.createElement('div');container.style.position='absolute';container.style.height=this._dimensions.totalHeight+'px';container.style.width=this._dimensions.totalWidth+'px';container.style.top=top+'px';container.style.left=left+'px';parent.appendChild(container);this.buildTitle(container);this.buildData(container);this.buildInputField(container);return container;}
PageDetail.prototype.buildTitle=function(container)
{var adj=(dhtmlapi.isIE==true)?2:0;var c1=document.createElement('div');c1.style.top='0px';c1.style.left='0px';c1.style.height=this._dimensions.titleHeight+'px';c1.style.width=this._dimensions.totalWidth+'px';c1.style.textAlign='center';c1.style.marginTop='auto';c1.style.marginBottom='auto';this._titleWidget=document.createElement('div');this._titleWidget.className='listViewTitle';this._titleWidget.innerHTML=this._title;this._titleWidget.style.color=this._colors.titleColor;this._titleWidget.style.paddingTop=(12+adj)+'px';this._titleWidget.style.height='auto';this._titleWidget.style.marginBottom='auto';c1.appendChild(this._titleWidget);this._subtitleWidget=document.createElement('div');this._subtitleWidget.className='listViewSubtitle';this._subtitleWidget.innerHTML="";this._subtitleWidget.style.color=this._colors.subtitleColor;c1.appendChild(this._subtitleWidget);container.appendChild(c1);}
PageDetail.prototype.buildData=function(container)
{var c1=document.createElement('div');c1.style.top=this._dimensions.titleHeight+'px';c1.style.left='0px';c1.style.height=this._dimensions.listHeight+'px';c1.style.width=(this._dimensions.totalWidth-3)+'px';c1.style.paddingLeft='3px';c1.style.overflowX='hidden';c1.style.overflowY='hidden';c1.style.backgroundColor=this._colors.backgroundColor;container.appendChild(c1);var width=dhtmlapi.getObjectWidth(c1);var thumbnail_width=parseInt(width*0.80);var sp=parseInt((width-thumbnail_width)/2);var obj=document.createElement('div');obj.style.position='relative';obj.style.height=thumbnail_width+'px';obj.style.width=thumbnail_width+'px';obj.style.top=sp+'px';obj.style.left=sp+'px';obj.style.overflow='hidden';obj.style.verticalAlign='middle';obj.style.textAlign='center';c1.appendChild(obj);this._thumbnail=document.createElement('img');this._thumbnail.setAttribute('widgetid',this._id);this._thumbnail.setAttribute('op','editro');this._thumbnail.src=PageX.THUMBNAIL_UNAVAILABLE;this._thumbnail.style.cursor='pointer';this._thumbnail.style.visibility='hidden';this._thumbnail.onload=PageDetail.handleLoadedImage;this._thumbnail.onerror=PageDetail.handleErrorImage;this._thumbnail.onclick=PageDetail.handleClick;obj.appendChild(this._thumbnail);c1.appendChild(document.createElement('br'));var tbl=document.createElement("table");tbl.width="90%";tbl.align='left';c1.appendChild(tbl);var tr=tbl.insertRow(0);var td=tr.insertCell(0);td.style.paddingLeft='10px';this._ownerWidget=document.createElement('span');this._ownerWidget.className='listViewSubtitle';this._ownerWidget.style.color=this._colors.textColor;this._ownerWidget.innerHTML='';td.appendChild(this._ownerWidget);tr=tbl.insertRow(1);td=tr.insertCell(0);td.style.paddingLeft='10px';this._advancedWidget=document.createElement('span');this._advancedWidget.setAttribute('widgetid',this._id);this._advancedWidget.setAttribute('op','properties');this._advancedWidget.className='listViewSubtitle';this._advancedWidget.style.color=this._colors.textColor;this._advancedWidget.style.cursor='pointer';this._advancedWidget.style.textDecoration='underline';this._advancedWidget.onclick=PageDetail.handleClick;this._advancedWidget.innerHTML='&nbsp;Page History';td.appendChild(this._advancedWidget);tr=tbl.insertRow(2);td=tr.insertCell(0);td.style.paddingLeft='10px';td.style.paddingTop='4px';this._readonlyCheckBoxWidget=document.createElement('input');this._readonlyCheckBoxWidget.type='checkbox';this._readonlyCheckBoxWidget.onclick=PageDetail.handleClick;this._readonlyCheckBoxWidget.setAttribute('widgetid',this._id);this._readonlyCheckBoxWidget.setAttribute('op','lock');td.appendChild(this._readonlyCheckBoxWidget);this._readonlyWidget=document.createElement('span');this._readonlyWidget.className='listViewSubtitle';this._readonlyWidget.innerHTML='&nbsp;Allow Editing';td.appendChild(this._readonlyWidget);this._detailContainerWidget=c1;}
PageDetail.prototype.buildInputField=function(container)
{var c1=document.createElement('div');c1.style.top=(this._dimensions.titleHeight+
this._dimensions.listHeight)+'px';c1.style.left='0px';c1.style.height=this._dimensions.inputFieldHeight+'px';c1.style.width=(this._dimensions.totalWidth-3)+'px';c1.style.paddingLeft='3px';c1.style.backgroundColor=this._colors.footerColor;c1.appendChild(document.createElement('br'));var tbl=document.createElement("table");tbl.width="90%";tbl.align='left';var tr=tbl.insertRow(0);var td_left=tr.insertCell(0);var td_right=tr.insertCell(1);td_left.nowrap=true;td_right.nowrap=true;c1.appendChild(tbl);this._sharePageWidget=document.createElement('a');this._sharePageWidget.setAttribute('widgetid',this._id);this._sharePageWidget.setAttribute('op','share');this._sharePageWidget.className='listViewSubtitle';this._sharePageWidget.innerHTML='Share Page';this._sharePageWidget.style.whiteSpace='nowrap';this._sharePageWidget.style.textDecoration='underline';this._sharePageWidget.style.cursor='pointer';this._sharePageWidget.onclick=PageDetail.handleClick;td_left.style.paddingLeft='5px';td_left.style.whiteSpace='nowrap';td_left.appendChild(this._sharePageWidget);this._viewPageWidget=document.createElement('a');this._viewPageWidget.setAttribute('widgetid',this._id);this._viewPageWidget.setAttribute('op','edit');this._viewPageWidget.className='listViewSubtitle';this._viewPageWidget.innerHTML='View Page';this._viewPageWidget.style.whiteSpace='nowrap';this._viewPageWidget.style.textDecoration='underline';this._viewPageWidget.style.cursor='pointer';this._viewPageWidget.onclick=PageDetail.handleClick;td_right.style.paddingLeft='0px';td_right.style.whiteSpace='nowrap';td_right.appendChild(this._viewPageWidget);container.appendChild(c1);this._bottomContainerWidget=c1;}
PageDetail.prototype.loadThumbnail=function()
{if(this._thumbnail.width!=NaN&&this._thumbnail.width>0&&this._thumbnail.height!=NaN&&this._thumbnail.height>0){var parent=this._thumbnail.parentNode;var width=dhtmlapi.getObjectWidth(parent);var height=dhtmlapi.getObjectHeight(parent);var ratio=parseFloat(this._thumbnail.width/this._thumbnail.height);if(ratio>1.0){this._thumbnail.width=width;this._thumbnail.height=parseInt(width/ratio);}
else{this._thumbnail.height=height;this._thumbnail.width=parseInt(height*ratio);}
this._thumbnail.style.visibility='visible';}}
PageDetail.prototype.getStorageLocation=function(page)
{var storagePath=page.getStoragePath();var isMaster=(storagePath.getServerType()==0);var storageLoc="";if(!isMaster)
storageLoc=location.protocol+"//"+storagePath.getServerUrl()+"/ewsstorage/";storageLoc=storageLoc+"_path_/"+storagePath.getOid()+"/";return storageLoc;}
PageVersion.prototype._revNumber;PageVersion.prototype._revTime;PageVersion.prototype._revUserOid;PageVersion.prototype._comment;function PageVersion(revNumber,revTime,revUserOid,comment)
{this._revNumber=revNumber;this._revTime=revTime;this._revUserOid=revUserOid;this._comment=comment;}
PageVersion.createInstance=function(xmlstr)
{var env=null;var ms=null;var pv=new PageVersion();try{if(typeof xmlstr=="string"){if(xmlstr!=""){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}}
else
env=xmlstr;if(env!=null){for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(name){case'revnumber':pv._revNumber=val;break;case'revtime':ms=parseInt(val);pv._revTime=(ms==0)?null:new Date(ms);break;case'revuseroid':pv._revUserOid=parseInt(val);break;case'comment':pv._comment=val;break;}}}
return pv;}catch(e){alert("PageVersion.createInstance: "+e);}}
PageVersion.prototype.isEqual=function(pv)
{if(this._revNumber==pv._revNumber&&this._revTime==pv._revTime&&this._revUserOid==pv._revUserOid&&this._comment==pv._comment){return true;}
else
return false;}
PageVersion.prototype.toXML=function()
{s="<revnumber>"+this._revNumber+"</revnumber>";s+="<revtime>"+((this._revTime==null)?0:this._revTime.getTime())+"</revtime>";s+="<revuseroid>"+this._revUserOid+"</revuseroid>";s+="<comment>"+((this._comment==null)?"":this._comment)+"</comment>";return s;}
PageVersion.prototype.toXMLObject=function()
{var rootNode=xmlutils.dom.createElement("version");var revNumber=xmlutils.dom.createElement("revnumber");var revTime=xmlutils.dom.createElement("revtime");var revUserOid=xmlutils.dom.createElement("revuseroid");var comment=xmlutils.dom.createElement("comment");xmlutils.setNodeText(revNumber,this._revNumber);xmlutils.setNodeText(revTime,((this._revTime==null)?0:this._revTime.getTime()));xmlutils.setNodeText(revUserOid,this._revUserOid);xmlutils.setNodeText(comment,((this._comment==null)?"":this._comment));rootNode.appendChild(revNumber);rootNode.appendChild(revTime);rootNode.appendChild(revUserOid);rootNode.appendChild(comment);return rootNode;}
PageVersion.prototype.getRevNumber=function()
{return this._revNumber;}
PageVersion.prototype.getRevTime=function()
{return this._revTime;}
PageVersion.prototype.getRevUserOid=function()
{return this._revUserOid;}
PageVersion.prototype.getComment=function()
{return this._revComment;}
PageView.rday=new Array("Sun ","Mon ","Tue ","Wed ","Thu ","Fri ","Sat ");PageView.rmonth=new Array("Jan ","Feb ","Mar ","Apr ","May ","Jun ","Jul ","Aug ","Sep ","Oct ","Nov ","Dec ");PageView.prototype._userOid;PageView.prototype._lastVersionView;PageView.prototype._viewTime;PageView.prototype._editVersion;PageView.prototype._userRecord;PageView.prototype._owner;function PageView(userOid,lastVersionView,viewTime,editVersion,userRecord,owner)
{this._userOid=userOid;this._lastVersionView=lastVersionView;this._viewTime=viewTime;this._editVersion=editVersion;this._userRecord=userRecord;this._owner=owner;}
PageView.createInstance=function(xmlstr)
{var idx=null;var end_idx=null;var ms=null;var pv=new PageView();try{idx=xmlstr.indexOf('uid="');end_idx=xmlstr.indexOf('"',idx+5);pv._userOid=parseInt(xmlstr.substring(idx+5,end_idx));idx=xmlstr.indexOf('version="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+9);pv._lastVersionView=parseInt(xmlstr.substring(idx+9,end_idx));idx=xmlstr.indexOf('time="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+6);ms=parseInt(xmlstr.substring(idx+6,end_idx));if(ms==0)
pv._viewTime=null;else
pv._viewTime=new Date(ms);pv._editVersion=null;pv._userRecord=null;pv._owner=false;return pv;}catch(e){alert("PageView.creatInstance: "+e);return null;}}
PageView.createEditInstance=function(versionRecord)
{var pv=new PageView();pv._userOid=versionRecord.getRevUserOid();pv._lastVersionView=-1;pv._viewTime=null;pv._editVersion=versionRecord;pv._userRecord=null;pv._owner=null;return pv;}
PageView.processViewDetails=function(xmlstr)
{var idx;var end_idx;var createOid;try{idx=xmlstr.indexOf("<createuser>",0);end_idx=xmlstr.indexOf("</createuser>",idx+12);var createOid=parseInt(xmlstr.substring(idx+12,end_idx));idx=xmlstr.indexOf("<viewhistory>",end_idx+13);end_idx=xmlstr.indexOf("</viewhistory>",idx+13);var viewStr=xmlstr.substring(idx+13,end_idx);idx=xmlstr.indexOf("<revisionhistory>",end_idx+14);end_idx=xmlstr.indexOf("</revisionhistory>",idx+17);var revisionStr=xmlstr.substring(idx+17,end_idx);idx=xmlstr.indexOf("<userlist>",end_idx+18);end_idx=xmlstr.indexOf("</userlist>",idx+10);var userStr=xmlstr.substring(idx+10,end_idx);var pvList=PageView.getViewList(viewStr);PageView.addEditList(revisionStr,pvList);var uList=PageView.getUserList(userStr);PageView.assignUserList(pvList,uList,createOid);return pvList;}catch(e){return null;}}
PageView.getViewList=function(xmlstr)
{var idx;var end_idx;var pvList=new Array();idx=xmlstr.indexOf("<view",0);while(idx!=-1){end_idx=xmlstr.indexOf("/>",idx+5);var viewStr=xmlstr.substring(idx+5,end_idx);var pvObj=PageView.createInstance(viewStr);pvList[pvList.length]=pvObj;idx=xmlstr.indexOf("<view",end_idx+2);}
return pvList;}
PageView.addEditList=function(xmlstr,pvList)
{var idx;var end_idx;idx=xmlstr.indexOf("<version>",0);while(idx!=-1){end_idx=xmlstr.indexOf("</version>",idx+9);var versionStr=xmlstr.substring(idx,end_idx+10);var versionObj=PageVersion.createInstance(versionStr);var pvObj=PageView.findUser(pvList,versionObj.getRevUserOid());if(pvObj==null){pvObj=PageView.createEditInstance(versionObj);pvList[pvList.length]=pvObj;}
else
pvObj._editVersion=versionObj;idx=xmlstr.indexOf("<version>",end_idx+10);}
return pvList;}
PageView.getUserList=function(xmlstr)
{var idx;var end_idx;var userList=new Array();idx=xmlstr.indexOf("<user>",0);while(idx!=-1){end_idx=xmlstr.indexOf("</user>",idx+6);var userStr=xmlstr.substring(idx,end_idx+7);var userObj=User.createInstance(userStr);if(userObj.getOid()==2){userObj.setFirstName("Guests");userObj.setLastName("");}
userList[userList.length]=userObj;idx=xmlstr.indexOf("<user>",end_idx+7);}
return userList;}
PageView.assignUserList=function(pvlist,ulist,createOid)
{for(i=0;i<pvlist.length;i++){if(pvlist[i].getUserOid()==createOid)
pvlist[i]._owner=true;for(j=0;j<ulist.length;j++){if(pvlist[i].getUserOid()==ulist[j].getOid()){pvlist[i]._userRecord=ulist[j];break;}}}}
PageView.findUser=function(pvList,oid)
{if(pvList!=null){for(i=0;i<pvList.length;i++){if(pvList[i].getUserOid()==oid)
return pvList[i];}}
return null;}
PageView.prototype.getData=function(columnId,clientData)
{var lc=null;var dataValue=null;if(columnId=="member"){dataValue=this.getDisplayName();if(this._owner)
dataValue+=" *";lc=new ListCell(ListCell.TYPE_STRING,dataValue);}
else if(columnId=="viewed"){dataValue=this.getViewTime();lc=new ListCell(ListCell.TYPE_STRING,dataValue==null?"---":this.formatDate(dataValue));}
else if(columnId=="edited"){dataValue=this.getEditTime();lc=new ListCell(ListCell.TYPE_STRING,dataValue==null?"---":this.formatDate(dataValue));}
return lc;}
PageView.prototype.getUserOid=function()
{return this._userOid;}
PageView.prototype.getLastVersionView=function()
{return this._lastVersionView;}
PageView.prototype.getViewTime=function()
{return this._viewTime;}
PageView.prototype.getEditTime=function()
{if(this._editVersion!=null)
return this._editVersion.getRevTime();return null;}
PageView.prototype.getEmail=function()
{if(this._userRecord==null)
return null;name=this._userRecord.getEmailAddress();return name;}
PageView.prototype.getDisplayName=function()
{if(this._userRecord==null)
return null;name=this._userRecord.getDisplayName();return name;}
PageView.prototype.formatDate=function(dt)
{return util.formatDate(dt);}
StoragePath.prototype._oid;StoragePath.prototype._serverOid;StoragePath.prototype._serverType;StoragePath.prototype._serverUrl;function StoragePath(oid,serverOid,serverType,serverUrl)
{this._oid=oid;this._serverOid=serverOid;this._serverType=serverType;this._serverUrl=serverUrl;}
StoragePath.createInstance=function(xmlstr)
{var sp=new StoragePath();try{if(typeof xmlstr=="string"){if(xmlstr!=null){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}}
else
env=xmlstr;for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(elem.nodeName){case'oid':sp._oid=parseInt(val);break;case'soid':sp._serverOid=parseInt(val);break;case'type':sp._serverType=parseInt(val);break;case'url':sp._serverUrl=val;break;default:break;}}
return sp;}catch(e){alert("StoragePath.createInstance: "+e);}}
StoragePath.prototype.getServerOid=function(){return this._serverOid;}
StoragePath.prototype.getOid=function(){return this._oid;}
StoragePath.prototype.getServerType=function(){return this._serverType;}
StoragePath.prototype.getServerUrl=function(){return this._serverUrl;}
Topic.prototype._oid;Topic.prototype._groupOid;Topic.prototype._title;Topic.prototype._parentOid;Topic.prototype._children;Topic.prototype._parent;Topic.prototype._pages;function Topic(oid,groupOid,title,parentOid)
{this._oid=parseInt(oid);this._groupOid=parseInt(groupOid);this._title=title;this._parentOid=parseInt(parentOid);this._children=new Array();this._parent=null;this._pages=new Array();}
Topic.createInstance=function(xml)
{var t=new Topic();var env=null;var elem=null;try{if(typeof xml=="string"){xmlutils.loadXml(xmlutils.dom,xml);env=xmlutils.dom.documentElement;}
else
env=xml;for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(elem.nodeName){case'oid':t._oid=parseInt(val);break;case'groupoid':t._groupOid=parseInt(val);break;case'title':t._title=val;break;case'parentoid':t._parentOid=parseInt(val);break;default:break;}}
return t;}catch(e){alert("Topic.createInstance: "+e);return null;}}
Topic.insertPages=function(topics,pages)
{for(var i=0;i<pages.length;i++){var p=pages[i];Topic.insertPage(topics,p);}}
Topic.insertPage=function(topics,page)
{for(var i=0;i<topics.length;i++){var gt=topics[i];var oid=gt.getOid();if(oid==page.getTopic()){gt.addPage(page);return;}}}
Topic.getTotalPageCount=function(topic,data)
{data.counter+=topic.getPageCount();}
Topic.prototype.insert=function(newTopic)
{var oid=newTopic.getParentOid();var foundNode=Tree.find(Tree.TREE,this,oid);if(foundNode!=null)
{this.appendChild(newTopic);return true;}
return false;}
Topic.prototype.addPage=function(p)
{this._pages[this._pages.length]=p;}
Topic.prototype.appendChild=function(obj){this._children[this._children.length]=obj;}
Topic.prototype.deletePage=function(oid)
{for(var i=0;i<this._pages.length;i++){var p=this._pages[i]
if(p.getOid()==oid){this._pages.splice(i,1);return p;}}}
Topic.prototype.indexOf=function(pageOid)
{if(this._pages==null||pageOid==null)
return-1;for(var i=0;i<this._pages.length;i++){if(this._pages[i].getOid()==pageOid)
return i;}
return-1;}
Topic.prototype.isEqual=function(item,arg)
{if(arg==null)
return(this.getOid()==item)?true:false;else if(arg=="title")
return(this.getTitle()==item)?true:false;}
Topic.prototype.getParentOid=function(){return this._parentOid;}
Topic.prototype.getOid=function(){return this._oid;}
Topic.prototype.getPages=function(){return this._pages;}
Topic.prototype.getPageCount=function(){return((this._pages==null)?0:this._pages.length);}
Topic.prototype.getPage=function(oid){var list=this.getPages();if(list!=null)
{for(var i=0;i<list.length;i++){var p=list[i]
if(p.getOid()==oid){return p;}}}
return null;}
Topic.prototype.getTotalPages=function()
{var data=new Object();data.counter=0;Tree.traverse(Tree.TREE,this,Topic.getTotalPageCount,data);return data.counter;}
Topic.prototype.getName=function(){return this._title;}
Topic.prototype.getTitle=function(){return this._title;}
Topic.prototype.getGroupOid=function(){return this._groupOid;}
Topic.prototype.getParentOid=function(){return this._parentOid;}
Topic.prototype.isParent=function(child)
{return(this.getOid()==child.getParentOid())?true:false;}
Topic.prototype.isRoot=function(){return(this.getOid()==0)?true:false;}
Topic.prototype.setTitle=function(val){this._title=val;}
User.prototype._oid;User.prototype._email;User.prototype._first;User.prototype._last;User.prototype._lastLogin;User.prototype._preferences;User.prototype._userGroups;function User(oid,email,fname,lname,lastLogin)
{this._oid=oid;this._email=email;this._first=fname;this._last=lname;this._preferences=null;this._userGroups=null;try{var ms=parseInt(lastLogin);if(ms==0)
this._lastLogin=null;else
this._lastLogin=new Date(ms);}catch(e){this._lastLogin=null;}}
User.createInstance=function(xmlstr)
{var env=null;if(typeof xmlstr=="string"){if(xmlstr!=""){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}}
else
env=xmlstr;return User.parseXml(env);}
User.parseXml=function(userElement)
{var u=new User();var elem=null;try{elem=userElement.getElementsByTagName("oid").item(0);u._oid=parseInt(xmlutils.getNodeText(elem));elem=userElement.getElementsByTagName("email").item(0);u._email=xmlutils.getNodeText(elem);elem=userElement.getElementsByTagName("firstname").item(0);u._first=xmlutils.getNodeText(elem);elem=userElement.getElementsByTagName("lastname").item(0);u._last=xmlutils.getNodeText(elem);elem=userElement.getElementsByTagName("profile").item(0);u.parseProfile(elem);var prefElement=userElement.getElementsByTagName("preferences");if(prefElement!=null&&prefElement.item(0)!=null){u._preferences=Preferences.parseXml(prefElement.item(0));}
elem=userElement.getElementsByTagName("lastlogin").item(0);var ms=parseInt(xmlutils.getNodeText(elem));if(ms==0)
u._lastLogin=null;else{u._lastLogin=new Date();u._lastLogin.setTime(ms);}
return u;}catch(e){alert("User.parseXml: "+e);return null;}}
User.prototype.parseProfile=function(profile)
{}
User.prototype.getFirstName=function(){return this._first;}
User.prototype.getLastName=function(){return this._last;}
User.prototype.getName=function()
{var str=(this._first!=null)?this._first:"";if(this._last!=null){if(str.length!=0)
str+=" ";str+=this._last;}
return str;}
User.prototype.getDisplayName=function()
{var dn=this.getName();if(dn==null||dn.length==0||dn=="")
dn=this.getEmailAddress();return dn;}
User.prototype.getOid=function()
{return this._oid;}
User.prototype.getLastLogin=function()
{return this._lastLogin;}
User.prototype.getPreferences=function(name)
{return this._preferences;}
User.prototype.setPreferences=function(preferences)
{this._preferences=preferences;}
User.prototype.setPreference=function(name,value)
{this._preferences.setPreferenceValue(name,value);}
User.prototype.getEmailAddress=function()
{return this._email;}
User.prototype.setEmailAddress=function(val)
{this._email=val;}
User.prototype.getEncryptedPassword=function()
{return"0x8675309";}
User.prototype.setFirstName=function(val)
{this._first=val;}
User.prototype.setLastName=function(val)
{this._last=val;}
var MESSAGES={"photoviewer.toolbar.first":"Go to Start (Home)","photoviewer.toolbar.prev":"Previous Photo (Left arrow)","photoviewer.toolbar.slideShow":"Start/Pause Slide Show (Space)","photoviewer.toolbar.next":"Next Photo (Right arrow)","photoviewer.toolbar.last":"Go to End (End)","photoviewer.toolbar.email":"Email Photo","photoviewer.toolbar.permalink":"Link to Photo","photoviewer.toolbar.close":"Close (Esc)","photoviewer.email.subject.photo":"Photo","gallery.nophotos":"No photos","gallery.thumbs.start":"Start","gallery.thumbs.end":"End","gallery.toolbar.first":"First Photo","gallery.toolbar.prev":"Previous Photo","gallery.toolbar.view":"View Photo","gallery.toolbar.next":"Next Photo","gallery.toolbar.last":"Last Photo"};var agent=navigator.userAgent.toLowerCase();var IE=(agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1);var IE7=(agent.indexOf("msie 7")!=-1);var OPERA=(agent.indexOf("opera")!=-1);var SAFARI=(agent.indexOf("safari")!=-1);var STRICT_MODE=(document.compatMode=="CSS1Compat");var _DOMAIN=undefined;var GALLERY_W=650;var log=getLogger();if(document.location.href.indexOf("#jslog")!=-1)
log.enable();function Logger(){this.enable=loggerEnable;this.clear=loggerClear;this.log=loggerLog;this.debug=loggerDebug;this.info=loggerInfo;this.error=loggerError;var console=undefined;try{console=document.createElement("textarea");console.style.display="none";console.style.position="absolute";console.style.right="2px";console.style.bottom="2px";console.style.width="23em";console.style.height="40em";console.style.fontFamily="monospace";console.style.fontSize="9px";console.style.color="#000000";setOpacity(console,0.7);console.border="1px solid #808080";console.ondblclick=clearLogger;}catch(e){}
this.console=console;this.enabled=false;this.logTimeStart=getTimeMillis();}
function getLogger(){var log=undefined;var win=window;while(log==undefined){try{log=win.document.log;}catch(e){break;}
if(win==win.parent)
break;win=win.parent;}
if(log==undefined){log=new Logger();document.log=log;}
return log;}
function clearLogger(){getLogger().clear();}
function loggerEnable(){if(this.enabled||this.console==undefined)
return;if(window.document.body!=undefined){window.document.body.appendChild(this.console);this.console.style.display="";this.enabled=true;}}
function loggerDebug(msg){this.log("DEBUG",msg);}
function loggerInfo(msg){this.log("INFO",msg);}
function loggerError(msg,e){this.log("ERROR",msg,e);}
function loggerLog(level,msg,e){if(!this.enabled||this.console==undefined)
return;var millis=(getTimeMillis()-this.logTimeStart)+"";while(millis.length<6)
millis+=" ";var m=millis+" ";if(msg!=undefined)
m+=msg+" ";if(e!=undefined)
m+=e.name+": "+e.message;this.console.value+=m+"\n";}
function loggerClear(){if(!this.enabled||this.console==undefined)
return;this.console.value="";}
function getTimeMillis(){var t=new Date();return Date.UTC(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());}
function getEvent(event){return(event!=undefined?event:window.event);}
function preventDefault(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}}
function getEventTarget(event){if(event==undefined)
return undefined;if(event.srcElement!=undefined)
return event.srcElement;else
return event.target;}
function getResponse(url,async,getXML,callback,data){var req=undefined;try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){req=new XMLHttpRequest();}}
if(req==undefined){log.error("Failed to initialize XML/HTTP");return undefined;}
req.open("GET",url,async);if(!async){req.send(undefined);if(req.readyState!=4){log.error("Request failed: "+req.readyState);return undefined;}
if(!getXML)
return req.responseText;else
return req.responseXML;}else{req.onreadystatechange=function(){callback(req,data);};req.send(undefined);return undefined;}}
function getElementsByTagName(node,tag){if(node==undefined)
return undefined;if(IE){return node.getElementsByTagName(tag);}
if(tag.indexOf(":")!=-1){tag=tag.split(":")[1];}
return node.getElementsByTagNameNS("*",tag);}
function getFirstElementsValue(node,tag){if(node==undefined)
return undefined;var nodes=getElementsByTagName(node,tag);if(nodes.length===0)
return undefined;else
return getElementValue(nodes[0]);}
function getElementValue(node){var i;var val="";for(i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeValue!==null)
val+=node.childNodes[i].nodeValue;}
return val;}
function trim(str){if(str==undefined)
return undefined;return str.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1');}
function getRootWindow(){var win=window;while(win!=undefined){try{if(win===win.parent){break;}else if(win.parent!=undefined&&win.parent.document.location.href.indexOf("/selenium-server/")!=-1){break;}
win=win.parent;}catch(e){break;}}
return win;}
function getURLParams(){var i,params=[];var url=window.location.search;if(url==undefined||url.length===0)
return undefined;url=url.substring(1);var namevals=url.replace(/\+/g," ").split("&");for(i=0;i<namevals.length;i++){var name,val;var pos=namevals[i].indexOf("=");if(pos!=-1){name=namevals[i].substring(0,pos);val=unescape(namevals[i].substring(pos+1));}else{name=namevals[i];val=undefined;}
params[name]=val;}
return params;}
function setCookie(name,value,expire){var expiry=(expire==undefined)?"":("; expires="+expire.toGMTString());document.cookie=name+"="+value+expiry;}
function getCookie(name){if(document.cookie==undefined||document.cookie.length===0)
return undefined;var search=name+"=";var index=document.cookie.indexOf(search);if(index!=-1){index+=search.length;var end=document.cookie.indexOf(";",index);if(end==-1)
end=document.cookie.length;return unescape(document.cookie.substring(index,end));}}
function removeCookie(name){var today=new Date();var expires=new Date();expires.setTime(today.getTime()-1);setCookie(name,"",expires);}
function getMessage(id){if(MESSAGES[id]==undefined){return"("+id+")";}else{return MESSAGES[id];}}
function localizeNodeAttribs(node){var i;if(node==undefined)
return;if(node.alt!=undefined&&node.alt.indexOf("#")===0){node.alt=getMessage(node.alt.substring(1));}
if(node.title!=undefined&&node.title.indexOf("#")===0){node.title=getMessage(node.title.substring(1));}
if(node.childNodes!=undefined){for(i=0;i<node.childNodes.length;i++){localizeNodeAttribs(node.childNodes[i]);}}}
function padNumber(n,pad){n=n+"";while(n.length<pad){n="0"+n;}
return n;}
function formatDate(date,longFormat){if(date==undefined)
return undefined;return padNumber(date.getMonth()+1,2)+"/"+padNumber(date.getDate(),2)+
(longFormat?"/"+date.getFullYear():"")+" "+
padNumber(date.getHours(),2)+":"+padNumber(date.getMinutes(),2);}
function parseISOTime(strTime){if(strTime==undefined)
return undefined;var isoRE=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d{3})?([Z+-])?(\d\d)?:?(\d\d)?$/;if(!isoRE.test(strTime)){return undefined;}else{return new Date(RegExp.$1,RegExp.$2-1,RegExp.$3,RegExp.$4,RegExp.$5,RegExp.$6);}}
function setOpacity(elt,opacity){if(IE){elt.style.filter="alpha(opacity="+parseInt(opacity*100)+")";}
elt.style.KhtmlOpacity=opacity;elt.style.opacity=opacity;}
function validCoordinates(lat,lon){if(Math.abs(lat)>90||Math.abs(lon)>180){return false;}
if(lat===0.0&&lon===0.0){return false;}
return true;}
function isHosted(){var host=document.location.host;if(host==undefined)
host="";return(host!="triptracker.net"&&host.indexOf("rtvslo.si")==-1&&!checkDomain());}
function checkDomain(){try{if(_DOMAIN==undefined)
return false;var protocol=document.location.protocol;if(protocol==undefined)
protocol="http:";var host=document.location.host;if(host==undefined)
host="";host=host.toLowerCase();if(protocol.toLowerCase().indexOf("file")===0){return true;}
var pos=host.lastIndexOf(":");if(pos!=-1){host=host.substring(0,pos);}
if(host.indexOf("www.")===0){host=host.substring(4);}
if(host===""||host=="localhost"||host=="127.0.0.1")
return true;var domain=_DOMAIN.toLowerCase();pos=domain.indexOf("://");if(pos!=-1){domain=domain.substring(pos+3);}
pos=domain.indexOf("/");if(pos!=-1){domain=domain.substring(0,pos);}
if(domain.indexOf("www.")===0){domain=domain.substring(4);}
if(host==domain){return true;}else if(new RegExp(domain).test(host)){return true;}
return false;}catch(e){return true;}}
function getWindowSize(win){var availW=win.innerWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.documentElement.clientWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.body.clientWidth;var availH=win.innerHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.documentElement.clientHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.body.clientHeight;return{w:availW,h:availH};}
function getDocumentSize(win){var winSize=getWindowSize(win);var scrollPos=getScrollPos(win);var w=winSize.w+scrollPos.left;var h=winSize.h+scrollPos.top;w=Math.max(w,win.document.body.offsetWidth);h=Math.max(h,win.document.body.offsetHeight);w=Math.max(w,win.document.body.scrollWidth);h=Math.max(h,win.document.body.scrollHeight);return{w:w,h:h};}
function getScrollPos(win){var scrollTop=win.pageYOffset;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.documentElement.scrollTop;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.body.scrollTop;var scrollLeft=win.pageXOffset;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.documentElement.scrollLeft;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.body.scrollLeft;return{top:scrollTop,left:scrollLeft};}
var CLEAR_EVENTS=["onclick","ondblclick","onkeydown","onkeypress","onmousedown","onmouseup","onmousemove","onmouseover","onmouseout","onmousewheeldown","oncontextmenu"];function clearEvents(){var i,j;var count=0;if(document.all==undefined)
return;for(i=0;i<document.all.length;i++){for(j=0;j<CLEAR_EVENTS.length;j++){var event=document.all[i][CLEAR_EVENTS[j]];if(event!=undefined){document.all[i][CLEAR_EVENTS[j]]=null;count++;}}}}
if(window.attachEvent){window.attachEvent("onunload",clearEvents);}
var VIEWER_INDEX=0;var SLIDE_DURATION=4000;var SLIDE_OFFSET=50;var SLIDE_PHOTOS=true;var FADE_BORDER=false;var FADE_STEPS=10;var MOVE_STEP=1;var PRELOAD_TIMEOUT=15000;var BORDER_WIDTH=5;var FONT_SIZE=10;var OFFSET_LEFT=0;var OFFSET_TOP=0;var REST_URL="/rest/";var P_IMG_ROOT="http://static.triptracker.net/jsmap/images/photoviewer";var TOOLBAR_IMG="toolbar.png";var TOOLBAR_IMG_RUNNING="toolbar2.png";var TOOLBAR_IMG_BACK="toolbar-back";var TOOLBAR_IMG_MASK="toolbar-mask.png";var TOOLBAR_IMG_LOADING="loading-anim.gif";var TOOLBAR_W=440;var TOOLBAR_H=75;var TOOLBAR_IMG_W=420;var TOOLBAR_IMG_H=44;var TOOLBAR_LINK="http://slideshow.triptracker.net";var TOOLBAR_FONT_COLOR="#c0c0c0";var TOOLBAR_FONT_STYLE="tahoma, verdana, arial, helvetica, sans-serif";var VIEWER_ID_PREFIX="PhotoViewer";var VIEWER_ID_BACK=VIEWER_ID_PREFIX+"Back";var VIEWER_ID_TOOLBAR=VIEWER_ID_PREFIX+"Toolbar";var VIEWER_ID_TOOLBAR_MAP=VIEWER_ID_PREFIX+"ToolbarMap";var VIEWER_ID_TOOLBAR_IMG=VIEWER_ID_PREFIX+"ToolbarImg";var VIEWER_ID_LOADING=VIEWER_ID_PREFIX+"Loading";var VIEWER_ID_TIME=VIEWER_ID_PREFIX+"Time";var VIEWER_ID_TITLE=VIEWER_ID_PREFIX+"Title";var VIEWER_ID_BYLINE=VIEWER_ID_PREFIX+"Byline";var TITLE_MAX_LENGTH=140;function PhotoViewer(win,handleKeys){this.setImageRoot=setImageRoot;this.add=addPhoto;this.show=showPhoto;this.close=closePhoto;this.isShown=isPhotoShown;this.setBackground=setPhotoBackground;this.setShowToolbar=setShowToolbar;this.setToolbarImage=setToolbarImage;this.setShowCallback=setShowCallback;this.setCloseCallback=setCloseCallback;this.setLoading=setPhotoLoading;this.addBackShade=addBackShade;this.addToolbar=addToolbar;this.addCaptions=addCaptions;this.next=nextPhoto;this.prev=prevPhoto;this.first=firstPhoto;this.last=lastPhoto;this.slideShow=slideShow;this.slideShowStop=slideShowStop;this.handleKey=viewerHandleKey;this.email=emailPhoto;this.favorite=favoritePhoto;this.permalink=linkPhoto;this.setBackgroundColor=setBackgroundColor;this.setBorderWidth=setBorderWidth;this.setSlideDuration=setSlideDuration;this.disablePanning=disablePanning;this.enablePanning=enablePanning;this.disableFading=disableFading;this.enableFading=enableFading;this.disableShade=disableShade;this.enableShade=enableShade;this.setShadeColor=setShadeColor;this.setShadeOpacity=setShadeOpacity;this.setFontSize=setFontSize;this.setFont=setFont;this.enableAutoPlay=enableAutoPlay;this.disableAutoPlay=disableAutoPlay;this.enableEmailLink=enableEmailLink;this.disableEmailLink=disableEmailLink;this.enablePhotoLink=enablePhotoLink;this.disablePhotoLink=disablePhotoLink;this.hideOverlappingElements=hideOverlappingElements;this.showOverlappingElements=showOverlappingElements;this.id=VIEWER_ID_PREFIX+VIEWER_INDEX;VIEWER_INDEX++;this.photos=[];this.index=0;this.win=(win!=undefined?win:window);this.shown=false;this.showToolbar=true;this.backgroundColor="#000000";this.shadeColor="#000000";this.shadeOpacity=0.7;this.borderColor="#000000";this.shadeColor="#000000";this.shadeOpacity=0.7;this.borderWidth=BORDER_WIDTH;this.backgroundShade=true;this.fadePhotos=true;this.autoPlay=false;this.enableEmailLink=true;this.enablePhotoLink=true;this.slideDuration=SLIDE_DURATION;this.panPhotos=SLIDE_PHOTOS;this.fontSize=FONT_SIZE;this.font=undefined;if(handleKeys==undefined||handleKeys){if(this.win.addEventListener){this.win.addEventListener("keydown",viewerHandleKey,false);}else{this.win.document.attachEvent("onkeydown",viewerHandleKey);}}
this.win.document.viewer=this;}
function PhotoImg(id,src,w,h,time,title,byline){this.id=id;this.src=src;this.w=parseInt(w);this.h=parseInt(h);this.time=time;this.title=title;this.byline=byline;}
function getViewer(){var viewer=undefined;var win=window;while(viewer==undefined){try{viewer=win.document.viewer;}catch(e){break;}
if(win===win.parent){break;}
win=win.parent;}
return viewer;}
function setImageRoot(root){P_IMG_ROOT=root;}
function addPhoto(photo,title,time,byline){var type=typeof photo;if(typeof photo=="string"){photo=new PhotoImg(undefined,photo,undefined,undefined,time,title,byline);}
this.photos.push(photo);}
function setPhotoBackground(color,border,doShade){if(color!=undefined)
this.backgroundColor=color;if(border!=undefined)
this.borderColor=border;if(doShade!=undefined)
this.backgroundShade=doShade;}
function setPhotoLoading(isLoading){this.isLoading=isLoading;var elt=this.win.document.getElementById(VIEWER_ID_LOADING);if(elt==undefined)
return;elt.style.display=isLoading?"":"none";}
function setBackgroundColor(color){this.backgroundColor=color;this.borderColor=color;}
function setBorderWidth(width){this.borderWidth=width;}
function setSlideDuration(duration){this.slideDuration=duration;}
function disableShade(){this.backgroundShade=false;}
function enableShade(){this.backgroundShade=true;}
function setShadeColor(color){this.shadeColor=color;}
function setShadeOpacity(opacity){this.shadeOpacity=opacity;}
function disableFading(){this.fadePhotos=false;}
function enableFading(){this.fadePhotos=true;}
function disablePanning(){this.panPhotos=false;}
function enablePanning(){this.panPhotos=true;}
function setFontSize(size){this.fontSize=size;}
function setFont(font){this.font=font;}
function enableAutoPlay(){this.autoPlay=true;}
function disableAutoPlay(){this.autoPlay=false;}
function enableEmailLink(){this.enableEmailLink=true;}
function disableEmailLink(){this.enableEmailLink=false;}
function enablePhotoLink(){this.enablePhotoLink=true;}
function disablePhotoLink(){this.enablePhotoLink=false;}
function showPhoto(index,cropWidth,opacity){if(this.photos.length===0){return true;}
if(index!=undefined)
this.index=index;if(this.index<0||this.index>=this.photos.length){log.error("Invalid photo index");return true;}
var doc=this.win.document;var firstShow=false;if(!this.shown){firstShow=true;doc.viewer=this;try{this.hideOverlappingElements();}catch(e){}}
var zIndex=ZIndex.TOP_LAST;var winSize=getWindowSize(this.win);var availW=winSize.w-20;var availH=winSize.h-20;var scrollPos=getScrollPos(this.win);var scrollLeft=scrollPos.left;var scrollTop=scrollPos.top;this.addBackShade(zIndex);if(this.showToolbar){this.addToolbar(availW,zIndex);this.addCaptions();}
var photo=this.photos[this.index];if(isNaN(photo.w)||isNaN(photo.h)){if(photo.preloadImage!=undefined){if(isNaN(photo.w)&&photo.preloadImage.width>0)
photo.w=photo.preloadImage.width;if(isNaN(photo.h)&&photo.preloadImage.height>0)
photo.h=photo.preloadImage.height;}else{this.index--;this.next();return false;}}
this.shown=true;var offset=20;var pw=-1;var ph=-1;if(parseInt(photo.w)>availW||parseInt(photo.h)>availH){if(parseInt(photo.w)/availW>parseInt(photo.h)/availH){pw=availW-offset;ph=parseInt(pw*photo.h/photo.w);}else{ph=availH-offset;pw=parseInt(ph*photo.w/photo.h);}}else{pw=parseInt(photo.w);ph=parseInt(photo.h);}
if(pw<=0||ph<=0){if(!this.showToolbar)
throw"Missing photo dimension";}
if(cropWidth==undefined)
cropWidth=0;var photoDiv=doc.createElement("div");photoDiv.style.visibility="hidden";photoDiv.style.position="absolute";photoDiv.style.zIndex=zIndex;photoDiv.style.overflow="hidden";photoDiv.style.border=this.borderWidth+"px solid "+this.borderColor;photoDiv.style.textAlign="center";photoDiv.style.backgroundColor=this.backgroundColor;var photoElt=doc.createElement("img");photoElt.style.visibility="hidden";photoElt.style.position="relative";photoElt.style.backgroundColor=this.backgroundColor;photoElt.style.border="none";photoElt.style.cursor="pointer";photoElt.style.zIndex=(parseInt(photoDiv.style.zIndex)+1)+"";photoElt.onclick=closeViewer;if(opacity!=undefined&&this.fadePhotos){var fadeElt=(FADE_BORDER?photoDiv:photoElt);setOpacity(fadeElt,opacity);}
var left=parseInt((availW-pw)/2)+OFFSET_LEFT;photoDiv.style.left=(left+scrollLeft+cropWidth/2)+"px";var top=parseInt((availH-ph)/2)+OFFSET_TOP;photoDiv.style.top=(top+scrollTop)+"px";photoElt.style.visibility="hidden";photoDiv.style.width=(pw-cropWidth)+"px";photoDiv.style.height=ph+"px";photoElt.style.width=pw+"px";photoElt.style.height=ph+"px";photoElt.src=photo.src;photoDiv.style.visibility="visible";photoElt.style.visibility="visible";photoDiv.appendChild(photoElt);doc.body.appendChild(photoDiv);if(this.photoDiv!=undefined){try{doc.body.removeChild(this.photoDiv);}catch(e){}}
this.photoDiv=photoDiv;this.photoImg=photoElt;this.setLoading(false);if(this.showCallback!=undefined)
this.showCallback(this.index);if(firstShow&&this.autoPlay){this.slideShow(true);}
return false;}
function isPhotoShown(){return this.shown;}
function closeViewer(){getViewer().close();}
function onPhotoLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index)){viewer.setLoading(false);viewer.index--;viewer.next();return;}
viewer.show();}}
function closePhoto(){var win=this.win;if(win==undefined)
win=window;var doc=win.document;var elt=this.photoDiv;if(elt!=undefined)
doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_BACK);if(elt!=undefined)
doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_TOOLBAR);if(elt!=undefined)
doc.body.removeChild(elt);this.shown=false;this.slideShowRunning=false;this.slideShowPaused=false;try{this.showOverlappingElements();}catch(e){}
if(this.closeCallback!=undefined)
this.closeCallback(this.index);}
function nextPhoto(n){if(this.isLoading)
return;if(n==undefined)
n=1;var oldIndex=this.index;if(this.index+n>=this.photos.length){if(n>1)
this.index=this.photos.length-1;else
return;}else if(this.index+n<0){if(n<-1)
this.index=0;else
return;}else{this.index+=n;}
if(this.index==oldIndex)
return;this.slideShowStop();var img=new Image();this.photos[this.index].preloadImage=img;this.setLoading(true);img.onload=onPhotoLoad;img.onerror=onPhotoLoad;img.src=this.photos[this.index].src;}
function prevPhoto(n){if(n==undefined)
n=1;this.next(-n);}
function firstPhoto(){this.prev(this.photos.length);}
function lastPhoto(){this.next(this.photos.length);}
var slideTimeout;var slidePreloadImageLoaded=false;var slidePreloadTime=undefined;function slideShow(start){var doc=this.win.document;var viewer=this;var photoElt=this.photoImg;if(photoElt==undefined)
return;var photoDiv=this.photoDiv;var fadeElt=(FADE_BORDER?photoDiv:photoElt);if(start!=undefined&&start===true){if(this.isLoading||this.index>=this.photos.length-1){return;}
if(this.slideShowPaused){this.slideShowPaused=false;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG_RUNNING);return;}else if(this.slideShowRunning){this.slideShowPaused=true;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}else{this.slideShowRunning=true;this.slideShowPaused=false;this.slideFirstPhoto=true;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG_RUNNING);}}else if(this.slideShowPaused){window.setTimeout(function(){viewer.slideShow(false);},200);return;}else if(!this.slideShowRunning){this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}
var left=0;if(photoElt.leftOffset!=undefined){left=parseFloat(photoElt.leftOffset);}
if(left===0){if(this.index<this.photos.length-1){slidePreloadImageLoaded=false;var slidePreloadImage=new Image();this.photos[this.index+1].preloadImage=slidePreloadImage;slidePreloadTime=getTimeMillis();slidePreloadImage.onload=onSlideLoad;slidePreloadImage.onerror=onSlideLoad;slidePreloadImage.src=this.photos[this.index+1].src;}}
if(left>-SLIDE_OFFSET){left-=MOVE_STEP;if(-left<=FADE_STEPS){if(fadeElt.style.opacity!=undefined&&parseFloat(fadeElt.style.opacity)<1){if(this.fadePhotos&&this.photos[this.index].src!=undefined)
setOpacity(fadeElt,-left/FADE_STEPS);}}else if(left+SLIDE_OFFSET<FADE_STEPS){if(this.index<this.photos.length-1&&!slidePreloadImageLoaded){if(slidePreloadTime!=undefined&&getTimeMillis()-slidePreloadTime>PRELOAD_TIMEOUT)
slidePreloadImageLoaded=true;left++;this.setLoading(true);}else{if(this.index<this.photos.length-1&&this.fadePhotos&&this.photos[this.index].src!=undefined)
setOpacity(fadeElt,(left+SLIDE_OFFSET)/FADE_STEPS);}}
photoElt.leftOffset=left;if(this.panPhotos&&!this.slideFirstPhoto){photoElt.style.left=left+"px";}}else{if(this.index>=this.photos.length-1){this.slideShowRunning=false;this.slideShowPaused=false;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}
this.index++;this.slideFirstPhoto=false;this.show(undefined,(this.panPhotos?SLIDE_OFFSET:0),0);fadeElt=(FADE_BORDER?this.photoDiv:this.photoImg);if(this.fadePhotos)
setOpacity(fadeElt,0);this.photoImg.leftOffset=0;if(this.panPhotos)
this.photoImg.style.left="0px";}
var pause=this.slideDuration/SLIDE_OFFSET;if(this.slideFirstPhoto){pause/=2;}
slideTimeout=window.setTimeout(function(){viewer.slideShow(false);},pause);}
function onSlideLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index+1)){var slidePreloadImage=viewer.photos[viewer.index+1].preloadImage;slidePreloadImage.src=viewer.photos[viewer.index+1].src;slidePreloadTime=getTimeMillis();return;}
slidePreloadImageLoaded=true;viewer.setLoading(false);}}
function slideShowStop(){this.slideShowRunning=false;this.slideShowPaused=false;var doc=this.win.document;var photoElt=this.photoImg;if(photoElt!=undefined){if(this.fadePhotos){var fadeElt=(FADE_BORDER?this.photoDiv:photoElt);setOpacity(fadeElt,1);}
photoElt.style.left="0px";}}
function addBackShade(zIndex){var doc=this.win.document;if(doc.getElementById(VIEWER_ID_BACK)!=undefined){return;}
var photoBack=doc.createElement("div");photoBack.id=VIEWER_ID_BACK;photoBack.style.top="0px";photoBack.style.left="0px";photoBack.style.bottom="0px";photoBack.style.right="0px";photoBack.style.margin="0";photoBack.style.padding="0";photoBack.style.border="none";if(IE&&!(IE7&&STRICT_MODE)){photoBack.style.position="absolute";var docSize=getDocumentSize(this.win);photoBack.style.width=(docSize.w-21)+"px";photoBack.style.height=(docSize.h-4)+"px";}else{photoBack.style.position="fixed";photoBack.style.width="100%";photoBack.style.height="100%";}
photoBack.style.zIndex=zIndex-1;photoBack.style.backgroundColor=this.shadeColor;if(this.backgroundShade)
setOpacity(photoBack,this.shadeOpacity);else
setOpacity(photoBack,0.0);photoBack.onclick=closeViewer;doc.body.appendChild(photoBack);}
function addToolbar(availW,zIndex){var doc=this.win.document;var i;if(doc.getElementById(VIEWER_ID_TOOLBAR)!=undefined)
return;var photoToolbar=doc.createElement("div");photoToolbar.id=VIEWER_ID_TOOLBAR;var bottom=10;if(IE&&!(IE7&&STRICT_MODE)){photoToolbar.style.position="absolute";if(IE7)
bottom-=getScrollPos(this.win).top;}else{photoToolbar.style.position="fixed";}
photoToolbar.style.bottom=bottom+"px";photoToolbar.style.left=(availW-TOOLBAR_W+10)/2+"px";photoToolbar.style.width=TOOLBAR_W+"px";photoToolbar.style.height=TOOLBAR_H+"px";photoToolbar.style.textAlign="center";setOpacity(photoToolbar,0.7);photoToolbar.style.zIndex=zIndex+1;var imgBack=TOOLBAR_IMG_BACK;if(!isHosted()){imgBack+="-nologo";}
if(IE&&!IE7){imgBack+="-indexed";}
imgBack+=".png";photoToolbar.style.backgroundImage="url('"+P_IMG_ROOT+"/"+imgBack+"')";photoToolbar.style.backgroundPosition="50% 0%";photoToolbar.style.backgroundRepeat="no-repeat";if(STRICT_MODE){photoToolbar.style.lineHeight="0.8em";}
var toolbarMask=undefined;if(!this.enableEmailLink){toolbarMask=doc.createElement("img");toolbarMask.style.position="absolute";toolbarMask.style.width=44;toolbarMask.style.height=44;toolbarMask.style.left="289px";toolbarMask.style.top="0px";toolbarMask.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;photoToolbar.appendChild(toolbarMask);}
if(!this.enablePhotoLink){toolbarMask=doc.createElement("img");toolbarMask.style.position="absolute";toolbarMask.style.width=44;toolbarMask.style.height=44;toolbarMask.style.left="339px";toolbarMask.style.top="0px";toolbarMask.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;photoToolbar.appendChild(toolbarMask);}
var imgMap=doc.createElement("map");imgMap.name=VIEWER_ID_TOOLBAR_MAP;imgMap.id=VIEWER_ID_TOOLBAR_MAP;var areas=[];areas.push(["document.viewer.first()","17",getMessage("photoviewer.toolbar.first")]);areas.push(["document.viewer.prev()","68",getMessage("photoviewer.toolbar.prev")]);areas.push(["document.viewer.slideShow(true)","122",getMessage("photoviewer.toolbar.slideShow")]);areas.push(["document.viewer.next()","175",getMessage("photoviewer.toolbar.next")]);areas.push(["document.viewer.last()","227",getMessage("photoviewer.toolbar.last")]);if(this.enableEmailLink)
areas.push(["document.viewer.email()","300",getMessage("photoviewer.toolbar.email")]);if(this.enablePhotoLink)
areas.push(["document.viewer.permalink()","350",getMessage("photoviewer.toolbar.permalink")]);areas.push(["document.viewer.close()","402",getMessage("photoviewer.toolbar.close")]);for(i=0;i<areas.length;i++){var area=doc.createElement("area");area.href="javascript:void("+areas[i][0]+")";area.alt=areas[i][2];area.title=area.alt;area.shape="circle";area.coords=areas[i][1]+", 21, 22";area.onclick=blurElement;imgMap.appendChild(area);}
var img=doc.createElement("img");img.id=VIEWER_ID_TOOLBAR_IMG;img.src=P_IMG_ROOT+"/"+TOOLBAR_IMG;img.width=TOOLBAR_IMG_W;img.height=TOOLBAR_IMG_H;img.style.border="none";img.style.background="none";img.style.margin="4px";img.useMap="#"+VIEWER_ID_TOOLBAR_MAP;photoToolbar.appendChild(imgMap);photoToolbar.appendChild(img);if(isHosted()){var ttLink=doc.createElement("a");ttLink.style.position="absolute";ttLink.style.bottom="0px";ttLink.style.right="0px";ttLink.style.width="25px";ttLink.style.height="25px";ttLink.style.background="none";ttLink.alt="TripTracker.net";ttLink.title=ttLink.alt;ttLink.cursor=ttLink.alt;ttLink.href=TOOLBAR_LINK;ttLink.target="_new";ttLink.alt="TripTracker Slideshow";ttLink.title=ttLink.alt;photoToolbar.appendChild(ttLink);}
var loadingIcon=doc.createElement("img");loadingIcon.id=VIEWER_ID_LOADING;loadingIcon.width=16;loadingIcon.height=16;loadingIcon.style.display="none";loadingIcon.style.position="absolute";loadingIcon.style.left=(273-8)+"px";loadingIcon.style.top=(24-8)+"px";loadingIcon.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_LOADING;loadingIcon.style.border="none";loadingIcon.style.background="none";photoToolbar.appendChild(loadingIcon);photoToolbar.appendChild(doc.createElement("br"));var photoTime=doc.createElement("span");photoTime.id=VIEWER_ID_TIME;photoTime.position="relative";photoTime.style.color=TOOLBAR_FONT_COLOR;photoTime.style.fontFamily=TOOLBAR_FONT_STYLE;photoTime.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTime.style.lineHeight=this.fontSize+"px";}
if(this.font!=undefined){photoTime.style.font=this.font;}
photoTime.style.cssFloat="none";photoTime.style.textAlign="right";photoTime.style.padding="0px 10px";photoTime.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTime);var photoTitle=doc.createElement("span");photoTitle.id=VIEWER_ID_TITLE;photoTitle.position="relative";photoTitle.style.color=TOOLBAR_FONT_COLOR;photoTitle.style.fontFamily=TOOLBAR_FONT_STYLE;photoTitle.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTitle.style.lineHeight=this.fontSize+"px";}
if(this.font!=undefined){photoTitle.style.font=this.font;}
photoTitle.style.cssFloat="none";photoTitle.style.textAlign="left";photoTitle.style.paddingRight="20px";photoTitle.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTitle);doc.body.appendChild(photoToolbar);var photoByline=doc.createElement("div");photoByline.appendChild(doc.createTextNode(""));photoByline.style.color=TOOLBAR_FONT_COLOR;photoByline.style.fontFamily=TOOLBAR_FONT_STYLE;photoByline.style.fontSize=this.fontSize+"px";if(this.font!=undefined){photoByline.style.font=this.font;}
photoByline.id=VIEWER_ID_BYLINE;photoByline.style.position="absolute";photoByline.style.right="5px";photoByline.style.bottom="5px";photoByline.style.zIndex=zIndex+1;doc.body.appendChild(photoByline);}
function blurElement(event){var target=getEventTarget(getEvent(event));if(target!=undefined)
target.blur();}
function setToolbarImage(img){var doc=this.win.document;var elt=doc.getElementById(VIEWER_ID_TOOLBAR_IMG);if(elt!=undefined)
elt.src=img;}
function setShowToolbar(doShow){this.showToolbar=doShow;}
function addCaptions(){var photo=this.photos[this.index];var doc=this.win.document;var photoTime=doc.getElementById(VIEWER_ID_TIME);var photoTitle=doc.getElementById(VIEWER_ID_TITLE);var photoByline=doc.getElementById(VIEWER_ID_BYLINE);var time=(this.index+1)+"/"+this.photos.length;if(photo.time!=undefined){time+=" ["+photo.time+"]";}
photoTime.firstChild.nodeValue=time;var title=(photo.title!=undefined?photo.title:"");photoTitle.title="";photoTitle.alt="";if(title.length>TITLE_MAX_LENGTH){photoTitle.title=title;photoTitle.alt=title;title=title.substring(0,TITLE_MAX_LENGTH)+" ...";}
if(title.indexOf("\n")!==0){title=title.replace("\n","<br />");photoTitle.innerHTML=title;}else{photoTitle.nodeValue=title;}
if(photo.byline!=undefined&&photo.byline.length>0){photoByline.firstChild.nodeValue=photo.byline;}else{photoByline.firstChild.nodeValue="";}}
function setCloseCallback(callback){this.closeCallback=callback;}
function setShowCallback(callback){this.showCallback=callback;}
function emailPhoto(){var photo=this.photos[this.index];var doc=this.win.document;var title=(photo.title!=undefined?photo.title:getMessage("photoviewer.email.subject.photo"));var mailtoLink="mailto:?subject="+title+"&body="+
getPhotoURL(photo.src);doc.location.href=mailtoLink;}
function getPhotoURL(url){var loc=document.location;if(/\w+:\/\/.+/.test(url)){return url;}else if(url.indexOf("/")===0){return loc.protocol+"//"+loc.host+url;}else{var path=loc.pathname;var pos=path.lastIndexOf("/");if(pos!=-1){path=path.substring(0,pos);}
return loc.protocol+"//"+loc.host+path+"/"+url;}}
function linkPhoto(){var photo=this.photos[this.index];window.open(photo.src);}
function favoritePhoto(){var photo=this.photos[this.index];var doc=this.win.document;var restURL=REST_URL+"markfeatured?id"+photo.id;try{var res=getResponse(restURL,false,true);}catch(e){return;}}
function hideOverlappingElements(node){if(node==undefined){node=this.win.document.body;this.hideOverlappingElements(node);return;}
if(node.style!=undefined&&node.style.visibility!="hidden"){var nodeName=node.nodeName.toLowerCase();if((node.className!=undefined&&node.className.indexOf("SlideshowDoHide")!=-1)||(IE&&(nodeName=="select"||nodeName=="object"||nodeName=="embed"))){node.style.visibility="hidden";if(this.hiddenElements==undefined)
this.hiddenElements=[];this.hiddenElements.push(node);}}
if(node.childNodes!=undefined){var i;for(i=0;i<node.childNodes.length;i++){this.hideOverlappingElements(node.childNodes[i]);}}}
function showOverlappingElements(){var i;if(this.hiddenElements!=undefined){for(i=0;i<this.hiddenElements.length;i++){this.hiddenElements[i].style.visibility="visible";}
this.hiddenElements=[];}}
function viewerHandleKey(event){if(!getViewer)
return true;var viewer=getViewer();if(viewer==undefined||!viewer.shown)
return true;event=getEvent(event);if(event.ctrlKey||event.altKey)
return true;var keyCode=event.keyCode;switch(keyCode){case 37:case 38:viewer.prev();break;case 39:case 40:viewer.next();break;case 33:viewer.prev(10);break;case 34:viewer.next(10);break;case 36:viewer.first();break;case 35:viewer.last();break;case 32:case 13:viewer.slideShow(true);break;case 27:viewer.close();break;default:return true;}
preventDefault(event);return false;}
function flickrHack(viewer,index){if(viewer.photos[index]!=undefined){var preloadPhoto=viewer.photos[index].preloadImage;if(preloadPhoto!=undefined&&preloadPhoto.width==500&&preloadPhoto.height==375){var flickrRE=/.+static\.flickr\.com.+_b\.jpg/;if(flickrRE.test(preloadPhoto.src)){viewer.photos[index].src=viewer.photos[index].src.replace(/_b\.jpg/,"_o.jpg");return true;}}}
return false;}
function findPhotosTT(viewer,node){var i;if(node.nodeName.toLowerCase()=="a"){var onclick=node.getAttribute("onclick");if(onclick==undefined){onclick=node.onclick;}
if(onclick!=undefined&&new String(onclick).indexOf("popupImg")!=-1){var popupRE=/.*popupImg\((.+?),(.+?),(.+?)\).*/;if(popupRE.test(onclick)){var url,w,h;if(node.photoUrl!=undefined){url=node.photoUrl;w=node.photoW;h=node.photoH;}else{url=RegExp.$1;if(url.charAt(0)=="'"&&url.charAt(url.length-1)=="'")
url=url.substring(1,url.length-1);w=parseInt(RegExp.$2);h=parseInt(RegExp.$3);}
var photo=new PhotoImg(undefined,url,w,h);var found=false;for(i=0;i<viewer.photos.length;i++){if(viewer.photos[i].src==photo.src){found=true;break;}}
if(!found)
viewer.add(photo);}}}
if(node.childNodes!=undefined){for(i=0;i<node.childNodes.length;i++){findPhotosTT(viewer,node.childNodes[i]);}}}
var defaultViewer=undefined;function popupImg(url,w,h,backColor,showToolbar){var i;if(defaultViewer==undefined)
defaultViewer=new PhotoViewer();else{defaultViewer.photos=[];defaultViewer.index=0;}
if(backColor!=undefined)
defaultViewer.setBackground(backColor,backColor,false);if(showToolbar==undefined||showToolbar){findPhotosTT(defaultViewer,window.document.body);for(i=0;i<defaultViewer.photos.length;i++){if(defaultViewer.photos[i].src==url){defaultViewer.show(i);}}}
if(defaultViewer.photos===undefined||defaultViewer.photos.length===0){defaultViewer.setShowToolbar(false);defaultViewer.add(new PhotoImg(undefined,url,w,h));defaultViewer.show();}
return false;}
_DOMAIN=".*pikiwiki.com";Canvas.object=null;Canvas.OBJECT_TYPE_ALL="all";Canvas.OBJECT_TYPE_RESOURCE="resource";Canvas.OBJECT_TYPE_IMAGE="image";Canvas.TOOLTIP_ID="EwsEditTooltip";Canvas.TOOLTIP_OFFSETX=4;Canvas.TOOLTIP_OFFSETY=0;Canvas.numFlashRecordingWidgets=0;Canvas.maxFlashRecordingWidgets=0;Canvas.prototype._editor;Canvas.prototype._element=null;Canvas.prototype._id=null;Canvas.prototype._selectedObj=null;Canvas.prototype._selectedMenuObj=null;Canvas.prototype._widget=null;Canvas.prototype._resize=null;Canvas.prototype._mousedown=false;Canvas.prototype._maxWidth;Canvas.prototype._maxHeight;Canvas.prototype._editmode;Canvas.prototype._showRevisions;Canvas.prototype._lastViewedVersion;Canvas.prototype._widgets_tb=null;Canvas.prototype._operation=null;Canvas.prototype._layout;Canvas.prototype._editResizemode;Canvas.prototype._objectCache;Canvas.prototype._objectCacheOrdered;Canvas.prototype._snapToGrid;Canvas.prototype._zindexTop;Canvas.prototype._viewer;Canvas.prototype._viewerCounter;Canvas.prototype._isDirty;Canvas.prototype._groupOid;Canvas.prototype._pageOid;function Canvas(editor,canvasId,dimensions)
{var canvas=document.createElement("div");canvas.id=canvasId;canvas.className="canvas";canvas.style.position="absolute";canvas.style.left=dimensions.left+"px";canvas.style.top=dimensions.top+"px";canvas.style.overflow="visible";canvas.style.borderTop="0px";canvas.style.backgroundColor='white';this._maxHeight=dhtmlapi.getInsideWindowHeight();this._maxWidth=dhtmlapi.getInsideWindowWidth();canvas.style.height=this._maxHeight+"px";canvas.style.width=this._maxWidth+"px";document.body.appendChild(canvas);Canvas.object=this;this._editor=editor;this._element=canvas;this._id=canvasId;this._widgets_tb=Toolbar.getToolbar("widgets");this._objectCache=new Object();this._objectCacheOrdered=new Array();this._layout=null;this._editmode=Editor.READ_ONLY;this._showRevisions=false;this._snapToGrid='none';this._zindexTop=ZIndex.WIDGET_FIRST;this._viewer=new PhotoViewer();this._viewer.setImageRoot("images/slide");this._viewer.disableEmailLink();this._viewer.setBackgroundColor('#FFFFFF');this._viewer.setBorderWidth(10);this._viewerCounter=0;this._isDirty=false;Canvas.maxFlashRecordingWidgets=maxRecordingWidgets;return;}
Canvas.logEvent=function(msg)
{alert(msg);}
Canvas.prototype.setDimensions=function(dimensions)
{this._element.style.top=dimensions.top+'px';this._element.style.left=dimensions.left+'px';}
Canvas.prototype.setLayout=function(layout)
{this._layout=layout;this.reArrangeLayout();this._layout.setCanvas(this);}
Canvas.prototype.getPreferences=function()
{return this._editor.getPreferences();}
Canvas.prototype.getEditMode=function()
{return this._editmode;}
Canvas.prototype.setEditMode=function(mode)
{this._editmode=mode;}
Canvas.prototype.getHeight=function()
{return dhtmlapi.getObjectHeight(this._element);}
Canvas.prototype.getWidth=function()
{return dhtmlapi.getObjectWidth(this._element);}
Canvas.prototype.createObject=function(id,mimeType,url,x,y,height,width,zindex,flashUpload)
{var obj=null;if(mimeType=="audio/flash"||mimeType=="video/flash"){if(Canvas.numFlashRecordingWidgets<Canvas.maxFlashRecordingWidgets)
Canvas.numFlashRecordingWidgets++;else{alert("Sorry you cannot open more than "+Canvas.maxFlashRecordingWidgets+" audio/video widgets per edit session");return null;}}
if(zindex==null||(zindex<ZIndex.WIDGET_FIRST)||(zindex>ZIndex.WIDGET_LAST)){zindex=this._zindexTop;this._zindexTop++;}
this.removeCurrentSelection();var cls=Editor.getRegisteredClass(mimeType);var obj=cls.createInstance(mimeType,id,height,width,zindex,this,url);obj.markFlashUpload(flashUpload);obj.markDirty();this._layout.calculate(obj,x,y);this.addToCache(obj);this.resizeCanvas(obj);return obj;}
Canvas.prototype.replaceObject=function(id,url,w,h,r)
{var obj=this.getObjectById(id);var dim=obj.getDimensions();var mimeType=MimeTypes.getMimeType(url);var zi=obj.getZIndex();var logical=obj.getLogicalName();var archive=obj.getWidgetProperty("archive");this.deleteObjectX(obj);obj=this.createObject(id,mimeType,url,dim.x,dim.y,h,w,zi,false);if(obj!=null){obj.setRatio(r);obj.setWidgetProperty("archive",archive);obj.setWidgetProperty("master",url);obj.setExternalUpload(Widget.EXUPLOAD_MASTER);obj.setLogicalName(url,logical);obj.markChanged(Widget.ACTION_EDIT,0);}}
Canvas.prototype.resizeCanvas=function(obj)
{var dim=obj.getDimensions();var obj_w=dim.x+dim.width;var obj_h=dim.y+dim.height;this.resizeCanvasDimensions(obj_w,obj_h);}
Canvas.prototype.resizeCanvasDimensions=function(w,h)
{if(w>this._maxWidth){this._maxWidth=w+10;this._element.style.width=this._maxWidth+"px";}
if(h>this._maxHeight){this._maxHeight=h+10;this._element.style.height=this._maxHeight+"px";}
resizeLoadingLayer(this._maxHeight+50,this._maxWidth);var stg=document.getElementById('snapToGrid');if(stg!=null){stg.style.height=dhtmlapi.getObjectHeight(this._element)+'px';stg.style.width=dhtmlapi.getObjectWidth(this._element)+'px';}}
Canvas.prototype.snapToGrid=function(value)
{var stg=null;if(value=="show"||value=="snap"){stg=document.createElement("div");stg.id="snapToGrid";stg.style.position='absolute';stg.style.top='0px';stg.style.left='0px';stg.style.zIndex=ZIndex.BOTTOM_FIRST;stg.style.height=dhtmlapi.getObjectHeight(this._element)+'px';stg.style.width=dhtmlapi.getObjectWidth(this._element)+'px';stg.style.backgroundImage='url(images/editor/grid_large.gif)';this._element.appendChild(stg);}
else{stg=document.getElementById("snapToGrid");this._element.removeChild(stg);}
this._snapToGrid=value;}
Canvas.prototype.getObjectById=function(id)
{var obj=this._objectCache[id];return obj;}
Canvas.prototype.addToCache=function(obj)
{this._objectCache[obj.getId()]=obj;this._objectCacheOrdered[this._objectCacheOrdered.length]=obj.getId();this._objectCacheOrdered.sort();}
Canvas.prototype.removeFromCache=function(obj)
{delete this._objectCache[obj.getId()];for(var i=0;i<this._objectCacheOrdered.length;i++){if(obj.getId()==this._objectCacheOrdered[i]){this._objectCacheOrdered.splice(i,1);}}}
Canvas.prototype.getSelectedObject=function()
{return this._selectedObj;}
Canvas.prototype.getContainer=function()
{return this._element;}
Canvas.prototype.getSelectedMenuObject=function()
{return this._selectedMenuObj;}
Canvas.prototype.selectObject=function(elem,mode)
{if(elem){var id=elem.id;var idx=id.indexOf("Wrap");if(id.indexOf("Wrap")!=-1)
id=id.slice(0,idx);var obj=this.getObjectById(id);if(this._selectedObj!=null){if(this._selectedObj.getId()==obj.getId())
{return;}
else
this.unSelectObject(mode);}
this._selectedObj=obj;obj.select(this._element);}}
Canvas.prototype.selectMenuObject=function(elem)
{if(elem){var id=elem.id;var idx=id.indexOf("Wrap");if(id.indexOf("Wrap")!=-1)
id=id.slice(0,idx);var obj=this.getObjectById(id);this._selectedMenuObj=obj;}}
Canvas.prototype.unSelectMenuObject=function()
{this._selectedMenuObj=null;}
Canvas.prototype.rolloverObject=function(elem,evt,userHistory)
{if(elem){var pe;var id=elem.id;var idx=id.indexOf("Wrap");if(id.indexOf("Wrap")!=-1)
id=id.slice(0,idx);var obj=this.getObjectById(id);var oldObj=this._selectedObj;if(this._selectedObj!=null){if(this._selectedObj.getId()==obj.getId())
return;else
this.rolloutObject();}
this._selectedObj=obj;obj.rollover();pe=obj.getHistoryRecord();if((oldObj!=obj)&&(pe!=null)&&(pe.getAction()==Widget.ACTION_ADD||pe.getAction()==Widget.ACTION_EDIT)){this.showTooltip(Canvas.TOOLTIP_ID,evt,this.formatHistoryText(pe,userHistory));}}}
Canvas.prototype.rolloutObject=function()
{this.hideTooltip(Canvas.TOOLTIP_ID);if(this._selectedObj)
this._selectedObj.rollout();this._selectedObj=null;}
Canvas.prototype.formatHistoryText=function(pe,users)
{var username="---";var str;var u=this.findUserHistory(pe.getUserOid(),users);if(u!=null){username=u.getName();if(username==null||username=="")
username=u.getEmailAddress();}
str=(pe.getAction()==Widget.ACTION_ADD)?"Added by ":"Last Edited by ";str+=username+" on ";str+=util.formatDate(pe.getRevTime());return str;}
Canvas.prototype.findUserHistory=function(oid,userHistory)
{var i;var id;for(i=0;i<userHistory.length;i++){if(oid==userHistory[i].getOid())
return userHistory[i];}
return null;}
Canvas.prototype.launch=function()
{var selectedObject=this.getSelectedObject();if(selectedObject){var mimeType=selectedObject.getMimeType();if(MimeTypes.isMimeType(mimeType,"audio/flash")){var container=selectedObject;for(var obj=container.firstChild;obj!=null;obj=obj.nextSibling){if(obj.tagName=="A"){var href=obj.href;window.open(href);break;}}}
else
selectedObject.launch();}}
Canvas.prototype.endOperation=function()
{if(this._resize){this._selectedObj.endOperation(x,y);}
else{if(this._snapToGrid!='snap'||this._selectedObj==null)
return false;var dim=this._selectedObj.getDimensions();var x=Math.floor(dim.x/20)*20;var y=Math.floor(dim.y/20)*20;this._selectedObj.moveTo(x,y);}}
Canvas.prototype.move=function(deltaX,deltaY)
{if(deltaX==0&&deltaY==0||this._selectedObj==null)
return;if(this._resize){this._selectedObj.resizeBy(this._resize,deltaX,deltaY);this.markDirty();}
else if(this._mousedown){this._selectedObj.moveBy(deltaX,deltaY);this.markDirty();}
this.resizeCanvas(this._selectedObj);}
Canvas.prototype.unSelectObject=function(mode)
{this.removeCurrentSelection(mode);this._selectedObj=null;}
Canvas.prototype.unSelectWidget=function(widget)
{if(this._selectedObj==widget)
this.unSelectObject(Editor.READ_WRITE);}
Canvas.prototype.removeCurrentSelection=function(mode)
{if(this._selectedObj){this._selectedObj.unselect(mode);}}
Canvas.prototype.createTooltip=function(id)
{if(document.createElement)
{var el=document.createElement('div');el.id=id;el.className='tooltip';with(el.style)
{display='none';position='absolute';zIndex=ZIndex.TOP_FIRST;}
el.innerHTML='&nbsp;';document.body.appendChild(el);}}
Canvas.prototype.showTooltip=function(id,evt,text)
{if(!document.getElementById(id))
this.createTooltip(id);var tooltip=document.getElementById(id);var scroll=dhtmlapi.getPageScroll();tooltip.style.left=(evt.clientX+scroll.scrollX+Canvas.TOOLTIP_OFFSETX)+'px';tooltip.style.top=(evt.clientY+scroll.scrollY+Canvas.TOOLTIP_OFFSETX)+'px';tooltip.innerHTML=text;tooltip.style.display='block';}
Canvas.prototype.hideTooltip=function(id)
{if(document.getElementById(id)){document.getElementById(id).style.display='none';}}
Canvas.prototype.getZIndexData=function(ziObj)
{var top=backward=-1;var bottom=forward=ZIndex.TOP_FIRST;var zi;for(var i in this._objectCache)
{zi=this._objectCache[i].getZIndex();if(zi>top)
top=zi;if(zi<bottom)
bottom=zi;if((zi>backward)&&(zi<ziObj))
backward=zi;if((zi<forward)&&(zi>ziObj))
forward=zi;}
if(forward>=ZIndex.TOP_FIRST)
forward=-1;return ZIndex.createInstance(top,bottom,forward,backward);}
Canvas.prototype.moveZIndex=function(obj,newpos)
{var zicur;var objcur;var oldpos=obj.getZIndex();if(oldpos==newpos)
return;for(var i in this._objectCache)
{objcur=this._objectCache[i];zicur=objcur.getZIndex();if(newpos<oldpos&&zicur>=newpos&&zicur<oldpos)
objcur.setZIndex(zicur+1);else if(newpos>oldpos&&zicur<=newpos&&zicur>oldpos)
objcur.setZIndex(zicur-1);}
obj.setZIndex(newpos);}
Canvas.prototype.reportZIndex=function()
{for(var i in this._objectCache)
{var objcur=this._objectCache[i];alert('object '+objcur.getId()+' has zindex '+objcur.getZIndex());}}
Canvas.prototype.setZIndex=function(obj,op)
{if(obj==null)
return;var zd=this.getZIndexData(obj.getZIndex());if((op==ZIndex.OPFORWARD)&&(zd._forward==-1))
return;if((op==ZIndex.OPBACKWARD)&&(zd._backward==-1))
return;var newpos=(op==ZIndex.OPFORWARD)?zd._forward:(op==ZIndex.OPBACKWARD)?zd._backward:(op==ZIndex.OPTOP)?zd._top:zd._bottom;this.moveZIndex(obj,newpos);}
Canvas.prototype.setTopLocation=function(t)
{this._element.style.top=t+"px";}
Canvas.prototype.reArrangeLayout=function()
{switch(this._layout._name)
{case"freeform":break;case"1_column":this.setColumnDistribution(1);break;case"2_column":this.setColumnDistribution(2);break;case"3_column":this.setColumnDistribution(3);break;default:break;}}
Canvas.prototype.setColumnDistribution=function(cols)
{var maxHeight=0;var currentHeight=10;var elemWidth=0;var canvasWidth=this.getWidth();var imageList=this.getObjects(Canvas.OBJECT_TYPE_RESOURCE,false);if(canvasWidth>600&&canvasWidth<900){elemWidth=canvasWidth/cols;}
else if(canvasWidth>900){elemWidth=900/cols;}
else{elemWidth=600/cols;}
var rows=new Array(cols);var numberImg=imageList.length;for(var p=0;p<imageList.length;p++)
{var dim=imageList[p].getDimensions();var col=p%cols;rows[col]=imageList[p];maxHeight=(maxHeight<dim.height)?dim.height:maxHeight;if(col==cols-1||p==(numberImg-1)){for(var j=0;j<rows.length&&rows[j]!=null;j++){var xcoord=(j*elemWidth)+(0.1*elemWidth);rows[j].moveTo(xcoord,currentHeight+250);this.resizeCanvas(rows[j]);}
for(var k=0;k<rows.length;k++){rows[k]=null;}
currentHeight=currentHeight+maxHeight+100;maxHeight=0}}}
Canvas.prototype.getDraggableElement=function(target)
{var parentNode=null;if(target.id!="canvas"){if(target.className=="draggable"){parentNode=target;}
else{parentNode=target.parentNode;while(parentNode){if(parentNode.id=="canvas"){parentNode=null;break;}
else{if(parentNode.className=="draggable")
break;parentNode=parentNode.parentNode;}}}}
return parentNode;}
Canvas.prototype.getWidgetTitleBar=function(target)
{var parentNode=null;if(target.id!="canvas"){if(target.className=="widgetToolbar"){parentNode=target;}
else{parentNode=target.parentNode;while(parentNode){if(parentNode.id=="canvas"){parentNode=null;break;}
else{if(parentNode.className=="widgetToolbar")
break;parentNode=parentNode.parentNode;}}}}
return parentNode;}
Canvas.prototype.getWidgetFooterBar=function(target)
{var parentNode=null;if(target.id!="canvas"){if(target.className=="widgetFooter"){parentNode=target;}
else{parentNode=target.parentNode;while(parentNode){if(parentNode.id=="canvas"){parentNode=null;break;}
else{if(parentNode.className=="widgetFooter")
break;parentNode=parentNode.parentNode;}}}}
return parentNode;}
Canvas.prototype.deleteObjectX=function(obj)
{if(obj==null)
return;if(obj._mimeType=="audio/flash"||obj._mimeType=="video/flash"){if(obj._editmode)
Canvas.numFlashRecordingWidgets--;}
this.unSelectObject(obj);obj.removeBars(this._element);var elem=obj.getElement();if(elem!=null)
this._element.removeChild(elem);this.removeFromCache(obj);this.markDirty();delete obj;}
Canvas.prototype.deleteObject=function(obj)
{if(confirm("Do you really want to delete this item?"))
this.deleteObjectX(obj);}
Canvas.prototype.setRevisionMode=function(on,lastViewedVersion)
{for(var i in this._objectCache)
{obj=this._objectCache[i];if(on)
obj.showChangeBox(lastViewedVersion);else
obj.removeChangeBox(lastViewedVersion);}
this.hideTooltip(Canvas.TOOLTIP_ID);this._showRevisions=on;this._lastViewedVersion=lastViewedVersion;}
Canvas.prototype.getRevisionMode=function()
{return this._showRevisions;}
Canvas.prototype.showChangeBox=function(obj)
{if((this.getRevisionMode()==true)&&(this.getEditMode()==Editor.READ_ONLY))
obj.showChangeBox(this._lastViewedVersion);}
Canvas.prototype.hasRevisions=function(lastViewedVersion)
{for(var i in this._objectCache)
{obj=this._objectCache[i];if(obj.hasRevisions(lastViewedVersion))
return true;}
return false;}
Canvas.prototype.load=function(data)
{this._element.innerHTML=data;}
Canvas.prototype.isPageSaved=function()
{var obj=null;for(var i in this._objectCache)
{obj=this._objectCache[i];if(obj.isDirty()){return true;}}
return this._isDirty;}
Canvas.prototype.isJavaEnabled=function()
{return this._editor.isJavaEnabled();}
Canvas.prototype.isJavaActive=function()
{return this._editor.isJavaActive();}
Canvas.prototype.clearChanged=function()
{var obj=null;for(var i in this._objectCache)
{obj=this._objectCache[i];obj.clearChanged();}
this.markClean();}
Canvas.prototype.clearFlashUpload=function()
{var obj=null;for(var i in this._objectCache)
{obj=this._objectCache[i];obj.markFlashUpload(false);}}
Canvas.prototype.resetExternalUpload=function()
{var obj=null;for(var i in this._objectCache)
{obj=this._objectCache[i];obj.resetExternalUpload();}}
Canvas.prototype.markClean=function()
{this._isDirty=false;}
Canvas.prototype.markDirty=function()
{this._isDirty=true;}
Canvas.prototype.getObjects=function(objectType,isDirty)
{var list=new Array();var mtype=null;var obj=null;for(var i=0;i<this._objectCacheOrdered.length;i++)
{obj=this.getObjectById(this._objectCacheOrdered[i]);if(isDirty==false||(isDirty==true&&obj.isDirty()))
{mtype=obj.getMimeType();if(objectType==Canvas.OBJECT_TYPE_ALL){list[list.length]=obj;}
else if(objectType==Canvas.OBJECT_TYPE_RESOURCE){if(obj.isExternalResource()==true)
list[list.length]=obj;}
else if(obj.isMimeType(objectType)){list[list.length]=obj;}}}
return list;}
Canvas.prototype.getObjectByType=function(mimeType)
{var list=new Array();for(var elem=this._element.firstChild;elem;elem=elem.nextSibling){var q=elem;if(MimeTypes.isMimeType(elem,mimeType)){list[list.length]=elem.id;}}
return list;}
Canvas.prototype.rotateNoJava=function(widget,url,rotation)
{this._editor.rotateNoJava(widget,url,rotation);}
Canvas.prototype.activateJava=function()
{for(var i in this._objectCache)
{obj=this._objectCache[i];obj.activateJava();}}
Canvas.prototype.refreshSlideshow=function()
{var slideshowObjects=this.getObjects('image',false);var slide=null;this._viewer=new PhotoViewer();this._viewer.setImageRoot("images/slide");this._viewer.disableEmailLink();this._viewer.setBackgroundColor('#FFFFFF');this._viewer.setBorderWidth(10);this._viewerCounter=0;var pref=this.getPreferences();var storageLoc=pref.getPreferenceValue("editor.storage.location");var imageLoc=pref.getPreferenceValue("editor.widgets.image.location");var i=0;var idx=-1;for(i=0;i<slideshowObjects.length;i++){slide=slideshowObjects[i];idx=-1;if(slide._urlMaster.indexOf('file:')==-1){idx=slide._urlMaster.lastIndexOf("/");this._viewer.add(storageLoc+imageLoc+"/"+slide._urlMaster.substr(idx+1)+"?"+Math.floor(Math.random()*1001));slide._viewerID=this._viewerCounter;this._viewerCounter++;}}}
ColorPicker.maxValue;ColorPicker.HSV;ColorPicker.hSV;ColorPicker.wSV;ColorPicker.hH;ColorPicker.slideHSV;ColorPicker.zINDEX;ColorPicker.stop;ColorPicker.ds;ColorPicker.oX;ColorPicker.oY;ColorPicker.eX;ColorPicker.eY;ColorPicker.left;ColorPicker.top;ColorPicker.tX;ColorPicker.tY;ColorPicker.oo;ColorPicker.d;ColorPicker.undoColor;function ColorPicker()
{ColorPicker.maxValue={'h':360,'s':100,'v':100};ColorPicker.HSV={0:360,1:100,2:100};ColorPicker.hSV=165;ColorPicker.wSV=162;ColorPicker.hH=163;ColorPicker.slideHSV={0:360,1:100,2:100};ColorPicker.zINDEX=ZIndex.EDITOR_TOOLBAR;ColorPicker.stop=1;}
ColorPicker.prototype.toHTML=function(){var plugin=document.createElement("div");plugin.id="plugin";plugin.style.top="42px";plugin.style.left="430px";plugin.style.zIndex=ZIndex.EDITOR_TOOLBAR;plugin.style.display="none";var plugCUR=document.createElement("div");plugCUR.id="plugCUR";plugin.appendChild(plugCUR);var plugHEX=document.createElement("div");plugHEX.id="plugHEX";plugHEX.innerHTML=" # ";var inputHEX=document.createElement("input");inputHEX.id="inputHEX";inputHEX.type="text";inputHEX.size=7;inputHEX.maxLength=6;inputHEX.value="FFFFFF";inputHEX.style.height="14px";inputHEX.style.fontSize="10px";inputHEX.style.fontFamily="Century Gothic";inputHEX.style.lineHeight="10px";var setHEX=document.createElement("img");setHEX.src="images/editor/colorPicker/set.gif";setHEX.align="absmiddle";setHEX.alt="Set new color based on HEX code";var revertHEX=document.createElement("img");revertHEX.src="images/editor/colorPicker/revert.gif";revertHEX.align="absmiddle";revertHEX.alt="Go back to the color set before opening the picker.";plugHEX.appendChild(inputHEX);plugHEX.appendChild(setHEX);plugHEX.appendChild(revertHEX);plugin.appendChild(plugHEX);var plugCLOSE=document.createElement("div");plugCLOSE.id="plugCLOSE";plugCLOSE.innerHTML="X";plugCLOSE.alt="Close";plugin.appendChild(plugCLOSE);var br=document.createElement("br");plugin.appendChild(br);var SV=document.createElement("div");SV.id="SV";SV.title="Saturation + Value";var SVslide=document.createElement("div");SVslide.id="SVslide";SVslide.style.top="-4px";SVslide.style.left="-4px";SVslide.innerHTML="<br />";SV.appendChild(SVslide);plugin.appendChild(SV);var H=document.createElement("form");H.id="H";H.title="Hue";var Hslide=document.createElement("div");Hslide.id="Hslide";Hslide.style.top="-7px";Hslide.style.left="-8px";Hslide.innerHTML="<br />";H.appendChild(Hslide);var Hmodel=document.createElement("div");Hmodel.id="Hmodel";H.appendChild(Hmodel);plugin.appendChild(H);document.body.appendChild(plugin);plugHEX.onmousedown=ColorPicker.handlePlugHEX;plugCLOSE.onmousedown=ColorPicker.handlePlugCLOSE;SV.onmousedown=ColorPicker.handleSV;H.onmousedown=ColorPicker.handleH;setHEX.onmousedown=ColorPicker.handleSetBackgroundColor;revertHEX.onmousedown=ColorPicker.handleRevert;inputHEX.onkeypress=ColorPicker.handleKeys;SV.ondrag=ColorPicker.handleSVdrag;H.ondrag=ColorPicker.handleHdrag;ColorPicker.loadSV();}
ColorPicker.isHex=function(entry){validChar='0123456789ABCDEF';strlen=entry.length;if(strlen>0){entry=entry.toUpperCase();for(i=0;i<strlen;i++){if(validChar.indexOf(entry.charAt(i))<0){ColorPicker.getElem('inputHEX').value=entry.substring(0,strlen-1);return false;}}
return true;}
return false;}
ColorPicker.loadSV=function(){var z='';for(var i=ColorPicker.hSV;i>=0;i--)
z+="<div style=\"BACKGROUND: #"+ColorPicker.hsv2hex([Math.round((360/ColorPicker.hSV)*i),100,100])+";\"><br /><\/div>";ColorPicker.getElem('Hmodel').innerHTML=z;}
ColorPicker.handlePlugIn=function(){ColorPicker.HSVslide('drag','plugin',event);}
ColorPicker.handlePlugHEX=function(){ColorPicker.stop=0;setTimeout('ColorPicker.stop=1',100);}
ColorPicker.handlePlugCLOSE=function(){ColorPicker.toggle('plugin');}
ColorPicker.handleSV=function(e){var evt=EventUtils.getEvent(e);ColorPicker.HSVslide('SVslide','plugin',evt);}
ColorPicker.handleH=function(e){var evt=EventUtils.getEvent(e);ColorPicker.HSVslide('Hslide','plugin',evt);}
ColorPicker.handleSVdrag=function(e){var evt=EventUtils.getEvent(e);ColorPicker.HSVslide('SVslide','plugin',evt);}
ColorPicker.handleHdrag=function(e){var evt=EventUtils.getEvent(e);ColorPicker.HSVslide('Hslide','plugin',evt);}
ColorPicker.handleSetBackgroundColor=function(){ColorPicker.HSVupdateManual();}
ColorPicker.handleKeys=function(){if(window.event.keyCode==13){ColorPicker.HSVupdateManual();return true;}else{if((window.event.keyCode>47&&window.event.keyCode<58)||(window.event.keyCode>64&&window.event.keyCode<71)||(window.event.keyCode>96&&window.event.keyCode<103))
return true;else{return false;}}}
ColorPicker.handleRevert=function(){ColorPicker.getElem('inputHEX').value=ColorPicker.undoColor.substring(1);ColorPicker.getElemStyle('plugCUR').background=ColorPicker.undoColor;var edit=Editor.editor;edit._preferences.setPreferenceValue("page.backgroundColor",ColorPicker.undoColor);edit.setBackgroundColor(ColorPicker.undoColor);}
ColorPicker.tXY=function(e){ColorPicker.tY=ColorPicker.XY(e,1)-ColorPicker.top;ColorPicker.tX=ColorPicker.XY(e)-ColorPicker.left;}
ColorPicker.ckHSV=function(a,b){if(ColorPicker.within(a,0,b)){return a;}
else if(a>b){return b;}
else if(a<0){return('-'+ColorPicker.oo);}}
ColorPicker.drag=function(e){if(!ColorPicker.stop){if(ColorPicker.d!='drag')
ColorPicker.tXY(e);if(ColorPicker.d=='SVslide'){ColorPicker.ds.left=ColorPicker.ckHSV(ColorPicker.tX-ColorPicker.oo,ColorPicker.wSV)+'px';ColorPicker.ds.top=ColorPicker.ckHSV(ColorPicker.tY-ColorPicker.oo,ColorPicker.wSV)+'px';ColorPicker.slideHSV[1]=ColorPicker.mkHSV(100,ColorPicker.wSV,ColorPicker.ds.left);ColorPicker.slideHSV[2]=100-ColorPicker.mkHSV(100,ColorPicker.wSV,ColorPicker.ds.top);ColorPicker.HSVupdate();}
else if(ColorPicker.d=='Hslide'){var ck=ColorPicker.ckHSV(ColorPicker.tY-ColorPicker.oo,ColorPicker.hH),j,r='hsv',z={};ColorPicker.ds.top=(ck-5)+'px';ColorPicker.slideHSV[0]=ColorPicker.mkHSV(360,ColorPicker.hH,ck);for(var i=0;i<=r.length-1;i++){j=r.substr(i,1);z[i]=(j=='h')?ColorPicker.maxValue[j]-ColorPicker.mkHSV(ColorPicker.maxValue[j],ColorPicker.hH,ck):ColorPicker.HSV[i];}
ColorPicker.HSVupdate(z);ColorPicker.getElemStyle('SV').backgroundColor='#'+ColorPicker.hsv2hex([ColorPicker.HSV[0],100,100]);}
else if(ColorPicker.d=='drag'){ColorPicker.ds.left=ColorPicker.XY(e)+ColorPicker.oX-ColorPicker.eX+'px';ColorPicker.ds.top=ColorPicker.XY(e,1)+ColorPicker.oY-ColorPicker.eY+'px';}}}
ColorPicker.HSVslide=function(dval,o,e){ColorPicker.d=dval;if(ColorPicker.stop){ColorPicker.stop='';ColorPicker.ds=ColorPicker.getElemStyle(ColorPicker.d!='drag'?ColorPicker.d:o);if(ColorPicker.d=='drag'){ColorPicker.oX=parseInt(ColorPicker.ds.left);ColorPicker.oY=parseInt(ColorPicker.ds.top);ColorPicker.eX=ColorPicker.XY(e);ColorPicker.eY=ColorPicker.XY(e,1);ColorPicker.getElemStyle(o).zIndex=ColorPicker.zINDEX++;}
else{ColorPicker.left=(ColorPicker.getElem(o).offsetLeft+10);ColorPicker.top=(ColorPicker.getElem(o).offsetTop+22);ColorPicker.oo=(ColorPicker.d=='Hslide')?2:4;if(ColorPicker.d=='SVslide')
ColorPicker.slideHSV[0]=ColorPicker.HSV[0];}
ColorPicker.getElem('SV').onmousemove=ColorPicker.drag;ColorPicker.getElem('H').onmousemove=ColorPicker.drag;ColorPicker.getElem('SV').onmouseup=function(){ColorPicker.stop=1;ColorPicker.getElem('SV').onmousemove='';ColorPicker.getElem('SV').onmouseup='';};ColorPicker.getElem('H').onmouseup=function(){ColorPicker.stop=1;ColorPicker.getElem('H').onmousemove='';ColorPicker.getElem('H').onmouseup='';};ColorPicker.drag(e);}}
ColorPicker.HSVupdate=function(v){v=ColorPicker.hsv2hex(ColorPicker.HSV=v?v:ColorPicker.slideHSV);ColorPicker.getElem('inputHEX').value=v;ColorPicker.getElemStyle('plugCUR').background='#'+v;var edit=Editor.editor;edit._preferences.setPreferenceValue("page.backgroundColor",'#'+v);edit.setBackgroundColor('#'+v);return(v);}
ColorPicker.HSVupdateManual=function(){v=ColorPicker.getElem('inputHEX').value;if(v.length<6)
alert("The color code is composed by 6 characters from a-f and 1-9. Please complete it.");else{ColorPicker.getElemStyle('plugCUR').background='#'+v;var edit=Editor.editor;edit._preferences.setPreferenceValue("page.backgroundColor",'#'+v);edit.setBackgroundColor('#'+v);}}
ColorPicker.toHex=function(v){v=Math.round(Math.min(Math.max(0,v),255));return("0123456789ABCDEF".charAt((v-v%16)/16)+"0123456789ABCDEF".charAt(v%16));}
ColorPicker.rgb2hex=function(r){return(ColorPicker.toHex(r[0])+ColorPicker.toHex(r[1])+ColorPicker.toHex(r[2]));}
ColorPicker.hsv2hex=function(h){return(ColorPicker.rgb2hex(ColorPicker.hsv2rgb(h)));}
ColorPicker.hsv2rgb=function(r){var R,B,G,S=r[1]/100,V=r[2]/100,H=r[0]/360;if(S>0){if(H>=1)H=0;H=6*H;F=H-Math.floor(H);A=Math.round(255*V*(1.0-S));B=Math.round(255*V*(1.0-(S*F)));C=Math.round(255*V*(1.0-(S*(1.0-F))));V=Math.round(255*V);switch(Math.floor(H)){case 0:R=V;G=C;B=A;break;case 1:R=B;G=V;B=A;break;case 2:R=A;G=V;B=C;break;case 3:R=A;G=B;B=V;break;case 4:R=C;G=A;B=V;break;case 5:R=V;G=A;B=B;break;}
return([R?R:0,G?G:0,B?B:0]);}
else return([(V=Math.round(V*255)),V,V]);}
ColorPicker.getElem=function(v){return(document.getElementById(v));}
ColorPicker.getElemStyle=function(v){return(ColorPicker.getElem(v).style);}
ColorPicker.agent=function(v){return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0));}
ColorPicker.toggle=function(v){var edit=Editor.editor;ColorPicker.undoColor=edit._canvas._element.style.backgroundColor
ColorPicker.getElemStyle('plugCUR').background=ColorPicker.undoColor;ColorPicker.getElemStyle('inputHEX').value=ColorPicker.undoColor.substring(1);ColorPicker.getElemStyle(v).display=(ColorPicker.getElemStyle(v).display=='none'?'block':'none');}
ColorPicker.within=function(v,a,z){return((v>=a&&v<=z)?true:false);}
ColorPicker.XY=function(e,v){var z=ColorPicker.agent('msie')?[event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop]:[e.pageX,e.pageY];return(z[ColorPicker.zero(v)]);}
ColorPicker.XYwin=function(v){var z=ColorPicker.agent('msie')?[document.body.clientHeight,document.body.clientWidth]:[window.innerHeight,window.innerWidth];return(!isNaN(v)?z[v]:z);}
ColorPicker.zero=function(v){v=parseInt(v);return(!isNaN(v)?v:0);}
ColorPicker.mkHSV=function(a,b,c){return(Math.min(a,Math.max(0,Math.ceil((parseInt(c)/b)*a))));}
Editor.NEW_PAGE=parseInt("0x01",16);Editor.EXISTING_PAGE=parseInt("0x02",16);Editor.READ_ONLY=parseInt("0x04",16);Editor.READ_WRITE=parseInt("0x08",16);Editor.SAVE_IN_PROGRESS=parseInt("0x10",16);Editor.editor=null;Editor.registeredClasses=null;Editor.prototype._voiceRecordersOpen;Editor.prototype._editmode;Editor.prototype._showRevisions;Editor.prototype._atb;Editor.prototype._canvas;Editor.prototype._preferences;Editor.prototype._title;Editor.prototype._templates;Editor.prototype._prev_clientX;Editor.prototype._prev_clientY;Editor.prototype._hasFocus;Editor.prototype._defaultWidgetOperation;Editor.prototype._html_text;Editor.prototype._currentPageVersion;Editor.prototype._versionHistory;Editor.prototype._objectEditHistory;Editor.prototype._objectEditHistoryIds;Editor.prototype._nextObjectId;Editor.prototype._userHistory;Editor.prototype._lastViewedVersion;Editor.prototype._popupMenuCreate;Editor.prototype._popupMenuWidget;Editor.prototype._currentPopupMenu;Editor.prototype._lastdropx;Editor.prototype._lastdropy;Editor.prototype._buildVersion;Editor.prototype._javaActive;Editor.prototype._javaEnabled;function Editor(editmode,dimensions,prefs,buildVersion,javaEnabled,javaActive)
{this._title=null;this._preferences=(prefs!=null)?prefs:new Preferences();this._buildVersion=buildVersion;this._popupMenuCreate=null;this._popupMenuWidget=null;this._currentPopupMenu=null;this._templates=null;this._defaultWidgetOperation=null;this._hasFocus=true;this._html_text=null;this._canvas=new Canvas(this,"canvas",dimensions);this._lastdropx=0;this._lastdropy=0;this._currentPageVersion=null;this._javaActive=javaActive;this._javaEnabled=javaEnabled;this._versionHistory=new Array();this._objectEditHistory=new Array();this._objectEditHistoryIds=new Array();this._nextObjectId=1000;this._userHistory=new Array();this._lastViewedVersion=-1;this._showRevisions=false;if(editmode!=null&&editmode==Editor.READ_ONLY){this._editmode=Editor.READ_ONLY;this._atb=null;this.setHandlers(this._editmode);}
else{this._editmode=Editor.READ_WRITE;var appContainer=document.getElementById("applet_precontainer");if(appContainer!=null)
appContainer.parentNode.removeChild(appContainer);if(this._javaEnabled&&this._javaActive)
this.createDropTarget();this.setHandlers(this._editmode);this._canvas.setTopLocation(53);}
this._canvas.setEditMode(this._editmode);this._canvas._zindexTop=ZIndex.WIDGET_FIRST;Editor.editor=this;}
Editor.getEditorObject=function(name){return Editor.editor;}
Editor.handleResize=function(e)
{var editor=Editor.getEditorObject();var h=null;var w=null;if(dhtmlapi.isIE){h=dhtmlapi.getObjectHeight(document.body);w=dhtmlapi.getObjectWidth(document.body);}
else{h=document.body.clientHeight;w=document.body.clientWidth;}
editor._canvas.resizeCanvasDimensions(w,h);}
Editor.handleBlur=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();editor._hasFocus=false;}
Editor.handleFocus=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();editor._hasFocus=true;}
Editor.handleDragEnter=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();var scroll=dhtmlapi.getPageScroll();editor._atb.style.display="block";editor._atb.style.top=(evt.clientY+scroll.scrollY-2)+"px";editor._atb.style.left=(evt.clientX+scroll.scrollX-2)+"px";EventUtils.stopPropagation(evt);}
Editor.handleDragOver=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();var scroll=dhtmlapi.getPageScroll();editor._atb.style.top=(evt.clientY+scroll.scrollY-2)+"px";editor._atb.style.left=(evt.clientX+scroll.scrollX-2)+"px";EventUtils.stopPropagation(evt);}
Editor.handleDragEnterFlashMode=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleDropFlashMode=function(e){alert('To drag stuff onto this page, please click on "Enable Drag and Drop" link at the top of the window.');var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleDragOverFlashMode=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleDragEnterViewMode=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleDropViewMode=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleDragOverViewMode=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleMouseDown=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var editor=Editor.getEditorObject();EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);if(evt.button==2){return false;}
if((editor._currentPopupMenu!=null)&&(editor._currentPopupMenu.isVisible())){if(editor._currentPopupMenu.isItemSelected()){return false;}
else{editor.closeContextMenu();return false;}}
if(target.id=="canvas"||target.tagName.toLowerCase()=="body"){return false;}
editor._prev_clientX=evt.clientX;editor._prev_clientY=evt.clientY;editor._canvas._mousedown=true;if(target.className=="resizer"){editor._canvas._resize=target.id;}
else
editor._canvas._resize=null;}
Editor.handleMouseOut=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();var canvas=editor._canvas;var target=EventUtils.getTargetElement(evt);var fromElement=EventUtils.getFromElement(evt);var toElement=EventUtils.getToElement(evt);if(canvas._resize!=null&&((fromElement!=null&&fromElement.tagName=="IFRAME")||(toElement!=null&&toElement.tagName=="IFRAME")))
{canvas._resize=null;}
EventUtils.stopPropagation(evt);}
Editor.handleMouseOver=function(e){var evt=EventUtils.getEvent(e);var editor=Editor.getEditorObject();var canvas=editor._canvas;EventUtils.stopPropagation(evt);if(canvas._mousedown||canvas._resize!=null){return false;}
var target=EventUtils.getTargetElement(evt);var container=canvas.getDraggableElement(target);var widgetTB=canvas.getWidgetTitleBar(target);var widgetFB=canvas.getWidgetFooterBar(target);if(target.id=="canvas"||container==null){if(editor._editmode==Editor.READ_ONLY)
canvas.rolloutObject();else if(widgetTB==null&&widgetFB==null)
canvas.unSelectObject(editor._editmode);return false;}
if(editor._editmode==Editor.READ_ONLY)
canvas.rolloverObject(container,evt,editor._userHistory);else
canvas.selectObject(container,editor._editmode);}
Editor.handleMouseMove=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var editor=Editor.getEditorObject();var canvas=editor._canvas;if(canvas._mousedown==true){var deltaX=evt.clientX-editor._prev_clientX;var deltaY=evt.clientY-editor._prev_clientY;editor._prev_clientX=evt.clientX;editor._prev_clientY=evt.clientY;canvas.move(deltaX,deltaY);}
EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);return false;}
Editor.handleMouseUp=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var canvas=Editor.getEditorObject()._canvas;if(canvas.getSelectedObject())
{canvas.endOperation();if(document.body&&document.body.releaseCapture){document.body.releaseCapture();}}
canvas._mousedown=false;canvas._resize=null;EventUtils.stopPropagation(evt);}
Editor.handleKeyUp=function(e){var evt=EventUtils.getEvent(e);var canvas=Editor.getEditorObject()._canvas;switch(evt.keyCode){case 46:canvas.deleteObject(canvas.getSelectedObject());canvas.reArrangeLayout();break;default:break;}}
Editor.handleDoubleClick=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var canvas=Editor.getEditorObject()._canvas;canvas.launch(target);return false;}
Editor.handleContextMenu=function(e){var editor=Editor.getEditorObject();var canvas=Editor.getEditorObject()._canvas;var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var container=canvas.getDraggableElement(target);var scroll=dhtmlapi.getPageScroll();var top=evt.clientY+scroll.scrollY;var left=evt.clientX+scroll.scrollX;editor.closeContextMenu();var isWidgetMenu=!((target.id=="canvas"||container==null));if(isWidgetMenu){canvas.selectMenuObject(container);editor._currentPopupMenu=editor.getWidgetPopupMenu(canvas);editor._currentPopupMenu.popup(top-10,left-10);}
else{editor._currentPopupMenu=editor.getCreatePopupMenu();editor._currentPopupMenu.popup(top-10,left-10);editor._currentPopupMenu.highlightItem(0);}
evt.returnValue=false;return false;}
Editor.drop=function()
{alert("You are faster than your computer, try dragging the image slower.\n"+"Use the feedback button to let us know if you are getting this message too often.");}
Editor.showLoading=function()
{var editor=Editor.getEditorObject();var h=editor._canvas.getHeight();var w=editor._canvas.getWidth();showLoading(h+80,w);}
Editor.disableEvents=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);}
Editor.prototype.showHintLayer=function(dnd){var desc=dnd?'Drag pictures and<br>other stuff from<br>your computer to here':'Click the file upload<br>button (<img src="images/editor/flashupload_disabled.gif">) to add<br>content to the page';var obj=document.createElement("div");obj.id="hintLayer";obj.style.zIndex=0;obj.className="hintLayer";obj.innerHTML="<span class='hintLayer2'>"+desc+"</span>";obj.onmousedown=Editor.disableEvents;obj.onmousemove=Editor.disableEvents;obj.onmouseup=Editor.disableEvents;obj.onkeyup=Editor.disableEvents;obj.ondblclick=Editor.disableEvents;obj.onmouseover=Editor.disableEvents;obj.onmouseout=Editor.disableEvents;obj.oncontextmenu=Editor.disableEvents;this._canvas._element.appendChild(obj);var obj_h=dhtmlapi.getObjectHeight(obj);var obj_w=dhtmlapi.getObjectWidth(obj);var can_h=dhtmlapi.getObjectHeight(this._canvas._element);var win_w=dhtmlapi.getInsideWindowWidth();var x=parseInt((win_w/2)-(obj_w/2));var y=parseInt((can_h/2)-(obj_h/2))-65;obj.style.top=y+'px';}
Editor.prototype.removeHintLayer=function(){var obj=document.getElementById("hintLayer");if(obj!=null)
obj.parentNode.removeChild(obj);}
Editor.initializeRegisteredClasses=function()
{Editor.registeredClasses=new Object();Editor.registeredClasses['text']=new MimeTypes("text",null);Editor.registeredClasses['image']=new MimeTypes('image',null);Editor.registeredClasses['audio']=new MimeTypes('audio',null);Editor.registeredClasses['video']=new MimeTypes('video',null);Editor.registeredClasses['custom']=new MimeTypes('custom',null);Editor.registeredClasses['application']=new MimeTypes('application',null);}
Editor.registerMimeType=function(typ,subtype,cls)
{if(Editor.registeredClasses==null){Editor.initializeRegisteredClasses();}
var mimetype=new MimeTypes(typ,subtype,cls);var mt=Editor.registeredClasses[typ];if(mt==null){throw new Error("Base mimetype ["+type+"] must be one of text, image, audio, video, application");}
if(mt._data==null)
mt._data=new Object();mt._data[subtype]=mimetype;}
Editor.getRegisteredClass=function(mimeType)
{var arr=mimeType.split('/');var typ=null;var subtype=null;var baseMimeTypes=null;var mt=null;try{typ=arr[0];subtype=arr[1];baseMimeTypes=Editor.registeredClasses[typ];if(baseMimeTypes==null)
return null;mt=baseMimeTypes._data[subtype];if(mt==null){mt=baseMimeTypes._data['*'];}
return mt._data;}catch(e){return null;}}
Editor.loadObject=function(urloptimized,urlmaster,urlarchive,name,width,height){var ed=Editor.getEditorObject();var canvas=ed._canvas;if(urloptimized!=null){urloptimized=Persistence.decode(urloptimized);urloptimized=urloptimized.replace(/;/g,"%3B");}
if(urlmaster!=null){urlmaster=Persistence.decode(urlmaster);urlmaster=urlmaster.replace(/;/g,"%3B");}
if(urlarchive!=null){urlarchive=Persistence.decode(urlarchive);urlarchive=urlarchive.replace(/;/g,"%3B");}
name=decodeURI(name);if(width>loadMax||height>loadMax){ratio=width/height;if(width>height){width=loadMax;height=width/ratio;}
else{height=loadMax;width=ratio*height;}}
var x=dhtmlapi.getObjectLeft(ed._atb)+4;var y=dhtmlapi.getObjectTop(ed._atb)+4-100;if(x>0&&y>0){this._lastdropx=x;this._lastdropy=y;}else{x=this._lastdropx+Math.floor(Math.random()*151);y=this._lastdropy+Math.floor(Math.random()*151);}
mtype=MimeTypes.getMimeType(urloptimized);var obj=canvas.createObject(ed.genNextObjectId(),mtype,urloptimized,x,y,height,width,-1,false);obj.setLogicalName(urloptimized,name);obj.setWidgetProperty("master",urlmaster);obj.setWidgetProperty("archive",urlarchive);obj.setExternalUpload(Widget.EXUPLOAD_MASKALL);if(width!=null&&height!=null){obj.setRatio(width/height);obj.resizeTo(height,width);}
if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);ed._atb.style.top="0px";ed._atb.style.left="-10px";}
Editor.loadObjectNoJava=function(urloptimized,urlmaster,urlarchive,width,height,name,objid){var idx=urloptimized.lastIndexOf("/");var part1=urloptimized.substring(0,idx);var part2=urloptimized.substring(idx+1);part2=encodeURIComponent(part2);urloptimized=part1+"/"+part2;var idx=urlmaster.lastIndexOf("/");var part1=urlmaster.substring(0,idx);var part2=urlmaster.substring(idx+1);part2=encodeURIComponent(part2);urlmaster=part1+"/"+part2;var idx=urlarchive.lastIndexOf("/");var part1=urlarchive.substring(0,idx);var part2=urlarchive.substring(idx+1);part2=encodeURIComponent(part2);urlarchive=part1+"/"+part2;var ed=Editor.getEditorObject();var canvas=ed._canvas;var x=100+Math.floor(Math.random()*201);var y=100+Math.floor(Math.random()*201);var mtype=MimeTypes.getMimeType(urloptimized);var obj=canvas.createObject(objid,mtype,urloptimized,x,y,height,width,-1,true);obj.setLogicalName(urloptimized,name);obj.setWidgetProperty("master",urlmaster);obj.setWidgetProperty("archive",urlarchive);if(width!=0&&height!=0){obj.setRatio(width/height);obj.resizeTo(height,width);}
if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);canvas.refreshSlideshow();}
Editor.changeImageName=function(id,imgName,w,h,r){var editor=Editor.getEditorObject();var canvas=editor._canvas;try{canvas.replaceObject(id,imgName,w,h,r);}catch(e){alert("imageEditor: could not find element ["+id+"] to manipulate");}}
Editor.updateServerThumbnail=function(filename){var editor=Editor.getEditorObject();var imageMgr=document.getElementById("imageMgr");imageMgr.uploadFileImageTrusted(filename);}
Editor.reArrangeLayout=function(){var canvas=editor._canvas;canvas.reArrangeLayout();}
Editor.contextMenuCB=function(title,operation,x,y){var editor=Editor.getEditorObject();var canvas=editor._canvas;var url=null;var objId=editor.genNextObjectId();var obj=null;var height=-1;var width=-1;var zindex=-1;if(operation=='insert_text'){obj=canvas.createObject(objId,"text/html",url,x,y,height,width,zindex,false);}
else if(operation=='insert_chat'){obj=canvas.createObject(objId,"text/chat",url,x,y,height,width,zindex,false);}
else if(operation=='insert_audio'){obj=canvas.createObject(objId,"audio/flash",url,x,y,height,width,zindex,false);}
else if(operation=='insert_video'){obj=canvas.createObject(objId,"video/flash",url,x,y,height,width,zindex,false);}
else if(operation=='insert_html'){obj=canvas.createObject(objId,"custom/html",url,x,y,height,width,zindex,false);}
else if(operation=='properties'){editor.showProperties();}
else{alert("contextMenuCB: title= "+title+", operation= "+operation);}
if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);}
Editor.contextMenuObjectCB=function(title,operation,x,y){var editor=Editor.getEditorObject();var canvas=editor._canvas;var obj=canvas.getSelectedMenuObject();if(operation=='z_forward'){canvas.setZIndex(obj,ZIndex.OPFORWARD);}
else if(operation=='z_backward'){canvas.setZIndex(obj,ZIndex.OPBACKWARD);}
else if(operation=='z_front'){canvas.setZIndex(obj,ZIndex.OPTOP);}
else if(operation=='z_back'){canvas.setZIndex(obj,ZIndex.OPBOTTOM);}}
Editor.rearrangeAppletAfterLoading=function(){var obj=document.getElementById("applet_container");if(obj!=null){obj.style.top="0px";obj.style.left="-10px";hideLoading();}
var bgColor=Editor.editor._canvas._element.style.backgroundColor;var imageMgr=document.getElementById("imageMgr");if(bgColor==null||bgColor==""||bgColor=='white')
bgColor='#FFFFFF';}
Editor.prototype.setDefaultWidgetCreated=function(operation){this._defaultWidgetOperation=operation;}
Editor.prototype.createDropTarget=function(){if(!this._javaEnabled){hideLoading();return;}
var div=String.fromCharCode(97,112,112,108,101,116);var imageSizeWidth=10000;var imageSizeHeight=10000;if(this._atb!=null)
return;var obj=document.createElement("div");obj.id="applet_container";obj.style.position="absolute";obj.style.overflow="hidden";obj.style.height="4px";obj.style.width="4px";obj.style.top="0px";obj.style.left="0px";document.body.appendChild(obj);var host=this._preferences.getPreferenceValue("editor.storage.host",location.host);var pathname=this._preferences.getPreferenceValue("editor.storage.context",location.pathname);var urlprefix=location.protocol+"//"+host;var domain=pathname.split("/")[1];var dimval=this._preferences.getPreferenceValue("editor.imageSize","1024x768");if(dimval=="original"){imageSizeWidth=10000;imageSizeHeight=10000;}
else{var imageSize=dimval.split("x");imageSizeWidth=imageSize[0];imageSizeHeight=imageSize[1];}
var bgColor=this._canvas._element.style.backgroundColor;if(bgColor==null||bgColor==""||bgColor=='white')
bgColor='#FFFFFF';var str='<'+div+' id="imageMgr" '+'    code="com.ews.droptarget.FileDropTarget.class" '+'    mayscript="mayscript" archive="ews_applets_'+this._buildVersion+'.jar" '+'    height=4px width=4px align=top border=0> '+'        <param name=urlprefix value="'+urlprefix+'">'+'        <param name=domainprefix value="'+domain+'">'+'        <param name=maxImageHeight value="'+imageSizeWidth+'">'+'        <param name=maxImageWidth value="'+imageSizeWidth+'">'+'        <param name=masterMax value="'+masterMax+'">'+'        <param name=optMax value="'+optMax+'">'+'        <param name=loadMax value="'+loadMax+'">'+'        <param name=uploadMax value="'+uploadMax+'">'+'        <param name=uploadBuildNShareMax value="'+uploadBuildNShareMax+'">'+'        <param name=backgroundColor value="'+bgColor+'">'+'        <param name=groupOid value="'+this._preferences.getPreferenceValue("editor.groupOid")+'">'+'        <param name=storagePathOid value="'+storagePathOid+'">'+'        <param name=pageOid value="'+this._preferences.getPreferenceValue("editor.pageOid")+'">'+'</'+div+'>';obj.innerHTML=str;this._atb=obj;var div=document.createElement('DIV');div.setAttribute('id','loading-refresher');document.body.appendChild(div);var obj=document.getElementById("loading-refresher");document.body.removeChild(obj);}
Editor.prototype.setDimensions=function(dim)
{this._canvas.setDimensions(dim);}
Editor.prototype.removeDropTarget=function(){if(this._atb!=null){var obj=document.getElementById("applet_container");document.body.removeChild(obj);this._atb=null;}}
Editor.prototype.clearHandlers=function(){document.onmousedown=null;document.onmousemove=null;document.onmouseup=null;document.onkeyup=null;document.ondblclick=null;document.onmouseover=null;document.onmouseout=null;document.oncontextmenu=null;var read=(this._editmode==Editor.READ_ONLY);if(dhtmlapi.isGecko==true){this._canvas._element.addEventListener('dragenter',read?Editor.handleDragEnterViewMode:Editor.handleDragEnterFlashMode,true);this._canvas._element.addEventListener('dragover',read?Editor.handleDragOverViewMode:Editor.handleDragOverFlashMode,true);this._canvas._element.addEventListener('drop',read?Editor.handleDropViewMode:Editor.handleDropFlashMode,true);}
else{this._canvas._element.ondragenter=read?Editor.handleDragEnterViewMode:Editor.handleDragEnterFlashMode;this._canvas._element.ondragover=read?Editor.handleDragOverViewMode:Editor.handleDragOverFlashMode;this._canvas._element.ondrop=read?Editor.handleDropViewMode:Editor.handleDropFlashMode;}}
Editor.prototype.setHandlers=function(mode)
{if(mode==Editor.READ_ONLY){document.onmouseover=Editor.handleMouseOver;document.onmouseout=Editor.handleMouseOut;if(dhtmlapi.isGecko==true){this._canvas._element.addEventListener('dragenter',Editor.handleDragEnterViewMode,true);this._canvas._element.addEventListener('dragover',Editor.handleDragOverViewMode,true);this._canvas._element.addEventListener('drop',Editor.handleDropViewMode,true);}
else{this._canvas._element.ondragenter=Editor.handleDragEnterViewMode;this._canvas._element.ondragover=Editor.handleDragOverViewMode;this._canvas._element.ondrop=Editor.handleDropViewMode;}}
else{var celem=this._canvas._element;if(this._javaEnabled&&this._javaActive){if(dhtmlapi.isGecko==true){celem.addEventListener('dragenter',Editor.handleDragEnter,true);celem.addEventListener('dragover',Editor.handleDragOver,true);celem.addEventListener('drop',Editor.drop,true);}
else{this._canvas._element.ondragenter=Editor.handleDragEnter;this._canvas._element.ondragover=Editor.handleDragOver;this._canvas._element.ondrop=Editor.drop;}}
else{if(dhtmlapi.isGecko==true){this._canvas._element.addEventListener('dragenter',Editor.handleDragEnterFlashMode,true);this._canvas._element.addEventListener('dragover',Editor.handleDragOverFlashMode,true);this._canvas._element.addEventListener('drop',Editor.handleDropFlashMode,true);}
else{this._canvas._element.ondragenter=Editor.handleDragEnterFlashMode;this._canvas._element.ondragover=Editor.handleDragOverFlashMode;this._canvas._element.ondrop=Editor.handleDropFlashMode;}}
document.onmousedown=Editor.handleMouseDown;document.onmousemove=Editor.handleMouseMove;document.onmouseup=Editor.handleMouseUp;document.onkeyup=Editor.handleKeyUp;document.ondblclick=Editor.handleDoubleClick;document.onmouseover=Editor.handleMouseOver;document.onmouseout=Editor.handleMouseOut;document.oncontextmenu=Editor.handleContextMenu;}
window.onresize=Editor.handleResize;}
Editor.prototype.disableHandlers=function(){document.onmousedown=null;document.onmousemove=null;document.onmouseup=null;document.onkeyup=null;document.ondblclick=null;document.onmouseover=null;document.onmouseout=null;document.oncontextmenu=null;this._canvas._element.ondragenter=null;this._canvas._element.ondragover=null;this._canvas._element.ondrop=null;}
Editor.prototype.getTitle=function(){return this._title;}
Editor.prototype.setTitle=function(val){this._title=val;}
Editor.prototype.genNextObjectId=function()
{var str=this._nextObjectId.toString();this._nextObjectId++;return str;}
Editor.prototype.setLayoutTemplate=function(layout){this._canvas.setLayout(layout);}
Editor.prototype.setEditMode=function(mode){if((mode!=null)&&(this._editMode!=mode)){if(mode==Editor.READ_ONLY){this.removeDropTarget();this._editmode=mode;}
else if(mode==Editor.READ_WRITE){this._canvas.setTopLocation(53);this._editmode=mode;this.setHandlers(mode);if(this._javaActive)
this.createDropTarget();else
hideLoading();if(tooltips=="true")
generateTooltip();}
this._canvas.setEditMode(this._editmode);}
return"ok";}
Editor.prototype.getEditMode=function(){return this._editmode;}
Editor.prototype.getPreferences=function()
{return this._preferences;}
Editor.prototype.isJavaEnabled=function()
{return this._javaEnabled;}
Editor.prototype.isJavaActive=function()
{return this._javaActive;}
Editor.prototype.getRevisionMode=function()
{return this._showRevisions;}
Editor.prototype.setRevisionMode=function(on)
{if(on!=this._showRevisions)
this._canvas.setRevisionMode(on,this._lastViewedVersion);this._showRevisions=on;}
Editor.prototype.hasRevisions=function()
{return this._canvas.hasRevisions(this._lastViewedVersion);}
Editor.prototype.showProperties=function()
{EditorProperties.display(this._canvas._element,this._preferences,this,this.setProperties);}
Editor.prototype.setProperties=function(properties)
{var props=properties.getElementsByTagName("property");for(var i=0;i<props.length;i++){var elem=props.item(i);var name=elem.getAttribute("name");var value=xmlutils.getNodeText(elem);this._preferences.setPreferenceValue(name,value);switch(name){case'page.backgroundColor':this.setBackgroundColor(value);break;case'editor.snapToGrid':this._canvas.snapToGrid(value);break;default:break;}}}
Editor.prototype.setBackgroundColor=function(val)
{document.body.style.backgroundColor=val;this._canvas._element.style.backgroundColor=val;var imageMgr=document.getElementById("imageMgr");if(imageMgr!=null)
imageMgr.updateBackgroundColor(val);}
Editor.prototype.closeContextMenu=function()
{if(this._currentPopupMenu!=null){if(this._currentPopupMenu.isVisible()){this._currentPopupMenu.popdown();}}
this._currentPopupMenu=null;}
Editor.prototype.getCreatePopupMenu=function(){if(this._popupMenuCreate==null){this._popupMenuCreate=PopupMenu.createInstance(document.body,"createmenu",Editor.contextMenuCB,null,82);this._popupMenuCreate.setFont('Century Gothic, Verdana, Arial, Helvetica, sans-serif',"10px");this._popupMenuCreate.addMenuItem("Add Text",'insert_text');this._popupMenuCreate.addMenuItem("Add Chat",'insert_chat');this._popupMenuCreate.addMenuItem("Record Audio",'insert_audio');this._popupMenuCreate.addMenuItem("Record Video",'insert_video');this._popupMenuCreate.addMenuItem("Custom HTML",'insert_html');}
return this._popupMenuCreate;}
Editor.prototype.getWidgetPopupMenu=function(canvas){if(this._popupMenuWidget!==null)
delete this._popupMenuWidget;var obj=canvas.getSelectedMenuObject();var ziObj=obj.getZIndex();var zd=canvas.getZIndexData(ziObj);this._popupMenuWidget=PopupMenu.createInstance(document.body,"zindexmenu",Editor.contextMenuObjectCB,null,100);this._popupMenuWidget.setFont('Century Gothic, Verdana, Arial, Helvetica, sans-serif',"10px");this._popupMenuWidget.addMenuItem("Bring Forward",zd._forward!=-1?'z_forward':null);this._popupMenuWidget.addMenuItem("Send Backward",zd._backward!=-1?'z_backward':null);this._popupMenuWidget.addMenuItem("Bring to Front",ziObj<zd._top?'z_front':null);this._popupMenuWidget.addMenuItem("Send to Back",ziObj>zd._bottom?'z_back':null);return this._popupMenuWidget;}
Editor.prototype.loadPageContents=function(pageData)
{this.loadPageVersion(pageData.version);if(pageData.history!=null&&pageData.lastViewed!=null)
this.loadPageHistory(pageData.history,pageData.lastViewed);if(pageData.users!=null)
this.loadPageUserHistory(pageData.users);try{var xmldoc=xmlutils.getXMLDocument();xmlutils.loadXml(xmldoc,pageData.contents);var pageDoc=xmldoc.childNodes.item(0);this._title=xmlutils.getElementText(pageDoc,"title");var metadataHTML=xmlutils.getChildNode(pageDoc,"metadata");var properties=xmlutils.getChildNode(pageDoc,"properties");if(properties!=null)
this.setProperties(properties);var content=xmlutils.getChildNode(pageDoc,"content");for(var elem=content.firstChild;elem!=null;elem=elem.nextSibling){if(elem.nodeType==1&&elem.nodeName=="object"){this.renderXml(elem);}}}catch(e){}
return true;}
Editor.prototype.getExternalResources=function(isDirty,mtype)
{var list=new Array();var objtype=(mtype!=null)?mtype:Canvas.OBJECT_TYPE_RESOURCE;objs=this._canvas.getObjects(objtype,isDirty);if(objs!=null){for(var i=0;i<objs.length;i++)
{var eres=objs[i].getExternalResource();if(eres!=null)
list.push(eres);}}
return list;}
Editor.prototype.getPageRevNumber=function(){if(this._currentPageVersion!=null)
return this._currentPageVersion.getRevNumber();else
return"-1";}
Editor.prototype.getPageNextRevNumber=function(){var revstr=this.getPageRevNumber();var revNum=parseInt(revstr);return revNum+1;}
Editor.prototype.isPageSaved=function(){return this._canvas.isPageSaved();}
Editor.prototype.renderXml=function(elem)
{try{var xml=elem;if(typeof elem=="string"){xmlutils.loadXml(xmlutils.dom,elem);xml=xmlutils.dom.documentElement;}
var mimetype=xml.getAttribute("mimeType");if(mimetype==null)
mimetype="application/*";var objId=xml.getAttribute("id");if(objId==null||objId=="")
objId=this.genNextObjectId();var objNum=parseInt(objId);var zindex=0;var zi=xml.getAttribute("zIndex");if(zi!=null&&zi.length>0){zindex=parseInt(zi);if(zindex<ZIndex.WIDGET_FIRST||zindex>ZIndex.WIDGET_LAST)
zindex=this._canvas._zindexTop;}
else
zindex=this._canvas._zindexTop;if(zindex>=this._canvas._zindexTop)
this._canvas._zindexTop=zindex+1;var cls=Editor.getRegisteredClass(mimetype);var obj=cls.RenderXML(xml,mimetype,objId,zindex,this._canvas);if(obj!=null){obj.setHistory(this.getObjectEditHistory(objId));this._canvas.addToCache(obj);this._canvas.resizeCanvas(obj);if(objNum>=this._nextObjectId){this._nextObjectId=objNum+1;}}}catch(e){alert("An error has occurred while trying to render an object of\n"+"type "+mimetype+", and will not be displayed on your page.");}}
Editor.prototype.htmlToXhtml=function(html){var exp=/<(img|IMG|embed|EMBED)([^>]+)>/g;var rr=html.replace(exp,"<$1$2></$1>");return rr;}
Editor.prototype.htmlToXML=function(){try{xmlutils.initialize();var canvas=editor._canvas;var pageXML=xmlutils.dom.createElement("page");var title=xmlutils.dom.createElement("title");var metadata=xmlutils.dom.createElement("metadata");var properties=xmlutils.dom.createElement("properties");var content=xmlutils.dom.createElement("content");var xmlstr=null;xmlutils.setNodeText(title,editor._title);pageXML.appendChild(title);if(this._currentPageVersion!=null){var versionInfo=this._currentPageVersion.toXMLObject();pageXML.appendChild(versionInfo);}
pageXML.appendChild(metadata);var pageProperties=this._preferences.get("page");if(pageProperties!=null)
pageProperties.toXml(properties,null);pageXML.appendChild(properties);var canvas=editor._canvas;for(var i in canvas._objectCache){var obj=canvas.getObjectById(i);var node=obj.toXML();if(node!=null)
content.appendChild(node);}
pageXML.appendChild(content);xmlstr=xmlutils.getNodeXML(pageXML);return xmlstr;}
catch(e){alert(e);}}
Editor.prototype.getObjectChangeList=function(){var canvas=editor._canvas;var xml;var obj;var objstr;xml="<edits>";for(var i in canvas._objectCache){obj=canvas.getObjectById(i);objstr=obj.getChangeXML(this._preferences.getPreferenceValue("editor.userOid"));if(objstr!=null)
xml+=objstr;}
xml+="</edits>";return xml;}
Editor.prototype.getThumbnailGenList=function()
{var canvas=editor._canvas;var xml;var obj;var objstr;xml="<thumbs>";for(var i in canvas._objectCache){obj=canvas.getObjectById(i);objstr=obj.getThumbnailGenXML();if(objstr!=null)
xml+=objstr;}
xml+="</thumbs>";return xml;}
Editor.prototype.loadPageVersion=function(xml){this._currentPageVersion=PageVersion.createInstance(xml);}
Editor.prototype.loadPageHistory=function(xml,lastViewed)
{var idx=xml.indexOf("<history>",idx);var end_idx=xml.indexOf("</history>",idx+9);var historyStr=xml.substring(idx+9,end_idx);idx=historyStr.indexOf("<nextobjectid>",0);end_idx=historyStr.indexOf("</nextobjectid>",idx+14);var nextId=parseInt(historyStr.substring(idx+14,end_idx));if(nextId>this._nextObjectId)
this._nextObjectId=nextId;idx=historyStr.indexOf("<versions>",end_idx+15);end_idx=historyStr.indexOf("</versions>",idx+10);var versionStr=historyStr.substring(idx+10,end_idx);this.loadVersionHistory(versionStr);idx=historyStr.indexOf("<edits>",end_idx+11);end_idx=historyStr.indexOf("</edits>",idx+7);var objectStr=historyStr.substring(idx+7,end_idx);this.loadObjectEditHistory(objectStr);this._lastViewedVersion=parseInt(lastViewed);}
Editor.prototype.loadVersionHistory=function(xml){var idx=0;var end_idx=0;var pvStr;var pvObj;idx=xml.indexOf("<version>",0);while(idx!=-1){end_idx=xml.indexOf("</version>",idx+9);pvStr=xml.substring(idx+9,end_idx);pvObj=PageVersion.createInstance(pvStr);this._versionHistory[this._versionHistory.length]=pvObj;idx=xml.indexOf("<version>",end_idx+10);}}
Editor.prototype.loadObjectEditHistory=function(xml){var idx=0;var end_idx=0;var idx1=0;var end_idx1=0;var editStr;var objectStr;var editList;var objId;var peObj;idx=xml.indexOf("<object",0);while(idx!=-1){end_idx=xml.indexOf("</object>",idx+7);objectStr=xml.substring(idx,end_idx+9);idx1=objectStr.indexOf('id="',0);end_idx1=objectStr.indexOf('"',idx1+4);objId=objectStr.substring(idx1+4,end_idx1);this._objectEditHistoryIds[this._objectEditHistoryIds.length]=objId;editList=new Array();idx1=objectStr.indexOf("><edit",end_idx1+1);while(idx1!=-1){end_idx1=objectStr.indexOf("/>",idx1+6);editStr=objectStr.substring(idx1+6,end_idx1);peObj=PageEdit.createInstance(editStr);editList[editList.length]=peObj;idx1=objectStr.indexOf("<edit",end_idx1+2);}
this._objectEditHistory[this._objectEditHistory.length]=editList;editList=null;idx=xml.indexOf("<object",end_idx+9);}}
Editor.prototype.getObjectEditHistory=function(id)
{var i;var id;for(i=0;i<this._objectEditHistoryIds.length;i++){if(id==this._objectEditHistoryIds[i])
return this._objectEditHistory[i];}
return null;}
Editor.prototype.loadPageUserHistory=function(userlist){var userObj;xmlutils.loadXml(xmlutils.dom,userlist);env=xmlutils.dom.documentElement;var users=env.getElementsByTagName("user");for(var i=0;i<users.length;i++){var u=users.item(i);userObj=User.parseXml(u);this._userHistory[this._userHistory.length]=userObj;}}
Editor.prototype.rotateNoJava=function(widget,url,rotation)
{if(gblRotateNoJavaCB!=null)
gblRotateNoJavaCB(widget,url,rotation,widget.getId(),Editor.rotateNoJavaCB);}
Editor.rotateNoJavaCB=function(widget,url,urlmaster)
{widget.handleNoJavaRotate(url,urlmaster);}
Editor.prototype.activateJava=function()
{this._javaActive=true;if(!this._javaEnabled)
return;this.disableHandlers();this.setHandlers(this._editmode);this.createDropTarget();this._canvas.activateJava();}
EditorProperties.container=null;EditorProperties.overlay=null;EditorProperties.cbobj=null;EditorProperties.cbfunc=null;EditorProperties.preferences;EditorProperties.changedProperties;EditorProperties.colorCodes=[{name:'Red',description:'indian red to dark red',rgb:'#FF0000',list:['#CD5C5C','#F08080','#FA8072','#E9967A','#FFA07A','#DC143C','#FF0000','#B22222','#8B0000']},{name:'Pink',description:'pink to pale violet ',rgb:'#FFC0CB',list:['#FFC0CB','#FFB6C1','FF69B4','FF1493','C71585','DB7093']},{name:'Orange',description:'salmon to orange',rgb:'#FFA500',list:['#FFA07A','#FF7F50','#FF6347','#FF4500','#FF8C00','#FFA500']},{name:'Yellow',description:'gold to dark khaki',rgb:'#FFFF00',list:['#FFD700','#FFFF00','#FFFFE0','#FFFACD','#FAFAD2','#FFEFD5','#FFE4B5','#FFDAB9','#EEE8AA','#F0E68C','#BDB76B']},{name:'Purple',description:'grey, brown, orange',rgb:'#800080',list:['#E6E6FA','#D8BFD8','#DDA0DD','#EE82EE','#DA70D6','#FF00FF','#FF00FF','#BA55D3','#9370DB','#8A2BE2','#9400D3','#9932CC','#8B008B','#800080','#4B0082','#6A5ACD','#483D8B']},{name:'Green',description:'Green Yellow to Teal',rgb:'#00FF00',list:['#ADFF2F','#7FFF00','#7CFC00','#00FF00','#32CD32','#98FB98','#90EE90','#00FA9A','#00FF7F','#3CB371','#2E8B57','#228B22','#008000','#006400','#9ACD32','#6B8E23','#808000','#556B2F','#66CDAA','#8FBC8F','#20B2AA','#008B8B','#008080']},{name:'Blue',description:'Aqua to Midnight blue',rgb:'#0000FF',list:['#00FFFF','#00FFFF','#E0FFFF','#AFEEEE','#7FFFD4','#40E0D0','#48D1CC','#00CED1','#5F9EA0','#4682B4','#B0C4DE','#B0E0E6','#ADD8E6','#87CEEB','#87CEFA','#00BFFF','#1E90FF','#6495ED','#7B68EE','#4169E1','#0000FF','#0000CD','#00008B','#000080','#191970']},{name:'Brown',description:'Cornsilk to Maroon',rgb:'#A52A2A',list:['#FFF8DC','#FFEBCD','#FFE4C4','#FFDEAD','#F5DEB3','#DEB887','#D2B48C','#BC8F8F','#F4A460','#DAA520','#B8860B','#CD853F','#D2691E','#8B4513','#A0522D','#A52A2A','#800000']},{name:'White',description:'White to Misty Rose',rgb:'#FFFFFF',list:['#FFFFFF','#FFFAFA','#F0FFF0','#F5FFFA','#F0FFFF','#F0F8FF','#F8F8FF','#F5F5F5','#FFF5EE','#F5F5DC','#FDF5E6','#FFFAF0','#FFFFF0','#FAEBD7','#FAF0E6','#FFF0F5','#FFE4E1']},{name:'Gray',description:'Gainsboro to Black',rgb:'#808080',list:['#DCDCDC','#D3D3D3','#D3D3D3','#C0C0C0','#A9A9A9','#A9A9A9','#808080','#808080','#696969','#696969','#778899','#778899','#708090','#708090','#2F4F4F','#2F4F4F','#000000']},{name:'All',description:'All',rgb:null,list:[]}];function EditorProperties()
{this._data=null;}
EditorProperties.handleSaveCancel=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var op=target.getAttribute('operation');document.body.removeChild(EditorProperties.container);document.body.removeChild(EditorProperties.overlay);EditorProperties.overlay=null;EditorProperties.container=null;if(op=='ok'){var properties=xmlutils.dom.createElement("properties");var elem=null;for(var name in EditorProperties.changedProperties){var value=EditorProperties.changedProperties[name];elem=xmlutils.createTextElement("property",value);elem.setAttribute("name",name);properties.appendChild(elem);}
EditorProperties.cbfunc.call(EditorProperties.cbobj,properties);}
EditorProperties.preferences=null;EditorProperties.changedProperties=null;EditorProperties.cbfunc=null;return false;}
EditorProperties.colorCategoryChange=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var name=target.innerText;if(name=='All'){var obj=new Object();obj.list=new Array();for(var i=0;i<EditorProperties.colorCodes.length;i++)
{var sublist=EditorProperties.colorCodes[i];for(var j=0;j<sublist.list.length;j++){obj.list[obj.list.length]=sublist.list[j];}}
EditorProperties.selectColorCode(obj);}
else{for(var i=0;i<EditorProperties.colorCodes.length;i++)
{if(EditorProperties.colorCodes[i].name==name){EditorProperties.selectColorCode(EditorProperties.colorCodes[i]);return;}}}}
EditorProperties.applyRgbValue=function()
{var obj=document.getElementById("rgbColorValue");var rgb=obj.value;var selectedColor=document.getElementById("selectedColor");if(rgb.charAt(0)!='#'){rgb='#'+rgb;}
try{selectedColor.style.backgroundColor=rgb;EditorProperties.logChangedProperty("page.backgroundColor",rgb);}catch(e){selectedColor.style.backgroundColor='#FFFFFF';obj.value='#FFFFFF';}}
EditorProperties.highlightColor=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);target.style.border="solid black 1px";}
EditorProperties.unhighlightColor=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);target.style.border="solid white 1px";}
EditorProperties.selectColor=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var obj=document.getElementById("selectedColor");var rgbColorValue=document.getElementById("rgbColorValue");obj.style.background=target.bgColor;rgbColorValue.value=target.bgColor;EditorProperties.logChangedProperty("page.backgroundColor",target.bgColor);}
EditorProperties.selectSnapToGrid=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);EditorProperties.logChangedProperty("editor.snapToGrid",target.value);}
EditorProperties.logChangedProperty=function(name,value)
{EditorProperties.changedProperties[name]=value;}
EditorProperties.display=function(parentContainer,preferences,cbobj,cbfunc)
{EditorProperties.preferences=preferences;EditorProperties.changedProperties=new Object();EditorProperties.cbobj=cbobj;EditorProperties.cbfunc=cbfunc;var pageData=dhtmlapi.getPageSize();var scrollTop=parseInt(document.body.scrollTop);EditorProperties.overlay=document.createElement("div");EditorProperties.overlay.style.position="absolute";EditorProperties.overlay.style.display="";EditorProperties.overlay.style.top=scrollTop+"px";EditorProperties.overlay.style.left="0px";EditorProperties.overlay.style.height=dhtmlapi.getObjectHeight(parentContainer)+"px";EditorProperties.overlay.style.width=dhtmlapi.getObjectWidth(parentContainer)+"px";EditorProperties.overlay.style.backgroundColor="black";EditorProperties.overlay.style.zIndex=200;dhtmlapi.setOpacity(EditorProperties.overlay,0.4);document.body.appendChild(EditorProperties.overlay);var container=document.createElement('div');container.style.position='absolute';container.style.top='150px';container.style.left='100px';container.style.height='400px';container.style.width='500px';container.style.backgroundColor='#FFFFFF';container.style.border='ridge #ADD8E6 8px';container.style.zIndex=201;document.body.appendChild(container);EditorProperties.container=container;var img=document.createElement('img');img.src='images/editor/pikiwikiproperties.png';img.style.height='40px';img.style.width='79px';container.appendChild(img);container.appendChild(document.createElement('br'));var tbl=document.createElement('table');container.appendChild(tbl);var tr=null;var td=null;tbl.width='100%';tr=tbl.insertRow(0);tr.style.valign='top';tr.style.height='320px';tr.style.borderTop='solid #F08080 2px';td=tr.insertCell(0);td.style.width='100px';td.style.borderRight='solid #F08080 2px';td=tr.insertCell(1);td.style.width='400px';td.vAlign='top';td.style.borderTop='solid #F08080 2px';tr=tbl.insertRow(1);td=tr.insertCell(0);td=tr.insertCell(1);td.align='center';var navbar=tbl.rows[0].cells[0];var main=tbl.rows[0].cells[1];var btns=tbl.rows[1].cells[1];EditorProperties.buildNavigation(navbar);EditorProperties.buildPropertyWindow(main);EditorProperties.buildFooter(btns);}
EditorProperties.buildNavigation=function(navContainer)
{var items=['Background','Images','Text','Alignment'];var spn=null;for(var i=0;i<items.length;i++)
{spn=document.createElement('span');spn.className='navigation';spn.style.fontSize='10px';spn.innerHTML=items[i];navContainer.appendChild(spn);navContainer.appendChild(document.createElement('br'));navContainer.appendChild(document.createElement('br'));navContainer.appendChild(document.createElement('br'));}}
EditorProperties.buildPropertyWindow=function(container)
{var scrollContainer=document.createElement('div');scrollContainer.style.overflowY='scroll';scrollContainer.style.overflowX='hidden';scrollContainer.style.width='100%';container.appendChild(scrollContainer);EditorProperties.buildBackgroundProperties(scrollContainer);}
EditorProperties.buildFooter=function(container)
{var btn=document.createElement('button');btn.innerHTML="Ok";btn.setAttribute('operation','ok');btn.onclick=EditorProperties.handleSaveCancel;container.appendChild(btn);var spn=document.createElement('span');spn.innerHTML='&nbsp;&nbsp;';container.appendChild(spn);var btn=document.createElement('button');btn.innerHTML="Cancel";btn.setAttribute('operation','cancel');btn.onclick=EditorProperties.handleSaveCancel;container.appendChild(btn);}
EditorProperties.buildBackgroundProperties=function(container)
{var div=document.createElement('div');var str='<table width="90% cellspacing=0 cellpadding=0">'+'<col width="5%"><col width="30%"><col width="65%">';str+='<tr valign="top">'+'  <td align="center"><span class=normalText>&nbsp;</span></td>'+'  <td align="center"><span class=normalText>Categories</span></td>'+'  <td align="center"><span class=normalText>Available Colors</span></td></tr>'+'<tr valign="top"><td>&nbsp;</td><td>';for(var i=0;i<EditorProperties.colorCodes.length;i++)
{var cc=EditorProperties.colorCodes[i];str+='<span class=smallText style="cursor:pointer;" onclick="EditorProperties.colorCategoryChange()">'
+cc.name+'</span><br>';}
str+='</td>'+'<td id=colorTable align=left style="border:1px solid lightgrey;"></td></tr>'+'<tr>'+'  <td>&nbsp;</td>'+'  <td align=center><div id="selectedColor" style="width:64px;height:16px;border:1px solid black;"></div></td>'+'  <td><span class=normalText>RGB Value&nbsp;</span>'+'      <input id=rgbColorValue class=normalText type=text size=7 maxlength=7 id=rgb>&nbsp;&nbsp;'+'      <button class=normalText onclick="EditorProperties.applyRgbValue()">Apply</button>'+'</td></tr></table>';div.innerHTML=str;container.appendChild(div);EditorProperties.selectColorCode(EditorProperties.colorCodes[0]);var bgcolor=EditorProperties.preferences.getPreferenceValue("page.backgroundColor");if(bgcolor!=null)
{var obj=document.getElementById("selectedColor");obj.style.background=bgcolor;}}
EditorProperties.buildAlignmentProperties=function(container)
{var snap=EditorProperties.preferences.getPreferenceValue("editor.snapToGrid");var chk_show=(snap=="show")?"checked":"";var chk_snap=(snap=="snap")?"checked":"";var chk_none=(chk_show!='checked'&&chk_snap!='checked')?"checked":"";var div=document.createElement('div');var str='<br><hr width="85%"><br><table width="90%" onclick="EditorProperties.selectSnapToGrid()">'+'<col width="10%"><col width="5%"><col width="85%">'+'<tr><td colspan=3><span class=normalText>Snap to Grid</span></td></tr>'+'<tr><td><br/></td>'+'    <td><input type=radio name=snapToGrid value=none '+chk_none+'></td>'+'    <td><span class=normalText>None</span></td></tr>'+'<tr><td><br/></td>'+'    <td><input type=radio name=snapToGrid value=show '+chk_show+'></td>'+'    <td><span class=normalText>Show Grid Lines Only</span></td></tr>'+'<tr><td><br/></td>'+'    <td><input type=radio name=snapToGrid value=snap '+chk_snap+'></td>'+'    <td><span class=normalText>Snap to Grid</span></td></tr>'+'</table><br><br>';div.innerHTML=str;container.appendChild(div);}
EditorProperties.selectColorCode=function(cc)
{var rows=Math.floor(cc.list.length/8);if((cc.list.length%8)>0)
rows++;var obj=document.getElementById('colorTable');var h=dhtmlapi.getObjectHeight(obj);var str='<div style="height:'+h+'px;overflow-x:hidden;overflow-y:scroll;"><table border=0 cellspacing="0" align=left>';var listIdx=0;for(var i=0;i<rows;i++)
{str+='<tr>';for(var j=0;j<8;j++)
{if(listIdx<cc.list.length)
str+='<td height="16" width="16" style="border:1px solid white;" onmouseover="EditorProperties.highlightColor()" onmouseout="EditorProperties.unhighlightColor()", onclick="EditorProperties.selectColor()" bgcolor="'+cc.list[listIdx++]+'">&nbsp;</td>';}
str+='</tr>';}
str+='</table></div>';obj.innerHTML=str;}
JavaTest.prototype._javaEnabled;JavaTest.prototype._navigatorPIResult;JavaTest.prototype._navigatorMTResult;JavaTest.prototype._activeXResult;JavaTest.prototype._oldVersion;function JavaTest()
{this._javaEnabled=false;this._navigatorPIResult="";this._navigatorMTResult="";this._activeXResult="";this._javaEnabled=false;}
JavaTest.prototype.testEnabled=function()
{this._javaEnabled=navigator.javaEnabled();return this._javaEnabled;}
JavaTest.prototype.testSafari=function()
{var st=navigator.appVersion;var val=st.indexOf("AppleWebKit");if(val!=-1){return true;}
else{return false;}}
JavaTest.prototype.testYahoo=function()
{var st=httpuseragent.toLowerCase();var val=st.indexOf("yplus");if(val!=-1&&BrowserDetect.version=="6"){return true;}
else{return false;}}
JavaTest.prototype.testMac=function()
{var st=navigator.appVersion;var val=st.indexOf("Macintosh");if(val!=-1){return true;}
else{return false;}}
JavaTest.prototype.testActiveXVersion=function(progID)
{var result=false;try{cmd="new ActiveXObject('"+progID+"');";var oJava=eval(cmd);if(oJava!=null){result=true;}}
catch(e){}
return result;}
JavaTest.prototype.testJavaVersion=function(tuple)
{var G,x3,x4,progID;var T=tuple.split(".")
var J="JavaPlugin."+T[0]+T[1];var v=T[0]+"."+T[1]+".";for(x3=T[2];x3>=0;x3--){for(x4=T[3];x4>=0;x4--){G=(x4<10)?"0"+x4:x4;progID=J+x3+"_"+G;if(this.testActiveXVersion(progID)){if(T[1]=="4"){this._oldVersion=true;return null;}
return v+x3+"_"+G;}}}
return null;}
JavaTest.prototype.testActiveX=function()
{var javaVersions=new Array("1.7.0.15","1.6.0.15","1.5.0.12","1.4.2.13");var version;if(window.ActiveXObject){activeXResult="Java not present";for(i=0;i<javaVersions.length;i++){version=this.testJavaVersion(javaVersions[i]);if(version!=null)
return true;}
if(this.testActiveXVersion("JavaPlugin"))
return true;}}
JavaTest.prototype.testNavigator=function()
{var x;var resultP=false;var resultM=false;if(navigator.plugins&&navigator.plugins.length){this._navigatorPIResult="none";navigator.plugins.refresh(false);for(x=0;x<navigator.plugins.length;x++){if(navigator.plugins[x].name.indexOf('Java(TM)')!=-1){this._navigatorPIResult=navigator.plugins[x].name;resultP=true;break;}}}
if(navigator.mimeTypes&&navigator.mimeTypes.length){this._navigatorMTResult="none";for(x=0;x<navigator.mimeTypes.length;x++){if((navigator.mimeTypes[x].type!=null)&&(navigator.mimeTypes[x].type.indexOf("application/x-java-applet;")!=-1)){this._navigatorMTResult=navigator.mimeTypes[x].type;resultM=true;break;}}}
return(resultP||resultM);}
JavaTest.prototype.run=function()
{if(!this.testEnabled())
return false;if(this.testMac())
return false;if(this.testSafari())
return false;if(this.testYahoo())
return false;if(this.testNavigator())
return true;return this.testActiveX();}
Layout.prototype._name;Layout.prototype._description;Layout.prototype._rows;Layout.prototype._columns;Layout.prototype._canvas;Layout.prototype._cumulative_width;Layout.prototype._cumulative_height;Layout.prototype._grid_rows;Layout.prototype._grid_columns;function Layout(name,description,rows,columns)
{this._name=name;this._description=description;}
Layout.prototype.calculate=function(obj,x,y)
{obj.toHtml();obj.moveTo(x,y);}
Layout.prototype.getName=function()
{return this._name;}
Layout.prototype.getDescription=function()
{return this._description;}
Layout.prototype.getRows=function()
{return this._rows;}
Layout.prototype.getColumns=function()
{return this._columns;}
Layout.prototype.setCanvas=function(canvas)
{this._canvas=canvas;}
PageEdit.prototype._userOid;PageEdit.prototype._widgetOid;PageEdit.prototype._action;PageEdit.prototype._actionDetail;PageEdit.prototype._revTime;PageEdit.prototype.pageVersion;function PageEdit(userOid,widgetOid,action,actionDetail,revTime,pageVersion)
{this._userOid=userOid;this._widgetOid=widgetOid;this._action=action;this._actionDetail=actionDetail;this._revTime=revTime;this._pageVersion=pageVersion;}
PageEdit.createInstance=function(xmlstr)
{var idx=null;var end_idx=null;var ms=null;var pe=new PageEdit();try{idx=xmlstr.indexOf('wid="');end_idx=xmlstr.indexOf('"',idx+5);pe._widgetOid=parseInt(xmlstr.substring(idx+5,end_idx));idx=xmlstr.indexOf('uid="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+5);pe._userOid=parseInt(xmlstr.substring(idx+5,end_idx));idx=xmlstr.indexOf('action="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+8);pe._action=parseInt(xmlstr.substring(idx+8,end_idx));idx=xmlstr.indexOf('actiondetail="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+14);pe._actionDetail=parseInt(xmlstr.substring(idx+14,end_idx));idx=xmlstr.indexOf('revtime="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+9);ms=parseInt(xmlstr.substring(idx+9,end_idx));if(ms==0)
pe._revTime=null;else
pe._revTime=new Date(ms);idx=xmlstr.indexOf('pageversion="',end_idx+1);end_idx=xmlstr.indexOf('"',idx+13);pe._pageVersion=parseInt(xmlstr.substring(idx+13,end_idx));return pe;}catch(e){alert("PageEdit.createInstance: "+e);return null;}}
PageEdit.prototype.toXML=function()
{s='<edit';s+=' wid="'+this._widgetOid+'"';s+=' uid="'+this._userOid+'"';s+=' action="'+this._action+'"';s+=' actiondetail="'+this._actionDetail+'"';s+=' revtime="'+((this._revTime==null)?0:this._revTime.getTime())+'"';s+=' />';return s;}
PageEdit.prototype.getWidgetOid=function()
{return this._widgetOid;}
PageEdit.prototype.getRevTime=function()
{return this._revTime;}
PageEdit.prototype.getUserOid=function()
{return this._userOid;}
PageEdit.prototype.getAction=function()
{return this._action;}
PageEdit.prototype.getPageVersion=function()
{return this._pageVersion;}
PageEdit.prototype.getActionDetail=function()
{return this._actionDetail;}
PageEdit.prototype.setUserOid=function(oid)
{this._userOid=oid;}
PageLockInfo.prototype._userOid;PageLockInfo.prototype._userSave;PageLockInfo.prototype._userMeta;PageLockInfo.prototype._activityTimeout;PageLockInfo.prototype._connectionTimeout;PageLockInfo.prototype._owner;function PageLockInfo(userOid,userOidSave,userOidMeta,activityTimeout,connectionTimeout,owner)
{this._userOid=userOid;this._userOidSave=userOidSave;this._userOidMeta=userOidMeta;this._activityTimeout=activityTimeout;this._connectionTimeout=connectionTimeout;this._owner=owner;}
PageLockInfo.createInstance=function(xmlstr,xmlstrOwner)
{var env=null;var ms=null;var pli=new PageLockInfo();pli._owner=null;try{if(typeof xmlstr=="string"){if(xmlstr!=""){xmlutils.loadXml(xmlutils.dom,xmlstr);env=xmlutils.dom.documentElement;}}
else
env=xmlstr;if(env!=null){for(elem=env.firstChild;elem!=null;elem=elem.nextSibling){var name=elem.nodeName;var val=xmlutils.getNodeText(elem);switch(name){case'useroid':pli._userOid=parseInt(val);break;case'saveuseroid:':pli._userOidSave=parseInt(val);break;case'metauseroid:':pli._userOidMeta=parseInt(val);break;case'activitytimeout':ms=parseInt(val);pli._activityTimeout=(ms==0)?null:new Date(ms);break;case'connecttimeout':ms=parseInt(val);pli._connectionTimeout=(ms==0)?null:new Date(ms);break;case'revuseroid':pli._revUserOid=parseInt(val);break;}}}
if(typeof xmlstrOwner=="string"){if(xmlstrOwner!=""){xmlutils.loadXml(xmlutils.dom,xmlstrOwner);env=xmlutils.dom.documentElement;}}
else
env=xmlstrOwner;if(env!=null){if(env.firstChild!=null)
pli._owner=User.createInstance(env.firstChild);}
return pli;}catch(e){alert("PageLockInfo.createInstance: "+e);return null;}}
PageLockInfo.prototype.isEqual=function(pv)
{if(this._userOid==pv._userOid&&this._activityTimeout==pv._activityTimeout&&this._connectionTimeout==pv._connectionTimeout){return true;}
else
return false;}
PageLockInfo.prototype.getUserOid=function()
{return this._userOid;}
PageLockInfo.prototype.getUserOidSave=function()
{return this._userOidSave;}
PageLockInfo.prototype.getUserOidMeta=function()
{return this._userOidMeta;}
PageLockInfo.prototype.getActivityTimeout=function()
{return this._activityTimeout;}
PageLockInfo.prototype.getConnectionTimeout=function()
{return this._connectionTimeout;}
PageLockInfo.prototype.getOwnerName=function()
{if(this._owner!=null)
return this._owner.getDisplayName();return null;}
Persistence.object=null;function Persistence()
{}
Persistence.upload=function(userOid,groupOid,pageOid,data,title,changeListXML,thumbGenXML,nextId,thumbnail,callingObject,option)
{Persistence.object=callingObject;Persistence.option=option;var obj=document.getElementById("imageMgr");obj.uploadHtml(userOid,groupOid,pageOid,data,title,changeListXML,thumbGenXML,nextId,thumbnail);}
Persistence.uploadHtmlDone=function(retStr)
{Persistence.object.successCB(Persistence.option,retStr);obj.generateThumbnail();}
Persistence.uploadHtmlError=function(errMsg)
{Persistence.object.errorCB(Persistence.option,errMsg);}
Persistence.uploadImage=function(groupOid,pageOid,local_name_archive,local_name_master,network_name,host,context,storagePathOid,w,h,callingObject,option)
{Persistence.object=callingObject;Persistence.option=option;var obj=document.getElementById("imageMgr");obj.uploadImage(groupOid,pageOid,local_name_archive,local_name_master,network_name,host,context,storagePathOid,w,h);}
Persistence.uploadImageStart=function()
{Persistence.object.progressCB(Persistence.option,"start",0,0);}
Persistence.uploadImageStartLoad=function(szImage,szMaster,szThumb)
{Persistence.object.progressCB(Persistence.option,"load",szImage,szMaster,szThumb);}
Persistence.uploadImageGenerateThumb=function(start)
{Persistence.object.progressCB(Persistence.option,start?"thumb":"thumbdone",0,0);}
Persistence.uploadImageProgress=function(index,numBytes)
{Persistence.object.progressCB(Persistence.option,"progress",index,numBytes);}
Persistence.uploadImageDone=function()
{Persistence.object.successCB(Persistence.option);}
Persistence.uploadImageError=function(errMsg)
{Persistence.object.errorCB(Persistence.option,errMsg);}
Persistence.uploadImageCancel=function()
{Persistence.object.cancelCB(Persistence.option);}
Persistence.uploadImageEstimateSize=function(locArchive,locMaster,network_name,w,h)
{var obj=document.getElementById("imageMgr");return obj.estimateImageSize(locArchive,locMaster,network_name,w,h);}
Persistence.getNetworkName=function(base,archive)
{var obj=document.getElementById("imageMgr");return obj.getNetworkName(base,archive);}
Persistence.signalCancelEvent=function()
{var obj=document.getElementById("imageMgr");return obj.signalCancelEvent();}
Persistence.removeProtocol=function(val)
{var fname=val;if(fname.indexOf("file:///")!=-1){fname=val.slice(8);}
return fname;}
Persistence.convertToHtmlName=function(url)
{var str=url.replace(/%20/g," ");str=str.replace(/&/g,"&amp;");return str;}
Persistence.convertToLocalName=function(url)
{var fname=url;if(fname.indexOf("file:///")!=-1){fname=url.slice(8);}
fname=fname.replace(/%20/g," ");return fname;}
Persistence.convertToNetworkName=function(url,title,id,revNumber)
{var idx=url.lastIndexOf(".");var suffix=(idx>=0)?url.substr(idx):"";var result=title;result=result+"_v"+revNumber+"o"+id+suffix;return result;}
Persistence.encode=function(url)
{var idx=url.lastIndexOf("/");var fname=url;if(idx!=-1){fname=fname.substr(0,idx+1)+escape(url.substr(idx+1));}else{fname=encodeURI(fname);}
return fname;}
Persistence.decode=function(url)
{var idx=url.lastIndexOf("/");var fname=url;if(idx!=-1){fname=fname.substr(0,idx+1)+unescape(url.substr(idx+1));}else{fname=decodeURI(fname);}
return fname;}
EditorSkin.currentSkin=null;EditorSkin.SAVE_SAMPLE_SIZE=30;EditorSkin.prototype._mainContainer;EditorSkin.prototype._toolbarContainer;EditorSkin.prototype._toolbarSeparator;EditorSkin.prototype._toolbar;EditorSkin.prototype._status;EditorSkin.prototype._moveInProgress;EditorSkin.prototype._layoutTemplates;EditorSkin.prototype._saveInProgress;EditorSkin.prototype._hasLock;EditorSkin.prototype._refreshTimeout;EditorSkin.prototype._activityTimeout;EditorSkin.prototype._activityHasWarned;EditorSkin.prototype._expireTime;EditorSkin.prototype._lockRefreshRate;EditorSkin.prototype._currentPageLockInfo;EditorSkin.prototype._cancelSave;EditorSkin.prototype._cancelMessage;EditorSkin.prototype._logger;EditorSkin.prototype._save_local_image_name_archive;EditorSkin.prototype._save_local_image_name_master;EditorSkin.prototype._save_network_image_name;EditorSkin.prototype._save_widget_width;EditorSkin.prototype._save_widget_height;EditorSkin.prototype._save_widget_id;EditorSkin.prototype._save_widget_url;EditorSkin.prototype._save_widget_counter;EditorSkin.prototype._save_widget_pct;EditorSkin.prototype._save_widget_size;EditorSkin.prototype._save_origImageSize;EditorSkin.prototype._save_masterImageSize;EditorSkin.prototype._save_totalSize;EditorSkin.prototype._save_curProgress;EditorSkin.prototype._save_curProgressFile;EditorSkin.prototype._save_startTime;EditorSkin.prototype._save_progressTimeout;EditorSkin.prototype._save_progressCounter;EditorSkin.prototype._save_expanded;EditorSkin.prototype._save_sample_size;EditorSkin.prototype._save_sample_interval;EditorSkin.prototype._save_sample_idx;EditorSkin.prototype._save_sample_last_progress;EditorSkin.prototype._save_sample_last_time;EditorSkin.prototype._save_server_alias;EditorSkin.prototype._fileUpload;EditorSkin.prototype._fileUploadObjId;EditorSkin.prototype._javaEnabled;EditorSkin.prototype._javaActive;EditorSkin.prototype._javaOld;EditorSkin.prototype._javaTested;EditorSkin.prototype._saveNShare;EditorSkin.prototype._rotateCB;EditorSkin.prototype._rotateWidget;EditorSkin.prototype._objectsToRefresh;function EditorSkin()
{this._mainContainer=null;this._toolbarContainer=null;this._toolbar=null;this._status="closed";this._moveInProgress=false;this._saveInProgress=false;this._hasLock=false;this._refreshTimeout=null;this._activityTimeout=null;this._activityHasWarned=false;this._expireTime=0;this._lockRefreshRate=60;this._currentPageLockInfo=null;this._save_local_image_name_archive=null;this._save_local_image_name_master=null;this._save_network_image_name=null;this._save_progressTimeout=null;this._save_sample_size=new Array(EditorSkin.SAVE_SAMPLE_SIZE);this._save_sample_interval=new Array(EditorSkin.SAVE_SAMPLE_SIZE);this._cancelSave=false;this._javaEnabled=true;this._javaActive=false;this._javaOld=false;this._javaTested=false;this._saveNShare=false;this._rotateCB=null;this._rotateWidget=null;this._objectsToRefresh;document.body.ondragenter=EditorSkin.disableDnD;document.body.ondragover=EditorSkin.disableDnD;}
EditorSkin.createInstance=function(editmode,readonly,javaEnabled,javaActive,javaOld,isAnonymousLink,isSaveNShare)
{var skin=new EditorSkin();skin.initialize(editmode,readonly,javaEnabled,javaActive,javaOld,isAnonymousLink,isSaveNShare);EditorSkin.currentSkin=skin;window.onbeforeunload=EditorSkin.confirmClose;return skin;}
EditorSkin.confirmClose=function(){if((editor.getEditMode()!=Editor.READ_ONLY)&&(editor.isPageSaved()))
return"If you leave this page without saving, your changes will be lost.  Are you sure you want to leave this page?";else
return;}
EditorSkin.changeRevisionMode=function(e)
{document.getElementById("showChanges").innerHTML=editor.getRevisionMode()?"Show Changes":"Hide Changes";document.getElementById("legend1").style.visibility=editor.getRevisionMode()?"hidden":"visible";document.getElementById("legend2").style.visibility=editor.getRevisionMode()?"hidden":"visible";editor.setRevisionMode(!editor.getRevisionMode());}
EditorSkin.closeEditor=function(e)
{window.close();}
EditorSkin.changeToEditMode=function(e)
{BrowserWarning.report(EditorSkin.changeToEditMode2);}
EditorSkin.changeToEditMode2=function()
{var skin=EditorSkin.currentSkin;if(!skin._javaTested&&skin._javaActive)
skin.runJavaTest(true);skin.switchMode();}
EditorSkin.handleOpenClose=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var skin=EditorSkin.currentSkin;if(skin._moveInProgress==true)
return false;skin._moveInProgress=true;if(EditorSkin.currentSkin._status=="closed")
EditorSkin.expand();else
EditorSkin.detract();}
EditorSkin.expand=function()
{var skin=EditorSkin.currentSkin;var l=dhtmlapi.getObjectLeft(skin._mainContainer);if(l>=0){skin._moveInProgress=false;skin._status="opened";return;}
skin._mainContainer.style.left=l+3+"px";setTimeout("EditorSkin.expand()",5);}
EditorSkin.detract=function()
{var skin=EditorSkin.currentSkin;var l=dhtmlapi.getObjectLeft(skin._mainContainer);if(l<=-115){skin._moveInProgress=false;skin._status="closed";return;}
skin._mainContainer.style.left=(l-3)+"px";setTimeout("EditorSkin.detract()",5);}
EditorSkin.disableDnD=function(){event.returnValue=false;}
EditorSkin.prototype.runJavaTest=function(showLoading)
{if(showLoading)
Editor.showLoading();this._javaTested=true;var jt=new JavaTest();var javaEnabled=jt.run();skin._javaEnabled=javaEnabled;skin._javaOld=jt._oldVersion;editor._javaEnabled=javaEnabled;if(showLoading)
hideLoading();}
EditorSkin.javaTestCB=function(ver,code)
{var skin=EditorSkin.currentSkin;var javaEnabled=(code==2);skin._javaEnabled=javaEnabled;editor._javaEnabled=javaEnabled;hideLoading();skin.switchMode();}
EditorSkin.prototype.switchMode=function()
{if(editor._editMode==Editor.READ_WRITE)
{Editor.showLoading();this.removeToolbar();this.createEditToolbar();this._toolbar.selectDefaultButton();var dim=this.getToolbarDimensions();dim.top=dim.height;editor.setDimensions(dim);setTimeout("editor.setEditMode(Editor.READ_WRITE)",200);return;}
var pageVersion=editor.getPageRevNumber();application.getPageContents(userOid,groupOid,pageOid,lockId,pageVersion,WRITELOCKTIMEOUT,EditorSkin.changeModeCB);}
EditorSkin.changeModeCB=function(pageData)
{if(pageData==null){alert("An error has occurred.  Please try again later.");return;}
var skin=EditorSkin.currentSkin;skin.loadPageLockInfo(pageData.lock,pageData.lockOwner);if(pageData.status=="locked"){var name=skin.getLockOwner();if(name==null||name.length==0)
alert("Sorry, you cannot edit the page right now as someone else\n"+"is currently modifying the page. Please try again later.");else
alert("Sorry, user '"+name+"' is currently editing this page.\n"+"Please try again later.");}
else if((pageData.status=="metalock")||(pageData.status=="savelock"))
alert("Sorry, you cannot edit the page right now because someone else is currently saving it.");else if(pageData.status=="badversion")
alert("Notice: this page has recently changed.  Before editing, please press F5 to reload the page. Or just close and re-open this page.");else{editor.loadPageVersion(pageData.version);skin.setLock();Editor.showLoading();skin.removeToolbar();skin.createEditToolbar();skin._toolbar.selectDefaultButton();var dim=skin.getToolbarDimensions();dim.top=dim.height;editor.setDimensions(dim);setTimeout("editor.setEditMode(Editor.READ_WRITE)",200);}}
EditorSkin.prototype.initialize=function(editmode,readonly,javaEnabled,javaActive,javaOld,isAnonymousLink,isSaveNShare)
{this._javaEnabled=javaEnabled;this._javaActive=javaActive;this._javaOld=javaOld;this._layoutTemplates=new Array();var l=new Layout("freeform","free positioning of objects on the canvas",0,0,true);this._layoutTemplates.push(l);var l=new Layout("1_column","One column, unlimited rows",-1,1,true);this._layoutTemplates.push(l);l=new Layout("2_column","square template with 2 rows and two colummns",-1,2,true);this._layoutTemplates.push(l);l=new Layout("3_column","3 columns and unlimited rows",-1,3,true);this._layoutTemplates.push(l);if(editmode==Editor.READ_WRITE){this._javaTested=javaActive;this._saveNShare=isSaveNShare;this.createEditToolbar();}
else{this.createViewToolbar(readonly,isAnonymousLink);}}
EditorSkin.prototype.getToolbarDimensions=function()
{var dim=new Object();dim.top=0;dim.left=0;dim.width=dhtmlapi.getObjectWidth(this._toolbarContainer);dim.height=dhtmlapi.getObjectTop(this._toolbarSeparator)+dhtmlapi.getObjectHeight(this._toolbarSeparator);return dim;}
EditorSkin.prototype.selectDefaultButtons=function()
{if(this._toolbar!=null)
this._toolbar.selectDefaultButton();}
EditorSkin.prototype.pageLoaded=function()
{var elem=document.getElementById("showChanges");if(elem!=null)
elem.style.visibility=editor.hasRevisions()?"visible":"hidden";}
EditorSkin.prototype.toolbarCB=function(toolbarName,state,operation,value)
{var canvas=editor._canvas;var url=null;var objId=null;var obj=null;var x=parseInt(dhtmlapi.getInsideWindowWidth()/2)-100;var y=parseInt(dhtmlapi.getInsideWindowHeight()/2)-100;if(toolbarName.indexOf("editToolbar")==-1){alert("Error: toolbar("+toolbarName+") is unknown");return;}
var name=operation;var height=-1;var width=-1;var zindex=-1;switch(operation){case"close":window.close();break;case"insert_file":this.saveNoJava();break;case"exec_media_manager":var url="mediaManager.jsp";var params="resizable, top=0, left= 0,width="+(window.screen.width*0.2)+", height="+(window.screen.height-30);var win=window.open(url,"mediaManagerWindow",params);break;case"text":objId=editor.genNextObjectId();obj=canvas.createObject(objId,"text/html",url,x,y,height,width,zindex,false);if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);break;case"chat":objId=editor.genNextObjectId();obj=canvas.createObject(objId,"text/chat",url,x,y,height,width,zindex,false);if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);break;case"audio":objId=editor.genNextObjectId();obj=canvas.createObject(objId,"audio/flash",url,x,y,height,width,zindex,false);if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);break;case"video":objId=editor.genNextObjectId();obj=canvas.createObject(objId,"video/flash",url,x,y,height,width,zindex,false);if(obj!=null)
obj.markChanged(Widget.ACTION_ADD,0);break;case"snaptogrid":if(canvas._snapToGrid=='none')
canvas.snapToGrid('snap');else
canvas.snapToGrid('none');break;case"backcolor":this.showColorPicker();break;case"feedback":var url="feedbackForm.jsp?url="+location.href+"&title="+document.title;var params="height=450,width=450";window.open(url,"feedbackWin",params);break;case"macfeatures":util.openWarning("macWarning.html");break;case"properties":editor.showProperties();break;case"pwhome":window.open("/ews/index.jsp");break;case"save":if(this._saveInProgress==true){alert("A save operation is already in progress.");}
else{this._saveInProgress=true;this.save();}
break;case"saveNshare":if(this._saveInProgress==true){alert("A save operation is already in progress.");}
else{this._saveInProgress=true;this.save();}
break;default:var found=false;for(var i=0;i<this._layoutTemplates.length;i++){var l=this._layoutTemplates[i];if(l.getName()==name){editor.setLayoutTemplate(l);found=true;break;}}
if(found==false)
alert("Error: no layout found with name '"+name+"'");break;}}
EditorSkin.prototype.removeToolbar=function()
{document.body.removeChild(this._toolbarContainer);document.body.removeChild(this._toolbarSeparator);this._toolbar=null;this._toolbarSeparator=null;}
EditorSkin.prototype.createEditToolbar=function()
{this._toolbarContainer=this.createContainer(document.body,"editToolbar","50px","100%","0px","0px","none");var isJava=this._javaEnabled&&this._javaActive;var tbl=document.createElement("table");tbl.id='editheadertable';tbl.width="100%";this._toolbarContainer.appendChild(tbl);var tr=tbl.insertRow(0);tr.vAlign="top";var td=tr.insertCell(0);td.style.width='450px';var b=null;var tb=new Toolbar("editToolbar",td);tb.setPadding(0);tb.setSpacing(0);tb.setHighlight(false);b=Button.createImage("pwhome",Button.BUTTON,"pwhome","images/editor/pwlogo.png",30,29,"Pikiwiki Editor");b=Button.createSprite("pwhome",Button.BUTTON,"pwhome","images/editor/toolbar.gif",30,30,0,0,"Pikiwiki Editor");tb.add(b);tb.add(Button.createSpacer(10));b=Button.createSprite("mediamgr",Button.BUTTON,"exec_media_manager","images/editor/toolbar.gif",30,30,0,-30,"media manager");b.setPressedSprite("images/editor/toolbar.gif",-30,-30);b.setDisabledSprite("images/editor/toolbar.gif",-30,-90);b.enable(isJava);tb.add(b);b=Button.createSprite("flashupload",Button.BUTTON,"insert_file","images/editor/toolbar.gif",30,30,0,-60,"insert an image or file");b.setPressedSprite("images/editor/toolbar.gif",-30,-60);tb.add(b);tb.add(Button.createSpacer(10));b=Button.createSprite("text",Button.BUTTON,"text","images/editor/toolbar.gif",30,30,0,-120,"add text");b.setPressedSprite("images/editor/toolbar.gif",-30,-120);tb.add(b);b=Button.createSprite("chat",Button.BUTTON,"chat","images/editor/toolbar.gif",30,30,0,-150,"add chat");b.setPressedSprite("images/editor/toolbar.gif",-30,-150);tb.add(b);b=Button.createSprite("audio",Button.BUTTON,"audio","images/editor/toolbar.gif",30,30,0,-180,"add audio");b.setPressedSprite("images/editor/toolbar.gif",-30,-180);tb.add(b);b=Button.createSprite("video",Button.BUTTON,"video","images/editor/toolbar.gif",30,30,0,-210,"add video");b.setPressedSprite("images/editor/toolbar.gif",-30,-210);tb.add(b);tb.add(Button.createSpacer(10));b=Button.createSprite("freeform",Button.RADIO_BUTTON,"freeform","images/editor/toolbar.gif",30,30,0,-240,"freeform image layout");b.setPressedSprite("images/editor/toolbar.gif",-30,-240);tb.add(b);b=Button.createSprite("onecolumn",Button.RADIO_BUTTON,"1_column","images/editor/toolbar.gif",30,30,0,-270,"layout images in single column");b.setPressedSprite("images/editor/toolbar.gif",-30,-270);tb.add(b);b=Button.createSprite("twocolumn",Button.RADIO_BUTTON,"2_column","images/editor/toolbar.gif",30,30,0,-300,"layout images in two columns");b.setPressedSprite("images/editor/toolbar.gif",-30,-300);tb.add(b);b=Button.createSprite("threecolumn",Button.RADIO_BUTTON,"3_column","images/editor/toolbar.gif",30,30,0,-330,"layout images in three columns");b.setPressedSprite("images/editor/toolbar.gif",-30,-330);tb.add(b);tb.setDefaultButton("freeform");tb.add(Button.createSpacer(10));b=Button.createSprite("snaptogridBtn",Button.TOGGLE_BUTTON,"snaptogrid","images/editor/toolbar.gif",30,30,0,-360,"snap to grid objects on the canvas");b.setPressedSprite("images/editor/toolbar.gif",-30,-360);tb.add(b);tb.add(Button.createSpacer(5));b=Button.createSprite("backColor",Button.TOGGLE_BUTTON,"backcolor","images/editor/toolbar.gif",30,30,0,-390,"pick the background color");b.setPressedSprite("images/editor/toolbar.gif",-30,-390);tb.add(b);this._toolbar=tb;this._toolbar.registerCallback(this);td=tr.insertCell(1);obj=document.createElement("div");obj.id="warnings";obj.style.height="45px";obj.style.width="45px";obj.style.zIndex=ZIndex.EDITOR_TOOLBAR;td.appendChild(obj);var jtest=new JavaTest();if(jtest.testMac()){setWarning('images/editor/missingfeatures.gif',"It appears you have a Mac. Apple and PikiWiki are working to make drag and drop possible",'util.openWarning("macWarning.html")');tb.add(Button.createSpacer(45));}else{tb.add(Button.createSpacer(45));}
td=tr.insertCell(2);td.style.width='150px';tb=new Toolbar("editToolbar2",td);tb.setPadding(0);tb.setSpacing(0);tb.setHighlight(false);tb.registerCallback(this);if(!this._saveNShare){b=Button.createImage("save",Button.BUTTON,"save","images/editor/save_normal.gif",28,68,"Save Page");b.setPressedImage("images/editor/save_rollover.gif");tb.add(b);tb.add(Button.createSpacer(5));b=Button.createImage("close",Button.BUTTON,"close","images/editor/close_normal.gif",28,68,"Close Page");b.setPressedImage("images/editor/close_rollover.gif");tb.add(b);}else{b=Button.createImage("saveNshare",Button.BUTTON,"saveNshare","images/editor/saveshare_normal.gif",28,136,"Save and share page");b.setPressedImage("images/editor/saveshare_rollover.gif");tb.add(b);}
var jhtml;if(!this._javaTested&&!jtest.testMac()&&!jtest.testYahoo())
jhtml="<a href=# onClick='activateJava()'>Enable Drag & Drop</a>";else if(jtest.testMac()||jtest.testYahoo())
jhtml="";else if(!this._javaEnabled&&this._javaOld){jhtml="";setWarning('images/editor/getnewjava.gif',"You have an old version of Java.  For the fastest and most reliable PikiWiki experience, click here",'util.openWarning("OldJavaWarning.html")');}
else if(!this._javaEnabled){jhtml="";setWarning('images/editor/getjava.gif',"You don't have Java.  For the best PikiWiki experience, including full drag and drop functionality from your desktop, click here",'util.openWarning("javaWarning.html")');}
else if(this._javaActive)
jhtml="Drag & Drop ON";else if(!jtest.testMac())
jhtml="<a href=# onClick='activateJava()'>Enable Drag & Drop</a>";else
jhtml="";jhtml="<td width='125' align='left' valign='bottom' id='jdnd' class=smallText>"+jhtml+"</td>";var obj=document.createElement("div");obj.id="editModeLogofeedback";obj.style.position="absolute";obj.style.height="20px";obj.style.width="100%";obj.style.top="28px";obj.style.left="0px";obj.style.zIndex=ZIndex.EDITOR_TOOLBAR;obj.innerHTML="<table width='100%' border='0'><tr>"+jhtml
+"<td align='center' valign='middle' class=normalText></span></td>"
+"<td width='100' align='right' valign='bottom'  class=normalText>"
+"<a href='http://pikiwiki.com/help/questions/15/How+do+I+use+the+Page+Editor%3F' target='_blank'>Help</a>&nbsp&nbsp&nbsp&nbsp<a href=# onClick='util.openFeedback()'>Feedback</a>"
+"</td></tr></table>";this._toolbarContainer.appendChild(obj);obj=document.createElement("div");obj.id="captions";obj.style.position="absolute";obj.style.height="14px";obj.style.width="340px";obj.style.top="34px";obj.style.left="110px";obj.style.zIndex=ZIndex.EDITOR_TOOLBAR-1;obj.innerHTML="<img src='images/editor/buttonscaptions.gif' alt='button captions' width='100%' height='100%'/>";this._toolbarContainer.appendChild(obj);this.createToolbarSeparator();}
EditorSkin.prototype.createViewToolbar=function(readonly,isAnonymousLink)
{this._toolbarContainer=this.createContainer(document.body,"viewToolbar","50px","100%","0px","0px","none");var headertable=document.createElement("table");headertable.id='viewheadertable';headertable.width="100%";headertable.border="0px";this._toolbarContainer.appendChild(headertable);var tr=headertable.insertRow(0);tr.vAlign="top";var td=tr.insertCell(0);var link=document.createElement("a");link.href="/ews/index.jsp";link.target="_blank";var logo=document.createElement("img");logo.src="images/editor/pwminilogo.jpg";logo.alt="pw mini logo";logo.style.border="none";logo.style.width="151px";logo.style.height="30px";td.style.width="25%";td.align="left";td.vAlign="top";link.appendChild(logo);td.appendChild(link);td=tr.insertCell(1);td.style.width="50%";td.align="center";if(isAnonymousLink){var builddiv=document.createElement("div");builddiv.id="buildbutton";builddiv.align="center";builddiv.style.width="100%";builddiv.style.position="absolute";builddiv.style.top="0px";builddiv.style.zIndex=ZIndex.EDITOR_TOOLBAR
b=Button.createImage("buildpage",Button.BUTTON,"buildpage","images/editor/buildpage_normal.gif",45,150,"Create your own page!!!");b.setPressedImage("images/editor/buildpage_rollover.gif");btn=b.getElement();btn.style.cursor="pointer";btn.onclick=util.openEditorCreatenSend;td.appendChild(btn);}
else{spn=document.createElement("span");spn.id="showChanges";spn.innerHTML="Show Changes";spn.style.textDecoration="underline";spn.style.color="gray";spn.style.fontSize="10pt";spn.style.fontFamily='Century Gothic, Verdana, Arial, Helvetica, sans-serif';spn.style.cursor="pointer";spn.style.visibility="hidden";spn.style.verticalAlign="top";spn.onclick=EditorSkin.changeRevisionMode;td.appendChild(spn);spn=document.createElement("span");spn.innerHTML="&nbsp;";td.appendChild(spn);spn=document.createElement("span");spn.id="legend1";spn.innerHTML="&nbsp;New&nbsp;";spn.style.color="red";spn.style.fontSize="10pt";spn.style.border="solid red 2px";spn.style.verticalAlign="top";spn.style.fontFamily='Century Gothic, Verdana, Arial, Helvetica, sans-serif';spn.style.visibility="hidden";td.appendChild(spn);spn=document.createElement("span");spn.innerHTML="&nbsp;";td.appendChild(spn);spn=document.createElement("span");spn.id="legend2";spn.innerHTML="&nbsp;Changed&nbsp;";spn.style.fontSize="10pt";spn.style.color="blue";spn.style.border="solid blue 2px";spn.style.fontFamily='Century Gothic, Verdana, Arial, Helvetica, sans-serif';spn.style.visibility="hidden";spn.style.verticalAlign="top";td.align="left";td.valign="middle";td.style.width="50%";td.appendChild(spn);}
td=tr.insertCell(2);td.style.width="25%";td.align='right';var b=null;var btn=null;if(readonly==false||readonly=="false"){b=Button.createImage("edit",Button.BUTTON,"edit","images/editor/edit_normal.gif",28,68,"Edit this page");b.setPressedImage("images/editor/edit_rollover.gif");btn=b.getElement();btn.style.cursor="pointer";btn.onclick=EditorSkin.changeToEditMode;td.appendChild(btn);}
if(isAnonymousLink==false){b=Button.createImage("close",Button.BUTTON,"close","images/editor/close_normal.gif",28,68,"Close Page");b.setPressedImage("images/editor/close_rollover.gif");btn=b.getElement();btn.style.cursor="pointer";btn.onclick=EditorSkin.closeEditor;td.appendChild(btn);}
var obj=document.createElement("div");obj.id="viewModeLogofeedback";obj.style.marginLeft='auto';obj.style.marginRight='0px';obj.style.width="25%";obj.style.position="absolute";obj.style.height="20px";obj.style.top="28px";obj.style.right="0px";obj.style.zIndex=ZIndex.EDITOR_TOOLBAR;obj.innerHTML="<table width='100%' border='0'><tr>"
+"<td width='75'></td>"
+"<td align='center' valign='middle' class=normalText></span></td>"
+"<td width='100' align='right' valign='bottom' class=normalText>&nbsp;</td>"
+"<td width='100' align='right' valign='bottom' class=normalText>"
+"<a href='http://pikiwiki.com/help/questions/15/How+do+I+use+the+Page+Editor%3F' target='_blank'>Help</a>&nbsp&nbsp&nbsp&nbsp<a href=# onClick='util.openFeedback()'>Feedback</a>"
+"</td></tr></table>";this._toolbarContainer.appendChild(obj);this.createToolbarSeparator();return obj;}
EditorSkin.prototype.createContainer=function(parent,id,h,w,t,l,border)
{var obj=document.createElement("div");obj.id=id;obj.style.position="absolute";obj.style.height=h;obj.style.width=w;obj.style.top=t;obj.style.left=l;obj.style.background="#FFFFFF";obj.style.border=border;obj.style.zIndex=ZIndex.EDITOR_TOOLBAR;obj.ondragover=EditorSkin.disableDnD;obj.ondragenter=EditorSkin.disableDnD;parent.appendChild(obj);return obj;}
EditorSkin.prototype.createToolbarSeparator=function()
{var obj=document.createElement("div");var t=dhtmlapi.getObjectTop(this._toolbarContainer);var h=dhtmlapi.getObjectHeight(this._toolbarContainer);obj.style.top=(t+h)+"px";obj.style.position="absolute";obj.style.left="0px"
obj.style.right="0px"
obj.style.height="4px";obj.style.backgroundImage="url(images/editor/separator.gif)";obj.style.width="100%";obj.style.overflow='hidden';document.body.appendChild(obj);this._toolbarSeparator=obj;}
EditorSkin.prototype.showColorPicker=function()
{var pi=document.getElementById("plugin");if(pi==null){var cp=new ColorPicker();cp.toHTML();ColorPicker.toggle("plugin");}else{ColorPicker.toggle("plugin");}}
EditorSkin.refreshLock=function(){var skin=EditorSkin.currentSkin;application.refreshPageLock(userOid,groupOid,pageOid,lockId,EditorSkin.refreshLockCB);}
EditorSkin.refreshLockCB=function(ret)
{var skin=EditorSkin.currentSkin;if(ret==true){skin._refreshTimeout=setTimeout("EditorSkin.refreshLock()",skin._lockRefreshRate*1000);}}
EditorSkin.prototype.setLock=function(){if(!this._hasLock){this._hasLock=true;this._refreshTimeout=setTimeout("EditorSkin.refreshLock()",this._lockRefreshRate*1000);}}
EditorSkin.prototype.killRefreshLockTimer=function(){if(this._refreshTimeout!=null){clearTimeout(this._refreshTimeout);this._refreshTimeout=null;}}
EditorSkin.prototype.killActivityLockTimer=function(){if(this._activityTimeout!=null){clearTimeout(this._activityTimeout);this._activityTimeout=null;}}
EditorSkin.prototype.getLockOwner=function(){if(this._currentPageLockInfo!=null)
return this._currentPageLockInfo.getOwnerName();else
return null;}
EditorSkin.prototype.loadPageLockInfo=function(xmlLock,xmlLockOwner){this._currentPageLockInfo=PageLockInfo.createInstance(xmlLock,xmlLockOwner);}
EditorSkin.prototype.initializeLockState=function(lock,owner,isWrite){this.loadPageLockInfo(lock,owner);if(isWrite)
this.setLock();}
EditorSkin.prototype.save=function()
{var title=editor.getTitle();loadingLayer(editor._canvas.getHeight()+80,editor._canvas.getWidth());if(editor.getTitle()=="")
this.promptForPageTitle();else
this.startSaveOperation(title);}
EditorSkin.prototype.promptForPageTitle=function()
{var div=document.createElement('div');div.id='savePageDialog';div.className='normalText';div.style.backgroundColor='#E4EDF2';div.style.position='absolute';div.style.border='solid black 2px';div.style.paddingTop='15px';div.style.paddingBottom='15px';div.style.paddingLeft='10px';div.style.paddingRight='10px';div.style.zIndex=ZIndex.PROGRESS_BAR;div.style.backgroundImage='url(images/loading-bottom.gif)';div.innerHTML='<span class=largeText>Save as:&nbsp;&nbsp;</span>'+'<input class=largeText type=text id=savePageDialogInputField onKeyPress="EditorSkin.savePageDialogCBReturn()" value="" maxlength=50><br><br>'+'<center><button onclick="EditorSkin.savePageDialogCB(\'ok\')">Ok</button>&nbsp;'+'        <button onclick="EditorSkin.savePageDialogCB(\'cancel\')">Cancel</button></center>';document.body.appendChild(div);dhtmlapi.centerOnWindow(div);var obj=document.getElementById("savePageDialogInputField");obj.focus();}
EditorSkin.savePageDialogCBReturn=function()
{var charnum=window.event.keyCode;if(charnum==13)
EditorSkin.savePageDialogCB('ok');}
EditorSkin.savePageDialogCB=function(val)
{var skin=EditorSkin.currentSkin;var obj=document.getElementById("savePageDialog");if(val=='ok'){var name=document.getElementById("savePageDialogInputField").value;if(name==null||name==""){alert("Please specify a title for this page");return;}
document.body.removeChild(obj);editor.setTitle(name);skin.startSaveOperation();}
else{document.body.removeChild(obj);skin.saveCleanup();return;}}
EditorSkin.prototype.startSaveOperation=function()
{var pageData=null;var pageVersion=editor.getPageRevNumber();application.savePageStart(userOid,groupOid,pageOid,lockId,pageVersion,EditorSkin.saveCB);}
EditorSkin.saveCB=function(pageData)
{var skin=EditorSkin.currentSkin;if(pageData==null){savePageCB("save",groupOid,topicOid,pageOid,"error");skin.saveCleanup();return;}
skin.loadPageLockInfo(pageData.lock,pageData.lockOwner);if(pageData.status=="ok"){if(pageData.info==null){savePageCB("save",groupOid,topicOid,pageOid,"error");skin.saveCleanup();return;}}
if(pageData.status!="ok"){savePageCB("save",groupOid,topicOid,pageOid,pageData.status);skin.saveCleanup();return;}
skin._save_server_alias=(pageData.serveralias!=null&&pageData.serveralias.length!=0)?pageData.serveralias:null;skin.save2();}
EditorSkin.prototype.save2=function()
{var list;var i;var obj;this.setLock();this.objectsToRefresh=editor._canvas.getObjects('image',true);list=editor.getExternalResources(true);for(i=list.length-1;i>=0;i--){obj=list[i];if(obj.external==0)
list.splice(i,1);}
this._save_expanded=(list.length>0);var revNumber=editor.getPageNextRevNumber();this._cancelSave=false;editor.clearHandlers();this._logger=ProgressBar.createInstance(document.body,0,100);this._logger.initialize(this._save_expanded,EditorSkin.progressBarFunc,this._save_expanded?"Cancel":"OK","Initializing Save...");this._logger.resetSlider(1,this._logger.getSliderWidth(1));this._logger.setSliderText(1,"Total Progress: 0%");this._logger.setSliderText(2,"File Progress: 0%");if(!this._save_expanded)
this._logger.enableButton(false);this._save_local_image_name_archive=new Array(list.length);this._save_local_image_name_master=new Array(list.length);this._save_network_image_name=new Array(list.length);this._save_widget_width=new Array(list.length);this._save_widget_height=new Array(list.length);this._save_widget_id=new Array(list.length);this._save_widget_url=new Array(list.length);this._save_widget_size=new Array(list.length+1);this._save_widget_pct=new Array(list.length+1);this._save_widget_counter=0;for(i=0;i<list.length;i++){obj=list[i];if(obj.url.indexOf(Widget.ICON_RESIZE_HANDLE)!=-1){continue;}
this._save_local_image_name_archive[i]=(obj.external&Widget.EXUPLOAD_ARCHIVE)!=0?obj.urlarchive:null;this._save_local_image_name_master[i]=(obj.external&Widget.EXUPLOAD_MASTER)!=0?obj.urlmaster:null;this._save_network_image_name[i]=Persistence.convertToNetworkName(obj.url,obj.title,obj.id,revNumber);this._save_widget_width[i]=obj.width;this._save_widget_height[i]=obj.height;this._save_widget_id[i]=obj.id;var str="images/"+pageOid+"/"+this._save_network_image_name[i];this._save_widget_url[i]=str;}
this.estimateUploadSize();if(this._save_expanded){this.initializeSaveProgress();EditorSkin.estimateSaveProgress();}
this.saveImages();return"ok";}
EditorSkin.prototype.cancelSave=function(msg)
{this._cancelMessage=msg;this.killSaveProgressTimer();application.releasePageSaveLock(userOid,groupOid,pageOid,lockId,EditorSkin.cancelSaveCb);}
EditorSkin.cancelSaveCb=function(data)
{var skin=EditorSkin.currentSkin;skin.finish(skin._cancelMessage,"Close");}
EditorSkin.progressBarFunc=function(str){var skin=EditorSkin.currentSkin;if(str=="Cancel"){skin._cancelSave=true;skin._logger.updateStatus("Cancelling save, please wait...");Persistence.signalCancelEvent();}
else if((str=="Close")||(str=="OK")){editor.setHandlers(editor._editmode);skin._logger.close();skin.saveCleanup();}}
EditorSkin.estimateSaveProgress=function()
{var skin=EditorSkin.currentSkin;var interval=1;if(skin._save_progressCounter>0){var now=new Date();var elapsedMS=now.getTime()-skin._save_sample_last_time;skin._save_sample_last_time=now.getTime();var curSize=skin._save_curProgress+skin._save_curProgressFile;if(curSize>skin._save_totalSize)curSize=skin._save_totalSize;var amtDownload=curSize-skin._save_sample_last_progress;skin._save_sample_last_progress=curSize;skin.addSaveSample(amtDownload,elapsedMS);var speed=skin.getDownloadSpeed();var bytesLeft=skin._save_totalSize-curSize;if((speed>0)&&(bytesLeft>0)){var secsLeft=Math.round((bytesLeft/speed)/1000);if(secsLeft>0)
skin._logger.updateFooter("Estimated Time Remaining: "+skin.formatSecs(secsLeft));}}
skin._save_progressCounter++;skin._save_progressTimeout=setTimeout("EditorSkin.estimateSaveProgress()",interval*1000);}
EditorSkin.prototype.killSaveProgressTimer=function(){if(this._save_progressTimeout!=null){clearTimeout(this._save_progressTimeout);this._save_progressTimeout=null;}}
EditorSkin.prototype.estimateUploadSize=function()
{var i;var totalSize=0;var curSize=0;var base;var locArchive;var locMaster;for(i=0;i<this._save_local_image_name_archive.length;i++){locArchive=this._save_local_image_name_archive[i];locMaster=this._save_local_image_name_master[i];this._save_widget_size[i]=Persistence.uploadImageEstimateSize(locArchive,locMaster,this._save_network_image_name[i],this._save_widget_width[i],this._save_widget_height[i]);totalSize+=this._save_widget_size[i];}
this._save_widget_size[i]=editor.htmlToXML().length+editor.getObjectChangeList().length;totalSize+=this._save_widget_size[i];for(i=0;i<this._save_widget_size.length;i++){curSize+=this._save_widget_size[i];this._save_widget_pct[i]=curSize/totalSize;}
this._save_totalSize=totalSize;skin._logger.updateStatus("estimateUploadSize: totalSize to save = "+this._save_totalSize);}
EditorSkin.prototype.initializeSaveProgress=function()
{var i;for(i=0;i<this._save_sample_size.length;i++)
this._save_sample_size[i]=0;for(i=0;i<this._save_sample_interval.length;i++)
this._save_sample_interval[i]=0;this._save_sample_idx=0;this._save_curProgress=0;this._save_curProgressFile=0;this._save_startTime=new Date();this._save_progressCounter=0;this._save_sample_last_progress=0;this._save_sample_last_time=this._save_startTime.getTime();}
EditorSkin.prototype.getDownloadSpeed=function()
{var totalSize=0;var totalTime=0;var count;for(i=0;i<this._save_sample_interval.length;i++){if(this._save_sample_interval[i]!=0){totalSize+=this._save_sample_size[i];totalTime+=this._save_sample_interval[i];}}
if(totalSize!=0&&count!=0)
return totalSize/totalTime;else
return 0;}
EditorSkin.prototype.addSaveSample=function(size,time)
{this._save_sample_interval[this._save_sample_idx]=time;this._save_sample_size[this._save_sample_idx]=size;this._save_sample_idx++;if(this._save_sample_idx>=this._save_sample_interval.length)
this._save_sample_idx=0;}
EditorSkin.prototype.saveImages=function()
{if(this._cancelSave){this.cancelSave("Save Cancelled!");return;}
var index=this._save_widget_counter;if(index>=this._save_local_image_name_archive.length){this.saveMetaData();}
else{var locArchive=this._save_local_image_name_archive[index];var locMaster=this._save_local_image_name_master[index];var net=this._save_network_image_name[index];var ww=this._save_widget_width[index];var wh=this._save_widget_height[index];this._logger.updateStatus("Saving file "+this.getShortName(locArchive));var host=preferences.getPreferenceValue("editor.storage.host",location.host);var pathname=preferences.getPreferenceValue("editor.storage.context",location.pathname);var storageLoc=preferences.getPreferenceValue("editor.storage.location");var imageLoc=preferences.getPreferenceValue("editor.widgets.image.location");var urlprefix=location.protocol+"//"+host;var domain=pathname.split("/")[1];Persistence.uploadImage(groupOid,pageOid,locArchive,locMaster,net,urlprefix,domain,storagePathOid,ww,wh,this,"image");var objupdate=editor._canvas.getObjectById(this._save_widget_id[index]);if(objupdate!=null){var netencoded=encodeURIComponent(net);objupdate._url=storageLoc+imageLoc+"/"+net;objupdate._urlArchive=storageLoc+imageLoc+"/"+"orig_"+net;objupdate._urlMaster=storageLoc+imageLoc+"/"+"master_"+net;}}}
EditorSkin.prototype.saveMetaData=function()
{var cacheObj;var rawname;var newlink;for(var i=0;i<this._save_widget_id.length;i++){cacheObj=editor._canvas.getObjectById(this._save_widget_id[i]);cacheObj._url=this._save_widget_url[i];if(this._save_local_image_name_archive[i]!=null){rawname=Persistence.getNetworkName(this._save_network_image_name[i],true);newlink="images/"+pageOid+"/"+rawname;cacheObj.setWidgetProperty("archive",newlink);}
rawname=Persistence.getNetworkName(this._save_network_image_name[i],false);newlink="images/"+pageOid+"/"+rawname;cacheObj.setWidgetProperty("master",newlink);cacheObj._hasThumbnail=true;}
var thumbnail=PageX.THUMBNAIL_UNAVAILABLE;try{var list=editor.getExternalResources(false,"image");if(list!=null&&list[0]!=null){for(var i=0;i<list.length;i++){var ext_res=list[i];if(ext_res!=null&&ext_res.url!=null){thumbnail=ext_res.url;break;}}}}catch(e){thumbnail=PageX.THUMBNAIL_UNAVAILABLE;}
var title=editor.getTitle();var nextId=editor._nextObjectId;var changeListXML=editor.getObjectChangeList();var thumbGenXML=editor.getThumbnailGenList();this._logger.enableButton(false);var xml=editor.htmlToXML();this._logger.updateStatus("Updating page information");application.updatePageMetadata(this._save_server_alias,userOid,groupOid,pageOid,lockId,xml,title,changeListXML,thumbGenXML,nextId,thumbnail,EditorSkin.updatePageCB);}
EditorSkin.updatePageCB=function(pageData)
{var skin=EditorSkin.currentSkin;if(pageData==null){skin._logger.updateStatus("Page information update error");skin.cancelSave("An error has occurred trying to save the page.  Save has been cancelled.");}
else{skin._logger.updateStatus("Page information update completed");skin.saveDone(pageData.version);}}
EditorSkin.prototype.saveDone=function(versionStr)
{this.killSaveProgressTimer();editor.loadPageVersion(versionStr);editor._canvas.clearChanged();editor._canvas.clearFlashUpload();editor._canvas.resetExternalUpload();savePageCB("save",groupOid,topicOid,pageOid,"complete");this._logger.setSliderPos(1,this._logger.getSliderLimit(1));this._logger.setSliderText(1,"Total Progress: 100%");if(this._save_expanded){var now=new Date();var elapsed=Math.ceil((now.getTime()-this._save_startTime.getTime())/1000);this._logger.updateFooter("Total Time Elapsed: "+this.formatSecs(elapsed));}
this.finish("Save Complete!","OK");}
EditorSkin.prototype.finish=function(msg,btntext)
{var obj=null;this._logger.updateStatus(msg);this._logger.setButtonText(btntext);this._logger.enableButton(true);this._logger.focusButton();if(!this._logger.isOpened())
this.saveCleanup();if(this._saveNShare){editor.setHandlers(editor._editmode);this._logger.close();this.saveCleanup();this.saveNShareDialog();}
for(i=0;i<this.objectsToRefresh.length;i++){obj=this.objectsToRefresh[i];obj.refresh();}
editor._canvas.refreshSlideshow();}
EditorSkin.prototype.saveNShareDialog=function()
{var options=["height=450","width=500"];var dlg=ModalDialog.createInstance(options);var s='<div class="largeText">'+' <form id="registerForm" name="registerForm" method="POST" action="#">'+'  <table width="100%">'+'  <tr><td>To share this page, copy this link into an E-mail and send it:</td></tr>'+'  <tr><td><input name="link" type="text" id="link" size="55" onclick="this.select()"/></td></tr>'+'  <tr><td><strong>Your Page will be saved for <strong>30 DAYS </strong>.</td></tr>'+'  <tr><td><span class="normalText">(Use this link to access this page in the future).</span>'+'  <tr><td><hr style="font-weight:bold;"></td></tr>'+'  <tr><td><span style="font-weight:bold;">Optional:<br>'+'    Sign-up for a FREE PikiWiki account and save your page indefinitely.</span></td></tr>'+'  </table>'+'  <table width="100%" border="0"><col width="50%"><col width="50%">'+'  <tr>'+'    <td style="align:right;">Your Email Address:</td>'+'    <td><input name="newemail" type="text" id="newemail" size="25" maxlength="64" /></td></tr>'+'  <tr>'+'    <td style="align:right;">Password:</td>'+'    <td><input name="newpassword" type="password" id="newpassword" size="25" maxlength="32" /></td></tr>'+'  <tr>'+'    <td style="align:right;">Confirm Password:</td>'+'    <td><input name="newpassword2" type="password" id="newpassword2" size="25" maxlength="32" /></td></tr>'+'  </table>'+'  <table width="100%"><col width="10%"><col width="90%">'+'  <tr>'+'    <td class=normalText><input name="terms" id="terms" type="checkbox" value="" onclick="parent.EditorSkin.agreeToTerms()"/></td>'+'    <td><span class=normalText>I have read and agree to the'+'          <a href="terms.jsp" target="_blank">terms of use</a>'+'          and I certify that I am at least 13 years old.</div></span>'+'  </tr></table>'+' </form>'+'  <table width="100%">'+'  <tr><td colspan=2 align=center>'+'      <button id="register" onclick="parent.EditorSkin.validateReg()" disabled=true>Register</button>'+'      <button id="close" onclick="parent.ModalDialog.handleBtnPress(\'cancel\')">Close</button>'+'  </tr></table>'+'</div>';dlg.render(s);setTimeout("EditorSkin.saveAndShareDialog2("+groupOid+", "+pageOid+")",500);}
EditorSkin.saveAndShareDialog2=function(groupOid,pageOid)
{application.createURL(groupOid,pageOid,false,EditorSkin.createLinkCB);}
EditorSkin.createLinkCB=function(urls)
{var obj=ModalDialog.getElementById("link");obj.value=urls.url;}
EditorSkin.agreeToTerms=function()
{var registerBtn=ModalDialog.getElementById("register");registerBtn.disabled=(registerBtn.disabled==true)?false:true;}
EditorSkin.validateReg=function()
{var email=ModalDialog.getElementById("newemail");var pwd=ModalDialog.getElementById('newpassword');var pwd_confirm=ModalDialog.getElementById("newpassword2");var termsCheck=ModalDialog.getElementById('terms');if(termsCheck!=null){if(!termsCheck.checked)
{alert("To be able you able to register you have to accept our terms and conditions.");termsCheck.focus();return false;}}
if(util.isEmpty(email.value)){alert("An email address must be specified to register with PikiWiki");email.focus();return false;}
var emailValidationMsg=util.validEmailAddress2(email.value);if(emailValidationMsg!=null){alert(emailValidationMsg);email.focus();return false;}
if(pwd.length<6){alert("Your password is too short it should be 6 or more characters long");pwd.focus();return false;}
if(pwd.value!=pwd_confirm.value){alert('Passwords do not match.  Please try again.');pwd.focus();return false;}
var first=null;var last=null;application.registerUser(first,last,email.value,pwd.value,pageOid,EditorSkin.registerUserCb);return false;}
EditorSkin.registerUserCb=function(data)
{if(data.fault!=null||data.groupName==null){alert("An error occurred while registering this new user.\n"+data.fault.detail);}
else{window.location.href="registrationok.jsp?user="+data.userOid;}}
EditorSkin.prototype.saveCleanup=function()
{removeLoadingLayer();this._saveInProgress=false;}
EditorSkin.prototype.successCB=function(option,retStr){if(option=="html"){this._logger.updateStatus("Page information update completed");this.saveDone(retStr);}
else if(option=="image"){this._logger.updateStatus("File save completed");this._save_curProgress+=this._save_widget_size[this._save_widget_counter];this._save_widget_counter++;this._save_curProgressFile=0;this.saveImages();}
else{log("ERROR: shouldn't be here");}}
EditorSkin.prototype.errorCB=function(option,retStr){if(option=="html"){this._logger.updateStatus("Page information update error");this.cancelSave("An error has occurred trying to save the page.  Save has been cancelled.");}
else if(option=="image"){this._logger.updateStatus("File save error encountered");this.cancelSave("An error has occurred trying to upload a file.  Save has been cancelled.");}
else{log("ERROR: shouldn't be here");}}
EditorSkin.prototype.cancelCB=function(option){if(option=="image"){this._cancelSave=true;this.cancelSave("Save Cancelled!");}}
EditorSkin.prototype.progressCB=function(option,action,arg1,arg2,arg3){if(option=="image"){var curIndex=this._save_widget_counter;var base;if(action=="start"){this._logger.setSliderText(2,"File Progress: 0%");this._logger.resetSlider(2,1);}
else if(action=="thumb"){base=(this._save_local_image_name_archive[curIndex]!=null)?this._save_local_image_name_archive[curIndex]:this._save_local_image_name_master[curIndex];this._logger.updateStatus("Building thumbnail for "+this.getShortName(base));}
else if(action=="thumbdone"){base=(this._save_local_image_name_archive[curIndex]!=null)?this._save_local_image_name_archive[curIndex]:this._save_local_image_name_master[curIndex];this._logger.updateStatus("Saving file "+this.getShortName(base));}
else if(action=="load"){var actualSize=arg1+arg2+arg3;this._save_totalSize+=(actualSize-this._save_widget_size[curIndex]);this._save_widget_size[curIndex]=actualSize;this._save_origImageSize=arg1;this._save_masterImageSize=arg2;this._logger.resetSlider(2,actualSize);}
else if(action=="progress"){var alreadyBytes=(arg1==2)?this._save_origImageSize+this._save_masterImageSize:(arg1==1)?this._save_origImageSize:0;var progress2=arg2+alreadyBytes;this._save_curProgressFile=progress2;var limit=this._save_widget_size[curIndex];var pct2=Math.floor((progress2*100)/limit);this._logger.setSliderPos(2,progress2);this._logger.setSliderText(2,"File Progress: "+pct2+"%");var prev=(curIndex==0)?0:this._save_widget_pct[curIndex-1];var cur=this._save_widget_pct[curIndex];var fraction=((cur-prev)*(progress2/limit))+prev;var progress1=Math.floor(fraction*this._logger.getSliderLimit(1));var pct1=Math.floor(fraction*100);this._logger.setSliderPos(1,progress1);this._logger.setSliderText(1,"Total Progress: "+pct1+"%");}}}
EditorSkin.prototype.formatSecs=function(secs)
{var minutes=Math.floor(secs/60);var seconds=secs-(minutes*60);return(minutes>0?minutes.toString()+" min "+seconds.toString()+" sec":seconds.toString()+" sec");}
EditorSkin.prototype.getShortName=function(longname)
{var locidx=longname.lastIndexOf("/");var shortname=longname;if(locidx!=-1)
shortname=longname.substr(locidx+1);return shortname;}
EditorSkin.prototype.saveNoJava=function()
{var maxWidth;var maxHeight;var revNumber=editor.getPageNextRevNumber();var dimval=preferences.getPreferenceValue("editor.imageSize","1024x768")
if(dimval=="original"){maxWidth=10000;maxHeight=10000;}
else{var imageSize=dimval.split("x");maxWidth=imageSize[0];maxHeight=imageSize[1];}
loadingLayer(editor._canvas.getHeight(),editor._canvas.getWidth());editor.clearHandlers();var host=preferences.getPreferenceValue("editor.storage.host");var pathname=preferences.getPreferenceValue("editor.storage.context",location.pathname);var domain=pathname.split("/")[1];this._fileUpload=FileUpload.createInstance(document.body,0,100);this._fileUpload.initialize();this._fileUpload.execute(host,domain,storagePathOid,pageOid,editor._nextObjectId,revNumber,maxHeight,maxWidth);}
EditorSkin.prototype.getUploadedWidgetInfo=function(filename)
{var revNumber=editor.getPageNextRevNumber();var objId=editor.genNextObjectId();var host=preferences.getPreferenceValue("editor.storage.host");var context=preferences.getPreferenceValue("editor.storage.context");application.getUploadedWidgetInfo(host,context,pageOid,storagePathOid,revNumber,objId,filename,EditorSkin.widgetInfoCB);}
EditorSkin.widgetInfoCB=function(pageData)
{var skin=EditorSkin.currentSkin;if(pageData==null||pageData.errcode!=0)
alert("Unable to insert image or file");else{var w=parseInt(pageData.width);var h=parseInt(pageData.height);var ratio=w/h;if(w>h){w=loadMax;h=w/ratio;}else{h=loadMax;w=ratio*h;}
Editor.loadObjectNoJava(pageData.url,pageData.urlmaster,pageData.urlarchive,w,h,pageData.name,pageData.objid);}}
EditorSkin.prototype.saveNoJavaCBCancel=function()
{this.saveNoJavaCleanup();}
EditorSkin.prototype.saveNoJavaCleanup=function()
{editor.setHandlers(editor._editmode);this._fileUpload.close();this._fileUpload=null;removeLoadingLayer();}
EditorSkin.prototype.rotateNoJavaCB=function(widget,url,rotation,objId,cbfunc)
{var revNumber=editor.getPageNextRevNumber();this._rotateCB=cbfunc;this._rotateWidget=widget;var decoded=decodeURIComponent(url);var logicalName=widget.getLogicalName();var host=preferences.getPreferenceValue("editor.storage.host");var context=preferences.getPreferenceValue("editor.storage.context");application.rotateNoJava(host,context,url,rotation,pageOid,storagePathOid,objId,revNumber,logicalName,EditorSkin.rotateNoJavaResponse);}
EditorSkin.rotateNoJavaResponse=function(pageData)
{var skin=EditorSkin.currentSkin;if(pageData.errcode!=0)
alert("Unable to rotate image");else
skin._rotateCB(skin._rotateWidget,pageData.url,pageData.urlmaster);}
EditorSkin.prototype.activateJava=function()
{var jdnd=document.getElementById("jdnd");if(!this._javaTested)
this.runJavaTest(false);if(!this._javaEnabled){if(!dhtmlapi.isMac()){if(skin._javaOld){setWarning('images/editor/getnewjava.gif',"You have an old version of Java.  For the fastest and most reliable PikiWiki experience, click here",'util.openWarning("OldJavaWarning.html")');}
else{setWarning('images/editor/getjava.gif',"You don't have Java.  For the best PikiWiki experience, including full drag and drop functionality from your desktop, click here",'util.openWarning("javaWarning.html")');}}
return false;}
this._javaActive=true;if(jdnd!=null)jdnd.innerHTML="Drag & Drop ON";if(this._toolbar!=null){var b=this._toolbar.getButton("mediamgr");if(b!=null)
b.enable(true);}
return true;}
Function.prototype.inheritsFrom=function(parentClass)
{this.prototype=new parentClass;this.prototype.constructor=this;this.prototype._parent=parentClass.prototype;}
Widget.ACTION_NONE=0;Widget.ACTION_ADD=1;Widget.ACTION_EDIT=2;Widget.ACTION_DELETE=3;Widget.EXUPLOAD_ARCHIVE=2;Widget.EXUPLOAD_MASTER=4;Widget.EXUPLOAD_MASKALL=Widget.EXUPLOAD_ARCHIVE+Widget.EXUPLOAD_MASTER;Widget.ICON_RESIZE_HANDLE="images/editor/widgets/resize.gif";Widget.cache=null;Widget._prev_clientX;Widget._prev_clientY;Widget._topleft=null;Widget._topright=null;Widget._bottomleft=null;Widget._bottomright=null;Widget.prototype._id;Widget.prototype._mimeType;Widget.prototype._isDirty;Widget.prototype._isFlashUpload;Widget.prototype._externalUpload;Widget.prototype._canvas;Widget.prototype._html;Widget.prototype._top;Widget.prototype._left;Widget.prototype._height;Widget.prototype._width;Widget.prototype._ratio;Widget.prototype._properties;Widget.prototype._history;Widget.prototype._editDesc;Widget.prototype._zindex;Widget.prototype._titleBar;Widget.prototype._footerBar;Widget.prototype._resizeHandler;function Widget(id,mimeType)
{this.initialize(id,mimeType);}
Widget.addToCache=function(key,obj)
{if(Widget.cache==null)
Widget.cache=new Object();Widget.cache[key]=obj;}
Widget.prototype.deleteProperty=function(name)
{if(this._properties[name]!=null)
delete this._properties[name];}
Widget.prototype.deleteHTML=function(obj)
{if(this._html!=null){this._canvas.removeChild(this._html);this._html=null;}}
Widget.prototype.endOperation=function(obj)
{}
Widget.getFromCache=function(key)
{if(Widget.cache==null||key==null)
return null;return Widget.cache[key];}
Widget.prototype.getChangeXML=function(userOid)
{var xml;if(this._editDesc==null)
return null;this._editDesc.setUserOid(userOid);xml='<object id="'+this.getId()+'">';xml+=this._editDesc.toXML();xml+='</object>';return xml;}
Widget.prototype.getContents=function()
{return null;}
Widget.prototype.getDimensions=function()
{var dim=new Object();dim.x=dhtmlapi.getObjectLeft(this._html);dim.y=dhtmlapi.getObjectTop(this._html);dim.height=dhtmlapi.getObjectHeight(this._html);dim.width=dhtmlapi.getObjectWidth(this._html);return dim;}
Widget.prototype.getElement=function()
{return this._html;}
Widget.prototype.getExternalResource=function()
{return null;}
Widget.prototype.getThumbnailGenXML=function()
{return null;}
Widget.prototype.getId=function()
{return this._id;}
Widget.prototype.getIdNumber=function()
{return parseInt(this._id);}
Widget.prototype.getMimeType=function()
{return this._mimeType;}
Widget.prototype.getProperty=function(name)
{if(this._properties==null||name==null)
return null;else
return this._properties[name];}
Widget.prototype.getZIndex=function()
{return this._zindex;}
Widget.prototype.initialize=function(mimeType,id,height,width,zindex,canvas)
{this.setMimeType(mimeType);this._id=id;this._isDirty=false;this._isFlashUpload=false;this._externalUpload=0;this._html=null;this._canvas=canvas;this._top=parseInt("0");this._left=parseInt("0");this._height=(height!=null)?parseInt(height):0;this._width=(width!=null)?parseInt(width):0;this._ratio=0;this._history=null;this._editDesc=null;this._zindex=zindex;this._titleBar=null;this._footerBar=null;this._properties=new Object();}
Widget.prototype.isDirty=function()
{return this._isDirty;}
Widget.prototype.isExternalResource=function()
{return false;}
Widget.prototype.isFlashUpload=function()
{return this._isFlashUpload;}
Widget.prototype.isChanged=function()
{return(this._editDesc!=null);}
Widget.prototype.isMimeType=function(mtype)
{if(mtype==null)
return false;var attr=this._mimeType;var str=null;if(mtype.indexOf("/")!=-1){str=attr;}
else{var idx=attr.indexOf("/");str=(idx==-1)?attr:attr.substring(0,idx);}
return(mtype==str)?true:false;}
Widget.prototype.launch=function()
{}
Widget.prototype.setExternalUpload=function(mask)
{this._externalUpload=this._externalUpload|mask;}
Widget.prototype.getExternalUpload=function(mask)
{return((this._externalUpload&mask)!=0);}
Widget.prototype.isExternalUpload=function()
{return(this._externalUpload!=0);}
Widget.prototype.clearExternalUpload=function(mask)
{this._externalUpload=this._externalUpload&(~mask);}
Widget.prototype.resetExternalUpload=function()
{this._externalUpload=0;}
Widget.prototype.markClean=function()
{this._isDirty=false;}
Widget.prototype.markDirty=function()
{this._isDirty=true;}
Widget.prototype.markFlashUpload=function(on)
{this._isFlashUpload=on;}
Widget.prototype.markChanged=function(action,actionDetail)
{this.markDirty();if(this._editDesc==null)
this._editDesc=new PageEdit(-1,this.getIdNumber(),action,actionDetail,null,-1);}
Widget.prototype.clearChanged=function()
{this.markClean();if(this._editDesc!=null){delete this._editDesc;this._editDesc=null;}}
Widget.prototype.hasRevisions=function(lastViewedVersion)
{var pe=this.getHistoryRecord();if((pe!=null)&&(lastViewedVersion>0)&&(pe.getPageVersion()>lastViewedVersion)){var action=pe.getAction();if((action==Widget.ACTION_ADD)||(action==Widget.ACTION_EDIT))
return true;}
return false;}
Widget.prototype.moveTo=function(xcoord,ycoord)
{var x=parseInt(xcoord);var y=parseInt(ycoord);if(x<0||y<0)
return;this._top=y;this._left=x;dhtmlapi.shiftTo(this._html,x,y);this.moveBars();return true;}
Widget.prototype.moveBy=function(deltaX,deltaY)
{if(deltaX==0&&deltaY==0)
return;this._top+=parseInt(deltaY);this._left+=parseInt(deltaX);dhtmlapi.shiftBy(this._html,deltaX,deltaY);if(this._titleBar!=null)
dhtmlapi.shiftBy(this._titleBar.getContainer(),deltaX,deltaY);if(this._footerBar!=null)
dhtmlapi.shiftBy(this._footerBar,deltaX,deltaY);return true;}
Widget.removeFromCache=function(key)
{if(Widget.cache==null||key==null)
return null;var obj=Widget.cache[key];delete Widget.cache[key];return obj;}
Widget.prototype.resizeBy=function(whichCorner,deltaX,deltaY)
{if(deltaX==0&&deltaY==0)
return;var container=this._html;var height=this._height+deltaY;var width=this._width+deltaX;if(this._mimeType.indexOf("flash")==-1){var child=this._html.firstChild;child.style.height=height+"px";child.style.width=width+"px";}
container.style.height=height+"px";container.style.width=width+"px";this._height=height;this._width=width;this.resizeBars();}
Widget.prototype.resizeTo=function(height,width)
{var container=this._html;var child=this._html.firstChild;if(this._mimeType.indexOf("flash")==-1){if(child!=null){child.style.height=height+"px";child.style.width=width+"px";}}
container.style.height=height+"px";container.style.width=width+"px";this._height=height;this._width=width;}
Widget.prototype.resizeToFlash=function(height,width)
{var container=this._html;var child=this._html.firstChild;container.style.height=height+"px";container.style.width=width+"px";this._height=height;this._width=width;}
Widget.prototype.restoreZIndex=function()
{this.setZIndex(this._zindex);}
Widget.prototype.rollover=function()
{}
Widget.prototype.rollout=function()
{}
Widget.prototype.select=function(parent)
{Widget._prev_clientX=0;Widget._prev_clientY=0;var dim=this.getDimensions();if(this._titleBar==null)
this._titleBar=this.createTitleBar();var tbContainer=this._titleBar.getContainer();var tbWidth=this._titleBar.getMinimumWidth();var tbHeight=this._titleBar.getMinimumHeight()-1;var top=dim.y-tbHeight;var left=dim.x;var bottom=dim.y+dim.height;if(tbWidth<dim.width)
tbWidth=dim.width;this._titleBar.resize(tbWidth);tbContainer.style.left=left+'px';tbContainer.style.top=top+'px';parent.appendChild(tbContainer);tbContainer.style.visibility="visible";if(this._footerBar==null)
this._footerBar=this.createFooterBar();this._footerBar.style.left=left+'px';this._footerBar.style.top=bottom+'px';this.resizeFooterBar();this._footerBar.style.visibility="visible";parent.appendChild(this._footerBar);this.createSelectionBox();}
Widget.prototype.setDimensions=function(h,w)
{this._height=h;this._width=w;}
Widget.prototype.setMimeType=function(mimeType)
{this._mimeType=mimeType;}
Widget.prototype.setProperties=function(elem)
{if(elem==null)
return;for(var se=elem.firstChild;se!=null;se=se.nextSibling)
{if(se.nodeType==1&&se.nodeName=='property'){var name=se.getAttribute("name");var val=xmlutils.getNodeText(se);this.setProperty(name,val);}}}
Widget.prototype.setProperty=function(name,value)
{if(name==null)
return null;if(this._properties==null)
this._properties=new Object();this._properties[name]=value;}
Widget.prototype.setLogicalName=function(url,name)
{return;}
Widget.prototype.getLogicalName=function()
{return null;}
Widget.prototype.getWidgetProperty=function(name)
{return null;}
Widget.prototype.setWidgetProperty=function(name,value)
{return null;}
Widget.prototype.setTempZIndex=function(zindex)
{this.setZIndexHTML(zindex);}
Widget.prototype.setZIndexHTML=function(zindex)
{var elem=this._html;dhtmlapi.setZIndex(elem,zindex);}
Widget.prototype.setZIndex=function(zindex)
{if(zindex<ZIndex.WIDGET_FIRST)
zindex=ZIndex.WIDGET_FIRST;else if(zindex>ZIndex.WIDGET_LAST)
zindex=ZIndex.WIDGET_LAST;this._zindex=zindex;var elem=this._html;var ziCur=dhtmlapi.getZIndex(elem);if((ziCur>=ZIndex.WIDGET_FIRST)&&(ziCur<=ZIndex.WIDGET_LAST)){this.setZIndexHTML(zindex);}}
Widget.prototype.unselect=function()
{this._html.style.borderStyle="none";this.removeSelectionBox();if(this._titleBar!=null)
this._titleBar.getContainer().style.visibility="hidden";if(this._footerBar!=null)
this._footerBar.style.visibility="hidden";}
Widget.prototype.setHistory=function(history)
{this._history=history;}
Widget.prototype.getHistoryRecord=function()
{if(this._history==null||this._history.length==0)
return null;return this._history[this._history.length-1];}
Widget.prototype.toHtml=function()
{}
Widget.prototype.toXml=function()
{var elem=xmlutils.dom.createElement("object");var dimensions=xmlutils.dom.createElement("dimensions");var location=xmlutils.dom.createElement("location");elem.setAttribute("mimeType",this._mimeType);elem.setAttribute("id",this._id);elem.setAttribute("zIndex",this._zindex);var left=parseInt(dhtmlapi.getObjectLeft(this._html));var top=parseInt(dhtmlapi.getObjectTop(this._html));location.setAttribute("left",((left<0)?"0px":left+"px"));location.setAttribute("top",((top<0)?"0px":top+"px"));dimensions.setAttribute("height",dhtmlapi.getObjectHeight(this._html)+"px");dimensions.setAttribute("width",dhtmlapi.getObjectWidth(this._html)+"px");elem.appendChild(location);elem.appendChild(dimensions);if(this._properties!=null){var props=null;for(var p in this._properties){if(props==null)
props=xmlutils.dom.createElement("properties");var se=xmlutils.dom.createElement("property");se.setAttribute("name",p);xmlutils.setNodeText(se,this._properties[p]);props.appendChild(se);}
if(props!=null)
elem.appendChild(props);}
return elem;}
Widget.prototype.createSelectionBox=function()
{var container=this._html;var height=dhtmlapi.getObjectHeight(this._html);var width=dhtmlapi.getObjectWidth(this._html);var left=dhtmlapi.getObjectLeft(this._html);var top=dhtmlapi.getObjectTop(this._html);container.style.border="dashed black 1px";return;}
Widget.prototype.showChangeBox=function(lastViewedVersion)
{if(this.hasRevisions(lastViewedVersion)){var pe=this.getHistoryRecord();var container=this._html;var action=pe.getAction();if(action==Widget.ACTION_ADD)
container.style.border="solid red 3px";else if(action==Widget.ACTION_EDIT)
container.style.border="solid blue 3px";}}
Widget.prototype.removeChangeBox=function(lastViewedVersion)
{if(this.hasRevisions(lastViewedVersion)){var pe=this.getHistoryRecord();var container=this._html;var action=pe.getAction();if((action==Widget.ACTION_ADD)||(action==Widget.ACTION_EDIT))
container.style.border="none black 0px";}}
Widget.prototype.removeSelectionBox=function()
{var container=this._html;container.style.border="none black 0px";}
Widget.prototype.createTitleBar=function()
{var container=document.createElement("div");var toolbarName="widgetToolbar"+this.getId();var containerName="widgetToolbarContainer"+this.getId();container.id=containerName;container.className="widgetToolbar";container.style.position="absolute";container.style.overflow="hidden";container.style.left=0;container.style.top=0;container.style.backgroundColor="lightgrey";container.style.height="22px";container.style.width="20px";container.style.display="";container.style.cursor="move";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.zIndex=ZIndex.IMAGE_TOOLBAR;var tb=new Titlebar(toolbarName,container,22,20);var b=null;b=Button.createImage("help"+this._id,Button.BUTTON,"help","images/editor/widgets/info.png",16,16,"Help");tb.addRight(b);b=Button.createImage("delete"+this._id,Button.BUTTON,"delete","images/editor/widgets/delete.png",16,16,"Remove Object");tb.addRight(b);tb.setHandlers(Editor.handleMouseUp,Editor.handleMouseDown,Editor.handleMouseMove);tb.registerCallback(this);return tb;}
Widget.prototype.createFooterBar=function()
{var footer=document.createElement("div");footer.id="widgetFooter"+this.getId();footer.className="widgetFooter";footer.style.position="absolute";footer.style.overflow="hidden";footer.style.left=0;footer.style.top=0;footer.style.backgroundColor="lightgrey";footer.style.width="150px";footer.style.height="16px";footer.style.display="";footer.style.borderStyle="none";footer.style.borderColor="black";footer.style.borderWidth="0px";footer.style.cursor="move";footer.style.zIndex=ZIndex.IMAGE_TOOLBAR;var resize=document.createElement("div");resize.id="bottomright_"+this._id;resize.className="resizer";resize.style.backgroundImage="url("+Widget.ICON_RESIZE_HANDLE+")";resize.style.position="absolute";resize.style.top=0;resize.style.left="134px";resize.style.height="16px";resize.style.width="16px";resize.style.cursor="nw-resize";footer.appendChild(resize);this._footerBar=footer;this._resizeHandler=resize;return footer;}
Widget.prototype.resizeFooterBar=function()
{var dim=this.getDimensions();var resizeLoc=dim.width-16;this._footerBar.style.width=dim.width+"px";this._resizeHandler.style.left=resizeLoc+"px";}
Widget.prototype.removeBars=function(canvasElem)
{if(this._titleBar!=null)
canvasElem.removeChild(this._titleBar.getContainer());if(this._footerBar!=null)
canvasElem.removeChild(this._footerBar);}
Widget.prototype.deleteBars=function()
{if(this._titleBar!=null){delete this._titleBar;this._titleBar=null;}
if(this._footerBar!=null){delete this._footerBar;this._footerBar=null;}}
Widget.prototype.resizeBars=function()
{var dim=this.getDimensions();if(this._titleBar!=null)
this._titleBar.resize(dim.width);if(this._footerBar!=null){dhtmlapi.shiftTo(this._footerBar,dim.x,dim.y+dim.height);this.resizeFooterBar();}}
Widget.prototype.moveBars=function()
{var dim=this.getDimensions();if(this._titleBar!=null){var tbContainer=this._titleBar.getContainer();var tbHeight=this._titleBar.getMinimumHeight()-1;dhtmlapi.shiftTo(tbContainer,dim.x,dim.y-tbHeight);}
if(this._footerBar!=null){dhtmlapi.shiftTo(this._footerBar,dim.x,dim.y+dim.height);}}
Widget.prototype.toolbarCB=function(toolbarName,state,operation,value)
{if(operation=="delete"){this._canvas.deleteObject(this);}
else if(operation==="help"){if(this._mimeType.indexOf("audio/flash")!=-1){util.openWindow('http://pikiwiki.com/help/questions/8/How+Do+I+Record+Audio+to+a+Page');}
if(this._mimeType.indexOf("video/flash")!=-1){util.openWindow('http://pikiwiki.com/help/questions/8/How+Do+I+Record+Video+to+a+Page');}
if(this._mimeType.indexOf("image")!=-1){util.openWindow('http://pikiwiki.com/help/questions/31/What+can+I+do+with+Pictures+on+a+Page');}
if(this._mimeType.indexOf("text/chat")!=-1){util.openWindow('http://pikiwiki.com/help/questions/23/How+Do+I+Use+the+Chat+Box+on+the+PikiWiki+Pages');}
if(this._mimeType.indexOf("text/html")!=-1){util.openWindow('http://pikiwiki.com/help/questions/24/How+Do+I+Use+the+Text+Box');}
else{}}}
Widget.prototype.activateJava=function()
{}
Widget.prototype.refresh=function()
{}
AudioWidget.object=null;AudioWidget.prototype._url;AudioWidget.prototype._editmode;AudioWidget.prototype._htmlEditor;AudioWidget.prototype._flagToSave;function AudioWidget(mimeType,id,height,width,zindex,canvas,url){var mt=(mimeType!=null)?mimeType:"audio/flash";this._parent.initialize.call(this,mt,id,height,width,zindex,canvas);this._url=url;this._htmlEditor=null;this._editmode=(url==null)?true:false;AudioWidget.object=this;}
AudioWidget.inheritsFrom(Widget);Editor.registerMimeType("audio","flash",AudioWidget);AudioWidget.RenderXML=function(elem,mimeType,id,zindex,canvas){var url=xmlutils.getChildNode(elem,"url");var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var style=xmlutils.getChildNode(elem,"style");var div=xmlutils.dom.createElement("div");var name=xmlutils.dom.createElement("br");var left=parseInt(location.getAttribute("left"));var top=parseInt(location.getAttribute("top"));var width=parseInt(dimensions.getAttribute("width"));var height=parseInt(dimensions.getAttribute("height"));var obj=AudioWidget.createInstance(mimeType,id,height,width,zindex,canvas,xmlutils.getNodeText(url));obj.setDimensions(height,width);obj.toHtml();obj.moveTo(left,top);return obj;}
AudioWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,url){var ce=new AudioWidget(mimeType,id,height,width,zindex,canvas,url);return ce;}
AudioWidget.handleClose=function(url,mimeType){var ce=AudioWidget.object;ce._htmlEditor=ce._html;if(url!=null){try{ce._url=url;ce._mimeType=mimeType;ce._html=ce.createAudioLink();ce._canvas._element.appendChild(ce._html);ce._editmode=false;}catch(e){return;}}
var obj=document.getElementById("audioEditor");obj=null;setTimeout("AudioWidget.removeAudioEditor()",100);}
AudioWidget.removeAudioEditor=function(){var ce=AudioWidget.object;ce._canvas._element.removeChild(ce._htmlEditor);}
AudioWidget.disableEvents=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);EventUtils.preventDefault(evt);}
AudioWidget.markToSave=function(id)
{var obj=editor._canvas.getObjectById(id);if(obj!=null)
obj._flagToSave=true;}
AudioWidget.prototype.isExternalResource=function(){return true;}
AudioWidget.prototype.launch=function(){}
AudioWidget.prototype.select=function(parent){this._parent.select.call(this,parent);}
AudioWidget.prototype.rollover=function(){this._parent.rollover.call(this);}
AudioWidget.prototype.rollout=function(){this._parent.rollout.call(this);}
AudioWidget.prototype.toHtml=function(){if(this._editmode==true)
this._html=this.createAudioEditor();else
this._html=this.createAudioLink();this._canvas._element.appendChild(this._html);}
AudioWidget.prototype.toXML=function(){if(this._flagToSave){var elem=this._parent.toXml.call(this);var url=xmlutils.dom.createElement("url");xmlutils.setNodeText(url,this._url);elem.appendChild(url);return elem;}else{return null;}}
AudioWidget.prototype.unselect=function(mode){this._parent.unselect.call(this);}
AudioWidget.prototype.toolbarCB=function(toolbarName,state,operation,value){this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
AudioWidget.prototype.createTitleBar=function(){var tb=this._parent.createTitleBar.call(this);return tb;}
AudioWidget.prototype.createAudioEditor=function(){this._flagToSave=false;var ce=AudioWidget.object;var height=180;var width=240;this._width=width;this._height=height;this._ratio=width/height;var d=document.createElement("div");var name="audioRecorder";var rgb="255,255,255";d.id=this._id;d.className="draggable";d.style.position="absolute";d.style.left=this._left+"px";d.style.top=this._top+"px";d.style.overflow="hidden";d.style.width=width+"px";d.style.height=height+"px";d.style.borderStyle="none";d.style.borderColor="black";d.style.borderWidth="0px";d.style.zIndex=this.getZIndex();var prefs=this._canvas.getPreferences();var randomnumber=Math.floor(Math.random()*11111);var streamName=prefs.getPreferenceValue("editor.widgets.audio.location")+"/audio"+ce._canvas._username+randomnumber;var locServer=this._canvas.getPreferences().getPreferenceValue("editor.location");var swfurl="audioRecorder.swf?filename="+streamName+"\u0026server="+location.hostname+"\u0026appServer="+locServer+"\u0026id="+this._id;this._url=streamName;if(BrowserDetect.OS=="Mac"&&BrowserDetect.browser=="Safari"){var FO={id:"recorder"+this._id,movie:swfurl,top:"5%",left:"5%",width:"90%",height:"90%",majorversion:"8",build:"0",loop:"false",salign:"tl",wmode:"transparent",allowscriptaccess:"sameDomain",menu:"false",scale:"noborder"};UFO.create(FO,this._id);}else{div=document.createElement("div");div.id="maincontainer"+this._id;div.style.position="absolute";div.style.top="5%";div.style.left="5%";div.style.height="90%";div.style.width="90%";div.style.overflow='hidden';div.innerHTML="Flash failed loading or is not installed. Please click <a href='failedflashInstallation.html' target='_blank'>here for further instructions.</a>";if(dhtmlapi.isMac()){div.onmousedown=AudioWidget.disableEvents;div.onmousemove=AudioWidget.disableEvents;div.onmouseup=AudioWidget.disableEvents;}
d.appendChild(div);var FO={id:"recorder"+this._id,movie:swfurl,width:"100%",height:"100%",majorversion:"8",build:"0",loop:"false",salign:"tl",wmode:"transparent",allowscriptaccess:"sameDomain",menu:"false",scale:"exactfit"};UFO.create(FO,"maincontainer"+this._id);}
return d;}
AudioWidget.prototype.createAudioLink=function(){this._flagToSave=true;try{var d=document.createElement("div");var txt=this._url.substr(this._url.lastIndexOf("/")+1);d.id=this._id;d.className="draggable";d.style.position="absolute";d.style.overflow="hidden";d.style.left=this._left+"px";d.style.top=this._top+"px";d.style.width=this._width+"px";d.style.height=this._height+"px";d.style.border="none black 0px";d.style.zIndex=this.getZIndex();d.setAttribute("mimeType",this._mimeType);var prefs=this._canvas.getPreferences();var flashPath=prefs.getPreferenceValue("editor.storage.location.flash");var audiolink=flashPath+this._url;var pathname=preferences.getPreferenceValue("editor.storage.context",location.pathname);var context=pathname.split("/")[1];var swfurl="audioPlayer.swf?filename="+audiolink+"\u0026server="+location.host+"\u0026context="+context;if(BrowserDetect.OS=="Mac"&&BrowserDetect.browser=="Safari"){var FO={movie:swfurl,top:"5%",left:"5%",width:"90%",height:"90%",majorversion:"8",build:"0",loop:"false",wmode:"transparent",allowscriptaccess:"sameDomain",menu:"false"};UFO.create(FO,this._id);}else{div=document.createElement("div");div.id="maincontainer"+this._id;div.style.position="absolute";div.style.top="5%";div.style.left="5%";div.style.height="90%";div.style.width="90%";div.style.overflow='hidden';div.innerHTML="Flash failed loading or is not installed. Please click <a href='failedflashInstallation.html' target='_blank'>here for further instructions.</a>";if(dhtmlapi.isMac()){div.onmousedown=AudioWidget.disableEvents;div.onmousemove=AudioWidget.disableEvents;div.onmouseup=AudioWidget.disableEvents;}
d.appendChild(div);var FO={movie:swfurl,width:"100%",height:"100%",majorversion:"8",build:"0",loop:"false",wmode:"transparent",allowscriptaccess:"sameDomain",menu:"false"};UFO.create(FO,"maincontainer"+this._id);}
return d;}catch(e){alert("AudioWidget: "+e);return null;}}
ChatWidget.objects=null;ChatWidget.COMMENT_ICON_TEXT="images/editor/widgets/chat/text.gif";ChatWidget.UPPERPANE_HEIGHT=parseInt(160);ChatWidget.UPPERPANE_WIDTH=parseInt(250);ChatWidget.LOWERPANE_HEIGHT=parseInt(-1);ChatWidget.LOWERPANE_WIDTH=parseInt(250);ChatWidget.COMMENTS_HEIGHT=parseInt(160);ChatWidget.COMMENTS_WIDTH=parseInt(230);ChatWidget.TEXTAREA_HEIGHT=parseInt(50);ChatWidget.TEXTAREA_WIDTH=parseInt(250);ChatWidget.BACKGROUND_COLOR="#F5EF90";ChatWidget.prototype._editmode;ChatWidget.prototype._username;ChatWidget.prototype._comments;ChatWidget.prototype._isSelected;ChatWidget.prototype._closeButton;ChatWidget.prototype._container;ChatWidget.prototype._upperPane;ChatWidget.prototype._lowerPane;ChatWidget.prototype._lowerPaneDisplayed;ChatWidget.prototype._commentSection;ChatWidget.prototype._statusBar;ChatWidget.prototype._table;ChatWidget.prototype._textArea;ChatWidget.prototype._resizeHandler;ChatWidget.prototype._canvas;ChatWidget.prototype._textColor;function ChatWidget(mimeType,id,height,width,zindex,canvas,cmnts,top,left)
{this._parent.initialize.call(this,mimeType,id,height,width,zindex,canvas);this._username=canvas.getPreferences().getPreferenceValue("editor.widgets.chat.username","???");this._top=(top!=null)?parseInt(top):0;this._left=(left!=null)?parseInt(left):0;this._height=(height==null||height==-1)?ChatWidget.TEXTAREA_HEIGHT:height;this._width=(width==null||width==-1)?ChatWidget.TEXTAREA_WIDTH:width;this._editmode=(cmnts!=null)?false:true;this._comments=(cmnts!=null)?cmnts:new Array(0);this._isSelected=false;this._lowerPaneDisplayed=false;this._textColor=canvas.getPreferences().getPreferenceValue("editor.textColor","black");}
ChatWidget.inheritsFrom(Widget);Editor.registerMimeType("text","chat",ChatWidget);ChatWidget.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var comments=xmlutils.getChildNode(elem,"comments");var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var style=xmlutils.getChildNode(elem,"style");var left=location.getAttribute("left");var top=location.getAttribute("top");left=left.substring(0,left.length-2);top=top.substring(0,top.length-2);var width=parseInt(dimensions.getAttribute("width"));var height=parseInt(dimensions.getAttribute("height"));var coms=new Array(0);for(var j=0;j<comments.childNodes.length;j++)
coms[j]=ChatComment.RenderXML(comments.childNodes.item(j));var ctw=ChatWidget.createInstance(mimeType,id,height,width,zindex,canvas,coms,top,left);ctw.toHtml();return ctw;}
ChatWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,cmnts,top,left)
{var ce=new ChatWidget(mimeType,id,height,width,zindex,canvas,cmnts,top,left);if(ChatWidget.objects==null){ChatWidget.objects=new Object();}
ChatWidget.objects[ce._id]=ce;return ce;}
ChatWidget.getObject=function(obj)
{var elem=obj.parentNode;while(elem.className!="draggable"){elem=elem.parentNode;}
return ChatWidget.objects[elem.id];}
ChatWidget.handleClose=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var ce=ChatWidget.getObject(target);ce._canvas._element.removeChild(ce._html);ce._editmode=false;ce._html=null;ce.restoreZIndex();if(ce._comments.length==0)
ce._canvas.deleteObjectX(ce);else{ce.toHtml();ce.resizeBars();}}
ChatWidget.handleOpen=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getCurrentTarget(evt);var ce=ChatWidget.getObject(target);var mode=ce._canvas.getEditMode();ce._canvas._element.removeChild(ce._html);ce.createChatEditor(mode);ce._canvas._element.appendChild(ce._html);ce._editmode=true;}
ChatWidget.handleKeyUp=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);}
ChatWidget.handleMouseDown=function(e){var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);}
ChatWidget.handleMouseDown2=function(e){var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var ce=ChatWidget.getObject(target);if(evt.offsetX>ce._commentSection.scrollWidth)
EventUtils.stopPropagation(evt);}
ChatWidget.newComment=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var ce=ChatWidget.getObject(target);if(ce._lowerPaneDisplayed==true)
return;var h=dhtmlapi.getObjectHeight(ce._container);ce._container.appendChild(ce._lowerPane);var lph=dhtmlapi.getObjectHeight(ce._lowerPane);ce._lowerPaneDisplayed=true;ce._textArea.focus();ce._container.style.height=(h+lph)+'px';var w=dhtmlapi.getObjectWidth(ce._upperPane);ce._lowerPane.style.width=w+"px";ce._textArea.style.width=w+"px";ce.resizeResizer();}
ChatWidget.cancelComment=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var ce=ChatWidget.getObject(target);ce._textArea.value="";var h=dhtmlapi.getObjectHeight(ce._container);var lph=dhtmlapi.getObjectHeight(ce._lowerPane);ce._container.removeChild(ce._lowerPane);ce._lowerPaneDisplayed=false;ce._container.style.height=(h-lph)+'px';ce.resizeResizer();}
ChatWidget.saveComment=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);var ce=ChatWidget.getObject(target);if(ce._textArea.value=="")
return;var idx=ce._comments.length;var d=new Date();ce._comments[idx]=ChatComment.createTextInstance(ce._username,ce._textArea.value,ce._textColor,d);ce.displayComment(ce._comments[idx],idx);ce.markChanged(Widget.ACTION_EDIT,0);ce._statusBar.innerHTML=ce._comments.length+"&nbsp;Post"+
((ce._comments.length!=1)?"s":"");ce._textArea.value="";var h=dhtmlapi.getObjectHeight(ce._container);var lph=dhtmlapi.getObjectHeight(ce._lowerPane);ce._container.removeChild(ce._lowerPane);ce._lowerPaneDisplayed=false;ce._container.style.height=(h-lph)+'px';ce.resizeResizer();}
ChatWidget.prototype.getContents=function()
{var ce=ChatWidget.object;return ce._comments;}
ChatWidget.prototype.launch=function()
{this._canvas._element.removeChild(this._html);this._editmode=true;this.createChatEditor();this._canvas._element.appendChild(this._html);}
ChatWidget.prototype.resizeBy=function(location,deltaX,deltaY)
{var bx=2;var resize=true;if(this._editmode==false){var w1=dhtmlapi.getObjectWidth(this._html);this._html.style.width=(w1+deltaX-bx)+"px";var h1=dhtmlapi.getObjectHeight(this._html);this._html.style.height=(h1+deltaY-bx)+"px";this._width+=parseInt(deltaX);this._height+=parseInt(deltaY);this.resizeResizer();return;}
var textAdj=6;if(dhtmlapi.isSafari==true)
textAdj=2;else if(dhtmlapi.isGecko==true)
textAdj=4;if(deltaX!=0)
{var w=dhtmlapi.getObjectWidth(this._container)+deltaX-bx;if(w<200)
return;this._container.style.width=w+"px";w=dhtmlapi.getObjectWidth(this._upperPane);this._upperPane.style.width=(w+deltaX)+"px";w=dhtmlapi.getObjectWidth(this._commentSection);this._commentSection.style.width=(w+deltaX)+"px";if(this._lowerPaneDisplayed==true){w=dhtmlapi.getObjectWidth(this._lowerPane);this._lowerPane.style.width=(w+deltaX)+"px";w=dhtmlapi.getObjectWidth(this._textArea);this._textArea.style.width=(w+deltaX-textAdj)+"px";}}
if(deltaY!=0)
{var h=null;if(this._lowerPaneDisplayed!=true){h=dhtmlapi.getObjectHeight(this._commentSection);if((h+deltaY)>25){this._commentSection.style.height=(h+deltaY)+"px";h=dhtmlapi.getObjectHeight(this._upperPane);this._upperPane.style.height=(h+deltaY)+"px";h=dhtmlapi.getObjectHeight(this._container);this._container.style.height=(h+deltaY-bx)+"px";}}
else{h=dhtmlapi.getObjectHeight(this._textArea);if((h+deltaY)>25){this._textArea.style.height=(h+deltaY-textAdj)+"px";h=dhtmlapi.getObjectHeight(this._lowerPane);this._lowerPane.style.height=(h+deltaY)+"px";h=dhtmlapi.getObjectHeight(this._container);this._container.style.height=(h+deltaY-bx)+"px";}}}
this.resizeResizer();}
ChatWidget.prototype.select=function(parent)
{if(this._isSelected==false){this._parent.select.call(this,parent);this._isSelected=true;}}
ChatWidget.prototype.rollover=function()
{this._parent.rollover.call(this);}
ChatWidget.prototype.rollout=function()
{this._parent.rollout.call(this);}
ChatWidget.prototype.toHtml=function()
{if(this._editmode==true)
this.createChatEditor();else{this.createCommentBox();}}
ChatWidget.prototype.toXML=function()
{var elem=this._parent.toXml.call(this);var comments=xmlutils.dom.createElement("comments");for(var j=0;j<this._comments.length;j++){comments.appendChild(this._comments[j].toXml());}
elem.appendChild(comments);return elem;}
ChatWidget.prototype.unselect=function(mode)
{try{if(this._isSelected==true){this._isSelected=false;this._parent.unselect.call(this);}}catch(e){;}}
ChatWidget.prototype.toolbarCB=function(toolbarName,state,operation,value)
{if(operation=="chatExpand"){if(this._editmode!=true)
this.launch();}
else
this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
ChatWidget.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);var b=null;b=Button.createImage("zoom",Button.BUTTON,"chatExpand","images/editor/widgets/zoom.png",16,16,"Expand Chat Box");tb.add(b);return tb;}
ChatWidget.prototype.displayComment=function(comment,idx)
{var tr=this._table.insertRow(idx);var td=tr.insertCell(0);td.width="30";td.border=5;td.style.paddingRight="2px";var img=document.createElement("img");img.src=ChatWidget.COMMENT_ICON_TEXT;td.appendChild(img);td=tr.insertCell(1);td.style.fontSize="10pt";td.style.fontFamily="Verdana, Trebuchet, Arial";var spnName=document.createElement("span");spnName.innerHTML="<strong>"+comment.getName()+": </strong>";spnName.style.color=comment.getColor();var spnComment=document.createElement("span");spnComment.innerHTML=comment.getMessage();spnComment.style.color=comment.getColor();td.border=5;td.appendChild(spnName);td.appendChild(spnComment);}
ChatWidget.prototype.getContents=function()
{return this._comments;}
ChatWidget.prototype.resizeResizer=function()
{this.resizeBars();}
ChatWidget.prototype.setDimensions=function(top,left)
{this._container.style.top=top;this._container.style.left=left;this._top=top;this._left=left;this._upperPane.style.height=ChatWidget.UPPERPANE_HEIGHT+"px";this._upperPane.style.width=ChatWidget.UPPERPANE_WIDTH+"px";this._lowerPane.style.width=ChatWidget.LOWERPANE_WIDTH+"px";this._textArea.style.height=ChatWidget.TEXTAREA_HEIGHT+"px";this._textArea.style.width=ChatWidget.TEXTAREA_WIDTH+"px";this.resizeResizer();}
ChatWidget.prototype.updateComments=function(commentsArray)
{this._comments=commentsArray;}
ChatWidget.prototype.createChatEditor=function(mode)
{this._container=document.createElement("div");this._container.id=this._id;this._container.className="draggable";this._container.style.position="absolute";this._container.style.top=this._top+"px";this._container.style.left=this._left+"px";this._container.style.backgroundColor=ChatWidget.BACKGROUND_COLOR;this._container.style.border="solid black 1px";this._container.style.zIndex=(mode==null||mode!=Editor.READ_ONLY)?ZIndex.CHAT_EDIT:ZIndex.CHAT_EXPANDED;this._container.style.fontSize="10pt";this._container.style.fontFamily="Verdana, Trebuchet, Arial";this._canvas._element.appendChild(this._container);this.createUpperPane(mode);this.createLowerPane(mode);for(var i=0;i<this._comments.length;i++)
{var comment=this._comments[i];this.displayComment(comment,i);}
this._statusBar.innerHTML=this._comments.length+"&nbsp;Post"+
((this._comments.length!=1)?"s":"");var height=dhtmlapi.getObjectHeight(this._container);var width=dhtmlapi.getObjectWidth(this._container);this._container.style.height=height+'px';this._container.style.width=width+'px';this._html=this._container;this._canvas.showChangeBox(this);this.resizeBars();}
ChatWidget.prototype.createUpperPane=function(mode)
{this._upperPane=document.createElement("div");this._upperPane.id="chatEditor_upperPane";this._upperPane.style.width=ChatWidget.UPPERPANE_WIDTH+"px";this._upperPane.style.backgroundColor=ChatWidget.BACKGROUND_COLOR;this._upperPane.style.border="solid gray 0px";this._upperPane.style.margin="5px";this._upperPane.style.fontSize="10pt";this._upperPane.style.fontFamily="Verdana, Trebuchet, Arial";this._container.appendChild(this._upperPane);this._statusBar=document.createElement("span");this._statusBar.innerHTML="0 Posts";this._statusBar.style.fontWeight="bold";this._statusBar.style.textDecoration="underline";this._upperPane.appendChild(this._statusBar);this._commentSection=document.createElement("div");this._commentSection.style.height=ChatWidget.COMMENTS_HEIGHT+"px";this._commentSection.style.width=ChatWidget.COMMENTS_WIDTH+"px";this._commentSection.style.overflowY="auto";this._commentSection.style.overflowX="hidden";this._commentSection.style.margin="5px";this._commentSection.style.border="solid yellow 0px";this._commentSection.style.backgroundColor=ChatWidget.BACKGROUND_COLOR;this._commentSection.onmousedown=ChatWidget.handleMouseDown2;this._upperPane.appendChild(this._commentSection);this._table=document.createElement("table");this._table.border=0;this._table.width="100%";this._table.bgColor=ChatWidget.BACKGROUND_COLOR;this._table.cellSpacing="0";this._table.cellPadding="0";this._commentSection.appendChild(this._table);var close=document.createElement("span");close.innerHTML="Close";close.style.color="blue";close.style.textDecoration="underline";close.style.cursor="pointer";close.onclick=ChatWidget.handleClose;close.onmousedown=ChatWidget.handleMouseDown;this._upperPane.appendChild(close);var spn=document.createElement("span");spn.innerHTML="&nbsp;&nbsp;";this._upperPane.appendChild(spn);if(mode==null||mode!=Editor.READ_ONLY){var add=document.createElement("span");add.innerHTML="Enter Comment";add.style.color="blue";add.style.cursor="pointer";add.style.textDecoration="underline";add.onclick=ChatWidget.newComment;add.onmousedown=ChatWidget.handleMouseDown;this._upperPane.appendChild(add);}
var h=dhtmlapi.getObjectHeight(this._upperPane);this._upperPane.style.height=h+'px';}
ChatWidget.prototype.createLowerPane=function(mode)
{if(mode==Editor.READ_ONLY)
return;this._lowerPane=document.createElement("div");this._lowerPane.id="lowerPane";this._lowerPane.style.width=ChatWidget.LOWERPANE_WIDTH+"px";this._lowerPane.style.border="solid gray 0px";this._lowerPane.style.margin="5px";this._lowerPane.style.fontSize="10pt";this._lowerPane.style.fontFamily="Verdana, Trebuchet, Arial";this._textArea=document.createElement("textarea");this._textArea.id="commentArea";this._textArea.style.height=ChatWidget.TEXTAREA_HEIGHT+"px";this._textArea.style.width=ChatWidget.TEXTAREA_WIDTH+"px";this._textArea.wrap="soft";this._textArea.onkeyup=ChatWidget.handleKeyUp;this._textArea.onmousedown=ChatWidget.handleMouseDown;this._lowerPane.appendChild(this._textArea);var br=document.createElement("br");this._lowerPane.appendChild(br);var submit=document.createElement("span");submit.innerHTML="Submit";submit.style.color="blue";submit.style.textDecoration="underline";submit.style.cursor="pointer";submit.onclick=ChatWidget.saveComment;submit.onmousedown=ChatWidget.handleMouseDown;this._lowerPane.appendChild(submit);var spn=document.createElement("span");spn.innerHTML="&nbsp;&nbsp;";this._lowerPane.appendChild(spn);var cancel=document.createElement("span");cancel.innerHTML="Cancel";cancel.style.color="blue";cancel.style.cursor="pointer";cancel.style.textDecoration="underline";cancel.onclick=ChatWidget.cancelComment;cancel.onmousedown=ChatWidget.handleMouseDown;this._lowerPane.appendChild(cancel);}
ChatWidget.prototype.createCommentBox=function()
{var d=document.createElement("div");d.id=this._id;d.className="draggable";d.setAttribute("mimeType","chat");d.style.position="absolute";d.style.left=this._left+"px";d.style.top=this._top+"px";var val=parseInt(this._height);if(parseInt(this._height)==NaN)
this._height=ChatWidget.TEXTAREA_HEIGHT;if(parseInt(this._width)==NaN)
this._width=ChatWidget.TEXTAREA_WIDTH;d.style.height=this._height+'px';d.style.width=this._width+'px';d.style.overflow="visible";d.style.borderStyle="none";d.style.borderColor="black";d.style.borderWidth="0px";d.style.backgroundColor=ChatWidget.BACKGROUND_COLOR;d.style.zIndex=this.getZIndex();d.style.fontSize="10pt";d.style.fontFamily="Verdana, Trebuchet, Arial";var spn=document.createElement("span");d.appendChild(spn);var blurb="";if(this._comments.length>0){blurb+=this._comments[0].getMessage().substr(0,50);if(this._comments.length>1){var morelen="more ...".length+2;blurb+="<br>"+this._comments[1].getMessage().substr(0,50-morelen)+"&nbsp;";}
else{blurb+="<br>";}
spn.innerHTML=blurb;var more=document.createElement('span');more.style.color='blue';more.style.cursor='pointer';more.style.fontStyle='italic';more.style.textDecoration='underline';more.innerHTML='more';more.onclick=ChatWidget.handleOpen;spn.appendChild(more);}
this._html=d;this._canvas.showChangeBox(this);this._canvas._element.appendChild(this._html);}
ChatWidget.prototype.initialize=function(username,chatObject)
{this._username=username;while(this._table.rows.length>0)
this._table.rows.deleteRow(0);this._container.style.display="block";this._container.style.zIndex=this.getZIndex();}
ChatComment.prototype._name;ChatComment.prototype._message;ChatComment.prototype._color;ChatComment.prototype._date;function ChatComment(author,msg,color,d)
{this._name=author;if(d!=null)
this._date=d;else
this._date=new Date(0);this._message=msg;if(color!=null)
this._color=color;else
this._color="black";}
ChatComment.createTextInstance=function(author,msg,color,d)
{var c=new ChatComment(author,msg,color,d);return c;}
ChatComment.RenderXML=function(elem)
{var e=xmlutils.getChildNode(elem,"author");var author="unknown";var message="unknown";var color="black";var date=new Date(0);if(e!=null)
author=xmlutils.getNodeText(e);e=xmlutils.getChildNode(elem,"message");if(e!=null)
message=xmlutils.getNodeText(e);e=xmlutils.getChildNode(elem,"date");if(e!=null){var x=xmlutils.getNodeText(e);if(x!=null&&x!="")
date=new Date(parseInt(x));}
e=xmlutils.getChildNode(elem,"color");if(e!=null)
color=xmlutils.getNodeText(e);var cmt=ChatComment.createTextInstance(author,message,color,date);return cmt;}
ChatComment.prototype.getColor=function()
{return this._color;}
ChatComment.prototype.getName=function()
{return this._name;}
ChatComment.prototype.getDate=function()
{return this._date;}
ChatComment.prototype.getMessage=function()
{return this._message;}
ChatComment.prototype.toXml=function()
{var elem=xmlutils.dom.createElement("comment");elem.appendChild(xmlutils.createTextElement("author",this._name));elem.appendChild(xmlutils.createTextElement("message",this._message));elem.appendChild(xmlutils.createTextElement("date",this._date.getTime()));elem.appendChild(xmlutils.createTextElement("color",this._color));return elem;}
HtmlWidget.prototype._element;HtmlWidget.prototype._htmltext;HtmlWidget.prototype._editmode;HtmlWidget.prototype._type;HtmlWidget.prototype._editHeight;HtmlWidget.prototype._editWidth;HtmlWidget.prototype._detachedFrame;HtmlWidget.DEFAULT_HEIGHT=parseInt(200);HtmlWidget.DEFAULT_WIDTH=parseInt(200);HtmlWidget.MIN_EDITOR_HEIGHT=parseInt(130);HtmlWidget.MIN_EDITOR_WIDTH=parseInt(225);HtmlWidget.EDITOR_TEXTAREA_DIFF=parseInt(65);HtmlWidget.DEFAULT_SCRIPT='<head><script type="text/javascript"> function init() { document.onmouseup = up; } function up() { window.parent.handleIFrameMouseUp(); } </script></head>';function HtmlWidget(mimeType,id,height,width,zindex,canvas,url,top,left)
{var mt=(mimeType!=null)?mimeType:"custom/html";this._parent.initialize.call(this,mt,id,height,width,zindex,canvas);this._top=(top!=null)?parseInt(top):0;this._left=(left!=null)?parseInt(left):0;this._width=(width!=null)?parseInt(width):0;this._height=(height!=null)?parseInt(height):0;if(this._width<=0)
this._width=HtmlWidget.DEFAULT_WIDTH;if(this._height<=0)
this._height=HtmlWidget.DEFAULT_HEIGHT;this._element=null;this._editmode=false;this._type=0;this._htmltext=url;this._detachedFrame=null;}
HtmlWidget.inheritsFrom(Widget);Editor.registerMimeType("custom","html",HtmlWidget);HtmlWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,url,top,left)
{return new HtmlWidget(mimeType,id,height,width,zindex,canvas,url);}
HtmlWidget.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var mimetype=elem.getAttribute("mimeType");var style=xmlutils.getChildNode(elem,"style");var left=location.getAttribute("left");var top=location.getAttribute("top");var width=dimensions.getAttribute("width");var height=dimensions.getAttribute("height");var props=xmlutils.getChildNode(elem,"properties");var url=xmlutils.getChildNode(elem,"htmltext");var type=xmlutils.getChildNode(elem,"type");type=parseInt(xmlutils.getNodeText(type));left=left.substring(0,left.length-2);top=top.substring(0,top.length-2);width=width.substring(0,width.length-2);height=height.substring(0,height.length-2);var obj=HtmlWidget.createInstance(mimeType,id,height,width,zindex,canvas,xmlutils.getNodeText(url),top,left);obj._type=type;obj.setProperties(props);obj.toHtml();obj.moveTo(left,top);return obj;}
HtmlWidget.prototype.isExternalResource=function()
{return true;}
HtmlWidget.prototype.launch=function()
{var htmlText=this.getContents();if(this._html!=null){height=dhtmlapi.getObjectHeight(this._html);width=dhtmlapi.getObjectWidth(this._html);}else{height=HtmlWidget.MIN_EDITOR_HEIGHT;width=HtmlWidget.MIN_EDITOR_WIDTH;}
if(height<HtmlWidget.MIN_EDITOR_HEIGHT)
height=HtmlWidget.MIN_EDITOR_HEIGHT;if(width<HtmlWidget.MIN_EDITOR_WIDTH)
width=HtmlWidget.MIN_EDITOR_WIDTH;this._canvas.unSelectWidget(this);if(this._html!=null)
this._canvas._element.removeChild(this._html);this.createEditor(height,width);this._editmode=true;}
HtmlWidget.prototype.createEditor=function(h,w)
{var i;var sel=false;var prop=null;var d=document.createElement("div");d.id=this._id;d.className="draggable";d.style.position="absolute";d.style.top=this._top+"px";d.style.left=this._left+"px";d.style.display="";d.style.padding='4px';d.style.backgroundColor="lightgrey";d.style.zIndex=50000;d.style.width=w+"px";d.style.height=h+"px";var tbl=document.createElement("table");tbl.width="100%";tbl.height="100%";tbl.cellPadding=2;tbl.cellSpacing=0;tbl.border=0;tbl.align="center";var obj1=document.createElement('span');obj1.className='normalText';obj1.innerHTML='Insert your html here:';var obj2=document.createElement("select");obj2.className='smallText';obj2.name='type';obj2.options.length=0;obj2.options[0]=new Option("HTML code","0",false,false);obj2.options[1]=new Option("Website URL","1",false,false);if(this._type==0)
obj2.options[0].selected=true;else
obj2.options[1].selected=true;var tr=tbl.insertRow(0);var td=tr.insertCell(0);td.height="30px";td.width="100%";td.appendChild(obj1);td.appendChild(obj2);var obj3=document.createElement('textarea');obj3.className='normalText';obj3.name='htmltext';if(this._htmltext!=null&&this._htmltext!=""&&this._htmltext.indexOf("null")==-1)
obj3.value=this._htmltext;else
obj3.value="";obj3.rows=1;obj3.cols=10;tr=tbl.insertRow(1);td=tr.insertCell(0);td.height=(h-60)+"px";td.width="100%";td.appendChild(obj3);obj3.style.height=(h-HtmlWidget.EDITOR_TEXTAREA_DIFF)+"px";obj3.style.width="95%";if(dhtmlapi.isIE==true){obj3.onmousedown=HtmlWidget.handleMouseMove;obj3.onmousemove=HtmlWidget.handleMouseMove;obj3.onkeyup=HtmlWidget.handleMouseMove;}
else{obj3.addEventListener("mousedown",HtmlWidget.handleMouseMove,false);obj3.addEventListener("mousemove",HtmlWidget.handleMouseMove,false);obj3.addEventListener("keyup",HtmlWidget.handleMouseMove,false);}
var obj4=document.createElement('button');obj4.innerHTML='OK';obj4.onclick=HtmlWidget.handleClose;tr=tbl.insertRow(2);td=tr.insertCell(0);td.height="30px";td.width="100%";td.appendChild(obj4);d.appendChild(tbl);this._editHeight=h;this._editWidth=w;this._canvas._element.appendChild(d);this._html=d;Widget.addToCache(this._id,this);}
HtmlWidget.handleMouseMove=function(e)
{var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);}
HtmlWidget.handleClose=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);while(target.className!='draggable'&&target!=null){target=target.parentNode;}
var lw=Widget.removeFromCache(target.id);var fontFamily=null;var fontSize=null;var decoration=null;var text=null;var value=null;var obj1=HtmlWidget.getChildByName(target,"htmltext");var obj2=HtmlWidget.getChildByName(target,"type");lw._htmltext=obj1.value;var value=obj2.options[obj2.selectedIndex].value;lw._type=parseInt(value);if(lw._type==1){if(lw._htmltext.indexOf("http://")==-1&&lw._htmltext.indexOf("https://")==-1)
lw._htmltext="http://"+lw._htmltext;}
if(lw.isEmbedWidget(lw._htmltext))
lw._htmltext=lw.adjustHtml(lw._htmltext);lw._canvas.unSelectWidget(lw);lw._canvas._element.removeChild(lw._html);lw._editmode=false;lw.toHtml();lw.moveTo(lw._left,lw._top);}
HtmlWidget.getChildByName=function(target,name)
{var child;var recurse;for(child=target.firstChild;child!=null;child=child.nextSibling){if(child.name==name)
return child;recurse=HtmlWidget.getChildByName(child,name);if(recurse!=null)
return recurse;}
return null;}
HtmlWidget.prototype.resizeBy=function(whichCorner,deltaX,deltaY)
{if(deltaX==0&&deltaY==0)
return;if(this._editmode!=true){var container=this._html;var child=this._html.firstChild;var new_height=this._height+deltaY;var new_width=this._width+deltaX;if(child!=null){child.style.height=new_height+"px";child.style.width=new_width+"px";}
container.style.height=new_height+"px";container.style.width=new_width+"px";if(this._detachedFrame!=null){this._detachedFrame.style.height=new_height+"px";this._detachedFrame.style.width=new_width+"px";}
this._height=new_height;this._width=new_width;this.resizeBars();}
else{var container=this._html;var height=this._editHeight+deltaY;var width=this._editWidth+deltaX;if(height>=HtmlWidget.MIN_EDITOR_HEIGHT){var textarea=HtmlWidget.getChildByName(container,"htmltext");textarea.style.height=(height-HtmlWidget.EDITOR_TEXTAREA_DIFF)+"px";container.style.height=height+"px";}
if(width>=HtmlWidget.MIN_EDITOR_WIDTH){container.style.width=width+"px";}
this.resizeBars();this._editHeight=height;this._editWidth=width;}}
HtmlWidget.prototype.select=function(parent)
{this._parent.select.call(this,parent);}
HtmlWidget.prototype.rollover=function()
{this._parent.rollover.call(this);}
HtmlWidget.prototype.rollout=function()
{this._parent.rollout.call(this);}
HtmlWidget.prototype.setLogicalName=function(url,name)
{var idx=url.lastIndexOf(".");var suffix=(idx>=0)?url.substr(idx):"";this._displayName=name+suffix;if(this._element!=null)
this._element.innerHTML=this._displayName;}
HtmlWidget.prototype.toHtml=function()
{if(this._htmltext!=null){var container=document.createElement("div");container.id=this._id;container.className="draggable";container.style.position="absolute";container.style.left=0+"px";container.style.top=0+"px";container.style.width=this._width+"px";container.style.height=this._height+"px";container.style.overflow="visible";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.backgroundColor="transparent";container.style.zIndex=this.getZIndex();container.setAttribute("mimeType",this._mimeType);var d=document.createElement('iframe');d.name=d.id="customhtml";d.frameBorder="0";d.allowTransparency="true";d.style.height=this._height+"px";d.style.width=this._width+"px";if(this._type==0)
d.src='about:blank';else
d.src=this._htmltext;container.appendChild(d);this._html=container;this._canvas._element.appendChild(this._html);this._width=dhtmlapi.getObjectWidth(d);this._height=dhtmlapi.getObjectHeight(d);if(this._type==0){var iframeDoc;if(d.contentDocument){iframeDoc=d.contentDocument;}
else if(d.contentWindow){iframeDoc=d.contentWindow.document;}
else if(window.frames[d.name]){iframeDoc=window.frames[d.name].document;}
if(iframeDoc){iframeDoc.open();iframeDoc.write('<html>'+HtmlWidget.DEFAULT_SCRIPT+'<body onLoad="init()" style="background-color:transparent">'+this._htmltext+'<\/body><\/html>');iframeDoc.close();d.frameborder="0";}}}else{this.launch();}}
HtmlWidget.prototype.toXML=function()
{if(this._htmltext==null){return null;}
var elem=this._parent.toXml.call(this);var text=xmlutils.dom.createElement("htmltext");var xmlstr=xmlutils.encodeUTF(this._htmltext);xmlutils.setNodeText(text,xmlstr);elem.appendChild(text);var typ=xmlutils.dom.createElement("type");xmlutils.setNodeText(typ,this._type);elem.appendChild(typ);return elem;}
HtmlWidget.prototype.unselect=function(mode)
{this._parent.unselect.call(this);}
HtmlWidget.prototype.toolbarCB=function(toolbarName,state,operation,value,x,y)
{var v=(value==null)?'':value;var logicalX=x+document.body.scrollLeft;var logicalY=y+document.body.scrollTop;if(operation=="textEdit"){if(this._editmode!=true)
this.launch();}
else
this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
HtmlWidget.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);var b=null;b=Button.createImage("edit",Button.BUTTON,"textEdit","images/editor/widgets/edit.png",16,40,"Edit");tb.add(b);return tb;}
HtmlWidget.prototype.adjustHtml=function(htmlStr)
{var regexArray=new Array(/width="[0-9]+"/gi,/height="[0-9]+"/gi,/width='[0-9]+'/gi,/height='[0-9]+'/gi,/width=[0-9]+/gi,/height=[0-9]+/gi);var regexArrayReplace=new Array('width="XYZZY"','height="XYZZY"',"width='XYZZY'","height='XYZZY'",'width=XYZZY','height=XYZZY');for(i=0;i<regexArray.length;i++)
htmlStr=htmlStr.replace(regexArray[i],regexArrayReplace[i]);var result=htmlStr.replace(/XYZZY/g,"100%");return result;}
HtmlWidget.prototype.isEmbedWidget=function(htmlStr)
{var matchArray=new Array(/<OBJECT/i,/<EMBED/i,/<\/OBJECT/i,/<\/EMBED/i);for(j=0;j<matchArray.length;j++){if(htmlStr.match(matchArray[j])!=null)
return true;}
return false;}
HtmlWidget.prototype.getChild=function(name)
{if(this._html!=null){var child;for(child=this._html.firstChild;child!=null;child=child.nextSibling){if(child.name==name)
return child;}}
return null;}
HtmlWidget.prototype.moveEvent=function(deltaX,deltaY)
{if((this._detachedFrame==null)&&(this._editmode==false)){var frame=this.getChild("customhtml");if(frame!=null){this._detachedFrame=this._html.removeChild(frame);var wm=this.createWatermark();this._html.appendChild(wm);}}}
HtmlWidget.prototype.moveEnd=function()
{if((this._detachedFrame!=null)&&(this._editmode==false)){var d=this.getChild('htmlwatermark');if(d!=null)
this._html.removeChild(d);this._html.appendChild(this._detachedFrame);this.reloadFrame();this._detachedFrame=null;}}
HtmlWidget.prototype.resizeEvent=function(whichCorner,deltaX,deltaY)
{this.moveEvent(deltaX,deltaY);}
HtmlWidget.prototype.resizeEnd=function(x,y)
{this.moveEnd();}
HtmlWidget.prototype.createWatermark=function()
{var d=document.createElement("div");d.style.backgroundImage='url(images/editor/grid_medium.gif)';d.style.backgroundRepeat='repeat';d.style.width='100%';d.style.height='100%';d.id=d.name='htmlwatermark';return d;}
HtmlWidget.prototype.reloadFrame=function()
{if((dhtmlapi.isIE==false)&&(this._type==0)){var reattach=this.getChild("customhtml");if(reattach==null)
return;var iframeDoc;if(reattach.contentDocument){iframeDoc=reattach.contentDocument;}
else if(reattach.contentWindow){iframeDoc=reattach.contentWindow.document;}
else if(window.frames[reattach.name]){iframeDoc=window.frames[reattach.name].document;}
if(iframeDoc){iframeDoc.open();iframeDoc.write('<html>'+HtmlWidget.DEFAULT_SCRIPT+'<body onLoad="init()" style="background-color:transparent">'+this._htmltext+'<\/body><\/html>');iframeDoc.close();reattach.frameborder="0";}}}
ImageWidget.toolbar=null;ImageWidget.toolbarElement=null;ImageWidget.toolbarMode=null;ImageWidget.prototype._urlMaster;ImageWidget.prototype._urlArchive;ImageWidget.prototype._overlay;ImageWidget.prototype._imageContainer;ImageWidget.prototype._magnifiedImage;ImageWidget.prototype._closeBtn;ImageWidget.prototype._title;ImageWidget.prototype._viewerID;ImageWidget.prototype._border;ImageWidget.prototype._imageHeight;ImageWidget.prototype._imageWidth;ImageWidget.prototype._borderName;ImageWidget.prototype._borderHeight;ImageWidget.prototype._borderWidth;function ImageWidget(mimeType,id,height,width,zindex,canvas,url)
{this._parent.initialize.call(this,mimeType,id,height,width,zindex,canvas);this._url=url;this._urlMaster=null;this._urlArchive=null;this._title=util.titleFromUrl(url);this._ratio=0;this._borderName="default";this._borderHeight=15;this._borderWidth=15;this._imageHeight=parseInt(height);this._imageWidth=parseInt(width);this._border=true;this._height=parseInt(height)+(2*parseInt(this._borderHeight));this._width=parseInt(width)+(2*parseInt(this._borderWidth));}
ImageWidget.inheritsFrom(Widget);Editor.registerMimeType("image","*",ImageWidget);ImageWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,url)
{return new ImageWidget(mimeType,id,height,width,zindex,canvas,url);}
ImageWidget.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var url=xmlutils.getChildNode(elem,"url");var title=xmlutils.getChildNode(elem,"title");var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var style=xmlutils.getChildNode(elem,"style");var border=xmlutils.getChildNode(elem,"border");var ratio=xmlutils.getChildNode(elem,"ratio");var archive=xmlutils.getChildNode(elem,"archive-url");var master=xmlutils.getChildNode(elem,"master-url");var borderenabled=false;var ratioVal=0;var left=parseInt(location.getAttribute("left"));var top=parseInt(location.getAttribute("top"));var width=parseInt(dimensions.getAttribute("width"));var height=parseInt(dimensions.getAttribute("height"));var obj=ImageWidget.createInstance(mimeType,id,height,width,zindex,canvas,xmlutils.getNodeText(url));if(title!=null)
obj._title=xmlutils.getNodeText(title);if(ratio!=null)
ratioVal=ratio.getAttribute("value");else
ratioVal=width/height;obj._urlArchive=xmlutils.getNodeText(archive);obj._urlMaster=xmlutils.getNodeText(master);if(border!=null&&border.getAttribute("enabled")=="true")
{obj.setBorder("default",15,15);height-=30;width-=30;}
else
obj.setBorder(null,0,0);obj.setRatio(ratioVal);obj.setDimensions(height,width);obj.toHtml();obj.resizeTo(obj._imageHeight,obj._imageWidth);obj.moveTo(left,top);return obj;}
ImageWidget.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);var b=null;b=Button.createImage("cw",Button.BUTTON,"rotatecw","images/editor/widgets/rotateright.png",16,16,"Rotate Clockwise");tb.add(b);b=Button.createImage("ccw",Button.BUTTON,"rotateccw","images/editor/widgets/rotateleft.png",16,16,"Rotate Counter-Clockwise");tb.add(b);b=Button.createImage("border_"+this._id,Button.BUTTON,"border","images/editor/widgets/border.png",16,16,"Hide/Show border");tb.add(b);b=Button.createImage("zoom",Button.BUTTON,"zoom","images/editor/widgets/zoom.png",16,16,"Display Full Image");tb.add(b);if(this.isDirty()&&Editor.editor._javaActive){tb.hideButton("zoom");}
return tb;}
ImageWidget.prototype.endOperation=function()
{var container=this._html;var child=this.getImageElement();var border=this.getBorderElement();var height=this._height;var width=this._width;this._height=this._imageHeight+(2*this._borderHeight);this._width=this._imageWidth+(2*this._borderWidth);container.style.height=this._height+"px";container.style.width=this._width+"px";this.resizeBars();}
ImageWidget.prototype.getContents=function()
{return this._url;}
ImageWidget.prototype.getExternalResource=function()
{var external_resource={"id":this._id,"url":this._url,"urlmaster":this._urlMaster,"urlarchive":this._urlArchive,"external":this._externalUpload,"title":this._title,"width":this._width,"height":this._height};return external_resource;}
ImageWidget.prototype.isExternalResource=function()
{return true;}
ImageWidget.prototype.launch=function()
{if(dhtmlapi.isSafari==true)
return;}
ImageWidget.prototype.resizeBy=function(whichCorner,deltaX,deltaY)
{if(deltaX==0&&deltaY==0)
return;var container=this._html;var child=this.getImageElement();var border=this.getBorderElement();var new_container_height=this._height+deltaY;var new_container_width=this._width+deltaX;var proposed_image_height=new_container_height-(2*this._borderHeight);var proposed_image_width=new_container_width-(2*this._borderWidth);if(this._ratio!=0){var new_width=proposed_image_width;var new_height=proposed_image_height;if(this._ratio>1){new_height=parseInt(proposed_image_width/this._ratio);if(new_height>proposed_image_height){new_height=proposed_image_height;new_width=parseInt(new_height*this._ratio);}}else{new_width=parseInt(proposed_image_height*this._ratio);if(new_width>proposed_image_width){new_width=proposed_image_width;new_height=parseInt(new_width/this._ratio);}}}
var sz=(new_width<new_height)?new_width:new_height;if(sz<75&&!this._border)
return;if(sz<45&&this._border)
return;this._imageHeight=new_height;this._imageWidth=new_width;this._height=new_container_height;this._width=new_container_width;container.style.height=this._height+"px";container.style.width=this._width+"px";child.style.height=this._imageHeight+"px";child.style.width=this._imageWidth+"px";if(this.isBorder()){this.adjustBorder(this._imageHeight,this._imageWidth);}
this.resizeBars();this.markChanged(Widget.ACTION_EDIT,0);}
ImageWidget.prototype.resizeTo=function(height,width)
{return;}
ImageWidget.prototype.select=function(parent)
{this._parent.select.call(this,parent);}
ImageWidget.prototype.setDimensions=function(height,width)
{this._imageHeight=this._height=height;this._imageWidth=this._width=width;if(this.isBorder()){this._height+=(2*this._borderHeight);this._width+=(2*this._borderWidth);}}
ImageWidget.prototype.rollover=function()
{this._parent.rollover.call(this);this.createImageToolbar(Editor.READ_ONLY);}
ImageWidget.prototype.rollout=function(mode)
{this.removeImageToolbar();this._parent.rollout.call(this);}
ImageWidget.prototype.toHtml=function(xcoord,ycoord)
{try{var container=document.createElement("div");var t=document.createElement("img");var dy=0;var prefs=this._canvas.getPreferences();var storageLoc=prefs.getPreferenceValue("editor.storage.location");var imageLoc=prefs.getPreferenceValue("editor.widgets.image.location");container.id=this._id+"Wrap";container.className="draggable";container.style.position="absolute";container.style.overflow="hidden";container.style.left=(xcoord!=null)?x+"px":"0px";container.style.top=(ycoord!=null)?y+"px":"0px";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.zIndex=this.getZIndex();container.setAttribute("mimeType","image");if(this.isBorder()){t.style.position="absolute";t.style.top=(15+dy)+"px";t.style.left="15px";}
else{t.style.position="absolute";t.style.top="0px";t.style.left="0px";}
t.id=this._id;t.name=this._id;var idx=this._url.lastIndexOf("/");t.src=storageLoc+imageLoc+"/"+this._url.substr(idx+1);t.style.border="none black 0px";idx=this._url.lastIndexOf("/");if(this._width!=0&&this._height!=0){t.width=this._imageWidth;t.height=this._imageHeight;container.style.width=this._width+'px';container.style.height=this._height+'px';}
else{alert("ImageWidget.toHtml() - this should not occur, where the width and height values are not set");}
container.appendChild(t);if(this.isBorder())
container.appendChild(this.createBorder(this._height,this._width));this._html=container;this._canvas._element.appendChild(container);}catch(e){alert("createImage: exception: "+e.message);}}
ImageWidget.prototype.toXML=function()
{var elem=this._parent.toXml.call(this);var url=xmlutils.dom.createElement("url");xmlutils.setNodeText(url,this._url);elem.appendChild(url);var master=xmlutils.dom.createElement("master-url");xmlutils.setNodeText(master,this._urlMaster);elem.appendChild(master);var archive=xmlutils.dom.createElement("archive-url");xmlutils.setNodeText(archive,this._urlArchive);elem.appendChild(archive);var title=xmlutils.dom.createElement("title");xmlutils.setNodeText(title,this._title);elem.appendChild(title);var ratio=xmlutils.dom.createElement("ratio");ratio.setAttribute("value",this._ratio);elem.appendChild(ratio);var border=xmlutils.dom.createElement("border");if(this.isBorder())
border.setAttribute("enabled","true");else
border.setAttribute("enabled","false");elem.appendChild(border);return elem;}
ImageWidget.prototype.unselect=function(mode)
{this._parent.unselect.call(this);var container=this._html;container.style.border="none black 1px";}
ImageWidget.prototype.getThumbnailGenXML=function()
{if(this.isDirty())
return'<object><url>'+this.getContents()+'</url><width>'+this._width+'</width><height>'+this._height+'</height></object>';else
return null;}
ImageWidget.prototype.removeBorder=function()
{var border=this.getBorderElement();while(border.hasChildNodes())
border.removeChild(border.firstChild);this._html.removeChild(border);}
ImageWidget.prototype.createBorder=function(h,w)
{var bw=this._borderWidth;var bh=this._borderHeight;var b_horizontal=w-(2*bw);var b_vertical=h-(2*bh);var id=this._id;var bor=document.createElement("div");bor.id="borderimg_"+id;bor.style.top='0px';bor.style.left='0px';bor.style.position="absolute";bor.style.width=w+"px";bor.style.height=h+"px";bor.style.zIndex=this.getZIndex()-1;bor.appendChild(this.createBorderElement('ctl_'+id,'borderbackground_01.png',0,0,bh,bw));bor.appendChild(this.createBorderElement('bt_'+id,'borderbackground_02.png',0,bw,bh,b_horizontal));bor.appendChild(this.createBorderElement('ctr_'+id,'borderbackground_03.png',0,bw+b_horizontal,bh,bw));bor.appendChild(this.createBorderElement('bl_'+id,'borderbackground_04.png',bh,0,b_vertical,bw));bor.appendChild(this.createBorderElement('br_'+id,'borderbackground_06.png',bh,bw+b_horizontal,b_vertical,bw));bor.appendChild(this.createBorderElement('cbl_'+id,'borderbackground_07.png',bh+b_vertical,0,bh,bw));bor.appendChild(this.createBorderElement('bb_'+id,'borderbackground_08.png',bh+b_vertical,bw,bh,b_horizontal));bor.appendChild(this.createBorderElement('cbr_'+id,'borderbackground_09.png',bh+b_vertical,bw+b_horizontal,bh,bw));return bor;}
ImageWidget.prototype.createBorderElement=function(id,src,t,l,h,w)
{var url='images/editor/widgets/image/borders/'+src;var div=document.createElement("div");div.id=id;div.style.position="absolute";div.style.top=t+"px";div.style.left=l+"px";div.style.height=h+"px";div.style.width=w+"px";div.style.overflow='hidden';if(dhtmlapi.isIE==true&&dhtmlapi.version<7)
{div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='scale')";}
else{div.style.backgroundImage="url("+url+")";}
return div;}
ImageWidget.prototype.adjustBorder=function(h,w)
{var bw=this._borderWidth;var bh=this._borderHeight;var border=this.getBorderElement();border.style.height=(h+(2*bh))+"px";border.style.width=(w+(2*bw))+"px";for(var elem=border.firstChild;elem!=null;elem=elem.nextSibling){if(elem.nodeType!=1)
continue;var id=elem.id.split("_")[0];switch(id){case"ctl":break;case"bt":elem.style.width=parseInt(w)+"px";break;case"ctr":elem.style.left=parseInt(bw+w)+"px";break;case"bl":elem.style.height=parseInt(h)+"px";break;case"br":elem.style.height=parseInt(h)+"px";elem.style.left=parseInt(bw+w)+"px";break;case"cbl":elem.style.top=parseInt(bh+h)+"px";break;case"bb":elem.style.width=parseInt(w)+"px";elem.style.top=parseInt(bh+h)+"px";break;case"cbr":elem.style.top=parseInt(bh+h)+"px";elem.style.left=parseInt(bw+w)+"px";break;default:break;}}}
ImageWidget.prototype.getBorderElement=function()
{var nl=this._html.getElementsByTagName("div");for(var i=0;i<nl.length;i++){var elem=nl[i];if(elem.nodeType==1&&elem.id.indexOf("borderimg")!=-1)
return elem;}
return null;}
ImageWidget.prototype.getImageElement=function()
{return this._html.firstChild;}
ImageWidget.prototype.createImageToolbar=function(mode)
{var container=null;if(mode!=Editor.READ_ONLY)
return;if(ImageWidget.toolbarElement==null){container=this.createImageToolbarRO();ImageWidget.toolbarMode=mode;}
else{ImageWidget.toolbar.unregisterCallback();if(ImageWidget.toolbarMode==Editor.READ_ONLY&&mode==Editor.READ_ONLY){this._html.appendChild(ImageWidget.toolbarElement);}
else if(ImageWidget.toolbarMode==Editor.READ_ONLY&&mode==Editor.READ_WRITE){;}
else{this._html.appendChild(ImageWidget.toolbarElement);}}
ImageWidget.toolbar.registerCallback(this);ImageWidget.toolbarElement.style.visibility="visible";return container;}
ImageWidget.prototype.createImageToolbarRO=function()
{var container=document.createElement("div");container.id="imageToolbarRO";container.className="imageToolbar";container.style.position="absolute";container.style.overflow="hidden";container.style.left=15;container.style.top=0;container.style.backgroundColor="white";container.style.width="40px";container.style.display="";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.zIndex=ZIndex.IMAGE_TOOLBAR;this._html.appendChild(container);var tb=new Toolbar("imageToolbar",container,20,80);var b=null;b=Button.createImage("zoom",Button.BUTTON,"zoom","images/editor/widgets/zoom.png",16,16,"Display Full Image");tb.add(b);b=Button.createImage("download",Button.BUTTON,"download","images/editor/widgets/download.png",16,16,"Download file to disk.");tb.add(b);ImageWidget.toolbar=tb;ImageWidget.toolbarElement=container;return container;}
ImageWidget.prototype.removeImageToolbar=function()
{if(ImageWidget.toolbarElement!=null){this._html.removeChild(ImageWidget.toolbarElement);ImageWidget.toolbarElement.style.visibility="hidden";}}
ImageWidget.prototype.isBorder=function()
{return(this._borderName==null)?false:true;}
ImageWidget.prototype.setBorder=function(name,h,w)
{this._borderName=name;this._borderHeight=h;this._borderWidth=w;}
ImageWidget.prototype.setRatio=function(ratio)
{this._ratio=ratio;}
ImageWidget.prototype.setLogicalName=function(url,name)
{this._title=name;}
ImageWidget.prototype.getLogicalName=function()
{return this._title;}
ImageWidget.prototype.getWidgetProperty=function(name)
{if(name=="archive")
return this._urlArchive;else if(name=="master")
return this._urlMaster;return null;}
ImageWidget.prototype.setWidgetProperty=function(name,value)
{if(name=="archive")
this._urlArchive=value;else if(name=="master")
this._urlMaster=value;return null;}
ImageWidget.prototype.toolbarCB=function(toolbarName,state,operation,value)
{var idx=0;var src=this._urlMaster;var prefs=this._canvas.getPreferences();var host=prefs.getPreferenceValue("editor.storage.host");var storageLoc=prefs.getPreferenceValue("editor.storage.location");var imageLoc=prefs.getPreferenceValue("editor.widgets.image.location");if(src.indexOf("file:/")==-1)
{src=storageLoc+src;if(host=="master"){idx=location.pathname.lastIndexOf("/");var servletPath=location.pathname.slice(0,idx);src=location.protocol+"//"+location.host+servletPath+"/"+src;}}
if(operation=="imageEdit"){src=encodeURIComponent(src);var url="imageEditor.jsp?id="+this._id+"&image="+src;var params="height=620,width=820,resizable";var win=window.open(url,"imageEditorWindow",params);}
else if(operation=="rotatecw"||operation=="rotateccw"){var child=this.getImageElement();var border=this.getBorderElement();var rotation="clockwise";if(operation=="rotateccw")
rotation="counterclockwise";var localfileIndicator=this._urlMaster.indexOf("file:");if(this._canvas.isJavaEnabled()&&this._canvas.isJavaActive()&&(localfileIndicator!=-1)){var imageMgr=document.getElementById("imageMgr");var newFilename=null;var newurls=String(imageMgr.rotate(src,rotation));this.setExternalUpload(Widget.EXUPLOAD_MASTER);var i=newurls.indexOf(",");var masImg=Persistence.decode(newurls.substring(0,i));masImg=masImg.replace(/;/g,"%3B");var optImg=Persistence.decode(newurls.substring(i+1,newurls.length));optImg=optImg.replace(/;/g,"%3B");this.handleRotate(masImg,optImg);}
else{this._canvas.rotateNoJava(this,this._urlMaster,rotation);}}
else if(operation=="zoom"){this._canvas._viewer.show(this._viewerID);}
else if(operation=="download"){idx=this._urlArchive.lastIndexOf("/");var newsrc=storageLoc+imageLoc+"/"+this._urlArchive.substr(idx+1);var archive=newsrc+"?download=true";window.location=archive;}
else if(operation=="border"){var container=this._html;var child=this.getImageElement();if(!this.isBorder()){this.setBorder("default",15,15);this._height+=(2*this._borderHeight);this._width+=(2*this._borderWidth);container.style.height=this._height+'px';container.style.width=this._width+'px';child.style.top=this._borderHeight+'px';child.style.left=this._borderWidth+'px';container.appendChild(this.createBorder(this._height,this._width));}
else{this._height-=(2*this._borderHeight);this._width-=(2*this._borderWidth);container.style.height=this._height+'px';container.style.width=this._width+'px';this.removeBorder(border);this.setBorder(null,0,0);child.style.top="0px";child.style.left="0px";}}
else
this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
ImageWidget.prototype.handleNoJavaRotate=function(url,urlmaster)
{var idx=url.lastIndexOf("/");var part1=url.substring(0,idx);var part2=url.substring(idx+1);part2=encodeURIComponent(part2);url=part1+"/"+part2;idx=urlmaster.lastIndexOf("/");part1=urlmaster.substring(0,idx);part2=urlmaster.substring(idx+1);part2=encodeURIComponent(part2);urlmaster=part1+"/"+part2;this._url=url;this._urlMaster=urlmaster;this.handleRotate(this._urlMaster,this._url);}
ImageWidget.prototype.handleRotate=function(urlMaster,urlOptimized)
{this._urlMaster=urlMaster;this._url=urlOptimized;var idx=this._url.lastIndexOf("/");var prefs=this._canvas.getPreferences();var storageLoc=prefs.getPreferenceValue("editor.storage.location");var imageLoc=prefs.getPreferenceValue("editor.widgets.image.location");var newsrc=storageLoc+imageLoc+"/"+this._url.substr(idx+1);img=this._html.firstChild;var x=this._imageWidth;this._imageWidth=this._imageHeight;this._imageHeight=x;x=this._width;this._width=this._height;this._height=x;this._ratio=1/this._ratio;this._html.style.width=this._width+"px";this._html.style.height=this._height+"px";img.src="";if(newsrc.indexOf("file:")==-1)
img.src=newsrc+"?"+Math.floor(Math.random()*1001);else
img.src=newsrc;img.style.width=this._imageWidth+"px";img.style.height=this._imageHeight+"px";this.markChanged(Widget.ACTION_EDIT,0);this.markFlashUpload(false);if(this.isBorder()){this.removeBorder();this._html.appendChild(this.createBorder(this._height,this._width));}
this._parent.unselect.call(this);this._parent.select.call(this,this._canvas.getContainer());}
ImageWidget.prototype.refresh=function()
{var idx=this._url.lastIndexOf("/");var prefs=this._canvas.getPreferences();var storageLoc=prefs.getPreferenceValue("editor.storage.location");var imageLoc=prefs.getPreferenceValue("editor.widgets.image.location");var newsrc=storageLoc+imageLoc+"/"+this._url.substr(idx+1);var imgt=this._html.firstChild;imgt.src=newsrc+"?"+Math.floor(Math.random()*1001);}
ImageWidget.prototype.activateJava=function()
{}
LinkWidget.prototype._url;LinkWidget.prototype._element;LinkWidget.prototype._displayName;LinkWidget.prototype._title;LinkWidget.prototype._editmode;LinkWidget.prototype._remoteFile;function LinkWidget(mimeType,id,height,width,zindex,canvas,url,top,left)
{var mt=(mimeType!=null)?mimeType:"text/href";this._parent.initialize.call(this,mt,id,height,width,zindex,canvas);this._url=url;this._top=(top!=null)?parseInt(top):0;this._left=(left!=null)?parseInt(left):0;this._width=(width!=null)?parseInt(width):0;this._height=(height!=null)?parseInt(height):0;this._displayName=util.urlToString(MimeTypes.getName(url));this._element=null;this._title=util.titleFromUrl(url);this._editmode=false;this._remoteFile=false;this.setProperty('fontFamily',canvas.getPreferences().getPreferenceValue("editor.textFont","Century Gothic"));this.setProperty('fontSize',canvas.getPreferences().getPreferenceValue("editor.textSize","18px"));this.setProperty('fontStyle',canvas.getPreferences().getPreferenceValue("editor.textStyle","normal"));this.setProperty('fontWeight',canvas.getPreferences().getPreferenceValue("editor.textWeight","normal"));this.setProperty('textDecoration',canvas.getPreferences().getPreferenceValue("editor.textDecoration","none"));}
LinkWidget.inheritsFrom(Widget);Editor.registerMimeType("application","*",LinkWidget);Editor.registerMimeType("text","plain",LinkWidget);Editor.registerMimeType("text","href",LinkWidget);Editor.registerMimeType("video","*",LinkWidget);Editor.registerMimeType("audio","*",LinkWidget);LinkWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,url,top,left)
{return new LinkWidget(mimeType,id,height,width,zindex,canvas,url);}
LinkWidget.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var url=xmlutils.getChildNode(elem,"url");var displayName=xmlutils.getChildNode(elem,"displayName");var title=xmlutils.getChildNode(elem,"title");var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var mimetype=elem.getAttribute("mimeType");var style=xmlutils.getChildNode(elem,"style");var left=location.getAttribute("left");var top=location.getAttribute("top");var width=dimensions.getAttribute("width");var height=dimensions.getAttribute("height");var props=xmlutils.getChildNode(elem,"properties");left=left.substring(0,left.length-2);top=top.substring(0,top.length-2);var obj=LinkWidget.createInstance(mimeType,id,height,width,zindex,canvas,xmlutils.getNodeText(url),top,left);obj.setProperties(props);if(displayName!=null)
obj._displayName=xmlutils.getNodeText(displayName);if(title!=null)
obj._title=xmlutils.getNodeText(title);obj._remoteFile=(obj._url.length>=7)&&(obj._url.substring(0,7).toLowerCase()=="images/");obj.toHtml();obj.moveTo(left,top);return obj;}
LinkWidget.prototype.getExternalResource=function()
{if(this._url.search(/http/i)!=-1)
return null;var ext_res={"id":this._id,"url":this._url,"urlmaster":this._url,"urlarchive":this._url,"external":this._externalUpload,"title":this._title,"width":0,"height":0};return ext_res;}
LinkWidget.prototype.isExternalResource=function()
{return true;}
LinkWidget.prototype.launch=function()
{var htmlText=this.getContents();var height=dhtmlapi.getObjectHeight(this._html);var width=dhtmlapi.getObjectWidth(this._html);this._canvas.unSelectWidget(this);this._canvas._element.removeChild(this._html);this.createEditor(height,width,htmlText);this._editmode=true;}
LinkWidget.prototype.createEditor=function(h,w)
{var i;var sel=false;var prop=null;var d=document.createElement("div");d.id=this._id;d.className="draggable";d.style.position="absolute";d.style.top=this._top+"px";d.style.left=this._left+"px";d.style.display="";d.style.padding='4px';d.style.backgroundColor="lightgrey";d.style.zIndex=50000;var obj=document.createElement("select");obj.className='smallText';obj.name='fontFamily';obj.options.length=0;if(dhtmlapi.isIE!=true){obj.addEventListener("mousedown",LinkWidget.handleMouseMove,false);obj.addEventListener("mouseup",LinkWidget.handleMouseMove,false);}
d.appendChild(obj);var opts=[{name:'Arial',value:'Arial'},{name:'Century Gothic',value:'Century Gothic'},{name:'Comic Sans',value:'Comic Sans MS'},{name:'Georgia',value:'Georgia'},{name:'Times Roman',value:'Times New Roman'},{name:'Trebuchet',value:'Trebuchet'},{name:'Verdana',value:'Verdana'}];prop=this.getProperty('fontFamily');sel=0;for(i=0;i<opts.length;i++){if(prop==opts[i].value)
sel=i;obj.options[i]=new Option(opts[i].name,opts[i].value,false,false);}
obj.options[sel].selected=true;obj=document.createElement('span');obj.className='smallText';obj.innerHTML='&nbsp;&nbsp;';d.appendChild(obj);obj=document.createElement("select");obj.className='smallText';obj.name='fontSize';obj.options.length=0;if(dhtmlapi.isIE!=true){obj.addEventListener("mousedown",LinkWidget.handleMouseMove,false);obj.addEventListener("mouseup",LinkWidget.handleMouseMove,false);}
d.appendChild(obj);opts=[{name:'9',value:'9px'},{name:'10',value:'10px'},{name:'12',value:'12px'},{name:'14',value:'14px'},{name:'16',value:'16px'},{name:'18',value:'18px'},{name:'24',value:'24px'},{name:'32',value:'32px'},{name:'48',value:'48px'}];prop=this.getProperty('fontSize');sel=0;for(i=0;i<opts.length;i++){if(prop==opts[i].value)
sel=i;obj.options[i]=new Option(opts[i].name,opts[i].value,false,false);}
obj.options[sel].selected=true;obj=document.createElement('span');obj.className='smallText';obj.innerHTML='&nbsp;&nbsp;';d.appendChild(obj);obj=document.createElement('input');obj.className='smallText';obj.name='fontWeight';obj.type='checkbox';obj.value='bold';if(this.getProperty('fontWeight')=='bold'){obj.defaultChecked=true;obj.checked=true;}
d.appendChild(obj);obj=document.createElement('span');obj.className='smallText';obj.innerHTML='Bold&nbsp;&nbsp;';d.appendChild(obj);obj=document.createElement('input');obj.className='smallText';obj.name='fontStyle';obj.type='checkbox';obj.value='italic';if(this.getProperty('fontStyle')=='italic'){obj.defaultChecked=true;obj.checked=true;}
d.appendChild(obj);obj=document.createElement('span');obj.className='smallText';obj.innerHTML='Italic';d.appendChild(obj);d.appendChild(document.createElement('br'));obj=document.createElement('input');obj.className='normalText';obj.name='linkText';obj.type='text';obj.value=(this._displayName!=null)?this._displayName:this._url;obj.size=40;obj.maxLength=100;if(dhtmlapi.isIE==true){obj.onmousedown=LinkWidget.handleMouseMove;obj.onmousemove=LinkWidget.handleMouseMove;obj.onkeyup=LinkWidget.handleMouseMove;}
else{obj.addEventListener("mousedown",LinkWidget.handleMouseMove,false);obj.addEventListener("mousemove",LinkWidget.handleMouseMove,false);obj.addEventListener("keyup",LinkWidget.handleMouseMove,false);}
d.appendChild(obj);d.appendChild(document.createElement('br'));obj=document.createElement('span');obj.className='smallText';obj.innerHTML='(original link: '+this._title+')';d.appendChild(obj);d.appendChild(document.createElement('br'));d.appendChild(document.createElement('br'));obj=document.createElement('span');obj.className='normalText';obj.innerHTML='Close';obj.style.cursor='pointer';obj.style.textDecoration='underline';obj.onclick=LinkWidget.handleClose;d.appendChild(obj);this._canvas._element.appendChild(d);this._html=d;Widget.addToCache(this._id,this);}
LinkWidget.handleMouseMove=function(e)
{var evt=EventUtils.getEvent(e);EventUtils.stopPropagation(evt);}
LinkWidget.handleClose=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);while(target.className!='draggable'&&target!=null){target=target.parentNode;}
var lw=Widget.removeFromCache(target.id);var fontFamily=null;var fontSize=null;var decoration=null;var text=null;for(var child=target.firstChild;child!=null;child=child.nextSibling){switch(child.name){case'fontFamily':value=child.options[child.selectedIndex].value;lw.setProperty('fontFamily',value);break;case'fontSize':value=child.options[child.selectedIndex].value;lw.setProperty('fontSize',value);break;case'fontWeight':lw.setProperty('fontWeight',(child.checked==true)?"bold":"normal");break;case'fontStyle':lw.setProperty('fontStyle',(child.checked==true)?"italic":"normal");break;case'linkText':lw._displayName=child.value;break;default:break;}}
lw._canvas.unSelectWidget(lw);lw._canvas._element.removeChild(lw._html);lw._editmode=false;lw.toHtml();lw.moveTo(lw._left,lw._top);}
LinkWidget.prototype.resizeBy=function(whichCorner,deltaX,deltaY)
{if(deltaX==0&&deltaY==0||this._editmode==true)
return;var container=this._html;var child=this._html.firstChild;var new_height=this._height+deltaY;var new_width=this._width+deltaX;child.style.height=new_height+"px";child.style.width=new_width+"px";container.style.height=new_height+"px";container.style.width=new_width+"px";this._height=new_height;this._width=new_width;this.resizeBars();}
LinkWidget.prototype.select=function(parent)
{this._parent.select.call(this,parent);}
LinkWidget.prototype.rollover=function()
{this._parent.rollover.call(this);}
LinkWidget.prototype.rollout=function()
{this._parent.rollout.call(this);}
LinkWidget.prototype.setLogicalName=function(url,name)
{this._title=name;var idx=url.lastIndexOf(".");var suffix=(idx>=0)?url.substr(idx):"";this._displayName=name+suffix;if(this._element!=null)
this._element.innerHTML=this._displayName;}
LinkWidget.prototype.getLogicalName=function()
{return this._title;}
LinkWidget.prototype.toHtml=function()
{var container=document.createElement("div");var a=document.createElement("a");var s=document.createElement("span");container.id=this._id;container.className="draggable";container.style.position="absolute";container.style.left=0+"px";container.style.top=0+"px";container.style.overflow="visible";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.zIndex=this.getZIndex();container.setAttribute("mimeType",this._mimeType);var d=document.createElement('div');var prefs=this._canvas.getPreferences();var storageLoc=prefs.getPreferenceValue("editor.storage.location");var imageLoc=prefs.getPreferenceValue("editor.widgets.image.location");a.id=this._id;a.name=this._id;if(this._remoteFile){var idx=this._url.lastIndexOf("/");a.href=storageLoc+imageLoc+"/"+this._url.substr(idx+1)+"?download=true";}else{a.href=this._url}
a.target="_blank";a.style.borderStyle="none";a.style.borderColor="black";a.style.borderWidth="1px";a.style.padding="3px";if(this._displayName.length!=0)
s.innerHTML=this._displayName;else
s.innerHTML=this._url;s.style.fontFamily=this.getProperty('fontFamily');s.style.fontSize=this.getProperty('fontSize');s.style.fontWeight=this.getProperty('fontWeight');s.style.fontStyle=this.getProperty('fontStyle');s.style.textDecoration='underline';a.appendChild(s);d.appendChild(a);container.appendChild(d);this._element=s;this._html=container;this._canvas._element.appendChild(this._html);this._width=dhtmlapi.getObjectWidth(d);this._height=dhtmlapi.getObjectHeight(d);}
LinkWidget.prototype.toXML=function()
{var elem=this._parent.toXml.call(this);var url=xmlutils.dom.createElement("url");xmlutils.setNodeText(url,this._url);elem.appendChild(url);if(this._displayName!=null){var dn=xmlutils.dom.createElement("displayName");xmlutils.setNodeText(dn,this._displayName);elem.appendChild(dn);}
if(this._title!=null){var dn=xmlutils.dom.createElement("title");xmlutils.setNodeText(dn,this._title);elem.appendChild(dn);}
return elem;}
LinkWidget.prototype.unselect=function(mode)
{this._parent.unselect.call(this);}
LinkWidget.prototype.toolbarCB=function(toolbarName,state,operation,value,x,y)
{var v=(value==null)?'':value;var logicalX=x+document.body.scrollLeft;var logicalY=y+document.body.scrollTop;if(operation=="textEdit"){if(this._editmode!=true)
this.launch();}
else
this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
LinkWidget.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);var b=null;b=Button.createImage("edit",Button.BUTTON,"textEdit","images/editor/widgets/edit.png",16,16,"Edit");tb.add(b);return tb;}
RichText.TOOLBAR_HEIGHT=parseInt(20);RichText.TOOLBAR_WIDTH=parseInt(160);RichText.CLOSE_BUTTON_HEIGHT=parseInt(25);RichText.MINIMUM_EDITOR_HEIGHT=parseInt(40);RichText.MINIMUM_EDITOR_WIDTH=parseInt(RichText.TOOLBAR_WIDTH)+
parseInt(15);RichText.MINIMUM_TOTAL_HEIGHT=parseInt(RichText.TOOLBAR_HEIGHT)+
parseInt(RichText.CLOSE_BUTTON_HEIGHT)+
parseInt(RichText.MINIMUM_EDITOR_HEIGHT);RichText.MINIMUM_TOTAL_WIDTH=parseInt(RichText.MINIMUM_EDITOR_WIDTH)+
parseInt(20);RichText.prototype._editmode;RichText.prototype._text;RichText.prototype._range;RichText.prototype._toolbar;RichText.prototype._container;RichText.prototype._closeButton;RichText.prototype._resizeHandler;RichText.prototype._targetElement;RichText.prototype._iframeElement;RichText.prototype._contentDocument;RichText.prototype._contentWindow;RichText.prototype._fontPalette;RichText.prototype._fontSize;RichText.prototype._colorPalette;RichText.prototype._linkPalette;RichText.prototype._resized;RichText.prototype._isNew;function RichText(mimeType,id,height,width,zindex,canvas,richText,top,left)
{this._parent.initialize.call(this,mimeType,id,height,width,zindex,canvas);this._text=richText;this._editmode=(richText==null)?true:false;this._top=(top!=null)?parseInt(top):0;this._left=(left!=null)?parseInt(left):0;this._width=(width!=null)?parseInt(width):0;this._height=(height!=null)?parseInt(height):0;this._container=null;this._range=null;this._toolbar=null;this._fontPalette=null;this._fontSize=null;this._colorPalette=null;this._linkPalette=null;this._resized=false;this._isNew=true;this.setProperty('fontFamily',canvas.getPreferences().getPreferenceValue("editor.textFont","Arial"));this.setProperty('fontSize',canvas.getPreferences().getPreferenceValue("editor.textSize","14px"));this.setProperty('backgroundColor',canvas.getPreferences().getPreferenceValue("editor.backgroundColor","nocolor"));}
RichText.inheritsFrom(Widget);Editor.registerMimeType("text","html",RichText);RichText.createInstance=function(mimeType,id,height,width,zindex,canvas,richText,top,left)
{return new RichText(mimeType,id,height,width,zindex,canvas,richText,top,left);}
RichText.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var textNode=xmlutils.getChildNode(elem,"text");var text=xmlutils.getNodeText(textNode);var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var props=xmlutils.getChildNode(elem,"properties");var left=location.getAttribute("left");var top=location.getAttribute("top");left=left.substring(0,left.length-2);top=top.substring(0,top.length-2);var width=dimensions.getAttribute("width");var height=dimensions.getAttribute("height");var rt=RichText.createInstance(mimeType,id,height,width,zindex,canvas,text,top,left);rt.setProperties(props);rt.toHtml();return rt;}
RichText.handleClose=function(e)
{var evt=EventUtils.getEvent(e);var target=EventUtils.getTargetElement(evt);while(target.className!='draggable'&&target!=null){target=target.parentNode;}
var rte=Widget.removeFromCache(target.id);var oldStr=rte._text;rte._text=rte.getEditorContents();if(rte._text!=null){if(rte._text.indexOf('<p>')==0||rte._text.indexOf('<P>')==0){var regex=/<[pP]>/;var str=rte._text.replace(regex,"");regex=/<\/[pP]>/;rte._text=str.replace(regex,"<br>");}
regex=/[\r\n]/g;rte._text=rte._text.replace(regex,"");if(rte._text.length>=13){var comp=rte._text.substr(rte._text.length-13);if(comp.toLowerCase()=="<p>&nbsp;</p>")
rte._text=rte._text.substring(0,rte._text.length-13);}
if(rte._text.length>=8){comp=rte._text.substr(rte._text.length-8);if(comp.toLowerCase()=="<br><br>")
rte._text=rte._text.substring(0,rte._text.length-8);}
if(dhtmlapi.isIE==false&&rte._isNew==true){var ff=rte._properties.fontFamily;rte._text='<span style="font-family:'+ff+',Century Gothic;">'+rte._text+'</span>';}}
rte._canvas._element.removeChild(rte._html);rte._editmode=false;if(rte._text==null){rte._html=null;rte._canvas.deleteObjectX(rte);}
else{if(rte._text!=oldStr)
rte.markChanged(Widget.ACTION_EDIT,0);rte.deleteBars();var oldheight=dhtmlapi.getObjectHeight(rte._container)-RichText.TOOLBAR_HEIGHT-RichText.CLOSE_BUTTON_HEIGHT;var oldwidth=dhtmlapi.getObjectWidth(rte._container)-20;if(dhtmlapi.isSafari)
oldheight+=5;rte._container.style.height=oldheight+"px";rte._container.style.width=oldwidth+"px";rte.toHtml();}}
RichText.handleMouseClick=function(e)
{var rte=RichText.getRTE();if(rte!=null)
rte.handleNodeChange();}
RichText.handleDragStart=function(e)
{if(e!=null){e.cancelBubble=true;return false;}
var rte=RichText.getRTE();if(rte!=null){var evt=rte._targetElement.event;evt.cancelBubble=true;}
return false;}
RichText.getRTE=function()
{var evt;for(var i=0;i<window.frames.length;i++)
{evt=window.frames[i].event;if(evt!=null&&evt.type=='click'){var frame_id=window.frames[i].frameElement.id;var id=frame_id.substr(frame_id.indexOf('_')+1);return Widget.getFromCache(id);}}
return null;}
RichText.prototype.getContents=function()
{return this._text;}
RichText.prototype.launch=function()
{var htmlText=this.getContents();var height=dhtmlapi.getObjectHeight(this._html);var width=dhtmlapi.getObjectWidth(this._html);this._canvas.unSelectWidget(this);this._canvas._element.removeChild(this._html);this.createRichTextEditor(height,width,htmlText);this._editmode=true;}
RichText.prototype.moveBy=function(deltaX,deltaY)
{if(this._editmode!=true){this._parent.moveBy.call(this,deltaX,deltaY);return;}}
RichText.prototype.resizeBy=function(location,deltaX,deltaY)
{this._resized=true;if(this._editmode!=true){this._parent.resizeBy.call(this,location,deltaX,deltaY);return;}
var container_height=dhtmlapi.getObjectHeight(this._container)+deltaY;var container_width=dhtmlapi.getObjectWidth(this._container)+deltaX;var adjustment=8;if(deltaX!=0)
{if(container_width>RichText.MINIMUM_TOTAL_WIDTH){var width=dhtmlapi.getObjectWidth(this._iframeElement);this._container.style.width=(container_width-adjustment)+"px";this._iframeElement.style.width=width+deltaX+"px";var l=dhtmlapi.getObjectLeft(this._resizeHandler);this._resizeHandler.style.left=l+deltaX+"px";this._width=container_width;}
else{;}}
if(deltaY!=0)
{if(container_height>RichText.MINIMUM_TOTAL_HEIGHT){var height=dhtmlapi.getObjectHeight(this._iframeElement);this._container.style.height=(container_height-adjustment)+"px";this._iframeElement.style.height=height+deltaY+"px";var t=dhtmlapi.getObjectTop(this._resizeHandler);this._resizeHandler.style.top=t+deltaY+"px";t=dhtmlapi.getObjectTop(this._closeButton);this._closeButton.style.top=t+deltaY+"px";this._height=container_height;}
else{;}}}
RichText.prototype.select=function(parent)
{if(this._editmode!=true)
this._parent.select.call(this,parent);}
RichText.prototype.rollover=function()
{this._parent.rollover.call(this);}
RichText.prototype.rollout=function()
{this._parent.rollout.call(this);}
RichText.prototype.toHtml=function()
{if(this._editmode==true)
this.createRichTextEditor(100);else{var dim=new Object();dim.top=(this._top!=-1)?this._top:dhtmlapi.getObjectTop(this._container);dim.left=(this._left!=-1)?this._left:dhtmlapi.getObjectLeft(this._container);dim.width=(this._width!=-1)?this._width:dhtmlapi.getObjectWidth(this._container);dim.height=(this._height!=-1)?this._height:dhtmlapi.getObjectHeight(this._container);var data=this.getContents();if(this._resized==false){var height=StaticTextWidget.estimateTextSize(dim,this._properties,data);if((this._html!=null)||(height>dim.height))
dim.height=height;}
this._html=StaticTextWidget.createStaticText(this._id,this._zindex,dim,this._properties,data);this._canvas._element.appendChild(this._html);this._height=dim.height;this._width=dim.width;}}
RichText.prototype.toXML=function()
{var contents=this.getContents();if(contents==null){contents=this.getEditorContents();if(contents==null){return null;}}
var elem=this._parent.toXml.call(this);var text=xmlutils.dom.createElement("text");var xmlstr=xmlutils.encodeUTF(contents);xmlutils.setNodeText(text,xmlstr);elem.appendChild(text);return elem;}
RichText.prototype.unselect=function(mode)
{try{if(this._editmode!=true)
this._parent.unselect.call(this);}catch(e){;}}
RichText.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);var b=null;b=Button.createImage("edit_"+this._id,Button.BUTTON,"textEdit","images/editor/widgets/edit.png",16,16,"Edit");tb.add(b);return tb;}
RichText.prototype.getEditorContents=function()
{var doc=this._contentDocument;var html=doc.body.innerHTML;if(html.toUpperCase()=="<P></P>"||html=="")
{return null;}
else{if(dhtmlapi.isIE!=true){var re=/<i>/i;var str=html.replace(re,'<em>');re=/<\/i>/i;str=str.replace(re,'</em>');re=/<b>/i;str=str.replace(re,'<strong>');re=/<\/b>/i;str=str.replace(re,'</strong>');return str;}
else
return html;}}
RichText.prototype.getEditorBackground=function()
{var doc=this._contentDocument;return doc.body.style.backgroundColor;}
RichText.prototype.setDimensions=function(top,left,height,width)
{this._container.style.top=top+"px";this._container.style.left=left+"px";if(height<RichText.MINIMUM_EDITOR_HEIGHT)
height=RichText.MINIMUM_EDITOR_HEIGHT;if(width<RichText.MINIMUM_EDITOR_WIDTH)
width=RichText.MINIMUM_EDITOR_WIDTH;this._container.style.height=(height+RichText.TOOLBAR_HEIGHT+RichText.CLOSE_BUTTON_HEIGHT)+"px";this._container.style.width=(width+20)+"px";this._iframeElement.style.width=width+"px";this._iframeElement.style.height=height+"px";this._closeButton.style.top=(height+RichText.TOOLBAR_HEIGHT)+"px";this._resizeHandler.style.top=(height+RichText.TOOLBAR_HEIGHT)+"px";this._resizeHandler.style.left=width+"px";}
RichText.prototype.createRichTextEditor=function(h,w,htmlText)
{var width=RichText.MINIMUM_EDITOR_WIDTH;var height=RichText.MINIMUM_EDITOR_HEIGHT;var adjustment=8;if(h!=null&&h>RichText.MINIMUM_EDITOR_HEIGHT)
height=h;if(w!=null&&w>RichText.MINIMUM_EDITOR_WIDTH)
width=w;var d=document.createElement("div");d.id=this._id;d.className="draggable";d.style.position="absolute";d.style.top=this._top+"px";d.style.left=this._left+"px";d.style.height=(height+RichText.TOOLBAR_HEIGHT+RichText.CLOSE_BUTTON_HEIGHT)+"px";d.style.width=(width+20)+"px";d.style.display="";d.style.border="ridge lightgrey 4px";d.style.backgroundColor="lightgrey";d.style.zIndex=ZIndex.TEXT_EDIT;this._canvas._element.appendChild(d);this.createToolbar(d);var i=document.createElement("iframe");i.id="iframe_"+this._id;i.className="richTextEditor";i.name="rte"+this._id;i.src="rte.htm?"+this._id+"&"+this.getProperty('fontFamily')+"&"+this.getProperty('fontSize');i.style.top=RichText.TOOLBAR_HEIGHT+"px";i.style.left="0px";i.frameborder=0;i.style.position="absolute";i.style.height=height+"px";i.style.width=(width+10+adjustment)+"px";i.style.marginHeight="0px";i.style.marginWidth="0px";i.style.display="";i.style.border="solid black 0px";d.appendChild(i);var s=document.createElement("span");s.className='normalText';s.style.position="absolute";s.style.top=(height+RichText.TOOLBAR_HEIGHT)+adjustment+"px";s.style.left="0px";s.style.height=RichText.CLOSE_BUTTON_HEIGHT+"px";s.style.fontSize="10pt";s.style.textDecoration="underline";s.style.cursor="pointer";s.innerHTML="save";s.onclick=RichText.handleClose;d.appendChild(s);var r=document.createElement("div");r.id="bottomright_"+this._id;r.className="resizer";r.style.position="absolute";r.style.top=(height+RichText.TOOLBAR_HEIGHT)+adjustment+"px";r.style.left=(width-4)+adjustment+"px";r.style.height="16px";r.style.width="16px";r.style.overflow='hidden';r.style.cursor="se-resize";r.style.backgroundImage="url("+Widget.ICON_RESIZE_HANDLE+")";r.ondragstart=RichText.handleDragStart;if(dhtmlapi.isIE!=true){r.addEventListener('dragenter',RichText.handleDragStart,true);r.addEventListener('dragover',RichText.handleDragStart,true);}
d.appendChild(r);this._targetElement=window.frames["iframe_"+this._id];this._iframeElement=i;this._container=d;this._resizeHandler=r;this._closeButton=s;this._html=this._container;Widget.addToCache(this._id,this);}
RichText.loaded=function(id)
{var rte=Widget.getFromCache(id);rte.initialize();}
RichText.prototype.createToolbar=function(parent)
{var d=document.createElement("div");var toolbarId="rteToolbar_"+this._id;d.id=toolbarId;d.className="rteToolbar";d.style.position="absolute";d.style.overflow="hidden";d.style.left="0px";d.style.top="0px";d.style.width="93%";d.style.height="20px";d.style.display="";d.style.borderStyle="none";d.style.borderColor="black";d.style.borderWidth="0px";d.style.zIndex="0";parent.appendChild(d);var b=null;var tb=new Toolbar(toolbarId,d,20,180);tb.setPadding(0);tb.setSpacing(0);tb.setHighlight(false);b=Button.createImage("bold",Button.TOGGLE_BUTTON,"bold","images/editor/widgets/rte/richtext_01.gif",19,20,"Bold");b.setPressedImage("images/editor/widgets/rte/richtextpressed_01.gif");tb.add(b);b=Button.createImage("italic",Button.TOGGLE_BUTTON,"italic","images/editor/widgets/rte/richtext_02.gif",19,20,"Italic");b.setPressedImage("images/editor/widgets/rte/richtextpressed_02.gif");tb.add(b);b=Button.createImage("underline",Button.TOGGLE_BUTTON,"underline","images/editor/widgets/rte/richtext_03.gif",19,20,"Underline");b.setPressedImage("images/editor/widgets/rte/richtextpressed_03.gif");tb.add(b);b=Button.createImage("fontfamily",Button.BUTTON,"createFontPalette","images/editor/widgets/rte/richtext_04.gif",19,20,"Font Selection");b.setPressedImage("images/editor/widgets/rte/richtextpressed_04.gif");tb.add(b);b=Button.createImage("fontsize",Button.BUTTON,"createFontSize","images/editor/widgets/rte/richtext_05.gif",19,20,"Font Size");b.setPressedImage("images/editor/widgets/rte/richtextpressed_05.gif");tb.add(b);b=Button.createImage("textcolor",Button.BUTTON,"createForeColor","images/editor/widgets/rte/richtext_06.gif",19,20,"Text Color");b.setPressedImage("images/editor/widgets/rte/richtextpressed_06.gif");tb.add(b);b=Button.createImage("bgcolor",Button.BUTTON,"createBackColor","images/editor/widgets/rte/richtext_07.gif",19,20,"Background Color");b.setPressedImage("images/editor/widgets/rte/richtextpressed_07.gif");tb.add(b);b=Button.createImage("hyperlink",Button.BUTTON,"createHyperLink","images/editor/widgets/rte/richtext_08.gif",19,20,"Insert Link");b.setPressedImage("images/editor/widgets/rte/richtextpressed_08.gif");tb.add(b);tb.registerCallback(this);this._toolbar=tb;}
RichText.prototype.initialize=function()
{this._contentWindow=this._iframeElement.contentWindow;this._contentDocument=this._contentWindow.document;var htmlText=(this.getContents()==null)?"":this.getContents();this._isNew=(htmlText=="")?true:false;if(dhtmlapi.isIE)
this.initializeIE(htmlText);else
this.initializeGecko(htmlText);var bg=this.getProperty('backgroundColor');if(bg==null||bg==""||bg=='nocolor')
this._contentDocument.body.style.backgroundImage='url(images/editor/checkerboard.gif)';else
this._contentDocument.body.style.backgroundColor=bg;this._resizeText=true;}
RichText.prototype.initializeIE=function(htmlText)
{this._container.style.display="";this._container.style.zIndex=ZIndex.TEXT_EDIT;this._range=null;this._contentDocument.body.contentEditable=true;this._contentDocument.body.innerHTML=htmlText;this._contentWindow.focus();this._contentDocument.body.onclick=RichText.handleMouseClick;this._contentDocument.ondragstart=RichText.handleDragStart;}
RichText.tryAgain=function(id,htmlText)
{var rte=Widget.getFromCache(id);rte.initializeGecko(htmlText);}
RichText.prototype.initializeGecko=function(htmlText)
{var o=this._contentDocument;try{o.designMode='on';}catch(e){alert("exception: "+e+" while changing to designMode");setTimeout("RichText.tryAgain("+this._id+","+htmlText+")",25);}
this._container.style.display="";this._container.style.zIndex=ZIndex.TEXT_EDIT;this._range=null;var html='<html><head></head>'+'<body style="cursor:text;margin:4px;background-color:#FFFFFF;font-family:'+this._properties.fontFamily+';'+'font-size:'+this._properties.fontSize+';">';if(this._isNew==false){o.onclick=null;var re=/<em>/i;var str=htmlText.replace(re,'<i>');re=/<\/em>/i;str=str.replace(re,'</i>');re=/<strong>/i;str=str.replace(re,'<b>');re=/<\/strong>/i;str=str.replace(re,'</b>');html+=str;}
html+='</body></html>';o.open();o.write(html);o.close();this._contentWindow.focus();this._contentDocument.execCommand('styleWithCSS',false,false);this._contentDocument.execCommand('insertbronreturn',false,true);this._contentDocument.createRange();this._contentDocument.body.onclick=RichText.handleMouseClick;this._contentDocument.addEventListener('dragenter',RichText.handleDragStart,true);this._contentDocument.addEventListener('dragover',RichText.handleDragStart,true);}
RichText.prototype.toolbarCB=function(toolbarName,state,operation,value,x,y)
{var o=this._targetElement;var sel=null;var rng=null;var v=(value==null)?'':value;var scroll=dhtmlapi.getPageScroll();var logicalX=x+scroll.scrollX;var logicalY=y+scroll.scrollY;try{if(toolbarName!=null&&toolbarName.indexOf("rteToolbar")==-1){if(operation=="textEdit"){if(this._editmode!=true)
this.launch();}
else{this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}}
else{if(operation!='fontname'&&operation!='fontsize'&&operation!='forecolor'&&operation!='backcolor'&&operation!='hyperlink')
{if(this.resetPalettes()==true)
return;}
switch(operation){case'createFontPalette':this._fontPalette=FontPalette.createInstance(this,logicalX,logicalY);break;case'createFontSize':this._fontSize=SizePalette.createInstance(this,logicalX,logicalY);break;case'createForeColor':this._colorPalette=ColorPalette.createInstance(this,"forecolor",logicalX,logicalY);break;case'createBackColor':this._colorPalette=ColorPalette.createInstance(this,"backcolor",logicalX,logicalY);break;case'createHyperLink':this._linkPalette=LinkPalette.createInstance(this,logicalX,logicalY);break;case'backcolor':if(v=='nocolor'){this._contentDocument.body.style.backgroundColor='white';this._contentDocument.body.style.backgroundImage='url(images/editor/checkerboard.gif)';}
else{this._contentDocument.body.style.backgroundImage='none';this._contentDocument.body.style.backgroundColor=v;}
this.setProperty('backgroundColor',v);this.markChanged(Widget.ACTION_EDIT,0);break;case'fontname':case'fontsize':case'forecolor':rng=this.getRange();if(dhtmlapi.isIE)
rng.select();this._contentDocument.execCommand(operation,false,v);if(rng.text!=null&&rng.text.length!=0)
this.markChanged(Widget.ACTION_EDIT,0);break;case'hyperlink':if(state=="cancel")
return;var xyzzy='<a href="'+v[0]+'" target=_blank>'+v[1]+'</a>';this.setRangeText(xyzzy);break;default:sel=this._contentDocument.selection;if(sel!=null){rng=sel.createRange();if(rng.text!=null&&rng.text.length!=0)
this.markChanged(Widget.ACTION_EDIT,0);}
this._contentDocument.execCommand(operation,false,'');break;}}}catch(e){alert("Exception while trying to invoke editor command ["+operation+"]:"+e);}
finally{if(operation=="fontname"&&this._fontPalette!=null){this._fontPalette.destroy();delete this._fontPalette;this._fontPalette=null;}
else if(operation=="fontsize"&&this._fontSize!=null){this._fontSize.destroy();delete this._fontSize;this._fontSize=null;}
else if((operation=='forecolor'||operation=="backcolor")&&this._colorPalette!=null){this._colorPalette.destroy();delete this._colorPalette;this._colorPalette=null;}
else if(operation=="hyperlink"&&this._linkPalette!=null){this._linkPalette.destroy();delete this._linkPalette;this._linkPalette=null;}}}
RichText.prototype.resetPalettes=function()
{if(this._fontPalette!=null){this._fontPalette.destroy();delete this._fontPalette;this._fontPalette=null;return true;}
else if(this._fontSize!=null){this._fontSize.destroy();delete this._fontSize;this._fontSize=null;return true;}
else if(this._colorPalette!=null){this._colorPalette.destroy();delete this._colorPalette;this._colorPalette=null;return true;}
else if(this._linkPalette!=null){this._linkPalette.destroy();delete this._linkPalette;this._linkPalette=null;return true;}
return false;}
RichText.prototype.clearArea=function()
{var bdy=frames["fff"].document.body;var brange=bdy.createTextRange();brange.execCommand("Delete",false);if(brange.text!=null&&brange.text.length!=0)
this.markChanged(Widget.ACTION_EDIT,0);bdy.innerHTML="<p></p>";}
RichText.prototype.handleNodeChange=function()
{this._toolbar.clearButton("bold");this._toolbar.clearButton("italic");this._toolbar.clearButton("underline");var b=this._contentDocument.queryCommandState("Bold");var i=this._contentDocument.queryCommandState("Italic");var u=this._contentDocument.queryCommandState("Underline");if(b)
this._toolbar.setButton("bold");if(i)
this._toolbar.setButton("italic");if(u)
this._toolbar.setButton("underline");}
RichText.prototype.getRange=function()
{return this._range;}
RichText.prototype.getRangeText=function()
{return dhtmlapi.getRangeText(this._range);}
RichText.prototype.setRange=function()
{var oRTE;if(document.all){oRTE=this._targetElement;if(oRTE==null)
return;var selection=oRTE.document.selection;if(selection!=null)
this._range=selection.createRange();}
else{oRTE=this._contentWindow;var selection=oRTE.getSelection();this._range=selection.getRangeAt(selection.rangeCount-1).cloneRange();}}
RichText.prototype.setRangeText=function(val)
{var rng=this.getRange();this._contentWindow.focus();if(dhtmlapi.isIE){rng.pasteHTML(val);this.markChanged(Widget.ACTION_EDIT,0);rng.collapse(false);rng.select();}
else{this._contentDocument.execCommand('insertHTML',false,val);}}
ColorPalette.object=null;ColorPalette.prototype._iframe=null;ColorPalette.prototype._rte=null;ColorPalette.prototype._value=null;ColorPalette.prototype._operation=null;function ColorPalette()
{this._iframe=null;this._rte=null;this._value=null;this._operation=null;}
ColorPalette.createInstance=function(rte,operation,x,y)
{var cp=new ColorPalette();ColorPalette.object=cp;cp._rte=rte;cp._operation=operation;cp._rte.setRange();var options="left="+x+",top="+y+",width=154,height=104";var i=document.createElement("iframe");i.id="colorPalette";i.name="colorPalette";i.src="colorPalette.htm?operation="+operation;i.style.position="absolute";i.style.left=x+'px';i.style.top=y+'px';i.style.height="120px"
i.style.width="135px";i.style.marginHeight=0;i.style.marginWidth=0;i.style.display="";i.style.borderStyle="none";i.style.borderColor="black";i.style.borderWidth="0px";i.style.zIndex=ZIndex.TEXT_EDIT_PALETTE;document.body.appendChild(i);cp._iframe=i;i.onmouseout=ColorPalette.handleMouseOut;return cp;}
ColorPalette.handleMouseOut=function()
{var cp=ColorPalette.object;cp.destroy();cp._rte._colorPalette=null;}
ColorPalette.prototype.destroy=function()
{try{this._iframe.style.display="none";var sp=document.getElementById("colorPalette");if(sp!=null)
document.body.removeChild(sp);}
catch(e){alert("ColorPalette.destroy: "+e);}}
FontPalette.object=null;FontPalette.prototype._iframe=null;FontPalette.prototype._value=null;FontPalette.prototype._rte=null;function FontPalette()
{this._iframe=null;this._value=null;FontPalette.object=this;}
FontPalette.createInstance=function(rte,x,y)
{var fp=new FontPalette();fp._rte=rte;fp._rte.setRange();var i=document.createElement("iframe");i.id="fontPalette";i.name="fontPalette";i.src="fontPalette.htm";i.scrolling="no";i.style.position="absolute";i.style.left=x+'px';i.style.top=y+'px';i.style.width="110px";i.style.marginHeight=0;i.style.marginWidth=0;i.style.display="";i.style.borderStyle="none";i.style.borderColor="black";i.style.borderWidth="0px";i.style.zIndex=ZIndex.TEXT_EDIT_PALETTE;document.body.appendChild(i);fp._iframe=i;i.onmouseout=FontPalette.handleMouseOut;return fp;}
FontPalette.handleMouseOut=function()
{var fp=FontPalette.object;fp.destroy();fp._rte._fontPalette=null;}
FontPalette.prototype.destroy=function()
{try{this._iframe.style.display="none";var sp=document.getElementById("fontPalette");if(sp!=null)
document.body.removeChild(sp);}
catch(e){alert("FontPalette.destroy: "+e);}}
SizePalette.object=null;SizePalette.prototype._iframe=null;SizePalette.prototype._value=null;SizePalette.prototype._rte=null;function SizePalette()
{this._iframe=null;this._value=null;SizePalette.object=this;}
SizePalette.createInstance=function(rte,x,y)
{var sp=new SizePalette();sp._rte=rte;sp._rte.setRange();var options="left="+x+",top="+y+",width=200,height=200";var i=document.createElement("iframe");i.id="sizePalette";i.name="sizePalette";i.src="sizePalette.htm";i.scrolling="no";i.style.position="absolute";i.style.left=x+'px';i.style.top=y+'px';i.style.width="140px";i.style.marginHeight=0;i.style.marginWidth=0;i.style.display="";i.style.borderStyle="none";i.style.borderColor="black";i.style.borderWidth="0px";i.style.zIndex=ZIndex.TEXT_EDIT_PALETTE;document.body.appendChild(i);sp._iframe=i;i.onmouseout=SizePalette.handleMouseOut;return sp;}
SizePalette.updateSize=function(h,w)
{var i=document.getElementById("sizePalette");var adjustment=(dhtmlapi.isIE)?5:0;i.style.height=(h+adjustment)+"px";i.style.width=(w+adjustment)+"px";}
SizePalette.handleMouseOut=function()
{var sp=SizePalette.object;sp.destroy();sp._rte._sizePalette=null;}
SizePalette.prototype.destroy=function()
{try{this._iframe.style.display="none";var sp=document.getElementById("sizePalette");if(sp!=null)
document.body.removeChild(sp);}
catch(e){alert("SizePalette.destroy: "+e);}}
LinkPalette.object=null;LinkPalette.prototype._iframe=null;LinkPalette.prototype._value=null;LinkPalette.prototype._rte=null;function LinkPalette()
{this._iframe=null;this._value=null;LinkPalette.object=this;}
LinkPalette.createInstance=function(rte,x,y)
{var lp=new LinkPalette();lp._rte=rte;lp._rte.setRange();var i=document.createElement("iframe");i.id="linkPalette";i.name="linkPalette";i.src="linkPalette.htm";i.style.position="absolute";i.style.left=x+'px';i.style.top=y+'px';i.style.height="140px";i.style.width="300px";i.style.marginHeight=0;i.style.marginWidth=0;i.style.display="";i.style.borderStyle="none";i.style.borderColor="black";i.style.borderWidth="0px";i.style.zIndex=ZIndex.TEXT_EDIT_PALETTE;document.body.appendChild(i);lp._iframe=i;return lp;}
LinkPalette.prototype.destroy=function()
{try{this._iframe.style.display="none";var sp=document.getElementById("linkPalette");if(sp!=null)
document.body.removeChild(sp);}
catch(e){alert("LinkPalette.destroy: "+e);}}
StaticTextWidget.prototype._data;function StaticTextWidget(mimeType,id,height,width,zindex,canvas,data)
{this._parent.initialize.call(this,mimeType,id,height,width,zindex,canvas);this._data=data;}
StaticTextWidget.inheritsFrom(Widget);StaticTextWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,data)
{var obj=new StaticTextWidget(mimeType,id,height,width,zindex,canvas,data);return obj;}
StaticTextWidget.prototype.getContents=function()
{return this._data;}
StaticTextWidget.prototype.select=function(parent)
{if(this._editmode==true)
return;this._parent.select.call(this,parent);}
StaticTextWidget.prototype.rollover=function()
{this._parent.rollover.call(this);}
StaticTextWidget.prototype.rollout=function()
{this._parent.rollout.call(this);}
StaticTextWidget.prototype.toHtml=function(xcoord,ycoord)
{var dim={top:ycoord,left:xcoord,height:this._height,width:this._width};var container=StaticTextWidget.createStaticText(this._id,this._zindex,dim,null,this._data);this._html=container;this._canvas._element.appendChild(container);}
StaticTextWidget.prototype.toXml=function()
{var elem=this._parent.toXml.call(this);var text=xmlutils.dom.createElement("text");var xmlstr=this._text;xmlutils.setNodeText(text,xmlstr);elem.appendChild(text);return elem;}
StaticTextWidget.prototype.unselect=function(mode)
{if(this._editmode==true)
return;this._parent.unselect.call(this);}
StaticTextWidget.prototype.toolbarCB=function(toolbarName,state,operation,value)
{this._parent.toolbarCB.call(this,toolbarName,state,operation,value);}
StaticTextWidget.prototype.createTitleBar=function()
{var tb=this._parent.createTitleBar.call(this);return tb;}
StaticTextWidget.createStaticText=function(id,zindex,dim,properties,data)
{try{var container=document.createElement("div");var p=document.createElement("div");container.id=id;container.className="draggable";container.style.position="absolute";container.style.top=dim.top+"px";container.style.left=dim.left+"px";container.style.height=dim.height+"px";container.style.width=dim.width+"px";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";if(properties!=null){var bgcolor=properties.backgroundColor;if(bgcolor!=null&&bgcolor!=""&&bgcolor!='nocolor')
container.style.backgroundColor=properties.backgroundColor;}
container.style.zIndex=zindex.toString();container.style.overflowY="hidden";container.style.overflowX="hidden";container.setAttribute("mimeType","text/html");p.id=name;p.innerHTML=data;p.style.top="0px";p.style.left="0px";p.style.width=(dim.width-6)+"px";p.style.height=(dim.height-6)+"px";p.style.overflowX='hidden';p.style.overflowY='hidden';p.style.marginTop="3px";p.style.marginBottom="3px";p.style.marginRight="3px";p.style.marginLeft="3px";p.style.fontFamily=properties.fontFamily;p.style.fontSize=properties.fontSize;container.appendChild(p);return container;}catch(e){alert("StaticTextWidget.createStaticText: exception: "+e);}}
StaticTextWidget.estimateTextSize=function(dim,properties,data)
{var container=document.createElement("div");var p=document.createElement("div");container.id="hecontainer";container.className="draggable";container.style.position="absolute";container.style.borderStyle="none";container.style.borderColor="black";container.style.borderWidth="0px";container.style.overflowY="hidden";container.style.overflowX="hidden";container.style.width=dim.width+"px";container.style.visibility="hidden";p.id="hetext";p.innerHTML=data;p.style.overflowX="hidden";p.style.overflowY="hidden";p.style.width=(dim.width-6)+"px";p.style.marginTop="3px";p.style.marginBotton="3px";p.style.marginRight="3px";p.style.marginLeft="3px";p.style.fontFamily=properties.fontFamily;p.style.fontSize=properties.fontSize;p.style.visibility="hidden";container.appendChild(p);document.body.appendChild(container);height=document.getElementById("hetext").offsetHeight+6;document.body.removeChild(container);if(dhtmlapi.isSafari)
height+=5;return height;}
VideoWidget.object=null;VideoWidget.prototype._url;VideoWidget.prototype._editmode;VideoWidget.prototype._htmlEditor;VideoWidget.prototype._flagToSave;function VideoWidget(mimeType,id,height,width,zindex,canvas,url)
{var mt=(mimeType!=null)?mimeType:"video/flash";this._parent.initialize.call(this,mt,id,height,width,zindex,canvas);this._url=url;this._htmlEditor=null;this._editmode=(url==null)?true:false;VideoWidget.object=this;}
VideoWidget.inheritsFrom(Widget);Editor.registerMimeType("video","flash",VideoWidget);VideoWidget.RenderXML=function(elem,mimeType,id,zindex,canvas)
{var url=xmlutils.getChildNode(elem,"url");var dimensions=xmlutils.getChildNode(elem,"dimensions");var location=xmlutils.getChildNode(elem,"location");var style=xmlutils.getChildNode(elem,"style");var div=xmlutils.dom.createElement("div");var name=xmlutils.dom.createElement("br");var left=location.getAttribute("left");var top=location.getAttribute("top");var width=dimensions.getAttribute("width");var height=dimensions.getAttribute("height");left=left.substring(0,left.length-2);top=top.substring(0,top.length-2);width=width.substring(0,width.length-2);height=height.substring(0,height.length-2);var obj=VideoWidget.createInstance(mimeType,id,height,width,zindex,canvas,xmlutils.getNodeText(url));obj.setDimensions(height,width);obj.toHtml();obj.resizeTo(height,width);obj.moveTo(left,top);return obj;}
VideoWidget.createInstance=function(mimeType,id,height,width,zindex,canvas,url)
{var ce=new VideoWidget(mimeType,id,height,width,zindex,canvas,url);return ce;}
VideoWidget.handleClose=function(url,mimeType)
{var ce=VideoWidget.object;ce._htmlEditor=ce._html;if(url!=null){try{ce._url=url;ce._mimeType=mimeType;ce._html=ce.createVideoLink();ce._canvas._element.appendChild(ce._html);ce._editmode=false;}catch(e){return;}}
var obj=document.getElementById("videoEditor");obj=null