jQuery(function($){
	$('#bcr_packshot_1').hover(
      function(){$('#bcr_packshot').css('background-position','0 -312px');}, 
      function(){$('#bcr_packshot').css('background-position','0 0');}
    ).click(function(){
		this.target = '_blank';
	});
	$('#bcr_watch').hover(
		function(){ $(this).css('background-position','0 -43px'); }, 
      	function(){ $(this).css('background-position','0 0'); }
    ).click(function(){
		openOverlay(); 
    });
	shareFunc('bcr_share');
	$('#bcr_scroller li:last-child').css({ background:'none', marginBottom:'0', paddingBottom:'0' });
	$('#bcr_slider_vertical').slider({
		orientation: 'vertical',
		min: -100,
		max: 0,
		change: handleChange,
        slide: handleSlide
	});
});
function getAnchorAndAreaLinks(){ return $('a,area'); }
function handleChange(e, ui)
{
    var maxScroll = $("#bcr_scroller").attr("scrollHeight") - $("#bcr_scroller").height();
    $("#bcr_scroller").animate({ scrollTop: -ui.value * (maxScroll / 100)}, 1000);
}
function handleSlide(e, ui)
{
    var maxScroll = $("#bcr_scroller").attr("scrollHeight") - $("#bcr_scroller").height();
    $("#bcr_scroller").attr({ scrollTop: -ui.value * (maxScroll / 100)   });
}
function shareFunc(id){
	var el = document.getElementById(id);
	var el_anchors = el.getElementsByTagName('a');
	for(var i=0; i<el_anchors.length; i++){
		extendOnClick(el_anchors[i],function(evt,that){
			var rel = that.getAttribute('rel');
			switch(rel){
				case 'facebook':
				case 'twitter':
				case 'myspace':
				case 'digg':
				case 'stumbleupon':
				case 'myspace':
				case 'delicious':
					share.send(rel);
				break;
				default:
					alert('This share does not exist');
			}
			return false;
		});
	}
}
