
$(document).ready(function(){
	$('ul.spy').simpleSpy('5','5000');
			$('ul.spy li').reverseOrder(); 
	
});
(function ($) {
$.fn.reverseOrder = function() {
	return this.each(function() {
		$(this).prependTo( $(this).parent() );
	});
};
$.fn.simpleSpy = function (limit, interval) {
    limit = limit || 5;
    interval = interval || 5000;
    
    return this.each(function () {

        var $list = $(this),
            items = [],
            currentItem = limit,
            total = 0, 
            start = 0,
            startdelay = 5000;
            height = $list.find('> li:first').height();

        $list.find('> li').each(function () {
            items.push('<li>' + $(this).html() + '</li>');
        });
        
        total = items.length;
        
        $list.wrap('<div class="spyWrapper" />').parent().css({ height : height * limit });

        $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();
    
        function spy() {

            var $insert = $(items[currentItem]).css({
                height : 0,
                opacity : 0,
                display : 'none'
            }).prependTo($list);

            $list.find('> li:last').animate({ opacity : 0}, 1000, function () {
              
                 $insert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000);

                    $(this).remove();
            
            });
            
            currentItem++;
            if (currentItem >= total) {
                currentItem = 0;
            }
            
            setTimeout(spy, interval)
        }
        
        if (start < 1) {
               setTimeout(spy,startdelay);
                start++;
            } else {
            spy();
            }
        
    });
};
    
})(jQuery);



$(function() {
$(".vote").click(function() 
{
var id = $(this).attr("id");
var par = $(this).attr("par");
var name = $(this).attr("name");
var dataString = 'par='+ par ;
var dataString = 'id='+ id ;
var parent = $(this);
if(name=='up')
{

$.ajax({
   type: "POST",
   url: "blocks/up_vote.php",      
   data: dataString,
   cache: false,
   success: function(html)
   {
    parent.html(html);
 } }); }
else
{

$.ajax({
   type: "POST",   
   data: dataString,
   cache: false,
   url: "blocks/up_vote.php",
   success: function(html)
   {
	   $('#love'+id).html(html);
  }   
 });
}
return false;
	}); });

function showHint(str)
{
if (str.length==0)
  {
  document.getElementById("test").innerHTML="";
  document.getElementById("test").innerHTML=" ";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4) 
  {
  	if(xmlhttp.status==200) 
    {
    document.getElementById("test").innerHTML=xmlhttp.responseText; 
    }
    
   }
   else 
   {
   	document.getElementById("test").innerHTML='<div align="center"><img src="ajax-loader.gif"></div>'; 
   }
  }
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}

  function scrollit()
  {for (I=100; I>=1; I--)
  {self.scroll(1,I)}}

