var hwr4pictures	= new Array();
var hwr4pictures_current	= 0;
var hwr4_timeout_slide;

function hwr4gallery_slideshow() {
	document.getElementById("galplaybutton").style.visibility = "hidden";
	var slide_btn = document.getElementById("gallerie_slideshow");
	if(slide_btn.className == "hwr4icon_slide_play") {
		slide_btn.className = "hwr4icon_slide_pause";
		hwr4gallery_next();
    } else {
		slide_btn.className = "hwr4icon_slide_play";
		window.clearTimeout(hwr4_timeout_slide);
	}
}

function hwr4gallery_next() {
	if(hwr4pictures.length>hwr4pictures_current+1) {
		hwr4pictures_current+= 1;
		hwr4gallery_setImg();
		//return true;
	}else{
		hwr4pictures_current= 0;
		hwr4gallery_setImg();
		//return true;
	}
	var slide_btn = document.getElementById("gallerie_slideshow");
	if(slide_btn.className == "hwr4icon_slide_pause") {
		hwr4_timeout_slide = window.setTimeout(hwr4gallery_next, 2000);
	}	
	return true;
}

function hwr4gallery_prev() {
	if(0<hwr4pictures_current) {
		hwr4pictures_current-= 1;
		hwr4gallery_setImg();
		return true;
	}else{
		hwr4pictures_current= hwr4pictures.length-1;
		hwr4gallery_setImg();
		return true;
	}
}

function hwr4gallery_setImg() {
	document.getElementById('hwr4gallery_mainpic').src	= hwr4pictures[hwr4pictures_current][2];
	
		var img_anim	= new YAHOO.util.Anim("hwr4gallery_mainpic", { width: { to: hwr4pictures[hwr4pictures_current][3]}, height: { to: hwr4pictures[hwr4pictures_current][4]} }, 0.2, YAHOO.util.Easing.easeOut);
		img_anim.animate();
		
	document.getElementById('hwr4gallery_name_top').innerHTML	= 'Bild '+(hwr4pictures_current+1)+' / '+hwr4pictures.length;
	document.getElementById('hwr4gallery_subtitle').innerHTML	= hwr4pictures[hwr4pictures_current][1];
	document.getElementById('hwr4gallery_subtitle').style.visibility	= (""==hwr4pictures[hwr4pictures_current][1].replace(" ", "")) ? 'hidden' : 'visible';
	
	return true;
}
/*
function hwr4gallery_slideshow() {
	if(hwr4gallery_next()) window.setTimeout('hwr4gallery_slideshow()', 3000);
}
*/