var inputFields = [
	['firstname','First Name'],
	['lastname','Last Name'],
	['address','Mailing Address'],
	['city','City'],
	['state','State'],
	['zip','Zip Code'],
	['homeArea','Phone Area'],
	['homePre','Phone Pre'],
	['homeEnd','Phone End'],	
	['email','Email'],
	['custom8','Due Date']
]

function clearField(form, field, value)
{
	if (form[field].value == value)
		form[field].value = '';
}

function isEmpty(value)
{
    var retVal = (value.search(/\S/) == -1);
    return retVal;    
}

function validate(form)
{
	var sErr = '';
	var inputName, defaultValue;

	for (field in inputFields)
	{
		inputName = inputFields[field][0];
		defaultValue = inputFields[field][1];
		if (document.MedicaidAssistant[inputName].value == defaultValue || isEmpty(document.MedicaidAssistant[inputName].value))
			sErr = sErr + defaultValue + '\r\n';
	}
	
	if (sErr != '')
	{
		alert('Please fill out the following information:\r\n' + sErr);
		return false;
	}
	else
		return true;
}

function change(id, newClass)
{
    identity = getDiv(id);
    if (identity)
        identity.className = newClass;
}

function getDiv( name )
{
    if (document.getElementById)
        return document.getElementById(name)
    else
        return document.all[name]
}

function getObjectTop(thisObj)
{
    var curY, curObj;
    curY = 0;
    curObj = thisObj;
    while (curObj != null)
    {
        curY += curObj.offsetTop;
        curObj = curObj.offsetParent;
    }
    
    return curY;
}

function getObjectBottom(thisObj)
{
    var curY, curObj;
    curY = 0;
    curObj = thisObj;
    while (curObj != null)
    {
        curY += curObj.offsetTop;
        curObj = curObj.offsetParent;
    }
    
    return curY += thisObj.clientHeight;
}

function getObjectLeft(thisObj)
{
    var curX, curObj;
    curX = 0;
    curObj = thisObj;
    while (curObj != null)
    {
        curX += curObj.offsetLeft;
        curObj = curObj.offsetParent;
    }
    
    return curX;    
}
function getObjectRight(thisObj)
{
    var curX, curObj;
    curX = 0;
    curObj = thisObj;
    while (curObj != null)
    {
        curX += curObj.offsetLeft;
        curObj = curObj.offsetParent;
    }
    
    //add the width of the object to get it's right position
    curX += thisObj.clientWidth;
    
    return curX;    
}

