var editWin;var editted = false;function openEditListing(id, add, el){var surl = 'pages/edit-listings.php?id=' + id;	if(editWin) editWin = null;editWin = new Ext.Window({title:'Editing listing : <span id="titleAddress">' + add + '</span>',layout:'fit',width:737,height:450,closeAction:'hide',modal:true,plain: true,autoLoad: surl,autoScroll: true,scripts:true});editWin.show();}function changeTitle(el){var address = el.value;document.getElementById('titleAddress').innerHTML = address;}function removePhoto(el, id, photo){Ext.Msg.show({title:'Remove Image?',msg: 'Are you sure you would like to remove this image?',buttons: Ext.Msg.YESNO,fn: function(btn, txt) {if(btn == 'yes'){Ext.Ajax.request({url:'pages/update-listings.php?id=' + id + '&photo=' + photo + '&op=removePhoto',method: 'POST',scope:this,callback: function(opts, suss, resp){if(resp.responseText == 'ok'){document.getElementById(el).style.display = 'none';} }})   }},icon: Ext.MessageBox.QUESTION});	}

function getAgentInfo(id)
{
	Ext.get("agentInfo").load({
        url: "pages/agentInfo.php",
        scripts: true,
        params: "id=" + id,
        text: "Loading Foo..."
   });
}

function newAgent()
{
	win = new Ext.Window({
						 title: 'Add a new agent',
						 layout: 'fit',
						 width: 260,
						 height:245,
						 closeAction: 'hide',
						 modal: true,
						 plain: true,
						 autoLoad: 'pages/newAgent.php'
						 
						 }).show();
}
