﻿

function setName(obj, prm1) {
    if (obj.innerText) {

        document.getElementById('textfield').value = obj.innerText;
        document.getElementById('textfield1').value = obj.innerText;
        document.getElementById('prodID').value = prm1;
        //generalFrm.textfield.value = obj.innerText;
        //generalFrm.textfield1.value = obj.innerText;
    }
    else {
        document.getElementById('textfield').value = obj.textContent;
        document.getElementById('textfield1').value = obj.textContent;
        document.getElementById('prodID').value = prm1;

        // generalFrm.textfield.value = obj.textContent;
        //generalFrm.textfield1.value = obj.textContent;
    }
    document.getElementById('divNamess').innerHTML = '';
    window.setTimeout('hideDiv()', 100);
    searchgeneralFrm();
}

function hideDiv() {
    document.getElementById('textfield1').style.display = '';
    document.getElementById('divNamess').style.display = 'none';
}


function getNames(prm) {

    xmlHttp = GetXmlHttpObject()
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request")
        return;
    }
   // if (document.getElementById('firstTime').value == 'yes') {
        var url = "inc/getSelectAjax.asp";
        url = url + "?phrase=" + prm;
       // alert(url);
        xmlHttp.onreadystatechange = stateChanged;
        //alert(url);
        xmlHttp.open("GET", url, true)
        xmlHttp.send(null)
    //}     
}


function stateChanged() {
    if ((xmlHttp.readyState == 4) || (xmlHttp.readyState == "complete")) {
        if (xmlHttp.status == 200) {
            document.getElementById('catIDtd').innerHTML = xmlHttp.responseText;
            document.getElementById('catIDtd').style.display = "inline";

        }
    }
}




function GetXmlHttpObject() {
    var objXMLHttp;
    try { objXMLHttp = new XMLHttpRequest(); }
    catch (e) {
        try { objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
        catch (e) {
            try { objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    return objXMLHttp;
}

var myWindow;

function newWindow(winWidth, winHeight, imgName) {
    if (myWindow)
        myWindow.close();
    myWindow = window.open(imgName, 'mama', 'resizable=no,scrollbars=no,width=' + winWidth + ',height =' + winHeight + ',left=' + (screen.width / 2 - winWidth / 2) + ',top=' + (screen.height / 2 - winHeight / 2) + '');
    myWindow.focus();
}

function isHeb(e) {
    var strCheck = 'אבגדהוזחטיכלמנסעפצקרשתךףץםן- ';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode != 0) {
        // return true;
        if (whichCode == 13)
            document.getElementById('divNames').style.display = "none";
        key = String.fromCharCode(whichCode);
        if (strCheck.indexOf(key) == -1) return false;
        else return true;
    }
}


////////////////////////////////////////////////////////////////////////////////
///הצגת תמונה
////////////////////////////////////////////////////////////////////////////////