$(document).ready(function() {
function loadfeature(obj_name, data){
	var i = 1
	var loclang = 'english';
	var locurl = 'real-estate-portfolio-and-available-space/property-availabilities';
	var imgView = '<img src="http://www.btbreit.com/files/enview.gif" alt="View details">';
	if ($('html')[0].lang=='fr-FR'){
		loclang = 'francais';
		locurl = 'fr/portefeuille-immobilier-et-espaces-disponibles/espaces-disponibles';
		imgView = '<img src="http://www.btbreit.com/files/frview.gif" alt="Afficher les détails">';
	}
	$.each(data, function(val, text) {
			$('#home-featured-box'+i).children('.featured-image').append('<a href="http://www.btbreit.com/'+locurl+'/?lt=2&page=www.espacelistings.com/details_'+text.name+'.asp&rtn=yes&id='+text.id+'&language='+loclang+'&property_group='+text.name+'&property_group_id='+text.category+'&state_id=64&company_id=244&client=btb_reit&cext=html"><img src="http://www.espacelistings.com/send_binary.asp?Path=D:\\wwwroot\\espacelistings\\photoslive\\'+text.id+'_3.jpg&Width=100&Height=100" ></a>');
			$('#home-featured-box'+i).children('.featured-city').append(text.city);
			$('#home-featured-box'+i).children('.featured-type').append(text.typename);
			$('#home-featured-box'+i).children('.featured-area').append(text.sq_feet);
			$('#home-featured-box'+i).children('.featured-link').append('<a href="http://www.btbreit.com/'+locurl+'/?lt=2&page=www.espacelistings.com/details_'+text.name+'.asp&rtn=yes&id='+text.id+'&language='+loclang+'&property_group='+text.name+'&property_group_id='+text.category+'&state_id=64&company_id=244&client=btb_reit&cext=html">'+imgView+'</a>');
			i++;
			//obj.append('<a href="btbsearchiframe.html?lt=2&page=http://www.espacelistings.com/details_'+text.name+'.asp&rtn=yes&id='+text.id+'&language=english&property_group='+text.name+'&property_group_id='+text.category+'&state_id=64&comany_id=244&client=btb_reit"><img src="http://www.espacelistings.com/send_binary.asp?Path=D:\\wwwroot\\espacelistings\\photoslive\\'+text.id+'.jpg&Width=120&Height=120" ></a>');
			//obj.append(' pos: '+text.pos+' id: '+text.id+' sq_feet: '+text.sq_feet+' city: '+text.city+' osi_code: '+text.osi_code+'<br>');
		});
	};
	loadfeatureddata('#home-featured-box','featuredata',loadfeature);
	function loadfeatureddata(obj_name,action,callback,loadstate){
		$.ajax({
			type: "GET",
			url: "/getbtbdataprox.php",
			//url: "http://localhost/espacelistings/getbtbdataprox.php",
			data: "action="+action+'&lang='+$('html')[0].lang ,
			dataType: "json",
			contentType: "application/json; charset=utf-8",
			success: function(data, textStatus, XMLHttpRequest){
				callback(obj_name,data,loadstate);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				alert(textStatus);
			}
		});
	}
});// JavaScript Document
