Hey everyone, noob here. I've been working on setting up a quickview extension for my magento site and I'm having issues positioning the button in the bottom right corner of the product photo. The js uses top and left offsets to automatically position the button in the center. Here's what I'm working with:

Code:
Cmsmart.noConflict();
Cmsmart(function($) {
	var producturl;
	
	function geturlrewrite(){
		var mypath = arguments[0];
		var patt = /\/[^\/]{0,}$/ig;
		if(mypath){
			if(mypath[mypath.length-1]=="/"){
				mypath = mypath.substring(0,mypath.length-1);
				return (mypath.match(patt)+"/");
			}
			return mypath.match(patt);
		}
		return '';	
	}

	function urltrim(){
		return arguments[0].replace(/^\s+|\s+$/g,"");
	}

	function installquickview(){
		if (typeof CMSMART == 'undefined') return;
		var argInput = arguments[0];
		var productlistBlocks = $(argInput.productlistClassArr);
		var datasaved = [];
		var mypath = 'cmsmquickview/index/index';
		if(CMSMART.QuickView.BASE_URL.indexOf('index.php') == -1){
			mypath = 'cmsmquickview/index/index';
		}else{
			mypath = 'cmsmquickview/index/index';
		}
		var baseUrl = CMSMART.QuickView.BASE_URL + mypath;
		
		var _quickviewbutton = '<a id="cmsmart_quickview_button" href="#">' + CMSMART.QuickView.BOTTON_LABEL + '</a>';
		var _quickform = '<div id="csmm_quickform">' + 
			'<div id = "quickviewshow" ></div>' + 
		'</div>';

		$(document.body).append(_quickform);
		$(document.body).append(_quickviewbutton);

		var quickviewButton = $('#cmsmart_quickview_button');
		//alert(encodeURIComponent(CMSMART.QuickView.BASE_URL + 'ab=3dfd&ddfdfd=234'));
		$.each(productlistBlocks, function(i, vl){
		var productlist = $(vl);
		$.each(productlist, function(index, value) {
			var reloadurl = '';
			
			var aClass = argInput.aClass[i]?argInput.aClass[i]:argInput.aClass[0];
			producturl = $(aClass, value);

			if(producturl.attr('href')){
				var producturlpath = producturl.attr('href').replace(CMSMART.QuickView.BASE_URL,"");
				//var producturlpath = geturlrewrite(producturl.attr('href'))[0];
				//producturlpath[0] == "\/" ? producturlpath = producturlpath.substring(1,producturlpath.length) : producturlpath;
				//producturlpath = urltrim(producturlpath);
				
				reloadurl += baseUrl+ ("/path/"+producturlpath).replace(/\/\//g,"/");
				//alert(reloadurl);
				var imgClass = argInput.imgClass[i]?argInput.imgClass[i]:argInput.imgClass[0];
				$(this).bind('mouseover', function() {
					//var o = $(this).offset();
					//var o = $(this);
					var o = $(imgClass+':eq(0)', this);

					$('#cmsmart_quickview_button').attr('href',reloadurl).show()
						.css({
						'top': o.offset().top+(o.height() - quickviewButton.height())/2+'px',
						'left': o.offset().left+(o.width() - quickviewButton.outerWidth())/2+'px',
							'visibility': 'visible'
						});
				});
				$(value).bind('mouseout', function() {
					$('#cmsmart_quickview_button').hide();
				});
			}
		});
		});

		if(CMSMART.QuickView.CENTER)
		{ 
			$("#quickviewshow").css('margin', ($(window).height() / 2 - $("#quickviewshow").height() / 2) + "px auto auto auto"); 
		}
			
		$('#cmsmart_quickview_button')
			.bind('mouseover', function() {
				$(this).show();
			})
			.bind('click', function() {
				idbyurl = ($(this).attr('href')).replace(/\W/g,"");
				showqv();
				$("#quickviewshow").html('<a id="cmsmart_quickview_button_close" title="Close Quick View"> </a><a class="quickviewloading"><a>');
				$("#cmsmart_quickview_button_close").on( "click", function() {
					closeqv();
					$("div.zoomContainer").remove();
				});
				
				$(this).hide();			
				if(datasaved[idbyurl]){
					$("#quickviewshow").html('<a id="cmsmart_quickview_button_close" title="Close Quick View"> </a>');
					$("#cmsmart_quickview_button_close").on( "click", function() {
						closeqv();
					});
					$("#quickviewshow").append(datasaved[idbyurl]);				
					showqv();				
					relimg();
					return false;				
				}			
				else{
					$.ajax({
						url: $(this).attr('href'),
						cache: false
					}).done(function( html ) {
						
						$("#quickviewshow").html('<a id="cmsmart_quickview_button_close" title="Close Quick View"> </a>');
						$("#cmsmart_quickview_button_close").on( "click", function() {
							closeqv();
							$("div.zoomContainer").remove();
						});													
						$("#quickviewshow").append(html);					
						showqv();						
						datasaved[idbyurl] = html;
						relimg();
					});
				}

				return false;
			});
			
			$('#csmm_quickform').click(function(e) {
				if($(e.target).is('#quickviewshow, #quickviewshow *')) return;
				$('#csmm_quickform').hide();
				$("div.zoomContainer").remove();
			});
			
	}

	$( document ).ready(function() {
		installquickview(CMSMART.QuickView.BUTTON_CONFIG);
	});
	
	$(window).resize(function() {
		$("#quickviewshow").css('margin', ($(window).height() / 2 - $("#quickviewshow").height() / 2) + "px auto auto auto");
	});
	
	
	function relimg(){
		maxh = $('div.product-quickview').outerHeight() - 45;
		if($('div.qvtabhead')) maxh = maxh - $('div.qvtabhead').outerHeight();
		if($('div.qvformaddtocart')) maxh = maxh - $('div.qvformaddtocart').outerHeight();
		if($('div.tabquickshow')) $('div.tabquickshow').css('max-height', maxh + "px");	
		
		//submitbqv();
		$('#showlargeimg').elevateZoom({ zoomWindowWidth:300, zoomWindowHeight:300, borderSize: 2, zoomWindowOffetx:15, cursor:'move' });
		 $('#mycarousel').jcarousel({
			scroll: 4
		});
	
		$("li img.p_image_hover").click(
			function () {
				smallImage = $(this).attr('src');
				largeImage = $(this).attr('data-zoom-image');
				$('img#showlargeimg').attr('src', smallImage);
				var ez = $('#showlargeimg').data('elevateZoom');
				ez.swaptheimage(smallImage, largeImage);
			}
		);
	
		$('a.tabquickviewcontrol').click(
			function(){		
				$('a.tabquickviewcontrol').removeClass("highlight");
				$(this).addClass("highlight");
				var divsl = $(this).attr('href');
				$('.tabquickshow').css('display', 'none');
				$(divsl).css('display', 'block');
				return false;
			}
		)
	}
	
	function showqv(){ $("#csmm_quickform").css("display", "block"); }
	function closeqv(){ $("#csmm_quickform").css("display", "none"); }
	
	function btcloseqv(){
		$("#cmsmart_quickview_button_close").on( "click", function() {
			$("#csmm_quickform").css("display", "none");
		});
	}
	
	function submitbqv(){
		var fr = $('#product_addtocart_form');
		var btc = $('.btn-cart', fr);
		
		btc.attr('onclick', '');
		btc.click(function(){
			var cansubmit = true;
			$('select.required-entry', fr).each(function(){
				if($(this).val() == ''){
					$(this).addClass('validation-failed');
					$(this).focus();
					cansubmit = false;
					return false;
				}else { $(this).removeClass('validation-failed'); }
			});
			if(cansubmit) fr.submit();
		});
	}
	btcloseqv();
});
This part specifically determines the positioning:

Code:
$('#cmsmart_quickview_button').attr('href',reloadurl).show()
						.css({
						'top': o.offset().top+(o.height() - quickviewButton.height())/2+'px',
						'left': o.offset().left+(o.width() - quickviewButton.outerWidth())/2+'px',
							'visibility': 'visible'
						});
Here's a live preview of this (hover over product photo): Furniture

Any idea how to change the positioning of the button? I've googled extensively and haven't found a solution, and I'm a total noob at javascript. Any help/guidance would be greatly appreciated.