function switchView(id) {
	document.getElementById(id).style.display = document.getElementById(id).style.display == 'block' ? 'none' : 'block';
	
}
function switchViewTable(id) {
	if(navigator.appName.indexOf("Microsoft") > -1)
		var styleDisplay = 'block';
	else 
		var styleDisplay = 'table-row';

	document.getElementById(id).style.display = document.getElementById(id).style.display == styleDisplay ? 'none' : styleDisplay;

}

function cleanIfValue(obj, value) {
	obj = document.getElementById(obj);
	if (obj.value == value)
		obj.value = "";
} 



var id = 0;
var automate = 1;

function play_video() {
	hide_highlight();
	
	if ($('highlight_' + id + '_video')) {
		new Effect.Appear('highlight_' + id + '_video', { duration: 0.2 });
		stop_automate();
		
	}	
}



function next_highlight() {
	
	if ($('highlight_' + id + '_video'))
		new Effect.Fade('highlight_' + id + '_video', { duration: 0.2 });

	
	hide_highlight();
	id++;
	if (!$('highlight_' + id)) id = 1;	
	
		setTimeout("show_highlight();",300);

}



function previous_highlight() {

	if ($('highlight_' + id + '_video'))
		new Effect.Fade('highlight_' + id + '_video', { duration: 0.2 });


	hide_highlight();
	id--;
	
	if (!$('highlight_' + id)) {
		ant = 1;
		while(true) {
			if(!$('highlight_' + ant)) {
				break;
			}
			ant = ant + 1;
		}
		id = ant - 1;
	}

	setTimeout("show_highlight();",300);
}
function hide_highlight() {
	if ($('highlight_' + id))
		new Effect.Fade('highlight_' + id, { duration: 0.2 });
		
}
function show_highlight() {
	if ($('highlight_' + id)) 
		new Effect.Appear('highlight_' + id, { duration: 0.2 });
}
function automate_highlight() {
	if(automate == 1) {
		next_highlight();
		
		//If there is more than one highlight
		if($('highlight_2')) {
			setTimeout("automate_highlight();",5000);
		}
	}
}
function stop_automate() {
	automate = 0;
}
