function addFavorite(){
    window.external.AddFavorite('http://www.electrosystems.ru/','ЭлектроСистемы');
}
/////////////////////////////////////////////////////////////////////////////////

function hideInfo(){
    document.getElementById('rge11').style.display = "none";
}

/////////////////////////////////////////////////////////////////////////////////

function getrandom(min_random, max_random) {
    var range = max_random - min_random + 1;
    return Math.floor(Math.random()*range) + min_random;
}

/////////////////////////////////////////////////////////////////////////////////

function chKeyImage(imgKey) {
   name=getrandom(1,5);
   document.images[imgKey].src = "images/w"+name+".gif";
}

/////////////////////////////////////////////////////////////////////////////////

function show_inline(){
    if (document.getElementById("onlineBlock").style.display == "none"){
        document.getElementById("onlineBlock").style.display = "block";
    } else {
        document.getElementById("onlineBlock").style.display = "none";
    } 
}

/////////////////////////////////////////////////////////////////////////////////

function close_inline(){
   document.getElementById("onlineBlock").style.display = "none";
}

/////////////////////////////////////////////////////////////////////////////////

function getXmlHttp(){
    var xmlhttp;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
	      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (E) {
	      xmlhttp = false;
	    }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
         xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

/////////////////////////////////////////////////////////////////////////////////

function voteInLineMsg(uname,ucompany,umail,umsg,currKey) {

    if (uname.length==0 || umail.length==0 || umsg.length==0 || currKey.length==0){

        alert ("Все поля кроме КОМПАНИЯ должны быть заполнены");

    } else {

        if (currKey!="GK9DZK" && currKey!="3DK8DF" && currKey!="ARJTE7" && currKey!="DKSVJ3" && currKey!="KSB8JS"){

        alert ("Неправильный код");

        } else {

        uname=encodeURIComponent(uname); 
        ucompany=encodeURIComponent(ucompany); 
        umail=encodeURIComponent(umail);
        umsg=encodeURIComponent(umsg);
        currKey=encodeURIComponent(currKey);

        var req = getXmlHttp()
        req.open('GET', 'http://www.electrosystems.ru/saveMsg.php?uname='+uname+'&ucompany='+ucompany+'&umail='+umail+'&umsg='+umsg+'&currKey='+currKey+'&from=MT', true); 
        req.send(null);

        alert ("Ваше сообщение сохранено");
        document.getElementById('uname').value="";
        document.getElementById('ucompany').value="";        
        document.getElementById('umail').value="";
        document.getElementById('umsg').value="";
        document.getElementById('currKey').value="";

        }

    }

}

/////////////////////////////////////////////////////////////////////////////////
