$(document).ready(function()
{
	$(".download_link").bind("click", function()
	{
		var destination = "/sitesync2/downloaded/";
		setTimeout("window.location='" + destination + "'",3000);
		return true;
	});
});

function ShowNextSlide()
{
	if(currentSlide >= slides.length - 1)
		currentSlide = 0;
	else
		currentSlide++;
	ShowSlide(currentSlide);
}

function ShowSlide(index)
{
	currentSlide = index;	
	$("#imgSlideShow").stop(true, true);
	$("#imgSlideShow").fadeOut("fast", function()
	{
		$(".li_feature").css("list-style-image", "url('/images/bullet_blue.png')").children("a").css("font-weight", "normal").css("color", "#fff");
		$("#liFeature" + slides[index].id).css("list-style-image", "url('/images/bullet_white.png')").children("a").css("font-weight", "bold").css("color", "#9BBC49");
		$("#imgSlideShow").attr("src", "/images/screenshots/sitesync2/slides/" + slides[index].img).attr("title", slides[index].title).fadeIn("fast");		

	});					
}

function roundNumber(rnum, rlength) 
{ 
	//return Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);	
	return rnum.toFixed(rlength);
}

function ShowFeaturePopup(featureKey)
{
	var url = "/featurepopup.php?key=" + featureKey;
	var title = "Feature";
	$("#divPopupBoxContent").css("display", "block").load(url, function()
	{
		$('body').css(
		{
			'overflow': 'hidden'
		});
		$('#overlayscreen').css(
		{
			opacity: 0.7,
			'width': $(window).width(),
			'height': $(window).height(),
			'top': getScrollTop()

		}).fadeIn("slow");
		$("#hdrPopupBox").text(title);
		$('#popupbox').css(
		{
			top: getScrollTop() + (($(window).height() / 2) - ($("#popupbox").height() / 2))
		}).fadeIn("slow");
	});
	return false;
}

function HidePopup()
{
	$("div#popupbox").fadeOut("slow");
	$('div#overlayscreen').fadeOut("slow", function()
	{
		$('body').css('overflow', 'auto');
	});
}

function getScrollTop()
{
	var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;

	return h ? h : 0;
}

function dump(obj) {
    var out = '';
    for (var i in obj) {
        out += i + ": " + obj[i] + "\n";
    }

    alert(out);
}
