function ctoggle(elem, tg) {
    if ($(elem).attr("checked")) {
        $(tg).removeAttr("disabled")
    } else {
        $(tg).attr("disabled", true);
    }
}


function ajaxDialog(elem, w, h, url, oid) {
    if ($.browser.msie) h+=120;
    $(elem).dialog({
        autoOpen: false,
        modal: true,
        resizable: false,
        width: w,
        height: h,
        buttons: {"Отмена": function() {
            $(this).dialog("close");
        }}
    }).show().load(url, {id: oid}, function() {
        $(elem).dialog("open");
    }
            );

}








function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}



function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}




//function setRegion() {
//    $.get("ajax.setregion.jsp", {fmcity: $('#mycity').val()}, new function(data, textStatus) {
//        $('#fcity').toggle();
//        setCookie('mycity', $('#mycity').val(), 365);
//        window.location.reload();
//    });
//}
