	//<![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()",4000) 
		} 
	}
	function clear () { 
		window.status= ""; 
	} 
	
	function load() 
	{
		if (GBrowserIsCompatible()) 
		{
			progressBar();
			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),14);
		var sZipCode=zip;
			 
     			 /*if(!sZipCode)
						{			
     				   progressBar();*/
						geocoder.getLatLng(sZipCode, function(latlng) 
								{
								 searchLocationsNear(latlng);
								});		
						//} 
		   			} 				
		  				
	}
	
	
	function searchLocationsNear(center) 
	{
	    /*if(document.getElementById('zipcode').value!="Your Zip / Postal Code")
		{var zipcode = document.getElementById('zipcode').value;}		
				else*/
		var zipcode=zip;

		/*<? echo "var neighborHoodId = ".$neighborHoodId." "; ?>*/	
		/*if(!zipcode)
		{
		//alert(center);
		//var searchUrl = 'GetHoods.php?lat=' + center.lat() + '&lng=' + center.lng(); */
		var searchUrl = '/GetHoods.php?hood='+hoodId;
		/*}
		else
		{
		 var searchUrl = '/GetHoods.php?lat=' + center.lat() + '&lng=' + center.lng() + '&zip=' + zipcode ; 
		} */
		// alert(searchUrl);
		 //var searchUrl = 'GetHoods.php?neighborHoodId=' + neighborHoodId + '' ; 		
		//alert(searchUrl);
		GDownloadUrl(searchUrl, function(data) 

						{
							var xml = GXml.parse(data);	   
							var markers = xml.documentElement.getElementsByTagName('marker');	   

							map.clearOverlays();						   
							if (markers.length == 0) 
							{
								alert('There are no '+NCookie+'s for this postal Code');
								map.setCenter(new GLatLng(40, -100), 10);
								return;
							}
							var count=0;
							var bounds = new GLatLngBounds();
							
							
							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 newDescription = '';
								//var descLength = description.length;
								var latitude = parseFloat(markers[i].getAttribute('latitude'));
								var longitude= parseFloat(markers[i].getAttribute('longitude'));
								/*if (parseInt(descLength)>50)
								{
									newDescription = description.substr(0,50)+'...';
								}
								else
								{
									newDescription = description;
								}*/
								// var distance = parseFloat(markers[i].getAttribute('distance'));
								count=count+0.000050;			
								var point = new GLatLng(latitude+count,longitude-count);
											 
							   //var poly =  new GPolygon(pts,"#RRGGBB",1,1,colour,0.5,{clickable:true});
	
								var marker = createMarker(point,name,address,newDescription,hoodId,postalcode,photos,titles);
								map.addOverlay(marker);
								
								bounds.extend(point);
						   }
						   //map.setCenter(bounds.getCenter(), ((map.getBoundsZoomLevel(bounds))-11));
						   /*if(zipcode==''){
						   	 //map.setCenter(bounds.getCenter(),11);
							 //map.setCenter(new GLatLng(loc_lat, loc_long),11);
						   }
						   else{
						    //map.setCenter(bounds.getCenter(), ((map.getBoundsZoomLevel(bounds))-1));
							map.setCenter(new GLatLng(center.lat(), center.lng()),12);
						  } */
						 }
			);
	}
	
	function createMarker(point, name, address,description,hoodId,postalcode,photos,titles) 
	{
	//	var marker = new GMarker(point,baseIcon);	
		
		var marker =  new GMarker(point, {icon:baseIcon, draggable: false}); 		
		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+'">more info...</a></div><div id="imagesDisp" style="width:260px; " align="left">';
		var html = '<div align="left" class="hoodSelectBlack">' + name +'</div><div id="imagesDisp" style="width:260px; " align="left">';
		
		//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>';
		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;');
			//alert(titlesX);*/
			
			if(length<=3)
			{	
				for(var p2=0; p2<length; p2++)
				{
					html+='<a href="#" onclick="displayImage(\''+photos[p2]+'\',\''+titles[p2]+'\');"><img src=http://www.i-'+nCookie+'s.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-'+nCookie+'s.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>';
	
		GEvent.addListener(marker, 'mouseover', function() 
				{
					marker.openInfoWindowHtml(html);
					
				}		
		); 
		marker.openInfoWindowHtml(html);
		return marker;
	}


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('result').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('result').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 username.!</h2>';
					$.blockUI({ message: $('#emailalert') });
					return false;
					
				}
			}
			else
			{			    
				xmlhttp.onreadystatechange=fnCheckDuplicateemailIE;
				xmlhttp.open("GET",url,false);
				xmlhttp.send(null);				
			}
			break;
			case "zipcode":
			if (navigator.appName == "Netscape")
			{	
				xmlhttp.open("GET",url,false);
				xmlhttp.send("");
				document.getElementById('result').value=xmlhttp.responseText;
				if (parseInt(xmlhttp.responseText)==1)
				{
					alert ('Extend the Limit');					
				}
			}
			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('result').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('result').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;
			}
		}
	}
}

var firstName,email,passWord,how;
function validateSignupDetails()
{
	//Validation for firstName	
	firstName = document.getElementById('firstname').value;
	email = document.getElementById('email').value ;
	passWord= document.getElementById('password').value;
	how=document.getElementById('how').value; 
	
	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-'+NCookie+'s you must provide an email address, first name and your zip or postal code.</h2>';
		$.blockUI({ message: $('#emailalert') });
		return false;

		
	}
	/*else
		{
			sSearchURL = '/query.php?UserName='+ document.getElementById('firstname').value;			
			Ajax('duplicateusername',sSearchURL);			
			if(parseInt(document.getElementById('result').value) == 1)
			{
				return false;
			}				
		}*/			
	if (document.getElementById('email').value == "")
	{
		
		$('#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 '+nCookie+'s to you at this address (you can adjust the frequency of these notifications). We will not share your email address with your '+nCookie+'s or anyone else.</h2>';
		$.blockUI({ message: $('#emailalert') });
		return false;
		
	}
	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('result').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 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;
		
	}

	//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;
		
	}  
	var private=document.getElementById('private').value;
	if(private ==1){
		$.blockUI({ message: $('#popuup_div')});
	 }
	 else{
	    
		 //var searchURl= '/actionpage.php?module=signup&action=public&firstName=' + firstName + '&email=' + email + '&passWord=' + passWord + '&how='+ how + '&postalcode=' + postalcode + '&hoodId=' + hoodId ;   
		 //ajax1(searchURl);
		 window.location.replace('/actionpage.php?module=signup&action=public&firstName=' + firstName + '&email=' + email + '&Word=' + passWord + '&how='+ how + '&postalcode=' + postalcode + '&hoodId=' + hoodId);
		 /*if(sessionId){
			 window.location.replace('/home.php');
		}
		else{
			 window.location.replace('/index.php');
		}*/	  
	}	 
     
}
function ajax1(url) { 
        var http_request = false;
       //  alert(url);	
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
        
            http_request = new XMLHttpRequest();
     	   
           if (http_request.overrideMimeType){
    	   
               http_request.overrideMimeType('text/xml');
    		   
           }
    	   
       } 
       else if (window.ActiveXObject) { // IE
       
           try{
    	   
               http_request = new ActiveXObject("Msxml2.XMLHTTP");
    		   
           } 
    	   catch(e){
    	   
               try{
    		   
                   http_request = new ActiveXObject("Microsoft.XMLHTTP");
    			   
               } 
    		   catch (e) {}
           }
    	   
       }
    
       if (!http_request) {
       
           alert('Unfortunatelly you browser doesn\'t support this feature.');
    	   
           return false;
    	   
       }
       http_request.onreadystatechange = function() {
       
          if (http_request.readyState == 4){
   	   
               if (http_request.status == 200){
    
    			//	alert(http_request.responseText);
    
               } 
    		   else{
   		   
                   alert('There was a problem with the request.(Code: ' + http_request.status + ')');
    			   
               }
    		   
           }
    	   
       };
      // alert(url);
       http_request.open('GET', url, false);
       http_request.send(null);
    }




function validateMessage(){
   // alert(firstName);  
   if (document.getElementById('message7').value == "")
	{
		alert ('Please Enter the Message Code ');
		document.getElementById('message7').focus();
		return false;
	}
	
	//&firstName=firstName&email=email&passWord=passWord&how=how";	
	// var url= '/actionpage.php?firstName=' + firstName + '&email=' + email + '&passWord=' + passWord + '&how='+ how;
	var userPrivate=document.getElementById('userprivate').value;
	if (userPrivate=='')
    document.moreHoodInfo1.action= '/actionpage.php?module=signup&action=private&firstName='+ firstName + '&email=' + email + '&passWord=' + passWord + '&how=' + how;   
	else
    document.moreHoodInfo1.action= '/actionpage.php?module=signup&action=private1';   

	//document.moreHoodInfo1.submit();
  	//ajax1(url);
}

function validatePostalCode(){
	   if (document.getElementById('zipcode').value == "" || document.getElementById('zipcode').value == "Your Zip / 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;
			}
			//searchLocations(document.getElementById('zipcode').value);
			//window.location.replace('http://www.i-neighbors.org/'+document.getElementById('zipcode').value);
			window.location.replace('http://www.i-'+nCookie+'s.org/'+sZipValue);
			//searchLocations(document.getElementById('zipcode').value);
			//window.location.replace('http://www.i-neighbors.org/'+document.getElementById('zipcode').value);
		}		   			   
}

function validateSignupDetailsIndex(){

	var private=document.getElementById('private').value;
	if(private ==1){
		$.blockUI({ message: $('#popuup_div')});		  		 
	 }
	else
	{
	sSession=document.getElementById('hoods').value;
	if(sSession=='')
	
	{
	sSelValues = "/"+hoodId+"/";
	}
	else
	{
	sSelValues = document.getElementById('hoods').value+hoodId+"/";
	}
	if(sSession=='') 
	window.location.replace("/actionpage.php?module=moreneighbourhoods&action=index&neighbour="+sSelValues+"&id="+hoodId);
	else
	window.location.replace("/actionpage.php?module=moreneighbourhoods&action=add&neighbour="+sSelValues+"&id="+hoodId);
	}
}


