function ONpreloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.ONp) d.ONp=new Array();
    var i,j=d.ONp.length,a=ONpreloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.ONp[j]=new Image; d.ONp[j++].src=a[i];}}
}

function ONswapImgRestore() { //v3.0
  var i,x,a=document.ONsr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function ONfindObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ONfindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function ONswapImage() { //v3.0
  var i,j=0,x,a=ONswapImage.arguments; document.ONsr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=ONfindObj(a[i]))!=null){document.ONsr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function viewLocation(state) {
	newWindow =
	window.open("locations_popup.cgi","locations","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=500,height=550");
	newWindow.location ="http://www.hammerheadpaintball.com/cgi-bin/locations_popup.cgi?State=" + state;
	newWindow.focus();
}

function viewGallery(photo) {
	newWindow =
	window.open("gallery_popup.cgi","gallery","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=420,height=420");
	newWindow.location ="http://www.hammerheadpaintball.com/cgi-bin/gallery_popup.cgi?photo=" + photo;
	newWindow.focus();
}


var mySlideList = ['images/logocase.jpg', 'images/logocase.jpg', 'images/logo1.jpg', 'images/logo14.jpg', 'images/logo12.jpg', 'images/marauders.jpg', 'images/tsu.jpg'];
var mySlideShow = new SlideShow(mySlideList, 'slide1', 5000, "mySlideShow");

var mySlideList1 = ['images/product_beanie_red.jpg', 'images/product_beanie_black.jpg', 'images/product_beanie_blue.jpg'];
var mySlideShow1 = new SlideShow(mySlideList1, 'slide1', 2500, "mySlideShow1");

var mySlideList2 = ['images/product_hat_red.jpg', 'images/product_hat_black.jpg', 'images/product_hat_yellow.jpg'];
var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 2500, "mySlideShow2");

var mySlideList3 = ['images/product_visor_red.jpg', 'images/product_visor_gray.jpg'];
var mySlideShow3 = new SlideShow(mySlideList3, 'slide3', 2500, "mySlideShow3");

var mySlideList4 = ['images/productblueshirt.jpg', 'images/productblueshirtback.jpg', 'images/productgreyshirtfront.jpg', 'images/productgreyshirtback.jpg','images/productdarkblueshirtfront.jpg', 'images/productdarkblueshirtback.jpg'];
var mySlideShow4 = new SlideShow(mySlideList4, 'slide4', 2500, "mySlideShow4");

var mySlideList5 = ['images/productyellowshirt.jpg', 'images/productyellowshirtback.jpg'];
var mySlideShow5 = new SlideShow(mySlideList5, 'slide5', 2500, "mySlideShow5");

var mySlideList6 = ['images/productjerseyfront.jpg', 'images/productjerseyback.jpg'];
var mySlideShow6 = new SlideShow(mySlideList6, 'slide6', 2500, "mySlideShow6");

function SlideShow(slideList, image, speed, name)          
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(image, slideList[current]);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}

function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}