// JavaScript Document

var tabs;
var pictures;
var numberOfPictures;
var currPicture = 0;
var cycleTimer;
var qtimer;
var fadeOutPicture;
var fadeInPicture;
var opacity;
var currHeight = 10;
var nMenuItems = 0;
var XMLHeaderB64="PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/PiAg";
var UniqueID = 314
var newWinOffset=0

// base64 conversion class for Javascript.  Very fast!
// August 7, 2006 by Tony Kaiser


  var base64 = (function () 
        {
            var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

            function encode(instring)
            {
            //get length of string.
            	var x;
            	var iWord;
            	var r=(instring.length % 3);
            	var oStr="";
            	var y;
            	
            	var fourStr;
            	while (r>=0) {instring += " "; r--;}
            
            	for (x=0;x<instring.length-2;x+=3)
            	{
            		iWord=instring.charCodeAt(x) << 8;
            		iWord=(instring.charCodeAt(x+1) | iWord) << 8;
            		iWord = iWord | instring.charCodeAt(x+2);
            	
            		fourStr="";
            		for (y=0;y<4;y++)
            		{
            			fourStr = b64.charAt(iWord & 63) + fourStr;
            			iWord = iWord >> 6;
            		}
            		oStr +=fourStr;
            	}
            	return (oStr);
            }

            function decode (instream)
            {
            	var x,y;
            	var iWord;
            	var oStream="";
            	var os3;
            	for (x=0;x<instream.length-3;x+=4)
            	{
            		iWord=0;
            		for (y=x;y<x+4;y++)				
            		{
            			iWord = (iWord<<6) | b64.indexOf(instream.charAt(y));
            		}
            		os3="";
            		for (y=0;y<3;y++)
            		{
            			os3 = String.fromCharCode(iWord & 255) + os3;
            			iWord = iWord >> 8;
            		}
            		oStream += os3;
            	}
            	return (oStream);
            }
            return {'encode':encode, 'decode':decode};
        })();
  
function makeCornerDiv (radius, colorVal, width, height, elem)
{	
	var r;
	var newDiv = document.createElement("div");
	var newCorner = document.createElement("div");
	var botCorner = document.createElement("div");
	var rightArea = document.createElement("div");
	var leftSpace = document.createElement("div");
	var textArea = document.createElement("div");
	var x, y;

	if (height & 1)
		height++;

	if (radius & 1)
		radius++;

	r = radius * radius;
	newDiv.style.position = 'absolute';
	newDiv.style.width = width + 'px';
	newDiv.style.height = height + 'px';
	leftSpace.style.position = 'absolute';
	leftSpace.style.width = radius + 'px';
	leftSpace.style.height = (height - (2 * radius)) + 'px';
	leftSpace.style.overflow = 'hidden';
	leftSpace.style.left = '1px';
	leftSpace.style.top = radius + 'px';
	leftSpace.style.backgroundColor = colorVal;
	leftSpace.setAttribute('name', 'leftSpace');
	rightArea.style.position = 'absolute';
	rightArea.style.width = (width - radius) + 'px';
	rightArea.style.height = newDiv.style.height;
	rightArea.style.left = radius + 'px';
	rightArea.style.top = '0px';
	rightArea.style.backgroundColor = colorVal;
	rightArea.setAttribute('name', 'rightArea');
	textArea.style.position = 'absolute';
	textArea.style.width = ((width - (radius / 2)) - 3) + 'px';
	textArea.style.left = ((radius / 2) + 3) + 'px';
	textArea.style.top = (radius / 2) + 'px';
	textArea.style.height = (height - radius) + 'px';
	textArea.style.textAlign = 'left';
	textArea.style.zIndex = 3;
	textArea.setAttribute('name', 'textArea');
	newCorner.style.position = 'absolute';
	newCorner.style.width = radius + 'px';
	newCorner.style.height = radius + 'px';
	newCorner.style.top = '0px';
	newCorner.style.left = '0px';
	newCorner.style.overflow = 'hidden';
	botCorner.style.position = 'absolute';
	botCorner.style.width = radius + 'px';
	botCorner.style.height = radius + 'px';
	botCorner.style.bottom = '0px';
	botCorner.style.left = '0px';
	botCorner.style.overflow = 'hidden';
	var topCoord;
	var nDiv;
	var bDiv;

	for (x = 0; x <= radius; x++)
	{
		y = Math.floor(Math.sqrt(r - (x * x)));
		topCoord = radius - y;
		nDiv = document.createElement("div");
		bDiv = document.createElement("div");
		nDiv.style.backgroundColor = colorVal;
		nDiv.style.position = 'absolute';
		nDiv.style.width = '1px';
		nDiv.style.height = y + 'px';
		nDiv.style.top = topCoord + 'px';
		nDiv.style.left = (radius - x) + 'px';
		bDiv.style.backgroundColor = colorVal;
		bDiv.style.position = 'absolute';
		bDiv.style.bottom = topCoord + 'px';
		bDiv.style.left = (radius - x) + 'px';
		bDiv.style.width = '1px';
		bDiv.style.height = radius + 'px';
		newCorner.appendChild(nDiv);
		botCorner.appendChild(bDiv);
	}

	newDiv.appendChild(newCorner);
	newDiv.appendChild(botCorner);
	newDiv.appendChild(leftSpace);
	newDiv.appendChild(rightArea);
	newDiv.appendChild(textArea);
	return (elem.appendChild(newDiv));
}

function getPixelProperty (elem, propertyName)
{
	var prop = elem.style[propertyName];
	prop = parseInt(prop.replace('px', ''), 10);
	return (prop);
}

function getTextElement (elem)
{
	var nodes = elem.childNodes;
	var idx, outputElem = false;

	for (idx = 0; idx < nodes.length; idx++)
	{
		if (nodes[idx].getAttribute('name') == 'textArea')
		{
			outputElem = nodes[idx];
			break;
		}
	}
	return (outputElem);
}

function highlightTopTopRight (elem1)
{
	elem1.style.color = '#155389';
	elem1.style.fontWeight = 'bold';
	elem1.style.cursor = 'default';
}

function unhighlightTopTopRight (elem1)
{
	elem1.style.color = '#ffffff';
	elem1.style.fontWeight = 'normal';
}

function adjustHeight (elem, newHeight)
{
	var nodes = elem.childNodes;
	var idx;
	var leftSpaceNode = 0;
	var rightAreaNode = 0;
	var textNode = 0;
	var cHeight = getPixelProperty(elem, 'height');

	if (newHeight & 1)
		newHeight++;

	elem.style.height = newHeight + 'px';

	for (idx = 0; idx < nodes.length; idx++)
	{
		if (nodes[idx].getAttribute('name') == 'leftSpace')
			leftSpaceNode = nodes[idx];

		if (nodes[idx].getAttribute('name') == 'rightArea')
			rightAreaNode = nodes[idx];

		if (nodes[idx].getAttribute('name') == 'textArea')
			textNode = nodes[idx];
	}

	var radius = (cHeight - getPixelProperty(leftSpaceNode, 'height')) / 2;
	leftSpaceNode.style.height = (newHeight - (2 * radius)) + 'px';
	rightAreaNode.style.height = newHeight + 'px';
	textNode.style.height = (newHeight - radius) + 'px';
}

// encapsulates all the functionality of ajax in a single function.

function logTransaction()
{
 //    alert (arguments.length);
}

function AJAXRequest(sendData, returnFunction, url)
{
   
   var AJAXWrapper = (function ()
   {
      var rFunc; // the return function.
      var sData; // data we're sending. 
      var xhrq; // XMLHTTPRequest object.
      var xURL;
      var errorCode;
      var errorMsg;

      var readyStates = { 'uninitialized' : 0, 'loading' : 1, 'loaded' : 2, 'interactive' : 3, 'complete' : 4 } ;
      var statusCodes = { 'OK' : 200, 'Not Found' : 404 } ;
      function XMLHandler()
      {
         if (xhrq.readyState == readyStates.complete)

            if (xhrq.status == statusCodes.OK)
               rFunc(xhrq.responseXML, xhrq.responseText);
            else
               logTransaction ('AJAXRequest', ['error', 'status failed'], ['status', xhrq.statusText]);
      }

      function init(dataToSend, returnFunc, inURL)
      {
         rFunc = returnFunc;
         if (dataToSend != null)
            sData = new String(dataToSend.xml);         // make a new copy.
         else
            sData = null;
         xURL = new String(inURL);
         errorCode = 0;
         errorMsg = "";

         // make xmlhttprequest -- branch for IE & one for other browsers.
         xhrq = false;
         if (window.XMLHttpRequest)
         {
            try
            {
               xhrq = new XMLHttpRequest();
            }
            catch (e)
            {
               xhrq = false;
            }
         }
         else if (window.ActiveXObject)
         {
            try
            {
               xhrq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
               xhrq = false;
            }
         }
         
         if (xhrq)
         {
            var sendMethod;
            if (dataToSend != null) sendMethod = "POST"; else sendMethod = "GET";
            logTransaction('AJAXRequest', ['xmlout', sData]);
            xhrq.onreadystatechange = XMLHandler;
            xhrq.open(sendMethod, inURL, true);

            if (dataToSend != null)
            {
               xhrq.setRequestHeader('Content-Type', 'text/xml');
               xhrq.send(dataToSend);
            }
            else
               xhrq.send(null);
         }
         else
         {
            errorCode = - 1;
            errorMsg = "No XMLHttpRequest object available in browser.";
         }
      }

      return { 'init' : init, 'XMLHandler' : XMLHandler } ;
   })();
   
   this.readyStates = {'uninitialized' : 0, 'loading' : 1, 'loaded' : 2, 'interactive' : 3, 'complete' : 4 };
   this.statusCodes = { 'OK' : 200, 'Not Found' : 404 } ;
   AJAXWrapper.init(sendData, returnFunction, url);
}

//  ---------------------------------------


function init ()
{
	doLeftNavHomePage();
	var pictureArea = document.getElementById("pictureArea");
	//var pictureArea = document.getElementById("pictureAreaImage");
	
	// comment out because not cylcling through picture
	//pictures = pictureArea.children;
	//pictures[0].filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;

	//if (pictures.length > 1)
	//	cycleTimer = setInterval(changeImage, 4500);
	//now, grab 'quality first' notecard.
    enableTabs();	
	var getNoteCard = new AJAXRequest(null,drawNoteCard,"mvl.htm"); //fire async request for notecard data.
}

function enableTabs()
{
    tabs = new Object({'tabSelected':-1,'tabCount':0});
    tabs.tabArray = new Array();
    tabs.linkArray = new Array();



    var tabDiv = document.getElementById("tabs");

    if (tabDiv != null)
    {
    	var divs = tabDiv.getElementsByTagName("div");

	var idx;
    	var tabCount=0;



    //we populate the tab object with a list of tabs.
    for (idx=0; idx<divs.length; idx++)
    {
        if (divs[idx].className == 'tabText')
        {
            tabs.tabArray[tabCount++] = divs[idx];
		}            
        if ((divs[idx].className == 'tabSelectedText') || (divs[idx].className == 'tabMVLSelectedText'))
        {
            tabs.tabArray[tabCount] = divs[idx];
            tabs.tabSelected = tabCount++;
        }
    }



    }
    

    

   


    
    tabs.tabCount = tabCount;
    
    tabs.linkArray[2]='qualityfirst.htm';
    tabs.linkArray[1]='clinicaltrials.htm';
    tabs.linkArray[0]='mvl.htm';
	//tabs.linkArray[0]='forphysicians.htm';
            
//        newDiv.attachEvent('onclick', gosomewhere);

    for (idx=0; idx<tabs.tabArray.length; idx++)
    {
		if (window.ActiveXObject)
		{
			tabs.tabArray[idx].attachEvent('onclick', refreshTabs);
			tabs.tabArray[idx].mydata=idx;
		}
		else
		{
			tabs.tabArray[idx].addEventListener('click',refreshTabs,false);
			tabs.tabArray[idx].mydata=idx;
		}
	}
    //attach event handlers 
    //alert (tabs.tabSelected);
    //alert (tabs.tabArray.length);
    //alert (tabs.tabArray[tabs.tabSelected].innerHTML);
}

function refreshTabs(eva)
{
    var e_out;
    cancelBubble=true;
    
    var ie_var = "srcElement";
	var moz_var = "target";
	var prop_var = "mydata";
	// "target" for Mozilla, Netscape, Firefox et al. ; "srcElement" for IE
	eva[moz_var] ? e_out = eva[moz_var][prop_var] : e_out = eva[ie_var][prop_var];
	
	var clinicImg = document.getElementById('ClinicalTrialsImg');
	var MVLImg = document.getElementById('MVLImg');
	//var forPhysicianImg = document.getElementById('ForPhysiciansImg');
	var qualityImg = document.getElementById('QualityImg');
	
	var clinic = document.getElementById('ClinicalTrials');
	var forMVL = document.getElementById('MVL');
	//var forPhysician = document.getElementById('ForPhysicians');
	var quality = document.getElementById('Quality');
		
	switch (e_out)
	{
		case 0://'Clinical Trials':
			nLink='clinicaltrials.htm';
			clinic.className="tabSelectedText";
			clinicImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabMiddleSelected.gif')";
			clinicImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddleSelected.gif')";
			clinicImg.rows[0].cells[2].style.backgroundImage="url('Images/folderTabRightSelected.gif')";
			
    		forMVL.className="tabText";
    		MVLImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeftSquare.gif')";
    		MVLImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
    		MVLImg.rows[0].cells[2].style.backgroundImage="url('Images/folderTabRight.gif')";
           			
  			quality.className="tabText";
			qualityImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeft.gif')";
			qualityImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
			break;
			
			
		case 2://'MVL':
			
            nLink='mvl.htm';
    		clinic.className="tabText";
    		clinicImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeftSquare.gif')";
    		clinicImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
    		clinicImg.rows[0].cells[2].style.backgroundImage="url('Images/folderTabRight.gif')";
		
    		forMVL.className="tabMVLSelectedText";
    		MVLImg.rows[0].cells[0].style.backgroundImage="url('Images/folderMVLTabMiddleSelected.gif')";
    		MVLImg.rows[0].cells[1].style.backgroundImage="url('Images/folderMVLTabMiddleSelected.gif')";
    		MVLImg.rows[0].cells[2].style.backgroundImage="url('Images/folderMVLTabRightSelected.gif')";
            
    		quality.className="tabText";
    		qualityImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeft.gif')";
    		qualityImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
			break;
			
		case 1://'Quality':
			nLink='qualityfirst.htm';
			clinic.className="tabText";
			clinicImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeftSquare.gif')";
			clinicImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
			clinicImg.rows[0].cells[2].style.backgroundImage="url('Images/folderTabRight.gif')";
			
    		forMVL.className="tabText";
    		MVLImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeftSquare.gif')";
    		MVLImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddle.gif')";
    		MVLImg.rows[0].cells[2].style.backgroundImage="url('Images/folderTabRight.gif')";
	        	 
			quality.className="tabSelectedText";
			qualityImg.rows[0].cells[0].style.backgroundImage="url('Images/folderTabLeftSelected.gif')";
			qualityImg.rows[0].cells[1].style.backgroundImage="url('Images/folderTabMiddleSelected.gif')";
			break;
	}
	var getNoteCard = new AJAXRequest(null,drawNoteCard,nLink); 
	return;
}

function drawNoteCard(theXML, theText)
{
    //now, we can create an XML document from the text of the HTML -- find the body tag and pull it out, along with everything in
    //between.  Reparse as XML, and insert into document!
    var bodyStart, bodyEnd;
    
    bodyStart = theText.indexOf('>',theText.indexOf('<body')+5)+1;
    bodyEnd = theText.indexOf('body>',bodyStart)-2;
    var nBody = "";//base64.decode(XMLHeaderB64);
    nBody += theText.substr(bodyStart,(bodyEnd-bodyStart));
    //var nXML = new ActiveXObject("MSXML2.DOMDocument.4.0");
    //nXML.async=false;

    // nXML.loadXML(nBody);
    //alert (nXML.documentElement.tagName);
    
	//find notecardWrapper div.



    var noteCardDiv = document.getElementById("notecardWrapper");


    if (noteCardDiv != null)
    {

    	noteCardDiv.innerHTML = nBody;
    }
	
	//alert (nBody);
	//alert (theXML.documentElement.tagName);
}


function changeImage ()
{
	fadeOutPicture = pictures[currPicture];
	fadeInPicture = pictures[getNextPicture()];
	opacity = 0;
	qtimer = setInterval(fadeStep, 70);
}

function fadeStep ()
{
	opacity += 5;
	fadeInPicture.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
	fadeOutPicture.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100 - opacity;

	if (opacity == 100)
	{
		clearInterval(qtimer);
		currPicture = getNextPicture();
	}
}

function getNextPicture ()
{
	var next = currPicture + 1;

	if (next == pictures.length)
		next = 0;

	return (next);
}

var lightBlueDiv;
var xmlhttp;
var blueDiv;

function doLeftNavHomePage ()
{	
	var el=document.getElementById("picture");
	//load images.
	var footerHTML='<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td width="30%" align="left"><a href="webprivacy/webprivacy.htm">Privacy Statement</a>&nbsp;|&nbsp;<a href="termsofusage/termsofusage.htm">Terms of Usage</a></td><td width="70%" align="right">400 East 3rd Street, Duluth, MN 55805 &bull; 218&ndash;786&ndash;8364</td></tr></table>';
	var footerElem;
	if (footerElem = document.getElementById('footer'))
		footerElem.innerHTML = footerHTML;
	
	currOpacity=0;
	currPic=el;
	//iTimer=setInterval(fadeIn,50);
	
	var p=new AJAXRequest(null,finishImageLoad,'piclist.xml');
	
	var elem = document.getElementById("leftNav");
	var elem2;
	lightBlueDiv = makeCornerDiv(16, '#b3d8ea', 220, 64, elem);
	//	lightBlueDiv.setAttribute('id','leftNavLighterBlue');
	lightBlueDiv.style.left = '10px';
	lightBlueDiv.style.top = '14px';

	//addPurpleBar('Access SMDC MyHealth', 'http://www.smdcmyhealth.org');
	addPurpleBar('Access SMDC MyHealth', 'http://www.smdcmyhealth.org');
	addRoyalBlueBar('Find a Physician/Provider', 'findaphysician/findaphysician.asp');
	
	

	//blueDiv = makeCornerDiv(16, '#b3d8ea', 220, 64, elem);
	//blueDiv.setAttribute('id', 'leftNavLighterBlue');
	//blueDiv.style.left = '10px';
	//blueDiv.style.top = '185px';
	//currHeight = 10;
	//lightBlueDiv = blueDiv;
	
	elem2 = addBlueBar('I want to', 'specialtycenters/specialtycenters.htm');
	elem2.style.height = '25px';
	expandBlueBar(elem2, 40);
	var newDiv = addSubMenuDark(elem2);
	var textspot = getTextElement(newDiv);
	textspot.style.color = '#ffffff';
	textspot.style.fontFamily = 'arial';
	textspot.style.fontSize = '11px';
	textspot.style.fontWeight = 'bold';
	textspot.style.lineHeight = '14px';
	textspot.style.textAlign = 'left';
	textspot.innerHTML
		= '<a style="color:#ffffff;" href="findaphysician/makeanappointment.htm" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Make an appointment</a><br /><a style="color:#ffffff;" href="cliniclocations/cliniclocations.htm" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Find hospitals or clinics</a><br /><a style="color:#ffffff;" href="http://www.smdc.org/billinginsurance/onlinebilling.htm" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Pay a bill <br />';

	//	textspot.innerHTML = '<a href="specialtycenters/cancercenter/cancercenter.htm">Cancer Center</a><br />St. Mary' + "'" + 's Duluth Clinic Heart Center' + '<br />Digestive Health Center' + '<br />Bone, Joint, &amp; Spine Center';
	newDiv = addBlueBar('Services and Specialties', 'otherspecialties/otherspecialties.htm');
	addBlueBar('Fitness & Therapy Center', 'otherspecialties/fitnesstherapycenter/fitnesstherapycenter.htm');
	addBlueBar('Research', 'otherspecialties/researchstudies/researchstudies.htm');
	addBlueBar('About Us', 'aboutus/aboutus.htm');
	
	elem2 = addBlueBar('Our Affiliates', 'http://www.smdc.org/ouraffiliates/ouraffiliates.htm');
	elem2.style.height = '25px';
	expandBlueBar(elem2, 125);
	var newDiv = addSubMenuDark(elem2);
	var textspot = getTextElement(newDiv);
	textspot.style.color = '#ffffff';
	textspot.style.fontFamily = 'arial';
	textspot.style.fontSize = '11px';
	textspot.style.fontWeight = 'bold';
	textspot.style.lineHeight = '14px';
	textspot.style.textAlign = 'left';
	textspot.innerHTML
		= '<a style="color:#ffffff;" href="http://www.smdc.org" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> SMDC Health System</a><br /><a style="color:#ffffff;" href="http://www.smdcmedicalcenter.org/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> SMDC Medical Center</a><br /><a style="color:#ffffff;" href="http://www.stmarysduluth.org/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> St. Mary' + "'" + 's Medical Center <br /><a style="color:#ffffff;" href="http://www.duluthchildrens.org" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Duluth Children' + "'" + 's <br /><a style="color:#ffffff;" href="http://www.polinskyrehabilitationcenter.org/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Polinsky Rehabilitation Center</a><br /><a style="color:#ffffff;" href="http://www.stmaryshospitalsuperior.org/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> St. Mary' + "'" + 's Hospital of Superior</a><br /><a style="color:#ffffff;" href="http://www.pinemedicalcenter.org/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Pine Medical Center</a><br /><a style="color:#ffffff;" href="https://www.mwmedical.com/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Midwest Medical Equipment</a><br /><a style="color:#ffffff;" href="http://www.rainylakemedical.com/" onmouseover="this.style.color='
			  + "'" + '#c7eaef' + "'" + ';" onmouseout="this.style.color=' + "'" + '#ffffff' + "'"
			  + '"> Rainy Lake Medical Center</a><br />';

	//	textspot.innerHTML = '<a href="specialtycenters/cancercenter/cancercenter.htm">Cancer Center</a><br />St. Mary' + "'" + 's Duluth Clinic Heart Center' + '<br />Digestive Health Center' + '<br />Bone, Joint, &amp; Spine Center';

	
	//newDiv.attachEvent('onclick', gosomewhere);

	
	//blueDiv = makeCornerDiv(16, '#b3d8ea', 220, 64, elem);
	//blueDiv.setAttribute('id', 'leftNavLighterBlue');+
	//blueDiv.style.left = '10px';
	//blueDiv.style.top = '405px';
	//currHeight = 10;
	//lightBlueDiv = blueDiv;
	//addBlueBar('Patient Resources', 'patientresources/patientresources.htm');
//	addBlueBar('Provider Resources', 'providerresources/providerresources.htm');
	//addBlueBar('Billing & Insurance', 'billinginsurance/billinginsurance.asp');
}

function gosomewhere ()
{
	window.location = 'otherspecialties/otherspecialties.htm';
}

function goToSpecialties ()
{
	window.location = 'specialtycenters/specialtycenters.htm';
}

function doLeftNav ()
{
	var elem = document.getElementById("leftNav");
	lightBlueDiv = makeCornerDiv(16, '#d9e9f2', 220, 64, elem);
	lightBlueDiv.setAttribute('id', 'leftNavLighterBlue');
	lightBlueDiv.style.left = '10px';
	lightBlueDiv.style.top = '14px';
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

	if (xmlhttp)
	{
		xmlhttp.onreadystatechange = xmlhttpChange;
		xmlhttp.open("GET", "ctSitemap.xml", true);
		xmlhttp.send();
	}
}

function isChildOf (pageURL, currNode)
{
	if (currNode.getAttribute('url').toLowerCase() == pageURL)
		return (true);

	else
	{
		var pages = currNode.getElementsByTagName('page');
		var y;
		var returnVal = false;

		for (y = 0; y < pages.length; y++)
		{
			if (pages[y].getAttribute('url').toLowerCase() == pageURL)
			{
				returnVal = true;
				break;
			}
		}

		return (returnVal);
	}
}

var depth = 0;

function xmlhttpChange ()
{
	var y;
	var root;
	var pages;
	var ourPage;
	var currBar;
	var currNode;
	var currPath;
	var pathParts;
	var currPage;

	if (xmlhttp.readyState == 4)
	{
		if (xmlhttp.status == 200)
		{
			currPath = new String(window.location.pathname);
			pathParts = currPath.split('/');
			currPage = pathParts[pathParts.length - 1];
			currPage = currPage.toLowerCase();

			root = xmlhttp.responseXML.documentElement;
			pages = root.getElementsByTagName('page');

			for (y = 0; y < pages.length; y++)
			{
				if (pages[y].getAttribute('url').toLowerCase() == currPage)
				{
					alert('XML Site Map loaded ok, this page title:' + pages[y].getAttribute('title'));
					ourPage = pages[y];
					break;
				}
			}

			currNode = ourPage;

			while (currNode.parentNode)
			{
				currNode = currNode.parentNode;
				depth++;
			}

			currNode = currNode.childNodes[1];
			var currTitle;
			var currURL;
			var p;

			for (p = 0; p < currNode.childNodes.length; p++)
			{
				currTitle = new String(currNode.childNodes[p].getAttribute('title'));
				currURL = new String(currNode.childNodes[p].getAttribute('url'));
				currURL = currURL.toLowerCase();

				if (isChildOf(currPage, currNode.childNodes[p]))
				{
					currBar = addLightBlueBar(currTitle, '');

					if ((currNode.childNodes[p].hasChildNodes()) && depth >= 3)
						addLevel3(currBar, currNode.childNodes[p].childNodes, currPage);
				}
				else
					addBlueBar(currTitle, '');
			}
		}
	}
}

function addLevel3 (barDiv, nodeList, pageURL)
{
	var lines = nodeList.length;
	var newHTML = new String();
	var newHeight = (lines * 16);

	expandBlueBar(barDiv, newHeight);

	var newNav = addSubMenu(barDiv);

	var textSpot = getTextElement(newNav);
	textSpot.className = 'subNavLightBlueText';
	var idx, currTitle, currURL;

	var nRow, nCell, nLink;
	var newNode, idy;
	var nodeList2;
	var nRow2, nCell2, nBr;

	for (idx = 0; idx < nodeList.length; idx++)
	{
		currTitle = nodeList[idx].getAttribute('title');
		currURL = nodeList[idx].getAttribute('url');

		nCell = document.createElement('span');
		nCell.style.height = '9px';

		if (isChildOf(pageURL, nodeList[idx]))
		{
			nLink = document.createElement('a');
			nLink.setAttribute('href', currURL);
			nLink.innerText = currTitle;
			nCell.appendChild(nLink);

			//NOW, we have to add it's children (if any)
			if (nodeList[idx].hasChildNodes())
			{
				nodeList2 = nodeList[idx].childNodes;
				newHeight += (nodeList2.length * 16);

				addExpandBlueBar(barDiv, nodeList2.length * 16);
				adjustHeight(newNav, getPixelProperty(barDiv, 'height') - 10);

				for (idy = 0; idy < nodeList2.length; idy++)
				{
					currTitle = nodeList2[idy].getAttribute('title');
					currURL = nodeList2[idy].getAttribute('url').toLowerCase();
					nRow2 = document.createElement('br');
					nCell.appendChild(nRow2);

					if (currURL != pageURL)
					{
						nLink = document.createElement('a');
						nLink.setAttribute('href', currURL);
						nLink.style.paddingLeft = '10px';
						nLink.innerHTML = currTitle;
					}
					else
					{
						nLink = document.createElement('span');
						nLink.style.fontWeight = 'bold';
						nLink.style.paddingLeft = '10px';
						nLink.style.color = '#004477';
						nLink.innerHTML = '&bull;&nbsp;' + currTitle;
					}

					nCell.appendChild(nLink);
				}
			}
		}
		else
		{
			nLink = document.createElement('a');
			nLink.setAttribute('href', currURL);
			nLink.innerText = currTitle;
			nCell.appendChild(nLink);
		}

		nBr = document.createElement('br');
		nCell.appendChild(nBr);
		textSpot.appendChild(nCell);
	}
}

var rightArrowImage = 0;
var bluebarElem = 0;

function createRightImage ()
{
}

function makeDivClass (classNameOf)
{
	var newElem = document.createElement("div");
	newElem.className = classNameOf;
	return (newElem);
}

function addBlueBar (nameOf, URL)
{
	var elem;
	var bluebarElem = makeDivClass('bluebar');
	var downArrowImage = document.createElement("img");
	downArrowImage.setAttribute('src', 'Images/smallDownArrow.gif');
	downArrowImage.className = 'arrow';
	bluebarElem.appendChild(downArrowImage);
	bluebarElem.appendChild(makeDivClass('topCorner'));
	bluebarElem.appendChild(makeDivClass('topRight'));
	elem = makeDivClass('middleExpand');
	elem.style.height = '1px';
	var elem2 = document.createElement("img");
	elem2.style.height = '1px';
	elem2.setAttribute('src', 'Images/blueBarMiddle12by1.gif');
	elem.appendChild(elem2);
	bluebarElem.appendChild(elem);
	elem = makeDivClass('bottomCorner');
	elem.style.top = '13px';
	bluebarElem.appendChild(elem);
	elem = makeDivClass('bottomRight');
	elem.style.top = '13px';
	bluebarElem.appendChild(elem);

	elem = makeDivClass('textArea');
	elem2 = document.createElement("a");
	elem2.setAttribute('href', URL);
	elem2.innerHTML = nameOf;
	elem.appendChild(elem2);
	bluebarElem.appendChild(elem);
	bluebarElem.style.top = currHeight + 'px';
	//bluebarElem.attachEvent('onmouseover', highlightBar);
	//bluebarElem.attachEvent('onmouseout', unHighlightBar);
	lightBlueDiv.appendChild(bluebarElem);
	currHeight += 29;
	adjustHeight(lightBlueDiv, currHeight + 6);
	return (bluebarElem);
}

function addPurpleBar (nameOf, URL)
{
	var divs = new Array('topCorner', 'bottomCorner', 'rightArea');
	var idn;

	var purple = makeDivClass('purplebar');

	for (idn = 0; idn < 3; idn++)
	{
		purple.appendChild(makeDivClass(divs[idn]));
	}

	var newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/purpleMiddleLeft12by1.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '0px';
	newImg.style.top = '12px';
	newImg.style.height = '1px';
	newImg.style.zIndex = 3;

	purple.appendChild(newImg);
	var circleDiv = document.createElement('div');
	circleDiv.style.position = 'absolute';
	circleDiv.style.left = '9px';
	circleDiv.style.top = '5px';
	circleDiv.style.width = '13px';
	circleDiv.style.height = '13px';
	circleDiv.style.overflow = 'hidden';
	circleDiv.setAttribute('name', 'circleDiv');
	circleDiv.style.zIndex = 4;

	newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/yellowCircleOnPurple13by13.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '0px';
	newImg.style.top = '0px';
	newImg.style.zIndex = 4;
	circleDiv.appendChild(newImg);

	newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/rightArrowForYellowCircle.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '4px';
	newImg.style.top = '3px';
	newImg.style.zIndex = 6;
	circleDiv.appendChild(newImg);

	var hl = document.createElement('div');
	hl.style.position = 'absolute';
	hl.style.width = '3px';
	hl.style.height = '5px';

	hl.style.left = '5px';
	hl.style.top = '4px';
	hl.style.zIndex = 5;
	hl.style.overflow = 'hidden';
	hl.style.backgroundColor = '#216b9e';
	hl.setAttribute('name', 'arrowLeft');
	circleDiv.appendChild(hl);

	hl = document.createElement('div');
	hl.style.position = 'absolute';
	hl.style.width = '1px';
	hl.style.height = '1px';
	hl.style.left = '8px';
	hl.style.top = '6px';
	hl.style.zIndex = 5;
	hl.style.overflow = 'hidden';
	hl.setAttribute('name', 'arrowRight');
	hl.style.backgroundColor = '#216b9e';
	circleDiv.appendChild(hl);

	purple.appendChild(circleDiv);

	var textA = makeDivClass('purplebarLink');

	var newLink = document.createElement('a');
	newLink.setAttribute('href', URL);
	newLink.innerHTML = nameOf;

	textA.appendChild(newLink);

	purple.appendChild(textA);
	purple.style.height = '25px';
	purple.style.top = currHeight + 'px';
	
	if (window.ActiveXObject)
	{
		purple.attachEvent ('onmouseover', highlightTopBar);
		purple.attachEvent ('onmouseout', unHighlightTopBar);
	}
	else
	{
		purple.addEventListener('mouseover',highlightTopBar,false);
		purple.addEventListener('mouseout',unHighlightTopBar,false);
	}

	lightBlueDiv.appendChild(purple);
	currHeight += 29;
	adjustHeight(lightBlueDiv, currHeight + 6);
	return (purple);
}

function highlightTopBar (eventObj)
{
	var source;
	 if (window.ActiveXObject)
	 {
		source = eventObj.srcElement;
	 }
	 else
	 {
		source = eventObj.target;
	 }
	var nDepth = 0;

	while ((source.className != 'purplebar') && (source.className != 'royalbluebar'))
	{
		source = source.parentNode;
		nDepth++;
	}

	if (nDepth < 3)
	{
		var cNode;
		var nodes = source.childNodes;
		//	if (source.className == 'purplebar')
		//	nodes[5].className = 'purplebarLink';

		cNode = nodes[4].childNodes[2];
		cNode.style.backgroundColor = '#95c2da';
		nodes[4].childNodes[3].style.backgroundColor = '#95c2da';
		nodes[5].style.color = '#c7e9f5';
	}
}

function unHighlightTopBar (eventObj)
{
	var source;
	 if (window.ActiveXObject)
	 {
		source = eventObj.srcElement;
	 }
	 else
	 {
		source = eventObj.target;
	 }
	 
	var nDepth = 0;

	while ((source.className != 'purplebar') && (source.className != 'royalbluebar'))
	{
		source = source.parentNode;
		nDepth++;
	}

	if (nDepth < 3)
	{
		var cNode;
		var nodes = source.childNodes;
		cNode = nodes[4].childNodes[2];
		cNode.style.backgroundColor = '#216b9e';
		nodes[4].childNodes[3].style.backgroundColor = '#216b9e';
		nodes[5].style.color = '#ffffff';
	}
}

function addRoyalBlueBar (nameOf, URL)
{
	var divs = new Array('topCorner', 'bottomCorner', 'rightArea');
	var idn;

	var purple = makeDivClass('royalbluebar');

	for (idn = 0; idn < 3; idn++)
	{
		purple.appendChild(makeDivClass(divs[idn]));
	}

	var newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/royalBlueBarMiddleLeft12by1.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '0px';
	newImg.style.top = '12px';
	newImg.style.height = '1px';
	newImg.style.zIndex = 3;

	purple.appendChild(newImg);

	var circleDiv = document.createElement('div');
	circleDiv.style.position = 'absolute';
	circleDiv.style.left = '9px';
	circleDiv.style.top = '5px';
	circleDiv.setAttribute('name', 'circleDiv');
	circleDiv.style.width = '13px';
	circleDiv.style.height = '13px';
	circleDiv.style.overflow = 'hidden';
	circleDiv.style.zIndex = 4;

	newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/yellowCircleOnBlueTop13by13.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '0px';
	newImg.style.top = '0px';
	newImg.style.zIndex = 4;
	circleDiv.appendChild(newImg);

	newImg = document.createElement('img');
	newImg.setAttribute('src', 'Images/rightArrowForYellowCircle.gif');
	newImg.style.position = 'absolute';
	newImg.style.left = '4px';
	newImg.style.top = '3px';
	newImg.style.zIndex = 6;
	circleDiv.appendChild(newImg);

	var hl = document.createElement('div');
	hl.style.position = 'absolute';
	hl.style.width = '3px';
	hl.style.height = '5px';

	hl.style.left = '5px';
	hl.style.top = '4px';
	hl.style.zIndex = 5;
	hl.style.overflow = 'hidden';
	hl.setAttribute('name', 'arrowLeft');
	hl.style.backgroundColor = '#216b9e';
	circleDiv.appendChild(hl);

	hl = document.createElement('div');
	hl.style.position = 'absolute';
	hl.style.width = '1px';
	hl.style.height = '1px';
	hl.style.left = '8px';
	hl.style.top = '6px';
	hl.style.zIndex = 5;
	hl.setAttribute('name', 'arrowRight');
	hl.style.overflow = 'hidden';
	hl.style.backgroundColor = '#216b9e';
	circleDiv.appendChild(hl);

	purple.appendChild(circleDiv);

	var textA = makeDivClass('textArea');

	var textA = makeDivClass('purplebarLink');

	var newLink = document.createElement('a');
	newLink.setAttribute('href', URL);
	newLink.innerHTML = nameOf;

	textA.appendChild(newLink);

	purple.appendChild(textA);
	purple.style.height = '25px';
	purple.style.top = currHeight + 'px';
	//purple.attachEvent('onmouseover', highlightTopBar);
	//purple.attachEvent('onmouseout', unHighlightTopBar);
	if (window.ActiveXObject)
	{
		purple.attachEvent ('onmouseover', highlightTopBar);
		purple.attachEvent ('onmouseout', unHighlightTopBar);
	}
	else
	{
		purple.addEventListener('mouseover',highlightTopBar,false);
		purple.addEventListener('mouseout',unHighlightTopBar,false);
	}

	lightBlueDiv.appendChild(purple);
	currHeight += 29;
	adjustHeight(lightBlueDiv, currHeight + 6);
	return (purple);
}

function addLightBlueBar (nameOf, URL)
{
	var elem;
	var bluebarElem = makeDivClass('lightBluebar');
	bluebarElem.style.height = '25px';
	var downArrowImage = document.createElement("img");
	downArrowImage.setAttribute('src', 'Images/smallDownArrowLighterBlue.gif');
	downArrowImage.className = 'arrow';
	bluebarElem.appendChild(downArrowImage);
	bluebarElem.appendChild(makeDivClass('topCorner'));
	bluebarElem.appendChild(makeDivClass('topRight'));
	elem = makeDivClass('middleExpand');
	elem.style.height = '1px';
	var elem2 = document.createElement("img");
	elem2.style.height = '1px';
	elem2.setAttribute('src', 'Images/lightBlueBarMiddle12by1.gif');

	elem.appendChild(elem2);
	bluebarElem.appendChild(elem);

	elem = makeDivClass('bottomCorner');
	elem.style.top = '13 px';
	bluebarElem.appendChild(elem);

	elem = makeDivClass('bottomRight');
	elem.style.top = '13 px';

	bluebarElem.appendChild(elem);
	elem = makeDivClass('textArea');
	elem.innerHTML = nameOf;
	bluebarElem.appendChild(elem);
	bluebarElem.style.top = currHeight + 'px';
	lightBlueDiv.appendChild(bluebarElem);
	currHeight += 29;
	adjustHeight(lightBlueDiv, currHeight + 6);

	return (bluebarElem);
}

function expandBlueBar (elem, newHeight)
{
	var idx;
	var expandDiv = false;
	var expandImg = false;
	var bottomRightDiv = false;
	var bottomCornerDiv = false;
	var newBottom;
	newHeight += 24;

	if (newHeight & 1)
		newHeight++;

	elem.style.height = newHeight + 'px';

	for (idx = 0; idx < elem.childNodes.length; idx++)
	{
		if (elem.childNodes[idx].className == 'middleExpand')
			expandDiv = elem.childNodes[idx];

		if (elem.childNodes[idx].className == 'bottomRight')
			bottomRightDiv = elem.childNodes[idx];

		if (elem.childNodes[idx].className == 'bottomCorner')
			bottomCornerDiv = elem.childNodes[idx];
	}

	if (expandDiv)
	{
		expandDiv.style.height = newHeight + 'px';
		expandImg = expandDiv.childNodes[0];
		expandImg.style.height = newHeight + 'px';
		newBottom = getPixelProperty(bottomRightDiv, 'top');
		newBottom += (newHeight - 1);

		newBottom += 'px';

		bottomRightDiv.style.top = newBottom;
		bottomCornerDiv.style.top = newBottom;
		currHeight += newHeight;
		adjustHeight(lightBlueDiv, currHeight);
	}
}

function addExpandBlueBar (elem, newHeight)
{
	var idx;
	var expandDiv = false;
	var expandImg = false;
	var bottomRightDiv = false;
	var bottomCornerDiv = false;
	var newBottom;
	var delta = newHeight;

	newHeight += getPixelProperty(elem, 'height');

	if (newHeight & 1)
		newHeight++;

	elem.style.height = newHeight + 'px';

	for (idx = 0; idx < elem.childNodes.length; idx++)
	{
		if (elem.childNodes[idx].className == 'middleExpand')
			expandDiv = elem.childNodes[idx];

		if (elem.childNodes[idx].className == 'bottomRight')
			bottomRightDiv = elem.childNodes[idx];

		if (elem.childNodes[idx].className == 'bottomCorner')
			bottomCornerDiv = elem.childNodes[idx];
	}

	if (expandDiv)
	{
		expandDiv.style.height = newHeight + 'px';
		expandImg = expandDiv.childNodes[0];
		expandImg.style.height = newHeight + 'px';
		newBottom = getPixelProperty(bottomRightDiv, 'top');
		newBottom += (delta);

		newBottom += 'px';

		bottomRightDiv.style.top = newBottom;
		bottomCornerDiv.style.top = newBottom;
		currHeight += delta;
		adjustHeight(lightBlueDiv, currHeight);
	}
}

function addSubMenu (parentElem)
{
	var newHeight = getPixelProperty(parentElem, 'height');

	if (newHeight & 1)
		newHeight++;

	newHeight -= 10;
	var newMenu = makeCornerDiv(12, '#a6dce7', 200, newHeight, parentElem);
	newMenu.style.right = '0px';
	newMenu.style.top = '22px';
	return (newMenu);
}

function addSubMenuDark (parentElem)
{
	var newHeight = getPixelProperty(parentElem, 'height');

	if (newHeight & 1)
		newHeight++;

	newHeight -= 10;
	var newMenu = makeCornerDiv(12, '#6397bb', 200, newHeight, parentElem);
	newMenu.style.right = '0px';
	newMenu.style.top = '22px';
	return (newMenu);
}

function highlightBar (eventObj)
{
	var source = eventObj.srcElement;
	var nDepth = 0;

	while ((source.className != 'bluebar') && (source.className != 'lightBluebar'))
	{
		source = source.parentNode;
		nDepth++;
	}

	if (nDepth < 3)
	{
		var nodes = source.childNodes;
		var idx;

		for (idx = 0; idx < nodes.length; idx++)
		{
			if (nodes[idx].className == 'arrow')
				nodes[idx].className = 'arrowHighlight';

			if (nodes[idx].className == 'textArea')
				nodes[idx].className = 'textAreaHighlight';
		}
	}
}

function unHighlightBar (eventObj)
{
	var source = eventObj.srcElement;

	while ((source.className != 'bluebar') && (source.className != 'lightBluebar'))
		 source = source.parentNode;

	var nodes = source.childNodes;
	var idx;

	for (idx = 0; idx < nodes.length; idx++)
	{
		if (nodes[idx].className == 'arrowHighlight')
			nodes[idx].className = 'arrow';

		if (nodes[idx].className == 'textAreaHighlight')
			nodes[idx].className = 'textArea';
	}
}

function gotoLink2(theForm)
{
    window.open(document.getElementById('groupscombo').value);
}
function gotoLink4(theForm)
{
    window.open(document.getElementById('cmecombo').value);
}
function gotoLink3(theForm)
{
    window.open(document.getElementById('classescombo').value);
}

function finishImageLoad(theXML,theText)
{

	var gfx=theXML.documentElement.getElementsByTagName('image');

	for (var ix=0;ix<gfx.length;ix++)
	{

		imageArray[nImages]=new Image();
		picLinkArray[nImages]=new String(gfx[ix].getAttribute('link'));
		imageArray[nImages++].src = gfx[ix].getAttribute('url');

	}
	currPic=0;
	mPic=document.getElementById('picture');

	document.getElementById('placeHolder').src=imageArray[currPic].src;
	iTimer=setInterval(fadeIn,50);
}

function doPicLink()
{
	window.location = picLinkArray[currPic];	
}

var picLinkArray=new Array();
var currOpacity;
var currPic;
var iTimer;
var imageArray=new Array();
var currImageIndex;
var nImages=0;
var lastImage=false;
var lightUps=new Array();

function doNextImage1()
{
	clearInterval(iTimer);
	iTimer=setInterval(fadeOut,50);
}
function fadeIn()
{
	currOpacity+=5;
	if (currOpacity==100) {
		clearInterval(iTimer);
		iTimer=setInterval(doNextImage1,4000);
		}
	setOpacity(mPic,currOpacity);
}

function fadeOut()
{
	currOpacity-=5;
	setOpacity(mPic,currOpacity);
	if (currOpacity==0) 
	{
		clearInterval(iTimer);
		currPic++;
		if (currPic>=nImages) currPic=0;
		document.getElementById('placeHolder').src=imageArray[currPic].src;
		iTimer=setInterval(fadeIn,50);
	}	

}


function setOpacity(obj,alpha)
{
	if (window.ActiveXObject)
		obj.filters.alpha.opacity=alpha;
	else
		obj.style.opacity=(alpha/100);
}

function getOpacity(obj)
{
	if (window.ActiveXObject)
		return (obj.filters.alpha.opacity);
	else
		return Math.floor(obj.style.opacity*100);
}

function PlayAudio(soundfiledesc,soundfilepath) 
{ 
PlayWin = window.open('',UniqueID,'width=320,height=190,top=' + newWinOffset +',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
PlayWin.focus(); 

var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc + "</TITLE></HEAD><BODY bgcolor='rgb(66, 93, 146)'>"; 
winContent += "<B style='font-size:13px;font-family:Arial, Helvetica, sans-serif;line-height:1.5;color:white;font-weight:bold'>" + soundfiledesc + "</B>";

winContent += "<OBJECT width='325' height='42'>"; 
winContent += "<param name='SRC' value='" + soundfilepath + "'>";
winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
winContent += "<param name='CONTROLLER' VALUE='true'>";
winContent += "<param name='BGCOLOR' VALUE='rgb(66, 93, 146)'>"; 
winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='rgb(66, 93, 146)'></EMBED>";
winContent += "</OBJECT>"; 


winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>"; 
winContent += "</BODY></HTML>"; 


PlayWin.document.write(winContent); 
PlayWin.document.close(); // "Finalizes" new window 
UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
} 
