var jweb={
	/********************************************/
	/** ONLOAD **********************************/
	/********************************************/
	onload:{
		_stack:[],
		_readyState:0, // 0: uninitialized, 1: monitoring, 2: dom is loaded
		add:function(f){
			if(this._readyState==2){f();return}
			this._stack.push(f);
			if(this._readyState==0){
				this._readyState=1;
				var self=this;
				if(document.readyState&&ua.webkit){ // Apple WebKit (Safari, OmniWeb, ...)
					(function(){
						if(/loaded|complete/.test(document.readyState)){self._runStack()}
						else{setTimeout(arguments.callee,0);return;}
						})();
					}
				else if(ua.ie&&window==top){ // Internet Explorer
					(function(){
						try{document.documentElement.doScroll('left')}
						catch(e){setTimeout(arguments.callee,0);return}
						self._runStack();
						})();
					}
				else if(window.addEventListener){ // Mozilla, Opera
					if(!ua.opera||ua.opera9up){document.addEventListener('DOMContentLoaded',self._runStack,false)} // Mozilla, Opera 9
					else{window.addEventListener('load',self._runStack,false)} // opera<9
					}
				else{ // Last effort
					var oldOnLoad=window.onload;
					window.onload=function(){
						self._runStack();
						if(oldOnLoad){oldOnLoad()}
						}
					}
				}
			},
		_runStack:function(){
			jweb.onload._readyState=2;
			var i=-1;
			while(++i<jweb.onload._stack.length){
				jweb.onload._stack[i]();
				}
			}
		},
	/********************************************/
	/** TIME ************************************/
	/********************************************/
	time:{
		now:function(){
			return (new Date()).getTime();
			}
		},
	/********************************************/
	/** TRANSLATE *******************************/
	/********************************************/
	translateSelector:{
		open:function(span){
			var tab=span.getElementsByTagName('TABLE')[0];
			tab.style.display='block';
			jweb.ieWindowedsCover.cover(tab);
			},
		close:function(evt,tab){
			evt=jweb.event.get();
			if(jweb.event.isMouseLeave(evt,tab)){
				tab.style.display='none';
				jweb.ieWindowedsCover.uncover(tab);
				}
			}
		},
	/********************************************/
	/** EVENT ***********************************/
	/********************************************/
	event:{
		get:function(continuePropagation){
			var evt=window.event||jweb.event.get.caller.arguments[0];
			if(ua.ie&&ua.win){
				evt.charCode=(evt.type=='keypress')?evt.keyCode:0;
				evt.eventPhase=2;
				evt.isChar=(evt.charCode>0);
				var winScroll=jweb.xy.scroll(window);
				evt.pageX=evt.clientX+winScroll.x;
				evt.pageY=evt.clientY+winScroll.y;
				evt.preventDefault=function(){
					this.returnValue=false;
					}
				evt.stopPropagation=function(){
					this.cancelBubble=true;
					}
				if(evt.type=='mouseout'){
					evt.relatedTarget=evt.toElement;
					}
				else if(evt.type=='mouseover'){
					evt.relatedTarget=evt.fromElement;
					}
				evt.target=evt.srcElement;
				evt.time=jweb.time.now();
				}
			if(!continuePropagation){
				evt.stopPropagation()
				}
			return evt;
			},
		addHandler:function(o,type,handler){
			if(o.addEventListener)o.addEventListener(type,handler,false);
			else if(o.attachEvent)o.attachEvent('on'+type,handler);
			else o['on'+type]=handler;
			},
		remHandler:function(o,type,handler){
			if(o.removeEventListener)o.removeEventListener(type,handler,false);
			else if(o.detachEvent)o.detachEvent('on'+type,handler);
			else o['on'+type]=null;
			},
		isMouseEnter:function(evt,o){	
			return this._isMouseLeaveOrEnter(evt,o,'mouseover');
			},
		isMouseLeave:function(evt,o){		
			return this._isMouseLeaveOrEnter(evt,o,'mouseout');
			},
		isMouseLeaveOrEnter:function(evt,o){		
			return (this.isMouseLeave(evt,o)||this.isMouseEnter(evt,o));
			},
		_isMouseLeaveOrEnter:function(evt,o,type){		
			if(evt.type!=type)return false;
			var ro=evt.relatedTarget;
			while(ro){
				if(ro==o){return false}
				try{ro=ro.parentNode}
				catch(e){return true}
				}
			return true;
			}
		},
	/********************************************/
	/** DOM *************************************/
	/********************************************/
	dom:{
		above:function(o,tagName,self){
			o=self?o:o.parentNode;
			while(o.tagName!=tagName){
				try{o=o.parentNode}
				catch(e){return null}
				}
			return o;
			},
		clear:function(o){
			while(o&&o.firstChild){
				o.removeChild(o.firstChild);
				}
			},
		windowScrollbars:function(show){
			document.documentElement.style.overflow=show?'auto':'hidden';
			}
		},
	/********************************************/
	/** OVERLAY *********************************/
	/********************************************/
	overlay:{
		bg:0,  // overlay
		wrp:0, // wrap
		clb:0, // closebutton
		open:function(content,args){
			if(!this.bg){
				var self=this;
				// bg
				this.bg=document.createElement('DIV');
				this.bg.id='jwebOverlayBg';
				jweb.event.addHandler(window,'scroll',function(){self._bgFit()});
				jweb.event.addHandler(window,'resize',function(){self._bgFit()});
				// closer
				var btn=document.createElement('INPUT');
					btn.type='button';
					btn.value='Stäng';
					btn.onclick=function(){self.close()};
				this.clb=document.createElement('DIV');
				this.clb.id='jwebOverlayClose';
				this.clb.appendChild(btn);
				// wrap
				this.wrp=document.createElement('DIV');
				this.wrp.id='jwebOverlayWrap';
				jweb.event.addHandler(window,'resize',function(){self._wrapFit()});
				// append
				this.wrp.appendChild(this.clb);
				document.body.appendChild(this.bg);
				document.body.appendChild(this.wrp);
				jweb.ieWindowedsCover.cover(this.bg);
				}
			this._emptyWrap();
			if(content){
				this.wrp.appendChild(content);
				}
			jweb.tip.hide();
			this.bg.style.display='block';
			this.wrp.style.display='block';
			this.wrp.className=(args&&args.className)?args.className:'';
			this.clb.style.display=(args&&args.closer)?'block':'none';
			this._bgFit();
			this._wrapFit();
			},
		_emptyWrap:function(){
			var cn=this.wrp.childNodes,i=cn.length;
			while(--i>-1){
				if(cn[i]!=this.clb){
					this.wrp.removeChild(cn[i]);
					}
				}
			},
		close:function(){
			this.wrp.style.display='none';
			this.bg.style.display='none';
			this._emptyWrap();
			jweb.ieWindowedsCover.uncover(this.bg);
			},
		_wrapFit:function(){
			jweb.xy.center(this.wrp);
			},
		_bgFit:function(){
			if('block'==this.bg.style.display){
				var ws=jweb.xy.size(window);
				var wc=jweb.xy.scroll(window);
				var marg=100;
				this.bg.style.top=(wc.y-marg)+'px';
				this.bg.style.left=(wc.x-marg)+'px';
				this.bg.style.width=(ws.x+(2*marg))+'px';
				this.bg.style.height=(ws.y+(2*marg))+'px';
				jweb.ieWindowedsCover.fit(this.bg);
				}
			},
		/**********************/
		iframe:{
			o:0,
			open:function(args){
				if(!this.o){
					this.o=document.createElement('IFRAME');
					this.o.frameBorder=0;
					this.o.scrolling=ua.ie?'yes':'auto';
					}
				this.o.src=args.url;
				this.o.style.width=(args.width?args.width:650)+'px';
				this.o.style.height=(args.height?args.height:450)+'px';
				jweb.overlay.open(this.o,args);
				},
			close:function(){
				this.o.src="javascript:'<span id=\"jwebOverlayIframeLoading\">Laddar...</span>'";
				jweb.overlay.close();
				}
			},
		/**********************/
		images:{
			wrp:0,
			prev:0,
			close:0,
			next:0,
			img:0,
			descr:0,
			images:0,
			index:0,
			open:function(images,args){
				this.setup();
				this.wrp.className=(images.length>1)?'':'single';
				this.images=images;
				this.index=(args&&args.start)?args.start:0;
				jweb.overlay.open(this.wrp);
				this.load();
				},
			load:function(){
				this.img.src=this.images[this.index][0]; // triggers loaded()
				this.descr.innerHTML='';
				},
			loaded:function(){
				this.descr.innerHTML=this.images[this.index][1];
				jweb.overlay._wrapFit();
				},
			step:function(s){
				var last=this.images.length-1,i=this.index+s;
				this.index=(i>last)?0:((i<0)?last:i);
				this.load();
				},
			setup:function(){
				if(this.wrp)return;
				var self=this;
				// wrap
				this.wrp=document.createElement('DIV');
				this.wrp.id='jwebOverlayImage';
				// prev
				this.prev=document.createElement('DIV');
				this.prev.id='prev';
				this.prev.innerHTML='&laquo;';
				this.prev.onclick=function(){self.step(-1)};
				// close
				this.close=document.createElement('DIV');
				this.close.id='close';
				this.close.innerHTML='STÄNG';
				this.close.onclick=function(){jweb.overlay.close()};
				// next
				this.next=document.createElement('DIV');
				this.next.id='next';
				this.next.innerHTML='&raquo;';
				this.next.onclick=function(){self.step(1)};
				// img
				this.img=document.createElement('IMG');
				this.img.onload=function(){self.loaded()};
				// descr
				this.descr=document.createElement('DIV');
				this.descr.id='descr';
				// append
				this.wrp.appendChild(this.prev);
				this.wrp.appendChild(this.close);
				this.wrp.appendChild(this.next);
				this.wrp.appendChild(this.img);
				this.wrp.appendChild(this.descr);
				}
			}
		/**********************/
		},
	/********************************************/
	/** XY **************************************/
	/********************************************/
	xy:{
		size:function(o,inner){
			o=$(o);
			if(o[0]==window){
				return {x:o.width(),y:o.height()};
				}
			if(o[0]==document){
				return {x:o.width(),y:o.height()};
				}
			if(inner){
				return {x:o.innerWidth(),y:o.innerHeight()};
				}
			return {x:o.outerWidth(),y:o.outerHeight()};
			},
		scroll:function(o){
			if(o==window){
				o=$(o);
				return {x:o.scrollLeft(),y:o.scrollTop()};
				}
			return {x:o.scrollLeft,y:o.scrollTop};
			},
		pos:function(o){
			var p=$(o).offset()
			return {x:p.left,y:p.top};
			},
		center:function(o,negok){
			var os=this.size(o);
			var ws=this.size(window);
			var wc=this.scroll(window);
			var t=((ws.y-os.y)/2)+wc.y;
			var l=((ws.x-os.x)/2)+wc.x;
			if(!negok){
				t=Math.max(0,t);
				l=Math.max(0,l);
				}
			o.style.top=t+'px';
			o.style.left=l+'px';
			}
		},
	/********************************************/
	/** AJAX ************************************/
	/********************************************/
	ajax:{
		_stack:[],
		_callsMax:10,
		_retryMs:1000,
		_msSignatures:['MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],
		get:function(url,cb,async){
			return this._open(this._register('GET',url,cb,async));
			},
		post:function(url,cb,async){
			return this._open(this._register('POST',url,cb,async));
			},
		_createClient:function(){
			if(typeof XMLHttpRequest!='undefined'){
				return new XMLHttpRequest();
				}
			for(var i in this._msSignatures){
				try{
					var tmp=new ActiveXObject(this._msSignatures[i]);
					return tmp;
					}
				catch(e){}
				}
			},
		_register:function(method,url,cb,async){
			var id=this._stack.length;
			this._stack[id]={
				'method'	:method,
				'url'		:this._parseUrl(url),
				'async'		:((typeof async=='boolean')?async:true),
				'client'	:this._createClient(),
				'cb'		:((typeof cb=='function')?cb:null),
				'callsleft'	:this._callsMax
				};
			return id;
			},
		_parseUrl:function(url){
			var ret={'file':url,'query':'','anchor':''};
			var urlParts=/^(.+)#(\w+)$/.exec(ret.file);
			if(urlParts){
				ret.file=urlParts[1];
				ret.anchor=urlParts[2];
				}
			var urlParts=/^([^\?]+)\?(.+)$/.exec(ret.file);
			if(urlParts){
				ret.file=urlParts[1];
				var amp='z2o5l0D4c6H42xX32P2i4n5Gh6Jz';
				var queryArr=urlParts[2].replace(/\\\&/g,amp).match(/\w+=[^&]+/g);
				var tmpPos;
				for(var i=0;i<queryArr.length;i++){
					tmpPos=queryArr[i].indexOf('=')+1;
					ret.query+=(i>0)?'&':'';
					ret.query+=queryArr[i].substr(0,tmpPos);
					ret.query+=encodeURIComponent(queryArr[i].substr(tmpPos).replace(amp,'\\&'));
					}
				}
			return ret;
			},
		_open:function(id){
			var r=this._stack[id];
			if('GET'==r.method){
				r.client.open('GET',r.url.file+'?'+r.url.query,r.async);
				var query=null;
				}
			else{
				r.client.open('POST',r.url.file,r.async);
				r.client.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				var query=r.url.query;
				}
			if(r.async){
				r.client.onreadystatechange=function(){
					// readyStates: 0 uninitialized, 1 loading, 2 loaded, 3 interactive, 4 complete
					if(r.client.readyState==4){
						if(r.client.status==200){
							jweb.ajax._cb(id);
							}
						else{
							jweb.ajax._retry(id);
							}
						}
					}
				r.client.send(query);
				}
			else{
				r.client.send(query);
				if(r.client.status==200){
					if(r.cb){
						r.cb(r.client.responseText);
						}
					else{
						var ret=r.client.responseText;
						this._unset(id);
						return ret;
						}
					}
				else{
					jweb.ajax._retry(id);
					}
				}
			},
		_cb:function(id){
			var txt=this._stack[id].client.responseText;
			if(this._stack[id].cb){
				this._stack[id].cb(txt);
				}
			this._unset(id);
			},
		_retry:function(id){
			if(--this._stack[id].callsleft<1){
				this._unset(id);
				}
			else{
				setTimeout(function(){jweb.ajax._open(id)},this._retryMs);
				}
			},
		_unset:function(id){
			this._stack[id].client.abort();
			this._stack[id]=null; // ramsaver
			}
		},
	/********************************************/
	/** IE WINDOWED'S COVER *********************/
	/********************************************/
	ieWindowedsCover:{
		_an:'jwebIeWindowedsCovercoverId',
		_lib:{},
		cover:function(o){
			if(ua.ie5||ua.ie55||ua.ie6){
				var ifr=this._getIfr(o);
				if(!ifr){
					ifr=document.createElement('iframe');
					ifr.style.position='absolute';
					ifr.style.zIndex=1;
					ifr.style.filter='alpha(opacity=0)';
					ifr.id=Math.round(Math.random()*10000);
					ifr.src="javascript:''";
					o.setAttribute(this._an,ifr.id);
					this._lib[ifr.id]=ifr;
					document.body.appendChild(ifr);
					}
				this._setXY(ifr,o);
				}
			},
		uncover:function(o){
			var ifr=this._getIfr(o);
			if(ifr)ifr.style.display='none';
			},
		fit:function(o,p,s){
			var ifr=this._getIfr(o);
			if(ifr){
				this._setXY(ifr,o,p,s);
				}
			},
		_getIfr:function(o){
			var cid=o.getAttribute(this._an);
			return cid?this._lib[cid]:null;
			},
		_setXY:function(ifr,o,p,s){
			p=p?p:jweb.xy.pos(o);
			s=s?s:jweb.xy.size(o);
			ifr.style.display='block';
			ifr.style.left=p.x+'px';
			ifr.style.top=p.y+'px';
			ifr.style.width=s.x+'px';
			ifr.style.height=s.y+'px';
			}
		},
	/********************************************/
	/** TABLE SORTER ****************************/
	/********************************************/
	tableSorter:{
		sort:function(type){
			if(1===type){ // sorting from td in first row (1,this)
				var o=arguments[1];
				if(o&&o.tagName&&('TD'==o.tagName)){
					var tab=jweb.dom.above(o,'TABLE');
					this._sort(tab,o.cellIndex,1);
					}
				}
			else if(2===type){ // sorting from outside table (2,'id',index)
				var tab=document.getElementById(arguments[1]);
				var index=arguments[2];
				this._sort(tab,index,0);
				}
			},
		_sort:function(tab,index,dontTouchFirstRow){
			var i=dontTouchFirstRow?0:-1;
			var trs=[];
			var tbody=tab.tBodies[0];
			var header=tbody.rows[0];
			var anLastIndex='jwebtablesorterlast';
			var lastIndex=tab.getAttribute(anLastIndex);
			if(ua.ie){
				// iefix checkboxar som inte är hårdkodat checkade tappar check vid sortering
				var cbs=tab.getElementsByTagName('INPUT'),c=-1;
				var anCbChecked='jwebtablesortercbchecked';
				while(++c<cbs.length){
					if('checkbox'==cbs[c].type){
						cbs[c].setAttribute(anCbChecked,cbs[c].checked?1:0);
						}
					}
				}
			while(++i<tbody.rows.length){
				trs.push(tbody.rows[i]);
				}
			trs.sort(function(a,b){
				a=jweb.tableSorter._getValue(a.cells[index]);
				b=jweb.tableSorter._getValue(b.cells[index]);
				return ((a<b)?-1:((a>b)?1:0));
				});
			if(index==lastIndex){
				trs.reverse();
				tab.setAttribute(anLastIndex,'x');
				}
			else{
				tab.setAttribute(anLastIndex,index);
				}
			var frag=document.createDocumentFragment(),i=-1;
			frag.appendChild(header);
			while(++i<trs.length){
				frag.appendChild(trs[i]); // här försvinner trs automatiskt från tbody
				}
			tbody.appendChild(frag);
			if(ua.ie){
				c=-1;
				while(++c<cbs.length){
					cbs[c].checked=cbs[c].getAttribute(anCbChecked);
					}
				}
			},
		_getValue:function(o){
			if(!o){
				return '';
				}
			var v=o.getAttribute('jwebtablesortervalue');
			if(v){
				if(/^\d+$/.test(v)){
					return v*1;
					}
				return v;
				}
			o=o.firstChild;
			var c=o;
			while(c){
				if(c.tagName=='INPUT'){
					if((c.type=='checkbox')||(c.type=='radio')){
						return c.checked?'1':'0';
						}
					return c.value;
					}
				if(c.tagName=='IMG'){
					return c.src;
					}
				c=c.firstChild;
				}
			if(o&&o.nodeType==3){
				return o.nodeValue.toLowerCase();
				}
			return '';
			}
		},
	/********************************************/
	/** RESIZE **********************************/
	/********************************************/
	resize:{
		_o:0,
		_margin:10, // pixels from border where mouse can start resize
		_initMouse:0, // mousepodition when resizing beginns
		_initSize:0, // object size when resizing beginns
		_dirX:0,
		_dirY:0,
		_resizing:0,
		_minSize:10,
		_anHaseBaseHandlers:'jwebresizehasbasehandlers',
		mouseMove:function(evt,o){
			if(!this._resizing){
				evt=jweb.event.get(true);
				this._setDirs(evt,o);
				this._setCursor(o);
				if(!o.getAttribute(this._anHaseBaseHandlers)){
					jweb.event.addHandler(o,'mousedown',jweb.resize._mouseDown);
					jweb.event.addHandler(o,'mouseout',jweb.resize._mouseOut);
					o.setAttribute(this._anHaseBaseHandlers,1);
					}
				this._o=o;
				}
			},
		_setCursor:function(o){
			var c='';
			if(this._dirY)c+='s';
			if(this._dirX)c+='e';
			c=c.length?c+'-resize':'';
			o.style.cursor=c;
			document.body.style.cursor=c;
			},
		_setDirs:function(evt,o){
			var s=jweb.xy.size(o);
			var p=jweb.xy.pos(o);
			jweb.resize._dirX=((s.x-(evt.pageX-p.x))<jweb.resize._margin);
			jweb.resize._dirY=((s.y-(evt.pageY-p.y))<jweb.resize._margin);
			},
		_mouseDown:function(){
			var evt=jweb.event.get();
			var t=jweb.resize;
			if(t._dirX||t._dirY){
				t._initMouse={x:evt.clientX,y:evt.clientY};
				t._initSize=jweb.xy.size(t._o);
				jweb.event.addHandler(document.body,'mousemove',t._mouseMove);
				jweb.event.addHandler(document.body,'mouseup',t._mouseUp);
				}
			},
		_mouseMove:function(){
			var evt=jweb.event.get();
			var t=jweb.resize;
			var w=t._initSize.x;
			var h=t._initSize.y;
			if(t._dirX)w+=(evt.clientX-t._initMouse.x);
			if(t._dirY)h+=(evt.clientY-t._initMouse.y);
			w=(w<t._minSize)?t._minSize:w
			h=(h<t._minSize)?t._minSize:h
			t._o.style.width=w+'px';
			t._o.style.height=h+'px';
			t._resizing=true;
			},
		_mouseUp:function(){ // release
			var t=jweb.resize;
			jweb.event.remHandler(document.body,'mousemove',t._mouseMove);
			jweb.event.remHandler(document.body,'mouseup',t._mouseUp);
			t._resizing=false;
			},
		_mouseOut:function(){
			if(!jweb.resize._resizing){
				document.body.style.cursor='';
				}
			}
		},
	/********************************************/
	/** TIP *************************************/
	/********************************************/
	tip:{
		_initialized:false,
		_an:'jwebtip',
		_tips:[],
		_o:null,
		_win:null,
		_cursor:null,
		_activeTarget:null,
		_progress:false,
		init:function(){
			jweb.event.addHandler(document,'mousemove',function(evt){
				jweb.tip.documentMousemove(evt);
				});
			},
		showProgress:function(){
			if(!this._initialized){
				this._initialize();
				}
			this._progress=true;
			this._o.o.id='jwebTipProgress';
			this._display(['&nbsp;']);
			},
		documentMousemove:function(evt){
			evt=jweb.event.get(true); // true - stoppar annars alla andra document.mousemove event
			if(this._progress){
				this._move(evt);
				return;
				}
			var t=evt.target;
			if(t!=this._activeTarget){
				this._activeTarget=t;
				var newTips=[];
				var tmp;
				while(t.tagName){
					if(t.getAttribute('jwebtiphide')){
						this.hide();
						return;
						}
					tmp=t.getAttribute(this._an);
					if(tmp){
						newTips.unshift(tmp);
						}
					try{t=t.parentNode;}
					catch(e){break;}
					}
				if(newTips!=this._tips){
					if(!this._initialized){
						this._initialize();
						}
					this._display(newTips);
					}
				}
			if(this._tips.length){
				this._move(evt);
				}
			},
		refresh:function(evt){ // dynamicaly setting jwebTip needs refresh to work at once
			this._activeTarget=null;
			this.documentMousemove(evt);
			},
		hide:function(){
			if(this._initialized){
				this._o.o.style.display='none';
				jweb.ieWindowedsCover.uncover(this._o.o);
				this._activeTarget=null;
				}
			},
		_initialize:function(){
			this._cursor={r:16};
			this._cursor.x=ua.ie?2:4;;
			this._cursor.y=ua.ie?7:10;
			this._o={o:document.createElement('div')};
			this._o.o.id='jwebTip';
			document.body.appendChild(this._o.o);
			jweb.ieWindowedsCover.cover(this._o.o);
			this._initialized=true;
			},
		_display:function(newTips){
			if(newTips.length){
				this._o.o.innerHTML=newTips.join('<br />');
				this._o.o.style.display='block';
				this._o.o.style.left='-1000px';
				var tmpo=jweb.xy.size(this._o.o);
				var tmpw=jweb.xy.size(window);
				var tmps=jweb.xy.scroll(window);
				this._win={x:tmpw.x,y:tmpw.y,sx:tmps.x,sy:tmps.y,mx:(tmpw.x/2)+tmps.x,my:(tmpw.y/2)+tmps.y};
				this._o.w=tmpo.x/2;
				this._o.h=tmpo.y/2;
				this._o.d=Math.sqrt((this._o.h*this._o.h)+(this._o.w*this._o.w));
				this._o.r=Math.atan(this._o.w/this._o.h);
				}
			else{
				this.hide();
				}
			this._tips=newTips;
			},
		_move:function(evt){
			var x=evt.pageX+this._cursor.x;
			var y=evt.pageY+this._cursor.y;
			var a=Math.abs(Math.atan((this._win.mx-x)/(this._win.my-y)))||0;//radian av muspunkt från center på skärm
			var c=Math.sin((Math.sin(Math.abs(a-this._o.r))*this._o.d)/this._cursor.r);// radian genom box
			var dx=dy=0;
			if(a<this._o.r){ // 2 motsatta kvadranter
				var d=(a>Math.atan(this._o.w/(this._cursor.r+this._o.h)));
				dx=d?((Math.sin(a-c)*this._cursor.r)+this._o.w):(Math.tan(a)*(this._cursor.r+this._o.h));
				dy=d?((Math.cos(a-c)*this._cursor.r)+this._o.h):(this._cursor.r+this._o.h);
				}
			else{
				var d=(a<Math.atan((this._cursor.r+this._o.w)/this._o.h));
				dx=d?((Math.sin(a+c)*this._cursor.r)+this._o.w):(this._cursor.r+this._o.w);
				dy=d?((Math.cos(a+c)*this._cursor.r)+this._o.h):(Math.tan((Math.PI/2)-a)*(this._cursor.r+this._o.w));
				}
			var xm=x+((x>this._win.mx)?-dx:dx);
			if((xm+this._o.w)>(this._win.x+this._win.sx)){
				xm=this._win.x+this._win.sx-this._o.w;
				}
			if((xm-this._o.w)<this._win.sx){
				xm=this._win.sx+this._o.w;
				}
			var ym=y+((y>this._win.my)?-dy:dy);
			if((ym+this._o.h)>(this._win.y+this._win.sy)){
				ym=this._win.y+this._win.sy-this._o.h;
				}
			if((ym-this._o.h)<this._win.sy){
				ym=this._win.sy+this._o.h;
				}
			var l=Math.round(xm-this._o.w);
			var t=Math.round(ym-this._o.h);
			this._o.o.style.left=l+'px';
			this._o.o.style.top=t+'px';
			jweb.ieWindowedsCover.fit(this._o.o,{x:l,y:t},{x:(this._o.w*2),y:(this._o.h*2)});
			}
		}
	/********************************************/
	};