document.lastImgs = new Array;

function PreloadImages() { 
  images = new Array;
  for (x=0; x<PreloadImages.arguments.length; x++) {
  	images[x]=new Image;
  	images[x].src=PreloadImages.arguments[x];
  	}
}

function SwapImage () {
  if (document.images) {
   if (document.lastImgs.length) {
      RestoreImage();
   }
   a = SwapImage.arguments;
   inum = 0;
   for (x = 0; x < a.length; x+=2) {
      oldimg = a[x];
      newimg = a[x+1];
      if (document.images[oldimg].src.indexOf(newimg) == -1) {
         document.images[oldimg].oldsrc = document.images[oldimg].src;
         document.images[oldimg].src=newimg;
      }
      
      document.lastImgs[inum] = oldimg;
      inum++;
   
    }
  }
}

function RestoreImage () {
  if (document.images) {
   for (x = 0; x < document.lastImgs.length; x++) {
      img = document.lastImgs[x];
      document.images[img].src=document.images[img].oldsrc;
   }
   document.lastImgs = new Array;
  }
}

function newWindow(url, height, width, nameW) {
    if (nameW==""){nameW='popup';}
 if (navigator.appVersion.indexOf('4') != -1) {
 // Vars for centering the new window on Version 4 Browsers
 xTop = screen.width/2 - (width/2);
 yTop = screen.height/2 - (height/2);
 window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
 } else {
 window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
 }
}

