/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
    var request_type;
    var browser = navigator.appName;
    
    if(browser == "Microsoft Internet Explorer"){
    	request_type = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
    	request_type = new XMLHttpRequest();
    }
    return request_type;
}

var http = createObject();
/* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function getFormResponse() {
    // Optional: Show a waiting message in the layer with ID login_response
    document.getElementById('form').innerHTML = "Just a second..."
	
    // Required: verify that all fields are not empty. Use encodeURI() to solve some issues about character encoding.
    //var id = encodeURI(document.getElementById('id').value);
	
	var form = document.getElementById('form');
	var id = form.getAttribute('name');

  
    // Set the random number to add to URL request
    nocache = Math.random();
	
	//var params ="&nocache="+nocache;
    var params = "id="+id+"&nocache="+nocache;
    // Pass the login variables like URL variable
    http.open('POST', '../form-files/getForm.php');
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	
    http.onreadystatechange = function () { getFormReply();}
    http.send(params);
	
	//return drss_id;
 }
	
    function getFormReply() {
        if(http.readyState == 4){

			
        	var response = http.responseText;
        	document.getElementById('form').innerHTML = response;
    }
}

// JavaScript Document