
var http_request = false;
   function makeRequest(url, parameters, obj) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('GET', 'includes/'+url + parameters, false);
      http_request.send(null);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
		obj = eval(http_request.responseText);
		clearForm(obj)
         } else {
            document.write(http_request.responseText);
         }
      }
   }
   
   function get(obj, actionURL) {
	
      var getstr = "?";
	
      for (i=0; i<obj.childNodes.length; i++) {
		
	if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text" || obj.childNodes[i].type == "hidden") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
			 
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
         }   
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];


		for (optionCounter = 0; optionCounter < sel.length; optionCounter++){
			if(sel.options[optionCounter].selected==true){
				getstr += sel.name + "=" + sel.options[optionCounter].value + "&";
			}		 
		}

          
         }

         if (obj.childNodes[i].tagName == "TEXTAREA") {
		var txtArea = obj.childNodes[i];
		getstr += txtArea.name + "=" + txtArea.innerText + "&";
	 }
	
      }
      makeRequest(actionURL, getstr, obj);
   }

	function Generic_XMLHTTP(actionPage){
		var http_request = false;
      			if (window.XMLHttpRequest) { // Mozilla, Safari,...
         			http_request = new XMLHttpRequest();
         			if (http_request.overrideMimeType) {
            				http_request.overrideMimeType('text/xml');
         			}
      			} else if (window.ActiveXObject) { // IE
         		try {
            			http_request = new ActiveXObject("Msxml2.XMLHTTP");
         		} catch (e) {
            		try {
               			http_request = new ActiveXObject("Microsoft.XMLHTTP");
            		} catch (e) {}
         		}
     	 		}
      			if (!http_request) {
         			alert('Cannot create XMLHTTP instance');
         			return false;
      			}
      			
			http_request.open('GET', actionPage, false);
      			http_request.send(null);
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
				return http_request.responseText;
			}
		}
	}
	
	
		function clearForm(obj){
		/*for (i=1; i<obj.childNodes.length; i++) {
			if (obj.childNodes[i].tagName == "INPUT") {
				if (obj.childNodes[i].type == "text" || obj.childNodes[i].type == "hidden") {
					obj.childNodes[i].value="";
            			}
            			if (obj.childNodes[i].type == "checkbox" || obj.childNodes[i].type == "radio") {
               				obj.childNodes[i].checked=false;
            			}
            		}   
		
			if (obj.childNodes[i].tagName == "SELECT") {
            			var sel = obj.childNodes[i];
					for (var g=0;g<sel.options.length;g++){
						sel.options[g].selected=false;
					}
            			sel.options[0].selected=true;
         		}
         
			if (obj.childNodes[i].tagName == "TEXTAREA") {
				var txtArea = obj.childNodes[i];
				txtArea.innerHTML="";
	 		}
	
		}*/
	}
