/**
 *
 * @return
 */
function accept()
{
    dijit.byId('accept').set('checked', true);
	dijit.byId('form-dialog').hide();
}

/**
 *
 * @return
 */
function decline()
{
    dijit.byId('accept').set('checked', false);
	dijit.byId('form-dialog').hide();
}

/**
 *
 * @param id
 * @return
 */
function showDialog(id)
{
	dijit.byId(id).show();
}


/*
dojo.connect(dojo.byId('regitration-submit'), 'onclick', null, function() {
	sendForm("regitration");
});
*/

function sendForm(formId)
{
    var form = dojo.byId(formId);
    dojo.connect(form, "onsubmit", function(event)
    {
        //Stop the submit event since we want to control form submission.
        dojo.stopEvent(event);

        //The parameters to pass to xhrPost, the form, how to handle it, and the callbacks.
        //Note that there isn't a url passed.  xhrPost will extract the url to call from the form's
        //'action' attribute.  You could also leave off the action attribute and set the url of the xhrPost object
        //either should work.
        var xhrArgs =
        {
            form: dojo.byId(formId),
            handleAs: "text",
            load: function(data)
            {
            	alert("succès... " + formId);
                dojo.byId("response").innerHTML = "Form posted.";
            },
            error: function(error)
            {
                //We'll 404 in the demo, but that's okay.  We don't have a 'postIt' service on the
                //docs server.
            	alert("erreur... " + formId);
                dojo.byId("response").innerHTML = "Form posted." + error;
            }
        }
        //Call the asynchronous xhrPost
        dojo.byId("response").innerHTML = "Form being sent..."
        var deferred = dojo.xhrPost(xhrArgs);
    });
}
//dojo.addOnLoad(sendForm('registration'));

// JavaScript Document


//window.onload = montre;
function show(id)
{
    var d = document.getElementById(id);
	for (var i = 1; i <= 10; i ++)
    {
		if (document.getElementById('smenu'+i))
        {
			document.getElementById('smenu'+i).style.display = 'none';
		}
	}

	if (d)
    {
		d.style.display = 'block';
	}
}

function changeBackground(id)
{
	var d = document.getElementById(id);
	if (d)
    {
		d.style.backgroundColor = '#eaeaea';
		d.style.color = '#003366';
		d.style.backgroundImage = 'none';
	}
}
