function fixPNG(element){
  //Если браузер IE версии 5.5-6
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
	var src;
	if (element.tagName=='IMG'){
		if (/\.png$/.test(element.src)){
		src = element.src;
		element.src = "http://195.68.160.173/3/imgstc/blank.gif"}}
	//если, src не пуст, то нужно загрузить изображение с помощью фильтра AlphaImageLoader
	if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')"}}



fw.slideshow = function(){
	var out = {};
	for(var i in fw.slideshow) out[i] = (typeof fw.slideshow[i]);
	out['version'] = "v0.21";
	return out;
}

fw.slideshow._img = {};
fw.slideshow._prefix = 'idx_';
fw.slideshow._interval = 5000;
fw.slideshow._duration = 500;
fw.slideshow._fpd = 5;
fw.slideshow._isIE = /MSIE/.test(navigator.userAgent);
fw.slideshow._speed = Math.round(this._duration / this._fpd);
fw.slideshow._step = Math.round(100 / this._fpd);
fw.slideshow._pool = [];

fw.slideshow.setOpacity = function(els, opacity){
	/* Use early detecting type of opacity */
	els[fw.slideshow._opacity] = (fw.slideshow._opacity != "filter") ? (opacity / 100) : "alpha(opacity=" + opacity + ")";
}

fw.slideshow.cache = function (idx, url, uid, nums){
	/* Executing once, cos early we havent't access to style */
	if (typeof fw.slideshow._opacity == "undefined") fw.slideshow._opacity = (typeof document.body.style.opacity == "string") ? "opacity" : ((typeof document.body.style.Mozopacity == "string") ? "MozOpacity": ((typeof document.body.style.KhtmlOpacity == "string") ? "KhtmlOpacity" : "filter"));
	this._img[idx] = [];
	for(var i=0; i < nums.length; i++){
		var im = new Image();
		im.src = url + uid.substr(0,2) + "/" + uid.substr(2,2) + "/" + uid + "/s_img" + nums[i] + ".jpg";
		this._img[idx].push(im);
		this._img[idx]["el_ptr"] = document.getElementById(this._prefix + idx).getElementsByTagName("img")[0];
		this._img[idx]["style_ptr"] = this._img[idx]["el_ptr"].style;
	}
	im = new Image();
	im.src = document.getElementById(this._prefix + idx).getElementsByTagName('img')[0].src;
	this._img[idx].push(im);
	/* Cross-browser JS closure */
	this._pool.push(window.setInterval(function(){fw.slideshow.change(idx)}, this._interval));
}

fw.slideshow.change = function (i){
	var img = {}, speed = Math.round(this._duration / this._fpd), step = Math.round(100 / this._fpd), timer = 0; 
	fw.slideshow._img[i].push(fw.slideshow._img[i].shift());
	img = fw.slideshow._img[i][0];
	if((window.ActiveXObject)?img.complete:img.height){
		for(j = 100; j >=0; j-=step) {
			if (fw.slideshow._isIE)
				window.setTimeout("fw.slideshow.setOpacity(fw.slideshow._img["+i+"]['style_ptr'], "+j+")", timer * speed);
			else
				window.setTimeout(fw.slideshow.setOpacity, timer * speed, fw.slideshow._img[i]['style_ptr'], j);
			timer++;
		}
		window.setTimeout(function(){fw.slideshow._img[i]['el_ptr'].src = fw.slideshow._img[i][0].src;}, this._duration);
		for(j = 0; j <= 100; j+=step) {
			if(fw.slideshow._isIE)
				window.setTimeout("fw.slideshow.setOpacity(fw.slideshow._img["+i+"]['style_ptr'], "+j+")", fw.slideshow._duration + step + timer * speed);
			else
				window.setTimeout(fw.slideshow.setOpacity, fw.slideshow._duration + step + timer * speed, fw.slideshow._img[i]['style_ptr'], j);
			timer++;
		}
	}
}

fw.slideshow.destroy = function(){
  for (var i = 0; i < this._pool.length; i++)
    window.clearInterval(this._pool[i]);
}

fw.slideshow.start = function (){
	return false;
}

fw.slideshow();
