
var SubtleTemplateGitHubBadge = (function(options){
	function Badge(DATA){
		// console.log(DATA);
		Badge.element.adopt(new Badge.Template(DATA.user.repositories));
	};
	
	window.addEvent('domready',function(){
		Badge.element = $(options.element);
		Badge.Template = new SubtleTemplate($(options.templateElement));
		new Element('script', {src: 'http://github.com/api/v1/json/'+ options.username +'?callback=SubtleTemplateGitHubBadge' }).inject(document.body);
	});
	
	return Badge;
})({
	username: 'subtleGradient',
	templateElement:'github-badge-template',
	element:'github-badge'
});


/*
(function(){
	if(!window.orientation)return;
	
	window.addEventListener('load',function(){

		function FIX(selector){

			var node = document.querySelector(selector);
			var fix = function(e){
				// if(!e.touches) return;
				var s = window.getComputedStyle(node,null)

				node.style.position = 'absolute';
				node.style.top = window.pageYOffset + 'px';

				setTimeout(function(){fix(e)}, 0);
			}

			document.addEventListener('touchmove', fix);
			document.addEventListener('touchstart', fix);
			document.addEventListener('touchend', fix);
			document.addEventListener('touchcancel', fix);
		}
		// FIX('#toolbar')

		function oriental(e){
			
			switch(window.orientation){
			case 0: // Landscape
				$(document.body)
				.removeClass('left')
				.removeClass('right')
				.removeClass('wide')
				.addClass('tall');
				break;
			case 90: // Left
				$(document.body)
				.removeClass('right')
				.removeClass('tall')
				.addClass('left')
				.addClass('wide');
				break;
			case -90: // Right
				$(document.body)
				.removeClass('left')
				.removeClass('tall')
				.addClass('right')
				.addClass('wide');
				break;
			default:
				
			}
			
		};
		// document.addEventListener('orientationchange', oriental);
		
		// document.addEventListener('gestureend',function(e){
		// 	var f = [];
		// 	for (var property in e) {
		// 		f.push(property)
		// 	}
		// 	alert(f.join(", "))
		// });
		
		

	},true);
	
	
})()

// document.addEventListener('gestureend',function(e){
// 	alert(e.scale)
// });
// document.addEventListener('scroll',function(e){ alert('' + e) });
// document.addEventListener('resize',function(e){ alert('' + e) });
// document.addEventListener('resize',function(e){ alert('' + e) });
document.addEventListener('orientationchange',function(e){
	ff = [];
	for (var property in window.screen) {
		ff.push(property)
		ff.push(window.screen[property])
	}
	ff.push('screenX: '+window.screenX)
	ff.push('screenY: '+window.screenY)
	alert(ff.join(', '))
});
*/

