	//Calling Ajax Function
	function stateChanged() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	   { 
		   document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
		} 
	} 
	
	function stateChangeda() 
	{ 
		//document.getElementById("txtHint"+id_tag).refresh();
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	   { 
		   document.getElementById("txtHint"+id_tag).innerHTML=xmlHttp.responseText 
	   } 
	} 
	
	function GetXmlHttpObject()
	{
	  var xmlHttp=null;
	  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}
	
	
	//Number Validation Function only passing object  not value
	function number_valid(f) 
	{
	  	if ( f.value >=0)
			event.returnValue= true;
		else
		{
			alert("Only integer numbers allowed!");
			event.returnValue= false;
			f.value = f.value.replace(/[^.\d{2}]/g,"");
			if (f.value.length <=0)
				f.value = 0;
			f.focus;
		}
	}

	//Only Number key press event
	function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
		 if (charCode == 46)
	         return true;
         else if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
		
		return true;
      }

   function EmailValid(aemail)
{ 
    //if email field is empty - warning displays and return false
         if(aemail=="")
         {
         alert ("Email field is required. Please enter email in myemail@mysite.com format");
         return false;
         }
         //get email string length
         len = aemail.length;


         //check position of @ character.
         //it may be anywhere but not in the beginning or at the end of string.
         if((aemail.charAt(1)=='@')||(aemail.charAt(1)=='.')) {
         alert ("Invalid email. Please enter email like myemail@mysite.com");
         return false;  }
         if((aemail.charAt(len-2)=='@')||(aemail.charAt(len-2)=='.')) {
    alert ("Invalid email. Please enter email like myemail@mysite.com");
         return false;  }
    //count number of @ occurrences and number of dot occurrences
         count=0;
         dotcount=0;
    for (i=0; i< aemail.length; i++)
    {
         if(aemail.charAt(i)=='@')
         count++;
         if(aemail.charAt(i)=='.')
         dotcount++;
          }
    //if @ or dot occurs not once display warning and return false
         if((count !=1)||(dotcount !=1))
         {
    alert ("Invalid email. Please enter email like myemail@mysite.com");
         return false;
    }
    return true;
}


 function ConvertRowsToLinks(xTableId){

        var rows = document.getElementById(xTableId).getElementsByTagName("tr");
   
        for(i=0;i<rows.length;i++){
          var link = rows[i].getElementsByTagName("a")
          if(link.length == 1){
            rows[i].onclick = new Function("document.location.href='" + link[0].href + "'");
//            rows[i].onmouseover = new Function("this.className='highlight'");
//            rows[i].onmouseout = new Function("this.className=''");
          }
        }

      }
