function JS_IsEmail(PREmail)
{
    /*variable declarations*/var INTEmailLen, INTDotFound, INTAtFound, ret, INTAtCount;/*initialization*/ret=false;INTDotFound=0;INTAtFound=0;INTAtCount=0;INTEmailLen=PREmail.length;
    /*Regular Expression check*/if (PREmail.search('^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$') == -1){/*document.write("FAILED REGEXP<br />");*/return false;}
    /*main loop*/do {if ((INTEmailLen < PREmail.length)&&(INTEmailLen>=1)&&(PREmail.substr(INTEmailLen,1)==".")) {INTDotFound=INTEmailLen;}if ((INTEmailLen < PREmail.length)&&(INTEmailLen>=1)&&(PREmail.substr(INTEmailLen,1)=="@")&&(INTDotFound > INTEmailLen+1)) {ret=true;INTAtFound=INTEmailLen;INTAtCount=INTAtCount+1;}INTEmailLen=INTEmailLen-1;} while (INTEmailLen >= 0);
    /*end checks*/if (ret==false){/*document.write("FAILED LOOP<br />");*/return false;}if (INTAtCount > 1) {/*document.write("FAILED ATCOUNT<br />");*/return false;}if (PREmail.substr(PREmail.length,1)=="."){/*document.write("FAILED LASTDOT CHECK<br />");*/return false;}
     return ret;
}

function clearcontents(field,content)
{
    if (field.value == content)
    {
        field.value = "";
    }
}
function refill(field,content)
{
    if (field.value == "")
    {
        field.value = content;
    }
}
