
// This js file should be kept *section*-specific in order minimize code overhead;
// If scripts are co-opted to other sections, then move scripts to common js files;

// -------------------------------------------------------------------------------


//..... POPUP LOADER script;
//..... script intended to run onload;
//..... script searches for a.biography elements;
//..... adds onclick event [popmeup(this)] to each;
//..... script is invisible to non-scripted browsers;
//..... if script fails or is ignored, then hard-coded link remains untouched:


  // check if autorunList$ exists and has value:
    var autorunList$ = (autorunList$)? autorunList$ : '';
  // add poploader() to autorunList$ for autoRun() [see defaults.js]:
    autorunList$ += 'poploader();'


  function poploader()
    {
    //alert('running poploader');
    var elements$$ = document.getElementsByTagName('a');
    if(elements$$)
      {
      for(var i=0; i<elements$$.length; i++)
        {
        if(elements$$[i].className.indexOf('biography') > (-1)) elements$$[i].onclick = addonclick;
        }
      }
    }


  // event registry:

  function addonclick(){ return popmeup(this); }


// POPUP script:
// ... *** add new cases to script to handle new class names in document(s) ***
// ... function and associated code is invisible to non-scripted browsers;
// ... function intercepts href and substitutes window.open() method--but only in js-enabled browsers;
// ... script-failure in scripted browsers returns true;
// ... if script is ignored or fails, original html <a href> remains;
// ... option included for user to dis-allow pop-ups, although not in use on EFMF site:

  function popmeup(thislink)
    {
    //if(!document.killpopups.havemercy.checked) return true;

    var class$ = (thislink.className.split(' '))

    switch (class$[0])
      {
      case 'biography':
          {
          var name$ = 'bio_WIN';
          var chrome$ = 'width=775,height=575,scrollbars,resizable';
          var href$ = thislink.href;
          }
      case /launch_window/:
          {
          var imagewin = window.open(href$,name$,chrome$);
          imagewin.focus();
          break;
          }
      default : return true;
      }
    return false;
    }


//.....popup killer:
//    <label style="" for="havemercy" title="images will load into a pop-up window unless box is un-checked">
//      load full-sized images in a pop-up window
//      <input style="" id="havemercy" type="checkbox" name="havemercy" checked="checked">
//    </label>


// .......... Edmonton Folk Music Festival : tfannon [at] shaw [dot]ca .......... //
