// JavaScript Document

	
	// this function will call a url in the parent window
	function to_old_win(url)
	{
		opener.location.href = url;
	}
	
	// this just reloads the current parent page - used mostly on close or onunload
	function reload_old()
	{
		opener.location.href = opener.location.href;
	}
	
	function reload_current()
	{
		document.location.href = document.location.href;
	}
	
	// this function will add an item to a multiselect
	function moveItem(from,to) {
		elSel = document.getElementById(from);
		elDest = document.getElementById(to);
		
		for (var i = 0; i < elSel.options.length; i++) { 
			if (elSel.options[ i ].selected) {
			
				try {
				  //elDest.add(elOptNew, null); // standards compliant; doesn't work in IE
				  elDest[elDest.options.length]=new Option(elSel.options[ i ].text, elSel.options[ i ].value, false)
				}
				catch(ex) {
				  alert("error on move"+ex);
				}
			}
		}
	}
	
	function getSelect(ob) {
		var elSel = document.getElementById(ob);
		data = new Array();
		for (i = elSel.length - 1; i>=0; i--) {
			data[i] = elSel.options[i].value;
		  }
		return data;
	}
	
	// this function will remove an item from a multiselect
	function removeItem(to) {
		var elSel = document.getElementById(to);
		  var i;
		  for (i = elSel.length - 1; i>=0; i--) {
			if (elSel.options[i].selected) {
			  elSel.remove(i);
			}
		  }
	}
	
	// validate the fields required
	function validate_required(field,alerttxt)
	{
		with (field)
		{
			if (value==null||value=="")
			  {alert(alerttxt);return false;}
			else {return true}
		}
	}
	
	function validate_form(thisform)
	{
		with (thisform)
		{
			if (validate_required(name,"Category name must be filled out!")==false)
			  {name.focus();return false;}
		}
	}