/*
 * JavaScript functions and code for the Musician Registration form.
 */
	//
	// set bDebugging to true to get some test values and URLs that
	// work on the local testing environment
	//
var	bDebugging = false;
function LoadDebug()
{
    try
    {
        var elem;
        
        if (bDebugging)
        {
            if (elem = document.getElementsByName("Name")[0])
                elem.value = "Jack Straw";
            if (elem = document.getElementsByName("Address1")[0])
                elem.value = "1 Smith Street";
            if (elem = document.getElementsByName("Suburb")[0])
                elem.value = "No Where";
            if (elem = document.getElementsByName("State")[0])
                elem.selectedIndex = 1;
            if (elem = document.getElementsByName("PostalCode")[0])
                elem.value = "1234";
            if (elem = document.getElementsByName("Email")[0])
                elem.value = "russpub@tectite.com";
            if (elem = document.getElementsByName("Phone")[0])
                elem.value = "9752 1811";
            if (elem = document.getElementsByName("Band1")[0])
                elem.value = "The First Band";
            if (elem = document.getElementsByName("Band2")[0])
                elem.value = "The Second Band";
            
            var     s_host = window.location.host;
            
            if (s_host == 'wjf.openconc.com.au' || s_host == 'wjf')
                if (elem = document.getElementsByName("recipients")[0])
                    elem.value = 'russellr@cabernet.openconc.com.au';
        }
    }
    catch (ex)
    {
        alert(ex);
    }
}

var	sSaveSubmit = "";
var eButton = null;
function OnClick(elem)
{
    /*
     * Disabling the button stops IE7 from submitting the form, so we fake the
     * disabling by returning false on repeated clicks.
     */
  if (eButton != null)
    return (false);
  if (Validator())
  {
	  sSaveSubmit = elem.value;
	  elem.value = "Wait...";
	  eButton = elem;
	  setTimeout("eButton.value = sSaveSubmit; eButton = null;",30000);
	  return (true);
  }
  return (false);
}
