function getPopupMenu(nCatID)  {
	var sMenu = $.ajax({ 
  	url: "/GetPopupMenu.asp?CatID=" + nCatID, 
  	async: false,
	cache: true 
 	}).responseText;

	document.getElementById("MenuItem").innerHTML = sMenu;

	if (nCatID == 1)
		{
		nPositionLeft = -30;
		}
	else if (nCatID == 2)
		{
		nPositionLeft = 50;
		}
	else if (nCatID == 3)
		{
		nPositionLeft = 140;
		}
	else if (nCatID == 4)
		{
		nPositionLeft = 210;
		}
	else if (nCatID == 5)
		{
		nPositionLeft = 310;
		}
	else if (nCatID == 6)
		{
		nPositionLeft = 410;
		}
	else if (nCatID == 7)
		{
		nPositionLeft = 520;
		}
	else if (nCatID == 8)
		{
		nPositionLeft = 585;
		}
	else if (nCatID == 9)
		{
		nPositionLeft = 640;
		}
	else
		{
		nPositionLeft = 600;
		}

	document.getElementById("MenuBox").style.left = nPositionLeft + "px";
	document.getElementById("MenuBox").style.display = "block";
}


//===========================================AJAX=======================================================
// from http://www.devarticles.com/c/a/JavaScript/JavaScript-Remote-Scripting-Reading-Data-From-the-Server/1/

// initialize XMLHttpRequest object
var xmlobj=null;
// initialize global variables
var data=new Array();
var i=0;

// send http request
function sendRequest(doc){
    // check for existing requests
    if(xmlobj!=null&&xmlobj.readyState!=0&&xmlobj.readyState!=4){
        xmlobj.abort();
    }
    try{
        // instantiate object for Firefox, Nestcape, etc.
        xmlobj=new XMLHttpRequest();
    }
    catch(e){
        try{
            // instantiate object for Internet Explorer
            xmlobj=new ActiveXObject('Microsoft.XMLHTTP');
        }
        catch(e){
            // Ajax is not supported by the browser
            xmlobj=null;
            return false;
        }
    }
    // assign state handler
    xmlobj.onreadystatechange=stateChecker;
    // open socket connection
    xmlobj.open('GET',doc,true);
    // send request
    xmlobj.send(null);
}

// check request status
function stateChecker(){
    // if request is completed
    if(xmlobj.readyState==4){
        // if status == 200 display text file
        if(xmlobj.status==200){
		data=xmlobj.responseText;
		//document.write(data);
		//document.getElementById("leftNav").innerHTML = data;
		document.getElementById("MenuItem").innerHTML = data;
        }
        else{
            alert('Failed to get response :'+ xmlobj.statusText);
        }
    }
}


//==============================MENU POSITION========================================
function DisplayPopupMenu() {
	//document.getElementById("MenuBox").style.display = "block";

	el = document.getElementById('MenuBox');
	el.style.display = "block";

}


function HidePopupMenu() {
	//timeoutID = window.setTimeout('HidePopupMenuNow()', 2000);
	//document.getElementById("MenuBox").style.display = "none";

	el = document.getElementById('MenuBox');
	el.style.display = "none";

}

function HidePopupMenu_NOTUSED() {
	setTimeout("HidePopupMenuCode()", 1000);
}



function isMouseLeaveOrEnter(e, handler)
{		
	if (e.type != 'mouseout' && e.type != 'mouseover') return false;
	var reltg = e.relatedTarget ? e.relatedTarget :
	e.type == 'mouseout' ? e.toElement : e.fromElement;
	while (reltg && reltg != handler) reltg = reltg.parentNode;
	return (reltg != handler);
}




//============================CHECK RADIO BUTTONS=====================================
// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}




