
  google.load("maps", "2.x");   
  // Call this function when the page has been loaded 
 function initialize() {  
  var map = new google.maps.Map2(document.getElementById("map"));  
  map.setCenter(new google.maps.LatLng(40.694604,-73.834983), 9);


		//var map = new GMap2(document.getElementById("map"));
      //  map.setCenter(new GLatLng(40.694604, -73.834983), 13);

  }
  
  google.setOnLoadCallback(initialize);





	var ajax = new sack();
	var currentZipID=false;
	var currentRadiusID=false;
	var currentTextID=false;
	function getZipData()
	{
		
		var zip = document.getElementById('zip').value.replace(/[^0-9]/g,'');
		var radius = document.getElementById('radius').value.replace(/[^0-9]/g,'');
		var stext = document.getElementById('stext').value;
		
		if((zip.length==5 && (zip!=currentZipID || radius!=currentRadiusID) && radius.length>=1 && radius.length<=2) || (stext.length >= 4 && radius!=currentTextID)){
			document.getElementById("wait").style.visibility='visible';
			currentZipID = zip;
			currentRadiusID = radius;
			currentTextID = stext;
			
			ajax.requestFile = 'http://www.ehouseny.com/getZip.php?zip='+zip+'&radius='+radius+'&stext='+stext;	// Specifying which file to get
			ajax.onCompletion = showZipData;	// Specify function that will be executed after file has been found
			ajax.runAJAX();		// Execute AJAX function			
		}
		
	}
	
//	var currentStateID=false;
/*	function getStateData()
	{
		
		var state = document.getElementById('state').value;
		if(state!=currentStateID){
			document.getElementById("wait").style.visibility='visible';
			currentStateID = state;
		
			ajax.requestFile = 'http://www.ehouseny.com/getState.php?state='+state;	// Specifying which file to get
			ajax.onCompletion = showStateData;	// Specify function that will be executed after file has been found
			ajax.runAJAX();		// Execute AJAX function			
		}
		
	}
	
*/
	function showZipData()
	{
		document.getElementById("wait").style.visibility='hidden';
		eval(ajax.response);
		
	}
	
/*	
	function showStateData()
	{
		document.getElementById("wait").style.visibility='hidden';
		document.getElementById("zip").value='';
		document.getElementById("radius").value='20';
		eval(ajax.response);
		
	}
	
	*/
	function initFormEvents()
	{
		document.getElementById('submitbutton').onclick  = getZipData;
	//	document.getElementById('state').onchange  = getStateData;
		document.getElementById('zip').focus();
		
	}
	






/*



	var ajax2 = new sack();






var articleListObj;
var activeArticle = false;
var clickedArticle = false;
var contentObj	// Reference to article content <div>

function mouseoverArticle()	// Highlight article
{
	if(this==clickedArticle)return;
	if(activeArticle && activeArticle!=this){
		if(activeArticle==clickedArticle)
			activeArticle.className='articleClick';
		else
			activeArticle.className='';
		
	}
	this.className='articleMouseOver';
	activeArticle = this;	// Storing reference to this article
}



function mouseoutArticle()	// Highlight article
{
	if(this==clickedArticle)return;
	if(activeArticle && activeArticle!=this){
		if(activeArticle==clickedArticle)
			activeArticle.className='articleClick';
		else
			activeArticle.className='';
		
	}
	this.className='';
	activeArticle = this;	// Storing reference to this article
}

function showContent()	// Displaying content in the content <div>
{
	contentObj.innerHTML = ajax2.response;	// ajax.response is a variable that contains the content of the external file	
}

function showWaitMessage()
{
	contentObj.innerHTML = '<img src="http://www.casinosgamblingusa.com/img/wait.gif" alt="wait" />';
}
function getAjaxFile(fileName)
{
	ajax2.requestFile = fileName;	// Specifying which file to get
	ajax2.onCompletion = showContent;	// Specify function that will be executed after file has been found
	ajax2.onLoading = showWaitMessage;	// Action when AJAX is loading the file
	ajax2.runAJAX();		// Execute AJAX function	
}

function selectArticle()	// User have clicked on an article
{
	getAjaxFile('http://www.casinosgamblingusa.com/'+this.id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	if(clickedArticle && clickedArticle!=this)clickedArticle.className='';
	this.className='articleClick';
	clickedArticle = this;
}


function initAjaxDemo()
{
	articleListObj = document.getElementById('articleList');
	var articles = articleListObj.getElementsByTagName('LI');
	for(var no=0;no<articles.length;no++){
		articles[no].onmouseover = mouseoverArticle;
		articles[no].onmouseout = mouseoutArticle;
		articles[no].onclick = selectArticle;
	}	
	
	contentObj = document.getElementById('contentContainer');

	getAjaxFile('http://www.casinosgamblingusa.com/article1.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	document.getElementById('article1').className='articleClick';
	clickedArticle = document.getElementById('article1');
}

*/