var mySite = {

	start : function() {
		//this.morphBackground();
		//this.fancyMenu();
		this.smallFixes();
		//this.googleAnalytics();
		this.test();
	},

	smallFixes : function() {
		//$('#content').hide();
		//alert($.boxModel);
		$('#cv').click(function () {
			alert('upon request : plinfo@piotrlewandowski.info');
			return false;
			//$(this).slideUp();
		});

	},
	
	// morph function copied from DevonStudio (http://www.devonstudio.com/)
	morphBackground: function() {
		var colors = [
		'273434',	'342732',	'343327',
		'273433',	'342727',	'342734',
		'2e3427',	'27342e',	'0e171a'
		];
		
		var i = 0;
		function morph( color ) {
			$('html').animate({
				'backgroundColor': '#' + color,
				'color': '#' + color
			}, 5000, function() {
				morph( colors[ i = ( i >= ( colors.length - 1 ) ) ? 0 : ( i + 1 ) ] )
			});
		}
		
		morph( colors[i] );
	},

	fancyMenu : function() {
		$('#homeLink').toggle(function() {
			//$('#siteName').animate({marginTop: '150px'}, "slow");
			$('#siteName').animate({height: '100px', lineHeight: '100px'}, "slow");
			$('#content').slideDown();
			//$('#content').animate({width: '400px'}, "slow");
			//$('#siteName').animate({height: '100px'}, "fast");
			//$('#siteName').animate({marginTop: '150px'}, "fast");
		}, function() {
			//$('#content').animate({width: '300px'}, "slow");
			$('#content').slideUp();
			$('#siteName').animate({height: '30px', lineHeight: '30px'}, "slow");
			//$('#siteName').animate({marginTop: '95px'}, "slow");			
		});
	},

	googleAnalytics : function() {
		var GAID = 'UA-291581-4';
		var head = document.getElementsByTagName('head')[0];
		var scr = document.createElement('script');
		scr.type = 'text/javascript';
		scr.src = (location.protocol == 'http:' ? 'http://www.' : 'https://ssl.') + 'google-analytics.com/'+'urchin.js';
		var once = 0;
			function runMe() { 
				if (scr.readyState == 'loading' || urchinTracker == undefined || once) { return; }
				clearInterval(timer);
				once++;
				_uacct = GAID;
            var _uOsr=new Array();
            var _uOkw=new Array();
				_uOsr[0]="szukaj.onet.pl";	_uOkw[0]="qt";
            _uOsr[1]="szukaj.wp.pl";	_uOkw[1]="szukaj";
            _uOsr[2]="nesprint.pl";	_uOkw[2]="q";
            _uOsr[3]="google.interia.pl";	_uOkw[3]="q";
            _uOsr[4]="gooru.pl";	_uOkw[4]="PHRASE";
            _uOsr[5]="szukaj.gazeta.pl";	_uOkw[5]="slowo";
            _uOsr[6]="szukaj2.o2.pl";	_uOkw[6]="qt";
            _uOsr[7]="szukacz.pl";	_uOkw[7]="q";
            _uOsr[8]="search.live.com";	_uOkw[8]="q";
            _uOsr[9]="katalog.interia.pl";	_uOkw[9]="q";
            _uOsr[10]="szukaj.wow.pl";	_uOkw[10]="q";
            _uOsr[11]="szukaj.gery.pl";	_uOkw[11]="q";
            _uOsr[12]="katalog.onet.pl";	_uOkw[12]="qt";
				urchinTracker();
			}
		var timer = setInterval(runMe, 2000);
		scr['onload'] = runMe;
		scr['onreadystatechange'] = runMe;
		head.appendChild(scr);
	},
	
	test : function() {
		$('.href1').click(function(){
			$('#box1').animate({
				width: "400",
				height: "200",
				marginTop: "50"
			}, "slow", "elasout");
			//}, "slow");
			return false;
		});
		$('.href2').click(function(){
			$('#box1').animate({
				"height": "+=50px"
			}, "slow");
			return false;
		});
		$('.href3').click(function(){
			$('#box1').animate({
				marginTop: "100",
				"height": "-=100"
			}, "slow");
			return false;
		});
		$('.href4').click(function(){
			$('#box1').animate({
				width: "600",
				height: "300",
				marginTop: "100"
			}, "slow", "elasout");
			//}, "slow");
			return false;
		});
	}

}

function init() {
	mySite.start();
}

$().ready(init);