function displayWaterType(val)
{
	var location_name = document.getElementById("location_name").value;
	if(location_name)
	{
		if(val == 'Lake')
		{
			document.getElementById("fishing_location_name").innerHTML = val+' '+location_name;
			document.getElementById('hid_loc_name').value = val+' '+location_name;
		}
		else
		{
			document.getElementById("fishing_location_name").innerHTML = location_name+' '+val;
			document.getElementById('hid_loc_name').value = location_name+' '+val;
		}
	}
	
		
}
function loadFishingLocation()
{
	var location_name = document.getElementById("location_name").value;
	var bodywater = document.getElementById("water_body").value;
	location_name = location_name.toLowerCase();
	if(bodywater == 'Lake')
	{
		var words = location_name.split(" "); 
		for (var i=0 ; i < words.length ; i++){ 
			  var testwd = words[i]; 
			  var firLet = testwd.substr(0,1); 
			  var rest = testwd.substr(1, testwd.length -1) 
			  words[i] = firLet.toUpperCase() + rest 
		   } 
		 location_name = words.join(" ");
		document.getElementById("fishing_location_name").innerHTML = bodywater+' '+location_name;
		document.getElementById('hid_loc_name').value = bodywater+' '+location_name;
	}
	else
	{
		var words = location_name.split(" "); 
		for (var i=0 ; i < words.length ; i++){ 
			  var testwd = words[i]; 
			  var firLet = testwd.substr(0,1); 
			  var rest = testwd.substr(1, testwd.length -1) 
			  words[i] = firLet.toUpperCase() + rest 
		   } 
		 location_name = words.join(" ");
		document.getElementById("fishing_location_name").innerHTML = location_name+' '+bodywater;
		document.getElementById('hid_loc_name').value = location_name+' '+bodywater;
	}
}
function addSpecies()
{
	var myForm = document.frmLocation; //Form Name
    var mySel = myForm.sel_species; // Listbox Name
	var unsel = myForm.unsel_species;
    var myOption;
	var flg = 0;
	for(var i=0;i<unsel.options.length;i++)
	{
		if(unsel.options[i].selected)
		{
			if(mySel.options.length > 0)
			{
				for(var j=0;j<mySel.options.length;j++)
				{
					if(unsel.options[i].value == mySel.options[j].value)
					{
						flg = 1;
					}
				}
				
			}
			if(flg == 0)
			{
				myOption = document.createElement("Option");
				var trim_text = trim(unsel.options[i].text);
				myOption.text = trim_text; 
				myOption.value = unsel.options[i].value;
				mySel.options.add(myOption);
			}
			flg  = 0;
    		
		}
	}
  
}
function trim(str)
{
   return str.replace(/^\s+|\s+$/g,"");
}
function removeSpecies()
{
	var myForm = document.frmLocation; //Form Name
    var mySel = myForm.sel_species; // Listbox Name
	for(var i=0;i<mySel.options.length;i++)
	{
		if(mySel.options[i].selected)
		{
			mySel.remove(i);
		}
		
	}
}

function chnagePBVal(radioObj)
{
	
	if(radioObj.value == 'Y')
	{
		document.getElementById('hid_pub_access').value = 'Y';
	}
	else
	{
		document.getElementById('hid_pub_access').value = 'N';
	}
}
function changeBoatAc(radioObj)
{
	if(radioObj.value == 'Y')
	{
		document.getElementById('hid_boat_access').value = 'Y';
	}
	else
	{
		document.getElementById('hid_boat_access').value = 'N';
	}
}
function changeTourVal(radioObj)
{
	if(radioObj.value == 'Y')
	{
		document.getElementById('hid_tournament').value = 'Y';
	}
	else
	{
		document.getElementById('hid_tournament').value = 'N';
	}
}

function movemapLocation()
{
	
	closepopup();
	_var = document.getElementById('updatedLocation').value;
	
	if(_var != 0)
	{
		var datas = _var.split(",");
		var country = datas[2];
		var state = datas[1];
		var city = datas[0];
		var cntry_code = datas[3];
		var LatLong = document.getElementById('curLatLong').value;
		var newLatLong = LatLong.replace("(","");
		newLatLong = newLatLong.replace(")","");
		var datas = newLatLong.split(",");
		document.getElementById('latitude').value = datas[0];
		var long = datas[1];
		long = long.replace(" ","");
		document.getElementById('longitude').value = long;
		
		var city_entered = document.getElementById("city").value;
		if((city != '')&&(city_entered != city))
		{
			document.getElementById('city').value = city;
		}
		else if(city == '')
		{
			document.getElementById('city').value = '';
		}
		if(country != '')
		{
			//document.getElementById("country").
			//var w = document.frmLocation.country.selectedIndex;
			var COUNTRY = document.frmLocation.country.value;
			
			if(COUNTRY != cntry_code)
			{
				document.getElementById('country').value = cntry_code;
			}
			
			show_state('state',country,state);
		}
		
	}
	
}