$(document).ready(function() {
   $('#addfav > a').live('click', function() {
   	addfav(this);
   	return false;
  });
   	
   $('#cosplayersubnav ul > li > a').click(function() {
   	var section = $(this).attr('id');
   	var showtype = $(this).attr('name');
   	var cosplayerid = $(this).attr('rel');
   	var numRand = Math.floor(Math.random()*101)
   	
   	$.ajax({
   		method: "get", url: "../func2/showcostume.php", data: "a=" + cosplayerid + "&t=" + showtype + "&s=" + section + "&rand=" + numRand,
   		beforeSend: function(){$('#celestialcostumes').html('<div class="normal"><img src="../func2/images/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#celestialcostumes').html(html);
   		}
   	});
   	return false;
  });
  
  $('#favbutton').click(function() {
  	$('#favcategories').toggle('fast');
  	return false;
  });
  
  function profilepopup(item) {
  	var showid = $(item).attr('id');
  	var showtype = $(item).attr('name');
  	var numRand = Math.floor(Math.random()*101)
  	
  	$.ajax({
   		method: "get", url: "../func2/profilepopup.php", data: "a=" + showid + "&type=" + showtype + "&r=" + numRand,
   		beforeSend: function(){$('#profilesection').html('<div class="normal"><img src="../func2/images/loading.gif"> Please Wait...</div>');},
   		success: function(html){ 
   			$('#profilesection').html(html);
   			
        $('#profilesection').show();
   		}
   	});
  }
  
  $('#favitems li > a').click(function() {
  	profilepopup(this);
   	return false;
  });
  
  $('.profileicon > a').click(function() {
  	profilepopup(this);
  	return false;
  });
 
 });
