// JavaScript Document

//Define Global vars for nextNews
i = 0;
time = 12000;
element = '#slide .rotation';
var actNextNews;
//End Define Global vars for nextNews

function refr() 
{
	window.location.reload( false );
}
function nextNews()
{
    var amount = $(element).length;
    if(amount > i+1)//amount > that number order (i+1) of .content
							{
									$(element).eq(i).fadeOut("fast");

                                    $(element).eq(i+1).fadeIn("fast");

									i++;
									clearTimeout(actNextNews);
							}
							else
							{
									$(element).eq(i).fadeOut("fast");

                                    $(element).eq(0).fadeIn("fast");
                                    
									i = 0;
									clearTimeout(actNextNews);
							}
   if(time != 0) actNextNews = setTimeout(nextNews,time);
}

$(document).ready(function(){
						   
/*	$("ul.fotos img.dragme").Draggable(
			{
				ghosting: true, 
				revert: true
			}
	);
	$("ul.fotos img.dragme").Droppable(
			{
				accept : 'dragme', 
				activeclass: 'comehere', 
				hoverclass:	'camehere',
				ondrop:	function (drag) 
						{
							a = $("ul.fotos").attr('id');
							//alert("Departamento: "+String(a)+", Mover el "+String(drag.id)+" antes del "+String(this.id));
							$.get("/admin/departamentos/cambiarordenfotos/"+a+"/"+drag.id+"/"+this.id, refr); 
							//window.location.href = "/admin/departamentos/cambiarordenfotos/"+a+"/"+drag.id+"/"+this.id;
						},
				fit: true
			}
	);*/
//Rotation Cites
$(element).eq(0).css({display:"block"});

$("a.control").click(function (){nextNews();});

if(time != 0)
{
    actNextNews = setTimeout(nextNews,5000);
}
	
});
