
function go(page, task, item)
{
	if(task == 'delete_exec')
	{
		if(confirm('Are you sure you wish to delete this entry?'))
		{
			document.forms[0].page.value = page;
			document.forms[0].task.value = task;
			document.forms[0].item.value = item;
			document.forms[0].submit();	
		}
	}
	else
	{
		document.forms[0].page.value = page;
		document.forms[0].task.value = task;
		document.forms[0].item.value = item;
		document.forms[0].submit();		
	}
}

function submit_on_enter(e)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	//alert(key);

	if(document.forms[0].task){document.forms[0].task.value='';}

	// SUBMIT PAGE IF ENTER IS PRESSED
	if(key == 13) { document.forms[0].submit(); }

	return true;
}


function change_img(obj,fil)
{
	if(obj.src.match("gt.gif"))
	{
		obj.src="../images/lt.gif";
		fil.value = '<';
	}
	else if(obj.src.match("lt.gif"))
	{
		obj.src="../images/eq.gif";
		fil.value = '=';
	}
	else
	{
		obj.src="../images/gt.gif";
		fil.value = '>';
	}
}
				
// REFRESHES THE OUTPUT OF SHOW_DB
function search_list(n)
{
	document.forms[0].first_record.value = n;
	document.forms[0].submit();
}

function numbers_only(e) 
{
	 var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	 
	 if (key == 110 || key == 190 || key == 8 || key == 9 || key == 46 || (key > 47 && key < 58) || (key > 95 && key < 106)) return true; else return false;
}

function numbers_only_submit(e) 
{
	 var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	 
	 // SUBMIT PAGE IF ENTER IS PRESSED
	 if(key == 13) { document.forms[0].submit(); }
	 
	 if (key == 110 || key == 190 || key == 8 || key == 9 || key == 46 || (key > 47 && key < 58) || (key > 95 && key < 106)) return true; else return false;
}
			
function add_picture()
{
	if(reqd_info_check())
	{
		document.forms[0].sfn.value = document.forms[0].picture_path.value;
		document.forms[0].page.value = 'item';	
		document.forms[0].task.value = 'add_picture';	
		document.forms[0].submit();
	}
}

function delete_picture(p)
{
	if(confirm('Are you sure you want to delete this picture?'))
	{
		if(reqd_info_check())
		{
			document.forms[0].page.value='item';
			document.forms[0].task.value=p;
			document.forms[0].submit(); 	
		}
	}
}

function search_box_submit(e,t)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;

	if(key == 13) { search_submit(t); return true;}
	else return false;
}

function search_submit(t)
{
	document.forms[0].action=t;
	document.forms[0].page.value='search';
	document.forms[0].submit();
}

function search_next_prev_view(item,page)
{
	document.forms[0].item.value=item;
	document.forms[0].page.value=page;
	document.forms[0].submit();
}

function reqd_info_check()
{
	//alert(document.forms[0].type_id.selectedIndex);

	if(! (document.forms[0].name.value.match(/\w+/)))
	{
		alert('Please enter a name!');
		document.forms[0].name.focus();
		return 0;
	}
	else
	{
		return 1;	
	}
}
