$(document).ready(function(){
	$(document).bind("contextmenu",function(e){
        return true;
      });
	$.fn.pause = function(duration) {
	    $(this).animate({ dummy: 1 }, duration);
	    return this;
	};
	var clearMePrevious = '';
	// clear input on focus
	$('.clearMeFocus').focus(function()
	{
	if($(this).val()==$(this).attr('title'))
		{
		clearMePrevious = $(this).val();
		$(this).val('');
		}
	});
	// if field is empty afterward, add text again
	$('.clearMeFocus').blur(function()
	{
	if($(this).val()== '')
	{
	$(this).val(clearMePrevious);
	}
	});
});

function copy_coupon_and_go_to_site ( coupon_id,checkout_url )
	{
	window.open ((siteURL + 'viewout/c-' +coupon_id)  , "_blank" ) ;
	}

  function set_copy_command ( text_to_copy , control_id , coupon_id,checkout_url )
	{
		if ( navigator.userAgent.indexOf("MSIE") > -1 ) 
		{
			$("#"+control_id).click ( function ( )
				{
					window.clipboardData.setData("Text",text_to_copy);
					copy_coupon_and_go_to_site ( coupon_id ) ;
				}
									 ) ;
		}
		else
		{
			var clip = new ZeroClipboard.Client();
		   
			ZeroClipboard.setMoviePath ("/js/new/ZeroClipboard.swf" ) ;
			clip.setText( text_to_copy ); 
			clip.setHandCursor( true );
			clip.addEventListener( 'mouseOver', function(client) {
                                show_tool_tip ( coupon_id ) ;
                        } );
			clip.addEventListener( 'mouseOut', function(client) { 
                                hide_tool_tip ( coupon_id ) ;
                        } );
			clip.addEventListener( 'complete', function(client, text) {
				$("#"+control_id).css("background-color" , "#33CC66");
				$("#coupon_Tool_tip_action_"+coupon_id).css("width","60px").text("Copied ! ") ;
				copy_coupon_and_go_to_site ( coupon_id,checkout_url ) ;
			} );
			clip.glue( control_id );
		}
	}
function animate_area ( div_id , direction )
	{
		if ( direction == 0 )
			$("#"+div_id).animate ( { scrollLeft : "-=504" } , "slow" ) ;
		else
			$("#"+div_id).animate ( { scrollLeft : "+=504" } , "slow" ) ;
	}
	
	function show_tool_tip ( copon_id )
	{
		$("#coupon_Tool_tip_action_"+copon_id).show() ;
	}
	
	function hide_tool_tip ( copon_id )
	{
		$("#coupon_Tool_tip_action_"+copon_id).hide() ;
	}

