//smartsite site root: equivalent to ~/ var siteroot = typeof(window.SITEROOT) == "string" ? window.SITEROOT : "/"; //fixes double slash in URLs var normalizePath = function(string) {return string.replace(/(\/+)|\\+/g, "/");} //escapes <, > & and " into corresponding html entities var escapeHTML = function(string) {return string.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """);} //this file contains code that is useful but doesn't get used often - don't link directly to this file unless you plan to use all the functionality here. Instead, copy what you need into javascript.js //swfobject - http://blog.deconcept.com/swfobject/ - mit license if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="";_19+="";var _1d=this.getParams();for(var key in _1d){_19+="";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="";}_19+="";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.majorfv.major){return true;}if(this.minorfv.minor){return true;}if(this.rev=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject; //Modal mask var Modal = { width: 0, onOpen : function() {}, onClose : function() {}, onResize : function() {}, open : function(options) { options = options || {}; var title = options.title || ""; var url = options.url || ""; var params = options.params || {}; var contentEl = options.contentEl || ""; var onComplete = params.onComplete || function() {}; Modal.onOpen = options.onOpen || function() {}; Modal.onClose = options.onClose || function() {}; Modal.onResize = options.onResize || function() {}; Modal.onTransferContent = options.onTransferContent || function() {}; Modal.modalStyle = options.modalStyle || "standardmodal"; Modal.top = options.top || 100; Modal.width = options.width || 500; Modal.cleanUp();//clean up old modal params.onComplete = function() { $("#modalloader").remove();//in case of error, don't show loading animation forever onComplete.apply(null, arguments); }; if (url != "") { $("#modalcontent").html("
");//show loading animation Modal.updater = $("#modalcontent").load(url, params.onComplete); } else if (contentEl != "") {//make sure moving contentEl into the modal doesn't duplicate id's Modal.contentOrigin = contentEl; Modal.transferContent(Modal.contentOrigin, "#modalcontent"); } $("#modalcontainer").addClass(Modal.modalStyle).removeClass("hidden"); $("#modaltitle").html(title); Modal.resize(); Modal.onOpen();//use params.onComplete if you want something to run after the AJAX finishes }, close : function() { Modal.onClose(); Modal.cleanUp(); }, cleanUp : function() { $("#modalcontainer").removeClass(Modal.modalStyle).addClass("hidden"); if (Modal.contentOrigin) {//make sure restoring contentEl doesn't duplicate id's Modal.transferContent("#modalcontent", Modal.contentOrigin); Modal.contentOrigin = null; } }, resize : function() { var height = $("#modalbody").height(); var left = (document.documentElement.offsetWidth / 2) - (Modal.width / 2); var top = ($(window).height() > height + Modal.top) ? Modal.top : ($(window).height() - height) / 2; var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); left = (left > 0) ? left : 0; top = (top > 0) ? top : 0; $("#modalbody").css({ left : (scrollLeft + left) + "px", top : (scrollTop + top) + "px" }); $("#modalbody").width(Modal.width + "px"); //only calculate scroll dimensions after modal body has been repositioned $("#modalmask").hide();//hide mask temporarily to measure document size var scrollHeight = Math.max(document.body.scrollHeight, $(window).height()); var scrollWidth = Math.max(document.body.scrollWidth,$(window).width()); $("#modalmask").css({ height : scrollHeight + "px", width : scrollWidth + "px" }); $("#modalmask").show(); Modal.onResize(); }, transferContent : function(source, dest) { $(dest).html($(source)[0].innerHTML); $(source)[0].innerHTML = ""; Modal.onTransferContent(); } } $(window).load(function(){ //alert('hi'); // var userFontCookie="fontsize fontsize2" var userFontCookie = Cookie.get("userFontClass"); if(userFontCookie != "fontsize fontsize2" && userFontCookie != null) { if($(".homecontainer").length == 0) $("body").addClass(userFontCookie); $(".fontsize").removeClass("fontsizedisabled"); if($(".font"+userFontCookie).length > 0) $(".font"+userFontCookie).addClass("fontsizedisabled"); } $(".headernavbar li") .mouseover(function(){ if(this.className.indexOf("extent") < 0) $(this).addClass("hover"); else $(this).addClass("hoverextent"); }) .mouseout(function(){ $(this).removeClass("hover"); $(this).removeClass("hoverextent"); }) $(".dignavbar .secondarynav a").removeClass("selected"); $(".dignavbar .secondarynav .last").remove(); $(".secondarynav a,.homebanner a.button") .mouseover(function(){$(this).addClass("hover");}) .mouseout(function(){$(this).removeClass("hover");}) $(".dignavbar a.next") .mouseover(function(){$(this).addClass("selected");}) .mouseout(function(){$(this).removeClass("selected");}) $(".dignavbar div.rollover") .mouseover(function() { $(this).addClass("hover") $(this).children(".secondarynav").css("display","block"); }).bind(/*@cc_on "mouseleave " || @*/"mouseout", function() { $(this).removeClass("hover") $(this).children(".secondarynav").css("display","none"); }) $("sup a,.tooltip").live("mouseover", function(e) { var container = $(""); var content = container.find(".tooltipcontent"); $("body").append(container); var data = $(this).attr("title"); var position = $(this).offset(); if($(this).attr("coords")){ var coords = $(this).attr("coords").split(","); var height = coords[3] - coords [1]; var left = parseInt(position.left); var top = parseInt(position.top); var position = {'left':left+parseInt(coords[0]),'top':top+parseInt(coords[1])}; }else{ var height = $(this).height(); } $(this).attr("title",""); content.html(data); if((position.left + 10 + container.outerWidth()) > 1003) container.css({"top":position.top + height, "left":position.left - container.outerWidth() - 10}); else container.css({"top":position.top + height, "left":position.left + 10}); container.removeClass("hidden"); }).live(/*@cc_on "mouseleave " || @*/"mouseout", function() { var container = $(".tooltipcontainer:not(.hidden)") var content = container.find(".tooltipcontent"); container.addClass("hidden"); var data = content.html(); if (data) $(this).attr("title", data) container.remove() }).live("click",function() { var container = $(".tooltipcontainer") var content = container.find(".tooltipcontent"); container.addClass("hidden"); var data = content.html(); if (data) $(this).attr("title", data) container.remove(); }) $(".fontsize").click(function() { var fontsize = $(".fontsize"); var size = this.className.substring(13, 18); fontsize.removeClass("fontsizedisabled"); for(i=1;i<=3;i++){$("body").removeClass("size"+i)}; $(this).addClass("fontsizedisabled") $("body").addClass(size); Cookie.set('userFontClass', size, 240); }) $("#outboundlinks a, a.outboundlink").click(function(e){ e.preventDefault(); var target = $(this).attr("href"); Modal.open({ width:"500", url:"/leavingsite.jsp", params : { onComplete:function(){ $(".modalcontent .button").click(function(){ Modal.close(); if($(this).hasClass("okbutton")) { window.open(target, "") } }) } } }) }) $(".faq h4").click(function(){ $(this).toggleClass("brown"); $(this).next(".answer").toggleClass("hidden"); }) $(".faq .faqbutton").click(function(){ if($(this).hasClass("expanded")){ $(".faq").find("h4").removeClass("brown") $(".faq").find(".answer").addClass("hidden"); $(this).removeClass("expanded") $(this).html("Expand All Questions and Answers Below.") } else { $(".faq").find("h4").addClass("brown"); $(".faq").find(".answer").removeClass("hidden"); $(this).addClass("expanded") $(this).html("Collapse All Questions and Answers Below.") } }) $(window).resize(Modal.resize); $("#modalcloser").click(Modal.close); }) var Cookie={ set:function(c_name,value, options) { var expireDays = options.expires || 1; var today = new Date(); today.setDate(today.getDate() + expireDays); document.cookie=c_name + "=" + escape(value) + ";expires=" + today.toUTCString() + ";path=/"; }, get:function(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return null; }, remove:function(c_name) {this.set(c_name,"",-1);} } var showBanner = function(id) { $(".homebanner1,.homebanner2,.homebanner3,.homebanner4").addClass("hidden"); $(".homebanner" + id).removeClass("hidden"); } var spotlightTag = function(category, isMovie) { var random = Math.random() * 10000000000000 var type = isMovie ? "moavi893" : "linkl861" var ping = new Image() ping.src = "http://fls.doubleclick.net/activityi;src=2701519;type=" + type + ";cat=exjad" + category + ";ord=1;num=" + random } var thal_p0 = function(){location.href = "/transfusion-dependent-beta-thalassemia/efficacy/mild-to-moderate-cardiac-iron-toxicity.jsp";} var thal_p1 = function(){location.href = "/transfusion-dependent-beta-thalassemia/efficacy/severe-cardiac-iron-toxicity.jsp";} var thal_p2 = function(){location.href = "/transfusion-dependent-beta-thalassemia/efficacy/preventing-cardiac-iron-loading.jsp";} var thal_learn = function(){location.href = "/transfusion-dependent-beta-thalassemia/efficacy/mild-to-moderate-cardiac-iron-toxicity.jsp";} var lowe_p0 = function(){location.href = "/myelodysplastic-syndromes/efficacy/liver-iron-concentration.jsp";} var lowe_p1 = function(){location.href = "/myelodysplastic-syndromes/efficacy/lpi.jsp";} var lowe_learn = function(){location.href = "/myelodysplastic-syndromes/efficacy.jsp";} var sick_p0 = function(){location.href = "/sickle-cell-disease/efficacy/extension-data.jsp";} var sick_p1 = function(){location.href = "/sickle-cell-disease/efficacy.jsp";} var sick_learn = function(){location.href = "/sickle-cell-disease/efficacy.jsp";} var apla_p0 = function(){location.href = "/aplastic-and-other-anemias/efficacy.jsp";} var apla_learn = function(){location.href = "/aplastic-and-other-anemias/efficacy/aplastic-anemia.jsp";} var refTwo = function(){location.href = "/tools-and-resources/references.jsp#69";} var refThree = function(){location.href = "/tools-and-resources/references.jsp#23";} var refFour = function(){location.href = "/tools-and-resources/references.jsp#32";} var refFive = function(){location.href = "/tools-and-resources/references.jsp#52";} var videoPlay = function(){ _gaq.push(['_trackPageview', '/MOA_video']); if (location.href.indexOf("scientific-and-clinical-materials") > -1) spotlightTag('603', true) else if (location.href.indexOf("accumulation-of-toxic-iron") > -1) spotlightTag('828', true) } var leavingsite = function(link){ var modal2 = "\ "; $("body").append(modal2); $("#modalcontent2").load('/leavingsite.jsp', function(){ $("#modalcontent2 .button").click(function(){ $("#modalcontainer2").remove(); if($(this).hasClass("okbutton")) { window.open(link) } }) } ) var h = $("#modalbody2").height(); var l = (document.documentElement.offsetWidth / 2) - 250; var t = ($(window).height() > h + 200) ? 200 : ($(window).height() - h) / 2; var sl = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); var st = Math.max(document.documentElement.scrollTop, document.body.scrollTop); $("#modalbody2").css({ left : (sl + l) + "px", top : (st + t) + "px" }); $("#modalbody2").width("500px"); $("#modalmask2").hide(); var sh = Math.max(document.body.scrollHeight, $(window).height()); var sw = Math.max(document.body.scrollWidth,$(window).width()); $("#modalmask2").css({ height : sh + "px", width : sw + "px" }); $("#modalmask2").show(); $("#modalcontainer2").removeClass("hidden"); $("#modalcloser2").click(function(){$("#modalcontainer2").remove()}); } /*********************************** Send to a Friend ***********************************/ function submitEmailForm() { // Serialize the form // serialize() returns a query string; serializeArray() returns an array of JSON objects (name, value) var formData = $('#frmSendToAFriend').serializeArray(); // Add the current URL and page title to the form data formData.push({"name":"url","value":document.location.href}); formData.push({"name":"title","value":document.title}); // We want to encode the query string so that we can come back to the edit page with the values pre-populated if ($('#SubmitAction').val() == 'Preview') formData.push({"name":"queryString","value":$.param(formData)}); // Load the same page, in the same place with new data var url = siteroot + 'friendform.jsp'; $("#modalcontent").load(url, formData, function(reponseText, textStatus, XMLHttpRequest) {}); } function submitEmailPreview(action) { var queryString = $('#queryString').val(); queryString = queryString.replace("action=Preview", "action="+action); var url = siteroot + 'friendform.jsp'; $("#modalcontent").load(url, queryString, function(reponseText, textStatus, XMLHttpRequest) {}); } /*********************************** Search ***********************************/ function searchfield() { var search = $("#searchkey").val(); search = $.trim(search); search = escapeHTML(search); //document.searchform["searchkeynew"].value = search; $('#searchkeynew').val(search); }