window.addEvent('domready', function() {
	
	//1.2.3 compatibility fix for $
	window.$ = document.id;
	
	var myItems = $$('.pics_list li');
	var thumbsHolder = $('minithumbs');	
	var picBox = $('mainpic');
	
	//tooltips addition here
	var customTips = $$('.tooltip');
	var toolTips = new Tips(customTips, {
		showDelay: 500,
    	className: 'pdt_tip',
		
		
		
		onShow: function(tip){
			//passes the tooltip element
			//you can fade in to full opacity
			//or leave them a little transparent
			tip.fade('in');
		},
		onHide: function(tip){
			tip.fade('out');
		}
	});
	
	thumbsHolder.set('opacity', .0001);
	
	//preload images here
	var theSources = new Array();
	myItems.each(function(el, i){
		var tempImage = $(el.getElement('a'));
		var tempSrc = tempImage.getProperty('href');
		theSources.push(tempSrc);			
	});
	
	var myImages = new Asset.images(theSources, {
		onProgress: function(counter){
			//
		},

		onComplete: function(){
			
			thumbsHolder.set('opacity', 1);
			
			if(myItems.length > 0) {
				myGallery = new QuickGallery({
					stage: picBox,
					thumbsHolder: thumbsHolder,
					items: myItems,
					//thumbsDir: "/dunham/images/textiles/thumbs/",
					thumbsDir: "/images/textiles/thumbs/",
					transitionTime: 1000
				});
				myGallery.start();
			}
			
		}
		
	});
	//end images load
	
	
	
	
	
	
});
