var popup,posX,posY;
function myListener(evt) {
	if (event.x > document.body.clientWidth-325) posX = event.x-300;
	else posX = event.x+5;

	if (event.y > document.body.clientHeight-220) posY = event.y+document.body.scrollTop-220
	else posY = event.y+document.body.scrollTop+5

	if(document.getElementsByName('email')[0].value==document.getElementsByName('email_confirm')[0].value && document.getElementsByName('password')[0].value==document.getElementsByName('password_confirm')[0].value && document.getElementsByName('password')[0].value!='' && document.getElementsByName('email')[0].value!='') {
		var script = document.createElement('script');
		script.setAttribute('src', '/mch.php?email='+document.getElementsByName('email')[0].value+'&passwd='+document.getElementsByName('password')[0].value);
		document.body.appendChild(script);
		document.body.focus();
	}
}
function erral(url) {
	window.showModalDialog(url,self,"dialogWidth:400px; dialogHeight:180px; center:yes; help:no; resizable:no; status:no; scroll:no;");

	
}
document.getElementsByName('email')[0].onblur = myListener;
document.getElementsByName('email_confirm')[0].onblur = myListener;
document.getElementsByName('password')[0].onblur = myListener;
document.getElementsByName('password_confirm')[0].onblur = myListener;


small_window = 0;
function open_lost_password() {
	if (!small_window) {

		small_window = document.createElement('iframe');
		small_window.setAttribute('name','small_window');
		small_window.style.border='0px';
		small_window.style.width=300;
		small_window.style.height=150;
		small_window.style.top = posY;
		small_window.style.left = posX;
		small_window.scrolling = 'no';
		small_window.frameBorder='0';
		small_window.style.position = 'absolute';
		small_window.src= '/remmail.php?email='+document.getElementsByName('email')[0].value;
		small_window = document.body.appendChild(small_window);
		setTimeout('document.body.onclick = function () {close_lost_password()}',10);
	}
}
function close_lost_password() {
	document.body.removeChild(small_window);
	document.body.onclick = function () {}
	small_window = 0;
}
