// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function highlight_screenshot(id) {
	$$('.screenshot_selected').each(function(item, index) {item.className = "right screenshot_unselected"});
	
	$(id).className = "right screenshot_selected";
}

function highlight_video(from_id, to_id) {
	$(from_id).className = "right video_unselected";
	
	$(to_id).className = "right video_selected";
}

function set_quicktime_movie(url, reload_url) {
	movie = document.quicktime_movie;
	t = url.split(".")
	if(movie) {
		if(t[t.length - 1] != "mov")
			window.location = reload_url;
		movie.SetURL(url);
		movie.SetHREF(url);
	}
	w_movie = document.media_player_movie;
	if(w_movie) {
		if(t[t.length - 1] != "wmv")
			window.location = reload_url;
		w_movie.URL = url;
	}
}

function fg_filter_titles(platform, genre, esrb) {
	ps = $('title_menu');
	var selected = ps.options[ps.selectedIndex].value;
	ps.options.length = 1;
	//ps[ps.length] = new Option("", "Title");
	for (var i = 0; i < fg_ids.length; i++){
		if ((fg_platforms[i].indexOf(platform) > -1 || platform == "") && (fg_genres[i].indexOf(genre) > -1 || genre == "") && (fg_esrbs[i].indexOf(esrb) > -1 || esrb == "") ){
			ps.options[ps.options.length] = new Option(fg_titles[i], fg_ids[i]);
		}
	}
	for(var j=0;j<ps.options.length; j++) {
		if(ps.options[j].value == selected) {
			ps.selectedIndex = j;
		}
	}
}