 function initKLayers(){ isDOM=document.getElementById?true:false; isOpera=isOpera5=window.opera && isDOM; isOpera6=isOpera && window.print; isOpera7=isOpera && document.readyState; isMSIE=isIE=document.all && document.all.item && !isOpera; isStrict=document.compatMode=='CSS1Compat'; isNN=isNC=navigator.appName=="Netscape"; isNN4=isNC4=isNN && !isDOM; isMozilla=isNN6=isNN && isDOM; isIE7=isIE&&window.XMLHttpRequest; if(!isDOM && !isNC && !isMSIE && !isOpera){ KLayers=false; return false; } pageLeft=0; pageTop=0; KL_imgCount=0; KL_imgArray=new Array(); KL_imageRef="document.images[\""; KL_imagePostfix="\"]"; KL_styleSwitch=".style"; KL_layerPostfix="\"]"; if(isNN4){ KL_layerRef="document.layers[\""; KL_styleSwitch=""; } if(isMSIE){ KL_layerRef="document.all[\""; } if(isDOM){ KL_layerRef="document.getElementById(\""; KL_layerPostfix="\")"; } KLayers=true; return true; } initKLayers(); function KL_getBody(w){ if(!w) w=window; if(isStrict){ return w.document.documentElement; }else{ return w.document.body; } } function getWindowLeft(w){ if(!w) w=window; if(isMSIE || isOpera7) return w.screenLeft; if(isNN || isOpera) return w.screenX; } function getWindowTop(w){ if(!w) w=window; if(isMSIE || isOpera7) return w.screenTop; if(isNN || isOpera) return w.screenY; } function getWindowWidth(w){ if(!w) w=window; if(isMSIE || isMozilla || isOpera7) return KL_getBody(w).clientWidth; if(isNN || isOpera) return w.innerWidth; return 0; } function getWindowHeight(w){ if(!w) w=window; if(isMSIE) return KL_getBody(w).clientHeight; if(isNN || isOpera) return w.innerHeight; } function getDocumentWidth(w){ if(!w) w=window; if(isMSIE || isOpera7) return KL_getBody(w).scrollWidth; if(isNN) return w.document.width; if(isOpera) return w.document.body.style.pixelWidth; return 0; } function getDocumentHeight(w){ if(!w) w=window; if(isMSIE || isOpera7) return KL_getBody(w).scrollHeight; if(isNN) return w.document.height; if(isOpera) return w.document.body.style.pixelHeight; } function getScrollX(w){ if(!w) w=window; if(isMSIE || isOpera7) return KL_getBody(w).scrollLeft; if(isNN || isOpera) return w.pageXOffset; } function getScrollY(w){ if(!w) w=window; if(isMSIE || isOpera7) return KL_getBody(w).scrollTop; if(isNN || isOpera) return w.pageYOffset; } function preloadImage(imageFile){ KL_imgArray[KL_imgCount]=new Image(); KL_imgArray[KL_imgCount++].src=imageFile; } var KL_LAYER=0; var KL_IMAGE=1; function KL_findObject(what,where,type){ var i,j,l,s; var len=eval(where+".length"); for(j=0;j<len;j++){ s=where+"["+j+"].document.layers"; if(type==KL_LAYER){ l=s+"[\""+what+"\"]"; } if(type==KL_IMAGE){ i=where+"["+j+"].document.images"; l=i+"[\""+what+"\"]"; } if(eval(l)) return l; l=KL_findObject(what,s,type); if(l!="null") return l; } return "null"; } function KL_getObjectPath(name,parent,type){ var l=((parent && isNN4)?(parent+"."):(""))+((type==KL_LAYER)?KL_layerRef:KL_imageRef)+name+((type==KL_LAYER)?KL_layerPostfix:KL_imagePostfix); if(eval(l))return l; if(!isNN4){ return l; }else{ return KL_findObject(name,"document.layers",type); } } function layer(name){ return new KLayer(name,null); } function layerFrom(name,parent){ if(parent.indexOf("document.")<0) parent=layer(parent).path; return new KLayer(name,parent); } function image(name){ return new KImage(name,null); } function imageFrom(name,parent){ if(parent.indexOf("document.")<0) parent=layer(parent).path; return new KImage(name,parent); } function KLayer(name,parent){ this.path=KL_getObjectPath(name,parent,KL_LAYER); this.object=eval(this.path); if(!this.object)return; this.style=this.css=eval(this.path+KL_styleSwitch); } KLP=KLayer.prototype; KLP.isExist=KLP.exists=function(){ return (this.object)?true:false; }; function KL_getPageOffset(o){ var KL_left=0; var KL_top=0; do{ KL_left+=o.offsetLeft; KL_top+=o.offsetTop; }while(o=o.offsetParent); return [KL_left, KL_top]; } KLP.getLeft=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera) return o.offsetLeft-pageLeft; if(isNN4) return o.x-pageLeft; }; KLP.getTop=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera) return o.offsetTop-pageTop; if(isNN4) return o.y-pageTop; }; KLP.getAbsoluteLeft=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera) return KL_getPageOffset(o)[0]-pageLeft; if(isNN4) return o.pageX-pageLeft; }; KLP.getAbsoluteTop=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera) return KL_getPageOffset(o)[1]-pageTop; if(isNN4) return o.pageY-pageTop; }; KLP.getWidth=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera7) return o.offsetWidth; if(isOpera) return this.css.pixelWidth; if(isNN4) return o.document.width; }; KLP.getHeight=function(){ var o=this.object; if(isMSIE || isMozilla || isOpera7) return o.offsetHeight; if(isOpera) return this.css.pixelHeight; if(isNN4) return o.document.height; }; KLP.getZIndex=function(){ return this.css.zIndex; }; KLP.setLeft=KLP.moveX=function(x){ x+=pageLeft; if(isOpera){ this.css.pixelLeft=x; }else if(isNN4){ this.object.x=x; }else{ this.css.left=x+"px"; } }; KLP.setTop=KLP.moveY=function(y){ y+=pageTop; if(isOpera){ this.css.pixelTop=y; }else if(isNN4){ this.object.y=y; }else{ this.css.top=y+"px"; } }; KLP.moveTo=KLP.move=function(x,y){ this.setLeft(x); this.setTop(y); }; KLP.moveBy=function(x,y){ this.moveTo(this.getLeft()+x,this.getTop()+y); }; KLP.moveDown=function(){ if(getWindowHeight()<=this.getHeight()) { kl_scroll_top(this.getAbsoluteTop()); } else { kl_scroll_top(this.getAbsoluteTop()+this.getHeight()-getWindowHeight()); } }; KLP.setZIndex=KLP.moveZ=function(z){ this.css.zIndex=z; }; KLP.setVisibility=function(v){ this.css.visibility=(v)?(isNN4?"show":"visible"):(isNN4?"hide":"hidden"); }; KLP.show=function(){ this.setVisibility(true); }; KLP.hide=function(){ this.setVisibility(false); }; KLP.isVisible=KLP.getVisibility=function(){ return (this.css.visibility.toLowerCase().charAt(0)=='h')?false:true; }; KLP.setBgColor=function(c){ if(isMSIE || isMozilla || isOpera7){ this.css.backgroundColor=c; }else if(isOpera){ this.css.background=c; }else if(isNN4){ this.css.bgColor=c; } }; KLP.setBgImage=function(url){ if(isMSIE || isMozilla || isOpera6){ this.css.backgroundImage="url("+url+")"; }else if(isNN4){ this.css.background.src=url; } }; KLP.setClip=KLP.clip=function(top,right,bottom,left){ if(isMSIE || isMozilla || isOpera7){ this.css.clip="rect("+top+"px "+right+"px "+bottom+"px "+left+"px)"; }else if(isNN4){ var c=this.css.clip; c.top=top; c.right=right; c.bottom=bottom; c.left=left; } }; KLP.scrollTo=KLP.scroll=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){ if(scrollX>this.getWidth()-windowWidth) scrollX=this.getWidth()-windowWidth; if(scrollY>this.getHeight()-windowHeight) scrollY=this.getHeight()-windowHeight; if(scrollX<0)scrollX=0; if(scrollY<0)scrollY=0; var top=0; var right=windowWidth; var bottom=windowHeight; var left=0; left=left+scrollX; right=right+scrollX; top=top+scrollY; bottom=bottom+scrollY; this.moveTo(windowLeft-scrollX,windowTop-scrollY); this.setClip(top,right,bottom,left); }; KLP.scrollBy=KLP.scrollByOffset=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){ var X=-parseInt(this.css.left)+windowLeft+scrollX; var Y=-parseInt(this.css.top)+windowTop+scrollY; this.scroll(windowLeft,windowTop,windowWidth,windowHeight,X,Y); }; KLP.scrollByPercentage=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){ var X=(this.getWidth()-windowWidth)*scrollX/100; var Y=(this.getHeight()-windowHeight)*scrollY/100; this.scroll(windowLeft,windowTop,windowWidth,windowHeight,X,Y); }; KLP.write=function(str){ var o=this.object; if(isNN4){ var d=o.document; d.open(); d.write(str); d.close(); }else{ o.innerHTML=str; } }; KLP.add=function(str){ var o=this.object; if(isNN4){ o.document.write(str); }else{ o.innerHTML+=str; } }; KIP=KImage.prototype; function KImage(name){ this.path=KL_getObjectPath(name,false,KL_IMAGE); this.object=eval(this.path); } KIP.isExist=KIP.exists=function(){ return (this.object)?true:false; }; KIP.getSrc=KIP.src=function(){ return this.object.src; }; KIP.setSrc=KIP.load=function(url){ this.object.src=url; }; KLP.clientHeight=function(){ return this.object.clientHeight; }; KLP.clientWidth=function(){ return this.object.clientWidth; }; KLP.display=function(v){ if(isNN4) { this.setVisibility(v); } else { this.style.display=(v)?(""):("none"); } }; KLP.offsetHeight=function(){ return this.getHeight(); }; KLP.offsetParent=function(){ return this.object.offsetParent; }; KLP.offsetWidth=function(w){ if(w) { this.object.style.width=w; } return this.getWidth(); }; KLP.scrollHeight=function(){ return this.object.scrollHeight; }; KLP.scrollWidth=function(){ return this.object.scrollWidth; }; KLP.set_height=function(h){ if(this.style.height!=h) { this.style.height=h; return true; } return false; }; function kl_error(s,url) { if(!url) url='/js-error.html'; preloadImage(url+'?s='+escape(s)); } function kl_nodeName(o) { if(!o) return ''; if(o.nodeName) return o.nodeName; return ''; } function kl_parentNode(o) { if(!o) return null; if(o.parentNode) return o.parentNode; if(o.parentElement) return o.parentElement; return null; } function kl_scroll_down(s_id) { l=layer(s_id); if(!l.exists()) return false; if(getWindowHeight()<=l.getHeight()) { kl_scroll_top(l.getAbsoluteTop()); } else { kl_scroll_top(l.getAbsoluteTop()+l.getHeight()-getWindowHeight()); } return true; } function kl_scroll_top(pos,w) { if(pos>=0) { if(!w) w=window; w.scrollTo(getScrollX(w),pos); } } var a_onload=[]; var a_ondomload=[]; var b_ondomload_done=false; var b_onload_done=false; var f_onload_old=false; function _cbjs_ondomload_do() { if(b_ondomload_done) return; b_ondomload_done=true; var i; for(i=0;i<a_ondomload.length;i++) a_ondomload[i](); } function _cbjs_onload_do() { if(b_onload_done) return; b_onload_done=true; if(f_onload_old) f_onload_old(); var i; for(i=0;i<a_onload.length;i++) a_onload[i](); } function _cbjs_onload_startup() { f_onload_old=window.onload; window.onload=_cbjs_onload_do; } function _cbjs_ondomload_startup() { if (window.addEventListener) { window.addEventListener("DOMContentLoaded", _cbjs_ondomload_do, false); } if(isIE) { document.write("<script id=\"__ie_onload\" defer=\"defer\" src=\"javascript:void(0)\"><\/script>"); var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { _cbjs_ondomload_do(); } }; } if (/WebKit/i.test(navigator.userAgent)) { var _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { clearInterval(_timer); _cbjs_ondomload_do(); } }, 10); } cbjs_onload(_cbjs_ondomload_do); } function cbjs_check_email(s) { var i,c; var j; var len; if((s.length <= 0) || (s == null) || (s == "")) return false; i = s.indexOf("@"); if(i<=0) return false; if(s.indexOf("@",i+1)!=-1) return false; if(s.indexOf(".",i)<=2) return false; if(s.indexOf(",")!=-1) return false; if(s.indexOf(" ")!=-1) return false; len = s.length; j = s.lastIndexOf(".")+1; if(len-j<2||len-j>4) return false; for(i=0;i<len;i++) { c=s.charCodeAt(i); if(c<=32||c>127) return false; } return true; } function cbjs_document_scroll_width(w) { if(!w) w=window; if(isMSIE || isOpera7 || isMozilla) return KL_getBody(w).scrollWidth; if(isNN) return w.document.width; if(isOpera) return w.document.body.style.pixelWidth; return 0; } function cbjs_form_field_value(o) { if(o.selectedIndex) { if(o.selectedIndex<0) return ''; else return o.options[o.selectedIndex].value; } else return o.value; } function cbjs_nl2br(x) { var s=new String(x); s=s.replace(/\n/g, '<br />'); return s.toString(); } function cbjs_object(id,parent) { return eval(KL_getObjectPath(id,parent,KL_LAYER)); } function cbjs_object_class(o,n) { if(n) o.className=n; return o.className; } function cbjs_object_client_height(o) { return o.clientHeight; } function cbjs_object_client_width(o) { return o.clientWidth; } function cbjs_object_display(o,v) { if(v!==null) { o.style.display=(v)?(""):("none"); } return o.style.display!="none"; } function cbjs_object_event_attach(o,e,a) { if (o.addEventListener) o.addEventListener(e, a, false); else if (o.attachEvent) o.attachEvent('on' + e, a); else return null; } function cbjs_object_offset_height(o,h) { if(h) { o.style.height=h; } if(isMSIE || isMozilla || isOpera7) return o.offsetHeight; if(isOpera) return o.style.pixelHeight; if(isNN4) return o.document.height; return 0; } function cbjs_object_scroll_height(o) { return o.scrollHeight; } function cbjs_select_can_parent() { return isMSIE; } function cbjs_select_can_text() { return isMSIE||isMozilla; } function cbjs_select_get_parent() { if(isMSIE) { return document.selection.createRange().parentElement(); } return null; } function cbjs_select_get_text() { if(isMSIE) { return document.selection.createRange().text; } if(isMozilla) { if(window.getSelection) return window.getSelection(); else return document.getSelection(); } return ''; } function cbjs_select_set_text(s_text) { if(isMSIE) { document.selection.createRange().text=s_text; } return ''; } function cbjs_set_backgroundcolor(o,c) { if(isMSIE || isMozilla || isOpera7){ o.style.backgroundColor=c; }else if(isOpera){ o.style.background=c; }else if(isNN4){ o.style.bgColor=c; } } function cbjs_set_color(o,c) { o.style.color=c; } function cbjs_set_html(o,v) { o.innerHTML=v; } function cbjs_set_text(o,v) { if(isMozilla){ o.textContent=v; }else{ o.innerText=v; } } function cbjs_ondomload(f_function) { if(b_ondomload_done) f_function(); else a_ondomload[a_ondomload.length]=f_function; } function cbjs_onload(f_function) { if(b_onload_done) f_function(); else a_onload[a_onload.length]=f_function; } _cbjs_onload_startup(); _cbjs_ondomload_startup();  function a_attach_edit_add(s_id,i_add,i_count) { if(!document.getElementById) return; var c,d,i,o,p; var o=document.getElementById('a-attach-header-'+s_id); if(o) o.style.display=''; o_body=document.getElementById('a-attach-new-'+s_id); if(!o_body) { debug_error('[a_attach_edit_add] The `a-attach-new-'+s_id+'` element is not found.'); return; } var i_has=0; if(o_body.hasChildNodes()) { var o_item=o_body.firstChild; while(o_item) { if(o_item.style.display=='none') { o_item.style.display=''; return true; } i_has++; o_item=o_item.nextSibling; if(o_item) o_item=o_item.nextSibling; } if(i_has>=i_add) return false; } var o_empty=a_attach_edit_empty(i_count+i_has,i_count>0||i_add>1); o_body.insertBefore(o_empty,null); var o_error=a_attach_edit_empty_error(); o_body.insertBefore(o_error,null); return true; } function a_attach_edit_empty(i_idx,is_remove) { var o=document.createElement('tr'); var c=document.createElement('TD'); c.align='right'; c.innerHTML='<b>'+i_idx+':</b>'; o.appendChild(c); if(is_remove) { c=document.createElement('TD'); c.width=''; c.innerHTML='&nbsp;'; o.appendChild(c); } c=document.createElement('TD'); c.width='100'; c.innerHTML='<input class="admin" type="text" name="new_attach_name[]" value="" style="width:100px;" maxlength="255" />'; o.appendChild(c); c=document.createElement('TD'); c.innerHTML='<input class="admin" type="file" name="new_attach_file[]" />'; o.appendChild(c); c=document.createElement('TD'); c.width="100%"; c.innerHTML='<input class="admin" type="text" name="new_attach_comment[]" value="" style="width:100%;" maxlength="'+i_a_attach_edit_comment_length+'" />'; o.appendChild(c); return o; } function a_attach_edit_empty_error() { var o=document.createElement('tr'); o.style.display='none'; var c=document.createElement('TD'); c.colSpan='5'; c.innerHTML='&nbsp;'; o.appendChild(c); return o; } function a_attach_edit_remove(s_id,i_count) { if(!document.getElementById) return; o_body=document.getElementById('a-attach-new-'+s_id); if(!o_body) { debug_error('[a_attach_edit_remove] The `a-attach-new-'+s_id+'` element is not found.'); return; } var has_visible=false; var has_remove=false; if(o_body.hasChildNodes()) { var o_item=o_body.lastChild; if(o_item) o_item=o_item.previousSibling; while(o_item) { if(o_item.style.display!='none') { var o_input=o_item.getElementsByTagName('input'); var can_remove=true; for(var i=0;i<o_input.length;i++) { if(o_input[i].value.length>0) { can_remove=false; break; } } if(can_remove&&!has_remove) { o_item.style.display='none'; o_item.nextSibling.style.display='none'; has_remove=true; } else has_visible=true; } if(has_remove&&has_visible) break; o_item=o_item.previousSibling; if(o_item) o_item=o_item.previousSibling; } } if(!has_visible&&i_count<1) { var o=document.getElementById('a-attach-header-'+s_id); if(o) o.style.display='none'; } } function a_attach_edit_validate(o_form) { if(!document.getElementById) return; var o_table=o_form.getElementsByTagName('table'); var has_table=false; for(i=0;i<o_table.length;i++) { if(cbjs_object_class(o_table[i])!='a-attach-edit') continue; has_table=true; o_table=o_table[i]; } if(!has_table) { debug_error('[a_attach_edit_validate] The `a-attach-edit` table is not found.'); return false; } var o_body=o_table.getElementsByTagName('tbody'); var b_result=true; for(i_body=0;i_body<o_body.length;i_body++) { var o_tr=o_body[i_body].firstChild; while(o_tr) { var o_input=o_tr.getElementsByTagName('input'); if(o_input.length==0) break; var a_input={ 'save':'', 'save-exists' : false, 'name':'', 'file':'', 'comment':'' }; for(i_input=0;i_input<o_input.length;i_input++) { var s_name=o_input[i_input].name; if(s_name.substr(0,4)=='new_') s_name=s_name.substr(4,s_name.length-4); if(s_name.substr(0,7)=='attach_') s_name=s_name.substr(7,s_name.length-4); s_name=s_name.substr(0,4); switch(s_name) { case 'save': a_input['save']=o_input[i_input].checked; a_input['save-exists']=true; break; case 'name': case 'file': a_input[s_name]=o_input[i_input].value; break; case 'comm': a_input['comment']=o_input[i_input].value; break; } } var has_error=false; var s_error=''; if(!a_input['save-exists']||a_input['save-exists']&&!a_input['save']) { if(a_input['name'].length>255) { has_error=true; s_error=s_error+'<div class="a-validate-message">'+msg_a_attach_edit_name_length+'</div>'; } else if(a_input['name'].length>0&&!a_file_valid(a_input['name'])) { has_error=true; s_error=s_error+'<div class="a-validate-message">'+msg_a_attach_edit_name_character+'</div>'; } if(a_input['comment'].length>i_a_attach_edit_comment_length) { has_error=true; s_error=s_error+'<div class="a-validate-message">'+msg_a_attach_edit_comment_length+'</div>'; } } o_tr=o_tr.nextSibling; if(o_tr) { var o_td=o_tr.firstChild; if(has_error) { b_result=false; o_td.innerHTML=s_error; o_tr.style.display=''; } else o_tr.style.display='none'; o_tr=o_tr.nextSibling; } } } return b_result; } function a_file_valid(s) { if(typeof(s)!='string') return false; if(!s||s.length==0) return false; var l=s.length; if(l>=255) return false; var a_regexp=new RegExp("[0-9a-zA-Z_.-]{"+l+"}"); if(!s.match(a_regexp)) return false; if(s.charAt(0)=='.'||s.charAt(0)=='-'||s.charAt(l-1)=='.'||s.charAt(l-1)=='-') return false; if(s.indexOf('..')!=-1||s.indexOf('--')!=-1) return false; return true; } function a_log_rollback() { return confirm(msg_a_log_rollback); } function a_validate_error(s_id,has_error) { var m=document.getElementById('msg-'+s_id); if(!m) return has_error; m.style.display=has_error?'block':'none'; return has_error; } function a_validate_float(s) { if(!s.length) return false; if(s.length<1||s.length>20) return false; if(!s.match(/^[0-9]{1,10}(\.[0-9]{1,10}){0,1}$/)) return false; return true; } function a_validate_id(s) { if(!s.length) return false; if(!helper_is_id(s)) return false; return true; } function a_validate_zid(s) { if(!s.length) return false; if(s=='0') return true; if(!helper_is_id(s)) return false; return true; } function a_url_protect_unprotect() { var o=document.getElementsByTagName('a'); var s; var a={ 'd':'a','j':'b','q':'c','s':'d','i':'e','e':'f','8':'g','z':'h','a':'i', 'l':'j','x':'k','n':'l','o':'m','.':'n','2':'o','f':'p','b':'q','k':'r', 'g':'s','3':'t','@':'u','w':'v','y':'w','v':'x','9':'y','7':'z','m':'0', '5':'1','u':'2','/':'3','h':'4','p':'5','1':'6','t':'7','c':'8','6':'9', '4':'@','0':'.',':':'/','r':':'}; for(var i=0;i<o.length;i++) { s=o[i].getAttribute('href'); if(!s) continue; if(s.substr(0,8)=='protect:') { s=s.substr(8,s.length-8); var s_result=''; for(var j=0;j<s.length;j++) { var c=s.charAt(j); if(a[c]) s_result+=a[c]; else s_result+=c; } o[i].setAttribute('href',s_result); } if(cbjs_object_class(o[i])=='script') { o[i].style.display='inline'; } } } cbjs_ondomload(a_url_protect_unprotect);  var a_param_field=false; function _a_param_edit_apply_item(a_data,s_concat) { var s_name=a_data['name']; var is_inherit=!a_data['o_inherit']||a_data['o_inherit'].checked; var is_enable=!a_data['o_enable']||a_data['o_enable'].checked; var is_check= a_data['o_check']&&a_data['o_check'].checked|| !a_data['o_check']&&a_data['o_value']&&a_data['o_value'].value.length>0|| !a_data['o_check']&&!a_data['o_value']; var s_value=false; if(a_data['o_value']&&cbjs_form_field_value(a_data['o_value']).length>0) s_value=cbjs_form_field_value(a_data['o_value']); if(s_value) { var a_regexp=new RegExp("[0-9a-zA-Z/,.:_-]{"+s_value.length+"}"); if(!s_value.match(a_regexp)) { debug_error('[a_param] Invalid value: `'+s_value+'`'); alert(msg_a_param_edit_string); return '*'; } var s_type=cbjs_object_class(a_data['o_value']); if(s_type=='id'&&!helper_is_id(s_value)) { alert(msg_a_param_edit_id); return '*'; } } if(is_check) { if(is_enable) { if(is_inherit) { if(s_value) return s_name+'='+s_value; else return s_name; } else { if(s_value) return '~'+s_name+'='+s_value; else return '~'+s_name; } } else { if(is_inherit) { if(s_value) return s_name+'='+s_value+s_concat+'~-'+s_name; else return s_name+s_concat+'~-'+s_name; } else { alert(msg_a_param_edit_nodefine); return '*'; } } } else { if(is_enable) { if(is_inherit) { return '' } else { alert(msg_a_param_edit_enblenoinherit); return '*'; } } else { if(is_inherit) { return '~-'+s_name; } else { return '-'+s_name; } } } debug_error('_a_param_edit_apply_item: internal error'); return '*'; } function a_param_edit_apply() { if(!a_param_field) { debug_error('a_param_edit_apply: can not apply `'+s_field+'` field as it was not initialized.'); return false; } if(!a_param_edit_modified()) return a_param_edit_cancel(); var o_field=document.getElementById(a_param_field['s_field']); if(!o_field) { debug_error('a_param_edit_apply: A field with `'+a_param_field['s_field']+'` name is not exists.'); return false; } var s=new String(o_field.value); var a_param=s.split(/[ \n\r]+/); if(o_field.tagName=='TEXTAREA'||o_field.tagName=='textarea') s_concat="\n"; else s_concat=' '; s_result=''; var a_processed={}; for(i=0;i<a_param.length;i++) { s_src=a_param[i]; if(s_src.length==0) continue; var s=s_src; if(s.charAt(0)=='~') s=s.substr(1); if(s.length==0) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s_src; continue; } if(s.charAt(0)=='-') s=s.substr(1); if(s.length==0) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s_src; continue; } if(s.charAt(0)=='!') { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s_src; continue; } var a_value=s.split('=',2); var s_name=a_value[0]; if(!a_param_field['a_param']['data'][s_name]) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s_src; continue; } if(a_processed[s_name]) continue; var a_data=a_param_field['a_param']['data'][s_name]; if(!a_data['editable']) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s_src; continue; } var s=_a_param_edit_apply_item(a_data,s_concat); if(s=='*') { if(a_data['o_value']) a_data['o_value'].focus(); else if(a_data['o_check']) a_data['o_check'].focus(); else debug_error('a_param_edit_apply: error occured, but no field could be focused.'); return false; } if(s.length>0) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s; } a_processed[s_name]=true; } for(var i=0;i<a_param_field['a_param']['list'].length;i++) { var s_name=a_param_field['a_param']['list'][i]; if(a_processed[s_name]) continue; if(!a_param_field['a_param']['data'][s_name]) continue; var a_data=a_param_field['a_param']['data'][s_name]; if(!a_data['editable']) continue; var s=_a_param_edit_apply_item(a_data,s_concat); if(s=='*') { if(a_data['o_value']) a_data['o_value'].focus(); else if(a_data['o_check']) a_data['o_check'].focus(); else debug_error('a_param_edit_apply: error occured, but no field could be focused.'); return false; } if(s.length>0) { if(s_result.length>0) s_result=s_result+s_concat; s_result=s_result+s; } a_processed[s_name]=true; } o_field.value=s_result; return a_param_edit_cancel(); } function a_param_edit_cancel() { if(!a_param_field) { debug_error('a_param_edit_cancel: can not cancel `'+s_field+'` field as it was not initialized.'); return false; } var s_field=a_param_field['s_field']; a_param_field=false; var o_field=document.getElementById(s_field); if(!o_field) { debug_error('a_param_edit_cancel: A field with `'+s_field+'` name is not exists.'); return false; } o_field.readOnly=false; var o_button=document.getElementById(s_field+'-button'); if(!o_button) debug_error('a_param_edit_cancel: A button for `'+s_field+'` field is not exists.'); else o_button.style.display=''; return http_request_hide('a.param.edit'); } function a_param_edit_modified(is_check) { if(!a_param_field) return false; for(var i=0;i<a_param_field['a_param']['list'].length;i++) { var s_param=a_param_field['a_param']['list'][i]; var a_data=a_param_field['a_param']['data'][s_param]; if(!a_data['editable']) continue; if(a_data['o_check']&&a_data['o_check'].checked!=a_data['check']) return true; if(a_data['o_inherit']&&a_data['o_inherit'].checked!=a_data['inheritable']) return true; if(a_data['o_enable']&&a_data['o_enable'].checked!=a_data['enable']) return true; if(a_data['check']&&a_data['o_value']&&cbjs_form_field_value(a_data['o_value'])!=a_data['value']) { if(is_check) debug_error('[a_param_edit_modified] value is changed for field `'+s_param+'`. Current value: `'+cbjs_form_field_value(a_data['o_value'])+'`; expected: `'+a_data['value']+'`'); return true; } } return false; } function a_param_edit_select_onchange(s_id) { var o1=document.getElementById(s_id+'-check'); var o2=document.getElementById(s_id+'-value'); if(!o1||!o2) return false; if(o2.value.length>0) o1.checked=true; else o1.checked=false; } function a_param_edit_show(s_id,s_url) { if(a_param_edit_modified(true)) { alert(msg_a_param_edit_noedit); return false; } if(a_param_field) a_param_edit_cancel(); return http_request_show('a.param.edit',s_id,s_id,s_url,'<span class="loading">'+msg_a_param_edit_loading+'</span>',a_param_edit_startup,false,false,DEBUG_MODE); } function a_param_edit_show_button(s_field_id) { var o=document.getElementById(s_field_id+'-button'); if(o) o.style.display=''; else debug_error('a_param_edit_show_button: buttun not exists: `'+s_field_id+'`'); } function a_param_edit_startup(a_data) { if(!a_data['s_field']) { debug_error('a_param_edit_startup: s_field is not passed by server.'); return false; } if(!a_data['s_form']) { debug_error('a_param_edit_startup: s_field is not passed by server.'); return false; } var o_field=document.getElementById(a_data['s_field']); if(!o_field) { debug_error('a_param_edit_startup: A field with `'+a_data['s_field']+'` name is not exists.'); return false; } var a_param=a_param_explode(o_field.value); var o_form=document.getElementById(a_data['s_form']); if(!o_form) { debug_error('a_param_edit_startup: A form with `'+a_data['s_form']+'` id is not exists.'); return false; } var a_input=o_form.getElementsByTagName('input'); var a_select=o_form.getElementsByTagName('select'); var a=[]; for(var i=0;i<a_input.length;i++) a[a.length]=a_input[i]; for(var i=0;i<a_select.length;i++) a[a.length]=a_select[i]; a_input=a; a_param['a_input']={}; for(var i=0;i<a_input.length;i++) { var s_name=a_input[i].getAttribute('id'); if(!s_name) continue; if(s_name.substr(0,a_data['s_field'].length)!=a_data['s_field']) continue; var s=s_name.substr(a_data['s_field'].length+1); if(!s.length) continue; var p=s.lastIndexOf('-'); if(p<0) { debug_error('A `-` is not found in the field name ('+p+'): '+s); continue; } var s_param=s.substr(0,p); var s_type=s.substr(p+1); a_param['a_input'][s_name]={'s_param': s_param, 's_type' : s_type}; if(!a_param['data'][s_param]) { a_param['list'][a_param['list'].length]=s_param; a_param['data'][s_param]={ 'name' : s_param, 'src' : '', 'value' : '', 'inheritable' : true, 'check' : false, 'enable' : true, 'editable' : true, 'o_check' : false, 'o_enable' : false, 'o_inherit' : false, 'o_value' : false }; } is_editable=a_param['data'][s_param]['editable']; if(!is_editable) continue; if(is_editable&&s_type!='check'&&s_type!='enable'&&s_type!='inherit'&&s_type!='value') { debug_error('a_param_edit_startup: A field for `+s_param+` has an invalid type: `'+s_type+'`'); is_editable=false; } if(is_editable&&a_param['data'][s_param]['o_'+s_type]) { debug_error('Multiple fields for param `'+s_param+'` of type `'+s_type+'`'); is_editable=false; } if(is_editable) a_param['data'][s_param]['o_'+s_type]=a_input[i]; else a_param['data'][s_param]['editable']=false; } for(var i=0;i<a_param['list'].length;i++) { var s_param=a_param['list'][i]; var o=document.getElementById(a_data['s_field']+'-'+s_param+'-block'); if(!o) { if( a_param['data'][s_param]['o_check']|| a_param['data'][s_param]['o_inherit']|| a_param['data'][s_param]['o_enable']|| a_param['data'][s_param]['o_value'] ) debug_error('a_param_edit_startup: `'+a_data['s_field']+'-'+s_param+'-block` container not found.'); a_param['data'][s_param]['editable']=false; continue; } if(a_param['data'][s_param]['editable']&&a_param['data'][s_param]['value'].length>0&&!a_param['data'][s_param]['o_value']) { debug_error('a_param_edit_startup: `'+s_param+'` parameter is disabled because its declaration has a value, but the form does not allow to edit values.'); a_param['data'][s_param]['editable']=false; } if(a_param['data'][s_param]['editable']&&a_param['data'][s_param]['value'].length==0&&!a_param['data'][s_param]['o_check']&&a_param['data'][s_param]['check']) { debug_error('a_param_edit_startup: field `'+s_param+'` disabled because the form requires a value, but the param string contains a defenition without any values.'); a_param['data'][s_param]['editable']=false; } if(a_param['data'][s_param]['editable']&&!a_param['data'][s_param]['o_value']&&!a_param['data'][s_param]['o_check']) { debug_error('a_param_edit_startup: `'+s_param+'` parameter is disabled because neither value, nor check field found.'); a_param['data'][s_param]['editable']=false; } if(a_param['data'][s_param]['editable']&&!a_param['data'][s_param]['o_enable']) { debug_error('a_param_edit_startup: field `'+s_param+'` disabled because required `o_enable` field is not contained in the form.'); a_param['data'][s_param]['editable']=false; } if(a_param['data'][s_param]['editable']&&!a_param['data'][s_param]['o_inherit']) { debug_error('a_param_edit_startup: field `'+s_param+'` disabled because required `o_inherit` field is not contained in the form.'); a_param['data'][s_param]['editable']=false; } if(!a_param['data'][s_param]['editable']) { debug_error('a_param_edit_startup: A disabled field found: '+s_param); if(DEBUG_MODE) { o.style.backgroundColor='#eeeeee'; var o=document.getElementById(a_data['s_field']+'-'+s_param+'-check'); if(o) o.disabled=true; var o=document.getElementById(a_data['s_field']+'-'+s_param+'-enable'); if(o) o.disabled=true; else debug_error('a_param_edit_startup: The `'+a_data['s_field']+'-'+s_param+'-enable` field could not be disabled as it is not found.'); var o=document.getElementById(a_data['s_field']+'-'+s_param+'-inherit'); if(o) o.disabled=true; var o=document.getElementById(a_data['s_field']+'-'+s_param+'-value'); if(o) o.disabled=true; } else { o.style.display='none'; } continue; } o.style.display=''; if(a_param['data'][s_param]['o_check']) a_param['data'][s_param]['o_check'].checked=a_param['data'][s_param]['check']; if(a_param['data'][s_param]['o_inherit']) a_param['data'][s_param]['o_inherit'].checked=a_param['data'][s_param]['inheritable']; if(a_param['data'][s_param]['o_enable']) a_param['data'][s_param]['o_enable'].checked=a_param['data'][s_param]['enable']; if(a_param['data'][s_param]['o_value']) a_param['data'][s_param]['o_value'].value=a_param['data'][s_param]['value']; } for(var i=0;i<a_input.length;i++) { var s_id=a_input[i].getAttribute('id'); if(!a_param['a_input'][s_id]) continue; var s_param=a_param['a_input'][s_id]['s_param']; if(!a_param['data'][s_param]['editable']) continue; if(a_param['data'][s_param]['o_value']) { a_param['data'][s_param]['o_value'].focus(); break; } if(a_param['data'][s_param]['o_check']) { a_param['data'][s_param]['o_check'].focus(); break; } } a_param_field={ 's_field' : a_data['s_field'], 's_form' : a_data['s_form'], 'a_param' : a_param }; o_field.readOnly=true; var o_button=document.getElementById(a_data['s_field']+'-button'); if(!o_button) debug_error('a_param_edit_startup: A button for `'+s_field+'` field is not exists.'); else o_button.style.display='none'; return true; } function a_param_explode(s_param) { var s=new String(s_param); var a=s.split(/[ \n\r]+/); var a_result={'list':[],'data':{}}; var is_editable=false; var is_inheritable=false; var is_enable=false; for(i=0;i<a.length;i++) { s=a[i]; if(s.length==0) continue; is_editable=true; if(s.charAt(0)=='~') { s=s.substr(1); is_inheritable=false; } else { is_inheritable=true; } if(s.length==0) continue; if(s.charAt(0)=='-') { s=s.substr(1); is_enable=false; if(!is_inheritable) is_inheritable=true; else is_inheritable=false; } else { is_enable=true; } if(s.length==0) continue; if(s.charAt(0)=='!') { debug_error('a_param_explode: field `'+s+'` is disabled bocause it has used an unimplemented `!` modifier.'); s=s.substr(1); is_editable=false; } var a_value=s.split('=',2); var s_name=a_value[0]; if(a_value.length==2) { s_value=a_value[1]; if(s_value.length==0) { debug_error('a_param_explode: field `'+s+'` is disabled bocause its defenition contains a value of a zero length.'); is_editable=false; } if(is_editable&&!is_enable) { debug_error('a_param_explode: field `'+s+'` is disabled bocause its has a syntax error. `-` properies can no contain values.'); is_editable=false; } } else s_value=''; if(a_result['data'][s_name]) { if(is_editable&&!a_result['data'][s_name]['editable']) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause it vas disabled by a previous declaration.'); is_editable=false; } if(is_editable&&!a_result['data'][s_name]['enable']) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause there were a prevous `-` declaraion.'); is_editable=false; } if(is_editable&&!a_result['data'][s_name]['inheritable']) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause there were a prevous non-inheritable declaraion.'); is_editable=false; } if(is_editable&&s_value.length>0) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause repeatable declarations can not contain a value.'); is_editable=false; } if(is_editable&&!is_inheritable) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause only inheritable declaraions are allowed to repeat.'); is_editable=false; } if(is_editable&&is_enable) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause only disabling declaraions are allowed to repeat.'); is_editable=false; } if(is_editable&&!a_result['data'][s_name]['check']) { debug_error('a_param_explode: parameter `'+s+'` is disabled bocause previous declaration is not marked as inclisive.'); is_editable=false; } if(is_editable) { a_result['data'][s_name]['enable']=false; } else { a_result['data'][s_name]['editable']=false; } } else { a_result['list'][a_result['list'].length]=s_name; a_result['data'][s_name]={ 'name' : s_name, 'src' : s, 'value' : s_value, 'inheritable' : is_inheritable, 'check' : is_enable||s_value.length>0, 'enable' : is_enable, 'editable' : is_editable, 'o_check' : false, 'o_enable' : false, 'o_inherit' : false, 'o_value' : false }; } } return a_result; } function a_param_list_switch(s_id) { var o=document.getElementById(s_id); if(!o) return; if(o.style.display=='none') o.style.display='block'; else o.style.display='none'; return false; }  function cms_language_code_remove(s) { return confirm(msg_cms_language_code_remove+"\n\n"+s); }  var debug_info_visible=true; var debug_message_has=false; function debug_info_error() { if(isDOM) { var o=document.getElementById('debug-info-error'); if(o) o.style.display=''; } } function debug_info_trigger() { debug_info_visible=debug_info_visible?false:true; if(document.getElementById) { var val=debug_info_visible?'block':'none'; if(debug_message_has) { var o=document.getElementById('debug-message'); if(o) o.style.display=val; } var a_list=document.getElementsByTagName('div'); var i=0; for (i=0;i<a_list.length;i++) { if(a_list[i].className=='debug-info') a_list[i].style.display=val; } var a_list=document.getElementsByTagName('pre'); for (i=0;i<a_list.length;i++) { if(a_list[i].className=='debug-info') a_list[i].style.display=val; } var a_list=document.getElementsByTagName('iframe'); for (i=0;i<a_list.length;i++) { if(a_list[i].className=='debug-info') a_list[i].style.display=val; } var o_link=document.getElementById('debug-info-link'); if(o_link) o_link.innerHTML=debug_info_visible?'Hide debug info':'Show debug info'; return; } if(isNN4) { document.ErrorOccured.visibility='show'; val=debug_info_visible?'show':'hide'; for (i=0;i<document.layers.length;i++) { whichEl=document.layers[i]; if(whichEl.id.indexOf("debug_info")!=-1) whichEl.visibility=val; } return; } } function debug_error(s_message) { if(!DEBUG_MODE) return; if(isDOM) { var o=document.getElementById('debug-info-error-js'); if(o) o.style.display=''; var o=document.getElementById('debug-message'); if(!o) return; if(debug_message_has) o.innerHTML=o.innerHTML+'<br />'+s_message; else o.innerHTML='JavaScript errors occured: <br />'+s_message; debug_message_has=true; return; } } function debug_info(s_message) { if(!DEBUG_MODE) return; if(isDOM) { var o=document.getElementById('debug-message'); if(!o) return; o.innerHTML=o.innerHTML+'<br />'+s_message+'<br />'; debug_message_has=true; return; } } function debug_startup() { debug_info_trigger(); } cbjs_onload(debug_startup);  function image_upload_add(s_id,i_count) { var c,d,i,o,p; if(!document.getElementById) { if(DEBUG_MODE) alert('image_upload_add: document.getElementById not allowed'); return; } var c=document.getElementById('image-upload-header-'+s_id); if(c) c.style.display=''; c=document.getElementById('image-upload-table-'+s_id); if(!c) { if(DEBUG_MODE) alert('image_upload_add: image-upload-table not found'); return; } p=false; for(i=0;i<i_count;i++) { d=document.getElementById('image-upload-item-'+i+'-'+s_id); if(d) { if(d.style.display!='none') { p=d; continue; } d.style.display=''; return; } o = image_upload_empty(i,s_id); if(!p) { if(c.hasChildNodes()) { c.insertBefore(o,c.firstChild); } else { c.insertBefore(o,null); } } else if(p&&p.nextSibling) { c.insertBefore(o,p.nextSibling); } else { c.insertBefore(o,null); } return; } } function image_upload_remove(s_id,i_count) { if(!document.getElementById) return; var i,c,c1; var has_visible=false; for (i=i_count-1;i>=0;i--) { c=document.getElementById('image-upload-item-'+i+'-'+s_id); if(!c||c.style.display=='none') continue; if(document.getElementById('image-upload-check-'+i+'-'+s_id)) { has_visible=true; continue; } c1=document.getElementById('image-upload-file-'+i+'-'+s_id); if(c1&&c1.value.length!=0) { has_visible=true; continue; } c1=document.getElementById('image-upload-comment-'+i+'-'+s_id); if(c1&&c1.value.length!=0) { has_visible=true; continue; } c.style.display='none'; if(i>0) has_visible=true; break; } if(!has_visible) { var c1=document.getElementById('image-upload-header-'+s_id); if(c1) c1.style.display='none'; } } function image_upload_empty(idx,s_id) { var o=document.createElement('tr'); o.id='image-upload-item-'+idx+'-'+s_id; var c=document.createElement('TD'); c.align='right'; c.innerHTML='<b>'+idx+':</b>'; o.appendChild(c); c=document.createElement('TD'); c.align='right'; c.innerHTML='&nbsp;'; o.appendChild(c); c=document.createElement('TD'); c.innerHTML='<input class="admin" type="file" id="image-upload-file-'+idx+'-'+s_id+'" name="imf'+idx+'" />'; o.appendChild(c); c=document.createElement('TD'); c.width="100%"; c.innerHTML='<input class="admin" type="text" id="image-upload-comment-'+idx+'-'+s_id+'" name="imt'+idx+'" style="width:100%;" value="" />'; o.appendChild(c); return o; }  function date_mysql_valid(s_mysql) { var s_date_time=new String(s_mysql); var a_date_time=s_date_time.split(' ',3); if(a_date_time.length!=1&&a_date_time.length!=2) return false; var s_date=new String(a_date_time[0]); var a_date=s_date.split('-',4); if(a_date.length!=3) return false; if(!date_valid_date(a_date[0],a_date[1],a_date[2])) return false; if(a_date_time.length==1) return true; var s_time=new String(a_date_time[1]); var a_time=s_time.split(':',4); if(a_time.length!=3) return false; if(!date_valid_time(a_time[0],a_time[1],a_time[2])) return false; return true; } function date_mysql_zero(s_mysql) { return s_mysql=='0000-00-00'||s_mysql=='0000-00-00 00:00:00'; } function date_valid_date(y,m,d) { if(!date_valid_number(y)||!date_valid_number(m)||!date_valid_number(d)) return false; if(y<=0||y>9999) return false; if(m<1||m>12) return false; var _MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31); if(date_year_leap(y)) _MD[1]++; if(d<1||d>_MD[m-1]) return false; return true; } function date_valid_number(x) { var s=new String(x); if(!s.match(/^[0-9]{1,4}$/)) return false; var n=parseInt(x); if(n<0||n>9999) return false; return true; } function date_valid_time(h,m,s) { if(!date_valid_number(h)||!date_valid_number(m)||!date_valid_number(s)) return false; if(h<0||h>=24) return false; if(m<0||m>=60) return false; if(s<0||s>=60) return false; return true; } function date_year_leap(y) { return (y%4==0)&&(y%100!=0)||(y%400==0); }  function helper_favorite(title,url) { if (window.sidebar) { window.sidebar.addPanel(title, url, ""); } else { if(window.opera && window.print) { var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all) { window.external.AddFavorite(url, title); } else { alert(msg_helper_favorite); } } return false; } function helper_is_href_http(s) { var i; var len; if((s.length <= 0) || (s == null) || (s == "")) return false; if(s.substr(0,7)!='http://') return false; len = s.length; for(i=0;i<len;i++) { c=s.charCodeAt(i); if(c<=32||c>127) return false; } return true; } function helper_is_id(s) { if(!helper_is_u8(s)) return false; if(s<=0||s>9223372036854775807) return false; return true; } function helper_is_id32(s) { if(!helper_is_integer(s)) return false; if(s<=0||s>2147483647) return false; return true; } function helper_is_integer(s) { if(s.length<1||s.length>10) return false; if(!s.match(/^[0-9]{1,10}$/)) return false; return true; } function helper_is_u8(s) { if(s.length<1||s.length>20) return false; if(!s.match(/^[0-9]{1,20}$/)) return false; return true; } o_helper = { is_even:true, do_onload: function() { o_helper.table_prepare(document); }, table_mouse_out: function(e) { var d = window.event ? window.event.srcElement : e.currentTarget; while(d) { if(d.tagName=='TR') { var c=cbjs_object_class(d); if(c=='o'||c=='o1'||c=='e'||c=='e1') break; } d=d.parentNode; } if(d) { cbjs_set_backgroundcolor(d,''); var d1=d; while((d1=d1.nextSibling)&&(cbjs_object_class(d1)=='o1'||cbjs_object_class(d1)=='e1')) cbjs_set_backgroundcolor(d1,''); var d1=d; while((cbjs_object_class(d1)=='o1'||cbjs_object_class(d1)=='e1')&&(d1=d1.previousSibling)) cbjs_set_backgroundcolor(d1,''); } }, table_mouse_over: function(e) { var d = window.event ? window.event.srcElement : e.currentTarget; while(d) { if(d.tagName=='TR') { var c=cbjs_object_class(d); if(c=='o'||c=='o1'||c=='e'||c=='e1') break; } d=d.parentNode; } if(d) { cbjs_set_backgroundcolor(d,c_interline_current); var d1=d; while((d1=d1.nextSibling)&&(cbjs_object_class(d1)=='o1'||cbjs_object_class(d1)=='e1')) cbjs_set_backgroundcolor(d1,c_interline_current); var d1=d; while((cbjs_object_class(d1)=='o1'||cbjs_object_class(d1)=='e1')&&(d1=d1.previousSibling)) cbjs_set_backgroundcolor(d1,c_interline_current); } }, table_prepare: function(o_parent) { var a = o_parent.getElementsByTagName('TABLE'); var i; for(i=0;i<a.length;i++) { var c=cbjs_object_class(a[i]); if(!c||c!='interline') continue; o_helper.table_prepare_table(a[i]); } }, table_prepare_table: function(o_table) { o_helper.is_even=true; if(!o_table.hasChildNodes()) return; var o=o_table.firstChild; while(o) { if(o.tagName=='TR') o_helper.table_prepare_tr(o); else if (o.tagName=='TBODY') o_helper.table_prepare_tbody(o); o=o.nextSibling; } }, table_prepare_tbody: function(o_tbody) { if(!o_tbody.hasChildNodes()) return; var o=o_tbody.firstChild; while(o) { if(o.tagName=='TR') o_helper.table_prepare_tr(o); o=o.nextSibling; } }, table_prepare_tr: function(o_tr) { if(cbjs_object_class(o_tr)=='head'||cbjs_object_class(o_tr)=='noflash') return; if(!cbjs_object_class(o_tr)||cbjs_object_class(o_tr).length==0) { if(o_helper.is_even) cbjs_object_class(o_tr,'e'); else cbjs_object_class(o_tr,'o'); o_helper.is_even=!o_helper.is_even; } cbjs_object_event_attach(o_tr,'mouseover',o_helper.table_mouse_over); cbjs_object_event_attach(o_tr,'mouseout',o_helper.table_mouse_out); } }; cbjs_ondomload(o_helper.do_onload);  var http_request_open={}; function http_request_hide(s_service) { if(!s_service) return true; if(!http_request_open[s_service]) return true; var c=http_request_open[s_service]; http_request_open[s_service]=false; if(c[0]) { var l_style=layer(c[0]); if(l_style.exists()) l_style.display(false); } if(c[1]) { var l_html=layer(c[1]); if(l_html.exists()) l_html.write(''); } return false; } function http_request_show(s_service,id_style,id_html,url,msg,f_onload,a_data,is_nomove,is_nocache,s_loader,s_method) { http_request_hide(s_service); http_request_open[s_service]=[id_style,id_html]; if(id_style) { var l_style=layer(id_style); if(!l_style.exists()) { debug_error('http_request_show: id not exists: '+id_style); return true; } l_style.display(true); } var l_html=layer(id_html); if(!l_html.exists()) { debug_error('http_request_show: id not exists: '+id_html); return true; } l_html.write(msg); var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { l_html.write(req.responseText); window.setTimeout(function() { if(f_onload) f_onload(req.responseJS,id_style,id_html); if(!is_nomove) { if(getWindowHeight()<=l_html.getHeight()) { kl_scroll_top(l_html.getAbsoluteTop()); } else { kl_scroll_top(l_html.getAbsoluteTop()+l_html.getHeight()-getWindowHeight()); } } }, 100); } }; if(is_nocache) req.caching = false; else req.caching = true; if(s_loader) req.loader=s_loader; else req.loader='SCRIPT'; if(!s_method) s_method='GET'; req.open(s_method, url, true); if(a_data) req.send(a_data); else req.send({ }); return false; }  function JsHttpRequest() { var t = this; t.onreadystatechange = null; t.readyState = 0; t.responseText = null; t.responseXML = null; t.status = 200; t.statusText = "OK"; t.responseJS = null; t.caching = false; t.loader = null; t.session_name = "PHPSESSID"; t._ldObj = null; t._reqHeaders = []; t._openArgs = null; t._errors = { inv_form_el: 'Invalid FORM element detected: name=%, tag=%', must_be_single_el: 'If used, <form> must be a single HTML element in the list.', js_invalid: 'JavaScript code generated by backend is invalid!\n%', url_too_long: 'Cannot use so long query with GET request (URL is larger than % bytes)', unk_loader: 'Unknown loader: %', no_loaders: 'No loaders registered at all, please check JsHttpRequest.LOADERS array', no_loader_matched: 'Cannot find a loader which may process the request. Notices are:\n%' }; t.abort = function() { with (this) { if (_ldObj && _ldObj.abort) _ldObj.abort(); _cleanup(); if (readyState == 0) { return; } if (readyState == 1 && !_ldObj) { readyState = 0; return; } _changeReadyState(4, true); }}; t.open = function(method, url, asyncFlag, username, password) { with (this) { if (url.match(/^((\w+)\.)?(GET|POST)\s+(.*)/i)) { this.loader = RegExp.$2? RegExp.$2 : null; method = RegExp.$3; url = RegExp.$4; } try { if ( document.location.search.match(new RegExp('[&?]' + session_name + '=([^&?]*)')) || document.cookie.match(new RegExp('(?:;|^)\\s*' + session_name + '=([^;]*)')) ) { url += (url.indexOf('?') >= 0? '&' : '?') + session_name + "=" + this.escape(RegExp.$1); } } catch (e) {} _openArgs = { method: (method || '').toUpperCase(), url: url, asyncFlag: asyncFlag, username: username != null? username : '', password: password != null? password : '' }; _ldObj = null; _changeReadyState(1, true); return true; }}; t.send = function(content) { if (!this.readyState) { return; } this._changeReadyState(1, true); this._ldObj = null; var queryText = []; var queryElem = []; if (!this._hash2query(content, null, queryText, queryElem)) return; var hash = null; if (this.caching && !queryElem.length) { hash = this._openArgs.username + ':' + this._openArgs.password + '@' + this._openArgs.url + '|' + queryText + "#" + this._openArgs.method; var cache = JsHttpRequest.CACHE[hash]; if (cache) { this._dataReady(cache[0], cache[1]); return false; } } var loader = (this.loader || '').toLowerCase(); if (loader && !JsHttpRequest.LOADERS[loader]) return this._error('unk_loader', loader); var errors = []; var lds = JsHttpRequest.LOADERS; for (var tryLoader in lds) { var ldr = lds[tryLoader].loader; if (!ldr) continue; if (loader && tryLoader != loader) continue; var ldObj = new ldr(this); JsHttpRequest.extend(ldObj, this._openArgs); JsHttpRequest.extend(ldObj, { queryText: queryText.join('&'), queryElem: queryElem, id: (new Date().getTime()) + "" + JsHttpRequest.COUNT++, hash: hash, span: null }); var error = ldObj.load(); if (!error) { this._ldObj = ldObj; JsHttpRequest.PENDING[ldObj.id] = this; return true; } if (!loader) { errors[errors.length] = '- ' + tryLoader.toUpperCase() + ': ' + this._l(error); } else { return this._error(error); } } return tryLoader? this._error('no_loader_matched', errors.join('\n')) : this._error('no_loaders'); }; t.getAllResponseHeaders = function() { with (this) { return _ldObj && _ldObj.getAllResponseHeaders? _ldObj.getAllResponseHeaders() : []; }}; t.getResponseHeader = function(label) { with (this) { return _ldObj && _ldObj.getResponseHeader? _ldObj.getResponseHeader(label) : null; }}; t.setRequestHeader = function(label, value) { with (this) { _reqHeaders[_reqHeaders.length] = [label, value]; }}; t._dataReady = function(text, js) { with (this) { if (caching && _ldObj) JsHttpRequest.CACHE[_ldObj.hash] = [text, js]; responseText = responseXML = text; responseJS = js; if (js !== null) { status = 200; statusText = "OK"; } else { status = 500; statusText = "Internal Server Error"; } _changeReadyState(2); _changeReadyState(3); _changeReadyState(4); _cleanup(); }}; t._l = function(args) { var i = 0, p = 0, msg = this._errors[args[0]]; while ((p = msg.indexOf('%', p)) >= 0) { var a = args[++i] + ""; msg = msg.substring(0, p) + a + msg.substring(p + 1, msg.length); p += 1 + a.length; } return msg; }; t._error = function(msg) { msg = this._l(typeof(msg) == 'string'? arguments : msg); msg = "JsHttpRequest: " + msg; if (!window.Error) { throw msg; } else if ((new Error(1, 'test')).description == "test") { throw new Error(1, msg); } else { throw new Error(msg); } }; t._hash2query = function(content, prefix, queryText, queryElem) { if (prefix == null) prefix = ""; if((''+typeof(content)).toLowerCase() == 'object') { var formAdded = false; if (content && content.parentNode && content.parentNode.appendChild && content.tagName && content.tagName.toUpperCase() == 'FORM') { content = { form: content }; } for (var k in content) { var v = content[k]; if (v instanceof Function) continue; var curPrefix = prefix? prefix + '[' + this.escape(k) + ']' : this.escape(k); var isFormElement = v && v.parentNode && v.parentNode.appendChild && v.tagName; if (isFormElement) { var tn = v.tagName.toUpperCase(); if (tn == 'FORM') { formAdded = true; } else if (tn == 'INPUT' || tn == 'TEXTAREA' || tn == 'SELECT') { } else { return this._error('inv_form_el', (v.name||''), v.tagName); } queryElem[queryElem.length] = { name: curPrefix, e: v }; } else if (v instanceof Object) { this._hash2query(v, curPrefix, queryText, queryElem); } else { if (v === null) continue; if (v === true) v = 1; if (v === false) v = ''; queryText[queryText.length] = curPrefix + "=" + this.escape('' + v); } if (formAdded && queryElem.length > 1) { return this._error('must_be_single_el'); } } } else { queryText[queryText.length] = content; } return true; }; t._cleanup = function() { var ldObj = this._ldObj; if (!ldObj) return; JsHttpRequest.PENDING[ldObj.id] = false; var span = ldObj.span; if (!span) return; ldObj.span = null; var closure = function() { span.parentNode.removeChild(span); }; JsHttpRequest.setTimeout(closure, 50); }; t._changeReadyState = function(s, reset) { with (this) { if (reset) { status = statusText = responseJS = null; responseText = ''; } readyState = s; if (onreadystatechange) onreadystatechange(); }}; t.escape = function(s) { return escape(s).replace(new RegExp('\\+','g'), '%2B'); }; } JsHttpRequest.COUNT = 0; JsHttpRequest.MAX_URL_LEN = 2000; JsHttpRequest.CACHE = {}; JsHttpRequest.PENDING = {}; JsHttpRequest.LOADERS = {}; JsHttpRequest._dummy = function() {}; JsHttpRequest.TIMEOUTS = { s: window.setTimeout, c: window.clearTimeout }; JsHttpRequest.setTimeout = function(func, dt) { window.JsHttpRequest_tmp = JsHttpRequest.TIMEOUTS.s; if (typeof(func) == "string") { id = window.JsHttpRequest_tmp(func, dt); } else { var id = null; var mediator = function() { func(); delete JsHttpRequest.TIMEOUTS[id]; }; id = window.JsHttpRequest_tmp(mediator, dt); JsHttpRequest.TIMEOUTS[id] = mediator; } window.JsHttpRequest_tmp = null; return id; }; JsHttpRequest.clearTimeout = function(id) { window.JsHttpRequest_tmp = JsHttpRequest.TIMEOUTS.c; delete JsHttpRequest.TIMEOUTS[id]; var r = window.JsHttpRequest_tmp(id); window.JsHttpRequest_tmp = null; return r; }; JsHttpRequest.query = function(url, content, onready, nocache) { var req = new this(); req.caching = !nocache; req.onreadystatechange = function() { if (req.readyState == 4) { onready(req.responseJS, req.responseText); } }; req.open(null, url, true); req.send(content); }; JsHttpRequest.dataReady = function(d) { var th = this.PENDING[d.id]; delete this.PENDING[d.id]; if (th) { th._dataReady(d.text, d.js); } else if (th !== false) { throw "dataReady(): unknown pending id: " + d.id; } }; JsHttpRequest.extend = function(dest, src) { for (var k in src) dest[k] = src[k]; }; JsHttpRequest.LOADERS.xml = { loader: function(req) { JsHttpRequest.extend(req._errors, { xml_no: 'Cannot use XMLHttpRequest or ActiveX loader: not supported', xml_no_diffdom: 'Cannot use XMLHttpRequest to load data from different domain %', xml_no_headers: 'Cannot use XMLHttpRequest loader or ActiveX loader, POST method: headers setting is not supported, needed to work with encodings correctly', xml_no_form_upl: 'Cannot use XMLHttpRequest loader: direct form elements using and uploading are not implemented' }); this.load = function() { if (this.queryElem.length) return ['xml_no_form_upl']; if (this.url.match(new RegExp('^([a-z]+://[^\\/]+)(.*)', 'i'))) { if (RegExp.$1.toLowerCase() != document.location.protocol + '//' + document.location.hostname.toLowerCase()) { return ['xml_no_diffdom', RegExp.$1]; } } var xr = null; if (window.XMLHttpRequest) { try { xr = new XMLHttpRequest() } catch(e) {} } else if (window.ActiveXObject) { try { xr = new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {} if (!xr) try { xr = new ActiveXObject("Msxml2.XMLHTTP") } catch (e) {} } if (!xr) return ['xml_no']; var canSetHeaders = window.ActiveXObject || xr.setRequestHeader; if (!this.method) this.method = canSetHeaders && this.queryText.length? 'POST' : 'GET'; if (this.method == 'GET') { if (this.queryText) this.url += (this.url.indexOf('?') >= 0? '&' : '?') + this.queryText; this.queryText = ''; if (this.url.length > JsHttpRequest.MAX_URL_LEN) return ['url_too_long', JsHttpRequest.MAX_URL_LEN]; } else if (this.method == 'POST' && !canSetHeaders) { return ['xml_no_headers']; } this.url += (this.url.indexOf('?') >= 0? '&' : '?') + 'JsHttpRequest=' + (req.caching? '0' : this.id) + '-xml'; var id = this.id; xr.onreadystatechange = function() { if (xr.readyState != 4) return; xr.onreadystatechange = JsHttpRequest._dummy; req.status = null; try { req.status = xr.status; req.responseText = xr.responseText; } catch (e) {} if (!req.status) return; try { eval('JsHttpRequest._tmp = function(id) { var d = ' + req.responseText + '; d.id = id; JsHttpRequest.dataReady(d); }'); } catch (e) { return req._error('js_invalid', req.responseText) } JsHttpRequest._tmp(id); JsHttpRequest._tmp = null; }; xr.open(this.method, this.url, true, this.username, this.password); if (canSetHeaders) { for (var i = 0; i < req._reqHeaders.length; i++) { xr.setRequestHeader(req._reqHeaders[i][0], req._reqHeaders[i][1]); } xr.setRequestHeader('Content-Type', 'application/octet-stream'); } xr.send(this.queryText); this.span = null; this.xr = xr; return null; }; this.getAllResponseHeaders = function() { return this.xr.getAllResponseHeaders(); }; this.getResponseHeader = function(label) { return this.xr.getResponseHeader(label); }; this.abort = function() { this.xr.abort(); this.xr = null; } }}; JsHttpRequest.LOADERS.script = { loader: function(req) { JsHttpRequest.extend(req._errors, { script_only_get: 'Cannot use SCRIPT loader: it supports only GET method', script_no_form: 'Cannot use SCRIPT loader: direct form elements using and uploading are not implemented' }); this.load = function() { if (this.queryText) this.url += (this.url.indexOf('?') >= 0? '&' : '?') + this.queryText; this.url += (this.url.indexOf('?') >= 0? '&' : '?') + 'JsHttpRequest=' + this.id + '-' + 'script'; this.queryText = ''; if (!this.method) this.method = 'GET'; if (this.method !== 'GET') return ['script_only_get']; if (this.queryElem.length) return ['script_no_form']; if (this.url.length > JsHttpRequest.MAX_URL_LEN) return ['url_too_long', JsHttpRequest.MAX_URL_LEN]; var th = this, d = document, s = null, b = d.body; if (!window.opera) { this.span = s = d.createElement('SCRIPT'); var closure = function() { s.language = 'JavaScript'; if (s.setAttribute) s.setAttribute('src', th.url); else s.src = th.url; b.insertBefore(s, b.lastChild); } } else { this.span = s = d.createElement('SPAN'); s.style.display = 'none'; b.insertBefore(s, b.lastChild); s.innerHTML = 'Workaround for IE.<s'+'cript></' + 'script>'; var closure = function() { s = s.getElementsByTagName('SCRIPT')[0]; s.language = 'JavaScript'; if (s.setAttribute) s.setAttribute('src', th.url); else s.src = th.url; } } JsHttpRequest.setTimeout(closure, 10); return null; } }}; JsHttpRequest.LOADERS.form = { loader: function(req) { JsHttpRequest.extend(req._errors, { form_el_not_belong: 'Element "%" does not belong to any form!', form_el_belong_diff: 'Element "%" belongs to a different form. All elements must belong to the same form!', form_el_inv_enctype: 'Attribute "enctype" of the form must be "%" (for IE), "%" given.' }); this.load = function() { var th = this; if (!th.method) th.method = 'POST'; th.url += (th.url.indexOf('?') >= 0? '&' : '?') + 'JsHttpRequest=' + th.id + '-' + 'form'; if (th.method == 'GET') { if (th.queryText) th.url += (th.url.indexOf('?') >= 0? '&' : '?') + th.queryText; if (th.url.length > JsHttpRequest.MAX_URL_LEN) return ['url_too_long', JsHttpRequest.MAX_URL_LEN]; var p = th.url.split('?', 2); th.url = p[0]; th.queryText = p[1] || ''; } var form = null; var wholeFormSending = false; if (th.queryElem.length) { if (th.queryElem[0].e.tagName.toUpperCase() == 'FORM') { form = th.queryElem[0].e; wholeFormSending = true; th.queryElem = []; } else { form = th.queryElem[0].e.form; for (var i = 0; i < th.queryElem.length; i++) { var e = th.queryElem[i].e; if (!e.form) { return ['form_el_not_belong', e.name]; } if (e.form != form) { return ['form_el_belong_diff', e.name]; } } } if (th.method == 'POST') { var need = "multipart/form-data"; var given = (form.attributes.encType && form.attributes.encType.nodeValue) || (form.attributes.enctype && form.attributes.enctype.value) || form.enctype; if (given != need) { return ['form_el_inv_enctype', need, given]; } } } var d = form && (form.ownerDocument || form.document) || document; var ifname = 'jshr_i_' + th.id; var s = th.span = d.createElement('DIV'); s.style.position = 'absolute'; s.style.display = 'none'; s.style.visibility = 'hidden'; s.innerHTML = (form? '' : '<form' + (th.method == 'POST'? ' enctype="multipart/form-data" method="post"' : '') + '></form>') + '<iframe name="' + ifname + '" id="' + ifname + '" style="width:0px; height:0px; overflow:hidden; border:none"></iframe>'; if (!form) { form = th.span.firstChild; } d.body.insertBefore(s, d.body.lastChild); var setAttributes = function(e, attr) { var sv = []; var form = e; if (e.mergeAttributes) { var form = d.createElement('form'); form.mergeAttributes(e, false); } for (var i = 0; i < attr.length; i++) { var k = attr[i][0], v = attr[i][1]; sv[sv.length] = [k, form.getAttribute(k)]; form.setAttribute(k, v); } if (e.mergeAttributes) { e.mergeAttributes(form, false); } return sv; }; var closure = function() { top.JsHttpRequestGlobal = JsHttpRequest; var savedNames = []; if (!wholeFormSending) { for (var i = 0, n = form.elements.length; i < n; i++) { savedNames[i] = form.elements[i].name; form.elements[i].name = ''; } } var qt = th.queryText.split('&'); for (var i = qt.length - 1; i >= 0; i--) { var pair = qt[i].split('=', 2); var e = d.createElement('INPUT'); e.type = 'hidden'; e.name = unescape(pair[0]); e.value = pair[1] != null? unescape(pair[1]) : ''; form.appendChild(e); } for (var i = 0; i < th.queryElem.length; i++) { th.queryElem[i].e.name = th.queryElem[i].name; } var sv = setAttributes( form, [ ['action', th.url], ['method', th.method], ['onsubmit', null], ['target', ifname] ] ); form.submit(); setAttributes(form, sv); for (var i = 0; i < qt.length; i++) { form.lastChild.parentNode.removeChild(form.lastChild); } if (!wholeFormSending) { for (var i = 0, n = form.elements.length; i < n; i++) { form.elements[i].name = savedNames[i]; } } }; JsHttpRequest.setTimeout(closure, 100); return null; } }};  var hexcase = 0; var b64pad = ""; var chrsz = 8; function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} function sha1_vm_test() { return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; } function core_sha1(x, len) { x[len >> 5] |= 0x80 << (24 - len % 32); x[((len + 64 >> 9) << 4) + 15] = len; var w = Array(80); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var e = -1009589776; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; var olde = e; for(var j = 0; j < 80; j++) { if(j < 16) w[j] = x[i + j]; else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; } a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } return Array(a, b, c, d, e); } function sha1_ft(t, b, c, d) { if(t < 20) return (b & c) | ((~b) & d); if(t < 40) return b ^ c ^ d; if(t < 60) return (b & c) | (b & d) | (c & d); return b ^ c ^ d; } function sha1_kt(t) { return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514; } function core_hmac_sha1(key, data) { var bkey = str2binb(key); if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); return core_sha1(opad.concat(hash), 512 + 160); } 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 rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } function str2binb(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32); return bin; } function binb2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask); return str; } function binb2hex(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] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); } return str; } function binb2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * (3 - (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; }  Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { this.activeDiv = null; this.currentDateEl = null; this.getDateStatus = null; this.getDateToolTip = null; this.getDateText = null; this.timeout = null; this.onSelected = onSelected || null; this.onClose = onClose || null; this.dragging = false; this.hidden = false; this.minYear = 1970; this.maxYear = 2050; this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; this.isPopup = true; this.weekNumbers = true; this.firstDayOfWeek = typeof(firstDayOfWeek)== "number" ? firstDayOfWeek : Calendar._FD; this.showsOtherMonths = false; this.dateStr = dateStr; this.ar_days = null; this.showsTime = false; this.time24 = true; this.yearStep = 2; this.hiliteToday = true; this.multiple = null; this.table = null; this.element = null; this.tbody = null; this.firstdayname = null; this.monthsCombo = null; this.yearsCombo = null; this.hilitedMonth = null; this.activeMonth = null; this.hilitedYear = null; this.activeYear = null; this.dateClicked = false; if (typeof(Calendar._SDN)== "undefined") { if (typeof(Calendar._SDN_len)== "undefined") Calendar._SDN_len = 3; var ar = new Array(); for (var i = 8; i > 0;) { ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); } Calendar._SDN = ar; if (typeof(Calendar._SMN_len)== "undefined") Calendar._SMN_len = 3; ar = new Array(); for (var i = 12; i > 0;) { ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); } Calendar._SMN = ar; } }; Calendar._C = null; Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) ); Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); Calendar.is_opera = /opera/i.test(navigator.userAgent); Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); Calendar.getAbsolutePos = function(el) { var SL = 0, ST = 0; var is_div = /^div$/i.test(el.tagName); if (is_div && el.scrollLeft) SL = el.scrollLeft; if (is_div && el.scrollTop) ST = el.scrollTop; var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; if (el.offsetParent) { var tmp = this.getAbsolutePos(el.offsetParent); r.x += tmp.x; r.y += tmp.y; } return r; }; Calendar.isRelated = function (el, evt) { var related = evt.relatedTarget; if (!related) { var type = evt.type; if (type == "mouseover") { related = evt.fromElement; } else if (type == "mouseout") { related = evt.toElement; } } while (related) { if (related == el) { return true; } related = related.parentNode; } return false; }; Calendar.removeClass = function(el, className) { if (!(el && el.className)) { return; } var cls = el.className.split(" "); var ar = new Array(); for (var i = cls.length; i > 0;) { if (cls[--i] != className) { ar[ar.length] = cls[i]; } } el.className = ar.join(" "); }; Calendar.addClass = function(el, className) { Calendar.removeClass(el, className); el.className += " " + className; }; Calendar.getElement = function(ev) { var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; while (f.nodeType != 1 || /^div$/i.test(f.tagName)) f = f.parentNode; return f; }; Calendar.getTargetElement = function(ev) { var f = Calendar.is_ie ? window.event.srcElement : ev.target; while (f.nodeType != 1) f = f.parentNode; return f; }; Calendar.stopEvent = function(ev) { ev || (ev = window.event); if (Calendar.is_ie) { ev.cancelBubble = true; ev.returnValue = false; } else { ev.preventDefault(); ev.stopPropagation(); } return false; }; Calendar.addEvent = function(el, evname, func) { if (el.attachEvent) { el.attachEvent("on" + evname, func); } else if (el.addEventListener) { el.addEventListener(evname, func, true); } else { el["on" + evname] = func; } }; Calendar.removeEvent = function(el, evname, func) { if (el.detachEvent) { el.detachEvent("on" + evname, func); } else if (el.removeEventListener) { el.removeEventListener(evname, func, true); } else { el["on" + evname] = null; } }; Calendar.createElement = function(type, parent) { var el = null; if (document.createElementNS) { el = document.createElementNS("http://www.w3.org/1999/xhtml", type); } else { el = document.createElement(type); } if (typeof(parent)!= "undefined") { parent.appendChild(el); } return el; }; Calendar._add_evs = function(el) { with (Calendar) { addEvent(el, "mouseover", dayMouseOver); addEvent(el, "mousedown", dayMouseDown); addEvent(el, "mouseout", dayMouseOut); if (is_ie) { addEvent(el, "dblclick", dayMouseDblClick); el.setAttribute("unselectable", true); } } }; Calendar.findMonth = function(el) { if (typeof(el.month)!= "undefined") { return el; } else if (typeof(el.parentNode.month)!= "undefined") { return el.parentNode; } return null; }; Calendar.findYear = function(el) { if (typeof(el.year)!= "undefined") { return el; } else if (typeof(el.parentNode.year)!= "undefined") { return el.parentNode; } return null; }; Calendar.showMonthsCombo = function () { var cal = Calendar._C; if (!cal) { return false; } var cal = cal; var cd = cal.activeDiv; var mc = cal.monthsCombo; if (cal.hilitedMonth) { Calendar.removeClass(cal.hilitedMonth, "hilite"); } if (cal.activeMonth) { Calendar.removeClass(cal.activeMonth, "active"); } var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; Calendar.addClass(mon, "active"); cal.activeMonth = mon; var s = mc.style; s.display = "block"; if (cd.navtype < 0) s.left = cd.offsetLeft + "px"; else { var mcw = mc.offsetWidth; if (typeof(mcw)== "undefined") mcw = 50; s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; } s.top = (cd.offsetTop + cd.offsetHeight) + "px"; }; Calendar.showYearsCombo = function (fwd) { var cal = Calendar._C; if (!cal) { return false; } var cal = cal; var cd = cal.activeDiv; var yc = cal.yearsCombo; if (cal.hilitedYear) { Calendar.removeClass(cal.hilitedYear, "hilite"); } if (cal.activeYear) { Calendar.removeClass(cal.activeYear, "active"); } cal.activeYear = null; var Y = cal.date.getFullYear() + (fwd ? 1 : -1); var yr = yc.firstChild; var show = false; for (var i = 12; i > 0; --i) { if (Y >= cal.minYear && Y <= cal.maxYear) { yr.innerHTML = Y; yr.year = Y; yr.style.display = "block"; show = true; } else { yr.style.display = "none"; } yr = yr.nextSibling; Y += fwd ? cal.yearStep : -cal.yearStep; } if (show) { var s = yc.style; s.display = "block"; if (cd.navtype < 0) s.left = cd.offsetLeft + "px"; else { var ycw = yc.offsetWidth; if (typeof(ycw)== "undefined") ycw = 50; s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; } s.top = (cd.offsetTop + cd.offsetHeight) + "px"; } }; Calendar.tableMouseUp = function(ev) { var cal = Calendar._C; if (!cal) { return false; } if (cal.timeout) { clearTimeout(cal.timeout); } var el = cal.activeDiv; if (!el) { return false; } var target = Calendar.getTargetElement(ev); ev || (ev = window.event); Calendar.removeClass(el, "active"); if (target == el || target.parentNode == el) { Calendar.cellClick(el, ev); } var mon = Calendar.findMonth(target); var date = null; if (mon) { date = new Date(cal.date); if (mon.month != date.getMonth()) { date.setMonth(mon.month); cal.setDate(date); cal.dateClicked = false; cal.callHandler(); } } else { var year = Calendar.findYear(target); if (year) { date = new Date(cal.date); if (year.year != date.getFullYear()) { date.setFullYear(year.year); cal.setDate(date); cal.dateClicked = false; cal.callHandler(); } } } with (Calendar) { removeEvent(document, "mouseup", tableMouseUp); removeEvent(document, "mouseover", tableMouseOver); removeEvent(document, "mousemove", tableMouseOver); cal._hideCombos(); _C = null; return stopEvent(ev); } }; Calendar.tableMouseOver = function (ev) { var cal = Calendar._C; if (!cal) { return; } var el = cal.activeDiv; var target = Calendar.getTargetElement(ev); if (target == el || target.parentNode == el) { Calendar.addClass(el, "hilite active"); Calendar.addClass(el.parentNode, "rowhilite"); } else { if (typeof(el.navtype)== "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) Calendar.removeClass(el, "active"); Calendar.removeClass(el, "hilite"); Calendar.removeClass(el.parentNode, "rowhilite"); } ev || (ev = window.event); if (el.navtype == 50 && target != el) { var pos = Calendar.getAbsolutePos(el); var w = el.offsetWidth; var x = ev.clientX; var dx; var decrease = true; if (x > pos.x + w) { dx = x - pos.x - w; decrease = false; } else dx = pos.x - x; if (dx < 0) dx = 0; var range = el._range; var current = el._current; var count = Math.floor(dx / 10) % range.length; for (var i = range.length; --i >= 0;) if (range[i] == current) break; while (count-- > 0) if (decrease) { if (--i < 0) i = range.length - 1; } else if ( ++i >= range.length ) i = 0; var newval = range[i]; el.innerHTML = newval; cal.onUpdateTime(); } var mon = Calendar.findMonth(target); if (mon) { if (mon.month != cal.date.getMonth()) { if (cal.hilitedMonth) { Calendar.removeClass(cal.hilitedMonth, "hilite"); } Calendar.addClass(mon, "hilite"); cal.hilitedMonth = mon; } else if (cal.hilitedMonth) { Calendar.removeClass(cal.hilitedMonth, "hilite"); } } else { if (cal.hilitedMonth) { Calendar.removeClass(cal.hilitedMonth, "hilite"); } var year = Calendar.findYear(target); if (year) { if (year.year != cal.date.getFullYear()) { if (cal.hilitedYear) { Calendar.removeClass(cal.hilitedYear, "hilite"); } Calendar.addClass(year, "hilite"); cal.hilitedYear = year; } else if (cal.hilitedYear) { Calendar.removeClass(cal.hilitedYear, "hilite"); } } else if (cal.hilitedYear) { Calendar.removeClass(cal.hilitedYear, "hilite"); } } return Calendar.stopEvent(ev); }; Calendar.tableMouseDown = function (ev) { if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { return Calendar.stopEvent(ev); } }; Calendar.calDragIt = function (ev) { var cal = Calendar._C; if (!(cal && cal.dragging)) { return false; } var posX; var posY; if (Calendar.is_ie) { posY = window.event.clientY + document.body.scrollTop; posX = window.event.clientX + document.body.scrollLeft; } else { posX = ev.pageX; posY = ev.pageY; } cal.hideShowCovered(); var st = cal.element.style; st.left = (posX - cal.xOffs) + "px"; st.top = (posY - cal.yOffs) + "px"; return Calendar.stopEvent(ev); }; Calendar.calDragEnd = function (ev) { var cal = Calendar._C; if (!cal) { return false; } cal.dragging = false; with (Calendar) { removeEvent(document, "mousemove", calDragIt); removeEvent(document, "mouseup", calDragEnd); tableMouseUp(ev); } cal.hideShowCovered(); }; Calendar.dayMouseDown = function(ev) { var el = Calendar.getElement(ev); if (el.disabled) { return false; } var cal = el.calendar; cal.activeDiv = el; Calendar._C = cal; if (el.navtype != 300) with (Calendar) { if (el.navtype == 50) { el._current = el.innerHTML; addEvent(document, "mousemove", tableMouseOver); } else addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); addClass(el, "hilite active"); addEvent(document, "mouseup", tableMouseUp); } else if (cal.isPopup) { cal._dragStart(ev); } if (el.navtype == -1 || el.navtype == 1) { if (cal.timeout) clearTimeout(cal.timeout); cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); } else if (el.navtype == -2 || el.navtype == 2) { if (cal.timeout) clearTimeout(cal.timeout); cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); } else { cal.timeout = null; } return Calendar.stopEvent(ev); }; Calendar.dayMouseDblClick = function(ev) { Calendar.cellClick(Calendar.getElement(ev), ev || window.event); if (Calendar.is_ie) { document.selection.empty(); } }; Calendar.dayMouseOver = function(ev) { var el = Calendar.getElement(ev); if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { return false; } if (el.ttip) { if (el.ttip.substr(0, 1) == "_") { el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); } el.calendar.tooltips.innerHTML = el.ttip; } if (el.navtype != 300) { Calendar.addClass(el, "hilite"); if (el.caldate) { Calendar.addClass(el.parentNode, "rowhilite"); } } return Calendar.stopEvent(ev); }; Calendar.dayMouseOut = function(ev) { with (Calendar) { var el = getElement(ev); if (isRelated(el, ev) || _C || el.disabled) return false; removeClass(el, "hilite"); if (el.caldate) removeClass(el.parentNode, "rowhilite"); if (el.calendar) el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; return stopEvent(ev); } }; Calendar.cellClick = function(el, ev) { var cal = el.calendar; var closing = false; var newdate = false; var date = null; if (typeof(el.navtype)== "undefined") { if (cal.currentDateEl) { Calendar.removeClass(cal.currentDateEl, "selected"); Calendar.addClass(el, "selected"); closing = (cal.currentDateEl == el); if (!closing) { cal.currentDateEl = el; } } cal.date.setDateOnly(el.caldate); date = cal.date; var other_month = !(cal.dateClicked = !el.otherMonth); if (!other_month && !cal.currentDateEl) cal._toggleMultipleDate(new Date(date)); else newdate = !el.disabled; if (other_month) cal._init(cal.firstDayOfWeek, date); } else { if (el.navtype == 200) { Calendar.removeClass(el, "hilite"); cal.callCloseHandler(); return; } date = new Date(cal.date); if (el.navtype == 0) date.setDateOnly(new Date()); cal.dateClicked = false; var year = date.getFullYear(); var mon = date.getMonth(); function setMonth(m) { var day = date.getDate(); var max = date.getMonthDays(m); if (day > max) { date.setDate(max); } date.setMonth(m); }; switch (el.navtype) { case 400: Calendar.removeClass(el, "hilite"); var text = Calendar._TT["ABOUT"]; if (typeof(text)!= "undefined") { text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; } else { text = "Help and about box text is not translated into this language.\n" + "If you know this language and you feel generous please update\n" + "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n" + "Thank you!\n" + "http://dynarch.com/mishoo/calendar.epl\n"; } alert(text); return; case -2: if (year > cal.minYear) { date.setFullYear(year - 1); } break; case -1: if (mon > 0) { setMonth(mon - 1); } else if (year-- > cal.minYear) { date.setFullYear(year); setMonth(11); } break; case 1: if (mon < 11) { setMonth(mon + 1); } else if (year < cal.maxYear) { date.setFullYear(year + 1); setMonth(0); } break; case 2: if (year < cal.maxYear) { date.setFullYear(year + 1); } break; case 100: cal.setFirstDayOfWeek(el.fdow); return; case 50: var range = el._range; var current = el.innerHTML; for (var i = range.length; --i >= 0;) if (range[i] == current) break; if (ev && ev.shiftKey) { if (--i < 0) i = range.length - 1; } else if ( ++i >= range.length ) i = 0; var newval = range[i]; el.innerHTML = newval; cal.onUpdateTime(); return; case 0: if ((typeof(cal.getDateStatus)== "function") && cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { return false; } break; } if (!date.equalsTo(cal.date)) { cal.setDate(date); newdate = true; } else if (el.navtype == 0) newdate = closing = true; } if (newdate) { ev && cal.callHandler(); } if (closing) { Calendar.removeClass(el, "hilite"); ev && cal.callCloseHandler(); } }; Calendar.prototype.create = function (_par) { var parent = null; if (! _par) { parent = document.getElementsByTagName("body")[0]; this.isPopup = true; } else { parent = _par; this.isPopup = false; } this.date = this.dateStr ? new Date(this.dateStr) : new Date(); var table = Calendar.createElement("table"); this.table = table; table.cellSpacing = 0; table.cellPadding = 0; table.calendar = this; Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); var div = Calendar.createElement("div"); this.element = div; div.className = "calendar"; if (this.isPopup) { div.style.position = "absolute"; div.style.display = "none"; } div.appendChild(table); var thead = Calendar.createElement("thead", table); var cell = null; var row = null; var cal = this; var hh = function (text, cs, navtype) { cell = Calendar.createElement("td", row); cell.colSpan = cs; cell.className = "button"; if (navtype != 0 && Math.abs(navtype) <= 2) cell.className += " nav"; Calendar._add_evs(cell); cell.calendar = cal; cell.navtype = navtype; cell.innerHTML = "<div unselectable='on'>" + text + "</div>"; return cell; }; row = Calendar.createElement("tr", thead); var title_length = 6; (this.isPopup) && --title_length; (this.weekNumbers) && ++title_length; hh("?", 1, 400).ttip = Calendar._TT["INFO"]; this.title = hh("", title_length, 300); this.title.className = "title"; if (this.isPopup) { this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; this.title.style.cursor = "move"; hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"]; } row = Calendar.createElement("tr", thead); row.className = "headrow"; this._nav_py = hh("&#x00ab;", 1, -2); this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; this._nav_pm = hh("&#x2039;", 1, -1); this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); this._nav_now.ttip = Calendar._TT["GO_TODAY"]; this._nav_nm = hh("&#x203a;", 1, 1); this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; this._nav_ny = hh("&#x00bb;", 1, 2); this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; row = Calendar.createElement("tr", thead); row.className = "daynames"; if (this.weekNumbers) { cell = Calendar.createElement("td", row); cell.className = "name wn"; cell.innerHTML = Calendar._TT["WK"]; } for (var i = 7; i > 0; --i) { cell = Calendar.createElement("td", row); if (!i) { cell.navtype = 100; cell.calendar = this; Calendar._add_evs(cell); } } this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; this._displayWeekdays(); var tbody = Calendar.createElement("tbody", table); this.tbody = tbody; for (i = 6; i > 0; --i) { row = Calendar.createElement("tr", tbody); if (this.weekNumbers) { cell = Calendar.createElement("td", row); } for (var j = 7; j > 0; --j) { cell = Calendar.createElement("td", row); cell.calendar = this; Calendar._add_evs(cell); } } if (this.showsTime) { row = Calendar.createElement("tr", tbody); row.className = "time"; cell = Calendar.createElement("td", row); cell.className = "time"; cell.colSpan = 2; cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;"; cell = Calendar.createElement("td", row); cell.className = "time"; cell.colSpan = this.weekNumbers ? 4 : 3; (function(){ function makeTimePart(className, init, range_start, range_end) { var part = Calendar.createElement("span", cell); part.className = className; part.innerHTML = init; part.calendar = cal; part.ttip = Calendar._TT["TIME_PART"]; part.navtype = 50; part._range = []; if (typeof(range_start)!= "number") part._range = range_start; else { for (var i = range_start; i <= range_end; ++i) { var txt; if (i < 10 && range_end >= 10) txt = '0' + i; else txt = '' + i; part._range[part._range.length] = txt; } } Calendar._add_evs(part); return part; }; var hrs = cal.date.getHours(); var mins = cal.date.getMinutes(); var t12 = !cal.time24; var pm = (hrs > 12); if (t12 && pm) hrs -= 12; var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); var span = Calendar.createElement("span", cell); span.innerHTML = ":"; span.className = "colon"; var M = makeTimePart("minute", mins, 0, 59); var AP = null; cell = Calendar.createElement("td", row); cell.className = "time"; cell.colSpan = 2; if (t12) AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); else cell.innerHTML = "&nbsp;"; cal.onSetTime = function() { var pm, hrs = this.date.getHours(), mins = this.date.getMinutes(); if (t12) { pm = (hrs >= 12); if (pm) hrs -= 12; if (hrs == 0) hrs = 12; AP.innerHTML = pm ? "pm" : "am"; } H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; M.innerHTML = (mins < 10) ? ("0" + mins) : mins; }; cal.onUpdateTime = function() { var date = this.date; var h = parseInt(H.innerHTML, 10); if (t12) { if (/pm/i.test(AP.innerHTML) && h < 12) h += 12; else if (/am/i.test(AP.innerHTML) && h == 12) h = 0; } var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); date.setHours(h); date.setMinutes(parseInt(M.innerHTML, 10)); date.setFullYear(y); date.setMonth(m); date.setDate(d); this.dateClicked = false; this.callHandler(); }; })(); } else { this.onSetTime = this.onUpdateTime = function() {}; } var tfoot = Calendar.createElement("tfoot", table); row = Calendar.createElement("tr", tfoot); row.className = "footrow"; cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); cell.className = "ttip"; if (this.isPopup) { cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; cell.style.cursor = "move"; } this.tooltips = cell; div = Calendar.createElement("div", this.element); this.monthsCombo = div; div.className = "combo"; for (i = 0; i < Calendar._MN.length; ++i) { var mn = Calendar.createElement("div"); mn.className = Calendar.is_ie ? "label-IEfix" : "label"; mn.month = i; mn.innerHTML = Calendar._SMN[i]; div.appendChild(mn); } div = Calendar.createElement("div", this.element); this.yearsCombo = div; div.className = "combo"; for (i = 12; i > 0; --i) { var yr = Calendar.createElement("div"); yr.className = Calendar.is_ie ? "label-IEfix" : "label"; div.appendChild(yr); } this._init(this.firstDayOfWeek, this.date); parent.appendChild(this.element); }; Calendar._keyEvent = function(ev) { var cal = window._dynarch_popupCalendar; if (!cal || cal.multiple) return false; (Calendar.is_ie) && (ev = window.event); var act = (Calendar.is_ie || ev.type == "keypress"), K = ev.keyCode; if (ev.ctrlKey) { switch (K) { case 37: act && Calendar.cellClick(cal._nav_pm); break; case 38: act && Calendar.cellClick(cal._nav_py); break; case 39: act && Calendar.cellClick(cal._nav_nm); break; case 40: act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (K) { case 32: Calendar.cellClick(cal._nav_now); break; case 27: act && cal.callCloseHandler(); break; case 37: case 38: case 39: case 40: if (act) { var prev, x, y, ne, el, step; prev = K == 37 || K == 38; step = (K == 37 || K == 39) ? 1 : 7; function setVars() { el = cal.currentDateEl; var p = el.pos; x = p & 15; y = p >> 4; ne = cal.ar_days[y][x]; };setVars(); function prevMonth() { var date = new Date(cal.date); date.setDate(date.getDate() - step); cal.setDate(date); }; function nextMonth() { var date = new Date(cal.date); date.setDate(date.getDate() + step); cal.setDate(date); }; while (1) { switch (K) { case 37: if (--x >= 0) ne = cal.ar_days[y][x]; else { x = 6; K = 38; continue; } break; case 38: if (--y >= 0) ne = cal.ar_days[y][x]; else { prevMonth(); setVars(); } break; case 39: if (++x < 7) ne = cal.ar_days[y][x]; else { x = 0; K = 40; continue; } break; case 40: if (++y < cal.ar_days.length) ne = cal.ar_days[y][x]; else { nextMonth(); setVars(); } break; } break; } if (ne) { if (!ne.disabled) Calendar.cellClick(ne); else if (prev) prevMonth(); else nextMonth(); } } break; case 13: if (act) Calendar.cellClick(cal.currentDateEl, ev); break; default: return false; } return Calendar.stopEvent(ev); }; Calendar.prototype._init = function (firstDayOfWeek, date) { var today = new Date(), TY = today.getFullYear(), TM = today.getMonth(), TD = today.getDate(); this.table.style.visibility = "hidden"; var year = date.getFullYear(); if (year < this.minYear) { year = this.minYear; date.setFullYear(year); } else if (year > this.maxYear) { year = this.maxYear; date.setFullYear(year); } this.firstDayOfWeek = firstDayOfWeek; this.date = new Date(date); var month = date.getMonth(); var mday = date.getDate(); var no_days = date.getMonthDays(); date.setDate(1); var day1 = (date.getDay() - this.firstDayOfWeek) % 7; if (day1 < 0) day1 += 7; date.setDate(-day1); date.setDate(date.getDate() + 1); var row = this.tbody.firstChild; var MN = Calendar._SMN[month]; var ar_days = this.ar_days = new Array(); var weekend = Calendar._TT["WEEKEND"]; var dates = this.multiple ? (this.datesCells = {}) : null; for (var i = 0; i < 6; ++i, row = row.nextSibling) { var cell = row.firstChild; if (this.weekNumbers) { cell.className = "day wn"; cell.innerHTML = date.getWeekNumber(); cell = cell.nextSibling; } row.className = "daysrow"; var hasdays = false, iday, dpos = ar_days[i] = []; for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { iday = date.getDate(); var wday = date.getDay(); cell.className = "day"; cell.pos = i << 4 | j; dpos[j] = cell; var current_month = (date.getMonth() == month); if (!current_month) { if (this.showsOtherMonths) { cell.className += " othermonth"; cell.otherMonth = true; } else { cell.className = "emptycell"; cell.innerHTML = "&nbsp;"; cell.disabled = true; continue; } } else { cell.otherMonth = false; hasdays = true; } cell.disabled = false; cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; if (dates) dates[date.print("%Y%m%d")] = cell; if (this.getDateStatus) { var status = this.getDateStatus(date, year, month, iday); if (this.getDateToolTip) { var toolTip = this.getDateToolTip(date, year, month, iday); if (toolTip) cell.title = toolTip; } if (status === true) { cell.className += " disabled"; cell.disabled = true; } else { if (/disabled/i.test(status)) cell.disabled = true; cell.className += " " + status; } } if (!cell.disabled) { cell.caldate = new Date(date); cell.ttip = "_"; if (!this.multiple && current_month && iday == mday && this.hiliteToday) { cell.className += " selected"; this.currentDateEl = cell; } if (date.getFullYear() == TY && date.getMonth() == TM && iday == TD) { cell.className += " today"; cell.ttip += Calendar._TT["PART_TODAY"]; } if (weekend.indexOf(wday.toString()) != -1) cell.className += cell.otherMonth ? " oweekend" : " weekend"; } } if (!(hasdays || this.showsOtherMonths)) row.className = "emptyrow"; } this.title.innerHTML = Calendar._MN[month] + ", " + year; this.onSetTime(); this.table.style.visibility = "visible"; this._initMultipleDates(); }; Calendar.prototype._initMultipleDates = function() { if (this.multiple) { for (var i in this.multiple) { var cell = this.datesCells[i]; var d = this.multiple[i]; if (!d) continue; if (cell) cell.className += " selected"; } } }; Calendar.prototype._toggleMultipleDate = function(date) { if (this.multiple) { var ds = date.print("%Y%m%d"); var cell = this.datesCells[ds]; if (cell) { var d = this.multiple[ds]; if (!d) { Calendar.addClass(cell, "selected"); this.multiple[ds] = date; } else { Calendar.removeClass(cell, "selected"); delete this.multiple[ds]; } } } }; Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { this.getDateToolTip = unaryFunction; }; Calendar.prototype.setDate = function (date) { if (!date.equalsTo(this.date)) { this._init(this.firstDayOfWeek, date); } }; Calendar.prototype.refresh = function () { this._init(this.firstDayOfWeek, this.date); }; Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { this._init(firstDayOfWeek, this.date); this._displayWeekdays(); }; Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { this.getDateStatus = unaryFunction; }; Calendar.prototype.setRange = function (a, z) { this.minYear = a; this.maxYear = z; }; Calendar.prototype.callHandler = function () { if (this.onSelected) { this.onSelected(this, this.date.print(this.dateFormat)); } }; Calendar.prototype.callCloseHandler = function () { if (this.onClose) { this.onClose(this); } this.hideShowCovered(); }; Calendar.prototype.destroy = function () { var el = this.element.parentNode; el.removeChild(this.element); Calendar._C = null; window._dynarch_popupCalendar = null; }; Calendar.prototype.reparent = function (new_parent) { var el = this.element; el.parentNode.removeChild(el); new_parent.appendChild(el); }; Calendar._checkCalendar = function(ev) { var calendar = window._dynarch_popupCalendar; if (!calendar) { return false; } var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); for (; el != null && el != calendar.element; el = el.parentNode); if (el == null) { window._dynarch_popupCalendar.callCloseHandler(); return Calendar.stopEvent(ev); } }; Calendar.prototype.show = function () { var rows = this.table.getElementsByTagName("tr"); for (var i = rows.length; i > 0;) { var row = rows[--i]; Calendar.removeClass(row, "rowhilite"); var cells = row.getElementsByTagName("td"); for (var j = cells.length; j > 0;) { var cell = cells[--j]; Calendar.removeClass(cell, "hilite"); Calendar.removeClass(cell, "active"); } } this.element.style.display = "block"; this.hidden = false; if (this.isPopup) { window._dynarch_popupCalendar = this; Calendar.addEvent(document, "keydown", Calendar._keyEvent); Calendar.addEvent(document, "keypress", Calendar._keyEvent); Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); } this.hideShowCovered(); }; Calendar.prototype.hide = function () { if (this.isPopup) { Calendar.removeEvent(document, "keydown", Calendar._keyEvent); Calendar.removeEvent(document, "keypress", Calendar._keyEvent); Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); } this.element.style.display = "none"; this.hidden = true; this.hideShowCovered(); }; Calendar.prototype.showAt = function (x, y) { var s = this.element.style; s.left = x + "px"; s.top = y + "px"; this.show(); }; Calendar.prototype.showAtElement = function (el, opts) { var self = this; var p = Calendar.getAbsolutePos(el); if (!opts || typeof(opts)!= "string") { this.showAt(p.x, p.y + el.offsetHeight); return true; } function fixPosition(box) { if (box.x < 0) box.x = 0; if (box.y < 0) box.y = 0; var cp = document.createElement("div"); var s = cp.style; s.position = "absolute"; s.right = s.bottom = s.width = s.height = "0px"; document.body.appendChild(cp); var br = Calendar.getAbsolutePos(cp); document.body.removeChild(cp); if (Calendar.is_ie) { br.y += document.body.scrollTop; br.x += document.body.scrollLeft; } else { br.y += window.scrollY; br.x += window.scrollX; } var tmp = box.x + box.width - br.x; if (tmp > 0) box.x -= tmp; tmp = box.y + box.height - br.y; if (tmp > 0) box.y -= tmp; }; this.element.style.display = "block"; Calendar.continuation_for_the_fucking_khtml_browser = function() { var w = self.element.offsetWidth; var h = self.element.offsetHeight; self.element.style.display = "none"; var valign = opts.substr(0, 1); var halign = "l"; if (opts.length > 1) { halign = opts.substr(1, 1); } switch (valign) { case "T": p.y -= h; break; case "B": p.y += el.offsetHeight; break; case "C": p.y += (el.offsetHeight - h) / 2; break; case "t": p.y += el.offsetHeight - h; break; case "b": break; } switch (halign) { case "L": p.x -= w; break; case "R": p.x += el.offsetWidth; break; case "C": p.x += (el.offsetWidth - w) / 2; break; case "l": p.x += el.offsetWidth - w; break; case "r": break; } p.width = w; p.height = h + 40; self.monthsCombo.style.display = "none"; fixPosition(p); self.showAt(p.x, p.y); }; if (Calendar.is_khtml) setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); else Calendar.continuation_for_the_fucking_khtml_browser(); }; Calendar.prototype.setDateFormat = function (str) { this.dateFormat = str; }; Calendar.prototype.setTtDateFormat = function (str) { this.ttDateFormat = str; }; Calendar.prototype.parseDate = function(str, fmt) { if (!fmt) fmt = this.dateFormat; this.setDate(Date.parseDate(str, fmt)); }; Calendar.prototype.hideShowCovered = function () { if (!Calendar.is_ie && !Calendar.is_opera) return; function getVisib(obj){ var value = obj.style.visibility; if (!value) { if (document.defaultView && typeof((document.defaultView.getComputedStyle))== "function") { if (!Calendar.is_khtml) value = document.defaultView. getComputedStyle(obj, "").getPropertyValue("visibility"); else value = ''; } else if (obj.currentStyle) { value = obj.currentStyle.visibility; } else value = ''; } return value; }; var tags = new Array("applet", "iframe", "select"); var el = this.element; var p = Calendar.getAbsolutePos(el); var EX1 = p.x; var EX2 = el.offsetWidth + EX1; var EY1 = p.y; var EY2 = el.offsetHeight + EY1; for (var k = tags.length; k > 0; ) { var ar = document.getElementsByTagName(tags[--k]); var cc = null; for (var i = ar.length; i > 0;) { cc = ar[--i]; p = Calendar.getAbsolutePos(cc); var CX1 = p.x; var CX2 = cc.offsetWidth + CX1; var CY1 = p.y; var CY2 = cc.offsetHeight + CY1; if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { if (!cc.__msh_save_visibility) { cc.__msh_save_visibility = getVisib(cc); } cc.style.visibility = cc.__msh_save_visibility; } else { if (!cc.__msh_save_visibility) { cc.__msh_save_visibility = getVisib(cc); } cc.style.visibility = "hidden"; } } } }; Calendar.prototype._displayWeekdays = function () { var fdow = this.firstDayOfWeek; var cell = this.firstdayname; var weekend = Calendar._TT["WEEKEND"]; for (var i = 0; i < 7; ++i) { cell.className = "day name"; var realday = (i + fdow) % 7; if (i) { cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); cell.navtype = 100; cell.calendar = this; cell.fdow = realday; Calendar._add_evs(cell); } if (weekend.indexOf(realday.toString()) != -1) { Calendar.addClass(cell, "weekend"); } cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; cell = cell.nextSibling; } }; Calendar.prototype._hideCombos = function () { this.monthsCombo.style.display = "none"; this.yearsCombo.style.display = "none"; }; Calendar.prototype._dragStart = function (ev) { if (this.dragging) { return; } this.dragging = true; var posX; var posY; if (Calendar.is_ie) { posY = window.event.clientY + document.body.scrollTop; posX = window.event.clientX + document.body.scrollLeft; } else { posY = ev.clientY + window.scrollY; posX = ev.clientX + window.scrollX; } var st = this.element.style; this.xOffs = posX - parseInt(st.left); this.yOffs = posY - parseInt(st.top); with (Calendar) { addEvent(document, "mousemove", calDragIt); addEvent(document, "mouseup", calDragEnd); } }; Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); Date.SECOND = 1000 ; Date.MINUTE = 60 * Date.SECOND; Date.HOUR = 60 * Date.MINUTE; Date.DAY = 24 * Date.HOUR; Date.WEEK = 7 * Date.DAY; Date.parseDate = function(str, fmt) { var today = new Date(); var y = 0; var m = -1; var d = 0; var a = str.split(/\W+/); var b = fmt.match(/%./g); var i = 0, j = 0; var hr = 0; var min = 0; for (i = 0; i < a.length; ++i) { if (!a[i]) continue; switch (b[i]) { case "%d": case "%e": d = parseInt(a[i], 10); break; case "%m": m = parseInt(a[i], 10) - 1; break; case "%Y": case "%y": y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); break; case "%b": case "%B": for (j = 0; j < 12; ++j) { if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } } break; case "%H": case "%I": case "%k": case "%l": hr = parseInt(a[i], 10); break; case "%P": case "%p": if (/pm/i.test(a[i]) && hr < 12) hr += 12; else if (/am/i.test(a[i]) && hr >= 12) hr -= 12; break; case "%M": min = parseInt(a[i], 10); break; } } if (isNaN(y)) y = today.getFullYear(); if (isNaN(m)) m = today.getMonth(); if (isNaN(d)) d = today.getDate(); if (isNaN(hr)) hr = today.getHours(); if (isNaN(min)) min = today.getMinutes(); if (y != 0 && m != -1 && d != 0) return new Date(y, m, d, hr, min, 0); y = 0; m = -1; d = 0; for (i = 0; i < a.length; ++i) { if (a[i].search(/[a-zA-Z]+/) != -1) { var t = -1; for (j = 0; j < 12; ++j) { if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } } if (t != -1) { if (m != -1) { d = m+1; } m = t; } } else if (parseInt(a[i], 10) <= 12 && m == -1) { m = a[i]-1; } else if (parseInt(a[i], 10) > 31 && y == 0) { y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); } else if (d == 0) { d = a[i]; } } if (y == 0) y = today.getFullYear(); if (m != -1 && d != 0) return new Date(y, m, d, hr, min, 0); return today; }; Date.prototype.getMonthDays = function(month) { var year = this.getFullYear(); if (typeof(month)== "undefined") { month = this.getMonth(); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { return Date._MD[month]; } }; Date.prototype.getDayOfYear = function() { var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var time = now - then; return Math.floor(time / Date.DAY); }; Date.prototype.getWeekNumber = function() { var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var DoW = d.getDay(); d.setDate(d.getDate() - (DoW + 6) % 7 + 3); var ms = d.valueOf(); d.setMonth(0); d.setDate(4); return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; }; Date.prototype.equalsTo = function(date) { return ((this.getFullYear() == date.getFullYear()) && (this.getMonth() == date.getMonth()) && (this.getDate() == date.getDate()) && (this.getHours() == date.getHours()) && (this.getMinutes() == date.getMinutes())); }; Date.prototype.setDateOnly = function(date) { var tmp = new Date(date); this.setDate(1); this.setFullYear(tmp.getFullYear()); this.setMonth(tmp.getMonth()); this.setDate(tmp.getDate()); }; Date.prototype.print = function (str) { var m = this.getMonth(); var d = this.getDate(); var y = this.getFullYear(); var wn = this.getWeekNumber(); var w = this.getDay(); var s = {}; var hr = this.getHours(); var pm = (hr >= 12); var ir = (pm) ? (hr - 12) : hr; var dy = this.getDayOfYear(); if (ir == 0) ir = 12; var min = this.getMinutes(); var sec = this.getSeconds(); s["%a"] = Calendar._SDN[w]; s["%A"] = Calendar._DN[w]; s["%b"] = Calendar._SMN[m]; s["%B"] = Calendar._MN[m]; s["%C"] = 1 + Math.floor(y / 100); s["%d"] = (d < 10) ? ("0" + d) : d; s["%e"] = d; s["%H"] = (hr < 10) ? ("0" + hr) : hr; s["%I"] = (ir < 10) ? ("0" + ir) : ir; s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; s["%k"] = hr; s["%l"] = ir; s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); s["%M"] = (min < 10) ? ("0" + min) : min; s["%n"] = "\n"; s["%p"] = pm ? "PM" : "AM"; s["%P"] = pm ? "pm" : "am"; s["%s"] = Math.floor(this.getTime() / 1000); s["%S"] = (sec < 10) ? ("0" + sec) : sec; s["%t"] = "\t"; s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; s["%u"] = w + 1; s["%w"] = w; s["%y"] = ('' + y).substr(2, 2); s["%Y"] = y; s["%%"] = "%"; var re = /%./g; if (!Calendar.is_ie5 && !Calendar.is_khtml) return str.replace(re, function (par) { return s[par] || par; }); var a = str.match(re); for (var i = 0; i < a.length; i++) { var tmp = s[a[i]]; if (tmp) { re = new RegExp(a[i], 'g'); str = str.replace(re, tmp); } } return str; }; Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; Date.prototype.setFullYear = function(y) { var d = new Date(this); d.__msh_oldSetFullYear(y); if (d.getMonth() != this.getMonth()) this.setDate(28); this.__msh_oldSetFullYear(y); }; window._dynarch_popupCalendar = null;  Calendar.setup = function (params) { function param_default(pname, def) { if (typeof(params[pname])== "undefined") { params[pname] = def; } }; param_default("inputField", null); param_default("displayArea", null); param_default("button", null); param_default("eventName", "click"); param_default("ifFormat", "%Y-%m-%d %H:%M:00"); param_default("daFormat", "%Y/%m/%d"); param_default("singleClick", true); param_default("disableFunc", null); param_default("dateStatusFunc", params["disableFunc"]); param_default("dateText", null); param_default("firstDay", null); param_default("align", "Br"); param_default("range", [1900, 2999]); param_default("weekNumbers", true); param_default("flat", null); param_default("flatCallback", null); param_default("onSelect", null); param_default("onClose", null); param_default("onUpdate", null); param_default("date", null); param_default("showsTime", false); param_default("timeFormat", "24"); param_default("electric", true); param_default("step", 2); param_default("position", null); param_default("cache", false); param_default("showOthers", false); param_default("multiple", null); var tmp = ["inputField", "displayArea", "button"]; for (var i in tmp) { if (typeof(params[tmp[i]])== "string") { params[tmp[i]] = document.getElementById(params[tmp[i]]); } } if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); return false; } function onSelect(cal) { var p = cal.params; var update = (cal.dateClicked || p.electric); if (update && p.inputField) { p.inputField.value = cal.date.print(p.ifFormat); if (typeof(p.inputField.onchange)== "function") p.inputField.onchange(); } if (update && p.displayArea) p.displayArea.innerHTML = cal.date.print(p.daFormat); if (update && typeof(p.onUpdate)== "function") p.onUpdate(cal); if (update && p.flat) { if (typeof(p.flatCallback)== "function") p.flatCallback(cal); } if (update && p.singleClick && cal.dateClicked) cal.callCloseHandler(); }; if (params.flat != null) { if (typeof(params.flat)== "string") params.flat = document.getElementById(params.flat); if (!params.flat) { alert("Calendar.setup:\n Flat specified but can't find parent."); return false; } var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); cal.showsOtherMonths = params.showOthers; cal.showsTime = params.showsTime; cal.time24 = (params.timeFormat == "24"); cal.params = params; cal.weekNumbers = params.weekNumbers; cal.setRange(params.range[0], params.range[1]); cal.setDateStatusHandler(params.dateStatusFunc); cal.getDateText = params.dateText; if (params.ifFormat) { cal.setDateFormat(params.ifFormat); } if (params.inputField && typeof(params.inputField.value)== "string") { cal.parseDate(params.inputField.value); } cal.create(params.flat); cal.show(); return false; } var triggerEl = params.button || params.displayArea || params.inputField; triggerEl["on" + params.eventName] = function() { var dateEl = params.inputField || params.displayArea; var dateFmt = params.inputField ? params.ifFormat : params.daFormat; var mustCreate = false; var cal = window.calendar; if (dateEl) params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); if (!(cal && params.cache)) { window.calendar = cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect, params.onClose || function(cal) { cal.hide(); }); cal.showsTime = params.showsTime; cal.time24 = (params.timeFormat == "24"); cal.weekNumbers = params.weekNumbers; mustCreate = true; } else { if (params.date) cal.setDate(params.date); cal.hide(); } if (params.multiple) { cal.multiple = {}; for (var i = params.multiple.length; --i >= 0;) { var d = params.multiple[i]; var ds = d.print("%Y%m%d"); cal.multiple[ds] = d; } } cal.showsOtherMonths = params.showOthers; cal.yearStep = params.step; cal.setRange(params.range[0], params.range[1]); cal.params = params; cal.setDateStatusHandler(params.dateStatusFunc); cal.getDateText = params.dateText; cal.setDateFormat(dateFmt); if (mustCreate) cal.create(); cal.refresh(); if (!params.position) cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); else cal.showAt(params.position[0], params.position[1]); return false; }; return cal; };  var f_passport_onload; function passport_alive_do() { var req = new JsHttpRequest(); req.onreadystatechange = function() { }; req.open('GET', s_passport_alive_url, true); req.send({ }); setTimeout("passport_alive_do();",i_passport_alive_timeout); }; function passport_alive_startup() { if(!PASSPORT_ALIVE) return; if(typeof(i_passport_alive_timeout)=='undefined') { debug_error('[passport_alive_startup] `i_passport_alive_timeout` not exists'); return; } setTimeout('passport_alive_do();',i_passport_alive_timeout); } function passport_bot_edit_hide() { return http_request_hide('passport.bot'); } function passport_bot_edit_show(url,id) { return http_request_show('passport.bot','pbl-tr-'+id,'pbl-td-'+id,url,'<span class="loading">'+passport_msg_bot_edit_loading+'</span>',passport_bot_edit_startup); } function passport_bot_edit_startup() { var o=document.getElementById('passport_bot_edit_form'); if(!o||!o.s_login) { debug_error('[passport_bot_edit_startup()] `passport_bot_edit_form` form not found or `s_login` field is not found in the form.'); return false; } o.s_login.focus(); } function passport_bot_edit_submit(o_form) { if(!o_form) return false; return passport_bot_edit_form_validate(); } function passport_bot_remove(s) { return confirm(passport_msg_bot_remove+"\n\n"+s); } function passport_info_edit_submit(o_form) { if(!o_form.pwd) return true; if(o_form.pwd.value.length==0) { o_form.pwd.focus(); return false; } return passport_login_send(o_form); } function passport_login_send(o_form,s_prefix) { var s_name=o_form.id; if(!s_name) { debug_error('[passport_login_send] o_form does not contain form id.'); return false; } if(!s_prefix) s_prefix=''; var o=document.getElementById(s_name+'-process'); if(!o) { debug_error('[passport_login_send] `'+s_name+'-process` element is not found.'); return false; } if(!o_form[s_prefix+'password']) { debug_error('[passport_login_send] `o_form` does not contain `'+s_prefix+'password` field.'); return false; } if(!o_form[s_prefix+'pwd']) { debug_error('[passport_login_send] `o_form` does not contain `'+s_prefix+'pwd` field.'); return false; } if(o_form[s_prefix+'pwd'].value==0) { o_form[s_prefix+'pwd'].focus(); return false; } if(typeof(msg_passport_login_processing)=='string') o.innerHTML='<span class="loading">'+msg_passport_login_processing+'</span>'; else { alert(typeof(msg_passport_login_processing)); o.innerHTML='<span class="loading">Your login is being checked. Wait, please...</span>'; } o.style.display='block'; var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { o_form[s_prefix+'password'].value=hex_sha1(hex_sha1(o_form[s_prefix+'pwd'].value)+req.responseJS['notepad']); o_form[s_prefix+'pwd'].value=''; o_form[s_prefix+'i'].value=req.responseJS['i']; var o1=document.getElementById('passport_login_protect_frame'); if(o1&&o1.tagName=='IFRAME') { o_form['inline'].value='1'; o_form.target='passport_login_protect_frame'; } o_form.submit(); } }; req.open('GET', passport_url_login_notepad, true); req.send({ }); if(o_form['b_submit']) o_form['b_submit'].disable=true; else debug_error('[passport_login_send] `o_form` does not contain `b_submit` button.'); return false; } function passport_login_submit(o_form) { if (o_form.login.value.length == 0) {o_form.login.focus();return false;} if (o_form.pwd.value.length == 0) {o_form.pwd.focus();return false;} return passport_login_send(o_form); } function passport_mail_error_edit_hide() { return http_request_hide('passport.mail.error'); } function passport_mail_error_edit_show(url,id) { return http_request_show('passport.mail.error','pme-tr-'+id,'pme-td-'+id,url,'<span class="loading">'+msg_passport_mail_error_edit_loading+'</span>',passport_mail_error_edit_startup); } function passport_mail_error_edit_startup() { var o=document.getElementById('passport_mail_error_edit_form'); if(!o) return false; if(!o.s_mail) { debug_error('[passport_mail_error_edit_startup()] `passport_mail_error_edit_form` form does not contain `s_mail` field.'); return false; } o.s_mail.focus(); } function passport_mail_error_edit_submit(o_form) { if(!o_form) return false; return passport_mail_error_edit_form_validate(); } function passport_mail_error_remove(s_mail,s_comment) { return confirm(msg_passport_mail_error_remove+"\n\n"+s_mail+"\n\n"+s_comment); } function passport_mail_submit(o_form) { if(!o_form.s_mail) { debug_error('passport_mail_submit: `s_mail` field not exists'); return false; } if(!o_form.s_body) { debug_error('passport_mail_submit: `s_mail` field not exists'); return false; } if(!o_form.s_subject) { debug_error('passport_mail_submit: `s_mail` field not exists'); return false; } if(o_form.s_mail.value.length==0) { alert(msg_passport_mail_submit_mail_empty); o_form.s_mail.focus(); return false; } if(!cbjs_check_email(o_form.s_mail.value)) { alert(msg_passport_mail_submit_mail_invalid); o_form.s_mail.focus(); return false; } if(o_form.s_subject.value.length==0) { alert(msg_passport_mail_submit_subject_empty); o_form.s_subject.focus(); return false; } if(o_form.s_body.value.length==0) { alert(msg_passport_mail_submit_body_empty); o_form.s_body.focus(); return false; } return true; } function passport_menu_out_switch(mode) { var c_on=document.getElementById('passport_login_small'); if(!c_on) { if(DEBUG_MODE) alert('`passport_login_small` not found.'); return false; } var c_off=document.getElementById('passport_menu_out_label'); if(!c_off) { if(DEBUG_MODE) alert('`passport_menu_out_label` not found.'); return false; } if(mode) { c_on.style.display='block'; c_off.style.display='none'; c_on.login.focus(); } else { c_on.style.display='none'; c_off.style.display='block'; } return false; } function passport_privilege_edit_login_submit(o) { if (o.login.value.length==0 ) { o.login.focus(); return false; } return true; } cbjs_onload(passport_alive_startup); cbjs_onload(passport_mail_error_edit_startup);  var stat_referer_obj=''; function stat_domain_flood(url,i) { return http_request_show('stat.spam','ssl-'+i+'-style','ssl-'+i+'-html',url,'<span class="loading">'+stat_msg_domain_flood_loading+'</span>'); } function stat_item_hide() { return http_request_hide('stat.item'); } function stat_item_show(url,id) { if(id) { var id_html='si-'+id+'-html'; var id_style='si-'+id+'-style'; } else { var id_html='stat_view_item_td'; var id_style='stat_view_item_tr'; } return http_request_show('stat.item',id_style,id_html,url,'<span class="loading">'+stat_msg_item_loading+'</span>'); } function stat_item_vars(s_name,b_mode) { var o=layer('stat-item-form-'+s_name); if(!o.exists()) return true; o.display(b_mode); if(b_mode) { if(getWindowHeight()<=o.getHeight()) { kl_scroll_top(o.getAbsoluteTop()); } else { kl_scroll_top(o.getAbsoluteTop()+o.getHeight()-getWindowHeight()); } } return false; } function stat_spam_log_hide() { return http_request_hide('stat.spam'); } function stat_spam_log_show(url,i_ip) { return http_request_show('stat.spam','ssl-'+i_ip+'-style','ssl-'+i_ip+'-html',url,'<span class="loading">'+stat_msg_spam_log_loading+'</span>',stat_spam_log_startup); } function stat_spam_log_startup(a_xml,id_style,id_html) { o_helper.table_prepare(document.getElementById(id_html)); } function stat_proxy_hide() { return http_request_hide('stat.spam'); } function stat_proxy_show(url,i_ip) { return http_request_show('stat.spam','ssl-'+i_ip+'-style','ssl-'+i_ip+'-html',url,'<span class="loading">'+stat_msg_proxy_loading+'</span>',stat_proxy_startup); } function stat_proxy_startup() { } function stat_referer_hide() { return http_request_hide(stat_referer_obj); } function stat_referer_show(s_obj,url,id_style,id_html) { stat_referer_obj=s_obj; return http_request_show(s_obj,id_style,id_html,url,'<span class="loading">'+stat_msg_referer_loading+'</span>'); } function stat_spam_remove(ip) { return confirm(stat_msg_spam_remove+"\n\n"+ip); }  var a_xmlfilter_tinymce=[]; var i_xmlfilter_max_length=1; function xmlfilter_apply(s_open,s_close,s_default) { var o_body=xmlfilter_body(); if(!o_body) { if(DEBUG_MODE) alert('xmlfilter_apply: xmlfilter_body() could not find destination textarea'); return; } var s_text=''; if(isMSIE) { if(cbjs_select_can_text()) s_text=cbjs_select_get_text(); if(s_text=='') s_text=s_default; if(cbjs_select_can_parent()&&cbjs_select_get_parent()!=o_body) s_text=xmlfilter_chars(s_text); o_body.focus(); if(s_text.charAt(s_text.length-1)==' ') { cbjs_select_set_text(s_open+s_text.substring(0,s_text.length-1)+s_close+' '); } else { cbjs_select_set_text(s_open+s_text+s_close); } } else if (isMozilla) { var replaced = false; var startPos = o_body.selectionStart; var endPos = o_body.selectionEnd; if (endPos-startPos) { replaced = true; } var scrollTop = o_body.scrollTop; s_text=o_body.value.substring(startPos, endPos); if (!s_text) s_text=s_default; var s_subst; if (s_text.charAt(s_text.length - 1) == ' ') { s_subst = s_open + s_text.substring(0, (s_text.length - 1)) + s_close + ' '; } else { s_subst = s_open+s_text+s_close ; } o_body.value = o_body.value.substring(0, startPos) + s_subst + o_body.value.substring(endPos, o_body.value.length); o_body.focus(); if (replaced) { var cPos = startPos+s_open.length+s_text.length+s_close.length; o_body.selectionStart = cPos; o_body.selectionEnd = cPos; } else { o_body.selectionStart = startPos+s_open.length; o_body.selectionEnd = startPos+s_open.length+s_text.length; } s_open.scrollTop = scrollTop; } } function xmlfilter_body() { return document.getElementById('xmlfilter_body'); } function xmlfilter_bold() { xmlfilter_apply('<b>','</b>',msg_xmlfilter_bold); } function xmlfilter_change() { if(!xmlfilter_loaded()) return; var l=layer('xmlfilter_length'); var w=layer('xmlfilter_warning'); if(!l.exists()||!w.exists()) return; l.write(i_xmlfilter_max_length-xmlfilter_body().value.length); if(xmlfilter_body().value.length>i_xmlfilter_max_length) { w.display(true); } else { w.display(false); } return true; } function xmlfilter_chars(s) { s=s.replace(/&/g, "&amp;"); s=s.replace(/"/g, "&quot;"); s=s.replace(/</g, "&lt;"); s=s.replace(/>/g, "&gt;"); return s; } function xmlfilter_code() { xmlfilter_apply('<code>','</code>',msg_xmlfilter_code); } function xmlfilter_detach() { if(typeof(tinyMCE)=='object') tinyMCE.triggerSave(); } function xmlfilter_email() { s=prompt(msg_xmlfilter_email,""); if(s==null) return; if(s=='') return; s=xmlfilter_chars(s); xmlfilter_text('<a href="mailto:'+s+'">'+s+"<\/a>"); } function xmlfilter_focus() { document.getElementById('xmlfilter_body').focus(); } function xmlfilter_hide() { if(typeof(tinyMCE)=='object'&&document.getElementById('xmlfilter_body')) { var i; for(i=0;i<a_xmlfilter_tinymce.length;i++) tinyMCE.execCommand('mceRemoveControl', false, a_xmlfilter_tinymce[i]); a_xmlfilter_tinymce=[]; } } function xmlfilter_italic() { xmlfilter_apply('<i>','</i>',msg_xmlfilter_italic); } function xmlfilter_img() { s=prompt(msg_xmlfilter_img,'http://'); if(s==null) return; if(s=='') return; xmlfilter_text('<img src="'+xmlfilter_chars(s)+'" />'); } function xmlfilter_list(s_tag,is_type) { var s_type=false; if(is_type) { if(confirm(msg_xmlfilter_list_char)) { if(confirm(msg_xmlfilter_list_arabic)) s_type="1"; else { if(confirm(msg_xmlfilter_list_rim_uppercase)) s_type="I"; else s_type='i'; } } else { if(confirm(msg_xmlfilter_list_char_lowercase)) s_type='a'; else s_type='A'; } } var s_open=s_tag; if(s_type) s_open=s_tag+' '+s_type; var s; if(confirm(msg_xmlfilter_list_wizard)) { s="\n"; while(true) { s1=prompt(msg_xmlfilter_list,""); if(s1==null) return; if(s1=='') break; s=s+" <li>"+xmlfilter_chars(s1)+"</li>\n"; } if(s=="\n") s="\n <li></li>\n"; } else { s="\n <li></li>\n"; } xmlfilter_text('<'+s_open+'>'+s+'</'+s_tag+'>'); } function xmlfilter_loaded() { if(document.getElementById('xmlfilter_body')) return true; else return false; } function xmlfilter_php() { xmlfilter_apply('<?php ',' ?>',msg_xmlfilter_php); } function xmlfilter_pre() { xmlfilter_apply('<?pre ',' ?>',msg_xmlfilter_pre); } function xmlfilter_quote(is_author,is_title,is_url,default_author,default_url) { var i; var s=''; var s_author=''; var s_url=''; var s_title=''; if(cbjs_select_can_text()) { if((is_author||is_href||is_title)&&cbjs_select_can_parent()) { var o_parent=cbjs_select_get_parent(); while(o_parent) { if(o_parent.className=='message'||o_parent.className=='forum-index-message'||o_parent.className=='talk-index-message') { var a_span=o_parent.getElementsByTagName('span'); for(i=0;i<a_span.length;i++) { if(o_parent.className=='message') { if(is_author&&s_author.length==0&&a_span[i].className=='hide-author') s_author=a_span[i].innerHTML; if(is_url&&s_url.length==0&&a_span[i].className=='hide-url') s_url=a_span[i].innerHTML; } if(is_title&&s_title.length==0&&a_span[i].className=='hide-title') s_title=a_span[i].innerHTML; if((!is_author||s_author.length>0)&&(!is_url||s_url.length>0)&&(!is_title||s_title.length>0)) break; } if((!is_author||s_author.length>0)&&(!is_url||s_url.length>0)&&(!is_title||s_title.length>0)) break; } o_parent=kl_parentNode(o_parent); } } } if(is_author&&s_author.length==0&&default_author) s_author=default_author; if(is_url&&s_url.length==0&&default_url) s_url=default_url; if(is_author&&s_author.length==0) { s_author=prompt(msg_xmlfilter_quote_author,""); if(s_author==null) return; } if(is_title&&s_title.length==0) { s_title=prompt(msg_xmlfilter_quote_title,""); if(s_title==null) return null; } if(is_url&&s_url.length==0) { s_url=prompt(msg_xmlfilter_quote_href,""); if(s_url==null) return null; } s='<quote'; if(s_author.length>0) s=s+' author="'+xmlfilter_chars(s_author)+'"'; if(s_title.length>0) s=s+' title="'+xmlfilter_chars(s_title)+'"'; if(s_url.length>0) s=s+' href="'+xmlfilter_chars(s_url)+'"'; s=s+'>'; xmlfilter_apply(s,'</quote>',msg_xmlfilter_quote); } function xmlfilter_sign() { if(!xmlfilter_loaded()) return; xmlfilter_apply('',' ~~~~',''); } function xmlfilter_smile_advanced(t) { xmlfilter_text('<smile src="'+xmlfilter_chars(t)+'" />'); } function xmlfilter_smile_mode(url) { var l=layer('xmlfilter_form_smile'); if(l.exists()) { if(url) { l.display(true); l.write('<span class="loading">'+msg_xmlfilter_smile_loading+'</span>'); var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { l.write(req.responseText); setTimeout('xmlfilter_smile_size(true)',10); } }; req.caching = true; req.open('GET', url, true); req.send({ }); } else l.display(false); } xmlfilter_focus(); } function xmlfilter_smile_simple(t) { xmlfilter_text(xmlfilter_chars(t)); } function xmlfilter_smile_size(m) { if(!xmlfilter_smile_width()) { var o=cbjs_object('xmlfilter_smile_body_div'); if(o) { var o1=cbjs_object('xmlfilter_smile_body_table'); if(o1) { var h1=cbjs_object_offset_height(o); var h=cbjs_object_offset_height(o1)+h1-cbjs_object_client_height(o); if(h<16) h=16; if(h1!=h) { cbjs_object_offset_height(o,h); if(!m) setTimeout('xmlfilter_smile_size()',10); return; } } } if(!m) setTimeout('xmlfilter_smile_size()',1000); } else { if(!m) setTimeout('xmlfilter_smile_size()',10); } } function xmlfilter_smile_width() { var l=layer('xmlfilter_smile_body_div'); if(!l.exists()) return false; var l1=layer('xmlfilter_form_smile'); if(!l1.exists()) return false; var w=getWindowWidth()-cbjs_document_scroll_width()+cbjs_object_client_width(l1.object); if(l.offsetWidth()==w) return false; l.offsetWidth(w); return true; } function xmlfilter_startup(a_settings) { if(a_settings&&a_settings['is-tinymce']) { if(typeof(tinyMCE)=='object'&&document.getElementById('xmlfilter_body')) { xmlfilter_tinymce_init(a_settings); tinyMCE.execCommand('mceAddControl', false, 'xmlfilter_body'); a_xmlfilter_tinymce[a_xmlfilter_tinymce.length]='xmlfilter_body'; } else debug_info('[xmlfilter_startup] TinyMCE init OK.'); } else { var c; i_xmlfilter_max_length=a_settings['max-body-length']; xmlfilter_change(); c=document.getElementById('xmlfilter_info'); if(c) c.style.display=''; c=document.getElementById('xmlfilter_form_js_table'); if(c) c.style.display=''; c=document.getElementById('xmlfilter_smile_switch'); if(c) { c.style.display=''; xmlfilter_smile_mode(false); xmlfilter_smile_size(); } } } function xmlfilter_text(t) { var b; b=xmlfilter_body(); if(!b) return; b.value=b.value+t; xmlfilter_focus(); xmlfilter_change(); } function xmlfilter_tinymce_init(a_settings) { tinyMCE.init(a_settings); } function xmlfilter_underline() { xmlfilter_apply('<u>','<\/u>',msg_xmlfilter_underline); } function xmlfilter_url() { var s,s1,s2,b; s=prompt(msg_xmlfilter_url_href,'http://'); if(s==null) return; if(s=='') return; s1=prompt(msg_xmlfilter_url_title,""); if(s1==null) return; b=confirm(msg_xmlfilter_url_blank); if(b) s2=' target="_blank"'; else s2=''; if(s1=='') { xmlfilter_text('<a href="'+s+'"'+s2+'>'+xmlfilter_chars(s)+"<\/a>"); } else xmlfilter_text('<a href="'+s+'"'+s2+'>'+xmlfilter_chars(s1)+"<\/a>"); } function xmlfilter_user(t) { if(!xmlfilter_loaded()) return; if(xmlfilter_body().value.length==0) xmlfilter_text("<b>"+xmlfilter_chars(t)+"<\/b>,\n"); else xmlfilter_text("\n<b>"+xmlfilter_chars(t)+"<\/b>,\n"); }  o_dic = { a_file_cache:{}, o_tooltip:null, o_timer_show: null, o_timer_hide: null, s_current: '', s_file: '', i_hide_timeout:false, is_visible:false, is_fixed:false, is_updating:false, attach_event: function(o, e, a){ if (o.addEventListener) o.addEventListener(e, a, false); else if (o.attachEvent) o.attachEvent("on" + e, a); else return null; }, do_blur: function(e){ o_dic.schedule_hide(300); }, do_click: function(e) { o_dic.schedule_show(e,100); }, do_hide: function(e){ if(o_dic.is_updating) return; o_dic.s_file=''; o_dic.o_tooltip.style.visibility = "hidden"; o_dic.o_tooltip.style.display = "none"; o_dic.o_tooltip.innerHTML=''; o_dic.unschedule(); o_dic.i_hide_timeout=false; o_dic.is_visible = false; }, do_move: function(x, y,old_width,old_height,old_x,old_y,c) { if(c>10) return; oCanvas = document.getElementsByTagName( (document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0]; w_width = window.innerWidth ? window.innerWidth + window.pageXOffset : oCanvas.clientWidth + oCanvas.scrollLeft; w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : oCanvas.clientHeight + oCanvas.scrollTop; t_width = window.event ? o_dic.o_tooltip.clientWidth : o_dic.o_tooltip.offsetWidth; t_height = window.event ? o_dic.o_tooltip.clientHeight : o_dic.o_tooltip.offsetHeight; if(old_width&&old_height&&old_x&&old_y&&t_width==old_width&&t_height==old_height&&x==old_x&&y==old_y) return; old_x=x; old_y=y; t_extra_width = 16; t_extra_height = 16; if(x + t_width + t_extra_width > w_width&&x>w_width*0.2||x<0) { if(t_width>w_width*0.7||t_width*t_height>w_width*14) x=w_width*0.2; else x=w_width-t_width-t_extra_width; } o_dic.o_tooltip.style.left = x + "px"; if(y+t_height+t_extra_height>w_height&&(!old_x||x==old_x)) { y=w_height-t_height-t_extra_height; } if(y<0) y=0; o_dic.o_tooltip.style.top = y + "px"; setTimeout("o_dic.do_move("+x+','+y+','+t_width+','+t_height+','+old_x+','+old_y+','+(c+1)+");",1); }, do_onload: function() { o_dic.o_tooltip=document.getElementById('dic_tooltip'); if(!o_dic.o_tooltip) { debug_error('dic_tooltip not found'); return; } o_dic.prepare(document); o_dic.o_tooltip.onmousemove=o_dic.do_over; o_dic.o_tooltip.onmouseout=o_dic.do_out; cbjs_object_event_attach(o_dic.o_tooltip,'blur',o_dic.do_blur); o_dic.attach_event(document, "click", o_dic.do_click); document.onmousemove= o_dic.do_over; }, do_out: function(e){ o_dic.schedule_hide(3000); }, do_over: function(e) { o_dic.schedule_show(e,500); }, get_position: function(o) { var c=0; var s=''; while(o.parentNode&&c<20) { var c1=0; c++; if(o.getAttribute("id")) { if(s.length!=0) s='.'+s; s=o.getAttribute("id")+s; } while(o.previousSibling!=null&&c1<100) { o=o.previousSibling; c1++; } if(s.length!=0) s='.'+s; s=c1+s; o=o.parentNode; } return s; }, html_load: function(s_file) { if(o_dic.a_file_cache[s_file]) { o_dic.o_tooltip.innerHTML=o_dic.a_file_cache[s_file]; return; } var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4 && req.responseJS.ok && o_dic.is_visible && o_dic.s_file==s_file) { o_dic.o_tooltip.innerHTML=req.responseText; setTimeout(function() { o_dic.prepare(o_dic.o_tooltip); o_dic.a_file_cache[s_file]=o_dic.o_tooltip.innerHTML; }, 1); } }; req.caching = false; req.open('GET', dic_url_body, true); req.send({ 's_file': s_file }); }, is_tooltip: function(o) { if(!o_dic.is_visible) return false; var c=0; while(o.parentNode&&c<20) { if(o.getAttribute('id')=='dic_tooltip'&&o.tagName=='DIV') return true; c++; o=o.parentNode; } return false; }, prepare: function(o_parent) { var a = o_parent.getElementsByTagName('SPAN'); var i; for (i=0;i<a.length;i++) { if(cbjs_object_class(a[i])=='nodic') continue; if(a[i].getAttribute('title')) { a[i].setAttribute('tooltip', a[i].getAttribute('title')); if(a[i].getAttribute('tooltip')) { a[i].removeAttribute('title'); if(a[i].getAttribute('alt') && a[i].complete) a[i].removeAttribute('alt'); o_dic.attach_event(a[i], "mouseout", o_dic.do_out); o_dic.attach_event(a[i], "mouseover", o_dic.do_over); o_dic.attach_event(a[i], "click", o_dic.do_click); } } else if (a[i].getAttribute("alt") && a[i].complete) { a[i].setAttribute('tooltip', a[i].getAttribute("alt")); if (a[i].getAttribute('tooltip')) { a[i].removeAttribute("alt"); o_dic.attach_event(a[i], "mouseover", o_dic.do_over); o_dic.attach_event(a[i], "mouseout", o_dic.do_out); o_dic.attach_event(a[i], "click", o_dic.do_click); } } } }, show: function(d,x,y) { if(o_dic.is_updating) return; var is_new=!o_dic.is_tooltip(d); if(!d.getAttribute('tooltip')) return; var s_position=o_dic.get_position(d); if(o_dic.is_visible&&o_dic.s_current.length>0&&o_dic.s_current == s_position) { o_dic.unschedule(); return; } o_dic.s_current = s_position; if(is_new&&o_dic.is_visible) o_dic.do_hide(); var want_position=!o_dic.is_visible; o_dic.is_visible = true; o_dic.s_file=''; cbjs_set_html(o_dic.o_tooltip,cbjs_nl2br(d.getAttribute('tooltip'))); var o=d.getAttribute('id'); if(o) { if(o.substr(0,14)=='dic-highlight-') { o_dic.s_file=o.substr(14,o.length-14); o_dic.html_load(o_dic.s_file); } } if(want_position) o_dic.do_move(x, y,false,false,false,false,0); o_dic.unschedule(); o_dic.is_updating=true; setTimeout("o_dic.o_tooltip.style.visibility = 'visible';o_dic.o_tooltip.style.display = 'inline';o_dic.o_tooltip.focus();o_dic.is_updating=false;", 100); }, schedule_hide: function (i_timeout) { if(!o_dic.is_visible||o_dic.is_updating) return; if(o_dic.i_hide_timeout&&o_dic.i_hide_timeout<=i_timeout) return; o_dic.unschedule(); o_dic.i_hide_timeout=i_timeout; o_dic.o_timer_hide = setTimeout("o_dic.do_hide();", i_timeout); }, schedule_show: function (e,i_timeout) { if(o_dic.is_updating) return; var d = window.event ? window.event.srcElement : e.currentTarget; var x; var y; if(!d.getAttribute) return; if(!d.getAttribute('tooltip')&&!o_dic.is_tooltip(d)) { o_dic.schedule_hide(3000); return; } o_dic.unschedule(); oCanvas = document. getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0]; x = window.event ? event.clientX + oCanvas.scrollLeft : e.pageX; y = window.event ? event.clientY + oCanvas.scrollTop : e.pageY; o_dic.o_timer_show=setTimeout(function(){ o_dic.show(d,x,y); }, i_timeout); }, unschedule:function() { if(o_dic.is_updating) return; clearTimeout(o_dic.o_timer_hide); clearTimeout(o_dic.o_timer_show); o_dic.o_timer_hide=null; o_dic.o_timer_show=null; o_dic.i_hide_timeout=false; } }; cbjs_onload(o_dic.do_onload);  var file_dir_edit_form_submitting=false; var file_file_edit_form_submitting=false; function file_dir_edit_body_show() { var o=document.getElementById('file-dir-edit-body-a'); if(o) o.style.display='none'; else if(DEBUG_MODE) alert('`file-dir-edit-body-a` not found.'); var o=document.getElementById('file-dir-edit-body-b'); if(o) { o.style.display='block'; } else if(DEBUG_MODE) alert('`file-dir-edit-body-b` not found.'); var o=document.getElementById('file-dir-edit-s_body'); if(o) o.focus(); return false; } function file_dir_edit_startup() { a_param_edit_show_button('file-dir-edit-param'); var o=document.getElementById('file_dir_edit_form'); if(!o) return; if(o.s_file) { o.s_file.focus(); return; } if(o.k_move) { o.k_move.focus(); return; } if(o.s_param) { o.s_param.focus(); return; } if(o.s_title) { o.s_title.focus(); return; } if(o.s_comment) { o.s_comment.focus(); return; } } function file_dir_edit_submit() { if(file_dir_edit_form_submitting) return false; if(a_param_edit_modified()) { alert(msg_file_dir_edit_nosubmit); return false; } file_dir_edit_form_submitting=true; document.getElementById('file_dir_edit_button').disabled=true; return true; } function file_dir_edit_hide() { return http_request_hide('file'); } function file_dir_edit_show(url) { return http_request_show('file','file-index-admin-style','file-index-admin-html',url,file_msg_dir_edit_loading,file_dir_edit_startup); } function file_file_edit_hide() { return http_request_hide('file'); } function file_file_edit_show(url,k_file) { if(k_file) return http_request_show('file','file-edit-'+k_file+'-style','file-edit-'+k_file+'-html',url,file_msg_file_edit_loading,file_file_edit_startup,false,false,true); else return http_request_show('file','file-index-admin-style','file-index-admin-html',url,file_msg_file_edit_loading,file_file_edit_startup,false,false,true); } function file_file_edit_startup() { var o=document.getElementById('file_file_edit_form'); if(!o) return; if(o.s_file) { o.s_file.focus(); return; } } function file_file_edit_submit() { if(file_file_edit_form_submitting) return false; var o=document.getElementById('file_file_edit_form'); if(!o) return false; if(!o.s_file) return false; if(o.s_src&&o.s_file&&o.s_src.value.length>0&&o.f_file.value.length>0) { alert(o.f_file.value); alert(file_msg_file_edit_error_src_file_both); o.s_src.focus(); return false; } file_file_edit_form_submitting=true; document.getElementById('file_file_edit_button').disabled=true; return true; }  var forum_message_topic=false; function forum_admin_theme_startup() { var f=document.getElementById('forum_admin_theme_form'); if(!f) return; a_param_edit_show_button('forum-admin-theme-form-param'); if(f.i_sort) { f.i_sort.focus(); return; } if(f.fn_theme) { f.fn_theme.focus(); return; } if(f.s_param) { f.s_param.focus(); return; } return; } function forum_admin_theme_submit() { if(a_param_edit_modified()) { alert(msg_forum_admin_theme_nosubmit_param); return false; } return true; } function forum_message_file_hide(k_message) { var l_tr=layer('id-reply-tr-'+k_message); if(!l_tr.exists()) return; l_tr.display(false); } function forum_message_file_show(k_message,fn_message,url_action) { var l_tr=layer('id-reply-tr-'+k_message); var l_td=layer('id-reply-td-'+k_message); if(!l_tr.exists()||!l_td.exists()) return; l_tr.display(true); l_td.write( '<form action="'+url_action+'" method="post" style="margin:0;" onsubmit="return confirm(msg_forum_message_file_confirm);">'+ '<input type="hidden" name="k_message" value="'+k_message+'" />'+ '<input type="text" name="fn_message" class="admin" value="'+fn_message+'" malength="255" size="32" />'+ '<input type="submit" class="admin" value="'+msg_forum_message_file_submit+'" />&nbsp;'+ '<input type="button" class="admin" onClick="forum_message_file_hide('+k_message+');" value="'+msg_forum_message_file_hide+'" />'+ '</form>'); return false; } function forum_message_remove() { return confirm(msg_forum_message_remove); } function forum_message_show(k_message,k_topic) { if(forum_message_topic&&forum_message_topic!=k_topic&&typeof(map_collapse)!='function') forum_message_hide(forum_message_topic); forum_message_topic=k_topic; c=document.getElementById('id-message-style-'+k_topic); if(c) c.style.display=''; document.getElementById('id-message-body-'+k_topic).innerHTML='<span class="loading">'+msg_forum_message_loading+'</span>'; var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { document.getElementById('id-message-body-'+k_topic).innerHTML=req.responseText; } }; req.caching = true; req.open('GET', forum_url_message_preview, true); req.send({ 'k_message': k_message }); return false; } function forum_message_hide(k_topic) { if(typeof(map_collapse)=='function') map_collapse('map-forum-topic-'+k_topic); c=document.getElementById('id-message-style-'+k_topic); if(c) c.style.display='none'; if(k_topic==forum_message_topic) forum_message_topic=false; return false; } function forum_reply_error_hide() { var o1=document.getElementById('forum-reply-form-theme-noselect'); if(o1) o1.style.display='none'; } function forum_reply_focus_first() { if(!document.forum_reply_form) return; if(document.forum_reply_form.s_user) { document.forum_reply_form.s_user.focus(); return; } if(document.forum_reply_form.k_theme) { document.forum_reply_form.k_theme.focus(); return; } if(document.forum_reply_form.s_title) { document.forum_reply_form.s_title.focus(); return; } if(document.forum_reply_form.s_body) { document.forum_reply_form.s_body.focus(); return; } } function forum_reply_hide() { return http_request_hide('forum.reply'); } function forum_reply_message_show(url,k_topic) { var l=layer('forum_reply_form_new_message_td'); if(!l.exists()) return true; l.write('<span class="loading">'+msg_forum_reply_message_loading+'</span>'); var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { l.write(req.responseText); setTimeout(function() { var o=document.getElementById('forum-message-list'); if(!o) return; o.focus(); }, 100); } }; req.caching = true; req.open('GET', url, true); req.send({'k_topic':k_topic}); return false; } function forum_reply_message_switch(url,k_topic) { var l_tr=layer('forum_reply_form_new_message_tr'); if(!l_tr.exists()) return true; if(k_topic==0) { l_tr.display(false); return false; } var l_td=layer('forum_reply_form_new_message_td'); if(!l_td.exists()) return true; l_tr.display(true); l_td.write('<a href="#" tabindex="15" onClick="return forum_reply_message_show(\''+url+"',"+k_topic+');">&gt;&gt;&gt;</a>'); return true; } function forum_reply_show(url,id_style,id_html) { return http_request_show('forum.reply',id_style,id_html,url,'<span class="loading">'+msg_forum_reply_loading+'</span>',forum_reply_startup); } function forum_reply_user(t) { xmlfilter_user(t); } function forum_reply_startup(a_settings) { xmlfilter_startup(a_settings); forum_reply_focus_first(); } function forum_reply_submit() { forum_reply_error_hide(); var l=layer('forum_reply_form'); if(!l.exists()) return false; var o=l.object; if(o.k_theme&&o.k_theme.value=='') { var o1=document.getElementById('forum-reply-form-theme-noselect'); if(o1) o1.style.display=''; o.k_theme.focus(); return false; } if(l.object['move-theme']&&l.object['move-theme'].value=='') { alert(msg_forum_reply_submit_disable); l.object[['move-theme']].focus(); return false; } if(l.object['is_rule']&&!l.object['is_rule'].checked) { alert(msg_forum_reply_submit_rule); return false; } return true; } function forum_reply_topic_show(url,k_theme) { var l=layer('forum_reply_form_new_topic'); if(!l.exists()) return true; l.display(true); l.write('<span class="loading">'+msg_forum_reply_topic_loading+'</span>'); var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { l.write(req.responseText); setTimeout(function() { if(!document.forum_reply_form) return; if(!document.forum_reply_form['move-topic']) return; document.forum_reply_form['move-topic'].focus(); }, 100); } }; req.caching = true; req.open('GET', url, true); req.send({'k_theme':k_theme}); return false; } function forum_reply_topic_switch(url,k_theme) { forum_reply_message_switch('',0); if(k_theme=='') return false; var l=layer('forum_reply_form_new_topic'); if(!l.exists()) return true; l.write('<a href="#" tabindex="15" onClick="return forum_reply_topic_show(\''+url+"',"+k_theme+');">&gt;&gt;&gt;</a>'); return true; } function forum_setup_avatar(s_url,s_this) { var o=cbjs_object('forum-setup-avatar-img'); if(!s_this||s_this.length==0) { cbjs_object_display(o,false); } else { cbjs_object_display(o,true); o.src=s_url+s_this+'.gif'; } } function forum_startup_main() { var c=document.getElementById('id-forum-main'); if(!c) return false; var a=c.getElementsByTagName('span'); var i; for(i=0;i<a.length;i++) { if(cbjs_object_class(a[i])=='preview') a[i].style.display=''; } } function forum_startup() { forum_startup_main(); } function forum_theme_remove() { return confirm(msg_forum_theme_remove); } function forum_topic_close() { return confirm(msg_forum_topic_close); } function forum_topic_file_confirm() { return confirm(msg_forum_topic_file_confirm); } function forum_topic_move(url) { if(url=='') return; if(!confirm(msg_forum_topic_move)) return; window.location.href=url; } function forum_topic_remove() { return confirm(msg_forum_topic_remove); } function forum_topic_sticky() { return confirm(msg_forum_topic_sticky); } function forum_topic_unit() { return confirm(msg_forum_topic_unit); } function forum_topic_unsubscribe(s) { return confirm(msg_forum_topic_unsubscribe+'\n\n'+s); } function forum_topic_vote() { return confirm(msg_forum_topic_vote); } cbjs_onload(forum_startup);  function news_item_hide() { return http_request_hide('news'); } function news_item_show(id,url) { return http_request_show('news','news-tr-'+id,'news-td-'+id,url,'\<span class="loading"\>'+msg_news_item_edit_loading+'\</span\>',news_item_edit_startup); } function news_item_edit_startup() { var f=document.getElementById('news_item_form'); if(!f) return; var o=document.getElementById('news-item-button-dt_create'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "news-item-button-dt_create", step : 1, inputField : "news-item-field-dt_create" }); } else debug_error('[news_item_edit_startup] `news-item-button-dt_create` item not exists'); var o=document.getElementById('news-item-button-dt_sticky'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "news-item-button-dt_sticky", step : 1, inputField : "news-item-field-dt_sticky" }); } else debug_error('[news_item_edit_startup] `news-item-button-dt_sticky` item not exists'); var o=document.getElementById('news-item-button-dt_publish'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "news-item-button-dt_publish", step : 1, inputField : "news-item-field-dt_publish" }); } else debug_error('[news_item_edit_startup] `news-item-button-dt_publish` item not exists'); f.s_comment.focus(); news_admin_item_change(); } function news_item_rollback() { return confirm(msg_news_item_log_rollback); } function news_manual_change(o_field,s_id,i_length) { var i_chars=i_length-o_field.value.length; if(i_chars>=0) { var o=document.getElementById(s_id+'-chars'); if(o.style.display!='inline') { o.style.display='inline'; var o1=document.getElementById(s_id+'-long'); o1.style.display='none'; } o.innerHTML=i_chars; } else { var o=document.getElementById(s_id+'-long'); if(o.style.display!='inline') { o.style.display='inline'; var o1=document.getElementById(s_id+'-chars'); o1.style.display='none'; } } } function news_theme_submit(o_form,k_theme) { if(a_param_edit_modified()) { alert(msg_news_edit_nosubmit); return false; } return true; }  function rotator_item_edit_change() { var f=document.getElementById('rotator_item_edit_form'); var l=layer('rotator_item_edit_length'); if(!f||!l.exists()||!f.s_body) return; var n=i_rotator_item_length-f.s_body.value.length; if(n<0) { l.write('&nbsp;<b style="color:#ff0000;font-weight:bold;">'+n+'</b>'); } else { l.write('&nbsp;'+n); } return true; } function rotator_item_edit_hide() { return http_request_hide('rotator.item'); } function rotator_item_edit_show(url,id) { return http_request_show('rotator.item','rotator-tr-'+id,'rotator-td-'+id,url,'<span class="loading">'+msg_rotator_item_loading+'</span>',rotator_item_edit_startup); } function rotator_item_edit_startup() { var f=document.getElementById('rotator_item_edit_form'); if(!f) return; f.s_body.focus(); rotator_item_edit_change(); } function rotator_item_remove() { return confirm(msg_rotator_item_remove); } function rotator_startup() { rotator_item_edit_startup(); } cbjs_onload(rotator_startup);  var s_seqrch_quick_text=''; function search_quick_submit(o_form) { var s=cbjs_object_class(o_form.q); if(s=='search-quick-passive'||o_form.q.value.length==0) { o_form.q.focus(); return false; } else return true; } function search_quick_focus(o_input) { var s=cbjs_object_class(o_input); if(s=='search-quick-active') return; s_seqrch_quick_text=o_input.value; o_input.value=''; cbjs_object_class(o_input,'search-quick-active'); } function search_quick_blur(o_input) { var s=cbjs_object_class(o_input); if(s=='search-quick-passive') return; if(o_input.value!='') return; o_input.value=s_seqrch_quick_text; cbjs_object_class(o_input,'search-quick-passive'); }  var text_dir_id_style=false; var text_dir_id_html=false; function text_category_edit_hide() { xmlfilter_hide(); return http_request_hide('text.category'); } function text_category_edit_show(url,id) { return http_request_show('text.category',id+'-tr',id+'-td',url,'<span class="loading">'+msg_text_category_edit_loading+'</span>',text_category_edit_startup); } function text_category_edit_startup() { var o=document.getElementById('text_category_edit'); if(!o) { debug_error('[text_category_edit_startup] `text_category_edit` form not found.'); return false; } if(!o.s_group) { debug_error('[text_category_edit_startup()] `text_category_edit` form does not contain `s_group` field.'); return false; } o.s_group.focus(); return true; } function text_category_edit_submit(o_form) { if(!o_form) return false; return text_category_edit_validate(); } function text_category_remove() { return confirm(msg_text_category_remove); } function text_body_picture(fn) { var o; o = window.open(fn,"text_body_picture_window",""); o.focus(); return false; } function text_dir_inline(o) { if(!o.is_inline) { debug_error('[text_dir_inline] field not exists: is_inline in text_dir_inline'); return false; } o.is_inline.value=1; o.target='text_dir_frame'; } function text_dir_order(o) { if(confirm(msg_text_dir_order)) { if(o.do_submit) o.do_submit.disabled=true; return true; } else return false; } function text_dir_remove() { return confirm(msg_text_dir_remove); } function text_dir_rename() { return confirm(msg_text_dir_rename); } function text_dir_hide() { return http_request_hide('text'); } function text_dir_show(url,id_style,id_html) { if(id_style) text_dir_id_style=id_style; else id_style=text_dir_id_style; if(id_html) text_dir_id_html=id_html; else id_html=text_dir_id_html; return http_request_show('text',id_style,id_html,url,'<span class="loading">'+msg_text_dir_loading+'</span>',text_dir_startup,null,false,false); } function text_dir_startup() { var o=document.getElementById('text_data_form'); if(!o) return; if(o.s_file) { o.s_file.focus(); return; } if(o.k_move) { o.k_move.focus(); return; } if(o.s_param) { o.s_param.focus(); return; } } function text_edit_focus() { var o=document.getElementById('text_edit_form'); if(!o) return false; if(o.s_file.value.length==0 ) {o.s_file.focus();return false;} if(o.s_title.value.length==0 ) {o.s_title.focus();return;} if(o.s_comment.value.length==0 ) {o.s_comment.focus();return;} if(o.s_body.style.display!='none') o.s_body.focus(); } function text_edit_hide() { xmlfilter_hide(); return http_request_hide('text'); } function text_edit_show(url,id_style,id_html) { return http_request_show('text',id_style,id_html,url,text_view_admin_loading,text_edit_startup); } function text_edit_startup(a_settings) { a_param_edit_show_button('text-edit-form-param'); var o=document.getElementById('text-edit-news-button-dt_create'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "text-edit-news-button-dt_create", step : 1, inputField : "text-edit-news-field-dt_create" }); } var o=document.getElementById('text-edit-news-button-dt_sticky'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "text-edit-news-button-dt_sticky", step : 1, inputField : "text-edit-news-field-dt_sticky" }); } var o=document.getElementById('text-edit-news-button-dt_publish'); if(o) { o.style.display=''; Calendar.setup({ showsTime : true, button : "text-edit-news-button-dt_publish", step : 1, inputField : "text-edit-news-field-dt_publish" }); } var f_closure=function(){ xmlfilter_startup(a_settings); text_edit_focus(); }; cbjs_onload(f_closure); } function text_edit_submit() { if(a_param_edit_modified()) { alert(msg_text_edit_nosubmit); return false; } xmlfilter_detach(); var o=document.getElementById('text_edit_form'); if(!o) return false; if(o.s_title.value.length==0 ) {o.s_title.focus();return false;} if(o.s_comment.value.length==0 ) {o.s_comment.focus();return false;} if(o.s_body.value.length==0 ) {o.s_body.focus();return false;} return true; } function text_view_admin_edit(self,k_text) { while(self&&self.className!='text-view-admin') self=kl_parentNode(self); if(!self) { debug_error('[text_view_admin_edit]: container element not found for k_text='+k_text); return false; } if(self.id=='') { var s_id='q'+Math.random()+'w'; self.id=s_id; var a=self.getElementsByTagName('div'); for(var i=0;i<a.length;i++) { if(a[i].className=='panel-button') a[i].id=s_id+k_text+'-a'; if(a[i].className=='panel') a[i].id=s_id+k_text+'-b'; } var a=self.getElementsByTagName('table'); for(var i=0;i<a.length;i++) { if(a[i].className=='panel') { a[i].id=s_id+k_text+'-b'; break; } } } else s_id=self.id; var o=document.getElementById(s_id+k_text+'-a'); if(o) o.style.display='none'; var o=document.getElementById(s_id+k_text+'-b'); if(o) { o.style.display=''; return false; } debug_error('[text_view_admin_edit]: admin panel not found for k_text='+k_text); return true; } function text_view_admin_hide(self,k_text) { while(self&&self.className!='text-view-admin') self=kl_parentNode(self); if(!self) { debug_error('[text_view_admin_hide]: container element not found for k_text='+k_text); return false; } if(self.id=='') { debug_error('[text_view_admin_hide]: `self.id` has not been set for k_text='+k_text); return false; } s_id=self.id; var o=document.getElementById(s_id+k_text+'-a'); if(o) o.style.display=''; var o=document.getElementById(s_id+k_text+'-b'); if(o) { o.style.display='none'; return false; } return true; } cbjs_onload(text_dir_startup);  function vote_dir_admin_show(s_id) { var o=document.getElementById('vote-dir-admin-'+s_id+'-a'); if(o) o.style.display='none'; var o=document.getElementById('vote-dir-admin-'+s_id+'-b'); if(o) { o.style.display=''; return false; } return true; } function vote_dir_admin_hide(s_id) { var o=document.getElementById('vote-dir-admin-'+s_id+'-a'); if(o) o.style.display=''; var o=document.getElementById('vote-dir-admin-'+s_id+'-b'); if(o) o.style.display='none'; return false; } function vote_dir_edit_hide() { return http_request_hide('vote.admin'); } function vote_dir_edit_show(id,url) { return http_request_show('vote.admin','vde-tr-'+id,'vde-td-'+id,url,'<span class="vote-loading">'+vote_msg_dir_edit_loading+'</span>',vote_dir_edit_startup); } function vote_dir_edit_startup() { var o=document.getElementById('vote_dir_edit_form'); if(!o) { if(DEBUG_MODE) alert('vote_dir_edit_startup: form not found'); return false; } if(o.i_sort&&o.i_sort.value.length==0) { o.i_sort.focus(); return true; } if(o.fn_dir&&o.fn_dir.value.length==0) { o.fn_dir.focus(); return true; } o.s_title.focus(); return true; } function vote_index_single_reply_submit(o_form,s_require,s_unique,is_inline,s_random) { if(s_require.length>0) { if(!vote_reply_variant_selected(s_require)) { alert(msg_vote_index_reply_require); return false; } } if(s_unique.length>0) { if(!vote_reply_variant_unique([s_unique])) { alert(msg_vote_index_reply_unique); return false; } } if(is_inline) { var c=document.getElementById('visa-wait-'+s_random); if(c) c.style.display=''; var c=document.getElementById('visa-result-'+s_random); if(c) c.style.display='none'; o_form.target='visa-frame-'+s_random; o_form['is-inline'].value='1'; } return true; } function vote_question_admin_hide(s_id) { if(s_id) { var o=document.getElementById('vote-question-admin-'+s_id+'-a'); if(o) o.style.display=''; var o=document.getElementById('vote-question-admin-'+s_id+'-b'); if(o) o.style.display='none'; return false; } else { return http_request_hide('vote.question'); } } function vote_question_admin_show(s_id,s_url) { if(s_url) { return http_request_show('vote.question','vqa-tr-'+s_id,'vqa-td-'+s_id,s_url,'<span class="vote-loading">'+vote_msg_question_admin_loading+'</span>',vote_question_admin_startup); } else { var o=document.getElementById('vote-question-admin-'+s_id+'-a'); if(o) o.style.display='none'; var o=document.getElementById('vote-question-admin-'+s_id+'-b'); if(o) { o.style.display=''; return false; } return true; } } function vote_question_admin_startup() { vote_question_edit_startup(); } function vote_question_body_change() { var f=document.getElementById('vote_question_edit_form'); var l=layer('vote_question_body_chars'); if(!f||!l.exists()||!f.s_body) return; var n=VOTE_QUESTION_BODY_LENGTH-f.s_body.value.length; if(n<0) { l.write('<span style="color:#ff0000;font-weight:bold;">'+n+'</span>'); } else { l.write(n); } return true; } function vote_question_edit_change() { var f=document.getElementById('vote_question_edit_form'); var l=layer('vote_question_edit_chars'); if(!f||!l.exists()||!f.s_comment) return; var n=VOTE_QUESTION_COMMENT_LENGTH-f.s_comment.value.length; if(n<0) { l.write('<span style="color:#ff0000;font-weight:bold;">'+n+'</span>'); } else { l.write(n); } return true; } function vote_question_edit_hide() { return http_request_hide('vote.admin'); } function vote_question_edit_show(id,url) { return http_request_show('vote.admin','vde-tr-'+id,'vde-td-'+id,url,'<span class="vote-loading">'+vote_msg_question_edit_loading+'</span>',vote_question_edit_startup); } function vote_question_edit_startup() { var f=document.getElementById('vote_question_edit_form'); if(!f) return; f.s_title.focus(); vote_question_edit_change(); vote_question_body_change(); vote_question_variant_change() } function vote_question_remove() { return confirm(vote_msg_question_remove); } function vote_question_variant_change() { var f=document.getElementById('vote_question_edit_form'); var l=layer('vote_question_variant_chars'); if(!f||!l.exists()||!f.s_variant) return; var n=VOTE_QUESTION_VARIANT_LENGTH-f.s_variant.value.length; if(n<0) { l.write('<span style="color:#ff0000;font-weight:bold;">'+n+'</span>'); } else { l.write(n); } return true; } function vote_reply_inline_all(s_result,s_random) { var c=document.getElementById('visa-all-'+s_random); if(c) c.innerHTML=s_result; } function vote_reply_inline_result(s_result,s_random) { var c=document.getElementById('visa-wait-'+s_random); if(c) c.style.display='none'; var c=document.getElementById('visa-result-'+s_random); if(c) { c.innerHTML=s_result; c.style.display=''; } } function vote_reply_list_hide(k_variant) { var o=document.getElementById('vote-reply-head-'+k_variant+'-a'); if(o) o.style.display=''; var o=document.getElementById('vote-reply-head-'+k_variant+'-b'); if(o) o.style.display='none'; return false; } function vote_reply_list_show(k_variant) { var o=document.getElementById('vote-reply-head-'+k_variant+'-a'); if(o) o.style.display='none'; var o=document.getElementById('vote-reply-head-'+k_variant+'-b'); if(o) o.style.display=''; return false; } function vote_reply_remove() { return confirm(vote_msg_reply_remove); } function vote_reply_variant_change(o,k_variant) { var o1=document.getElementById('vote-reply-variant-'+k_variant+'-a'); if(!o1) return; o1.checked=o.value.length>0; } function vote_reply_variant_selected(a_variant) { if(typeof(a_variant[0])=='object') return vote_reply_variant_selected_split(a_variant); for(var i=0;i<a_variant.length;i++) { var k_variant=a_variant[i]; var o=document.getElementById('vote-reply-variant-'+k_variant); if(!o) { if(DEBUG_MODE) alert('vote_reply_variant_selected: Item not found: vote-reply-variant-'+k_variant); return false; } if(o.tagName=='INPUT') { if(o.type=='radio' || o.type=='checkbox') { if(o.checked) return true; continue; } else if(o.type=='text') { if(o.value.length>0) return true; continue; } if(DEBUG_MODE) alert('vote_reply_variant_selected: Unknown input type: '+o.type+' for k_variant='+k_variant); return false; } else if(o.tagName=='SELECT') { if(o.selectedIndex!=0) return true; continue; } else if(o.tagName=='TEXTAREA') { if(o.value.length>0) return true; continue; } if(DEBUG_MODE) alert('vote_reply_variant_selected: Unknown tagName: '+o.tagName+' for k_variant='+k_variant); return false; } for(i=0;i<a_variant.length;i++) { k_variant=a_variant[i]; var o=document.getElementById('vote-reply-variant-'+k_variant); if(o) { o.focus(); return false; } } return false; } function vote_reply_variant_selected_split(a_variant) { var i; for(i=0;i<a_variant.length;i++) { if(!vote_reply_variant_selected(a_variant[i])) return false; } return true; } function vote_reply_variant_unique(a_variant) { if(typeof(a_variant[0])=='object') return vote_reply_variant_unique_split(a_variant); var has_selected=false; var i; var is_unique=true; var k_variant; var k_selected=false; var o; for(i=0;i<a_variant.length;i++) { k_variant=a_variant[i]; o=document.getElementById('vote-reply-variant-'+k_variant); if(!o) continue; if(o.tagName=='INPUT') { if(o.type=='radio' || o.type=='checkbox') { if(o.checked) { if(has_selected) is_unique=false; else has_selected=true; } continue; } else if(o.type=='text') { if(o.value.length>0) { if(has_selected) is_unique=false; else has_selected=true; k_selected=k_variant; } continue; } return false; } else if(o.tagName=='SELECT') { if(o.selectedIndex!=0) { if(has_selected) is_unique=false; else has_selected=true; } continue; } else if(o.tagName=='TEXTAREA') { if(o.value.length>0) { if(has_selected) is_unique=false; else has_selected=true; k_selected=k_variant; } continue; } } if(is_unique) { if(k_selected) { var o=document.getElementById('vote-reply-variant-'+k_selected+'-a'); if(o&&!o.checked) return false; } return true; } for(i=0;i<a_variant.length;i++) { k_variant=a_variant[i]; var o=document.getElementById('vote-reply-variant-'+k_variant); if(o) { o.focus(); return false; } } return false; } function vote_reply_variant_unique_split(a_variant) { var i; for(i=0;i<a_variant.length;i++) { if(!vote_reply_variant_unique(a_variant[i])) return false; } return true; } 