// JavaScript Document
debugtext = "";
function setimg()
{
bx = 1280;
by = 538;
wx = $(window).width();
wy = $("#stage1").css("height");
wy = wy.replace("px","");
//jetzt = vormals.replace(/Hinz/g, "Kunz, geb. Hinz");
fx = wx/bx;
fy = wy/by;
if (fy < fx) // immmer der größte Faktor ist ausschlaggebend
{
y = by *fx // neue Bildhöhe
mg_korrektur = Math.round ((y-wy)/2)*-1;
$("#testimg1").css('margin-top',mg_korrektur);
$("#testimg1").css('margin-left',"0px");
$("#testimg1").css('width',wx); //100%
$("#testimg1").css('height',y);
$("#testimg2").css('margin-top',mg_korrektur);
$("#testimg2").css('margin-left',"0px");
$("#testimg2").css('width',wx);
$("#testimg2").css('height',y);
}
else
{
x = bx *fy // neue Bildbreite
mg_korrektur = Math.round ((x-wx)/2)*-1;
$("#testimg1").css('margin-top',"0px");
$("#testimg1").css('margin-left',mg_korrektur);
$("#testimg1").css('width',x);
$("#testimg1").css('height',wy);
$("#testimg2").css('margin-top',"0px");
$("#testimg2").css('margin-left',mg_korrektur);
$("#testimg2").css('width',x);
$("#testimg2").css('height',wy);
}
$("#ornamentimg").css('width',wx);
$("#ornamentimg").css('height',wy); // fixer wert -> verzerrt
//$("#textbalken_bottom").css('height',($(document).height()-500));
$("#leftcontenttable").css('height',(300)); // erst verkürzen da sonst die Länge nicht mehr kürzer wird
$("#leftcontenttable").css('height',($(document).height()-368));
}
function init_sound()
{
soundManager.createSound({ id: 'plaetschern', url: '/sounds/Boat-MaRc-8003_hifi.mp3', autoLoad: true,autoPlay: true, onfinish: function() {soundManager.play('plaetschern');},volume:70});
soundManager.createSound({ id: 'birds', url: '/sounds/birds.mp3', autoLoad: true,autoPlay: true, onfinish: function() {soundManager.play('birds');},volume:100});
soundManager.createSound({ id: 'song', url: '/sounds/ambiente_music.mp3', autoLoad: true,autoPlay: true, onfinish: function() {soundManager.play('song');},volume:80});
}
function preload(group,nr)
{
//alert(group+ " "+nr);
img[group][nr] = new Image();
img[group][nr].src = imagelist[group][nr];
next = nr + 1;
if (next < imagelist[group].length)
{
img[group][nr].onload = function() {flag[group][nr] = true; preload(group,next);}
}
else
{
img[group][nr].onload = function() {flag[group][nr] = true; }
nextgroup = group+1;
if (nextgroup < imagelist.length)
{preload(nextgroup,0);}
}
}
actual_img = -1;
actual_group = 0;
actual_layer = 1;
standzeit = 6000;
function changer()
{
setimg();
new_img = actual_img +1;
if (new_img >= img[actual_group].length) {new_img = 0;}
if (flag[actual_group][new_img] == true)
{
if (actual_layer == 1)
{
$("#testimg2").attr("src",img[actual_group][new_img].src);
debugtext = "2 bekommt Src. 1 fadet jetzt aus";
$("#stage1").animate({opacity: 0},2000,"linear",function()
{
actual_layer = 2;
actual_img = new_img;
debugtext = "2 bekommt Src. 1 fadet jetzt aus - FERTIG";
window.setTimeout("changer()", standzeit);
});
}
else
{
$("#testimg1").attr("src",img[actual_group][new_img].src);
debugtext = "1 bekommt Src. 1 fadet jetzt ein";
$("#stage1").animate({opacity: 1},2000,"linear",function()
{
actual_layer = 1;
actual_img = new_img;
debugtext = "1 bekommt Src. 1 fadet jetzt ein - FERTIG";
window.setTimeout("changer()", standzeit);
});
}
}
else
{
window.setTimeout("changer()", 500);
}
}
function deb_out()
{
$("#debugger").html(""+flag[1][0]+" "+flag[1][1]+" "+flag[1][2]+" "+flag[1][3]+" - Act: "+actual_group+" - "+actual_img+" - Ly: "+actual_layer+"| Z-Index: "+$("#stage1").css("z-index")+" - "+$("#stage2").css("z-index")+" | Window: "+wx+" - "+wy+"
"+debugtext );
//$("#debugger").html("WTC: "+wtc.join(",")+"
INSTR: "+m_instr.join(",")+"
"+debugtext );
window.setTimeout("deb_out()", 100);
}