    var div;
    var loader;

    var handleSuccess = function(o){

	    if(o.responseText != undefined){
		    /*div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
		    div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
		    div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
		    div.innerHTML += "<li>Server response: " + o.responseText + "</li>";*/
		    try
		    {
		        var location = YAHOO.lang.JSON.parse(o.responseText);
		        loader.style.display = "none";
                div.style.display = "block";
		        div.innerHTML = location.Content;
		        createCookie("camden-property",location.Content,14);
		    }
		    catch (Exception)
		    {
		        loader.style.display = "none";
                div.style.display = "block";
		    }
		    
	    }
    }

    var handleFailure = function(o){

	    if(o.responseText != undefined){
		    var error = "Transaction id: " + o.tId + "\n";
		    error += "HTTP status: " + o.status + "\n";
		    error += "Status code message: " + o.statusText + "\n";
		    
		    // turn off loader to display default content
		    loader.style.display = "none";
            div.style.display = "block";
	    }
    }

    var callback =
    {
      success:handleSuccess,
      failure:handleFailure
      //argument: { foo:"foo", bar:"bar" }
    };

    var sUrl = "utilities/geolocator.ashx";
    
    function makeRequest(){
        loader = document.getElementById('featured-property-content-loader');
        div = document.getElementById('featured-property-content');
        loader.style.display = "block";
        div.style.display = "none";
        
        var cookie = readCookie('camden-property')
        if (cookie)
        {
	        loader.style.display = "none";
            div.style.display = "block";
		    div.innerHTML = cookie;    
        }
        else
        {
            var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
        }
    
    }
    function createCookie(name,value,days) 
    {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
    }
    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;
}

function toggleExpandFlash() {
    if ($("#expand-unplugged").hasClass("expanded"))
        $("#expand-unplugged").removeClass("expanded");
    else
        $("#expand-unplugged").addClass("expanded");
}

