I am trying to create a hand-held type of menu for my responsive joomla site based on the J AT 3 framework.

I am using a JavaScript code to detect the width of the browser, and a php code to process the desktop menu if the width is greater than 450px and process the hand-held menu if the width is less than 450px. Please advice