/* Symbicort additional JS functions */ function fnSwitchpage(the_form){ //Get the selected link URL from the dropdown var link_chosen; link_chosen=the_form.selection.options[the_form.selection.selectedIndex].value; //Redirect to this URL window.location=link_chosen; return false; } function hideSearchText(the_form) { var defaultValue; var inputValue; inputValue=the_form.bsterm.value; if(inputValue == 'Search Symbicort.com here'){ the_form.bsterm.value = ''; } else if(inputValue == '' || inputValue == null){ the_form.bsterm.value = 'Search Symbicort.com here'; } } function registeredSymbolChange(){ var el; var elText; el=document.getElementsByTagName('H1')[0]; elText=el.firstChild.nodeValue; el.firstChild.nodeValue=elText.replace('®','®'); } function redefineOpacity() { //simply sets the minimum opacity minOpacity = 0.1; } function privacyPopup(){ if(!!$('privacy-popup')){ $$('a#open-popup')[0].observe('click',function(e){ if(!e.stop)e.stopped; $$('div#privacy-popup')[0].style.display="block"; }); $$('a#close-popup')[0].observe('click',function(e){ if(!e.stop)e.stopped; $$('div#privacy-popup')[0].style.display="none"; }); } } var prototypeAZSymbicortFunctions = function(){ //anything here is private var default_container_name = 'overlay_container_exitramp'; // Used to store scroll bar position var lastScrollPositon =0; return{ //anything here is public. Call using prototypeAZFunctions.functionName(); hasPrototype : function(){ return typeof Prototype !== 'undefined'; }, addExitRamps : function(){ var callBacks = [prototypeAZSymbicortFunctions.exitRamp]; $$('select.exit_ramp_new').each(function(el){ //this is the element where the response should be directed //replace the existing link with an AJAX request el.observe('change',prototypeAZSymbicortFunctions.simpleAjaxUpdater.curry(callBacks)); }); $$('a.exit_ramp_new').each(function(el){ //this is the element where the response should be directed //replace the existing link with an AJAX request el.observe('click',prototypeAZSymbicortFunctions.simpleAjaxUpdater.curry(callBacks)); }); }, /*Suitable for retrieving an item based on the path of the anchor clicked*/ simpleAjaxUpdater : function(callBacks, event){ //event last as a result of use of curry //pull the necessary information from the updater //this format should be used for all requests which are AJAX enabled //first of all, kill the request if(!event.stopped){ event.stop(); event.cancelBubble=true; } var href = prototypeAZSymbicortFunctions.getEventHref(event); //ie is returning undefined here when a stopped event is passed as an argument //try with a proxy object instead of an event perhaps? if(href.indexOf('exitramps')!="-1"){ lastScrollPositon=f_scrollTop(); var params = {}; params['ajaxSource'] = true;//makes webapp believe this is an AJAX request (same syntax as a Spring AJAX request) var target; if(!$(default_container_name)){ target = new Element('div'); //native JS method here target.setAttribute('id',default_container_name); document.body.appendChild(target); }else{ target = $(default_container_name); } var updater = new Ajax.Updater(target,href,{ method: 'get', parameters: params, onSuccess: function(){prototypeAZSymbicortFunctions.fadeOutBackground();}, onComplete: function(){ //TODO refactor this for(j=0;j