var favify_count = 0;
favify_add = function() {
	favify_count += 1;
	var favify_url = 'http://afeverishdream.com/RGBify/';
	var file = 'rgb';
	var count = 3;
	if (Math.random() > .6) {
		file = 'rgb';
	}
	file += Math.ceil(Math.random()*count) + '.png';
	var div = document.createElement('div');
	div.style.position = 'fixed';
	
	var numType = 'px';
	var heightRandom = Math.random()*1;
	var windowHeight = 800;
	var windowWidth = 1900;
	var height = 0;
	var width = 0;
	var de = document.documentElement;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
		windowWidth = window.innerWidth;
	} else if(de && de.clientHeight) {
		windowHeight = de.clientHeight;
		windowWidth = de.clientWidth;
	} else {
		numType = '%';
		height = Math.round( height*30 )+'%';
	}
	
	div.onclick = favify_add;
	div.style.zIndex = 10;
	div.style.outline = 0;
	
	if( numType=='px' ) div.style.top = Math.round( windowHeight*heightRandom ) + numType;
		else div.style.top = height;
		div.style.left = Math.round( Math.random()*100 ) + '%';
	
	
	var img = document.createElement('img');
	img.setAttribute('src',favify_url+'img/'+file);
	var body = document.getElementsByTagName('body')[0];
	body.appendChild(div);
	div.appendChild(img);
	
	
}



