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

function clear_box(input_box) {
	if ((input_box.value == "name *") || (input_box.value == "email *") || (input_box.value == "phone *") || (input_box.value == "company") || (input_box.value == "message *")) {
		input_box.value = "";
	}
}

function fill_box(input_box) {
	if (input_box.value == "") {
		if (input_box.name == "d829ff7c8172fe56c820e0dd672d3dce") {
			input_box.value = "name *";
		} else if (input_box.name == "318f782997a1a404a00965a81668eb05") {
			input_box.value = "email *";
		} else if (input_box.name == "dfb2b4ca4ff2bd199720b8edef958c68") {
			input_box.value = "phone *";
		} else if (input_box.name == "906f7095997913b45ee3e9a713f29634") {
			input_box.value = "company";
		} else if (input_box.name == "contact[body]") {
			input_box.value = "message *";
		}
	}
}

function image_onmouseover(the_id, the_src) {
	$(the_id).src = the_src;	
}

function submit_loading (toggle) {
	if (toggle == 'on') {
		$('footer_submit').innerHTML = "<input class=\"submit\" type=\"submit\" value=\"sending...\" name=\"commit\" />";
	} else {
		$('footer_submit').innerHTML = "<input class=\"submit\" type=\"submit\" value=\"send\" name=\"commit\"/>";
	}
}

function show_more_testimonial (test_id) {
	$('more_testimonial_' + test_id).style.display = 'none';
	new Effect.SlideDown('testimonial_' + test_id, {duration:0});
}

function show_less_testimonial (test_id) {
	$('more_testimonial_' + test_id).style.display = '';
	new Effect.SlideUp('testimonial_' + test_id, {duration:0});
}


var number_of_images = 1;
var number_of_files = 1;
var number_of_links = 1;

function add_image_field () {
	number_of_images += 1;
	to_add = 'Image: <br /> <input id="image_' + number_of_images + '_uploaded_data" name="image_' + number_of_images + '[uploaded_data]" type="file" size="30"><br />Title: <br /> <input id="image_' + number_of_images + '_title" name="image_' + number_of_images + '[title]" type="text" size="30"><br /><textarea id="image_' + number_of_images + '_description" name="image_' + number_of_images + '[description]"></textarea><br />';
	$("section_images").insert(to_add);
	document.forms[0].number_of_images.value = number_of_images;
}

function add_file_field () {
	number_of_files += 1;
	to_add = 'Title: <br /> <input id="file_' + number_of_files + '_title" name="file_' + number_of_files + '[title]" type="text" size="30"><br />File: <br /> <input id="file_' + number_of_files + '_uploaded_data" name="file_' + number_of_files + '[uploaded_data]" type="file" size="30"><br />';
	$("section_files").insert(to_add);
	document.forms[0].number_of_files.value = number_of_files;
}

function add_link_field () {
	number_of_links += 1;
	to_add = 'Title: <br /> <input id="link_' + number_of_links + '_title" name="link_' + number_of_links + '[title]" type="text" size="30"><br />The URL: <br /> <input id="link_' + number_of_links + '_the_url" name="link_' + number_of_links + '[the_url]" type="text" size="30"><br />Description: <br /> <textarea id="link_' + number_of_links + '_description" name="link_' + number_of_links + '[description]"></textarea><br />';
	$("section_links").insert(to_add);
	document.forms[0].number_of_links.value = number_of_links;
}
