$(document).ready(function () { if(getCookie("ReferFriend")){ $("#refer_coll_bg").show(); $('#_3qw_espanol-popup').css({ height : $(document).height() }).show(); deleteCookie('ReferFriend', 'index.html'); } if(window.location.search.substring() == "?thank-you"){ $("#refer_coll_bg").show(); $('#_3qw_espanol-popup').css({ height : $(document).height() }).show(); } $("#tabs-healthy li a").click(function () { var urlLink = $(this)[0].rel; var tabId = $(this)[0].parentElement.className; ajaxLoadRecipes(urlLink,tabId); }); value = getCookie("US_healthcare"); $("#_3qw_espanol-popup").click(function () { $(".close-pop").hide(); }); $('._3qw').click(function () { $(this).hide(); $('.popup').hide(); }); /*Refer a Friend*/ $(".refer-friend").click(function () { $("#refer_a_friend").show(); $('._3qw').css({ height : $(document).height() }).show(); $("#sendto")[0].reset(); }); $('.input_form').keyup(function(){ if(($('#toEmail').val() != '') && ($('#fromEmail').val() != "")){ $('#submit_to_friend_grayed').hide(); $('#submit_to_friend_active').show(); } else if(($('#toEmail').val() == '') || ($('#fromEmail').val() == "")){ $('#submit_to_friend_grayed').show(); $('#submit_to_friend_active').hide(); }} ); $('#submit_to_friend_active').click(function () { if(!validateEmail($('#toEmail').val()) || !validateEmail($('#fromEmail').val())){ alert("Please enter a valid e-mail address."); } else{ /*$('#refer_a_friend_content').hide(); $('#refer_a_friend_thank_you').show();*/ createCookie('ReferFriend',document.location.pathname,365,'index.html'); } }); function validateEmail($email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if( !emailReg.test( $email ) ) { return false; } else { return true; } } $('.input_form').keyup(function(){ validateForm(); }); $(".button-stater-preview").click(function () { $("#diabetes-discussion-planner").hide(); $("#diabetes-discussion-planner-preview").show(); $('.tab1-preview #medications-below input').attr('disabled', 'disabled'); $('.tab1-preview #medications-below select').attr('disabled', 'disabled'); var i=0; $("#diabetes-discussion-planner #medications-below input").each(function(i) { $("#diabetes-discussion-planner-preview input")[i].value = $(this)[0].value; }); var j=0; $("#diabetes-discussion-planner #medications-below select").each(function(i) { $("#diabetes-discussion-planner-preview select")[j].value = $(this)[0].value; j++; }); var copy = "
Questions for my Doctor
" var band = false; $(".content-accordion.tab4 input").each(function() { if($(this)[0].checked){ copy +=""+$(this).next()[0].innerHTML+""; band = true; } }); if(band == true){ $('#questions-doctor').append(copy); } var copy2 = "Other Things I Want to Talk About
" var band2 = false; $(".content-accordion.tab5 input").each(function() { if($(this)[0].checked){ copy2 +=""+$(this).next().text();"
"; band2 = true; } }); if(band2 == true){ $('#other-things').append(copy2); } }); $("#conversation-starter").click(function () { $('.tab1-preview #medications-below input').removeAttr('disabled'); $('.tab1-preview #medications-below select').removeAttr('disabled'); }); $("#printer-version").click(function () { $('#masthead').addClass("print-display"); $('#wrapper-left').addClass("print-display"); $('#footer').addClass("print-display"); $('#banner_area').addClass("print-display"); $('#breadcrumbs').addClass("print-display"); $('.header-utilities').addClass("print-display"); $('#conversation-starter').addClass("print-display"); $('#printer-version').addClass("print-display"); $('#page_content .content p.title').addClass("print-display"); $('#page_content .content #diabetes-discussion-planner-preview > p').addClass("print-display"); $('#footer').addClass("print-display"); print(); }); //mainNavHover(); mainNavLeftPromo(promoId); if(promoPdf == "promo-pdf")mainNavLeftPromo(promoPdf); setInterval( "slideSwitch()", 5000 ); /* accordion */ $("#accordion > div.content_smaler").click(function(){ if(false == $(this).next().is(':visible')) { $(this).addClass("opentabCommon"); $(this).next().slideToggle(300); } else{ $(this).removeClass("opentabCommon"); $(this).next().slideUp(300); } }); $("#accordion > div.content_smaler").mouseover(function(){ if(false == $(this).next().is(':visible')) { $(this).addClass("opentabCommon"); $(this).next().slideToggle(300); } }); $("#janumet-xr-free-trial .voucher_button").click(function () { $(".sign_trial").show(); $('._3qw').css({ height : $(document).height() }).show(); $("#janumet-xr-free-trial .blue_m").click(function(){ $("._3qw").hide(); $(".sign_trial").hide(); }); }); $("#janumet-coupon .already-have span").click(function () { $("#sign_trial_coupon").show(); $('._3qw').css({ height : $(document).height() }).show(); $(".blue_m").click(function(){ $("._3qw").hide(); $("#sign_trial_coupon").hide(); }); $(".steps_buttom").click(function(){ $("#sign_trial_coupon").show(); }); }); $(".interactive-section .buttons-true").click(function () { $('.interactive-section div[class|="question"]').hide(); $(this).next().show(); $(".interactive-section .close-question").show(); }); $(".interactive-section .buttons-false").click(function () { $('.interactive-section div[class|="question"]').hide(); $(this).next().show(); $(".interactive-section .close-question").show(); }); $(".interactive-section .close-question").click(function () { $('.interactive-section div[class|="question"]').hide(); $(".interactive-section .close-question").hide(); }); $(".medications-below").click(function () { $("#page_content .content .diabetes-discussion-answers div#medications-below").show(); }); $("#espanol-link").click(function () { $("#espanol-popup").show(); $('#_3qw_espanol-popup').css({ height : $(document).height() }).show(); }); $("#go-to-my-sched").click(function () { $("#popup-thank-you").show(); $('._3qw').css({ height : $(document).height() }).show(); $("#return_to_my_sched").click(function(){ $("._3qw").hide(); $("#popup-thank-you").hide(); }); }); $("#submit_information").click(function () { if($("#password").val() == "") $(".popup-submit-information-thank-you-2").show(); else $(".popup-submit-information-thank-you").show(); $('._3qw').css({ height : $(document).height() }).show(); $(".popup-close").click(function(){ $("._3qw").hide(); $(".popup-submit-information-thank-you-2").hide(); }); }); $("#button-submit").click(function(){ var validate = $("#form_signup_email").validate(); }); $(".button-next").click(function(){ $("html, body").animate({ scrollTop: 0 }, "slow"); $(".tab-1").hide(); $(".tab-2").show(); return false; }); $("#button-submit-opinion").click(function(){ $(".popup-thank-you-opinion").show(); $('._3qw').css({ height : $(document).height() }).show(); return false; }); $("#button-submit-update").click(function(){ $("#popup-thank-you-info-update").show(); $('._3qw').css({ height : $(document).height() }).show(); form.submit("janumetxrinfoUpdate.do"); return false; }); /*Planning a Healthy Vacation*/ $("#first-see-your-doctor").show(); $(".planning-chart .left .option").click(function () { $(".option").removeClass("active"); $(this).addClass("active"); var div_to_display = $(this).attr("alt"); $(".planning-chart .right .div-to-display").hide(); $("#"+div_to_display).show();/*fadeToggle("slow", "swing");*/ }); }); function validateForm(){ if(($('#toEmail').val() != '') && ($('#fromEmail').val() != "")){ if(validateEmail($('#toEmail').val()) && validateEmail($('#fromEmail').val())){ $('#submit_to_friend_grayed').hide(); $('#submit_to_friend_active').show(); }else{ $('#submit_to_friend_grayed').show(); $('#submit_to_friend_active').hide(); } } else if(($('#toEmail').val() == '') && ($('#fromEmail').val() == "")){ $('#submit_to_friend_grayed').show(); $('#submit_to_friend_active').hide(); } } function isEmpty(ob){ for(var i in ob){ if(ob.hasOwnProperty(i)){return false;}} return true; } function slideSwitch() { var $active = $('#rb_wrap div.active'); if ( $active.length == 0 ) $active = $('#rb_wrap div:last'); var $next = $active.next().length ? $active.next() : $('#rb_wrap div:first'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active'); }); } function mainNavHover() { $('li.main_nav').hover( function () { //show its submenu $('ul', this).slideToggle("slow"); }, function () { //hide its submenu $('ul', this).slideUp(200); } ); } function mainNavLeftPromo(promoId){ $('#'+promoId).show(); } function openExternalWinLink(product, url) { $("#popup-thank-you").show(); $('._3qw').css({ height : $(document).height() }).show(); $(".btn-ok a").unbind('click').click(function () { $("#popup-thank-you").hide(); $('._3qw').hide(); var externalWin = window.open(url,null,"toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=500"); if (externalWin.opener == null) externalWin.opener=window; externalWin.opener.name="opener"; return false; }); $(".btn-cancel a").unbind('click').click(function () { $("#popup-thank-you").hide(); $('._3qw').hide(); }); } function openTabsHealthyRecipes(tabId,active_recipe) { $("#tabs-healthy-recipes").ready(function () { $('#tabs-healthy-recipes div.content-tabs-healthy').hide(); $('#tabs-healthy-recipes div.content-tabs-healthy:first').show(); /*$('#tabs-healthy-recipes ul#tabs-healthy li a').click(function(){ $('#tabs-healthy-recipes ul#tabs-healthy li').removeClass('active'); $('#tabs-healthy-recipes ul#tabs-healthy li:first').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href').split('#')[1]; $('#tabs-healthy-recipes div.content-tabs-healthy').hide(); $('#'+currentTab).show(); return false; });*/ /*Displays Tab Selected*/ $('.'+tabId).addClass('active'); }); $(".recipes_list").ready(function () { $('#tabs-healthy-recipes div.content-tabs').hide(); /*$('.recipes_list li a').click(function(){ $('.recipes_list li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href').split('#')[1]; $('#tabs-healthy-recipes div.content-tabs').hide(); $('#'+currentTab).show(); return false; });*/ /*Displays Recipe Content*/ $('#'+active_recipe).show(); $('.'+active_recipe).parent().addClass('active'); }); } function ajaxLoadRecipes(urlLink, tabId, active_recipe){ $.ajax({ url: urlLink, cache: false }).done(function( html ) { $('.contectall-tabs-healthy').empty().append('