// Micro-Dollar function:
function gEBI (el_id) {
	return document.getElementById(el_id);
}

// Simple, set the string:
function get_is_javascript () {
	gEBI('Javascript').value = "enabled";
	gEBI('Javascript_img').src = "system_setup/green.gif";
	gEBI('Javascript_span').innerHTML = "Javascript";
	// Set the other links:
	gEBI('Resolution_span').innerHTML = "<a href=\"faq/resolution/\">Resolution</a>";
	gEBI('Resolution_img').src = "system_setup/red.gif";
	gEBI('Cookies_span').innerHTML = "<a href=\"faq/cookies/\">Cookies</a>";
	gEBI('Cookies_img').src = "system_setup/red.gif";
	gEBI('Flash_span').innerHTML = "<a href=\"faq/flash/\">Flash</a>";
	gEBI('Flash_img').src = "system_setup/red.gif";
}

// Sets the value of the input to the screen res:
function get_screen_resolution () {
	var w = (screen.width) ? screen.width : '???';
	var h = (screen.height) ? screen.height : '???';
	gEBI('Resolution').value = w + " * " + h;
	if (w <= 800 && h <= 600) {
		gEBI('Resolution_img').src = "system_setup/red.gif";
	} else {
		gEBI('Resolution_img').src = "system_setup/green.gif";
		gEBI('Resolution_span').innerHTML = "Resolution";
	}
}

// Cookies enabled?
function get_has_cookies () {
	Set_Cookie('cookie_test', 'it_worked', '', '', '', '' );
	if (Get_Cookie ('cookie_test')) {
		gEBI('Cookies').value = "enabled";
		gEBI('Cookies_img').src = "system_setup/green.gif";
		gEBI('Cookies_span').innerHTML = "Cookies";
	} else {
		gEBI('Cookies').value = "disabled";
	}
}

// Sets the flash version:
function set_flash_version (version) {
	gEBI("Flash").value = version;
	var tmp = version.substring(version.indexOf(" "));
	var major = tmp.substring(1, tmp.indexOf(","));
	if (major >= 8) {
		gEBI('Flash_img').src = "system_setup/green.gif";
		gEBI('Flash_span').innerHTML = "Flash";
	} else {
		alert("Flash Player Error - Please scroll to bottom of the screen to get help");
		gEBI('Flash_img').src = "system_setup/red.gif";
	}
}

// Cookie functions:
function Get_Cookie(name) {
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;
	if ((!start) && (name != document.cookie.substring(0, name.length))) {
		return null;
	}
	if (start == -1) return null;
	var end = document.cookie.indexOf(";", len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
}
function Set_Cookie(name, value, expires, path, domain, secure) {
	var today = new Date();
	today.setTime(today.getTime());
	if (expires) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date(today.getTime() + (expires));
	document.cookie = name + "=" +escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : "");
}
function Delete_Cookie(name, path, domain) {
	if (Get_Cookie(name)) document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
