$(document).ready(function(){
	
	$('#codetype').change(function(){
		var codetype = $('#codetype').val();
		if(codetype == 5){
			$('#check_char option[value="N"]').attr('selected','selected');
		} else {
			$('#check_char option[value="Y"]').attr('selected','selected');
		}
		
	})
	
	$('#code_form').submit(function(){
		var codes = $('#code_textarea').val();
		var series = ($('#series_radio').attr('checked'))?true:false;
		if(series){
			var total_codes = (parseInt($('#last_code').val()) - parseInt($('#start_code').val()))/(parseInt($('#inc_code').val()));
			if(parseInt(total_codes) > 100){
				alert('Note: The FREE Barcode Generator can produce up to 100 barcodes at a time, please create a Serialio.com store account to remove this limit');
				return false;
			}
		} else if(codes){
			var array_codes = codes.split('\n');
			if(array_codes.length>100){
				alert('Note: The FREE Barcode Generator can produce up to 100 barcodes at a time, please create a Serialio.com store account to remove this limit');
				return false;
			}
		}
	})
});