Why are my variables not declaring outside a function

What im trying to do here is get the coordinates data from the html5 geolocation feature and declaring them to variables so that i can manipulate them. but for some reason when i go outside the function the values are undefined. Got any ideas on how I can combat this???help