var index = 0;
var flag = 0;
var surimg=null;
var surspan=null;
imgs_min = new Array('/images/1[min].jpg',
					'/images/2[min].jpg',
					'/images/4[min].jpg',
					'/images/5[min].jpg',
					'/images/6[min].jpg');
imgs = new Array('/images/12.jpg',
				'/images/1.jpg',
				'/images/2.jpg',
				'/images/3.jpg',
				'/images/4.jpg',
				'/images/5.jpg',
				'/images/6.jpg',
				'/images/7.jpg',
				'/images/8.jpg',
				'/images/9.jpg',
				'/images/10.jpg',
				'/images/11.jpg',
				'/images/0.jpg',
				'/images/13.jpg',
				'/images/14.jpg',
				'/images/15.jpg');
text = new Array('<a href="http://www.oknarosta.ru/plastic.php">Пластиковые окна</a>',
				'<a href="http://www.oknarosta.ru/plastic.php">Пластиковые окна</a>',
				'<a href="http://www.oknarosta.ru/plastic.php">Пластиковые окна</a> и <a href="http://www.oknarosta.ru/al_okna.php">алюминиевые окна</a>',
				'<a href="http://www.oknarosta.ru/plastic.php">Пластиковые окна</a> и <a href="http://www.oknarosta.ru/al_okna.php">алюминиевые окна</a>',
				'<a href="http://www.oknarosta.ru/plastic.php">Пластиковые окна</a> и <a href="http://www.oknarosta.ru/al_okna.php">алюминиевые окна</a>',
				'<a href="http://www.oknarosta.ru/al_okna.php">Алюминиевые окна</a>',
				'<a href="http://www.oknarosta.ru/al_okna.php">Алюминиевые окна</a>',
				'<a href="http://www.oknarosta.ru/al_okna.php">Алюминиевые окна</a> и <a href="http://www.oknarosta.ru/al_vitrazh.php">витраж</a>',
				'<a href="http://www.oknarosta.ru/al_zs.php">Зимний сад</a>',
				'<a href="http://www.oknarosta.ru/derevo.php">Деревянные окна</a>',
				'<a href="http://www.oknarosta.ru/al_zs.php">Зимний сад</a>',
				'<a href="http://www.oknarosta.ru/al_krovlya.php">Светопрозрачная кровля</a>',
     			'<a href="http://www.oknarosta.ru/derevo.php">Деревянные окна</a>',
     			'<a href="http://www.oknarosta.ru/al_dveri.php">Алюминиевые двери</a>',
     			'<a href="http://www.oknarosta.ru/al_okna.php">Алюминиевые окна</a>',
     			'<a href="http://www.oknarosta.ru/al_okna.php">Алюминиевые окна</a>');
var str='';

function st(){
for(i=0;i<imgs.length;i++){
 if (i==index){
 str+=' | <span class="lin" onClick="flag=0;mult();index='+i+';func();">'+(i+1)+'</span> ';
 }
else {str+=' | <span class="link" onClick="flag=0;mult();index='+i+';func();">'+(i+1)+'</span>';}
}
document.getElementById('str').innerHTML = str.substring(3, str.length-1)
str='';
}

function first(){
index=0;
func();
}
function last(){
index=imgs.length-1;
func();
}

function next(){
if (index<imgs.length-1){index++;
func();
}
else{
if (index=imgs.length-1){index=0;
func();
}
}
}

function pre(){
if(index>=1){
index--;
func();
}
else{
index=imgs.length-1;
func();
}
}

function mult(){
if(flag==0)
{clearTimeout(window.to);
if (index!=0){index--; func();
 document.getElementById('btn').src='/images/buton_01.jpg';
 document.getElementById('btn').alt='запустить слайд-шоу';
 document.getElementById('btn').title='запустить слайд-шоу';
 document.getElementById('btn').width='53';
 document.getElementById('btn').height='54';}
 else{index=5; func();
 document.getElementById('btn').src='/images/buton_01.jpg';
 document.getElementById('btn').alt='запустить слайд-шоу';
 document.getElementById('btn').title='запустить слайд-шоу';
 document.getElementById('btn').width='53';
 document.getElementById('btn').height='54';
 index=0;
 }
 }	
else
{ 
 func(); index++;
 if(index>imgs.length-1) index=0;
 window.to=setTimeout("mult();",2500);
 document.getElementById('btn').src='/images/buton_24.jpg';
 document.getElementById('btn').alt='остановить слайд-шоу';
 document.getElementById('btn').title='остановить слайд-шоу';
 document.getElementById('btn').width='53';
 document.getElementById('btn').height='54';
}
}

function func(){
document.photo.src = imgs[index];	
document.getElementById('insert').innerHTML = text[index];
st();
}
