/*******************************************************************/
/***( image gallery )**********************************************/
/*******************************************************************/
var curStep = 1;
var steps = new Array();
function imagegallery(num) {
steps = document.getElementById("gallery_nav").getElementsByTagName("li");
	if (num != curStep) {
		elem = document.getElementById("gallery" + num);
		prevElem = document.getElementById("gallery" + curStep);
		elem.style.display = "block";
		prevElem.style.display = "none";
		steps[curStep-1].className = "";
		steps[num-1].className = "active";
		curStep = num;
	}
}

/*******************************************************************/
/***( drawer gallery )**********************************************/
/*******************************************************************/

/*************************** alternate to display HTML ***************************/
GalleryObj.prototype.displaySmallGallery = function(self) {
	self.glryimgsXcntnt = self.glryX.getElementsByTagName('galleryimage');
	var iGalleryWidth = self.glrycntntH.offsetWidth;

	for(var i=0; i<self.glryimgsXcntnt.length; i++) {
		var oItem = self.glryimgsXcntnt[i];
		var sName = (oItem.getElementsByTagName('name')[0].hasChildNodes()) ? oItem.getElementsByTagName('name')[0].firstChild.data : '';
		var sDate = (oItem.getElementsByTagName('date')[0].hasChildNodes()) ? oItem.getElementsByTagName('date')[0].firstChild.data : '';
		if(iGalleryWidth > 570 && sDate.length > 0) { sDate += ' / '; }
		var sDescription = (oItem.getElementsByTagName('description')[0].hasChildNodes()) ? oItem.getElementsByTagName('description')[0].firstChild.data : '';
		self.glryimgsX[self.glryimgsX.length] = {
			obj: oItem,
			href:oItem.getAttribute('href'),
			thumbnail:oItem.getElementsByTagName('thumbnail')[0].firstChild.data,
			fullsize:oItem.getElementsByTagName('fullsize')[0].firstChild.data,
			alt:oItem.getAttribute('alt'),
			name:sName,
			date:sDate,
			description:sDescription
		};
	}
	
	
	self.thumbalt = 'Image Thumbnail';
	self.onimage = '/jp/pro/creative/images/onnavdot20060420.gif';
	self.offimage = '/jp/pro/creative/images/offnavdot20060420.gif';
	self.onoffimageheight = 9;
	self.onoffimagewidth = 9;
	self.nextarrow = '/jp/pro/creative/images/rightgalleryarrow20060420.gif';
	self.prevarrow = '/jp/pro/creative/images/leftgalleryarrow20060420.gif';
	self.nextarrowheight = 14;
	self.nextarrowwidth = 12;
	self.prevarrowheight = 14;
	self.prevarrowwidth = 12;
	self.smallglry = true;
	
	if(iGalleryWidth < 570) {
		self.thumbsacrs = 6;
		self.thumbpding = 5;
		self.thumbwdth = 41;
		self.thumbhght = 40;
		self.glrywdth = 370;
		self.thumbnavwdth = ((self.thumbwdth+(self.thumbpding*2))*self.thumbsacrs);
		self.mvspd = parseFloat((self.thumbwdth+(self.thumbpding*2))/self.glryspd);
		self.smallglryimgheight = 178;
		self.smallglryimgwidth = 300;

		if(self.glryimgsX.length > 1) { self.displayHTML(); }
		self.displaySmallGalleryImg();
	} else {
		self.thumbsacrs = 7;
		self.thumbpding = 10;
		self.thumbwdth = 55;
		self.thumbhght = 55;
		self.glrywdth = 572;
		self.thumbnavwdth = ((self.thumbwdth+(self.thumbpding*2))*self.thumbsacrs);
		self.mvspd = parseFloat((self.thumbwdth+(self.thumbpding*2))/self.glryspd);
		self.smallglryimgheight = 183;
		self.smallglryimgwidth = 260;
		
		if(self.glryimgsX.length > 1) { self.displayHTML(); }
		self.displayWideGalleryImg();
	}

};
GalleryObj.prototype.displayWideGalleryImg = function() {
	var oGlryImgX = this.glryimgsX[0];
	this.oFullSzImg.src = oGlryImgX.fullsize;
	this.oFullSzImg.alt = oGlryImgX.alt;
	this.oDateH5.appendChild(document.createTextNode(oGlryImgX.date));
	this.oDescriptionP.appendChild(document.createTextNode(oGlryImgX.description));
	var oDateDescDiv = oDiv.cloneNode(true);

	
	this.oFullSzImg.style.width = this.smallglryimgwidth+'px';
	this.oFullSzImg.style.height = this.smallglryimgheight+'px';
	this.oFullSzImg.style.margin = '0 15px 0 33px';
	if(browser.isIE == true) {
		this.oFullSzImg.style.styleFloat = 'left';
	} else {
		this.oFullSzImg.style.cssFloat = 'left';
	}

	oDateDescDiv.style.margin = '0 33px 0 0';

	this.oDateH5.style.margin = '0';
	this.oDateH5.style.color = '#666666';
	this.oDateH5.style.fontSize = '11px';
	this.oDateH5.style.display = 'inline';

	this.oDescriptionP.style.margin = '0';
	this.oDescriptionP.style.padding = '0';
	this.oDescriptionP.style.color = '#999999';
	this.oDescriptionP.style.fontSize = '10px';
	this.oDescriptionP.style.display = 'inline';
	
	oDateDescDiv.appendChild(this.oDateH5);

	oDateDescDiv.appendChild(this.oDescriptionP);
	this.glrycntntH.appendChild(this.oFullSzImg);
	this.glrycntntH.appendChild(oDateDescDiv);
};
GalleryObj.prototype.displaySmallGalleryImg = function() {
	var oGlryImgX = this.glryimgsX[0];
	this.oFullSzImg.src = oGlryImgX.fullsize;
	this.oFullSzImg.alt = oGlryImgX.alt;
	this.oDateH5.appendChild(document.createTextNode(oGlryImgX.date));
	this.oDescriptionP.appendChild(document.createTextNode(oGlryImgX.description));

	this.oFullSzImg.style.width = this.smallglryimgwidth+'px';
	this.oFullSzImg.style.height = this.smallglryimgheight+'px';
	this.oFullSzImg.style.margin = '0 35px';
	this.oDateH5.style.width = this.smallglryimgwidth+'px';
	this.oDateH5.style.margin = '5px 35px';
	this.oDateH5.style.color = '#666666';
	this.oDateH5.style.fontSize = '11px';
	this.oDescriptionP.style.width = this.smallglryimgwidth+'px';
	this.oDescriptionP.style.margin = '0 35px';
	this.oDescriptionP.style.color = '#999999';
	this.oDescriptionP.style.fontSize = '10px';
	
	this.glrycntntH.appendChild(this.oFullSzImg);
	this.glrycntntH.appendChild(this.oDateH5);
	this.glrycntntH.appendChild(this.oDescriptionP);
};
GalleryObj.prototype.processSmallGalleryFSImg = function(obj,ev) {
	stopDefaultAction(ev);
	var oClickedLink = getClickedLink(ev);
	var iImgNum = oClickedLink.parentNode.id.split('_')[1];
	var oGlryImgX = obj.glryimgsX[iImgNum];
	
	obj.oFullSzImg.src = oGlryImgX.fullsize;
	obj.oFullSzImg.alt = oGlryImgX.alt;
	obj.oDateH5.innerHTML = oGlryImgX.date;
	obj.oDescriptionP.innerHTML = oGlryImgX.description;
};
GalleryObj.prototype.getGalleryImages = function(self,func) {
	self.thumbnmstgl = true;
	if(self.glryimgsX.length <= 0 && self.glryX.getElementsByTagName('galleryitems').length > 0) {
		if(self.glryitmsX.getAttribute('fromurl')) {
			var xmlfile = self.glryitmsX.getAttribute('fromurl');
			
			var images = new Array();
			AppleJAX.getXML(xmlfile,function(){
				var category;
				var results = req.responseXML;
				//if(self.glryitmsX.getAttribute('fromelement')) {
				//	category = results.getElementsByTagName(self.glryitmsX.getAttribute('fromelement'))[0];
				//}
				category = results;
				var items = self.glryitmsX.getElementsByTagName('item');
				for(var i=0;i<items.length;i++) {
					var item = items[i].firstChild.data;
					var oItem = category.getElementsByTagName(item)[0].getElementsByTagName('galleryimage')[0];
					self.glryimgsX[i] = {
						obj:oItem,
						href:oItem.getAttribute('href'),
						thumbnail:oItem.getElementsByTagName('thumbnail')[0].firstChild.data,
						alt:oItem.getAttribute('alt'),
						name:oItem.getElementsByTagName('name')[0].firstChild.data,
						learnmore:oItem.getAttribute('learnmore'),
						buynow:oItem.getAttribute('buynow')
					};
				}
				self.displayHTML();
				if(func) {func();}
			});
		}
	} else {
		self.displayHTML();
		if(func) {func();}
	}
};
GalleryObj.prototype.setGalleryList = function(self) {
	self.glrywdth = self.glrywdth-170;
	
	self.glrylstcntnrH.style.width = '170px';

	self.glrylstH.style.width = '170px';
	
	for(var i=0;i<self.glryimgsX.length;i++) {
		var listitem = oLi.cloneNode(true);
		listitem.appendChild(document.createTextNode(self.glryimgsX[i].name));
		listitem.style.listStyle = 'disc inside';
		self.glrylstH.appendChild(listitem);
	}
	self.glrylstcntnrH.style.position = 'absolute';
	self.glrylstcntnrH.style.top = '10px';
	self.glrylstcntnrH.style.left = '10px';
	self.glrycntntH.style.position = 'absolute';
	self.glrycntntH.style.top = '10px';
	self.glrycntntH.style.left = '180px';
	self.glrylstcntnrH.appendChild(self.glrylstH);
	var containerDiv = self.glrycntntH.parentNode;
	containerDiv.insertBefore(self.glrylstcntnrH,self.glrycntntH);
	
	self.displayHTML();

	var glrylstcntnrheight = self.glrylstcntnrH.offsetHeight;
	var drawerheight = 184;
	var glrylstcntnrtop = (drawerheight-glrylstcntnrheight)/2;
	self.glrylstcntnrH.style.top = glrylstcntnrtop+'px';

	var glryheight = self.glrycntntH.offsetHeight;
	var glrytop = (drawerheight-glryheight)/2;
	self.glrycntntH.style.top = glrytop+'px';
};
/*************************** display HTML ***************************/
GalleryObj.prototype.displayHTML = function() {
	this.pgs = parseInt(this.glryimgsX.length/this.thumbsacrs);
	
	if(this.glryimgsX.length <= 0) {
		this.errmsg += 'What are you thinking? A gallery with no images? That won\'t work! ';
	}
	var requiredattributeerrors = '';
	for(i=0;i<this.reqattrs.length;i++) {
		if(!(this.glryX.getAttribute(this.reqattrs[i]))) {
			if(i == (this.reqattrs.length-1)) {
				requiredattributeerrors += 'and ' + this.reqattrs[i];
			} else {
				requiredattributeerrors += this.reqattrs[i] + ', ';
			}
		}
	}
	if(requiredattributeerrors.length > 0) {
		this.errmsg += 'You need to add attributes to the gallery tag.  Please add: ' +
			requiredattributeerrors + '. ';
	}
	
	if(this.glryX.getAttribute('rulecolor')) { //should be hasAttribute but doesn't work in IE
		this.rlclr = this.glryX.getAttribute('rulecolor');
	}
	if(this.glryX.getAttribute('thumbnailnavheight')) { //should be hasAttribute
		this.thumbnavhght = parseInt(this.glryX.getAttribute('thumbnailnavheight'));
	} else {
		this.thumbnavhght = this.thumbhght+60+this.onoffimageheight;
	}

	var remainder = (this.glryimgsX.length%this.thumbsacrs);
	if(remainder > 0) {
		this.errmsg += 'You have an incorrect number of gallery images.  ' +
			'Please check your XML file. ' + this.glryimgsX.length +
			' gallery images and ' + this.thumbsacrs + ' thumbnails across. You need ' +
			(this.thumbsacrs-parseInt(remainder)) + ' more or ' + remainder + ' less. ';
	}

	this.glryH.setAttribute('id',this.galleryStr+'gallery');
	this.glryrlH.setAttribute('id',this.galleryStr+'galleryrule');
	this.glryimgglrynavH.setAttribute('id',this.galleryStr+'imagegallerynav');
	this.glrypgnavH.setAttribute('id',this.galleryStr+'pagenav');
	this.glrymtncontH.setAttribute('id',this.galleryStr+'motioncontainer');
	this.glrylftopacH.setAttribute('id',this.galleryStr+'leftopacity');
	this.glryrghtopacH.setAttribute('id',this.galleryStr+'rightopacity');
	this.glrymvingglryH.setAttribute('id',this.galleryStr+'movinggallery');
	
	var gallerynavtoggle = false;
	if(this.glryimgsX.length > this.thumbsacrs) {
		gallerynavtoggle = this.displayPrevNextNavHTML();
		this.displayPageNavHTML();
	}
	this.displayOpacityHTML();
	
	this.glrymtncontH.appendChild(this.glrymvingglryH);
	this.glryimgglrynavH.appendChild(this.glrypgnavH);
	this.glryimgglrynavH.appendChild(this.glrymtncontH);
	
	var moveSpeedString = this.mvspd.toString();
	var moveSpeedDecimal = this.mvspd.toString().split('.')[1];

	if(moveSpeedDecimal && moveSpeedDecimal.length >= 10) {
		this.errmsg += 'Watch your speed! Your speed will not work ' +
			'in this scenario. Your current speed is ' + this.glryspd +
			' and your image width with padding is ' +
			(this.thumbwdth+(this.thumbpding*2)) +
			'. This results in an actual speed of ' + this.mvspd +
			', which may be a repeating decimal. ';
	}
	
	if(this.errmsg.length > 0) {
		var errorText = document.createTextNode(this.errmsg);
		this.glrycntntH.appendChild(errorText);
	} else {

		this.preloadImages();
		this.displayThumbnailsHTML();
		this.styleHTML();
		if(this.flszimgtgl) {
			this.glrycntntH.appendChild(this.glryH);
			this.glrycntntH.appendChild(this.glryrlH);
		}
		if(gallerynavtoggle) {this.glrycntntH.appendChild(this.glrynavH);}
		this.glrycntntH.appendChild(this.glryimgglrynavH);
	}
};

GalleryObj.prototype.preloadImages = function() {
	for(i=0;i<this.glryimgsX.length;i++) {
		if(this.glryimgsX[i].length > 0 && this.glryimgsX[i].thumbnail) {
			this.thumbimgs[i] = new Image();
			this.thumbimgs[i].src = this.glryimgsX[i].thumbnail;
		}

	}
};

GalleryObj.prototype.styleHTML = function() {
	this.glrycntntH.style.width = this.glrywdth + 'px';
	if(!this.smallglry) {
		this.glrycntntH.style.cssFloat = 'left';
	}
	this.glryrlH.style.width = this.glrywdth + 'px';
	if(this.rlclr) {
		this.glryrlH.style.borderTop = '1px solid ' + this.rlclr;
	}
	
	this.glrypgnavH.style.width = this.glrywdth + 'px';
	this.glrypgnavH.style.textAlign = 'center';
	this.glrypgnavH.style.margin = '0 0 10px 0';
	
	this.glrymtncontH.style.width = this.thumbnavwdth + 'px';
	this.glrymtncontH.style.height = this.thumbnavhght + 'px';
	this.glrymtncontH.style.margin = '0 ' + (this.glrywdth-this.thumbnavwdth)/2 + 'px'; 

	this.glrymtncontH.style.padding = '0';
	this.glrymtncontH.style.overflow = 'hidden';
	this.glrymtncontH.style.position = 'relative';
	
	this.glrymvingglryH.style.width = this.thumbnavwdth + 'px';
	this.glrymvingglryH.style.height = this.thumbnavhght + 'px';
	this.glrymvingglryH.style.position = 'relative';
};

GalleryObj.prototype.displayOpacityHTML = function() {
	if(this.glryX.getElementsByTagName('gallerysideopacity').length > 0) {
		var gallerysideopacityXML = this.glryX.getElementsByTagName('gallerysideopacity')[0];
		var galleryleftopacityXML = gallerysideopacityXML.getElementsByTagName('leftopacity')[0];
		var galleryrightopacityXML = gallerysideopacityXML.getElementsByTagName('rightopacity')[0];

		this.glrylftopacH.style.position = 'absolute';
		this.glrylftopacH.style.left = '0px';
		this.glrylftopacH.style.top = '0px';
		this.glrylftopacH.style.height = this.thumbnavhght + 'px';
		this.glrylftopacH.style.width = galleryleftopacityXML.getAttribute('width') + 'px';
		this.glrylftopacH.style.background = 'url(' + galleryleftopacityXML.getAttribute('src') + ') repeat-y';
		this.glrylftopacH.style.zIndex = '200';
		this.glrylftopacH.style.behavior = 'url(/main/js/iepngfix/iepngfix.htc)';
	
		this.glryrghtopacH.style.position = 'absolute';
		this.glryrghtopacH.style.right = '0px';
		this.glryrghtopacH.style.top = '0px';
		this.glryrghtopacH.style.height = this.thumbnavhght + 'px';
		this.glryrghtopacH.style.width = galleryrightopacityXML.getAttribute('width') + 'px';
		this.glryrghtopacH.style.background = 'url(' + galleryrightopacityXML.getAttribute('src') + ') repeat-y';
		this.glryrghtopacH.style.zIndex = '200';
		this.glryrghtopacH.style.behavior = 'url(/jp/main/js/iepngfix/iepngfix.htc)';
	
		this.glrymtncontH.appendChild(this.glrylftopacH);
		this.glrymtncontH.appendChild(this.glryrghtopacH);
	}
};

GalleryObj.prototype.displayPageNavHTML = function() {

		var pagenavonimg = oImg.cloneNode(true);
		pagenavonimg.setAttribute('width',this.onoffimagewidth);
		pagenavonimg.setAttribute('height',this.onoffimageheight);
		pagenavonimg.setAttribute('border','0');
		pagenavonimg.style.margin = '2px 4px 0pt'; // '0 2px'; // nat
	
		while(this.glrypgnavH.hasChildNodes()) { this.glrypgnavH.removeChild(this.glrypgnavH.firstChild); }
	
		for(i=0;i<this.pgs;i++) {
			if(this.currbgningthumb == (i*this.thumbsacrs)) {
					pagenavonimg.setAttribute('src',this.onimage);

				this.glrypgnavH.appendChild(pagenavonimg);
			}
			else {
				var pagenavoffa = oA.cloneNode(true);
				var pagenavoffimg = pagenavonimg.cloneNode(true);
		
				pagenavoffa.setAttribute('id',this.galleryStr+'pagenav_'+(this.thumbsacrs*i));				
				pagenavoffa.setAttribute('href','#');
				pagenavoffimg.setAttribute('src',this.offimage);
	
				pagenavoffa.appendChild(pagenavoffimg);
				this.glrypgnavH.appendChild(pagenavoffa);

				var myObj = this;
				addEventToObject(pagenavoffa,'onclick',function(ev){processMovingGalleryNavItem(myObj,ev);});

			}
		}
	
	return true;
};

GalleryObj.prototype.displayPrevNextNavHTML = function() {


		this.glrynavH.setAttribute('id',this.galleryStr+'gallerynav');
	

		this.glrynavprevH.setAttribute('href','#');
		this.glrynavnextH.setAttribute('href','#');
		this.glrynavprevH.setAttribute('id',this.galleryStr+'prevgallerynav');
		this.glrynavnextH.setAttribute('id',this.galleryStr+'nextgallerynav');
		

		this.glrynavprevimgH.setAttribute('src',this.prevarrow);
		this.glrynavnextimgH.setAttribute('src',this.nextarrow);

		
		this.glrynavprevimgH.setAttribute('width',this.prevarrowwidth);
		this.glrynavnextimgH.setAttribute('width',this.nextarrowwidth);
		this.glrynavprevimgH.setAttribute('height',this.prevarrowheight);
		this.glrynavnextimgH.setAttribute('height',this.nextarrowheight);
		this.glrynavprevimgH.setAttribute('border','0');
		this.glrynavnextimgH.setAttribute('border','0');

		this.glrynavprevimgH.setAttribute('alt','Previous');
		this.glrynavnextimgH.setAttribute('alt','Next');
		
		this.glrynavprevH.appendChild(this.glrynavprevimgH);
		this.glrynavnextH.appendChild(this.glrynavnextimgH);
		
		this.glrynavH.appendChild(this.glrynavprevH);
		this.glrynavH.appendChild(this.glrynavnextH);
	
		this.glrynavH.style.width = this.glrywdth + 'px';
		this.glrynavH.style.position = 'relative';

		this.glrynavprevH.style.position = 'absolute';
		this.glrynavnextH.style.position = 'absolute';

		if(this.glryX.getElementsByTagName('gallerypagenav')[0]) {
			this.glrynavprevH.style.top = (((this.thumbnavhght-parseInt(this.prevarrowheight))/2)+parseInt(this.onoffimageheight)+((this.thmbnmstgl) ? 10 : 0)) + 'px';
			this.glrynavnextH.style.top = (((this.thumbnavhght-parseInt(this.nextarrowheight))/2)+parseInt(this.onoffimageheight)+((this.thmbnmstgl) ? 10 : 0)) + 'px';
		} else {

			this.glrynavprevH.style.top = ((this.thumbnavhght-parseInt(this.prevarrowheight))/2) + 'px';
			this.glrynavnextH.style.top = ((this.thumbnavhght-parseInt(this.nextarrowheight))/2) + 'px';
		}

		this.glrynavprevH.style.left = (((this.glrywdth-this.thumbnavwdth)/2)-(parseInt(this.prevarrowwidth)+10)) + 'px';
		this.glrynavnextH.style.right = (((this.glrywdth-this.thumbnavwdth)/2)-(parseInt(this.nextarrowwidth)+10)) + 'px'; // '100px'; //  // nat test
		
		this.glrynavprevH.style.zIndex = 100;
		this.glrynavnextH.style.zIndex = 100;

		var myObj = this;
		
addEventToObject(this.glrynavprevH,'onclick',function(ev){processMovingGalleryNavItem(myObj,ev);});
		addEventToObject(this.glrynavnextH,'onclick',function(ev){processMovingGalleryNavItem(myObj,ev);});

		return true;

};

GalleryObj.prototype.displayThumbnailsHTML = function(direction) {
	for(i=0;i<this.glrymvingglryH.childNodes.length;i++) {
		if((i < this.currbgningthumb) || (i > (this.currbgningthumb+this.thumbsacrs))) {
			var childToRemove = document.getElementById(this.galleryStr+'imagenav_'+i);
			if(childToRemove) {
				this.glrymvingglryH.removeChild(childToRemove);
			}
		}
	}

	if(this.mvingthumbs.length > this.thumbsacrs) {
		this.mvingthumbs.splice(0,this.thumbsacrs);
		this.mvingthumblft.splice(0,this.thumbsacrs);
	}

	var endingThumbnail = (this.thumbnum+this.thumbsacrs);

	var i = this.thumbsacrs;
	var j = this.thumbsacrs;

	for(this.thumbnum;this.thumbnum<endingThumbnail;this.thumbnum++) {
		
		var galleryimagedivHTML = oDiv.cloneNode(true);
		var galleryimageaHTML = oA.cloneNode(true);
		var galleryimagetitleaHTML = oA.cloneNode(true);
		var galleryimageimgHTML = oImg.cloneNode(true);
		var galleryimagespanHTML = oSpan.cloneNode(true);
		var galleryimagelearnmoreimgHTML = oImg.cloneNode(true);
		var galleryimagebuynowimgHTML = oImg.cloneNode(true);
		var galleryimagelearnmoreaHTML = oA.cloneNode(true);
		var galleryimagebuynowaHTML = oA.cloneNode(true);
		var galleryimagelearnmorespanHTML = oSpan.cloneNode(true);
		var galleryimagebuynowspanHTML = oSpan.cloneNode(true);
		var buttonHeight = '17px';
		var buttonWidth = '86px';
		

		galleryimagedivHTML.setAttribute('id',this.galleryStr+'imagenav_'+this.thumbnum);
		galleryimagedivHTML.style.position = 'absolute';
		galleryimagedivHTML.style.width = (this.thumbwdth+(this.thumbpding*2)) + 'px';
		galleryimagedivHTML.style.height = this.thumbnavhght + 'px';

		galleryimagedivHTML.style.top = '0px';
		var thumbnailLeft;

		if(direction === 'right') {
			thumbnailLeft = (-(this.thumbwdth+(this.thumbpding*2))*i);
			i--;
		}
		else if(direction === 'left') {
			thumbnailLeft = ((this.thumbwdth+(this.thumbpding*2))*j);
			j++;
		}
		else {
			thumbnailLeft = (this.thumbnum*(this.thumbwdth+(this.thumbpding*2)));
		}

		galleryimagedivHTML.style.left = thumbnailLeft + 'px';
		this.mvingthumblft.push(thumbnailLeft);

		galleryimagedivHTML.style.padding = '0 ' + this.thumbpding + 'px';

		// add link to a thumbnail
		if(this.glryimgsX[this.thumbnum].href){
			galleryimageaHTML.setAttribute('href',this.glryimgsX[this.thumbnum].href);
		}


		if(this.glryimgsX[this.thumbnum].thumbnail) {
			galleryimageimgHTML.setAttribute('src',this.glryimgsX[this.thumbnum].thumbnail);
		}

		galleryimageimgHTML.setAttribute('width',this.thumbwdth);
		galleryimageimgHTML.setAttribute('height',this.thumbhght);

		if(this.glryimgsX[this.thumbnum].alt) {
			galleryimageimgHTML.setAttribute('alt',this.glryimgsX[this.thumbnum].alt);
		}

		galleryimageimgHTML.setAttribute('border','0');

		// display title with a link underneath of each thumbnail
		if(this.thumbnmstgl && this.glryimgsX[this.thumbnum].name) {
			var childTitle = document.createTextNode(this.glryimgsX[this.thumbnum].name);
			if(this.glryimgsX[this.thumbnum].href)
			{
				galleryimagetitleaHTML.setAttribute('href',this.glryimgsX[this.thumbnum].href);
				galleryimagetitleaHTML.style.color = '#666';
				
			}
			galleryimagetitleaHTML.appendChild(childTitle);
			galleryimagespanHTML.appendChild(galleryimagetitleaHTML);
			
		}
		
		// display Learn More button
		if(this.thumbnmstgl && this.glryimgsX[this.thumbnum].learnmore) {
			galleryimagelearnmoreimgHTML.setAttribute('src', 'http://images.apple.com/jp/pro/images/btnLearnmore.gif');
			galleryimagelearnmoreimgHTML.setAttribute('border','0');
			galleryimagelearnmoreimgHTML.setAttribute('width',buttonWidth);
			galleryimagelearnmoreimgHTML.setAttribute('height',buttonHeight);
			galleryimagelearnmoreimgHTML.style.width = buttonWidth;
			galleryimagelearnmoreimgHTML.style.height = buttonHeight;
			galleryimagelearnmoreaHTML.setAttribute('href',this.glryimgsX[this.thumbnum].learnmore);
			galleryimagelearnmoreaHTML.appendChild(galleryimagelearnmoreimgHTML);
			galleryimagelearnmorespanHTML.appendChild(galleryimagelearnmoreaHTML);
		}
		
		// display Buy Now button
		if(this.thumbnmstgl && this.glryimgsX[this.thumbnum].buynow) {
			galleryimagebuynowimgHTML.setAttribute('src', 'http://images.apple.com/jp/pro/images/btnBuynow.gif');
			galleryimagebuynowimgHTML.setAttribute('border','0');
			galleryimagebuynowimgHTML.setAttribute('width',buttonWidth);
			galleryimagebuynowimgHTML.setAttribute('height',buttonHeight);
			galleryimagebuynowimgHTML.style.width = buttonWidth;
			galleryimagebuynowimgHTML.style.height = buttonHeight;
			galleryimagebuynowaHTML.setAttribute('href',this.glryimgsX[this.thumbnum].buynow);
			galleryimagebuynowaHTML.appendChild(galleryimagebuynowimgHTML);
			galleryimagebuynowspanHTML.appendChild(galleryimagebuynowaHTML);
		}
		
		


		
		// SPAN that wraps thumb image and title
		galleryimagespanHTML.style.display = 'block';
		galleryimagespanHTML.style.width = this.thumbwdth + 'px';
		galleryimagespanHTML.style.textAlign = 'center';
		//galleryimagespanHTML.style.margin = '0 ' + thumbnailpadding + 'px';
		galleryimagespanHTML.style.fontSize = this.thumbfntsz + 'px';
		
		// SPAN that wraps Learn More button
		galleryimagelearnmorespanHTML.style.display = 'block';
		galleryimagelearnmorespanHTML.style.width = this.thumbwdth + 'px';
		galleryimagelearnmorespanHTML.style.textAlign = 'center';
		galleryimagelearnmorespanHTML.style.padding =  this.thumbpding + 'px' + ' 0 0 0';
		
		// SPAN that wraps Buy Now button
		galleryimagebuynowspanHTML.style.display = 'block';
		galleryimagebuynowspanHTML.style.width = this.thumbwdth + 'px';
		galleryimagebuynowspanHTML.style.textAlign = 'center';
		galleryimagebuynowspanHTML.style.padding =  this.thumbpding + 'px' + ' 0 0 0';

		//if(this.glryimgsX[this.thumbnum].hasChildNodes()) {
		galleryimageaHTML.appendChild(galleryimageimgHTML);
		galleryimagedivHTML.appendChild(galleryimageaHTML);
		galleryimagedivHTML.appendChild(galleryimagespanHTML);
		if(this.thumbnmstgl && this.glryimgsX[this.thumbnum].buynow)
			galleryimagedivHTML.appendChild(galleryimagebuynowspanHTML); //nat
		if(this.thumbnmstgl && this.glryimgsX[this.thumbnum].learnmore)
			galleryimagedivHTML.appendChild(galleryimagelearnmorespanHTML); //nat
			
			if(this.flszimgtgl) {
				addEventToObject(galleryimageaHTML,'onclick',this.processGalleryImageItem);
			}
			var myObj = this;
			if(this.smallglry) {
				addEventToObject(galleryimageaHTML,'onclick',function(ev){myObj.processSmallGalleryFSImg(myObj,ev);});
			}

		this.glrymvingglryH.appendChild(galleryimagedivHTML);
		

		this.mvingthumbs.push(galleryimagedivHTML);
		
	}

	return true;

};

GalleryObj.prototype.displayLargeImageHTML = function(galleryimage) {
	var galleryImgHTML = oImg.cloneNode(true);
	this.glryh4H = document.createElement('h4');
	var galleryH4Text;
	if(galleryimage.getElementsByTagName('name')[0] && galleryimage.getElementsByTagName('name')[0].hasChildNodes()) {
		galleryH4Text = document.createTextNode(galleryimage.getElementsByTagName('name')[0].firstChild.data);
	} else {
		galleryH4Text = document.createTextNode('');
	}
	
	while(this.glryH.hasChildNodes()) { this.glryH.removeChild(this.glryH.firstChild); }
	
	if(galleryimage.getElementsByTagName('fullsize')[0] && galleryimage.getElementsByTagName('fullsize')[0].hasChildNodes()) {
	galleryImgHTML.setAttribute('src',galleryimage.getElementsByTagName('fullsize')[0].firstChild.data);
	}

	galleryImgHTML.setAttribute('alt',galleryimage.getAttribute('alt'));
	galleryImgHTML.setAttribute('border','0');
	galleryImgHTML.setAttribute('width',this.flszwdth);
	galleryImgHTML.setAttribute('height',this.flszhght);
	
	galleryImgHTML.style.width = this.flszwdth + 'px';
	galleryImgHTML.style.height = this.flszhght + 'px';
		
	this.glryh4H.appendChild(galleryH4Text);
	
	this.glryH.style.width = this.glrywdth + 'px';
	this.glryH.style.height = (this.flszhght+this.lrgfntsz+5) + 'px';
	this.glryH.style.padding = '0 0 ' + (this.lrgfntsz+5) + 'px 0';
	this.glryH.style.textAlign = 'center';
	
	this.glryh4H.style.color = this.txtclr;
	this.glryh4H.style.fontSize = this.lrgfntsz + 'px';

	this.glryH.style.visibility = 'hidden';
	
	this.glryH.appendChild(galleryImgHTML);
	this.glryH.appendChild(this.glryh4H);
	
	
	this.glryH.Fade(600,0,100,50,10,10);
	
	return true;
};




