// initialize settings
var mostpopnavarray = new Array;

mostpopnavarray['mostpopnav1'] = 0;
mostpopnavarray['mostpopnav2'] = 2;
mostpopnavarray['mostpopnav3'] = 0;

//function for swapping colors on hover
function popnavhov(thisnav) {
	if (mostpopnavarray[thisnav] != 2) {
		document.getElementById(thisnav).className = "mostpopnavh";
		mostpopnavarray[thisnav] = 1;
	}
}

//function for resetting states on click
function resetpopnav() {
	if (mostpopnavarray['mostpopnav1'] == 2) {
	document.getElementById('mostpopnav1').className = "mostpopnav";
	mostpopnavarray['mostpopnav1'] = 0;
	}
		if (mostpopnavarray['mostpopnav2'] == 2) {
		document.getElementById('mostpopnav2').className = "mostpopnav";
		mostpopnavarray['mostpopnav2'] = 0;
		}
			if (mostpopnavarray['mostpopnav3'] == 2) {
			document.getElementById('mostpopnav3').className = "mostpopnav";
			mostpopnavarray['mostpopnav3'] = 0;
			}
}
function resetpopnavroll(thisnav) {
	if (mostpopnavarray['mostpopnav1'] == 1) {
	document.getElementById('mostpopnav1').className = "mostpopnav";
	mostpopnavarray['mostpopnav1'] = 0;
	}
		if (mostpopnavarray['mostpopnav2'] == 1) {
		document.getElementById('mostpopnav2').className = "mostpopnav";
		mostpopnavarray['mostpopnav2'] = 0;
		}
			if (mostpopnavarray['mostpopnav3'] == 1) {
			document.getElementById('mostpopnav3').className = "mostpopnav";
			mostpopnavarray['mostpopnav3'] = 0;
			}
}


//function for swapping colors on click
function popnavclick(thisnav, init) {
if (!init) {
document.getElementById('mostpopbox').innerHTML = "<DIV align='center'><IMG SRC='LoadingAnim.gif' border='0'></DIV>";
}
	resetpopnav();
	if (!init) {
		document.getElementById(thisnav).className = "mostpopnavd";
		}
		mostpopnavarray[thisnav] = 2;
}




///////////////// AJAX FROM HERE ON
// runs when link is clicked
activestate = "0";
function ajax_request(rurl,rtarget) {
if (activestate != "1") {
activestate = "1";
	var url = rurl; 
	target = rtarget; 
	http.open("GET", url, true); 
	http.onreadystatechange = handleHttpResponse; 
	http.send(null);
	}
}
function handleHttpResponse() { 
	if (http.readyState == 4) { 
		document.getElementById(target).innerHTML = http.responseText;
		activestate = "0";
	} 
}



//generic ajax function
function getHTTPObject() {
var httpRequest;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}


  return httpRequest;
}

var http = getHTTPObject(); //create the HTTP Object

