function setchecks(obj,maxChecks,checkBoxId){
  	var ajaxSelect;  // The variable that makes Ajax possible!
    var ajaxUpdate;
    var checkCount;
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxSelect = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxSelect = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxSelect = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxSelect.onreadystatechange = function(){
        if(ajaxSelect.readyState == 4){
            //alert("select="+ajaxSelect.responseText);
			checkCount=parseInt(ajaxSelect.responseText);
			ajaxSelect.abort();
            if(obj.checked){
                checkCount=checkCount+1
            }  else{
                checkCount=checkCount-1
            }
            if(checkCount>maxChecks){
                obj.checked=false
                checkCount=checkCount-1
                alert('Вы можете вибрать только '+maxChecks)
            }


            try{
                // Opera 8.0+, Firefox, Safari
                ajaxUpdate = new XMLHttpRequest();
            } catch (e){
                // Internet Explorer Browsers
                try{
                    ajaxUpdate = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try{
                        ajaxUpdate = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e){
                        // Something went wrong
                        alert("Your browser broke!");
                        return false;
                    }
                }
            }
            // Create a function that will receive data sent from the server*/
            ajaxUpdate.onreadystatechange = function(){
                if(ajaxUpdate.readyState == 4){
                   /// alert("update="+ajaxUpdate.responseText);
                }
            }

            url="update_check_box_count.php";
            url+="?index="+checkBoxId;
            url+="&q="+checkCount;
           

            ajaxUpdate.open("GET", url, true);
            ajaxUpdate.send(null);

        }
    }
    url="select_check_box_count.php";
    url+="?index="+checkBoxId;

    ajaxSelect.open("GET", url, true);
    ajaxSelect.send(null);
 
}

function changeFunc(x)
{
  alert("value="+document.getElementById(x).value);

 var ajaxSelect;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxSelect = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxSelect = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxSelect = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){0                                                 
                // Something went wrong
                alert("Your browser broke!");
                return false;                                 
            }
        }
    } 
    
     ajaxSelect.onreadystatechange = function(){
                if(ajaxSelect.readyState == 4){
                    alert("session="+ajaxSelect.responseText);
                    
                }
     }
    url="peopleNum.php";
    url+="?peopleNum="+document.getElementById(x).value; 
   
    

    ajaxSelect.open("GET", url, true);
    ajaxSelect.send(null);


}

