var preloadFlag = false;
var movieName = "soundPlay";
var msgWindow = null;
var currentImageName = "";

function thisMovie(movieName) {
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  }	else {
    return document[movieName]
  }
}

function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}

function clickSound(soundName) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TGotoLabel("_level0/"+soundName,"playSound");
  }
}



if (document.images) {
	back = newImage("/images/back.jpg")
	a11 = newImage("/images/a11.gif");
	a21 = newImage("/images/a21.gif");
	a22 = newImage("/images/a22.gif");
	a31 = newImage("/images/a31.gif");
	a32 = newImage("/images/a32.gif");
	tr = newImage("/images/tr.gif");
	circ = newImage("/images/circ.gif");
	a12 = newImage("/images/a12.gif");
	a13 = newImage("/images/a13.gif");
	a14 = newImage("/images/a14.gif");
	a24 = newImage("/images/a24.gif");
	a34 = newImage("/images/a34.gif");
	tl = newImage("/images/tl.gif");
	a33 = newImage("/images/a33.gif");
	bl1 = newImage("/images/bl1.gif");
	bl2 = newImage("/images/bl2.gif");
	bl2 = newImage("/images/bl.gif");
	back = newImage("/images/back.jpg");
	mail = newImage("/images/br_on.gif");
	picon = newImage("/images/gophoto_on.gif");
	rodon = newImage("/images/rod_on.gif");
	bottop = newImage("/images/bottop_on.gif");
	albumback = newImage("/pics/album.jpg");
	albumback2= newImage("/images/backthumbs2.gif");
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function windowOpener(currentPage, currentImage) {
	currentImageName = 'pics/pic'+currentImage+'.jpg'
	if (msgWindow) {
		if (msgWindow.closed) {
			makeIt(currentPage, currentImage, currentImageName)
		} else {
			msgWindow.frames[0].document['photo'].src=currentImageName
			msgWindow.focus()
		}
	} else {
		makeIt(currentPage, currentImage, currentImageName)
	}
	msgWindow.currentImageName = currentImageName
}

function makeIt(currentPage, currentImage, currentImageName) {
	myWidth=790;
	myHeight=540;
	myPosX=(screen.width-myWidth)/2;
	myPosY=(screen.height-myHeight)/2;
	myProps='toolbar=no, status=no,scrollbars=no,resizable=no,left='+myPosX+',top='+myPosY+',width='+myWidth+',height='+myHeight;
	msgWindow=window.open('/album.asp?pageID=' + currentPage + '&photoID=' + currentImage, 'photos',myProps);
}

