/*
 * This is the function that actually highlights a text string by
 * adding HTML tags before and after all occurrences of the search
 * term. You can pass your own tags if you'd like, or if the
 * highlightStartTag or highlightEndTag parameters are omitted or
 * are empty strings then the default <font> tags will be used.
 */
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag) 
{
  // the highlightStartTag and highlightEndTag parameters are optional
  if ((!highlightStartTag) || (!highlightEndTag)) {
    highlightStartTag = "<font style='color:blue; background-color:yellow;'>";
    highlightEndTag = "</font>";
  }
  
  // find all occurences of the search term in the given text,
  // and add some "highlight" tags to them (we're not using a
  // regular expression search, because we want to filter out
  // matches that occur within HTML tags and script blocks, so
  // we have to do a little extra validation)
  var newText = "";
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
    
  while (bodyText.length > 0) {
    i = lcBodyText.indexOf(lcSearchTerm, i+1);
    if (i < 0) {
      newText += bodyText;
      bodyText = "";
    } else {
      // skip anything inside an HTML tag
      if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
        // skip anything inside a <script> block
        if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
          newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
          bodyText = bodyText.substr(i + searchTerm.length);
          lcBodyText = bodyText.toLowerCase();
          i = -1;
        }
      }
    }
  }
  
  return newText;
}


/*
 * This is sort of a wrapper function to the doHighlight function.
 * It takes the searchText that you pass, optionally splits it into
 * separate words, and transforms the text on the current web page.
 * Only the "searchText" parameter is required; all other parameters
 * are optional and can be omitted.
 */
function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)
{
  // if the treatAsPhrase parameter is true, then we should search for 
  // the entire phrase that was entered; otherwise, we will split the
  // search string so that each word is searched for and highlighted
  // individually
  if (treatAsPhrase) {
    searchArray = [searchText];
  } else {
    searchArray = searchText.split(" ");
  }
  
  if (!document.body || typeof(document.body.innerHTML) == "undefined") {
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i < searchArray.length; i++) {
    bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
  }
  
  document.body.innerHTML = bodyText;
  return true;
}


/*
 * This displays a dialog box that allows a user to enter their own
 * search terms to highlight on the page, and then passes the search
 * text or phrase to the highlightSearchTerms function. All parameters
 * are optional.
 */
function searchPrompt(treatAsPhrase, textColor, bgColor)
{
  // This function prompts the user for any words that should
  // be highlighted on this web page
   
  // we can optionally use our own highlight tag values
  if ((!textColor) || (!bgColor)) {
    highlightStartTag = "";
    highlightEndTag = "";
  } else {
    highlightStartTag = "<font style='color:" + textColor + "; background-color:" + bgColor + ";'>";
    highlightEndTag = "</font>";
  }
  
    
  searchText = document.getElementById('search').value;

  if (!searchText)  {
    alert("No search terms were entered.");
    return false;
  }
  
  return highlightSearchTerms(searchText, treatAsPhrase, true, highlightStartTag, highlightEndTag);
}


/*
 * This function takes a referer/referrer string and parses it
 * to determine if it contains any search terms. If it does, the
 * search terms are passed to the highlightSearchTerms function
 * so they can be highlighted on the current page.
 */
function highlightGoogleSearchTerms(referrer)
{
  // This function has only been very lightly tested against
  // typical Google search URLs. If you wanted the Google search
  // terms to be automatically highlighted on a page, you could
  // call the function in the onload event of your <body> tag, 
  // like this:
  //   <body onload='highlightGoogleSearchTerms(document.referrer);'>
  
  //var referrer = document.referrer;
  if (!referrer) {
    return false;
  }
  
  var queryPrefix = "q=";
  var startPos = referrer.toLowerCase().indexOf(queryPrefix);
  if ((startPos < 0) || (startPos + queryPrefix.length == referrer.length)) {
    return false;
  }
  
  var endPos = referrer.indexOf("&", startPos);
  if (endPos < 0) {
    endPos = referrer.length;
  }
  
  var queryString = referrer.substring(startPos + queryPrefix.length, endPos);
  // fix the space characters
  queryString = queryString.replace(/%20/gi, " ");
  queryString = queryString.replace(/\+/gi, " ");
  // remove the quotes (if you're really creative, you could search for the
  // terms within the quotes as phrases, and everything else as single terms)
  queryString = queryString.replace(/%22/gi, "");
  queryString = queryString.replace(/\"/gi, "");
  
  return highlightSearchTerms(queryString, false);
}


/*
 * This function is just an easy way to test the highlightGoogleSearchTerms
 * function.
 */
function testHighlightGoogleSearchTerms()
{
  var referrerString = "http://www.google.com/search?q=javascript%20highlight&start=0";
  referrerString = prompt("Test the following referrer string:", referrerString);
  return highlightGoogleSearchTerms(referrerString);
}





/******************************************************************************************
Function Name : f_isEmpty
Input : String 
Output : true or false
Description : This function returns true if string is not empty o.w. returns false.
******************************************************************************************/
function f_isEmpty(msStr)
{   

    var   msTemp=msStr;
    for(mnI=0;mnI<msTemp.length;mnI++)
    {
     // find out ascii value of each character   
     temp=msTemp.charCodeAt(mnI);
    if ( temp != 10 &&  temp != 13 &&  temp != "@" &&  temp != 32)
                    {
                        return false;
                    }
    }
    msStr.value="";
    return true;
}

/******************************************************************************************
Function Name : f_isNumber
Input : String 
Output : true or false
Description : This function returns true if string is numeric o.w. returns false.
******************************************************************************************/
function f_isNumber(str)
{
	nstr = '0123456789';
    err = 0;
    for (f=0;f<str.length;f++){
      if (nstr.indexOf(str.charAt(f)) == -1) err++;
    }
    if (err!=0) return false;
    else return true;
}

/******************************************************************************************
Function Name : f_isFloatNumber
Input : String 
Output : true or false
Description : This function returns true if string is numeric o.w. returns false.
******************************************************************************************/
function f_isFloatNumber(sStr)
{
var msStr = "0123456789.";
var d1 = sStr.indexOf(".");
var d2 = sStr.lastIndexOf(".");

if ((d1 >= 0 && d2 >= 0) && d1 != d2)
{
return false;
}
for (i=0;i<sStr.length;i++)
{
if ( msStr.indexOf(sStr.charAt(i)) == -1 )
{
return false; // Not Numeric....
}
}
return true; // string is Numeric....
}

/******************************************************************************************
Function Name : f_isValidPhone
Input : String i.e. an email address
Output : true or false
Description : This function returns true if email id is valid o.w. returns false.
******************************************************************************************/
function IsValidphone(phone)
{
 var list="0123456789- + _.()";
  var str = phone
  for(var i=0; i<str.length; i++){
	if(list.indexOf(str.charAt(i))<0){      
      return false;
	}
   }
	return true;
 }

/******************************************************************************************
Function Name : IsValidName
Input : String 
Output : true or false
Description : This function returns true if name is valid o.w. returns false.
******************************************************************************************/
function IsValidName(Name)
{
  var list="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ~!@#$%^&*()_+=\|]}[{';:/?.,><";
  var str = Name
  err = 0;
  for(i=0; i<str.length; i++){
  	if(list.indexOf(str.charAt(i))==-1)
  		err++;
  	}
  		if(err!=0) return true;
  	else return false;
 }
 
 
 
/******************************************************************************************
Function Name : Check_email
Input : String i.e. an email address
Output : true or false
Description : This function returns true if email id is valid o.w. returns false.
******************************************************************************************/
function Check_email(emailStr) 
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	
	if (matchArray==null) 
	{  
		alert("Email address seems incorrect (check @ and .'s)")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) 
	{
	    alert("The username doesn't seem to be valid.")
	    return false
	}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) 
	{  
		  for (var i=1;i<=4;i++) 
		  {
		    if (IPArray[i]>255) 
			{
		        alert("Destination IP address is invalid!")
				return false
		    }
	    }
	    return true
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) 
	{
		alert("The domain name doesn't seem to be valid.")
	    return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
	{   
	   alert("The address must end in a three-letter domain, or two letter country.")
	   return false
	}
	if (len<2) 
	{
	   var errStr="This address is missing a hostname!"
	   alert(errStr)
	   return false
	}
	return true;
}
/******************************************************************************************/

/******************************************************************************************
Function Name : Compares two dates
Input : accepts two dates - date1, date2
Output : true or false
Description : This function returns        
		0 if two dates are equal
		1 if date1 is greater than date 2 
	   -1 if date1 is less than date2
******************************************************************************************/
function f_DateCompare(nMonth,nDay,nYear,date2)
{
		var str=nMonth+"/"+nDay+"/"+nYear;
		var dateStr1=str;
		var dateStr2=date2;
			
		var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
		
		var matchArray1 = dateStr1.match(datePat); // is the format ok?
		var ma1=dateStr1
		maarray1=ma1.match(datePat);
		if (matchArray1 == null) 
			{
				alert("Date1 is not in a valid format.")
				return false;
			}
		
		var matchArray2 = dateStr2.match(datePat); // 
		var ma2=date2;
		maarray2=ma2.match(datePat);
		
		if (matchArray2 == null) 
			{
				alert("Date2 is not in a valid format.")
				return false;
			}
	
		month1 = matchArray1[1]; // parse date into variables
		day1 = matchArray1[3];
		year1 = matchArray1[4];
		yea1=year1.length
		if(yea1 < 4)
		{
			alert("Date1 should be in mm/dd/yyyy format");
			return false;
		}
		month2 = matchArray2[1]; // parse date into variables
		day2 = matchArray2[3];
		year2 = matchArray2[4];
		yea2=year2.length
		if(yea2 < 4)
		{
			alert("Date2 should be in mm/dd/yyyy format");
			return false;
		}
	if (month1 < 1 || month1 > 12) 
		{ 
			// check month range
			alert("Date1 Error: Month must be between 1 and 12.");
			return false;
		}
	if (day1 < 1 || day1 > 31) 
		{
			alert("Date1 Error: Day must be between 1 and 31.");
			return false;
		}

	if ((month1==4 || month1==6 || month1==9 || month1==11) && day1==31) 
		{
			alert("Date1 Error: Month in Date1  doesn't have 31 days!");
			return false;
		}
	if (month1 == 2) 
		{ // check for february 29th
			var isleap = (year1 % 4 == 0 && (year1 % 100 != 0 || year1 % 400 == 0));
			if (day1>29 || (day1==29 && !isleap)) 
				{
					alert("Wrong Date1: February " + year1 + " doesn't have " + day1 + " days! \n As it is not a Leap Year");
					return false;
			   }
		}
	
	if (month2 < 1 || month2 > 12) 
		{ 
			// check month range
			alert("Date2 Error: Month must be between 1 and 12.");
			return false;
		}

	if (day2 < 1 || day2 > 31) 
		{
			alert("Date2 Error: Day must be between 1 and 31.");
			return false;
		}

	if ((month2==4 || month2==6 || month2==9 || month2==11) && day2==31) 
		{
			alert("Month in Date2  doesn't have 31 days!");
			return false;
		}
	if (month2 == 2) 
		{ // check for february 29th
			var isleap = (year2 % 4 == 0 && (year2 % 100 != 0 || year2 % 400 == 0));
			if (day2>29 || (day2==29 && !isleap)) 
				{
					alert("Wrong Date1: February " + year2 + " doesn't have " + day2 + " days! \n As it is not a Leap Year");
					return false;
			   }
		}
	
 // Till here both dates are OK... Now actual Comparison starts from here....!!!
		if (year1 == year2)
		{
			if (month1 == month2)
			{
				if (day1 == day2)
				{
					return 0; // dates are equal
				}
				else if (day1 > day2)
				{
					return 1; // date1 > date2
				}
				else 
				{
					return -1; // date1 < date2
				}
			}
			else if (month1 > month2 )
			{                   
				return 1; //date1 > date 2
			}
			else
			{
				return -1; // date1 < date 2
			}
		}
		else if (year1 > year2)
		{
			return 1; // date1 > date 2
		}
		else
		{
			return -1; // date1 < date2
		}
}

/******************************************************************************************
Function Name : Validation of date
Input : accepts date - date1
Output : true or false
Description : This function returns true or fasle if date is not in valid format       
		
******************************************************************************************/
function f_ValidDate(nMonth,nDay,nYear)
{
		var str=nMonth+"/"+nDay+"/"+nYear;
		var dateStr1=str;
					
		var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
		
		var matchArray1 = dateStr1.match(datePat); // is the format ok?
		var ma1=dateStr1
		maarray1=ma1.match(datePat);
		if (matchArray1 == null) 
			{
				return false;
			}
		
		month1 = matchArray1[1]; // parse date into variables
		day1 = matchArray1[3];
		year1 = matchArray1[4];
		yea1=year1.length
		if(yea1 < 4)
		{
			alert("Date should be in mm/dd/yyyy format");
			return false;
		}
		
	if (month1 < 1 || month1 > 12) 
		{ 
			// check month range
			alert("Date Error: Month must be between 1 and 12.");
			return false;
		}
	if (day1 < 1 || day1 > 31) 
		{
			alert("Date Error: Day must be between 1 and 31.");
			return false;
		}

	if ((month1==4 || month1==6 || month1==9 || month1==11) && day1==31) 
		{
			alert("Date Error: Month in Date1  doesn't have 31 days!");
			return false;
		}
	if (month1 == 2) 
		{ // check for february 29th
			var isleap = (year1 % 4 == 0 && (year1 % 100 != 0 || year1 % 400 == 0));
			if (day1==29 && !isleap) 
				{
					alert("February " + year1 + " doesn't have " + day1 + " days! \n As it is not a Leap Year");
					return false;
			   }
			if (day1>29) 
				{
					alert("February " + year1 + " doesn't have " + day1 + " days!");
					return false;
			   }   
		}
		return true;
}



function comparedate(value1,value2)
{
   var date1, date2;
   var month1, month2;
   var year1, year2;

   month1 = value1.substring (0, value1.indexOf ("/"));
   date1 = value1.substring (value1.indexOf ("/")+1, value1.lastIndexOf ("/"));
   year1 = value1.substring (value1.lastIndexOf ("/")+1, value1.length);

   month2 = value2.substring (0, value2.indexOf ("/"));
   date2 = value2.substring (value2.indexOf ("/")+1, value2.lastIndexOf ("/"));
   year2 = value2.substring (value2.lastIndexOf ("/")+1, value2.length);

   if (year1 > year2) return 1;
   else if (year1 < year2) return -1;
   else if (month1 > month2) return 1;
   else if (month1 < month2) return -1;
   else if (date1 > date2) return 1;
   else if (date1 < date2) return -1;
   else return 0;
}
/******************************************************************************************/


function validate_qc()
{
 if(f_isEmpty(document.getElementById("txtname").value))
 {
	window.alert("Please enter your name");
	document.getElementById("txtname").value='';
	document.getElementById("txtname").focus();
	return false;
 }
 if(IsValidName(document.getElementById("txtname").value))
 {
	window.alert("Please enter valid name");
	document.getElementById("txtname").value='';
	document.getElementById("txtname").focus();
	return false;
 }
 
 if(f_isEmpty(document.getElementById("txtemail").value))
 {
	window.alert("Please enter your email address");
	document.getElementById("txtemail").value='';
	document.getElementById("txtemail").focus();
	return false;	
 }
 if(!(Check_email(document.getElementById("txtemail").value)))
 {
    document.getElementById("txtemail").value='';
    document.getElementById("txtemail").focus();
    return false;
 } 
 if(f_isEmpty(document.getElementById("txtcourse").value))
 {
	window.alert("Please enter Course");
	document.getElementById("txtcourse").value='';
	document.getElementById("txtcourse").focus();
	return false;	
 } 
 if(f_isEmpty(document.getElementById("txtphone").value))
 {
	window.alert("Please enter your phone number");
	document.getElementById("txtphone").value='';
	document.getElementById("txtphone").focus();
	return false;
 }
 if(!(IsValidphone(document.getElementById("txtphone").value)))
 {
	window.alert("Please enter valid phone number");
	document.getElementById("txtphone").value='';
	document.getElementById("txtphone").focus();
	return false;
 }
 
}

function validate_online()
{
 if(f_isEmpty(document.getElementById("txtEnrollmentNo").value))
 {
	window.alert("Please enter Enrollment No.");
	document.getElementById("txtEnrollmentNo").value='';
	document.getElementById("txtEnrollmentNo").focus();
	return false;
 }
  
 if(f_isEmpty(document.getElementById("score").value))
 {
	window.alert("Please enter your score");
	document.getElementById("score").value='';
	document.getElementById("score").focus();
	return false;	
 }
 
 if(!f_isNumber(document.getElementById("score").value))
 {
	window.alert("Please enter valid score(only number)");
	document.getElementById("score").value='';
	document.getElementById("score").focus();
	return false;	
 }
 
 
 if(f_isEmpty(document.getElementById("txtFullName").value))
 {
	window.alert("Please enter your Full Name");
	document.getElementById("txtFullName").value='';
	document.getElementById("txtFullName").focus();
	return false;	
 }
 
 if(IsValidName(document.getElementById("txtFullName").value))
 {
	window.alert("Please enter valid Full Name");
	document.getElementById("txtFullName").value='';
	document.getElementById("txtFullName").focus();
	return false;	
 }
 
if(IsValidName(document.getElementById("txtPerCity").value))
 {
	window.alert("Please enter valid City");
	document.getElementById("txtPerCity").value='';
	document.getElementById("txtPerCity").focus();
	return false;	
 }


 if(!f_isNumber(document.getElementById("txtPerPin").value))
 {
	window.alert("Please enter valid pin number");
	document.getElementById("txtPerPin").value='';
	document.getElementById("txtPerPin").focus();
	return false;	
 }
  if(f_isEmpty(document.getElementById("txtPerEmail").value))
 {
	window.alert("Please enter your Email Id");
	document.getElementById("txtPerEmail").value='';
	document.getElementById("txtPerEmail").focus();
	return false;	
 }
 
 if(!(Check_email(document.getElementById("txtPerEmail").value)))
 {
    document.getElementById("txtPerEmail").value='';
    document.getElementById("txtPerEmail").focus();
    return false;
 } 
 
 if(f_isEmpty(document.getElementById("txtPerPhone").value))
 {
	window.alert("Please enter your phone number");
	document.getElementById("txtPerPhone").value='';
	document.getElementById("txtPerPhone").focus();
	return false;
 }
 if(!(IsValidphone(document.getElementById("txtPerPhone").value)))
 {
	window.alert("Please enter valid phone number");
	document.getElementById("txtPerPhone").value='';
	document.getElementById("txtPerPhone").focus();
	return false;
 }
 
  if(IsValidName(document.getElementById("txtFatherName").value))
 {
	window.alert("Please enter valid Father Name");
	document.getElementById("txtFatherName").value='';
	document.getElementById("txtFatherName").focus();
	return false;	
 }
  if(IsValidName(document.getElementById("txtContactCity").value))
 {
	window.alert("Please enter valid Contact City Name");
	document.getElementById("txtContactCity").value='';
	document.getElementById("txtContactCity").focus();
	return false;	
 }
 
 if(!f_isNumber(document.getElementById("txtContactPin").value))
 {
	window.alert("Please enter valid contact address pin number");
	document.getElementById("txtContactPin").value='';
	document.getElementById("txtContactPin").focus();
	return false;	
 }
 
 if(!(IsValidphone(document.getElementById("txtContactFax").value)))
 {
	window.alert("Please enter valid contact fax number");
	document.getElementById("txtContactFax").value='';
	document.getElementById("txtContactFax").focus();
	return false;
 }
 if(!(IsValidphone(document.getElementById("txtContactPhone").value)))
 {
	window.alert("Please enter valid contact phone number");
	document.getElementById("txtContactPhone").value='';
	document.getElementById("txtContactPhone").focus();
	return false;
 }
  if(IsValidName(document.getElementById("txtUniBoard").value))
 {
	window.alert("Please enter valid University/Board Name");
	document.getElementById("txtUniBoard").value='';
	document.getElementById("txtUniBoard").focus();
	return false;	
 }
 
 if(!f_isNumber(document.getElementById("yearofpassing").value))
 {
	window.alert("Please enter valid year of passing");
	document.getElementById("yearofpassing").value='';
	document.getElementById("yearofpassing").focus();
	return false;	
 }
 if(!f_isNumber(document.getElementById("txtPerMark_D").value))
 {
	window.alert("Please enter valid percentage of marks");
	document.getElementById("txtPerMark_D").value='';
	document.getElementById("txtPerMark_D").focus();
	return false;	
 }
 
 if(!f_isNumber(document.getElementById("drpYearOfPassing_XII").value))
 {
	window.alert("Please enter valid year of passing for XII");
	document.getElementById("drpYearOfPassing_XII").value='';
	document.getElementById("drpYearOfPassing_XII").focus();
	return false;	
 }
 if(!f_isNumber(document.getElementById("txtPerMark_XII").value))
 {
	window.alert("Please enter valid percentage of marks of XII");
	document.getElementById("txtPerMark_XII").value='';
	document.getElementById("txtPerMark_XII").focus();
	return false;	
 }
 if(!f_isNumber(document.getElementById("drpYearOfPassing_X").value))
 {
	window.alert("Please enter valid year of passing for X");
	document.getElementById("drpYearOfPassing_X").value='';
	document.getElementById("drpYearOfPassing_X").focus();
	return false;	
 }
 if(!f_isNumber(document.getElementById("txtPerMark_X").value))
 {
	window.alert("Please enter valid percentage of marks of X");
	document.getElementById("txtPerMark_X").value='';
	document.getElementById("txtPerMark_X").focus();
	return false;	
 }
 
}



function Validate_PI()
{
 if(f_isEmpty(document.getElementById("txtname").value))
 {
	window.alert("Please enter your name");
	document.getElementById("txtname").value='';
	document.getElementById("txtname").focus();
	return false;
 }
 if(IsValidName(document.getElementById("txtname").value))
 {
	window.alert("Please enter valid name");
	document.getElementById("txtname").value='';
	document.getElementById("txtname").focus();
	return false;
 }
 
 if(!f_isNumber(document.getElementById("txtscore").value))
 {
	window.alert("Please enter valid score.");
	document.getElementById("txtscore").value='';
	document.getElementById("txtscore").focus();
	return false;	
 }
 if(f_isEmpty(document.getElementById("txtemail").value))
 {
	window.alert("Please enter your email address");
	document.getElementById("txtemail").value='';
	document.getElementById("txtemail").focus();
	return false;	
 }
 if(!(Check_email(document.getElementById("txtemail").value)))
 {
    document.getElementById("txtemail").value='';
    document.getElementById("txtemail").focus();
    return false;
 } 
  if(IsValidName(document.getElementById("txtcity").value))
 {
	window.alert("Please enter valid City");
	document.getElementById("txtcity").value='';
	document.getElementById("txtcity").focus();
	return false;
 }

 if(!f_isNumber(document.getElementById("txtPin").value))
 {
	window.alert("Please enter valid Pin Code.");
	document.getElementById("txtPin").value='';
	document.getElementById("txtPin").focus();
	return false;	
 }
 
 if(f_isEmpty(document.getElementById("txttelephone").value))
 {
	window.alert("Please enter your phone number");
	document.getElementById("txttelephone").value='';
	document.getElementById("txttelephone").focus();
	return false;
 }
 if(!(IsValidphone(document.getElementById("txttelephone").value)))
 {
	window.alert("Please enter valid phone number");
	document.getElementById("txttelephone").value='';
	document.getElementById("txttelephone").focus();
	return false;
 }
 
}