var xmlHttp; var resultString = ''; var isResultSuccess = false; var targetContainer = ''; function createXMLHttpRequest() { /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlHttp = false; } } @end @*/ if (!xmlHttp && typeof XMLHttpRequest!='undefined') { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp=false; } } if (!xmlHttp && window.createRequest) { try { xmlHttp = window.createRequest(); } catch (e) { xmlHttp=false; } } } function makeRequest(url,tc) { clientBeginFunction(); targetContainer = tc; createXMLHttpRequest(); xmlHttp.onreadystatechange = handleStateChange; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function handleStateChange() { isResultSuccess = false; if(xmlHttp.readyState==4) { if(xmlHttp.status == 200) { isResultSuccess = true; resultString = xmlHttp.responseText; if(isResultSuccess) { // create temp span to replace existing var childSpan = document.createElement('span'); childSpan.id = 'temp_'+targetContainer; // insert the AJAX response string childSpan.innerHTML = resultString; // remove the old span; killKids(targetContainer); // now append the new span findObj(targetContainer).appendChild(childSpan); //dispense with temp span delete childSpan; } else { alert('Request result for '+ targetContainer +'produced an error'); } } else { alert('Error within the incoming code for '+ targetContainer +': ' + xmlHttp.status); } clientDoneFunction(); } resultString = ''; isResultSuccess = false; } function killKids(nodeName) { var parentSpan = findObj(nodeName); if (parentSpan.hasChildNodes()) {parentSpan.removeChild(parentSpan.lastChild);} } function newClass(id,nuClassName) { findObj(id).className=nuClassName; } function showDiv(s) { findObj(s).style.display='block'; } function hideDiv(s) { findObj(s).style.display='none'; } function shoHideDiv(s) { var obj = findObj(s); if(obj.style.display=='none') { obj.style.display='block'; } else { obj.style.display='none'; } } function findObj(theObj, theDoc) { var p, i, foundObj; if(!theDoc) theDoc = document; if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) { theDoc = parent.frames[theObj.substring(p+1)].document; theObj = theObj.substring(0,p); } if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj]; for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj]; for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj,theDoc.layers[i].document); if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj); return foundObj; } function popUp(pPage,w,h) { if (w==null) w=400; if (h==null) h=275; var ms; var m; var Today = new Date(); var ms = Today.getMilliseconds(); var m = Today.getMinutes(); var winName = 'popWin'+m.toString()+ms.toString(); var winOpts = 'dependent=yes,toolbar=no,menubar=yes,status=no,location=no,resizable=yes,scrollbars=yes,width='+w+',height='+h; popUpWin = window.open(pPage,winName,winOpts); popUpWin.focus(); } function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) { field.value = field.value.substring(0, maxlimit); } else { countfield.value = maxlimit - field.value.length; } }