function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validateForm(sFormName) 
{
	var frm=document.forms[sFormName];
	var msg;
	var empty_fields = "";
	var errors = "";
	var doVerify = false;
	
	// check the form
/*	if (sFormName == "login")
	{
		frm.username.optional = false;
		frm.password.optional = false;
		doVerify = true;
	}*/
	
	if (sFormName == "makeEdit")
	{
		frm.image.optional = true;
		doVerify = true;
	}
	
	if (sFormName == "modelEdit")
	{
		frm.image.optional = true;
		doVerify = true;
	}

	// if we need to verify loop through all the controls and build up any errors
	if (doVerify == true) 
	{
		for(var i = 0; i < frm.length; i++) 
		{
			var e = frm.elements[i];
			
			if (((e.type == "text") || (e.type == "textarea") || (e.type == "password")) && !e.optional)
			{
				// first check if the field is empty
				if ((e.value == null) || (e.value == "") || (e.value == "Javascript:void();")) 
				{
					empty_fields += "\n      " + e.id;
					continue;
				}
			}
			
			if ((e.type == "select-one") && !e.optional)
			{
				if ((e.value == null) || (e.value == "") || (e.value == "Javascript:void();")) 
				{
					empty_fields += "\n      " + e.id;
					continue;
				}
			}
		}
	}

	// now, if there were any errors, display error messages and return false
	// otherwise return true
	if (empty_fields || errors)
	{

		msg  = "________________________________________________\n\n";
		msg += "The form was not submitted because of the following error(s).\n";
		msg += "Please correct these error(s) and re-submit.\n";
		msg += "________________________________________________\n\n";
		
		if (empty_fields) {
			msg += "- The following required field(s) are empty:"
						+ empty_fields + "\n"
			if (errors) msg += "\n";
		}
		msg += errors;
		alert(msg);
		return false;
	}
	else 
	{
		return true;
	}

}


function validateAndSubmitForm(sFormName) 
{
	if (validateForm(sFormName))
	{
			document.forms[sFormName].submit();
	}

}