//-----------------------------------------------------------------
// Used by purchase form to hide and display more citie entry boxes
//-----------------------------------------------------------------
                $(document).ready(function() {
			var cost = 100;

                        $('#btnAdd').click(function() {
                                var num         = $('.clonedInput').length;
                                var newNum      = new Number(num + 1);

                                var newElem = $('#input' + num).clone().attr('id', 'input' + newNum);

                                newElem.children(':first').attr('id', 'city' + newNum).attr('name', 'city' + newNum);
                                $('#input' + num).after(newElem);

				$('#city' + newNum + ' INPUT').attr('name', 'city' + newNum).val('');

                                $('#btnDel').attr('disabled','');

				cost = cost + 25;
				screenUpdate(cost);
                                if (newNum == 5)
                                        $('#btnAdd').attr('disabled','disabled');
                        });

                        $('#btnDel').click(function() {
                                var num = $('.clonedInput').length;

                                $('#input' + num).remove();
                                $('#btnAdd').attr('disabled','');

				cost = cost - 25;
                                if (num-1 == 1)
                                        $('#btnDel').attr('disabled','disabled');
				screenUpdate(cost);
                        });

                        $('#btnDel').attr('disabled','disabled');


                        $('#uk').click(function() {
                        if($('#uk').is(':checked')) {$('#cities').css('display','none'); $('#cities-buttons').css('display','none'); cost=500; screenUpdate(cost);}
                        if(!$('#uk').is(':checked')) {
				$('#cities').css('display','');    
				$('#cities-buttons').css('display',''); 
				cost = ($('#cities .form-row').size() * 25) + 75;
				screenUpdate(cost);
				}
                        });

			

                });


function screenUpdate(cost)
{
	$('#cost').html(cost);
	$('[NAME="amount"]').val(cost + '00');
}

//-----------------------------------------------------------------

// Form Validation
$(function () {
			$('#submitBtn').formValidator({
				onSuccess	: function() { console.log('Success!'); },
				scope		: '#form-1',
				errorDiv	: '.errorDiv1'
			});
		});
			
		// EXECUTE PLUGIN ON DOM READY - END



