/**
 * createXMLHttp()
 * 
 * Attempts to create a new XMLHTTP object for any supported type of browser.
 */
function createXMLHttp() {
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new XMLHttpRequest()
      } catch (e) {
        //alert("Could not create XMLHttpRequest object!");
        return false;
      }
    }
  }
  return xmlhttp;
}

/**
 * show/hide toggle
 *
 */

function toggleDisplay(sectionID){
  section = document.getElementById(sectionID);
        
  section.style.display = (section.style.display == 'none') ? '' : 'none' ;
}

function Trim(value) {
    value = String(value);
    return value.replace(/^\s+/ig, "").replace(/\s+$/ig, "");
}

function IsValidUrl(objId){
    obj = document.getElementById(objId);
    if(obj.value == '') {
        return false;
    }
    obj.value = Trim(obj.value);
    var re = new RegExp("^https?://", "i");
    if(!re.test(obj.value)) {
        obj.value = 'http://' + obj.value;
    }
}

