window.addEvent('domready',function(){
	if ($('home-slideshow'))
	{
		images = $('home-slideshow').getElements('li');
		firstimage = $('home-slideshow').getElement('li.show');
		counter = 0;
		currentcounter = 0;
		totalimages = images.length - 1;
		images.each(function(el){
			el.addClass('show');
			if (el != firstimage)
			{
				el.set('opacity',0);
			} else
			{
				el.set('opacity',1);
				currentcounter = counter;
			}
			el.store('fx',new Fx.Morph(el));
			counter++;
		});
		
		var slide = function(){
			var nextcounter = currentcounter + 1;
			if (nextcounter > totalimages)
			{
				nextcounter = 0;
			}
			images[currentcounter].retrieve('fx').start({'opacity':0}).chain(function(){
				images[nextcounter].retrieve('fx').start({'opacity':1})
			});
			currentcounter++;
			if(currentcounter > totalimages)
			{
				currentcounter = 0;
			}
		};
		slide.periodical(4000,window);
	}
});

window.addEvent('load', function(){
/***************************************
/  PNG transparency fix for IE 6
/**************************************/
	if ((Browser.Engine.trident4) && (document.body.filters))
	{
		$$('img').each(function(img){
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML
			}
		});
	}
});