﻿
var slide = new Array;
var pictureName = new Array("images/slideshow_1.jpg", "images/slideshow_2.jpg", "images/slideshow_3.jpg", "images/slideshow_4.jpg");

for (var i=0; i<pictureName.length; i++) {
  slide[i] = new Image();
  slide[i].src = pictureName[i];
}
var m=new Array(0, 100);
var nextImage=0;
var t="";

function next() {
  if (t!="") return;
  m[0] = 1.0;
  nextImage=nextImage+1;
  if (nextImage==pictureName.length) nextImage = 0;
  if (nextImage==-1) nextImage=pictureName.length-1;
  fade_out();
}

function fade_out() {
  m[0]-=0.02;
  document.getElementById("slider").style.opacity = m[0];
  document.getElementById("slider").style.filter="alpha(opacity="+m[0]*100+")";
  t = setTimeout("fade_out()",5);
  if (m[0] < 0.04) {
    clearTimeout(t);
    document.getElementById("slider").src = slide[nextImage].src;
    document.getElementById("slider").style.opacity = 0;
    document.getElementById("slider").style.filter="alpha(opacity=100)";
    t = "";
    fade_in();
  }

}

function fade_in() {
  m[0]+=0.02;
  document.getElementById("slider").style.opacity = m[0];
  document.getElementById("slider").style.filter="alpha(opacity="+m[0]*100+")";
  t = setTimeout("fade_in()",5);
  if (m[0] > 0.96) {
    clearTimeout(t);
    document.getElementById("slider").style.opacity = 1.0;
    document.getElementById("slider").style.filter="alpha(opacity=100)";
    t = "";
  }
}


function slideshow_new() {
  b=setTimeout("slideshow_new()",500);
  next();
}


document.write(document.getElementById("slider").style);
window.onLoad=slideshow_new();




function checkform(arg,id) {
	if (arg.sizeop.value==-1) {
		var name="error"+id;
		document.getElementById(name).innerHTML='Выберите размер!';
	}
	else {arg.submit();}
}


