	function shNewCity(cID){
		if(cID=='OTHER'){
			document.getElementById('othcity').style.display = 'block';
		}else{
			document.getElementById('othcity').style.display = 'none';
		}
	}
	
	
	function emailCheck(emailStr) 
	{
		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		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];
		
		for (i=0; i<user.length; i++)
		{
			if (user.charCodeAt(i)>127) 
			{
				alert("Ths username contains invalid characters.");
				return false;
			}
		}
		for (i=0; i<domain.length; i++) 
		{
			if (domain.charCodeAt(i)>127) 
			{
				alert("Ths domain name contains invalid characters.");
				return false;
			}
		}
	
		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 atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) 
		{
			if (domArr[i].search(atomPat)==-1)
			{
				alert("The domain name does not seem to be valid.");
				return false;
			}
		}
	
		if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) 
		{
			alert("The address must end in a well-known domain or two letter " + "country.");
			return false;
		}
		if (len<2) 
		{
			alert("This address is missing a hostname!");
			return false;
		}
		return true;
	}
	/*function validateregstep2() {
		if (emailCheck(document.getElementById('txtemail').value)==false) return false;
		if (document.getElementById('txtfname').value =="") {
			alert('Please enter first name');
			return false;
		}
		if (document.getElementById('txtlname').value =="") {
			alert('Please enter last name');
			return false;
		}
		if (document.getElementById('txtactname').value == "") {
			alert('Please enter act name');
			return false;
		}
		if (document.getElementById('txtpaswd').value =="") {
			alert('Please enter password');
			return false;
		}
		if (document.getElementById('txtpaswd').value != document.getElementById('txtrepaswd').value) {
			alert('Passwords donot match');
			return false;
		}

		if (document.getElementById('cbostates').value =="0") {
		//	alert('Please select state');
		//	return false;
		}
		if (document.getElementById('cbocities').value =="0") {
		//	alert('Please enter select city');
		//	return false;
		}
		if (document.getElementById('txtzipcode').value == "") {
			alert('Please enter zip code');
			return false;
		}		
		return true;														
	}*/

	function clearme(){
		if (document.getElementById("txtcity").value == "Enter City (optional)") {
			document.getElementById("txtcity").value = "";
		}
	}
	function showme() {	
		if (document.getElementById("txtcity").value == "") {
			document.getElementById("txtcity").value = "Enter City (optional)";
		}
	}
	
	function selectComboItem(value, combo){
		if (combo == null){
			return;
		}
		if(value!=0){
			return combo.value=value;
		}
	}	

	function validateforgetpassword() {
		if (emailCheck(document.getElementById('txtemail').value)==false) return false;
	}
	
	function validate(){
			var alertmessage = "Following error(s) occurred";
			var retflag = true;
			if (document.getElementById("txtcurrentpaswd").value==""){
				alertmessage += "<Br>Please enter current password";
				retflag = false;
			}
			if (document.getElementById("txtnewpassword").value==""){
				alertmessage += "<Br>Please enter new password";
				retflag = false;
			}	
			if (document.getElementById("txtrepassword").value!=document.getElementById("txtnewpassword").value){
				alertmessage += "<Br>New and retyped passwords does not match";
				retflag = false;
			}			
			if (retflag == false) {
				$.blockUI({ 
				message: alertmessage,  
						  css: { 
				border: 'none', 
				padding: '15px', 
				backgroundColor: '#FF0000', 
				'-webkit-border-radius': '10px', 
				'-moz-border-radius': '10px', 
				opacity: '.5', 
				color: '#fff' 
					} }); 
				setTimeout($.unblockUI, 2000); 	
			}
		return retflag;
	}
