<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">	/* Author: 

*/

function sizeContent() {
	var height = $('#featured section').height();
	var width = $('#featured section').width();
	$('#featured').css('height', height);
	//$('#featured').css('width', width);
	//$('#featured section').css('width', width);
}

/**
 * Set width of scrollable slides to width of browser window
*/
//var siteWidth = $(window).width();
//$('.scrollable .slide').css('width', siteWidth);

/**
 * Set scrollable height to be proportional to the aspect ratio of the slide's content - eg if in your design the slide is 1000w x 500h, this ratio would be 2
*/
//var bannerHeight = $(window).width() / 2;	
//$('.scrollable').css('height', bannerHeight);

/**
 * Use the api to reposition the slide once it's been resized (if the broswer is resized)
*/
//var api = $(".scrollable").data('scrollable');
//var currentSlide = api.getIndex();
//api.seekTo(currentSlide, 50);

$(window).resize(function() {
	sizeContent();
});

$(document).ready(function(){

	sizeContent();

	// user login form focus
	$('#UserUsername').focus();
	
    
   	// retailer search
	$( "input#RetailerSearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 0,
		source: "/retailers/find_retailer",
		focus: function( event, ui ) {
			$( "input#RetailerSearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#RetailerSearch" ).val( ui.item.label );
			$( "input#RetailerSlug" ).val( ui.item.value );
			$( "input#RetailerId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// example text
	$('#RetailerSearch').example(function() {
  		return $(this).attr('title');
	});
	
	// submit function
	$('#SearchForm').submit(function() {
		var slug = $("input#RetailerSlug").val();
  		location.href = "/retailers/" + slug;
  		return false;
	});
	
	// admin submit function
	$('#AdminSearchForm').submit(function() {
		var id = $("input#RetailerId").val();
  		location.href = "/admin/retailers/view/" + id;
  		return false;
	});
	
	// company search
	$( "input#CompanySearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 0,
		source: "/companies/find_company",
		focus: function( event, ui ) {
			$( "input#CompanySearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#CompanySearch" ).val( ui.item.label );
			$( "input#CompanyId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// admin submit function
	$('#CompanySearchForm').submit(function() {
		var id = $("input#CompanyId").val();
  		location.href = "/admin/companies/view/" + id;
  		return false;
	});
	
	// example text
	$('#CompanySearch').example(function() {
  		return $(this).attr('title');
	});
	
	// member search
	$( "input#MemberSearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 1,
		source: "/members/find_companies",
		focus: function( event, ui ) {
			$( "input#MemberSearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#MemberSearch" ).val( ui.item.label );
			$( "input#MemberId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// admin submit function
	$('#MemberSearchForm').submit(function() {
		var id = $("input#MemberId").val();
  		location.href = "/admin/members/view/" + id;
  		return false;
	});
	
	// example text
	$('#MemberSearch').example(function() {
  		return $(this).attr('title');
	});
	
	// student search
	$( "input#StudentSearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 1,
		source: "/students/find_companies",
		focus: function( event, ui ) {
			$( "input#StudentSearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#StudentSearch" ).val( ui.item.label );
			$( "input#StudentId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// admin submit function
	$('#StudentSearchForm').submit(function() {
		var id = $("input#StudentId").val();
  		location.href = "/admin/students/view/" + id;
  		return false;
	});
	
	// example text
	$('#StudentSearch').example(function() {
  		return $(this).attr('title');
	});
	
	// discount search
	$( "input#DiscountSearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 3,
		delay: 500,
		source: "/discounts/find_companies",
		focus: function( event, ui ) {
			$( "input#DiscountSearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#DiscountSearch" ).val( ui.item.label );
			$( "input#DiscountId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// admin submit function
	$('#DiscountSearchForm').submit(function() {
		var id = $("input#DiscountId").val();
  		location.href = "/admin/discounts/view/" + id;
  		return false;
	});
	
	// example text
	$('#DiscountSearch').example(function() {
  		return $(this).attr('title');
	});
	
	// discount search
	$( "input#UserSearch" ).autocomplete({
		search: function(event, ui) { 
       		$('.spinner').show();
   		},
   		open: function(event, ui) {
       		$('.spinner').hide();
   		},
		minLength: 3,
		delay: 500,
		source: "/users/find_users",
		focus: function( event, ui ) {
			$( "input#UserSearch" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "input#UserSearch" ).val( ui.item.label );
			$( "input#UserId" ).val( ui.item.admin );
			return false;
		}
	});
	
	// admin submit function
	$('#UserSearchForm').submit(function() {
		var id = $("input#UserId").val();
  		location.href = "/admin/users/view/" + id;
  		return false;
	});
	
	// example text
	$('#UserSearch').example(function() {
  		return $(this).attr('title');
	});
	
	// fade out good flash messages after 3 seconds
	$('#flashMessage').animate({opacity: 1.0}, 5000).fadeOut();
	$('#authMessage').animate({opacity: 1.0}, 5000).fadeOut();
	
	// read more
	$('.description').shorten({
   		moreText: 'read more',
    	lessText: 'read less'
	});
	
	// toggle description
	$('.retailer_description').click(function () {
		$('.retailer_info').toggle();
	});
	
	// tabs slideshow - used in featured
	$(".featured-tabs").tabs("#featured &gt; section", {effect: 'fade', fadeOutSpeed: "slow", rotate: true}).slideshow({clickable: false, autoplay: true, interval: 10000});
	
	// popular drag &amp; drop
	$(function() {
		$( ".populars" ).sortable({
			revert: true, 
			cursor: 'move',
			update: function() {
				var data = $('.populars').sortable('serialize'); 
				$.ajax({
   					type: "post",
   					url: "/admin/offers_templates/reorder",
   					data: data,
   					dataType: "json",
				});
			}
		});
		$( ".populars, .single-popular" ).disableSelection();
	});
	
	// more drag &amp; drop
	$(function() {
		$( ".mores" ).sortable({
			revert: true, 
			cursor: 'move',
			update: function() {
				var data = $('.mores').sortable('serialize'); 
				$.ajax({
   					type: "post",
   					url: "/admin/features_templates/reorder",
   					data: data,
   					dataType: "json",
				});
			}
		});
		$( ".mores, .single-more" ).disableSelection();
	});
    
	
	// scrollable - used in discounts
	//$(".scrollable").scrollable({circular: true}).autoscroll(5000,{ autoplay: true });
	$(".scrollable").scrollable({circular: true});
	
	// click deal header
	$( ".retailer-offer-collapse" ).on( "click", function() {
		var selector = $(this)[0].classList[1];
		$('#' + selector).toggle();
		
		$($(this)[0].children[1]).toggle();
		$($(this)[0].children[2]).toggle();
	});

});</pre></body></html>