/*
 * Index page scripts 
 */

/* 
 * Preload onmouseover images
 */
function preload_image(_image) {
	var image = new Image;
	image.src = _image;
}

/* 
 * Change menu image onmouseover 
 */
function change_image (section) {
	var ShowItem = document.getElementById("map_change");
	ShowItem.style.background = 'url(img/menu_' + section + '.gif) no-repeat';
	return true;
}

/* 
 * Change back menu image onmouseout 
 */ 
function hide_image (section) {
	var ShowItem = document.getElementById("map_change");
	ShowItem.style.background = 'url(img/menu_empty.gif) no-repeat';
	return true;
}

/* 
 * Toggle div open and close
 */ 
function show_div(div) {
	var open_div = document.getElementById(div);	
	open_div.style.display = "block";
}

function hide_div(div) {
	var close_div = document.getElementById(div);	
	close_div.style.display = "none";
}

/*
 * Admin news 
 */
function show_event(element) {
	/* Show these elements*/
	document.getElementById("event" + element).style.display = "block";

	/* Hide these divs */
	document.getElementById("text" + element).style.display = "none";
	document.getElementById("textimage" + element).style.display = "none";
} 

function show_text(element) {
	/* Show these elements*/
	document.getElementById("text" + element).style.display = "block";

	/* Hide these divs */
	document.getElementById("event" + element).style.display = "none";
	document.getElementById("textimage" + element).style.display = "none";
} 

function show_textimage(element) {
	/* Show these elements*/
	document.getElementById("textimage" + element).style.display = "block";

	/* Hide these divs */
	document.getElementById("event" + element).style.display = "none";
	document.getElementById("text" + element).style.display = "none";
} 


/* 
 * Event toggler   
 * Display and hide elements depending on the event type
 */
function select_evening(evening) {
	if(evening == "home" || evening == "home_multiple_bands") {
		show_input("date");
		show_input("extra_info");
		show_input("artist");
		show_input("status");
		show_input("artist_info");
		show_input("artist_link");
		show_input("artist_cdon");
		show_input("artist_cdon_buy");
		show_input("support");
		show_input("support_info");
		show_input("support_link");
		hide_input("arena");
		hide_input("city");
		show_input("time_on_scene");
		hide_input("time_entry");
		show_input("time_open_from");
		show_input("time_open_to");
		show_input("price");
		show_input("prepay");
    show_input("printlink");
		show_input("age");
		show_input("time_club_before_from");
		show_input("time_club_before_to");
		show_input("price_club_before");
		show_input("time_club_after_from");
		show_input("time_club_after_to");
		show_input("price_club_after");
		show_input("dj");
		show_input("dj_big");
		show_input("dj_small");
		show_input("image");
		show_input("submit");
	}

	else if(evening == "notice") {
		show_input("date");
		show_input("extra_info");
		show_input("artist");
		hide_input("status");
		hide_input("artist_info");
		hide_input("artist_link");
		hide_input("artist_cdon");
		hide_input("artist_cdon_buy");
		hide_input("support");
		hide_input("support_info");
		hide_input("support_link");
		hide_input("arena");
		hide_input("city");
		hide_input("time_on_scene");
		hide_input("time_entry");
		hide_input("time_open_from");
		hide_input("time_open_to");
		hide_input("price");
		hide_input("prepay");
    hide_input("printlink");
		hide_input("age");
		hide_input("time_club_before_from");
		hide_input("time_club_before_to");
		hide_input("price_club_before");
		hide_input("time_club_after_from");
		hide_input("time_club_after_to");
		hide_input("price_club_after");
		hide_input("dj");
		hide_input("dj_big");
		hide_input("dj_small");
		hide_input("image");
		show_input("submit");
	} 
	else if(evening == "away" || evening == "away_multiple_bands") {
		show_input("date");
		show_input("extra_info");
		show_input("artist");
		show_input("status");
		show_input("artist_info");
		show_input("artist_link");
		show_input("artist_cdon");
		show_input("artist_cdon_buy");
		show_input("support");
		show_input("support_info");
		show_input("support_link");
		show_input("arena");
		show_input("city");
		show_input("time_on_scene");
		show_input("time_entry");
		hide_input("time_open_from");
		hide_input("time_open_to");
		show_input("price");
		show_input("prepay");
    show_input("printlink");
		show_input("age");
		hide_input("time_club_before_from");
		hide_input("time_club_before_to");
		hide_input("price_club_before");
		hide_input("time_club_after_from");
		hide_input("time_club_after_to");
		hide_input("price_club_after");
		hide_input("dj");
		hide_input("dj_big");
		hide_input("dj_small");
		show_input("image");
		show_input("submit");
	} 

	else if(evening == "nightclub") {
		show_input("date");
		show_input("extra_info");
		show_input("artist");
		show_input("status");
		hide_input("artist_info");
		hide_input("artist_link");
		hide_input("artist_cdon");
		hide_input("artist_cdon_buy");
		hide_input("support");
		hide_input("support_info");
		hide_input("support_link");
		hide_input("arena");
		hide_input("city");
		hide_input("time_on_scene");
		hide_input("time_entry");
		show_input("time_open_from");
		show_input("time_open_to");
		show_input("price");
		hide_input("prepay");
    hide_input("printlink");
		show_input("age");
		show_input("time_club_before_from");
		show_input("time_club_before_to");
		show_input("price_club_before");
		show_input("time_club_after_from");
		show_input("time_club_after_to");
		show_input("price_club_after");
		show_input("dj");
		show_input("dj_big");
		show_input("dj_small");
		show_input("image");
		show_input("submit");
	}
	else if(evening == "none") {
		hide_input("date");
		hide_input("extra_info");
		hide_input("artist");
		hide_input("status");
		hide_input("artist_info");
		hide_input("artist_link");
		hide_input("artist_cdon");
		hide_input("artist_cdon_buy");
		hide_input("support");
		hide_input("support_info");
		hide_input("support_link");
		hide_input("arena");
		hide_input("city");
		hide_input("time_on_scene");
		hide_input("time_entry");
		hide_input("time_open_from");
		hide_input("time_open_to");
		hide_input("price");
		hide_input("prepay");
    hide_input("printlink");
		hide_input("age");
		hide_input("time_club_before_from");
		hide_input("time_club_before_to");
		hide_input("price_club_before");
		hide_input("time_club_after_from");
		hide_input("time_club_after_to");
		hide_input("price_club_after");
		hide_input("dj");
		hide_input("dj_big");
		hide_input("dj_small");
		hide_input("image");
		hide_input("submit");
	}

}


function show_input(input) {
	/* Show these layers */
	document.getElementById(input).disabled = false; 
	document.getElementById(input).style.background = "white"; 
	document.getElementById(input).style.border= "1px solid gray"; 
}

function hide_input(input) {
	/* Hide these layers */
	document.getElementById(input).disabled = true; 
	document.getElementById(input).style.background = "gray"; 
	document.getElementById(input).style.border= "1px solid black"; 
}
