/*	CE @ Alliant / ShopSite Shopping Cart
*/

var REs =
[
	"^0[0-9]{5}$",
	"^11[0-9]{4}$",
	"^2[2-5][0-9]{4}$",
	"^30[0-9]{4}$",
	"^31[0-9]{4}$",
	"^39[0-9]{4}$",
	"^50[0-9]{4}$",
	"^600[0-9]{3}$",
	"^70[0-9]{4}$",
	"^79[0-9]{4}$",
	"^9[7-9][0-9]{4}$",
	"^[a-zA-Z]{3}[0-9]{3}$"
];

function GetCPA()
{
	var ID = window.prompt( "Please enter your CPA membership ID", "" );
	if( ID )
	{

		var I = document.forms[0].elements['coupon_code'];
		var L = REs.length;
		for( var i=0; i < L; i++ )
		{
			var RE = new RegExp( REs[i] );
			if( RE.exec( ID ) )
			{
				// IE=BOOM!
				try
				{	I.type = "password";	}
				catch(e)
				{
					var E = document.createElement( '<INPUT type="password" name="coupon_code"></INPUT>' );
					I.parentNode.replaceChild( E, I );
					I = E;
					E = null;
				}
				I.value = "1223864787";
				I = null;
				return false;
			}
		}
				
		I.value = "";
		I.type = "text";
		I = null;
		alert( "I'm sorry, that does not appear to be a valid CPA membership ID." );
		return false;
	}
}



