function openDialog(title,node,x,y) {

         $("#"+node).show();                          
         $("#"+node).dialog({
                  modal: true,
                  height: y,
                  title: title,
                  width: x
         });  
    
}

function closeDialog(node) {
         $("#"+node).dialog("close");
         $("#"+node).hide();
}

function openDialogTinyMCE(title,node,x,y,tinymcenodes) {
         
         $("#"+node).show();                          
         $("#"+node).dialog({
                  modal: true,
                  height: y,
                  title: title,
                  width: x,
                  open : function () {
                           tmnodes=tinymcenodes.split(",");
                           $.each(tmnodes, function(i,n) {
                                    tinyMCE.execCommand('mceAddControl', false,n);
                           });
                  },
                  close: function () {
                           tmnodes=tinymcenodes.split(",");
                           $.each(tmnodes, function(i,n) {
                                    tinyMCE.execCommand('mceRemoveControl', false,n);
                           });
                  }
         });  
    
}

// Have a generic title, width and height,variables to send
function jQueryAlert(title,msg,x,y) {
         // node 
         $("#alert").html(msg);
         $("#alert").show();
         $("#alert").dialog({
                  width: x,
                  height: y,
                  title: title,
                  buttons: {
                           "OK": function() {
                                    closeDialog('alert');
                                    return true; 
                           },
                           "Cancel": function () {
                                    closeDialog('alert');
                                    return false;
                           }
                  }
         });
}


function ajax(script,node,querystring) {

    $.ajax({
        type: "POST",
        url: script,
        async: false,
        data: querystring,
        success: function(msg) {

                  $("#"+node).html(msg);
        }
    });


}