// <!--
var active_picture = "1";
var active_gallery = "photos";

var galleryThumbs = new Array();
var galleryPictures = new Array();
var galleryText = new Array();
var galleryTab = new Array();

//thumbnails
galleryThumbs["photosOff1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb1.gif");
galleryThumbs["photosOff2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb2.gif");
galleryThumbs["photosOff3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb3.gif");
galleryThumbs["photosOff4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb4.gif");
galleryThumbs["floorOff1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb1.gif");
galleryThumbs["floorOff2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb2.gif");
galleryThumbs["floorOff3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb3.gif");
galleryThumbs["floorOff4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb4.gif");
galleryThumbs["photosOn1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb1_click.gif");
galleryThumbs["photosOn2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb2_click.gif");
galleryThumbs["photosOn3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb3_click.gif");
galleryThumbs["photosOn4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_thumb4_click.gif");
galleryThumbs["floorOn1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb1_click.gif");
galleryThumbs["floorOn2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb2_click.gif");
galleryThumbs["floorOn3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb3_click.gif");
galleryThumbs["floorOn4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_thumb4_click.gif");

//big pictures
galleryPictures["photos1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_big1.gif");
galleryPictures["photos2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_big2.gif");
galleryPictures["photos3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_big3.gif");
galleryPictures["photos4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_big4.gif");
galleryPictures["floor1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_big1.gif");
galleryPictures["floor2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_big2.gif");
galleryPictures["floor3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_big3.gif");
galleryPictures["floor4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_big4.gif");

//text for under big picture
galleryText["photos1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_text1.gif");
galleryText["photos2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_text2.gif");
galleryText["photos3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_text3.gif");
galleryText["photos4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_text4.gif");
galleryText["floor1"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_text1.gif");
galleryText["floor2"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_text2.gif");
galleryText["floor3"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_text3.gif");
galleryText["floor4"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_text4.gif");

//tabs to toggle between photos and floorplans
galleryTab["floorOn"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_tab_on.gif");
galleryTab["floorOff"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/floor_tab_off.gif");
galleryTab["photosOn"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_tab_on.gif");
galleryTab["photosOff"] = newImage("/shared_docs/pacific_rim/images/about_the_pyramid/photos_tab_off.gif");

function setCookie(name, value, expires, path, domain, secure)
{
		var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
		document.cookie = curCookie;
}

function getCookie(name)
{
		var dc = document.cookie;
		var prefix = name + "=";
		 var begin = dc.indexOf("; " + prefix);
		 if (begin == -1) {
			 begin = dc.indexOf(prefix);
		if (begin != 0) return null;
		} else
			 begin += 2;
			 var end = document.cookie.indexOf(";", begin);
		if (end == -1)
			end = dc.length;
		  return unescape(dc.substring(begin + prefix.length, end));
}

function imageGallery (arg){  //pass it either "forward", "back" or a number
	//first two take care of arrows 3rd takes care of number
	if (arg == "forward"){
		turnon = active_picture%4 + 1;
	}
	else if(arg == "back"){
		if (active_picture == 1){
			turnon = 4;
		}
		else{
			turnon = active_picture -1;
		}
	}
	else {
		turnon = arg;
	}
	for (var i = 1; i <= 4; i++){ //takes care of thumbnails
		if (turnon == i){
			var state = "On";
		}
		else {
			var state = "Off";
		}
		var picgalIndex = active_gallery+""+state+""+i;
		var thumbname = "gallery_thumb"+i;
		document.images[thumbname].src = galleryThumbs[picgalIndex].src;
	}
	//takes care of big picture and text and changes active flag
	galIndex = active_gallery+""+turnon;
	document.images["gallery_big"].src = galleryPictures[galIndex].src;
	document.images["gallery_text"].src = galleryText[galIndex].src;
	active_picture = turnon;
	var cookiename = active_gallery+"Index";
	setCookie(cookiename,active_picture);
	return;
}

function switchGalleryTabs (arg) {  //"floor" or "photos" or "initiate"
	if (arg == active_gallery){
		return;
	}
	picNum = 1;
	if (arg == "initiate"){
		var cookiedata = new String();
		cookiedata = getCookie("pyramidgallery");
		if (cookiedata){
			active_gallery = cookiedata;
		}
	}
	var switchto = (arg == "initiate")?active_gallery:arg;
	var cookiename = switchto+"Index";
	cookiedata = getCookie(cookiename);
	if (cookiedata){
		picNum = cookiedata;
	}
	if (switchto == "floor"){
			document.images["floorTab"].src = galleryTab["floorOn"].src;
			document.images["photosTab"].src = galleryTab["photosOff"].src;
	}
	else if (switchto == "photos"){
			//document.images["floorTab"].src = galleryTab["floorOff"].src;
			document.images["photosTab"].src = galleryTab["photosOn"].src;
	}
	active_gallery = switchto;
	imageGallery(picNum);
	setCookie("pyramidgallery",active_gallery);
	return;
}

function winOpenGallery(){
	var url = "enlarge.aspx?"+active_gallery+"_bigger"+active_picture;
	contentWin = window.open(url,"gallery","resizable=no,toolbar=yes,location=no,width=500,height=525,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,left=0,top=0");

}

// -->