


pstatus = 'off';


//toddg: I don't think these are in use any more.
var oldid = '';
var oldbid = 'benefit1';
var oldfid = 'f1';


//open a new browser window on a page where the user
//can download the firefox or safari WMP plugins.
 function gotoDownloadPage()
        {
  
          if(navigator.userAgent.toLowerCase().indexOf('firefox')>-1)
            window.open("https://addons.mozilla.org/firefox/plugins/");
          
          else if(navigator.userAgent.toLowerCase().indexOf('safari')>-1)
            window.open("http://www.microsoft.com/mac/otherproducts/otherproducts.aspx?pid=windowsmedia");
        }

//a hash table to store all the object tags to
//play videos for a page. Use registerVideo() method
//to add a new video and removeVideo() method to delete, 
//and getVideo() to retrieve the html.
var videoObjectTags = new Array;

function getVideo(key)
{
    return videoObjectTags[key];
}

function registerVideo(key, html)
{
    videoObjectTags[key] = html;
}

function removeVideo(key, html)
{
    delete videoObjectTags[key];
}




//home page
function swapimage(imgid,imgsrc,imgstate)
{
    //alert(imgid + ' ' + imgsrc+ ' ' + imgstate);
    var objimg = document.getElementById(imgid);
    objimg.src = imgsrc.replace(/.jpg/,imgstate + ".jpg");
}

//start video playback.
function startVideo(vidId)
{
    var vid = document.getElementById(vidId);
    if(vid == null) return;
    
    //start in IE.
    if (navigator.userAgent.indexOf("IE") > -1)
    {
        try
        {
            //vid.Play();
         }
         catch(ex)
         {
           alert(ex.message);
         }
    }
       
    
    //start in firefox and hopefully others.
    else
    {
    
        var params = vid.getElementsByTagName("param");
        for(i=0;i<params.length;i++)
        {
           if(params[i].name.toLowerCase()=="autostart")
            params[i].value = 1;
        }
   
    }
}


//stop video playback.
function stopVideo(vidId)
{


    var vid = document.getElementById(vidId);
    if(vid == null) return;
    
    //stop in IE.
    if (navigator.userAgent.indexOf("IE") > -1)vid.Stop();
    
    //stop in firefox and hopefully others.
    else
    {
    
        var params = vid.getElementsByTagName("param");
        for(i=0;i<params.length;i++)
        {
           if(params[i].name.toLowerCase()=="autostart")
            params[i].value = 0;
        }
   
    }
}


//Used for FAQ
function showit(idnum)
{
	var newelem = document.getElementById(idnum);
	if (newelem.style.display == 'inline') 
    {
        newelem.style.display = 'none';
    }
    else
    {
    newelem.style.display = 'inline';
    }
}

//What is this?
function showbenefit(idnum,bg)
{
	var topelem = document.getElementById(oldbid);

	if (topelem != null)
	{
		topelem.style.display = 'none';
		var navelem = document.getElementById(bg + oldbid);
		if (navelem != null) {
			navelem.style.color = '#ffe500';
		}
	}
	var newelem = document.getElementById(idnum);
	newelem.style.display = 'inline';
	var navelem2 = document.getElementById(bg + idnum);
	if (navelem2 != null) {
		navelem2.style.color = '#ffffff';
	}
	oldbid = idnum;
}


//IS THIS USED?
function setactive(idnum)
{
    oldfeature = idnum;
}



   



//Sets the opacity of the given img to the given value.
//'value' should be set to 0-100 .
function lightImage(img, value)
{
    img.style.opacity = value/100;
    img.style.filter = 'alpha(opacity=' + value + ')';
}

//uses the imageid to find the image object then calls lightImage();
function lightup(imageid, value){
    var imageobject = document.getElementById(imageid);
    if (imageobject != null) lightImage(imageobject, value);
}



function checkForPlugin(pluginName)
{

    var lcName = pluginName.toLowerCase();
    for(i=0;i<navigator.plugins.length;i++)
    {
        //if a match, return true.
        if(navigator.plugins[i].name.toLowerCase().indexOf(lcName)>-1)return true;
        
    }
    
    //not found, return false.
     return false;
}

function checkForMimeType(mimeType)
{
    return (navigator.mimeTypes["video/x-ms-wmv"]!=null);
}


function play2(obj)
{
	if (navigator.userAgent.indexOf("IE") > -1) {
		
	}
	else {
		obj = document.objMediaPlayer;
	}

	if (pstatus == 'off')
	{
		obj.Play();
		pstatus = 'on';
	}
	else
	{
		obj.Stop();
		pstatus = 'off';
	}
}


startList = function() 
{
    if (document.all && document.getElementById) 
    {
        navRoot = document.getElementById('topnav');

        for (i=0; i<navRoot.childNodes.length; i++) 
        {
            node = navRoot.childNodes[i];
	  
            if (node.nodeName=='LI') 
            {
  	            node.onmouseover=function() 
  	            {
  		            this.className+=' navover';
                }
	  	        node.onmouseout=function() 
	  	        {
	  		        this.className=this.className.replace(' navover', "");
	   	        }
	    
	        } 
	    } 
	    navRoot = document.getElementById('bottomnav');
	    if (navRoot != null)
        {
            for (i=0; i<navRoot.childNodes.length; i++) 
            {
                node = navRoot.childNodes[i];
    	  
                if (node.nodeName=='LI') 
                {
  	                node.onmouseover=function() 
  	                {
  		                this.className+=' navover';
                    }
	  	            node.onmouseout=function() 
	  	            {
	  		            this.className=this.className.replace(' navover', "");
	   	            }
    	    
	            } 
	        } 
	    }
	    navRoot = document.getElementById('tile-wrap');
	    
	    
    }
}



