// JavaScript code for frankleecattery.com photo galleries

// Lionel Deimel, 5/18/2005

// Create global variable for new window
var popWindow;

// Define default values for width and height of popup windows. These default values assume
// photos with dimensions 300 px x 400 px. Defaults specify window width (W) and height (H)
// for portrait mode (P) and landscape mode (L).
var defaultWP = 380;
var defaultHP = 585;
var defaultWL = 480;
var defaultHL = 485

// Define default location for top left corner of window created by popup
var topOfWindow = 40;
var leftOfWindow = 170;

// Define arrays that specify sequence of Web pages and window sizes for Bombay gallery
bOrder = new Array(11);
bWidth = new Array(11);
bHeight = new Array(11);
bOrder[0]  = "rue.html";            bWidth[0]  = defaultWL; bHeight[0]  = defaultHL+22;
bOrder[1]  = "louis_t.html";        bWidth[1]  = defaultWP; bHeight[1]  = defaultHP+22;
bOrder[2]  = "louiss_boy.html";     bWidth[2]  = defaultWP; bHeight[2]  = defaultHP+22;
bOrder[3]  = "georgia.html";        bWidth[3]  = defaultWL; bHeight[3]  = defaultHL+22;
bOrder[4]  = "georgia2.html";       bWidth[4]  = defaultWP; bHeight[4]  = defaultHP+22;
bOrder[5]  = "eve.html";            bWidth[5]  = defaultWL; bHeight[5]  = defaultHL;
bOrder[6]  = "restis_bentley.html"; bWidth[6]  = defaultWL; bHeight[6]  = defaultHL;
bOrder[7]  = "jackjade.html";       bWidth[7]  = defaultWL; bHeight[7]  = defaultHL+22;
bOrder[8]  = "blackjade.html";      bWidth[8]  = defaultWL; bHeight[8]  = defaultHL;
bOrder[9]  = "marymack.html";       bWidth[9]  = defaultWP; bHeight[9]  = defaultHP;
bOrder[10] = "kizzi.html";          bWidth[10] = defaultWP; bHeight[10] = defaultHP;

// Define arrays that specify sequence of Web pages and window sizes for Tomkinese gallery
tOrder = new Array(18);
tWidth = new Array(18);
tHeight = new Array(18);
tOrder[0]  = "abercrombie.html";     tWidth[0]  = defaultWP; tHeight[0]  = defaultHP+22;
tOrder[1]  = "lovemeblue.html";      tWidth[1]  = defaultWL; tHeight[1]  = defaultHL+22;
tOrder[2]  = "oconnor.html";         tWidth[2]  = defaultWL; tHeight[2]  = defaultHL;
tOrder[3]  = "judeoconnor.html";     tWidth[3]  = defaultWL; tHeight[3]  = defaultHL+22;
tOrder[4]  = "m_mae.html";           tWidth[4]  = defaultWL; tHeight[4]  = defaultHL-10;
tOrder[5]  = "passacaille.html";     tWidth[5]  = defaultWL; tHeight[5]  = defaultHL+22;
tOrder[6]  = "heyjude.html";         tWidth[6]  = defaultWP; tHeight[6]  = defaultHP+22;
tOrder[7]  = "bean.html";            tWidth[7]  = defaultWL; tHeight[7]  = defaultHL+22;
tOrder[8]  = "mauiblue.html";        tWidth[8]  = defaultWL; tHeight[8]  = defaultHL+22;
tOrder[9]  = "bobbyrudy.html";       tWidth[9]  = defaultWL; tHeight[9]  = defaultHL+39;
tOrder[10]  = "bobby.html";          tWidth[10] = defaultWL; tHeight[10]  = defaultHL+39;
tOrder[11] = "bestcat.html";         tWidth[11] = defaultWL; tHeight[11] = defaultHL+39;
tOrder[12] = "bobby2.html";          tWidth[12] = defaultWP; tHeight[12] = defaultHP+22;
tOrder[13] = "lucyjude.html";        tWidth[13] = defaultWL; tHeight[13] = defaultHL+22;
tOrder[14] = "mckensie.html";        tWidth[14] = defaultWP; tHeight[14] = defaultHP+22;
tOrder[15] = "lucy.html";            tWidth[15] = defaultWP; tHeight[15] = defaultHP+22;
tOrder[16] = "mei.html";             tWidth[16] = defaultWL; tHeight[16] = defaultHL+22;
tOrder[17] = "lookatme.html";        tWidth[17] = defaultWP; tHeight[17] = defaultHP+22;

// function popup
//
// Open popup window named popWindow that displays the page whose name is pageName.
// If such a window is already open, it is first closed to assure a window of the proper size is
// created. If either of the size parameters is 0, the corresponding default value (using topOfWindow
// or leftOfWindow is used instead.

function popup(pageName, w, h) {

	// Define local variables to hold dimensions of window popWindow. These variables are initially
	// set to the default dimensions.
	var windowW = defaultWP;
	var WindowH = defaultHP;
	
	// Close existing window. Actually, this line is useful only for very old browsers because of the
	// lines that follow. (See below.)
	if (typeof(popWindow) != "undefined" && !popWindow.closed) {popWindow.close()};

	// Use window dimensions from parameter list if they are not 0
	if (w!=0) {windowW = w};
	if (h!=0) {windowH = h};
	
	// Create new window. If the window is not new, its size and position may not be set by this
	// statement, depending upon the browser.
	popWindow = window.open(pageName, "popWin", "resizable=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,top=topOfWindow,left=leftOfWindow,copyhistory=0,width="+windowW+",height="+windowH);

	// Assure proper size, position, and visibility. The top two statements may not work for very old
	// browsers.
	popWindow.resizeTo(windowW,windowH);
	popWindow.moveTo(leftOfWindow,topOfWindow);
	popWindow.focus();

	}

// function bPopup
//
// Call popup with appropriate parameters for the seqNo-th window in the Bombay sequence as defined
// in arrays bOrder, bWidth, and bHeight. The lowest valid value of seqNo is 0.
	
function bPopup(seqNo) {

	// Call popup with proper parameters
	popup(bOrder[seqNo], bWidth[seqNo], bHeight[seqNo]);

	}

// function tPopup
//
// Call popup with appropriate parameters for the seqNo-th window in the Tonkinese sequence as defined
// in arrays tOrder, tWidth, and tHeight. The lowest valid value of seqNo is 0.
	
function tPopup(seqNo) {

	// Call popup with proper parameters
	popup(tOrder[seqNo], tWidth[seqNo], tHeight[seqNo]);

	}

// function bNext
//
// Call bPopup to open a window displaying the page following the page with URL url in the
// sequence of pages for Bombays. There is no error handling; the parameter is assumed
// to be valid.
	
function bNext(url) {

	// Define variable to hold file name and loop index
	var fileName;
	var i;
	
	// Extract file name from URL
	fileName = url.substr(url.lastIndexOf('/')+1, url.length);
	
	// Search for file name in page sequence
	i = 0;
	while (bOrder[i] != fileName) {i = i+1};
	
	// Get next page in Bombay sequence
	bPopup(i+1);
	
	}
	
// function tNext
//
// Call bPopup to open a window displaying the page following the page with URL url in the
// sequence of pages for Tonkinese. There is no error handling; the parameter is assumed
// to be valid.
	
function tNext(url) {

	// Define variable to hold file name and loop index
	var fileName;
	var i;
	
	// Extract file name from URL
	fileName = url.substr(url.lastIndexOf('/')+1, url.length);
	
	// Search for file name in page sequence
	i = 0;
	while (tOrder[i] != fileName) {i = i+1};
	
	// Get next page in Tonkinese sequence
	tPopup(i+1);
	
	}

// function bPrevious
//
// Call bPopup to open a window displaying the page before the page with URL url in the
// sequence of pages for Bombays. There is no error handling; the parameter is assumed
// to be valid.
	
function bPrevious(url) {
	
	// Define variable to hold file name and loop index
	var fileName;
	var i;
	
	// Extract file name from URL
	fileName = url.substr(url.lastIndexOf('/')+1, url.length);
	
	// Search for file name in page sequence
	i = 0;
	while (bOrder[i] != fileName) {i = i+1};

	// Get previous page in Bombay sequence
	bPopup(i-1);
	
	}


// function tPrevious
//
// Call tPopup to open a window displaying the page before the page with URL url in the
// sequence of pages for Tonkinese. There is no error handling; the parameter is assumed
// to be valid.
	
function tPrevious(url) {
	
	// Define variable to hold file name and loop index
	var fileName;
	var i;
	
	// Extract file name from URL
	fileName = url.substr(url.lastIndexOf('/')+1, url.length);
	
	// Search for file name in page sequence
	i = 0;
	while (tOrder[i] != fileName) {i = i+1};

	// Get previous page in Bombay sequence
	tPopup(i-1);
	
	}

	
	
	
