var $U={};$U.Str={};$U.Cookie={};$U.XML={};$U.Date={};var _undef="undefined";$U.Str.GetNowTime=function(){var dt=new Date();return String(dt.getMonth()+1)+"/"+dt.getDate()+"/"+dt.getFullYear()+" "+dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds()+" "+((dt.getHours()>12)?"PM":"AM");}$U.Str.StripHTML=function(str){if(!str)return"";var re=/<\S[^><]*>/g;return str.replace(re,"");}$U.Str.HexToBin=function(str){if(!str)return 0;var res=0;for(var idx=0;idx<Math.min(str.length,8);idx++){var symb=str.charCodeAt(idx);if(symb>=97&&symb<=102)res=(res*16)+(symb-97)+10;else if(symb>=65&&symb<=70)res=(res*16)+(symb-65)+10;else if(symb>=48&&symb<=57)res=(res*16)+(symb-48);else{res=0;break;}}return res;}$U.Str.BinToHex=function(num,len){if(!len)len=8;var digs=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var res="";for(var idx=0;idx<len;idx++){var dig=num&15;res=digs[dig]+res;num>>=4;}return res;}$U.Str.Bin64ToHex=function(num){return $U.Str.BinToHex(num,16);}$U.Str.Escape=function(str){return str.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}function _str_escape(str){return $U.Str.Escape(str);}$U.Str.Unescape=function(str){return str.replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&');}function _str_unescape(str){return $U.Str.Unescape(str);};$U.Str.ExtractHost=function(host){return(host.substr(0,7).toLowerCase()=="http://")?host.substr(7).toLowerCase():((host.substr(0,8).toLowerCase()=="https://")?host.substr(8).toLowerCase():host.toLowerCase());}$U.Date.FormatDate=function(d,modificator,format){if(!d)d=new Date();if(modificator=="me")d=$U.Date.AddDate($U.Date.AddDate(d,-d.getDate(),1),-1);if(modificator=="-w")d=$U.Date.AddDate(d,-7);if(modificator=="-d")d=$U.Date.AddDate(d,-1);var day=(modificator=="mb")?1:d.getDate();var month=d.getMonth()+1;var year=d.getFullYear();switch(format){case"Y-M-D":return year+"-"+(month<10?"0"+month:month)+"-"+(day<10?"0"+day:day);default:return month+"/"+day+"/"+year;}}$U.Str.FormatRatio=function(ratio){var flt=parseInt((ratio-parseInt(ratio))*100);return(parseInt(ratio)+"."+(flt<10?"0"+flt:flt));}$U.Str.FormatNumber=function(num){var num=String(num);var triples=[];for(var i=num.length-3;i>=-2;i=i-3){triples.push(num.substr((i<0?0:i),3+(i<0?i:0)));}return triples.reverse().join(",");}$U.Date.AddDate=function(_d,days,months,years){var d=(!_d)?new Date():new Date(_d.getFullYear(),_d.getMonth(),_d.getDate(),0,0,0);if(days)d.setDate(d.getDate()+days);if(months)d.setMonth(d.getMonth()+months);if(years)d.setFullYear(d.getFullYear()+years);return d;}$U.FixPNG=function(elem,srcPNG){if(!elem)return;if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){var src=null;if((elem.tagName=='IMG')&&(/\.png$/.test(elem.src)||srcPNG)){src=(srcPNG?srcPNG:elem.src);elem.src="/images/empty.gif";}if(src){elem.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";return true;}}else if(srcPNG){if(elem.tagName=='IMG')elem.src=srcPNG;}return false;}$U.CreateStatusMsg=function(text,parent,offset,msgIcon){offset=offset||{x:0,y:0};var ctl=document.createElement("div");ctl.className="StatusMsg";if(parent){var pos=Position.cumulativeOffset(parent);ctl.style.position="absolute";ctl.style.left=String(pos[0]+(offset.x?offset.x:0))+"px";ctl.style.top=String(pos[1]+(offset.y?((offset.y==-1)?parseInt((parent.offsetHeight-16)/2):offset.y):0))+"px";}else if(offset){if(offset.y)ctl.style.marginTop=String(offset.y)+"px";if(offset.x)ctl.style.marginLeft=String(offset.x)+"px";}ctl.innerHTML="<img src='"+msgIcon+"'/><span>"+text+"</span>";return ctl;}$U.CreateLoadingMsg=function(text,parent,offset){return $U.CreateStatusMsg(text,parent,offset,'/images/loading.gif');}$U.CreateErrorMsg=function(text,parent,offset){return $U.CreateStatusMsg(text,parent,offset,'/images/error.gif');}$U.CreateWarningMsg=function(text,parent,offset){return $U.CreateStatusMsg(text,parent,offset,'/images/warning.gif');}$U.CreateInformationMsg=function(text,parent,offset){return $U.CreateStatusMsg(text,parent,offset,'/images/information.gif');}$U.ExceptionHandler=function(err){dbg_break();var errMsg=(err.name&&err.message)?(err.name.toString()+": "+err.message.toString()):err.toString();var status=$("divStatus");if(status){status.innerHTML="";status.appendChild($U.CreateErrorMsg(errMsg,status,{x:2,y:-1}));}else window.alert(errMsg);}$U.ShowWaitStatus=function(msg){var status=$("divStatus");if(status){status.innerHTML="";status.appendChild($U.CreateLoadingMsg(msg||"Please wait...",status,{x:2,y:-1}));}}$U.ClearStatus=function(){var status=$("divStatus");if(status)status.innerHTML="";}$U.GetClientWidth=function(){return(document.documentElement&&document.documentElement.clientWidth)?document.documentElement.clientWidth:(document.body!=null)?document.body.clientWidth:null;}$U.GetClientHeight=function(){return(document.documentElement&&document.documentElement.clientHeight)?document.documentElement.clientHeight:(document.body!=null)?document.body.clientHeight:null;}$U.GetPageWidth=function(){return Math.max(document.body.scrollWidth,document.body.offsetWidth);}$U.GetPageHeight=function(){return Math.max(document.body.scrollHeight,document.body.offsetHeight);}$U.GetElementOffset=function(ctl,cont){var pos=Position.cumulativeOffset(ctl);if(cont){var scrl=Position.realOffset(cont);pos[0]-=scrl[0];pos[1]-=scrl[1];}return pos;}$U.GetEventPos=function(evt){var pos=[Event.pointerX(evt),Event.pointerY(evt)];if(Prototype.Browser.IE&&(/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent))){pos[0]-=2;pos[1]-=2;}return pos;}$U.SetFocus=function(ctlId,val,sel){var ctl=$(ctlId);if(ctl){if(val)ctl.value=val;if(sel)ctl.select();ctl.focus();}}$U.SetText=function(ctlId,sText,sel){var ctl=$(ctlId);if(ctl){ctl.value=(sText?sText:"");if(sel)ctl.select();}}$U.GetText=function(ctlId){var ctl=$(ctlId);return ctl?ctl.value:"";}$U.DropSelect=function(slct){if(!slct)return;slct.selectedIndex=-1;slct.options.length=0;}$U.SelectSelect=function(slct,_iSelected){if(!slct)return;slct.selectedIndex=-1;for(var _i=0,opt;slct.options&&(_i<slct.options.length)&&(opt=slct.options[_i]);++_i){if(opt.value==_iSelected){slct.selectedIndex=_i;break;}}}$U.CreateSelect=function(slct,opts,_iSelected){$U.DropSelect(slct);if(opts.length==0)return;var idx=-1;if(_iSelected&&(_iSelected.substr(0,1)=="#"))idx=parseInt(_iSelected.substr(1));for(var i=0;i<opts.length;i++){if(!opts[i])break;if(opts[i].length>=2){slct.options[slct.options.length]=new Option(opts[i][1],opts[i][0]);if((idx<0)&&(opts[i][0]==_iSelected))idx=i;}else{slct.options[slct.options.length]=new Option(opts[i]._n,opts[i].id);if((idx<0)&&(opts[i].id==_iSelected))idx=i;}}slct.selectedIndex=((idx>=0)?idx:0);}$U.GetFirstElement=function(tagName,parent){if(!tagName)return null;var objs=parent?parent.getElementsByTagName(tagName):document.body.getElementsByTagName(tagName);if(objs&&(objs.length>0))return $(objs[0]);return(tagName=="object")?$U.GetFirstElement("embed",parent):null;}$U.CheckEMail=function(sText){if(!sText)return false;var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;if(filter.test(sText))return true;else return false;}$U.CheckURL=function(sText){if(!sText)return false;var filter=new RegExp();filter.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");if(filter.test(sText))return true;else return false;}$U.UrlParam=function(name,_default){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)return _default;else return results[1];}$U.Cookie.Get=function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin<0){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=dc.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}function _getcookie(name){return $U.Cookie.Get(name);}$U.Cookie.Set=function(name,value,hours,path,domain,secure){var expires=null;if(hours){expires=new Date();var base=new Date(0);var skew=base.getTime();if(skew>0)expires.setTime(now.getTime()-skew);if(parseInt(hours))expires.setTime(expires.getTime()+parseInt(hours)*60*60*1000);else expires.setTime(0x7FFFFFFF*1000);}var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;}function _setcookie(name,value,hours,path){$U.Cookie.Set(name,value,hours?hours:"never",path?path:"/");}$U.Cookie.Delete=function(name,path,domain){if($U.Cookie.Get(name))document.cookie=name+"="+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}$U.XML.GetNodeChildren=function(node,nodeName,maxNumItems){if(!node)return null;var list=[];var idx=0;for(var child=node.firstChild;child!=null;child=child.nextSibling){if(child.nodeName==nodeName){list.push(child);if(maxNumItems&&(++idx>=maxNumItems))break;}}return(maxNumItems==1)?((list.length>0)?list[0]:null):list;}$U.XML.GetNodeChild=function(node,nodeName){return $U.XML.GetNodeChildren(node,nodeName,1);}$U.XML.GetNodeAttribute=function(node,tagPath){if(!node)return"";var pathParts=tagPath?tagPath.split("/"):[];for(var _i=0;_i<pathParts.length;++_i){if(pathParts[_i].substr(0,1)=="@")return node.getAttribute(pathParts[_i].substr(1));var tag=$U.XML.GetNodeChildren(node,pathParts[_i],1);if(!tag)return"";node=tag;}return(node&&node.firstChild)?node.firstChild.nodeValue:"";}$U.XML.ParsePageInfo=function(nd){var pi={};pi.page=parseInt(nd.getAttribute("page"));pi.pages=parseInt(nd.getAttribute("pages"));pi.perpage=parseInt(nd.getAttribute("perpage"));pi.total=parseInt(nd.getAttribute("total"));return pi;}$U.XML.ParseSearchResult=function(rsp){var list=[];var databoxes=$U.XML.GetNodeChildren(rsp,"databox");for(var _i=0;databoxes&&(_i<databoxes.length);++_i){var dbx=databoxes[_i];var item={id:dbx.getAttribute("id"),_n:dbx.getAttribute("name"),_cx:32,_cy:32};var icons=dbx.getElementsByTagName("icon");if(icons&&(icons.length>0)&&icons[0].firstChild)item._i=icons[0].firstChild.nodeValue;if(!item._i)item._i="/images/empty.gif";var layouts=dbx.getElementsByTagName("layout");if(layouts&&layouts.length>0){item._layouts=[];for(var _k=0;_k<layouts.length;_k++){var l=layouts[_k];item._layouts.push({code:l.getAttribute("code"),name:l.getAttribute("name"),width:l.getAttribute("width"),height:l.getAttribute("height"),icon:l.getAttribute("icon")});}}list.push(item);}return list;}$U.ToString=function(_mixValue){if(_mixValue==null)return _undef;var propToString=function(_str,_mixValue,j){switch(typeof(_mixValue[j])){case"number":case"boolean":_str+=(((_str=="{")||(_str=="["))?"":", ");if(isNaN(_mixValue.length))_str+="'"+j+"':"+_mixValue[j];else _str+=_mixValue[j];break;case"string":_str+=(((_str=="{")||(_str=="["))?"":", ");if(isNaN(_mixValue.length))_str+="'"+j+"':'"+_mixValue[j]+"'";else _str+="'"+_mixValue[j]+"'";break;case"object":if(isNaN(_mixValue.length)){_str+=(((_str=="{")||(_str=="["))?"":", ");_str+="'"+j+"':";}else{_str+=(((_str=="{")||(_str=="["))?"":", ");_str+=$U.ToString(_mixValue[j]);}break;}return _str;};var _str="";_str+=isNaN(_mixValue.length)?"{":"[";_str+=(((_str=="{")||(_str=="["))?"":",");try{for(var j in _mixValue)_str=propToString(_str,_mixValue,j);}catch(e){if(_mixValue.xml)_str=propToString(_str,_mixValue,"xml");else _str+=e.message;}_str+=isNaN(_mixValue.length)?"}":"]";return _str;}function dump(_v){window.alert($U.ToString(_v));}function dbg_break(){var i=0;}$U.ShowPopupInfoWindow=function(href){var w=(window.screen.availWidth*40)/100;var h=(window.screen.availHeight*90)/100;var l=window.screen.availWidth-w-10;var t=0;var opts="toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";var newWnd=window.open(href,"popupinfo",opts+",width="+String(w)+",height="+String(h)+",left="+String(l)+",top="+String(t));if(newWnd)newWnd.focus();}$U.ShowPopupGadgetWindow=function(href,minw,minh){var w=(window.screen.availWidth*50)/100;if(minw)w=Math.max(w,minw);var h=(window.screen.availHeight*50)/100;if(minh)h=Math.max(h,minh);var l=(window.screen.availWidth-w)/2;var t=(window.screen.availHeight-h)/2;var opts="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no";var newWnd=window.open(href,"popupgadget",opts+",width="+String(w)+",height="+String(h)+",left="+String(l)+",top="+String(t));if(newWnd)newWnd.focus();}$U.DownloadImage=function(url){if(!url)return;window.open(url,"imagedownload","width=10,height=10,resizable=yes");}$U.DisableElement=function(_element,_disable){if(_disable==null)_disable=true;switch(_element.tagName.toLowerCase()){case'button':_element.className=_disable?"FlatButtonGray":"FlatButton";_element.disabled=_disable;break;}}var channel={};channel.STATE_UNINITIALIZED=0;channel.STATE_LOADING=1;channel.STATE_LOADED=2;channel.STATE_INTERACTIVE=3;channel.STATE_COMPLETE=4;channel.sCommonAJAXError="Cannot create XMLHttpRequest object.";channel.sCommonServerError="Server cannot reply to the request. Please try later...";channel.sCommonFormatError="Invalid response format.";channel.sNotReadyWarning="System is not ready. Please try later...";channel.sInUseError="This name is already in use.";channel.Request=function(url,onload,context,params,type){this.url=url;this.onload=onload;this.context=context;this.method=params?"POST":"GET";this.params=params?params:null;this.type=type?type:"application/x-www-form-urlencoded";this.xmlHttp=null;}channel.Request.prototype.Send=function(){this.xmlHttp=channel.Request.CreateXmlHttpRequestObject();if(!this.xmlHttp)return false;var bRes=true;try{this.xmlHttp.open(this.method,this.url,true);if(this.method=="POST")this.xmlHttp.setRequestHeader("Content-Type",this.type);var This=this;this.xmlHttp.onreadystatechange=function(){channel.Request.OnReadyState.call(This);};if(this.method=="POST")this.xmlHttp.send(this.params);else this.xmlHttp.send(null);}catch(e){bRes=false;}return bRes;}channel.Request.OnReadyState=function(){var complete=(this.xmlHttp.readyState==channel.STATE_COMPLETE);var success;try{success=(this.xmlHttp.readyState>=channel.STATE_LOADED)?((this.xmlHttp.status==0)||(this.xmlHttp.status>=200&&this.xmlHttp.status<300)):false;}catch(e){success=false;}if(!complete||!success){if(complete){var statusText=this.xmlHttp.statusText;if(this.xmlHttp.status==405)statusText="Method "+this.method+" is not allowed";window.alert("HTTP Error "+this.xmlHttp.status+": "+statusText);}return;}if(this.onload&&(this.onload instanceof Function)){var isXML=this.xmlHttp.responseXML&&this.xmlHttp.responseXML.documentElement;var resp={responseXML:this.xmlHttp.responseXML,responseText:(!isXML?this.xmlHttp.responseText:null)};this.xmlHttp=null;if(this.reqData){resp.reqData=this.reqData;this.reqData=null;}this.onload.call(this.context,resp);}}channel.Request.CreateXmlHttpRequestObject=function(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){var XmlHttpVersions=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var idx=0;idx<XmlHttpVersions.length&&!xmlHttp;idx++){try{xmlHttp=new ActiveXObject(XmlHttpVersions[idx]);}catch(e){$U.ExceptionHandler(e);}}}if(!xmlHttp)window.alert(channel.sCommonAJAXError);else return xmlHttp;}channel.Request.GetResponseXML=function(xmlHttp){var rspXML=xmlHttp.responseXML?xmlHttp.responseXML:xmlHttp;if(!rspXML||!rspXML.documentElement||(rspXML.documentElement.nodeName=="parsererror"))return null;return rspXML;}channel.Request.GetResponseResult=function(xmlHttp,rootName){var rspXML=channel.Request.GetResponseXML(xmlHttp);if(!rspXML)return{id:-1,msg:channel.sCommonServerError};var response=rspXML.documentElement;if(rootName&&(response.nodeName==rootName))return null;if(response.nodeName!="response")return{id:-1,msg:channel.sCommonFormatError};if(response.getAttribute("stat")=="ok")return null;var err={id:-1,msg:channel.sCommonServerError};var errs=response.getElementsByTagName("error");if(errs&&(errs.length>0)){err.id=parseInt(errs[0].getAttribute("id"))||err.id;err.msg=errs[0].getAttribute("msg")||err.msg;}return err;}channel.SendCustomRequest=function(hash,onready,context,params){if(params&&params.isDialog){if((typeof DlgBox!=_undef)&&DlgBox.singleton)DlgBox.singleton.ShowWaitStatus();}else $U.ShowWaitStatus();var query="";for(var key in hash){if(query)query+="&";query+=encodeURIComponent(key)+"="+encodeURIComponent(hash[key]);}var req;if(params&&params.isPost)req=new channel.Request(gd.sServiceEndPoint,onready,context,query);else{if(params&&params.xml)req=new channel.Request(gd.sServiceEndPoint+"?"+query,onready,context,params.xml,"text/xml");else if(params&&params.html)req=new channel.Request(gd.sServiceEndPoint+"?"+query,onready,context,params.html,"text/html");else if(params&&params.plain)req=new channel.Request(gd.sServiceEndPoint+"?"+query,onready,context,params.plain,"text/plain");else req=new channel.Request(gd.sServiceEndPoint+"?"+query,onready,context);}req.reqData=(params&&params.reqData)?params.reqData:null;return req.Send();}function MenuDataItem(){this.__typeName="MenuDataItem";this._n="";this._s=null;this._i="";}function Menu(data,bar,parent){this.__typeName="Menu";this.popup=!bar;this.container=$(document.createElement("div"));this.container.className=this.popup?"menu_container_v":"menu_container_h";this.container.style.zIndex=2;this.container.onmouseover=this.OnMOver.bind(this);this.container.onmouseout=this.OnMOut.bind(this);this.container.render=this;this.InitChildren(data);this.parentMenu=parent;}Menu.STYLE_LEFTALIGN=0x00;Menu.STYLE_RIGHTALIGN=0x01;Menu.STYLE_TOPALIGN=0x00;Menu.STYLE_BOTTOMALIGN=0x10;Menu.IconRowWidth=(16+4);Menu.SpacerSignWidth=(7+4);Menu.DropSignWidth=(14+4);Menu.LinkMargin=5;Menu.MainItemGap=1;Menu.Separator={_n:null};Menu.popup=null;Menu.bar=null;Menu.onmousedown=null;Menu.OnMDown=function(evt){Menu.DestroySingleton(evt,Menu.popup);Menu.DestroySingleton(evt,Menu.bar);}Menu.DestroyPopup=function(){if(!Menu.popup)return;Menu.popup.Destroy();Menu.popup=null;}Menu.DestroyBar=function(){if(!Menu.bar)return;Menu.bar.Destroy();}Menu.DestroySingleton=function(evt,menu){if(!(menu&&menu.container))return;var mouPos={x:Event.pointerX(evt),y:Event.pointerY(evt)};var testMenu=menu;while(testMenu){if(Position.within(testMenu.container,mouPos.x,mouPos.y))return;var item=testMenu.FindOpenedSubMenu();testMenu=item?item.menu:null;}(menu.popup)?Menu.DestroyPopup():Menu.DestroyBar();}Menu.prototype.Show=function(pt,style,cont){if(!this.parentMenu){Menu.DestroyPopup();if(this.popup){Menu.DestroyBar();Menu.popup=this;}else Menu.bar=this;}style=style||(Menu.STYLE_LEFTALIGN+Menu.STYLE_TOPALIGN);if(this.popup)document.body.appendChild(this.container);else if(cont)cont.appendChild(this.container);Object.extend(this.container.style,{left:String(pt.x)+"px",top:String(pt.y)+"px"});if(!this.popup){if(pt.w)this.container.style.width=String(pt.w)+"px";if(pt.h){this.barHeight=pt.h;this.barPadding=(this.barHeight>24)?parseInt((this.barHeight-24)/2):0;this.container.style.height=String(this.barHeight)+"px";for(var _i=0;_i<this.items.length;++_i){var itemBar=this.items[_i].render.itemBar;if(this.barPadding)itemBar.style.paddingTop=String(this.barPadding)+"px";this.RestoreItemBar(this.items[_i].render);}}}else{this.barHeight=24;this.barPadding=0;}this.container.style.display="block";Menu.CorrectLinkWidth(this.container);if((style&Menu.STYLE_RIGHTALIGN)!=0)this.container.style.left=String(pt.x-(this.container.offsetWidth-1)+(pt.w?(pt.w-1):0))+"px";else{if(this.popup&&((pt.x+this.container.offsetWidth)>$U.GetClientWidth()))this.container.style.left=String(pt.x-(this.container.offsetWidth-1)+(pt.w?(pt.w-1):0))+"px";else this.container.style.left=String(pt.x)+"px";}if((style&Menu.STYLE_BOTTOMALIGN)!=0)this.container.style.top=String(pt.y-(this.container.offsetHeight-1)+(pt.h?(pt.h-1):0))+"px";else{if(this.popup&&((pt.y+this.container.offsetHeight)>$U.GetClientHeight()))this.container.style.top=String(pt.y-(this.container.offsetHeight-1)+(pt.h?(pt.h-1):0))+"px";else this.container.style.top=String(pt.y)+"px";}if(!Menu.onmousedown){Menu.onmousedown=Menu.OnMDown.bindAsEventListener(Menu);Event.observe(document.body,'mousedown',Menu.onmousedown);}}Menu.prototype.Destroy=function(){if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=null;}if(this.popup){if(this.openTimer){clearTimeout(this.openTimer);this.openTimer=null;}if(this.container)document.body.removeChild(this.container);this.container=null;}this.CloseOpenedSubMenu();}Menu.prototype.InitChildren=function(data){this.maxWidth=0;this.items=[];if(!this.popup&&data.length)data[data.length-1].last=true;for(var _i=0;_i<data.length;_i++){if(!data[_i])continue;if(!data[_i].right)this.addMenuItem(data[_i]);}for(var _i=data.length-1;_i>=0;_i--){if(!data[_i])continue;if(data[_i].right)this.addMenuItem(data[_i]);}}Menu.prototype.addMenuItem=function(data){if(!data||(data._s&&(data._s.length==0)))return;var item=new MenuItem(data,this);item.render.context=this;this.container.appendChild(item.render.rendered);this.items[this.items.length]=item;if(item.render.maxWidth&&(item.render.maxWidth>this.maxWidth))this.maxWidth=item.render.maxWidth;}Menu.prototype.OnMOver=function(){if(!this.popup)Menu.DestroyPopup();if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=null;}if(this.parentMenu){if(this.parentMenu.hideTimer){clearTimeout(this.parentMenu.hideTimer);this.parentMenu.hideTimer=null;}}var item=this.FindOpenedSubMenu();if(item&&item.menu){if(item.menu.hideTimer){clearTimeout(item.menu.hideTimer);item.menu.hideTimer=null;}}}Menu.prototype.OnMOut=function(){if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=null;}this.hideTimer=setTimeout(this.HideMenu.bind(this),(this.popup?1250:125));}Menu.prototype.FindOpenedSubMenu=function(){for(var _i=0;_i<this.items.length;++_i){if(this.items[_i].menu)return this.items[_i];}return null;}Menu.prototype.HideMenu=function(){this.Destroy();if(this.parentMenu)this.parentMenu.HideMenu();else{if(this.oncmdclick&&(this.oncmdclick instanceof Function))this.oncmdclick.call(this.context,null);}}Menu.CorrectLinkWidth=function(cont){var maxWidth=0,aveWidth=0;var spans=cont.getElementsByTagName("span");var _sl=spans.length;for(var _i=0;_i<_sl;++_i){aveWidth+=parseInt(spans[_i].offsetWidth);if(parseInt(spans[_i].offsetWidth)>maxWidth)maxWidth=parseInt(spans[_i].offsetWidth);}if(cont.render.popup){for(_i=0;_i<_sl;++_i){if(spans[_i].render.item.subMenu)spans[_i].style.marginRight=String(maxWidth-parseInt(spans[_i].offsetWidth))+"px";}}aveWidth=parseInt(aveWidth/_sl+0.5);var baseWidth=cont.render.popup?((Menu.IconRowWidth*2+Menu.LinkMargin)+maxWidth):((Menu.SpacerSignWidth+Menu.DropSignWidth)+aveWidth);for(_i=0;_i<_sl;++_i){var span=$(spans[_i]),prnt=$(span.parentNode);var view=span.render;var itemWidth=baseWidth;if(!cont.render.popup&&(parseInt(span.offsetWidth)>aveWidth))itemWidth=(Menu.SpacerSignWidth+Menu.DropSignWidth)+parseInt(span.offsetWidth);prnt.hide();prnt.style.width=String(itemWidth-(view.item.separator?(Menu.IconRowWidth+4):0))+"px";if(view.item.separator){prnt.style.height="1px";view.rendered.style.height="5px";}view.rendered.style.width=String(itemWidth+(cont.render.popup?2:(view.item.data.last?0:Menu.MainItemGap)))+"px";prnt.show();}}Menu.prototype.CreatePopupSubMenu=function(menuData,pt,style){var menu=new Menu(menuData,false,this);menu.Show(pt,style);menu.context=this.context;menu.oncmdclick=this.oncmdclick;return menu;}Menu.prototype.RestoreItemBar=function(view){view.itemBar.className=view.itemBar.backClassName;view.itemBar.style.height=String(this.barHeight-this.barPadding-(view.context.popup?2:0))+"px";}Menu.prototype.CloseOpenedSubMenu=function(){var item=this.FindOpenedSubMenu();if(item&&item.menu){item.menu.Destroy();item.menu=null;this.RestoreItemBar(item.render);}}Menu.prototype.OnItemClick=function(evt){if(this.openTimer){clearTimeout(this.openTimer);this.openTimer=null;}var trg=Event.element(evt);var item=(trg&&trg.render)?trg.render.item:null;if(!item)return;if(item.subMenu){if(!(item.menu&&item.menu.container)){this.CloseOpenedSubMenu();var divCont=item.render.rendered;if(this.popup&&(!divCont.offsetParent||!divCont.offsetParent.offsetParent))return;var pos=Position.cumulativeOffset(divCont);var pt={};if(this.popup){pt={x:((pos[0]+divCont.offsetWidth)-2),y:(pos[1]),w:-(divCont.offsetWidth-4),h:(divCont.offsetHeight)};if(Prototype.Browser.IE&&(/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent))){pt.y+=2;pt.x+=1;}if(Prototype.Browser.Gecko){pt.x+=1;pt.y+=1;}}else{pt={x:(pos[0]),y:((pos[1]+divCont.offsetHeight)-1),w:(divCont.offsetWidth)};if(Prototype.Browser.IE&&(/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent))){}if(Prototype.Browser.Gecko){}}item.menu=this.CreatePopupSubMenu(item.data._s,pt,(item.data.last?Menu.STYLE_RIGHTALIGN:0));item.menu.parentMenu=this;}}else{if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=null;}if(!this.popup){this.RestoreItemBar(item.render);}var testMenu=this;while(testMenu){testMenu.Destroy();testMenu=testMenu.parentMenu;}if(this.oncmdclick&&(this.oncmdclick instanceof Function))this.oncmdclick.call(this.context,item.data);}}Menu.prototype.OnItemMOver=function(evt){if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=null;}var trg=Event.element(evt);var view=trg?trg.render:null;if(!view)return;view.itemBar.className=view.itemBar.backClassName+" "+(view.context.popup?"menu_item_content_current_v":"menu_item_content_current_h");view.itemBar.style.height=String(this.barHeight-this.barPadding-(view.context.popup?4:0))+"px";if(view.item.subMenu){if(!(view.item.menu&&view.item.menu.container)){this.CloseOpenedSubMenu();this.openTimer=setTimeout(this.OnItemClick.bind(this,{srcElement:{render:view}}),10);}}else this.CloseOpenedSubMenu();}Menu.prototype.OnItemMOut=function(evt){var trg=Event.element(evt);var view=trg?trg.render:null;if(!view)return;var mouPos={x:Event.pointerX(evt),y:Event.pointerY(evt)};var pos=$U.GetElementOffset(view.itemBar,!view.context.popup?document.body:null);if(Prototype.Browser.IE&&(/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent))){pos[0]+=2;pos[1]+=2;}var rc={left:pos[0],top:pos[1],right:(pos[0]+(view.itemBar.offsetWidth-1)),bottom:(pos[1]+(view.itemBar.offsetHeight-1))};if((mouPos.y>rc.top)&&(mouPos.y<rc.bottom)&&(mouPos.x>rc.left)&&(mouPos.x<rc.right))return;if(!view.item.menu)this.RestoreItemBar(view);if(this.openTimer){clearTimeout(this.openTimer);this.openTimer=null;}}Menu.prototype.AddLoadingItem=function(){var item=new MenuItem({_n:"Please Wait...",_i:"/images/loading.gif",cmd:null,data:null},this);item.render.context=this;this.container.appendChild(item.render.rendered);this.items[this.items.length]=item;if(item.render.maxWidth&&(item.render.maxWidth>this.maxWidth))this.maxWidth=item.render.maxWidth;}Menu.ShowWaitStatus=function(pt){var menu=new Menu([]);menu.AddLoadingItem();menu.Show(pt);return menu;}function MenuItem(menuData,context){this.__typeName="MenuItem";this.data=menuData;this.subMenu=Boolean(menuData._s);this.separator=!Boolean(menuData._n);this.context=context;this.render=new MenuItemView(this);this.render.context=context;}function MenuItemView(item){this.__typeName="MenuItemView";this.item=item;var divCont=$(document.createElement("div"));divCont.className=item.context.popup?"menu_option_v":(item.data.right?"menu_option_hr":"menu_option_hl");divCont.render=this;this.rendered=divCont;if(!item.separator){var img1="<img class='menu_item_image' src='/images/empty.gif'/>";var link="<span class='"+(item.context.popup?"menu_item_link_v":"menu_item_link_h")+"'>"+item.data._n+"</span>";var img2="<img class='menu_item_image' src='/images/empty.gif'/>";divCont.innerHTML="<div class='"+(item.context.popup?"menu_item_content_v":"menu_item_content_h")+"'>"+img1+link+img2+"</div>";this.maxWidth=(item.context.popup?(Menu.IconRowWidth*2+Menu.LinkMargin):(Menu.SpacerSignWidth+Menu.DropSignWidth))+$U.Str.StripHTML(item.data._n).length*7;divCont.style.width=String(this.maxWidth)+"px";}else{var img="<img class='menu_item_image' src='/images/empty.gif'/>";var link="<span class='"+(item.context.popup?"menu_item_link_v":"menu_item_link_h")+"'></span>";divCont.innerHTML="<div class='menu_item_content_separator'>"+img+link+"</div>";}var spans=divCont.getElementsByTagName("span");for(var _i=0;_i<spans.length;++_i)spans[_i].render=this;if(item.context.popup)spans[0].style.marginLeft=String(Menu.LinkMargin)+"px";if(item.data._def)spans[0].style.fontWeight="bold";var imgs=divCont.getElementsByTagName("img");for(_i=0;_i<imgs.length;++_i){Object.extend(imgs[_i].style,{width:String((item.context.popup?Menu.IconRowWidth:(_i==0?Menu.SpacerSignWidth:Menu.DropSignWidth))-4)+"px",marginLeft:"2px",marginRight:"2px"});imgs[_i].render=this;}if(Boolean(item.data._i)&&(imgs.length>0))$U.FixPNG(imgs[0],item.data._i);if(!item.separator){if(item.subMenu)imgs[1].src=item.context.popup?"/images/menu/submenu_sign.gif":"/images/menu/dropmenu_sign.gif";else{if(!item.context.popup)imgs[1].style.width=String(Menu.SpacerSignWidth-4)+"px";}}if(!item.separator){this.itemBar=spans[0].parentNode;if(!item.context.popup)this.itemBar.style.textAlign="center";this.itemBar.render=this;this.itemBar.backClassName=this.itemBar.className;this.itemBar.onclick=item.context.OnItemClick.bindAsEventListener(item.context);this.itemBar.onmouseover=item.context.OnItemMOver.bindAsEventListener(item.context);this.itemBar.onmouseout=item.context.OnItemMOut.bindAsEventListener(item.context);}}DlgBox=function(title,params){this.__typename="DlgBox";this.title=title;this.frag=document.createDocumentFragment();this.bkg=document.createElement("div");Object.extend(this.bkg.style,{display:"none",position:"absolute",top:0,left:0,zIndex:1});if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent))this.bkg.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fadeOut.png', sizingMethod='scale')";else Object.extend(this.bkg.style,{backgroundColor:"#ffffff",filter:"alpha(opacity=50)",opacity:0.5});this.frag.appendChild(this.bkg);this.dlg=document.createElement("div");this.dlg.className="wdDlgBox";Object.extend(this.dlg.style,{display:"none",position:"absolute",zIndex:1});this.dlgCapt=document.createElement("div");this.dlgCapt.className="wdDlgBoxCaption";this.dlgCapt.onmousedown=this.OnCaptMDown.bindAsEventListener(this);this.dlg.appendChild(this.dlgCapt);this.dlgBody=document.createElement("div");this.dlgBody.className="wdDlgBoxBody";this.SetPadding(5);this.dlg.appendChild(this.dlgBody);this.frag.insertBefore(this.dlg,this.bkg.nextSibling);var ctlBody=$$("body")[0];ctlBody.insertBefore(this.frag,ctlBody.firstChild);this.isLoading=false;this.oldStatus="";if(params)Object.extend(this,params);}DlgBox.singleton=null;DlgBox.INIT="dlgInit";DlgBox.IDOK="btnOK";DlgBox.IDCANCEL="btnCancel";DlgBox.IDCLOSE="btnClose";DlgBox.IDMAXIMIZE="btnMaximize";DlgBox.sTemplateNotFound="Dialog template was not found";DlgBox.prototype.OnTemplateLoad=function(xmlHttp){$U.ClearStatus();try{var rspText=xmlHttp.responseText;if(!rspText)throw(channel.sCommonServerError);var div=document.createElement("div");div.style.display="none";div.innerHTML=rspText;document.body.appendChild(div);var ctlTempl=xmlHttp.reqData?$(xmlHttp.reqData.templName):null;if(!ctlTempl)$U.ExceptionHandler(DlgBox.sTemplateNotFound);else{if(DlgBox.singleton)DlgBox.singleton.Hide();DlgBox.singleton=this;try{rspText.evalScripts();}catch(e){if(xmlHttp.reqData&&xmlHttp.reqData.templName)e.name=e.name+" ("+xmlHttp.reqData.templName+".html)";$U.ExceptionHandler(e);}this.ShowIndirect(ctlTempl.innerHTML,xmlHttp.reqData.pos);}}catch(e){$U.ExceptionHandler(e);}}DlgBox.prototype.ShowIndirect=function(templ,pos){Position.prepare();this.dlgBody.innerHTML=templ;this.bkg.style.display="block";Object.extend(this.bkg.style,{width:String($U.GetPageWidth())+"px",height:String($U.GetPageHeight())+"px"});this.dlg.style.display="block";this.Center(pos);var btns=this.dlgBody.getElementsByTagName("button");if(btns&&(btns.length>0)){for(var idx=0;idx<btns.length;idx++){btns[idx].onclick=this.OnBtnClick.bindAsEventListener(this);}}var chks=Selector.findChildElements(this.dlgBody,['input[type="checkbox"]']);if(chks&&(chks.length>0)){for(var idx=0;idx<chks.length;idx++){chks[idx].onclick=this.OnBtnClick.bindAsEventListener(this);}}var sels=this.dlgBody.getElementsByTagName("select");if(sels&&(sels.length>0)){for(var idx=0;idx<sels.length;idx++){sels[idx].onchange=this.OnSelChange.bindAsEventListener(this);}}this.infos=[];var infs=Selector.findChildElements(this.dlgBody,['div[type="infobox"]']);if(infs&&(infs.length>0)){for(var idx=0;idx<infs.length;idx++){this.infos.push(new InfoBox($(infs[idx]),300));}}if(this.oncommand&&(this.oncommand instanceof Function)){if(!this.clientRect)this.clientRect={cx:$U.GetClientWidth(),cy:$U.GetClientHeight()};try{var res=this.oncommand.call(this,DlgBox.INIT);if(!res)this.Center();}catch(e){$U.ExceptionHandler(e);}}this.old_onkeydown=document.onkeydown;document.onkeydown=this.OnKeyDown.bindAsEventListener(this);this.old_onwindowresize=window.onresize;window.onresize=this.OnWindowResize.bindAsEventListener(this);}DlgBox.prototype.Show=function(templName,pos){var ctlTempl=$(templName);if(!ctlTempl){$U.ShowWaitStatus();var req=new channel.Request("/forms/?templ_name="+templName.toLowerCase()+".html&"+gd.sSiteBuild,this.OnTemplateLoad,this);req.reqData={templName:templName,pos:pos};if(!req.Send())$U.ExceptionHandler(DlgBox.sTemplateNotFound);return;}var rspText=ctlTempl.parentNode?ctlTempl.parentNode.innerHTML:null;if(DlgBox.singleton)DlgBox.singleton.Hide();DlgBox.singleton=this;try{rspText.evalScripts();}catch(e){$U.ExceptionHandler(e);}this.ShowIndirect(ctlTempl.innerHTML,pos);}DlgBox.prototype.Center=function(pos){pos=pos||{x:50,y:50};Position.prepare();if(!this.clientRect)this.clientRect={cx:$U.GetClientWidth(),cy:$U.GetClientHeight()};var pt={x:Position.deltaX+parseInt(((this.clientRect.cx-this.dlg.offsetWidth)*pos.x)/100+.5),y:Position.deltaY+parseInt(((this.clientRect.cy-this.dlg.offsetHeight)*pos.y)/100+.5)};Object.extend(this.dlg.style,{left:String(pt.x<0?0:pt.x)+"px",top:String(pt.y<0?0:pt.y)+"px"});this.SetTitle();}DlgBox.GetPressBtnBhvr=function(img){return'src="'+img+'_up.png"/'+' onmousedown="javascript:this.src=\''+img+'_down.png\'" onmouseup="javascript:this.src=\''+img+'_over.png\'"'+' onmouseover="javascript:this.src=\''+img+'_over.png\'" onmouseout="javascript:this.src=\''+img+'_up.png\'"';}DlgBox.prototype.SetTitle=function(){var width=this.dlgCapt.offsetWidth;var title=this.title;while((title.length>0)&&(title.length*7>width))title=title.substr(0,title.length-1);this.dlgCapt.innerHTML='<table border="0" cellspacing="0" cellpadding="0"><tr style="height:20px;">'+'<td style="width:'+String(width-(this.maximizeButton?40:22))+'px;" noWrap="true"><span>'+(title+((this.title.length!=title.length)?"...":""))+'</span></td>'+'<td style="width:'+(this.maximizeButton?38:20)+'px;" align="center">'+(this.maximizeButton?'<img id="'+DlgBox.IDMAXIMIZE+'" style="width:16px; height:16px; margin-right:2px;" '+DlgBox.GetPressBtnBhvr('/images/dlg/maximize')+'>':'')+'<img id="'+DlgBox.IDCLOSE+'" style="width:16px; height:16px;" '+DlgBox.GetPressBtnBhvr('/images/dlg/close')+'>'+'</td></tr></table>';var imgs=this.dlgCapt.getElementsByTagName("img");if(this.maximizeButton){imgs[0].title="Maximize";imgs[0].onclick=this.OnBtnClick.bindAsEventListener(this);imgs[1].title="Close";imgs[1].onclick=this.OnBtnClick.bindAsEventListener(this);}else{imgs[0].title="Close";imgs[0].onclick=this.OnBtnClick.bindAsEventListener(this);}}DlgBox.prototype.Hide=function(){if(this.dlg.parentNode){var objs=this.dlg.getElementsByTagName("object");for(var i=0;i<objs.length;i++)objs[i].parentNode.innerHTML="";this.dlg.parentNode.removeChild(this.dlg);}this.dlg=null;if(this.bkg.parentNode)this.bkg.parentNode.removeChild(this.bkg);this.bkg=null;this.frag=null;DlgBox.singleton=null;document.onkeydown=this.old_onkeydown;window.onresize=this.old_onwindowresize;}DlgBox.prototype.IsVisible=function(){return Boolean(this.frag);}DlgBox.prototype.OnBtnClick=function(evt){var trg=Event.element(evt);if(!trg)return;var id=trg.id;if(id==DlgBox.IDMAXIMIZE){if(this.maximized){var imgs=this.dlgCapt.getElementsByTagName("img");imgs[0].title="Maximize";this.maximized=false;Object.extend(this.dlg.style,{left:String(this.normalPos.x)+"px",top:String(this.normalPos.y)+"px"});Object.extend(this.dlgBody.style,{width:String(this.normalSize.cx)+"px",height:String(this.normalSize.cy)+"px"});var cols=this.dlgCapt.getElementsByTagName("td");if(cols&&(cols.length>0))cols[0].style.width=String(this.normalSize.cx-cols[1].offsetWidth-7)+"px";var obj=$U.GetFirstElement("object",this.dlgBody);if(obj)Object.extend(obj,{width:this.normalObjSize.cx,height:this.normalObjSize.cy});}else{this.normalPos={x:parseInt(this.dlg.style.left),y:parseInt(this.dlg.style.top)};this.normalSize={cx:this.dlgBody.offsetWidth,cy:this.dlgBody.offsetHeight};Object.extend(this.dlg.style,{left:"0px",top:"0px"});this.FitContents();var imgs=this.dlgCapt.getElementsByTagName("img");imgs[0].title="Restore";this.maximized=true;}}if(this.oncommand&&(this.oncommand instanceof Function)){try{this.oncommand.call(this,(parseInt(id)||(id=="0"))?parseInt(id):id,evt);}catch(e){$U.ExceptionHandler(e);}}if((id==DlgBox.IDCLOSE)&&this.IsVisible())this.Hide();}DlgBox.prototype.FitContents=function(){var gap={cx:(this.dlg.offsetWidth-this.dlgBody.offsetWidth),cy:(this.dlg.offsetHeight-this.dlgBody.offsetHeight)};Object.extend(this.dlgBody.style,{width:String($U.GetPageWidth()-gap.cx)+"px",height:String($U.GetPageHeight()-gap.cy+3)+"px"});var cols=this.dlgCapt.getElementsByTagName("td");if(cols&&(cols.length>0))cols[0].style.width=String($U.GetPageWidth()-cols[1].offsetWidth-gap.cx)+"px";var obj=$U.GetFirstElement("object",this.dlgBody);if(obj){this.normalObjSize={cx:obj.width,cy:obj.height};Object.extend(obj,{width:(parseInt(this.dlgBody.style.width)-4),height:(parseInt(this.dlgBody.style.height)-4)});}}DlgBox.prototype.OnSelChange=function(evt){var trg=Event.element(evt);if(!trg)return;if(!trg.id&&(trg.tagName.toLowerCase()!="select")&&trg.parentNode)trg=trg.parentNode;var id=trg.id;if(this.oncommand&&(this.oncommand instanceof Function)){try{this.oncommand.call(this,(parseInt(id)||(id=="0"))?parseInt(id):id,trg.value);}catch(e){$U.ExceptionHandler(e);}}}DlgBox.prototype.$=function(id){var childs=this.dlgBody.getElementsByTagName("*");for(var idx=0;idx<childs.length;idx++)if(childs[idx].id==id)return Element.extend(childs[idx]);return null;}DlgBox.prototype.$$=function(){return Selector.findChildElements(this.dlgBody,$A(arguments));}DlgBox.prototype.OnCaptMDown=function(evt){var trg=Event.element(evt);if(!trg)return;if(Event.isLeftClick(evt)&&(trg.tagName!="IMG")&&!this.maximized){this.old_onmousemove=document.onmousemove;this.old_onmouseup=document.onmouseup;document.onmousemove=this.OnCaptMMove.bindAsEventListener(this);document.onmouseup=this.OnCaptMUp.bindAsEventListener(this);this.mouseCaptured=true;this.startPos={x:parseInt(this.dlg.style.left),y:parseInt(this.dlg.style.top)};this.dragPos={x:Event.pointerX(evt),y:Event.pointerY(evt)};}}DlgBox.prototype.OnCaptMMove=function(evt){if(this.mouseCaptured){var mouPos={x:Event.pointerX(evt),y:Event.pointerY(evt)};var newPos={x:(this.startPos.x+mouPos.x-this.dragPos.x),y:(this.startPos.y+mouPos.y-this.dragPos.y)};this.dlg.style.left=String(newPos.x)+"px";this.dlg.style.top=String(newPos.y)+"px";Event.stop(evt);}}DlgBox.prototype.OnCaptMUp=function(evt){if(this.mouseCaptured){document.onmousemove=this.old_onmousemove;document.onmouseup=this.old_onmouseup;this.mouseCaptured=false;}}DlgBox.prototype.SetFocus=function(id,delay){if(!delay)this.$(id).focus();else setTimeout(this.SetFocus.bind(this,id),delay);}DlgBox.prototype.OnKeyDown=function(evt){if(this.old_onkeydown&&(this.old_onkeydown instanceof Function))this.old_onkeydown.call(window,evt);if((evt.type=="keydown")&&(evt.keyCode==Event.KEY_ESC)&&this.IsVisible()){Event.stop(evt);this.Hide();}};DlgBox.prototype.OnWindowResize=function(evt){if(this.old_onwindowresize instanceof Function)this.old_onwindowresize.call(window,evt);if(this.bkg)Object.extend(this.bkg.style,{width:String($U.GetPageWidth())+"px",height:String($U.GetPageHeight())+"px"});if(this.maximized)this.FitContents();}DlgBox.prototype.ShowWaitStatus=function(msg){this.isLoading=true;var status=this.$("divDlgStatus");if(status){if(this.oldStatus=="")this.oldStatus=status.innerHTML;status.innerHTML="";status.appendChild($U.CreateLoadingMsg(msg||"Please wait..."));}}DlgBox.prototype.ShowWarning=function(msg){var status=this.$("divDlgStatus");if(status){status.innerHTML="";status.appendChild($U.CreateWarningMsg(msg||"Incorrect data..."));}}DlgBox.prototype.ShowError=function(msg){var status=this.$("divDlgStatus");if(status){status.innerHTML="";status.appendChild($U.CreateErrorMsg(msg));}}DlgBox.prototype.ClearStatus=function(){this.isLoading=false;var status=this.$("divDlgStatus");if(status)status.innerHTML=this.oldStatus;this.oldStatus="";}DlgBox.prototype.GetLoading=function(){return this.isLoading;}DlgBox.prototype.SetPadding=function(padding){if(this.dlgBody)this.dlgBody.style.padding=String(padding)+"px";}DlgBox.AttachProc=function(func){if(DlgBox.singleton)DlgBox.singleton.oncommand=func;}DlgBox.Std=function(){this.__typename="DlgBox.Std";}DlgBox.Std.ImageView=function(data){var title=data._n.replace(/\'/g,"&#039;");if(title.length==0)title="(untitled)";var imgTitle=((data._t?data._t:data._n)||"");imgTitle=imgTitle.replace(/\'/g,"&#039;");var dlg=new DlgBox(title);dlg.oncommand=((typeof DlgImageViewProc!=_undef)?DlgImageViewProc:null);dlg.path=data.staticPath;dlg.imgTitle=imgTitle;dlg.Show("dlgImageView");}DlgBox.Std.DataboxView=function(info,pageInfo){if(!info)return;var dlg=new DlgBox((info.name?info.name+" - ":"")+(info.isAd?"Ad Preview":"Databox Preview"),{boxId:info.boxId,layoutName:info.layoutName,viewMode:info.viewMode,itemTags:info.itemTags,pageInfo:pageInfo});if(info.isAd)dlg.oncommand=((typeof DlgAdPreviewProc!=_undef)?DlgAdPreviewProc:null);else dlg.oncommand=((typeof DlgDbxPreviewProc!=_undef)?DlgDbxPreviewProc:null);dlg.Show(info.isAd?"dlgAdPreview":"dlgDbxPreview");}DlgBox.Std.AdEdit=function(info){var dlg=new DlgBox(((info&&info.name)?(info.name+" - "):"")+((info&&info.viewer&&(info.viewer=="adtoaster"))?"Ad Toaster":"Ad Builder"),{boxId:info?info.boxId:null,viewer:info?info.viewer:null,maximizeButton:true});dlg.oncommand=((typeof DlgAdEditProc!=_undef)?DlgAdEditProc:null);dlg.Show("dlgAdEdit");}DlgBox.Std.AdBuild=function(data){var dlg=new DlgBox((data&&data._n?data._n+" - ":"")+"Build Ad");dlg.oncommand=((typeof DlgAdBuildProc!=_undef)?DlgAdBuildProc:null);dlg.data=data;dlg.Show("dlgAdBuild");}DlgBox.Std.VideoView=function(data){var dlg=new DlgBox(data._n);dlg.oncommand=DlgBox.Std.VideoViewProc;dlg.path=data.staticPath;dlg.Show("dlgVideoView");}DlgBox.Std.VideoViewProc=function(id,val){switch(id){case DlgBox.INIT:this.cont=$("ctlCont");this.cont.innerHTML=DlgBox.Std.GetDbxViewEmbedHTML({url:this.path});break;}}DlgBox.Std.DbxEdit=function(action,info){var title="",templ="";switch(action){case"add_item":title="Add Item";templ="dlgDbxAddItem";break;case"add_comment":title="Add Comment";templ="dlgDbxAddComment";break;case"view_comments":title="Comments";templ="dlgDbxComments";break;default:return;}var dlg=new DlgBox(title,{info:info,maximizeButton:true});dlg.oncommand=DlgDbxEditProc;dlg.info.action=action;dlg.Show(templ);}DlgDbxEditProc=function(id,val){switch(id){case DlgBox.INIT:this.SetPadding(0);this.cont=this.$("ctlCont");var size=DlgBox.Std.GetDbxEditDlgSize(this.info.action);Object.extend(this.cont.style,{width:String(size.cx)+"px",height:String(size.cy)+"px"});var wi={viewer:"dbxedit",action:this.info.action,boxId:this.info.boxId,itemId:(this.info.itemId?this.info.itemId:null),authorName:gd.sLoggedUserName};this.cont.innerHTML=DlgBox.Std.GetDbxEditHTML(wi);this.SetFocus("DbxEditWidget",10);break;case"addItem":var dlg=DlgBox.singleton;if(dlg.info&&dlg.info.view&&dlg.info.view.parent)dlg.info.view.SendRequest();break;case DlgBox.IDOK:case DlgBox.IDCANCEL:setTimeout("if(DlgBox.singleton) DlgBox.singleton.Hide();",10);break;}}DlgBox.Std.PreviewBaseWidth=640;DlgBox.Std.DbxViewWidth=function(base){return(base?base:DlgBox.Std.PreviewBaseWidth);}DlgBox.Std.DbxViewHeight=function(base,ratio){return parseInt((base?base:DlgBox.Std.PreviewBaseWidth)/(ratio?ratio:1.2));}DlgBox.Std.GetDbxViewer=function(){return"flashclient";}DlgBox.Std.InitDataboxView=function(cont,vi){if(!cont)return;if(!DetectFlashVer(9,0,115))vi.viewer="playerproductinstall";if(vi.embed){Object.extend(vi,{boxId:vi.box_id,itemId:vi.item_id,parentId:vi.parent_id,itemTags:vi.item_tags,layoutName:vi.layout_name,templateId:vi.template_id,timestamp:vi.timestamp,embed:true,width:cont.clientWidth,height:cont.clientHeight});cont.innerHTML=DlgBox.Std.GetDbxViewEmbedHTML(vi);}else{Object.extend(vi,{boxId:vi.box_id,itemId:vi.item_id,parentId:vi.parent_id,templateId:vi.template_id});if(vi.center)cont.innerHTML='<table cellspacing="0" celpadding="0" border="0" width="100%" height="100%"><tr valign="middle"><td align="center">'+DlgBox.Std.GetDbxViewEmbedHTML(vi)+'</td></tr></table>';else{var style=cont.clientHeight?"margin:"+String(parseInt((cont.clientHeight-DlgBox.Std.DbxViewHeight(vi.baseWidth,vi.ratio))/2))+"px 0px 0px 0px;":"";cont.innerHTML="<div style='"+style+"'>"+DlgBox.Std.GetDbxViewEmbedHTML(vi)+"</div>";}}}DlgBox.Std.GetDbxViewEmbedHTML=function(wi){if(!wi)return"";var url,base;if(wi.viewer.substr(0,7).toLowerCase()=="http://"){url=wi.viewer;base=url.substr(0,url.lastIndexOf("/")+1);if(wi.timestamp)url+="?"+encodeURIComponent(wi.timestamp);}else{url=gd.sFlashAppletsUrl+wi.viewer+".swf";base="/";if(wi.viewer=="flashclient")url+="?"+gd.sFlashClientVer;else if(wi.viewer=="adview")url+="?"+gd.sAdViewVer;else if(wi.timestamp)url+="?"+encodeURIComponent(wi.timestamp);}var width=(wi.width?wi.width:DlgBox.Std.DbxViewWidth(wi.baseWidth));var height=(wi.height?wi.height:DlgBox.Std.DbxViewHeight(wi.baseWidth,wi.ratio));var flashVars="host="+encodeURIComponent(gd.sServerName);if(wi.action)flashVars+="&action="+wi.action;if(wi.boxId)flashVars+="&box_id="+wi.boxId;if(wi.templateId)flashVars+="&template_id="+wi.templateId;if(wi.itemId)flashVars+="&item_id="+wi.itemId;if(wi.parentId)flashVars+="&parent_id="+encodeURIComponent(wi.parentId);if(wi.itemTags)flashVars+="&item_tags="+encodeURIComponent(wi.itemTags);if(wi.layoutName)flashVars+="&layout_name="+wi.layoutName;if(wi.user_name)flashVars+="&user_name="+encodeURIComponent(wi.user_name);else if(_getcookie("last_logged_user"))flashVars+="&user_name="+encodeURIComponent(_getcookie("last_logged_user"));if(wi.view)flashVars+="&view="+wi.view;if(wi.embed)flashVars+="&embed=1";if(wi.page)flashVars+="&page="+wi.page;if(wi.perpage)flashVars+="&per_page="+wi.perpage;if(wi.clickTAG)flashVars+="&clickTAG="+encodeURIComponent(wi.clickTAG);if(wi.urlParams){for(var key in wi.urlParams)flashVars+="&"+encodeURIComponent(key)+"="+encodeURIComponent(wi.urlParams[key]);}var dim="width='"+width+"' height='"+height+"'";var wrBegin="",wrEnd="";if(wi.expand){wrBegin="<div id='divExpandCont' style='position:relative; left:0px; top:0px; width:"+width+"px; height:"+height+"px;'>";wrEnd="</div>";}var embed="<embed id='AdxcelPlayerWidget' src='"+url+"' flashVars='"+flashVars+"' "+dim+" base='"+base+"' allowFullScreen='true' allowScriptAccess='always' salign='TL'"+(wi.wmode?" wmode='"+wi.wmode+"'":"")+" type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer'/>";var objct="<object id='AdxcelPlayerWidget' "+dim+" classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab'>"+"<param name='allowFullScreen' value='true'/>"+"<param name='movie' value='"+url+"'/>"+"<param name='base' value='"+base+"'/>"+"<param name='flashVars' value='"+flashVars+"'/>"+"<param name='salign' value='TL'/>"+(wi.wmode?"<param name='wmode' value='"+wi.wmode+"'>":"")+"<param name='allowScriptAccess' value='always'></object>";return(isIE&&isWin&&!isOpera)?wrBegin+objct+wrEnd:wrBegin+embed+wrEnd;}DlgBox.Std.GetDbxEditHTML=function(wi){if(!wi)return"";var size=DlgBox.Std.GetDbxEditDlgSize(wi.action);if(!size)return;var url=gd.sFlashAppletsUrl+wi.viewer+".swf";var flashVars="host="+encodeURIComponent(gd.sServerName);if(wi.action)flashVars+="&action="+wi.action;if(wi.boxId)flashVars+="&box_id="+encodeURIComponent(wi.boxId);if(wi.itemId)flashVars+="&item_id="+encodeURIComponent(wi.itemId);if(wi.authorName)flashVars+="&author_name="+encodeURIComponent(wi.authorName);var dim="width='"+size.cx+"' height='"+size.cy+"'";var embed="<embed name='DbxEditWidget' src='"+url+"' flashVars='"+flashVars+"' "+dim+" allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer'/>";var objct="<object id='DbxEditWidget' "+dim+" classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab'>"+"<param name='movie' value='"+url+"'/>"+"<param name='flashVars' value='"+flashVars+"'/>"+"<param name='allowScriptAccess' value='always'></object>";return(isIE&&isWin&&!isOpera)?objct:embed;};DlgBox.Std.GetDbxEditDlgSize=function(action){var size={cx:0,cy:0};switch(action){case"add_item":size.cx=716;size.cy=596;break;case"add_comment":size.cx=480;size.cy=360;break;case"view_comments":size.cx=620;size.cy=465;break;default:return null;}return size;}DlgBox.Std.GetDbxViewHTMLTag=function(wi){if(!wi)return"";var script="script";return"<"+script+" type='text/javascript' src='"+wi.htmlTag+"'></"+script+">"+"<noscript><a href='/'><img src='"+wi.thumbnail+"' width='"+wi.width+"' height='"+wi.height+"' border='0' alt=''/></a></noscript>";}TabFactory=function(_oElement,_aData,_size,_oHandler,_skin){this.holder=_oElement;this.data=_aData;this.hnd=_oHandler;this.tabs=[];this.activeTab=null;var pth="/images/";this.IMG_TAB_OUT="tab_out.gif";this.IMG_TAB_DOWN="empty.gif";this.IMG_TAB_OVER="tab_over.gif";this.skin={outSkin:pth+this.IMG_TAB_OUT,overSkin:pth+this.IMG_TAB_OVER,downSkin:pth+this.IMG_TAB_DOWN,height:19};if(_skin)Object.extend(this.skin,_skin);if(_size)this.data.each(function(i){if(!i)return;if(_size.cx)i[2].style.width=parseInt(_size.cx)+"px";if(_size.cy)i[2].style.height=parseInt(_size.cy)+"px";if(_size.cx&&_size.cy)i[2].style.overflow="hidden";});this.constructor=function(){var html='';for(var i=0;i<this.data.length;i++){html+='<div>'+this.data[i][1]+'</div>';this.tabs[i]={name:this.data[i][0],control:null,ground:(this.data[i][2]?this.data[i][2]:null)};}this.holder.innerHTML=html;this.holder.style.height=(this.skin.height+1)+'px';for(var i=0;i<this.holder.childNodes.length;i++){this.tabs[i].control=this.holder.childNodes[i];this.holder.childNodes[i].style.height=this.holder.childNodes[i].style.lineHeight=this.skin.height+'px';this.activateTab(i,false);}this.SwitchTab(0);};this.SwitchTab=function(_i){for(var n=0;n<this.tabs.length;n++)if(_i==this.tabs[n].name)_i=n;if(_i>this.tabs.length-1||_i<0)return false;if(this.activeTab!=null)this.activateTab(this.activeTab,false);this.activeTab=_i;this.activateTab(_i,true);if(this.hnd)this.hnd.call(this,this.data[_i][0],this.data[_i][2]);return true;};this.nextTab=function(){return this.SwitchTab(this.activeTab+1);};this.prevTab=function(){return this.SswitchTab(this.activeTab-1);};this.getActiveTab=function(){return this.tabs[this.activeTab].name;},this.activateTab=function(_i,_bActivate){var tab=this.tabs[_i].control;var ground=this.tabs[_i].ground;if(_bActivate===false){tab.className="TabFactory_Tab";tab.style.background='url('+this.skin.outSkin+')';tab.onclick=this.SwitchTab.bind(this,_i);tab.onmouseover=function(s){this.style.background='url('+s+')'}.bind(tab,this.skin.overSkin);tab.onmouseout=function(s){this.style.background='url('+s+')'}.bind(tab,this.skin.outSkin);if(ground)ground.style.display='none';}else{tab.className="TabFactory_Tab TabFactory_Active";tab.style.background='#ffffff url('+this.skin.downSkin+') repeat-x';tab.onclick=tab.onmouseover=tab.onmouseout=null;if(ground)ground.style.display='block';}};this.constructor();};InfoBox=function(_oAnchor,_w){if(!(_oAnchor instanceof Array))_oAnchor=[_oAnchor];for(var i=0;i<_oAnchor.length;i++){var anch=_oAnchor[i];if(!anch)continue;var btn=document.createElement('img');btn.width="13";btn.height="14";btn.src="/images/info.gif";btn.style.cursor="pointer";if(_w){var txt=anch.innerHTML;anch.innerHTML='<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr valign="top" style="height:24px;">'+'<td style="width:'+(_w-16)+'px;"><img style="width:16px; height:16px; vertical-align:middle;" src="/images/dlg/tipinfo.png"/>&nbsp<b>'+anch.title+'</b></td>'+'<td><img tipclose="1" style="width:16px; height:16px; vertical-align:middle;" '+DlgBox.GetPressBtnBhvr('/images/dlg/tipclose')+'>'+'</td></tr></table>';anch.innerHTML+=txt;anch.title="";}anch.parentNode.insertBefore(btn,anch);anch.className="InfoBox_baloon";anch.style.width=String(_w?_w:400)+"px";var qb=new QuickBox(btn,anch,btn);var cb=anch.getElementsBySelector('img[tipclose="1"]')[0];if(qb&&cb)cb.onclick=function(evt){this.hide();}.bindAsEventListener(qb);}}QuickBox=function(_oBundleElement,_oSourceElement,_oButton){this.control=_oBundleElement;this.base=_oSourceElement;this.initialized=false;this.oninit=null;this.onopen=null;this.init=function(){if(this.initialized)return false;this.base.style.position='absolute';this.base.style.zIndex=2;this.base=document.body.appendChild(this.base.remove());if(this.oninit)this.oninit.call(this);this.initialized=true;};this.open=function(){this.init();if(this.base.visible()){this.hide();return false;}var pos=Position.cumulativeOffset(this.control);this.base.style.left=(pos[0]+2)+"px";this.base.style.top=(pos[1]+this.control.offsetHeight+3)+"px";this.base.show();Event.observe(document.body,'mousedown',this.checkMouseDown.bindAsEventListener(this));Event.observe(document,'keydown',this.checkKeyDown.bindAsEventListener(this));if(this.onopen)this.onopen.call(this);};this.hide=function(){Event.stopObserving(document.body,'mousedown',this.checkMouseDown.bindAsEventListener(this));Event.stopObserving(document,'keydown',this.checkKeyDown.bindAsEventListener(this));this.base.hide();};this.checkKeyDown=function(e){if(e.type=="keydown"&&e.keyCode==Event.KEY_ESC)this.hide();};this.checkMouseDown=function(e){e=e||window.event;var mouPos={x:Event.pointerX(e),y:Event.pointerY(e)};if(_oButton&&Position.within(_oButton,mouPos.x,mouPos.y))return;var trg=Event.element(e);if(trg&&trg.tipclose)return;if(!Position.within(this.base,mouPos.x,mouPos.y))this.hide();};if(_oButton)_oButton.onclick=this.open.bindAsEventListener(this);};ListCtrl=function(_oElement,check){this.listCont=_oElement;this.check=check?true:false;this.rowClsName="ListCtrl_row";this.selClsName="ListCtrl_row ListCtrl_rowSel";this.selIndex=-1;this.originalHeight=0;this.Empty=function(){if(!this.listCont)return;this.listCont.innerHTML="";};this.Fill=function(_data){if(!this.listCont)return;if(!this.originalHeight)this.originalHeight=this.listCont.offsetHeight;if(!this.originalWidth)this.originalWidth=this.listCont.offsetWidth;var html='<table width="100%" cellpadding="0" cellspacing="0">';_img=false;_data.each(function(item){if(item._i){_img=true;throw $break;}});var itemsAdded=0;for(var _i=0,entry;(_i<_data.length)&&(entry=_data[_i]);++_i){var w=entry._cx||16;var h=entry._cy||16;html+='<tr class="'+this.rowClsName+'" style="height:'+(h+2)+'px; display:'+(entry.hidden?"none":"")+';">';if(this.check){var imgEntity='<img src="/images/empty.gif" style="width:'+w+'px; height:'+h+'px; margin:1px;"/>';var inpEntity='<input type="checkbox" value="'+entry.id+'"'+(entry.checked?' checked="checked"':'')+'/>';html+='<td style="width:20px;" align="center">'+(entry.link?imgEntity:inpEntity)+'</td>';}if(_img)html+='<td style="width:20px;" align="center"><img src="'+entry._i+'" style="width:'+w+'px; height:'+h+'px; margin:1px;"/></td>';html+='<td'+(entry._t?' title="'+$U.Str.StripHTML(entry._t)+'"':'')+' style="text-align:left; overflow:hidden;">';var label=$U.Str.StripHTML(entry._n);var lblEntity='<label style="vertical-align:middle;'+(entry.italic?'font-style:italic;':'')+'">'+label+'</label>';var ancEntity='<a style="vertical-align:middle;" href="javascript:" id="'+String(_i)+'">'+label+'</a>';html+='<div style="width:'+Math.max(label.length*7,this.originalWidth-20)+'px;">'+(entry.link?ancEntity:lblEntity)+'</div>';html+='</td></tr>';if(!entry.hidden)itemsAdded++;}html+='</table>';this.listCont.innerHTML=html;if(itemsAdded){var itemHeight=this.listCont.firstChild.offsetHeight/itemsAdded;if(itemHeight)this.listCont.style.height=parseInt(this.originalHeight/itemHeight)*itemHeight+"px";}var tbl=this.listCont.getElementsByTagName("table")[0];if(tbl){var tw=this.listCont.offsetWidth-((this.listCont.offsetHeight<itemsAdded*itemHeight)?(this.listCont.offsetWidth-this.listCont.clientWidth):2);if(tw>0)tbl.style.width=String(tw)+"px";}var rows=this.listCont.getElementsByTagName("tr");for(var _i=0,entry;(_i<rows.length)&&(entry=rows[_i]);_i++){if(!_data[_i].link)entry.onmousedown=this.OnRowClick.bindAsEventListener(this,_i,_data[_i]);var div=entry.children[entry.children.length-1].firstChild;if(div.firstChild&&div.firstChild.offsetWidth)div.style.width=String(div.firstChild.offsetWidth+2)+"px";}var chks=Selector.findChildElements(this.listCont,['input[type="checkbox"]']);for(_i=0;_i<chks.length;_i++)chks[_i].onclick=this.OnRowClick.bindAsEventListener(this,_i,_data[_i]);var anchors=Selector.findChildElements(this.listCont,['a']);for(_i=0;_i<anchors.length;_i++)anchors[_i].onclick=this.OnLinkClick.bindAsEventListener(this,anchors[_i].id,_data[anchors[_i].id]);this.selIndex=-1;};this.OnRowClick=function(evt,selIdx,selItem){var trg=Event.element(evt);while(trg&&(trg.tagName.toLowerCase()!="tr"))trg=trg.parentNode;if(!trg)return;var pt=evt?{x:Event.pointerX(evt),y:Event.pointerY(evt)}:null;var rows=$A(this.listCont.getElementsByTagName("tr"));rows.each(function(i){if(!i)return;i.className=this.rowClsName;}.bind(this));trg.className=this.selClsName;this.selIndex=selIdx;var chks=$A(trg.getElementsByTagName("input"));if(chks.length>0){selItem.checkChanged=(selItem.checked&&!chks[0].checked)||(!selItem.checked&&chks[0].checked);selItem.checked=chks[0].checked;}if(this.onitemclick&&(typeof(this.onitemclick)=="function"))this.onitemclick.call(this.context,selItem,pt);};this.OnLinkClick=function(evt,selIdx,selItem){if(this.onitemclick&&(typeof(this.onitemclick)=="function"))this.onitemclick.call(this.context,selItem,null);};this.SetCheck=function(selIdx,chk){var chks=Selector.findChildElements(this.listCont,['input[type="checkbox"]']);if(selIdx<chks.length)chks[selIdx].checked=chk;};this.selectedIndex=function(){return this.selIndex;};};var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion(){var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}catch(e){version=-1;}}return version;}function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var verMajor=tempArrayMajor[0];var verMinor=tempArrayMajor[1];if(descArray[3]!="")tempArrayMinor=descArray[3].split("r");else tempArrayMinor=descArray[4].split("r");var verRev=tempArrayMinor[1]>0?tempArrayMinor[1]:0;var flashVer=verMajor+"."+verMinor+"."+verRev;}}else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera)flashVer=ControlVersion();return flashVer;}function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision){ver=GetSwfVer();if(ver==0||ver==-1)return false;if(isIE&&isWin&&!isOpera){tempArray=ver.split(" ");tempString=tempArray[1];verArray=tempString.split(",");}else verArray=ver.split(".");var verMajor=verArray[0];var verMinor=verArray[1];var verRev=verArray[2];if(verMajor>parseFloat(reqMajorVer))return true;if(verMajor==parseFloat(reqMajorVer)){if(verMinor>parseFloat(reqMinorVer))return true;if(verMinor==parseFloat(reqMinorVer)&&verRev>=parseFloat(reqRevision))return true;}return false;}ListBox=function(_oElement,_skin){this.IMG_FOLDER="/images/dropdown/";this.IMG_COMBO_ARROW="sel_arrow.gif";this.IMG_COMBO_ARROW_GRAY="sel_arrow_gray.gif";this.IMG_COMBO_UP="sel_up.gif";this.IMG_COMBO_DOWN="sel_up.gif";this.IMG_COMBO_OVER="sel_up.gif";this.skin={upSkin:this.IMG_FOLDER+this.IMG_COMBO_UP,overSkin:this.IMG_FOLDER+this.IMG_COMBO_OVER,downSkin:this.IMG_FOLDER+this.IMG_COMBO_DOWN,arrowSkin:this.IMG_FOLDER+this.IMG_COMBO_ARROW,arrowGraySkin:this.IMG_FOLDER+this.IMG_COMBO_ARROW_GRAY,width:16,height:19};this.refreshView=function(_force){if(this.disabled){this.holder.style.background='#f4f4f4';this.holder.style.borderColor='#afafaf';}else if(this.expanded){this.holder.style.borderColor='#2c628b';this.holder.style.backgroundImage='url('+this.skin.downSkin+')';}else if(this.flagOver){this.holder.style.borderColor='#3c7fb1';this.holder.style.backgroundImage='url('+this.skin.overSkin+')';}else{if(this.skin.invisible){this.holder.style.borderColor='#d8d8d8';this.holder.style.background='window';}else{this.holder.style.borderColor='#a4b4bf';this.holder.style.backgroundImage='url('+this.skin.upSkin+')';}}if(_force){this.arrow.src=this.disabled?this.skin.arrowGraySkin:this.skin.arrowSkin;this.holder.style.color=this.disabled?'#afafaf':'#ffffff';this.holder.style.cursor=this.disabled?'default':'pointer';}};this.DropDownBase(_oElement,_skin);};ListBox.prototype=new DropDownBase();DropDownBox=function(_oElement,_skin){this.IMG_FOLDER="/images/dropdown/";this.IMG_COMBO_UP="combo_up.gif";this.IMG_COMBO_DOWN="combo_up.gif";this.IMG_COMBO_OVER="combo_up.gif";this.IMG_COMBO_GRAY="combo_gray.gif";this.skin={upSkin:this.IMG_FOLDER+this.IMG_COMBO_UP,overSkin:this.IMG_FOLDER+this.IMG_COMBO_OVER,downSkin:this.IMG_FOLDER+this.IMG_COMBO_DOWN,arrowSkin:this.IMG_FOLDER+this.IMG_COMBO_UP,arrowGraySkin:this.IMG_FOLDER+this.IMG_COMBO_GRAY,graySkin:this.IMG_FOLDER+this.IMG_COMBO_GRAY,width:16,height:20,color:"windowtext"};this.refreshView=function(_force){if(this.disabled)this.arrow.src=this.skin.graySkin;else if(this.expanded)this.arrow.src=this.skin.downSkin;else if(this.flagOver)this.arrow.src=this.skin.overSkin;else this.arrow.src=this.skin.upSkin;if(_force){this.holder.style.borderColor=this.disabled?'#afafaf':'#4d8eb4';this.holder.style.background=this.disabled?'#f4f4f4':'#ffffff';this.holder.style.color=this.disabled?'#afafaf':'#ffffff';this.holder.style.cursor=this.disabled?'default':'pointer';}};this.DropDownBase(_oElement,_skin);};DropDownBox.prototype=new DropDownBase();function DropDownBase(){this.value=null;this.selectedIndex=null;this.text=null;this.disabled=false;this.MIN_BOX_WIDTH=75;this.name="DropDownBox_"+Math.ceil(Math.random()*10000000000).toString();this.isReplaced=false;this.width=0;this.expanded=false;this.element=null;this.skin={};this.onchange=null;this.refreshView=function(){};this.DropDownBase=function(_oElement,_skin){this.element=_oElement;this.isReplaced=(this.element.nodeName.toLowerCase()=="select");if(_skin)Object.extend(this.skin,_skin);this.createSceleton();if(this.isReplaced){this.fetch(this.element);if(this.element.onchange)this.onchange=this.element.onchange;this.element.dropdownbox=0;}this.drawInput();};this.createSceleton=function(){var oEl;if(this.isReplaced){if(this.element.style.width)this.width=parseInt(this.element.style.width);else this.width=this.element.offsetWidth;if(this.width<this.MIN_BOX_WIDTH)this.width=this.MIN_BOX_WIDTH;oEl=document.createElement("div");oEl.id="div_"+this.name;oEl.style.width=this.width+"px";oEl.style.height=this.skin.height+"px";this.holder=oEl;this.element.parentNode.insertBefore(oEl,this.element);this.element.style.display="none";}else{this.holder=this.element;var tWidth=parseInt(this.element.style.width);this.width=tWidth>0?tWidth:200;}oEl=document.createElement("div");oEl.style.width=this.width+"px";oEl.className="DropDown_List";this.options=new options(oEl,true);this.options.onclick=this.onoptionclick.bind(this);this.element.parentNode.insertBefore(oEl,this.isReplaced?this.element:this.element.nextSibling);this.holder.className="DropDown_Holder";if(this.skin.color)this.holder.style.color=this.skin.color;var htm='<div class="DropDown_Input" '+'style="width:'+(this.width-24)+'px; height:'+this.skin.height+'px; line-height:'+this.skin.height+'px;">&nbsp;</div>'+'<img src="'+this.skin.arrowSkin+'" width="'+this.skin.width+'" height="'+this.skin.height+'" border="0" class="DropDown_Arrow" />';this.holder.innerHTML=htm;this.input=this.holder.childNodes[0];this.arrow=this.holder.childNodes[1];this.holder.onmousedown=this.click.bindAsEventListener(this);this.holder.onmouseover=this.mouseover.bind(this,true);this.holder.onmouseout=this.mouseover.bind(this,false);this.refreshView();};this.fetch=function(_oSelect){for(var i=0;i<_oSelect.length;i++){this.options.add(_oSelect.options[i].value,_oSelect.options[i].text,null);if(i==0)this.setSelectedIndex(0);else if(i==_oSelect.selectedIndex){this.value=_oSelect.options[i].value;this.text=_oSelect.options[i].text;this.selectedIndex=i;}}};this.drawInput=function(){if(this.selectedIndex==null||this.options[this.selectedIndex]==null){this.input.title="";this.input.innerHTML="";return;}var option=this.options[this.selectedIndex];var html='';if(option.img)html+='<img src="'+option.img+'" class="DropDown_IconS" />&nbsp;';html+=option.text;this.input.title=option.text;this.input.innerHTML=html;};this.expand=function(){if(window.__LastUsedDropDown!=null)window.__LastUsedDropDown.collapse();window.__LastUsedDropDown=this;this.options.show();this.expanded=true;this.refreshView();if(this.selectedIndex!=null)this.options.setActiveOption(this.selectedIndex);Event.observe(document.body,'mousedown',this.ondocclick.bindAsEventListener(this));};this.collapse=function(){if(!this.expanded)return false;Event.stopObserving(document.body,'mousedown',this.ondocclick.bindAsEventListener(this));this.expanded=false;this.refreshView();this.options.hide();};this.onoptionclick=function(_iIndex){this.setSelectedIndex(_iIndex);this.collapse();};this.ondocclick=function(e){var target=Event.element(e);if(target&&target.className=="DropDown_List"){Event.stop(e);return;}this.collapse();};this.mouseover=function(_over){this.flagOver=_over===false?false:true;this.refreshView();};this.click=function(event){if(event)Event.stop(event);if(this.disabled)return;this.expanded?this.collapse():this.expand();};this.disable=function(_bDisable){_bDisable=(_bDisable===false?false:true);this.disabled=_bDisable;this.refreshView(true);};this.fill=function(_data,_selectedValue){if(this.options.length>0)this.clear();this.options.fill(_data);if(_data.length>0){this.setSelectedIndex(0);if(_selectedValue!=null)this.setValue(_selectedValue);}else this.drawInput();};this.clear=function(){this.options.clear();this.value=null;this.selectedIndex=null;this.text=null;this.drawInput();};this.setSelectedIndex=function(_iIndex){if(_iIndex!=null&&this.options[_iIndex]){var changed=(_iIndex!=this.selectedIndex&&this.selectedIndex!=null);this.selectedIndex=_iIndex;this.value=this.options[_iIndex].value;this.text=this.options[_iIndex].text;this.drawInput();if(changed&&this.onchange){this.onchange.call(this);}return true;}return false;};this.setValue=function(_sValue){for(var i=0;i<this.options.length;i++){if(this.options[i].value==_sValue)return this.setSelectedIndex(i);}};}function options(_oHolder,_bDropMode){this.holder=_oHolder;this.dropMode=_bDropMode;this.length=0;this.activeIndex=null;this.MAX_OPTIONS_SHOWN=15;this.onclick=null;this.ontoggle=null;this.ICON_REMOVE='/images/remove_icon.gif';this.ICON_EXPANDED='/images/treeview/tv_o.gif';this.ICON_COLLAPSED='/images/treeview/tv_c.gif';this.ICON_TRANS='/images/empty.gif';this.fill=function(_data){this.clear();for(var i=0;i<_data.length;i++)this.add(_data[i][0],_data[i][1],_data[i][2],_data[i][3]);};this.add=function(_sValue,_sText,_sImage,_oOptions){if(_oOptions==null)_oOptions={};if(typeof(_sValue)=='object'&&_sValue.length){_sImage=_sValue[2];_sText=_sValue[1];_sValue=_sValue[0];}var n=this.length++;if(_oOptions.before_index>=0&&_oOptions.before_index<n){n=_oOptions.before_index;for(var i=this.length-1;i>n;i--){this[i]=this[i-1];var el=this[i].element;el.itemIndex=i;}}this[n]=new option(_sValue,_sText,_sImage);this[n].itemOptions=_oOptions;var el=document.createElement("div");el.className="DropDown_ListItem";el.itemIndex=n;el.title=_sText;if(!_oOptions.unselectable){el.onmousedown=this.click.bindAsEventListener(this,el);el.onmouseover=this.mouseover.bindAsEventListener(this,el);}if(_oOptions.show_pointer)el.style.cursor="pointer";this[n].element=el;var cont=_oOptions.link_mode?'<a href="/'+_sText+'" onclick="return false;">'+_sText+'</a>':_sText;if(_sImage)cont='<img src="'+_sImage+'" class="DropDown_Icon"/>&nbsp;'+cont;if(_oOptions.checkbox)cont='<input type="checkbox" class="DropDown_Checkbox"/>&nbsp;'+cont;if(_oOptions.toggle)cont='<img src="'+(_oOptions.subcontent?this.ICON_COLLAPSED:this.ICON_TRANS)+'" class="TreeList_Icon" />&nbsp;'+cont;el.innerHTML=cont;if(_oOptions.unselectable&&_oOptions.link_mode){var links=el.getElementsByTagName("a");if(links)links[0].onmousedown=this.click.bindAsEventListener(this,el);}if(_oOptions.checkbox){var checkboxes=el.getElementsByTagName("input");if(checkboxes)this[n].checkbox=checkboxes[0];}if(_oOptions.toggle&&_oOptions.subcontent){var toggleEl=el.firstChild;this[n].toggleElement=toggleEl;toggleEl.style.cursor='pointer';}if(_oOptions.delete_button){var del=document.createElement("img");del.src=this.ICON_REMOVE;del.style.cursor='pointer';del.style.clear='none';del.onmousedown=this.delclick.bindAsEventListener(this,el);el.appendChild(del);this[n].deleteElement=del;}this.adjustDropList();if(n==this.length-1)this.holder.appendChild(el);else this.holder.insertBefore(el,this[n+1].element);if(_oOptions.subcontent){var sub=document.createElement("div");sub.className="DropDown_ListSubItem";sub.style.display="none";this.holder.appendChild(sub);this[n].subcontent=sub;}};this.setSubcontent=function(_iIndex,_oContent){this[_iIndex].subcontent.innerHTML='';this[_iIndex].subcontent.appendChild(_oContent);return this[_iIndex].subcontent;};this.setEmptySubcontent=function(_iIndex){this[_iIndex].empty=true;this[_iIndex].toggleElement.src=this.ICON_TRANS;this[_iIndex].subcontent.style.display='none';};this.remove=function(_iIndex){if(this.length==0)return;if(this.activeIndex!=null)this.selectOption(this.activeIndex,false);this.activeIndex=null;this.holder.removeChild(this.holder.childNodes[_iIndex]);for(var i=_iIndex;i<this.length;i++){if(i!=this.length-1){this[i]=this[i+1];var el=this[i].element;el.itemIndex=i;}}this[--this.length]=null;this.adjustDropList();};this.clear=function(){this.holder.innerHTML="";this.length=0;this.activeIndex=null;};this.show=function(){this.holder.style.display="block";};this.hide=function(){this.holder.style.display="none";};this.setActiveOption=function(_iIndex){if(this[_iIndex]&&this[_iIndex].itemOptions.unselectable)return;if(this.activeIndex!=null)this.selectOption(this.activeIndex,false);if(_iIndex!=null&&this[_iIndex])this.activeIndex=_iIndex;this.selectOption(this.activeIndex,true);};this.unselect=function(){if(this.activeIndex!=null)this.selectOption(this.activeIndex,false);this.activeIndex=null;};this.selectOption=function(_iIndex,_bSelect){this[_iIndex].element.className=_bSelect?(this.dropMode?"DropDown_ListItemActive":"PlainList_ListItemSelected"):"DropDown_ListItem";};this.adjustDropList=function(){if(!this.dropMode)return;var n=this.length;if(n==0||n>this.MAX_OPTIONS_SHOWN)n=this.MAX_OPTIONS_SHOWN;this.holder.style.height=(n*18)+"px";};this.mouseover=function(event,elem){if(!this.dropMode)return;var _iIndex=elem.itemIndex;this.setActiveOption(_iIndex);};this.click=function(event,elem){if(event)Event.stop(event);var _iIndex=elem.itemIndex;this.setActiveOption(_iIndex);var expanded=null;if(this[_iIndex].toggleElement)expanded=this.toggleItem(_iIndex);if(this.onclick)this.onclick.call(this,_iIndex,expanded);};this.delclick=function(event,elem){if(event)Event.stop(event);var _iIndex=elem.itemIndex;this.remove(_iIndex);};this.toggleclick=function(event,_iIndex){if(event)Event.stop(event);var expanded=this.toggleItem(_iIndex);if(this.ontoggle)this.ontoggle.call(this,_iIndex,expanded);};this.toggleItem=function(_iIndex){return this.expandItem(_iIndex,this[_iIndex].expanded?false:true)};this.expandItem=function(_iIndex,_bExpand){if(_bExpand==null)_bExpand=true;if(this[_iIndex].empty)return;this[_iIndex].expanded=_bExpand;if(this[_iIndex].toggleElement&&!this[_iIndex].empty)this[_iIndex].toggleElement.src=_bExpand?this.ICON_EXPANDED:this.ICON_COLLAPSED;if(this[_iIndex].subcontent)this[_iIndex].subcontent.style.display=_bExpand?'':'none';return _bExpand;};this.setCheckedValue=function(val){for(var i=0;i<this.length;i++){if(this[i].value==val)this[i].setChecked();}};this.checkedValues=function(){var values=[];for(var i=0;i<this.length;i++){if(this[i].isChecked())values.push(this[i].value);}return values;};}function option(_sValue,_sText,_sImage){this.value=_sValue;this.text=_sText;this.img=_sImage;this.expanded=false;this.element=null;this.subcontent=null;this.checkbox=null;this.isChecked=function(){return(this.checkbox&&this.checkbox.checked);};this.setChecked=function(_bChecked){_bChecked==null&&(_bChecked=true);if(this.checkbox)this.checkbox.checked=_bChecked;};}function PlainList(_oElement){this.value=null;this.selectedIndex=null;this.text=null;this.holder=_oElement;this.onchange=null;this.PlainList=function(){this.holder.className="PlainList";this.options=new options(this.holder);this.options.onclick=this.onoptionclick.bind(this);};this.onoptionclick=function(_iIndex){this.setSelectedIndex(_iIndex);};this.setSelectedIndex=function(_iIndex){if(_iIndex==null||this.options[_iIndex]==null)return;var changed=(_iIndex!=this.selectedIndex||this.selectedIndex==null);this.selectedIndex=_iIndex;this.value=this.options[_iIndex].value;this.text=this.options[_iIndex].text;if(this.onchange)this.onchange.call(this);};this.fill=function(_data,_selectedValue){this.clear();this.options.fill(_data);};this.clear=function(){this.options.clear();this.value=null;this.selectedIndex=null;this.text=null;};this.PlainList();}function TreeList(_oElement,_oRoot,_aParentValues){this.value=null;this.selectedIndex=null;this.text=null;this.disabled=false;this.holder=_oElement;this.branch={};this.onneeddata=null;this.root=_oRoot?_oRoot:this;this.parentValues=_aParentValues==null?[]:_aParentValues;this.activeBranch=null;this.onchange=null;this.TreeList=function(){if(this.parentValues.length==0)this.holder.style.borderWidth="1px";this.options=new options(this.holder);this.options.onclick=this.onoptionclick.bind(this);};this.onoptionclick=function(_iIndex,_bExpanded){this.setSelectedIndex(_iIndex,!_bExpanded);if(_bExpanded!=null)this.onoptiontoggle(_iIndex,_bExpanded);};this.setSelectedIndex=function(_iIndex,_bForce){if(_iIndex==null||this.options[_iIndex]==null)return;var changed=(_iIndex!=this.selectedIndex||this.selectedIndex==null);if(changed||_bForce)this.unselect();this.root.setActiveBranch(this);this.selectedIndex=_iIndex;this.value=this.options[_iIndex].value;this.text=this.options[_iIndex].text;this.options.setActiveOption(_iIndex);if(this.onchange)this.onchange.call(this);};this.setActiveBranch=function(_oTree){if(this.activeBranch)this.activeBranch.unselect();this.activeBranch=_oTree;};this.unselect=function(){if(this.selectedIndex==null)return;if(this.options[this.selectedIndex].subcontent&&this.options[this.selectedIndex].subcontent.treelist)this.options[this.selectedIndex].subcontent.treelist.unselect();this.selectedIndex=null;this.options.unselect();};this.getValues=function(){return this.root.activeBranch?this.root.activeBranch.parentValues.concat(this.root.activeBranch.value):[];};this.getText=function(){return this.root.activeBranch?this.root.activeBranch.text:"";};this.onoptiontoggle=function(_iIndex,_bExpanded){var val=this.options[_iIndex].value;if(_bExpanded&&this.onneeddata&&this.branch[val]==null){this.branch[val]=0;var ld=document.createElement('div');ld.innerHTML=' Loading...';this.options.setSubcontent(_iIndex,ld);this.onneeddata.call(this,this.parentValues.concat(val));}};this.loadData=function(_aValues,_data){var sValue=_aValues.shift();var iIndex=null;for(var i=0;i<this.options.length;i++){if(this.options[i].value==sValue)iIndex=i;}if(iIndex==null)return false;if(_aValues.length>0){this.options[iIndex].subcontent.treelist.loadData(_aValues,_data);return;}this.branch[sValue]=1;if(_data.length==0){this.options.setEmptySubcontent(iIndex);return true;}var ld=document.createElement('div');ld.style.marginLeft='12px';var sub=this.options.setSubcontent(iIndex,ld);ld=new TreeList(ld,this.root,this.parentValues.concat(sValue));ld.fill(_data);sub.treelist=ld;ld.onchange=this.onchange;ld.onneeddata=this.onneeddata;return true;};this.fill=function(_data){this.options.clear();for(var i=0;i<_data.length;i++){if(!_data[i][3])_data[i][3]={};_data[i][3].toggle=1;this.options.add(_data[i][0],_data[i][1],_data[i][2],_data[i][3]);}};this.TreeList();}function CalendarBox(_oHolder,_onchange){if(self.goCalendar==null)self.goCalendar=new cCalendar(self,0,_oHolder);this.calendar=self.goCalendar;this.calendar.onchange=_onchange;this.holder=_oHolder;this.width=this.holder.style.width?parseInt(this.holder.style.width):100;if(!this.holder.style.width)this.holder.style.width="auto";this.input=null;this.button=null;this.frameStart=null;this.frameEnd=null;this.CalendarBox=function(){var html='';html+='<table border="0" cellpadding="0" cellspacing="0" width="'+this.width+'"><tr><td>';html+='<input id="cal_'+this.holder.id+'_input" type="text" style="width:'+(this.width-20)+'px;" class="CalendarBox_input"/>';html+='</td><td width="20">';html+='<img id="cal_'+this.holder.id+'_button" src="/images/calendar.gif" style="cursor:pointer;" width="20" height="20"/>';html+='</td></tr></table>';this.holder.innerHTML=html;this.input=$('cal_'+this.holder.id+'_input');this.button=$('cal_'+this.holder.id+'_button');this.button.onclick=this.open.bind(this);};this.open=function(){var startDate=this.frameStart;if(this.frameStart instanceof Object&&this.frameStart.calendar){startDate=fnString2Date(this.frameStart.input.value);}var endDate=this.frameEnd;if(this.frameEnd instanceof Object&&this.frameEnd.calendar){endDate=fnString2Date(this.frameEnd.input.value);}this.calendar.open(this.input,this.button,startDate,endDate)};this.getValue=function(_asDate){return _asDate?fnString2Date(this.input.value):this.input.value;};this.setValue=function(_sValue){this.input.value=_sValue;};this.setFrame=function(_oStartDate,_oEndDate){this.frameStart=_oStartDate;this.frameEnd=_oEndDate;};this.CalendarBox();};function cCalendar(oWindow,nWeekOffset){this.weekDays=['Su','Mo','Tu','We','Th','Fr','Sa'];this.months=["January","February","March","April","May","June","July","August","September","October","November","December"];this.aShortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.className=null;this.insName=null;this.objWin=null;this.objDoc=null;this.objDiv=null;this.day=null;this.month=null;this.year=null;this.dateFrom=null;this.dateTo=null;this.onchange=null;this.hidden=null;this.weekOffset=null;this.WeekDays=null;this.WeekDaysMap=null;this.monthNames=null;this.inputElement=null;this.buttonElement=null;this.ConDays=null;this.frameStart=null;this.frameEnd=null;this.setDate=Calendar_setDate;this.showAt=Calendar_showAt;this.hide=Calendar_hide;this.checkMouseDown=Calendar_checkMouseDown;this.showAtObject=Calendar_showAtObject;this.getFormatDate=Calendar_getFormatDate;this.open=Calendar_open;this.onDayClick=onDayClick;this.addMonth=Calendar_addMonth;this.addYear=Calendar_addYear;this.redraw=Calendar_redraw;this.createSceleton=Calendar_createSceleton;this.init=Calendar_init;this.className="cCalendar";this.insName=this.className+'_'+(Math.ceil(Math.random()*10000000000)).toString();this.weekOffset=nWeekOffset;if(this.weekOffset==null){this.weekOffset=1;}nLang=2;this.objDiv=oWindow.document.createElement('DIV');this.objDiv.id='div_'+this.insName;this.width=180;this.height=140;this.objDiv.style.position='absolute';this.objDiv.style.zIndex=2;this.objDiv.style.left=-300+"px";this.objDiv.style.top=-300+"px";this.className="cCalendar";this.insName=this.className+'_'+(Math.ceil(Math.random()*10000000000)).toString();oWindow[this.insName]=this;this.objDiv.innerHTML='<iframe id="ifrCalendar" name="ifrCalendar" src="/frames/empty.html" frameBorder="0" width="'+this.width+'" scrolling=no height="'+this.height+'" tabindex=-1></iframe>';this.objDiv=oWindow.document.body.appendChild(this.objDiv);this.inputWindow=oWindow;oWindow[this.insName]=this;this.hidden=true;this.WeekDaysMap=new Array(0,1,2,3,4,5,6);this.WeekDays=this.weekDays;this.monthNames=this.months;for(var i=0;i<this.weekOffset;i++){this.WeekDays.push(this.WeekDays.shift());this.WeekDaysMap.push(this.WeekDaysMap.shift());}}function Calendar_init(){if(this.bIsInit)return;this.createSceleton(this.inputWindow);var oDate=new Date();this.year=oDate.getFullYear();var oDateFrom=new Date(1980,4,11);var oDateTo=new Date(2080,4,11);this.setDate(oDate.getFullYear(),oDate.getMonth(),oDate.getDate());this.bIsInit=true;}function Calendar_showAt(nTop,nLeft){if(nTop)this.objDiv.style.top=nTop+"px";if(nLeft)this.objDiv.style.left=nLeft+"px";this.objDiv.style.display='';this.hidden=false;Event.observe(document.body,'mousedown',this.checkMouseDown.bindAsEventListener(this));};function Calendar_checkMouseDown(e){e=e||window.event;var mouPos={x:Event.pointerX(e),y:Event.pointerY(e)};if(!this.buttonElement||!Position.within(this.buttonElement,mouPos.x,mouPos.y))this.hide();};function Calendar_hide(){Event.stopObserving(document.body,'mousedown',this.checkMouseDown.bindAsEventListener(this));if(this.inputWindow.top.document.getElementsByTagName('frameset').length&&this.inputWindow.top.document.getElementsByTagName('frameset')[0].onresize){this.inputWindow.top.oCurrentCalendar=null;this.inputWindow.top.onresize=null;this.inputWindow.top.document.getElementsByTagName('frameset')[0].onresize=null;}this.objDiv.style.display='none';this.hidden=true;}function Calendar_setDate(sYear,sMonth,sDay){this.day=Math.ceil(sDay);this.month=Math.ceil(sMonth);this.year=Math.ceil(sYear);this.redraw(this.year,this.month);}function Calendar_createSceleton(oWindow){var html='';html+='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';html+='<html><head></head>';html+='<body topmargin=0 leftmargin=0 marginheight="0" marginwidth="0">';html+='<div class="border_calendar" style="width:176px;height:138px;overflow:hidden;">';html+='<div style="padding:2px;" id="cont_years"></div>';html+='<div style="position:absolute;top:27px;left:3px;width:168px;height:110px;" id="cont_days" ></div>';html+='</div></body></html>';var objIframe=oWindow.document.getElementById('ifrCalendar');var oWin=objIframe.contentWindow;if(!oWin&&oWindow.frames['ifrCalendar'])oWin=oWindow.frames['ifrCalendar'].window;var oDoc=oWin.document;with(oDoc){open();write(html);close();};oStyleSheet=oDoc.createElement("LINK");oStyleSheet.setAttribute("rel","stylesheet");oStyleSheet.setAttribute("type","text/css");oStyleSheet.setAttribute("href","/css/calendar.css");oDoc.body.appendChild(oStyleSheet);this.objWin=oWindow.frames['ifrCalendar'];this.objDoc=oDoc;var elTable=oDoc.body.firstChild;this.ConYears=oDoc.getElementById('cont_years');this.ConDays=oDoc.getElementById('cont_days');var nMonth=this.month;var sHTML='';sHTML='<table cellpadding=0 cellspacing=1><tr valign="middle">';sHTML+='<td onClick="window.parent.'+this.insName+'.addYear(1);"><img src="/images/cal_fprev.gif" width="14" height="12"/></td>';sHTML+='<td onClick="window.parent.'+this.insName+'.addMonth(1);"><img src="/images/cal_prev.gif" width="14" height="12"/></td>';sHTML+='<td class="year_text" style="" id="years">'+this.monthNames[nMonth]+', '+this.year+'></td>';sHTML+='<td onClick="window.parent.'+this.insName+'.addMonth();"><img src="/images/cal_next.gif" width="14" height="12"/></td>';sHTML+='<td onClick="window.parent.'+this.insName+'.addYear();"><img src="/images/cal_fnext.gif" width="14" height="12"/></td></tr></table>';this.ConYears.innerHTML=sHTML;this.ObjYears=this.objDoc.getElementById('years');}function Calendar_addYear(sub){this.year=this.year+(sub?-1:1);this.redraw(this.year,this.month);}function Calendar_addMonth(sub){if(sub){if(--this.month<0){this.month=11;this.year--;}}else if(++this.month>11){this.month=0;this.year++;}this.redraw(this.year,this.month);}function Calendar_redraw(_iYear,_iMonth){this.ObjYears.innerHTML=this.monthNames[this.month]+', '+this.year;var bCurrent=false;if(this.year==_iYear&&this.month==_iMonth){bCurrent=true;}var sHTML='';sHTML+='<table cellpadding=0 cellspacing=0 border=0 CLASS="space" STYLE="width:100%;">';sHTML+='<tr>';for(var i=0;i<7;i++)sHTML+='<th width="21" class="mc-td mc-th">'+this.WeekDays[i]+'</th>';sHTML+='</tr>';var oDate=new Date(_iYear,_iMonth,1,0,0,0);var i=0,d=1,over=false;var startOffset=(7+oDate.getDay()-this.weekOffset)%7;var isDisabled=false;do{if(i%7==0)sHTML+="<tr>";isDisabled=this.frameStart&&this.frameStart.getTime()>oDate.getTime()?true:false;if(!isDisabled)isDisabled=this.frameEnd&&this.frameEnd.getTime()<oDate.getTime()?true:false;var sClass="";var sDay="&nbsp;";var sClick="";if(i<startOffset&&isDisabled)sClass="mc-td-d";else if(i<startOffset)sClass="mc-td-e";else if(!over){if(isDisabled)sClass="mc-td-d";else if(d==this.day&&_iMonth==this.month&&_iYear==this.year)sClass="mc-td-c";else if(oDate.getDay()==0)sClass="mc-td-h";else sClass="mc-td-r";if(!isDisabled)sClick=' onclick="window.parent.'+this.insName+'.onDayClick('+_iYear+', '+_iMonth+', '+d+');"';sDay=d;oDate.setDate(++d);if(oDate.getMonth()!=_iMonth)over=true;}else if(isDisabled)sClass="mc-td-d";else sClass="mc-td-e";sHTML+='<td class="mc-td '+sClass+'" '+sClick+'>'+sDay+'</td>';if(i%7==6)sHTML+='</tr>';}while(++i&&!over||i%7!=0);sHTML+='</table>';this.ConDays.innerHTML=sHTML;}function onDayClick(nYear,nMonth,nDay){this.setDate(nYear,nMonth,nDay);if(this.inputElement)this.inputElement.value=this.getFormatDate();this.hide();if(this.onchange){var trg=this.inputElement;while(trg&&(trg.tagName.toLowerCase()!="table"))trg=trg.parentNode;this.onchange({target:(trg?trg.parentNode:null)});}}function Calendar_showAtObject(_oObject,_nShiftX,_nShiftY){var intWidth=this.width;var intHeight=this.height;this.oBindObject=_oObject;this.nBindObjectShiftX=_nShiftX;this.nBindObjectShiftY=_nShiftY;var oElement=_oObject;var intXPos=0;var intYPos=0;while(oElement!=null){intXPos=intXPos+oElement.offsetLeft;intYPos=intYPos+oElement.offsetTop;oElement=oElement.offsetParent;}var intXPos=intXPos+Math.floor(_oObject.offsetWidth/2);var intYPos=intYPos+Math.floor(_oObject.offsetHeight/2);var intShiftX=-Math.floor(_oObject.offsetWidth/2)+_nShiftX;var intShiftY=Math.floor(_oObject.offsetHeight/2)+_nShiftY;var intWScrollTop=this.inputWindow.pageYOffset||this.inputWindow.document.body.scrollTop;var intWScrollLeft=this.inputWindow.pageXOffset||this.inputWindow.document.body.scrollLeft;var intWWidth=(this.inputWindow.innerWidth)?this.inputWindow.innerWidth+intWScrollLeft:this.inputWindow.document.body.offsetWidth+intWScrollLeft;var intWHeight=(this.inputWindow.innerHeight)?this.inputWindow.innerHeight+intWScrollTop:this.inputWindow.document.body.offsetHeight+intWScrollTop;var intBottomSpace=intWHeight-intYPos-intShiftY;var intTopSpace=intYPos-intShiftY-intWScrollTop;var intRightSpace=intWWidth-intXPos-intShiftX;var intLeftSpace=intXPos-intShiftX-intWScrollLeft;if(intWidth>intRightSpace&&intRightSpace<intLeftSpace&&intLeftSpace+intWScrollLeft>=intWidth){intShiftX=-(intShiftX+intWidth);}if(intHeight>intBottomSpace&&intBottomSpace<intTopSpace&&intTopSpace+intWScrollTop>=intHeight){intShiftY=-(intShiftY+intHeight);}this.showAt(intYPos+intShiftY,intXPos+intShiftX);if(this.inputWindow.top.document.getElementsByTagName('frameset').length){var oFrameset=this.inputWindow.top.document.getElementsByTagName('frameset')[0];oFrameset.oCurrentCalendar=this;}this.inputWindow.top.oCurrentCalendar=this;if(oFrameset&&oFrameset.onresize==null){oFrameset.onresize=function(){if(this.oCurrentCalendar&&!this.oCurrentCalendar.hidden){this.oCurrentCalendar.showAtObject(this.oCurrentCalendar.oBindObject,this.oCurrentCalendar.nBindObjectShiftX,this.oCurrentCalendar.nBindObjectShiftY)}}}else{this.inputWindow.top.document.window=this.inputWindow.top;this.inputWindow.top.onresize=function(){if(this.window.oCurrentCalendar&&!this.window.oCurrentCalendar.hidden){this.window.oCurrentCalendar.showAtObject(this.window.oCurrentCalendar.oBindObject,this.window.oCurrentCalendar.nBindObjectShiftX,this.window.oCurrentCalendar.nBindObjectShiftY)}}}}function Calendar_open(_oElement,_oButton,_oStartDate,_oEndDate){var _oCalendar=this;this.frameStart=null;this.frameEnd=null;if(_oStartDate instanceof Date)this.frameStart=new Date(_oStartDate.getFullYear(),_oStartDate.getMonth(),_oStartDate.getDate(),0,0,0);if(_oEndDate instanceof Date)this.frameEnd=new Date(_oEndDate.getFullYear(),_oEndDate.getMonth(),_oEndDate.getDate(),0,0,0);_oCalendar.init();if(!_oCalendar.hidden){_oCalendar.hide();if(_oCalendar.inputElement==_oElement){return false;}}var oDate;if(_oElement.value!=''){oDate=fnString2Date(_oElement.value);}if(!oDate){oDate=new Date();}_oCalendar.inputElement=_oElement;_oCalendar.buttonElement=_oButton?_oButton:_oElement;_oCalendar.setDate(oDate.getFullYear(),oDate.getMonth(),oDate.getDate());_oCalendar.showAtObject(_oButton?_oButton:_oElement,2,0);return true;}function fnString2Date(_sDate){var arrMatch;var intYear,intMonth,intDay;var re=/(\d{1,2})(\/)(\d{1,2})(\/)(\d{2,4})/;aMatch=_sDate.match(re);if(!aMatch)return null;if(aMatch[2]=='/'){intDay=aMatch[3]*1;intMonth=aMatch[1]*1;intYear=aMatch[5]*1;}return new Date(intYear?intYear:2000,intMonth?intMonth-1:0,intDay?intDay:0,0,0,0);}function Calendar_getFormatDate(){var delim='/';var sDate='';sDate+=this.month+1;sDate+=delim;sDate+=this.day;sDate+=delim;sDate+=this.year;return sDate;}var explore={};explore.SplitterPos=-1;explore.SplitterWidth=4;explore.LastBodyClientWidth=0;explore.LastBodyClientHeight=0;explore.BorderWidth=1;explore.MinClientHeight=160;explore.MaxClientHeight=0;explore.MinClientWidth=540;explore.MaxClientWidth=0;explore.MinStgWidth=225;explore.ClientMargin={cx:3,cy:3};var gsNotImplemented="This functionality is not implemented yet.";var gsAreYouSure="Are you sure you want to remove this item?";document.oncontextmenu=function(evt){evt=evt||window.event;var trg=Event.element(evt);if(!(trg.tagName=="INPUT"))Event.stop(evt);};explore.CreateMainMenu=function(mmData){if(typeof Menu==_undef)return;var cont=$("divToolbar");if(!cont)return;var pos=Position.cumulativeOffset(cont);if(!mmData){mmData=[{_n:"Home",act:"window.location='/?home=1';"}];if(typeof DebugMenuData!=_undef)mmData.push(DebugMenuData);}var menu=new Menu(mmData,true);menu.Show({x:0,y:0,w:cont.offsetWidth,h:cont.offsetHeight},null,cont);menu.context=null;menu.oncmdclick=explore.OnCmdClickCallback;}explore.OnCmdClickCallback=function(item){if(item){if(item.act&&(item.act.length>0))eval(item.act);else window.alert(gsNotImplemented);}}explore.OnExplorePageInit=function(noScroller,fixWidth,action){if(noScroller)$$("html")[0].style.overflow="hidden";if(fixWidth)explore.MinClientWidth=explore.MaxClientWidth=fixWidth;var jxClient=$("divMainClient");var fxClient=$("divFlashClient");if(jxClient){var status=$("divStatus");var ctlStg=document.createElement("div");ctlStg.className="StorageLeft";ctlStg.id="divStgClient";var ctlSpl=document.createElement("div");ctlSpl.className="Splitter";ctlSpl.id="divSplitter";var ctlCnt=document.createElement("div");ctlCnt.className="StorageRight";ctlCnt.id="divCntClient";jxClient.appendChild(ctlStg);jxClient.appendChild(ctlSpl);jxClient.appendChild(ctlCnt);Object.extend(jxClient.style,{marginLeft:"auto",marginRight:"auto",marginTop:String(explore.ClientMargin.cy)+"px"});Object.extend(status.style,{marginLeft:"auto",marginRight:"auto",marginTop:String(explore.ClientMargin.cy)+"px"});window.onresize=explore.OnWindowResize.bindAsEventListener(this);explore.OnWindowResize();var ctlTree=document.createElement("div");ctlTree.id="treeStorage";ctlStg.appendChild(ctlTree);if(typeof storage!=_undef){ctlTree.appendChild($U.CreateLoadingMsg(storage.sBuilding,ctlTree,{x:18,y:2}));storage.SendGetStorageRequest({ads:gArgs.ads,templates:gArgs.templates});}else ctlTree.appendChild($U.CreateErrorMsg("Storage object is not defined",ctlTree,{x:18,y:2}));jxClient.style.visibility="visible";status.style.visibility="visible";}else if(fxClient){Object.extend(fxClient.style,{marginLeft:"0px",marginRight:"0px",marginTop:"0px"});window.onresize=explore.OnWindowResize.bindAsEventListener(this);explore.OnWindowResize();var viewInfo={viewer:"flashclient",embed:true};if(action)viewInfo.action=action;DlgBox.Std.InitDataboxView(fxClient,viewInfo);fxClient.style.visibility="visible";}}explore.OnExplorePageDone=function(evt){window.onresize=null;}explore.ResizeScrollers=function(cliWidth,cliHeight){var status=$("divStatus");if(status)status.innerHTML="";var ctlStg=$("divStgClient");var ctlSpl=$("divSplitter");var ctlCnt=$("divCntClient");if(!ctlStg||!ctlSpl||!ctlCnt)return;if(explore.SplitterPos<0)explore.SplitterPos=(explore.MinStgWidth*100)/window.screen.availWidth;var splPos=Math.max(explore.MinStgWidth,Math.ceil((cliWidth*explore.SplitterPos)/100));var stgWidth=splPos-(parseInt(explore.SplitterWidth/2)+explore.BorderWidth);ctlStg.style.width=String(stgWidth-explore.BorderWidth)+"px";ctlStg.style.height=String(cliHeight-explore.BorderWidth*2)+"px";var splWidth=explore.BorderWidth*2+explore.SplitterWidth;ctlSpl.style.width=String(explore.SplitterWidth)+"px";ctlSpl.style.height=String(cliHeight)+"px";var cntWidth=cliWidth-stgWidth-splWidth;ctlCnt.style.width=String(cntWidth-explore.BorderWidth)+"px";ctlCnt.style.height=String(cliHeight-explore.BorderWidth*2)+"px";if(ctlCnt.childNodes&&(ctlCnt.childNodes.length>0)){for(var idx=0;idx<ctlCnt.childNodes.length;idx++){var view=ctlCnt.childNodes[idx].render;if(view&&view.OnWindowResize&&(view.OnWindowResize instanceof Function))view.OnWindowResize.call(view);}}}explore.OnWindowResize=function(evt){if((explore.LastBodyClientWidth!=$U.GetClientWidth())||(explore.LastBodyClientHeight!=$U.GetClientHeight())){explore.LastBodyClientWidth=$U.GetClientWidth();explore.LastBodyClientHeight=$U.GetClientHeight();var status=$("divStatus");var cliWidth=$U.GetClientWidth();var cliHeight=$U.GetClientHeight();var jxClient=$("divMainClient");var fxClient=$("divFlashClient");if(jxClient){cliHeight-=(jxClient.offsetTop+(status?status.offsetHeight:0)+explore.ClientMargin.cy*2);if(explore.MinClientHeight&&(cliHeight<explore.MinClientHeight))cliHeight=explore.MinClientHeight;if(explore.MinClientWidth&&(cliWidth<explore.MinClientWidth))cliWidth=explore.MinClientWidth;if(explore.MaxClientWidth&&(cliWidth>explore.MaxClientWidth)){var gap=parseInt((cliWidth-explore.MaxClientWidth)/2);if(gap<0)gap=0;cliWidth=explore.MaxClientWidth;Object.extend(jxClient.style,{width:String(cliWidth+2)+"px",marginLeft:"auto",marginRight:"auto"});Object.extend(status.style,{width:String(cliWidth)+"px",marginLeft:"auto",marginRight:"auto"});jxClient.style.height=String(cliHeight)+"px";explore.ResizeScrollers(cliWidth+2,cliHeight);}else{Object.extend(jxClient.style,{width:String(cliWidth-explore.ClientMargin.cx*2)+"px",marginLeft:"auto",marginRight:"auto"});Object.extend(status.style,{width:String(cliWidth-explore.ClientMargin.cx*2-2)+"px",marginLeft:"auto",marginRight:"auto"});jxClient.style.height=String(cliHeight)+"px";explore.ResizeScrollers(cliWidth-explore.ClientMargin.cx*2,cliHeight);}}else if(fxClient){cliHeight-=fxClient.offsetTop;if(cliHeight<explore.MinClientHeight)cliHeight=explore.MinClientHeight;fxClient.style.width=String(cliWidth)+"px";fxClient.style.height=String(cliHeight)+"px";var obj=$U.GetFirstElement("object");if(obj)Object.extend(obj,{width:cliWidth,height:cliHeight});}}}explore.StartExplore=function(_oUser){var userName=_oUser?_oUser.user_name:null;if(userName){if(_oUser.keep_user)_setcookie("keep_user","yes");else $U.Cookie.Delete("keep_user");}var stUrl="/";switch(gd.SiteProduct){case 1:stUrl="/explore/?boxes=1";break;case 2:stUrl="/explore/?ads=1";break;case 3:break;}self.location=stUrl;}explore.OnClick=function(evt){evt=evt||window.event;Event.stop(evt);}explore.RssFeedSubscribe=function(evt,url){evt=evt||window.event;Event.stop(evt);var dlg=new DlgBox("RSS Feed",{url:url});dlg.oncommand=((typeof DlgRssFeedProc!=_undef)?DlgRssFeedProc:null);dlg.Show("dlgRssFeed");}explore.ShowSigninDlg=function(evt,uname){evt=evt||window.event;if(evt)Event.stop(evt);var dlg=new DlgBox("Sign In",{name:uname});dlg.oncommand=((typeof DlgSignInProc!=_undef)?DlgSignInProc:null);dlg.Show("dlgSignIn",{x:50,y:40});}explore.ShowSignupDlg=function(evt){evt=evt||window.event;if(evt)Event.stop(evt);var dlg=new DlgBox("Sign Up");dlg.oncommand=((typeof DlgSignUpProc!=_undef)?DlgSignUpProc:null);dlg.Show("dlgSignUp",{x:50,y:40});}explore.OnLoginRequestReady=function(xmlHttp){this.ClearStatus();this.$("btnOK").disabled=false;try{var rspXML=channel.Request.GetResponseXML(xmlHttp);if(!rspXML)throw(channel.sCommonServerError);var response=rspXML.documentElement;if(response.nodeName!="response")throw(channel.sCommonFormatError);var idents=response.getElementsByTagName("identity");if(idents&&(idents.length>0)){var userIDs=idents[0].getElementsByTagName("user_id");if(userIDs&&(userIDs.length>0)){var userID=userIDs[0].firstChild?userIDs[0].firstChild.nodeValue:null;if(userID&&(userID.length==36)){var showWelcome=(idents[0].getElementsByTagName("show_welcome")[0].firstChild.nodeValue==1);var keepBtn=this.$("btnKeepUser");var keepUser=(keepBtn&&keepBtn.checked)?true:false;explore.StartExplore({user_name:$U.GetText("editUserName"),show_welcome:showWelcome,keep_user:keepUser});return;}else throw(channel.sCommonFormatError);}else throw(channel.sCommonFormatError);}var errs=response.getElementsByTagName("error");if(errs&&(errs.length>0)){var err=parseInt(errs[0].getAttribute("id"));this.ShowError(errs[0].getAttribute("msg"));if((err==105)||(err==104)||(err==107)||(err==110)){this.$("editPassword").value="";this.$("editPassword").focus();}else this.$("editUserName").focus();return;}throw(channel.sCommonFormatError);}catch(e){var errMsg=(e.name&&e.message)?(e.name.toString()+": "+e.message.toString()):e.toString();this.ShowError(errMsg);}}explore.OnProfileClicked=function(evt){evt=evt||window.event;Event.stop(evt);var trg=Event.element(evt);var pos=Position.cumulativeOffset(trg);var mdat=[];mdat.push({_n:"Change Password...",cmd:3});mdat.push({_n:"Edit Profile...",cmd:1});mdat.push({_n:"Change Account Info...",cmd:2});var menu=new Menu(mdat);menu.Show({x:pos[0],y:pos[1]+trg.offsetHeight-1,w:trg.offsetWidth});menu.context=null;menu.oncmdclick=explore.OnProfileCmdClickCallback;}explore.OnProfileCmdClickCallback=function(item){if(item){switch(item.cmd){case 1:explore.ShowUsrProfileDlg();break;case 2:explore.ShowUsrAccountDlg();break;case 3:explore.ShowChangePasswordDlg();break;}}}explore.OnDebugClicked=function(evt){evt=evt||window.event;Event.stop(evt);if(typeof DebugMenuData==_undef)return;var trg=Event.element(evt);var pos=Position.cumulativeOffset(trg);if((typeof storage!=_undef)&&storage.pagesMenu){for(var idx=0;idx<DebugMenuData._s.length;idx++){if(!((DebugMenuData._s[idx]._n=="Pages")&&(DebugMenuData._s[idx]._s.length==0)))continue;DebugMenuData._s[idx]._s=[];var items=storage.pagesMenu.getElementsByTagName("item");if(items&&(items.length>0)){for(var k=0;k<items.length;k++)DebugMenuData._s[idx]._s.push({_n:items[k].firstChild.nodeValue,act:items[k].getAttribute("action")});}break;}}var menu=new Menu(DebugMenuData._s);menu.Show({x:pos[0],y:pos[1]+trg.offsetHeight-1,w:trg.offsetWidth});menu.context=null;menu.oncmdclick=explore.OnCmdClickCallback;}explore.OnNewClicked=function(evt){evt=evt||window.event;Event.stop(evt);var trg=Event.element(evt);if(trg.tagName=="SPAN"||trg.tagName=="IMG")trg=trg.parentNode;var pos=Position.cumulativeOffset(trg);var mdat=[];mdat.push({_n:"New Ad...",cmd:1});mdat.push({_n:"New Campaign...",cmd:2});mdat.push({_n:"New Report...",cmd:3});var menu=new Menu(mdat);menu.Show({x:pos[0],y:pos[1]+trg.offsetHeight,w:trg.offsetWidth});menu.context=null;menu.oncmdclick=explore.OnNewCmdClickCallback;}explore.OnNewCmdClickCallback=function(item){if(item){switch(item.cmd){case 1:explore.ShowNewAdDlg(null);break;case 2:explore.ShowNewCampaignDlg(null);break;case 3:explore.ShowEditReportDlg();break;}}}explore.ShowUsrAccountDlg=function(){var dlg=new DlgBox("User Account");dlg.oncommand=((typeof DlgUsrAccountProc!=_undef)?DlgUsrAccountProc:null);dlg.Show("dlgUsrAccount");}explore.ShowUsrProfileDlg=function(){var dlg=new DlgBox("Profile");dlg.oncommand=((typeof DlgUsrProfileProc!=_undef)?DlgUsrProfileProc:null);dlg.Show("dlgUsrProfile");}explore.ShowChangePasswordDlg=function(){var dlg=new DlgBox("Change Password");dlg.oncommand=((typeof DlgChangePasswordProc!=_undef)?DlgChangePasswordProc:null);dlg.Show("dlgChangePassword");}explore.ShowNewBoxDlg=function(item){if(!item)return;var dlg=new DlgBox("New Databox");dlg.oncommand=((typeof DlgNewDataboxProc!=_undef)?DlgNewDataboxProc:null);dlg.Show("dlgNewDatabox");}explore.ShowNewAdDlg=function(item){var dlg=new DlgBox("New Ad");dlg.oncommand=((typeof DlgNewAdProc!=_undef)?DlgNewAdProc:null);if(item&&item.data&&item.data.stor&&(item.data.stor.type=="AdTemplate"))dlg.template={id:item.data.stor.host,name:item.data.stor.name};dlg.Show("dlgNewAd");}explore.ShowNewCampaignDlg=function(item){var dlg=new DlgBox("New Campaign");dlg.oncommand=((typeof DlgNewCampaignProc!=_undef)?DlgNewCampaignProc:null);if(item&&item.data&&item.data.stor&&(item.data.stor.type=="AdBox"))dlg.adbox={id:item.data.stor.host,name:item.data.stor.name,icon:item.data._i};dlg.Show("dlgCampaign");}explore.ShowEditReportDlg=function(data){var dlg=new DlgBox(data?$U.Str.StripHTML(data.name)+" Properties":"New Report",{data:data});dlg.oncommand=((typeof DlgEditReportProc!=_undef)?DlgEditReportProc:null);dlg.Show("dlgEditReport");}explore.ShowPropertiesDlg=function(item){if(!item||!item.data)return;if(storage.IsBox(item.data)||storage.IsTemplate(item.data)||storage.IsConnection(item.data)){var dlg=new DlgBox($U.Str.StripHTML(item.data._n)+" Properties",{data:item.data});dlg.oncommand=((typeof DlgDbxPropertiesProc!=_undef)?DlgDbxPropertiesProc:null);dlg.Show("dlgDbxProperties");}else{var dlg=new DlgBox($U.Str.StripHTML(item.data._n)+" Properties",{data:item.data});dlg.oncommand=((typeof DlgPropertiesProc!=_undef)?DlgPropertiesProc:null);dlg.Show("dlgProperties");}}explore.ShowSelectLayoutsDlg=function(item){if(!item||!item.data)return;var dlg=new DlgBox("Select Layouts",{data:item.data});dlg.oncommand=((typeof DlgSelectLayoutsProc!=_undef)?DlgSelectLayoutsProc:null);dlg.Show("dlgSelectLayouts");}explore.ShowVariationsDlg=function(item){if(!item||!item.data)return;var dlg=new DlgBox("Ad Variations",{data:item.data});dlg.oncommand=((typeof DlgAdVariationsProc!=_undef)?DlgAdVariationsProc:null);dlg.Show("dlgAdVariations");}explore.ShowTrgPolicyDlg=function(item){var createNew=!(item&&item.data&&item.data.stor);var dlg=new DlgBox(createNew?"New Targeting Policy Element":"Targeting Policy Element");dlg.oncommand=((typeof DlgTrgPolicyProc!=_undef)?DlgTrgPolicyProc:null);if(!createNew){var stor=item.data.stor;if(stor.type=="TagType")dlg.data={type:stor.host};else if(stor.type=="ItemTag")dlg.data={name:stor.host};}dlg.Show("dlgTrgPolicy");}explore.ShowTargetDlg=function(item){var createNew=!(item&&item.data&&item.data.stor);var dlg=new DlgBox(createNew?"New Targeting Policy":"Targeting Policy");dlg.oncommand=((typeof DlgTargetProc!=_undef)?DlgTargetProc:null);if(!createNew){var stor=item.data.stor;if(stor.type=="AdComponent")dlg.data={adver:stor.host};else if(stor.type=="Target")dlg.data={id:stor.host,name:stor.name};}dlg.Show("dlgTarget");}function OnTermsLinkClick(){$U.ShowPopupInfoWindow("/help/terms.htm");}function OnPrivacyLinkClick(){$U.ShowPopupInfoWindow("/help/privacy.htm");}function OnFlashClientClick(){$U.ShowPopupGadgetWindow("/widget/?swf=flashclient&embed=1",680,525);}function OnHowToLinkClick(){$U.ShowPopupInfoWindow("/help/howto.htm");}function OnFBLinkClick(){popupWin=window.open("http://apps.facebook.com/adxcelor/");}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 new 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=new Array(),opad=new Array();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=new 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;}