var links = new Array();
//links["New York"] = new Array("www.google.com", "www.aport.ru");
//links["Arizona"] = new Array("www.rambler.com", "www.aport.ru");
links["Arizona"] = new Array(
				{text:"AZ - Payson - Center Ridge",href:"http://www.centerridgeapts.com/"}, 
				{text:"AZ - Phoenix - Amber Pointe",href:"http:/"},
		{text:"AZ - Phoenix - Crystal Pointe",href:"http://crystalpointeapartments.com/"},
				{text:"AZ - Phoenix - Indigo Pointe",href:"http://www.indigopointeapartments.com"}, 
		{text:"AZ - Phoenix - Pointe del Sol",href:"http://www.pointedelsol.com/"}, 
		{text:"AZ - Eagar - Eagle Cove",href:"http://eaglecoveapartments.com/"},
		{text:"AZ - Timberstone - Show Low",href:"http://www.timberstoneaptsshowlow.com/"});
links["New Mexico"] = new Array(
		{text:"NM - Los Lunas - Ventana Cove",href:"http://www.ventanacove.com/"});
links["Texas"] = new Array(
		{text:"TX - Corpus Christi - Costa Tarragona ",href:"http://www.costatarragonaapts.com/"},
		{text:"TX - Clute - Costa Verde ",href:"http://www.costaverdeapts.com/"},
		{text:"TX - Irving - The Reserve at Las Brisas ",href:"http://www.thereserveatlasbrisas.com/"},
		{text:"TX - San Antonio - Costa Biscaya",href:"http://costabiscaya.com/"},
		{text:"TX - San Antonio - Costa Cadiz",href:"http://costacadizapartments.com/"},
		{text:"TX - San Antonio - Costa Valencia ",href:"http://www.costavalenciaapts.com/"},
		{text:"TX - San Antonio - San Juan Square ",href:"http://www.sanjuansquare.com/"},
		{text:"TX - San Antonio - Costa Mirada",href:"http://www.costamirada.com/"},
		{text:"TX - San Antonio - Costa Almadena",href:"http://www.costaalmadena.com/"},
		{text:"TX - Houston - Commons of Grace",href:"http://commonsofgrace.com/"},
		{text:"TX - Houston - Costa Ibiza",href:"http://www.costaibizaapartments.com"},
		{text:"TX - Houston - Costa Rialto",href:"http://www.costarialto.com"},
		{text:"TX - Houston - Costa Vizcaya",href:"http://www.costavizcaya.com"},
		{text:"TX - Houston - The Gibraltar Senior Apts",href:"http://thegibraltarseniorapts.com"},
		{text:"TX - San Antonio - The Alhambra Senior Apts",href:"http://thealhambraseniorapts.com/"});
links["North Carolina"] = new Array(
		{text:"NC - Durham - Falls Pointe",href:"http://fallspointeapartments.com/"},
		{text:"NC - Durham - Magnolia Pointe",href:"http://www.magnoliapointeaptsdurham.com/"},
		{text:"NC - Winnabow - Egret Pointe",href:"http://egretpointeapts.com/"},
		{text:"NC - Burgaw - Cooper's Pointe ",href:"http://www.cooperspointeapartments.com/"},
		{text:"NC - Raleigh - Gateway Park",href:"http://gatewayparknrp.com/"},
		{text:"NC - Shallotte - Cardinal Pointe ",href:"http://cardinalpointeapartments.com/"},
		{text:"NC - Wilmington - Vineyard Pointe",href:"http://vineyardpointeapartments.com/"},
		{text:"NC - Leland - Egret Pointe",href:"http://egretpointeapts.com/"},
		{text:"NC - Rocky Mount - Wood Hawk",href:"http://www.woodhawkseniorapartments.com/"});
links["Indiana"] = new Array(
		{text:"IN - Fort Wayne - Preston Pointe at Inverness",href:"http://prestonpointeinverness.com/"});
links["Ohio"] = new Array(
				{text:"OH - Bowling Green - Chauncey Pointe",href:"http://www.chaunceypointe.com"},
				{text:"OH - Canton - Wilson Pointe",href:"http://www.wilsonpointeseniorapts.com/"},
		{text:"OH - Cleveland - Cornerstone",href:"http://www.cornerstoneseniorapts.com/"},
		{text:"OH - Columbus - Preston Pointe at Shannon Glen",href:"http://prestonpointeshannonglen.com/"},
		{text:"OH - North Olmsted - Enclave at Kennedy Ridge",href:"http://enclavekennedyridge.com/"},
		{text:"OH - Kent - Four Seasons ",href:"http://www.fourseasonsatkent.com/"},
		{text:"OH - Toledo - The Waterford Apartments",href:"http://www.waterfordseniorapartments.com/"},
		{text:"OH - Ashtabula - Willowbrook",href:"http://www.willowbrookseniorapartments.com/"},
		{text:"OH - Norwalk - Bennett Pointe",href:"http://www.bennettpointeapartments.com/"},
		{text:"OH - Dayton - Ecumenical Homes of Dayton",href:"http://www.nrpgroup.com/ecumenical.html"},
		{text:"OH - Lorain - Lorain Homes ",href:"http://www.nrpgroup.com/lorain.html"});
links["Michigan"] = new Array(		
		{text:"MI - Brownstown Twp - Preston Pointe at Brownstown",href:"http://prestonpointebrownstown.com/"});
links["Virginia"] = new Array(
		{text:"VA - Chester - Grand Oaks",href:"http://grandoaksapartments.com/"},
		{text:"VA - Chester - Grand Oaks Senior Apartments",href:"http://www.grandoaksseniorapts.com/"});
var dialog;
var _x,_y;
function getElementLeft(Elem) {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
}
function getElementTop(Elem) {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
}
	
function popdown()
{
	if (!dialog) {return}
	var left=parseInt(dialog.style.left.substring(0,(dialog.style.left.length-2)));
	var top=parseInt(dialog.style.top.substring(0,(dialog.style.top.length-2)));
	var width=parseInt(dialog.style.width.substring(0,(dialog.style.width.length-2)));
	var height=parseInt(dialog.style.height.substring(0,(dialog.style.height.length-2)));
	if ((_x<=left)
		 ||(_x>(left+width))
		 ||(_y<=top)
		 ||(_y>(top+height))
		)
	{
	dialog.style.visibility="hidden";
//	alert(dialog.height);
	}
	
}

function popup(state, element){
	var lh=links[state].length*14+48;
	dialog.style.visibility="visible";
	dialog.style.width="300px";
	xx=_x-10;yy=_y-10;
	dialog.style.top=yy+"px";
	dialog.style.left=xx+"px";
	document.getElementById("popup_header").innerHTML = state;
	var body = document.getElementById("popup_body");
    body.innerHTML="";    
	for(i=0; i<links[state].length; i++){
		body.innerHTML += "<a target='_blank' href='" + links[state][i].href + "'>" + links[state][i].text + "</a><br>";
    }
}

function mousePageXY(e)
{
  var x = 0, y = 0;

  if (!e) {e = window.event;}

  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
 popdown();
  return {"x":x, "y":y};
}

function init(){
	dialog=document.getElementById("message");	
}

function keyHandler(e) { 
		var kC  = (window.event) ?    // MSIE or Firefox?
                 event.keyCode : e.keyCode;
      	var Esc = (window.event) ?   
                27 : e.DOM_VK_ESCAPE // MSIE : Firefox
      	if(kC==Esc)
        	dialog.style.visibility="hidden";
}
document.onmousemove = function(e){
	var mCur = mousePageXY(e); 
	_x=mCur.x; _y=mCur.y; 	
	window.status="x="+_x+"  y="+_y;
};
document.onkeypress = keyHandler;