// JavaScript Document function ReplaceAll(str,find,rep){ var reg = new RegExp(find,"gi") return(str.replace(reg,rep)); } function nl2br (str, is_xhtml) { var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '
' : '
'; return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2'); } function CheckFormProfile() { if (document.form_profile.form_item_tag.value=='') return(alert("Please fill in a Tag")); if (document.form_profile.form_item_profile.value=='') return(alert("Please fill in a Profile")); document.form_profile.submit(); } function CheckFormParameter() { if (document.form_parameter.form_item_parameter_value.value=='') return(alert("Please fill in a a non null value for the Parameter")); document.form_parameter.submit(); } function CheckFormLogon() { if (document.form_logon.Flogin.value=='') return(alert("Please fill in a login")); if (document.form_logon.Fpass.value=='') return(alert("Please fill in a password")); document.form_logon.submit(); } // Asynchronous Request For User checking function getHTTPObject() { var xhr_object; if(window.XMLHttpRequest) // Firefox xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) // Internet Explorer xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); return; } return xhr_object; } var http = getHTTPObject(); function check_user() { if (http.readyState == 4) { if (http.responseText==1) return(alert("This login exists! Please choose another one")); else document.form_user.submit(); } } function update_session_var(path_base,variable,value) { setTimeout("",1000); http.open("GET", path_base+"xmlhttprequest/update_session.php?recherche=" + escape(variable)+"&value="+escape(value), true); http.onreadystatechange = empty_function; http.send(null); } function empty_function() { } function CheckFormUser(path_base,action) { if (document.form_user.form_item_login.value=='') return(alert("Please fill in a login")); if (document.form_user.form_item_firstname.value=='') return(alert("Please fill in a first name")); if (document.form_user.form_item_name.value=='') return(alert("Please fill in a name")); if (document.form_user.form_item_email.value=='') return(alert("Please fill in a email")); if (document.form_user.form_item_password.value=='') return(alert("Please fill in a password")); if (action=='new') { setTimeout("",1000); var rechRapide = document.getElementById("form_item_login").value; http.open("GET", path_base+"xmlhttprequest/check_login_unicity.php?recherche=" + escape(rechRapide), true); http.onreadystatechange = check_user; http.send(null); } else { document.form_user.submit(); } } function CheckFormAddress(target_form) { if (document.forms[target_form].form_item_address_street1.value=='') return(alert("Please fill in a address")); if (document.forms[target_form].form_item_address_zip_code.value=='') return(alert("Please fill in a postal code")); if (document.forms[target_form].form_item_address_city.value=='') return(alert("Please fill in a city")); return 'ok'; } function affectValue(target,source) { if (document.getElementById(target).value=='') { document.getElementById(target).value=document.getElementById(source).value; document.getElementById(source).value=''; } } function switch_visibility(elem,path_img,nb,path_base) { etat=document.getElementById(elem+nb).style.display; if(etat=="none") { for (i=1;i<(nb+1);i++) { document.getElementById(elem+i).style.display="block"; } document.images[elem+'_image'].src=path_img+'bt_moins.gif'; update_session_var(path_base,elem,'block'); } else { for (i=1;i<(nb+1);i++) { document.getElementById(elem+i).style.display="none"; } document.images[elem+'_image'].src=path_img+'bt_plus.gif'; update_session_var(path_base,elem,'none'); } }