YAHOO.util.Event.addListener(window,'load', makeRequest);

function dhtmlLoadScript(url) {
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}

function makeRequest() {
  var elDiv = document.getElementById('ajax-container');
  var classId = elDiv.getAttribute('class');
 
  elDiv.innerHTML = 'loading data...';

  var callback =
  {
    success: function(o){ 
      elDiv.innerHTML = o.responseText;
      // load the script then call init method
      // needed to wait until the dom is right
      dhtmlLoadScript("http://www.forms.paristech.com/js/DOMhelp.js");   
      dhtmlLoadScript("http://www.forms.paristech.com/js/en_validationRules.php?json=1");   
      dhtmlLoadScript("http://www.forms.paristech.com/js/formValidation.js");   
      var e = document.createElement("script");
      e.type="text/javascript";
      e.innerHTML = 'df.init();';
      document.getElementsByTagName("head")[0].appendChild(e);
               
    },
    failure:function(o){}
  };

  YAHOO.util.Connect.initHeader('X_REQUESTED_WITH','XMLHttpRequest');
  var request = YAHOO.util.Connect.asyncRequest('GET', 'http://www.paristech.com/fsockopen.php?id='+classId, callback);  
}


function ajaxFormSubmit() {

  var callback =
  {
    success: function(o){ 
      var elDiv = document.getElementById('ajax-container');
      elDiv.innerHTML = o.responseText; 
    },
    failure:function(o){}
  };

  // argument formId can be the id or name attribute value of the
  // HTML form, or an HTML form object.
  var formObject = document.getElementById('validateForm');
  YAHOO.util.Connect.setForm(formObject);
  // This example facilitates a POST transaction.  The POST data(HTML form)
  // are initialized when calling setForm(), and it is automatically
  // included when calling asyncRequest.

  var cObj = YAHOO.util.Connect.asyncRequest('POST', 'http://www.paristech.com/fsockopen-salesforce.php', callback);
}

