// http://www.daniweb.com/forums/thread22560.html

var theImages = new Array()

//Random-loading images
theImages[0] = '/images/sandcastle-before-after.jpg' // replace with names of images
theImages[1] = '/images/woman-before-after.jpg' // replace with names of images
theImages[2] = '/images/woman-and-horse-before-after.jpg' // replace with names of images
theImages[3] = '/images/boy-water-before-after.jpg' // replace with names of images

var j = 0
var p = theImages.length;
var preBuffer = new Array()

for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

function showImage(){
if(whichImage==0){
document.write('<a href ="/comparisons/index.php"><img src="'+theImages[whichImage]+'" border=0 width=215 height=259></a>');
}
else if(whichImage==1){
document.write('<a href ="/comparisons/index.php"><img src="'+theImages[whichImage]+'" border=0 width=215 height=259></a>');
}
else if(whichImage==2){
document.write('<a href ="/comparisons/index.php"><img src="'+theImages[whichImage]+'" border=0 width=215 height=259></a>');
}
else if(whichImage==3){
document.write('<a href ="/comparisons/index.php"><img src="'+theImages[whichImage]+'" border=0 width=215 height=259></a>');
}
else if(whichImage==4){
document.write('<a href ="/comparisons/index.php"><img src="'+theImages[whichImage]+'" border=0 width=215 height=259></a>');
}

}



	//Popup Window Script © CJ Website Design
function popUp(url){
	window.open(url,"pop","width=650,height=500,toolbars=0,scrollbars=1")
}

//pop-up window function
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(); }
}
