// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function show_form_item(the_id) {
	var tmp = document.getElementById(the_id);
	if (the_id == "section_image") {
		document.getElementById("section_video").style.display = 'none';
		document.getElementById("section_other").style.display = 'none';
		tmp.style.display = '';
	} else if (the_id == "section_video") {
		document.getElementById("section_image").style.display = 'none';
		document.getElementById("section_other").style.display = 'none';
		tmp.style.display = '';
	} else if (the_id == "section_other") {
		document.getElementById("section_image").style.display = 'none';
		document.getElementById("section_video").style.display = 'none';
		tmp.style.display = '';
	} else if (the_id == "none") {
		document.getElementById("section_image").style.display = 'none';
		document.getElementById("section_video").style.display = 'none';
		document.getElementById("section_other").style.display = 'none';
	}
}

var file_uploads = 0;
var video_uploads = 0;

function add_file_field () {
	file_uploads += 1;
	to_add = 'File: <br /> <input id="section_file_' + file_uploads + '_uploaded_data" name="section_file_' + file_uploads + '[uploaded_data]" type="file" size="30"><br />';
	$("file_upload").insert(to_add);
	document.forms[0].number_of_files.value = file_uploads;
}

function add_video_field () {
	video_uploads += 1;
	to_add = 'Video: <br /> <input id="section_video_' + video_uploads + '_uploaded_data" name="section_video_' + video_uploads + '[uploaded_data]" type="file" size="30"><br />';
	$("video_upload").insert(to_add);
	document.forms[0].number_of_videos.value = video_uploads;
}