//to validate a text area
function taValidation(strString)
{
   arr = strString.split("\r\n")
   var strtemp = "";
   for (var i=0; i<arr.length; i++)
   {
    strtemp = strtemp + trim(arr[i])
   }

   if (trim(strtemp) == "")
       return false;
   else
       return true;
}

//to return a trimmed string
function trim(strStr) 
{
	var intLen = strStr.length;
	var intBegin = 0, intEnd = intLen-1;
	while (strStr.charAt(intBegin) == " " && intBegin < intLen) 
	{
		intBegin++;
	}
	while (strStr.charAt(intEnd) == " " && intBegin < intEnd) 
	{
		intEnd--;
	}
	return strStr.substring(intBegin, intEnd+1);
}

//to check on keypress if entered value is numeric or not
function fnIsNumber(eventObj, obj)
{
	 var keyCode
	
	 //check for Browser Type
	 if (document.all)
	 {
	  	keyCode = eventObj.keyCode
	 }
	 else
	 {
	  	keyCode = eventObj.which
	 }
	
	 if ((keyCode > 47 && keyCode < 58) || (keyCode == 46) || (keyCode == 8) || (keyCode == 0))
	   return true;
	 else
	   return false;
}

//to check on keypress if entered value is integer or not
function fnIsIntNumber(eventObj, obj)
{
     var keyCode

     //check for Browser Type
     if (document.all)
     {
      	keyCode = eventObj.keyCode
     }
     else
     {
      	keyCode = eventObj.which
     }

     if ((keyCode > 47 && keyCode < 58) || (keyCode == 8) || (keyCode == 0))
       return true;
     else
       return false;
}

//to check on keypress if entered value is alphabet or not
function fnIsAlphabet(eventObj, obj)
{
     var keyCode

     //check for Browser Type
     if (document.all)
     {
      	keyCode = eventObj.keyCode
     }
     else
     {
      	keyCode = eventObj.which
     }

     if ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (keyCode == 32)|| (keyCode == 8) || (keyCode == 0))
      return true;
     else
      return false;
}

//to check on keypress if entered value is alphanumeric or not
function fnIsAlphaNumeric(eventObj, obj)
{
     var keyCode

     //check for Browser Type
     if (document.all)
     {
      	keyCode = eventObj.keyCode
     }
     else
     {
      	keyCode = eventObj.which
     }

     if ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (keyCode > 47 && keyCode < 58) || (keyCode == 32) || (keyCode == 8) || (keyCode == 0))
      return true;
     else
      return false;
}

//to open a new file
function openNew1(file,imgHeight,imgWidth,scrolling)
{
  ypos = (screen.height / 2) - imgHeight/2;
  xpos = (screen.width / 2) - imgWidth/2;
  NewWindow1=window.open(file, "Win1", "height="+imgHeight+",width="+imgWidth+",toolbar=0,menubar=0,scrollbars="+scrolling+",status=0,location=0,left="+xpos+",top="+ypos+"screenx="+xpos+",screeny="+ypos);
  NewWindow1.focus();
}

//same as above
function openNew2(file,imgHeight,imgWidth,scrolling)
{
  ypos = (screen.height / 2) - imgHeight/2;
  xpos = (screen.width / 2) - imgWidth/2;
  NewWindow2=window.open(file, "Win2", "height="+imgHeight+",width="+imgWidth+",toolbar=0,menubar=0,scrollbars="+scrolling+",status=0,location=0,left="+xpos+",top="+ypos+"screenx="+xpos+",screeny="+ypos);
  NewWindow2.focus();
}

//function to check if valid date or not
var dtCh= "-";
var minYear=1900;
var maxYear=2100;
function IsInteger(s)
{
	var i;
    if (s.length == 0) 
    {
    	return false;
    }
	for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year)
{
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) 
{
	for (var i = 1; i <= n; i++) 
	{
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
    } 
   return this
}

function IsDate(dtStr)
{
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	
	if (pos1==-1 || pos2==-1)
	{
		alert("The date format should be: mm-dd-yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12)
	{
		alert("Please enter a valid month")
		return false
	}
	
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
	{
		alert("Please enter a valid day")
		return false
	}
	
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
	{
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || IsInteger(stripCharsInBag(dtStr, dtCh))==false)
	{
		alert("Please enter a valid date")
		return false
	}
    
	return true
}
//end date

//better version of trim and taValidation
function fnIsBlank(strInput)  
{
	if ((strInput == null) || (strInput == "")) 
		return false; //original true
	
	for(var i=0; i<strInput.length; i++)  
	{
	   var chrChar = strInput.charAt(i);		
	   if((chrChar != ' ') && (chrChar != '\\n') && (chrChar != '\\t') && (chrChar != '\\r\\n')) 
	   	   return true;//original false
    }
	return false;//original true
}

//if an option button has been checked or not
function fnIsChecked(objInput)
{
	intOK = 0;
	if (objInput.length)
	{
		for (var i=0; i<objInput.length; i++)
		{
			if (objInput[i].checked) 
			{
			  intOK=1;
			}
		}
	}
	else
	{
		if (objInput.checked) 
		{
		  intOK=1;
		}
	}
	if (intOK == 1) 
	{ 
	  return true; 
	}
	else 
	{ 
	  return false; 
	}
}

//If a multiselect list box
function fnMultibox(objInput)
{
	intOK = 0;
	for (var i=0; i<objInput.length; i++)
	{	
		if (objInput[i].selected) 
		{ 
		  intOK = 1 
		}
	}
	if (intOK == 1) 
	{ 
	  return true; 
	}
	else 
	{ 
	  return false;
	}
}

//to check if valid email or not
function IsEmail(strEmail) 
{
	var y = strEmail.indexOf("\@");
  	var x = strEmail.indexOf(".");
  	var z = y + 1;
  	if(y < 0 || x < 0 || x == z)  
  	{ 
  	  return false; //original true
  	}
	return true;//original false
}

//to validate forms
function fnCheckForm(frmInput, arrList, arrCustomFunction, arrCompareField, arrCompareFieldAlert, strChangeColor) 
{
		//initialization of variables
		var strMsg = "";    
		var strErr = "";
		var intFlag = 0;
		
		// running through the message loop
		for (strKey in arrList)
		{
			var strType = ""; // setting string variable to null
			var intFoundError = 0;
			var intChangeStyle = 0;
		
			objField = eval("frmInput."+strKey); // making a object for input field
            
			if (objField.length > 0) 
			{ 
			  strType = objField[0].type; 
			}  // setting the type to strType variable 
			if (!strType) 
			{ 
			  strType = objField.type;
			}// again checking and setting the type to strType variable 

			// condition for strType variable
			if (arrCustomFunction[strKey])
			{
				    intChangeStyle=1;
					if (!eval(arrCustomFunction[strKey]+"('"+objField.value+"')"))
					{
						intFoundError=1;
					}
			}
			else 
			{	
				switch (strType) 
				{
					case "text": 
					case "file": 
					case "password":
									intChangeStyle = 1;
									if (trim(objField.value) == false) 
									{
									  intFoundError = 1;
									}
								 	break;
					case "textarea":
									intChangeStyle = 1;
									if (taValidation(objField.value) == false) 
									{
									  intFoundError = 1;
									}
									break;
					case "radio":
					case "checkbox":
								    if (fnIsChecked(objField) == false) 
								    {
								      intFoundError = 1;
								    }
									break;
					case "select-one":
									  intChangeStyle=1;
									  if (objField.selectedIndex==0) 
									  {
									    intFoundError = 1;
									  }
									  break;
					case "select-multiple":
										   intChangeStyle=1;
										   if (fnMultibox(objField) == false) 
										   { 
										     intFoundError = 1
										   }
										   break;
				}
			}

			if (intFoundError == 1) 
			{
				strErr = strErr + arrList[strKey] + "\n";
				if (strChangeColor!="" && intChangeStyle==1)	
				{
				  objField.style.backgroundColor=strChangeColor;
				  if (intFlag == 0)
				  {
				  	intFlag = 1;
				  	objField.focus();
				  }
				}
			}
			else 
			{
				if (strChangeColor!="" && intChangeStyle==1)	
				{
				  objField.style.backgroundColor='#FFFFFF';
				}
			}
    	}
        
		//running through the compare fields
		for (strKey in arrCompareField)
		{
			var strType = ""; // setting string variable to null
			var intFoundError = 0;
			var intChangeStyle = 0;
			objField = eval("frmInput."+strKey); // making a parent compare object for input field
			objFieldCompare = eval("frmInput."+arrCompareField[strKey]); // making a child compare object for input field
			if (objField.value != objFieldCompare.value)
			{		
			  intChangeStyle=1;
			  intFoundError=1;
			}	
            
			if (intFoundError==1) 
			{
				strErr = strErr + arrCompareFieldAlert[strKey] + "\n";
				if (strChangeColor!="" && intChangeStyle==1)	
				{
				  objField.style.backgroundColor=strChangeColor;
				}
			}
			else 
			{
				if (strChangeColor!="" && intChangeStyle==1)	
				{
					objField.style.backgroundColor='#FFFFFF';
				}
			}

		}

		// if no error then initialize the error
		if(strErr != "")
		{ 
			// adding to the error message
			strMsg += "Please correct/check the following:\n";
			strMsg += "-------------------------------------------------------------------------\n\n";	           
			strMsg += strErr;
			alert(strMsg);
			return(false);	
		}
		else 
		{ 
			return (true); 
		}
}

/*function fnCheckAll(frmInput,chkCheckAllBox,chkBoxToBeChecked)
{
  //convert to actual objects
  objCheckAllBox = eval("frmInput."+chkCheckAllBox);
  objBoxToBeChecked = eval("frmInput."+chkBoxToBeChecked);
  alert(frmInput+"  " +objCheckAllBox+"  " +"");
  if (objCheckAllBox.checked == true)
  {
    for (var i=0; i<objBoxToBeChecked.length; i++)
         objBoxToBeChecked[i].checked = true;   
  }
  else
  {
  	for (var i=0; i<objBoxToBeChecked.length; i++)
         objBoxToBeChecked[i].checked = false;
  } 
}*/

//Function to check or uncheck list of checkboxes checkboxes
//Parameters: Takes 2 Parameters
//		1 - The checkbox on click of which the fuction is called
//		2 - The list of checkboxes which will be checked or unchecked depending on value of first parameter
function fnCheckUnCheckAll(chkCheckAllBox,chkBoxToBeChecked)
{
	if (!chkBoxToBeChecked.length)
	{
		chkBoxToBeChecked.checked = chkCheckAllBox.checked;
	}
	else
	{
		for (i = 0; i < chkBoxToBeChecked.length; i++)
			chkBoxToBeChecked[i].checked = chkCheckAllBox.checked;
	}
}

//Function to Validate Number
//Parameters: Takes 3 Parameters
//		1 - The number to check
//		2 - Maximum number of digits allowed before decimal
//		3 - Maximum number of digits allowed after decimal
function IsValidNumber(intNum,intPrecision,intScale)
{
    var intNumber
    intNumber = trim(intNum)
	if(trim(intNumber)=="")
		return false;
	
	//Check For Valid intNumber
	if (isNaN(intNumber)==true)    
		return false;
	
	//Check if More Than One Decimal 
	if(intNumber.split(".").length > 2) 
		return false;
		
	if(intNumber.indexOf(".") > 0)
	{
		//If the number contains decimal point
		if((intNumber.split(".")[0]).length > intPrecision)
			return false;
		
		if((intNumber.split(".")[1]).length > intScale)
			return false;	
		return true;
	}
	else
	{
		//If the number doesn't contain decimal point
		if(intNumber.length > intPrecision)
			return false;
		else
			return true;
	}
}

//This function checks if the entered value is a string
function fnIsString(strStr)
{
	var strStr1 = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var strStr2 = strStr.length;
	// modified by mayuri 
	// if nothing entered return false
	if (strStr == '') return false;
	for(var i=0; i<=strStr2; i++)
	{
		var strChar = strStr.substr(i,1);
		if (strStr1.indexOf(strChar) == -1)
		{
			return false;
		}
	}
	return true;
}

//This function checks if the entered value is a pure numeric value
function fnIsDigit(strStr)
{
    var strNum = "1234567890";
    var intCtr,intLen;
    intLen=strStr.length;
    for(intCtr=0; intCtr <= intLen && strNum.indexOf(strStr.charAt(intCtr))>=0; intCtr++);
    if(intCtr > intLen)
    {
        return true;
    }
    else
    {
    	return false;
    }
}

//This function checks if the entered value is a mixture of digits and strings
function fnIsStringDigit(strStr)
{
	var strStr1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890";
	var strStr2 = strStr.length;
	for(var i=0; i<=strStr2; i++)
	{
		var strChar = strStr.substr(i,1);
		if (strStr1.indexOf(strChar)==-1)
		{
			return false;
		}
	}
	return true;
}

//This function checks that the string should contain both alphabets and digits
function fnIsAlphaDigit(strStr)
{
	var strAlpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var strDigits = "1234567890";
	var intLength = strStr.length;
	
	intAlphaFound = 0;
	for(var i = 0; i < intLength; i++)
	{
		var strChar = strStr.substr(i,1);
		if (strAlpha.indexOf(strChar) != -1)
		{
			intAlphaFound = 1;
			break;
		}
	}
	
	intDigitFound = 0;
	for(var i=0; i < intLength; i++)
	{
		var strChar = strStr.substr(i,1);
		if (strDigits.indexOf(strChar) != -1)
		{
			intDigitFound = 1;
			break;
		}
	}
	
	if ((intAlphaFound) && (intDigitFound))
	{
		return true;
	}
	return false;
}

//Checks if a value is selected or not
function fnIsSelected(objInput,strMsg)
{
	if (objInput.value == "" || objInput.value == "0" || objInput.value == 0)
	{
		alert(strMsg);
		objInput.focus();
		return false;
	}
	return true;
}

//Checks if field value has number of characters between two specified limits
function fnIsMinMax(objInput,intMinLen,intMaxLen,strMsg,strBgColor)
{
	if(objInput.value.length < intMinLen || objInput.value.length > intMaxLen) 
	{ 
		objInput.style.backgroundColor=strBgColor;
		alert(strMsg);	
		objInput.focus(); 
		return false; 
	} 
	objInput.style.backgroundColor='white';
	return true; 
}

//check for file type
function fnCheckFileType(strField,strMsg)
{
  var objRegEx = new RegExp("(.doc|.pdf)$");	
  if (!objRegEx.test(strField))
  {
  	alert(strMsg);
  	strField.focus();
  	return false;
  }
  return true;	
}

//check for image type
function fnCheckImageType(strField,strMsg)
{
  var objRegEx = new RegExp("(.jpg|.jpeg|.gif|.JPG|.JPEG|.GIF)$");	
  if (!objRegEx.test(strField))
  {
  	alert(strMsg);
  	strField.focus();
  	return false;
  }
  return true;	
}

//check for size of image file. 
//YOU CAN CHECK either in terms of width and height of image or size of image in bytes
function fnCheckImageSize(strField,strMsg)
{
  var objImg = new Image(); 
  objImg.src = strField.value; 
  
  /*var Dimensions = objImg.width + 'x' + objImg.height;*/
  
  if(objImg.fileSize > 102400) 
  { 
	alert(strMsg); 
	strField.focus(); 
	return false; 
  } 
  return true;
}

//check for phone
function fnIsPhone(strField1,strField2,strField3,strMsg)
{
  var objRegEx = new RegExp("^[\d-+()]+$");
  var strPhone = "(" + strField1.value + ")" + strField2.value + "-" + strField3.value;
  if (!objRegEx.test(strPhone))
  {
  	alert(strMsg);
  	strField1.focus();
  	return false;
  }
  return true;
}

function fnSearchChk()
{
	strTxtSearch = document.getElementById('txtSearchFor').value;
	strSelSearch = document.getElementById('lstSearchFor').value;
	// enter search text
	if (strSelSearch == '' && trim(strTxtSearch) == '')
	{
		alert("Enter some search text in text box \n OR \nselect an alphabet from the list");
		document.getElementById('txtSearchFor').focus();
		return false;
	}
	if (strSelSearch != '' && strTxtSearch != '')
	{
		alert('You can specifically choose to search a particular string \n OR \n choose an alphabet from the list \n BUT NOT BOTH');
		return false;
	}
	if (trim(strTxtSearch) != '')
	{
		document.getElementById('hidText').value = '1';
	}
	return true;
}

//Function for valid IP Address
function fnIsValidIP(strIP)
{
	if ((document.getElementById(strIP).value > 255) || (document.getElementById(strIP).value < 0))
		return false;
	else
		return true;
}

strAFile = "ajax.php?";
function fnCounty(intState,strDiv)
{
	if (!strDiv)
	{
		strDiv = "";
	}
	if (document.getElementById('divCounty'+strDiv))
	{
	 	if (intState)
	 	{
			var xmlhttp = createXMLHttpObject();
			strArgs = "county=y&sid="+intState+"&div="+strDiv;
			xmlhttp.open("GET",strAFile+strArgs,true);
			xmlhttp.onreadystatechange=function() 
			{
				if (xmlhttp.readyState==4)
				{
					if (xmlhttp.status == 200)
					{
						document.getElementById('divCounty'+strDiv).innerHTML = xmlhttp.responseText;
						fnClear(1,strDiv);
					}
					else
					{
						alert('Error:AJAX request status = ' + xmlhttp.status);
					}
			    }
			}
			xmlhttp.send("");
	 	}
	 	else
	 	{
	 		fnClear(2,strDiv);
	 	}
	}
}

function fnCity(intCounty,strDiv)
{
	if (!strDiv)
	{
		strDiv = "";
	}
	if (document.getElementById('divCity'+strDiv))
	{
		if ((intCounty) && (document.getElementById('lstState'+strDiv).value))
		{
			intState = document.getElementById('lstState'+strDiv).value;
		 	strArgs = "city=y&sid="+intState+"&ctid="+intCounty+"&div="+strDiv;
			var xmlhttp = createXMLHttpObject();
			xmlhttp.open("GET",strAFile+strArgs,true);
			xmlhttp.onreadystatechange=function() 
			{
				if (xmlhttp.readyState==4)
				{
					if (xmlhttp.status == 200)
					{
						document.getElementById('divCity'+strDiv).innerHTML = xmlhttp.responseText;
					}
					else
					{
						alert('Error:AJAX request status = ' + xmlhttp.status);
					}
			    }
			}
			xmlhttp.send("");
		}
		else
		{
			fnClear(1,strDiv);
		}
	}
	else
	{
		//see city_cityadd.php page for example
		if (document.getElementById('divCountySubmit'))
		{
			if (document.getElementById('lstCounty').value != "")
			{
				document.frmAdd.submit();
			}
		}
	}
}

function fnNone()
{
	//see zip.php page for example
	if (document.getElementById('divCitySubmit'))
	{
		if (document.getElementById('lstCity').value != "")
		{
			document.frmAdd.submit();
		}
	}
}

function fnZIP(strZIP,strDiv)
{
	if (!strDiv)
	{
		strDiv = "";
	}
	
	if (trim(strZIP) == "")
	{
		fnClear(3,strDiv);
	}
	else
	{
		//now pass this zip code and get the state, county and city for it
		var xmlhttp = createXMLHttpObject();
		strArgs = "zip=y&zid="+strZIP;
		xmlhttp.open("GET",strAFile+strArgs,true);
		xmlhttp.onreadystatechange=function() 
		{
			if (xmlhttp.readyState==4)
			{
				if (xmlhttp.status == 200)
				{
					var strString = xmlhttp.responseText;
					if (strString != "0")
					{
						arrV = strString.split("<br>");
						document.getElementById('lstState'+strDiv).value = arrV[0];
						strArgs = "county=y&sid="+arrV[0]+"&sel="+arrV[1]+"&div="+strDiv;
						xmlhttp.open("GET",strAFile+strArgs,true);
						xmlhttp.onreadystatechange=function() 
						{
							if (xmlhttp.readyState==4)
							{
								if (xmlhttp.status == 200)
								{
									document.getElementById('divCounty'+strDiv).innerHTML = xmlhttp.responseText;
									strArgs = "city=y&sid="+arrV[0]+"&ctid="+arrV[1]+"&sel="+arrV[2]+"&div="+strDiv;
									xmlhttp.open("GET",strAFile+strArgs,true);
									xmlhttp.onreadystatechange=function() 
									{
										if (xmlhttp.readyState==4)
										{
											if (xmlhttp.status == 200)
											{
												document.getElementById('divCity'+strDiv).innerHTML = xmlhttp.responseText;
											}
											else
											{
												alert('Error:AJAX request status = ' + xmlhttp.status);
											}
									    }
									}
									xmlhttp.send("");
								}
								else
								{
									alert('Error:AJAX request status = ' + xmlhttp.status);
								}
						    }
						}
						xmlhttp.send("");
					}
				}
				else
				{
					alert('Error:AJAX request status = ' + xmlhttp.status);
				}
		    }
		}
		xmlhttp.send("");
	}
}

function fnClear(intWhat,strDiv)
{
	if (!strDiv)
	{
		strDiv = "";
	}
	strCounty = "<select name=lstCounty"+strDiv+" id=lstCounty"+strDiv+" class=input1><option value=''>--- Select County ---</option></select>";
	strCity = "<select name=lstCity"+strDiv+" id=lstCity"+strDiv+" class=input1><option value=''>--- Select City ---</option></select>";
	
	//1 means clear the city Drop Down
	if (intWhat == 1)
	{
		if (document.getElementById('divCity'+strDiv))
		{
			document.getElementById('divCity'+strDiv).innerHTML = strCity;
		}
	}
	
	//2 means clear both county and city drop down
	if (intWhat == 2)
	{
		if (document.getElementById('divCounty'+strDiv))
		{
			document.getElementById('divCounty'+strDiv).innerHTML = strCounty;
		}
		if (document.getElementById('divCity'+strDiv))
		{
			document.getElementById('divCity'+strDiv).innerHTML = strCity;
		}
	}
	
	if (intWhat == 3)
	{
		document.getElementById('lstState'+strDiv).value = "";
		if (document.getElementById('divCounty'+strDiv))
		{
			document.getElementById('divCounty'+strDiv).innerHTML = strCounty;
		}
		if (document.getElementById('divCity'+strDiv))
		{
			document.getElementById('divCity'+strDiv).innerHTML = strCity;
		}
	}
}



//This function checks if the entered value is a mixture of digits and strings and no specila character for username
function fnIsStringDigitNoSpe(strStr)
{
	var strStr1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-";
	var strStr2 = strStr.length;
	for(var i=0; i<=strStr2; i++)
	{
		var strChar = strStr.substr(i,1);
		if (strStr1.indexOf(strChar)==-1)
		{
			return false;
		}
	}
	return true;
}