function checkvalid()
{
	if(document.frmadd.iAmount[5].checked == true)
	{	
		if(document.frmadd.Otheramount.value.length<1)
		{
			alert(" Enter Price");
			document.frmadd.Otheramount.focus();
			return false;	
		}
	}
		
	if(document.frmadd.iAmount[5].checked == true)
	{	
		if(document.frmadd.Otheramount.value.length >1)
		{
			if(checkValidNumber(document.frmadd.Otheramount,"Enter Valid Price") == false)
			{	
			return false;
			}
		}
	}

	if(document.frmadd.rad_contributor_name[0].checked == true)
	{
		if(document.frmadd.contributor_name.value.length<1)
		{
			alert(" Enter Contributor Name");
			document.frmadd.contributor_name.focus();
			return false;	
		}
	}
	if(document.frmadd.vFirstName.value.length < 1)
	{
		alert("Enter Your First Name");
		document.frmadd.vFirstName.focus();
		return false;
	}
	if(document.frmadd.vLastName.value.length < 1)
	{
		alert("Enter Your Last Name");
		document.frmadd.vLastName.focus();
		return false;
	}
/*	if(document.frmadd.vMiddleInit.value.length < 1)
	{
		alert(" Enter Middle Initia ");
		document.frmadd.vMiddleInit.focus();
		return false;
	}*/
	if(document.frmadd.vAddress.value.length < 1)
	{
		alert("Enter Address ");
		document.frmadd.vAddress.focus();
		return false;
	}
	if(document.frmadd.vCity.value.length < 1)
	{
		alert("Enter City");
		document.frmadd.vCity.focus();
		return false;
	}
	if(document.frmadd.vState.selectedIndex ==0)
	{
		alert(" Select State Name From List");
		document.frmadd.vState.focus();
		return false;
	}
	if(document.frmadd.vZip.value.length < 1)
	{
		alert(" Enter Zip Code");
		document.frmadd.vZip.focus();
		return false;
	}
	if(document.frmadd.vDayPhone.value.length < 1)
	{
		alert(" Enter Your Day Phone");
		document.frmadd.vDayPhone.focus();
		return false;
	}
/*	if(document.frmadd.cc.selectedIndex ==0)
	{
		alert(" Select Card Type Form The List");
		document.frmadd.cc.focus();
		return false;
	}
*/	
if(document.frmadd.vEmail.value.length < 1)
	{
		alert("Enter Your Email");
		document.frmadd.vEmail.focus();
		return false;
	}
	
	// Start Email Validation
	var i;
	var input = document.frmadd.vEmail.value ;
	var lenth = input.length ;
	var ctr=0 ;

	if ( ( document.frmadd.vEmail.value.charAt(i) == '!' ) || ( 	document.frmadd.vEmail.value.charAt(i) == '#' ) )
    {
	  alert("Please enter a proper email address") ;
	  document.frmadd.vEmail.focus();
      return false;
    }
	if (input =="")
	{
		alert("Please enter email address") ;
	    document.frmadd.vEmail.focus();
		return false ;
	}
	if(input.length == 40)
	{
		alert("Please enter a proper email address") ;
	    document.frmadd.vEmail.focus();
		return false ;
	}

	for ( i=0; i < lenth; i++ )
	{
		var oneChar = input.charAt(i) ;
		if(oneChar == "@")
		{
			ctr = ctr+1 ;
		}
		if ( (i == 0 && oneChar == "@") || (i == 0 && oneChar == ".") || 
			( oneChar == " " ) )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if ( (oneChar == "@" && input.charAt(i+1) == ".") || 
			(oneChar == "." && input.charAt(i+1) == "@") ||
			(oneChar == "." && input.charAt(i+1) == ".") )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if( input.indexOf("@") < 2 )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if(input.indexOf(".")<4)
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if (ctr > 1)
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
	}	// End Email Validation Script
	
	if(document.frmadd.iCardNumber.value.length < 1)
	{
		alert(" Enter Card Number");
		document.frmadd.iCardNumber.focus();
		return false;
	}
	if(document.frmadd.iCardNumber.value.length >1)
	{
		if(checkValidOnlyNumber(document.frmadd.iCardNumber,"Enter Valid CardNumber") == false)
		{	
		return false;
		}
	}

	if(document.frmadd.dExpiryDate.value.length < 1)
	{
		alert(" Enter Expiry Date");
		document.frmadd.dExpiryDate.focus();
		return false;
	}
	if(document.frmadd.iDigitCode.value.length < 1)
	{
		alert(" Enter Your 3 or 4 Digit Code");
		document.frmadd.iDigitCode.focus();
		return false;
	}
	if((document.frmadd.iDigitCode.value.length < 3) || (document.frmadd.iDigitCode.value.length  > 4))
	{
		alert(" Enter Your 3 or 4 Digit Code");
		document.frmadd.iDigitCode.focus();
		return false;
	}
	if(document.frmadd.iDigitCode.value.length >1)
	{
		if(checkValidOnlyNumber(document.frmadd.iDigitCode,"Enter Code in Numeric Only") == false)
		{	
		return false;
		}
	}
}


function erase()
{
	document.frmadd.Otheramount.value = "";
	return true;
}
function checkValidNumber(obj, msg)
{
	validCharacters = "1234567890.";
	compareValue = obj.value;
	if(!checkCharFormat(validCharacters, compareValue))
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}
function checkValidOnlyNumber(obj, msg)
{
	validCharacters = "1234567890";
	compareValue = obj.value;
	if(!checkCharFormat(validCharacters, compareValue))
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}
function checkCharFormat(validCharacters, compareValue)
{
	for(i=0 , n=compareValue.length; i<n ;i++)
	{
		ch1=compareValue.charAt(i);
		rtn1=validCharacters.indexOf(ch1);
		if(rtn1==-1)
		{
			return false;
		}
	}
	return true;
}