function vote_yes(cpid,siteid)
{
 $.ajax({
   type: "POST",
   url: "/coupons/votecoupon",
   data: "couponid="+cpid+"&siteid="+siteid+"&voting=Yes",
   success: function(msg){
       if(msg!='')
          {       
             $('#vote_'+cpid+'').hide();
          }
      }
     });
}

function vote_no(cpid,siteid)
{
$.ajax({
   type: "POST",
   url: "/coupons/votecoupon",
   data: "couponid="+cpid+"&siteid="+siteid+"&voting=No",
   success: function(msg){
       if(msg!='')
          {
            $('#box_'+cpid+'').hide();
          }
      }
     });
}
$(document).ready(function(){

  $(".coupon_code").mouseout(function () {
  $('.couponTooltip').css("display","none");
  });
$("#search").click(function() {
   $(".form1").submit();
});
$("#subscribe1").click(function() {
$(".forms").submit();
});
});
$(document).ready(function(){
	   ZeroClipboard.setMoviePath( '/js/ZeroClipboard.swf' );
	   $("a.ccode").each(function() {
		var txt = $(this).attr("rel");
		var coup_id = $(this).attr("id");
		$(this).mouseover(function() {
		$('#content_btm2_'+coup_id).show();
        clip = new ZeroClipboard.Client();
        clip.setHandCursor(true);
        clip.setText(txt);
        clip.glue(this);
        clip.addEventListener('complete', function(client, text) {
           $('#content_btm2_'+coup_id).hide();
           $('#content_copied_'+coup_id).show();
       
        window.open('/get-coupon/'+coup_id,'_blank');
         setTimeout("$('.content_btm2_copied').hide();", 200);
          return false;
        });
	clip.addEventListener('mouseout', function(client, text) {
	$('#content_btm2_'+coup_id).hide();
       
		});
	clip.addEventListener('mouseover', function(client, text) {
	$('#content_btm2_'+coup_id).show();
		});
          });
          $(this).mouseout(function() {
           $('#content_btm2_'+coup_id).hide();   
          });
	  });
	});
  function suggest(inputString){

		if(inputString.length == 0) {

			$('#suggestions').fadeOut();

		} else {

		$('#search_store').addClass('load');

                $.ajax({

                     type: "POST",

                     url: "/stores/suggest",

                     data: "queryString="+inputString+"",

                     success: function(data){

 		if(data !='') {

		$('#suggestions').fadeIn();

                //alert(data);

		$('#suggestionsList').html(data);

		$('#search_store').removeClass('load');

		

		} else {

                    

                     $('#search_store').removeClass('load');

                }

                 }

                });



		}

	}

	function fill(thisValue) {

		$('#search_store').val(thisValue);
               
                $('#suggestions').fadeOut("slow");

		

	}
function lookup(inputString) {
		if(inputString.length == 0) {
			$('#suggestions').hide();
		} else {
			$.post("/stores/suggest", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} 
	

        
    function clearField(obj) {
     if (obj.defaultValue==obj.value) obj.value = ''; 
	 obj.style['color'] = 'black';
	 }
         
$(document).ready(function() {

$("#foo2").carouFredSel({
	circular: false,
	infinite: false,
	auto 	: false,
	scroll	: {
		items	: "page"
	},
	prev	: {	
		button	: "#foo2_prev",
		key		: "left"
	},
	next	: { 
		button	: "#foo2_next",
		key		: "right"
	},
	pagination	: "#foo2_pag"
});
});
