function addCard(){
	var frm = document.getElementById('credit_card_form');
	var card_no = document.getElementById('card_total_val');
	var next_card = parseInt(card_no.value) + 1;
	var remove = document.getElementById('remove-link');
	
	remove.style.display = 'block';
	remove.style.visibility = 'visible';
	
	if (card_no.value < 10){
		var next_form = document.getElementById('card' + next_card);
		var use_card = document.getElementById('use-card' + next_card);
		next_form.style.display = 'block';
		next_form.style.visibility = 'visible';
		card_no.value = next_card;
		use_card.value = 1;
	} else alert('You may only enter up to 10 credit cards.');
}


function removeLastCard(){
	var frm = document.getElementById('credit_card_form');
	var card_no = document.getElementById('card_total_val');
	var prev_card = parseInt(card_no.value) - 1;
	
	if (card_no.value > 1){
		var last_form = document.getElementById('card' + card_no.value);
		var use_card = document.getElementById('use-card' + card_no.value);
		last_form.style.display = 'none';
		last_form.style.visibility = 'hidden';
		use_card.value = 0;
		card_no.value = prev_card;
		if (prev_card == 1){
			var remove = document.getElementById('remove-link');
			remove.style.display = 'none';
			remove.style.visibility = 'hidden';
		}
	}
}



function popup(){
	var screen_top = (screen.height - 300) / 2;
	var screen_left = (screen.width - 500) / 2;
	var x=window.open('congrats.php','','top=' + screen_top + ',left=' + screen_left + ',height=300,width=500,scrollbars=no,status=no');
}

function popupThanks(){
	var screen_top = (screen.height - 300) / 2;
	var screen_left = (screen.width - 500) / 2;
	var x=window.open('congrats.php','','top=' + screen_top + ',left=' + screen_left + ',height=300,width=500,scrollbars=no,status=no');
	if (x.parWin==null) x.parWin = self;
}

/* -------------------------- */



function numbersonly ( field, e ){
	var key;
	var keyChar;
	var rVal = false;
	var max = field.maxLength;
	
	if (window.event) key = window.event.keyCode;
	else if (e) key = e.which;
	else return true;

	keyChar = String.fromCharCode(key);

	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27)) rVal = true;
	else if ((("0123456789").indexOf(keyChar) > -1)) rVal = true;
	else rVal = false;

	return rVal;
}

function jump(field, nextField){
	var next = document.getElementById( nextField );
	if (next){
		if (field.value.length == field.maxLength) next.focus();
	} else return false;
}

function selectMe( obj ){
//	alert(obj);
	if (obj.value.length >= obj.maxLength) obj.select();
}


function whatsThis(){
	pop('whats-estimate.php');
}

function whatsSignature(){
//	var msg =	'An electronic signature, or E-Signature, is a convenient way to sign agreements online and eliminate the time and hassle normally associated with printing, signing and faxing paper agreements.\n\n' +
//				'E-Signatures are safe and valid for signing contracts and other online documents. If you prefer to use an ink signature instead, please print out the contract from your computer, sign it in ink, and fax back to us at 1.718.360.5711.\n\n' + 
//				'We will confirm receipt of your signed document and work with you to expedite your registration as quickly as possible.\n\n' + 
//				'Failure to use an E-Signature may delay the “on-boarding” time it takes for you to become an active member of the OnCard Marketing service.';
//	alert(msg);
	pop('whats-signature.php');
}


function whatsEstimatedCost(){
/*	var msg =	'In order to support your marketing campaigns, OnCard Marketing must incur various costs associated with obtaining, storing, and analyzing your transactional data.\n\n' + 
				'In an effort to provide an exceptional level of service to our merchant clients, we do charge a modest monthly subscription fee. This fee will give you access to our reporting services with some of the most insightful and practical information available in the marketplace today.\n\n' +
				'If our service does not exceed your expectations, we will honor our 100% satisfaction guarantee and refund your subscription fees. We know you won’t be disappointed!';*/
	pop('whats-cost.php');
}

function pop( url ){
	var screen_top = (screen.height - 300) / 2;
	var screen_left = (screen.width - 500) / 2;
	if (url) var x=window.open(url,'','top=' + screen_top + ',left=' + screen_left + ',height=300,width=500,scrollbars=yes,status=no');
}

function clearOnFocus(e,o){
if(o.firstTime){return}
o.firstTime=true
o.value=""
}
function limitText(limitField, limitCount, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } else {
        limitCount.value = limitNum - limitField.value.length;
    }
}

