function launch_window(response, myLightWindow) {
	myLightWindow.activateWindow({
		href: 'includes/easter_eggs/eggs_result.php?response='+response,
		title: 'You\'ve found an egg!',
		width: 400,
		height: 142
	});
}

function egg_found(id, myLightWindow){
	var req = createXMLHttpRequest();

	req.open('GET', 'includes/easter_eggs/eggs.php?id='+id, true);
	req.onreadystatechange = function() {
		if (req.readyState == 4) { 
			launch_window(req.responseText, myLightWindow);
		}
	};
	
	req.send(null);
}

function createXMLHttpRequest(){
	var types = ['Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
	for (var i = 0; i < types.length; i++) { // if MSIE give him activeX
		try { return new ActiveXObject(types[i]); } catch(e) {}
	}
	try { return new XMLHttpRequest(); } catch(e) {} // if not MSIE - usual XHR
	return false; // XMLHttpRequest is not supported by browser
}