function check_length(my_form) {

	maxLen = 2000; // max number of characters allowed

	if (my_form.msg.value.length >= maxLen) {

		// Alert message if maximum limit is reached.

		// If required Alert can be removed.

		var msg = "You have reached the maximum limit of characters allowed";

		alert(msg);

		// Reached the Maximum length so trim the textarea

		my_form.msg.value = my_form.msg.value.substring(0, maxLen);

	} else {

		// Maximum length not reached so update the value of my_text counter

		my_form.txt_num.value = (maxLen - my_form.msg.value.length)-1;

	}

}

/*

function updateSubTotal() {

	doc = document.purchase;

	pricePerPack = 5;

	//alert('nay: '+doc.bundle.options[doc.bundle.selectedIndex].value);

	if ( isInt(doc.packs.value) ) {

		cost = doc.packs.value * pricePerPack;

		doc.sub_total.value = cost + ".00";

	} else {

		alert("Please enter the number of Packages you wish to purchase!");

		doc.packs.value="";

		doc.packs.focus();

	}

	

}



function toggleNewBilling() {

	//alert( document.step_two.same_address.checked );

	if ( document.purchase.sameBilling.checked && document.getElementById('billDetails').style.display=='block') {

		document.getElementById('billDetails').style.display='none';

	} else {

		document.getElementById('billDetails').style.display='block';

	}

	

}*/



function attEmail(id, em) {

	// id = tagId

	var tag = document.getElementById('attachEmail_'+id);

	if ( tag.style.display=='none' ) {

		var inputName = 'addEmail_'+id;

		var form = '<div style="padding-top: 7px;"><form action="?do=kindnessAccount" name="addEmail" method="post"><input type="hidden" name="_addemail_check" value="1" /><input type="hidden" name="tagId" value="'+id+'" />Email: <input type="text" name="addThis" id="'+inputName+'" value="'+em+'" /> <button type="submit"> addEmail </button></form></div>';

		tag.innerHTML = form;

		tag.innerTEXT = form;

		tag.style.display='block';

		document.getElementById(inputName).focus();

	} else

		tag.style.display='none';



}
