function showHideHistory(grpId, dirLevel) { var selid = "showhidehistory" + grpId; var imgid = "showhidehistoryimg" + grpId; var minusImg = new Image(); var plusImg = new Image(); minusImg.src = getHistoryImgPath(dirLevel) + "images/minus_icon.gif"; plusImg.src = getHistoryImgPath(dirLevel) + "images/plus_icon.gif"; if(document.getElementById(selid).style.display=='none') { document.getElementById(selid).style.display='block'; document.getElementById(imgid).src = minusImg.src; return true; } else { document.getElementById(selid).style.display='none'; document.getElementById(imgid).src = plusImg.src; return false; } } function getHistoryImgPath(depth) { var str = ""; var i; for (i = 0; i < depth; i++) { str += "../"; } return str; } /************************************ Global Variables *************************************************/ //AJAX Request Variables var grpHistoryReq; var groupId; /*********************************** AJAX Calling Methods ***************************************************/ function retrieveGroupHistory(url) { if (window.XMLHttpRequest) { // Non-IE browsers grpHistoryReq = new XMLHttpRequest(); try { grpHistoryReq.open("GET", url, true); } catch (e) { alert(e); } grpHistoryReq.onreadystatechange = processHistoryData; grpHistoryReq.send(null); } else if (window.ActiveXObject) { // IE grpHistoryReq = new ActiveXObject("Microsoft.XMLHTTP"); if (grpHistoryReq) { grpHistoryReq.open("GET", url, true); grpHistoryReq.onreadystatechange = processHistoryData; grpHistoryReq.send(); } } } /*********************************** Retrieve History Methods *************************************************/ function processHistoryData() { if (grpHistoryReq.readyState == 4) { // Complete if (grpHistoryReq.status == 200) { // OK response populateHistory(grpHistoryReq); } else { alert("Problem: " + grpHistoryReq.statusText); } } } function populateHistory(req) { document.getElementById('grpspan' + groupId).innerHTML = req.responseText; grayOut(false); document.getElementById("pleasewaitScreen").style.visibility="hidden"; } function fillHistory(grpId) { var answer = confirm ("WARNING!!! Filling with historical data will replace your current answers. Press OK to proceed.") if (answer) { document.getElementById("pleasewaitScreen").style.top = (document.body.scrollTop + 150); document.getElementById("pleasewaitScreen").style.visibility="visible"; grayOut(true, {'zindex':'50','opacity':'30'}); groupId = grpId; var urlString = 'ajax.fillHistory?grpid=' + grpId; setTimeout('retrieveGroupHistory("' + urlString + '")', 10); } }