//variables
//var piccount=20;
//var minipicwidth=20;
//var picdir="foto";
//var minipicdir="foto/minipics"
//body tagına onLoad="preload()" konulmalı

//window.onload = preload; //bu komut sayfa yüklenince çalıştırılacak fonksiyonu söyle. Çalışabilmesi için, fonksiyonla aynı script dosyasında tanımlanmış olması gerekir.

// IE6 browser detection
IE6 = (navigator.appVersion.indexOf("MSIE")==-1) ? false : true; // sadece 6 versiyonu için "MSIE 6." yazılmalı
function browser() {document.getElementById('cikti_alani').innerHTML=IE6;}

preImages=[];
function preload() {

for (i=1;i<=piccount;i++) {
document.getElementById('minipics').innerHTML += '<img src="'+foto["no"+i].dosyaadi+'"  onclick="goster('+ i +')"/>';
}
document.getElementById('minipics').childNodes[1].setAttribute('id', 'secili');

for (i=1;i<=piccount;i++) {
preImages[i] = new Image()
preImages[i].src = foto["no"+i].dosyaadi;
//preImages[i].title = "ÜRÜN NO "+rsm_syc; 
}
//document.getElementById('picbuttons').getElementsByTagName('IMG')[piccount+1].onclick=function(){picdegis(1)};
timerint=setInterval("picdegis(1)",slayttime);
$("#gallery").hover(function() {clearInterval(timerint);},function() {timerint=setInterval("picdegis(1)",slayttime);})
};//preload() sonu

m=[];no=1;
function goster(no) {
document.getElementById('secili').setAttribute('id', '');
document.getElementById('minipics').childNodes[no].setAttribute('id', 'secili');
//document.getElementById('minipics').childNodes[no].className="secili";
var	secici=parseInt(document.getElementById('secici').style.marginLeft);
document.getElementById('secici').style.marginLeft=((no-1)*minipicwidth)+"px";
window.no=no; 
document.getElementById('picshow').getElementsByTagName('IMG')[1].src=preImages[no].src;
//document.getElementById('picshow').getElementsByTagName('IMG')[0].onload=fade();
};//goster() sonu

function fade() {
//document.getElementById('picshow').getElementsByTagName('IMG')[0].style.opacity=0;
for(k=0;k<10;k++){clearTimeout(m[k]);if(k==10) document.getElementById('monitor').innerHTML=k; m[k]=setTimeout("opaklatici("+(1-(k+1)/10)+")",50*k);}
m[9]=setTimeout("document.getElementById('picshow').getElementsByTagName('IMG')[0].src=document.getElementById('picshow').getElementsByTagName('IMG')[1].src",50*9);
for(k=0;k<10;k++){clearTimeout(m[k+10]);if(k==10) document.getElementById('monitor').innerHTML=k; m[k+10]=setTimeout("opaklatici("+(k+1)/10+")",50*(k+10));}
document.getElementById('altyazi').innerHTML=foto["no"+no].yazi;
//document.getElementById('monitor2').innerHTML=no+"/"+rsm;
};//fade() sonu

function opaklatici(opakdeger) {
if (IE6==true) document.getElementById('picshow').getElementsByTagName('IMG')[0].style.filter ='alpha(opacity='+opakdeger*100+')';
else document.getElementById('picshow').getElementsByTagName('IMG')[0].style.opacity=opakdeger;

return window.no;
}//opaklatici() sonu

function picdegis(solsag) {
if (solsag==1) {if (window.no<piccount) {no++;} else no=1;}
else {if (no>1) {no--;} else return true;}
goster(no);
}//picdegis() sonu

