
function y_diashow_load(imageArr){for(var i=0;i<imageArr.length;i++){y_diashowImages[i]=new Image();y_diashowImages[i].src=imageArr[i];y_diashowImages[i].W=0;y_diashowImages[i].H=0;}
y_getImgDim(0);}
function y_getImgDim(i){var newImg=y_diashowImages[i];if(newImg.W==0){if(isNaN(newImg.width)||newImg.width==0){window.setTimeout(function(){y_getImgDim(i);},20);}
else{var dim=y_scale_proportional(newImg.width,newImg.height,y_div.x*0.95,y_div.y*1.0)
newImg.W=dim[0];newImg.H=dim[1];y_diashow_run(false);}}}
function y_diashow_run(increase){if(increase){y_image_index=(y_image_index+1)%y_diashowImages.length;}
var newImg=y_diashowImages[y_image_index];if(newImg.W==0){y_getImgDim(y_image_index);return false;}
var left=parseInt((y_div.x-newImg.W)/2);var top=parseInt(330*img_scaler-(newImg.H/2));if(y_top_visible){$("art2art_bottom").src=newImg.src;$("art2art_bottom").setStyles({'left':left,'top':top,'width':newImg.W,'height':newImg.H});y_topTween.start(1.,0.);y_bottomTween.start(0.,1.);}else{$("art2art_top").src=newImg.src;$("art2art_top").setStyles({'left':left,'top':top,'width':newImg.W,'height':newImg.H});y_topTween.start(0.,1.);y_bottomTween.start(1.,0.);}
y_top_visible=!y_top_visible;window.setTimeout(function(){y_diashow_run(true);},6000);}
function y_scale_proportional(width,height,maxWidth,maxHeight){var Faktor=Math.max(width/maxWidth,height/maxHeight);Faktor=Math.max(Faktor,1.);newWidth=parseInt(width/Faktor);newHeight=parseInt(height/Faktor);return[newWidth,newHeight];}
