	  function coupon_codes_open(cou)
	  {
		  dest = "/getcoupons.php?coupon="+cou+"&amp;afsrc=1";
			newwindow = window.open(dest,"mywindow"); 
			newwindow.focus(); 
	  }
	  
	  function coupon_codes_copy_index(theURL,mersiteid1)
		{  
		  
			var lastMerClicked;
			$(function() {

            $("#myTable td:last-child").each(function() {
                var clip = new ZeroClipboard.Client();
                var lastTd = $(this);
                var parentRow = lastTd.parent("tr");

                clip.glue(lastTd[0]);

                var txt = $.trim($("td:first-child", parentRow).text()) + "\r\n" + $.trim($("td:nth-child(2)", parentRow).text()) + "\r\n" +
                $.trim($("td:nth-child(3)", parentRow).text()) + "\r\n" + $.trim($("td:nth-child(4)", parentRow).text());
				
				
                clip.setText(txt);
				
				clip.addEventListener('complete', function(client, text) {
														   
					tipobj.innerHTML= 'Coupon Code is Copied';								   
					window.location.href = window.open(theURL,'mywindow');
					location.href = ''; 
										   
				   if (lastMerClicked != mersiteid)
				   {
					lastMerClicked = mersiteid;
				   }
				   
					
				});
				
				clip.addEventListener('mouseOver', function(client, text) {
						
						tipobj.innerHTML= 'Click to copy this coupon code and open the site';
								   
				});
				
				
            });
        });
		text3 = '';
	
		} 
	  
	  
		function coupon_codes_copy(theURL,mersiteid)
		{
			var lastMerClicked;
			
									
			$(function() {

            $("#myTable td:last-child").each(function() {
                var clip = new ZeroClipboard.Client();
				
                var lastTd = $(this);
                var parentRow = lastTd.parent("tr");
				clip.setHandCursor(true);
                clip.glue(lastTd[0]);

                var txt = $.trim($("td:first-child", parentRow).text()) + "\r\n" + $.trim($("td:nth-child(2)", parentRow).text()) + "\r\n" +
                $.trim($("td:nth-child(3)", parentRow).text()) + "\r\n" + $.trim($("td:nth-child(4)", parentRow).text());
				
                clip.setText(txt);
				
                clip.addEventListener('complete', function(client, text) {
														   
								   if (lastMerClicked != mersiteid)
								   {
									var newwindow = window.open(theURL,"mywindow");
									lastMerClicked = mersiteid;
								   }
								   
									tipobj.innerHTML= 'Coupon Code is Copied';
				});
				
				clip.addEventListener('mouseOver', function(client, text) {
						
					   if (lastMerClicked != mersiteid)
					   {
						tipobj.innerHTML= 'Click to copy this coupon code and open the site';
						
					   }
					   else
					   {
						tipobj.innerHTML= 'Click to copy the coupon code';
					   }
								   
				});
				
				
            });
        });
		mersiteid = '';
	
		}   

		

		

