//element
function $(strName){return document.getElementById(strName);}
//fields
function $field(strName){return trim($(strName).value);}
function $set(strName,strValue){$(strName).value = trim(strValue);}
function $clear(strName){$set(strName,'');}
function $focus(strName){$(strName).focus();}
//DIV
function $WriteDiv(strName,strValue){$(strName).innerHTML=strValue;}
function $ClearDiv(strName){$WriteDiv(strName,'');}
function $HideDiv(strName){$(strName).style.display="none";}
function $ShowDiv(strName){$(strName).style.display="block";}
function $ToggleDiv(strDiv){if($(strDiv).style.display=='block'){$HideDiv(strDiv);}else{$ShowDiv(strDiv);}}
//test
function trim(strValue){return strValue.replace(/^\s+|\s+$/g, '');}
function isEmail(strValue){return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(strValue);}
function isPhone(strValue){return /^\+?[0-9 ()-]+[0-9]$/.test(strValue);}
function isEmpty(strValue){return ((strValue == null) || (strValue.length == 0))}
// clean
function sSanitize(field){return  trim($field(field).replace(/[^a-zA-Z0-9\ \-\.\,\:\@]/gi,''));}
function _fb(field,flag)
{
    // called by validate() and clear()
    // define feedback messages
    var goodmsg = "&nbsp;"
    var badmsg = "&nbsp; Required"

    // flag=true gives good message
    // flag=false gives bad message
    $WriteDiv(field,flag ? goodmsg : badmsg)  ;
    
    return true;
}
function openwindow()
{
	window.open("http://www.dataco.com/livechat.html","Dataco",	"menubar=0,resizable=0,status=0,toolbar=0,location=0,width=210,height=350");
}
