function getkey(e) {
  if (window.event)
    return window.event.keyCode;
  else if (e)
    return e.which;
  else
    return null;
}
function goodchars(e, goods) {
  var key;
  var keychar;
  key = getkey(e);
  if (key == null) return true;
  
  // get character
  keychar = String.fromCharCode(key);
  keychar = keychar.toLowerCase();
  goods = goods.toLowerCase();
  
  // check goodkeys
  if (goods.indexOf(keychar) != -1)
  	return true;
  
  // control keys
  if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
     return true;
  
  // else return false
  return false;
}
function RollOver1(ent, obj) {
  var object = document.getElementById(obj);
  if (ent==1) {
    object.style.display='inline';
    object.style.visibility='visible';
	
	
	

	
  }
  else {
    object.style.display='inline';
    object.style.visibility='hidden';
  }
}
function RollOver2(ent, obj) {
  var object = document.getElementById(obj);
  if (ent==1) {
    object.style.display='inline';
    object.style.visibility='visible';
	//object.style.top='275px';
	//object.style.left='250px';
	

	
  }
  else {
    object.style.display='inline';
    object.style.visibility='hidden';
  }
}



/*


function chkspc(cntrl) {
	var spchars;
	var spcsts;
	var len = document.getElementById(cntrl).value.length - 1;
	spchars = " ";
	spcsts = "f"; //false
	if(spchars.indexOf(document.getElementById(cntrl).value.charAt(0)) != -1)
	{
		spcsts = "t"; //true
    alert("Input cannot begin with a space");
	}
	else if(spchars.indexOf(document.getElementById(cntrl).value.charAt(len)) != -1)
	{
		spcsts = "t"; //true
    alert("Input cannot end with a space");
	}
	if(spcsts == "t") {}
		document.getElementById(cntrl).focus();
		return false;				
	}
}
function validchars(fldname,sts,msg) {		
	var fldlen = document.getElementById(fldname).value.length;
	var chksts = sts;
	if(chksts == "genchars") {
		var ichars = "!@$#%^&*()+=-[]\\\':,./{}|\":<>?";
	}
	else if(chksts == "mailchars") {
		var ichars = "!$#%^&*()+=-[]\\\':,/{}|\":<>?";
	}
	else if(chksts == "sexchars") {
		var ichars = "!@$#%^&*()+=-[]\\\':,./{}|\":<>?abcdeghijklnopqrstuvwxyzABCDEGHIJKLNOPQRSTUVWXYZ0123456789";
	}
	else if(chksts == "datchars") {
		var ichars = "!@$#%^&*()+=[]\\\':,.{}|\":<>?abcdeghijklmnopqrstuvwxyzABCDEGHIJKLMNOPQRSTUVWXYZ";
	}
	else if(chksts == "adrchars") {
		var ichars = "!@$#%^&*()+=[]\\\':.{}|\":<>?";
	}
	for(var i=0;i < document.getElementById(fldname).value.length;i++) {
		if(ichars.indexOf(document.getElementById(fldname).value.charAt(i)) != -1) 	{
			alert(msg + " contains invalid characters");
			document.getElementById(fldname).focus();
			return false;
		}	
	}
}
function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Invalid email address")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid email address")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid email address")
      return false
  }
  if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid email address")
      return false
  }
  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    alert("Invalid email address")
    return false
  }
  if (str.indexOf(dot,(lat+2))==-1){
    alert("Invalid email address")
    return false
  }
  if (str.indexOf(" ")!=-1){
    alert("Invalid email address")
    return false
  }
  return true          
}
function validate() {     

  if(document.news.name.value=="") {
    alert("Enter your name");
    document.news.name.focus();
    return false;
  }
  else if(document.news.name.value!="") {
    if(chkspc("name") == false || validchars("name","genchars","Name") == false) {
      return false
    }
  }
  if(document.news.email.value=="") {
    alert("Enter your email");
    document.news.email.focus();
    return false;
  }
  else if(echeck(document.news.email.value)==false) {
    document.news.email.focus()
    return false;
  }
  if(document.news.email.value != "") {
    if(chkspc("email") == false || validchars("email","mailchars","Email") == false) {
      return false
    }
  }
  if(document.news.telephone.value=="") {
    alert("Enter your telephone no.");
    document.news.telephone.focus();
    return false;
  }
  if(document.news.comments.value=="") {
    alert("Enter your comments");
    document.news.comments.focus();
    return false;
  }
  else if(document.news.comments.value!="") {
    if(chkspc("comments") == false) {
      return false
    }
  }  
  return true;
}

*/

