var opac = 0;

function fadein( ){
    opac = opac+5;
    
    document.getElementById( 'anzeigebild' ).style.padding = '2px';
    image = document.getElementById( 'anzeigebild' );
    image.src = bild.src;

    image.style.filter="alpha(opacity:"+opac+")";
    image.style.opacity=opac/100;
    image.style.KhtmlOpacity=opac/100;
    image.style.MozOpacity=opac/100;
    
    if( opac < 100 ){
        fader = window.setTimeout( fadein , 10 );
    }
}






function centerImage( hoehe,breite){
    area = document.getElementById( 'imagearea' );
    
    if( window.innerWidth ){
        x_pos = Math.ceil((window.innerWidth - breite)/2 + window.pageXOffset) + "px";
        y_pos = Math.ceil((window.innerHeight - hoehe)/2 + window.pageYOffset) + "px";
    }else{
        var IE = (document.compatMode && document.compatMode == "CSS1Compat") ? document.documentElement : document.body || null;
        x_pos = Math.ceil((IE.offsetWidth - breite)/2 + IE.scrollLeft) + "px";
        y_pos = Math.ceil((IE.offsetHeight - hoehe)/2 + IE.scrollTop) + "px";
    }
    area.style.left = x_pos;
    area.style.top = y_pos;
}

function hidephoto(){
    document.getElementById( 'anzeigebild' ).src = '/img/loading.gif';
    document.getElementById( 'imagearea' ).style.display = 'none';
    window.clearInterval( fader );
    opac = 0;
}

function showphoto( photosrc ){
    var opac = 0;


    function show( ){
        var imagearea = document.getElementById( 'imagearea' );
        var image = document.getElementById( 'anzeigebild' );

        imagearea.style.height = (bild.height+5)+'px';
        imagearea.style.width = (bild.width+5)+'px';
        image.style.paddingTop = Math.ceil( (bild.height-29)/2 )+'px';
        image.style.paddingBottom = Math.ceil( (bild.height-29)/2 )+'px';
        image.style.paddingLeft = Math.ceil( (bild.width-29)/2 )+'px';
        image.style.paddingRight = Math.ceil( (bild.width-29)/2 )+'px';

        centerImage( bild.height , bild.width );
        
        imagearea.style.display = 'block';
        
        
        window.setTimeout("fadein();" , 1000 );
    }
    
    document.getElementById( 'anzeigebild' ).src = '/img/loading.gif';
    document.getElementById( 'imagearea' ).style.display = 'none';
    
    bild = new Image();
    bild.onload = show;
    bild.src = photosrc;
    
}
function showIt( photosrc ){
    showphoto( photosrc );
    return false;
}


