/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 Wednesday, November 10, 2004 2:27:12 PM
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */
function changeColor(colorType)
{
   preview = "ColorPreview" + colorType;
   edit =  "ColorHex" + colorType;
   document.getElementById(preview).style.backgroundColor = document.getElementById(edit).value;
}
function openColorPicker(page, editColor, controlColor)
{

    color = document.getElementById(editColor).value;
    color = color.substr(1,6);
    window_link = page + '?color=' + color + '&edit_color=' + editColor + '&control_color=' + controlColor;
    newWindow = window.open( window_link , '', 'dependent=yes,scrollbars=0,width=270,height=190,top=150,left=150,resizable=yes,toolbar=0,location=0,directories=0,status=0,menubar=yes,copyhistory=0' );
    if (document.images) newWindow.focus()
}
function checkEmail(email)
{
    var pattern = new RegExp("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$");
    if (email.search(pattern) == -1)
    {
        return false;
    }
    else
    {       
        return true;
    }
}
function isEmptyString(strValue) {
   	var strTemp = strValue;
   		strTemp = trimAll(strTemp);
   		if(strTemp.length > 0){
 		return false;
   		}
   		return true;		
}

function trimAll( strValue ) {
 	var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }

   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}








