// Start Showcase Features immediately
$(document).ready(function(){
	
	var open=function(hash){ hash.w.css('opacity',1).show(); };
	var close=function(hash) { hash.w.fadeOut('2000',function(){ hash.o.remove(); }); };
	
	$("#ChangeLogWindow").jqm(
	{
		trigger: 'a#changelog', 
		modal: false, 
		overlay: 50,
		onShow: open,
		onHide: close
	});
	
	$("#FAQWindow").jqm(
	{
		trigger: 'a#faq', 
		modal: false, 
		overlay: 50, 
		onShow: open,
		onHide: close
	});

	$('#screenshots').nivoSlider(
	{
		effect:'random',
		animSpeed:300,
		pauseTime:5000,
		startSlide:0,
		pauseOnHover:false,
		directionNav:false,
		controlNav:false,
		controlNavThumbs:false
	});


	var featureList = [];
    var url = "config/features.json";
    
    $.getJSON(url, function(json)
    {
    	$.each(json.features, function(i, feature)
    	{
    		featureList[i] = [];
    		featureList[i]['id'] = feature['id'];
    		featureList[i]['text'] = feature['text'];
    	});
    	
		var currentFeature = 1;
		
		setInterval(function()
		{
			$("#features").fadeOut("slow", function()
			{
				$("#features").html(featureList[currentFeature]['text']).fadeIn("slow");
			});

			if (currentFeature == (featureList.length - 1))
				currentFeature = 1;
			else
				currentFeature++;	
		}, 6500);	    	
    });
    
});


/****** Google Analytics ******/

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

/****** End Google Analytics ******/
