// Create the XML HTTP request object. We try to be
// more cross-browser as possible.
function CreateXmlHttpReq(handler) {
  var xmlhttp = null;
  try {
    xmlhttp = new XMLHttpRequest();
  } catch(e) {
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  xmlhttp.onreadystatechange = handler;
  return xmlhttp;
}

// An handler that does nothing, used for AJAX requests that
// don't require a reply and are non-critical about error conditions.
function DummyHandler() {
    return true;
}

// Shortcut for creating a GET request and get the reply
// This few lines of code can make Ajax stuff much more trivial
// to write, and... to avoid patterns in programs is sane!
function ajaxGet(url,handler) {
    var a = new Array("placeholder");
    for (var j=2; j<arguments.length; j++) {
        a[a.length] = arguments[j];
    }
    var ajax_req = CreateXmlHttpReq(DummyHandler);
    var myhandler = function() {
        var content = ajaxOk(ajax_req);
        if (content !== false) {
            a[0] = content;
            try {
                return handler.apply(this, a);
            } catch(e) {
                return myDummyApply(handler, a);
            }
        }
    }
    ajax_req.onreadystatechange = myhandler;
    ajax_req.open("GET",url);
    ajax_req.send(null);
}

// IE 5.0 does not support the apply() method of the function object,
// we resort to this eval-based solution that sucks because it is not
// capable of preserving 'this' and is ugly as hell, but it works for us.
function myDummyApply(funcname,args) {
    var e = "funcname(";
    for (var i = 0; i < args.length; i++) {
        e += "args["+i+"]";
        if (i+1 != args.length) {
            e += ",";
        }
    }
    e += ");"
    return eval(e);
}

// Add a random parameter to the get request to avoid
// IE caching madness.
function ajaxGetRand(url,handler) {
    url += (url.indexOf("?") == -1) ? "?" : "&";
    url += "rand="+escape(Math.random());
    arguments[0] = url;
    try {
        return ajaxGet.apply(this,arguments);
    } catch(e) {
        return myDummyApply(ajaxGet,arguments);
    }
}

function ajaxOk(req) {
    if (req.readyState == 4 && req.status == 200) {
        return req.responseText;
    } else {
        return false;
    }
}


function hide(target) {
    var e = document.getElementById(target);
    if (e.style.visibility == 'hidden') {
        e.style.visibility = 'visible';
        e.style.display = 'block';
    } else {
        e.style.visibility = 'hidden';
        e.style.display = 'none';
    }
}

function $(id) {
    return document.getElementById(id);
}

function $html(id) {
    return document.getElementById(id).innerHTML;
}

function $sethtml(id,html) {
    document.getElementById(id).innerHTML = html;
}

function $apphtml(id,html) {
    document.getElementById(id).innerHTML += html;
}

//Funzione per modificare il contenuto di un elemento nella pagina, accetta i parametri target e text
function set_text(target, text) {
    var e = document.getElementById(target);
    e.innerHTML = text;
}

//Funzione per prelevare il contenuto di un elemento
function get_text(target, text) {
    var e = document.getElementById(target);
   return e.innerHTML;
}

function $upd_div(content,elementid) {
    var e = document.getElementById(elementid);
    e.innerHTML = content;
}//function myHandler(content) {$sethtml('d1',content);}




function make_upd ()
{
var upd_div = function $upd_div(content,elementid) {var e = document.getElementById(elementid); e.innerHTML = content;};
return upd_div;
}

var htmlt = '<input type="submit" value="Ciao!">';

function sakaguchi()
{
$sethtml('descrizione_distribuzione','<b>Sakaguchi: </b> Using whole technique of electric heater application for Ultra high temperature, Ultra high vacuum, Super low temperature, SAKAGUCHI E.H CORP. has been developed the products for the field of Vacuum, Optical, Chemical industries.SAKAGUCHI has been manufacturing the products about Semi-conductor industry, applied with Ultra-conduction material, Bio-technology field, Aviation space industry, equipments for Environmental contamination.');
}
function junair()
{
$sethtml('descrizione_distribuzione','<b>Jun-Air: </b> The quiet JUN-AIR compressors are designed for a countless number of uses and can be found in laboratories, dental clinics, medical and industrial applications worldwide.');
}
function stec()
{
$sethtml('descrizione_distribuzione','<b>STEC:</b> has had the reputation of building the most reliable Mass Flow Controllers (MFCs), Liquid Flow devices, and Vaporization Control devices.</b> .');
}
function fujilog()
{
$sethtml('descrizione_distribuzione','<b>Fujikin:</b>  is a global leader in the design and manufacturer of advanced fluid and gas flow valves, fittings and control systems for specialized high purity fabrication and process equipment operating in abrasive, corrosive, flammable or toxic applications in a wide range of demanding industries, including semiconductor, aerospace, electric power generation, pharmaceutical, chemical and more.</b> ');
}
function gt()
{
$sethtml('descrizione_distribuzione','<b>Greene Tweed: </b>  Word leader in Composite Components, Connector Systems, Engineered Components, 	Sealing Components, etc..');
}
function timertest()
{
 setTimeout('alert("ciao!")', 3000); //l'oggetto window puņ essere sottointeso
}

function 
bgImage(id,image)
	{
	document.getElementById(id).style.backgroundImage = 'url('+image+')'; 
 	} 
	