// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// JavaScript Functions For Community Forge                01/2003
// ----------------------------------------         stray@stray.ch  
//                                             *  *        *
// This library provides a couple of functions      *  //     *
// for everyday webdesign tasks                 *    /. .\  *
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-m-U-m-=-=-=-=


// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Preload a list of images
// Usage: preload('file1.gif', 'file2.gif', ...);

function preload() {
   if (document.images) {
      for (var i = 0; i < preload.arguments.length; i++) {
         this[i+1] = new Image();
         this[i+1].src = preload.arguments[i];
      }
   }
}


// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show an image instead of the existing image tag
// HTML:  <IMG src="old_image.gif" name="image_tag_name">
// Usage: select('image_tag_name', 'new_image.gif"');

function select(i,newsrc) {
   if (document.images) {
      document.images[i].src = newsrc ;
   }    
}


// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Open a pop-up window
// Usage: popup('url.html', 600, 400);
// Usage: popup('url.html', 600, 400, 'location=1,scrollbars=1');

function popup(url,w,h,args) {
   window.open(url,'_blank','height='+h+',width='+w+','+args);
}

function popsame(url,samename,w,h,args) {
   window.open(url,samename,'height='+h+',width='+w+','+args);
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Are you sure you want to ...
//

function areyousure(action,url) {
  if (confirm(action)) {
    location.href=url;
  }
}


