var GalleryHelper_v01 = {
	debug: false,
	
	log: function (s) {
		if (this.debug && window.console)
			console.log( s );
	},
	/* 
		Centeres the array of given images, according to the given height  by setting the paddingTop style
		@param pics Array of images (HTMLElement)
		@param height int The height of outer container
		@return void
	 */
	centerPics: function(pics, width, height) {
		for (var j = 0; j < pics.length; j++) {
			w = pics[ j ].offsetWidth;
			h = pics[ j ].offsetHeight;
			
			if (w > width) {
				h = parseInt(width * h / w);
				w = width;
			}
			if (h > height) {
				w = parseInt(height * w / h);
				h = height;
			}
		
			pics[ j ].width = w;
			pics[ j ].height = h;
			
			this.log(pics[ j ].src + ' width: ' + w + ' height: ' + h);

			var pad = (height - h) / 2;
			if (pad > 0) {
				pics[ j ].style.paddingTop = pad + 'px';
				this.log(pics[ j ].src + ' padded top: ' + pad);
			}
			
			pad = (width - w) / 2;
			if (pad > 0) {
				pics[ j ].style.paddingLeft = pad + 'px';
				this.log(pics[ j ].src + ' padded left: ' + pad);
			}
		}
	}
};
