function validRequired(formField,fieldLabel) {
	var result = true;
	if(formField.value == "") {
		alert('Please enter a value for the "' + fieldLabel + '" field.');
		formField.focus();
		result = false;
	}
	return result;
}

function allDigits(str) {
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset) {
	var result = true;
	//Note : does'nt use regular expressions to avoid early mac browswer bugs
	for (var i=0;i<str.length;i++)
		if(charset.indexOf(str.substr(i,1))<0) {
			result = false;
			break;
		}
	return result;
}

function validNum(formField,fieldLabel,required) {
	var result = true;
	if(required && !validRequired(formField,fieldLabel))
		result = false;
			
	if(result) {
		if(!allDigits(formField.value)) {
			alert('Please enter a number for the "' + fieldLabel + '" field.');
			formField.focus();
			result = false;
		}
	}
	return result;
}

function validEmail(formField) {
	var result = true;
	var string1=formField.value;
	if(formField.value == "") {
		alert('Please enter a value for the Email field.');
		formField.focus();
		result = false;
	} else if(string1.indexOf("@")==-1 || string1.indexOf(".")==-1) {
		alert('That is not a correct email address');
		formField.focus();
		result = false;
	}

	return result;
}
function checkMinMax(theForm,minVname,maxVname) {
	//Check min and max values
	var minValue = Number(minVname.value);
	var maxValue = Number(maxVname.value);

	if (maxValue<=0) {
		maxValue = 10000000;
	}
	if (minValue>maxValue) {
		alert("The minimum value is MORE than the maximum value");
		return false;
	} else {
		return true;
	}
}
//confirm the delete of info
function deleteInfo(url)	{
	if (confirm("Delete this Item ?") == true) {
		//alert(url);
		window.navigate(url);
	}
}
//The function for a jump menu
function jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//build a window complex
function openWinComplex(theURL,winName,Bwidth,Bheight) {
  var w=Bwidth;
  var h=Bheight;
  var left = (screen.width/2) - w/2;
  var top = (screen.height/2) - h/2;
  var styleStr =  'width='+w+',height='+h+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  window.open(theURL,winName,styleStr);
}
//build a window basic
function openWinBasic(theURL,winName) { 
  window.open(theURL,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//resize window
var i=0;
function resize() {
  if (navigator.appName == 'Netscape') i=40;
  if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
  self.focus();
}