function countExistingCats() {
	// iterate through the number of animals, and check which ones have the animal set to 'cat'
	var numexistingpets = document.getElementById('existingpets').value;
	
	var cats = 0;
	for(var i=1;i<=numexistingpets;i++) { if(!getIsDog(i)) { cats++; } }
	return cats;
}

function countExistingDogs() {
	// iterate through the number of animals, and check which ones have the animal set to 'cat'
	var numexistingpets = document.getElementById('existingpets').value;
	
	var dogs = 0;
	for(var i=1;i<=numexistingpets;i++) { if(getIsDog(i)) { dogs++; } }
	return dogs;	
}

function countNewCats() {
	// iterate through the number of animals, and check which ones have the animal set to 'cat'
	var numpets = document.getElementById('pets').value;
	
	var cats = 0;
	for(var i=1;i<=numpets;i++) { if(!getNewIsDog(i)) { cats++; } }
	return cats;
}

function countNewDogs() {
	// iterate through the number of animals, and check which ones have the animal set to 'cat'
	var numpets = document.getElementById('pets').value;
	
	var dogs = 0;
	for(var i=1;i<=numpets;i++) { if(getNewIsDog(i)) { dogs++; } }
	return dogs;	
}

function getBoardCatsTogetherDiscount() {

	// get the board together value from appropriate input
	if(getBoardedBefore()) {
	
		if(document.orderform.boardcatstogether1[0].checked == true) {
			//alert('catstogether');
			// we're boarding cats together, so let's give a discount!
			cats = countExistingCats();
			if(cats > 1) {
				return cats-1;
			}
			else {
				return 0;
			}
		}
		else { return 0; }	
	
	}
	else {
	
	}
}

function getBoardDogsTogetherDiscount() {

	// get the board together value from appropriate input
	if(getBoardedBefore()) {
		
	
		if(document.orderform.boarddogstogether1[0].checked == true) {
			// we're boarding dogs together, so let's give a discount!
			dogs = countExistingDogs();
			if(dogs > 1) {
				return dogs-1;
			}
			else {
				return 0;
			}			
		}
		else { return 0; }	
	
	}
	else {
	
	}
}


function getNewBoardCatsTogetherDiscount() {

	// get the board together value from appropriate input
	if(!getBoardedBefore()) {
	
		if(document.orderform.boardcatstogether2[0].checked == true) {
			// we're boarding cats together, so let's give a discount!
			cats = countNewCats();
			if(cats > 1) {
				return cats-1;
			}
			else {
				return 0;
			}
		}
		else { return 0; }	
	
	}
	else {
	
	}
}

function getNewBoardDogsTogetherDiscount() {

	// get the board together value from appropriate input
	if(!getBoardedBefore()) {
	
		if(document.orderform.boarddogstogether2[0].checked == true) {
			// we're boarding dogs together, so let's give a discount!
			dogs = countNewDogs();
			if(dogs > 1) {
				return dogs-1;
			}
			else {
				return 0;
			}			
		}
		else { return 0; }	
	
	}
	else {
	
	}
}


