function refresh_leaderboard(){
	$.ajax({
   		method: "get", url: "/func/templates/topleaderboard.php", data: "nocache=" +Math.random(),
   		beforeSend: function(){$('#topleaderboard').html('<div class="normal"><img src="stuff/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#topleaderboard').html(html);
   		}
  });
  $.ajax({
   		method: "get", url: "/func/templates/bottomleaderboard.php", data: "nocache=" +Math.random(),
   		beforeSend: function(){$('#bottomleaderboard').html('<div class="normal"><img src="stuff/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#bottomleaderboard').html(html);
   		}
  });
}
function pic_count(picid) {
	$.get("/func/pichit.php", { p: picid} );
}
function acspic_count(picid) {
	$.get("/func/acspichit.php", { p: picid} );
}

function refreshadinterval() {
	refresh_leaderboard();
  setTimeout("refreshadinterval()", 30000);
}



function oneshot() {
   var timer;
        return function( fun, time ) {
            clearTimeout( timer );
            timer = setTimeout(fun, time );
        };
    } 

var suggestOneshot = oneshot(); 

function lookup() {
	var inputString = $('#inputString').val();
    if(inputString.length > 2) {
        $.ajax({
   				method: "get", url: "/func/pullcosplayer.php", data: "q=" +inputString,
   				beforeSend: function(){$('#cosplayers').html('<div class="normal"><img src="stuff/loading.gif"> Please Wait...</div>');},
   				success: function(html){ 
   					$('#cosplayers').html(html);
   				}
  		});
    }
}

function changedate() {
  $('#fixdate').show();
}

		
$(document).ready(function() {
	$('#fixdate').hide();
	
   $('#cosplayersnavigation a').click(function() {
   	var cosplayertype = $(this).attr('name');
   	$.ajax({
   		method: "get", url: "showcosplayers.php", data: "t=" +cosplayertype,
   		beforeSend: function(){$('#cosplayers').html('<div class="normal"><img src="stuff/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#cosplayers').html(html);
   		}
   	});
   	return false;
  });
  
  $('#seriesnavigation a').click(function() {
   	var seriesletter = $(this).attr('name');
   	$.ajax({
   		method: "get", url: "showseries.php", data: "t=" +seriesletter,
   		beforeSend: function(){$('#series').html('<div class="normal"><img src="stuff/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#series').html(html);
   		}
   	});
   	return false;
  });
	$("#highlightfield").click(
 		function(){
 			// only select if the text has not changed
  		
  		this.select();
  		
 		}
	)  
  
});

