﻿var mySimpleDialog = new YAHOO.widget.SimpleDialog("dlg", { 
    width: "20em", 
    draggable: true, 
    fixedcenter : true,
	visible : false,
	constraintoviewport : true,
    icon: YAHOO.widget.SimpleDialog.ICON_WARN
});

var handleYes = function() 
{
    var p = document.getElementById("prg1");
    p.style.visibility = "hidden";
    var cmd = document.getElementById("txtCmd").value;
    document.getElementById("txtCmd").value = "";
    document.getElementById("txtArgs").value = "";
    this.hide();
    
    if (cmd=="ok") window.location = "../index.html"
};

var myButtons = [ { text:"Ok", handler:handleYes, isDefault:true } ];

mySimpleDialog.cfg.queueProperty("buttons", myButtons);

function showAlert(title, msgbody)
{
    mySimpleDialog.setHeader(title);
    mySimpleDialog.setBody(msgbody);
    mySimpleDialog.render(document.body); 
    mySimpleDialog.cfg.queueProperty("icon", YAHOO.widget.SimpleDialog.ICON_WARN);
    mySimpleDialog.show();
} 

function pageLoad()
{
    centeredObject("prg1");
    var cmd = document.getElementById("txtCmd").value;
    
    if (cmd!="")
    {
        var arg = document.getElementById("txtArgs").value;
        var tit = document.getElementById("txtTitle").value;
        showAlert(tit, arg);
    }
}