$(document).ready(function(){
	
	lang_code = $('meta[http-equiv="content-language"]').attr('content');
	
	$(window).ajaxStart(function(){
		$("img.loading").css("display","block");
	});
	$(window).ajaxStop(function(){
		$("img.loading").css("display","none");
	});

	var images = ["../img/original/20090808_Shanghai_SWFC_and_Jin_Mao_2647.jpg", "../img/original/Shanghai_from_the_SWFC.jpg", "../img/original/3289936125_ffa156dc29_o.jpg", "../img/original/flickr-3599402256-original.jpg"]
	//$('#bg_img_container').animateTransition( images );
	$('#bg_img_container').css('backgroundImage', 'url('+images[Math.floor(Math.random()*images.length)]+')');
});


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22614715-1']);
_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);
})();

(function()
{
	if($(".disqus").length)
	{
		$.ajaxSetup({
			headers: {"X-Requested-With":"XMLHttpRequest"}
	    });
		var hash = location.hash;
		var segments = hash.split("/");
		var blog_post = segments.slice(-1).toString();
		var blog_entry_id = blog_post.match(/\d+/i);
		$(".disqus").load("/blog/loadComments/"+blog_entry_id);
	}
})();

