/**
 * Display the drop down menu for IE browser
 *
 * Note: Without the 2 functions below, the pop-up and drop down (product pages)
 * menus will not work in IE browsers.
 */

/**
 * Kick start the drop down/pop up menu
 *
 * Note: To add more menu(s) to kick start in IE browser,
 * just add the menu's name to the array within this function.
 */
function startDDM(){
	if(typeof ie6 != "undefined")e('js/ie6/');
	var arrDDM = new Array('popUpMenu', 'productsDDM');

	// Go throught each menu to kick start it.
	for(var x in arrDDM){
		if (document.all && document.getElementById && document.getElementById(arrDDM[x]) != null) {
			loopNode(document.getElementById(arrDDM[x]));
		}
	}
}

/**
 * This is the heart of the kick starting the
 * drop down and pop up menu in IE browsers.
 */
function loopNode(navRoot){
	for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			node.onmouseover=function() {
				this.className+=" over";
			}
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
			}
		}
	}
}

function setValue(cookieName, type, id){
	value = ((type != "") ? (type + ",") : "") + id;
alert(value);
	createCookie(cookieName, value);
}

/*function displayTOC(){
	cookieValue = readCookie("homeschoolTOC").split(",");

	postData = "type=" + cookieValue[0] + "&id=" + cookieValue[1];

	xmlHTTPObj("toc", "bookTOCClass.php", postData);
}

function displayPG(){
	cookieValue = readCookie("homeschoolPG");

	postData = "id=" + cookieValue);

	xmlHTTPObj("pg", "pacingGuideClass.php", postData);
}*/

function xmlHTTPObj(affectElement, serverPage, postData){
alert('');
	xmlhttp = getXMLHttpRequestObj();

	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			document.getElementById(affectElement).innerHTML = xmlhttp.responseText;
			document.getElementById('loadingImg').visible = false;
	}

	xmlhttp.open("POST", serverPage, true);
	// need this line of code bc using POST to send data to server
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.send(postData);
}
