// JavaScript for andiministrator.de


// Define vars for the animated favicon
var bcolor = '#d60';
var fcolor = '#fff';
var text = 'Andiministrator';
var textlen = text.length*-7;
var n = 16;
var ctx;
var	icon;


// Load function to run after side has load
$(function(){ 
	$(window).bind("load", function(){
		// load javascript for twitter Button
		//$.getScript('http://platform.twitter.com/widgets.js');
		// load javascript for linkedin Button
		//$.getScript('http://platform.linkedin.com/in.js');
		// load google +1 button
		//$('#sidebarpluseins').html('<script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang:\'de\'}</script>Google-Freunde klicken hier: <g:plusone size="medium"></g:plusone>');
		// load facebook like box
		//$("#sidebarfacebook").html('<script src="http://connect.facebook.net/de_DE/all.js#xfbml=1"></script><fb:like layout="box_count" show_faces="false" width="300" height="80" font="verdana"></fb:like>');
		//$('#sidebarfacebook').html('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fandiministrator.de%2F&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:80px;" allowTransparency="true"></iframe>');
		// animate favicon
		ctx = document.getElementById('favicon_canvas').getContext('2d'); 
		icon = document.getElementById('favicon1');
		if ($.browser.webkit || $.browser.opera) {
			setInterval(faviconFrame, 100);
			$('#favicon2 #favicon3').remove();
		} else {
			$('#favicon1').remove();
		}
	});
})


// function libary

function faviconFrame() {

	ctx.fillStyle = bcolor;
    ctx.fillRect (0, 0, 16, 16);
	ctx.clearRect(0,0,1,1);
	ctx.clearRect(15,0,1,1);
	ctx.clearRect(0,15,1,1);
	ctx.clearRect(15,15,1,1);

	ctx.textBaseline = 'top';
	ctx.font = 'bold 12px Optimer,Verdana';
	ctx.fillStyle = fcolor;
	ctx.fillText(text, n, 1);
	n = n-1;
	if (n<=textlen) n = 16;

	icon = document.getElementById('favicon1');
	(newIcon = icon.cloneNode(true)).setAttribute('href',ctx.canvas.toDataURL());
	icon.parentNode.replaceChild(newIcon,icon);

}


// EOF
