// this preloads the images
colorON = new Image();
colorON.src = "/navimages/bikes/colorsover.gif"; 
colorOFF = new Image();
colorOFF.src = "/navimages/bikes/colors.gif"; 

compareON = new Image();
compareON.src = "/navimages/bikes/compareover.gif"; 
compareOFF = new Image();
compareOFF.src = "/navimages/bikes/compare.gif"; 


geometryON = new Image();
geometryON.src = "/navimages/bikes/geometryover.gif"; 
geometryOFF = new Image();
geometryOFF.src = "/navimages/bikes/geometry.gif"; 


name = document.location; 
oldname = name.substring(name.lastIndexOf('/') + 1);
newimage = oldname.replace('_spec_','_');

function preloadlarge() {   //preloads the large image of the bike for future viewing
  if (document.images) {
  largeimage = document.images.bike.src;
  largeimage = largeimage.substring(largeimage.lastIndexOf('/') + 1);
  largeimage = largeimage.substring(0,largeimage.indexOf('_')) + largeimage.substring(largeimage.lastIndexOf('_'));
  
  large_image = new Image();
    large_image.src = largeimage;   //need to add proper path here
  }  
} 


function newWindow(location) {
  leftPos = 0
  if (screen) {
    leftPos = screen.width-300
  }
  myWindow = window.open(location, 'myName', 'width=300,height=320,resizable=yes,left='+leftPos+',top=0')
  myWindow.focus()
}


function open_window(url) {
  lview = window.open(url,"smallwindow",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=320,height=340');
  //lview = window.open(url,"smallwindow");
  lview.focus();
}


function go() {
  name = "redir_win";
  window.open(document.redirector.location.options[document.redirector.location.selectedIndex].value,name);
} 


function loadimage(imageName, imageLocation) {
   if (document.images) document.images[imageName].src = imageLocation;
   return true;
}

function imageview() {
  leftPost = 0
  if (screen){
    leftPos = screen.width - 1030;
  }
  window.open('large-image.html' + '?' + document.images.bike.src,'largeview','width=1000,height=700,left=' + leftPos + ',top=0,screenx=0,screeny=' + leftPos);
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
