/*	Set path to listing images.  I know this set up will need to be 
 *  changed once the image listing functionality gets implemented.  It 
 *  works for testing purposes.  Also, I'd rather build another function
 *  that preloads the larger images from a body onload.  Ask me.
 */
var image_path = web_root + "/images/listings/";

function updateImageViewer(image, image_lg, name) {
	var curr_image = document.getElementById('curr_image');
	var enlarge_link = document.getElementById('enlarge_link');
	var image_title = document.getElementById('image_title');
	
	if(image) {
			curr_image.src = image_path + image; 
			image_title.innerHTML = name;
			enlarge_link.innerHTML = "&lsaquo\; <a href=\"#\" onclick=\"enlargePhoto('"+image_lg+"'); return false;\">Enlarge Photo</a> &rsaquo\;";
		}
	else{
			curr_image.src = "";
			image_title.innerHTML = "Image not found.";
			enlarge_link.innerHTML = "";
		}
}


function enlargePhoto(image) 
{ 
	window.open(image_path + image,'large_view','width=560,height=450,resizable=yes,status=no,menubar=no,scrollbars=yes,directories=no,location=no,left=40,top=40,screenX=100,screenY=100'); 
} 


function scheduleShowing(listing_ID) 
{ 
	window.open(web_root + '/schedule_showing.php?listing_ID='+listing_ID,'schedule_showing','width=500,height=380,resizable=yes,status=no,menubar=no,scrollbars=yes,directories=no,location=no,left=40,top=40,screenX=100,screenY=100'); 
} 


function emailListing(listing_ID) 
{ 
	window.open(web_root + '/email_listing.php?listing_ID='+listing_ID,'schedule_showing','width=500,height=380,resizable=yes,status=no,menubar=no,scrollbars=yes,directories=no,location=no,left=40,top=40,screenX=100,screenY=100'); 
}
