function unload_intro() {
    if (f=document.getElementById("flash_intro_holder")) {
        f.style.display = "none";
    }
}


function unloadFlashMovie(name) {
    if (f=document.getElementById(name)) {
        f.style.display = "none";
    }
}


function app_submit(app_name) {
    ajax(app_name, "app.php", fields, "result");
}


function ajax(app_name, interface_url, field_ids, output_id) {
    //version 0.00.02

  
     if (field_ids.length) {
    
        var xmlHttp;
        try
          {
          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          // Internet Explorer
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
                if (o=document.getElementById(output_id)) {
                    responseAry = xmlHttp.responseText.split("|");
                    
                    if (responseAry[0] == '1') {
                        if (a=document.getElementById("form-" + app_name)) {
                            a.style.display = "none";
                        }
                    }
                    o.innerHTML = responseAry[1];
                } else {
                    alert(xmlHttp.responseText);
                }
              }
          }
          
          disqualified = false;
          params = "";
          for (i=0; i<field_ids.length; i++) {
            if (f=document.getElementById(app_name + "-" + field_ids[i])) {
                sep = (params == "") ? "" : "&";
                params += sep + field_ids[i] + "=" + f.value;
                if (f.value == "")
                    disqualified = true;
            }
          }
          //alert(params);
          
          //xmlHttp.open("GET","portal.php?me=" + me + "&child=" + child + "&child_name=" + child_name + "&" + caller.name + "=" + escape(caller.value),true);
          //xmlHttp.send(null);
        
        if (disqualified) {
            message = "Please ensure all fields are filled";
            if (o=document.getElementById(output_id)) {
                o.innerHTML = message;
            } else {
                alert(message);
            }
        } else {
            xmlHttp.open("POST", interface_url, true);

            //Send the proper header information along with the request
            xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttp.setRequestHeader("Content-length", params.length);
            xmlHttp.setRequestHeader("Connection", "close");
            xmlHttp.send(params);
        }
          
     }
}