Warning: A non-numeric value encountered in /data01/virt57623/domeenid/www.mjkeskus.ee/htdocs/axiscms/index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /data01/virt57623/domeenid/www.mjkeskus.ee/htdocs/axiscms/index.php:2) in /data01/virt57623/domeenid/www.mjkeskus.ee/htdocs/axiscms/axs.user.php on line 53
//2016-06-03 // AXIS CMS JS API function axs(global_name){ this.global_name=global_name; window[this.global_name]=this; //var THIS=this; this.keycodes={'esc':27,'left':37,'up':38,'right':39,'down':40,'tab':9}; this.db={}; this.tmp=''; // this.conf=function(conf){ var def={SITE_ROOT:'',PATH_CMS:'',PATH_EXT:false,logURL:false}; for (var k in def) this[k]=(typeof(conf[k])!=='undefined') ? conf[k]:def[k]; },// this.ajax=function(){ var a=this.fn_args(arguments,{url:null,target:null,cfg:{}}); var tmp={post:null,async:true,extractContent:null}; for (var k in tmp) a[k]=(typeof(a.cfg[k])!=='undefined') ? a.cfg[k]:tmp[k]; if (a.url.indexOf(' ')>0) { tmp=a.url.split(' '); a.url=tmp[0]; a.extractContent=tmp[1]; } var ajax=new XMLHttpRequest(); // if (!a.target) a.target=function(){}; if (typeof(a.target)==='string') { var tmp=a.target; a.target=document.querySelector(a.target); if (!a.target) return this.log('ajax','Target not found ("'+tmp+')'); } ajax.axs=a; if (typeof(a.target)!=='function') { axs.class_rem(a.target,'ajax-ready'); ajax.axs.throbber=this.throbber_set(a.target); } // ajax.open((a.post)?'POST':'GET',this.url(a.url,{"axs%5Brandom%5D":Math.random()}),a.async); if(a.post){ ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajax.setRequestHeader("Content-length", a.post.length); } ajax.onreadystatechange=function(){ if ((this.readyState!=4)||(!this.axs.target)) return; if (typeof(this.axs.target)==='function') return this.axs.target(this.status,this.responseText); if (this.status==200) { axs.class_rem(this.axs.target,'throbber'); axs.class_add(this.axs.target,'ajax-ready'); this.axs.target.innerHTML=axs.ajax_body(this.responseText,this.axs); } else this.axs.throbber.msg('Request failed:'+this.status+' ('+this.statusText+')'); } ajax.send(a.post); if (ajax.responseText) return ajax.responseText; }// this.ajax_body=function(html){ var a=this.fn_args(arguments,{html:'',cfg:{}}); if (a.cfg.extractContent){ parser=new DOMParser(); return parser.parseFromString(html,"text/html").querySelector(a.cfg.extractContent).innerHTML; } var body=/([\s\S]*)<\/body>/.exec(html); if (body) html=body[1]; return html; }// this.class_add=function(el,c){ if(typeof(c)!=='Array') c=[c]; for(var i=0; i this.class_has=function(el,c){ var rgx=new RegExp('\\b'+c+'\\b'); return (rgx.exec(el.className)); }// this.class_rem=function(el,c){ if(typeof(c)!=='Array') c=[c]; for(var i=0; i this.class_tgl=function(el,c){ if(this.class_has(el,c)) return this.class_rem(el,c); this.class_add(el,c); return true; }// this.cookie_del=function(name,path,domain){ if (this.cookie_get(name)) this.cookie_set(name,"",-1,path,domain); }// this.cookie_get=function(name){ var regexp=new RegExp("(?:^"+name+"|;\\s*"+name+")=(.*?)(?:;|$)","g"); var result=regexp.exec(document.cookie); return (result===null) ? null:result[1]; }// this.cookie_set=function(name,value,expires,path,domain){ var a=axs.fn_args(arguments,{name:'',value:'',expires:0,path:false,domain:false}); var cookie=a.name+"="+escape(a.value)+";"; if (a.expires){// if(a.expires instanceof Date) { if (isNaN(a.expires.getTime())) a.expires=new Date(); }// else a.expires=new Date(new Date().getTime()+parseInt(a.expires)*1000*60*60*24); cookie+="expires="+a.expires.toGMTString()+";"; } if (a.path) cookie+="path="+a.path+";"; if (a.domain) cookie+="domain="+a.domain+";"; document.cookie=cookie; }// this.fn_args=function(args,names){//var a=axs.fn_args(arguments,{}); var a={}; var i=0; for (k in names) { a[k]=(typeof(args[i])!=='undefined') ? args[i]:names[k]; i++; } return a; }// this.log=function(msgtype,msg){ console.log(msgtype,msg); if (this.logURL) this.ajax(this.logURL, null, {post:'type='+msgtype+'&msg='+escape(msg)+'&url='+escape(window.location.href)}); } this.mediaState=function(){// var el=document.querySelector('#axs_media'); this.media={ type:window.getComputedStyle(el,':before').getPropertyValue('content').replace(/"/g,''), q:parseInt(window.getComputedStyle(el,':before').getPropertyValue('z-index'),10) } var el=document.querySelector('html'); this.class_rem(el,'media-[a-z]+-.*'); for (k in this.media) this.class_add(el,'media-'+k+'-'+this.media[k]); }// this.throbber_set=function(){ var a=this.fn_args(arguments,{'node':false}); var throbber=document.createElement('span'); this.class_add(a.node,'throbber'); (a.node.firstChild) ? a.node.insertBefore(throbber,a.node.firstChild):a.node.appendChild(throbber); throbber.className='throbber'; throbber.innerHTML='Loading…'; if (window.getComputedStyle){ throbber.style.marginLeft='-'+window.getComputedStyle(a.node, null).getPropertyValue('padding-left'); throbber.style.marginTop='-'+window.getComputedStyle(a.node, null).getPropertyValue('padding-top'); var s={w:a.node.clientWidth,h:a.node.clientHeight}; if (s.w) throbber.style.width=s.w+'px'; if (s.h>throbber.firstChild.offsetHeight){ throbber.style.height=s.h+'px'; if (s.h>throbber.firstChild.offsetHeight*5) throbber.firstChild.style.marginTop=(throbber.firstChild.offsetHeight*2)+'px'; else throbber.firstChild.style.marginTop=Math.round(s.h/10*3-throbber.firstChild.offsetHeight/2,0)+'px'; var space=Math.round(s.h/10*3-throbber.firstChild.offsetHeight/2,0); } } o={ node:throbber, msg:function(msg){ var el=document.createElement('span'); el.className='msg'; el.innerHTML=msg+' '; this.node.innerHTML=''; this.node.appendChild(el); this.node.querySelector('input').onclick=this.remove; },// remove:function(e){ var a=axs.fn_args(arguments,{e:'','node':this}); if (!a.node.parentNode) return; var el=a.node.parentNode.querySelector('span.throbber'); if (el) a.node.parentNode.removeChild(el); else arguments.callee(e,a.node.parentNode); }// }; return o; }// this.url=function(url,change){ if (typeof(url)=='string') { var url_root=(url.search(/\?/)>-1) ? url.slice(0,url.indexOf('?')+1):url; var fragment=(url.search(/#/)>-1) ? url.slice(url.indexOf('#')):''; url=this.url_get(false,url); } else var url_root='', fragment=''; for(key in change){ if (change[key]===false) delete url[key]; else url[key]=change[key]; } var url_new=[]; for(key in url) url_new.push(key+'='+url[key]); return url_root+(((url_root.search(/\?/)<0)&&(url_new))?'?':'')+url_new.join('&')+fragment; }// this.url_get=function(){ var a=this.fn_args(arguments,{key:false,query_string:window.location.href}); if (a.query_string.search(/\//)>-1) a.query_string=a.query_string.slice(a.query_string.indexOf('/')+1); if (a.query_string.search(/\?/)>-1) a.query_string=a.query_string.slice(a.query_string.indexOf('?')+1); a.query_string=a.query_string.replace(/#.*$/,''); a.query_string=(a.query_string) ? a.query_string.split('&'):[]; var url={},hash; for(var i=0; i this.window_open=function(e){ //Create the new window // Change "_blank" to something like "newWindow" to load all links in the same new window this.window_open_ref=window.open(this.href, '_blank'); this.window_open_ref.focus(); e.preventDefault(); }// this.window_popup=function(e){ this.window_popup_ref=window.open(this.href, 'axs_popup', 'scrollbars=1,location=0,resizable=1,toolbar=0,status=1,width=750,height=500,top=50,left=40'); this.window_popup_ref.focus(); e.preventDefault(); }// this.window_resize=function(){ var tmp=this.fn_args(arguments,{'cfg':{}}); var resize=true; if ( (!window.toolbar || !window.menubar) && // (!window.toolbar.visible || !window.menubar.visible) ) resize=false; if (window.name=='axs_popup') resize=true; if (!resize) return; var a={'pos':[40,40,40,40],'iw':0,'ih':0,'ow':0,'oh':0}; for(k in tmp.cfg) a[k]=tmp.cfg[k]; //Set window position if (a.pos.length===1) a.pos=[a.pos[0],a.pos[0]]; if (a.pos.length===2) a.pos=[a.pos[0],a.pos[1],a.pos[0],a.pos[1]]; window.moveTo(a.pos[0],a.pos[1]); //Set window outer size ow_max=screen.width-a.pos[1]-a.pos[3]; oh_max=screen.height-a.pos[0]-a.pos[2]; if (a.ow<2) a.ow=ow_max; if (a.oh<2) a.oh=oh_max; if ((a.iw)||(a.ih)) {//If window inner size var tools_w=window.outerWidth-document.documentElement.clientWidth; var tools_h=window.outerHeight-document.documentElement.clientHeight; if (a.iw>1) a.ow=a.iw+tools_w; if (a.ih>1) a.oh=a.ih+tools_h; } if (a.ow<200) a.ow=200; if (a.oh<50) a.oh=50; if (a.ow>ow_max) a.ow=ow_max; if (a.oh>oh_max) a.oh=oh_max; window.resizeTo(a.ow,a.oh); }// this.window_size=function(){ var win={ w:0, h:0 }; if (document.body && document.body.offsetWidth) { win.w=document.body.offsetWidth; win.h=document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) { win.w=document.documentElement.offsetWidth; win.h=document.documentElement.offsetHeight; } if (window.innerWidth && window.innerHeight) { win.w=window.innerWidth; win.h=window.innerHeight; } return { 'w':win.w, 'h':win.h } },// this.window_visible=function(){ if (typeof document.hidden!=="undefined") return !document.hidden; return true; }// // if (this.logURL) window.addEventListener('error',function(e){ var stack=e.error.stack; var message=e.error.toString(); if(stack) message+='\n'+stack; this.log('error',message); }); this.conf({}); this.class_add(document.querySelector('html'),'js'); // var tmp=document.createElement('style'); tmp.id='axs_media'; document.querySelector('html head').appendChild(tmp); this.mediaState(); window.addEventListener('resize',this.mediaState); // window.addEventListener('load',function(){// var links=document.querySelectorAll('a[target="popup"]'); for (var i=0; i this.event_cancel=function(e){ var evt=e ? e:window.event; if (evt.stopPropagation) evt.stopPropagation(); if (evt.cancelBubble!=null) evt.cancelBubble=true; }// this.include_head={}; this.include=function(id){ var a=this.fn_args(arguments,{url:1}); if (this.include_head[id]) return; switch(id){ case 'jquery': if (typeof($)==='function') return; var el=document.createElement('script'); el.src='?popup=jquery.js'; break; default: var el=document.createElement('link'); el.type='text/css'; el.rel='stylesheet'; el.media='screen,projection,tv'; el.href=a.url; break; } document.getElementsByTagName('head')[0].appendChild(el); this.include_head[id]=id; }// }// axs('axs'); //2009-01-23 axs.conf({SITE_ROOT:"/",PATH_CMS:"./",logURL:"?axs%5Bgw%5D=js.log",PATH_EXT:false});