
var dgw_PicCnt = 5;
var dgw_foldername = "/fileadmin/slideshow/slides/demographischerwandel/";
var dgw_StayTime = 5000;
var dgw_ImgWidth = 560;  //411;
var dgw_ImgHeight = 274;
var dgw_playing = false;


uagent = window.navigator.userAgent.toLowerCase();
IEB = (uagent.indexOf('msie') != -1) ? true : false;
OPB = (uagent.indexOf('opera') != -1) ? true : false;
CRB = (uagent.indexOf('chrome') != -1) ? true : false;
SFB = (uagent.indexOf('safari') != -1) ? true : false;
var dgw_IsInitialStart = 0;
var scompat = document.compatMode;
var dgw_s = null;
var dgw_cwidth = 0;
var dgw_cheight = 0;
var dgw_calc = 0;
var dgw_tam = 0;
var dgw_ts = "";
var dgw_ds = "";
var dgw_jbtype = 0;
var dgw_realcurrent = 0;
var dgw_timeo = null;
var CursorStr = "default";
var dgw_DescCalcWidth = 0;
var dgw_DescCalcHeight = 0;
var dgw_DescCalcIcWidth = 0;
var dgw_DescCalcIcHeight = 0;
var dgw_ShowStopped = false;
dgw_imgarr = new Array();
dgw_imgstr = new Array();
dgw_linkstr = new Array();
dgw_clslinkstr = new Array();
dgw_titarr = new Array();
dgw_desarr = new Array();

for (var pidx = 0; pidx < dgw_PicCnt; pidx++) {
    dgw_imgarr[pidx] = new Image();
    dgw_imgarr[pidx].c = 0;
    dgw_imgarr[pidx].onload = dgw_secondcomplate;
    dgw_imgarr[pidx].src = dgw_foldername + 'image' + pidx + '.jpg';
    dgw_imgstr[pidx] = dgw_foldername + 'image' + pidx + '.jpg';
    dgw_linkstr[pidx] = '';
    dgw_clslinkstr[pidx] = '';
    dgw_titarr[pidx] = "";
    dgw_desarr[pidx] = "";
}

if ((IEB == true) && (scompat == "BackCompat")) {
    dgw_cwidth = dgw_ImgWidth;
    dgw_cheight = dgw_ImgHeight;
} else {
    dgw_cwidth = dgw_ImgWidth - 2 * (0);
    dgw_cheight = dgw_ImgHeight - 2 * (0);
}
var dgw_icwidth = dgw_ImgWidth - 2 * (0);
var dgw_icheight = dgw_ImgHeight - 2 * (0);
dgw_DescCalcWidth = 260;
dgw_DescCalcHeight = 80;
if ((IEB == true) && (scompat == "BackCompat")) {
    dgw_DescCalcIcWidth = dgw_DescCalcWidth;
    dgw_DescCalcIcHeight = dgw_DescCalcHeight;
} else {
    dgw_DescCalcIcWidth = dgw_DescCalcWidth - 2 * (2) - 2 * (3);
    dgw_DescCalcIcHeight = dgw_DescCalcHeight - 2 * (2) - 2 * (3);
}
document.write('<div style="position:relative;width:' + dgw_cwidth + 'px;height:' + dgw_cheight + 'px;overflow:hidden;border-style:' + 'solid' + ';border-width:' + 0 + 'px;border-color:#' + '000000' + ';' + '' + '' + '">');
document.write('<div id="dgw_dv" style="position:relative;width:' + dgw_icwidth + 'px;height:' + dgw_icheight + 'px;overflow:hidden;padding:0px;margin:0px;z-index:1;' + 'FILTER: progid:DXImageTransform.Microsoft.Fade(Overlap=1.00,duration=2,enabled=false);' + '"' + ' onfilterchange=dgw_FadeBitti()' + '></div>');
for (i = 0; i < dgw_PicCnt; i++) {

    if (0 == 0) {
        dgw_ds = dgw_ds + dgw_linkstr[i];
        if (dgw_linkstr[i].length > 2) {
            CursorStr = "pointer";
        } else {
            CursorStr = "default";
        }
    }

    dgw_ds = dgw_ds + '<div id="dgw_desc' + i + '" style="position:absolute;top:' + 120 + 'px;left:' + 10 + 'px;width:' + dgw_DescCalcWidth + 'px;height:' + dgw_DescCalcHeight + 'px;visibility:hidden;overflow:hidden;cursor:' + CursorStr + ';z-index:20;">';
    dgw_ds = dgw_ds + '<div style="position:absolute;left:0px;top:0px;width:' + dgw_DescCalcWidth + 'px;height:' + dgw_DescCalcHeight + 'px;border-style:solid;border-width:0px;border-color:#000000;background-color:#' + '000000' + ';opacity: ' + '0.50' + ';filter:alpha(opacity=' + '50' + ');-moz-opacity:' + '0.50' + ';"></div>';
    dgw_ds = dgw_ds + '<div style="position:relative;left:0px;top:0px;width:' + dgw_DescCalcIcWidth + 'px;height:' + dgw_DescCalcIcHeight + 'px;overflow:hidden;padding:' + 3 + 'px;text-align:' + 'left' + ';border-style:' + 'solid' + ';border-width:' + 2 + 'px;border-color:#' + '990000' + ';color:#' + 'FFFFFF' + ';font-family:' + 'arial' + ';font-style:' + 'normal' + ';font-size: ' + '13px' + ';font-weight:' + 'normal' + ';text-decoration:' + 'none' + ';opacity: 1.0;filter:alpha(opacity=100);-moz-opacity:1.0;">';
    dgw_ds = dgw_ds + '<span style="color:#' + 'FECE3F' + ';font-family:' + 'arial' + ';font-style:' + 'normal' + ';font-size: ' + '14px' + ';font-weight:' + 'bold' + ';text-decoration:' + 'none' + ';">' + dgw_titarr[i] + '</span><br />' + dgw_desarr[i];
    dgw_ds = dgw_ds + '</div>';
    dgw_ds = dgw_ds + '</div>';

    if (0 == 0) {
        dgw_ds = dgw_ds + dgw_clslinkstr[i];
    }

}
document.write('' + dgw_ds);

document.write('</div>');

function dgw_Sonraki() {
    dgw_vcurr = dgw_vnext;
    dgw_vnext = dgw_vnext + 1;
    if (dgw_vnext >= dgw_PicCnt) {
        dgw_vnext = 0;
        dgw_tam = 1;
    }
    dgw_objc = document.getElementById('dgw_d' + dgw_vcurr);
    dgw_objn = document.getElementById('dgw_d' + dgw_vnext);
}

function dgw_secondcomplate() {
    this.c = 1;
}

function dgw_devam(fm, pt) {

    if ((dgw_imgarr[dgw_vnext].c == 1) && (dgw_imgarr[dgw_vcurr].c == 1)) {
        dgw_timeo = setTimeout(fm + '()', pt);
    } else {
        dgw_timeo = null;
        setTimeout('dgw_devam("' + fm + '")', 500);
    }
    var dgw_cagain = 1;
    for (i = 0; i < dgw_PicCnt; i++) {
        if (dgw_imgarr[i].c == 1) {
        } else {
            dgw_cagain = 0;
        }
    }
    if (dgw_cagain == 1) {
        dgw_tam = 1;
    }
}

function dgw_sl() {
    dgw_vcurr = 0;
    dgw_vnext = 0;
    dgw_vssdiv = null;
    stepc = 20 * (2);
    dgw_dif = 0.00;
    dgw_op = 1.00;
    dgw_dif = (1.00 / stepc);
    dstr1 = '<div id="';
    dstr2 = '" style="position:absolute;visibility:hidden;' + 'left:0px;top:0px;' + 'padding:0px;margin:0px;overflow:hidden;">';
    dstr23 = '<table cellspacing="0" cellpadding="0" style="position:relative;left:0px;top:0px;padding:0px;margin:0px;"><tr><td style="width:' + dgw_icwidth + 'px;height:' + dgw_icheight + 'px;left:0px;top:0px;padding:0px;margin:0px;text-align:' + 'center' + ';vertical-align:' + 'middle' + ';">';
    dstr3 = '<img id="dgw_img';
    dstr4 = '" src="';
    dstr5 = '"  border="0" style="position:relative;border-style:' + 'solid' + ';border-width:' + '0' + 'px;border-color:' + '#CCCCCC' + ';' + 'width:' + dgw_icwidth + 'px;height:' + dgw_icheight + 'px;' + '" alt=""></img>';
    dstr56 = '</td></tr></table>';
    dstr6 = '</div>';
    this.dgw_dotrans = dgw_dotrans;
    this.dgw_initte = dgw_initte;
    this.dgw_initte2 = dgw_initte2;
    this.dgw_beftrans = dgw_beftrans;
    this.dgw_dotransff = dgw_dotransff;
    this.RestartSlideshow = dgw_RestartSlideshow;
    this.initialStart = dgw_initialStart;
}

function dgw_FadeBitti() {
    dgw_jbtype = 0;
}

function dgw_WaitForNextStepIE() {
    dgw_ShowStopped = false;
    dgw_Sonraki();
    if (dgw_tam == 0) {
        dgw_devam("dgw_dotrans", ((1000 * 2) + dgw_StayTime));
        dgw_timeo = null;
    } else {
        dgw_timeo = setTimeout('dgw_dotrans()', ((1000 * 2) + dgw_StayTime));
    }
    startProgressInfo(dgw_StayTime);
}


function dgw_dotrans() {
    dgw_jbtype = 1;
    if (IEB == true) {
        dgw_vssdiv.filters[0].apply();
    }
    dgw_objc.style.visibility = "hidden";
    dgw_objn.style.visibility = "visible";
    if (IEB == true) {
        dgw_vssdiv.filters[0].play();
    }
    dgw_realcurrent = dgw_vnext;
    if (dgw_playing) {
        dgw_WaitForNextStepIE();
    }
    else
        dgw_ShowStopped = true;
}

function dgw_WaitForNextStepFF() {
    dgw_ShowStopped = false;
    dgw_objc.style.zIndex = 2;
    dgw_objn.style.zIndex = 3;
    dgw_realcurrent = dgw_vnext;
    dgw_Sonraki();
    if (dgw_tam == 0) {
        dgw_devam("dgw_beftrans", dgw_StayTime);
        dgw_timeo = null;
    } else {
        dgw_timeo = setTimeout('dgw_beftrans()', dgw_StayTime);
    }
    dgw_jbtype = 0;
    startProgressInfo(dgw_StayTime);
}


function dgw_dotransff() {
    dgw_op = dgw_op - dgw_dif;
    if (dgw_op < (0.00)) {
        dgw_op = 0.00;
    }
    dgw_objc.style.opacity = dgw_op;
    dgw_objn.style.opacity = 1.00 - dgw_op;
    if (dgw_op > (0.00)) {
        setTimeout('dgw_dotransff()', 50);
    } else {
        if (dgw_playing) {
            dgw_WaitForNextStepFF();
        }
        else
            dgw_ShowStopped = true;
    }
}

function dgw_beftrans() {
    dgw_jbtype = 1;
    dgw_op = 1.00;
    dgw_objc.style.visibility = "visible";
    dgw_objn.style.visibility = "visible";
    dgw_objc.style.zIndex = 3;
    dgw_objn.style.zIndex = 2;
    dgw_objc.style.opacity = 1.00;
    dgw_objn.style.opacity = 1.00;
    dgw_dotransff();
}


function dgw_RestartSlideshow() {
    if (IEB)
        dgw_WaitForNextStepIE();
    else {
        //        if (this.dgw_vnext > 0)
        //            this.dgw_vnext = this.dgw_vnext - 1;
        dgw_WaitForNextStepFF();
    }

}

function dgw_initialStart() {
    dgw_IsInitialStart = 2;
    if (IEB == true) {
        dgw_Sonraki();
        dgw_devam("dgw_dotrans", dgw_StayTime);
    } else {
        dgw_Sonraki();
        dgw_devam("dgw_beftrans", dgw_StayTime);
    }
    startProgressInfo(dgw_StayTime);
}

function dgw_initte2() {
    dgw_vssdiv = document.getElementById("dgw_dv");

    dgw_objc = document.getElementById('dgw_d' + 0);
    dgw_objc.style.visibility = "visible";

    dgw_vcurr = 0;
    dgw_vnext = 0;
    dgw_realcurrent = 0;

    if (dgw_playing) {
        dgw_initialStart();
    }
    else
        dgw_IsInitialStart = 1;
}

function dgw_initte() {
    i = 0;
    innertxt = "";
    for (i = 0; i < dgw_PicCnt; i++) {
        innertxt = innertxt + dstr1 + "dgw_d" + i + dstr2 + dstr23 + dgw_linkstr[i] + dstr3 + i + dstr4 + dgw_imgstr[i] + dstr5 + dgw_clslinkstr[i] + dstr56 + dstr6;
    }
    spage = document.getElementById('dgw_dv');
    spage.innerHTML = "" + innertxt;

    setTimeout('dgw_initte2()', 100);
}

function dgw_Bas() {

    dgw_s = new dgw_sl();
    dgw_s.dgw_initte();
}

setTimeout('dgw_Bas()', 100);

function dgw_stopSlideshow() {
    dgw_playing = false;
}

function dgw_startSlideshow() {
    if (!dgw_playing) {
        dgw_playing = true;
        if (dgw_IsInitialStart == 1) {
            if (dgw_s.initialStart != undefined)
                dgw_s.initialStart();
            else
                alert("nixx da");
        }
        else if (dgw_ShowStopped) {
            dgw_s.RestartSlideshow();
        }
    }
}


     