$(document).ready(function(){
	$(function($) { $('#BBClock').jclock(); return false;});
	$("div#CBF").mouseover(function () { $(this).css('background-color','aaaaaa'); 	$(this).css('color','ffffff'); return false; });
	$("div#CBF").mouseout(function () { $(this).css('background-color','transparent'); $(this).css('color','000000'); return false; });
	$("div#CBF").click(function () { $("#CBFL").slideToggle(400); return false; });


	$("a#ministest").click(function () { 
	$.ajax({url: "messages.php", cache: false, success: function(html){ $("div#INNERPAGE").empty().append(html); return false; }});
	});


	//$.getJSON("ajax.php", function(data) { $.each(data.items, function(i,item) { $("<img/>").attr("src", item.media.m).appendTo("#CBFL"); if ( i == 3 ) return false; 	}); });

  /* Support System */
  $('div.demo-show> div.supportpost').hide();
  $('div.demo-show> span.supporttask').click(function() {
    var $nextDiv = $(this).next();
    var $visibleSiblings = $nextDiv.siblings('div.supportpost:visible');
    var ids = $nextDiv.attr('id').split('_');
    var id = (ids[(ids.length-1)]);

    $(function() { $nextDiv.load('ajax/support-task.php?function=showtask&id=' + id).slideToggle('fast'); });
    $(function() { if ($visibleSiblings.length ) { $visibleSiblings.slideUp('fast'); }});
  });

      /* Top bar HNR link */
			$("#myHNR").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});
			$("#allHNR").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});
			
			/* UserDetails Torrent Activity link */
			$("#profileTorrentActivity").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});
			
			/* CPX SiteStats link */
			$("#admin-SiteStats").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});

			$("#viewNFO").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});
			$("#newUpload").fancybox({'autoDimensions' : true, 'type' : 'ajax', 'padding' : 1, 'easingIn' : 'swing','transitionIn' : 'elastic', 'scrolling' : 'no', 'onComplete'	:	function() { $("#fancybox-wrap").css('height',552); }});
			
			
			$(".thumbsnoaccess img").fadeTo("fast", 0.15); // This sets the opacity of the thumbs to fade down to 60% when the page loads
			$(".thumbs img").fadeTo("fast", 0.40); // This sets the opacity of the thumbs to fade down to 60% when the page loads
      $(".thumbs img").hover(function(){
       $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
      },function(){
       $(this).fadeTo("slow", 0.40); // This should set the opacity back to 60% on mouseout
      });
      
      $("img:not([title])").each(function() {$(this).attr("title", $(this).attr("alt"))})
});
