
//-------------------
//Rachat de crédits
//-------------------

//affiche/cache les blocs de texte dans "Guide du rachat du crédits > Toutes vos questions"
function showTxt(nbRep){
	
	var thisText=document.getElementById('reponse'+nbRep);
	
	if(thisText.style.visibility == 'hidden'){
		thisText.style.visibility='visible';
		thisText.style.display='block';
		document.getElementById('question'+nbRep).style.listStyleImage='url(squelettes/images/7/puce_moins.gif)';

	}
	else{
		thisText.style.visibility='hidden';
		thisText.style.display='none';
		document.getElementById('question'+nbRep).style.listStyleImage='url(squelettes/images/7/puce_plus.gif)';

	}
}

//affiche/cache les blocs de texte dans "Prêt hypothécaire > Toutes vos questions"
function showBloc(id){
	
	var thisBloc=document.getElementById(id);
	
	for(var i=1;i<=3;i++){
	
		if(thisBloc.id != 'bloc'+i){
			
			document.getElementById('bloc'+i).style.visibility='hidden';
			document.getElementById('bloc'+i).style.display='none';
			document.getElementById('bloc_titre'+i).style.color='#000000';
			document.getElementById('bloc_titre'+i).style.backgroundImage='url(squelettes/images/7/bloc_solutions_off.gif)';

		}else{
			
			document.getElementById('bloc'+i).style.visibility='visible';
			document.getElementById('bloc'+i).style.display='block';
			document.getElementById('bloc_titre'+i).style.color='#ffffff';
			document.getElementById('bloc_titre'+i).style.backgroundImage='url(squelettes/images/7/bloc_solutions_on.gif)';

		}
	
	}
}

//Génére le sommaire dans un article de type carousel
function buildSommaire(){
	var div_active = document.getElementById("active");
	var title = div_active.getElementsByTagName("h2");
	var title_content='';
	var title_name;
	var last_title='';
	
	for(var i=0;i<title.length;i++) {
		
		if(i == title.length-1) {
			last_title = 'class="last"';
		}
		
		title_name = title[i].innerHTML;
		
		title_content+= '<li '+ last_title +'><a href="#'+ (i+1) +'" class="scrollAnchor">'+ title_name +'</a></li>';

	}
	document.getElementById("sommaire_content").innerHTML = title_content;
}

function resizeFrame(){

	var monIframe = document.getElementById("iframe_calcul");
	
	if(navigator.appName=="Microsoft Internet Explorer" ){
		if(document.all){
			document.all.moniframe.style.height = document.frames("iframe_calcul" ).document.body.scrollHeight;
		}
		else {
			document.getElementById("iframe_calcul" ).style.height = document.getElementById("iframe_calcul" ).contentDocument.body.scrollHeight;
		}
		
	}else{
		var hContent = monIframe.contentDocument.body.offsetHeight;
		monIframe.height = hContent+10;
	}
}

function iFrameHeight() {
       var h = 0;
       if ( !document.all ) {
               h = document.getElementById('iframe_calcul').contentDocument.height;
               document.getElementById('iframe_calcul').style.height = h + 60 + 'px';
       } else if ( document.all ) {
               h = document.frames('iframe_calcul').document.body.scrollHeight;
               document.all.iframe_calcul.style.height = h + 20 + 'px';
       }
}

//FONCTIONS POUR LES TAGS BANNIERE

smart_endpagemarkup = true // true = securise et false = standard
		
sas_tmstp=Math.round(Math.random()*10000000000);sas_masterflag=1;

function SmartAdServer(sas_pageid,sas_formatid,sas_target) {
	if (sas_masterflag==1) {sas_masterflag=0;sas_master='M';} else {sas_master='S';};
	document.write('<scr'+'ipt SRC="http://www.smartadserver.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/'+sas_master + '/' + sas_tmstp + '/' + escape(sas_target) + '?"></scr'+'ipt>');
}

function SmartAdServerStd(sas_pageid,sas_formatid,sas_target) {
	if (smart_endpagemarkup == false) {
		SmartAdServerInternal(sas_pageid,sas_formatid,sas_target)
	}
}

function SmartAdServerEndPage(sas_pageid,sas_formatid,sas_target) {
	if (smart_endpagemarkup == true) {
		SmartAdServerInternal(sas_pageid,sas_formatid,sas_target)
	}
}

function SmartAdServerInternal(sas_pageid,sas_formatid,sas_target) {
	if (sas_masterflag==1) {sas_masterflag=0;sas_master='M';} else
	{sas_master='S';};

	document.write('<SCR'+'IPT ID="SmartScr' + sas_formatid + '" SRC="http://www.smartadserver.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/'+sas_master + '/' + sas_tmstp + '/' + escape(sas_target) + '?"></SCR'+'IPT>');
}

// SCRIPT Gestion de la valeur par défaut du champ Newsletter
function texteDefautNL(focus){
	if(focus=="focusOn") {
		if(document.getElementById('newsletter').value == "votre adresse email") {
			document.getElementById('newsletter').style.color = "#32444E";
			document.getElementById('newsletter').value = '';
		}
	}
	if(focus=="focusOff") {
		if(document.getElementById('newsletter').value == "") {
			document.getElementById('newsletter').value = 'votre adresse email';
			document.getElementById('newsletter').style.color = "#AAA";
		}
		if(document.getElementById('newsletter').value == "votre adresse email") {
			document.getElementById('newsletter').style.color = "#AAA";
		}
	}
}

//FONCTION RECHERCHE AGENCE SUR HEADER
function chercher_agence(){
	
	//document.rechercher_agen.action = "http://localhost/meilleurtaux-V2/www/squelettes/list_agence.html";
	if (parseInt(document.rechercher_agen.postion_agen.value) > 0) {
		document.rechercher_agen.codepostal_agen.value 	= document.rechercher_agen.postion_agen.value;
		document.rechercher_agen.villes_agen.value 		= "";
	}
	else {
		document.rechercher_agen.villes_agen.value 		= document.rechercher_agen.postion_agen.value;
		document.rechercher_agen.codepostal_agen.value 	= "";
	}
	//alert(document.rechercher_agen.libelle.value);
	//document.rechercher_agen.action = "http://groupe.meilleurtaux.com/index.php";
	//document.rechercher_agen.submit();
}

