//<script>GoToUrl('http://192.168.1.2', {'q':'a', 'c':'b'}, 'Get')</script>
function GoToUrl(myURL, myPARAMS, myMETHOD, myTARGET) {
    myMETHOD = myMETHOD || 'post';
    var form = document.createElement('form');
    form.setAttribute('method', myMETHOD);
    form.setAttribute('action', myURL);
    form.setAttribute('target', myTARGET);
    for(var myKEY in myPARAMS) {
        var hiddenField = document.createElement('input');
        hiddenField.setAttribute('type', 'hidden');
        hiddenField.setAttribute('name', myKEY);
        hiddenField.setAttribute('value', myPARAMS[myKEY]);
        form.appendChild(hiddenField);
    }
    document.body.appendChild(form);
    form.submit();
    document.body.removeChild(form);
}
//Set Object Class
function OpenNewWin(myURL, myPARAMS, myMETHOD, myTARGET) {
    /*
        объекты не переносимы =( сцук!
        Конвертируем в текстовый формат и в новую функцию
    */
    myPARTXT = "";
    for(var myKEY in myPARAMS) {
        myPARTXT = myPARTXT + "'" + myKEY + "':'" + myPARAMS[myKEY] + "',";
    }
    myHWND = window.open('','Printableversion','width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no, resizable=yes');
    myHWND.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n');
    myHWND.document.write('<html>\n');
    myHWND.document.write('<head>\n');
    myHWND.document.write('<title>Printing...</title>\n');
    myHWND.document.write("<script language='javascript' type='text/javascript' src='http://" + window.location.hostname + "/js/protocol.js'></script>\n");
    myHWND.document.write('</head>\n');
    myHWND.document.write("<body onload=\"javascript: GoToUrl('" + myURL + "',{" + myPARTXT + "},'" + myMETHOD + "','" + myTARGET + "'); return false;\">\n");
    myHWND.document.write('</body>\n');
    myHWND.document.write('</html>\n');
    myHWND.document.close();
}
//Set Object Class
function setClass(myID,myCLASS) {
    document.getElementById(myID).className = myCLASS;
}
