I think there was something similar already done... Must dig the post out.