/*
	Utilities.js
	@author Paulo Bongato
	@date May 28, 2010
	@revision 2
*/

// image view, setup for lightbox
function imageViewer(id, path, images, summary, index) {
	var div = $("#"+id);
	var tempimgs = images.split(",");
	var tempsum = summary.split(";");
	
	// Remove anchor tags that is not the image shown
	$("#"+id+" a[class!=selected]").remove();

	// From the images path list, add anchor tags and append to div
	for(var i=0; i<tempimgs.length; i++) {
		var a = $(document.createElement("a"));

		a.attr({
			href: path+"/"+tempimgs[i],
			title: tempsum[i]
		});
		a.css("display","none");
		
		div.append(a);
	}

	// Setup light box for that div
	$("#"+id+" a[class!=selected]").lightBox();

	// Open the light box from the main image index
	$("#"+id+" a[class!=selected]").eq(index).click();
}

(function() {  
   $(document).ready(function() {
      var ac = $("#articles-column");

      ac.find(".tabs a").each(function(i, val) {
         $(val).click(function(e) {
            e.preventDefault();
      
            ac.find(".tabs a").removeClass("selected");
            ac.find(".tab-content").hide();

            $(this).addClass("selected");
            ac.find(".tab-content:eq("+i+")").show();
         });
      });
   });
})();

