function SaveForm(ID) {
            //$("#"+ID).attr("style","display:none"); // скрываем форму
            
            ////////////////////
            // собираем данные  
            for (i=0; i<$("#"+ID+" :input").length; i++) {
             if($("#"+ID+" :input")[i].type != "checkbox") {     
                    $("#url").append("&"+$("#"+ID+" :input")[i].id + "="+ $("#"+ID+" :input")[i].value); //формируем УРЛ
                    }}
           for (i=0; i<$("#"+ID+" input[type=checkbox]:checked").length; i++) {    
            $("#url").append("&"+$("#"+ID+"  input[type=checkbox]:checked")[i].id + "="+ $("#"+ID+"  input[type=checkbox]:checked")[i].value); //формируем УРЛ
        } 
        ////////////////////////////////   

        $.ajax({
              type: "POST",
              url: "/cp/check.php",      
              data: $("#url").text(),  // отправляем 
              timeout:15000,  
              success: function(html){ 
                $("#url").empty().append(""+html); 
                              
                if($("#error").attr("value") == 1) {                      
                  
                 //alert($("#url").text());   
                 jAlert(''+html+'', 'Ответ системы:');
                 //$("#"+ID).removeAttr("style"); 
                 $("#url").empty();
                } else {             
                $("#"+ID).empty();
                $("#"+ID).append("<br>"+html+"");
                jAlert(''+html+'', 'Ответ системы:');

                }               
              }
                })};
				
				
function imgOpen(path,title,iWidth,iHeigth) {

    if ($(window).width() - iWidth < 200)
        {
       
            var iWidth = iWidth/2;
                   
        } else {
        
            var iWidth = iWidth;
       
        }
        
    if($(window).height() - iHeigth < 100) {
    
            var iHeigth = iHeigth/2;
            
    }    else {
    
            var iHeigth = iHeigth;
    
    }
    popupWin = window.open(path,'new','0,0,0,0,0,resizable=1,scrollbars=1,width='+iWidth+',height='+iHeigth+',top=50,left=50'); 

}


