var new_win = null; $(function(){ function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } /* BIG REVEAL ALL BUTTON ON STORE PAGE */ $(".reveal_all").click(function(){ var name_u = trim($(this).attr('name')); $($(this)).unbind('click'); $(this).addClass('codes_revealed'); if( $(this).attr("storehascodes") == "1" ) { $(".codetype-code").each( function() { $(this).attr("opening_all", "1"); $(this).click(); $(this).attr("opening_all", "0"); }); } var new_win = window.open($(this).attr("href"),'_blank','toolbar=1, height=500, width=600,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); new_win.moveTo(950,0); var html = 'Scroll Down To View Discounts'; $(this).html(html); window.location = window.location + "#discounts"; return false; }); /* DEFAULT/PRIMARY CODE REVEAL FROM CODEROW */ $(".click_reveal, .limited_reveal").click(function() { if (!!$(this).attr("codeid")) { $("."+$(this).attr("codeid")+"_desc").hide(); $("."+$(this).attr("codeid")+"_more").hide(); $("."+$(this).attr("codeid")+"_tip").hide(); $("."+$(this).attr("codeid")+"_confirm").show(); $("."+$(this).attr("codeid")+"_show").hide(); $("."+$(this).attr("codeid")+"_hide").show(); $("#"+$(this).attr("codeid")+"").addClass('code_clicked'); $($(this)).unbind('click'); } else { //This method is kept for backwards compatiblity but should be phased out in 2011 $(".show",$(this)).hide(); $(".hide",$(this)).show(); $(".code",$(this)).addClass('code_clicked'); $($(this)).unbind('click'); } if( $(this).attr("opening_all") != "1" ) { var new_win = window.open( $("#"+$(this).attr("codeid")+"_outlink").attr("value") ,'_blank','toolbar=1, height=500, width=600,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); new_win.moveTo(950,0); } return false; }); $('a.hide').click(function() { var new_win = window.open($(this).attr("href"),'_blank','toolbar=1, height=500, width=600,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); new_win.moveTo(950,0); return false; }); $("a.link_reveal").click(function(){ var test = $(this).attr("href"); new_win = window.open($(this).attr("href"),'_blank','toolbar=1, height=500, width=600,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); new_win.moveTo(950,0); return false; }); //New click to reveal for small 'Click here' on the new code row $(".click_reveal_small").click(function(){ $(".show_small",$(this)).hide(); $(".hide_small",$(this)).show(); new_win = window.open($("a",$(".show_small,",$(this))).attr("href"),'_blank','toolbar=1, height=500, width=600,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); new_win.moveTo(950,0); $($(this)).unbind('click'); return false; }); window.hoverJSloaded = true; if(window.revealAllClicked) { $(".reveal_all").click(); } if(window.clickRevealClicked != null) { alert(window.clickRevealClicked); $(window.clickRevealClicked).click(); } });