// $Id: popup_image.js,v 1.4.2.1 2006/09/13 14:03:29 max Exp $
function open_email_notice(e) {
	var box = document.getElementById('box_emailnotice');
	var box_x = box.offsetLeft + box.offsetWidth;
	var box_y = box.offsetTop + box.offsetHeight;

	box.style.display='block';
}

function close_email_notice() {
	var box = document.getElementById('box_emailnotice');
	box.style.display = 'none';
}

function send_email_notice(pid) {
	var box = document.getElementById('box_emailnotice');
	var fname = document.getElementById('sender_name');
	var femail = document.getElementById('sender_email');
	var remail = document.getElementById('recipient_email');
	if (fname.value == ''){
		alert('Please input your name.');
		fname.focus();
		return;
	}
	if(!checkEmailAddress(femail,'Y')) {
		femail.focus();
		return;
	}
	if (!checkEmailAddress(remail,'Y')) {
		remail.focus();
		return;
	}
	var callback = {
		success: function (o) {
			if(o.responseText !== undefined){  
				alert('Success to send email.');
				box.style.display = 'none';
			}
		},

		failure: function (o) {
			alert('Error to send email.\nPlease try again.');
		}
	};
	var con = YAHOO.util.Connect.asyncRequest('GET','/exe/mail2friend.php?productid='+pid+'&fname='+fname.value+'&femail='+femail.value+'&remail='+remail.value, callback);
}
