$(document).ready(function() { $('#surveypopup').hide(); var showSurveycookie = $.cookie('showHCPSurvey'); if(showSurveycookie == 'hide') { $.cookie('showHCPSurvey','hide'); } else { setTimeout(function(){ showSurvey(); }, 7000); } }); function showSurvey() { $.blockUI({ message: $('#surveypopup'), overlayCSS: { backgroundColor:'#000', opacity:0.6 }, iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', forceIframe: true, allowBodyStretch: true, bindEvents: true, constrainTabKey: true, fadeIn:400, fadeOut:400, timeout:0, showOverlay: true, focusInput: true, applyPlatformOpacityRules: true }); $('#surveypopup').show(); } function closeSurvey() { $.unblockUI(); $.cookie('showHCPSurvey','hide'); $('#surveypopup').hide(); } function refuseSurvey() { $.unblockUI(); $.cookie('showHCPSurvey','hide'); $('#surveypopup').hide(); } /** * Validate the form by making sure a value was selected */ function validateSubmit() { var formIsValid = false; var ifr = document.getElementById('frameContainer'); var ifrDoc = ifr.contentDocument || ifr.contentWindow.document; var hcpForm = ifrDoc.getElementById('HCPForm'); var e = hcpForm.elements; for(var elem, i = 0; (elem = e[i]); i++) { if(elem.type == 'checkbox' || elem.type == 'radio') { if(elem.checked == true) { formIsValid = true; break; } } } if (formIsValid) { hcpForm.submit(); } else { //alert("You must make a selection"); return false; } }