/*-----------------------------------------------------------------------------------------------*/
// Copyright (c) 2008 Agence Clark (http://www.agence-clark.com)
//
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
// Init Page
/*-----------------------------------------------------------------------------------------------*/
//FUNCTION AJOUTER DANS LA BASE HIDDEN d'AUTO COMPLETER

Event.observe(window, 'load', function(){
	RollOverImage();
	focusInput();
	//DHTML
	//@Thinh a modifie
	//var menu1 = new menuDHTML('menu', {etat:'on'});	
	//var menu2 = new menuDHTML('menu2', {etat:'on'});
	
	if($$('#mod_voices .articles2').size() > 0){
		$$('#mod_voices .articles2 .onglets a').each(function(e,i){
			e.observe('click',function(event){
				$$('#mod_voices .articles2 .onglets a').each(function(a,j){
					a.removeClassName('on');
				});
				e.addClassName('on');
				$$('#voices .f_bloc').each(function(d,j){
					d.hide(); 
				});
				var val = e.hash.substr(7);
				if($('idkeysearch')) var keysearch = $('idkeysearch').value;
				else var keysearch = "";
				if($('cont_voices'+val)){
					$('cont_voices'+val).show();
				}else{
					$('voices').insert({top : '<div class="f_bloc" id="loading"></div>'});
					$('voices').insert({top : '<div class="f_bloc" id="cont_voices'+val+'" style="display:none;"></div>'});
					new Ajax.Request('/_ajax.php?ACT=voices',{
						parameters : {type:val,keysearch:keysearch},
						onComplete : function(transport){
							$('loading').remove();
							data = transport.responseJSON;
							data.voices.each(function(e,i){
								if(i == data.voices.size()-1){
								var tpl = '<div class="item last">';
								}else{
								var tpl = '<div class="item">';
								}
								if(e.visuel!=""){
									tpl+='<a href="'+e.url+'" class="visuel"><img src="'+e.visuel+'" alt="" /></a>';
								}	
								tpl+='<h2><a href="'+e.url+'">'+e.titre+'</a></h2>';
								tpl+='<p>'+e.texte+' <a href="'+e.url+'" class="suite">Read More &gt;</a></p>';
								tpl+='</div>';
								$('cont_voices'+val).insert({bottom:tpl});
							});
							$('cont_voices'+val).insert({bottom:'<div class="tous"><a href="'+data.lien.url+'">'+data.lien.titre+' &gt;</a></div>'});
							$('cont_voices'+val).show();
						}
					});	
				}
				event.stop();
			});
		});
	}
	
	
	/* SB ANNONCE */
	if($('dernieres_annonces')){
		var sb_annonce = new SwitchBloc('sb_annonces','item');
		rollItem('#sb_annonces .f_item');
	}

	/* SB APARTMENT */
	if($('dernieres_apartment')){
		var sb_annonce = new SwitchBloc('sb_apartment','item');
		rollItem('#sb_apartment .f_item');
	}
	
	
	/* SB ARTICLES */
	if($('sb_article')){
		var sb_article = new SwitchBloc('sb_article','item',{
			SwiDirection : 'vertical'				
		});
		rollItem('#sb_article .f_item');
	}

	// CALENDRIER
	$$('input.calendrier').each(function(e){
		Event.observe(e,'focus',function(){
			displayCalendar(this,'dd/mm/yyyy',this,false,false);
		});
	});
	// AJAX DU CHARGEMENT DES VILLES / PAYS
	$$('.sel_pays').each(function(e){
		Event.observe(e,'change',function(){
			getVille(e);
		});
	});
	//AUTOCOMPLETER THE MOVE CHANNEL//
	if($('input#tmc_location')) {
		alert('OK');
	}
	$$('input#tmc_location').each(function(e){
		e.insert({after:'<div id="liste_choix" class="autocomplete"></div>'});
		var form = $('frm_gauche');
		var country = form['cny_idt'];
		var cny_idt = country.getValue();
		//var url = 'http://www.expatfinder.com/_ajax.php?ACT=getLocationTMC'
		var url = './_ajax.php?ACT=getLocationTMC'	;
		var url = 'http://www.expatfinder.com/_ajax.php?ACT=getLocationTMC';
		new Ajax.Autocompleter('tmc_location','liste_choix',url,{
			parameters : 'country_id='+cny_idt,
			minChars : 3,
			afterUpdateElement : ajouteHidden
		});
	});
	
	function ajouteHidden(e,li){
		//var testVille = new RegExp("^country");
		//var testCountry = new RegExp("^ville");
		//var testRegion = new RegExp("^ville");
		var location = li.id;
		var form = $('frm_gauche');
		form['abcxyz'].writeAttribute("value",li.id);	
		form['locidt'].writeAttribute("value",li.id);
	};
	/*
	var ajouteHidden = function(e,li){
		alert('OK');
		var location = li.id;
		var form = $('frm_gauche');
		form['abcxyz'].writeAttribute("value",li.id);	
		form['locidt'].writeAttribute("value",li.id);
		alert(location);
	};
	
	$$('liste_choix').each(function(e){
		Event.observe(e,'click',function(){
			alert(e.id)
		});
	});
	*/
	// FORMULAIRE
	
	if($('formulaire')){
		$$('.mois.sel_date', '.annee.sel_date').each(function(e){
			Event.observe(e,'change',function(){
				annee = e.up().down('.annee').value;
				mois =  e.up().down('.mois').value;
				if(mois == '02'){
					var nb_jour = ((annee % 4) == 0) ? 29 : 28;
				}else if(mois == '04' || mois == '06' || mois == '09' || mois == '11'){
					var nb_jour = 30;
				}else{
					var nb_jour = 31;
				}
				e.up().down('.jour').update('');
				for(i=1;i<=nb_jour;i++){
					if(i<10){
						num = '0'+i;
					}else{
						num = i;	
					}
					e.up().down('.jour').insert({bottom:'<option value="'+num+'">'+num+'</option>'});
				}
				if(e.up().down('.annee').selectedIndex == 0){
					e.up().down('.annee').selectedIndex=1;
				}
				if(e.up().down('.mois').selectedIndex == 0){
					e.up().down('.mois').selectedIndex=1;
				}
				e.up().down('.jour').selectedIndex=0;
			});
		});		
		$$('.sel_date').each(function(e){
			Event.observe(e,'change',function(){
				annee = e.up().down('.annee').value;
				mois = e.up().down('.mois').value;
				jour = e.up().down('.jour').value;
				e.up().down('.hidden_date').writeAttribute('value',annee+mois+jour);
			});
		});
	}
	$$('.mois.sel_date', '.annee.sel_date').each(function(e){
		Event.observe(e,'change',function(){
			annee = e.up().down('.annee').value;
			mois =  e.up().down('.mois').value;
			if(mois == '02'){
				var nb_jour = ((annee % 4) == 0) ? 29 : 28;
			}else if(mois == '04' || mois == '06' || mois == '09' || mois == '11'){
				var nb_jour = 30;
			}else{
				var nb_jour = 31;
			}
			e.up().down('.jour').update('');
			for(i=1;i<=nb_jour;i++){
				if(i<10){
					num = '0'+i;
				}else{
					num = i;	
				}
				e.up().down('.jour').insert({bottom:'<option value="'+num+'">'+num+'</option>'});
			}
			if(e.up().down('.annee').selectedIndex == 0){
				e.up().down('.annee').selectedIndex=1;
			}
			if(e.up().down('.mois').selectedIndex == 0){
				e.up().down('.mois').selectedIndex=1;
			}
			e.up().down('.jour').selectedIndex=0;
		});
	});		
	$$('.sel_date').each(function(e){
		Event.observe(e,'change',function(){
			annee = e.up().down('.annee').value;
			mois = e.up().down('.mois').value;
			jour = e.up().down('.jour').value;
			e.up().down('.hidden_date').value = annee+mois+jour;
		});
	});
	//FORMULAIRE DE PET SHIPPING
	if($('frm_gauche_pet_shipping')){	
		$('keysearch_city').onfocus = function() {
			$('keysearch_airport').clear();
			$('keysearch_pettype').clear();
		};
		
		$('keysearch_airport').onfocus = function() {
			$('keysearch_city').clear();
			$('keysearch_pettype').clear();
		}	
		
		$('keysearch_pettype').onfocus = function() {
			$('keysearch_city').clear();
			$('keysearch_airport').clear();
		}	
	}
	// HOME
	if($('home')){
		$$('#home .rubriques .ligne').each(function(e,i){
			hauteurRub('.ligne'+(i+1)+' .rub');
		});
		$$('.rubriques .rub').each(function(e,i){
			Event.observe(e,'mouseover',function(){
				e.addClassName('over');									 
			});
			Event.observe(e,'mouseout',function(){
				e.removeClassName('over');									 
			});
		});
		if ($('hconteneur')) {
			var SwiTools = new SwitchBloc('hconteneur', 'actu', {
				SwiActIndice: false,
				SwiDefilAuto: false,
				SwiDefilBts: false
			});
		}
	}
	
	// ACCUEIL RUBRIQUE
	if($('rub_home')){
		$$('#rub_home .ligne').each(function(e,i){
			hauteurRub('.ligne'+(i+1)+' .rub');
		});
	}
	
	// VISIONNEUSE FICHE XML
	if($('xml_fiche2')){
		var SwiTools = new SwitchBloc('miniatures','actu',{
            SwiActIndice:false,
            SwiDefilAuto:false,
            SwiDefilBts:false
        });
		$$('#miniatures .actu a').each(function(e){
			e.onclick = function(){
				return false;
			}
			Event.observe(e,'click',function(){
				$('apercu').update('');
				$('apercu').update('<img src="'+e.href+'" alt="" />');
			});
		});
		/*
		map = new GMap2($("gmap"));
		map.addControl(new GMapTypeControl());
		map.addControl(new GLargeMapControl3D());
		var point = new GLatLng($F('latitude'),$F('longitude'));
		markerOptions = {
			title : $F('titre'),
			clickable : false
		};
		var marker = new GMarker(point, markerOptions);
		map.addOverlay(marker);
		map.setCenter(point,15);
		*/
	}
	if($('flat_fiche')){
		var SwiTools = new SwitchBloc('miniatures','actu',{
            SwiActIndice:false,
            SwiDefilAuto:false,
            SwiDefilBts:false
        });
		$$('#miniatures .actu a').each(function(e){
			e.onclick = function(){
				return false;
			}
			Event.observe(e,'click',function(){
				$('apercu').update('');
				$('apercu').update('<img src="'+e.href+'" alt="" />');
			});
		});
		
	}
	// BANNIERES
	if($('about_banners')){
		$$('.copy').each(function(e){
			Event.observe(e,'click',function(){
				if(navigator.userAgent.include('MSIE')==true){
					e.up().down('textarea').select();
					var textRange = document.body.createTextRange();
					textRange.moveToElementText(e.up().down('textarea'));
					textRange.execCommand("Copy");
				}else{
					e.up().down('textarea').select();
				}
			});
		});
	}
	
	// POPUP
	$$('.a_popup').each(function(e){
		e.onclick = function(){ return false;}
		Event.observe(e,'click',function(){
			if(e.rel!=''){
				var w = e.rel.split('x')[0];
				var h =  e.rel.split('x')[1];
			}else{
				var w = 900;
				var h = 500;
			}
			var l = (screen.availWidth-10 - w) / 2;
			var t = (screen.availHeight-20 - h) / 2;
			//alert(h + " " + w);
			features = "width="+w+",height="+h+",left="+l+",top="+t+",screenX="+l+",screenY="+t+",scrollbars=1,resizable=0,location=0,menubar=0,toolbar=0,status=1";
			window.open(e.href, 'ExpatFinder', features);
		});							 
	});
	
	// SEO
	if($('search_moteur')){
		$$('#search_moteur .onglet a').each(function(e,i){
			e.onclick = function(){ return false;}
			Event.observe(e,'click',function(){
				ongletRecherche(i);				
			});											
		});
	}
	if($('seo_rubriques')){
		$$('#seo_rubriques .ligne').each(function(e,i){
			hauteurRub('.ligne'+(i+1)+' .rub');
		});
		$$('#seo_rubriques .rub').each(function(e,i){
			Event.observe(e,'mouseover',function(){
				e.addClassName('over');									 
			});
			Event.observe(e,'mouseout',function(){
				e.removeClassName('over');									 
			});
		});
	}
	// AJAX STOCKAGE IP
	$$('.stockIP').each(function(e){
		Event.observe(e,'click',function(){
			stockIP(e);
		});
	});
	//FREEDOWNLOAD//
	$$('a.freedownload_link').each(function(e){
		Event.observe(e,'click',function(){
			_gaq.push(['_trackEvent', 'free-download', 'submit',  '' ]);
		});
	});
	//changement de la ville ==>activer la select si choisi, sinon desactiver
	/*
	$$('.sel_ville').each(function(e){
		Event.observe(e,'change',function(){
			if(e.up().next().down('.sel_bedroom') && e.value!=''){
				e.up().next().down('.sel_bedroom').disabled = '';
				e.up().next().down('.sel_bedroom').removeClassName('disabled');
			}else{
				e.up().next().down('.sel_bedroom').disabled = 'disabled';
				e.up().next().down('.sel_bedroom').addClassName('disabled');
			}
		});
	});*/
	
	if($$('.onglets_tab').size() > 0){
		menuOnglet();
	}
	// PIED SEO
	if($('seo1')){
		$$('#seo1 ul').each(function(e){
			e.setStyle({
				height:'150px',
				overflow:'hidden'
			});
			e.observe('mouseover',function(){
				e.style.overflow = 'auto';
			});
			e.observe('mouseout',function(){
				e.style.overflow = 'hidden';
			});
		});
	}
	/*--------------------*/
	/*-----INFO BOX-------*/
	/*--------------------*/
	
	$$('a.infobox').each(function(e){
		Event.observe(e,'click',function(){
			var pro_idt = e.name.split('_')[1];
			var myinfoBox = new infoBox('./_ajax.php?ACT=getContentProduct&pro_idt='+pro_idt);
			myinfoBox.ouvrir();
			
		});
	});
	/*--------------------*/
	/*-----INFO ITEMS-------*/
	/*--------------------*/
	$$('a.infoItems').each(function(e){
		Event.observe(e,'click',function(){
			var pro_idt = e.name.split('_')[1];
			new Ajax.Request('/_ajax.php?ACT=getContentItemProduct&pro_idt='+pro_idt,{
				onComplete : function(transport){
					$('infoproduct_'+ pro_idt).update(transport.responseText)
					}
				}
			);	
			Effect.toggle('infoproduct_'+ pro_idt, 'blind');
		});
	});
	$$('a.infoItemsSimple').each(function(e){
		Event.observe(e,'click',function(){
			var pro_idt = e.name.split('_')[1];
			new Ajax.Request('/_ajax.php?ACT=getContentItemProductSimple&pro_idt='+pro_idt,{
				onComplete : function(transport){
					$('infoproduct_'+ pro_idt).update(transport.responseText)
					}
				}
			);	
			Effect.toggle('infoproduct_'+ pro_idt, 'blind');
		});
	});
	
	/*-----------------------------------------------------------------------------------------------*/
	//CURRENCY CONVERTER
	/*-----------------------------------------------------------------------------------------------*/
	if($('button_convert_currency_right')){
		Event.observe($('button_convert_currency_right'),'click',function(e){
			var currency1 = $('frmConvert').currency1.value;
			var currency2 = $('frmConvert').currency2.value;
			var amount1 = $('frmConvert').amount1.value;
			var amount2 = $('frmConvert').amount2.value;
			var period = $('frmConvert').date.value;
			var historical_period = 1;
			new Ajax.Request('/_ajax.php?ACT=getChangeCurrency',{
			parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
			onComplete : function(transport){
							$('currency_results').update(transport.responseText);
						}
			});	
			createPickers();
		});
	};
	if($$('input.historical_period')){
		$$('input.historical_period').each(function(e){
			Event.observe(e,'change',function(){
				var currency1 = $('frmConvert').currency1.value;
				var currency2 = $('frmConvert').currency2.value;
				var amount1 = $('frmConvert').amount1.value;
				var amount2 = $('frmConvert').amount2.value;
				var period = $('frmConvert').date.value;
				var historical_period = e.value;
				new Ajax.Request('/_ajax.php?ACT=getResultsForex',{
				parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
				onComplete : function(transport){
					$('currency_results').update(transport.responseText);
				}
				});	
			});
		});
	};
	
	createPickers();
	/*-----------------------------------------------------------------------------------------------*/
	//END OF CURRENCY CONVERTER
	/*-----------------------------------------------------------------------------------------------*/
});

Event.observe(window,'unload',function(){
	if($('xml_fiche2')){
		GUnload();
	}
});

/*-----------------------------------------------------------------------------------------------*/
//INFO BOX
/*-----------------------------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------------------------*/
// Fonctions
/*-----------------------------------------------------------------------------------------------*/
function changeCurrency(){
	var currency1 = $('frmConvert').currency1.value;
	var currency2 = $('frmConvert').currency2.value;
	var amount1 = $('frmConvert').amount1.value;
	var amount2 = $('frmConvert').amount2.value;
	var period = $('frmConvert').date.value;
	var historical_period = 1;
	
	new Ajax.Request('/_ajax.php?ACT=getFormConverterNotResults',{
		parameters : {cur1:currency1, cur2:currency2, amount1:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
		onComplete : function(transport){
						$('form_currencyconvert').update(transport.responseText);
					}
		});	
	
	new Ajax.Request('/_ajax.php?ACT=getChangeCurrency',{
		parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
		onComplete : function(transport){
					$('currency_results').update(transport.responseText);
				}
	});	
	createPickers();
};
/**
 * Load Historical Currency
 */
var load_historical_currency = function(e){
	var currency1 = $('frmConvert').currency1.value;
	var currency2 = $('frmConvert').currency2.value;
	var amount1 = $('frmConvert').amount1.value;
	var amount2 = $('frmConvert').amount2.value;
	var period = $('frmConvert').date.value;
	var historical_period = e.value;
	new Ajax.Request('/_ajax.php?ACT=getResultsForex',{
	parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
	onComplete : function(transport){
		$('currency_results').update(transport.responseText);
	}
	});	
};
/**
 * Curerrency Converter
 */
function getConversionRate() {
	var currency1 = $('frmConvert').currency1.value;
	var currency2 = $('frmConvert').currency2.value;
	var amount1 = $('frmConvert').amount1.value;
	var amount2 = $('frmConvert').amount2.value;
	var period = $('frmConvert').date.value;
	var historical_period = 1;
	$('frmShowHistorical').reset();
	new Ajax.Request('/_ajax.php?ACT=getForexteRate',{
	parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
	onComplete : function(transport){
		$('amount2').setValue(transport.responseText);
	}
	});	
	new Ajax.Request('/_ajax.php?ACT=getResultsForex',{
	parameters : {cur1:currency1, cur2:currency2, amount:amount1,date:period,historical:historical_period,f_all:$('frmConvert').serialize()},
	onComplete : function(transport){
		$('currency_results').update(transport.responseText);
		$('currency_options_historical').show();
	}
	});	
	return false;
};
/**
 * Date Pickers
 * @return
 */
function createPickers() {
  if($$('input.datepicker')){
	  $(document.body).select('input.datepicker').each(
	     function(e) {
	        new Control.DatePicker(e, { 'icon': './images/calendar/calendar.png' });
	     }
	  );
  };
}
var rollItem = function(rule){
	$$(rule).each(function(e){
		e.stopObserving('mouseenter');							  
		e.stopObserving('mouseleave');
		e.observe('mouseenter',function(){
			e.addClassName('on');
		});
		e.observe('mouseleave',function(){
			e.removeClassName('on');
		});
	});
};
var hauteurRub = function(rule){
	var tab = new Array();
	$$(rule).each(function(e,i){
		tab.push(e.getHeight() - e.getStyle('padding-top').substr(0,e.getStyle('padding-top').length-2) - e.getStyle('padding-bottom').substr(0,e.getStyle('padding-top').length-2));
	});
	$$(rule).each(function(e,i){
		e.style.height = tab.max()+'px';
	});
};
var getVille = function(e){
	new Ajax.Request('_ajax.php?ACT=getVille',{
		parameters : {id:e.value, rubrik:e.up(1).down('.rubrik_courante').value},
		onComplete : function(transport){
			e.up().next().down('.sel_ville').update(transport.responseText);
			
			if(e.up().next(1).down('.sel_bedroom') ){
				e.up().next(1).down('.sel_bedroom').value = '';
				e.up().next(1).down('.sel_bedroom').disabled = 'disabled';
				e.up().next(1).down('.sel_bedroom').addClassName('disabled');
			}
		}
	});	
};
var stockIP = function(e){
	new Ajax.Request('_ajax.php?ACT=stockIP',{
		parameters : {url:e.href}
	});	
};
var ongletRecherche = function(num){
	a_onglet = $$('#search_moteur .onglet a');
	a_onglet.each(function(e){
		e.removeClassName('on');
	});
	a_onglet[num].addClassName('on');
	if(num == 1){
		//db('remove');
		$('goto').value='recherche_blog';
		//$('w').hide();
	}else{
		//$('w').show();
		$('goto').value='recherche';
	}
};
var menuOnglet = function(){
	$$('.onglets_tab a').each(function(e){
		Event.observe(e, 'click', function(){
			$$('.onglets_tab a').each(function(i){i.removeClassName('in');});
			e.blur();
			e.addClassName('in');
			$$('.cont_tab').each(function(i){i.hide();});
			$('cont_'+e.id).show();
		});
	});
};
/*-----------------------------------------------------------------------------------------------*/
// VERIF
/*-----------------------------------------------------------------------------------------------*/

/**
 * Changer de country
 */
var frmChangeCountry = function(form){
	var country = form.country.options[form.country.selectedIndex].text;
	_gaq.push(['_trackEvent', 'change-country', 'submit',  country ]);
	return true;
}
/**
 * FrameNewsletters
 * @return
 */
var frmNewsletter = function() {
	param_form = {
		mep: 'msg_champ',
		autoScroll: true,
		action: 'submit'
	};
	champs_form = {
		email: {type:'mel',alerte:'Email is a mandatory fiel and must be valid.'},
		title: {alerte:'Title is a mandatory field.'},
		firstname:{alerte:'Firstaname is a mandatory field.'},
		surname:{alerte:'Surname is a mandatory field.'},
		nationality:{alerte:'Nationality is a mandatory field.'},
		country:{alerte:'Your current country of residence is a mandatory field.'}
	};
	var res = formVerif('frm_newsletter', champs_form, param_form);
	if(res==true){
		_gaq.push(['_trackEvent', 'Newsletter_Top', 'submit', '' ]);
	}
	return res;
};
/**
 * Form Contacts
 * @return
 */
var frmContact = function() {
	param_form = {
		mep: 'msg_champ',
		autoScroll: true,
		action: 'submit'
	};
	champs_form = {
		enquiry: {type:'mel',alerte:'Subject of your enquiry is a mandatory fiel.'},
		title: {alerte:'Title is a mandatory field.'},
		name:{alerte:'Name is a mandatory field.'},
		tel_country:{alerte:'Telephone country is a mandatory field.'},
		daytime_tel_number:{alerte:'Daytime telephone number is a mandatory field.'},
		email: {type:'mel',alerte:'Email is a mandatory fiel and must be valid.'}
	};
	return formVerif('frm_contact', champs_form, param_form);
};
/**
 * Form Submit
 * @return
 */
var frmSubmit = function() {
	param_form = {
		mep: 'msg_champ',
		autoScroll: true,
		action: 'submit'
	};
	champs_form = {
		email: {type:'mel',alerte:'Email is a mandatory fiel and must be valid.'},
		url: {alerte:'Website URL is a mandatory field.'},
		captcha:{alerte:'You must enter the code shown above.'}
	};
	return formVerif('frm_submit', champs_form, param_form, {idMsgGlobal:'msgGlobalInsc2'});
};
var frmGuide = function() {
	param_form = {
		mep: 'msg_champ',
		autoScroll: true,
		action: 'submit'
	};
	champs_form = {
		email: {type:'mel',alerte:'Email is a mandatory fiel and must be valid.'},
		title: {alerte:'Title is a mandatory field.'},
		firstname:{alerte:'Firstaname is a mandatory field.'},
		surname:{alerte:'Surname is a mandatory field.'},
		nationality:{alerte:'Nationality is a mandatory field.'},
		country:{alerte:'Your current country of residence is a mandatory field.'},
		val_naissance:{alerte:'Date of birth is a mandatory field'},
		status:{alerte:'Relashionship status is a mandatory field'},
		nb_enfant:{alerte:'The number of children under 18 you have is a mandatory field'},
		pet:{alerte:'Are you relocating with a pet is a mandatory field'},
		income:{alerte:'Yearly total household income before tax is a mandatory field'}
	};
	return formVerif('frm_guide', champs_form, param_form, {idMsgGlobal:'msgGlobalInsc2'});
};
function getSelectionId(text, li) {
	alert (li.id);
}
/**
 * Ajouter une ConversionCode
 * @return
 */
function ppcconversion(code) {
	var iframe = document.createElement('iframe');
	iframe.style.width = '0px';
	iframe.style.height = '0px';
	document.body.appendChild(iframe);
	iframe.src = code;
};


(function(){var b=null;function f(a){if(a!=b)return escape(a.toString());return""}function h(a){if(a!=b)return a.toString().substring(0,256);return""}function j(a,c){var g=f(c);if(g!=""){var e=f(a);if(e!="")return"&".concat(e,"=",g)}return""}function k(a){if(typeof a!="number"&&typeof a!="string")return"";return f(a.toString())}
function l(a){if(!a)return"";a=a.google_conversion_items;if(!a)return"";for(var c=[],g=0,e=a.length;g<e;g++){var d=a[g],i=[];if(d){i.push(k(d.value));i.push(k(d.quantity));i.push(k(d.item_id));i.push(k(d.adwords_grouping));i.push(k(d.sku));c.push("("+i.join("*")+")")}}return c.length>0?"item="+c.join(""):""}
function m(a,c,g){var e=[];if(a){var d=a.screen;if(d){e.push(j("u_h",d.height));e.push(j("u_w",d.width));e.push(j("u_ah",d.availHeight));e.push(j("u_aw",d.availWidth));e.push(j("u_cd",d.colorDepth))}a.history&&e.push(j("u_his",a.history.length))}g&&typeof g.getTimezoneOffset=="function"&&e.push(j("u_tz",-g.getTimezoneOffset()));if(c){typeof c.javaEnabled=="function"&&e.push(j("u_java",c.javaEnabled()));c.plugins&&e.push(j("u_nplug",c.plugins.length));c.mimeTypes&&e.push(j("u_nmime",c.mimeTypes.length))}return e.join("")}
function n(a,c){var g="";if(c){var e=c.referrer;if(a&&a.top&&c.location&&a.top.location==c.location){g+=j("ref",h(e));e=c.location}g+=j("url",h(e))}return g}function o(a){if(a&&a.location&&a.location.protocol&&a.location.protocol.toString().toLowerCase()=="https:")return"https:";return"http:"}function p(a,c){return o(a)+"//www.googleadservices.com/pagead/"+c}
function q(a,c,g){var e="/?";if(a.google_conversion_type=="landing")e="/extclk?";e=p(a,["conversion/",f(a.google_conversion_id),e,"random=",f(a.google_conversion_time)].join(""));var d;a:{d=a.google_conversion_language;if(d!=b){d=d.toString();if(2==d.length){d=j("hl",d);break a}if(5==d.length){d=j("hl",d.substring(0,2))+j("gl",d.substring(3,5));break a}}d=""}e+=[j("cv",a.google_conversion_js_version),j("fst",a.google_conversion_first_time),j("num",a.google_conversion_snippets),j("fmt",a.google_conversion_format),
j("value",a.google_conversion_value),j("label",a.google_conversion_label),j("oid",a.google_conversion_order_id),j("bg",a.google_conversion_color),d,j("guid","ON"),l(a),m(a,c,a.google_conversion_date),n(a,g)].join("");return e}
function r(a){if({ar:1,bg:1,cs:1,da:1,de:1,el:1,en_AU:1,en_US:1,en_GB:1,es:1,et:1,fi:1,fr:1,hi:1,hr:1,hu:1,id:1,is:1,it:1,iw:1,ja:1,ko:1,lt:1,nl:1,no:1,pl:1,pt_BR:1,pt_PT:1,ro:1,ru:1,sk:1,sl:1,sr:1,sv:1,th:1,tl:1,tr:1,vi:1,zh_CN:1,zh_TW:1}[a])return a+".html";return"en_US.html"}
function s(a,c,g){c=q(a,c,g);g=function(e,d,i){return'<img height="'+i+'" width="'+d+'" border="0" src="'+e+'" />'};return a.google_conversion_format==0?'<a href="'+(o(a)+"//services.google.com/sitestats/"+r(a.google_conversion_language)+"?cid="+f(a.google_conversion_id))+'" target="_blank">'+g(c,135,27)+"</a>":a.google_conversion_snippets>1||a.google_conversion_format==3?g(c,1,1):'<iframe name="google_conversion_frame" width="'+(a.google_conversion_format==2?200:300)+'" height="'+(a.google_conversion_format==
2?26:13)+'" src="'+c+'" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no">'+g(c.replace(/\?random=/,"?frame=0&random="),1,1)+"</iframe>"};var t=window;
if(t)if(/[\?&;]google_debug/.exec(document.URL)!=b){var u=document.getElementsByTagName("head")[0];if(!u){u=document.createElement("head");document.getElementsByTagName("html")[0].insertBefore(u,document.getElementsByTagName("body")[0])}var v=document.createElement("script");v.src=p(window,"conversion_debug_overlay.js");u.appendChild(v)}else{try{var w;if(t.google_conversion_type=="landing"||!t.google_conversion_id)w=false;else{t.google_conversion_date=new Date;t.google_conversion_time=t.google_conversion_date.getTime();
if(typeof t.google_conversion_snippets=="number"&&t.google_conversion_snippets>0)t.google_conversion_snippets+=1;else t.google_conversion_snippets=1;if(typeof t.google_conversion_first_time!="number")t.google_conversion_first_time=t.google_conversion_time;t.google_conversion_js_version="6";if(t.google_conversion_format!=0&&t.google_conversion_format!=1&&t.google_conversion_format!=2&&t.google_conversion_format!=3)t.google_conversion_format=1;w=true}w&&document.write(s(t,navigator,document))}catch(x){}t.google_conversion_date=
b;t.google_conversion_time=b;t.google_conversion_js_version=b;t.google_conversion_id=b;t.google_conversion_value=b;t.google_conversion_label=b;t.google_conversion_language=b;t.google_conversion_format=b;t.google_conversion_color=b;t.google_conversion_type=b;t.google_conversion_order_id=b};})();

