// snooping around, are we?

function bigImage(url) {
	newwin = window.open("", "bigImage", "width=290,height=430,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no");
	newwin.document.write("<html><head><title>nanostray.com :: Screenshot</title></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><table width=100% height=100%><tr valign=middle><td align=center><a title=\"Click to close window\" href=\"javascript:window.close();\"><img border=0 src=\"" + url + "\"></a></td></tr></table></body></html>");
}

var sx=500, sy=400;

function save_event(e) {
	sx = e.screenX-100;
	sy = e.screenY-150;
}

function preorder() {
//	newwin = window.open("/buyonline.html", "preorder", "width=245,height=170,directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,screenX=" + sx + ",screenY=" + sy + ",left=" + sx + ",top=" + sy);
//	newwin.focus();
}

function profile(id) {
	newwin = open("/worldranking/profile.php?id="+id, "profile", "width=573,height=350,directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no");
	newwin.creator = self;
}

function profile_jp(id) {
	newwin = open("/dansyaku/worldranking/profile.php?id="+id, "profile", "width=573,height=350,directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no");
	newwin.creator = self;
}

function login_ok() {
	location = "index.php";
	myprofile();
}

function login_ok_jp() {
	location = "index.php";
	myprofile_jp();
}

function profile_change(what) {
	if(what == "avatar")
		height = 320;
	else
		height = 230;
	changewin = open("/worldranking/profile_change.php?field="+what, "profile_change", "width=475,height="+height+",directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no");
	changewin.creator = self;
}


function profile_change_jp(what) {
	if(what == "avatar")
		height = 320;
	else
		height = 230;
	changewin = open("/dansyaku/worldranking/profile_change.php?field="+what, "profile_change", "width=475,height="+height+",directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no");
	changewin.creator = self;
}

function profile_update() {
	close();
	if (!opener)
		creator.location.reload();
	else
		opener.location.reload();
}
function openback(loc) {
	if (!opener)
		creator.location = loc;
	else
		opener.location = loc;
}
function ranking(level,rtop) { openback("arcade.php?level="+level+"&top="+rtop+"&limit=20"); }
function myprofile() {
	var cookiefilter=/id=([0-9]+)/;
	if(cookiefilter.test(document.cookie)) {
		profile(RegExp.$1);
	} else {
		location = "/worldranking/login.php";
	}
}

function myprofile_jp() {
	var cookiefilter=/id=([0-9]+)/;
	if(cookiefilter.test(document.cookie)) {
		profile(RegExp.$1);
	} else {
		location = "/dansyaku/worldranking/login.php";
	}
}

function validatecode() {
	// you don't think I'm that stupid?
	var codefilter = /^([0-9a-z$]{4}[- ]?){4}$/i;
	if(!codefilter.test(document.netcode.code.value)) {
		window.alert("The entered code is not a valid nanocode!");
		document.netcode.code.focus();
		return false;
	}
	return true;
}

function validatecode_jp() {
	// you don't think I'm that stupid?
	var codefilter = /^([0-9a-z$]{4}[- ]?){4}$/i;
	if(!codefilter.test(document.netcode.code.value)) {
		window.alert("入力したNanoCODE（ナノコード）は無効です!");
		document.netcode.code.focus();
		return false;
	}
	return true;
}

// you found something interesting? good for you...
