$(document).ready(function(){ 

	var fd = new Date();
	var ft = fd.getTime();

	var flashvars = {};
	var params = {};
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "FitupApp";
	swfobject.embedSWF("main.swf?nocache="+ft, "no-flash", "800", "707", "10.0.0", "", flashvars, params, attributes);

	$(".gallery-image a").attr('rel', 'gallery').fancybox({
		 'transitionIn' : 'elastic',
		 'transitionOut' : 'elastic',
		 'easingIn' : 'easeOutElastic',
		 'easingOut' : 'easeInBack',
		'speedIn'		:	600, 
		'speedOut'		:	300, 
		'overlayShow'	:	true,
		'titleShow'		: false
	});

});

var popupWin = null;

function createPopup() {
	var url = "popup.html";
	if( !popupWin || popupWin.closed ) {
	
		popupWin = window.open( url, "popupWin", "status=no,width=626,height=436" );
	} else popupWin.focus();
}

function shareFacebook(location, title) {
	var e=encodeURIComponent;
	address = 'http://www.facebook.com/sharer.php?src=bm&v=4&i=1277427231&u='+e(location)+'&t='+e(title);
	goTo(address);
}

function goTo(a) {
	if( popupWin && !popupWin.closed ) {
		popupWin.goTo(a);
	} else {
		openPopup();
	}
}

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8551012-15']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
