function submitsearch(id){ //id is the id of the select that we DONT want to reset
	var form = document.search_form;
	//get all the selects
	var selects = document.getElementsByTagName("select");

	for(x = 0;x < selects.length;x++)
	{
		if(selects[x].id != id)
		{
			selects[x].selectedIndex = 0;
		}
	}

	//submit the form
	form.submit();
}

function validate_quicklink_add() {
	var input = document.quicklink_add.cat_name;
	if(input.value == ''){
		alert("You must enter a category name");
		input.focus();
		return false;
	} else {
		return true;
	}
}

function validate_quicklink_edit(id) {
	var form = document.getElementById('editform_' + id);
	var input = document.getElementById('edit_' + id);
	if(input.value == ''){
		alert("You must enter a category name");
		input.focus();
		return false;
	} else {
		return true;
	}
}

function quicklink_confirm_delete(id) {
	if(confirm("Do you want to delete this category?"))
	{
		window.location = "index.php?action=quicklink_admin&request=delete&id=" + id;
	}	
}

function quicklink_confirm_delete_clip(id) {
	if(confirm("Do you want to delete this clip?"))
	{
		window.location = "index.php?action=quicklink_admin&request=delete_clip&id=" + id;
	}	
}

function quicklink_toggle_edit(id){
	var edit_div = document.getElementById(id + '_edit');
	var static_div = document.getElementById(id + '_static');
	
	if(edit_div.style.display == 'block'){
		edit_div.style.display = 'none';
		static_div.style.display = 'block';
	} else {
		edit_div.style.display = 'block';
		static_div.style.display = 'none';
	}
}

var top_link = document.location + "#top";
function show_clip(id,type)
{
	frame = document.getElementById("portfolio_frame");
	frame.style.display = 'block'; 
	frame.src = 'display_clip_frame.php?action=display_clip&title=Media&clip_id=' + id;
	document.location = top_link; //goto the top

	if(type == 'video')
	{
		frame.style.height = "390px";
		frame.style.width = "450px";		
	}
	else if(type == 'audio')
	{
		frame.style.height = "120px";
		frame.style.width = "400px";		
	}
}