  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-4163080-29']);

  _gaq.push(['_trackPageview']);

 

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

function ChkKWord()
{
	if (document.frmsrchj.KWord.value=='')
	{
		alert('Please Enter Search KeyWord First !');
		return false;
	}
	else if (document.frmsrchj.KWord.value=='%' || document.frmsrchj.KWord.value=='_' || document.frmsrchj.KWord.value=='&' || document.frmsrchj.KWord.value=='AND' || document.frmsrchj.KWord.value=='And' || document.frmsrchj.KWord.value=='and')
	{
		alert('Please Enter Valid KeyWord !');
		return false;
	}
	else
		{return true;}
}

function ChkKW()
{
	if (document.frmsrch.search.value=='' && document.frmsrch.author.value=='')
	{
		alert('Please Enter Search KeyWord First !');
		return false;
	}
	else if (document.frmsrch.search.value=='%' || document.frmsrch.search.value=='_' || document.frmsrch.search.value=='&' || document.frmsrch.search.value=='AND' || document.frmsrch.search.value=='And' || document.frmsrch.search.value=='and')
	{
		alert('Please Enter Valid KeyWord !');
		return false;
	}
	else if (document.frmsrch.author.value=='%' || document.frmsrch.author.value=='_')
	{
		alert('Please Enter Valid KeyWord !');
		return false;
	}
	else
		{return true;}
}
//code added by deepak on 1/09/2010 for email validation in pages.
function chkvldemail(email_address)
   {
         //Assumes that valid email addresses consist of user_name@domain.tld
         at = email_address.indexOf('@');
         dot = email_address.indexOf('.');
         
         if(at == -1 || 
            dot == -1 ||         
            dot == 0 || 
            dot == email_address.length - 1)
		{//alert("Please enter valid email address.");
            return(false);
		}
            
         user_name = email_address.substr(0, at);
         domain_name = email_address.substr(at + 1, email_address.length);                  

         if(Validate_String(user_name) === false || Validate_String(domain_name) === false)
		{	
			//alert("Please enter valid email address.");
	            return(false); 
                }
         else
		 return(true);
}
function trimstr(par)
{

	while (par.charAt(0)==" ")
	{
		par=par.replace(" ","")
	}
	i=par.length-1
	while(par.charAt(i)==" ")
	{
		par=par.slice(0,i)
		i=i-1
	}
	return par
}
function Validate_String(string, return_invalid_chars)
         {
         valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         invalid_chars = '';
         
         if(string == null || string == '')
            return(true);
         
         //For every character on the string.   
         for(index = 0; index < string.length; index++)
            {
            charx = string.substr(index, 1);                        
            
            //Is it a valid character?
            if(valid_chars.indexOf(charx) == -1)
              {
              //If not, is it already on the list of invalid characters?
              if(invalid_chars.indexOf(charx) == -1)
                {
                //If it's not, add it.
                if(invalid_chars == '')
                   invalid_chars += charx;
                else
                   invalid_chars += ', ' + charx;
                }
              }
            }                     
            
         //If the string does not contain invalid characters, the function will return true.
         //If it does, it will either return false or a list of the invalid characters used
         //in the string, depending on the value of the second parameter.
         if(return_invalid_chars == true && invalid_chars != '')
           {
           last_comma = invalid_chars.lastIndexOf(',');
           
           if(last_comma != -1)
              invalid_chars = invalid_chars.substr(0, $last_comma) + 
              ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);
                      
           return(invalid_chars);
           }
         else
           return(invalid_chars == ''); 
         }


//Till here

