<button id="install" class="recommend">
  Install this App
</button>
<script>
	if('mozApps' in  navigator){
		(function(ic){
			ic.onsuccess = function(){
				if(ic.result){
					$('button#install').hide();
				}else{
					$('button#install').click(function(e){
						e.preventDefault();
						// install the app
						var installLocFind = navigator.mozApps.install(location.origin+'/bugs.webapp');
						installLocFind.onsuccess = function(data){
							apiState('page-index');
						};
						installLocFind.onerror = function(){
							// App wasn't installed, info is in
							// installapp.error.name
							error(installapp.error.name);
						};
						return false;
					});
				};
			};
		})(navigator.mozApps.checkInstalled(location.origin+"/bugs.webapp"));
	}else{
		$('button#install').hide();
	}
</script>
<h3>
	Welcome to Bugs
</h3>
<p>
	Bugs is a project issue tracker.
</p>
{{#if key}}
	<a class="button" href="#page-projects">
		Projects
	</a>
	<a class="button" href="#page-issues">
		Issues
	</a>
	<a class="button" href="#page-users">
		Users
	</a>
{{else}}
	<a class="button" href="#page-register">
		Register
	</a>
	<a class="button" href="#page-login">
		Login
	</a>
{{/if}}