nav1 = new Image();
nav1.src = 'http://libonlinepub.halifaxpubliclibraries.ca/gifs/sched_Workst.gif';

nav2 = new Image();
nav2.src = 'http://libonlinepub.halifaxpubliclibraries.ca/gifs/sched_Workst.gif';

function swapImg(imgName,imgSrc) {

if (imgName == 'nav1')
 {
    document.nav1.src=imgSrc;
  }
 else
{
    document.nav2.src=imgSrc;
 }

//document[imgName].src = imgSrc;

}

var mainWin = null;
function launchApp(url)
{
  //document['nav'].src = '/gifs/sched_Workst.gif';
	//alert( "got into launchApp and url " + url );
 
  var browser = navigator.appName; 
  var version = parseInt(navigator.appVersion); 

  var warning = "Sorry. You may not start another session while you have a session open.\n\nPlease close your previous session first before starting another.";

  if( browser.indexOf( "Netscape" ) != -1  && version >= 3 )
  {
	window.location.reload(true);
    if( mainWin )
    {
      if( mainWin.name != null )
      {
        alert( warning );
        return;
      }
    }
  }
  else if ( browser.indexOf( "Microsoft" ) != -1 && version >= 4 )
  {
    if( mainWin != null )
    {
      if( ! mainWin.closed )
      {
        alert( warning );
        return;
      }
    }
  }
  else if ( browser.indexOf( "Microsoft" ) != -1 && version >= 2 )
  {
    // no way found for IE 3.x to detect if mainWin has been closed;
    // allow IE 3.x to login again and regain the previous session;
  }
  else
  {
    alert( "Sorry. Our system currently supports certain versions of the Netscape and Microsoft browsers only. Please download the latest of these browsers and try again.\n\n( Your current browser is detected as '" + browser + " " + version + "' )" )
    return;
  }

  var now = new Date();
  var theTime = now.getTime();


  if (!window.opener)
  {
    /* removed alert to fix problems with Gecko based browsers (firefox 4+)*/
    // alert("Please close this window when you are done.");
  }
   
  mainWin = window.open(url, "mainWindow", "status,scrollbars,resizable,width=640,height=700");

  var browser = navigator.appName; 
  var version = parseInt(navigator.appVersion); 

  if ( (browser.indexOf( "Netscape" ) != -1 && version >= 3) || (browser.indexOf( "Microsoft" ) != -1 && version >= 4 ) )
  {       
    mainWin.focus();
  }
 
 
}
