/*
Date:		9 Nov 2007
Purpose:	To cause the "Email Agent" links to popup in a new window rather than redirect the current page

Useage:		just include the *.js file

*/


Event.observe(window, 'load', initEmailAgent);
function initEmailAgent(event) {
	var links = $$("a");
	
	links.each(function(link) {
		var href = link.getAttribute("href");
		
		if ((href.indexOf("contact-agent-via-email.asp") != -1)||(href.indexOf("contact-conjunctagent-via-email.asp") != -1)) {
			Event.observe(link, 'click', popupEmailAgent);
		}
	})
}

function popupEmailAgent(event) {
	Event.stop(event);
	
	var targ = Event.element(event);
	
	var property_id = String($("pid").innerHTML).replace("Prop ID: ", "");
	showContactEmail(1, null, null, targ.getAttribute('href'));
}
