
var x;

ns4=(document.layers)?true:false
ie4=(document.all)?true:false



	function view(fl, ft)
	{
	if(ns4)
	{
		//document.layers['Layer1'].visibility='show'
		//document.layers['Layer1'].top=ft
		//document.layers['Layer1'].left=fl
	}

	if(ie4)

	{
		//document.all['Layer1'].style.visibility='visible'
		//document.all['Layer1'].style.top=ft
		//document.all['Layer1'].style.left=fl
	        
	}

}

function VNum(formname)
{
  var checkOK = "0123456789-()";
  var checkStr = formname;
  var allValid = true;
  var mm = 0
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    //alert("Only numbers are allowed")
    return (false);
  }
  return (true);
  
}//end  of function

function VName(formname)
{
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .,_-<>()/;:+";
  var checkStr = formname;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
 
  if (!allValid)
  {
    
    return (false);
  }
  return (true);
  
}//end  of function

function trim(str)
{
	var tstr;
	var i;	
	if(str.length > 0)
	{
		i = 0
		while(str.charAt(i) == ' ') { i++ }
		tstr = str.substring(i,str.length)
		i    = tstr.length -1
		while(tstr.charAt(i) == ' ') { i --}
		tstr = tstr.substring(0,i+1)
		return(tstr)
	}
	else
	return("")
	
}//end of function trim	

function VEmail(contents)
  {
  var checkStr = contents;
  var flag1 = 0;
  var flag2 = 0;
  var cnt1=0;
  var cnt2=0;
  var ch;
  
  if(checkStr.length<7){
	return false;
  }	
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    if(ch == "@" && i>=1)//checkStr.length > 6)
       {	
		 cnt1 = i;
         flag1 = 1;  
       } 
    if(ch == "." && i>=4)//checkStr.length > 6)
       {
		 cnt2 = i;
         flag2 = 1;  
       }
		   
        
   }
   if((cnt2 - cnt1)<=2){
	 return false;
   }
   if((checkStr.length - cnt2) <=2){
		return false;
   }
    if (flag1 == 0 || flag2 == 0)
		{
			return (false);
		}
    return true;
 }
 



