function name_val(e)
  {
	
	if (window.event)key = window.event.keyCode; else if (e) key = e.which; else  return true;
	var unicode=e.charCode? e.charCode : e.keyCode
	//alert(unicode);
	var	keychar = String.fromCharCode(key);
	if((keychar=='%')&&(unicode==37)||(keychar=='.')&&(unicode==46))
	{ return false; }
	else
	{
	document.all ? k = e.keyCode : k = e.which;
	return ((unicode > 64 && unicode < 91) || (unicode > 96 && unicode < 123) || unicode == 8 || unicode == 9 || unicode == 32 || unicode==46 || unicode==37 || unicode==39 || unicode==116);
	}

 } 
function number_val(t)
{
	var v = "0123456789";
    var w = "";
    for (i=0; i < t.value.length; i++) {
        x = t.value.charAt(i);
        if (v.indexOf(x,0) != -1)
        w += x;
    }
    t.value = w; 
} 

function val_email(txt,spanid)
{
	var email = document.getElementById(txt).value;	 
    if(!valemail(email))
	{
		 document.getElementById(spanid).innerHTML="";
		 document.getElementById(spanid).innerHTML="Invalid Email..";
	}	
	if(valemail(email))
	{
			document.getElementById(spanid).innerHTML="";		
	} 	
    return true;
}

function valemail(email)
{
  var RegExp = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z\-]+\.)+))([a-zA-Z]{2,3})(\]?)$/
    if(RegExp.test(email)){
        return true;
    }else{
        return false;
    }
}
 
function val_EmptyText(txtControl,msgControl,strName)
{	
  	   if(txtControl.value=='')
       {
	     	document.getElementById(msgControl).innerHTML= "Please enter the "+strName;			
	       	return false;
       }
       else
       {
    		document.getElementById(msgControl).innerHTML="";
            return true;	
       }
}

function val_EmptyText1(txtControl,msgControl,strName)
{
      if(txtControl.value=='')
      {
	     	document.getElementById(msgControl).innerHTML= "Please enter the "+strName;			
	  }      
}

function val_Emptyddl(ddlControl,msgControl,strName)
{
	if(ddlControl.selectedIndex==0)
	{
			document.getElementById(msgControl).innerHTML= "Please select the "+strName;
	}
}
function val_clearddl(span_id,ddlctrl)
{	
	if((document.getElementById(ddlctrl).selectedIndex)!=0)
	{
		document.getElementById(span_id).innerHTML="";
		return true;
	}
	else
	{
	   return false;
	}
	return true;	
}

function verify()
{
	if(a.value==b.value)
	{	
	}
	else
	{
		alert("Fail");
		document.getElementById('verification').focus();
		return false;		
	}
	return true;
}
 
 
function one()
{
 	var a=document.getElementById('verify').value;
	var b=document.getElementById('txtverification').value;
	if(a==b)
	{	        
			return true;
	}
	else
	{
		document.getElementById('verificationError').innerHTML="verification does not match";
		document.getElementById('txtverification').focus();
		return false;
	}
}

function val_spanid(span_id,ddlctrl)
{
	if((document.getElementById(ddlctrl).selectedIndex)!=0)
	{
		document.getElementById(span_id).innerHTML="";
		return true;
	}
}

function val_comment(txtControl,msgControl)
{	
	if((txtControl.value).length==0)
	{
		return true;
	}
	if(((txtControl.value).length<50) || ((txtControl.value).length>250))
	{
		document.getElementById(msgControl).innerHTML="comment should be 50 to 250 char long...";		
	}
	else
	{
		document.getElementById(msgControl).innerHTML="";
		return true;
	}
}

function disableEvents1()
{
document.onmousedown = showDisabledMessage;

}
function disableEvents()
{
document.onselectstart = showDisabledMessage;

}

function showDisabledMessage()
{
return false;
}
 
 function disableEvents3()
{
document.onselectstart = showDisabledMessage1;
}

function disableEvents4()
{
document.onmousedown = showDisabledMessage1;

}
function showDisabledMessage1()
{
return true;
}