function SaveForm(ID) {
            $("#saveform").attr("style","display:none");
            for (i=0; i<$("#"+ID+" :input").length; i++) {    
                    $("#url").append("&"+$("#"+ID+" :input")[i].id + "="+ $("#"+ID+" :input")[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+'', 'Результат запроса');
                 $("#saveform").removeAttr("style"); 
                 $("#url").empty();
                } else {             
                $("#"+ID).empty();
                $("#"+ID).append("<br><h1>"+html+"</h1>");
                jAlert(''+html+'', 'Результат запроса');

                }               
              }
                })};
                
function  loadhtml(ID,ID2,ID3) {
              //alert(ID3);
                   $.ajax({
              type: "GET",
              url: "/cp/loadhtml.php?num="+$("#"+ID3+" option:selected").attr('id'),      
              data: "html",
              timeout:15000, 
              success: function(html){ 
               
               $("#"+ID).removeAttr("style"); 
                $("#"+ID2).empty().append(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'); 

}

