function is_email_valid(an_email) { return (an_email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)>=0); }

function is_empty_str(str) { return (str.toString().replace(/ +/i,"")==""); }

// окно, которое по центру
function OutInWin(pict, xw, yw, namew,scroll) {
    var x_width  = xw;
    var y_height = yw;

    if(!scroll) { scroll='yes'; }

    var w_top = (screen.height - y_height)/2-50;
    var w_left= (screen.width - x_width)/2;

    window.open(pict, namew, "top="+w_top+",left="+w_left+",width="+x_width+",height="+y_height+",resizable=yes,scrollbars="+scroll+",status=no,dependent=no");
    return false;
}

function get_calendar (impl, month, year, parent_node) {
	$.ajax({
         type: "POST",
         url: "calendar.gate",
         data: "impl="+impl+"&month="+month+"&year="+year+"&parent_node="+parent_node,
         dataType: "html" ,
         success: function(msg){
            var res=JSON.parse(msg);
            $("#calendar_"+impl).html(res['html']);
         }
    });
}

function get_action_calendar (impl, month, year, parent_node) {
    $.ajax({
         type: "POST",
         url: "action_calendar.gate",
         data: "impl="+impl+"&month="+month+"&year="+year+"&parent_node="+parent_node,
         dataType: "html" ,
         success: function(msg){
            var res=JSON.parse(msg);
            $("#calendar_"+impl).html(res['html']);
         }
    });
}
