$(document).ready(function() {
	$(window).trigger('resize');
	
	$("#twitterBox div.tweets").getTwitter({
		userName: "eigenwegwijs",
		numTweets: 5,
		loaderText: "Tweets aan het laden...",
		slideIn: false,
		showHeading: false,
		showProfileLink: false,
		showTimestamp: false,
		onComplete: function () { initiazeTwitterBox(); }
	});
});

$(window).resize(function () {
	if ($('div#navigationBg').length > 0) {
		var newHeight = $('#pageBox').height();
		$('div#navigationBg, div#grassBg').height(newHeight);
	}
});

function initiazeTwitterBox () {
	if ($('#twitterBox').length > 0) {
		var ulList = $('#twitterBox div.tweets ul');
		var countItems = $(ulList).find('li').length;
		
		if (countItems > 1) {
			setInterval(function (list, cI) {
				var currentTopPos = parseInt($(list).css('top'))*-1;
				var nextTopPos = -currentTopPos - 65
				
				if ((currentTopPos/65) >= (cI-1))
					nextTopPos = 0;
	
				$(list).css('top', nextTopPos);
			}, 4000, ulList, countItems);
		}
	}
}

var tarzana = {
  src: 'swf/tarzana_italic.swf'
};

var square721bt = {
  src: 'swf/square721bt.swf'
};

sIFR.activate(tarzana, square721bt);

sIFR.replace(tarzana, {
  selector: 'body#pageHome h1, h2.subtitle',
  wmode: 'transparent',
  css: [
	'.sIFR-root { color: #7bb026; font-size: 24px; }'
  ]
});

sIFR.replace(tarzana, {
  selector: 'h1',
  wmode: 'transparent',
  css: [
	'.sIFR-root { color: #1a171b; font-size: 24px; }'
  ]
});

sIFR.replace(square721bt, {
  selector: 'body#pageHome div#mainNavigationBox div.contactInfo',
  wmode: 'transparent',
  css: [
	'.sIFR-root { color: #FFFFFF;}',
	'a { color: #FFFFFF; text-decoration: underline;}',
	'a:hover { color: #FFFFFF; text-decoration: none;}'
  ]
});

sIFR.replace(square721bt, {
  selector: 'div#headerBox div.headerBoxInner2 div.contactInfo span.email',
  wmode: 'transparent',
  css: [
	'.sIFR-root { color: #FFFFFF; text-align: center;}',
	'a { color: #FFFFFF; text-decoration: none;}',
	'a:hover { color: #FFFFFF; text-decoration: underline;}'
  ]
});

sIFR.replace(square721bt, {
  selector: 'div#headerBox div.headerBoxInner2 div.contactInfo span.phone',
  wmode: 'transparent',
  css: [
	'.sIFR-root { color: #FFFFFF;}'
  ]
});
