/* jquery.hoverIntent.min.js */
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
/* rfd.lazyload.js */
function lazyload_manual(a){if($("img",a).length==0){$("<img />",{src:a.attr("lazy_src"),alt:a.attr("lazy_alt")!==undefined?a.attr("lazy_alt"):"",width:a.attr("lazy_w")!==undefined?a.attr("lazy_w"):"",height:a.attr("lazy_h")!==undefined?a.attr("lazy_h"):""}).appendTo(a)}}function lazyload_scroll(b,c){var a=function(){if(b.offset().top<($(window).scrollTop()+$(window).height())){c.each(function(){lazyload_manual($(this))})}};$(window).scroll(a)};
/* rfd.menu.js */
var tabHover=null;var menuHover=null;function showDropMenu(a){if(a.is(":hidden")){$(".topnav_dropmenu").hide();if($("#dropmenu_shadow_ie").length>0){$("#dropmenu_shadow_ie").hide()}$(".maintab a").removeClass("tab_hover");$("#"+a.attr("id").replace("dropmenu","tab")+" a").addClass("tab_hover");if($.browser.msie&&parseInt($.browser.version)==6){$(".actionbar select.ie_hidden").css({visibility:"hidden"})}a.fadeIn(200,function(){if($("#dropmenu_shadow_ie").length>0){$("#dropmenu_shadow_ie").show()}a.find("[lazy_src]").each(function(){lazyload_manual($(this))})});if($.browser.msie){$(".bleed").each(function(){var b=$(this).height()})}}}function checkHideDropMenu(a){if(tabHover===null&&menuHover===null){$(".actionbar select.ie_hidden").css({visibility:"visible"});if($("#dropmenu_shadow_ie").length>0){$("#dropmenu_shadow_ie").hide()}a.fadeOut(200);$("#"+a.attr("id").replace("dropmenu","tab")+" a").removeClass("tab_hover")}}$(document).ready(function(){if($.browser.msie&&parseInt($.browser.version)<9){var a=$("<div>",{id:"dropmenu_shadow_ie"});a.appendTo($("#dropmenu_container"));a.hide()}$(".maintab").hoverIntent(function(){if($("#"+$(this).attr("id").replace("tab","dropmenu")).length>0){showDropMenu($("#"+$(this).attr("id").replace("tab","dropmenu")));tabHover=$(this).attr("id").replace("tab_","")}else{$(".maintab a").removeClass("tab_hover");$(this).find("a").addClass("tab_hover");$(".topnav_dropmenu").hide()}},function(){if($("#"+$(this).attr("id").replace("tab","dropmenu")).length>0){tabHover=null;var b=$(this);window.setTimeout(function(){checkHideDropMenu($("#"+b.attr("id").replace("tab","dropmenu")))},300)}else{$(this).find("a").removeClass("tab_hover")}});$(".topnav_dropmenu").hover(function(){menuHover=$(this).attr("id").replace("dropmenu_","")},function(){menuHover=null;var b=$(this);window.setTimeout(function(){checkHideDropMenu(b)},300)});$(".maintab a").each(function(){$(this).click(function(){_gaq.push(["_trackEvent","topnav_new","click","Main Tab - "+$(this).text()])})});$(".topnav_dropmenu a").each(function(){$(this).click(function(){_gaq.push(["_trackEvent","topnav_new","click","Submenu - "+$(this).parents(".topnav_dropmenu").attr("id")+" - "+$(this).text()])})});$("#header_search").submit(function(){window.location.href="http://www.redflagdeals.com/search/#!/q="+encodeURIComponent($("#site_search_query").val());return false})});
/* rfd.dealcountcomment.js */
var countCommment={findOfferIDs:function(){var a={deals:new Array(),coupons:new Array(),announcements:new Array()};$(".comment_count").each(function(){if($(this).attr("deal_id")){a.deals.push($(this).attr("deal_id"))}else{if($(this).attr("coupon_id")){a.coupons.push($(this).attr("coupon_id"))}else{if($(this).attr("announcement_id")){a.announcements.push($(this).attr("announcement_id"))}}}});return a},getCountComment:function(a){$.post("/comments/",{"do":"get_counts",offer_ids:a},function(b){$.each(b,function(c,d){c=c.slice(0,-1);$.each(d,function(e,g){if($(".comment_count["+c+'_id="'+e+'"]').is(":empty")){$(".comment_count["+c+'_id="'+e+'"]').html(g)}else{var f=$(".comment_count["+c+'_id="'+e+'"]').html();if(g!=1){f=f+"s"}$(".comment_count["+c+'_id="'+e+'"]').html(g+" "+f)}})})},"json")}};$(document).ready(function(){var a;a=countCommment.findOfferIDs();if(a.deals.length>0||a.coupons.length>0||a.announcements.length>0){countCommment.getCountComment(a)}});
/* cookiemanager.js */
var CookieManager={setCookie:function(b,d,a,f,c,e){document.cookie=b+"="+escape(d)+((a)?"; expires="+a.toUTCString():"")+((f)?"; path="+f:"")+((c)?"; domain="+c:"")+((e)?"; secure":"")},getCookie:function(c){var b=document.cookie;var e=c+"=";var d=b.indexOf("; "+e);if(d==-1){d=b.indexOf(e);if(d!=0){return null}}else{d+=2}var a=document.cookie.indexOf(";",d);if(a==-1){a=b.length}return unescape(b.substring(d+e.length,a))},deleteCookie:function(a,c,b){if(this.getCookie(a)){document.cookie=a+"="+((c)?"; path="+c:"")+((b)?"; domain="+b:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"}}};
/* rfd.polls.js */
function getPoll(e,b){var a="#poll_"+e;var d=a+" .poll_form";var f=a+" .poll_response";var c=null;$(f).hide();if(CookieManager.getCookie("poll_"+e)==1){$(d).remove();$(f).show()}$(d).submit(function(g){g.preventDefault();c=$("#poll_"+e+" .poll_form form").serialize();$.post("/polls/index.php",c,function(i){CookieManager.setCookie("poll_"+e,"1");var h=jQuery.parseJSON(i);if(h.ok){$(d).hide();$(f).show()}else{if(h.err){alert(h.err)}}})})};
/* rfd.catselect.js */
$(document).ready(function(){$(".cat_select_sort select").change(function(){$(this).parents("form").submit()})});
