var selectedCell=null;
var selectedOnglet=null;
var selectedLog=null;
function showExamples(){
	var url="exemplesCapture.php";
	var properties="scrollbars=yes,dependent=yes,left=1,top=1,height=170,resizable=yes";
	window.open(url,"exemples",properties);
}
function openGfk(){
	var url="groupeGfK.php";
	var properties="scrollbars=yes,dependent=yes,left=1,top=1,height=350,resizable=yes";
	window.open(url,"",properties);
}
function launchMovingText(){
}

function selectCell(cell){
	//deselectionner la precedente cellule
	if(selectedCell!=null){
		
		selectedCell.className="menuInactif";
		
	}
		
	selectedCell=cell;
	
	cell.className="menuSelected";
	
	
}


function highlight(cell){
	if(selectedCell==cell)
		return;
	cell.style.cursor = 'hand';
	cell.className="menuHighlighted";
	
}
function unHighlight(cell){
	if(selectedCell==cell)
		return;
	cell.className="menuInactif";
}

function highlightOnglet(cell){
	if(selectedOnglet==cell)
		return;
	
	
	cell.style.cursor = 'hand';
	cell.className="ongletHighlighted";
	
	
	
	
}
function unHighlightOnglet(cell){
	if(selectedOnglet==cell)
		return;
	cell.className="ongletInactif";
	
	
	
}

function selectOnglet(cell){
	/*
	//deselectionner la precedente cellule
	if(selectedOnglet!=null){
		
		selectedOnglet.className="ongletInactif";
		//document.getElementById(selectedOnglet.id+"_contenu").className="invisible";
		
	}
		
	selectedOnglet=cell;
	
	cell.className="ongletActif";
	
	//document.getElementById(cell.id+"_contenu").className="visible";
	*/
	location.href=cell.id+".php";
	
	
	
}

function showCurrentDate(){
	var currentDate=getDateCourante();
	document.getElementById("currentDate").firstChild.data=currentDate;
	afficherHeure();

}
function afficherHeure(){
	var monHeure=new Date();
	document.getElementById("currentTime").firstChild.data=format(monHeure.getHours(),2)+":"+format(monHeure.getMinutes(),2)+":"+format(monHeure.getSeconds(),2);
	setTimeout(afficherHeure,1000);
}



function getDateCourante(){
	var maDate= new Date();
	return format(maDate.getDate(),2)+"/"+format((maDate.getMonth()+1),2)+"/"+format(maDate.getFullYear(),4);	
}
function format(nombre, nbChiffres){
	var chaine=new String(nombre);
	if(chaine.length==nbChiffres)
		return chaine;
	else{
		var nbChiffresAajouter=nbChiffres-chaine.length;
		for(var i=0;i<nbChiffresAajouter;i++){
			chaine="0"+chaine;
		}
		return chaine;
	}
	
}
function checkForm(){ //verifie les infos encodees lors du login
	//alert("test");
	
	if(document.monForm.login.value==""){
		alert("Veuillez remplir le champ login!");
		return false;
	}
	if(document.monForm.pwd.value==""){
		alert("Veuillez spécifier un mot de passe!");
		return false;
	}
	
	return true;
}

function checkFormModif(){ //verifie les infos encodees lors de la modif pwd
	
	
	if(document.monForm.login.value==""){
		alert("Veuillez remplir le champ login!");
		return false;
	}
	if(document.monForm.oldPwd.value==""){
		alert("Veuillez spécifier votre ancien mot de passe!");
		return false;
	}
	
	if(document.monForm.newPwd1.value=="" || document.monForm.newPwd2.value=="" || document.monForm.newPwd1.value!=document.monForm.newPwd2.value){
		alert("Veuillez indiquer 2 fois le même mot de passe.");
		return false;
	}
	
	return true;
}
function checkMail(){
	var texte=document.monForm.email.value;
	var pattern=/^[a-zA-Z0-9\.\-]+@[a-zA-Z0-9\.]+\.[a-zA-Z0-9]+$/;
	if(!pattern.test(texte)){
		alert("l'adresse email encodée n'est pas valide!");
		return false;
	}
	
	
	return true;

}
function checkFormInsc(){ //verifie les infos encodees lors de l'inscription
	//alert("test");
	
	if(document.monForm.nom.value==""){
		alert("Veuillez remplir le champ nom!");
		return false;
	}
	if(document.monForm.prenom.value==""){
		alert("Veuillez remplir le champ prénom!");
		return false;
	}
	if(document.monForm.societe.value==""){
		alert("Veuillez indiquer un nom de société!");
		return false;
	}
	/*
	if(document.monForm.telephone.value==""){
		alert("Vous devez indiquer un numéro de téléphone!");
		return false;
	}
	if(document.monForm.fonction.value==""){
		alert("Vous devez indiquer votre fonction professionnelle!");
		return false;
	}
	*/
	var texte=document.monForm.email.value;
	
	var pattern=/^[a-zA-Z0-9\.\-]+@[a-zA-Z0-9\.]+\.[a-zA-Z0-9]+$/;
	if(!pattern.test(texte)){
		alert("l'adresse email encodée n'est pas valide!");
		return false;
	}
	
	
	return true;
}
function changeLanguage(){
	var theUrl=new String(location);
	var pos = theUrl.lastIndexOf("/");
	theUrl=theUrl.substring(pos+1,theUrl.length);
	location.href="../nl/"+theUrl;
}
function highlightLog(cell){
	if(selectedLog==cell)
		return;
	
	
	cell.style.cursor = 'hand';
	cell.className="log_highlighted";
	
	
	
	
}
function unHighlightLog(cell){
	if(selectedLog==cell)
		return;
	cell.className="log_inactif";
	
	
	
}

function selectLog(cell, idLog, idType){
	if(cell==selectedLog)
		return;
	location.href="detailLogiciel.php?id_log="+idLog+"&type_doc="+idType;
	
}
function preSelectLog(cell){
	selectedLog=cell;
	cell.className="log_actif";
}

