<!--
function addFav(){
    var url      = "http://www.scopel.com.br";
    var title    = "Scopel";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

// -->

$(document).ready(function(){
	      // scrool das plantas
		  
		function hideArrowL(){
				 $('#arrowLCar').css('visibility','hidden'); 
		  }
		function hideArrowR(){
				 $('#arrowRCar').css('visibility','hidden'); 
		  }
		function showArrowL(){
				 $('#arrowLCar').css('visibility','visible'); 
		  }
		function showArrowR(){
				 $('#arrowRCar').css('visibility','visible'); 
		  }
		  
           var qtdP = $("#imgProduct ul li").size();
           var imgSizeP = -746;
           var imgSizePTemp = imgSizeP;
           var countP = 1; 
           hideArrowL();
		   if (qtdP == 1 ){
			   hideArrowR();
		   }
		   
	        $("#imgProduct").css("overflow-x","hidden");
	          
	        $("#arrowRCar").click(function() {    
			   showArrowL();
				if (countP == (qtdP - 1)){ 
					hideArrowR()
		      	};
		        if (countP < qtdP){ 
		            $("#imgProduct ul").stop();
		            $("#imgProduct ul").animate ({left: imgSizePTemp + "px"}, 1000 );
		            imgSizePTemp = imgSizeP + imgSizePTemp;
		            countP = countP + 1;
		      };
		      return false;
	        });
	      
	        $("#arrowLCar").click(function() {
		   		showArrowR();
				if (countP == 2){ 
                    hideArrowL()
		        };
	           if (countP <= qtdP && countP > 1){ 
		        $("#imgProduct ul").stop();
		        $("#imgProduct ul").animate ({left: imgSizePTemp - (2 * imgSizeP) + "px"}, 1000 );
		        imgSizePTemp = imgSizePTemp - imgSizeP;
		        countP = countP - 1;
		        };
		          return false;
	        });
        });

/*---------BY TIAGO BIAGE---------*/

function IsNumeric(value)
{
	var er = /^[0-9,\.]+$/;
	return (er.test(value)) ? true : false;
}

function vota(id)
{
	var aux, aux2;
	aux = '#gostei_'+id;
	aux2 = '#vota_'+id;
	$.ajax({
	type: "POST",
	url: "vota.php",
	data: "id="+id,
	cache: false,
	success: function(msg){		
		if(IsNumeric(msg))
		{
			$(aux).html('eu gostei!');
			$(aux2).html(msg);
			//$(aux).css({'display':'none'})
		}else
		{
			$(aux).html('eu gostei!');
			//$(aux).css({'display':'none'})
		}
	},
	error: function(error){
        alert('Problemas ao computar o voto, por favor tente mais tarde.');
    }
	});
}

function carrega_voto(id)
{
	var aux;
	aux = '#vota_'+id;
	$.ajax({
	type: "POST",
	url: "carrega_voto.php",
	data: "id="+id,
	cache: false,
	success: function(msg){		
		if(IsNumeric(msg))
		{
			$(aux).html(msg);
		}else
		{
			alert('Problemas ao computar o voto, por favor tente mais tarde.');
		}
	},
	error: function(error){
        //alert('Problemas ao computar o voto, por favor tente mais tarde.');
    }
	});
}

function verifica_voto(id)
{
	var aux;
	aux = '#gostei_'+id;
	$.ajax({
	type: "POST",
	url: "verifica_voto.php",
	data: "id="+id,
	cache: false,
	success: function(msg){		
		if(msg == 's')
		{		
			$(aux).html('eu gostei!');
			$(aux).css({'display':'none'})
		}
	},
	error: function(error){
        //alert('Problemas ao computar o voto, por favor tente mais tarde.');
    }
	});
}