// email_a_friend.js -- email a cottage to a friend
// written by jon burney (jon@opticalfx.co.uk)
//
//


function email_a_friend(cottage_id) {

	var base_path, window_width, window_height, window_attribs, window_handle, window_url;
	
	// the path to the email a friend script
	base_path = "http://www.internet-cottages.com/PHP_folder/email_a_friend/email_a_friend.php";
	
	// find out if the function was called with a cottage id if it was then 
	// we pass the id to the email script otherwise we pass the URL
	if (email_a_friend.arguments.length == 1) {
		arguments = "?id=" + cottage_id;
	} else {
		arguments = "?url=" + document.location;
	}
	
	// set the window width and height
	window_width = 400;
	window_height = 540;
	
	// set the complete window path to the script (including arguments)
	window_url = base_path + arguments;
	
	// set the attributes of the window
	window_attribs = "width=" + window_width + ",height=" + window_height + ",toolbar=0,menubar=0,scrollbars=0" + 
					",resizable=0,location=0,directories=0,status=0";
				
	// open the window and set its focus	
	window_handle = window.open(window_url,"email_a_friend",window_attribs);
	window_handle.focus();
}