
// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// Include this script on your page
// then make image rollovers simple like:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//
// http://jehiah.com/archive/simple-swap
// 


function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
		x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

var aryImages = new Array();

aryImages[1] = "images/photos/house.jpg";
aryImages[2] = "images/photos/woodenwindow.jpg";
aryImages[3] = "images/photos/woodenwindow&trim.jpg";
aryImages[4] = "images/photos/windowovertub.jpg";
aryImages[5] = "images/photos/window&door.jpg";
aryImages[6] = "images/photos/SlidersInside.jpg";
aryImages[7] = "images/photos/bay.jpg";
aryImages[8] = "images/photos/frenchdoors_deb.jpg";
aryImages[9] = "images/photos/showerdoor_glassblock.jpg";
aryImages[10] = "images/photos/patioslider.jpg";
aryImages[11] = "images/photos/roundshower.jpg";
aryImages[12] = "images/photos/browndoors.jpg";
aryImages[13] = "images/photos/reddoors.jpg";
aryImages[14] = "images/photos/neo-angle-open.jpg";
aryImages[15] = "images/photos/MasterBRwindow.jpg";
aryImages[16] = "images/photos/roofdeck1.jpg";

aryImages[17] = "images/photos/roofdeck.jpg";
aryImages[18] = "images/photos/glassrailing3.jpg";
aryImages[19] = "images/photos/glassRailing2.jpg";
aryImages[20] = "images/photos/exterior.jpg";
aryImages[21] = "images/photos/livingroom.jpg";
aryImages[22] = "images/photos/glassrailcloseup.jpg";
aryImages[23] = "images/photos/glassrail.jpg";
aryImages[24] = "images/photos/glassblockoutside.jpg";
aryImages[25] = "images/photos/glassblockinside.jpg";
aryImages[26] = "images/photos/fulllengthmirror.jpg";
aryImages[27] = "images/photos/frontDoor.jpg";
aryImages[28] = "images/photos/frenchDoors.jpg";
aryImages[29] = "images/photos/roundmirror.jpg";
aryImages[30] = "images/photos/door&window.jpg";
aryImages[31] = "images/photos/door-window-railing.jpg";
aryImages[32] = "images/photos/blueshower.jpg";
aryImages[33] = "images/photos/bigmirror2.jpg";
aryImages[34]= "images/photos/shower_deb.jpg";
aryImages[35]= "images/photos/stainedglass.jpg";

for (i=0; i < aryImages.length; i++) {
	var preload = new Image();
	preload.src = aryImages[i];
}

function swap(imgIndex, imgTarget) {
	document[imgTarget].src = aryImages[imgIndex];
}

