function toggle(div, bool) {
	currentDiv = document.getElementById(div);
	if (bool == true) {
		currentDiv.style.display = 'block';

		if( div == 'structure_fields' ) {
			document.getElementById(div+'_hidden').style.display = 'none';
		}
	} else {
		currentDiv.style.display = 'none';

		if( div == 'structure_fields' ) {
			document.getElementById(div+'_hidden').style.display = 'block';
		}
	}
}

if( $('#gallery') ) {
	$(function() {
	    $('#gallery a').lightBox();
	});
}


function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	var fencent=window.open(url,nom,'top='+haut+',left='+Gauche+',width='+largeur+',height='+hauteur+','+options);
}

function fermauto(url, title) {
	popup=window.open(url, title, 'width=780,height=800, scrollbar=yes');
	setTimeout("popup.close()",5000); // DELAI
}

function setPeriod(myId, resaId) {

	var myDiv = "period_"+ myId;
	$.ajax({
	   type: "POST",
	   url: "/fr/actions/ajax/getPeriod.php",
	   data: "travel_id="+myId,
	   success: function(html){

		//alert(myDiv);
		document.getElementById('period_' + resaId).innerHTML  = html;
		document.getElementById('hidden_period_'+resaId).value = html;
		//$("#period_" + resaId).innerHTML = html;

	   }
	 });
}

function displayDetails(id) {
	document.getElementById('tooltip_'+id).style.display  = '';
}

function hideDetails(id) {
	document.getElementById('tooltip_'+id).style.display  = 'none';
}

function deleteObject(type, id) {
	var response = confirm("Vous allez supprimer cet enregistrement. Continuer ? ");
	if( response ) {
		document.location.href = '/fr/actions/admin/delete_'+type + '.php?id='+id;
	}
}
