/* javascript */var WEBROOT = '';function $ (id){	return document.getElementById (id);}var galleryMenu = {	galleryMenuID:'gallerySubmenu',		toggleSubmenu: function (ulMenuID){						var curStyle = YAHOO.util.Dom.getStyle (ulMenuID, 'display')						if (curStyle != 'block'){							this.showSubmenu (ulMenuID);						}else{							this.hideSubmenus ();						}				},			showSubmenu: function (ulMenuID) {						this.hideSubmenus();						YAHOO.util.Dom.setStyle (ulMenuID, 'display', 'block');				},	hideSubmenus: function (){						var menu = $ (this.galleryMenuID);						YAHOO.util.Dom.getElementsBy (function (el){ return true;},'ul', menu, function (el) { YAHOO.util.Dom.setStyle (el, 'display', 'none');}) //				}}var picture = {		change: function(aObj,pic) {				var picArr = pic.split('_');				picArr[0] = this.getCategory (picArr[0]);				YAHOO.util.Connect.asyncRequest('GET',WEBROOT + "/gallery/changephoto/category/" + picArr[0] + '/project/' + picArr[1] + '/picture/' + picArr[2], callbacks); //				YAHOO.util.Connect.asyncRequest('GET',WEBROOT + "/gallery/changephoto", callbacks)				}, 				getCategory: function (cat) {				switch (cat) {					case 'cl'  : return 'classic';					case 'his' : return 'historic';					case 'com' : return 'commercial';					case 'trad': return 'traditional';					default:	 return false;				}			},				next: function (){				picNum = this.getCurrentPicNum ();				if (picNum == photoMenu.pmAnchors.length) {					return				}				nextNumNavObj = $ ('number' + (picNum + 1))				eval (nextNumNavObj.href.substring(11));			},				previous: function (){				picNum = this.getCurrentPicNum ();				if (picNum == 1) {					return				}				prevNumNavObj = $ ('number' + (picNum - 1))				eval (prevNumNavObj.href.substring(11));			},				getCurrentPicNum: function (){				var picObj = $ ('pic');				var picSrcArr = (picObj.src).split('/');				return Number ((picSrcArr[picSrcArr.length -1]).substr(4,2));							},				handleSuccess: function (o) {				try { 					picInfo = YAHOO.lang.JSON.parse(o.responseText);				}catch (x) { 					alert ("An error occured while trying to retrieve the requested sample. Please wait a minute or two and try again.");					return; 				}				picture.updatePhotoCredit(picInfo);				picture.updatePicture(picInfo);			},				handleFailure: function (o) {				alert ("An error occured while trying to retrieve the requested sample. Please wait a minute or two and try again.");			},				updatePicture: function (picInfoObj) {					//alert ('picture: ' + picInfoObj.picture);					myPic = $ ('pic');					myPic.src = WEBROOT + '/images/white.gif';					myPic.height = picInfoObj.picH;					myPic.width = picInfoObj.picW;					myPic.src = picInfoObj.picture;					picture.adjustFooter();					photoMenu.updateSelected();			},				adjustFooter: function () {//					console.log ('adjusting footer');					if (YAHOO.env.ua.ie) {						var pReg = YAHOO.util.Dom.getRegion('currentPhotoContainer');//							console.log ('photo container region: ' + pReg);						var h = pReg.bottom - pReg.top;						var w = pReg.right - pReg.left;						var isTall = h > w;						var c = YAHOO.util.Dom.hasClass ('footerContainer', 'footer')?'f':'f2';						if (isTall && c == 'f'){							YAHOO.util.Dom.replaceClass('footerContainer', 'footer', 'footer2');							YAHOO.util.Dom.setStyle('footerContainer', 'top', (pReg.bottom) + 'px');							return true;						}else if (!isTall && c == 'f2') {							YAHOO.util.Dom.replaceClass('footerContainer', 'footer2', 'footer');							return true;						}						return true;					}else{						return true;					}			},				updatePhotoCredit: 	function (picInfo){					var photographer = picInfo.photographer || null;					if (photographer != null && photographer != ''){//						return true;						var pcNode = $('photoCredit') || null;						if (pcNode != null) { 										// check to see if there is an existing photoCredit Node//							console.log (pcNode);							var phNode = $('photographer') || null;							if (phNode != null){//								console.log ('phNode')								if (phNode.innerHTML == photographer){				// Check to see if the photographer is the same									return true;									// if it is no change is neccessary exit the function 								}else{												// else the photographer is different so...									phNode.innerHTML = photographer; 				// set photographer node to new photographer value									var achPhoto = $(photograhperURL) || null;									if (achPhoto != null){							// if there is an photograhper link//										console.log (achPhoto);										var pURL = picInfo.photographerURL || null;										if (pURL != null) {							// and if there is a new photographer URL 											achPhoto.setAttribute('href', pURL);	// change the link to reflect the new photographer URL											return true;							// both photographer and URL have been updated so exit the function										} else {									// there is not a link associated with this photogragher so ...//											console.log ('no photographer website');											pcNode.replaceChild ($('photographer'),achPhoto);	//replace the photographerURL with the photograhper										}									}								}							}						}else{													// no existing photocredit so ...							picture.addPhotoCredit(picInfo);//							console.log ('no photo credit node.');						}					}else{														// else no photographer was returned, so ...						var pc = $('photoCredit') || null;						if (pc != null) {										// if there is a photoCredit Node							picture.removePCNode();								// remove the photoCredit Node						}														// or do nothing if there is no photoCredit Node						return true;											// return true function 					}															// all conditions tested, function complete//									},							addPhotoCredit: function (picInfo){//				console.log('in add photo credit');				var credit = document.createElement ('div');						// create a photoCredit Node				credit.setAttribute ("id", "photoCredit");							// add identifier to the photoCredit Node				var pBy = document.createTextNode ("PHOTO BY: ")					// create a text node with text "PHOTO BY:" 				credit.appendChild (pBy);											// add the "PHOTO BY:" Text Node as the first child of the Credit Node				var photographer = document.createElement ('span');					// create a photographer Node to enclose the photographer				photographer.setAttribute ("id", "photographer");				var pText = document.createTextNode (picInfo.photographer);			// create a text Node containing the content of picInfo.photographer				photographer.appendChild (pText);									// add the text Node as a child of the photographer Node								if (picInfo.photographerURL){										// if there is a photographer URL					var link = document.createElement ('a');						// create an anchor Node to hold the link info					link.setAttribute ("id", "photographerURL");					// add an identifier to the anchor Node					link.setAttribute ("href", picInfo.photographerURL);			// add the link (href) information to the anchor Node					link.setAttribute ("target", "_blank");							// add the link (target) information to the anchor Node (opens in new window)					link.appendChild (photographer);								// wrap the photographer Node with the anchor Node					credit.appendChild (link);										// wrap the anchor Node in the photoCredit Node				} else {															// else the photographer doesn't have a website to link to, so...					credit.appendChild (photographer);								// wrap the photographer Node with the photoCredit Node				}				var ftNode = $ ('footer') || null;									// get the footer Node				if (ftNode != null){//					console.log (ftNode);					var parNode = ftNode.parentNode || null;						// get the parent Node of the footer Node				}				if (parNode != null){					parNode.insertBefore(credit, ftNode);							// inset the photoCredit into the document before the footer Node					return true;				}//				console.log ('no node created');			},				removePCNode:	function (){						if (pcNode = $('photoCredit')){							pcNode.parentNode.removeChild (pcNode);						}			}			}photoMenu = {	pmAnchors: new Array(),	selAnchor:null,	selIndex:null,	discoverScope: function () {					var i = 1;					//var myAnchors = new Array();					while (aObj = $ ('number' + i)){						this.pmAnchors.push(aObj)						//alert(aObj);						i++;					}			},	findSelected: function () {				var src = $ ('pic').src;				var picSrcArr = src.split ('/');				var fName = picSrcArr[picSrcArr.length -1]				var re = /\d\d/gi;				var matchesArr = fName.match(re);				if (matchesArr.length != 0){					var nTemp = matchesArr[0];					var i = (nTemp.charAt(0) == '0')?nTemp.substr(1):nTemp					var tempID = 'number' + i;					return {el: $(tempID), idx:i-1};				}				return false;			},	updateSelected: function () {				var selectedInfo = this.findSelected ();				if (selectedInfo) {					if (this.selAnchor == null){						this.selAnchor = selectedInfo.el;						this.selIndex = selectedInfo.idx;						this.hiliteSelected();						return true;					}					if (this.selAnchor == selectedInfo.el){						return true;					}					this.unHiliteSelected ();					this.selAnchor = selectedInfo.el;					this.selIndex = selectedInfo.idx;					this.hiliteSelected();					return true;				}				return false			},	unHiliteSelected: function () {				//var posTxt = this.backgroundOffsets[this.selIndex][0];				//this.selAnchor.style.backgroundPosition = posTxt;				var success = null;				var i = this.selIndex +1;				var nClName = 'anc' + i;				var oClName = 'selAnc' + i;				success = YAHOO.util.Dom.replaceClass(this.selAnchor, oClName, nClName);			},	hiliteSelected: function () {				//var posTxt = this.backgroundOffsets[this.selIndex][2];				//this.selAnchor.style.backgroundPosition = posTxt;				var success = null;				var i = this.selIndex +1;				var oClName = 'anc' + i;				var nClName = 'selAnc' + i;				success = YAHOO.util.Dom.replaceClass(this.selAnchor, oClName, nClName);							}}//photoMunuvar callbacks = { 		    // Successful XHR response handler 		    success : picture.handleSuccess,		    failure:  picture.handleFailure		    //arguments: args}