ZeroClipboard.setMoviePath(template_path+"/plugins/ZeroClipboard.swf");

var clip = null;
var url = '';

function init() {
	clip = new ZeroClipboard.Client();
	clip.setHandCursor( true );

	$('.coupon-code').mouseover( function() {
		clip.setText(this.innerHTML);
		if (clip.div) {
			clip.receiveEvent('mouseout', null);
			clip.reposition(this);
		} else {
                        clip.glue(this);
                }
		clip.receiveEvent('mouseover', null);
		url = $(this).attr('rel');
	});

	clip.addEventListener('mouseUp', function(client) {
		window.open(url);
	});
}

$(document).ready(function() {
	init();
  
  heavyImage = new Image(); 
  heavyImage.src = template_path+"/images/coupon-code-hover.png";
  heavyImage2 = new Image(); 
  heavyImage2.src = template_path+"/images/coupon-code.png";
});


