function toggleimage(imageobj)
{
  if (parseInt(navigator.appVersion,10)>=3)
  {
    if (imageobj.src.substring(imageobj.src.lastIndexOf('.')-1,imageobj.src.lastIndexOf('.'))=='_')
    {
      imageobj.src=imageobj.src.substring(0,imageobj.src.lastIndexOf('.')-1)+imageobj.src.substring(imageobj.src.lastIndexOf('.'),imageobj.src.length);
    }
    else
    {
      imageobj.src=imageobj.src.substring(0,imageobj.src.lastIndexOf('.'))+'_'+imageobj.src.substring(imageobj.src.lastIndexOf('.'),imageobj.src.length);
    }
  }
  return true;
}

function checkemail(str)
{
  // Checks for a valid possible email address
  // Does NOT check whether the email address is operational
  var filter=/^\S+@\w[\w|\.|\-|\_]*\.[a-z][a-z]+$/i
  return (filter.test(str))
}

function checkpassword(str)
{
  // Checks for letters and numbers only, minimum length 4 characters
  var filter=/^[a-z|0-9][a-z|0-9][a-z|0-9][a-z|0-9]+$/i
  return (filter.test(str))
}

function resizeandcentrewindow(newWidth,newHeight)
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else
	{
	  return;
	}
	
	if ( newWidth>self.screen.width ) newWidth=self.screen.width;
	if ( newHeight>self.screen.height-32 ) newHeight=self.screen.height-32;
	
	if (document.layers)
	{
		tmp1 = parent.outerWidth - parent.innerWidth;
		tmp2 = parent.outerHeight - parent.innerHeight;
		newWidth -= tmp1;
		newHeight -= tmp2;
	}
	parent.window.resizeTo(newWidth,newHeight);
	parent.window.moveTo((self.screen.width-newWidth)/2,(self.screen.height-32-newHeight)/2);
}

function linkcheckbox(linkid,checkboxobject,offurl,onurl)
{
  if ( checkboxobject.checked )
  {
    document.links(linkid).href=onurl;
  }
  else
  {
    document.links(linkid).href=offurl;
  }
}
