function CloseHelp(DIVNAME) {
	obj = document.getElementById(DIVNAME); 
    	obj.style.visibility = 'visible'; 
    	document.getElementById(DIVNAME).innerHTML = '';
}

function DisplayHelp(COMMFORMURL,DIVNAME) {
	obj = document.getElementById(DIVNAME); 
    	obj.style.visibility = 'visible'; 
    	document.getElementById(DIVNAME).innerHTML = '<img src=images/loading.gif><font face=Arial size=2 color=#999999>&nbsp;&nbsp;Loading, please wait...</font>'; 
    	processAjax(COMMFORMURL,DIVNAME); 
}

function processAjax(url,unqdivname) {

    if (window.XMLHttpRequest) { // Non-IE browsers 
      req = new XMLHttpRequest(); 
      req.onreadystatechange = function () { targetDiv(unqdivname); };
      try { 
        req.open("GET", url, true); 
      } catch (e) { 
        alert(e); 
      } 
      req.send(null); 
    } else if (window.ActiveXObject) { // IE 
      req = new ActiveXObject("Microsoft.XMLHTTP"); 
      if (req) { 
        req.onreadystatechange = function () { targetDiv(unqdivname); };
        req.open("GET", url, true); 
        req.send(); 

      } 
    } 
} 

function targetDiv(DIVNAME) { 
    if (req.readyState == 4) { // Complete 
          if (req.status == 200) { // OK response 
              document.getElementById(DIVNAME).innerHTML = req.responseText; 
          } else { 
          } 
    } 
}

function checkMaxLength(field, maxlimit, divname) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	var txtleng = field.value.length;
	var charremaining = maxlimit - txtleng;
	obj = document.getElementById(divname); 
	document.getElementById(divname).innerHTML = '<font face=Arial,Helvetica,Sans-Serif size=2 color=#777777><b>' +charremaining +'</b> Characters Remaining.</font>';
}

function swappic(url,index,isSuper) {
	currentIndex = index;
	currentIsSuper = isSuper;
	document['PhotoLarge'].src=url;
	visibleState="hidden";
	
	return false;
}

function swappicANS(url,index,isSuper,AnsLoc) {
	currentIndex = index;
	currentIsSuper = isSuper;
	document[AnsLoc].src=url;
	visibleState="hidden";
	
	return false;
}