That isn't DNN changing the names, that is ASP.NET changing the names. It does this to make sure that each control has a unique ID on the client. Say you had two server controls in an ASP.NET page, each with a textbox with the ID txtFirstName, what should ASP.NET do to make sure all IDs are unique? It builds a unique name out of the Page/Control hierarchy.
Each ASP.Net Control exposes a property called ClientID which gives you the unique control name that is legal to use on the client. You can dynamically create javascript and pass this ClientID to your script as the value of a JavaScript variable. ASP.NET has a bunch of APIs to help manage the transition from Server to Client programming. It isn't easy, but the plubming is there. Look for APIs like RegisterStartupScript and RegisterClientScriptBlock to find out more.
Even better is to use the DNN ClientAPI and its methods in ClientAPI.vb, the explanations in ClientAPITests, and the scripts in the JS folder. These wrap the ASP.NET APIs and give you a sturcture for managing your client script.