// JavaScript Document
function reDo(){ window.location.reload() }
    window.onresize = reDo;

//Define global variables
	    var timerID = null;
		var timerOn = false;
//		var timecount = 500;
//		var what = null;
//		var newbrowser = true;
//		var check = false;

//function drawHi() {
//	var mysplit = id.split("_");

//	document.write("<img src=\"../images/hi"+mysplit[0]+".gif\" alt=\"\" name=\"hi"+mysplit[0]+"\" width=\"529\" height=\"3\" id=\"hi"+mysplit[0]+"\">");
//}

function getQuittingClass() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 2) {
		document.write("<li class=\"stepsOn\">");
		}
		else {
		document.write("<li class=\"steps\">");
		}
}
function getSuccessfulClass() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 1) {
		document.write("<li class=\"rewardsOn\">");
		}
		else {
		document.write("<li class=\"rewards\">");
		}
}
function getResourceClass() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 3) {
		document.write("<li class=\"helpOn\">");
		}
		else {
		document.write("<li class=\"help\">");
		}
}
function pageSubNavigation() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 2 && mysplit[1] == 0) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 1) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 2) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><span class=\"on\">1. Prepárate</span> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 3) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <span class=\"on\">2. Obtén apoyo</span> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 4) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <span class=\"on\">3. Aprende nuevas habilidades</span> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 5) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <span class=\"on\">4. Medicamentos</span> &nbsp;|&nbsp; <a href=\"staying.asp\">5. Permanecer sin fumar</a></div>");
		}
		else if (mysplit[0] == 2 && mysplit[1] == 6) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGrey\"><a href=\"getready.asp\">1. Prepárate</a> &nbsp;|&nbsp; <a href=\"getsupport.asp\">2. Obtén apoyo</a> &nbsp;|&nbsp; <a href=\"skills.asp\">3. Aprende nuevas habilidades</a> &nbsp;|&nbsp; <a href=\"medication.asp\">4. Medicamentos</a> &nbsp;|&nbsp; <span class=\"on\">5. Permanecer sin fumar</span></div>");
		}
		else if (mysplit[0] == 1 && mysplit[1] == 1) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavOrange\"><a href=\"readstories.asp\">Lee sus historias</a> &nbsp;|&nbsp; <a href=\"rewards.asp\">Recompensas de dejar de fumar</a> &nbsp;|&nbsp; <span class=\"on\">Las 10 razones más comunes para dejar de fumar</span></div>");
		}
		else if (mysplit[0] == 1 && mysplit[1] == 2) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavOrange\"><a href=\"readstories.asp\">Lee sus historias</a> &nbsp;|&nbsp; <a href=\"rewards.asp\">Recompensas de dejar de fumar</a> &nbsp;|&nbsp; <a href=\"topten.asp\">Las 10 razones más comunes para dejar de fumar</a></div>");
		}
		else if (mysplit[0] == 1 && mysplit[1] == 3) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavOrange\"><span class=\"on\">Lee sus historias</span> &nbsp;|&nbsp; <a href=\"rewards.asp\">Recompensas de dejar de fumar</a> &nbsp;|&nbsp; <a href=\"topten.asp\">Las 10 razones más comunes para dejar de fumar</a></div>");
		}
		else if (mysplit[0] == 1 && mysplit[1] == 0) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavOrange\"><a href=\"readstories.asp\">Lee sus historias</a> &nbsp;|&nbsp; <span class=\"on\">Recompensas de dejar de fumar</span> &nbsp;|&nbsp; <a href=\"topten.asp\">Las 10 razones más comunes para dejar de fumar</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 0) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 1) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><span class=\"on\">Guías</span> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas  </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 2) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <span class=\"on\">Sitios </span> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas  </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 3) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <span class=\"on\">Datos y sugerencias rápidas</span>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 4) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <span class=\"on\">Programas y apoyo</span> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 5) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <span class=\"on\">Líneas telefónicas </span> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 6) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas </a> &nbsp;|&nbsp; <span class=\"on\">Organizaciones de salud pública</span></div>");
		}
		else if (mysplit[0] == 3 && mysplit[1] == 7) {
		document.write("<div id=\"pageSubNavigation\" class=\"SubNavGreen\"><a href=\"guides.asp\">Guías</a> &nbsp;|&nbsp; <a href=\"comprehensive.asp\">Sitios </a> &nbsp;|&nbsp; <a href=\"quick.asp\">Datos y sugerencias rápidas</a>  &nbsp;|&nbsp; <a href=\"programs.asp\">Programas y apoyo</a> &nbsp;|&nbsp; <a href=\"quitlines.asp\">Líneas telefónicas </a> &nbsp;|&nbsp; <a href=\"public.asp\">Organizaciones de salud pública</a></div>");
		}
		else  {
		}
	}
function SubheaderImage() {
	var mysplit	= id.split("_");
	SubpageId = mysplit[0];
	document.write("<img src=\"../images/headers/SubHeader_"+SubpageId+".gif\" alt=\"\" width=\"300\" border=\"0\" height=\"26\" style=\"display:block;\" />");
}

function headerImage() {
	pageId = id;
	document.write("<img src=\"../images/headers/"+pageId+".gif\" alt=\"\" height=\"27\" border=\"0\" style=\"display:block;\" />");
}

//Purpose: Opens up new browser window according to PMUSA specs 011409
function openNewBrowserWindow(strURL)
			{
				var today = new Date();				
				var timestamp = today.getTime();

				//Begin WebTrends click-tracking
				try {
					if (WebTrends){//Verify that the WebTrends object exists, if it does not, we cannot continue
						if (WebTrends&&(typeof(_tag)=="undefined")){ 
							//If the WebTrends object exists, but an instance does not, instantiate a new object
							var _tag=new WebTrends();
							var _webTrendsExtender=new ALCSWebTrendsExtender();					
						}
						var url="";
						if ((strURL.toLowerCase().indexOf("redirect.asp?targeturl=")!=-1)||(strURL.toLowerCase().indexOf("redirect.asp?url=")!=-1)){
							//If the redirect is being used
							//Capture the URL of the anchor tag and pass the info to the WebTrends object
							url = strURL.substring(strURL.indexOf("=")+1);
						} else { //Otherwise use the value of strURL
							url = strURL;
						}						
						var host="";
						var uri="";
						var qry="";
						//RegEx for Parsing URL
						var urlRegEx = new RegExp(/^((https?):\/\/)?([^:\/\?\#\s]+)([^\?]+)?([\?]+.*)?$/); // changed 1/12/09
						//Parse the URL using a reg. expression, we cannot use JavaScript's e.hostname, e.pathname...etc
						var m = urlRegEx.exec(url);	
						if (m!=null){
							host=m[3];
							uri=m[4];
							qry=m[5]||"";
						} else {
							uri=url;
						}
						var title = "Offsite: " + host+uri+qry; //CHANGED 1/12/09
						var contentGroup = _webTrendsExtender.GetContentGroup();
						_tag.dcsMultiTrack("DCS.dcssip",host,"DCS.dcsuri",uri,"DCS.dcsqry",qry,"WT.ti",title,"WT.dl","24","WT.cg_n",contentGroup);						
					}									
				} catch (ex) {
					//Suppress error messages
				}
				//End WebTrends click-tracking
				window.open(strURL, timestamp, 'toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes');
			}
// End new window script			

function aboutLink() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 5 && mysplit[1] == 0) {
		document.write("Acerca de QuitAssist&reg;<!--<a href=\"../about/index.asp\">About QuitAssist&reg;</a>-->");
		}
		else {
		document.write("<a href=\"../about/index.asp\">Acerca de QuitAssist&reg;</a>");
		}
	}

	
function getguideLink() {
	var mysplit	= id.split("_");
	if (mysplit[0] == 4 && mysplit[1] == 0) {
		document.write("Descarga la Gu&iacute;a Recursos QuitAssist&reg;");
		}
		else {
		document.write("<a href=\"../getguide/index.asp\">Descarga la Gu&iacute;a Recursos QuitAssist&reg;</a>");
		}
	}
	
/*function switchLink() {
	var mysplit	= id.split("_");
	if (mysplit[0] == "z") {
		document.write("<span class=\"black\">QuitAssist En Espa&ntilde;ol</span>");
		}
		else {
		document.write("<a href=\"http://winstage.vml.com/philipmorris/quitassist_spanish/index_flash.asp\">QuitAssist En Espa&ntilde;ol</a>");
		}
	}


function transformExtLink(){
	docAddress = (""+document.location+"")
	docAddress = docAddress.toLowerCase()	
	
	engLoc = docAddress
		re1 = /\/quitassist\//
	spanLoc = docAddress
		re2 = /\/quitassist_spanish\//
		esLoc = "/quitassist_spanish/"
		enLoc = "/quitassist/"

	if (re1.test(engLoc)) {
		var str = docAddress.replace(/(^.*)\/quitassist\/(.*$)/, "$1"+ esLoc +"$2");
		document.location.href = (str); // prints "Two One Three"
	}
	if (re2.test(spanLoc)) {
		var str = docAddress.replace(/(^.*)\/quitassist_spanish\/(.*$)/, "$1"+ enLoc +"$2");
		document.location.href = (str); // prints "Two One Three"
	}
}
*/
function transformExtLink(){
	docAddress = (""+document.location+"");
	docAddress = docAddress.toLowerCase();	
	engLoc = docAddress;
		re1 = /\/en\//;
	spanLoc = docAddress;
		re2 = /\/es\//;
		esLoc = /es/;
		enLoc = /en/;

	if (re1.test(engLoc)) {
		var str = docAddress.replace(/(^.*)\/en\/(.*$)/, "$1"+ esLoc +"$2");
		document.location.href = (str);
	}
	if (re2.test(spanLoc)) {
		var str = docAddress.replace(/(^.*)\/es\/(.*$)/, "$1"+ enLoc +"$2");
		document.location.href = (str);
	}
}


function init() {
      //alert ("Running Init"+id);

      if (document.layers) {
            //  alert ("Running Netscape 4");
            layerRef="document.layers";
            styleSwitch="";
            visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";
          } else if(document.all) {
              //  alert ("Running IE");
              layerRef="document.all";
              styleSwitch=".style";
              visibleVar="visible";
			  screenSize = document.body.clientWidth + 18;
			  what ="ie";
		  } else if(document.getElementById) {
            //  alert ("Running Netscape 6");
            layerRef="document.getElementByID";
            styleSwitch=".style";
            visibleVar="visible";
			what="moz";
		  } else {
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
 		  }
		//window.status='status bar text to go here';
		check = true;
  	 	}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function showLayer(layerName){
   if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
}

function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
}

function hideAll(){
			//hideLayer('mnu1');
			//hideLayer('mnu2');
			//hideLayer('mnu3');
			//hideLayer('mnu4');
}

function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;
	        }
}

function stopTime() {
	        if (timerOn) {
    	        clearTimeout(timerID);
                timerID = null;
                timerOn = false;
	        }
}

function onLoad(){
			init();
}


//Printer and email pop up
function openPopupWindow(strURL, intWidth, intHeight, strPopupOptions)
{
	
	var today = new Date();
	
	var timestamp = today.getTime();

	window.open(strURL,timestamp,"width="+intWidth+",height="+intHeight+","+strPopupOptions);
}


<!-- use this comment tag to hide the enclosed code from old browsers.

var debug = false;
var overrideFlash = false;

// These Variables can be used in the outside world as indicators of various plugins
var hasSWDirector = false; // has the Shockwave Director
var versionSWDirector = ""; // version of the Shockwave Director - 7.0 or up
var hasFlash = false; // has Macromedia Flash
var versionFlash = ""; // version of the Shockwave Director - 5.0 or up

//************************************
// variables to handle MCR url redirect

//var DEFAULTBASEURL="http://mcr.us.icoke.com/"
var OS,browser,version,total,thestring;
var detect = navigator.userAgent.toLowerCase();
var DEFAULTBASEURL="http://localhost:8888/mcr/"; //replace for the document.domain for final production

//***************************
// A few variables to help figure out what platform we're on

var allPlugins = navigator.plugins;
var arraylength = allPlugins.length;

var ie  = (navigator.appName.toLowerCase().indexOf("microsoft") != -1);
	 ie  = ie || (navigator.appName.toLowerCase().indexOf("aol") != -1);
var ns  = (navigator.appName.toLowerCase().indexOf("netscape") != -1);
var win = (navigator.platform.toLowerCase().indexOf("win") != -1);
var mac = (navigator.platform.toLowerCase().indexOf("mac") != -1);
var browserVer = parseFloat(ie ? navigator.appVersion.substring(navigator.appVersion.toLowerCase().indexOf("msie") + 4) : navigator.appVersion);



//***************************
// For detecting the shockwave plugin for Netscape.
// This function can return a boolean or a floating point value.
// If you supply a reqVer value (number) it will return true or false
// depending on if that version or higher was found.
// If you don't supply a parameter it will return the found version number.

function detectNsVer() {
  // This function returns a floating point value which should be the version of the Shockwave plugin or 0.0
  // This function only returns useful information if called from Netscape or IE Mac 5.0+

  if (!navigator.plugins) return (""); // IE Mac 4.5 and lower don't have a plugins array.

  // Set these local variables to avoid the Netscape 4 crashing bug.
  thearray = navigator.plugins
  arraylen = thearray.length

	if (debug)  alert ("Plugins found - " + arraylen);
  // Step through each plugin in the array.
  for (i=0; i < arraylen; i++) {
    // Set these local variables to avoid the Netscape 4 crashing bug.
    theplugin = thearray[i]
    thename   = theplugin.name
    thedesc   = theplugin.description

	if (debug)  alert ("detectNsVer: Name - " + thename + "; Desc - " + thedesc);
	// If the plugin is Shockwave...
    if (thename.indexOf("Shockwave") != -1 && thename.indexOf("Director") != -1) {
      // ...extract the version information
      versionString = thedesc.substring(thedesc.indexOf("version ") + 8);
      if (versionString.indexOf(".") > 0) {
        versionMajor = versionString.substring(0,versionString.indexOf("."));
        versionMinor = versionString.substring(versionString.indexOf(".") + 1);
        if (versionMinor.indexOf(".") > 0)
          versionMinor = versionMinor.substring(0,versionString.indexOf("."))
                         + versionMinor.substring(versionMinor.indexOf(".") + 1);
        versionString = parseInt(versionMajor) + "." + versionMinor;
      }
      versionSWDirector = versionString;
    }
    if (thename.indexOf("Shockwave") != -1 && thename.indexOf("Flash") != -1) {
      // ...extract the version information
	  versionFlash = thedesc.substring(thedesc.indexOf(".") - 1);
    }
  }
  return ("");
}

//***************************
// For detecting the ActiveX for ie win.
// Requires vbscript function (VBGetShockwaveVer) above to be included on
// the page to do the actual checking.
// Returns version found or "" (blank string).
// This function will return String version value.

function shockwaveDetectAxVer() {
  // this function returns a floating point value which should be the version of the Shockwave control or 0.0
  // this function should only be called from Internet Explorer for Windows

  if (ie && win) {
    // loop backwards through the versions until we get a bite
    for (i=8;i>0;i--) {
      versionString = VBGetShockwaveVer(i);
      if (versionString != "0.0") {
        // if we get 1.0 we assume it is actually 6.0
        versionNumStr = (versionString == "1.0" ? "6.0" : versionString)
        return (versionNumStr);
      }
    }
  }
  return ("");
}

//***************************
// For detecting the ActiveX for ie win.
// Requires vbscript function (VBGetShockwaveVer) above to be included on
// the page to do the actual checking.
// Returns version found or "" (blank string).
// This function will return String version value.

function flashDetectAxVer() {
  // this function should only be called from Internet Explorer for Windows

  if (ie && win) {
    // loop backwards through the versions until we get a bite
    for (i=9;i>0;i--) {
      versionString = VBGetFlashVer(i);
      if (versionString != "0.0") {
        return (versionString);
      }
    }
  }
  return ("");
}

function canDetectShockwave() {
  // Determine the browser version
  var browserVer = parseFloat(ie ?
                     navigator.appVersion.substring(navigator.appVersion.toLowerCase().indexOf("msie") + 4) :
                     navigator.appVersion);

	if (debug)  alert ("Browser Version : " + browserVer + ",  " + ie  + ",  " + win  + ",  " + ns  + ",  " + mac );

  // Return the appropriate value based on the browser, version and platform
  if (ie && win) return (browserVer >= 4.0) // Works in Windows IE 4.0 and better
  if (ie && mac) return (browserVer >= 5.0) // Works in Mac IE 5.0 and better
  if (ns)        return (browserVer >= 3.0) // Works in Netscape 3.0 and better

  // If none of the above conditions matched, the browser is
  // unknown and likely doesn't support detection
  return false;
}

if (canDetectShockwave()) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');

	document.write('Function VBGetShockwaveVer(i) \n');
	document.write('  on error resume next \n');
	document.write('  Dim swControl, swVersion \n');
	document.write('  swVersion = "0.0" \n');

	document.write('  set swControl = CreateObject("SWCtl.SWCtl." + CStr(i)) \n');
	document.write('  if (IsObject(swControl)) then \n');
	document.write('    swVersion = CStr(i) + ".0" \n');
	document.write('    swVersion = CStr(swControl.ShockwaveVersion("")) \n');
	document.write('  end if \n');

	document.write('  VBGetShockwaveVer = swVersion \n');
	document.write('End Function \n');

	document.write('Function VBGetFlashVer(i) \n');
	document.write('	on error resume next \n');
	document.write('	Dim flashVersion, flashControl \n');
	document.write('	flashVersion = "0.0" \n');

	document.write('	set flashControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i)) \n');
	document.write('	if (IsObject(flashControl)) then \n');
	document.write('		flashVersion = CStr(i) + ".0" \n');
	document.write('	end if \n');

	document.write('  VBGetFlashVer = flashVersion \n');
	document.write('End Function \n');

	document.write('</SCRIPT\> \n');

	if (debug)  alert ("In for detecting SW");
	if (ie && win) {
		versionSWDirector = shockwaveDetectAxVer();
		versionFlash = flashDetectAxVer();
	} else {
		detectNsVer();
	}

	hasSWDirector = (versionSWDirector.length > 0 && (parseFloat(versionSWDirector) >= 7.0));
	hasFlash = (versionFlash.length > 0 && (parseFloat(versionFlash) >= 6.0));

	if (overrideFlash == true) {
		if (debug)  alert ("Overriding Flash - assuming HTML version.");
		hasFlash = false;
		hasSWDirector = false;
	}
}
