Event.observe(window, "load", attachBehaviourToThumbs);

function initCarousel(num){
	if (num>3){
		hCarousel = new UI.Carousel("h_slider");
	}
}

function attachBehaviourToThumbs(){
	icons = $$('.thumbImage');
	for (var i=0;i<icons.length;i++){
		icons[i].observe('click' ,showBigImage);
		icons[i].href = "javascript:void(0)"
	}
}

function showBigImage(){
	icons = $$('.thumbImage');
	for (var i=0;i<icons.length;i++){
		icons[i].parentNode.className = "";
	}
	$("mainImg").innerHTML = "";
	//$("loader").show();
	var pic = new Image();
	pic.id ="mainImgContent";
	pic.onload = (function(){
	  var alt = '';
	  if('alt' in pic)
	    if(pic.alt != undefined)
	      alt = 'alt="' + pic.alt + '"';
	      
		$('mainImg').innerHTML = '<img id="mainImgContent" style="display:none" src="'+pic.src+'" rel="'+pic.rel+'" ' + alt + '/>';
		$('mainImgContent').appear({duration:0.3});
		//this.style.display='block';
	});
	pic.src = this.rel;
	pic.alt = this.firstChild.alt;
	this.parentNode.className = "selected";
	
	return false;
}
