/***************************************************************************
* Create a photo object                                                    *
***************************************************************************/
function photo(id, galleries_id, photo_ref, section_code, src, width, height, caption, thumbnail, thumbnail_width, thumbnail_height, home, gallery, description, takendate, photographer, location, item_price, purchase_instruction) {
	this.id = id;
	this.galleries_id = galleries_id;
	this.photo_ref = photo_ref;
	this.section_code = section_code;
	this.src = src;
	this.width = width;
	this.height = height;
	this.caption = caption;
	this.thumbnail = thumbnail;
	this.thumbnail_width = thumbnail_width;
	this.thumbnail_height = thumbnail_height;
	this.home = home;
	this.gallery = gallery;
	this.description = description;
	this.takendate = takendate;
	this.photographer = photographer;
	this.location = location;
	this.item_price = item_price;
	this.purchase_instruction = purchase_instruction;
}
/***************************************************************************
* Create a gallery object                                                  *
***************************************************************************/

function gallery(id,featured_images,title,section_code) {
	this.id = id;
	this.featured_images = featured_images;
	this.title = title;
	this.section_code = section_code;}

/***************************************************************************
* Select a random value from a comma separated list                        *
***************************************************************************/
function randomListVal(list) {
	arrayVals = list.split(',');
	pos = Math.round(Math.random() * (arrayVals.length - 1));
	debug('Returning ' + arrayVals[pos] + ' as random image');
	return arrayVals[pos];
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('2381234,2346665,2346664,2346663,2346662,2346657,2346656,2346624,2346623,2346622,2346621,2346620,2346619,2343042,2343041,2343040,2343039,2343038,2343037,2343036,2343035,2343034,2343033,2343031,2343030,2343029,2343028,2343027,2343026,2343025,2343024,2343023,2343022,2343021,2338951,2338950,2338949,2338948,2338947,2338894,2338871,2338870,2338869,2338861,2338859,2338857,2338854,2338853,2338850,2338849,2338847,2338846,2338845,2338844,2338843,2338819,2338815,2338811,2338807');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if (!basic) {
			img.src = photos[j].src;
			img.width = photos[j].width;
			img.height = photos[j].height;
			}
			else {
				newImage = new Image(photos[j].width,photos[j].height);
				newImage.src = photos[j].src;
				document.images[img.name] = newImage;
				debug(newImage.src);
			}
			break;
		}
	}
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline() {
	
	imageID = randomListVal('2381234,2346665,2346664,2346663,2346662,2346657,2346656,2346624,2346623,2346622,2346621,2346620,2346619,2343042,2343041,2343040,2343039,2343038,2343037,2343036,2343035,2343034,2343033,2343031,2343030,2343029,2343028,2343027,2343026,2343025,2343024,2343023,2343022,2343021,2338951,2338950,2338949,2338948,2338947,2338894,2338871,2338870,2338869,2338861,2338859,2338857,2338854,2338853,2338850,2338849,2338847,2338846,2338845,2338844,2338843,2338819,2338815,2338811,2338807');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if ('gallery' != '') {
						if (photos[j].galleries_id != '') {
						document.write('<a href="' + photos[j].section_code + '_' + photos[j].galleries_id + '.html">');
						}
						else {
						document.write('<a href="gallery.html">');
						}
			}
			document.write('<img src="' + photos[j].src + '" width="' + photos[j].width + '" height="' + photos[j].height + '" class="mainhomepageimage" id="mainSample" name="mainSample" alt="' + photos[j].caption  + '" border="0">');
			if ('gallery' != '') {
				document.write('</a>');
			}
			break;
		}
	}
	
}

/***************************************************************************
* Show the next image in a gallery.  field = hidden field containing       *
* image_id                                                                 *
*  img = reference to image object in which to show image                  *
***************************************************************************/
function next(field,img) {

	debug('IN next');
	imageID = field.value;
	
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			break;
		}
	}
	debug('image is ' + j);
	nextImg = -1;
	k= j + 1;
	while (nextImg < 0) {
		for (; k < photos.length; k++) {
			debug('testing image ' + k + ': gallery = ' + photos[k].galleries_id + '(existing: ' + photos[j].galleries_id + ')');
			if (photos[k].galleries_id == photos[j].galleries_id) {
				nextImg = k;
				debug('setting  nextImg = ' + k);
				break;
			}
		}
		if (nextImg == -1) {
			k = 0;
		}
	}
	if (nextImg != -1) {
		updateImage(nextImg, field,img);
	}


}


/***************************************************************************
* Set a new image on the gallery detail page given its array position      *
***************************************************************************/
function updateImage (nextImg, field,img) {
	debug('Updating image');
	if (!basic && !(0)) {
		debug('In updateImage');
		debug('setting  img src = ' + photos[nextImg].src);
		
					
			document.getElementById('imagePhoto').innerHTML = '<img class="mainphoto" src="' + photos[nextImg].src + ' " id="mainPic" name="mainPic" width="' + photos[nextImg].width + '" height="' + photos[nextImg].height + '" alt="' + photos[nextImg].caption + '" border="0">';
						field.value = photos[nextImg].id;
			document.getElementById('imageTitle').innerHTML = photos[nextImg].caption;
			document.title = photos[nextImg].caption;
			/* apply 'blank' classname to element where */			if ( photos[nextImg].caption == '') {
				document.getElementById('imageTitle').style.className = 'blank';
			}
			else {
				document.getElementById('imageTitle').style.className = 'normal';
			}
						temp = '';
			if (photos[nextImg].description != '') {
				temp = temp +  '<p id="imageDescription">' + photos[nextImg].description + '</p>';
			}
			if (photos[nextImg].photo_ref != '') {
				temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + photos[nextImg].photo_ref + '</p>';
			}
			if (photos[nextImg].takendate != '') {
				debug('Resetting taken date');
				temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + photos[nextImg].takendate + '</p>';
			}
			
			if (photos[nextImg].location != '') {
				debug('Resetting location');
				temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  photos[nextImg].location + '</p>';
			}
			
			if (photos[nextImg].photographer != '') {
				debug('Resetting photographer');
				temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + photos[nextImg].photographer + '</p>';
			}
			if (temp != '') {				temp = temp + '<div class="spacer"></div>';			}					if (temp == '') {
			document.getElementById('imageDetails').style.display = 'none';
		}
		else {
			document.getElementById('imageDetails').style.display = 'block';
		}
		document.getElementById('imageDetails').innerHTML =temp;	
		
	}
	else {
		debug('Redirecting to id ' + photos[nextImg].id);
		window.location = 'photo_' + photos[nextImg].id + '.html';
	}
}

/***************************************************************************
* Show the previous image for a gallery. field = hidden field containing   *
* image_id                                                                 *
*  img = reference to image object in which to show image                  *
***************************************************************************/
function previous(field,img) {


	imageID = field.value;
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			break;
		}
	}
	debug('image is ' + j);
	nextImg = -1;
	k = j -1;
	while (nextImg < 0) {
		for (; k >= 0; k--) {
			if (photos[k].galleries_id == photos[j].galleries_id) {
				nextImg = k;
				break;
			}
		}
		if (nextImg == -1) {
			k = photos.length -1;
		}
	}
	if (nextImg != -1) {
		updateImage(nextImg, field,img);	
	}
}

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.
        *
* Gallery_id = id of gallery to choose                                     *
* 
 img = reference to html image                                       *
* in which to show image                                                   *
***************************************************************************/
function showGalleryImage(gallery_id, img) {
	debug('Gallery = ' + gallery_id);
	for (i = 0; i < galleries.length; i++) {
		if (galleries[i].id == gallery_id) {
			imageID = randomListVal(galleries[i].featured_images);
				for (j = 0; j < photos.length; j++) {
					if (photos[j].id == imageID) {
						
						img.src = photos[j].thumbnail;
						img.width = photos[j].thumbnail_width;
						img.height = photos[j].thumbnail_height;
						
						break;
					}
				}
			break;
		}
	} 
	}

/***************************************************************************
* If we have dynamic HTML                                                  *
*  replace the galleries link with a list that                             *
* doesn't include the current gallery                                      *
***************************************************************************/
function showGalleries(gallery_id) {
	debug('Showing links for gallery ' + gallery_id);
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
			debug('Testing gallery ' + galleries[i].id);
			
			if (galleries[i].id != gallery_id) {
				debug('Adding link');
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="gallery_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}
/***************************************************************************
* Create the array of Photo objects                                        *
***************************************************************************/
photos = new Array();
photos[0] = new photo(2338951,'152396','SFld043','gallery','http://www2.clikpic.com/abovenewzealand/images/SFld043.JPG',302,450,'Lake Brown & Arthur River, Arthur Valley, Milford Track, Fiordland National Park - aerial','http://www2.clikpic.com/abovenewzealand/images/SFld043_thumb.JPG',87, 130,1, 0,'','','','','','');
photos[1] = new photo(2338845,'152396','TGdr002','gallery','http://www2.clikpic.com/abovenewzealand/images/TGdr002.jpg',450,299,'Glider, Lake Pukaki and Aoraki / Mt Cook, Mackenzie Country, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/TGdr002_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[2] = new photo(2338850,'152396','SSth077 ','gallery','http://www2.clikpic.com/abovenewzealand/images/SSth077.jpg',450,296,'Clutha River near Kaitangata, South Otago, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SSth077_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[3] = new photo(2338849,'152396','SMtC319 ','gallery','http://www2.clikpic.com/abovenewzealand/images/SMtC319.jpg',450,299,'Aoraki / Mt Cook, Aoraki/ Mt Cook National Park, Southern Alps, South Island, new Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SMtC319_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[4] = new photo(2338844,'152393','NTpo202','gallery','http://www2.clikpic.com/abovenewzealand/images/NTpo202.jpg',450,300,'Mt Ngauruhoe, Tongariro National Park, Central Plateau, North Island, New Zealand (and Mt Taranaki / Egmont in distance) - aerial','http://www2.clikpic.com/abovenewzealand/images/NTpo202_thumb.jpg',130, 87,1, 1,'','','David Wall','','','');
photos[5] = new photo(2338819,'152396','SChc386','gallery','http://www2.clikpic.com/abovenewzealand/images/SChc386.jpg',450,299,'Akaroa Harbour (left) and Banks Peninsula, Canterbury, South Island, New Zealand- aerial','http://www2.clikpic.com/abovenewzealand/images/SChc386_thumb.jpg',130, 86,1, 1,'','','David Wall','','','');
photos[6] = new photo(2338854,'152393','TRur010','gallery','http://www2.clikpic.com/abovenewzealand/images/TRur010.JPG',450,304,'Dairy Farms, Taranaki, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/TRur010_thumb.JPG',130, 88,1, 0,'','','David Wall','','','');
photos[7] = new photo(2338846,'152396','SMCa055','gallery','http://www2.clikpic.com/abovenewzealand/images/SMCa055.jpg',450,299,'Hot-air Balloon, near Methven, Canterbury Plains, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SMCa055_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[8] = new photo(2338843,'152396','SQtn393','gallery','http://www2.clikpic.com/abovenewzealand/images/SQtn393.jpg',450,300,'Lake Wakatipu, Kelvin Heights Golf Course on Kelvin Peninsula and The Remarkables, Queenstown, South Island, New Zealand - aerial SQtn393','http://www2.clikpic.com/abovenewzealand/images/SQtn393_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[9] = new photo(2343028,'152393','NTpo272','gallery','http://www2.clikpic.com/abovenewzealand/images/NTpo272.jpg',300,450,'Bruce Road up Mt Ruapehu, and Mt Ngauruhoe, Tongariro National Park, Central Plateau, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NTpo272_thumb.jpg',87, 130,1, 0,'','','','','','');
photos[10] = new photo(2338811,'152396','SCOg718','gallery','http://www2.clikpic.com/abovenewzealand/images/SCOg718.jpg',450,299,'Orchard and Poplar Trees, Ripponvale, near Cromwell, Central Otago, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SCOg718_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[11] = new photo(2343024,'152393','NNoA017','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA017.jpg',450,299,'Motuarohia (Roberton) Island, Bay of Islands, Northland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA017_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[12] = new photo(2338815,'152396','SFld027','gallery','http://www2.clikpic.com/abovenewzealand/images/SFld027.JPG',450,302,'Mitre Peak & Milford Sound, Fiordland National Park, Fiordland, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SFld027_thumb.JPG',130, 87,1, 0,'','','David Wall','','','');
photos[13] = new photo(2338857,'152393','NWeA041','gallery','http://www2.clikpic.com/abovenewzealand/images/NWeA041.JPG',450,299,'Lady Norwood Rose Garden, Wellington Botanic Garden, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NWeA041_thumb.JPG',130, 86,1, 0,'','','David Wall','','','');
photos[14] = new photo(2343029,'152393','NTpo559','gallery','http://www2.clikpic.com/abovenewzealand/images/NTpo559.jpg',300,450,'Huka Falls, Waikato River, near Taupo, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NTpo559_thumb.jpg',87, 130,1, 0,'','','','','','');
photos[15] = new photo(2338807,'152393','NNoA015','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA015.jpg',450,299,'Cooks Cove, Motuarohia (Roberton) Island, Bay of Islands, Northland, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA015_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[16] = new photo(2346662,'152393','TMdE001','gallery','http://www2.clikpic.com/abovenewzealand/images/TMdE001.jpg',450,295,'White Island Volcano, Bay of Plenty, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/TMdE001_thumb.jpg',130, 85,1, 0,'','','','','','');
photos[17] = new photo(2338847,'152396','SMal127','gallery','http://www2.clikpic.com/abovenewzealand/images/SMal127.jpg',450,299,'Lochmara Bay (bottom), Double Bay (right), Torea Bay (left) and Queen Charlotte Sound, Marlborough Sounds, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SMal127_thumb.jpg',130, 86,1, 0,'','','David Wall','','','');
photos[18] = new photo(2343026,'152393','NRot007','gallery','http://www2.clikpic.com/abovenewzealand/images/NRot007.JPG',450,297,'White Island - Active Volcano, Bay of Plenty, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NRot007_thumb.JPG',130, 86,1, 0,'','','','','','');
photos[19] = new photo(2346620,'152396','SWst900','gallery','http://www2.clikpic.com/abovenewzealand/images/SWst900.jpg',450,299,'Twelve Mile Bluff and Motukiekie Rocks, north of Greymouth, West Coast, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SWst900_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[20] = new photo(2338853,'152393','NMtM001','gallery','http://www2.clikpic.com/abovenewzealand/images/NMtM001.JPG',450,303,'Mount Maunganui & Tauranga Harbour, North Island, New Zealand  - aerial','http://www2.clikpic.com/abovenewzealand/images/NMtM001_thumb.JPG',130, 88,1, 0,'','','David Wall','','','');
photos[21] = new photo(2343023,'152393','NNoA074','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA074.jpg',450,291,'Ohao Point (Coal Point) and Parengarenga Harbour Entrance, Far North, Northland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA074_thumb.jpg',130, 84,1, 0,'','','','','','');
photos[22] = new photo(2343027,'152393','NRot026','gallery','http://www2.clikpic.com/abovenewzealand/images/NRot026.JPG',450,301,'Champagne Pool (green) and Artists Palette (yellow), Waiotapu Thermal Reserve, near Rotorua, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NRot026_thumb.JPG',130, 87,1, 0,'','','','','','');
photos[23] = new photo(2338870,'152396','SChc462','gallery','http://www2.clikpic.com/abovenewzealand/images/SChc462.jpg',450,299,'Tidal Patterns, Heathcote and Avon Estuary, Christchurch, Canterbury, South Island, New Zealand- aerial','http://www2.clikpic.com/abovenewzealand/images/SChc462_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[24] = new photo(2343022,'152393','NAka007','gallery','http://www2.clikpic.com/abovenewzealand/images/NAka007.JPG',299,450,'Auckland Harbour Bridge & Waitemata Harbour, Auckland, North island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NAka007_thumb.JPG',86, 130,1, 0,'','','','','','');
photos[25] = new photo(2346656,'152393','NTnk010','gallery','http://www2.clikpic.com/abovenewzealand/images/NTnk010.jpg',301,450,'Mount Taranaki / Egmont, Egmont National Park, Taranaki, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NTnk010_thumb.jpg',87, 130,1, 0,'','','','','','');
photos[26] = new photo(2338894,'152396','SCOg696 ','gallery','http://www2.clikpic.com/abovenewzealand/images/SCOg696.jpg',299,450,'Orchards and Vineyards, Bannockburn, near Cromwell, Central Otago, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SCOg696_thumb.jpg',86, 130,1, 0,'','','','','','');
photos[27] = new photo(2338952,'152393','NWeA024','gallery','http://www2.clikpic.com/abovenewzealand/images/NWeA024.JPG',450,301,'Oriental Bay, Wellington, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NWeA024_thumb.JPG',130, 87,0, 0,'','','','','','');
photos[28] = new photo(2338859,'152393','NAka141','gallery','http://www2.clikpic.com/abovenewzealand/images/NAka141.jpg',299,450,'Hilton Hotel, Princes Wharf, Auckland CBD and Sky Tower, North Island, New Zealand - Aerial NAka141','http://www2.clikpic.com/abovenewzealand/images/NAka141_thumb.jpg',86, 130,1, 0,'','','David Wall','','','');
photos[29] = new photo(2338948,'152396','SFld487','gallery','http://www2.clikpic.com/abovenewzealand/images/SFld487.jpg',450,300,'Dome Islands and South Fiord, Lake Te Anau, Fiordland National Park, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SFld487_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[30] = new photo(2343030,'152393','NTpo628','gallery','http://www2.clikpic.com/abovenewzealand/images/NTpo628.jpg',450,300,'Taupo, Lake Taupo and Waikato River, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NTpo628_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[31] = new photo(2343039,'152396','SDun340','gallery','http://www2.clikpic.com/abovenewzealand/images/SDun340.jpg',450,300,'Dunedin and snow, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SDun340_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[32] = new photo(2338869,'152396','SWst798','gallery','http://www2.clikpic.com/abovenewzealand/images/SWst798.jpg',299,450,'Franz Josef Glacier, West Coast, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SWst798_thumb.jpg',86, 130,1, 0,'','','David Wall','','','');
photos[33] = new photo(2338950,'152393','NNoA054','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA054.jpg',299,450,'Ninety Mile Beach, Northland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA054_thumb.jpg',86, 130,1, 0,'','','','','','');
photos[34] = new photo(2381234,'152393','NAka033','gallery','http://www2.clikpic.com/abovenewzealand/images/NAka033.JPG',450,307,'Howick Golf Course & Musick Point, Auckland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NAka033_thumb.JPG',130, 89,1, 0,'','','','','','');
photos[35] = new photo(2338861,'152393','NAkA172','gallery','http://www2.clikpic.com/abovenewzealand/images/NAka1721.jpg',299,450,'North Head, Devonport, Auckland, North Island, New Zealand - Aerial','http://www2.clikpic.com/abovenewzealand/images/NAka1721_thumb.jpg',86, 130,1, 0,'','','David Wall','','','');
photos[36] = new photo(2343035,'152396','SChc249','gallery','http://www2.clikpic.com/abovenewzealand/images/SChc249.jpg',299,450,'New Brighton Pier, Christchurch, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SChc249_thumb.jpg',86, 130,1, 0,'','','','','','');
photos[37] = new photo(2343037,'152396','SDun282 ','gallery','http://www2.clikpic.com/abovenewzealand/images/SDun282.jpg',450,308,'Dunedin, Otago Harbour and Otago Peninsula, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SDun282_thumb.jpg',130, 89,1, 0,'','','','','','');
photos[38] = new photo(2346664,'152393','NNoA006','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA006.jpg',450,292,'Russell, Bay of Islands, Northland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA006_thumb.jpg',130, 84,1, 0,'','','','','','');
photos[39] = new photo(2338871,'152396','SFld382','gallery','http://www2.clikpic.com/abovenewzealand/images/SFld382.jpg',450,300,'Hall Arm, Doubtful Sound, Fiordland National Park, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SFld382_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[40] = new photo(2343040,'152396','SDun858','gallery','http://www2.clikpic.com/abovenewzealand/images/SDun858.jpg',299,450,'Cliffs at Tunnel Beach, Dunedin, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SDun858_thumb.jpg',86, 130,1, 0,'','','','','','');
photos[41] = new photo(2343036,'152396','SChc372','gallery','http://www2.clikpic.com/abovenewzealand/images/SChc372.jpg',450,299,'Akaroa Harbour, Banks Peninsula, Canterbury, South Island, New Zealand- aerial','http://www2.clikpic.com/abovenewzealand/images/SChc372_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[42] = new photo(2346621,'152396','SStw005','gallery','http://www2.clikpic.com/abovenewzealand/images/SStw005.JPG',303,450,'Patterson Inlet, Stewart Island / Rakiura, near the South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SStw005_thumb.JPG',88, 130,1, 0,'','','','','','');
photos[43] = new photo(2346663,'152393','NAka024','gallery','http://www2.clikpic.com/abovenewzealand/images/NAka024.JPG',450,302,'Orakei Jetty, Okahu Bay & Takaparawha Park, Auckland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NAka024_thumb.JPG',130, 87,1, 0,'','','','','','');
photos[44] = new photo(2343034,'152393','NWeA009 ','gallery','http://www2.clikpic.com/abovenewzealand/images/NWeA009.JPG',450,308,'The Beehive, Parliament Buildings, Parliament Grounds, Wellington, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NWeA009_thumb.JPG',130, 89,1, 0,'','','','','','');
photos[45] = new photo(2343041,'152396','SWan089 ','gallery','http://www2.clikpic.com/abovenewzealand/images/SWan089.jpg',450,303,'Lake Wanaka and the mouth of Matukituki River, near Wanaka, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SWan089_thumb.jpg',130, 88,1, 0,'','','','','','');
photos[46] = new photo(2346622,'152396','SSth046','gallery','http://www2.clikpic.com/abovenewzealand/images/SSth046.JPG',450,300,'Bluff Harbour & Bluff, Southland, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SSth046_thumb.JPG',130, 87,1, 0,'','','','','','');
photos[47] = new photo(2343033,'152393','NLwr091','gallery','http://www2.clikpic.com/abovenewzealand/images/NLwr091.jpg',450,304,'Paraparaumu, Kapiti Coast, Lower North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NLwr091_thumb.jpg',130, 88,1, 0,'','','','','','');
photos[48] = new photo(2346619,'152396','SWst807','gallery','http://www2.clikpic.com/abovenewzealand/images/SWst807.jpg',450,299,'Crevasses, Franz Josef Glacier, West Coast, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SWst807_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[49] = new photo(2346624,'152393','NTpo012','gallery','http://www2.clikpic.com/abovenewzealand/images/NTpo012.jpg',450,294,'Mounts Tongariro, Ngauruhoe & Ruapehu (left front to distant right), Tongariro National Park - aerial','http://www2.clikpic.com/abovenewzealand/images/NTpo012_thumb.jpg',130, 85,1, 0,'','','','','','');
photos[50] = new photo(2343042,'152396','SWst054','gallery','http://www2.clikpic.com/abovenewzealand/images/SWst054.JPG',450,295,'Climber crossing Albert Glacier below Mt Tasman, Westland/TePoutini National Park, SOuth Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SWst054_thumb.JPG',130, 85,1, 0,'','','','','','');
photos[51] = new photo(2343021,'152393','NTnk060','gallery','http://www2.clikpic.com/abovenewzealand/images/NTnk060.jpg',450,304,'Mt Taranaki / Egmont, Taranaki, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NTnk060_thumb.jpg',130, 88,1, 0,'','','','','','');
photos[52] = new photo(2346665,'152393','NWeA019','gallery','http://www2.clikpic.com/abovenewzealand/images/NWeA019.JPG',302,450,'Wellington Stadium, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NWeA019_thumb.JPG',87, 130,1, 0,'More <a target=\"_blank\" href=\"http://www.davidwallphoto.com/searchresults.asp?tx=&searchgo=1&submit=Search&phrase=all&g=48&t=15\">Wellington Aerials</a>','','','','','');
photos[53] = new photo(2338947,'152396','SDun666','gallery','http://www2.clikpic.com/abovenewzealand/images/SDun666.jpg',450,300,'Iceberg 100km east of Dunedin, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SDun666_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[54] = new photo(2338949,'152396','SMtC350','gallery','http://www2.clikpic.com/abovenewzealand/images/SMtC350.jpg',450,299,'Ohau Canal (left) meets Pukaki Canal, near Twizel, Mackenzie Country, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SMtC350_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[55] = new photo(2346657,'152393','NCor066','gallery','http://www2.clikpic.com/abovenewzealand/images/NCor066.JPG',304,450,'Whitianga and Whitianga Harbour, Coromandel Peninsula - aerial','http://www2.clikpic.com/abovenewzealand/images/NCor066_thumb.JPG',88, 130,1, 0,'','','','','','');
photos[56] = new photo(2343031,'152393','NHwk085','gallery','http://www2.clikpic.com/abovenewzealand/images/NHwk085.JPG',450,303,'Napier, Hawke\'s Bay, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NHwk085_thumb.JPG',130, 88,1, 0,'','','','','','');
photos[57] = new photo(2343038,'152396','SDun696','gallery','http://www2.clikpic.com/abovenewzealand/images/SDun696.jpg',299,450,'St. Paul\'s Cathedral and Municipal Chambers, The Octagon, Dunedin, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SDun696_thumb.jpg',86, 130,1, 0,'','','','','','');
photos[58] = new photo(2343025,'152393','NNoA103','gallery','http://www2.clikpic.com/abovenewzealand/images/NNoA103.jpg',450,299,'Cape Maria van Diemen, near Cape Reinga, Far North, Northland, North Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/NNoA103_thumb.jpg',130, 86,1, 0,'','','','','','');
photos[59] = new photo(2346623,'152396','SChc304','gallery','http://www2.clikpic.com/abovenewzealand/images/SChc304.jpg',450,299,'Weekend Market, Arts Centre, Christchurch, South Island, New Zealand - aerial','http://www2.clikpic.com/abovenewzealand/images/SChc304_thumb.jpg',130, 86,1, 0,'','','','','','');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
galleries = new Array();
galleries[0] = new gallery(152393,'2338844','Aerials - North Island NZ','gallery');
galleries[1] = new gallery(152396,'2338819','Aerials - South Island NZ','gallery');


