if(ROQ === undefined) {
	var ROQ = {};
}

//ajout de class
ROQ.tools = {
	hasClass: function(n, v) {
		var a = ' '+n.className+' ';
		if(a == '  ') {return false;}
		return (a.indexOf(' '+v+' ') == -1) ? false : true;
	},
	addClass: function(n, v) {
		if(this.hasClass(n, v)) {return false;}
		n.className += n.className ? ' '+v : v;
		return true;
	},
	removeClass: function(n, v) {
		if(!this.hasClass(n, v)) {return false;}
		var r = (n.className.indexOf(' '+v) != -1) ? ' '+v : v;
		n.className = n.className.replace(r, '');
		return true;
	}
}

// changer le contexte d'execution
if(!Function.prototype.context && Function.prototype.apply) {
	Function.prototype.context = function(context) {
		var that = this;
		var args = [];
		if(arguments.length > 1) {
			for(var i = 1, arg; arg = arguments[i]; i++) {
				args[args.length] = arg;
			}
		}
		return function() {
			that.apply(context, args);
		};
	}
}

// corrige les PNGs sur IE5.5 et IE6
ROQ.fixPNG = {
	init: function(){
		// test IE
		if(document.all != null && window.opera == null){
			// test IE 6
			if(window.XMLHttpRequest == null && document.implementation != null && document.compatMode != null){
				// récupération des images
				var imgs = document.getElementsByTagName('img');
				for(var i = 0, img; img = imgs[i]; i++){
					if(/png$/i.test(img.src)){
						var src = img.src;
						img.src = '/argosSites/roquette_common/images/common/dot.gif';
						img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='image');";
					}
				}
			}
		}
	}
};

// gestion de la navigation sur la home corp
ROQ.displayBannerCorp = {
	activelink: null,
	content: null,
	init: function(){
		if(document.body.parentNode.id == "corporate" && document.body.id == "home"){
			ROQ.displayBannerCorp.content = document.getElementById("content");
			if(!ROQ.displayBannerCorp.content){return;}
			var list = ROQ.displayBannerCorp.content.getElementsByTagName('ul')[0];
			var links = list.getElementsByTagName('li');
			for(var i = 0, link; link = links[i]; i++){
				ROQ.addListener(link, 'mouseover', ROQ.displayBannerCorp.change);
			}
			ROQ.addListener(list, 'mouseout', ROQ.displayBannerCorp.hide);
		}
	},
	change: function(){
		var imagelink = this.getElementsByTagName('img')[0];
		if(ROQ.displayBannerCorp.activelink && ROQ.displayBannerCorp.activelink != imagelink){
			ROQ.displayBannerCorp.activelink.src = ROQ.displayBannerCorp.activelink.src.replace('-on.gif', '.gif');
		}
		if(imagelink.src.indexOf("-on.gif") == -1){
			imagelink.src = imagelink.src.replace(".gif", "-on.gif");
			ROQ.displayBannerCorp.activelink = imagelink;
		}
			ROQ.displayBannerCorp.content.className = "mainpush-"+this.id.substring(11);
	},
	hide: function(){
		if(ROQ.displayBannerCorp.activelink){
			ROQ.displayBannerCorp.activelink.src = ROQ.displayBannerCorp.activelink.src.replace('-on.gif', '.gif');
			ROQ.displayBannerCorp.activelink = "";
		}
		ROQ.displayBannerCorp.content.className = "";
	}
}

// gestion des pushs focus sur les homes
ROQ.displayFocusHome = {
	init: function(){
		if(document.body.id == "home"){
			var focusbloc = document.getElementById('focus');
			if(!focusbloc){return;}
			pushs = focusbloc.getElementsByTagName('div');
			/*for(var i = 0, push; push = pushs[i]; i++){
				if(push.className!='pushFlash') {
					ROQ.addListener(push, 'mouseover', ROQ.displayFocusHome.lighten);
					ROQ.addListener(push, 'mouseout', ROQ.displayFocusHome.darken);
					ROQ.addListener(push, 'click', ROQ.displayFocusHome.click);
				}
			}*/
		}
	},
	lighten: function(){
		ROQ.tools.addClass(this, "on");
	},
	darken: function(){
		ROQ.tools.removeClass(this, "on");
	},
	click: function(){
	
			if(this.getElementsByTagName('a')[0] != undefined) {
				var destination = this.getElementsByTagName('a')[0].href;
				location.href = destination;
			}
	}
}

// gestion des pushs news sur les homes
ROQ.displayNewsHome = {
	activelink: null,
	init: function(){
		if(document.body.id == "home"){
			var newsbloc = document.getElementById('news');
			if(!newsbloc){return;}
			pushs = newsbloc.getElementsByTagName('h3');
			for(var i = 0, push; push = pushs[i]; i++){
				if(ROQ.tools.hasClass(push.getElementsByTagName('a')[0], 'open')){
					ROQ.displayNewsHome.activelink = push;
				}
				ROQ.addListener(push, 'click', ROQ.displayNewsHome.click);
			}
		}
	},
	click: function(e){
		var link = this.getElementsByTagName('a')[0];
		var push = this.nextSibling;
		var activepush = ROQ.displayNewsHome.activelink.nextSibling;
		while(push.nodeType != 1) {push = push.nextSibling;}
		while(activepush.nodeType != 1) {activepush = activepush.nextSibling;}
		if(ROQ.displayNewsHome.activelink && ROQ.displayNewsHome.activelink != link.parentNode){
			ROQ.tools.removeClass(ROQ.displayNewsHome.activelink.getElementsByTagName('a')[0], "open");
			ROQ.tools.removeClass(activepush, "open");
		}
		if(link.className != "open"){
			ROQ.tools.addClass(link, "open");
			ROQ.tools.addClass(push, "open");
			//ROQ.tools.addClass(link, "opened");
			//ROQ.displayNewsHome.activelink.getElementsByTagName('a')[0].onclick = ROQ.tools.removeClass(activepush, "open");
			ROQ.displayNewsHome.activelink = link.parentNode;
		}
		return false;
	}
}

// gestion des listes sur les articles
ROQ.displayListArticle = {
	init: function(){
		if(document.body.id == "article"){
			var content = document.getElementById("edito-texts");
			if(!content){return;}
			var blocks = content.getElementsByTagName("div");
			for(var i = 0, block; block = blocks[i]; i++){
				if(ROQ.tools.hasClass(block, "article")){
					ROQ.displayListArticle.managelist(block);
				}
			}
		}
	},
	managelist: function(article){
		var lists = article.getElementsByTagName("ul");
		if(!lists){return;}
		for(var i = 0, list; list = lists[i]; i++){
			if(ROQ.tools.hasClass(list, 'links')){
				ROQ.displayListArticle.managelinks(list);
			}
		}
	},
	managelinks: function(list){
		var links = list.getElementsByTagName("li");
		if(!links){return;}
		for(var i = 0, link; link = links[i]; i++){
			ROQ.addListener(link, 'click', ROQ.displayListArticle.click);
		}
	},
	click: function(){
		if(ROQ.tools.hasClass(this, 'open')){
			ROQ.tools.removeClass(this, "open");
		}
		else{
			ROQ.tools.addClass(this, "open");
		}
		return false;
	}
}

// gestion des tailles des legendes sur les articles
ROQ.checkLegendArticles = {
	init: function(){
		if(document.body.id == "article"){
			var content = document.getElementById("edito");
			if(!content){return;}
			var visuals = content.getElementsByTagName("img");
			for(var i = 0, visual; visual = visuals[i]; i++){
				if(ROQ.tools.hasClass(visual, 'zoom-visual')){
					ROQ.checkLegendArticles.resize(visual);
				}
			}
		}
	},
	 resize: function(image){
		var block = image.parentNode.parentNode;
		if(ROQ.tools.hasClass(block, 'visual')){
			block.style.width = image.width + 6 + 'px';
		}
	}
}

// gestion des zoom des images sur les articles
ROQ.ZoomImagesArticles = {
	init: function(){
		if(document.body.id == "article" || document.body.id == "sousrubrique" ){
			var content = document.getElementById("edito");
			if(!content){return;}
			var visuals = content.getElementsByTagName("img");
			for(var i = 0, visual; visual = visuals[i]; i++){
				if(ROQ.tools.hasClass(visual, 'zoom-visual')){
					ROQ.ZoomImagesArticles.manage(visual);
				}
			}
		}
	},
	manage: function(image){
		var link = image.parentNode.getElementsByTagName("a")[0];
		ROQ.addListener(link, 'click', ROQ.ZoomImagesArticles.show);
	},
	show: function(){
		/* creation du masque */
		var PageSize = document.getElementById("page").offsetHeight;
		var mask = document.createElement("div");
		mask.id = "mask";
		mask.style.height = PageSize + "px";
		/* creation de la popin */
		var popin = document.createElement("div");
		popin.id = "popin-zoom";
		/* creation de l'image */
		/*var linkvisual = this.parentNode.getElementsByTagName("img")[0];
		if(!linkvisual){return;}
		var posvisual = linkvisual.src.lastIndexOf("/");*/
		/*linkvisual = linkvisual.src.substring(0 ,posvisual + 1) + "zoom-" + linkvisual.src.substring(posvisual +1);*/
		/*linkvisual = linkvisual.src.substring(0 ,posvisual + 1) + "" + linkvisual.src.substring(posvisual +1);*/
		var linkvisual = this.href;
		if(!linkvisual || linkvisual == '#')
			return false;
		var visual = document.createElement("img");
		visual.src = linkvisual;
		visual.alt = "";
		/* creation du lien de fermeture */
		var txtclose = document.createElement("a");
		txtclose.innerHTML = "Close";
		var linkclose = "javascript:ROQ.ZoomImagesArticles.hide('";
		linkclose += popin.id;
		linkclose += "')";
		txtclose.setAttribute("href", linkclose);
		/* ajout des elements dans la popin */
		popin.appendChild(visual);
		popin.appendChild(txtclose);
		/* masquer la popin */
		popin.style.marginLeft = "-10000px";
		/* affichage de la popin */
		document.body.className = "js";
		document.body.insertBefore(mask, document.getElementById("page"));
		document.body.insertBefore(popin, document.getElementById("page"));
		
		/* positionnement de la popin */
		var D = document;
		var W = window;
		var de = D.documentElement;
		var scrolledHeight = (W.pageYOffset || (de && de.scrollTop) || D.body.scrollTop);
		var scrolledWidth = (W.pageXOffset || (de && de.scrollLeft) || D.body.scrollLeft);
		popin.style.marginTop = (scrolledHeight + (-popin.offsetHeight/2)) + "px";
		popin.style.marginLeft = (scrolledWidth + (-popin.offsetWidth/2)) + "px";
		// relance le positionnement lorsque l'image est charg�e
		visual.onload = function(){
			popin.style.marginTop = (scrolledHeight + (-popin.offsetHeight/2)) + "px";
			popin.style.marginLeft = (scrolledWidth + (-popin.offsetWidth/2)) + "px";
		}
		return false;
	},
	hide: function(popin){
		document.body.className = "";
		document.body.removeChild(document.getElementById("mask"));
		document.body.removeChild(document.getElementById(popin));
	}
}

// gestion des listes du header et du footer
ROQ.showLists = {
	init: function(content){
		if(!Function.prototype.context) {return;}
		var selector = document.getElementById(content);
		if((!selector)){return;}
		var opener = selector.getElementsByTagName('a')[0];
		var list = selector.getElementsByTagName('ul')[0];
		if((!opener)||(!list)){return;}
		ROQ.addListener(opener, 'click', ROQ.showLists.show);
		ROQ.addListener(list, 'click', ROQ.showLists.hide);
	},
	show: function(e){
		var list = this.parentNode.parentNode.getElementsByTagName('ul')[0];
		ROQ.tools.addClass(list, "js");
		ROQ.showLists.mouseDownId = ROQ.addListener(document, 'mousedown', function(e, options) {
			var t = ROQ.getEventTarget(e);
			while(t.parentNode && t != list) {t = t.parentNode;}
			if(t != list) {
				ROQ.showLists.hide.context(list)();
			}
		});
		return false;
	},
	hide: function(){
		ROQ.tools.removeClass(this, "js");
		ROQ.removeListener(document, 'mousedown', ROQ.showLists.mouseDownId);
	}
}

// gestion de la navigation
ROQ.displayNavigation = {
	activeLink:null,
	
	init: function(){
		var menu = document.getElementById("navigation-list");
		var navlinks = menu.getElementsByTagName('li');
		if((!menu)||(!navlinks)){return;}
		for(var i = 0, navlink; navlink = navlinks[i]; i++){
			var link = navlink.getElementsByTagName('a')[0];
			if(link) {
				if(link.className == 'on') {
					ROQ.displayNavigation.activeLink = link;
				}
				if(navlink.className == "section"){
					ROQ.addListener(navlink, 'mouseover', ROQ.displayNavigation.show);
					ROQ.addListener(navlink, 'mouseout', ROQ.displayNavigation.hide);
				}
			}
		}
	},
	show: function(e){
		var link = this.getElementsByTagName('a')[0];
		var list = this.getElementsByTagName('ul')[0];
		ROQ.tools.addClass(link, "on");
		if(list)
			ROQ.tools.addClass(list, "js");
	},
	hide: function(){
		var link = this.getElementsByTagName('a')[0];
		var list = this.getElementsByTagName('ul')[0];
		if(link != ROQ.displayNavigation.activeLink) {
			ROQ.tools.removeClass(link, "on");
		}
		if(list)
			ROQ.tools.removeClass(list, "js");
	}
}

// Gestion du moteur de recherche
ROQ.GoSearch = {
	init: function(){
		var query = document.getElementById('search-field');
		if(!query){
			query = document.getElementById('searchfield');
			if(!query){
				return;
			}
		}
		query.onfocus = ROQ.GoSearch.clearValue;
		query.onblur = ROQ.GoSearch.restoreValue;
	},
	clearValue: function(){
		if(this.value == this.defaultValue) {this.value = '';}
	},
	restoreValue: function(){
		if(/^\s*$/.test(this.value)) {this.value = this.defaultValue;}
	}
}

// Gestion des onglets sur l'edito
ROQ.SlidesEdito = {
	editoposition: null,
	init: function(){

		ROQ.SlidesEdito.editolist = document.getElementById('edito-navigation-onglets');
		if(!ROQ.SlidesEdito.editolist){return;};
		ROQ.SlidesEdito.editoback = document.getElementById('edito-navigation-previous');
		ROQ.SlidesEdito.editonext = document.getElementById('edito-navigation-next');
		var editoitems = ROQ.SlidesEdito.editolist.getElementsByTagName("li");
		var editototal = editoitems.length;
		ROQ.SlidesEdito.editolist.style.width = editototal*142 +'px';
		ROQ.SlidesEdito.editominbloc = (editototal*142) - 568;
		if(editototal <= 5){return;}
		else{
			for(var i = 0, editoitem;  editoitem = editoitems[i]; i++){
				if(editoitem.className == "active"){
					if(ROQ.SlidesEdito.editoposition >= ROQ.SlidesEdito.editominbloc){
						ROQ.SlidesEdito.editoposition = ROQ.SlidesEdito.editominbloc;
						ROQ.SlidesEdito.editolist.style.left = -(ROQ.SlidesEdito.editominbloc) +'px';
					}
					else{
						ROQ.SlidesEdito.editolist.style.left = -(ROQ.SlidesEdito.editoposition) +'px';
					}
					break;
				}
				ROQ.SlidesEdito.editoposition += 142;
			}
			if(ROQ.SlidesEdito.editoposition > 0){
				if(ROQ.SlidesEdito.editoposition == (editototal*142)){
					ROQ.SlidesEdito.editoposition = 0;
				}
				else{
					ROQ.tools.addClass(ROQ.SlidesEdito.editoback, "js");
				}
			}
			if(ROQ.SlidesEdito.editoposition < ROQ.SlidesEdito.editominbloc){
				ROQ.tools.addClass(ROQ.SlidesEdito.editonext, "js");
			}
			ROQ.addListener(ROQ.SlidesEdito.editoback, 'click', ROQ.SlidesEdito.moveLeft);
			ROQ.addListener(ROQ.SlidesEdito.editonext, 'click', ROQ.SlidesEdito.moveRight);
		}
	},
	moveLeft: function(){
		if(ROQ.SlidesEdito.editoposition > 0){
			ROQ.SlidesEdito.editoposition -= 142;
			ROQ.SlidesEdito.editolist.style.left = -(ROQ.SlidesEdito.editoposition) +'px';
		}
		if(ROQ.SlidesEdito.editoposition == 0){
			ROQ.tools.removeClass(this, "js");
		}
		ROQ.tools.addClass(ROQ.SlidesEdito.editonext, "js");
		return false;
	},
	moveRight: function(){
		if(ROQ.SlidesEdito.editoposition < ROQ.SlidesEdito.editominbloc){
			ROQ.SlidesEdito.editoposition += 142;
			ROQ.SlidesEdito.editolist.style.left = -(ROQ.SlidesEdito.editoposition) +'px';
		}
		if(ROQ.SlidesEdito.editoposition == ROQ.SlidesEdito.editominbloc){
			ROQ.tools.removeClass(this, "js");
		}
		ROQ.tools.addClass(ROQ.SlidesEdito.editoback, "js");
		return false;
	}
};

ROQ.addListener(window, 'load', function(){
	ROQ.fixPNG.init();
	ROQ.showLists.init("othersites");
	ROQ.showLists.init("search_site_specific");
	ROQ.showLists.init("productwebsites");
	ROQ.showLists.init("container-pagesname");
	ROQ.displayNavigation.init();
	ROQ.GoSearch.init();
	ROQ.displayBannerCorp.init();
	ROQ.displayFocusHome.init();
	ROQ.displayNewsHome.init();
	ROQ.displayListArticle.init();
	ROQ.checkLegendArticles.init();
	ROQ.ZoomImagesArticles.init();
	ROQ.SlidesEdito.init();
});

// Fonctions popup advert (pdf)
var popup;
function openPopupAdvert (url,largeur,hauteur,pict){
gauche=(screen.width-largeur)/2;haut=(screen.height-hauteur)/2;
if (popup && !popup.closed) {popup.close();};
popup = window.open(url+"ressource_id-" + escape ( pict )+"/",'geWindow','scrollbars=yes,status=no,width='+largeur+',height='+hauteur+',top='+haut+',left='+gauche);
}

var popup;
function openpopupAdvert (url) {
	var w = screen.availWidth||screen.width
	var h = screen.availHeight||screen.height
	if (popup && !popup.closed) {popup.close();};
	popup =window.open(url,'visioWindow','scrollbars=1,width='+screen.availWidth+',height='+screen.availHeight);
}

// FORMULAIRES CONTACT US
function selectReload(value) {
	// /contact.html
	recontact = /\/[a-z]+.html/;
	strcontact = recontact.exec(document.location.href);
	
	if (strcontact == null) {
	
		// pas de /contact.html de trouv�
		re = /\/ajaxContact-(.*)\/s-([0-9])/;
		str = re.exec(document.location.href);
		
		var select = document.getElementById("contact-us");
		
		if (str == null) {
		
			document.location.href += "ajaxContact-"+value+"/s-"+select.options[select.selectedIndex].index+"/";
			//document.location.href += "ajaxContact-"+elt.value+"/s-"+elt.index+"/";
		} else {
		
			var href = document.location.href;
			var newhref = href.replace(re, "");
			
			document.location.href = newhref+"ajaxContact-"+value+"/s-"+select.options[select.selectedIndex].index+"/";
			//document.location.href = newhref+"ajaxContact-"+elt.value+"/s-"+elt.index+"/";
		}
	} else {
	
		//alert(strcontact[0]);
		var href = document.location.href;
		var newhrefcontact = href.replace(recontact, "");
		
		re = /\/ajaxContact-(.*)\/s-([0-9])/;
		str = re.exec(newhrefcontact);
		
		var select = document.getElementById("contact-us");
		
		if (str == null) {
		
			document.location.href = newhrefcontact+"/ajaxContact-"+value+"/s-"+select.options[select.selectedIndex].index+strcontact[0];
			//document.location.href = newhrefcontact+"/ajaxContact-"+elt.value+"/s-"+elt.index+strcontact[0];
		} else {
		
			var href = newhrefcontact;
			var newhref = href.replace(re, "");
			
			document.location.href = newhref+"/ajaxContact-"+value+"/s-"+select.options[select.selectedIndex].index+strcontact[0];
			//document.location.href = newhref+"/ajaxContact-"+elt.value+"/s-"+elt.index+strcontact[0];
		}
	}
}

function verif_contact(formulaire, lang) {

	send = true;
	
	if (lang == "FR") {
	
		msg = "Veuillez compl&eacute;ter les champs suivants :\n";
		/* if( formulaire.your_comments.value == '' ) {
		
			msg += "- votre message ";
			send = false;
		} */
		if( formulaire.contact_firstname.value == '' )
		{
			msg += "- votre pr&eacute;nom ";
			send = false;
		}
		if( formulaire.contact_lastname.value == '' )
		{
			msg += "- votre nom ";
			send = false;
		}
		//if ( ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test('hamster@les-argonautes.com') )
		if( formulaire.contact_email.value == '' || ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test(formulaire.contact_email.value) )
		{
			msg += "- votre email ";
			send = false;
		}
		if(formulaire.contact_phone.value == '') {
		
			msg += "- votre t&eacute;l&eacute;phone ";
			send = false;
		}
		if(formulaire.contact_function.value == '') {
		
			msg += "- votre fonction ";
			send = false;
		}
		// voir pour application : Food
		if(formulaire.contact_company.value == '') {
		
			msg += "- votre soci&eacute;t&eacute; ";
			send = false;
		}
		if(formulaire.contact_address.value == '') {
		
			msg += "- votre adresse ";
			send = false;
		}
		if( formulaire.contact_city.value == '' )
		{
			msg += "- votre ville ";
			send = false;
		}
		if(formulaire.contact_zipcode.value == '') {
		
			msg += "- votre code postal ";
			send = false;
		}
		if ( formulaire.contact_country.value == '' ) {
		
			msg += "- votre pays ";
			send = false;
		}
		if ( formulaire.ucmail.value == '-1' ) {
		
			msg += "- votre UC ";
			send = false;
		}
		if ( formulaire.security_code.value == '' ) {
		
			msg += "- le code de s&eacute;curit&eacute; ";
			send = false;
		}
		/*if ( !formulaire.contact_updating.checked ) {
		
			msg += "- the checkbox";
			send = false;
		}*/
		if( send == false )
		{
			var error = document.getElementById("list_error");
			error.innerHTML = msg;
			window.scrollTo(0,0);
			return false;
		}
		else 
			formulaire.submit();
	}
	
	if (lang == "GB") {
		
		msg = "Please, complete the following field(s) :\n";
		/* if( formulaire.your_comments.value == '' ) {
		
			msg += "- your message ";
			send = false;
		} */
		if( formulaire.contact_firstname.value == '' )
		{
			msg += "- your firstname ";
			send = false;
		}
		if( formulaire.contact_lastname.value == '' )
		{
			msg += "- your lastname ";
			send = false;
		}
		//if ( ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test('hamster@les-argonautes.com') )
		if( formulaire.contact_email.value == '' || ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test(formulaire.contact_email.value) )
		{
			msg += "- your email address ";
			send = false;
		}
		if(formulaire.contact_phone.value == '') {
		
			msg += "- your telephone ";
			send = false;
		}
		if(formulaire.contact_function.value == '') {
		
			msg += "- your function ";
			send = false;
		}
		// voir pour application : Food
		if(formulaire.contact_company.value == '') {
		
			msg += "- your company ";
			send = false;
		}
		if(formulaire.contact_address.value == '') {
		
			msg += "- your address ";
			send = false;
		}
		if( formulaire.contact_city.value == '' )
		{
			msg += "- your city ";
			send = false;
		}
		if(formulaire.contact_zipcode.value == '') {
		
			msg += "- your zip/postal code ";
			send = false;
		}
		if ( formulaire.contact_country.value == '' ) {
		
			msg += "- your country ";
			send = false;
		}
		if ( formulaire.ucmail.value == '-1' ) {
		
			msg += "- your Interest area ";
			send = false;
		}
		if ( formulaire.security_code.value == '' ) {
		
			msg += "- the security code ";
			send = false;
		}
		/*if ( !formulaire.contact_updating.checked ) {
		
			msg += "- the checkbox";
			send = false;
		}*/
		if( send == false )
		{
			var error = document.getElementById("list_error");
			error.innerHTML = msg;
			window.scrollTo(0,0);
			return false;
		}
		else 
			formulaire.submit();
	}
}

function verif_contact_no_country(formulaire, lang) {

	send = true;
	
	if (lang == "FR") {
	
		msg = "Veuillez compl&eacute;ter les champs suivants :\n";
		if( formulaire.your_comments.value == '' ) {
		
			msg += "- votre message ";
			send = false;
		}
		if( formulaire.contact_firstname.value == '' )
		{
			msg += "- votre pr&eacute;nom ";
			send = false;
		}
		if( formulaire.contact_lastname.value == '' )
		{
			msg += "- votre nom ";
			send = false;
		}
		//if ( ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test('hamster@les-argonautes.com') )
		if( formulaire.contact_email.value == '' || ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test(formulaire.contact_email.value) )
		{
			msg += "- votre email ";
			send = false;
		}
		if(formulaire.contact_phone.value == '') {
		
			msg += "- votre t&eacute;l&eacute;phone ";
			send = false;
		}
		if(formulaire.contact_function.value == '') {
		
			msg += "- votre fonction ";
			send = false;
		}
		// voir pour application : Food
		if(formulaire.contact_company.value == '') {
		
			msg += "- votre soci&eacute;t&eacute; ";
			send = false;
		}
		if(formulaire.contact_address.value == '') {
		
			msg += "- votre adresse ";
			send = false;
		}
		if( formulaire.contact_city.value == '' )
		{
			msg += "- votre ville ";
			send = false;
		}
		if(formulaire.contact_zipcode.value == '') {
		
			msg += "- votre code postal ";
			send = false;
		}
		if ( formulaire.ucmail.value == '-1' ) {
		
			msg += "- 'votre question concerne' ";
			send = false;
		}
		if ( formulaire.security_code.value == '' ) {
		
			msg += "- le code de s&eacute;curit&eacute; ";
			send = false;
		}
		/*if ( !formulaire.contact_updating.checked ) {
		
			msg += "- the checkbox";
			send = false;
		}*/
		if( send == false )
		{
			var error = document.getElementById("list_error");
			error.innerHTML = msg;
			window.scrollTo(0,0);
			return false;
		}
		else 
			formulaire.submit();
	}
	
	if (lang == "GB") {
		
		msg = "Please, complete the following field(s) :\n";
		if( formulaire.your_comments.value == '' ) {
		
			msg += "- your message ";
			send = false;
		}
		if( formulaire.contact_firstname.value == '' )
		{
			msg += "- your firstname ";
			send = false;
		}
		if( formulaire.contact_lastname.value == '' )
		{
			msg += "- your lastname ";
			send = false;
		}
		//if ( ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test('hamster@les-argonautes.com') )
		if( formulaire.contact_email.value == '' || ! /^[\.a-zA-Z0-9_-]+@[\.a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/.test(formulaire.contact_email.value) )
		{
			msg += "- your email address ";
			send = false;
		}
		if(formulaire.contact_phone.value == '') {
		
			msg += "- your telephone ";
			send = false;
		}
		if(formulaire.contact_function.value == '') {
		
			msg += "- your function ";
			send = false;
		}
		// voir pour application : Food
		if(formulaire.contact_company.value == '') {
		
			msg += "- your company ";
			send = false;
		}
		if(formulaire.contact_address.value == '') {
		
			msg += "- your address ";
			send = false;
		}
		if( formulaire.contact_city.value == '' )
		{
			msg += "- your city ";
			send = false;
		}
		if(formulaire.contact_zipcode.value == '') {
		
			msg += "- your zip/postal code ";
			send = false;
		}
		if ( formulaire.ucmail.value == '-1' ) {
		
			msg += "- your Interest area ";
			send = false;
		}
		if ( formulaire.security_code.value == '' ) {
		
			msg += "- the security code ";
			send = false;
		}
		/*if ( !formulaire.contact_updating.checked ) {
		
			msg += "- the checkbox";
			send = false;
		}*/
		if( send == false )
		{
			var error = document.getElementById("list_error");
			error.innerHTML = msg;
			window.scrollTo(0,0);
			return false;
		}
		else 
			formulaire.submit();
	}
}

function contact_presence(continent, cityID) {
	
	//alert("IE6");
	
	if (continent && cityID) {
	
		list_contact_presence(continent, cityID);
	}
	
	var list = document.getElementById("list");
	list.style.display = "none";
	
	var formulaire = document.getElementById("formulaire");
	formulaire.style.display = "block";
	
	return false;
}

function list_contact_presence(continent, cityID) {

	$.ajax({
		type: "GET",
		url: '/delia-CMS/listcontinentsite/continent-'+continent+'/site-'+cityID+'/',
		success: function(retour){
			
			if ($.browser.msie) {
			
				// IE
				document.getElementById("ucmail").outerHTML = '<select tabindex="16" id="ucmail" name="ucmail">'+retour+'</select>';
			}
			else {
			
				document.getElementById("ucmail").innerHTML = retour;
			}
		}, 
		dataType: "html"
	});

	return false;	
}

function dynamic_scroll() {
	
}

// garder les cases coch�es
var checkbox = new Array();
function keep(article_id) {

	var test = false;
	
	for (var i = 0; i < checkbox.length; i++) {
		
		// D�cocher
		if (checkbox[i] == article_id) {
		
			for(var j = i; j < checkbox.length; j++) {
			
				checkbox[i] = checkbox[i+1];
				
				if (j == checkbox.length - 1) {
				
					checkbox.pop();
				}
			}
			
			test = true;
		}
	}
	
	if (test == false) {
	
		checkbox[checkbox.length] = article_id;
	}
	
	alert(checkbox+", taille : "+checkbox.length);
}

function cocher() {

	for(var i = 0; i < checkbox.length; i++) {
	
		var caze = document.getElementById(checkbox[i]);
		
		if (caze != undefined) {
		
			caze.checked = true;
		}
	}
}

function listSite(country){
	
	$.ajax({
		type: "GET",
		url: '/delia-CMS/listSite/country-'+country+'/',
		success: function(retour){
		
			if ($.browser.msie) {
			
				// IE
				document.getElementById("city").outerHTML = '<select tabindex="17" id="city" name="city" onchange="listUC(this.options[this.selectedIndex].value);">'+retour+'</select>';
				//document.getElementById("ucmail").outerHTML = '<select tabindex="16" id="ucmail" name="ucmail"><option value="-1">Please select Site before</option></select>';
			}
			else {
			
				document.getElementById("city").innerHTML = retour;
				//document.getElementById("ucmail").innerHTML = '<option value="-1">Please select Site before</option>';
			}
			
			// pour la gestion des png avec ie6
			/*if (typeof document.body.style.maxHeight == 'undefined') {
				ROQ.fixPNG.init();
			}*/
		}, 
		dataType: "html"
	});			 
	return false;
}

function listUC(site){
	
	$.ajax({
		type: "GET",
		url: '/delia-CMS/listUC/site-'+site+'/',
		success: function(retour){
			
			if ($.browser.msie) {
			
				// IE
				document.getElementById("ucmail").outerHTML = '<select tabindex="18" id="ucmail" name="ucmail">'+retour+'</select>';
			}
			else {
			
				document.getElementById("ucmail").innerHTML = retour;
			}
			
			//document.getElementById("ucmail").innerHTML = retour;
			
			// pour la gestion des png avec ie6
			/*if (typeof document.body.style.maxHeight == 'undefined') {
				ROQ.fixPNG.init();
			}*/
		}, 
		dataType: "html"
	});			 
	return false;
}

function listUCGeneric(){
	$.ajax({
		type: "GET",
		url: '/delia-CMS/listUCGeneric/',
		success: function(retour){
			
			if ($.browser.msie) {
			
				// IE
				document.getElementById("ucmail").outerHTML = '<select tabindex="18" id="ucmail" name="ucmail">'+retour+'</select>';
			}
			else {
			
				document.getElementById("ucmail").innerHTML = retour;
			}
			
			//document.getElementById("ucmail").innerHTML = retour;
			
			// pour la gestion des png avec ie6
			/*if (typeof document.body.style.maxHeight == 'undefined') {
				ROQ.fixPNG.init();
			}*/
		}, 
		dataType: "html"
	});			 
	return false;
}

// countryID : ID du pays
// flag : country ou no_country ( => contact generic)
function business_contact_listUC(countryID, flag) {
	$.ajax({
		type: 'GET',
		url: '/delia-CMS/business_contact_listUC/country-'+countryID+'/flag-'+flag+'/',
		success: function(retour) {
			
			if ($.browser.msie) {
			
				// IE
				document.getElementById("ucmail").outerHTML = '<select tabindex="12" id="ucmail" name="ucmail" style="font-size:9px;">'+retour+'</select>';
			}
			else {
			
				document.getElementById("ucmail").innerHTML = retour;
			}
		},
		dataType: 'html'
	});
	return false;
	
	//alert(countryID+" "+flag);
}

function business_contact_listUC_value(countryID, flag, nameField) {
	$.ajax({
		type: 'GET',
		url: '/delia-CMS/business_contact_listUC/country-'+countryID+'/flag-'+flag+'/value-ok/',
		success: function(retour) {
			
			if ($.browser.msie) {
			
				// IE
				document.getElementById("contact_uc").outerHTML = '<select tabindex="11" id="contact_uc" name="'+nameField+'" style="font-size:9px;" class="validate[\'required\']">'+retour+'</select>';
			}
			else {
			
				document.getElementById("contact_uc").innerHTML = retour;
			}
		},
		dataType: 'html'
	});
	return false;
	
	//alert(countryID+" "+flag);
}

function sample_documentation(countryID, flag) {
	
	if (document.getElementById('contact_country').options[document.getElementById('contact_country').selectedIndex].getAttribute('flag') == 'country') {
	
		document.getElementById('idCountry').value = document.getElementById('contact_country').options[document.getElementById('contact_country').selectedIndex].getAttribute('id');
	}
	else {
	
		document.getElementById('idCountry').value = '0';
	}
}