/****************************************
|
| A-Line / Muru
| http://www.a-linetool.com
|
| Created by: Kevin Biskaborn
| Copyright 2010 ScriptReaction
| http://www.scriptreaction.com
|
*****************************************
| Load Dependencies	: None
| Run Dependencies	: Global{}
****************************************/

var RecentPhotos = {
	activateById: function ( id ){
		// this function is the caller STUB for the FLASH BANNER
		// and accesses the images in the popUpPhotos div element
		RecentPhotos.activateGroupImage( id, "popUpPhotos" );
	},
	activateInlineById: function ( id ){
		// this function is the caller STUB for the INLINE IMAGES
		// located directly on the gallery page
		RecentPhotos.activateGroupImage( id, "galleryInlinePhotos" );
	},
	activateGroupImage: function ( id, groupDivId ){
		
		// get all image elements
		var arrayOfAnchorElements = $( groupDivId ).getElementsByTagName( "a" );
		
		// create an array of images container
		var arrayOfImages = new Array();
		
		// create loop containers
		var aTag, imageArray;
		
		// cycle through all anchors
		for( var i = 0; i < arrayOfAnchorElements.length; i++ ){
			
			// get the next anchor tag
			aTag = arrayOfAnchorElements[ i ];
			
			// create an image array container
			imageArray = new Array();
			
			// add the image properties
			imageArray.push( aTag.href );
			imageArray.push( RecentPhotos.buildImageCaption( aTag.title ) );
			
			// add the image to the collection
			arrayOfImages.push( imageArray );
		}
		
		// get the start image index
		var startImageIndex = id - 1;
		
		// specify the options object
		var optionsObject = { loop: true };
		
		// activate the slimbox component
		Slimbox.open( arrayOfImages, startImageIndex, optionsObject );
	},
	buildImageCaption: function ( titleTag ){
		return JS_Format.string.parseSpanClassTags( titleTag );
	}
}



