// JavaScript Document


$(document).ready(function(){
	chkNavigation();
	
	initLazyLoad();
	
	if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
		iPhoneiPadHoverFix();
	}
});

function chkNavigation(){
	$("#nav li.selected").each(function(){
		//$(this).find("a").html('<img src="images/icon-selected.jpg"><br>' + $(this).find("a").html());
		var txt = $(this).find("a").html();
		$(this).find("div").html('<img src="images/icon-selected.jpg">');
	});
	
}

function initLazyLoad(){
	$(".lazyLoadImg").lazyload({ 
		effect : "fadeIn"
	});
}

function iPhoneiPadHoverFix(){
	$('#nav a').live('touchend', function(e) {
		var el = $(this);
		var link = el.attr('href');
		window.location = link;
	});
}

//Google Analytics
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-6816101-2']);
  _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);
  })();

