<!--
function MAZ_help_popup(visa){
	    var x=window.event.clientX;
		var y=window.event.clientY;
		var hlp=document.getElementById('help_popup');
		hlp.style.visibility=visa;
 		hlp.style.left=x+20;
 		hlp.style.top=y+20;
}




function MAZ_loggaIn(){
	if(event.ctrlKey){
	    var x=window.event.clientX;
		var y=window.event.clientY;
 		document.getElementById('loggaIn').style.visibility="visible";
 		document.getElementById('loggaIn').style.left=x-44;
 		document.getElementById('loggaIn').style.top=y-80;
	}
}


function MAZ_find(){
	var s=document.getElementById('seek').value;
	var qw=encodeURIComponent(document.getElementById('qs').value);
	var Findwindow=window.open(s+qw,"Find","width=800,height=748,toolbar=yes,scrollbars=yes,location=yes");
	Findwindow.focus();
	}

function MAZ_laddaBilder() {
  		var d=document;
		if(d.images){
		  	if(!d.MAZ_p){
			  	d.MAZ_p=new Array();
		  	}
    	var i,j=d.MAZ_p.length,a=MAZ_laddaBilder.arguments;
		for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0){
				d.MAZ_p[j]=new Image;
				d.MAZ_p[j++].src=a[i];
				}
			}
}

function MAZ_bytBild(bild){
        var rr=event.srcElement.id;
        var rb=document.getElementById(rr);
        rb.src=bild;
		}

function MAZ_checkButtons(clicked){
		var ll=document.getElementById('ll').value;
		var llid=document.getElementById('llid').value;
		var id=document.getElementById('id').value;
		var r=document.getElementById('redigera');
		var nl=document.getElementById('nylink');
		var tl=document.getElementById('dellink');
 		var nj=document.getElementById('nyjuttu');
		var dj=document.getElementById('deljuttu');
		var ad=document.getElementById('admin');
		var lo=document.getElementById('logout');
		var tabort=document.getElementById('tabort').value;
		var button=new Array(r,nl,tl,nj,dj,ad,lo);
		var rgt=document.getElementById('rights').value.split('|');
		for(x =0; x < button.length; x++){
		    if(rgt[x] == "all" && (llid != ll || button[x].id != "dellink")|| rgt[x] == ll && (llid != ll || button[x].id != "dellink")){
		    var chd="_dw";
			var chu="_up";
			var rsp=button[x].src.split('.gif');
			var r=rsp[0].replace(chd, "");
			var rs=r.replace(chu, "");
		        if(clicked == button[x].id){
    			button[x].src=rs+"_dw.gif";
		        }else{
    			button[x].src=rs+"_up.gif";
		        }
		    }
		}
		
}

function MAZ_visaLoutTid(tid){
	if(tid < 2){
   			var la=document.getElementById('loutalert').value;
			alert(la);
			var h=screen.height;
			var w=screen.width;
			window.moveTo(0,0);
			window.resizeTo(w,h);
			var Logga_in=window.open('./redigera.php?','Redigera','');
  			Logga_in.close();
  			var un=document.getElementById('uname').value;
			location.replace("./?log_out=yes&uname="+un+"");
		}else{
		var d=document.getElementById('auth_time_left').value;
		var dmax=document.getElementById('auth_max').value;
		var da=tid-1;
		var lt=document.getElementById('lout_time_balk');
		var tbl=document.getElementById('timebalklength').value;
		lt.width=da/dmax*tbl;
		setTimeout('MAZ_visaLoutTid('+da+')', 1000);
		}
	}

function MAZ_loutTid(am){
    if(document.getElementById('auth_time_left').value < 2){
    	MAZ_visaLoutTid(am);
    	
    }else{
    	MAZ_visaLoutTid(document.getElementById('auth_time_left').value);
    }
	}

function MAZ_openRedigering(wm,w,id,news){
    var ll=document.getElementById('ll').value;
	var tl=document.getElementById('tl').value;
	if((ll == "" || ll == 0) && tl == ""){
	var sla=document.getElementById('select_link_alert').value;
	alert(sla);
	MAZ_checkbuttons();
	return;
	}
	var h=screen.height-30;
	var wo=screen.width-wm;
	if(wo < w){
	    var xn=screen.width-w;
		}else{
	    var xn=wm;
		}
  	window.resizeTo(wm,h);
  	window.moveTo(0,0);
  	if(news == "aktuellt" || news == "aktivitet"){
  	     var ur=document.getElementById('ur').value;
  	     
  	     var analert=document.getElementById('aktiveranewsalert').value;
  	    document.getElementById('toolbox_popup_nyhet').style.visibility="hidden";
  	    if(news == "aktuellt" && ur != "aktuellt"){
  	    alert(analert);
  	    MAZ_checkButtons();
  	    return false;
  	    }
  	    var ln=document.getElementById('llname').value;
  	    var ll=document.getElementById('ll').value;
		var tl=document.getElementById('tl').value;
		var al="";
  	    if(tl == 1 || ll == 0){ln = "Önuf"}else{}
  	    if(news == "aktuellt"){
  	    al =' i '+ln+'';
  	    }
  	    if(confirm('Lägg till '+news+''+al+'')){
		  	var iddde="";
		  	MAZ_checkButtons();
			}else{
			return;
			}
   	}else{
  	var idde=document.getElementById('id').value;
  	}
  	var eiden=document.getElementById('uname').value;
  	var ll=document.getElementById('ll').value;
  	var d=document.getElementById('d').value;
  	var m=document.getElementById('m').value;
  	var y=document.getElementById('y').value;
  	var llid=document.getElementById('llid').value;
  	var Logga_in=window.open('./redigera.php?id='+idde+'&nyhet='+news+'&editor_namn='+eiden+'&ll='+ll+'&llid='+llid+'&d='+d+'&m='+m+'&y='+y+'&spawh='+h+'','Redigera','width='+w+',height='+h+'');
  	Logga_in.moveTo(xn,0);
  	Logga_in.resizeTo(w,h);
  	Logga_in.focus();
}

function MAZ_redigera(what,how,llid,ll,llname,tlid,id){
		if(how != "confirmed"){
    		var id=document.getElementById('id').value;
			var rr=window.event.srcElement.id;
			var rs=document.getElementById(rr);
			var llname=document.getElementById('llname').value;
			var id=document.getElementById('id').value;
			if(rs.src.search("_dw") == -1 && rs.src.search("_up") == -1 ){
	    		var nor=document.getElementById('noedit').value
	    		alert(nor);
	 			return;
			}else{
				var rs=document.getElementById(rr).src.split('_up.gif');
				if(document.getElementById(rr).src == rr[0]+'_dw.gif'){
				}else{
				document.getElementById(rr).src=rs[0]+'_dw.gif';
				MAZ_checkButtons(rr);
				}
			var tlp=document.getElementById('toolbox_popup').style;
			var tlus=document.getElementById('toolbox_popup_users').style;
			var tlusn=document.getElementById('toolbox_popup_nyforening').style;
			var tlun=document.getElementById('toolbox_popup_nyhet').style;
			var rOf=document.getElementById('rO').value;
			var x=window.event.clientX;
			var y=window.event.clientY+17;
			tlp.visibility="hidden";
			tlus.visibility="hidden";
			tlusn.visibility="hidden";
			}
		}
	
	var sna=document.getElementById('session').value;
    var sid=document.getElementById('sessid').value;
    
	if(what == "lankar" && how == "nylank" || how == "confirmed"){
		var ll=document.getElementById('ll').value;
		var llid=document.getElementById('llid').value;
		var id=document.getElementById('id').value;

	    if(how == "confirmed"){
	    var name=document.getElementById('updateForening').value
	    var lltext=document.getElementById('nyUnderRubrik').value
	    window.location.href('./?nylank=yes&llname='+name+'&lltext='+lltext+'&id='+id+'&llid='+llid+'&ll='+ll+'&'+sna+'='+sid+'');
	    }else{
    	if(id == ""){
	    window.location.href('./?nylank=yes&id='+id+'&lltext=&llid='+llid+'&ll='+ll+'&'+sna+'='+sid+'');
		var sla=document.getElementById('select_link_alert').value
		alert(sla);
	    }
	    tlp.visibility="visible";
	    tlp.top=y;
	    tlp.left=x;
	    }

	}
	if(what == "lankar" && how == "tabort"){
		var ur=document.getElementById('ur').value;

	    if(llid != ll){
		if(confirm('Ta bort '+ur+' från '+llname+', id='+id+' ?')){
	    window.location.href('./?tabort=yes&llname='+name+'&ll='+ll+'&llid='+llid+'&id='+id+'&'+sna+'='+sid+'');
		}else{MAZ_checkButtons();}
		}else{
		MAZ_checkButtons();
		}
	}

	if(what == "nyhet" && how == "tabortnyhet"){
	    var tabort=document.getElementById('tabort').value;
	    var aktivitet=document.getElementById('akti').value;
	    var delna=document.getElementById('delnewsalert').value;
 		var id=document.getElementById('id').value;
	    if(aktivitet == "aktuellt" || aktivitet == "aktivitet"){
	      if(confirm('Ta bort aktiv nyhet/aktivitet id= '+id+' ?')){
	    window.location.href('./?tabortnyhet=yes&id='+id+'&'+sna+'='+sid+'');
	      }else{
			MAZ_checkButtons();
	      }
	      
	    }else{
		alert(delna);
		MAZ_checkButtons();
	    }
	}

	if(what == "nyhet" && how != "tabortnyhet"){
	    if(how != ""){
	    MAZ_openRedigering(epww,eww,id,how);
	    }else{
            if(tlun.visibility == "visible"){
                        tlun.visibility="hidden";
                        }else{
                        tlun.visibility="visible";
                        tlun.top=y;
                        tlun.left=x;
                         }           
	    }

	}
	
	if(what == "users"){
	    tlus.visibility="visible";
	    tlus.top=y;
	    tlus.left=x;
	    
	}
	if(what == "id"){
	    if(id == ""){
 		var ll=document.getElementById('ll').value;
		var llid=document.getElementById('llid').value;
	    window.location.href('./?nylank=yes&id=&lltext=&llid='+llid+'&ll='+ll+'&'+sna+'='+sid+'');
		var sla=document.getElementById('select_link_alert').value
		alert(sla);
		return;
		}
		var epww=document.getElementById('editing_parent_window_width').value
		var eww=document.getElementById('editor_window_width').value
 		MAZ_openRedigering(epww,eww,id,0)
		}
}


function MAZ_logOut(){
    var rr=window.event.srcElement.id;
	var rs=document.getElementById(rr).src.split('_up.gif');
        document.getElementById(rr).src=rs[0]+'_dw.gif';
	var lout_confirm=document.getElementById('lout_confirm').value;
	var un=document.getElementById('uname').value;
	var d=document.getElementById('auth_time_left').value;
	if(confirm(lout_confirm+', '+un+'?')){
		var h=screen.height;
		var w=screen.width;
		window.moveTo(0,0);
		window.resizeTo(w,h);
  		var Logga_in=window.open('./redigera.php?','Redigera','');
  		Logga_in.close();
		location.replace("./?log_out=yes&uname="+un+"");

	}else{
		document.getElementById(rr).src=rs[0]+'_up.gif';
	}
}


var ie=document.all
var ns6=document.getElementById&&!document.all

var dragapproved=false
var z,x,y

function move(e){
if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.className!="drag"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className=="drag"){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")



//-->


