/* CASH DONATIONS RELATED FUNCTIONS */
/***** BROWSER DETECTION *****/
var g_UA = navigator.userAgent.toLowerCase();
var g_NETSCAPE = (g_UA.indexOf("netscape")>0);
var g_NETSCAPE8 = (g_UA.indexOf("netscape/8")>0);
var g_NETSCAPE_LESS8 = (g_NETSCAPE && !g_NETSCAPE8);
var g_FIREFOX = (g_UA.indexOf("firefox")>0) 
var g_OPERA = (g_UA.indexOf("opera")>0)
var g_WEBTV = (g_UA.indexOf("webtv")>0)
var g_IE = (!g_OPERA && !g_WEBTV && g_UA.indexOf("msie")>0); //navigator.userAgent contains "msie" for Opera and WebTv too!!
var g_SAFARI = (g_UA.indexOf("safari") != -1);
var g_KONQUEROR = (g_UA.indexOf("konqueror") != -1);
var g_USE_NEW_CONTENT_MANAGER = (document.getElementById && document.designMode && !g_SAFARI && !g_KONQUEROR && !g_NETSCAPE_LESS8);
var g_USE_FCK_CONTENT_MANAGER = (!g_SAFARI && !g_KONQUEROR && !g_NETSCAPE_LESS8 && !g_OPERA);
var g_FormatDate = "MM/DD/YYYY";
var g_IE_VERSION5 = g_IE && (g_UA.charAt(navigator.appVersion.indexOf("msie") + 5) >= 5);
var g_WIN16 = (navigator.platform.indexOf("Win16") > 0);
var g_MAC = (g_UA.indexOf("mac")>0);

/***** GENERAL FUNCTIONS *****/
function check3Phone( PhoneField1ID, PhoneField2ID, PhoneField3ID, isRequired, showAlert )
{
	if( (document.getElementById(PhoneField1ID)) && (document.getElementById(PhoneField2ID)) && (document.getElementById(PhoneField3ID)) )
	{
		var PhoneField1 = document.getElementById(PhoneField1ID);
		var PhoneField2 = document.getElementById(PhoneField2ID);
		var PhoneField3 = document.getElementById(PhoneField3ID);
		
		if ((PhoneField1.value.length > 0 ) || (PhoneField2.value.length > 0) || (PhoneField3.value.length > 0)) {
			
			if (PhoneField1.value.length < 3 ) {
				if(showAlert)
					alert('This field must be a 3 digit from an U.S. phone number (like 415-555-1212)');
				PhoneField1.focus();
				return false;
			}
			if (PhoneField2.value.length < 3) {
				if(showAlert)
					alert('This field must be a 3 digit from an U.S. phone number (like 415-555-1212)');
				PhoneField2.focus();
				return false;
			}
			if (PhoneField3.value.length < 4) {
				if(showAlert)
					alert('This field must be a 4 digit from an U.S. phone number (like 415-555-1212)');
				PhoneField3.focus();
				return false;
			}
		}
		else
		{
			if ( isRequired ) 
			{
				if(showAlert)
					alert("Please enter Phone ");
				PhoneField1.focus();
				return false;
			}
		}
	}
	else
	{
		alert("No Phone field present on this form");
	    return false;
	}
	
	return true;
}
function validateUSPhone( strValue ) 
{
	if((isPhone(strValue)) || (isPhone2Format(strValue))){
		return true;
	}
	else{
		return false;
	}
}
function isEmail(str)
{
	var tmp = str + "";
	if(tmp!="")
	{		
		var exclude=/[^@\-\.\[A-Za-z0-9]]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;				
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,3}$/;

		if(((tmp.search(exclude) != -1)||(tmp.search(check)) == -1)||(tmp.search(checkend) == -1))
			return false;	
	}
	return true;	
}

function isPhone(str) //format: NNN-NNN-NNNN
{
	if (str.length != 12)     
	{		
		return false;
	}		
	
	for (var i=0; i<12; i++)
	{
		if ((i == 3 || i == 7) && str.charAt(i) != "-")
		{
			return false;
		}
		if (i!=3 && i!=7 && parseInt(str.charAt(i)) != str.charAt(i))
		{				
			return false;
		}		
	}
	
	return true;                     
}

function isPhone2Format(str) //format: (NNN) NNN-NNNN
{
	return /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/.test(str);                   
}

function isZip (str) // format NNNNN or NNNNN-NNNN
{
	if (str.length!=5 && str.length!=10)
	{	
		return false;
	}
		
	for (var i=0; i < str.length; i++) 
	{
		if(str.length == 5 && parseInt(str.charAt(i)) != str.charAt(i))
		{
			return false;
		}
		if(str.length == 10 && str.charAt(5) != "-")
		{
			return false;
		}			
		if(str.length == 10 && (i != 5 && parseInt(str.charAt(i)) != str.charAt(i)))		
		{		
			return false;
		}
	}

	return true;
}
function StripSpaces(sValue)
{
	return sValue.replace((/\s/g), ""); 
}

function doAssociateObjects( oSource, oTarget, bAssociate )
{
	if(bAssociate)
		oTarget.value = oSource.value;
}

function doClearObject(obj, clearvalue)
{
	obj.value = clearvalue;
}
function isEmpty(str)
{		
	if(g_IE)
	{		
		if(str=="")
			return true;
		var re = /(\S+)/gi;
		var t = re.test(str);
		return !t;
	}
	else
	{		
		if(str=="")	
			return true;
		return false;
	}
}

function changeClass(Elem, myClass) 
{
	if(document.getElementById(Elem))
		document.getElementById(Elem).className = myClass;
}
function isInteger( strValue ) {
	var objRegExp  = /(^-?\d\d*$)/;
	return objRegExp.test(strValue);
}
function clearChars( oCtrl ) {
	oCtrl.value = oCtrl.value.replace(/\D/g,'');
}
/* FORM RELATED */
function CheckSameAsBill ( oChkSame ){
	var objForm = document.forms.frmOnlineDonation;
	if( oChkSame.checked ){
		
		if (!isEmpty(objForm.txtDonorFirstName))
		{
			doAssociateObjects ( objForm.txtDonorFirstName, objForm.txtBillingFirstName, true );
			checkRequired ( objForm.txtDonorFirstName );
			checkRequired ( objForm.txtBillingFirstName );
		}
			
		if (!isEmpty(objForm.txtDonorLastName))
		{
			doAssociateObjects( objForm.txtDonorLastName, objForm.txtBillingLastName, true);
			checkRequired ( objForm.txtDonorLastName );
			checkRequired ( objForm.txtBillingLastName );
		}
			
		if (!isEmpty(objForm.txtDonorAddress1))
		{
			doAssociateObjects( objForm.txtDonorAddress1, objForm.txtBillingAddress1, true);
			checkRequired ( objForm.txtDonorAddress1 );
			checkRequired ( objForm.txtBillingAddress1 );
		}
		
		if (!isEmpty(objForm.txtDonorAddress2))
		{
			doAssociateObjects( objForm.txtDonorAddress2, objForm.txtBillingAddress2, true);
		}
		
		if (!isEmpty(objForm.selDonorState))
		{
			doAssociateObjects( objForm.selDonorState, objForm.selBillingState, true);
			checkRequired ( objForm.selDonorState );
			checkRequired ( objForm.selBillingState );
		}
		
		if (!isEmpty(objForm.txtDonorCity))
		{
			doAssociateObjects( objForm.txtDonorCity, objForm.txtBillingCity, true );
			checkRequired ( objForm.txtDonorCity );
			checkRequired ( objForm.txtBillingCity );
		}
		
		if (!isEmpty(objForm.txtDonorZip))
		{
			doAssociateObjects( objForm.txtDonorZip, objForm.txtBillingZip, true );
			checkRequired ( objForm.txtDonorZip );
			checkRequired ( objForm.txtBillingZip );
		}
		
		if ((!isEmpty(objForm.txtDonorPhone1))&&(!isEmpty(objForm.txtDonorPhone2))&&(!isEmpty(objForm.txtDonorPhone3)))
		{
			doAssociateObjects( objForm.txtDonorPhone1, objForm.txtBillingPhone1, true );
			doAssociateObjects( objForm.txtDonorPhone2, objForm.txtBillingPhone2, true );
			doAssociateObjects( objForm.txtDonorPhone3, objForm.txtBillingPhone3, true );
			checkRequired ( objForm.txtDonorPhone1 );
			checkRequired ( objForm.txtBillingPhone1);
			checkRequired ( objForm.txtDonorPhone2 );
			checkRequired ( objForm.txtBillingPhone2);
			checkRequired ( objForm.txtDonorPhone3 );
			checkRequired ( objForm.txtBillingPhone3);
		}
	}
	else{
		/*doClearObject(objForm.txtBillingAddress1, "");
		doClearObject(objForm.txtBillingAddress2, "");
		doClearObject(objForm.selBillingState, 0);
		doClearObject(objForm.txtBillingCity, "");
		doClearObject(objForm.txtBillingZip, "");*/
	}
}

function doCheckCountry( oCountrySource, oStateTarget )
{
	if ( oCountrySource.value != "United States of America" ) {
		oStateTarget.value = "N/A";
	}
	else
	{
		if (oStateTarget.value == "N/A")
			oStateTarget.value = "Texas";
	}
}

function doCheckUSState( oStateSource, oCountryTarget )
{
	if ( oStateSource.value != "N/A" ) {
		oCountryTarget.value = "United States of America";
	}
}

function checkLimit(iLimit, LimitedAreaID, CounterID, showAlert) {
	var oCounter = document.getElementById(CounterID);
	var oText = document.getElementById(LimitedAreaID);
	var prevCounter = iLimit - oCounter.value;
	oCounter.value = iLimit - oText.value.length;
	if(oCounter.value < 0){
		oCounter.value=0;
		if(showAlert){
			alert('The limit of ' + iLimit + ' characters is exceeded!');
		}
		oText.value = oText.value.substring(0,iLimit);
		return false;
	}
	return true;
}

function checkRequired( objCurrent )
{
	if(!isEmpty(objCurrent.value))
	{
		changeClass(objCurrent.id,'formField');
	}
	else
	{
		changeClass(objCurrent.id,'errformField');
	}
}
function checkRequiredSelect( objCurrent )
{
	if(objCurrent.value != "0")
	{
		changeClass(objCurrent.id,'formField');
	}
	else
	{
		changeClass(objCurrent.id,'errformField');
	}
}
function doSincroRequired( objAssociated, isAssociated )
{
	if ( isAssociated )
	{
		checkRequired(objAssociated);
	}
}
function doSincroReset( objAssociated, isAssociated, isAssocieatedRequired )
{
	if ( isAssociated )
	{
		resetCSS ( objAssociated ) ;
		
		if ( isAssocieatedRequired ) 
			checkRequired ( objAssociated );
	}
}
function checkRequiredMoney( objCurrent )
{
	if((!isEmpty(objCurrent.value)) && (objCurrent.value!="$0.00"))
	{
		changeClass(objCurrent.id,'formField');
	}
	else
	{
		changeClass(objCurrent.id,'errformField');
	}
}
function resetCSS( objCurrent )
{
	changeClass(objCurrent.id,'formField');
}
function resetCSSObj( objCurrentID )
{
	if(document.getElementById(objCurrentID))
		changeClass(document.getElementById(objCurrentID).id,'formField');
}
function doValidateMoneyForm()
{
	var oChkAlreadyPaid = document.getElementById('chkAlreadyPaid');
	var objForm = document.forms.frmOnlineDonation;
	var objCurrent;
	var isValid = true;
	var AlertMessage = "";
	var FirstErrField;
	
	if(objForm.hidTotalAmount.value == 0)
	{
		if ( isValid ) 
		{
			AlertMessage = "Total Amount cannot be null.";
			FirstErrField = objForm.txtDonationAmount;
		}
		isValid = false;
	}
	
	if(!isNaN(objForm.hidCountPlayers.value))
	{
		for( pIndex = 1; pIndex <= objForm.hidCountPlayers.value; pIndex++ )
		{
			isValid = doValidatePlayer( pIndex );
			if(!isValid) break;
		}
	}
	
	/* AMOUNT */
	objCurrent = objForm.txtDonationAmount;
	var amount = (objCurrent.value.indexOf('$')>-1)? objCurrent.value.substr(1,objCurrent.value.length-1):objCurrent.value ;
	amount = amount.replace(/,/g,'');
	if(amount=="") amount=0;
	
	/* DONOR */
	objCurrent = objForm.txtDonorFirstName;
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorFirstName','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person first name.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	objCurrent = objForm.txtDonorLastName;
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorLastName','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person last name.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	objCurrent = objForm.txtDonorAddress1;
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorAddress1','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person address.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	objCurrent = objForm.txtDonorCity;
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorCity','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person city.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	objCurrent = objForm.txtDonorZip;
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorZip','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person zip/postal code.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	else
	{
		if(!isZip(objCurrent.value))
		{
			changeClass('txtDonorZip','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter a valid zip code.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
	}
	
	objCurrent = objForm.txtDonorEmail;
	objCurrent.value = StripSpaces(objCurrent.value);
	if(isEmpty(objCurrent.value))
	{
		changeClass('txtDonorEmail','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person email address.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	if(!isEmail(objCurrent.value)) 
	{
		changeClass('txtDonorEmail','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter a valid email address.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	objCurrent = objForm.txtDonorPhone1;
	if(((!isEmpty(objCurrent.value))&&(!isEmpty(objForm.txtDonorPhone2.value))&&(!isEmpty(objForm.txtDonorPhone3.value))))
	{
		if (!check3Phone( 'txtDonorPhone1', 'txtDonorPhone2', 'txtDonorPhone3', true, false )) 
		{
			changeClass('txtDonorPhone1','errformField');
			changeClass('txtDonorPhone2','errformField');
			changeClass('txtDonorPhone3','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter a valid phone number. (e.g. 555-555-5555)";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
	}
	else
	{
		changeClass('txtDonorPhone1','errformField');
		changeClass('txtDonorPhone2','errformField');
		changeClass('txtDonorPhone3','errformField');
		if ( isValid ) 
		{
			AlertMessage = "Please, enter contact person phone number.";
			FirstErrField = objCurrent;
		}
		isValid = false;
	}
	
	
	if(!oChkAlreadyPaid.checked)
	{
		/* BILLING */
		objCurrent = objForm.txtBillingFirstName;
		if(isEmpty(objCurrent.value))
		{
			changeClass('txtBillingFirstName','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing first name.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		
		objCurrent = objForm.txtBillingLastName;
		if(isEmpty(objCurrent.value))
		{
			changeClass('txtBillingLastName','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing last name.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		
		objCurrent = objForm.selBillingCountry;
		if(objCurrent.value == "0")
		{
			changeClass('selBillingCountry','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing country.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		
		objCurrent = objForm.txtBillingAddress1;
		if(isEmpty(objCurrent.value))
		{
			changeClass('txtBillingAddress1','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing address.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		
		objCurrent = objForm.txtBillingCity;
		if(isEmpty(objCurrent.value))
		{
			changeClass('txtBillingCity','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing city.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		
		objCurrent = objForm.txtBillingZip;
		if(isEmpty(objCurrent.value))
		{
			changeClass('txtBillingZip','errformField');
			if ( isValid ) 
			{
				AlertMessage = "Please, enter billing zip/postal code.";
				FirstErrField = objCurrent;
			}
			isValid = false;
		}
		else
		{
			if((!isZip(objCurrent.value)) && (objForm.selBillingCountry.value == "United States of America"))
			{
				changeClass('txtBillingZip','errformField');
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid zip code.";
					FirstErrField = objCurrent;
				}
				isValid = false;
			}
		}
		
		
		objCurrent = objForm.txtBillingPhone1;
		if(objForm.selBillingCountry.value == "United States of America"){
			if(((!isEmpty(objCurrent.value))&&(!isEmpty(objForm.txtBillingPhone2.value))&&(!isEmpty(objForm.txtBillingPhone3.value))))
			{
				if (!check3Phone( 'txtBillingPhone1', 'txtBillingPhone2', 'txtBillingPhone3', true, false )) 
				{
					changeClass('txtBillingPhone1','errformField');
					changeClass('txtBillingPhone2','errformField');
					changeClass('txtBillingPhone3','errformField');
					if ( isValid ) 
					{
						AlertMessage = "Please, enter a valid phone number. (e.g. 555-555-5555)";
						FirstErrField = objCurrent;
					}
					isValid = false;
				}
			}
			else
			{
				changeClass('txtBillingPhone1','errformField');
				changeClass('txtBillingPhone2','errformField');
				changeClass('txtBillingPhone3','errformField');
				if ( isValid ) 
				{
					AlertMessage = "Please, enter billing phone number.";
					FirstErrField = objCurrent;
				}
				isValid = false;
			}
		}
	}
	
	// general err mgmt
	if ( !isValid ) 
	{
		objForm.hidAction.value = "";
		if(FirstErrField) FirstErrField.focus();
		if(!isEmpty(AlertMessage))
			alert('' + AlertMessage + '');
	}
	else
	{
		var message="";
		if(oChkAlreadyPaid.checked)
		{
			message = message + "This will start Registration process. Please make sure that the information is accurate.\n\rContinue?";
		}
		else
		{
			message = message + "This will start Secure Payment process. Please make sure that the billing information is accurate.\n\rContinue?";
		}
		if(confirm(message)){
			objForm.btnSubmit.value = "Please Wait...";
			objForm.hidAction.value = "send";
			
			objForm.hidNoPlayers.value			= objForm.txtNoPlayers.value;
			objForm.hidReceptionOnly.value		= objForm.txtReceptionOnly.value;
			objForm.hidNoTeams.value			= objForm.txtNoTeams.value;
			objForm.hidSameAsBilling.value		= objForm.chkSameAsDonor.value;
			objForm.hidAlreadyPaid.value		= objForm.chkAlreadyPaid.checked;
			
			objForm.hidDonorCompanyName.value	= objForm.txtDonorCompanyName.value;
			objForm.hidDonorFirstName.value		= objForm.txtDonorFirstName.value;
			objForm.hidDonorLastName.value		= objForm.txtDonorLastName.value;
			objForm.hidDonorEmail.value			= objForm.txtDonorEmail.value;
			objForm.hidDonorAddress1.value		= objForm.txtDonorAddress1.value;
			objForm.hidDonorAddress2.value		= objForm.txtDonorAddress2.value;
			objForm.hidDonorCity.value			= objForm.txtDonorCity.value;
			objForm.hidDonorState.value			= objForm.selDonorState.value;
			objForm.hidDonorZip.value			= objForm.txtDonorZip.value;
			objForm.hidDonorPhone1.value		= objForm.txtDonorPhone1.value;
			objForm.hidDonorPhone2.value		= objForm.txtDonorPhone2.value;
			objForm.hidDonorPhone3.value		= objForm.txtDonorPhone3.value;
			
			objForm.hidBillingAddress1.value	= objForm.txtBillingAddress1.value;
			objForm.hidBillingAddress2.value	= objForm.txtBillingAddress2.value;
			objForm.hidBillingCity.value		= objForm.txtBillingCity.value;
			objForm.hidBillingState.value		= objForm.selBillingState.value;
			objForm.hidBillingZip.value			= objForm.txtBillingZip.value;
			objForm.hidBillingCountry.value		= objForm.selBillingCountry.value;
			objForm.hidBillingFirstName.value	= objForm.txtBillingFirstName.value;
			objForm.hidBillingLastName.value	= objForm.txtBillingLastName.value;
			objForm.hidBillingPhone1.value		= objForm.txtBillingPhone1.value;
			objForm.hidBillingPhone2.value		= objForm.txtBillingPhone2.value;
			objForm.hidBillingPhone3.value		= objForm.txtBillingPhone3.value;
			objForm.hidDonationAmount.value		= objForm.txtDonationAmount.value;
			objForm.hidAdditionalInformation.value = objForm.txtAdditionalInformation.value;
			//isValid = false; // de scos pt save
		}
		else
		{
			isValid = false;
		}
	}
	return isValid; 	
}

function autoNumber(CtrlID) 
{			
	var oCtrl = eval("document.forms.frmOnlineDonation." + CtrlID);
	if(oCtrl){
		if(oCtrl.value.length > 0){
			oCtrl.value = oCtrl.value.replace(/-/,"");
		}
		
		var num = new NumberFormat();
		num.setInputDecimal('.');
		num.setNumber(oCtrl.value);
		num.setPlaces('2', false);
		num.setCurrencyValue('$');
		num.setCurrency(true);
		num.setCurrencyPosition(num.LEFT_OUTSIDE);
		num.setNegativeFormat(num.LEFT_DASH);
		num.setNegativeRed(false);
		num.setSeparators(true, ',', ',');
		oCtrl.value = num.toFormatted();
	}
}
function autoNumberValue(dValue) 
{			
	if(dValue.length > 0)
	{
		dValue = dValue.replace(/-/,"");
		var num = new NumberFormat();
		num.setInputDecimal('.');
		num.setNumber(dValue);
		num.setPlaces('2', false);
		num.setCurrencyValue('$');
		num.setCurrency(true);
		num.setCurrencyPosition(num.LEFT_OUTSIDE);
		num.setNegativeFormat(num.LEFT_DASH);
		num.setNegativeRed(false);
		num.setSeparators(true, ',', ',');
		return num.toFormatted();
	}
}
function selectCheckBox(chkID, Value)
{
	if(document.getElementById(chkID))
		document.getElementById(chkID).checked = (Value=="1")?true :false;
}


//	**************  3 fields input PHONE format *****************

function clearCharacters( oCtrl ) {
	oCtrl.value = oCtrl.value.replace(/\D/g,'');
}
function focusNext( oCtrl, NextCtrlID ) {
	if(oCtrl.value.length==3)
	{
		if (document.getElementById(NextCtrlID))
			document.getElementById(NextCtrlID).focus();
	}
}
var reWhitespace = /^\s+$/
function isEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{
	return (isEmpty(s) || reWhitespace.test(s));
}
function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}
function  isNumeric( strValue ) {
	var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
	return objRegExp.test(strValue);
}
function checkPlayer( oChk, PlayerNo )
{
	
	var idDetails = 'divPlayer' + PlayerNo + '_Details';
	if(document.getElementById(idDetails))
	{
		if(oChk.checked)
		{
			changeClass(idDetails, "hideElem");
		}
		else
		{
			changeClass(idDetails, "showElem");
		}
	}
}
function goRefresh(url)   
{

		document.forms[0].sCMD.value = "";
		document.forms[0].action = url;
		document.forms[0].submit();
}
function goUpd(url)   
{
		document.forms[0].sCMD.value = "XX";
		document.forms[0].action = url;
		document.forms[0].submit();
}
function goDel(url,ID)   
{
	if (confirm("This Record will be deleted! Are you sure !?"))
		{
		document.forms[0].sCMD.value = "del";
		document.forms[0].ID.value = ID;
		document.forms[0].action = url;
		document.forms[0].submit();
		}
}
function goMod(url,ID)   
{
		document.myform.sCMD.value = "edit";
		document.myform.action = url;
		document.myform.ID.value = ID;
		document.myform.submit();
}
function goSort(url,sSortBy,sSortOrd)
{
		document.forms[0].action = url;
		document.forms[0].SortBy.value  = sSortBy;
		document.forms[0].SortOrd.value = sSortOrd;

		document.forms[0].submit( );
}
function goSorts(url,sSortBy,sSortOrd)
{
		document.myform.action = url;
		document.myform.SortBy.value  = sSortBy;
		document.myform.SortOrd.value = sSortOrd;
		document.myform.submit( );
}
function ValidGo() {
	if (isWhitespace(document.myform.KeySearch.value)) {
	     alert("Please enter Search Key! ");
	     document.myform.KeySearch.focus();
	     return false;
	}  
	document.myform.GoSearch.value =1;
	 return true;
}
function goSubmM(url,page,groupCrt,sSortBy,sSortOrd){
		document.myform.page.value = page;
		document.myform.sCMD.value = "";
		document.myform.groupCrt.value = groupCrt;
		document.myform.SortBy.value = sSortBy;
		document.myform.SortOrd.value = sSortOrd;
		document.myform.action = url;
		document.myform.submit();
}
function goRegister( url, ID, CountPlayers )   
{
	if(doValidatePlayersAdmin(CountPlayers))
	{
		document.myform.sCMD.value = "savereg";
		document.myform.action = url;
		document.myform.ID.value = ID;
		document.myform.hidPlayersCount.value = CountPlayers;
		document.myform.submit();
	}
}
function doValidatePlayersAdmin(CountPlayers)
{
	var isValid = true;
	
	if(!isNaN(CountPlayers))
	{
		for( pIndex = 1; pIndex <= CountPlayers; pIndex++ )
		{
			isValid = doValidateAdminPlayer( pIndex );
			if(!isValid) break;
		}
	}
	return isValid; 	
}


function updateTotalAmount(NoPlayersFee, NoTeamsFee, ReceptionOnlyFee)
{
	var objForm = document.forms.frmOnlineDonation;
	var bWasUpdated = false;
	
	if(!isEmpty(objForm.txtNoPlayers.value))
	{
		updateNoPlayers( objForm.txtNoPlayers, NoPlayersFee, NoTeamsFee, ReceptionOnlyFee );
		bWasUpdated = true;
	}
	if(!isEmpty(objForm.txtNoTeams.value))
	{
		updateNoTeams( objForm.txtNoTeams, NoPlayersFee, NoTeamsFee, ReceptionOnlyFee );
		bWasUpdated = true;
	}
	if(!bWasUpdated)
	{
		// donation amount
		var dValue = document.getElementById('txtDonationAmount').value;
		var amount = dValue;
		amount = autoNumberValue(amount + ' ' );
		amount = amount.replace(/\$/g,'');
		amount = amount.replace(/\,/g,'');
		
		// reception only amount
		var cdValue = document.getElementById('txtReceptionOnly').value;
		var camount = cdValue;
		camount = autoNumberValue(camount + ' ' );
		camount = camount.replace(/\$/g,'');
		camount = camount.replace(/\,/g,'');
		
		// total amount
		var phAmount = document.getElementById('divSponsorTotalAmount');
		phAmount.innerHTML = autoNumberValue(( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) )) + ' ' );
		objForm.hidTotalAmount.value = ( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) ));
	}
}
function updateNoPlayers( oCtrl, NoPlayersFee, NoTeamsFee, ReceptionOnlyFee )
{
	// player number
	oCtrl.value = oCtrl.value.replace(/\D/g,'');
	var num = new NumberFormat();
	num.setInputDecimal('.');
	num.setNumber(oCtrl.value);
	num.setPlaces('0', false);
	num.setCurrencyValue('$');
	num.setCurrency(false);
	num.setCurrencyPosition(num.LEFT_OUTSIDE);
	num.setNegativeFormat(num.LEFT_DASH);
	num.setNegativeRed(false);
	num.setSeparators(true, ',', ',');
	oCtrl.value = num.toFormatted();
	
	var NoPlayers = oCtrl.value.replace(/\D/g,'');
	var PlayersCost = NoPlayers * NoPlayersFee;
	if(oCtrl.value == 0) oCtrl.value='';
	
	// donation amount
	var dValue = document.getElementById('txtDonationAmount').value;
	var amount = dValue;
	amount = autoNumberValue(amount + ' ' );
	amount = amount.replace(/\$/g,'');
	amount = amount.replace(/\,/g,'');
	
	// reception only amount
	var cdValue = document.getElementById('txtReceptionOnly').value;
	var camount = cdValue;
	camount = autoNumberValue(camount + ' ' );
	camount = camount.replace(/\$/g,'');
	camount = camount.replace(/\,/g,'');
		
	// total amount
	var phAmount = document.getElementById('divSponsorTotalAmount');
	phAmount.innerHTML = autoNumberValue(( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) ) + parseFloat(PlayersCost)) + ' ' );
	document.forms.frmOnlineDonation.hidTotalAmount.value = ( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) ) + parseFloat(PlayersCost));
}
function updateNoTeams( oCtrl, NoPlayersFee, NoTeamsFee, ReceptionOnlyFee )
{
	// player number
	oCtrl.value = oCtrl.value.replace(/\D/g,'');
	var num = new NumberFormat();
	num.setInputDecimal('.');
	num.setNumber(oCtrl.value);
	num.setPlaces('0', false);
	num.setCurrencyValue('$');
	num.setCurrency(false);
	num.setCurrencyPosition(num.LEFT_OUTSIDE);
	num.setNegativeFormat(num.LEFT_DASH);
	num.setNegativeRed(false);
	num.setSeparators(true, ',', ',');
	oCtrl.value = num.toFormatted();
	
	var NoTeams = oCtrl.value.replace(/\D/g,'');
	var PlayersCost = NoTeams * NoTeamsFee;
	
	// donation amount
	var dValue = document.getElementById('txtDonationAmount').value;
	var amount = dValue;
	amount = autoNumberValue(amount + ' ' );
	amount = amount.replace(/\$/g,'');
	amount = amount.replace(/\,/g,'');
		
	// reception only amount
	var cdValue = document.getElementById('txtReceptionOnly').value;
	var camount = cdValue;
	camount = autoNumberValue(camount + ' ' );
	camount = camount.replace(/\$/g,'');
	camount = camount.replace(/\,/g,'');
		
	// total amount
	var phAmount = document.getElementById('divSponsorTotalAmount');
	phAmount.innerHTML = autoNumberValue(( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) ) + parseFloat(PlayersCost)) + ' ' );
	document.forms.frmOnlineDonation.hidTotalAmount.value = ( parseFloat( !isNumeric(amount)?0:amount  ) + parseFloat( !isNumeric(camount)?0:(camount*ReceptionOnlyFee) ) + parseFloat(PlayersCost))
}
function updateReceptionOnly( oCtrl )
{
	// player number
	oCtrl.value = oCtrl.value.replace(/\D/g,'');
	var num = new NumberFormat();
	num.setInputDecimal('.');
	num.setNumber(oCtrl.value);
	num.setPlaces('0', false);
	num.setCurrencyValue('');
	num.setCurrency(false);
	num.setCurrencyPosition(num.LEFT_OUTSIDE);
	num.setNegativeFormat(num.LEFT_DASH);
	num.setNegativeRed(false);
	num.setSeparators(false, ',', ',');
	oCtrl.value = num.toFormatted();
	
	if(oCtrl.value == 0) oCtrl.value='';
}
function doNoTeams()
{
	var dValue = document.getElementById('txtNoTeams').value;
	//if((!isEmpty(dValue))||(parseInt(dValue)>parseInt(0)))
	//{
		var objForm = document.forms.frmOnlineDonation;
		//alert(objForm.hidNoTeams.value + '---' + objForm.txtNoTeams.value)
		if(objForm.hidNoTeams.value != objForm.txtNoTeams.value){
			objForm.hidNoPlayers.value			= objForm.txtNoPlayers.value;
			objForm.hidNoTeams.value			= objForm.txtNoTeams.value;
			objForm.hidSameAsBilling.value		= objForm.chkSameAsDonor.value;
			objForm.hidAlreadyPaid.value		= objForm.chkAlreadyPaid.checked;
			
			objForm.hidDonorCompanyName.value	= objForm.txtDonorCompanyName.value;
			objForm.hidDonorFirstName.value		= objForm.txtDonorFirstName.value;
			objForm.hidDonorLastName.value		= objForm.txtDonorLastName.value;
			objForm.hidDonorEmail.value			= objForm.txtDonorEmail.value;
			objForm.hidDonorAddress1.value		= objForm.txtDonorAddress1.value;
			objForm.hidDonorAddress2.value		= objForm.txtDonorAddress2.value;
			objForm.hidDonorCity.value			= objForm.txtDonorCity.value;
			objForm.hidDonorState.value			= objForm.selDonorState.value;
			objForm.hidDonorZip.value			= objForm.txtDonorZip.value;
			objForm.hidDonorPhone1.value		= objForm.txtDonorPhone1.value;
			objForm.hidDonorPhone2.value		= objForm.txtDonorPhone2.value;
			objForm.hidDonorPhone3.value		= objForm.txtDonorPhone3.value;
			
			objForm.hidBillingAddress1.value	= objForm.txtBillingAddress1.value;
			objForm.hidBillingAddress2.value	= objForm.txtBillingAddress2.value;
			objForm.hidBillingCity.value		= objForm.txtBillingCity.value;
			objForm.hidBillingState.value		= objForm.selBillingState.value;
			objForm.hidBillingZip.value			= objForm.txtBillingZip.value;
			objForm.hidBillingCountry.value		= objForm.selBillingCountry.value;
			objForm.hidBillingFirstName.value	= objForm.txtBillingFirstName.value;
			objForm.hidBillingLastName.value	= objForm.txtBillingLastName.value;
			objForm.hidBillingPhone1.value		= objForm.txtBillingPhone1.value;
			objForm.hidBillingPhone2.value		= objForm.txtBillingPhone2.value;
			objForm.hidBillingPhone3.value		= objForm.txtBillingPhone3.value;
			objForm.hidDonationAmount.value		= objForm.txtDonationAmount.value;
			objForm.hidAdditionalInformation.value = objForm.txtAdditionalInformation.value;
			objForm.hidReceptionOnly.value		= objForm.txtReceptionOnly.value;
			
			
			
			if(!isEmpty(objForm.txtNoTeams.value))
			{
				objForm.hidAction.value = "noteams";
			}
			else
			{
				objForm.hidAction.value = "onlydon";
				if((isEmpty(objForm.txtNoTeams.value))&&(isEmpty(objForm.txtNoPlayers.value)))
				{
					//objForm.hidNoBanquet.value = '';
				}
			}
			objForm.submit();
		}
	//}
}
function doNoPlayers()
{
	var dValue = document.getElementById('txtNoPlayers').value;
	//if((!isEmpty(dValue))||(parseInt(dValue)>parseInt(0)))
	//{
		var objForm = document.forms.frmOnlineDonation;
		//alert(objForm.hidNoTeams.value + '---' + objForm.txtNoTeams.value)
		if(objForm.hidNoPlayers.value != objForm.txtNoPlayers.value){
			objForm.hidNoPlayers.value			= objForm.txtNoPlayers.value;
			objForm.hidReceptionOnly.value		= objForm.txtReceptionOnly.value;
			objForm.hidNoTeams.value			= objForm.txtNoTeams.value;
			objForm.hidSameAsBilling.value		= objForm.chkSameAsDonor.value;
			objForm.hidAlreadyPaid.value		= objForm.chkAlreadyPaid.checked;
			
			objForm.hidDonorCompanyName.value	= objForm.txtDonorCompanyName.value;
			objForm.hidDonorFirstName.value		= objForm.txtDonorFirstName.value;
			objForm.hidDonorLastName.value		= objForm.txtDonorLastName.value;
			objForm.hidDonorEmail.value			= objForm.txtDonorEmail.value;
			objForm.hidDonorAddress1.value		= objForm.txtDonorAddress1.value;
			objForm.hidDonorAddress2.value		= objForm.txtDonorAddress2.value;
			objForm.hidDonorCity.value			= objForm.txtDonorCity.value;
			objForm.hidDonorState.value			= objForm.selDonorState.value;
			objForm.hidDonorZip.value			= objForm.txtDonorZip.value;
			objForm.hidDonorPhone1.value		= objForm.txtDonorPhone1.value;
			objForm.hidDonorPhone2.value		= objForm.txtDonorPhone2.value;
			objForm.hidDonorPhone3.value		= objForm.txtDonorPhone3.value;
			
			objForm.hidBillingAddress1.value	= objForm.txtBillingAddress1.value;
			objForm.hidBillingAddress2.value	= objForm.txtBillingAddress2.value;
			objForm.hidBillingCity.value		= objForm.txtBillingCity.value;
			objForm.hidBillingState.value		= objForm.selBillingState.value;
			objForm.hidBillingZip.value			= objForm.txtBillingZip.value;
			objForm.hidBillingCountry.value		= objForm.selBillingCountry.value;
			objForm.hidBillingFirstName.value	= objForm.txtBillingFirstName.value;
			objForm.hidBillingLastName.value	= objForm.txtBillingLastName.value;
			objForm.hidBillingPhone1.value		= objForm.txtBillingPhone1.value;
			objForm.hidBillingPhone2.value		= objForm.txtBillingPhone2.value;
			objForm.hidBillingPhone3.value		= objForm.txtBillingPhone3.value;
			objForm.hidDonationAmount.value		= objForm.txtDonationAmount.value;
			objForm.hidAdditionalInformation.value = objForm.txtAdditionalInformation.value;
			if(!isEmpty(objForm.txtNoPlayers.value))
			{
				objForm.hidAction.value = "noplayers";
			}
			else
			{
				objForm.hidAction.value = "onlydon";
				if((isEmpty(objForm.txtNoTeams.value))&&(isEmpty(objForm.txtNoPlayers.value)))
				{
					//objForm.hidNoBanquet.value = '';
				}
			}
			objForm.submit();
		}
	//}
}
function doSetShotgunStart( TeamIndex )
{
	var objForm = document.forms.frmOnlineDonation;
	var oTeamShotgun = eval("document.forms.frmOnlineDonation.txtTeam" + TeamIndex + "_Shotgun");
	
	for(Index = (((parseInt(TeamIndex,10)*4)-4)+1); Index <= (parseInt(TeamIndex,10) * 4); Index++ )
	{
		var oPlayer = eval("document.forms.frmOnlineDonation.txtPlayer" + Index + "_Shotgun");
		var oPlayerView = eval("document.forms.frmOnlineDonation.txtPlayerView" + Index + "_Shotgun");
		
		oPlayer.value		= oTeamShotgun.value;
		oPlayerView.value	= oTeamShotgun.options[oTeamShotgun.selectedIndex].text;
	}
}
function doValidatePlayer( PlayerIndex )
{
	var objForm = document.forms.frmOnlineDonation;
	var objCurrent;
	var isValid = true;
	var AlertMessage = "";
	var FirstErrField;
	
	var oChk = eval("document.forms.frmOnlineDonation.chkPlayer" + PlayerIndex + "_NA");
	var oName = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Name");
	var oZip = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Zip");
	var oEmail = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Email");
	var oPhone1 = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Phone1");
	var oPhone2 = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Phone1");
	var oPhone3 = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Phone1");
	var oShotgun = eval("document.forms.frmOnlineDonation.txtPlayer" + PlayerIndex + "_Shotgun");
	
	if(!oChk.checked)
	{
		if(isEmpty(oName.value))
		{
			if ( isValid ) 
			{
				AlertMessage = "Please, enter Player #" + PlayerIndex + " Name.";
				FirstErrField = oName;
			}
			isValid = false;
		}
		
		
		if(!isEmpty(oZip.value))
		{
			if(!isZip(oZip.value))
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid zip code for Player #" + PlayerIndex + ".";
					FirstErrField = oZip;
				}
				isValid = false;
			}
		}
		
		oEmail.value = StripSpaces(oEmail.value);
		if(!isEmpty(oEmail.value))
		{
			if(!isEmail(oEmail.value)) 
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid email address for Player #" + PlayerIndex + ".";
					FirstErrField = oEmail;
				}
				isValid = false;
			}
		}
		
		if(((!isEmpty(oPhone1.value))&&(!isEmpty(oPhone2.value))&&(!isEmpty(oPhone3.value))))
		{
			
			if (!check3Phone( 'txtPlayer' + PlayerIndex + '_Phone1', 'txtPlayer' + PlayerIndex + '_Phone2', 'txtPlayer' + PlayerIndex + '_Phone3', false, false )) 
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid phone number for Player #" + PlayerIndex + ". (e.g. 555-555-5555)";
					FirstErrField = oPhone1;
				}
				isValid = false;
			}
		}
		else
		{
			if(((!isEmpty(oPhone1.value))||(!isEmpty(oPhone2.value))||(!isEmpty(oPhone3.value))))
			{
				if (!check3Phone( 'txtPlayer' + PlayerIndex + '_Phone1', 'txtPlayer' + PlayerIndex + '_Phone2', 'txtPlayer' + PlayerIndex + '_Phone3', false, false )) 
				{
					if ( isValid ) 
					{
						AlertMessage = "Please, enter a valid phone number for Player #" + PlayerIndex + ". (e.g. 555-555-5555)";
						FirstErrField = oPhone1;
					}
					isValid = false;
				}
			}
		}
		
		
		if((!isEmpty(oName.value)) && ((isEmpty(oShotgun.value)) || (oShotgun.value == "0")))
		{
			if ( isValid ) 
			{
				AlertMessage = "Please, select Player #" + PlayerIndex + " Shotgun Start.";
				FirstErrField = oShotgun;
				
				if(document.getElementById('txtTeam1_Shotgun'))
				{
					AlertMessage = "Please, select Team#" + parseInt(parseInt(PlayerIndex/4)+1) + " Shotgun Start.";
					var oTeamShotgun = eval("document.forms.frmOnlineDonation.txtTeam" + parseInt(parseInt(PlayerIndex/4)+1) + "_Shotgun");
					FirstErrField = oTeamShotgun;
				}
				
			}
			isValid = false;
		}
		
	}
	
	if ( !isValid ) 
	{
		objForm.hidAction.value = objForm.hidAction.value;
		if(FirstErrField) FirstErrField.focus();
		if(!isEmpty(AlertMessage))
		{
			alert('' + AlertMessage + '');
		}
	}
	
	return isValid; 	
}
function doValidateAdminPlayer( PlayerIndex )
{
	var objForm = document.forms.myform;
	var objCurrent;
	var isValid = true;
	var AlertMessage = "";
	var FirstErrField;
	
	var oChk = eval("document.forms.myform.chkPlayer" + PlayerIndex + "_NA");
	var oName = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Name");
	var oZip = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Zip");
	var oEmail = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Email");
	var oPhone1 = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Phone1");
	var oPhone2 = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Phone1");
	var oPhone3 = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Phone1");
	var oShotgun = eval("document.forms.myform.txtPlayer" + PlayerIndex + "_Shotgun");
	
	if(!oChk.checked)
	{
		if(isEmpty(oName.value))
		{
			if ( isValid ) 
			{
				AlertMessage = "Please, enter Player #" + PlayerIndex + " Name.";
				FirstErrField = oName;
			}
			isValid = false;
		}
		
		if(!isEmpty(oZip.value))
		{
			if(!isZip(oZip.value))
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid zip code for Player #" + PlayerIndex + ".";
					FirstErrField = oZip;
				}
				isValid = false;
			}
		}
		
		oEmail.value = StripSpaces(oEmail.value);
		if(!isEmpty(oEmail.value))
		{
			if(!isEmail(oEmail.value)) 
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid email address for Player #" + PlayerIndex + ".";
					FirstErrField = oEmail;
				}
				isValid = false;
			}
		}
		
		if(((!isEmpty(oPhone1.value))&&(!isEmpty(oPhone2.value))&&(!isEmpty(oPhone3.value))))
		{
			
			if (!check3Phone( 'txtPlayer' + PlayerIndex + '_Phone1', 'txtPlayer' + PlayerIndex + '_Phone2', 'txtPlayer' + PlayerIndex + '_Phone3', false, false )) 
			{
				if ( isValid ) 
				{
					AlertMessage = "Please, enter a valid phone number for Player #" + PlayerIndex + ". (e.g. 555-555-5555)";
					FirstErrField = oPhone1;
				}
				isValid = false;
			}
		}
		else
		{
			if(((!isEmpty(oPhone1.value))||(!isEmpty(oPhone2.value))||(!isEmpty(oPhone3.value))))
			{
				if (!check3Phone( 'txtPlayer' + PlayerIndex + '_Phone1', 'txtPlayer' + PlayerIndex + '_Phone2', 'txtPlayer' + PlayerIndex + '_Phone3', false, false )) 
				{
					if ( isValid ) 
					{
						AlertMessage = "Please, enter a valid phone number for Player #" + PlayerIndex + ". (e.g. 555-555-5555)";
						FirstErrField = oPhone1;
					}
					isValid = false;
				}
			}
		}
		
		if((!isEmpty(oName.value)) && ((isEmpty(oShotgun.value)) || (oShotgun.value == "0")))
		{
			if ( isValid ) 
			{
				AlertMessage = "Please, select Player #" + PlayerIndex + " Shotgun Start.";
				FirstErrField = oShotgun;
			}
			isValid = false;
		}
	}
	
	if ( !isValid ) 
	{
		try
		{
			if(FirstErrField) FirstErrField.focus();
		}
		catch(err)
		{
		}
		if(!isEmpty(AlertMessage))
		{
			alert('' + AlertMessage + '');
		}
	}
	
	return isValid; 	
}
function checkAlreadyPaid(oChk)
{
	if(oChk.checked)
	{
		changeClass('tblBillingInformation','hideElem');
		document.forms.frmOnlineDonation.btnSubmit.value = "Register ";
	}
	else
	{
		changeClass('tblBillingInformation','showElem unselectedBlock');
		document.forms.frmOnlineDonation.btnSubmit.value = "Secure Payment ";
	}
}
function checkAlreadyPaidID(oChkID)
{
	var oChk = document.getElementById(oChkID);
	if(oChk.checked)
	{
		changeClass('tblBillingInformation','hideElem');
		document.forms.frmOnlineDonation.btnSubmit.value = "Register ";
	}
	else
	{
		changeClass('tblBillingInformation','showElem unselectedBlock');
		document.forms.frmOnlineDonation.btnSubmit.value = "Secure Payment ";
	}
}
function checkAlreadyPaidSelection(oChkID, Selected)
{
	var oChk = document.getElementById(oChkID);
	if(oChk.checked)
	{
		
		changeClass('tblBillingInformation','hideElem');
	}
	else
	{
		if(Selected)
			changeClass('tblBillingInformation','selectedBlock');
		else
			changeClass('tblBillingInformation','unselectedBlock');
	}
}
