﻿//function PageQuery() {
//alert("hi from pagquery");
//var q="title";
//if(q.length > 1) this.q = q.substring(1, q.length);
//else this.q = null;
//this.keyValuePairs = new Array();
//if(q) {
//for(var i=0; i < this.q.split("&").length; i++) {
//this.keyValuePairs[i] = this.q.split("&")[i];
//}
//}
//}

function PageQuery() {
//alert('hello Start');
var query_string = unescape(location.search.substr(1));
//alert(query_string);
//alert('hello End');
return query_string;
}

 function check(star)
    {
   
        var rad = document.getElementsByName(star);
        var chk = 0;
        
        for(i=0;i<rad.length;i++)
        {
            if(rad[i].checked == true)
            {
                chk = i+1;
                break;
            }
            else
            {
                chk = 0;
            }
        }
        
        //alert(chk);
        return chk;
    }

///////////////

  function validEmail(email){
    var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 //   str = document.getElementById('emailAddress').value;
 var str=email;
    if(str.match(emailRegEx)){
        return true;
    }
    else{
       // alert('Please enter a valid email address.');
        return false;
        }
    }
/////////////////////////


//function validEmail(email)
//{
//	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
//	var checkend=/\.[a-zA-Z]{2,3}$/;
//	if((email.search(exclude) != -1) || (email.search(checkend) == -1)) { return false; }
//	var atPos = email.indexOf("@",0);
//	var pPos1 = email.indexOf(".",0);
//	var periodPos = email.indexOf(".",atPos);
//	var pos1 = pPos1;
//	var pos2 = 0;

//	while (pos2 > -1)
//	{
//		pos2 = email.indexOf(".",pos1+1);
//		if (pos2 == pos1+1) { return false; }
//		else { pos1 = pos2; }
//	}
//    if (atPos == -1) { return false; }
//	if (atPos == 0) { return false; }
//	if (pPos1 == 0) { return false; }
//	if(email.indexOf("@",atPos+1) > -1) { return false; }
//	if(periodPos == -1) { return false; }
//	if(atPos+1 == periodPos) { return false; }
//	if(periodPos+3 > email.length) { return false; }
//    return true;
//}

function isBlank(fieldName)
{
	var len,k,flg;
	flg=true;
	if(fieldName!=null)
	{
		len=fieldName.length;
		for(k=0;k<len;k++)
		{
			if(fieldName.substring(k,k+1)!=" ")
			flg=false;
		}
	}
    return flg;
}

function charsOnlyWithSpaces(fieldName)
{
	var validChars = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var temp;

	for(var i=0; i < fieldName.length; i++)
	{
		temp = fieldName.substring(i,i+1);
		if(validChars.indexOf(temp) == "-1")
		{
		
			return false;
		}
	}	
}

function numbersOnly(fieldName)
{
	var validChars = "0123456789";
	var temp;

	for(var i=0; i < fieldName.length; i++)
	{
		temp = fieldName.substring(i,i+1);
		if(validChars.indexOf(temp) == "-1") { return false; }
	}
}


 function validatemobile(txtMobileNumber)
{
//var txtMobileNumber = document.getElementById("mobile").value;
var number=true;
var lenght=true;
var intval= isInteger(txtMobileNumber);
number=intval;
if(txtMobileNumber.length < 10)
{
// args.IsValid=false;
    lenght=false;
}
if(number==false || lenght==false)
{
return false;
}

}


function isInteger (s)
   {
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);
         if(i==0)
         {
           if(c=="0")
            {
            return false;
            }
            else{
              if (!isDigitfir (c)) return false;
            }
        }
        else{

         if (!isDigit(c)) return false;
         }
      }

      return true;
   }

 function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }
function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }
     function isDigitfir (c)
   {
      return ((c >= "1") && (c <= "9"))
   }


