var lastart = null;
var timer=null;

function startTimer(func,timeout){
  timer = setTimeout(func,timeout);
}
function stopTimer(){
  if (timer!=null) {
    clearTimeout(timer);
    timer = null;
  }
}

function toggleImage(form,element,path,image,id) {
    if (form.value==id) {
        form.value=false;
        element.src=path+image+".gif";
    } else {
        form.value=id;
        element.src=path+image+"_g.gif";
    }
    document.form.submit();
}

function mouseOverDetails(comp,artnr,id) {
    if (lastart==null || lastart != artnr){
        if (lastart != null) {
            document.getElementById(lastart).className='ZelleWeiss'
        }
        lastart=artnr;
        document.getElementById(artnr).className='ZelleHellBlau';
        loadHtml(comp+"?artnr="+artnr,id);
    }
}

function doXmlHttpRequest(url, callback, postdata) {
    var xmlhttp = null;
    var loaded = false;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e1) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e2) {
            xmlhttp = false;
        }
    }

    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        xmlhttp = new XMLHttpRequest();
    }
    
    xmlhttp.open(postdata == null ? "GET" : "POST", url, true);
    xmlhttp.onreadystatechange = function() {
        if (!loaded && xmlhttp.readyState == 4) {
            callback(xmlhttp);
            loaded = true;
        }
    }
    xmlhttp.send(postdata);
}
function loadHtml(comp,id) {
    doXmlHttpRequest
        (
         comp,
         function(xmlhttp) {
             document.getElementById(id).innerHTML
                 = xmlhttp.responseText;
         });
}
function ajaxAction (comp,url) 
{
    doXmlHttpRequest
        (
         comp,
         function(xmlhttp) {
             alert(xmlhttp.responseText);
         });
}



