/**
 * @param idElement string the element to be used for copying the link data.
 * 
 */
function clipboard(idElement) {
	try {
		Copied = document.getElementById( idElement ).createTextRange();
		Copied.execCommand("RemoveFormat");
		Copied.execCommand("Copy");
	}
	catch(e) {
		document.getElementById( idElement ).select();
	}
}

/*** USES JQUERY TO ANIMATE THE LEMMING AT THE TOP RIGHT OF THE PAGE ON THE GAME PLAY TEMPLATE ***/ 

function gaminatorAnimator() {
	var fadeDuration = 150; 
    $('#gaminatorAnimator').hover(function() {
      $(this).animate({ right: 125, bottom: 13 }, fadeDuration);
      $('#animatorBubble').show().animate({ right: 40 }, fadeDuration);
    }, function() {
      $(this).animate({ right: 128, bottom: 11 }, fadeDuration);
      $('#animatorBubble').animate({ right: 40 }, fadeDuration).fadeOut(fadeDuration);
    });
}

/*** FUNCTION TO HIDE/SHOW LIST ITEM DESCRIPTION DATA AND ROLLOVER IMAGE ON HOVER. THE ONE PARAMETER
IS THE PATH TO THE HOVER IMAGE - CALLED ON EITHER THE GAMES OR SHOWS INDEX PAGE IT CALLS THE RELEVANT IMAGE ***/ 

function contentItemsHover(imgPath) {
  var srcImg;
  $(".contentItems li").hover(
		  function() {
		      srcImg = $(".itemImg", this).attr("src");
		      $(".itemImg",this).attr({src: imgPath});
		      $(".itemLongDesc",this).show();
		      $(".itemRating",this).hide();
		      $(".itemTitle",this).hide();
		  },
		  function() {
		      $(".itemImg",this).attr({src: srcImg});
		      $(".itemLongDesc",this).hide();
		      $(".itemRating",this).show();
		      $(".itemTitle",this).show();
		  }
  );
  /*$(".contentItems li").bind("mouseover", 
    function() {
      srcImg = $(".itemImg", this).attr("src");
      $(".itemImg",this).attr({src: imgPath});
      $(".itemLongDesc",this).show();
      $(".itemRating",this).hide();
      $(".itemTitle",this).hide();
    });
		
  $(".contentItems li").bind("mouseout", 
    function() {
      $(".itemImg",this).attr({src: srcImg});
      $(".itemLongDesc",this).hide();
      $(".itemRating",this).show();
      $(".itemTitle",this).show();
  });*/
}

/*** FUNCTION TO ENABLE HOVER STATES USING JQUERY ON NON-ANCHOR TAB ELEMENTS ON LIST
MODULES IN IE6. IT ALSO ENABLES AN UP STATE FOR THE GAMES LIST MODULE 'ALL GAMES' DROPDOWN MENU ***/ 
 
function moduleTabs() {
	$(".moduleTabs ul li").live("mouseover", function() {
		$(this).addClass("hover");
	});
	$(".moduleTabs ul li").live("mouseout", function() {
		$(this).removeClass("hover");
	});
		
	$(".moduleTabs ul li:first").live("mouseover", function() {
		$(".tab-dropdown").show();
	});
	$(".moduleTabs ul li:first").live("mouseout", function() {
		$(".tab-dropdown").hide();
	});
	
	$(".tab-dropdown").hover( function() {
		$(".tab-dropdown").closest("li").addClass("tab-current");

	}, function() {
		$(".tab-dropdown").closest("li").removeClass("tab-current");

	});
}


/*** FUNCTION TO ENABLE HOVER STATES USING JQUERY ON NON-ANCHOR ELEMENTS IN IE6. THE FIRST PARAMETER
IS THE DIV HOVERED OVER, THE SECOND PARAMETER IS THE ELEMENT BEING HIDDEN/SHOWN. IT IS HIDDEN 
 VIA CSS BY DEFAULT ***/ 
function modHover(trigger,target) {
	$(trigger).hover( function() {
		$(target).show();
	}, function() {
		$(target).hide();
	});
}


/*** FUNCTION TO HOVER THE ARROW ICON IN THE GAMES MODULE 'ALL GAMES' DROP DOWN LIST ***/ 
function tabToggle() {
	
	$(".moduleTabs ul li:first").live("mouseover", function() {
		$(".showDDIcon-up").hide();
		$(".showDDIcon-over").show();
	});
	$(".moduleTabs ul li:first").live("mouseout", function() {
		$(".showDDIcon-up").show();
		$(".showDDIcon-over").hide();
	});
}

/*** FUNCTION TO HOVER THE DOWNLOAD SIZE OPTION ON DOWNLOADS MODULE ***/ 
function downloadHover(){
	$("div.downloadsWrapper ul li").live("mouseover", function() {
		$(".downloadOptionWrapper", this).show();
	});
	$("div.downloadsWrapper ul li").live("mouseout", function() {
		$(".downloadOptionWrapper",this).hide();
	});
}

//callback from CHSCommentsList_Holder.swf updates the total comments aka "shout outs"
function SetTotalComments(ops){
	$('div.chat h2').text(ops.nTotalItems+ " SHOUT-OUTS");
	return true;
}