/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function createRequest() {
try {
    request = new XMLHttpRequest();
    } catch (tryMS) {
    try {
        request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (otherMS) {
        try {
            request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (failed) {
        request = null;
    }
    }
    }
    return request;
}

/**
 *  Rotinas gerais para uso de todos os utilitários, uma espécie de plancton
 *
 */

function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
     // search email text for regular exp matches
   // alert(strEmail.search(validRegExp));
    if (strEmail.search(validRegExp) == -1)
   {
      // alert('A valid e-mail address is required.\nPlease amend and retry');
      return false;
    }
    return true;
}


function readCookie(name) {
// Find the specified cookie and return its value
/**
 * Copiado de Head First JavaScript
 */
    var searchName = name + "=";
    var cookies = document.cookie.split(';');
    for(var i=0; i < cookies.length; i++) {
        var c = cookies[i];
        while (c.charAt(0) == ' ')
            c = c.substring(1, c.length);
        if (c.indexOf(searchName) == 0)
            return c.substring(searchName.length, c.length);
    }
    return null;
}

function popHiddenLayer() {
if(document.getElementById('hiddenLayer')!=null) {
var elem = document.getElementById('hiddenLayer');
elem.className = 'POP_LAYER';
}
return true;
}
