// 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 getSelectValue(obj) {
	if (obj) {
		if ((obj.selectedIndex >= obj.length)|| (obj.selectedIndex < 0)) return '';
		var v = obj.options[obj.selectedIndex].value;
		if (v == null) return '';
		return v;
	} 
	else return '';
}



function lien(target) {
	window.open(target, '_blank');
	return false;
	}

function confirmation(url, mess) {
	if(confirm(mess)) {
		document.location.href = url;
		}
	else {}
	}

function changeImg(iday, pathToImg) {
	
	var oImage  = document.getElementById(iday);
	var oSelect = findObj('carte_id');
	
	var value = getSelectValue(oSelect);
	var tab   = value.split(';');
	
	oImage.src = pathToImg + tab[1];
	}

// INIT
var width  = new Number();
var height = new Number();
// FONCTION
function openPopup(lien, width, height) {
	
	var pop = window.open(lien, 'POPUP', "height=" + height + ",width=" + width + ",status=no,toolbar=no,menubar=no,location=no");
	
	pop.resizeTo(width, height + 75);
	pop.focus();
	} 