Add an exampleNS.strToBase64 function

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding
Use exampleNS.strToBase64 in kml example
Minor change to the example externs file
Create valid KML documents

Thanks @bartvde.