You can simplify this a bit with the following code. You might also want to consider just making it a function off of the demo namespace.
```javascript
var language = navigator.userLanguage || navigator.language;
defaultLangauge = language.substring(0,2).toLowerCase();
````