

function moveOnMax(field,nextFieldID){
  if(field.value.length >= field.maxLength){
    document.getElementById(nextFieldID).focus();
  }
}

function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Are you sure you want to log out?'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}

function WindowOpen(url,name,w,h)
{




  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  var win = window.open(url,name,'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');

  win.resizeTo(w, h);
  win.moveTo(wleft, wtop);
  win.focus();

}

function WindowOpenNS(url,name,w,h)
{

  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  var win = window.open(url,name,'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');

  win.resizeTo(w, h);
  win.moveTo(wleft, wtop);
  win.focus();

}

function checkForm(theForm)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.elements.Email.value))
{
if(theForm.elements.Comments.value == "")
{
alert("Please enter your comments.");
theForm.elements.Comments.focus();
return false;
}
}
else
{
alert("Please enter a valid email address.")
theForm.elements.Email.focus();
return false
}
}

function checkEmail(theForm)
{

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.elements.ea.value))
{
if(theForm.elements.ea.value == 'you@yourdomain.com')
{
alert("Please enter a valid email address.");
theForm.elements.ea.focus();
return false;
}
}
else
{
alert("Please enter a valid email address.")
theForm.elements.ea.focus();
return (false)
}
}

function checkSearch(theForm)
{

if(theForm.elements.story.value == "Search News" || theForm.elements.story.value == "")
{
alert("Please enter a search term.");
theForm.elements.story.focus();
return false;
} 
}

function checkForm2(theForm)
{

if(theForm.elements.y_name.value == "")
{
alert("Please enter your name.");
theForm.elements.y_name.focus();
return false;
} else if(theForm.elements.y_mail.value == "")
{
alert("Please enter your email address.");
theForm.elements.y_mail.focus();
return false;
} else if(theForm.elements.f_name.value == "")
{
alert("Please enter your friends name.");
theForm.elements.f_name.focus();
return false;
} else if(theForm.elements.f_mail.value == "")
{
alert("Please enter your friends email address.");
theForm.elements.f_mail.focus();
return false;
}
}
function checkForm3(theForm)
{

if(theForm.elements.comments.value == "")
{
alert("Please enter your comments.");
theForm.elements.comments.focus();
return false;
}
}
