$(document).ready(function() {
	$('.slider ul').kwicks({
		min : 31,
		spacing : 0,
		sticky : true,
		event : 'mouseover'
	});
	
	$('#credits').overlay({
		mask: 'white',
		effect: 'apple',
		top: '15%',
		onBeforeLoad: function() {
			this.getOverlay().appendTo('body');
		}
	});
	
	$('a.popups').overlay({
		mask: '#ffffff',
		closeOnClick: false,
		onBeforeLoad: function() {
			this.getOverlay().appendTo('body');
			var wrap = this.getOverlay().find(".wrapiframe");
			var link = this.getTrigger().attr("href");
			wrap.html('<iframe width="100%" height="100%" scrolling="auto" frameborder="0" src="'+link+'"></iframe>');
		}
	});
	
	$('.frm-log').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	$("ul.tabs").tabs("div.panes > div");
	
	$("#pageflip").hover(function() { //On hover...
		$("#pageflip img , .msg_block").stop()
			.animate({ //Animate and expand the image and the msg_block (Width + height)
				width: '311px',
				height: '311px'
			}, 500);
		} , function() {
		$("#pageflip img").stop() //On hover out, go back to original size 50x52
			.animate({
				width: '50px',
				height: '50px'
			}, 220);
		$(".msg_block").stop() //On hover out, go back to original size 50x50
			.animate({
				width: '50px',
				height: '50px'
			}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
	});
	
		// install flowplayer into flowplayer container
	var player = $f("player", "/uploads/flash/flowplayer-3.2.2.swf");
	
	// setup button action. it will fire our overlay 
	$("a.pagepeel[rel]").overlay({
		mask: 'white',
		// use the Apple effect for overlay
		effect: 'apple',
		
		// when overlay is opened, load our player
		onLoad: function() {
			player.load();
		},
		
		// when overlay is closed, unload our player
		onClose: function() {
			player.unload();
		}
	});

	var pathname = window.location.pathname;
	$('span#loadSaldo').click(function() {
		$('#headers .users-area').load(pathname+' #divLogin');
	});
	
});

includeJavascript('/js/jsfonts/FuturaMedium_500.font.js','head');

Cufon.replace('.heading h1, .blogHead .titleTesta');
Cufon.replace('#sub-menu ul li a', {
	hover: true
});