﻿var start = new Date();
document.onmouseup = stopTimer;

function getImgREL2Ahref(objID)
{
	if (!document.getElementById)
	    return;	
		
    var imgs = document.getElementsByName(objID);

    for(var i=0; i < imgs.length; i++)
    {
        //alert(imgs[i].alt);     
        var command = imgs[i].alt;
        var a = imgs[i].parentNode;
        a.name = command;
        a.onclick = myOnclick;
        a.onmousedown = startTimer;
        //a.onmouseup = decider;
        
        //if( a.attachEvent ){
        //    a.onclick = myOnclick;
        //    a.name = command;
        //} else {
        //    a.onclick = myOnclick;
        //   a.name = command;
        //    //a.setAttribute('onclick', "return hs.expand(this,{slideshowGroup:'" + command + "'})"); 
        //}
    }
}

function myOnclick()
{
    hs.goon = start;         // Calculate the difference
    return hs.expand(this,{slideshowGroup:this.name});
}

function startTimer(){
    start = new Date();
}

function elapsedmilliseconds()// Calculates elapsed time
{
    var now = new Date();           // Grab new copy of date
    var stop = now.getTime();          // Grab current millisecond #
    var diff = stop - start;         // Calculate the difference.
    return diff;                  // Return the difference.
}

function stopTimer()
{
    var d = elapsedmilliseconds();
    //alert("Elapsed milliseconds: " + d);
}