
$(document).ready(function(){
													 jQuery(".potind").hide();
  jQuery('#nav').find('a[href='+window.location.href+']').attr('class', function() {
  return this.id + 'active' });
	
		jQuery("#nextbtn").bind("click",function() {
  	showNext();
	});
	
window.setTimeout("moveDxIcon()",2000);
	
});/*ready*/

function moveDxIcon()
{
	//alert("qui");
	if(jQuery(".potcasa").is(':hidden'))
	{
		jQuery(".potind").hide();
		jQuery(".potcasa").show();
	}
	else
	{
		jQuery(".potcasa").hide();
		jQuery(".potind").show();
	}
	setTimeout("moveDxIcon()",2000);
}

function showNext()
{
	$('#nextbtn').unbind('click');
	ml=  $(".boxpromo-container ul").css('marginLeft').replace("-",'');
	ml= parseInt( ml.replace("px",""));
	w=parseInt($(".boxpromo-container ul").width());

	if((ml+168)>=w)
	{
		$(".boxpromo-container ul").animate({
		 marginLeft: '+='+ml
		}, 500, function(){
						jQuery("#nextbtn").bind("click",function() {
						showNext();
					});
			});
	}
	else
	{
		$(".boxpromo-container ul").animate({
		 marginLeft: '-=168'
		}, 500, function(){
						jQuery("#nextbtn").bind("click",function() {
						showNext();
					});
			});
	}
}
