function oldcheckEmail(what) 
	{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(what))
		{
		return (true)
		}
	alert("incorect email format");
	return (false)
	}
function checkEmail(str) {
return (str.lastIndexOf(".") > 2) && (str.indexOf("@") > 0) && (str.lastIndexOf(".") > (str.indexOf("@")+1)) && (str.indexOf("@") == str.lastIndexOf("@"));
}

function deletesighting(uid,ad)
	{
	if (confirm("Are You Sure ?"))
		{ 
		what="";
		what="dsid"+uid;
		whatf="sid"+uid;
		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		advAJAX.post({
			url: "../assets/includes/deletesighting.php",
       		s: uid,
       		add: ad,
       		onInitialization : function (obj)
          		{
		   		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  		},
       		onSuccess : function(obj) 
	      		{
		  	
		  		},
      		onFinalization : function(obj) 
	      		{
		  		if (obj.responseText=="deleted")
		  			document.getElementById(whatf).style.display="none";
	      		}		  
   			});
 		}
 	else
 		{
		return false;	
		};
	};


function deleteuser(uid,ad)
	{
	if (confirm("Are You Sure ?"))
		{ 
		what="";
		what="dsid"+uid;
		whatf="sid"+uid;
		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  	advAJAX.post({
       		url: "../assets/includes/deleteuser.php",
       		add: ad,
       		s: uid,
       		onInitialization : function (obj)
          		{
		   		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  		},
       		onSuccess : function(obj) 
	      		{ 	
		  		},
      		onFinalization : function(obj) 
	      		{
		  		if (obj.responseText=="deleted")
		  			document.getElementById(whatf).style.display="none";
	      		}		  
   			});
 		}
 	else
 		{
		return false;	
		};
	};


function remindpass(ema)
	{
	advAJAX.post({
    	url: "assets/includes/rpass.php",
       	s: ema,
       	onInitialization : function (obj)
			{
			},
		onSuccess : function(obj) 
			{
			},
      	onFinalization : function(obj) 
	  		{
		  	document.getElementById("forgot-form").innerHTML="password sent";
	      	}		  
		});
	};
	
function deletearticle(sid,ad)
	{
	if (confirm("Are You Sure ?"))
		{ 
		what="";
		what="dsid"+sid;
		whatf="sid"+sid;
		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  	advAJAX.post({
       		url: "/assets/includes/deletearticle.php",
       		s: sid,
       		add: ad,
       		onInitialization : function (obj)
          		{
		   		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  		},
	  	    onFinalization : function(obj) 
			      {
			  if (obj.responseText=="deleted")
		  	  	document.getElementById(whatf).style.display="none";
			  }		  
   			});
 		}
 	else
 		{
		return false;	
		};
	};


function deletelink(sid,ad)
	{
	if (confirm("Are You Sure ?"))
		{ 
		what="";
		what="dsid"+sid;
		whatf="sid"+sid;
		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  	advAJAX.post({
       		url: "includes/deletelink.php",
       		s: sid,
       		add: ad,
       		onInitialization : function (obj)
          		{
		   		document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  		},
	  	    onFinalization : function(obj) 
			      {
			  if (obj.responseText=="deleted")
		  	  	document.getElementById(whatf).style.display="none";
			  }		  
   			});
 		}
 	else
 		{
		return false;	
		};
	};




function deletespeciesg(sid,ad)
	{
	if (confirm("Are You Sure ?"))
	{ 
	what="";
	what="dsid"+sid;
	whatf="sid"+sid;
	document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  advAJAX.post({
       url: "/assets/includes/deletespeciesg.php",
       s: sid,
 		add: ad,       
       onInitialization : function (obj)
          {
		   document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  },
       onSuccess : function(obj) 
	      {

		  },
      onFinalization : function(obj) 
	      {
		  if (obj.responseText=="deleted")
		  	document.getElementById(whatf).style.display="none";

	      }		  
   });
 	}
 	else
 	{
	return false;	
	};
	};



function deletesighting(sid,ad)
	{
	if (confirm("Are You Sure ?"))
	{ 
	what="";
	what="dsid"+sid;
	whatf="sid"+sid;
	document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  advAJAX.post({
       url: "/assets/includes/deletesighting.php",
       s: sid,
       		add: ad,       
       onInitialization : function (obj)
          {
		   document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  },
       onSuccess : function(obj) 
	      {
		  	
		  },
      onFinalization : function(obj) 
	      {
		  if (obj.responseText=="deleted")
		  	document.getElementById(whatf).style.display="none";

	      }		  
   });
 	}
 	else
 	{
	return false;	
	};
	};


function deletespecies(sid,ad)
	{
	if (confirm("Are You Sure ?"))
	{ 
	what="";
	what="dsid"+sid;
	whatf="sid"+sid;
	document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
	  advAJAX.post({
       url: "/assets/includes/deletespecies.php",
       s: sid,
  		add: ad,       
       onInitialization : function (obj)
          {
		   document.getElementById(what).style.background="transparent url(images/lock.gif) no-repeat scroll 0%";
		  },
       onSuccess : function(obj) 
	      {
		  	
		  },
      onFinalization : function(obj) 
	      {
		  if (obj.responseText=="deleted")
		  	document.getElementById(whatf).style.display="none";

	      }		  
   });
 	}
 	else
 	{
	return false;	
	};
	};

function smartsearch2(p,np)
	{
	if (document.search2.search.value != '')
		{
   advAJAX.post({
       url: "assets/includes/smartsearch2.php",
       whattofind: document.search2.search.value,
       p: p,
       np: np,
       onInitialization : function (obj)
          {
          document.getElementById("statusik").style.display='block';	
		  document.getElementById("statusik").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("main_section_tbl").innerHTML = obj.responseText;             
		  },
      onFinalization : function(obj) 
	      {
		  document.getElementById("statusik").innerHTML= "";  	        
          document.getElementById("statusik").style.display='none';		        			 
	      }		  
   });
   };
};


function smartsearch()
	{
	if (document.sortfilter.whattofind.value != '')
		{
	document.sortfilter.g.value='';
   advAJAX.post({
       url: "smartsearch.php",
       whattofind: document.sortfilter.whattofind.value,
	   sortorder: document.sortfilter.sort.value,
       onInitialization : function (obj)
          {
          document.getElementById("statusik").style.display='block';	
		  document.getElementById("statusik").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("main_section_tbl").innerHTML = obj.responseText;             
		  },
      onFinalization : function(obj) 
	      {
	      document.sortfilter.g.value='';
		  document.getElementById("info1").innerHTML= "Results for [ "+document.sortfilter.whattofind.value+" ] on Biology.ie";  	        		   
		  document.getElementById("statusik").innerHTML= "";  	        
          document.getElementById("statusik").style.display='none';		        			 
	      }		  
   });
   };
};



	function showspecies3(species,mapid)
		{
		species1=species.split(",");
//	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/speciesc.php",
       s: species1[0],
       m: mapid,
       onInitialization : function (obj)
          {
           if (document.getElementById("aboutsighting"))
		  document.getElementById("aboutsighting").style.display='none';		  
          document.getElementById("aboutspecies").style.display='block';	
		  document.getElementById("aboutspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aboutspecies").innerHTML = obj.responseText;             
		  }
   });

		};



	function showspecies(species)
		{
	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/speciesc.php",
       s: species,
       onInitialization : function (obj)
          {
           if (document.getElementById("aboutsighting"))
		  document.getElementById("aboutsighting").style.display='none';		  
          document.getElementById("aboutspecies").style.display='block';	
		  document.getElementById("aboutspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aboutspecies").innerHTML = obj.responseText;             
		  }
   });

		};
	function showspecies2(species)
		{
		species1=species.split(",");
//	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/speciesc.php",
       s: species1[0],
       onInitialization : function (obj)
          {
           if (document.getElementById("aboutsighting"))
		  document.getElementById("aboutsighting").style.display='none';		  
          document.getElementById("aboutspecies").style.display='block';	
		  document.getElementById("aboutspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aboutspecies").innerHTML = obj.responseText;             
		  }
   });

		};

function showspecies2new(species)
	{
	species1=species.split(",");
   	advAJAX.post({
    	url: "assets/includes/speciesc.php",
       	s: species1[0],
       	onInitialization : function (obj)
        	{
           	if (document.getElementById("aboutsighting"))
		  		document.getElementById("aboutsighting").style.display='none';		  
          	document.getElementById("aboutspecies").style.display='block';	
		  	},
       onSuccess : function(obj) 
	      { 
		  $("#aboutspecies").append(obj.responseText);
		  }
   	});
	};

function showspeciesname(species,nr)
	{
	species1=species.split(",");
   	advAJAX.post({
    	url: "assets/includes/speciescn.php",
       	s: species1[0],
		nr: nr,
       	onInitialization : function (obj)
        	{
           	if (document.getElementById("aboutsighting"))
		  		document.getElementById("aboutsighting").style.display='none';		  
          	document.getElementById("aboutspecies").style.display='block';	
		  	},
       onSuccess : function(obj) 
	      { 
		  $("#aboutspecies").append(obj.responseText);
		  }
   	});
	};


	function showspecieslist(group,m)
		{
	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/specieslist.php",
       g: group,
       m: m,
       onInitialization : function (obj)
          {
		  document.getElementById("aspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aspecies").innerHTML = obj.responseText;             
		  }
   });

		};

	function show2specieslist(group,m)
		{
   advAJAX.post({
       url: "assets/includes/specieslist.php",
       g: group,
       m: m,
       onInitialization : function (obj)
          {
		  document.getElementById("aspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aspecies").innerHTML = obj.responseText;             
		  }
   });

		};


	function showspecieslist2(group,m)
		{
//	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/specieslist2.php",
       g: group,
       m: m,
       onInitialization : function (obj)
          {
		  document.getElementById("aspecies").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aspecies").innerHTML = obj.responseText;             
		  }
   });

		};














	function areaslist(group)
		{
//	map.removeAllMarkers();
   advAJAX.post({
       url: "assets/includes/areaslist.php",
       g: group,
       onInitialization : function (obj)
          {
		  document.getElementById("aareas").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aareas").innerHTML = obj.responseText;             
		  }
   });

		};
	function areaslist_v2(group)
		{
   advAJAX.post({
       url: "assets/includes/areaslist.php",
       g: group,
       onInitialization : function (obj)
          {
		  document.getElementById("aareas").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aareas").innerHTML = obj.responseText;             
		  }
   });

		};




function showsd(sighting)
	{   

   advAJAX.post({
       url: "assets/includes/sightingc.php",
       s: sighting,
       onInitialization : function (obj)
          {
          document.getElementById("aboutsighting").style.display='block';	
		  document.getElementById("aboutsighting").innerHTML= "Searching...";  
		  },
       onSuccess : function(obj) 
	      { 
 	      document.getElementById("aboutsighting").innerHTML = obj.responseText;             
		  }
   });


	};
	
function showonmap()
	{

			if (isNaN(document.new_sighting.gps_lon.value) || document.new_sighting.gps_lon.value=='' || document.new_sighting.gps_lat.value=='' || isNaN(document.new_sighting.gps_lat.value)) {
				document.new_sighting.gps_lon.value = '';
				document.new_sighting.gps_lat.value = '';
				alert("location on map incorect, click on the map to indicate the location of your sighting or provide exact GPS Coordinates");
			}
			else {
			
			
				laty = document.new_sighting.gps_lat.value;
				latx = document.new_sighting.gps_lon.value;
				
				latyx = laty + "," + latx;
//				igs = conv_gps_igs(laty, latx);
//				igs_en = igs.split(",");
//				igs_e = igs_en[0];
//				igs_n = igs_en[1];
//				document.new_sighting.igs_e.value = igs_e;
//				document.new_sighting.igs_n.value = igs_n;
//				document.new_sighting.ngr.value = NE2NGR(igs_e, igs_n);
				//								alert(NE2NGR(igs_e, igs_n));
				
				
				latlng = new GLatLng(laty, latx);
				
				var myHtml = "the location of your sighting: <br/>" + latlng;
				map.openInfoWindow(latlng, myHtml);
				map.panTo(latlng);
			};
};

function showonmap3()
   {
	map.removeAllMarkers();

gpsy=conv_igs_gps(document.new_sighting.igs_e.value,document.new_sighting.igs_n.value);
								gpsy_2=gpsy.split(",");
								document.new_sighting.gps_lat.value=gpsy_2[0];
								document.new_sighting.gps_lon.value=gpsy_2[1];																

laty=document.new_sighting.gps_lat.value;
latx=document.new_sighting.gps_lon.value;

latyx=laty + "," +latx;
marker1 = new CustomPOIMarker( 'new', '','', '0xFF0000', '0xFFFFFF'); 
								var latlon = new LatLon(laty,latx);
								map.setCenterByLatLon(latlon);

map.addMarkerByAddress( marker1, latyx); 
};



function showonmap4(ngr)
   {

conv_ngr_to_ings(document.new_sighting.ngr.value);

laty=document.new_sighting.gps_lat.value;
latx=document.new_sighting.gps_lon.value;
		latlng = new GLatLng(laty,latx);		

	          var myHtml = "the location of your sighting: <br/>"+latlng;
	          map.openInfoWindow(latlng, myHtml);
	  		  map.panTo(latlng);

};



function showonmap2(project,species)
   {
	var x;
//   map.removeAllMarkers();
		species1=species.split(",");
		if (species1[0]=="all")
		{
		species1[0]="all"+document.toshow.ngspecies.value;
		};
   advAJAX.post({
       url: "assets/includes/sightings.php",
       s: species1[0],
       c: project,
       onInitialization : function (obj)
          {
//		  document.getElementById("aboutsighting").innerHTML= "Searching...";  
		  },
       onFinalization : function(obj) 
	      { 
 	      lista = obj.responseText;     
    	  lista2 = lista.split(";");
    	  xx=lista2.length;
		  map.clearOverlays();
		  for (x=0; x < xx; x++)
		  	{
			if (lista2[x]!='' && x!="each")
			{
			// alert(x+"|"+lista2[x]);
			lista2a=lista2[x];
		  	lista3=lista2a.split(",");
			laty=lista3[3];
			latx=lista3[4];
			latyx=laty + "," +latx;
			ttt='this.target="_blank"';
			
var redIcon = new GIcon(G_DEFAULT_ICON);
redIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";
markerOptions = { icon:redIcon };
			
//			marker1 = new CustomPOIMarker( species1[1], '<br />'+lista3[1], lista3[2]+'<br /><a href="sighting.php?s='+lista3[0]+'" target="_blank">see more</a>', '0xFF0000', '0xFFFFFF'); 
//			marker1 = new CustomPOIMarker( lista3[5], '<br>Details:<b> '+lista3[1]+'</b>', 'When: <b>'+lista3[2]+'</b><br><a href="sighting.php?s='+lista3[0]+'" target="_blank">View more details...</a>', '0xFF0000', '0xFFFFFF'); 
//			var latlon = new LatLon(laty,latx);
//			map.addMarkerByAddress( marker1, latyx); 
//			alert(laty+"|"+latx+"|"+x+"|"+lista3[5]+"|"+lista3[2]+"|"+lista3[1]+"|"+lista3[0]);	
			if (latx!=''&&laty!='')
				map.addOverlay(createMarker(new GLatLng(laty,latx),x, lista3[5], lista3[2], lista3[1], lista3[0],3));			
//			map.panTo(new GLatLng(laty,latx));
			};
			}
		  }
   });
};




function showonmap22(project,species)
   {
	var x;
   species=document.toshow.nspecies.value;
		species1=species.split(",");
		if (species1[0]=="all")
		{
		species1[0]="all"+document.toshow.ngspecies.value;
		};	
   advAJAX.post({
       url: "assets/includes/sightings22.php",
       s: species1[0],
       c: project,
	   dfrom: document.toshow.date_from.value,
		dto: document.toshow.date_to.value,	   
       onInitialization : function (obj)
          {
		  document.getElementById("aboutsighting").innerHTML= "Searching...";  
		  },
       onFinalization : function(obj) 
	      { 
 	      lista = obj.responseText;     
    	  lista2 = lista.split(";");
    	  xx=lista2.length;
		  map.clearOverlays();		  
		  for (x=0; x < xx; x++)
		  	{
			if (lista2[x]!='' && x!="each")
			{
			// alert(x+"|"+lista2[x]);
			lista2a=lista2[x];
		  	lista3=lista2a.split(",");
			laty=lista3[3];
			latx=lista3[4];
			latyx=laty + "," +latx;
			ttt='this.target="_blank"';
			if (latx!=''&&laty!='')
				map.addOverlay(createMarker(new GLatLng(laty,latx),x, lista3[5], lista3[2], lista3[1], lista3[0]));			

//			marker1 = new CustomPOIMarker( species1[1], '<br />'+lista3[1], lista3[2]+'<br /><a href="sighting.php?s='+lista3[0]+'" target="_blank">see more</a>', '0xFF0000', '0xFFFFFF'); 
//			marker1 = new CustomPOIMarker( lista3[5], '<br>Details:<b> '+lista3[1]+'</b>', 'When: <b>'+lista3[2]+'</b><br><a href="sighting.php?s='+lista3[0]+'" target="_blank">View more details...</a>', '0xFF0000', '0xFFFFFF'); 
//			var latlon = new LatLon(laty,latx);
//			map.addMarkerByAddress( marker1, latyx); 
			};
			}
//			map.setCenterByLatLon(latlon);
		  }
   });
};











	
function checksighting()
   {
    if ((document.new_sighting.nspecies && document.new_sighting.nspecies.value != '') && document.new_sighting.email.value != '' && document.new_sighting.gps_lon.value != '' && document.new_sighting.gps_lat.value != '' && document.new_sighting.dates.value != '') {
		if (!checkEmail(document.new_sighting.email.value)) {
				alert("incorect email format");
			document.new_sighting.email.focus();
		}
		else {
			if (isNaN(document.new_sighting.gps_lon.value) || isNaN(document.new_sighting.gps_lat.value))
				{
				document.new_sighting.gps_lon.value='';
				document.new_sighting.gps_lat.value='';		
				document.getElementById('gps').style.display='block';			
				alert("location on map incorect, click on the map to indicate the location of your sighting or provide exact GPS Coordinates");
				}else
				{
			    document.new_sighting.submit();		
				}
			
		}
	}
	else {
		alert("data, position, species or email incorrect ");
	}
};
function checkregister()
	{
	var errorw=0;
	document.getElementById("name").style.border="1px solid #ccc";
	document.getElementById("email").style.border="1px solid #ccc;";	
	document.getElementById("password").style.border="1px solid #ccc;";	
	if (document.reguser.password.value=="")
		{
		document.getElementById("password").style.border="1px solid red;";
		document.reguser.password.focus();
		errorw=1;
		};
	if (document.reguser.email.value=="")
		{
		document.getElementById("email").style.border="1px solid red;";
		document.reguser.email.focus();
		errorw=1;
		};
	if (document.reguser.name.value=="")
		{
		document.getElementById("name").style.border="1px solid red;";
		document.reguser.name.focus();
		errorw=1;
		};
	return errorw;
	};
function userexist()
	{
	var xxx=0;
	user=document.reguser.username.value;
	project=document.reguser.m.value;
	var odp=0;
	  advAJAX.post({
       url: "assets/includes/users.php",
       u: user,
       m: project,
       onFinalization : function(obj) 
	      {
		  odp = obj.responseText;
		if (odp>0 || user=="")
			{
			checkregister();
			document.getElementById("username").style.border="1px solid red;";
			document.reguser.username.focus();
			document.reguser.fstatus.value=0;
			}
		else
			{
			document.getElementById("username").style.border="1px solid #ccc;";		
			aa=checkregister();
			if (aa==0)
			   {
			   document.reguser.fstatus.value=1;
				document.reguser.submit();
			   }
			else
				{
				document.reguser.fstatus.value=0;
				};			   
			};
		  }
		});
	};


function savealist(a)
	{
	b=a.split(','); 
	document.toshow.listspecies.value=document.toshow.listspecies.value +','+b[0]; 
//	alert (document.toshow.listspecies.value);
	};
	
	
	
function showonmap23(project,species,email)
   {
	var x;
	var xxx;
//   species=document.toshow.nspecies.value;
   species1=species.split(",");
    map.clearOverlays();	

	xa=species1.length;
	xxx=1;
//	for (xxx=1;xxx<xa;xxx++)
//{
	if (xxx>0)
		{
		advAJAX.post({
       		url: "assets/includes/sightingsp.php",
       		s: species1[xxx],
       		c: project,
	   		email: email,
	   		dfrom: document.toshow.date_from.value,
			dto: document.toshow.date_to.value,	   
       		onInitialization : function (obj)
          		{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
       		onFinalization : function(obj) 
	      		{ 
 	      		lista = obj.responseText;     
    	  		lista2 = lista.split(";");
    	  		xx=lista2.length;
		  		for (x=0; x < xx; x++)
		  			{
					if (lista2[x]!='' && x!="each")
						{
						lista2a=lista2[x];
			  			lista3=lista2a.split(",");
						laty=lista3[3];
						latx=lista3[4];
						latyx=laty + "," +latx;
						ttt='this.target="_blank"';
						if (latx != '' && laty != '') {
							if (xxx==1)
								map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
							}
	
						};
					}
				if (xa>xxx)
					{
					xxx++;
					advAJAX.post({
				    	url: "assets/includes/sightingsp.php",
				       	s: species1[xxx],
				       	c: project,
					   	email: email,
					   	dfrom: document.toshow.date_from.value,
						dto: document.toshow.date_to.value,	   
				       	onInitialization : function (obj)
				        	{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
				       	onFinalization : function(obj) 
					    	{ 
				 	      	lista = obj.responseText;     
				    	  	lista2 = lista.split(";");
				    	  	xx=lista2.length;
						  	for (x=0; x < xx; x++)
						  		{
								if (lista2[x]!='' && x!="each")
									{
									lista2a=lista2[x];
							  		lista3=lista2a.split(",");
									laty=lista3[3];
									latx=lista3[4];
									latyx=laty + "," +latx;
									ttt='this.target="_blank"';
									if (latx != '' && laty != '') {
										if (xxx==1)
											map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
										if (xxx==2)
											map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
										if (xxx==3)
											map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
										if (xxx==4)
											map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
										}					
									};
								}
						  	if (xa>xxx)
						  		{
								xxx++;
   								advAJAX.post({
       								url: "assets/includes/sightingsp.php",
	       							s: species1[xxx],
       								c: project,
	   	   							email: email,
	   								dfrom: document.toshow.date_from.value,
									dto: document.toshow.date_to.value,	   
       								onInitialization : function (obj)
          								{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
       								onFinalization : function(obj) 
	      								{ 
								 	    lista = obj.responseText;     
								    	lista2 = lista.split(";");
								    	xx=lista2.length;
		  								for (x=0; x < xx; x++)
		  									{
											if (lista2[x]!='' && x!="each")
												{
												lista2a=lista2[x];
											  	lista3=lista2a.split(",");
												laty=lista3[3];
												latx=lista3[4];
												latyx=laty + "," +latx;
												ttt='this.target="_blank"';
												if (latx != '' && laty != '') {
													if (xxx==1)
														map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
													if (xxx==2)
														map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
													if (xxx==3)
														map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
													if (xxx==4)
														map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
													}									
												};
											}
										if (xa>xxx)
		  									{
											xxx++;
										   	advAJAX.post({
										    	url: "assets/includes/sightingsp.php",
										       	s: species1[xxx],
										       	c: project,
											   	email: email,
											   	dfrom: document.toshow.date_from.value,
												dto: document.toshow.date_to.value,	   
										       	onInitialization : function (obj)
										        	{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
       											onFinalization : function(obj) 
	      											{ 
											 		lista = obj.responseText;     
    	  											lista2 = lista.split(";");
	    	  										xx=lista2.length;
		  											for (x=0; x < xx; x++)
		  												{
														if (lista2[x]!='' && x!="each")
															{
															lista2a=lista2[x];
			  												lista3=lista2a.split(",");
															laty=lista3[3];
															latx=lista3[4];
															latyx=laty + "," +latx;
															ttt='this.target="_blank"';
															if (latx != '' && laty != '') {
																if (xxx==1)
																	map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																if (xxx==2)
																	map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																if (xxx==3)
																	map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																if (xxx==4)
																	map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																}
															};
														}
													if (xa>xxx)
		  												{
														xxx++;
   														advAJAX.post({
													    	url: "assets/includes/sightingsp.php",
													    	s: species1[xxx],
													    	c: project,
												   	   		email: email,
	   														dfrom: document.toshow.date_from.value,
															dto: document.toshow.date_to.value,	   
								       						onInitialization : function (obj)
          														{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
													       onFinalization : function(obj) 
														      { 
													 	      lista = obj.responseText;     
													    	  lista2 = lista.split(";");
													    	  xx=lista2.length;
															  for (x=0; x < xx; x++)
															  	{
																if (lista2[x]!='' && x!="each")
																	{
																	lista2a=lista2[x];
																  	lista3=lista2a.split(",");
																	laty=lista3[3];
																	latx=lista3[4];
																	latyx=laty + "," +latx;
																	ttt='this.target="_blank"';
																	if (latx != '' && laty != '') {
																		if (xxx==1)
																			map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																		if (xxx==2)
																			map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																		if (xxx==3)
																			map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																		if (xxx==4)
																			map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																		if (xxx==5)
																			map.addOverlay(createMarker5(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																		}
																	};
																}
															if (xa>xxx)			
		  														{
																xxx++;
								   								advAJAX.post({
															    	url: "assets/includes/sightingsp.php",
															       	s: species1[xxx],
															       	c: project,
															   		email: email,
															   		dfrom: document.toshow.date_from.value,
																	dto: document.toshow.date_to.value,	   
														       		onInitialization : function (obj)
														          		{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
														       		onFinalization : function(obj) 
															      		{ 
														 	      		lista = obj.responseText;     
														    	  		lista2 = lista.split(";");
														    	  		xx=lista2.length;
																  		for (x=0; x < xx; x++)
																  			{
																			if (lista2[x]!='' && x!="each")
																				{
																				lista2a=lista2[x];
																			  	lista3=lista2a.split(",");
																				laty=lista3[3];
																				latx=lista3[4];
																				latyx=laty + "," +latx;
																				ttt='this.target="_blank"';
																				if (latx != '' && laty != '') {
																					if (xxx==1)
																						map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==2)
																						map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==3)
																						map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==4)
																						map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==5)
																						map.addOverlay(createMarker5(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==6)
																						map.addOverlay(createMarker6(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					}
																				};
																			}
																			

															if (xa>xxx)			
		  														{
																xxx++;
								   								advAJAX.post({
															    	url: "assets/includes/sightingsp.php",
															       	s: species1[xxx],
															       	c: project,
															   		email: email,
															   		dfrom: document.toshow.date_from.value,
																	dto: document.toshow.date_to.value,	   
														       		onInitialization : function (obj)
														          		{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
														       		onFinalization : function(obj) 
															      		{ 
														 	      		lista = obj.responseText;     
														    	  		lista2 = lista.split(";");
														    	  		xx=lista2.length;
																  		for (x=0; x < xx; x++)
																  			{
																			if (lista2[x]!='' && x!="each")
																				{
																				lista2a=lista2[x];
																			  	lista3=lista2a.split(",");
																				laty=lista3[3];
																				latx=lista3[4];
																				latyx=laty + "," +latx;
																				ttt='this.target="_blank"';
																				if (latx != '' && laty != '') {
																					if (xxx==1)
																						map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==2)
																						map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==3)
																						map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==4)
																						map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==5)
																						map.addOverlay(createMarker5(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==6)
																						map.addOverlay(createMarker6(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==7)
																						map.addOverlay(createMarker7(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));

																					}
																				};
																			}
																			
															if (xa>xxx)			
		  														{
																xxx++;
								   								advAJAX.post({
															    	url: "assets/includes/sightingsp.php",
															       	s: species1[xxx],
															       	c: project,
															   		email: email,
															   		dfrom: document.toshow.date_from.value,
																	dto: document.toshow.date_to.value,	   
														       		onInitialization : function (obj)
														          		{document.getElementById("aboutsighting").innerHTML= "Searching...";  },
														       		onFinalization : function(obj) 
															      		{ 
														 	      		lista = obj.responseText;     
														    	  		lista2 = lista.split(";");
														    	  		xx=lista2.length;
																  		for (x=0; x < xx; x++)
																  			{
																			if (lista2[x]!='' && x!="each")
																				{
																				lista2a=lista2[x];
																			  	lista3=lista2a.split(",");
																				laty=lista3[3];
																				latx=lista3[4];
																				latyx=laty + "," +latx;
																				ttt='this.target="_blank"';
																				if (latx != '' && laty != '') {
																					if (xxx==1)
																						map.addOverlay(createMarker(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==2)
																						map.addOverlay(createMarker2(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==3)
																						map.addOverlay(createMarker3(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==4)
																						map.addOverlay(createMarker4(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==5)
																						map.addOverlay(createMarker5(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==6)
																						map.addOverlay(createMarker6(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==7)
																						map.addOverlay(createMarker7(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));
																					if (xxx==8)
																						map.addOverlay(createMarker8(new GLatLng(laty, latx), x, xxx + '|' + lista3[5], lista3[2], lista3[1], lista3[0], xxx));

																					}
																				};
																			};
																			
																			
																			
																			}
   																	});
																};	
		
																			}
   																	});
																};	



																			
																			
																			
																			
																			
																			
																			
																			
																																				
																						
		  																}
   																	});
																}				
															}
   														});
													}							
		  										}
   											});
										}	
									}
   								});															
							}																													
						}
					});												
				};
			}
		});
   };
//}
};
	
	
function cshowonmap4(ngr)
   {

conv_ngr_to_ings(document.new_sighting.ngr.value);

laty=document.new_sighting.gps_lat.value;
latx=document.new_sighting.gps_lon.value;
		latlng = new GLatLng(laty,latx);		

map.clearOverlays();	
			map.addOverlay(createMarker(new GLatLng(laty,latx),x, xxx+'|'+'', '', '', '',''));			


};


function checkusers(email,map)
	{
	var odp=0;
	  advAJAX.post({
       url: "assets/includes/checkusers.php",
       myemail: email,
       m: map,
       onFinalization : function(obj) 
	      {
		  if (obj.responseText=="0")
		  	document.getElementById("statusik").innerHTML="you have no sighting entered, to view please submit sightings";
		  else
		  	document.search2.submit();
		  }
		});
	return false;
	};


function enteruj(map,evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if (charCode == 13) 
		{
		checkusers(document.search2.email.value,map);
		};
};	




function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

