function productGal() {
	var int = setInterval(function() {
		var white = $('#points .white_point');
		$(white).attr('class','grey_point');
		if ($(white).prev('.grey_point').length > 0) {
			$(white).prev('.grey_point').attr('class','white_point');
		}
		else {
			$('#points .grey_point:last').attr('class','white_point');
		}
		
		var visible = $('.anim_container .banner_box:visible');
		
		$(visible).find('.bg2').animate({ width:'1px' },400,'swing',function() {
			$(visible).find('.bg1').animate({ width:'1px' },400,'swing',function() {
				$(visible).css('display','none');
				
				if ($(visible).next('.banner_box').length > 0) {
					var next = $(visible).next('.banner_box');
				}
				else {
					var next = $('.anim_container .banner_box:first');
				}
				
				$(next).find('.bg1').css('width','1px');
				$(next).find('.bg2').css('width','1px');
				$(next).find('.img_banner').css('right','-250px');
				$(next).css('display','');
				$(next).find('.bg1').animate({ width:'288px' },400,'swing',function() {
					$(next).find('.bg2').animate({ width:'42px' },400,'swing');
				});
				$(next).find('.img_banner').animate({ right:'0px' },600,'swing');
			});
		});
		$(visible).find('.img_banner').animate({ right:'-250px' },600,'swing');
	},6000);
}

function showProduct(id) {
	maskOn();
	ajaxGetPage('producto.php?id='+id,'product');
	$('#product').fadeIn(600);
}

function closeProduct() {
	$('#product').fadeOut(600);
	maskOff();
}

function showLogin() {
	maskOn();
	$('#login').fadeIn(600);
}

function closeLogin() {
	$('#login').fadeOut(600);
	maskOff();
}

function showRegister() {
	maskOn();
	$('#register').fadeIn(600);
}

function closeRegister() {
	$('#register').fadeOut(600);
	maskOff();
}

function showForgot() {
	$('#forgot').fadeIn(600);
	$('#register').fadeOut(600);
	$('#login').fadeOut(600);
}

function closeForgot() {
	$('#forgot').fadeOut(600);
	maskOff();
}

function logToReg() {
	$('#login').fadeOut(600);
	$('#register').fadeIn(600);
}

function regToLog() {
	$('#register').fadeOut(600);
	$('#login').fadeIn(600);
}

function forgotToLog() {
	$('#forgot').fadeOut(600);
	$('#login').fadeIn(600);
}

function forgotToReg() {
	$('#forgot').fadeOut(600);
	$('#register').fadeIn(600);
}

function closeMessage() {
	$('#message').fadeOut(600);
	maskOff();
}

function maskOn() {
	if (!($('#mask').length > 0)) {
		$('body').prepend('<div id="mask"></div>');
		$('#mask').height($('body').height());
		$('#mask').width($('body').width());
	}
	$('#mask').fadeIn(600);
	document.getElementById('mask').style.filter  = "alpha(opacity=50)";

}

function maskOff() {
	if ($('#mask').length > 0) {
		$('#mask').fadeOut(600);
	}
}

$(document).ready(function(){
	productGal();
 });

 
