

function blink(i) {
	if (i==1) {
		document.getElementById("lmgf1").style.display="";
		document.getElementById("lmgf2").style.display="none";
		setTimeout("blink('2')",3000);
	} else {
		document.getElementById("lmgf2").style.display="";
		document.getElementById("lmgf1").style.display="none";
		setTimeout("blink('1')",3000);
	}
}

function verif(pays)
{
	var i= 0;
	var control = true;
		
	if (pays == 'fr' || pays=='dk' || pays=='uki' || pays=='ger' || pays=='in1' || pays=='in2')
	{
		var champ_formulaire = new Array ('nom','Prenom','Societe','Email','Phone','codepostal','ville','Pays');
	
		//alert("ok");
		//alert("i : " +i);
		//alert("control :" +control);
		
		while(control == true && i<8 )
		{
			if (document.getElementById(champ_formulaire[i]).value=="")
			{
				control=false;
			}
			i++;
		}
	}
	else
	{
		var champ_formulaire = new Array ('nom','Prenom','Societe','Email','Phone','codepostal','ville','etat','Pays');
	
		//alert("ok");
		//alert("i : " +i);
		//alert("control :" +control);
		
		while(control == true && i<9 )
		{
			if (document.getElementById(champ_formulaire[i]).value=="")
			{
				control=false;
			}
			i++;
		}
	}

		if (control==false)
		{
			if (pays == 'fr' )
				alert("Remplir tous les champs en gras");	
					
			else if (pays == 'it' )
				alert("I campi in grassetto sono obbligatori");
				
			else if (pays == 'dk' )
				alert("Denotes field is required");
				
			else if (pays == 'ger' )
				alert("Bitte alle fett gedruckte Felder ausfullen");
				
			else if (pays == 'uki' || pays == 'in1' || pays == 'in2')
				alert("Denotes field is required");
				
		}
		else
		{
			document.agenda.submit();
		}
	

}

function openAgenda(pays) {
var w=1100;
var h=900;

if (pays=='IN1') {
	w=1100;
	h=900;
}
if (pays=='IN2') {
	w=1100;
	h=850;
}
	window.open('agendaPopup.asp','agenda','width='+w+',height='+h+',menubar=no, status=no, scrollbars=yes, menubar=no');
}

function Closwind() {
	window.opener.document.form1.submit();
	window.close();
}

function OuvrirPopup(page,nom,option) {
   window.open(page,nom,option);
}

function rebour() {
if (document.all.rebour.value!="0") {
	document.all.rebour.value=Number(document.all.rebour.value)-1
}else{ document.location.href='<%=myredir%>'}
setTimeout('rebour()',1000)
}

function myOrder(l1,l2) {
	document.form1.page.value='0'
	document.form1.order.value=l1
	document.form1.sens.value=l2
	document.form1.submit()
}

function popu2(l1) {
	l2='Encart'
	l4='top=30,left=150,width=600,height=625,toolbar=no,menubar=no,scrollbars=no,resizable=yes,directories=no,location=no,status=no,titlebar=no'
	window.open(l1,l2,l4)
}

function popu1(l1,larg,haut) {
	l2='Encart'
	l4='top=30,left=150,width=' + larg + ',height=' + haut + ',toolbar=no,menubar=no,scrollbars=no,resizable=yes,directories=no,location=no,status=no,titlebar=no'
	window.open(l1,l2,l4)
}

function MU_checksize(MU_div){
	test=true;
	if (w.document.img01) {if (w.document.img01.complete==false) {test=false;}}
	if (test==true){
		if (MU_div=='chg_td1'){document.MU_importchg_td1.submit()}
		if (MU_div=='chg_td2'){document.MU_importchg_td2.submit()}
	}else{setTimeout('MU_checksize("'+MU_div+'");',250)}
}

function MU_OuvrirAttach(tmp,MU_chem,MU_div) {
	if(tmp.Fichier1.value!=''){
		w=window.open(MU_chem,'attachfile','resizable=no, location=no, width=500, height=300, menubar=no, status=no, scrollbars=no, menubar=no');
		tmp.target = "attachfile";
		setTimeout('MU_checksize("'+MU_div+'");',250)
	}else{
		alert('To add a file, please select it with the button "Browse" ')
	}
}

function MU_delFile(MU_div,MU_chem,l1){
	MU_info_recap(MU_div,MU_chem+'&dele='+l1,'');
}

function MU_info_recap(div,fil,nid,rep){
	var debug = 0;	var dgfoo = document.getElementById("divDebug");
	var irfoo = document.getElementById(div);
	if (rep=='') {rep='../'}
	var ajxload = '<img src='+rep+'ModuleUpload/img/loader.gif >';
	irfoo.innerHTML = ajxload;
	var xhr_object=null;var tmp='';var data=null;
	if(nid!="")data ="nid="+nid;
	if(window.XMLHttpRequest){xhr_object = new XMLHttpRequest();}else if(window.ActiveXObject){xhr_object = new ActiveXObject("Microsoft.XMLHTTP");}else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return;}
	if(document.all){
		var method="POST";
	}else{
		var method="GET";
	}
	
	xhr_object.open(method, fil, true);
	xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xhr_object.send(data);
	
	xhr_object.onreadystatechange = function anonymous() {
	
		irfoo.innerHTML= ajxload
		if(xhr_object.readyState == 4) {
			var tmp=xhr_object.responseText;
			if(debug){dgfoo.innerHTML=tmp;}
			if(tmp){
				
				var reg  = new RegExp("&lt;","g"); var reg1 = new RegExp("&gt;","g");
				irfoo.innerHTML=tmp;
				var tmp='';
				
			}
		}
	}
}

function showDiv(l1) {
	if (document.getElementById(l1).style.display=='none') {
		document.getElementById(l1).style.display='';
	} else {
		document.getElementById(l1).style.display='none';		
		}
}

function showDiv1(l2) {if (l2=='yes') {document.all.DivQuest1.style.display=""} else {document.all.DivQuest1.style.display="none"}}
	
function limite(zone,indic,max) { 
	if(zone.value.length>max)
		{zone.value=zone.value.substring(0,max);alert('Your text exceeds 100 words. Your should shorten it to fit in the text area. Thanks.');}
	else if(zone.value.length==max)
	{
		zone.value=zone.value.substring(0,max);
		indic.value = "Characters remaining : " + 0;
	}
	else {indic.value = "Characters remaining : " + (1000 - zone.value.length);
		}
} 

function Appear(country,check,url,description,textUrl,textDescription,indicateur)
{
	if(check.checked)
	{
		url.style.display="none"
		description.style.display="none"
		textUrl.style.display="none"
		textDescription.style.display="none"
		//indicateur.style.display="none"
	}
	else
	{ 
		url.style.display="block"
		description.style.display="block"
		textUrl.style.display="block"
		textDescription.style.display="block"
		//indicateur.style.display="block"
	}
}

function litcook(nom)
{
	var deb,fin
	deb = document.cookie.indexOf(nom + "=")
	if (deb >= 0)
	{	
		deb += nom.length + 1;
		fin = document.cookie.indexOf(";",deb);
		if (fin < 0) fin = document.cookie.length;
		return unescape(document.cookie.substring(deb,fin))
	}
	return ""
}

function compteurlow()
{
	if(litcook("numerolow")==1)
	{
		displaylow = litcook("fichierlow").replace(/\+/g,' '); // supprime le + du cookie ?a place de l'espace
		document.getElementById('low1').value=displaylow;
		document.getElementById('low1').style.display="block";
		document.getElementById('uploaded_low').value="Uploaded :";
		document.getElementById('uploaded_low').style.display="block";
	}
	for (var i=2;i<=10;i++)
	{
		if(litcook("numerolow")==i)
		{
			displaylow = litcook("fichierlow").replace(/\+/g,' ');
			document.getElementById('low'+i).value=displaylow
			document.getElementById('low'+i).style.display="block";
		}
	}
	setTimeout("compteurlow()", 1000);
}

function compteurhigh()
{
	if(litcook("numerohigh")==1)
	{
		displayhigh = litcook("fichierhigh").replace(/\+/g,' '); // supprime le + du cookie ?a place de l'espace
		document.getElementById('high1').value=displayhigh;
		document.getElementById('high1').style.display="block";
		document.getElementById('uploaded_high').value="Uploaded :";
		document.getElementById('uploaded_high').style.display="block";
	}
	for (var i=2;i<=10;i++)
	{
		if(litcook("numerohigh")==i)
		{
			displayhigh = litcook("fichierhigh").replace(/\+/g,' ');
			document.getElementById('high'+i).value=displayhigh;
			document.getElementById('high'+i).style.display="block";
		}
	}
	setTimeout("compteurhigh()", 1000);
}

function verifCompany() {
	
	if (document.getElementById('company').value!='') {
			if (document.getElementById('id_sponsorUploadNew')==null) {MU_info_recap("new_comp",'add_sponsor.asp?company='+document.getElementById('company').value,'','./');}
	} else {alert('Please enter the company name.');}			
	
}

function openReso(typ) {
	if (document.getElementById('id_sponsorUploadNew')==null) {alert('Please enter a company name.');} else {
		window.open('sponsorsupdown_upload2.asp?typ_upload='+typ+'&id_sponsorUpload='+document.getElementById('id_sponsorUploadNew').value,'','scrollbars=yes,resizable=no,width=570,height=200');
	}
}
