// Bettingerphoto.com JavaScript Functions

function swapPic() {
var imgnum = images.length - 1;
do {
var randnum = Math.random();
rand1 = Math.round((imgnum - 1) * randnum) + 1;
} while (rand1 == useRand);
useRand = rand1;
document.randimg.src = images[useRand].src;
}

var NS = (navigator.appName=="Netscape")?true:false; 
function FitPic() { 
iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
iWidth = document.images[0].width - iWidth; 
iHeight = document.images[0].height - iHeight; 
window.resizeBy(iWidth, iHeight); 
self.focus(); 
} 

function flip(name,src) {
    if (document.images)
        document.images[name].src = src;
}

function PopupPic(sPicURL) { 
  newWin=window.open( sPicURL, 'newWin', 
  'resizable=0,HEIGHT=200,WIDTH=200'); 
  newWin.focus(); 
} 

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();
		}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("All images and content are copyrighted material of Bettinger Photography");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;