var secure_domain = "https://secure1.ilisys.com.au/aujs/";
var secure_cookie_domain = "secure1.ilisys.com.au";
var public_domain = "http://www.aujs.com.au/";

function adjust_navmenu()
{
	check_JS_compatibility();
	
	if (adjust_navmenu.arguments.length > 0)
		check_cookies_enabled();
	
	var menu_style = "<style type=\"text/css\">\n" + 
		"ul#navigation li a {\n" +
		"display: block;\n" +
		"padding: 6px 8px 6px 8px;\n" +
		"background-image: url(" + secure_domain + "images/global/nav/bg_item.gif);\n" +
		"background-position: bottom;\n" +
		"background-repeat: repeat-x;\n" +
		"border-right: 1px solid #cccccc;\n" +
		"color: #333333;\n" +
		"font-weight: bold;\n" +
		"text-decoration: none;\n";
	if (navigator.appName.indexOf("Internet Explorer") == -1)
	{
		menu_style += "height: 18px;\n";
	}
	menu_style += "}\n" + "</style>\n";
	//document.write(menu_style);

	if (navigator.appName.indexOf("Internet Explorer") != -1)
	{
		menu_style = "<style type=\"text/css\">\n" + 
			".scrollbars_colour_scheme {\n" + 
			"scrollbar-3dlight-color: #FFFFFF;\n" +
			"scrollbar-arrow-color: #303047;\n" +
			"scrollbar-base-color: #E8F1F8;\n" +
			"scrollbar-darkshadow-color: #E8F1F8;\n" +
			"scrollbar-face-color: #C4DBEE;\n" +
			"scrollbar-highlight-color: #306898;\n" +
			"scrollbar-shadow-color: #306898;\n" +
			"scrollbar-track-color: #E8F1F8;}\n" + 
			"</style>\n";
	}
	else
	{
		menu_style = "<style type=\"text/css\">\n" + 
			".scrollbars_colour_scheme {}\n" + 
			"</style>\n";
	}
	document.write(menu_style);
}

function check_cookies_enabled()
{
  if (window.XMLHttpRequest)
    var objHttpRequest = new XMLHttpRequest();
  else if(window.ActiveXObject)
    var objHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  
  if (objHttpRequest)
  {
    objHttpRequest.onreadystatechange = function()
    {
      if (objHttpRequest.readyState == 4)
      {
				if (document.cookie.indexOf("dummy_cookie") == -1)
				{
					document.location.replace(public_domain + "includes/errors/cookies_not_enabled.php");
				}
			}
		}
		if (document.location.protocol.indexOf("https") >= 0)
			objHttpRequest.open("POST", secure_domain + "includes/probe_cookie_support.php", true);
		else
   		objHttpRequest.open("POST", public_domain + "includes/probe_cookie_support.php", true);
		objHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    objHttpRequest.send("action=probe_cookie_support");
	}
}

function check_JS_compatibility()
{
	var compatibility = false;
	
	// Test AJAX compatibility
	if (window.XMLHttpRequest)
		compatibility = true;
	else if(window.ActiveXObject)
		compatibility = true;
	else
		compatibility = false;
	
	if (compatibility)
	{
	// Test HTML document DOM methods
	if ((document.getElementById) && (document.getElementsByTagName) && (document.createElement))
		compatibility = true;
	else
		compatibility = false;
	}
	
	if (compatibility)
	{
		// Test XML document DOM methods
		if (window.ActiveXObject)
			compatibility = true;
		else if (document.implementation.createDocument)
			compatibility = true;
		else
			compatibility = false;
	}
	
	if (!compatibility)
	{
		document.location.replace(public_domain + "includes/errors/not_compatible.php");
	}
}