// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


function Poster(id, titre) {
    this.id = id;
    this.image = document.createElement('img');
    this.image.src = "/images/"+expo+"/posters_320/P" + id + ".jpg";
    this.image.alt = titre;
}

window.onclick = function () {
    if (show_liste && !btn_click) hideListePosters();
    if (btn_click) btn_click = false;
}

function toggleListePosters() {
    
    if (show_liste) { 
		document.getElementById('liste_posters').style.display = "none";
		show_liste = false; 
	}
	else { 
		document.getElementById('liste_posters').style.display = "block";
		show_liste = true; 
	}
	btn_click = true;
}

function hideListePosters() {
	if (show_liste) { 
	    document.getElementById('liste_posters').style.display = "none"; 
	    show_liste = false; 
    }
}

function gotoPoster(idp) {
	hideListePosters()
	location = "/"+ expo +"/poster/" + idp + ".html"
}

function gotoCurrentPoster() {
    if (current_poster) gotoPoster(current_poster);
}

function changePoster(idp) {
	document.getElementById("main_poster").src = posters[idp].image.src;
	document.getElementById("main_poster").alt = posters[idp].image.alt;
	current_poster = idp;
}

function go_selected(selectbox) {
	destination = selectbox.options[selectbox.selectedIndex].value;
	if (destination) location.href = destination;
}

function gotoSources(ids) {
	window.open ("/" + expo + "/sources/#" + ids, "sources","status=0,toolbar=0,width=400,height=450");
}
