//** Scripts for Left Sash

function rollOver(el_id,el_src) {

	document.getElementById(el_id).src = el_src;
}

function uText(el) {
	el.style.textDecoration = "underline";
}

function nuText(el) {
	el.style.textDecoration = "none";
}


//** Popup window (medium size)

var theWin;

function newWindow(inURL) {

	if (!theWin || theWin.closed) {

		theWin = window.open(inURL, "popup", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=750,height=550,top=50,left=50");
		theWin.focus();

	} else {
		theWin.location.href = inURL;
		theWin.focus();
	}
}

//** Popup window (small size)

var theSmallWin;

function newSmallWindow(inURL) {

	if (!theSmallWin || theSmallWin.closed) {

		theSmallWin = window.open(inURL, "popup", "toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=400,top=50,left=50");
		theSmallWin.focus();

	} else {
		theSmallWin.location.href = inURL;
		theSmallWin.focus();
	}
}



//** Begin scripts for dvd Landing Page ** 

function preloadImages() {

}

function viewPictures(el) {

	//get position of image in the array

	for (x=0; x < gThumbArray.length; x++) {
		if (el == gThumbArray[x]) {
			gElIndex = x;
		}
	}

	if (!gPicWin || gPicWin.closed) {
		gPicWin = window.open("picViewer.html", "popup", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=460,height=420,top=50,left=100");
		gPicWin.focus();
	} else {
		gPicWin.location.href = "picViewer.html";
		gPicWin.focus();
	}
}
//** End scripts for dvd Landing Page ** 


//** Begin scripts for picViewer.html ** 

function nextImage() {

	var aImageSelector = document.getElementsByName("imageSelector");
	var aImageHolder = document.getElementsByName("picDisplay");
	var displayIndex = 0;

	for (x=0; x < aImageHolder.length; x++) {

		if (aImageHolder[x].style.display == "") {
			displayIndex = x;
			break;
		}
	}
	if (displayIndex != (aImageSelector.length - 1)) {
		imageByNumber(displayIndex + 2);
	}
}

function previousImage() {

	var aImageSelector = document.getElementsByName("imageSelector");
	var aImageHolder = document.getElementsByName("picDisplay");
	var displayIndex = 0;

	for (x=0; x < aImageHolder.length; x++) {

		if (aImageHolder[x].style.display == "") {
			displayIndex = x;
			break;
		}
	}
	if (displayIndex != 0) {
		imageByNumber(displayIndex);
	}
}

function imageByNumber(imageNumber) {

	var aImageHolder  = document.getElementsByName("picDisplay");
	var aImageSelector = document.getElementsByName("imageSelector");

	for (x=0; x < aImageHolder.length; x++) {
		aImageHolder[x].style.display = "none";
	}
	aImageHolder[imageNumber - 1].style.display="";

	for(y=0; y < aImageSelector.length; y++) {
		aImageSelector[y].className="ActiveSelector";
	}
	aImageSelector[imageNumber - 1].className = "InactiveSelector";

	if (imageNumber == 1) {
		document.getElementById("imageBack").style.visibility = "hidden";
		document.getElementById("imageForward").style.visibility = "visible";

	} else if (imageNumber == aImageSelector.length) {
		document.getElementById("imageForward").style.visibility = "hidden";
		document.getElementById("imageBack").style.visibility = "visible";

	} else {
		document.getElementById("imageBack").style.visibility = "visible";
		document.getElementById("imageForward").style.visibility = "visible";
	}
}

function initPage() {

	gPicIndex = parseInt(opener.gElIndex) + 1;
	imageByNumber(gPicIndex);
}

//** End scripts for picViewer.html ** 

