function startGallery() {
	var myGallery = new gallery($('myGalleryListing'), {
		timed: false
	});
}

function loadMS(href) { with (document) {
	var span = createElement('SPAN');
	span.style.display = 'none';
	body.insertBefore(span, body.lastChild);
	span.innerHTML = 'Text for stupid IE.<s'+'cript></' + 'script>';
	setTimeout(function() {
		var s = span.getElementsByTagName('script')[0];
		s.language = 'JavaScript';
		if (s.setAttribute) 
			s.setAttribute('src', href); 
		else 
			s.src = href;
	}, 10);
}}


function rendering(data)
{
	for (var i = 0; i < data.feed.entry.length; i++)
	{
		addDiv2(data.feed.entry[i], i);
	}
	//window.addEvent('domready', startGallery);
	//window.onDomReady(startGallery);
	//startGallery();
}
function addDiv2 (item, count) {
	var title = item.title.$t;// the filename
	var imgId = item.gphoto$id.$t;// the file id
	
	var targetURL     = item.content.src + '?imgmax=576';//useful for downloading image
	var pictureURL    = item.content.src + '?imgmax=144&crop=1' ; //288;


	var commentCount  = item.gphoto$commentCount.$t;
	var description   = item.media$group.media$description.$t;// Picasa Web photo caption
	var keywords      = item.media$group.media$keywords.$t;// Picasa Web photo caption
	var description2  = "";

	try {
		var camera    = item.exif$tags.exif$make.$t + " " + item.exif$tags.exif$model.$t;
	} catch (err) {
		var camera    = "";
	}

	// comment this is line for remove tags data
	if (keywords.length > 0)
		description2 = description2 + "Tags: <a href='http://picasaweb.google.com/lh/searchbrowse?q=" + keywords + "'>" + keywords + "</a>;  ";
	
	// comment this is line for remove comments counter
		description2 = description2 + "Comments: " + commentCount + ";  ";

	// comment this is line for remove information about camera
	if (camera.length > 0)
		description2 = description2 + "Taken with: " + camera + "; ";
		
	// title
	title = "<a href='http://picasaweb.google.com/" + user + "/" + album + "/photo#" + imgId + "'>" + title + "</a>";
	
	if (description.length > 0)
		title = title + " - " + description;

//href='" + targetURL +"'

	HTML =	"<a class='thumbnailhover' title='"+ description + "' rel='lightbox[photography]' href='"+ targetURL +"'><img src='" + pictureURL + "'/></a>";
        
//class='full/thumbnail'
// full= normal scaled photos
// thumbnail = square thumbnails (distorted)

	newDiv = document.createElement("DIV");
        newDiv.className = "thumbnail";
	newDiv.innerHTML = HTML;
	$('gallerycontainer').appendChild(newDiv);
}