// montrer/cacher des éléments
function show(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = 'block';
}
function hide(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = 'none';
}
function show_hide(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = (document.getElementById(id).style.display == 'block')?'none':'block';
}


// redimentionner la taille de la police
function text_size(new_size) {
	if (document.getElementById('content'))
		document.getElementById(id).style.fontSize = new_size+'em';
}

// popup
function popup(url,w,h) {
	window.open(url,null,'height='+h+',width='+w+',top='+(screen.height/2 - h/2)+',left='+(screen.width/2 - w/2)+',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
}

//agrandissement de photos
function afficheMaxi(chemin) {
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML><HEAD><TITLE>&copy; CAO</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 oncontextmenu="return false;"><CENTER><IMG SRC="'+chemin+'" BORDER=0 name=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)" onClick="window.close()" alt="fermer"></CENTER></BODY></HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
};

// auto scroll 
var current_item = new Array;
current_item['actu'] = 1;

function show_actu(type,item) {
	if (!item) var item = 1;
	if (document.getElementById(type+'_txt')) {
		if (navigator.appVersion.indexOf("MSIE")!=-1) {
		// pour IE : on applique un effet de transition sur le texte
			document.getElementById(type+'_txt').filters[0].apply();
			document.getElementById(type+'_txt').innerHTML = document.getElementById(type+'_'+item).innerHTML;
			document.getElementById(type+'_txt').filters[0].play();
		} else {
		// pour FF et autres navigateurs : transition sans effet
			document.getElementById(type+'_txt').innerHTML = document.getElementById(type+'_'+item).innerHTML;
		}
	}
}
function auto_scrolling(vars) {
	var type_tab = vars.split(",");
	
	for (i = 0; i < type_tab.length; i++) {
		var item_tab = type_tab[i].split("#");
		var type = item_tab[0];
		var nb_item = item_tab[1];
		if (current_item[type] > nb_item) current_item[type] = 1;
		show_actu(type,current_item[type]);	
		current_item[type] ++;
		
	}
	timer = setTimeout("auto_scrolling('"+vars+"')",5000);
}
function switch_item(type,operator,nb_item) {
	if (operator == '+') new_item = current_item[type] - 1 + 1;
	else if (operator == '-') new_item = current_item[type] - 1 - 1;
	
	if (new_item < 1) new_item = nb_item;
	if (new_item > nb_item) new_item = 1;
	
	current_item[type] = new_item + 1;
	show_actu(type,new_item);
	//clearTimeout(timer);
}

function ariane_popup(chemin) {
  window.opener.location.href=chemin;
	window.close();
}
