var clip = null;
$(function(){
	// setup single ZeroClipboard object for all our elements
	ZeroClipboard.setMoviePath('/javascripts/ZeroClipboard.swf');
	clip = new ZeroClipboard.Client();
	clip.setHandCursor( true );
	
	// assign a common mouseover function for all elements using jQuery
	$('span.couponCode').mouseover( function() {
		// set the clip text to our innerHTML
		clip.setText( this.innerHTML );
		
		// reposition the movie over our element
		// or create it if this is the first time
		if (clip.div) {
			clip.receiveEvent('mouseout', null);
			clip.reposition(this);
		}
		else clip.glue(this);
		
		// gotta force these events due to the Flash movie
		// moving all around.	 This insures the CSS effects
		// are properly updated.
		clip.receiveEvent('mouseover', null);
		var coupon_url = $(this).parent('a').attr('href');
		clip.addEventListener('onComplete', function(){ document.location = coupon_url });
	} );
})