// snooping around, are we?

var sx=500, sy=400;

function save_event(e) {
	sx = e.screenX-100;
	sy = e.screenY-40;
}

function buy_europe() {
	newwin = open("/buy_europe.html", "buy_europe", "width=200,height=100,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"+id+".html", "profile", "width=573,height=415,directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no");
	newwin.creator = self;
}

function changer(url) {
	if(document.images)
		document.images['changee'].src = "/images/screens/160-"+url+".gif";
}

function framer(url) {
	if(document.images) {
		document.images['framee'].src = "/images/screens/240-"+url+".gif";
		document.images['caption'].src = "/images/screens/cap-"+url+".gif";
	}
} 

function login_ok() {
	location = "index.xsp";
	myprofile();
}

function profile_change(what) {
	if(what == "avatar")
		height = 320;
	else
		height = 230;
	changewin = open("/worldranking/profile_change.xsp?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"+level+".html"); }
function championship(rtop) { openback("championship.html"); }
function challenge(rtop) { openback("challenge.html"); }
function myprofile() {
	var cookiefilter=/id=([0-9]+)/;
	if(cookiefilter.test(document.cookie)) {
		profile(RegExp.$1);
	} else {
		location = "/worldranking/login.xsp";
	}
}
function logoutlink() {
	var cookiefilter=/id=([0-9]+)/;
	if(cookiefilter.test(document.cookie))  {
		document.write('<span class="i2netcode">');
		document.write('<a href="/worldranking/logout.xsp">logout</a>');
		document.write('</span>');
	}
}
function profilebutton() {
	var cookiefilter=/id=([0-9]+)/;
	var image="login";
	if(cookiefilter.test(document.cookie)) 
		image="myprofile";
	
	document.write('<img src="/images/iridion-top-'+image+'.gif" width="90" height="68" border="0" alt="" usemap="#iridionmap2">');
}

function validatecode() {
	// you don't think I'm that stupid?
	var codefilter = /([0-9a-f]{4}[- ]?){4}/i;
	if(!codefilter.test(document.netcode.code.value)) {
		window.alert("The entered code is not a valid i2-netcode!");
		return false;
	}
	return true;
}
// you found something interesting? good for you...