var heightli;
var heightTotal=0;
var i=0;
$(document).ready(function(){
	$("#consejos > ul").css("top",0);
	heightTotal=$("#consejos > ul").height();
	
	heightli=heightTotal;
	setTimeout(marquee, 3000);	
});
	
function marquee() {
	pos=intval($("#consejos > ul").css("top"));
	//alert($("#consejos > ul > li:first").css("top"));
	//height=$("#consejos > ul").height();
	
	var vel=2;

	if (heightli<=-10){
		//alert("asdasda");
		$("#consejos > ul").hide();
		$("#consejos > ul").css("top",380);
		$("#consejos > ul").show();
		heightli=heightTotal+380;
		//alert($("#consejos > ul").height()+pos);
		//$("#consejos > ul > li:last").after($("#consejos > ul > li:first").clone());
		//$("#consejos > ul > li:first").remove();
	}
	//if(heightli<pos)
	
	$("#consejos > ul").animate({top: "-="+vel+'px'}, "fast","linear",marquee);
	//$("#consejos > ul > li:last").after($("#consejos > ul > li:first"));
	heightli-=vel;
	
	/*
	function(){	
		$("#consejos > ul > li:last").after($("#consejos > ul > li:first"));
		//$("#consejos > ul").css({"top":"0px"});
		setTimeout(marquee, 3000);
	}
	*/
}

function intval (mixed_var, base) {
    // Get the integer value of a variable using the optional base for the conversion  
    // 
    // version: 1004.2314
    // discuss at: http://phpjs.org/functions/intval
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: stensi
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   input by: Matteo
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: intval('Kevin van Zonneveld');
    // *     returns 1: 0
    // *     example 2: intval(4.2);
    // *     returns 2: 4
    // *     example 3: intval(42, 8);
    // *     returns 3: 42
    // *     example 4: intval('09');
    // *     returns 4: 9
    // *     example 5: intval('1e', 16);
    // *     returns 5: 30
    var tmp;
 
    var type = typeof( mixed_var );
 
    if (type === 'boolean') {
        return (mixed_var) ? 1 : 0;
    } else if (type === 'string') {
        tmp = parseInt(mixed_var, base || 10);
        return (isNaN(tmp) || !isFinite(tmp)) ? 0 : tmp;
    } else if (type === 'number' && isFinite(mixed_var) ) {
        return Math.floor(mixed_var);
    } else {
        return 0;
    }
}

