$(document).ready(function(){
      $(window).load(function(){
        $("html").addClass("html1");
      });

      
      
      
      
      var first = 0;        
     
      var actual = 0;    


       
       if (reffer_count > 1){
        
        
         var refreshId = setInterval(function(){
           if ((actual+1)==reffer_count){
              actual = 0;
            }else{
              actual++;
            }

          $.ajax({
            type: "get",
            url: httpRoot+"ajax/getreffer.php",
            cache: false,
            data: "randval="+ Math.random()+"&id="+reffer_array[(actual)],
            success: function(j){
              $("#refer").html(j);       
            }
          });
          

            
          }, 8000);
  
       }

            
      $("#refer_right").click(function(){
        //alert(actual);
        if (actual==last){
          actual=0;
        }else{
          actual++;
        } 
       $("#refer").html("");

        $.ajax({
          type: "get",
          url: httpRoot+"ajax/getreffer.php",
          cache: false,
          data: "randval="+ Math.random()+"&id="+reffer_array[(actual)],
          success: function(j){
            $("#refer").html(j);       
          }
        });

       

      });

      $("#refer_left").click(function(){
        if (actual==first){
          actual=last;
        }else{
          actual--;
        }
        
        $.ajax({
          type: "get",
          url: httpRoot+"ajax/getreffer.php",
          cache: false,
          data: "randval="+ Math.random()+"&id="+reffer_array[(actual)],
          success: function(j){
            $("#refer").html(j);       
          }
        });        
       

      });



  });
