
 function changeImg(imgName, newImg)
  {
    document.images[imgName].src = newImg ;
  }



function validate_element()
{
	if (document.app.PracticeName.value == '')
	{
		alert("Practice Name cannot be NULL");
		document.app.PracticeName.focus();
		return false;
	}

	if (document.app.Address1.value == '')
	{
		alert("Address cannot be NULL");
		document.app.Address1.focus();
		return false;
	}
//	alert(document.app.state_id.selectedIndex);
	if (document.app.state_id.selectedIndex <= 0)
	{
		alert("Please choose the state");
		document.app.state_id.focus();
		return false;
	}
	if (document.app.Phone.value == '')
	{
		alert("Phone number cannot be NULL");
		document.app.Phone.focus();
		return false;
	}
	if (document.app.Taxid.value == '')
	{
		alert("Tax id  cannot be NULL");
		document.app.Taxid.focus();
		return false;
	}
	if (document.app.Yrsofpractice.value == '')
	{
		alert("Years of Practice cannot be NULL");
		document.app.Yrsofpractice.focus();
		return false;
	}

	if (!isInteger(document.app.Yrsofpractice.value))
	{
		alert("Years of practice should be integers only");
		document.app.Yrsofpractice.focus();
		return false;
	}
	if (document.app.PT.value < 0) 
	{
		alert("PT should have a value greater than or equal to 0");
		document.app.PT.focus();
		return false;
	}
	if (!isInteger(document.app.PT.value))
	{
		alert("PT should be integers only");
		document.app.PT.focus();
		return false;
	}
	
if (document.app.ST.value < 0) 
	{
		alert("ST should have a value greater than or equal to 0");
		document.app.ST.focus();
		return false;
	}
	if (!isInteger(document.app.ST.value))
	{
		alert("ST should be integers only");
		document.app.ST.focus();
		return false;
	}
	

if (document.app.OT.value < 0) 
	{
		alert("OT should have a value greater than or equal to 0");
		document.app.OT.focus();
		return false;
	}

if (!isInteger(document.app.OT.value))
	{
		alert("OT should be integers only");
		document.app.OT.focus();
		return false;
	}

if (document.app.Staffno.value < 0) 
	{
		alert("Staff number should have a value greater than or equal to 0");
		document.app.Staffno.focus();
		return false;
	}

if (!isInteger(document.app.Staffno.value))
	{
		alert("Staff Number should be integers only");
		document.app.Staffno.focus();
		return false;
	}

if (document.app.servicehrs.value < 0) 
	{
		alert("Service Hours should have a value greater than or equal to 0");
		document.app.servicehrs.focus();
		return false;
	}

if (!isInteger(document.app.servicehrs.value))
	{
		alert("Servce hours should be integers only");
		document.app.servicehrs.focus();
		return false;
	}


if (document.app.expirationdate.value < 0) 
	{
		alert("Expirationdate number should have a value greater than or equal to 0");
		document.app.expirationdate.focus();
		return false;
	}


if (document.app.expirationdate.value == '')
{
	return true;
}
else
{
date_arr = document.app.expirationdate.value.split('/');

var today = new Date();
var year = today.getYear();
var month = today.getMonth();
 
if (year > 90 )
{
	year = "19" + year;
}
else
{
	year = "20" + year;
}

if (date_arr[1] > 90)
{
	year1 = "19" + date_arr[1];
}
else
{
	year1  = "20" + date_arr[1];
}


if (date_arr[0] > 12 || date_arr[0] <= 0)
{
	alert("Credit card Expiration Month cannot be less than or equal to 0 or greater than 12");
	document.app.expirationdate.focus();
	return false;
}

if (date_arr[0] < month && year1 < year)
{
	alert("Credit card has expired. Please Enter valid card number.");
	document.app.expirationdate.focus();
	return false;
}

}


}

function isInteger (s)

{   var i;

     for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }
    return true;
}

function isDigit (c)
{   
	return ((c >= "0") && (c <= "9"))
}


