	//<![CDATA[
	var map;
	var geocoder;
	var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.image = "/images/core/homeicon.gif";
	baseIcon.iconSize = new GSize(12, 14);
	baseIcon.shadowSize = new GSize(17, 27);
	baseIcon.iconAnchor = new GPoint(9, 24);
	baseIcon.infoWindowAnchor = new GPoint(5, 2);
	
	function progressBar() {
		if(document.getElementById('map')){	
			window.status="Please Wait Page is Loading"; 		
			setTimeout("clear()",9000) 
		} 
	}
	function clear () { 
		window.status= ""; 
	} 
	
	function load() 
	{
		initialize();
	}
	
	function load3() 
	{
		if (GBrowserIsCompatible()) 
		{
			progressBar();
			var address=loc_city+', '+loc_region;
			geocoder = new GClientGeocoder();			
			map = new GMap2(document.getElementById('map'));
			map.enableDoubleClickZoom();
			map.enableScrollWheelZoom();
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			map.setCenter(new GLatLng(loc_lat, loc_long),11);
			
			var sZipCode=zip;
		
			geocoder.getLatLng(sZipCode, function(latlng) 
					{
					 searchLocationsNear(latlng);
					});		
			
	   	} 				
	}
	
	function load2(lat,lang)
	{
		if (GBrowserIsCompatible()) 
		{
			progressBar();
			var address=loc_city+', '+loc_region;
			geocoder = new GClientGeocoder();			
			map = new GMap2(document.getElementById('map'));
			map.enableDoubleClickZoom();
			map.enableScrollWheelZoom();
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			
			map.setCenter(new GLatLng(lat,lang),11);
			
			var sZipCode=zip;
		
			geocoder.getLatLng(sZipCode, function(latlng) 
					{
					 searchLocationsNear1(lat,lang);
					});		
			
	   	} 
	}
	
	var browserSupportFlag =  new Boolean();
	
	function initialize() {
	  if(navigator.geolocation) 
	  {
			browserSupportFlag = true;
			navigator.geolocation.getCurrentPosition(function(position) 
			{
				load2(position.coords.latitude,position.coords.longitude);
			}, 
			function() {
		  		handleNoGeolocation(browserSupportFlag);
			});
	  // Try Google Gears Geolocation
	  } 
	  else if (google.gears) 
	  {
			browserSupportFlag = true;
			var geo = google.gears.factory.create('beta.geolocation');
			geo.getCurrentPosition(function(position) {
		  		load2(position.coords.latitude,position.coords.longitude);
				}, 
				function() {
		  			handleNoGeoLocation(browserSupportFlag);
			});
	  // Browser doesn't support Geolocation
	  } else {
		browserSupportFlag = false;
		handleNoGeolocation(browserSupportFlag);
	  }
	  
	  function handleNoGeolocation(errorFlag) {
			load3();
	  }
	}
	
	function searchLocationsNear(center) 
	{
		var sZipCode=zip;
		var searchUrl = '/GetHoods.php?zip='+zip;
		GDownloadUrl(searchUrl, function(data) 
						{
							var xml = GXml.parse(data);	   
							var markers = xml.documentElement.getElementsByTagName('marker');	   
							map.clearOverlays();
						   
							if (markers.length == 0) 
							{
								return;
							}
							var count=0;
							var bounds = new GLatLngBounds();
							
							latitude_old=0.0;
							longitude_old=0.0;
							
							for (var i = 0; i < markers.length; i++) 
							{
								var hoodId=markers[i].getAttribute('id');	     
								var postalcode = markers[i].getAttribute('postalcode');		 
								var address = markers[i].getAttribute('country');
								var imageCount=markers[i].getAttribute('imageCount');
								var photos=new Array();
								var titles=new Array();
							
								for(var j=0;j<imageCount;j++)
								{
									var nn="photo"+j;
									var nn2="title"+j;
									photos[j]=markers[i].getAttribute(nn);
									titles[j]=markers[i].getAttribute(nn2);								
								}
								
								var name = Base64.decode(markers[i].getAttribute('name'));
								//var description = markers[i].getAttribute('description');
								var newDescription = '';
							   	var latitude = parseFloat(markers[i].getAttribute('latitude'));

								var longitude= parseFloat(markers[i].getAttribute('longitude'));
								
								if(latitude!=latitude_old || longitude!=longitude_old)
								{
									var point = new GLatLng(latitude,longitude);
								}
								else
								{
									count=count+0.005000;
									var point = new GLatLng(latitude+count,longitude-count);
									
								}
								//alert("point="+point);
								latitude_old = latitude;
								longitude_old =longitude;
								
	
								var marker = createMarker(point,name,address,newDescription,hoodId,postalcode,photos,titles);
								map.addOverlay(marker);
								
								bounds.extend(point);
						   }
						 }
			);
	}
	
	function searchLocationsNear1(lat,lang) 
	{
		var sZipCode=zip;
		var searchUrl = '/GetHoods1.php?lat='+lat+'&lang='+lang;
		//alert();
		GDownloadUrl(searchUrl, function(data) 
						{
							var xml = GXml.parse(data);	   
							var markers = xml.documentElement.getElementsByTagName('marker');	   
							map.clearOverlays();
						   
							if (markers.length == 0) 
							{
								return;
							}
							var count=0;
							var bounds = new GLatLngBounds();
							
							latitude_old=0.0;
							longitude_old=0.0;
							
							for (var i = 0; i < markers.length; i++) 
							{
								var hoodId=markers[i].getAttribute('id');	     
								var postalcode = markers[i].getAttribute('postalcode');		 
								var address = markers[i].getAttribute('country');
								var imageCount=markers[i].getAttribute('imageCount');
								var photos=new Array();
								var titles=new Array();
							
								for(var j=0;j<imageCount;j++)
								{
									var nn="photo"+j;
									var nn2="title"+j;
									photos[j]=markers[i].getAttribute(nn);
									titles[j]=markers[i].getAttribute(nn2);								
								}
								
								var name = Base64.decode(markers[i].getAttribute('name'));
								//var description = markers[i].getAttribute('description');
								var newDescription = '';
							   	var latitude = parseFloat(markers[i].getAttribute('latitude'));

								var longitude= parseFloat(markers[i].getAttribute('longitude'));
								
								if(latitude!=latitude_old || longitude!=longitude_old)
								{
									var point = new GLatLng(latitude,longitude);
								}
								else
								{
									count=count+0.005000;
									var point = new GLatLng(latitude+count,longitude-count);
									
								}
								//alert("point="+point);
								latitude_old = latitude;
								longitude_old =longitude;
								
	
								var marker = createMarker(point,name,address,newDescription,hoodId,postalcode,photos,titles);
								map.addOverlay(marker);
								
								bounds.extend(point);
						   }
						 }
			);
	}


	function createMarker(point, name, address,description,hoodId,postalcode,photos,titles) 
	{
		var marker = new GMarker(point,baseIcon);	
	//	var marker =  new GMarker(point, {icon:baseIcon, draggable: true}); 		
		marker.enableDragging();
		var moreinfo = "javascript:window.open('/hoodinfo.php?hoodId="+hoodId+"','hoodinfo','width=600,height=400, top=250,left=250,menubar=no,status=no,toolbar=no,resizable=no,scrollbars=1');";
		//var html = '<div align="left" class="hoodSelectBlack">' + name +'</div><div align="left"><a class="hoodHyperlinks" href="/index.php?hoodId='+hoodId+'">join</a>&nbsp;&nbsp;<a class="hoodHyperlinks" href="/index.php?hoodId='+hoodId+'&zipcode='+postalcode+'">more info...</a></div>';
		var html = '<div align="left" class="hoodSelectBlack">' + name +'</div><div align="left"><a class="hoodHyperlinks" href="http://www.i-neighbors.org/'+postalcode+'/'+address+'">Visit neighborhood homepage</a></div><div id="imagesDisp" style="width:260px; " align="left">';
		var countString="";
		var length=photos.length;
		
		if(length>0)
		{
			var photosX='';
			for(var i=0; i<length;i++)
			{
				photos[i]=photos[i].replace(/"/g,'&quot;');
				photos[i]=photos[i].replace(/'/g,"\\'");
				photosX+=photos[i]+'?+-';
			}

			
			var titlesX='';
			for(var i=0; i<length;i++)
			{
				titles[i]=titles[i].replace(/"/g,'&quot;');
				titles[i]=titles[i].replace(/'/g,"\\'");
				titlesX+=titles[i]+'?+-';
			}
			
			/*photosX=photosX.replace(/"/g,'&quot;');
			photosX=photosX.replace(/'/g,'&#39;');
			titlesX=titlesX.replace(/"/g,'&quot;');
			titlesX=titlesX.replace(/'/g,'&#39;');*/
			
			
			if(length<=3)
			{	
				for(var p2=0; p2<length; p2++)
				{
					html+='<a href="#" onclick="displayImage(\''+photos[p2]+'\',\''+titles[p2]+'\');"><img src=http://www.i-neighbors.org/Storage/album/photo/'+photos[p2]+'  height="75" width="80"><a/>&nbsp;';
				}
				countString="1 - "+length+" of "+length;
				html=html+'<div class="imgpreview"> <div class="countDisp">'+countString+'</div>';
			}
			else
			{
				for(var p2=0; p2<3; p2++)
				{
					html+='<a href="#" onclick="displayImage(\''+photos[p2]+'\',\''+titles[p2]+'\');"><img src=http://www.i-neighbors.org/Storage/album/photo/'+photos[p2]+'  height="75" width="80"><a/>&nbsp;';
				}
				countString="1 - 3 of "+length;
				html=html+'<div class="imgpreview"><div class="countDisp">'+countString+'</div> <div style="float:right;margin:0px;padding:0px"><a href="#" onclick="displayNext(\''+photosX+'\',\''+titlesX+'\','+p2+');">Next &gt;<a/></div>';
			}
		}
		html=html+'</div>';
		
		//var html = '<div align="left" class="hoodSelectBlack">' + name +'</div><div align="left"><a class="hoodHyperlinks" href="/signuphood.php?hoodId='+hoodId+'">join</a>&nbsp;&nbsp;<a class="hoodHyperlinks" href="/moreHoodInfo.php?hoodId='+hoodId+'&zip='+postalcode+'">more info...</a></div>';
		//var html = '<div align="left" class="hoodSelectBlack">' + name +'</div><div align="left" class="hoodDescText">'+ description +'</div><div align="left"><a class="hoodHyperlinks" href="/signuphood.php?hoodId='+hoodId+'">join</a>&nbsp;&nbsp;<a class="hoodHyperlinks" href="/moreHoodInfo.php?hoodId='+hoodId+'&zip='+postalcode+'">more info...</a></div>';
	
		GEvent.addListener(marker, 'mouseover', function() 
				{
					marker.openInfoWindowHtml(html);
					
				}		
		);
	/*	GEvent.addListener(marker, "drag", function(){
		alert(marker.getPoint().toUrlValue());
		// var searchUrl = 'GetHoods.php?locationValue=' + center.lat() + '&lng=' + center.lng(); 
		}); */
		return marker;
	} 

	function validatePostalCode()
	{
	   if (document.getElementById('zipcode').value == "" || document.getElementById('zipcode').value == "Your Zip Code" || document.getElementById('zipcode').value == "Your Postal Code")
		{
			$('#no').click(function() {
				$.unblockUI();
				document.getElementById('zipcode').focus();
				return false;
			});
	
			document.getElementById('message').innerHTML='<h2>Please enter desired postal code</h2>';
			$.blockUI({ message: $('#emailalert') });
			return false;
			
		}		
		else
		{
		
			if(isNaN(document.getElementById('zipcode').value))
			{
				sZipValue=document.getElementById('zipcode').value.substr(0,3);
			}
			else
			{
				sZipValue=document.getElementById('zipcode').value;
			}
			window.location.replace('http://www.i-neighbors.org/'+sZipValue);
		
			//searchLocations(document.getElementById('zipcode').value);
			//window.location.replace('http://www.i-neighbors.org/'+document.getElementById('zipcode').value);			
		}		   			   
	   /* if (document.getElementById('zipcode').value == "")
		{
			alert ('Please enter desired postal code');
			document.getElementById('zipcode').focus();
			return false;
		}			*/	
	} 
 function validateAccountDetails1IndexPage()
{
	//alert('Here');
	//Validation for firstName	
	if (document.getElementById('firstname').value == "")
	{
		$('#no').click(function() {
			$.unblockUI();
			document.getElementById('firstname').focus();
			return false;
		});

		document.getElementById('message').innerHTML='<h2>At a minimum, to participate in i-Neighbors you must provide an email address, first name and your zip or postal code.</h2>';
	    $.blockUI({ message: $('#emailalert') });
	    return false;
		
	}

	
//Radu - start 1
//Radu - end 1
	//Validation for Valid email Address

	if (document.getElementById('email').value == "")
	{
//Radu - start 2

		$('#no').click(function() {
			$.unblockUI();
			document.getElementById('email').focus();
			return false;
		});

		document.getElementById('message').innerHTML='<h2>Please enter your email address. It is important that you provide an accurate email address, we will relay messages from your neighbors to you at this address (you can adjust the frequency of these notifications). We will not share your email address with your neighbors or anyone else.</h2>';
	    $.blockUI({ message: $('#emailalert') });
	    return false;
		
//Radu - end 2
	
	}	
	else
	{
		var sErr;
		sErr = checkemail(document.getElementById('email'));
		if (!sErr)
		{
			return false;
		}
		else
		{
			sSearchURL = '/query.php?email='+ document.getElementById('email').value;
			Ajax('duplicateemail',sSearchURL);
			//pause(1500);			
			if(parseInt(document.getElementById('result1').value) == 1)
			{
				return false;
			}
		} 
	}
	 
			
	//Validate for passwords
	var pass=document.getElementById("password").value;
	var re = /^(\d|\w|\-|\+|\@|\$|\!|\_|\.|\*){6,15}$/;
	
	if(document.getElementById('password').value == "")
	{
		$('#no').click(function() {
			$.unblockUI();
			document.getElementById('password').focus();
			return false;
		});

		document.getElementById('message').innerHTML='<h2>You need to create a password to setup an account.</h2>';
	    $.blockUI({ message: $('#emailalert') });
	    return false;
		
	}
	//else if (document.getElementById('password').value.length<5)
	else if (!re.test(pass))	
	{
		$('#no').click(function() {
			$.unblockUI();
		document.getElementById('password').focus();
		document.getElementById('password').select();
			return false;
		});

		//document.getElementById('message').innerHTML='<h2>Password should be minimum of 5 characters length</h2>';
		document.getElementById('message').innerHTML='<h2 align=left>Your password must satisfy the following conditions: <br><br>* It must be at least 6 characters long.<br><br> *It can contain letters and numbers and only the following special symbols ! $ @ _ - + * <br> <br> *It cannot contain any spaces.</h2>';
	    $.blockUI({ message: $('#emailalert')});
	    return false;
		
	}
				
	if (document.getElementById('postalcode').value == "")
	{
		$('#no').click(function() {
			$.unblockUI();
		document.getElementById('postalcode').focus();
			return false;
		});

		document.getElementById('message').innerHTML='<h2>We need your Zip or Postal Code to help find your neighborhood</h2>';
	    $.blockUI({ message: $('#emailalert') });
	    return false;
		
	}
	else{
		var zipCode=document.getElementById('postalcode').value;
		var len = zipCode.length; 
	    var flag=0;
	  if(document.getElementById('postalcode').value.match(/^([a-z]){1}[0-9]{1}[a-z]{1}[0-9]{1}[a-z]{1}[0-9]{1}$/i)){
			flag=1; 
	  }	
 
	 if((((!document.getElementById('postalcode').value.match(/^\d+$/))||(len!=5))&&(flag==0)))
		   {                   
				$('#no').click(function() {
					$.unblockUI();
					document.getElementById('postalcode').value = "";          
					document.getElementById('postalcode').focus();                  	 
					return false;
				});
		
				document.getElementById('message').innerHTML='<h2>all US zip codes start with a number and are 5 digits, all Canada postal codes start with a letter and are six digits</h2>';
				$.blockUI({ message: $('#emailalert') });
				return false;
				
		   } 
	} 		
	/*Validation for neighbor hoods selection */

	//Validation for dropdown how
	if (document.getElementById('how').value=="none")

	{
		$('#no').click(function() {
			$.unblockUI();
			document.getElementById('how').focus();
			return false;
		});

		document.getElementById('message').innerHTML='<h2>Please tell us how you found this site.</h2>';
		$.blockUI({ message: $('#emailalert') });
		return false;
		
	}
    
	document.frmIndex.action = "/actionpage.php?module=signup&action=add&flagValue=newuser";
	/*document.frmIndex.submit();*/
}
function Ajax(sModule,sURL) 
{
	//alert (sURL);
	window.status='Please wait. Page is loading...';
	var url = sURL;
	var sAns = "";
	createXMLHTTPObject();
	switch (sModule)
	{
		

		case "duplicateusername":
			if (navigator.appName == "Netscape")
			{	
				xmlhttp.open("GET",url,false);
				xmlhttp.send("");
				document.getElementById('result1').value=xmlhttp.responseText;
				if (parseInt(xmlhttp.responseText)==1)
				{
					$('#no').click(function() {
						$.unblockUI();
						document.getElementById('firstname').value="";
						document.getElementById('firstname').focus();
						return false;
					});
			
					document.getElementById('message').innerHTML='<h2>Other user has already registered with this username!</h2>';
					$.blockUI({ message: $('#emailalert') });
					return false;
					
				}
			}
			else
			{			    
				xmlhttp.onreadystatechange=fnCheckDuplicateUserNameIE;
				xmlhttp.open("GET",url,false);
				xmlhttp.send(null);				
			}
			break;
	
	case "duplicateemail":
			if (navigator.appName == "Netscape")
			{	
				xmlhttp.open("GET",url,false);
				xmlhttp.send("");
				document.getElementById('result1').value=xmlhttp.responseText;
				if (parseInt(xmlhttp.responseText)==1)
				{
					$('#no').click(function() {
						$.unblockUI();
						document.getElementById('email').value="";
						document.getElementById('email').focus();
						return false;
					});
			
					document.getElementById('message').innerHTML='<h2>Other user has already registered with this Email!</h2>';
					$.blockUI({ message: $('#emailalert') });
					return false;
					
				}
			}
			else
			{			    
				xmlhttp.onreadystatechange=fnCheckDuplicateemailIE;
				xmlhttp.open("GET",url,false);
				xmlhttp.send(null);				
			}
			break;
	}
	
	window.status='';	
}
function fnCheckDuplicateUserNameIE()
{
	if(xmlhttp.readyState==4) 
	{
		if (xmlhttp.status==200)
		{
			sAns = xmlhttp.responseText;
			document.getElementById('result1').value=sAns;					
			if (sAns==1)
			{
				$('#no').click(function() {
					$.unblockUI();
					document.getElementById('firstname').focus();
					document.getElementById('firstname').select();
					return false;
				});
		
				document.getElementById('message').innerHTML='<h2>Entered user name is already in use.\nPlease change the user name.!</h2>';
				$.blockUI({ message: $('#emailalert') });
				return false;
				
			}
		}
	}
}
function fnCheckDuplicateemailIE()
{
	if(xmlhttp.readyState==4) 
	{
		if (xmlhttp.status==200)
		{
			sAns = xmlhttp.responseText;
			document.getElementById('result1').value=sAns;					
			if (sAns==1)
			{
				$('#no').click(function() {
					$.unblockUI();
					document.getElementById('email').focus();
					document.getElementById('email').select();
					return false;
				});
		
				document.getElementById('message').innerHTML='<h2>Entered email address is already in use.\nPlease change the email address.!</h2>';
				$.blockUI({ message: $('#emailalert') });
				return false;
				
			}
		}
	}
}
function createXMLHTTPObject()

{
	try 
	{
		xmlhttp=new XMLHttpRequest();
	}
	catch (e) 
	{
		try 
		{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) 
		{
			try 
			{
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) 
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
}



