function mpPreloadImage(pstrImage)
{
	var objImage = new Image(); 
	objImage.src = pstrImage;
}

function fgInitPage()
{
		mgChargerMenu();
		
		mpPreloadImage('image/message/message_bande_x.jpg');
		mpPreloadImage('image/fleche_g_on.gif');
		mpPreloadImage('image/fleche_g_off.gif');
		mpPreloadImage('image/fleche_d_on.gif');
		mpPreloadImage('image/fleche_d_off.gif');
		mpPreloadImage('image/fr/onglet/catalogue_on.jpg');
		mpPreloadImage('image/fr/onglet/extraits_audio_on.jpg');
		mpPreloadImage('image/fr/onglet/nouveautes_on.jpg');
		mpPreloadImage('image/recherche/recherche.gif');
		mpPreloadImage('image/' + gstrLangue + '/onglet/top.jpg');
		
		fgAfficheOnglet('0', 'true');
		fgAfficheOngletTop();
		fgAfficheLogin();
		fgAffichePanier();
		fgAfficheAccueil('1');
}

function mpAjouterPanier(pstrNoProduit, pstrSpecial, pstrPrix)
{
	gstrNoProduit = pstrNoProduit;
	gstrSpecial = pstrSpecial;
	gstrPrix = pstrPrix;
	if (fgblnVerifLogin() == true)
	{
		mgAfficheMessage(28, CONST_MESSAGE_QUEST_OUI_NON, "pstrParam1::" + document.all[gstrNoProduit + 'Titre'].innerText, "mgAjouterItem")
	}
}

function mpSupprimerPanier(pstrNoProduit)
{
	if (divMenuProduit.style.visibility == "visible") {
		if (window.event != null)
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		return;
	}
	gstrNoProduit = pstrNoProduit;
	mgAfficheMessage(31, CONST_MESSAGE_QUEST_OUI_NON, "pstrParam1::" + document.all[gstrNoProduit + 'Titre'].innerText, "mgSupprimerItem")
}

function mpGenerateLecteur(pstrNoProduit, pstrFile, pstrDuree, pstrMP3)
{
		gstrNoProduit = pstrNoProduit;
		gstrTitre = document.all[gstrNoProduit + 'Titre'].innerText;
		gstrDuree = pstrDuree;
		gstrMP3 = pstrMP3;
		
		if (fgblnVerifLogin() == true)
		{
			fgObtTraitement("Content/Gestion/CreerMP3.asp?NO_PRODUIT=" + gstrMP3, divContenu, false);
			fgObtTraitement("Content/Gestion/EnregistrerMP3.asp", divContenu, false);
			
			Player.src = pstrFile;
			Player.beginElement();

		}
}

function mpCopierInfoFacturation()
{
	if (chkInfo.checked == true)
	{
		chkPick.disabled = true;
		txtNomLivraison.value = txtNomFacturation.value;
		txtAdresseLivraison.value = txtAdresseFacturation.value;
		txtVilleLivraison.value = txtVilleFacturation.value;
		txtCodePostalLivraison.value = txtCodePostalFacturation.value;
		txtTelephoneJourLivraison.value = txtTelephoneJourFacturation.value;
		txtTelephoneSoirLivraison.value = txtTelephoneSoirFacturation.value;
		txtPaysLivraison.value = txtPaysFacturation.value;
		
		txtProvinceLivraison.value = txtProvinceFacturation.value;
	
		txtNomLivraison.disabled=true;
		txtAdresseLivraison.disabled=true;
		txtVilleLivraison.disabled=true;
		txtCodePostalLivraison.disabled=true;
		txtTelephoneJourLivraison.disabled=true;
		txtTelephoneSoirLivraison.disabled=true;
		txtPaysLivraison.disabled=true;
		txtProvinceLivraison.disabled=true;
		
	}else{
	
		chkPick.disabled = false;
		txtNomLivraison.value = '';
		txtAdresseLivraison.value = '';
		txtVilleLivraison.value = '';
		txtCodePostalLivraison.value = '';
		txtTelephoneJourLivraison.value = '';
		txtTelephoneSoirLivraison.value = '';
		txtPaysLivraison.value = '';
		txtProvinceLivraison.value = '';
		
		txtNomLivraison.disabled=false;
		txtAdresseLivraison.disabled=false;
		txtVilleLivraison.disabled=false;
		txtCodePostalLivraison.disabled=false;
		txtTelephoneJourLivraison.disabled=false;
		txtTelephoneSoirLivraison.disabled=false;
		txtPaysLivraison.disabled=false;
		txtProvinceLivraison.disabled=true;
	}
}

function mpPickUpFacturation()
{
	if (chkPick.checked == true)
	{
		chkInfo.disabled = true;
		txtNomLivraison.value = '';
		txtAdresseLivraison.value = '';
		txtVilleLivraison.value = '';
		txtCodePostalLivraison.value = '';
		txtTelephoneJourLivraison.value = '';
		txtTelephoneSoirLivraison.value = '';
		txtPaysLivraison.value = '';
		txtProvinceLivraison.value = '';
	
		txtNomLivraison.disabled=true;
		txtAdresseLivraison.disabled=true;
		txtVilleLivraison.disabled=true;
		txtCodePostalLivraison.disabled=true;
		txtTelephoneJourLivraison.disabled=true;
		txtTelephoneSoirLivraison.disabled=true;
		txtPaysLivraison.disabled=true;
		txtProvinceLivraison.disabled=true;
	}else{
	
		chkInfo.disabled = false;
		txtNomLivraison.disabled=false;
		txtAdresseLivraison.disabled=false;
		txtVilleLivraison.disabled=false;
		txtCodePostalLivraison.disabled=false;
		txtTelephoneJourLivraison.disabled=false;
		txtTelephoneSoirLivraison.disabled=false;
		txtPaysLivraison.disabled=false;
		txtProvinceLivraison.disabled=true;
	}
}

function mpVerifModedePaiement()
{
	txtNumeroCarteCredit.value = "";
	txtExpirationCarteCredit.value ="";
	
	if (optModePaiement[0].checked)
	{
		txtNumeroCarteCredit.style.backgroundColor='white';
		txtExpirationCarteCredit.style.backgroundColor='white';
		txtExpirationCarteCredit.disabled = false;
		txtNumeroCarteCredit.disabled = false;
		tdImageCarteCredit.innerHTML = '<img border="0" src="Image/panier/mastercard.gif">';
	}else if (optModePaiement[1].checked)
	{
		txtNumeroCarteCredit.style.backgroundColor='white';
		txtExpirationCarteCredit.style.backgroundColor='white';
		txtExpirationCarteCredit.disabled = false;
		txtNumeroCarteCredit.disabled = false;
		tdImageCarteCredit.innerHTML = '<img border="0" src="Image/panier/visa.gif">';
	}else{
		txtNumeroCarteCredit.style.backgroundColor='#ECECEC';
		txtExpirationCarteCredit.style.backgroundColor='#ECECEC';
		txtExpirationCarteCredit.disabled = true;
		txtNumeroCarteCredit.disabled = true;
		tdImageCarteCredit.innerHTML = '';
	}
}

function mpAfficheOngletAdmin()
{
	var strHTML = '';
	var objXMLNodeInfo = gXMLMusiClub.getElementsByTagName("LOGIN");
	if (objXMLNodeInfo.length > 0)
	{
		if (objXMLNodeInfo.item(0).getAttribute("ADMIN") == "-1")
		{	
			strHTML = '<Img Src="image/' + gstrLangue + '/onglet/top.jpg" UseMap="#map1" Border="0">';
			strHTML = strHTML + '<Map Name="map1">';
			strHTML = strHTML + '<Area Shape=Rect Coords="65,8,118,22" onclick="mgChangerMode(CONST_MODE_SPECIAUX);">';
			strHTML = strHTML + '<Area Shape=Rect Coords="14,8,61,22" onclick="mgChangerMode(CONST_MODE_ACCUEIL);">';
			strHTML = strHTML + '<Area Shape=Rect Coords="122,8,178,22" onclick="mgChangerMode(CONST_MODE_SELECTIONS);">';
			strHTML = strHTML + '<Area Shape=Rect Coords="182,8,244,22" onclick="mgChangerMode(CONST_MODE_MISEJOUR);">';
			strHTML = strHTML + '<Area Shape=Rect Coords="248,8,301,22" onclick="mgChangerMode(CONST_MODE_COURRIEL);">';
			strHTML = strHTML + '</Map>';
			tdAdmin.style.cursor="hand";
			tdAdmin.innerHTML = strHTML;
		} else {
			tdAdmin.innerHTML = '<img src="image/' + gstrLangue + '/onglet/bande_droite.gif">';
		}
	} else {
		tdAdmin.innerHTML = '<img src="image/' + gstrLangue + '/onglet/bande_droite.gif">';
	}
}

function mpOnChangeCopieInfo(pobjObject)
{
	if (chkInfo.checked == true)
	{
		var strObjectName = new String(pobjObject.name);
		var re = /Facturation/g;
        strObjectName = strObjectName.replace(re, "Livraison");
        
        document.all[strObjectName].value = pobjObject.value;
        if (strObjectName == "cboPaysLivraison")
        {
			document.all[strObjectName].onchange();
        }
	}
}

function mpValideInfoCommande()
{
	var re = / /g;
	
	var strValeur = txtNomFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtNomFacturation.value = "";
		mgAfficheMessage(42, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtAdresseFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtAdresseFacturation.value = "";
		mgAfficheMessage(43, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtVilleFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtVilleFacturation.value = "";
		mgAfficheMessage(44, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtPaysFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtPaysFacturation.value = ""
		mgAfficheMessage(45, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtProvinceFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtProvinceFacturation.value = "";
		mgAfficheMessage(46, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtCodePostalFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtCodePostalFacturation.value = "";
		mgAfficheMessage(48, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtTelephoneJourFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtTelephoneJourFacturation.value = "";
		mgAfficheMessage(49, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	var strValeur = txtTelephoneSoirFacturation.value;
	strValeur = strValeur.replace(re, "");
	if(strValeur == "")
	{
		txtTelephoneSoirFacturation.value = "";
		mgAfficheMessage(50, CONST_MESSAGE_INFO, '', '');
		return;
	}
	
	if (chkInfo.checked != true && chkPick.checked != true)
	{
		var strValeur = txtNomLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtNomLivraison.value = "";
			mgAfficheMessage(51, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtAdresseLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtAdresseLivraison.value = "";
			mgAfficheMessage(52, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtVilleLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtVilleLivraison.value = "";
			mgAfficheMessage(53, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtPaysLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtPaysLivraison.value = "";
			mgAfficheMessage(54, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtProvinceLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtProvinceLivraison.value = "";
			mgAfficheMessage(55, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtCodePostalLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtCodePostalLivraison.value = "";
			mgAfficheMessage(57, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtTelephoneJourLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtTelephoneJourLivraison.value = "";
			mgAfficheMessage(58, CONST_MESSAGE_INFO, '', '');
			return;
		}
	
		var strValeur = txtTelephoneSoirLivraison.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtTelephoneSoirLivraison.value = "";
			mgAfficheMessage(59, CONST_MESSAGE_INFO, '', '');
			return;
		}
	}
	
	if (!optModePaiement[2].checked)
	{
		var strValeur = txtNumeroCarteCredit.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtNumeroCarteCredit.value = "";
			mgAfficheMessage(60, CONST_MESSAGE_INFO, '', '');
			return;
		} else {
			re = /-/g;
			strValeur = strValeur.replace(re, "");
			if (strValeur.length != 16)
			{
				txtNumeroCarteCredit.value = "";
				mgAfficheMessage(62, CONST_MESSAGE_INFO, '', '');
				return;
			} else {
				txtNumeroCarteCredit.value = strValeur.substr(0,4) + "-" + strValeur.substr(4,4) + "-" + strValeur.substr(8,4) + "-" + strValeur.substr(12,4);
			}
		}
		
		var strValeur = txtExpirationCarteCredit.value;
		strValeur = strValeur.replace(re, "");
		if(strValeur == "")
		{
			txtExpirationCarteCredit.value = "";
			mgAfficheMessage(61, CONST_MESSAGE_INFO, '', '');
			return;
		} else {
			strValeur = strValeur.replace("/", "");
	
			if (strValeur != "")
			{
				if (strValeur.length != 4)
				{
					txtExpirationCarteCredit.value = "";
					mgAfficheMessage(63, CONST_MESSAGE_INFO, '', '');
					return;
				} else {
					if (parseFloat(strValeur.substr(0,2)) > 12)
					{
						txtExpirationCarteCredit.value = "";
						mgAfficheMessage(63, CONST_MESSAGE_INFO, '', '');
						return;
					} else {
						txtExpirationCarteCredit.value = strValeur.substr(0,2) + '/' + strValeur.substr(2,2);
					}
				}
			}
		}
	}
	
	fgAjoutInfoFacture();
}

function mpValideNumeroCarte()
{
	var re = /-/g;
	var strValeur = txtNumeroCarteCredit.value;
	strValeur = strValeur.replace(re, "");
	re = / /g;
	strValeur = strValeur.replace(re, "");
	
	if (strValeur != "")
	{
		if (strValeur.length != 16)
		{
			txtNumeroCarteCredit.value = "";
			mgAfficheMessage(62, CONST_MESSAGE_INFO, '', '');
			return;
		} else {
			txtNumeroCarteCredit.value = strValeur.substr(0,4) + "-" + strValeur.substr(4,4) + "-" + strValeur.substr(8,4) + "-" + strValeur.substr(12,4);
		}
	}
}

function fgVerifKeyPressNumeroCarte(pobjTextBox)
{
	if (gblnMessage == true) {
		if (window.event != null)
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		return;
	}
	
	var strValeur = String.fromCharCode(window.event.keyCode);
	if(window.event.keyCode != 45) 
	{
		if (isNaN(strValeur))
		{
			if (window.event != null)
			{
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			return;
		}
	}
}


function fgVerifKeyPressExpirationCarte(pobjTextBox)
{
	if (gblnMessage == true) {
		if (window.event != null)
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		return;
	}
	
	var strValeur = String.fromCharCode(window.event.keyCode);
	if(window.event.keyCode != 47) 
	{
		if (isNaN(strValeur))
		{
			if (window.event != null)
			{
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			return;
		}
	}
}

function mpValideExpirationCarte()
{
	var re = / /g;
	var strValeur = txtExpirationCarteCredit.value;
	strValeur = strValeur.replace(re, "");
	strValeur = strValeur.replace("/", "");
	
	if (strValeur != "")
	{
		if (strValeur.length != 4)
		{
			txtExpirationCarteCredit.value = "";
			mgAfficheMessage(63, CONST_MESSAGE_INFO, '', '');
			return;
		} else {
			if (parseFloat(strValeur.substr(0,2)) > 12)
			{
				txtExpirationCarteCredit.value = "";
				mgAfficheMessage(63, CONST_MESSAGE_INFO, '', '');
				return;
			} else {
				txtExpirationCarteCredit.value = strValeur.substr(0,2) + '/' + strValeur.substr(2,2);
			}
		}
	}
}

function fgVerifKeyPressTelephone(pobjTextBox)
{
	if (gblnMessage == true) {
		if (window.event != null)
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		return;
	}
	
	var strValeur = String.fromCharCode(window.event.keyCode);
	if(window.event.keyCode != 45 && window.event.keyCode != 40 && window.event.keyCode != 41) 
	{
		if (isNaN(strValeur))
		{
			if (window.event != null)
			{
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			return;
		}
	}
}

function mpGererChampSpeciaux(pobjchkSpeciaux, pobjtxtQte, pobjtxtEsc)
{
	if (pobjchkSpeciaux.checked == true)
	{
		pobjtxtQte.disabled = false;
		pobjtxtEsc.disabled = false;
	} else {
		pobjtxtQte.disabled = true;
		pobjtxtEsc.disabled = true;
		pobjtxtQte.value = "0";
		pobjtxtEsc.value = "0";
	}
}

function mpGererLigneFournisseur(pobjLigneFournisseur, pstrIDFournisseur, pblnMauve)
{
	if (gstrIDFournisseur != "")
	{
		if (gblnMauve == true)
		{
			document.all(gstrIDFournisseur).style.backgroundColor = "#FEFFB3";
		} else {
			document.all(gstrIDFournisseur).style.backgroundColor = "white";
		}
	}
	
	if (gstrIDFournisseur == pstrIDFournisseur)
	{
		gstrIDFournisseur = "";
		gblnMauve = false;
	} else {
		pobjLigneFournisseur.style.backgroundColor = "#F0E6F2";
		gstrIDFournisseur = pstrIDFournisseur;
		gblnMauve = pblnMauve;
	}
	
}

function mpGererBoutonFournisseur(pstrIDBouton)
{
	switch(pstrIDBouton)
	{
		case "0":
			gblnCopieInfo = true;
			gstrCopie = "0";
			gstrAction = "0";
			mgAfficheMessage(77, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseFournisseur');
			break;
			
		case "1":
			if (gstrIDFournisseur == "")
			{
				mgAfficheMessage(76, CONST_MESSAGE_INFO, '', '');
			} else {
				gblnCopieInfo = true;
				gstrCopie = "0";
				gstrAction = "1";
				gstrNomFournisseur = document.all('Nom' + gstrIDFournisseur).innerText;
				gstrDureeFournisseur = document.all('Duree' + gstrIDFournisseur).innerText;
				
				if (document.all('Acces' + gstrIDFournisseur).checked == true)
				{
					gstrAccesFournisseur = "1";
				} else {
					gstrAccesFournisseur = "0";
				}
				gstrNomFournisseur = document.all('Nom' + gstrIDFournisseur).innerText;
				mgAfficheMessage(78, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseFournisseur');
			}
			break;
			
		case "2":
			if (gstrIDFournisseur == "")
			{
				mgAfficheMessage(76, CONST_MESSAGE_INFO, '', '');
			} else {
				fgObtTraitement('Content/Gestion/EnregistrerFour.asp?ACTION=2&ID=' + gstrIDFournisseur, divContenu, false);
				gstrIDFournisseur = ''; 
				gblnMauve = false; 
				fgObtTraitement('Content/Gestion/Fournisseur.asp', divContenu, false);
			}
			break;
	}
}

function mpGererReponseFournisseur(pintReponse)
{
	if (pintReponse == 0)
	{
		fgObtTraitement('Content/Gestion/EnregistrerFour.asp?DUREE='+ gstrDureeFournisseur + '&ACCES='+ gstrAccesFournisseur + '&NOM='+  gstrNomFournisseur + '&ACTION=' + gstrAction + '&ID=' + gstrIDFournisseur, divContenu, false);
		gstrCopie = "";
		gblnCopieInfo = false;
		gstrNomFournisseur = "";
		gstrAccesFournisseur = "";
		gstrDureeFournisseur = "";
		gstrAction = "";
		gstrIDFournisseur = ''; 
		gblnMauve = false; 
		fgObtTraitement('Content/Gestion/Fournisseur.asp', divContenu, false);
	} else {
		gstrCopie = "";
		gblnCopieInfo = false;
		gstrNomFournisseur = "";
		gstrAccesFournisseur = "";
		gstrDureeFournisseur = "";
		gstrAction = "";
		gstrIDFournisseur = ''; 
		gblnMauve = false; 
		fgObtTraitement('Content/Gestion/Fournisseur.asp', divContenu, false);
	}
}

function mpCopieInfo()
{
	switch (gstrCopie)
	{
		//Fournisseur
		case "0":
			gstrNomFournisseur = document.all('NomFournisseur').value;
			gstrDureeFournisseur = document.all('DureeFournisseur').value;
			gstrIDFournisseur = document.all('IDFournisseur').value;
			gstrAccesFournisseur = document.all('AccesFournisseur').value;
			break;
			
		//Profil
		case "1":
			gstrNomProfil = document.all('NomProfil').value;
			gstrPrenomProfil = document.all('PrenomProfil').value;
			gstrUserProfil = document.all('IDProfil').value;
			gstrAdminProfil = document.all('AdminProfil').value;
			gstrMP3Profil =  document.all('MP3Profil').value;
			gstrCourrielProfil = document.all('CourrielProfil').value;
			gstrPasswordProfil = document.all('PasswordProfil').value;
			gstrJoursProfil = document.all('JoursProfil').value;
			break;
			
		//Courriel
		case "2":
			gstrObjetCourriel = document.all('ObjetCourriel').value;
			gstrMessageCourriel = document.all('MessageCourriel').value;
			break;
			
		//Courriel
		case "3":
			gstrDateDe = document.all('DateDe').value;
			gstrDateA = document.all('DateA').value;
			break;
			
		//Courriel WebMaster
		case "4":
			gstrObjetCourriel = document.all('ObjetCourriel').value;
			gstrMessageCourriel = document.all('MessageCourriel').value;
			gstrCourrielUtil = document.all('CourrielUtil').value;
			break;
			
	}
}

function fgVerifKeyPressNumeric(pobjTextBox)
{
	
	var strValeur = String.fromCharCode(window.event.keyCode);
	if (isNaN(strValeur))
	{
		if (window.event != null)
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		return;
	} else {
		if (window.event.keyCode == 32)
		{
			if (window.event != null)
			{
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			return;
		}
	}
}

function fgOnChangeAcces(pobjTextBox)
{
	if (pobjTextBox.value != "0" && pobjTextBox.value != "1")
	{
		pobjTextBox.value = "0";
		document.all('DureeFournisseur').value = "0";
		document.all('DureeFournisseur').disabled = true;
	} else {
		if (pobjTextBox.value == "0")
		{
			document.all('DureeFournisseur').value = "0";
			document.all('DureeFournisseur').disabled = true;
		} else {
			document.all('DureeFournisseur').value = "0";
			document.all('DureeFournisseur').disabled = false;
		}
	}
}

function mpGererLigneProfil(pobjLigneProfil, pstrIDProfil, pblnMauve)
{
	if (gstrIDProfil != "")
	{
		if (gblnMauve == true)
		{
			document.all(gstrIDProfil).style.backgroundColor = "#FEFFB3";
		} else {
			document.all(gstrIDProfil).style.backgroundColor = "white";
		}
	}
	
	if (gstrIDProfil == pstrIDProfil)
	{
		gstrIDProfil = "";
		gblnMauve = false;
	} else {
		pobjLigneProfil.style.backgroundColor = "#F0E6F2";
		gstrIDProfil = pstrIDProfil;
		gblnMauve = pblnMauve;
	}
	
}

function mpGererBoutonProfil(pstrIDBouton)
{
	switch(pstrIDBouton)
	{
		//Envoyer Courriel
		case "0":
			if (gstrIDProfil == "")
			{
				mgAfficheMessage(84, CONST_MESSAGE_INFO, '', '');
			} else {
				gblnCopieInfo = true;
				gstrCopie = "2";
				gstrCourrielProfil = document.all('Courriel' + gstrIDProfil).value;
				gstrUserProfil = document.all('ID' + gstrIDProfil).value;
				gstrPasswordProfil = document.all('Password' + gstrIDProfil).value;
				gstrNomProfil = document.all('Nom' + gstrIDProfil).innerText;
				gstrPrenomProfil = document.all('Prenom' + gstrIDProfil).innerText;
				mgAfficheMessage(87, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseCourriel');
			}
			break;
			
		//Envoyer MP3
		case "1":
			break;
			
		//Ajouter
		case "2":
			gblnCopieInfo = true;
			gstrCopie = "1";
			gstrAction = "0";
			mgAfficheMessage(85, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseProfil');
			break;
			
		//Modifier
		case "3":
			if (gstrIDProfil == "")
			{
				mgAfficheMessage(84, CONST_MESSAGE_INFO, '', '');
			} else {
				gblnCopieInfo = true;
				gstrCopie = "1";
				gstrAction = "1";
				gstrNomProfil = document.all('Nom' + gstrIDProfil).innerText;
				gstrPrenomProfil = document.all('Prenom' + gstrIDProfil).innerText;
				gstrUserProfil = document.all('ID' + gstrIDProfil).value;
				
				if (document.all('Admin' + gstrIDProfil).checked == true)
				{
					gstrAdminProfil = "1";
				} else {
					gstrAdminProfil = "0";
				}
				
				if (document.all('MP3' + gstrIDProfil).checked == true)
				{
					gstrMP3Profil = "1";
				} else {
					gstrMP3Profil = "0";
				}
				
				gstrCourrielProfil = document.all('Courriel' + gstrIDProfil).value;
				gstrPasswordProfil = document.all('Password' + gstrIDProfil).value;
				gstrDateProfil = document.all('Date' + gstrIDProfil).value;
				gstrLoginProfil = document.all('Login' + gstrIDProfil).innerText;
				gstrNBRMP3Profil = document.all('NbrMP3' + gstrIDProfil).innerText;
				gstrJoursProfil = document.all('Jours' + gstrIDProfil).value;
				mgAfficheMessage(86, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseProfil');
			}
			break;
			
		//Supprimer
		case "4":
			if (gstrIDProfil == "")
			{
				mgAfficheMessage(84, CONST_MESSAGE_INFO, '', '');
			} else {
				gstrCopie = "";
				gstrAction = "2";
				gstrNomProfil = document.all('Nom' + gstrIDProfil).innerText;
				gstrPrenomProfil = document.all('Prenom' + gstrIDProfil).innerText;
				gstrUserProfil = document.all('ID' + gstrIDProfil).value;
				
				if (document.all('Admin' + gstrIDProfil).checked == true)
				{
					gstrAdminProfil = "1";
				} else {
					gstrAdminProfil = "0";
				}
				
				if (document.all('MP3' + gstrIDProfil).checked == true)
				{
					gstrMP3Profil = "1";
				} else {
					gstrMP3Profil = "0";
				}
				
				gstrCourrielProfil = document.all('Courriel' + gstrIDProfil).value;
				gstrPasswordProfil = document.all('Password' + gstrIDProfil).value;
				gstrDateProfil = document.all('Date' + gstrIDProfil).value;
				gstrLoginProfil = document.all('Login' + gstrIDProfil).innerText;
				gstrNBRMP3Profil = document.all('NbrMP3' + gstrIDProfil).innerText;
				gstrJoursProfil = document.all('Jours' + gstrIDProfil).value;
				
				mpGererReponseProfil(0);
				gstrIDProfil = ''; 
				gblnMauve = false; 
				fgAfficheCourriel('1', '');
			}
			break;
		
	}
}

function mpGererReponseProfil(pintReponse)
{
	if (pintReponse == 0)
	{
		fgObtTraitement('Content/Gestion/EnregistrerProfil.asp?ACTION=' + gstrAction + '&ID=' + gstrIDProfil + '&NOM=' + gstrNomProfil + '&PRENOM=' + gstrPrenomProfil + '&USER=' + gstrUserProfil + '&ADMIN=' + gstrAdminProfil + '&MP3=' + gstrMP3Profil + '&COURRIEL=' + gstrCourrielProfil + '&PASSWORD=' + gstrPasswordProfil + '&JOURS=' + gstrJoursProfil, divContenu, false);
		gstrCopie = "";
		gblnCopieInfo = false;
		gstrIDProfil = ""; 
		gstrNomProfil = "";
		gstrPrenomProfil = "";
		gstrUserProfil = "";
		gstrAdminProfil = "";
		gstrMP3Profil = "";
		gstrCourrielProfil = "";
		gstrPasswordProfil = "";
		gstrDateProfil = "";
		gstrLoginProfil = "";
		gstrNBRMP3Profil = "";
		gstrJoursProfil = "";
		gblnMauve = false; 
		if (gstrAction == '1')
		{
			gstrAction = '';
			fgAfficheCourriel(gstrPageProfil, '');
		} else {
			gstrAction = '';
			fgAfficheCourriel('1', '');
		}
		
	} else {
		gstrCopie = "";
		gblnCopieInfo = false;
		gstrAction = "";
		gstrIDProfil = ""; 
		gstrNomProfil = "";
		gstrPrenomProfil = "";
		gstrUserProfil = "";
		gstrAdminProfil = "";
		gstrMP3Profil = "";
		gstrCourrielProfil = "";
		gstrPasswordProfil = "";
		gstrDateProfil = "";
		gstrLoginProfil = "";
		gstrNBRMP3Profil = "";
		gstrJoursProfil = "";
		gblnMauve = false; 
		fgAfficheCourriel(gstrPageProfil, '');
	}
}

function fgOnChangeProfil(pobjTextBox)
{
	if (pobjTextBox.value != "0" && pobjTextBox.value != "1")
	{
		pobjTextBox.value = "0";
		return;
	}
	
	if (pobjTextBox.value == "0")
	{
		document.all('JoursProfil').value = "0";
		document.all('JoursProfil').disabled = true;
	} else {
		document.all('JoursProfil').value = "0";
		document.all('JoursProfil').disabled = false;
	}
}

function fgOnChangeAdmin(pobjTextBox)
{
	if (pobjTextBox.value != "0" && pobjTextBox.value != "1")
	{
		pobjTextBox.value = "0";
		return;
	}
}

function mpGererReponseCourriel(pintReponse)
{
	if (pintReponse == 0)
	{
		gXMLMusiClub.getElementsByTagName("MESSAGE_COURRIEL").item(0).text = gstrMessageCourriel;
		fgObtTraitement('Content/Gestion/EnvoyerCourriel.asp?OBJET=' + gstrObjetCourriel + '&COURRIEL=' + gstrCourrielProfil + '&ID=' + gstrUserProfil + '&PWD=' + gstrPasswordProfil + '&NOM=' + gstrNomProfil + '&PRENOM=' + gstrPrenomProfil, divContenu, false);
	}
	gXMLMusiClub.getElementsByTagName("MESSAGE_COURRIEL").item(0).text = "";
	gblnCopieInfo = false;
	gstrObjetCourriel = "";
	gstrMessageCourriel = "";
	gstrUserProfil = "";
	gstrPasswordProfil = "";
	gstrNomProfil = "";
	gstrPrenomProfil = "";
	gstrCopie = "";
}

function mpEnvoyerCourrielMassif()
{
	gblnCopieInfo = true;
	gstrCopie = "2";
	gstrCourrielProfil = "";
	mgAfficheMessage(87, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseCourriel');
}

function fgVerifKeyPressEnter(pintSection)
{
	switch(pintSection)
	{
		case 0:
			if (window.event.keyCode == 13)
			{
				fgRecherche(cmdRecherche.value);
			}
			break;
			
		case 1:
			if (window.event.keyCode == 13)
			{
				fpvaliderProfil(txtId.value,txtMotPasse.value);
			}
			break;
	}
	
}

function fgAfficheCourriel(pstrPage, pstrRecherche)
{
	gstrPageProfil = pstrPage;
	gstrRechercheProfil = pstrRecherche;
	gstrIDProfil = ""; 
	gstrCourrielProfil = "";
	gstrObjetCourriel = "";
	gstrMessageCourriel = "";
	gblnMauve = false;
	gblnCopieInfo = true;
	gstrCopie = "3";
	if (gblnPageProfil == false)
	{
		gstrDateDe = "";
		gstrDateA = "";
		mgAfficheMessage(88, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseCourrielDate'); 
	} else {
		fgObtTraitement("Content/Gestion/Courriel.asp?PAGE=" + gstrPageProfil + "&RECHERCHE=" + gstrRechercheProfil + "&DATEDE=" + gstrDateDe + "&DATEA=" + gstrDateA, divContenu, false);
	}
}

function mpGererReponseCourrielDate(pintReponse)
{
	if (pintReponse == 0)
	{
		fgObtTraitement("Content/Gestion/Courriel.asp?PAGE=" + gstrPageProfil + "&RECHERCHE=" + gstrRechercheProfil + "&DATEDE=" + gstrDateDe + "&DATEA=" + gstrDateA, divContenu, false);
	}
	gblnCopieInfo = false;
	gstrCopie = "";
	gstrRechercheProfil = "";
}

function mpGererReponseCourrielWebMaster(pintReponse)
{
	if (pintReponse == 0)
	{
		gXMLMusiClub.getElementsByTagName("MESSAGE_COURRIEL").item(0).text = gstrMessageCourriel;
		fgObtTraitement("Content/Gestion/EnvoyerCourriel.asp?COURRIELUTIL=" + gstrCourrielUtil + "&OBJET=" + gstrObjetCourriel + "&COURRIEL=" + gstrCourrielWebMaster, divContenu, false);
	}
	gXMLMusiClub.getElementsByTagName("MESSAGE_COURRIEL").item(0).text = "";
	gblnCopieInfo = false;
	gstrObjetCourriel = "";
	gstrMessageCourriel = "";
	gstrCourrielUtil = "";
	gstrCopie = "";
}

function mgEnvoiCourrierWebMaster()
{
	gblnCopieInfo = true;
	gstrCopie = "4";
	mgAfficheMessage(89, CONST_MESSAGE_QUEST_OK_ANNULER, '', 'mpGererReponseCourrielWebMaster');
}