/*
 * Mem-validasi form sebelum disubmit
 */
function validateForm(pForm)
{
    var form = dijit.byId(pForm);
    if (!form.validate()) {
        alert("Please fill all required fields (*)");
        return false;
    }
    return true;
}

function hideFooter()
{
    dojo.byId('footer').style.display = "none";
}

function showFooter()
{
    dojo.byId('footer').style.display = "block";
}

function slideshow()
{
    // ajaxGet("slideshowA", baseUrl + "/slideshow/index/type/a");
    // ajaxGet("slideshowB", baseUrl + "/slideshow/index/type/b");
    // ajaxGet("slideshowC", baseUrl + "/slideshow/index/type/c");
    ajaxGet("slideshowD", baseUrl + "/slideshow/index/type/d");
    setTimeout("slideshow()",5000);
}

function ajaxGet(pTargetNode, pUrl)
{
    var targetNode = dojo.byId(pTargetNode);

    //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
    var xhrArgs = {
        url: pUrl,
        handleAs: "text",
        preventCache: true,
        load: function(data) {
            //Replace newlines with nice HTML tags.
            data = data.replace(/\n/g, "<br />");

            //Replace tabs with spacess.
            data = data.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");

            targetNode.innerHTML = data;
        },
        error: function(error) {
            targetNode.innerHTML = "An unexpected error occurred: " + error;
        }
    }

    //Call the asynchronous xhrGet
    var deferred = dojo.xhrGet(xhrArgs);
}

