function bild_popup(bild, width, height){
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + (height+10) + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
	meinfenster = window.open('bildanzeigen.php?bild='+bild,"Erstfenster", windowFeatures);
	meinfenster.focus();
}

function bild_popup2(bilder){
    var left = parseInt((screen.availWidth/2) - (800/2));
    var top = parseInt((screen.availHeight/2) - (800/2));
    var windowFeatures = "width=800,height=700,status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

    var url="";
    var i=0;
    for (i=0; i<bilder.length; i++)
	{
		if (i>0) {
			url += "&";
		}
		url += "bild"+i+"="+bilder[i];
	}
	meinfenster = window.open('bildanzeigen2.php?'+url,"Zweitfenster", windowFeatures);
	meinfenster.focus();
}

function startGallery() {
    var myGallery = new gallery($('myGallery'), {
        timed: true,
        delay: 4000,
        showArrows: false,
        showCarousel: false,
        showInfopane: false,
        embedLinks: false

    });
}
window.addEvent('domready', startGallery);

var reentrant = 0, h = 0, b = 0;

function div_blende(id, breite, hoehe, aktion) {
    if( ! reentrant ) {
        reentrant = 1;
        var move = 0, element = document.getElementById(id);
        if( aktion == 'ein' ) {
            if(h < hoehe ){ h += 20; move++ }
            if(b < breite){ b += 20; move++ }
            element.style.visibility = 'visible';
        }
        else if( aktion == 'aus' ) {
            if(h > 0 ){ h -= 20; move++ }
            if(b > 0 ){ b -= 20; move++ }
            element.style.visibility = (b > 0 && h > 0) ? 'visible' : 'hidden';
        }
        if( move ) {
            element.style.height =  h + 'px';
            element.style.width  =  b + 'px';
            window.setTimeout( function(){ div_blende(id,hoehe,breite,aktion) }, 20 );
        }
        reentrant = 0;
    }
}
 var ausgeblendet = 1;
function marken() {
    if (ausgeblendet==1) {
        ausgeblendet = 0;
        div_blende('marken',180,10,'ein');
    }else {
        ausgeblendet = 1;
        div_blende('marken',180,10,'aus');
    }
}
var h = 0 , b = 0;
function pop(file)
{
	helpwindow = window.open(file,"pophelp","status=1,toolbar=1,scrollbars=1,width=800,height=600,resizable=yes");
	helpwindow.focus();
	return false;
}
function pop2(file)
{
	helpwindow = window.open(file,"pophelp","status=1,toolbar=1,scrollbars=1,width=1024,height=768,resizable=yes");
	helpwindow.focus();
	return false;
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
        
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

 var ausgeblendet = true;
 
    function shiftOpacity(id, millisec) {
        //if an element is invisible, make it visible, else make it invisible
        if(!ausgeblendet) {
        	opacity(id, 100, 0, millisec);
			document.getElementById(id).style.zIndex = -1;         
            ausgeblendet = true;                        
        } else {
            document.getElementById(id).style.zIndex = 10;
            opacity(id, 0, 100, millisec);
            ausgeblendet = false;
        }
    }
