 var mp_startup_list=[]; var mp_startup_old=window.onload; function mp_startup() { if(mp_startup_old) mp_startup_old(); var i; for(i=0;i<mp_startup_list.length;i++) mp_startup_list[i](); } function mp_startup_register(f_function) { mp_startup_list[mp_startup_list.length]=f_function; } window.onload = mp_startup;  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'; } } } mp_startup_register(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; }  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 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(); } mp_startup_register(debug_startup);  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_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_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 image_upload_add() { 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'); if(c) c.style.display=''; c=document.getElementById('image-upload-table'); if(!c) { if(DEBUG_MODE) alert('image_upload_add: image-upload-table not found'); return; } p=false; for(i=0; i<IMAGE_UPLOAD_COUNT; i++) { d=document.getElementById('image-upload-item-'+i); if(d) { if(d.style.display!='none') { p=d; continue; } d.style.display=''; return; } o = image_upload_empty(i); if(!p) { if(c.hasChildNodes()) { c.insertBefore(o,c.firstChild); } else { c.insertBefore(o); } } else if(p&&p.nextSibling) { c.insertBefore(o,p.nextSibling); } else { c.insertBefore(o,null); } return; } } function image_upload_remove() { if(!document.getElementById) return; var i,c,c1; var has_visible=false; for (i = IMAGE_UPLOAD_COUNT-1; i>=0; i--) { c=document.getElementById('image-upload-item-'+i); if(!c||c.style.display=='none') continue; if(document.getElementById('image-upload-check-'+i)) { has_visible=true; continue; } c1=document.getElementById('image-upload-file-'+i); if(c1&&c1.value.length!=0) { has_visible=true; continue; } c1=document.getElementById('image-upload-comment-'+i); 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'); if(c1) c1.style.display='none'; } } function image_upload_empty(idx) { var o=document.createElement('tr'); o.id='image-upload-item-'+idx; 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+'" 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+'" name="imt'+idx+'" style="width:100%;" value="" />'; o.appendChild(c); return o; } 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&&(d.tagName!='TR'||!d.getAttribute('default-color'))) d=d.parentNode; if(d) cbjs_set_backgroundcolor(d,d.getAttribute('default-color')); }, table_mouse_over: function(e) { var d = window.event ? window.event.srcElement : e.currentTarget; while(d&&(d.tagName!='TR'||!d.getAttribute('default-color'))) d=d.parentNode; if(d) cbjs_set_backgroundcolor(d,'#bbbbbb'); }, 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; o_tr.setAttribute('default-color', o_tr.getAttribute('bgcolor')); if(o_tr.getAttribute('bgcolor').length==0) { if(o_helper.is_even) o_tr.setAttribute('bgcolor','#dddddd'); else o_tr.setAttribute('bgcolor','#eeeeee'); o_helper.is_even=!o_helper.is_even; } if(o_tr.getAttribute('default-color')) { cbjs_object_event_attach(o_tr,'mouseover',o_helper.table_mouse_over); cbjs_object_event_attach(o_tr,'mouseout',o_helper.table_mouse_out); } } }; mp_startup_register(o_helper.do_onload);  function JSHttpRequest() {} (function() { var count = 0; var pending = {}; var cache = {}; JSHttpRequest.dataReady = function(id, text, js) { var th = pending[id]; if (th) { if (th.caching) cache[th.hash] = [text, js]; th._dataReady(text, js); } else { alert("ScriptLoader: unknown pending id: "+id); } }; JSHttpRequest.prototype = { onreadystatechange: null, readyState: 0, responseText: null, responseXML: null, status: 200, statusText: "OK", responseJS: null, caching: false, _span: null, abort: function() { this.readyState = 0; var span = this._span; if (span) { this._span = null; setTimeout(function() { span.parentNode.removeChild(span); }, 100); } return false; }, open: function(method, url, asyncFlag, username, password) { if ((""+method).toLowerCase() != 'get') { alert('Only GET method is supported!'); return false; } this.url = url; return true; }, send: function(content) { var id = count++; var query = []; if (content instanceof Object) { for (var k in content) { query[query.length] = escape(k) + "=" + escape(content[k]); } } else { query = [content]; } var hash = this.url + '?' + query.join('&'); query[query.length] = 'http-request-id='+id; var href = this.url + (this.url.indexOf('?')>=0? '&' : '?') + query.join('&'); this.hash = hash; if (this.caching && cache[hash]) { var c = cache[hash]; this._dataReady(c[0], c[1]); return false; } with (document) { var span = body.appendChild(createElement("SPAN")); span.style.display = 'none'; span.innerHTML = 'Text for stupid IE.<script type="text/javascript"></' + 'script>'; this._span = span; pending[id] = this; setTimeout(function() { var s = span.getElementsByTagName("script")[0]; s.language = "JavaScript"; s.src = href; }, 10); } return true; }, getAllResponseHeaders: function() { return ''; }, getResponseHeader: function(label) { return ''; }, setRequestHeader: function(label, value) { }, _dataReady: function(text, js) { with (this) { if (text !== null || js !== null) { readyState = 4; responseText = responseXML = text; responseJS = js; } else { readyState = 0; responseText = responseXML = responseJS = null; } onreadystatechange(); var span = this._span; if (span) { this._span = null; setTimeout(function() { span.parentNode.removeChild(span); }, 100); } }} }; })(); var http_request_open = {}; function http_request_show(s_service,id_style,id_html,url,msg,f_onload,a_data,is_nomove,is_nocache) { 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()) { if(DEBUG_MODE) alert('http_request_show: id not exists: '+id_style); return true; } l_style.display(true); } var l_html=layer(id_html); if(!l_html.exists()) { if(DEBUG_MODE) alert('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); 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; req.open('GET', url, true); if(a_data) req.send(a_data); else req.send({ }); return false; } 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 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; 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_top(pos,w) { if(pos>=0) { if(!w) w=window; w.scrollTo(getScrollX(w),pos); } } 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) { 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; } }  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; }  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; 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) { if(!s_prefix) s_prefix=''; o_form[s_prefix+'password'].value=hex_sha1(hex_sha1(o_form[s_prefix+'pwd'].value)+o_form[s_prefix+'notepad'].value); o_form[s_prefix+'pwd'].value=''; return true; } function passport_login_small_validate(o_form) { var c=document.getElementById('passport_login_small'); if(!c) { if(DEBUG_MODE) alert('`passport_login_small` not found.'); return false; } if (c.login.value.length == 0) {c.login.focus();return false;} if (c.pwd.value.length == 0) {c.pwd.focus();return false;} passport_login_send(o_form); return true; } function passport_login_submit(o_form) { var o=document.getElementById('passport_login_form'); if(!o) { if(DEBUG_MODE) alert('`passport_login_form` not found.'); return false; } if (o.login.value.length == 0) {o.login.focus();return false;} if (o.pwd.value.length == 0) {o.pwd.focus();return false;} passport_login_send(o_form); return true; } 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_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; } mp_startup_register(passport_alive_startup); mp_startup_register(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>'); }  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')) { tinyMCE.execCommand('mceRemoveControl', false, 'xmlfilter_body'); } } 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=o_parent.parentElement; } } } 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_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'); } } 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_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"); }  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_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_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_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_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(); } mp_startup_register(forum_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_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; }  var text_dir_cache=true; var text_dir_id_style=false; var text_dir_id_html=false; 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) { if(DEBUG_MODE) alert('field not exists: is_inline in text_dir_inline'); return false; } text_dir_cache=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,text_dir_cache); } 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" }); } xmlfilter_startup(a_settings); text_edit_focus(); } 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'; break; } } 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=self.parentElement; 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; } mp_startup_register(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; } 