///////////////////////////////////////////////////////////// WDocCouverture /////////////////////////////////////////////////////////////function changeDisplayBtnAction(){	var btnSuivantVisible = window.top.document.getElementById('divBtnAction').style.display;	if (btnSuivantVisible == 'inline')	{		window.top.document.getElementById('divBtnAction').style.display = 'none'		window.top.document.getElementById('divBtnAction').style.visibility  =  'hidden';		window.top.document.getElementById('divBtnActionWait').style.display = 'inline';		window.top.document.getElementById('divBtnActionWait').style.visibility = 'visible';	}	else	{		window.top.document.getElementById('divBtnAction').style.display = 'inline';		window.top.document.getElementById('divBtnAction').style.visibility = 'visible';		window.top.document.getElementById('divBtnActionWait').style.display = 'none';		window.top.document.getElementById('divBtnActionWait').style.visibility = 'hidden';	}}function callAgent(context, idNext){	var f = document.forms[0];	var modeType = getModeType();	var typepaiement = '';	// v\u00E9rification des champs obligatoires	changeDisplayBtnAction();	var btnSuivantVisible = window.top.document.getElementById('divBtnAction').innerHTML;	var ProductInfo = window.top.document.getElementById('divProductInfo').innerHTML;	var NBLineVisible = window.top.document.getElementById('divNBLineVisible').innerHTML;	var j = 0;	var tabProdId=new Array;	var tabProdVisible=new Array;	var tabProd = ProductInfo.split('$$');	var prodLine = '';	if (modeType)	{		if (f.TypePaiement1.checked)			typepaiement = '1';		if (f.TypePaiement2.checked)			typepaiement = '2';		if (f.TypePaiement3.checked)			typepaiement = '3';		if (f.TypePaiement4.checked)			typepaiement = '4';	}		for (k=0; k<tabProd.length; k++)	{		if (k < 10)   		{   			// Le num\u00E9ro de la ligne (01, 02, ...)   			tabProdId[k] = '0' + (k);   		}   		else   	  		tabProdId[k] = k;		if (tabProd[k] != '\u00A3\u00A3\u00A3')   		{   			// Nous dit si la couverture est visible ou pas (true ou false)   			tabProdVisible[k] = true;   		}   		else   			tabProdVisible[k] = false;	}	var indice = '';	var k = 1;	var countChecked = 0;	var isCheck = false;	var tmp='';	// 	boucle de cr\u00E9ation de la cha\u00EEne prodLine	while ((isCheck == false) && (k < tabProd.length - 1))	{		if (k < 10)			indice = '0' + k;		else			indice = k;		// Le tableau des couvertures affich\u00E9es !!		// on va les parcourir pour r\u00E9cup\u00E9rer, si existantes		// les valeurs du check, franchise, capital, montant...		if(tabProdVisible[k])		{			// La ligne qui nous donne les informations sur			// ce qu'il y a d'affich\u00E9 sur la ligne (franchise, capital, montant, d\u00E9lai...)			var tmp4 = window.top.document.getElementById('divLineInfo'+tabProdId[k]).innerHTML;			var tabLine = tmp4.split('$$');			isCheck = false;			isAccCheck = false;			isLineCheck = false;			if (chkObject(tabLine[3]+indice))			{				if (f.elements[tabLine[3]+indice].checked)					isLineCheck = true;			}			if (chkObject(tabLine[5]+indice))			{				// il y a une case accident				// si la case accident est coch\u00E9e on passe isAccCheck \u00E0 true				if (!chkObject(tabLine[3]+indice))				{					if (f.elements[tabLine[5]+indice].checked)						isAccCheck = true;				}			}			if((chkObject(tabLine[3]+indice)) || (isAccCheck))			{				if ((isLineCheck) || (isAccCheck))				{					// Cr\u00E9ation du tableau des objets de chaque ligne					// Cette ligne contient toutes les informations					prodLine = prodLine + '?' + getProdLine(tabLine, indice);					countChecked = countChecked + 1				}			}		}		k = k  + 1;	}	if (modeType)	{				if (f.PWidProd.value != 'Vide')		{			var pwtype = f.PWType.value;			var pwamount = f.PWAmount.value;			var pwindem = f.PWIndem.value;			var pwdelai = f.PWDelai.value;			var pwfrais = f.PWFrais.value;			var pwtypetxt = f.PWTypeTxt.value;			var pwindemtxt = f.PWIndemTxt.value;			var pwdelaitxt = f.PWDelaiTxt.value;			var pwfraistxt = f.PWFraisTxt.value;			var pwinvalid = f.PWInvalid.value;			var pwalloc = f.PWAlloc.value;			var pw10 = window.document.getElementById("divPrimePW10").innerHTML;			var pw20 = window.document.getElementById("divPrimePW20").innerHTML;			var pw30 = window.document.getElementById("divPrimePW30").innerHTML;			var pw40 = window.document.getElementById("divPrimePW40").innerHTML;			var pw50 = window.document.getElementById("divPrimePW50").innerHTML;		}	}		if (globalFields.NextYearBaremCurrentYear == 'Oui')	{		syear = globalFields.WorkYearCurrent;		var syearTmp = globalFields.yearLAMalStartDate;		if (syearTmp != syear)			appPhraseNextYear();	}	var uniqueid = f.dUniqueID.value;	if (context != '4')	{		var saveDoc = true;		if ((context == '3' || context == '6') & !modeType)			saveDoc = false;	}	else		var saveDoc = false;	if (saveDoc)	{		//var sep = escape("\u00A7");		var sep = escape("~");		NBLineVisible = NBLineVisible.replace(/\$\$/g,"||");			var srcVal = f.BaseCourante.value + '/WCalculationOrValidation?OpenAgent&' + f.dLanguage.value + sep + prodLine + sep + countChecked + sep + context + sep + NBLineVisible + sep + uniqueid + sep + modeType + sep + typepaiement + sep + f.PWidProd.value + sep + pwtype + sep + pwamount + sep + pwindem + sep + pwdelai + sep + pwfrais + sep + pwtypetxt + sep + pwindemtxt + sep + pwdelaitxt + sep + pwfraistxt + sep + pwinvalid + sep + pwalloc + sep + pw10 + sep + pw20 + sep + pw30 + sep + pw40 + sep + pw50;		//alert(srcVal);		new Ajax.Request(srcVal, {			method: 'get',					onSuccess: function ajax_response(transport) {				//alert(transport.responseText);				transport.responseText.evalScripts();							changeDisplayBtnAction();									if (context == '1')					displayNextMember(0);				if (context == '5')					displayNextMember(0);				if (context == '3')				{					if (idNext == null)						displayCurrentPageReadMode();					else						displayNextMember(idNext);				}				if (context == '6')					displayNextPage();										}  		});	}	else	{		changeDisplayBtnAction();		if (context == '3')		{			if (idNext == null)				displayCurrentPageReadMode();			else				displayNextMember(idNext);		}		if (context == '4' || context == '6')			displayNextPage();	}}function displayNextMember(opt){	var f =  document.forms[0];	if (opt==0)	{		// Affichage membre suivant en \u00E9dition		window.location.href=f.BaseCourante.value +"/hvOffresByUniqueID/"+ window.top.document.getElementById('divIDNext').innerHTML + "?EditDocument&S=WDocCouverture&L=" + f.dLanguage.value;	}	else if (opt==1)	{		// En cas d'effacement		window.location.href=f.BaseCourante.value +"/hvOffresByUniqueID/"+ window.top.document.getElementById('divIDNext').innerHTML + "?OpenDocument&S=WDocCouverture&L=" + f.dLanguage.value + "&SaisieOK=true";	}	else	{		window.location.href=f.BaseCourante.value +"/hvOffresByUniqueID/"+ opt + "?EditDocument&S=WDocCouverture" + "&Version=" + f.dPageVersion.value + "&L=" + f.dLanguage.value;	}}function displayCurrentPageReadMode(){	var f =  document.forms[0];	if (f.dUniqueID.value == '')		displayNextPage();		else	{		window.location.href=f.BaseCourante.value + "/hvOffresByUniqueID/"+ f.dUniqueID.value + "?OpenDocument&S=WDocCouverture" + "&Version=" + f.dPageVersion.value + "&L=" + f.dLanguage.value + "&SaisieOK=true";	}}function displayNextPage(){	var f =  document.forms[0];			// Si il y a un seul membre, on n'affiche pas la page WDocRecapGenral 	if (f.dFamilleNBPersTotal.value == "1") 	{	  		if( f.dDisplayPosteOnly.value == "Non")				window.location.href=f.BaseCourante.value + "/WebOffre?OpenForm&S=WDocRemerciements&FamilleChef=" + f.dFamilleChefUniqueID.value + "&L=" + f.dLanguage.value;		else				window.location.href=f.BaseCourante.value + "/WebOffre?OpenForm&S=WDocRemerciements&Special=Poste&FamilleChef=" + f.dFamilleChefUniqueID.value + "&L=" + f.dLanguage.value;	}	else		window.location.href=f.BaseCourante.value +"/WebOffre?OpenForm&S=WDocRecapGeneral&FamilleChef=" + f.dFamilleChefUniqueID.value + "&Version=" + f.dPageVersion.value + "&L=" + f.dLanguage.value;}function WDocCouvertureValidate(){	// fonction de validation de la page	// appelle WDocCouvertureValidateFields	var f = document.forms[0];	var retour = new Array(3);	retour[0] = true;	retour[1] = 0;	retour[2] = '';	var modeType = getModeType();	if (modeType == true)		retour = WDocCouvertureValidateFields(retour);	if (retour[0] == false){		writeError(retour[2], 0, f.dLanguage.value);		return false;	}	else		return true;}function PrevisiaPlusLookup(idProd){	// on supprime le close.gif de la fen\u00EAtre	// parce que la fonction closeIt donne un effet de bord	// il faut fermer avec l'action "Fermer" sp\u00E9cialement pour la Previsia Plus	var f =  document.forms[0];	sLanguage = f.dLanguage.value;	var sex = f.Sex.value;	f.PWidProd.value = idProd;	var f = document.forms[0];	if (!f.elements['Check'+idProd].checked)	{		window.top.document.getElementById('div' + idProd + 'Detail').style.display  =  'none';		window.top.document.getElementById('divPrime' + idProd + '').innerHTML = '0.00';		callAgent('0');		return true;	}	if (globalFields.NextYearBaremCurrentYear == 'Oui')			syear = globalFields.WorkYearCurrent;	else	{		var syear = globalFields.yearLAMalStartDate;	}	var sage = f.dAgePourCalcul.value;	loadDojoDialog("<iframe src=\"" + f.BaseCourante.value + "/WebChoixPrevisiaPlus?OpenForm&" + syear + ';' + sage + ';' + sex + ';' + idProd + ';' + '&L=' + sLanguage + "\" frameborder=0 style=\"width:530; height:380; border: 1px solid #7BAACE;\"></iframe>", "PREVISIA PLUS", true, true);}function fCheck(idProd, group, typeControl, unCheckLine, jsFunctionCall){	if (jsFunctionCall != 'Vide')	{		eval(jsFunctionCall, typeControl, idProd);		return true;	}	var f = document.forms[0];	var writePub = false;	var isChild = getChild();	var preCheck = window.top.document.getElementById('divPreCheck'+idProd).innerHTML;	var noSpecial = false;	// Si n\u00E9cessaire on d\u00E9coche la ou les autres couvertures	// qui d\u00E9pendent de la cat\u00E9gorie courante	if(chkObject('divNecessairePour'+idProd))	{		var NecessairePour = window.top.document.getElementById('divNecessairePour'+idProd).innerHTML;		if (NecessairePour != '0')		{			var tabNecessairePour = NecessairePour.split('#');			for(var i=1;i<tabNecessairePour.length;i++)			{								if(chkObject(typeControl+tabNecessairePour[i]))				{						if (!f.elements[typeControl+idProd].checked && f.elements[typeControl+tabNecessairePour[i]].checked)						f.elements[typeControl+tabNecessairePour[i]].checked = false;					}			}		}	}	// Si n\u00E9cessaire on coche la couverture	// n\u00E9cessaire \u00E0 la cat\u00E9gorie courante (ex : Mondia + Complementa);	if(chkObject('divPossibleSi'+idProd))	{		var PossibleSi = window.top.document.getElementById('divPossibleSi'+idProd).innerHTML;		var tabPossibleSi = PossibleSi.split('#');		if (tabPossibleSi.length==2)		{			if (f.elements[typeControl+idProd].checked && !f.elements[typeControl+tabPossibleSi[1]].checked)				f.elements[typeControl+tabPossibleSi[1]].checked = true;		}	}	// Dans le cas de l'accident on v\u00E9rifie si c'est un enfant	// et auquel cas on annule sa demande de d\u00E9cochage de l'accident si on est en LAMal	if (typeControl == 'Acc')	{		if (isChild && window.top.document.getElementById('divCatLoi'+idProd).innerHTML == 'LAMal')		{			writePub = true;			f.elements[typeControl+idProd].checked = true;			preCheck = window.top.document.getElementById('divPreAcc'+idProd).innerHTML;		}		if (group == '101')		{			if(chkObject('Choix01') == true && globalFields.BasisEconomica =='Oui')			{				var writePub = f101Acc(idProd,group,typeControl);				noSpecial = true;			}		}	}	// en cas de d\u00E9cochage	if (noSpecial == false)	{		// on rentre dans cette condition seulement		// si on a pas pass\u00E9 dans la fonction f101Acc		// car c'est d\u00E9j\u00E0 g\u00E9r\u00E9 dans cette fonction		if (!f.elements[typeControl+idProd].checked )		{			// On \u00E9crira la publicit\u00E9			writePub = true;			// On vide les autres contr\u00F4les de la ligne			if (unCheckLine)				emptyAllProducts(idProd);		}		else		{			// On remplit les autres contr\u00F4les de la ligne			fullProducts(idProd, true, typeControl)		}	}	if (writePub )	{		if (preCheck != '0')		{			var pub = 'Pub';			var pos = preCheck.lastIndexOf("#");			if (pos != -1)			{				pub = pub + 'Acc';				preCheck = preCheck.substring(0,pos);			}			if (f.dAgePourCalcul.value <= 18)				pub = pub + 'Kid';			else				pub = pub + 'Adult';			// On \u00E9crit la publicit\u00E9			//writeIntoDiv(preCheck, 'DivError', 'pub' + f.dLanguage.value);		}	}	// ajout de la fonction sp\u00E9ciale Hospita 	if (group == '125') 	{		if (window.top.document.getElementById("SpecialDivInfo125") != null)		{			var ligneHospita = window.document.getElementById("SpecialDivInfo125").innerHTML;		      if (f.elements['Check01'].checked && f.elements['Check' + idProd].checked) 			{			      if (f.elements['Acc01'].checked ) 				      f.elements['Acc02'].checked = true;			      else 				      f.elements['Acc02'].checked = false;		      }		}	}	if (group == '101') 	{		if (window.top.document.getElementById("SpecialDivInfo125") != null)		{			var ligneHospita = window.document.getElementById("SpecialDivInfo125").innerHTML;			if (f.elements['Check01'].checked && f.elements['Check' + ligneHospita].checked) 			{				if (f.elements['Acc01'].checked ) 		      		f.elements['Acc02'].checked = true;	      		else 		      		f.elements['Acc02'].checked = false;	      	}		}	}	if (group == 'LCA') 	{		if (window.top.document.getElementById("SpecialDivInfo125") != null)		{			var ligneHospita = window.document.getElementById("SpecialDivInfo125").innerHTML			if (f.elements['Check01'].checked && f.elements['Check' + ligneHospita].checked) 			{			      if (f.elements['Acc01'].checked ) 				      f.elements['Acc02'].checked = true;			      else 				      f.elements['Acc02'].checked = false;		      }		}	}	callAgent('0');}	function fchangeSelect(idProd,group,typeControl, couvID){	// fonction appel\u00E9e sur le change d'un select	var f = document.forms[0];	var writePub = false;	var selValue = f.elements[typeControl+idProd].options[f.elements[typeControl+idProd].selectedIndex].value;	var selText = f.elements[typeControl+idProd].options[f.elements[typeControl+idProd].selectedIndex].text;	if (selValue == 0 || selText == '')		emptyAllProducts(idProd);	else	{		// On remplit les autres contr\u00F4les de la ligne		// Sauf dans le cas o\u00F9 on a Basis et Economica; l\u00E0 c'est g\u00E9r\u00E9 en dur		if (group == '101' && globalFields.BasisEconomica=='Oui' && (chkObject('Choix01')))		{			if (typeControl == 'Choix' && group == '101')				f101changeSelect(idProd,group,typeControl,selValue)			if (typeControl == 'Fra' && group == '101')				f101Fra(idProd,group,typeControl,selValue);		}		else			fullProducts(idProd, false, typeControl)		writePub = true;	}	if (writePub)	{		if (typeControl == 'Choix')			var opt = group + selValue;		else			var opt = group + couvID;	}	callAgent('0');}function f101Fra(idProd,group,typeControl,selValue){	// fonction sp\u00E9ciale utilis\u00E9e seulement pour la gestion	// de la Basis et de l'Economica		var f = document.forms[0];	var retourChoix = f.elements['Choix'+idProd].options[f.elements['Choix'+idProd].selectedIndex].value;	var retourFra = f.elements['Fra'+idProd].options[f.elements['Fra'+idProd].selectedIndex].value;	if (retourChoix == 0)	{		f.elements['Check'+idProd].checked = true;		if (f.dAgePourCalcul.value <= 18)		{			f.elements['Acc'+idProd].checked = true;		}		changeValues('remplir', getSpecialDivInfo('120'), '01');		f.elements['Choix'+idProd].options[1].selected = true;		f.elements['Fra'+idProd].options[retourFra].selected = true;	}	else	{		f.elements['Check'+idProd].checked = true;		if (f.elements['Choix'+idProd].options[0].selected )		{			f.elements['Choix'+idProd].options[1].selected = true;		}	}	callAgent('0');	}	function getSpecialDivInfo(idToGet){	if (chkObject('SpecialDivInfo' + idToGet) )	{				var getSpecialDivInfo = window.document.getElementById('SpecialDivInfo' + idToGet).innerHTML;		return getSpecialDivInfo;	}	return '';}		function f101Acc(idProd,group,typeControl){	// fonction sp\u00E9ciale utilis\u00E9e seulement pour la gestion	// de la Basis et de l'Economica	var f = document.forms[0];	var sLanguage = f.dLanguage.value;	var writePub = false;	var retourChoix = f.elements['Choix'+idProd].selectedIndex;	if (retourChoix == 0){		retourChoix = 1;	}	var fraDefault = window.top.document.getElementById('divFraDefault01').innerHTML;	var retourFra = f.elements['Fra'+idProd].selectedIndex;	with(window.document.forms[0])	{		if (parseInt(f.dAgePourCalcul.value) < 16)		{			// c'est un enfant - interdiction de supprimer l'accident			callAgent('0');			writePub = true;			elements['Acc'+idProd].checked = true;		}		if (elements['Acc'+idProd].checked)		{			if (retourChoix != 2)			{				// on remplit toutes les valeurs, si on est diff\u00E9rent de l'Economica						changeValues('remplir', getSpecialDivInfo('120'), '01');				// on remet un choix// modifi\u00E9 le 19.09.2007 / FM	elements['Choix'+idProd].options[1].selected = true;				elements['Choix'+idProd].options[retourChoix].selected = true;			}			else				elements['Choix'+idProd].options[2].selected = true;			// on r\u00E9affecte la franchise			elements['Fra'+idProd].options[retourFra].selected = true;			if (elements['Check'+idProd].checked != true)			{				elements['Fra'+idProd].options[fraDefault].selected = true;				elements['Check'+idProd].checked = true;			}			elements['Acc'+idProd].checked = true;		}	}			callAgent('0');	return writePub;}function checkIfChecked(objet){	// fonction qui regarde si un contr\u00F4le "check" est check\u00E9 ou pas	if(document.getElementsByName(objet)[0].checked)		return "1";	else		return "0";}function emptyFullSelect(elSel, selArrayText, selArrayValue){	// on supprime tous les \u00E9l\u00E9ments d'une ligne (capital, franchise, montant...)	for (i = elSel.length; i > 1 ; i --)		elSel.remove(elSel.length - 1);	for (k = 1; k < selArrayText.length ; k ++)	{		var elOptNew = document.createElement('option');		elOptNew.text = selArrayText[k];		elOptNew.value = selArrayValue[k];		try		{			elSel.add(elOptNew, null); // standards compliant; doesn't work in IE		}		catch(ex){			elSel.add(elOptNew); // IE only		}	}		return true;}	function chkObject(theVal) {	// recherche si un \u00E9l\u00E9ment est pr\u00E9sent sur la page	if (window.top.document.getElementById(theVal) != null)	     return true;	else		return false;}  function getChild(){	var f =  document.forms[0];		if (parseInt(f.dAgePourCalcul.value) < 16)		return true;	else		return false;}function fullProducts(idProd, opt1, typeControl){		// si opt1 = true, on remplit tous les contr\u00F4les de la ligne	// si opt1 = false, on remplit tous les contr\u00F4les de la ligne sauf le contr\u00F4le courant (typeControl)		var f = document.forms[0];		// on affecte les valeurs par d\u00E9faut; celles qui sont pr\u00E9vues		// en fonction de l'\u00E2ge de la personne et de son canton		// par exemple on met la franchise 2'000 ou 2'500...		if(chkObject('Check'+idProd) )			f.elements['Check'+idProd].checked = true;		// le produit		if(chkObject('divChoixDefault'+idProd) )			if (typeControl != 'Choix')				if (f.elements['Choix'+idProd].options[0].selected)					pushDefault(idProd, 'Choix');		// l'accident		if(chkObject('divAccDefault'+idProd) )			if (window.top.document.getElementById('divAccDefault'+idProd).innerHTML == '1')				f.elements['Acc'+idProd].checked = true;		// la franchise		if(chkObject('divFraDefault'+idProd) )			if (typeControl != 'Fra')				if (f.elements['Fra'+idProd].options[0].selected)				{					// seulement si rien de s\u00E9lectionn\u00E9; on ne change pas la franchise si d\u00E9j\u00E0 s\u00E9lectionn\u00E9e					pushDefault(idProd, 'Fra');				}		// capital		if(chkObject('divCapitalDefault'+idProd) )			if (typeControl != 'Capital')				pushDefault(idProd, 'Capital');		// d\u00E9lai		if(chkObject('divDelaiDefault'+idProd))			if (typeControl != 'Delai' && getSelected(idProd, 'Delai') == false)				pushDefault(idProd, 'Delai');		// montant		if(chkObject('divMntDefault'+idProd))			if (typeControl != 'Mnt' && getSelected(idProd, 'Mnt') == false)				pushDefault(idProd, 'Mnt');		// d\u00E9c\u00E8s		if(chkObject('divDecesDefault'+idProd) )			if (typeControl != 'Deces')				pushDefault(idProd, 'Deces');}function getSelected(idProd, objet){	// fonction qui renvoie true si une valeur	// est s\u00E9lectionn\u00E9e dans un select	// il faut que options[i].selected soit <> de 0	// \u00E0 l'utilisation, \u00E9vite de changer un select d\u00E9j\u00E0 s\u00E9lectionn\u00E9	var f = document.forms[0];	var i = 0;	var trouve = false;	while ((i < f.elements[objet+idProd].options.length) && (!trouve))	{		if (f.elements[objet+idProd].options[i].selected )			if (i != 0)				trouve = true;						i = i + 1;	}	return trouve;}function pushDefault(idProd, objet){	// fonction qui remet les valeurs par d\u00E9faut	var f = document.forms[0];	var objetDefault = window.top.document.getElementById('div' + objet + 'Default'+idProd).innerHTML;	for (var i = 0; i < f.elements[objet+idProd].options.length; i++)	 	if (objetDefault == f.elements[objet+idProd].options[i].value) 			f.elements[objet+idProd].options[i].selected = true}	function emptyAllProducts(idProd){	var f = document.forms[0];	// on d\u00E9sactive "produit", "franchise", "accident", "capital", "d\u00E9lai", "montant", "d\u00E9c\u00E8s"...	// pour autant qu'ils soient visible sur la page.	//if(chkObject('Check'+idProd) == true)	if(chkObject('Check'+idProd))		f.elements['Check'+idProd].checked = false;	// produit			if(chkObject('Choix'+idProd))		f.elements['Choix'+idProd].options[0].selected = true;	// accident	if(chkObject('Acc'+idProd))		f.elements['Acc'+idProd].checked = false;	// franchise		if(chkObject('Fra'+idProd))		f.elements['Fra'+idProd].options[0].selected = true;	// capital	if(chkObject('Capital'+idProd))		f.elements['Capital'+idProd].options[0].selected = true;	// d\u00E9lai	if(chkObject('Delai'+idProd) )		f.elements['Delai'+idProd].options[0].selected = true;	// montant	if(chkObject('Mnt'+idProd) )		f.elements['Mnt'+idProd].options[0].selected = true;	// d\u00E9c\u00E8s	if(chkObject('Deces'+idProd) )		f.elements['Deces'+idProd].options[0].selected = true;}function getModeType(){	var f =  document.forms[0];	if (f.dModeType.value == 'Edit')		return true;	else		return false}function f101changeSelect(idProd,group,typeControl,selValue,preCheck){	// fonction sp\u00E9ciale utilis\u00E9e seulement pour la gestion	// de la Basis et de l'Economica		// va modifier les franchises et les produits d'hospitalisation	var f = document.forms[0];	if (f.elements['Fra'+idProd].options[0].selected)		var appendFra = true;	else		var appendFra = false;	var preCheck = window.top.document.getElementById('divPreCheck'+idProd).innerHTML;	var fraDefault = window.top.document.getElementById('divFraDefault01').innerHTML;	var idHospitToChange = getSpecialDivInfo('120');	switch (selValue)	{		case '0':			// vide le check			f.elements['Check'+idProd].checked = false;			// on fait le changement si le champ HOChoix est existant sur la page			if (chkObject('Choix'+idHospitToChange))				changeValues('remplir', idHospitToChange, '01');			break;		case 'A':			// Basis			if (chkObject('Choix'+ idHospitToChange))				changeValues('remplir', idHospitToChange, '01');			if (appendFra == true)				f.elements['Fra'+idProd].options[fraDefault].selected = true;			f.elements['Check'+idProd].checked = true;			break;		case 'MF':			// M\u00E9d. de famille			if (chkObject('Choix'+ idHospitToChange) )				changeValues('remplir', idHospitToChange, '01');			if (appendFra == true)			f.elements['Fra'+idProd].options[fraDefault].selected = true;			f.elements['Check'+idProd].checked = true;			break;		case 'RPH':			// R\u00E9seau Pharmed			if (chkObject('Choix'+ idHospitToChange) )				changeValues('remplir', idHospitToChange, '01');			if (appendFra == true)				f.elements['Fra'+idProd].options[fraDefault].selected = true;			f.elements['Check'+idProd].checked = true;			break;						default:				// Econonica			if (chkObject('Choix'+idHospitToChange) )				changeValues('vider', idHospitToChange, '01');			if (appendFra == true)				f.elements['Fra'+idProd].options[fraDefault].selected = true;			f.elements['Check'+idProd].checked = true;			break;	}}function prepareSelectChanges(champ, opt1, idToChange){	// fonction sp\u00E9ciale utilis\u00E9e seulement pour la gestion	// de la Basis et de l'Economica		champ = champ + idToChange;	var elSel = document.getElementById(champ);	var f = document.forms[0];	if (opt1 == 'remplir')		{		if (champ != 'Fra'+idToChange) {		var selArrayText = new Array("","Priveco","Priveco Plus","Optima","Optima Plus","Ultra");		var selArrayValue = new Array(0,'Op','Op+','O','O+','U');		//20.08		emptyFullSelect(elSel, selArrayText, selArrayValue);		}		}	else		{		// on vide		if (champ != 'Fra'+idToChange)			{			var selArrayText = new Array("","Priveco","Priveco Plus");			var selArrayValue = new Array(0,'Op','Op+');			//20.08			emptyFullSelect(elSel, selArrayText, selArrayValue);			}		}}function changeValues(opt1, idToChange1, idToChange2)	{	// fonction sp\u00E9ciale utilis\u00E9e seulement pour la gestion	// de la Basis et de l'Economica	var f = document.forms[0];	prepareSelectChanges('Fra', opt1,idToChange2)		//if (chkObject('Check'+idToChange1) == true)	if (chkObject('Check'+idToChange1))		{		var hocheck = checkIfChecked('Check'+idToChange1);		//if (f.elements['Check'+idToChange1].checked == true)		if (f.elements['Check'+idToChange1].checked )			{			// il a d\u00E9j\u00E0 choisi une Hospitalisation			retourChoix = f.elements['Choix'+idToChange1].options[f.elements['Choix'+idToChange1].selectedIndex].value;			}		else			{			// il n'a pas encore choisi une hospitalisation			retourChoix = f.elements['Choix'+idToChange1].options[f.elements['Choix'+idToChange1].selectedIndex].value;			}		prepareSelectChanges('Choix', opt1,idToChange1)		if (retourChoix != '0')			{			// il avait d\u00E9j\u00E0 s\u00E9lectionn\u00E9 une couverture hospitalisation			if (opt1 == 'remplir')				{				switch (retourChoix)					{					case 'Op':						f.elements['Choix'+idToChange1].options[1].selected = true;					break;					case 'Op+':						f.elements['Choix'+idToChange1].options[2].selected = true;					break;					case 'O':						f.elements['Choix'+idToChange1].options[3].selected = true;					break;					case 'O+':						f.elements['Choix'+idToChange1].options[4].selected = true;					break;					case 'U':						f.elements['Choix'+idToChange1].options[5].selected = true;					break;					default:					break;					}				}			else				{				if (retourChoix == 'Op+')					{					// on remet la PRIVECO					f.elements['Choix'+idToChange1].options[2].selected = true;					}				else					{					// on remet la PRIVECO PLUS					f.elements['Choix'+idToChange1].options[1].selected = true;					}				}			}				}	}function getProdLine(tabLine, indice)	{	// Classe qui contient les informations saisies	// sur chaque ligne/*	0 = Group1 = CouvID2 = Alias3 = Check4 = Prime5 = Accident6 = Franchise7 = Montant8 = Capital9 = D\u00E9lai10=D\u00E9ces11=NomF12=CatLoi13=GbRsQAcc*/	var f = document.forms[0];	var tabProdLine=new Array();	this.prodLine = tabLine[0];	this.prodLine = this.prodLine + '|' + tabLine[1];	this.prodLine = this.prodLine + '|' + tabLine[2];	if (chkObject(tabLine[3]+indice) == true)	{		this.prodLine = this.prodLine + '|' + f.elements[tabLine[3]+indice].checked;			}	else	{		this.prodLine = this.prodLine + '|' + false;	}	this.prodLine = this.prodLine + '|' + tabLine[11];	this.prodLine = this.prodLine + '|' + tabLine[12];	this.prodLine = this.prodLine + '|' + indice;	this.prodLine = this.prodLine + '|' + tabLine[13];		if(chkObject('Fra'+indice))	{		this.Fra = f.elements['Fra'+indice].options[f.elements['Fra'+indice].selectedIndex].value;		this.FraTxt = f.elements['Fra'+indice].options[f.elements['Fra'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|FraStart=' + this.Fra + '=' + this.FraTxt + '=FraEnd';	}	if(chkObject('Choix'+indice) )	{		this.Choix = f.elements['Choix'+indice].options[f.elements['Choix'+indice].selectedIndex].value;		this.ChoixTxt = f.elements['Choix'+indice].options[f.elements['Choix'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|ChoixStart=' + this.Choix + '=' + this.ChoixTxt + '=ChoixEnd';	}	if(chkObject('Capital'+indice))	{		this.Capital = f.elements['Capital'+indice].options[f.elements['Capital'+indice].selectedIndex].value;		this.CapitalTxt = f.elements['Capital'+indice].options[f.elements['Capital'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|CapitalStart=' + this.Capital + '=' + this.CapitalTxt + '=CapitalEnd';	}	if(chkObject('Mnt'+indice) )	{		this.Mnt = f.elements['Mnt'+indice].options[f.elements['Mnt'+indice].selectedIndex].value;		this.MntTxt = f.elements['Mnt'+indice].options[f.elements['Mnt'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|MntStart=' + this.Mnt + '=' + this.MntTxt + '=MntEnd';	}	if(chkObject('Delai'+indice) )	{		this.Delai = f.elements['Delai'+indice].options[f.elements['Delai'+indice].selectedIndex].value;		this.DelaiTxt = f.elements['Delai'+indice].options[f.elements['Delai'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|DelaiStart=' + this.Delai + '=' + this.DelaiTxt + '=DelaiEnd';	}	if(chkObject('Deces'+indice) )	{		this.Deces = f.elements['Deces'+indice].options[f.elements['Deces'+indice].selectedIndex].value;		this.DecesTxt = f.elements['Deces'+indice].options[f.elements['Deces'+indice].selectedIndex].text;		this.prodLine = this.prodLine + '|DecesStart=' + this.Deces + '=' + this.DecesTxt + '=DecesEnd';	}	if(chkObject('Acc'+indice) )	{		this.Acc = f.elements['Acc'+indice].checked;		this.prodLine = this.prodLine + '|AccStart=' + this.Acc + '=' + '=AccEnd';	}	// remplacement de "+" par "pplus" du fait que	// ce caract\u00E8re est perdu lors du transfert	this.prodLine = replacesubstring(this.prodLine, '+', 'pplus')	return prodLine;}function appPhraseNextYear(){	var f =  document.forms[0];	var phrase = globalFields.PhrasePrimeNextYear;	if (globalFields.NextYearBaremCurrentYear == 'Oui' && phrase != '')	{		window.top.document.getElementById('divPrimeNextYear').style.display  =  'inline';		window.top.document.getElementById('divPrimeNextYear').innerHTML  =  phrase;	}}function appPhraseCantonVaud2009()	{}function appPhraseCantonPasFranchise(){}	function WDocCouvertureValidateFields(retour) {	// valide les champs	var f = document.forms[0];		var sErrorTxt = "";	var iErrorPos = 0;	retour[0] = true;	var trouve = true;	with (window.document.forms[0])	{		var aCheckedProducts = getCheckedProducts();		if (aCheckedProducts.length >= 1)		{			// Au moins un produit est coch\u00E9			// On recherche les produits n\u00E9cessaires			// Au produit courant			for(var i=0;i<aCheckedProducts.length;i++)			{				if(chkObject('divPossibleSi'+aCheckedProducts[i]) )				{					var PossibleSi = window.top.document.getElementById('divPossibleSi'+aCheckedProducts[i]).innerHTML;					if (PossibleSi != '0')					{						trouve = false;						var tabPossibleSi = PossibleSi.split('#');						n = 0;						while ((n<tabPossibleSi.length) && (!trouve))						{							if(chkObject('Check'+tabPossibleSi[n]) )								{								if(document.forms[0].elements['Check'+tabPossibleSi[n]].checked)									trouve = true;							}														n = n+1;						}					}				}			}		}		if (!trouve )			retour[2] = retour[2] + '<BR>' + sErrMsg[109];		// au lieu de v\u00E9rifier si au moins une couverture est saisie		// on regarde si le total est sup\u00E9rieur \u00E0 0		if (window.top.document.getElementById('divTotalBrt').innerHTML == '0.00')			retour[2] = retour[2] + '<BR>' + sErrMsg[25];	}	// Dans certains cantons nous n'avons pas de franchise 2000 et 2500	// Si a s\u00E9lectionn\u00E9 2000 ou 2500, nous mettons un message d'erreur	if(f.elements['Check01'].checked )	{		var primeBaseTmp = window.top.document.getElementById('divPrime01').innerHTML;		if (primeBaseTmp == '0.00' || primeBaseTmp == '0,00')			retour[2] = retour[2] + '<BR>' + sErrMsg[121];	}		if (retour[2] != '')		retour[0] = false;	return retour;}	function getCheckedProducts(){	var aProducts = new Array();	var aCheckboxes = document.getElementsByTagName("input");	var sCheckboxName;	var j=0;	for(var i=0;i<aCheckboxes.length;i++)	{		sCheckboxName = aCheckboxes[i].name;		if(	aCheckboxes[i].type == "checkbox" && sCheckboxName.substr(0,5) == "Check" && 	document.forms[0].elements[sCheckboxName].checked )		{				aProducts[j] = sCheckboxName.substr(5,2);				j++;		} 	}	return aProducts;}/*fonction qui r\u00E9cup\u00E8re un param\u00E8tre d'url gup = get URL parameter*/function gup( name ){	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");	var regexS = "[\\?&]"+name+"=([^&#]*)";	var regex = new RegExp( regexS );	var results = regex.exec( window.location.href );	if( results == null )		return "";	else		return results[1];}//dojo animation//ajout\u00E9 par hichem hbaieb le 07-05-2009 pour afficher la d\u00E9finition d'un produit avec un dialogvar toolTipDialog = null;var hideTooltip = false;function showToolTip(aroundID, tolTipContent){	if(tolTipContent != "")	{		hideTooltip = false;		setTimeout("setHideTooltip()", 100);		dojo.byId("tooltipDivContent").innerHTML = tolTipContent.replace(/&#34;/g,"\"");		var n = dojo.byId(aroundID);		dijit.popup.open({ around: n , popup: toolTipDialog });	}}function setHideTooltip(){	hideTooltip = true;}function showToolTipFromCombo(aroundID, idCombo){	var selectedValue = $(idCombo).value;	var ret = "def_" + selectedValue.replace(/\+/g, "_");	try	{		ret = eval(ret);		ret = ret.replace(/&#34;/g,"\"");		showToolTip(aroundID, ret);	}	catch(e){}}function hideToolTip(){	if(toolTipDialog)		dijit.popup.close(toolTipDialog);}///////////////////////////////////////////////////////////// WDocCouverture /////////////////////////////////////////////////////////////