/* AstraZeneca.com additional JS functions */ function addMasterScript(){ //this adds in the master root.js file which includes all basic JS functionality //this must be included in all local js files //Do not copy code from the root.js file, use this function to import it instead if(document.getElementById){ //browser supports getElementById - attempt to add js functionality //this is a site-specific js file so include the master //create a script element if(document.createElement){ var elRootScript=document.createElement('script'); if(elRootScript){ //include master file elRootScript.src='/_mshost81109/system/styles/root/javascript/root.js'; //elRootScript.src='../styles/root/javascript/root.js'; elRootScript.type='text/javascript'; //get a handle to this script file elHead=document.getElementsByTagName('head'); if(elHead){ //get script elExistingScript=document.getElementsByTagName('script'); if(elExistingScript){ //add into head before previous element elHead[0].insertBefore(elRootScript,elExistingScript[0]); //attachEvents function is called when the master file loads //so global functionality is still enabled } } } } } } //call the above function addMasterScript(); //v1.7 // Flash Player Version Detection // Detect Client Browser type // Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved. //adapted and stripped down var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function getVersion() { var version; var axo; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { //very old version or not installed or not IE version=-1; } return version; } // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available function detectFlashVer(reqMajorVer, reqMinorVer, reqRevision){ versionStr = getVersion(); if (versionStr == -1 ) { return false; } else if (versionStr !== 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function testFlash(){ //only checks for IE if(isIE){ if(!detectFlashVer(9,0,17)){ //flash 9.0.16 or lower //detect Flash object, replace with HTML //when filename matches AZ_video_ //config: detect this string var strToDetect='az_video'; //config: replace flash move with this var strFlash='Please upgrade to the latest version of Flash to see this video'; if(document.createElement){ var flashObjectsToReplace=document.getElementsByTagName('param'); if(flashObjectsToReplace){ var nodesArray=[]; var flashObjectsToRemove=[]; for(i=0;i