changed use of attr(checked) to prop(checked) to suit current version of jquery