function accountSelector(isLoggedIn){
	//alert(document.cookie);
	if(document.cookie.search("areaValue") != -1){
		document.getElementById("accountType").style.display = "none";
		var newArea = getCookie("areaValue");
		document.getElementById("selectZone").value = newArea;
	}else{
		document.getElementById("accountType").style.display = "block";
	}
	
	if(isLoggedIn == 0){
		document.getElementById("menuLoggedOut").style.display = "block";
		document.getElementById("ioMenuSignup").style.display = "block";
	}else if(isLoggedIn == 1){
		var secureCheck  = new Array();
		secureCheck = document.URL.split("/");
		if(secureCheck[2].search("secure1") != -1){
			document.getElementById("menuInnerOrbit").style.display = "block";
		}else if(secureCheck[2].search("secure2") != -1){
			document.getElementById("menuInnerOrbit").style.display = "block";
		}else if(secureCheck[2].search("secure3") != -1){
			document.getElementById("menuTraining").style.display = "block";
		}
	}
	addFooter();
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
} 

var http_request_footer = false;

function addFooter() {
	//alert(document.catalog.catID.options[document.catalog.catID.selectedIndex].value);
	var url="";
	http_request_footer = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request_footer = new XMLHttpRequest();
		if (http_request_footer.overrideMimeType) {
			http_request_footer.overrideMimeType('text/xml');
			// See note below about this line
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request_footer = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) { 
			http_request_footer = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	if (!http_request_footer) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	url = "/actorbit/footerMenus";
	http_request_footer.onreadystatechange = addFooterItems;
	http_request_footer.open('GET', url, true);
	http_request_footer.send(null);
	return false;
}
function addFooterItems() {	
	if (http_request_footer.readyState == 4) {
		if (http_request_footer.status == 200) {
		//alert( http_request_community.responseText);
			if(document.getElementById("footerwrap") != null){
				document.getElementById("footerwrap").innerHTML= http_request_footer.responseText;
			}else{
				alert('neighborhood is null');
			}
		} else {
			alert('There was a problem with the request.');
		}
	}
}

