function SetCookie (name,value) {
	var expdate = new Date ();
	expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000)); // eh, give'm a year
	document.cookie = name + "=" + escape (value) +
		"; expires=" + expdate.toGMTString() + 
		"; path=/";
} // setcookie

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
} // getcookieval

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	} // while
	return null;
} // getcookie




// ajax helpers =========================================

	// AJAX helpers
	var xmlHttp;
	var oTrow;
	var rIndex;
	
	var httpPath = "https://www.landfx.com/";

function xmlReady() {
	return (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete");
} // xmlReady

function NewXmlHttpObject() {
	var xmlHttp = null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	} // try
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} // try
		catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} // catch
	} // catch
	return xmlHttp;
} // newxmlhttpobject

function randGetParam() { // fucking IE bug, need to send unique GET request
	var randval = Math.random(); // random between 0 and 1
	randval = randval * 1000000000;
	randval = Math.floor(randval); // now an integer
	randval = randval + ""; // to a string
	return "&token=" + randval; // done
} // randGetParam
// =====================================================

