var clip = null;
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor revision of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->

  // Define event handler
 
function init() {
	
	// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
				"src", "/global_files/clipboard/example",
				"width", "550",
				"height", "200",
				"align", "middle",
				"id", "detectionExample",
				"quality", "high",
				"bgcolor", "#FFFFFF",
				"name", "detectionExample",
				"allowScriptAccess","sameDomain",
				"type", "application/x-shockwave-flash",
				'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
	
	$('div.nocoupon-code').mouseover( function() {
		//alert("no coupon");
		$('div.couponcopied').remove();
		$('div.couponcopy').remove();
		$(this).after("<div class='couponcopy'>Click to go to store for discount</div>");
	});
	$('div.nocoupon-code').mouseout( function() {
		//alert("no coupon");
		$('div.couponcopy').remove();
		$('div.couponcopied').remove();
	});
	
	// assign a common mouseover function for all elements 
	$('div.couponcode').mouseover( function() {
		 	
		// setup single ZeroClipboard object for all our elements
		clip = new ZeroClipboard.Client();
		clip.setHandCursor( true );
				
		var text_copy = this.innerHTML;
		var copy_url = this.lang;
		var i=0;
				
		// set the clip text to our innerHTML
		clip.setText( this.innerHTML );
				
		if (clip.div) {
			clip.receiveEvent('mouseout', null);
			clip.reposition(this);
		}
		else clip.glue(this);
		
		clip.receiveEvent('mouseover', null);
		clip.setCSSEffects( true );
				
		clip.addEventListener( 'mouseOver', function(client) { 
			$('div.couponcopied').remove();
			$('div.couponcopy').remove();
			var div = client.domElement;
			$(div).after("<div class='couponcopy'>Click to copy and use coupon</div>");
        } );
				
		clip.addEventListener( 'mouseOut', function(client) { 
            //	$('div.couponcopy').hide();
			$('div.couponcopy').remove();
		} );
				
		clip.addEventListener('complete', function(client) {
			$('div.couponcopied').remove();
			$('div.couponcopy').remove();
			var div = client.domElement;
			$(div).after("<div class='couponcopied'>Coupon code copied. Use at checkout!</div>");
			
				var agt=navigator.userAgent.toLowerCase();
				if (agt.indexOf("safari") != -1)
				{
					$(this).click(function(){
					$(this).unbind('click');
					window.open(div.lang,"_blank");});
				
				}
				else
				{
				 window.open(div.lang,"_blank");
				}
				
		} );
	} );
}
}