/*-----------------------/---------------------------------------------------------------
	JS Document (JavaScript/JScript)

	project:	Metaxa
	created:	2008-06-23 (yyyy-mm-dd)
	version:	1.0
	author:		Yves Van Goethem
	email:		yvangoethem@digitas.com
	website:	http://www.digitas.fr
				
	dependencies:	pnghack-1.0.2.js
					jquery-1.2.3.min.js
					jquery-flash-1.0.js
					jquery.dimensions.min.js
					jquery.jcarpisem.pack.js	
					jquery.jScrollPane.min.js
					jquery.mousewheel.min.js
					
	summary:	CONSTANTES
				ONLOAD
				PNGHACK
				PRINT
				RATING
				SELECT_SKIN
				SCROLL_SKIN
				COCKTAIL_CARROUSEL
				NEWS_HOME
				POPIN
				CLEARCLICK
				DIAPORAMA
				FAQ
				IE_NAVBAR
-------------------------------------------------------------------------------------- */


/*	=CONSTANTES
-------------------------------------------------------------------------------------- */
var ph 			= new PNGHack(IMG_DIR+'common/spacer.gif');
var ttl_print 	= LABEL_BT_PRINT;
var close_popin = IMGLANG_DIR+'popin/close.gif';
var ajax_load	= IMG_DIR+'common/ajaxload.gif';

/*	=ONLOAD
-------------------------------------------------------------------------------------- */
jQuery(document).ready(function(){
	jQuery('body').addClass('javascript-true');
	catchPNGImages();
	setNavBar();		// handles IE nav bar
	initPNGHack();		// launches PNGHack
	initPrintLink();	// sets print links
	initStarRating();	// launches the rating
	initCocktails();	// sets arrows and actives scroll
	initNewsHP();		// sets the events on news menu
	initPopins();		// sets popin links
	skinSelect();		// skins selects
	skinScroll();		// skins scrolls
	clearClick();		// removes value on focus
	initDiaporamaPUB();	// launches diaporama
	initDiaporama()
	getFAQAnswer();		// sets javascript on FAQ
	

});

function catchPNGImages(){
	
	var catchArray = new Array();
	
	jQuery("img[src$=png][class!=hack-png]").each(function(){
		catchArray.push(jQuery(this).attr("src"));
		jQuery(this).addClass("hack-png");
	});
	
	//console.log(catchArray);
	
	
	
}
function recallJavascript() {
	initPNGHack();		// launches PNGHack
	skinSelect(true);	// skins selects
	clearClick();		// removes value on focus
	initDiaporamaPUB();
	initDiaporama()// launches diaporama
}


jQuery(document).keyup(function(e){
	if (e.keyCode == 27) {
		if (jQuery('#content-popin')[0] && jQuery('#content-popin a.close')[0])
			closePopin();
	}
});


/*	=PNGHACK
-------------------------------------------------------------------------------------- */
function initPNGHack() {
	ph.hackClass(); 	// hacks elements using the class "hack-png" as the logo
	ph.hackExtension(); // hacks elements ending in .PNG as the cocktails pictures
}


/*	=PRINT
-------------------------------------------------------------------------------------- */
function initPrintLink() {
	if (jQuery('.interactif')[0]) {
		var target = jQuery('.interactif ul li');
		target.after('<li><a href="javascript:window.print();">'+ttl_print+'</a></li>');
	}
}


/*	=RATING
-------------------------------------------------------------------------------------- */
function initStarRating() {
	if (jQuery('.star-rating')[0]) {
		
		var ratings = jQuery('.star-rating ul');
		var stars 	= jQuery('.star-rating li');
		var star_active;
		var tmp = jQuery('.star-rating li.on');
		var userAllowVote = null;
		
		var setAverageNote = function() {
			var responseText = jQuery.ajax({
				url: "/index.php?coe_i_id="+COE_I_ID+"&fk_site="+FK_SITE+"&ctrl=misc&act=getaveragenote",
				async: false
			}).responseText;
			var note = responseText.split(',')[0];
			userAllowVote = responseText.split(',')[1];
			jQuery("#star"+note).addClass('on');
		}(); // function launches hisself with ();
		
		var savePersonalNote = function(noteClick) {
			var averageNote = jQuery.ajax({
				url: "/index.php?coe_i_id="+COE_I_ID+"&fk_site="+FK_SITE+"&ctrl=misc&act=vote&n="+noteClick,
				async: false
			}).responseText;
		
			// update star
			//remove all class on
			//jQuery(".actif li").removeClass("on")
			
			// add class on the star average
			//jQuery("#star"+averageNote).addClass("on");
		};
		
		jQuery('.star-rating li a').attr('href','javascript:void(0);');
		
		if (jQuery('.star-rating li.actif')) {
			ratings.bind('mouseover',function(){
				if (tmp[0]) {
					jQuery('.star-rating li').removeClass('on');
				}
				jQuery(this).bind('mouseout',function(){
					if(tmp) tmp.addClass('on');
				});
				jQuery(this).bind('mousedown',function(){
					tmp = null;
					ratings.unbind('mouseover');
				});
			});
		}
		
		stars.each(function() {
			if (userAllowVote != 'false') {
				jQuery(this).bind('click', function(){
					if (star_active == null) {
						star_active = jQuery(this);
						jQuery(this).addClass('on');
						ratings.removeClass('actif');
					}
					savePersonalNote(jQuery(this).text());
					return false;
				});
			}
			else {
				ratings.removeClass('actif');
				ratings.unbind('mouseover');
			}
		});
		
	}
}
	
/*	=DISTRIBUTOR
-------------------------------------------------------------------------------------- */

/**
* Ajax call to get ditributor informations
*/
function changeDistributor(oSelect,coe_i_id,lang)
{
	id = oSelect.options[oSelect.selectedIndex].value;
	
	var html = $.ajax({
	 url: "/index.php?coe_i_id="+coe_i_id+"&ctrl=formajax&act=getdistributorinfo&id="+id+"&lang="+lang,
	 async: false
	}).responseText;
	
	var oDistributorDetail = jQuery('#distributorDetail');
	
	oDistributorDetail.empty();
	oDistributorDetail.append(html);
}


/*	=SELECT_SKIN
-------------------------------------------------------------------------------------- */
function skinSelect(popin) {
	
	// only allow browsers compatible with inline-block
	// Fx 3, IE 7, Safari 2/3 Mac
	if ((navigator.userAgent.match(/\bFirefox\/3\b/))
	|| (navigator.userAgent.match(/\bMSIE 7.0\b/))
	|| (jQuery.browser.safari && !navigator.platform.match(/\bWin.+\b/))) {
		var config = {
			class_right : {
				0 : 'style-select-r-0',
				1 : 'style-select-r-1',
				2 : 'style-select-r-2'
			},
			class_left : {
				0 : 'style-select-l-0',
				1 : 'style-select-l-1',
				2 : 'style-select-l-2'
			},
			class_value	: 'select-value'
		};
		
		if (!popin)
			var parent = jQuery('select');
		else
			var parent = jQuery('#content-popin select');
	    parent.each(function(i) {
	    	var select = jQuery(this);
	    	select.wrap('<span class="'+config.class_left[0]+'"></span>').wrap('<span class="'+config.class_right[0]+'"></span>')
			select.before('<span class="'+config.class_value+'"> </span>').each(function() {
	        	select.prev().text(this.options[0].innerHTML);
	        	var x = jQuery(this).css('width');
	        	select.prev().css('width', jQuery(this).css('width')).css('height',jQuery(this).css('height'));
	        	if (jQuery.browser.msie && jQuery.browser.version == '7.0') {
	        		select.parent().css('width', jQuery(this).css('width')).css('height',jQuery(this).css('height'));
	        		select.parent().parent().css('width', jQuery(this).css('width')).css('height',jQuery(this).css('height'));
	        	}
	        });
	        var styleSelect = function(method, nb) {
				select.parents('.'+config.class_right[0])[method](config.class_right[nb]);
				select.parents('.'+config.class_left[0])[method](config.class_left[nb]);
	        };
			var keySelect = function(val) {
				if (val[0]) {
					var selectedOption = val.prev();
					var that = val[0];
					selectedOption.text(that.options[that.selectedIndex].innerHTML);
				}
			};
	        if (select[0].disabled)
				styleSelect('addClass',2);
			else {
				select.focus(function(){styleSelect('addClass',1);}).mouseover(function(){styleSelect('addClass',1);});
				select.blur(function(){styleSelect('removeClass',1);}).mouseout(function(){styleSelect('removeClass',1);});
				select.click(function() { keySelect(select); }).keypress(function() { keySelect(select); });
				keySelect(select);
			}
		});
	}
}


/*	=SCROLL_SKIN
-------------------------------------------------------------------------------------- */
var skinScroll = function() {
	_launch = function() {
		var pageWidth = null;
		if (jQuery(".scroll-pane")[0]) {
			
			pageWidth = parseInt(jQuery('.scroll-pane img').width());
			if (jQuery.browser.msie && jQuery.browser.version == '6.0')
				pageWidth = pageWidth - 2000;
			
			jQuery(".scroll-pane").jScrollPane({
				showArrows:false,
				scrollbarWidth:907,
				scrollbarHeight:15,
				scrollbarMargin:0,
				dragMinHeight:15,
				dragMaxHeight:15,
				direction:"horizontal",	
				trackHeight:907,
				blockWidth:pageWidth
			});
			
			jQuery(document.body).addClass('wideScroll');
			jQuery('#content').css('overflow','visible');
			jQuery('#content').css('width','2000px');
			jQuery('html').height('100%');
			jQuery('body').height('100%');
			
			posScroll();
			jQuery(window).resize(function(){
				posScroll();
			});
			// var x = setInterval(function() {
			// 				posScroll();
			// 			},500);
			// 			jQuery(window).unload(function(){
			// 				clearInterval(x);
			// 			});
		}
	};
	_launch();
};

var posScroll = function() {
	var imgHeight = 116
	var viewWidth = jQuery('#main').outerWidth();
	// bug IE bizare, le wiewWidth passe a 6268 une fois que la dimension de la fenetre passe sous la barre des 1400px
	if (jQuery.browser.msie && jQuery.browser.version == 6)
		viewWidth = 1400;
	var scrollWidth = jQuery('.jScrollPaneTrack').outerWidth();
	var contentWidth = jQuery('#main .jScrollPaneContainer img').width();
	
	var marginPos = (parseInt(viewWidth,10) - parseInt(scrollWidth,10))/2+'px';
	jQuery('.jScrollPaneTrack').css('margin-left',marginPos);
	jQuery('#breadcrump').css('margin-left',marginPos);
	jQuery('#main h1').css('margin-left',marginPos);
	jQuery('#main h1').height(imgHeight);
	// var hHeight = jQuery('h1 img').height();
	// jQuery('h1').height(hHeight);
};


/*	=COCKTAIL_CARROUSEL
-------------------------------------------------------------------------------------- */
function initCocktails() {
	if (jQuery('#a-la-carte')[0]) {
		jQuery('.a-la-carte').jcarousel({
			scroll : 10
		});
	}
}


/*	=NEWS_HOME
-------------------------------------------------------------------------------------- */
function initNewsHP() {
		
	jQuery(".news-box div[class='news list']").hide();
	oDivNews1 = document.getElementById('news1');
	if(!oDivNews1) return;
	
	document.getElementById('news1').style.display = 'block';

	if (jQuery('.choose')[0]) {
		jQuery('.choose ul li a').click(		
										
			function(){
				
				jQuery('.choose ul li').removeClass('actif');
				$(this).parent().addClass('actif');
				
				jQuery(".news-box div[class='news list']").hide();
				
				var sTemp = "news" + $(this).html();
				
				document.getElementById(sTemp.toString()).style.display = 'block';
		   
			}
	
		);
	}
			
}


/*	=POPIN
-------------------------------------------------------------------------------------- */
function initPopins() {
	jQuery('a.popin').click(function(){
		launchPopin(jQuery(this).attr('href'),null,false);
		jQuery(this).blur();
		return false;
	});
	
	jQuery('form.popin').submit(function() {
		launchPopin(jQuery(this).attr('action'),true,jQuery(this).find('select').get());
		jQuery(this).blur();
		return false;
	});
}

function launchPopin(link, close, params) {
	
	link = encodeURI(link); // avoid greek url error or other special charset
	
	var xH = document.documentElement.scrollHeight+'px';
	jQuery('body').prepend('<div id="popin-background"></div><div id="content-popin"><img src="'+ajax_load+'" alt="Loading ..." class="ajaxload" /></div>');

	jQuery('#content-popin').load(link,params,function(){
		
		var background = jQuery('#popin-background');
		var content = jQuery('#content-popin');
		var popin = jQuery('#load-popin');
		var tmp = popin.clone();
		
		content.empty();
		content.append(tmp);
		
		background.height(xH)

		var popin = jQuery('#load-popin');
		var marginLeft = '-'+parseInt(popin.css('width'))/2+'px';
		popin.css('margin-left',marginLeft);
		
		if (close != false) {
			popin.prepend('<a href="#" class="close"><img src="'+close_popin+'" alt="close" /></a>');
			jQuery('.close').click(closePopin);
		}
		
		// VERIFY POPIN IDENTIFY -> bug ie
		if (jQuery('#profilCurrentSite')[0])
			jQuery('#profilCurrentSite')[0].selected = true
		
			recallJavascript();
			initSubmitFormInPopin();
			tvAds();
		
		
		if (jQuery.browser.msie && jQuery.browser.version == '6.0') {
			jQuery('select').css('visibility', 'hidden');
			jQuery('#content-popin select').css('visibility', 'visible');
		}
		
	
	});
}

function reloadPopin(data, close) {
	var parent = jQuery('#content-popin');
	var content = getBoxInString(data, 'load-popin')
	parent.empty();
	parent.append(content);
	var popin = jQuery('#load-popin');
	var marginLeft = '-'+parseInt(popin.css('width'))/2+'px';
	popin.css('margin-left',marginLeft);

	if (close != false) {
		popin.prepend('<a href="#" class="close"><img src="'+close_popin+'" alt="close" /></a>');
		jQuery('.close').click(closePopin);
	}
	
	recallJavascript();
	initSubmitFormInPopin();
}

function closePopin() {
	/*if (jQuery('.popin-diaporamaPUB')[0]) {
		posScroll();
		document.body.style.overflowY = 'visible';
	}
	*/
	
	if (jQuery.browser.msie && jQuery.browser.version == '6.0'){
		jQuery('select').css('visibility', 'visible');
	}
	
	jQuery('#popin-background').remove();
	jQuery('#content-popin').remove();
	
	return false;
}

//Initialisation du click sur le bouton valider du formulaire
var initSubmitFormInPopin = (function () {
	jQuery(".formInPopin").bind("submit", function(){
		submitFormInPopin();
		return false;
	});
});

//Submission du formulaire
var submitFormInPopin = (function () {
	var myForm = jQuery(".formInPopin");
	
	var result = "";
	jQuery(".formInPopin input[@type=hidden]").each(function() {
		result += jQuery(this).attr("name")+"="+encodeURIComponent(jQuery(this).val())+"&";
	});
	jQuery(".formInPopin input[@type=text]").each(function() {
		result += jQuery(this).attr("name")+"="+encodeURIComponent(jQuery(this).val())+"&";
	});
	jQuery(".formInPopin input[@type=radio]:checked").each(function() {
		result += jQuery(this).attr("name")+"="+jQuery(this).val()+"&";
	});
	jQuery(".formInPopin input[@type=checkbox]:checked").each(function() {
		result += jQuery(this).attr("name")+"="+jQuery(this).val()+"&";
	});
	jQuery(".formInPopin select").each(function() {
		result += jQuery(this).attr("name")+"="+jQuery(this).val()+"&";
	});
	jQuery(".formInPopin textarea").each(function() {
		result += jQuery(this).attr("name")+"="+encodeURIComponent(jQuery(this).val())+"&";
	});
	//Envoie les donnees saisies au serveur
   	jQuery.ajax({
		type:"POST",
		url: myForm.attr("action"),
		data: result,
		success:function(response) {
			reloadPopin(response);
			// alert(response);
			// ADD EVENT
			//initSubmitFormInPopin();
		}
	}); 
});

var getBoxInString = function(data, id) {
    var start = data.indexOf('<div id="'+id);
    var end = data.indexOf('<br class="'+id);
    var length = end - start;
    data = data.substr(start, length);
    return data;
};


/*	=CLEARCLICK
-------------------------------------------------------------------------------------- */
function clearClick() {
	jQuery('.clear-click').click(function() {
		var tmp = jQuery(this).val();
		jQuery(this).val('');
		jQuery(this).blur(function() {
			if (jQuery(this).val() == '')
				jQuery(this).val(tmp);
		});
	});
}


/*	=DIAPORAMA
-------------------------------------------------------------------------------------- */
function initDiaporamaPUB() {
	if (jQuery('.diaporamaPUB')[0]) {
		//jQuery('.diaporama .show div > div').css('display','none');
		//jQuery('.diaporama .show div > div > div').css('display','block');
		/*if (window.location.hash.match(/#image/)) {
			var nb = window.location.hash.split('#image')[1]-1;
			jQuery('.diaporama .show div > div')[nb].style.display = 'block';
			jQuery('.diaporama .select a:eq('+nb+')').fadeTo('fast',0.3)
		}
		else {
			jQuery('.diaporama .show div > div')[0].style.display = 'block';
			jQuery('.diaporama .select a:first').fadeTo('fast',0.3)
		}
		*/
		

		
		jQuery('.diaporamaPUB .select ul').jcarousel({
					start:1					  
		});
		
		var firstPath = jQuery('.diaporamaPUB .select ul li:first a').attr("href");
		
		
		jQuery('.diaporamaPUB .select ul li:first a').fadeTo('fast',0.3, function(){
				jQuery("#flashInside").flash({
						src:'/FRONT/METAXA/client/swf/playerVideo_big.swf',
						width:500,
						height:374,
						wmode:'transparent',
						version:8,
						flashvars:{
							videoPath: firstPath
						}
					});																	   
																			   
																			   
																			   
		});
		
		jQuery('.diaporamaPUB .select ul a').click(function() {
			var myVideo = jQuery(this).attr("href");
			jQuery('.diaporamaPUB .select a').fadeTo('fast',1);
			jQuery(this).fadeTo('fast',0.3);
	
														 
			jQuery(".flashLoader").empty();
			jQuery(".flashLoader").append("<p>Video loading please wait...</p>");
			jQuery(".flashLoader").load("/FRONT/METAXA/templates/statique/video1.html",{}, function(){
				
					jQuery("#flashInside").flash({
						src:'/FRONT/METAXA/client/swf/playerVideo_big.swf',
						width:500,
						height:374,
						wmode:'transparent',
						version:8,
						flashvars:{
							videoPath: myVideo
						}
					});													
			});
			
			return false;
		});
	}
	
}





function initDiaporama() {
	if (jQuery('.diaporama')[0]) {
		//jQuery('.diaporama .show div > div').css('display','none');
		//jQuery('.diaporama .show div > div > div').css('display','block');
		/*if (window.location.hash.match(/#image/)) {
			var nb = window.location.hash.split('#image')[1]-1;
			jQuery('.diaporama .show div > div')[nb].style.display = 'block';
			jQuery('.diaporama .select a:eq('+nb+')').fadeTo('fast',0.3)
		}
		else {
			jQuery('.diaporama .show div > div')[0].style.display = 'block';
			jQuery('.diaporama .select a:first').fadeTo('fast',0.3)
		}
		*/
		

		
		jQuery('.diaporama .select ul').jcarousel({
					start:1					  
		});
		
		jQuery('.diaporama .select ul li:first a').fadeTo('fast',0.3);
		
		jQuery('.diaporama .select ul a').click(function() {
			
			jQuery('.diaporama .select a').fadeTo('fast',1);
			jQuery(this).fadeTo('fast',0.3);
	
			jQuery('.diaporama .show div > div').css('display','none');
			jQuery(this.hash).css('display','block');
			// to show flash animation in a sub div (media video)
			jQuery(this.hash+' > div').css('display','block'); 
			
			return false;
		});
	}
	
}





	
/****************************************
 * CONTACT SPECIAL POPIN LINK TO FULLSIX
 ****************************************/
 
	/*
	* Ajax Form Submission
	* We don't use generic popin form handlers coz we post to external server @see popin.js
	*/
	function postContactData () 
	{   
	   var myForm = $(".formContact");
	
	   var result = "";
	   
	   $(".formContact input[@type=hidden]").each(function() {
	      result += $(this).attr("name")+"="+encodeURIComponent($(this).val())+"&";
	   })
	   
	   
	   $(".formContact input[@type=text]").each(function() {
	      result += $(this).attr("name")+"="+encodeURIComponent($(this).val())+"&";
	   })
	   
	   
		$(".formContact input[@type=radio]:checked").each(function() {
	      result += $(this).attr("name")+"="+$(this).val()+"&";
	   })
	   
		$(".formContact input[@type=checkbox]:checked").each(function() {
	      result += $(this).attr("name")+"="+$(this).val()+"&";
	   })
	   $(".formContact select").each(function() {
	      result += $(this).attr("name")+"="+encodeURIComponent($(this).val())+"&";
	   })
	   $(".formContact textarea").each(function() {
	      result += $(this).attr("name")+"="+encodeURIComponent($(this).val())+"&";
	   })
	   
	   //Envoie les donnees saisies au serveur
	   $.ajax({
	      type:"post",
	      url: myForm.attr("action"),
	      data: result,
	      dataType: "text", // important else we get a parseerror 
	      success:function(response) {
				
	      		if(response == '&ok=true')
	      		{
	      			document.getElementById('contactForm').style.display = 'none';
					document.getElementById('contactConfirmMessage').style.display = 'block';
	      		}
	      		else
	      		{
	      			document.getElementById('contactErrorMessage').style.display = 'block';
	      		}
	      }
	      
	   });  
	}
	
	/**
	* Check emailVision field and encode values before submission
	*/
	function checkContactForm()
	{   
		//reset error message
		document.getElementById('contactErrorMessage').style.display = 'none';
		
		var oForm 				= document.getElementById('contactForm');
		var filterEmail 		= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
		var oErrorLastname 		= document.getElementById('errorLabel_LASTNAME');
		var oErrorFirstname 	= document.getElementById('errorLabel_FIRSTNAME');
		var oErrorEmail 		= document.getElementById('errorLabel_EMAIL');
		var oErrorBirth 		= document.getElementById('errorLabel_BIRTH');
		var oErrorCountry 		= document.getElementById('errorLabel_COUNTRY');
		var oErrorSubject 		= document.getElementById('errorLabel_SUBJECT');
		var oErrorMessage	 	= document.getElementById('errorLabel_MESSAGE');
		var oErrorStatus 		= document.getElementById('errorLabel_STATUS');
		
		var isError = false;
		
		resetErrorLabel();
		
		// check
		if(oForm.lastname.value=='') 	
		{ oErrorLastname.innerHTML = LABEL_FORMERROR_LASTNAME;isError = true; }
		
		if(oForm.firstname.value=='') 
		{ oErrorFirstname.innerHTML = LABEL_FORMERROR_FIRSTNAME;isError = true; }
		
		if(oForm.birthMonth.value=='' || oForm.birthDay.value=='' || oForm.birthYear.value=='') 	
		{ oErrorBirth.innerHTML = LABEL_FORMERROR_EMPTY;isError = true; }
				
		if(oForm.email.value=='') 	
		{ oErrorEmail.innerHTML = LABEL_FORMERROR_EMAIL;isError = true; }
		else if(!filterEmail.test(oForm.email.value)) 
		{ oErrorEmail.innerHTML =LABEL_FORMERROR_EMAIL_INVALID;isError = true; }
		
		if(oForm.countryId.value=='') 	
		{ oErrorCountry.innerHTML = LABEL_FORMERROR_COUNTRY;isError = true; }
		
		if(oForm.subjectId.value=='') 	
		{ oErrorSubject.innerHTML = LABEL_FORMCONTACT_SUBJECT_ERROR;isError = true; }
		
		if(oForm.message.value=='') 
		{ oErrorMessage.innerHTML = LABEL_FORMCONTACT_REQUEST_ERROR;isError = true; }
		
		if(!oForm.status.checked) 
		{ oErrorStatus.innerHTML = LABEL_FORMERROR_AGREEMENT;isError = true; }
	
		//////////////////////////////////////////////////
		// cancel submission if there is some errors
		if(isError) 
		{
			return false;
		}
		else	    
		{	// we remove class that auto add submission handler to manually handle fullsix submission
			postContactData(); // form ajax submission to fulsix server
			return false; // no submission -> only display the confirmation message
		}
		
	}
	
	
	/**
	* Reset error label for each submission
	*/
	function resetErrorLabel()
	{   
		var oErrorLastname 		= document.getElementById('errorLabel_LASTNAME');
		var oErrorFirstname 	= document.getElementById('errorLabel_FIRSTNAME');
		var oErrorEmail 		= document.getElementById('errorLabel_EMAIL');
		var oErrorBirth 		= document.getElementById('errorLabel_BIRTH');
		var oErrorCountry 		= document.getElementById('errorLabel_COUNTRY');
		var oErrorSubject 		= document.getElementById('errorLabel_SUBJECT');
		var oErrorMessage	 	= document.getElementById('errorLabel_MESSAGE');
		var oErrorStatus 		= document.getElementById('errorLabel_STATUS');
		
		oErrorLastname.innerHTML = '';
		oErrorFirstname.innerHTML = '';
		oErrorEmail.innerHTML = '';
		oErrorBirth.innerHTML = '';
		oErrorCountry.innerHTML = '';
		oErrorSubject.innerHTML = '';
		oErrorMessage.innerHTML = '';
		oErrorStatus.innerHTML = '';
	}


/*	=FAQ
-------------------------------------------------------------------------------------- */
function getFAQAnswer() {
	if (jQuery('#faqForm')[0]) {
		jQuery('#faqForm select').change(function() {
			var pageId = this.options[this.selectedIndex].value;
			window.location = jQuery('#faqForm').attr('action')+'&q='+pageId;
		});
	}
}

/*	=TVADS
-------------------------------------------------------------------------------------- */
function tvAds() {
	//if (jQuery('.popin-diaporamaPUB')[0]) {
		//jQuery('.popin-diaporamaPUB').jcarousel({
			//scroll : 3
		//});
		// jQuery('.jcarousel-item a').click(function() {
		// 			alert(jQuery('.header-style')[0]);
		// 			jQuery('.header-style')[0].scrollTop = 0;
		// 		});
		/*
			Bug sur IE 7, la scrollbar de l'element HTML ne permet pas de scroller.
			Ajout provisoir d'une scroll sur BODY pour permettre à l'utilisateur de scroller.
			A mettre a jour rapidement.
		*/
		//document.body.style.overflowY = 'scroll';
	//}
}


/*	=IE_NAVBAR
-------------------------------------------------------------------------------------- */
function setNavBar() {
	if (jQuery.browser.msie && jQuery.browser.version == '6.0') {
		if (jQuery('#nav > ul.open')[0]) {
			var nav_width = jQuery('#nav').width();
			jQuery('#nav ul.open li.on ul').css('width',nav_width);
		}
	}
	else {
		if (jQuery('#nav > .open > li').eq(0).hasClass('on')
		|| jQuery('#nav > .open > li').eq(1).hasClass('on')) {
			jQuery('#nav > .open > li.on > ul').css('text-align','left');
		}
	}
}
