function getTweets(q){
if(q == 'type search here...') q = '';
var lat = document.getElementById('lat').value;
var lon = document.getElementById('lon').value;
var lang = document.getElementById('lang').value;
var twitpic = 0;
if(document.getElementById('twitpic').value != 'undefined'){
	twitpic = document.getElementById('twitpic').checked;
}
document.getElementById('search').value = q;
var zoom = map.getZoom();
var url = "http://tweetatlas.com/";
var qstring = "json=1&q="+encodeURIComponent(q)+"&lat="+lat+"&lon="+lon+"&zoom="+zoom+"&lang="+lang;
if(twitpic != 0){
	qstring += "&twitpic=1";
}
	loadJSON(url,qstring);
}

function tellEm()
{
	var userName = encodeURIComponent(document.getElementById('username').value);
	var password = encodeURIComponent(document.getElementById('password').value);
	var thisUrl = encodeURIComponent(document.getElementById('thisUrl').value);
	var url = "http://tweetatlas.com/tellem/";
	var qstring = "thisurl="+thisUrl+"&username="+userName+"&password="+password;
	loadJSON(url,qstring);
}
function showTweets(res){
		for(i=0; i<markersArray.length; i++){
			map.removeOverlay(markersArray[i]);
		}
        for(i=0; i<res.points.length; i++)
        {
            addPoint(res.points[i]);
        }
		document.getElementById('thisUrlDiv').innerHTML = "<a href='"+res.thisUrl+"'>"+res.thisUrl+"</a>";
		document.getElementById('thisUrl').value = res.thisUrl;
		document.getElementById('postToTwitter').href = postToTwitter();
}
function toldEm(data)
{
	alert('Ya, you told\'em');
}
function postToTwitter()
{
	var longUrl = encodeURIComponent(document.getElementById('thisUrl').value);
	var url = "http://tweetatlas.com/posttotwitter/?longUrl="+longUrl;
	return url;
}
function clickSearch(searchInput, origValue){
	if(searchInput.value == origValue) searchInput.value = '';
	searchInput.select();
}
