(function($) {
	//
	// plugin definition
	//
	$.fn.rollover = function(options) {
		//debug(this);
		// build main options before element iteration
		var opts = $.extend({}, $.fn.rollover.defaults, options);
		return this.each(function() {
			$this = $(this);
			
			// change the image link (the photo) to point to the quickview
			/*var quickviewLink = $(this).find('.rollover-link').attr('href');
			$(this).find('.photo-link').attr('href', quickviewLink);
			$(this).find('.photo-link').colorbox({ 
				opacity: .3
				, scrolling: false
				, onComplete: function() {
					$.fn.colorbox.resize()
					pageTracker._trackPageview($(this).attr('href'))
				}
				, maxWidth: '100%'
			});
			*/
			var overlaySelector = '.' + opts.className;
			var rolloverDiv = $('<div class="'+opts.className+'"/>')
			var rolloverStyle = {
				'position' : 'absolute',
				'text-align' : 'center',
				'z-index' : '100',
				'display' : 'none',
				'height' : '24px',
				'width' : '102px',
				'margin-left' : opts.marginLeft + 'px',
				'margin-top' : opts.marginTop + 'px'
			};
			rolloverDiv.css(rolloverStyle);
			$this.prepend(rolloverDiv);
			rolloverDiv.append($this.find('.rollover-link'));
			$this.hover(
				function() {
					//$(this).find('img').fadeTo('fast', opts.fadeTo, function() {
						$(this).find(overlaySelector).show().children().show();
					//});
				},
				function() {
					//$(this).find('img').fadeTo('fast', 1, function() {
						$(this).find(overlaySelector).hide();
					//});
				}
			);
		});
	};
	//
	// private function for debugging
	//
	function debug($obj) {
		if (window.console && window.console.log)
		window.console.log('rollover selection count: ' + $obj.size());
	};
	//
	// plugin defaults
	//
	$.fn.rollover.defaults = {
		fadeTo:1,
		height: 290,
		width: 220,
		marginLeft: 59,
		marginTop: 130,
		fontSize: 12,
		className: 'overlay'
	};
	//
	// end of closure
	//
})(jQuery)

