/* ================================================================ 
This copyright notice must be untouched at all times.
Copyright (c) 2009 Stu Nicholls - stunicholls.com - all rights reserved.
=================================================================== */
onload = function() {
 

var CountdownJahr = 2010;
var CountdownMonat = 9;
var CountdownTag = 19;
var CountdownStunde = 00;
var CountdownMinute = 00;
var CountdownSekunde = 0;
 
function CountdownAnzeigen()
{
    var Jetzt = new Date();
    //var Countdown = new Date(CountdownJahr, CountdownMonat-1, CountdownTag, CountdownStunde, CountdownMinute, CountdownSekunde);
    var Countdown = new Date(CountdownJahr, CountdownMonat-1, CountdownTag);
    var MillisekundenBisCountdown = Countdown.getTime()-Jetzt.getTime();
    var Rest = Math.floor(MillisekundenBisCountdown/1000);
    var CountdownText = "";
 
    if(Rest >= 31536000)
    {
        var Jahre = Math.floor(Rest/31536000);
        Rest = Rest-Jahre*31536000;
 
        if(Jahre > 1 || Jahre == 0)
        {
            CountdownText += Jahre + " Jahre ";
        }
        else if(Jahre == 1)
        {
            CountdownText += Jahre + " Jahr ";
        }
    }
    if(Rest >= 86400)
    {
        var Tage = Math.floor(Rest/86400);
        Rest = Rest-Tage*86400;
 
        if(Tage > 1 || Tage == 0)
        {
            CountdownText += Tage + " Tage ";
        }
        else if(Tage == 1)
        {
            CountdownText += Tage + " Tag ";
        }
    }
 
    document.getElementById('Countdown').innerHTML = CountdownText;
    window.setTimeout("CountdownAnzeigen()", 1000);
}


CountdownAnzeigen();


/*
function für tabbed pages
*/

var e, i = 0;
 while (e = document.getElementById('tabbed').getElementsByTagName ('DIV') [i++]) {
 
  if (e.className == 'ony' || e.className == 'offy') {
  e.onclick = function() {
   var getEls = document.getElementsByTagName('DIV');
    for (var z=0; z<getEls.length; z++) {
    getEls[z].className=getEls[z].className.replace('showy', 'hidey');
    getEls[z].className=getEls[z].className.replace('ony', 'offy');
    }
   this.className = 'ony';
   var max = this.getAttribute('title');
   document.getElementById(max).className = "showy";
 
   et_eC_Wrapper('UBV26m', '/index_tabbed.php', '/', 0, '', '', 0, 0, 0, 0, 0, 0,0);
   ReloadPixelImages('rc_vermi_000', '');
 
   }
  }
}


/*
function für tabbed pages media
*/

var ex, ix = 0;
 while (ex = document.getElementById('tabbed_media').getElementsByTagName ('DIV') [ix++]) {
 
  if (ex.className == 'onx' || ex.className == 'offx') {
  ex.onclick = function() {
   var getElsx = document.getElementsByTagName('DIV');
    for (var zx=0; zx<getElsx.length; zx++) {
    getElsx[zx].className=getElsx[zx].className.replace('showx', 'hidex');
    getElsx[zx].className=getElsx[zx].className.replace('onx', 'offx');
    }
   this.className = 'onx';
   var maxx = this.getAttribute('titlex');
   document.getElementById(maxx).className = "showx";
 
   et_eC_Wrapper('UBV26m', '/index_tabbed_media.php', '/', 0, '', '', 0, 0, 0, 0, 0, 0,0);
   ReloadPixelImages('rc_vermi_000', '');
 
   }
  }
 }







showTime = 5000;
timer = 0;
 
current = 1;
button = 1;
pictures = 5;
width = 480;
 

$('#p1').animate({"left": "0px"}, 400, "swing");
$('#b1').css("backgroundPosition", "left bottom")
$('#b1 b').css("color","#fff");
$('#loading').css("display","none");
 
timer = setTimeout ("autoPlay()", showTime);
 

$("#next").click(function() {
	et_eC_Wrapper( 'UBV26m', '/index_slide.php', '/', 0, '', '', 0, 0, 0, 0, 0, 0, 0);
	ReloadPixelImages('rc_vermi_000', '');
  button = current;
	current++
 if (current == (pictures+1) ) {current = 1}
animateLeft(current,button)
});
 
$("#previous").click(function() {
	et_eC_Wrapper( 'UBV26m', '/index_slide.php', '/', 0, '', '', 0, 0, 0, 0, 0, 0, 0);
	ReloadPixelImages('rc_vermi_000', '');
  button = current;
  current--
 if (current == 0 ) {current = pictures}
animateRight(current,button)
});
 
$("#buttons div").click(function() {
	et_eC_Wrapper( 'UBV26m', '/index_slide.php', '/', 0, '', '', 0, 0, 0, 0, 0, 0, 0);
	ReloadPixelImages('rc_vermi_000', '');
 button=current;
 clickButton = $(this).attr('id');
 current = parseInt(clickButton.slice(1));
 if (current > button) {animateLeft(current,button)}
 if (current < button) {animateRight(current,button)}
});
 
$("#buttons div b").mouseover(function() {
 if (($(this).css("color")) == "#16a" || ($(this).css("color")) == "rgb(17, 102, 170)") {$(this).css("color","#000");}
});
 
$("#buttons div b").mouseout(function() {
 if (($(this).css("color")) == "#000" || ($(this).css("color")) == "rgb(0, 0, 0)") {$(this).css("color","#16a");}
});
 

function animateRight(current,button) {
 $('#p'+current).css("left",-width+"px");
 $('#p'+current).animate({"left": "0px"}, 400, "swing");
 $('#p'+button).animate({"left": width+"px"}, 400, "swing");
 setbutton()
}
 
document.getElementById('wrap').onmouseover = function () {clearTimeout(timer);}
document.getElementById('wrap').onmouseout = function () {timer = setTimeout ("autoPlay()", showTime);}
 
}
 
function autoPlay () {
  button = current;
  current++
 if (current == (pictures+1) ) {current = 1}
animateLeft(current,button)
 
timer = setTimeout ("autoPlay()", showTime);
}
 
function animateLeft(current,button) {
 $('#p'+current).css("left",width +"px");
 $('#p'+current).animate({"left": "0px"}, 400, "swing");
 $('#p'+button).animate({"left": -width+"px"}, 400, "swing");
 setbutton()
}
 
function setbutton () {
 $('#b'+button).css("backgroundPosition", "left top")
 $('#b'+button+' b').css("color","#16a");
 $('#b'+current).css("backgroundPosition", "left bottom")
 $('#b'+current+' b').css("color","#fff");
}