// Global variables
var isCSS, isW3C, isIE4, isNN4;
// set event handler to initialize API
window.onload = initDHTMLAPI;
// initialize upon load to let all browsers establish content objects
function initDHTMLAPI() {
    if (document.images) {
        isCSS = (document.body && document.body.style) ? true : false;
        isW3C = (isCSS && document.getElementById) ? true : false;
        isIE4 = (isCSS && document.all) ? true : false;
        isNN4 = (document.layers) ? true : false;
        isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
    }
}
// Convert object name string or object reference
// into a valid element object reference
function getRawObject(obj) {
    var theObj;
    if (typeof obj == "string") {
        if (isW3C) {
            theObj = document.getElementById(obj);
        } else if (isIE4) {
            theObj = document.all(obj);
        } else if (isNN4) {
            theObj = seekLayer(document, obj);
        }
    } else {
        // pass through object reference
        theObj = obj;
    }
    return theObj;
}
function isEmpty(elem) {
    var str = elem.value;
    if(str == null || str.length == 0) {
        return true;
    } else {
        return false;
    }
}
function isEmail(elem){
	var str = elem.value;
	var sCrit = /^.+@.+\..{2,3}$/;
	if(!str.match(sCrit)){
		return false;	
	}else{
		return true;
	}
}
function isJPG(pString){
	pString = pString.toLowerCase();
	var sCrit = /.jpg/g;
	if(!pString.match(sCrit)){
		return false;	
	}else{
		return true;	
	}
}
function isGIF(pString){
	pString = pString.toLowerCase();
	var sCrit = /.gif/g;
	if(!pString.match(sCrit)){
		return false;	
	}else{
		return true;	
	}
}
function isLen8(elem) {
	var str = elem.value;
    var re = /\b.{8}\b/;
    if (!str.match(re)) {
        return false;
    } else {
        return true;
    }
}
function errorMessage(pErrors){
	var sMsg = "";
	sMsg = "The form cannot be submitted because of the following errors:\n\n" + pErrors;
	return sMsg;
}