/* Copyright © Bernard Nauwelaerts 2010 - All rights reserved. This file is licensed to E-QCM (TM) for use on its website. Unauthorized copies and usage are prohibited. */ function xml_object(url){xml_object.prototype.get_data=get_data;xml_object.prototype.set_data=set_data;xml_object.prototype.url=url;xml_object.prototype.callback=function(){return false};function get_data(){var XML=get_XML_HTTP_obj();var this_obj=this;if(XML){this_obj.callback(XML.readyState);XML.onreadystatechange=function(){if(XML.readyState==4){if(XML.status !=200){this_obj.callback(XML.status);}else{this_obj.response=XML.responseXML.documentElement;this_obj.callback(4);}}};XML.open('GET',this.url,true);XML.send(null);}return false;}xml_object.prototype.post_data=function(data){this.XML=get_XML_HTTP_obj();if(this.XML){this.XML.open('POST',this.url,false);this.XML.send(data);if(this.XML.responseXML){var r=this.XML.responseXML.documentElement;this.response=r;this.callback(r);}else{alert('An error occured while posting '+this.url);}}return false;};function set_data(data){var XML=this.get_XML_HTTP_obj();if(XML){XML.open('GET',this.url,false);XML.send(undef);this.response=XML.response;}return false;};function get_XML_HTTP_obj(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return false;}}}return xmlHttp;};xml_object.prototype.setcallback=function(code){eval("this.callback=function(ret){"+code+"};");};};function loadXMLString(txt){try{parser=new DOMParser();xmlDoc=parser.parseFromString(txt,"text/xml");}catch(e){try{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(txt);}catch(e){alert('Your Browser does not supports XML');die}}return xmlDoc;};eqcm_class=function(url){this.name='eqcms';this.eqcmform=document.getElementById('eqcmf');this.ajax=new xml_object(url); this.post=function(r){this.eqcmform=document.getElementById('eqcmf');var val=Array();var rb=this.eqcmform.elements;for(var i=0;i < rb.length;i++){if(rb[i].checked==true){val.push(rb[i].name+'='+rb[i].value);}}this.ajax.setcallback('document.eqcms.ajax_res(ret)');this.eqcmform.EQCMSubmit.value='En cours...';this.eqcmform.EQCMSubmit.disabled=true;this.ajax.post_data(val.join('&')+'&qcmr0=&EQCMSubmit=1');return false;};this.ajax_res=function(r){this.eqcmform=document.getElementById('eqcmf');this.eqcmform.parentNode.innerHTML=this.ajax.XML.responseText;};};
