		var inicio 			= 3;
		var cantidad 		= 3;
	
		
		function mycarousel_itemLoadCallback(carousel, state)	{			
			if ( carousel.has(carousel.first, carousel.last)) {//state != "init" &&
				return;
			}			
			//para que no haga callback cuando se resetea con el cambio de operacion, tipo o provincia							
			if (state == 'prev')	return;		
						
			$.ajax({
			   type: "POST",
			   dataType: "json",
			   url: "/www/cajaespana/utils/ajax/productosEstrella.jsp",  
			   data: "inicio=" + inicio,
			   beforeSend: function(xhr) {

			   },
			   success: function(data) {		
			   		$("#mycarousel").css({height:"auto"})			
					mycarousel_aniadeElemento(carousel, data);									   					   		
			   }
			 });	
			 //cargaFooter();									
		};
		
		function mycarousel_aniadeElemento(carousel, elementos){				
			$.each(elementos, function(i,elemento){								
				html = 	'<div class="fotoCarrusel"><a href="'+elemento.href+'" target="_blank"><img src="' + elemento.src + '"  alt="' + urldecode(elemento.alt) + '" border="0" width="150" height="90" style="display:block;" /></a></div>';			
				html += '<div class="textoCarrusel">';
				if(typeof(elemento.nombre) != "undefined")
					html += '<a href="'+elemento.href+'" class="c2 tm1 noSubrayado"><b>' + urldecode(elemento.nombre) + '</b></a>' + '<br/>';
				
				html += '<a href="'+elemento.href+'" target="_blank" class="c2 tm4 noSubrayado">' + urldecode(elemento.zona) + '</a><br/>';
								
			    if(elemento.superficie != '' && elemento.superficie != null && typeof(elemento.superficie) != "undefined"){
			    	html += '<a href="'+elemento.href+'" target="_blank" class="c1 tm4 noSubrayado">m2 aprox.: ' +elemento.superficie + '</a><br/>';
			    }		    
			    
				if(elemento.precio != '' && elemento.precio != null && typeof(elemento.precio) != "undefined"){
			    	html += '<a href="'+elemento.href+'" target="_blank" class="c1 tm4 noSubrayado">' +urldecode(elemento.precio) + ' &euro;</a><br/>';
				}			   
				html += '</div>';
				carousel.add(carousel.first + i, html);								
				if(elemento.idAnuncio == idAnuncioCarousel){
					inicio = 3;
				}
			})
			inicio += cantidad;
			carousel.size(carousel.size() + cantidad );

		}		
		
		$(document).ready(function() {						
			$('#mycarousel').jcarousel({
				scroll: cantidad,
				/*animation:2000,*/	
				size:6,
				itemLoadCallback: mycarousel_itemLoadCallback				
			});			
		});//ready
		
		function verifica(){
			return true;
		}

		
		function debug(texto){		
			if(typeof(console) != 'undefined') console.info(texto);
		}			
		
		function urldecode(text) {	
			if(text != '' && text != null){
				text = unescape(text.replace(/\+/g,  " "));				
				return text;
			}				
			return text;
		}
