// Fonction pour trouver l'objet.
function findObj(id, ref) {
  	
	var nInt, i, obj;
	
	if (!ref) ref = document;
	
	n = id.indexOf("?");
	
	if ((n > 0) && parent.frames.length) {
		// Va chercher la frame
   		ref = parent.frames[id.substring(n + 1)].document;
		id  = id.substring(0, nInt);
		}
	obj = ref[id];
	
	if ((!obj) && ref.getElementById) obj = ref.getElementById(id);
 	if ((!obj) && ref.all) obj = ref.all[id];
	// NS4 ...
	for (i = 0; ((!obj) && (i < ref.forms.length)); i++) obj = ref.forms[i][id];																																	
  	for (i = 0; ((!obj) && (ref.layers) && (i < ref.layers.length)); i++) obj = findObj(id, ref.layers[i].document);
	
	return obj;
	}


function lien(target) {
	window.open(target, '_blank');
	return false;
	}

//
// Ouverture Object AJAX.
function ConnexionAjax() {
	
	// FALSE PAR DEFAUT.
	var xhr = false; 
	
	// Firefox et autres
	if(window.XMLHttpRequest) { 
		xhr = new XMLHttpRequest(); 
		}
	
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	
	return xhr;
	}

//INIT.
var _blockAffiche;

function setBlockImage(statut) {
	
	if(statut == 1) {
		document.getElementById('flashUploadImage').style.display = 'none';
		_blockAffiche = 'flashVisuelImage';
		}
	else {
		document.getElementById('flashVisuelImage').style.display = 'none';
		_blockAffiche = 'flashUploadImage';
		}
	}

function changeBlockImage(block) {
	
	document.getElementById(_blockAffiche).style.display = 'none';
	document.getElementById(block).style.display 		 = 'block';
	
	_blockAffiche = block;
	
	}

function confirmation(url, mess) {
	if(confirm(mess)) {
		document.location.href = url;
		}
	else {}
	}



function openPopup(lien, width, height) {
	
	
	var pop = window.open(lien, 'POPUP', "height=" + height + ",width=" + width + ", status=no,toolbar=no,menubar=no,location=no");
	
	pop.focus();
	pop.resizeTo(width + 4, height + 60);
	
	}

function ChangeImage(imageToLoad, identifiant) {

	var image = findObj(identifiant);
	image.src = imageToLoad;
	}
	
function vote(iday) {
	document.getElementById('IdVote').value = iday;
	document.getElementById('FormVote').submit();
	}