var newwindow = Array();

function popUp(URL, width, height) {
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	newwindow[width+'_'+height] = window.open(URL, width+'_'+height, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);
	if (window.focus) {newwindow[width+'_'+height].focus();}
}

function fill_check(what,message) {
	var str = document.getElementById(what).value;
	str = str.replace(/^\s*|\s*$/g,"");
	if (str=='') {
		alert(message);
		return false;
	}
	return true;
}

function password_check(message,action) {
	var strname = document.getElementById('user_name').value;
	var strpass = document.getElementById('password_1').value;
	var strpass2 = document.getElementById('password_2').value;
	strname = strname.replace(/^\s*|\s*$/g,"");
	if (action=='add' && (strpass.length==0 || strpass2.length==0)) {
		alert(message);
		return false;
	}
	if (strpass.length>0 || strpass2.length>0) {
		if (((strpass!=strpass2) || (strpass.length<6)) || (strname==strpass)) {
			alert(message);
			return false;
		}
	}
	else if (action=='sign_up') {
		alert(message);
		return false;
	}
	return true;
}

function only_numbers(what) {
	var checking = document.getElementById(what);
	checking.value=Number(checking.value);
	if (isNaN(checking.value)) {checking.value=''};
	if (checking.value==0) {checking.value=''};
}
