function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i";
else return '';
}
// Controle que la personne est bien cliquer sur un checked
function checkNumBetween (champs,msg)
{
if (!champs.checked)
return "• " + msg +"
"
else return '';
}
// Controle que le champs est un email
function checkIsMail (champs,label)
{
ctl = /^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+([\.][A-Za-z0-9-]+)+$/;
if (champs.value.search(ctl) != -1)
{
resetStyle (champs,label);
return true;
}
else
{
setStyle (champs,label);
return false;
}
}
function checkIsNotNull (champs,label)
{
if (champs.value)
{
resetStyle (champs,label);
return true;
}
else
{
setStyle(champs,label);
return false;
}
}
function checkStyleChamps (champs,type,label)
{
if(type == "normal")
{
if (checkIsNotNull(champs,label))
{
resetStyle(champs,label);
}
}
else if(type == "num")
{
if (checkIsNum(champs,label))
{
resetStyle(champs,label);
}
}
else if(type == "email")
{
if (checkIsMail(champs,label))
{
resetStyle(champs,label);
}
}
}
function resetStyle(champs,label)
{
champs.className = "";
label.className = "";
}
function setStyle (champs,label)
{
champs.className = "inputError";
label.className = "labelError";
}
function resetStyleText(label)
{
if (label != null)
label.style.color = "#000000";
}
function setStyleText (label)
{
if (label != null)
label.style.color = "red";
}
// Controle que la liste déroulante est bien selectionnée
/*function checkLdSelected (champs,msg)
{
if (champs.selectedIndex != -1 && champs.options[champs.selectedIndex].value != -1) return '';
else return "• "+ msg +" est obligatoire
";
}*/
// Permet de formatter un champs téléphone
function formatPhoneNumber (chaine)
{
for (var i = 0;i<20;i++)
{
chaine = chaine.replace(/(\s|-|\.)/, "");
}
if (chaine.length != 0)
return chaine.substr(0,3)+chaine.substr(3);
else
return "";
}
function submit_formPartner(formulaire)
{
var msgError = new Array();
msgError.push (checkIsNotNull(formulaire.formNom,document.getElementById("lblFormNom")));
msgError.push (checkIsNotNull(formulaire.formAdresse,document.getElementById("lblFormdAdresse")));
msgError.push (checkIsNotNull(formulaire.formNPA,document.getElementById("lblFormNPA")));
msgError.push (checkIsNotNull(formulaire.formVille,document.getElementById("lblFormVille")));
msgError.push (checkIsNotNull(formulaire.formPays,document.getElementById("lblFormPays")));
msgError.push (checkIsNotNull(formulaire.formTelephone,document.getElementById("lblFormTelephone")));
//msgError.push (checkIsNum(formulaire.formTelephone,document.getElementById("lblFormTelephone")));
msgError.push (checkIsMail(formulaire.formEmail,document.getElementById("lblFormEmail")))
msgError.push (checkIsNotNull(formulaire.formContact,document.getElementById("lblFormContact")));
msgError.push (checkIsNotNull(formulaire.formContmail,document.getElementById("lblFormContmail")));
msgError.push (checkIsNotNull(formulaire.formCA,document.getElementById("lblFormCA")));
msgError.push (checkIsNotNull(formulaire.formCrea,document.getElementById("lblFormCrea")));
msgError.push (checkIsNotNull(formulaire.formNb,document.getElementById("lblFormNb")));
//On parse l'array pour contrôler si on a une valeur false
var estValide = new Boolean(true);
for (var error in msgError)
{
if (!msgError[error])
estValide = false;
}
if (estValide)
return true;
else
{
document.getElementById("errorForm").style.visibility = "visible";
//document.getElementById("errorForm").style.display = 'block';
return false;
}
}
function submit_form(formulaire)
{
var msgError = new Array();
msgError.push (checkIsNotNull(formulaire.formNom,document.getElementById("lblFormNom")));
msgError.push (checkIsNotNull(formulaire.formContact,document.getElementById("lblFormContact")));
msgError.push (checkIsNotNull(formulaire.formAdresse,document.getElementById("lblFormAdresse")));
msgError.push (checkIsNotNull(formulaire.formNPA,document.getElementById("lblFormNPA")));
msgError.push (checkIsNotNull(formulaire.formVille,document.getElementById("lblFormVille")));
msgError.push (checkIsNotNull(formulaire.formPays,document.getElementById("lblFormPays")));
msgError.push (checkIsNotNull(formulaire.formTelephone,document.getElementById("lblFormTelephone")));
//msgError.push (checkIsNum(formulaire.formTelephone,document.getElementById("lblFormTelephone")));
msgError.push (checkIsNotNull(formulaire.txtValideForm,document.getElementById("lblValideForm")));
//msgError.push (checkIsNotNull(formulaire.formFiles,document.getElementById("lblFormFiles")));
msgError.push (checkIsMail(formulaire.formEmail,document.getElementById("lblFormEmail")));
//On contrôle s'il y a au moins une circonstance de panne choisie
if (!document.getElementById("formType_Analyse").checked && !document.getElementById("formType_Importe").checked && !document.getElementById("formType_Hardware").checked && !document.getElementById("formType_Logiciel").checked)
{
setStyleText (document.getElementById("lblformType_Analyse"));
setStyleText (document.getElementById("lblformType_Importe"));
setStyleText (document.getElementById("lblformType_Hardware"));
setStyleText (document.getElementById("lblformType_Logiciel"));
msgError.push (false);
}
/*if (!document.getElementById("formCirc_Autres").checked && !document.getElementById("formCirc_Bruit").checked && !document.getElementById("formCirc_Nature").checked && !document.getElementById("formCirc_Chute").checked && !document.getElementById("formCirc_OS").checked && !document.getElementById("formCirc_Format").checked)
{
setStyleText (document.getElementById("lblFormCirc_Format"));
msgError.push (false);
}*/
/*if(!document.getElementById("formTypeRecupLog").checked && !document.getElementById("formTypeRecupMat").checked)
{
setStyleText (document.getElementById("lblFormTypeRecupLog"));
setStyleText (document.getElementById("lblFormTypeRecupMat"));
msgError.push (false);
}*/
//else
//{
if (document.getElementById('formProvenance').value == "magasin")
{
msgError.push (checkIsNotNull(formulaire.formProvenanceDetails,document.getElementById("lblFormProvenanceDetails")));
}
//}
if(document.getElementById('formProvenance').value == "-1" || document.getElementById('formProvenance').value == "-2")
{
setStyleText (document.getElementById("lblFormProvenance"));
msgError.push (false);
}
else
{
if (document.getElementById('formProvenance').value == "magasin")
{
msgError.push (checkIsNotNull(formulaire.formProvenanceDetails,document.getElementById("lblFormProvenanceDetails")));
}
else
{
resetStyleText (document.getElementById("lblFormProvenance"));
}
}
if(!document.getElementById("formCGV_1").checked)
{
setStyleText (document.getElementById("lblFormCGV1"));
setStyleText (document.getElementById("lblLinkFormCGV1"));
msgError.push (false);
}
if(document.getElementById("txtValideForm").value != '')
{
setStyle(document.getElementById("txtValideForm"),document.getElementById("lblValideForm"));
msgError.push (false);
}
else
{
resetStyle(document.getElementById("txtValideForm"),document.getElementById("lblValideForm"));
}
//On parse l'array pour contrôler si on a une valeur false
var estValide = new Boolean(true);
for (var error in msgError)
{
if (!msgError[error])
estValide = false;
}
if (estValide)
return true;
else
{
document.getElementById("errorForm").style.visibility = "visible";
//document.getElementById("errorForm").style.display = 'block';
return false;
}
}
function testProvenance()
{
if(document.getElementById('formProvenance').value != "-1" && document.getElementById('formProvenance').value != "-2")
resetStyleText (document.getElementById("lblFormProvenance"));
else
setStyleText (document.getElementById("lblFormProvenance"));
}
function afficheDetailsProvenance(strProvenance)
{
if (strProvenance == "magasin")
{
document.getElementById("formRecupPartProvLabel").style.visibility = "visible";
document.getElementById("formRecupPartProvInput").style.visibility = "visible";
}
else
{
document.getElementById("formRecupPartProvLabel").style.visibility = "hidden";
document.getElementById("formRecupPartProvInput").style.visibility = "hidden";
}
}
function imposeMaxLength(Object, MaxLen)
{
return (Object.value.length <= MaxLen);
}
function submit_formSatisfaction(formulaire)
{
var msgError = new Array();
msgError.push (checkIsNotNull(formulaire.formNom,document.getElementById("lblFormNom")));
msgError.push (checkIsMail(formulaire.formEmail,document.getElementById("lblFormEmail")));
//On parse l'array pour contrôler si on a une valeur false
var estValide = new Boolean(true);
for (var error in msgError)
{
if (!msgError[error])
estValide = false;
}
if (estValide)
return true;
else
{
document.getElementById("errorForm").style.visibility = "Visible";
//document.getElementById("errorForm").style.display = 'block';
return false;
}
}
function $RF(el, radioGroup) {
if($(el).type && $(el).type.toLowerCase() == 'radio') {
var radioGroup = $(el).name;
var el = $(el).form;
} else if ($(el).tagName.toLowerCase() != 'form') {
return false;
}
var checked = $(el).getInputs('radio', radioGroup).find(
function(re) {return re.checked;}
);
return (checked) ? $F(checked) : null;
}
function ajaxPrix()
{
var xhr=null;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
//on définit l'appel de la fonction au retour serveur
xhr.onreadystatechange = function() { ajaxPrixTraitement(xhr); };
//on appelle le fichier reponse.txt
xhr.open("POST", "../action/form_typerecup.php", true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
if (document.getElementById('formTypeSupport').selectedIndex >= 0 && document.getElementById('formCapacite').selectedIndex >= 0)
{
var param = 'type=' + document.getElementById('formTypeSupport').options[document.getElementById('formTypeSupport').selectedIndex].value;
param += '&capacite=' + document.getElementById('formCapacite').options[document.getElementById('formCapacite').selectedIndex].value;
param += '&format=' + document.getElementById('formCirc_Format').checked;
param += '&chute=' + document.getElementById('formCirc_Chute').checked;
param += '&nature=' + document.getElementById('formCirc_Nature').checked;
param += '&bruit=' + document.getElementById('formCirc_Bruit').checked;
param += '&os=' + document.getElementById('formCirc_OS').checked;
param += '&autre=' + document.getElementById('formCirc_Autres').checked;
xhr.send(param);
}
else
{
xhr.send(null);
}
}
function ajaxPrixTraitement(xhr)
{
if (xhr.readyState==4)
{
aValue = xhr.responseText.split(";");
if (aValue[1] != '')
{
document.getElementById('prixAnalyseImporte').innerHTML = aValue[1];
}
else if (aValue[3] != '')
{
document.getElementById('prixAnalyseImporte').innerHTML = aValue[3];
}
if (aValue[2] == '' && aValue[4] == '')
{
document.getElementById('liPrixRecupImporte').style.visibility = "hidden";
document.getElementById('liPrixRecupImporte').style.display = "none";
}
else
{
document.getElementById('liPrixRecupImporte').style.visibility = "visible";
document.getElementById('liPrixRecupImporte').style.display = "list-item";
if (aValue[4] != '')
{
document.getElementById('prixRecupImporte').innerHTML = aValue[4];
}
else if (aValue[2] != '')
{
document.getElementById('prixRecupImporte').innerHTML = aValue[2];
}
}
}
/*
if (xhr.readyState==4)
{
aValue = xhr.responseText.split(";");
document.getElementById('liPrixAnalyseLogiciel').style.visibility = (aValue[1] != '') ? "visible" : "hidden";
document.getElementById('liPrixAnalyseLogiciel').style.display = (aValue[1] != '') ? "list-item" : "none";
if (aValue[1] != '')
{
document.getElementById('prixAnalyseLogiciel').innerHTML = aValue[1];
}
document.getElementById('liPrixRecupLogiciel').style.visibility = (aValue[2] != '') ? "visible" : "hidden";
document.getElementById('liPrixRecupLogiciel').style.display = (aValue[2] != '') ? "list-item" : "none";
if (aValue[2] != '')
{
document.getElementById('prixRecupLogiciel').innerHTML = aValue[2];
}
document.getElementById('liPrixAnalyseHardware').style.visibility = (aValue[3] != '') ? "visible" : "hidden";
document.getElementById('liPrixAnalyseHardware').style.display = (aValue[3] != '') ? "list-item" : "none";
if (aValue[3] != '')
{
document.getElementById('prixAnalyseHardware').innerHTML = aValue[3];
}
document.getElementById('liPrixRecupHardware').style.visibility = (aValue[4] != '') ? "visible" : "hidden";
document.getElementById('liPrixRecupHardware').style.display = (aValue[4] != '') ? "list-item" : "none";
if (aValue[4] != '')
{
document.getElementById('prixRecupHardware').innerHTML = aValue[4];
}
if (aValue[1] == '' && aValue[3] == '')
{
document.getElementById('liPrixAnalyseImporte').style.visibility = "hidden";
document.getElementById('liPrixAnalyseImporte').style.display = "none";
}
else
{
document.getElementById('liPrixAnalyseImporte').style.visibility = "visible";
document.getElementById('liPrixAnalyseImporte').style.display = "list-item";
if (aValue[1] == aValue[3])
{
document.getElementById('prixAnalyseImporte').innerHTML = aValue[1];
}
else
{
document.getElementById('prixAnalyseImporte').innerHTML = aValue[1] + " / " + aValue[3];
}
}
if (aValue[2] == '' && aValue[4] == '')
{
document.getElementById('liPrixRecupImporte').style.visibility = "hidden";
document.getElementById('liPrixRecupImporte').style.display = "none";
}
else
{
document.getElementById('liPrixRecupImporte').style.visibility = "visible";
document.getElementById('liPrixRecupImporte').style.display = "list-item";
if (aValue[2] == aValue[4])
{
document.getElementById('prixRecupImporte').innerHTML = aValue[2];
}
else
{
document.getElementById('prixRecupImporte').innerHTML = aValue[2] + " / " + aValue[4];
}
}
if (aValue[0] == 'hard')
{
document.getElementById('recommLogiciel').style.visibility = "hidden";
document.getElementById('recommHardware').style.visibility = "visible";
document.getElementById('recommImporte').style.visibility = "visible";
}
else if (aValue[0] == 'soft')
{
document.getElementById('recommLogiciel').style.visibility = "visible";
document.getElementById('recommHardware').style.visibility = "hidden";
document.getElementById('recommImporte').style.visibility = "visible";
}
else
{
document.getElementById('recommLogiciel').style.visibility = "hidden";
document.getElementById('recommHardware').style.visibility = "hidden";
document.getElementById('recommImporte').style.visibility = "visible";
}
//document.getElementById('prixAnalyseLogiciel').InnerHtml="asdas";
//document.getElementById('prixAnalyseLogiciel').style.border = "inset red 4px";
//Alert(document.getElementById('prixAnalyseLogiciel').style.border);
//document.getElementById('prixAnalyseLogiciel').InnerHtml = 'a';
//alert(xhr.responseText);
}
*/
}
function ajaxCapacite()
{
var xhr=null;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
//on définit l'appel de la fonction au retour serveur
xhr.onreadystatechange = function() { ajaxCapaciteTraitement(xhr); };
//on appelle le fichier reponse.txt
xhr.open("POST", "../action/form_capacite.php", true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send('type=' + document.getElementById('formTypeSupport').options[document.getElementById('formTypeSupport').selectedIndex].value);
}
function ajaxCapaciteTraitement(xhr)
{
if (xhr.readyState==4)
{
traitAddOption(xhr.responseText,'formCapacite');
}
}
function traitAddOption (aValue, aSelect) {
document.getElementById(aSelect).innerHTML = '';
document.getElementById(aSelect).length = 0;
if (aValue != "")
{
var ligne;
aValue = aValue.split(";");
for (var ind=0;ind < aValue.length-1;ind++)
{
ligne = aValue[ind].split(":");
document.getElementById(aSelect).options[ind] = new Option(ligne[1],ligne[0]);
}
document.getElementById(aSelect).selectedIndex = 0;
}
ajaxPrix();
}
function resetStyleType()
{
resetStyleText (document.getElementById('lblformType_Analyse'));
resetStyleText (document.getElementById('lblformType_Importe'));
resetStyleText (document.getElementById('lblformType_Hardware'));
resetStyleText (document.getElementById('lblformType_Logiciel'));
}
function focusOptionnel(aChamps,aValeur)
{
if(aChamps.value == aValeur)
{
aChamps.value = '';
aChamps.className = '';
}
}
function blurOptionnel(aChamps,aValeur)
{
if(aChamps.value == '')
{
aChamps.value = aValeur;
aChamps.className = 'inputOptionel';
}
}