function lc_swapit(id,on) {
    if (ob=find_handle(id)) { on?ob.visibility="visible":ob.visibility="hidden"; } 
}
    
function find_object(id) {
    if (document.getElementById) { if (!(document.getElementById(id))) { return false; } return document.getElementById(id); } else return false; 
}
function find_handle(id) {
    if (document.getElementById) { if (!(document.getElementById(id))) { return false; } return document.getElementById(id).style; } else if (document.layers) return document.layers[id]; else if (document.all) return document.all[id].style; else return false; 
}
function gsw(isrc,iname) {
    var swimg = (document.getElementById)?document.getElementById(iname):document.images[iname]; swimg.src=isrc; 
}
function me_ww() {
    return document.body.clientWidth; 
}
function me_dw() {
    var dw=me_ww();
    var b=find_handle('dw');
    if (b) { var cwd=b.width; if (dw<950 && cwd!='100%') { b.width="100%"; } if (dw>=950 && cwd=='100%') { b.width="950px"; } } 
}
function drotposta(user,host) {
    host = getMailHost(host); user = getMailUser(user); window.location='mailto:'+user+'\@'+host; 
}
function drotpostaHTML (id, user, host) {
    host = getMailHost(host); user = getMailUser(user); if ((host != '') && (user !='') && (o = find_object(id))) { o.innerHTML = user+"@"+host; }
}
function getMailUser(user) {
    if (user == '') return user; else return decode64(user); 
}
function getMailHost(host) {
    if (host==1) host='matton.se'; else if (host==2) host='mattonbutiken.se'; else if (host=='') host=''; else host=decode64(host);
    return host; 
}

function decode64(input) {
   var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0;
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
   do {
      enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++));
      chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4;
      output = output + String.fromCharCode(chr1); 
      if (enc3 != 64) { output = output + String.fromCharCode(chr2); }
      if (enc4 != 64) { output = output + String.fromCharCode(chr3); }
   } while (i < input.length); return output; 
}
// xmlreq ------------------------------------------------------------
me_request=new Array();
me_request_c=0;
function xmlreq(url,fresp) {
    r_c=me_request_c++; me_request[r_c] = new xmlhttp_request (url, fresp, r_c);
    return r_c; 
}
function xmlhttp_request (url, e, id) {
    this.target = document; this.url = url; this.id = id; this.event = e; this.xmlhttp = false; this.method = "GET"; this.doRequest(); }
    xmlhttp_request.prototype.init_xmlhttp = function () {
    try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { this.xmlhttp = false; } } if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') { this.xmlhttp = new XMLHttpRequest(); }
    }
    xmlhttp_request.prototype.doRequest = function () {
    if (!this.xmlhttp) { this.init_xmlhttp(); }
    //this.xmlhttp=false;
    if (this.xmlhttp) {
    var o = this;
    o.xmlhttp.open(this.method, this.url, true);
    o.xmlhttp.onreadystatechange= function() {
    if (o.xmlhttp.readyState==4) { o.response = o.xmlhttp.responseText; o.event(o.id); } }
    o.xmlhttp.send(null);
    }
    else { var iid=this.id+1; lbf.location=this.url+'&iframe='+iid; }
}


