function gallerie_spec (imageName,imageWidth,imageHeight,number,table_id) {
         if (document.getElementById("gal_spec_box")) {
             var Knoten = document.getElementById("gal_spec_box");
             verschwunden = document.getElementsByTagName("body")[0].removeChild(Knoten);
             }
         var gal_spec_div = document.createElement("div");
         //var scrollings = wo_samma();
         gal_spec_div.id = "gal_spec_box";
         var innere_masse = welche_masse();
         var thumping = "yes";
         if (imageWidth>0.95*innere_masse[0]) {
             var new_imageWidth = Math.round(0.90*innere_masse[0]);
             var faktor_x = new_imageWidth/imageWidth;
             imageHeight = Math.round(faktor_x*imageHeight);
             imageWidth =  new_imageWidth;
             thumping = "no";
             }

         if (imageHeight>0.95*innere_masse[1]) {
             var new_imageHeight = Math.round(0.90*innere_masse[1]);
             var faktor_y = new_imageHeight/imageHeight;
             imageWidth = Math.round(faktor_y*imageWidth);
             imageHeight =  new_imageHeight;
             thumping = "no";
             }
         var posit_x = (Math.round(innere_masse[0]/2)) - (Math.round(imageWidth/2));
         if (posit_x<0) {posit_x = 0;}
         var posit_y = (Math.round(innere_masse[1]/2)) - (Math.round(imageHeight/2));
         if (posit_y<0) {posit_y = 0;}
         var BlackBox = document.getElementById("backer");
         BlackBox.style.display = "block";
         var Ausgabebereich = document.getElementsByTagName("body")[0];
         Ausgabebereich.appendChild(gal_spec_div);
         var Ansprechpartner = document.getElementById("gal_spec_box");
         Ansprechpartner.style.width = imageWidth+"px";
         Ansprechpartner.style.height = imageHeight+"px";
         Ansprechpartner.style.left =  posit_x + "px";
         Ansprechpartner.style.top =  posit_y + "px";
         var gal_spec_inner_div = document.createElement("div");
         gal_spec_inner_div.id = "gal_spec_inner_box";
         Ansprechpartner.appendChild(gal_spec_inner_div);
         var Ansprechpartner2 = document.getElementById("gal_spec_inner_box");
         if (thumping=="yes") {
             Ansprechpartner2.style.backgroundImage = "url("+imageName+")";
             }
         else {
             var url_x = imageName.replace(/\//g, ":");
             var thumping_url = "/gal_img/thumper.php?id=";
             thumping_url = thumping_url + url_x;
             thumping_url = thumping_url + "&w=" + imageWidth;
             thumping_url = thumping_url + "&h=" + imageHeight;
             var str_pos = imageName.length-3;
             var typ = imageName.substring(str_pos);
             thumping_url = thumping_url + "&t=" + typ;
             Ansprechpartner2.style.backgroundImage = "url(" + thumping_url + ")";
             }
         var gal_table_id = "gal_table_" + table_id;
         var Anzahl_Bilder = document.getElementById(gal_table_id).getElementsByTagName("a").length;
         number_x = parseInt(number);
         if (number!=0) {
                         var div_links = document.createElement("div");
                         div_links.id = "gal_pfeil_links";
                         var button_links = document.createElement("a");
                         var number_links = number_x-1;
                         var link_links = document.getElementById(gal_table_id).getElementsByTagName("a")[number_links].href;
                         button_links.href = link_links;
                         div_links.appendChild(button_links);
                         Ansprechpartner2.appendChild(div_links);
                         }
         var max_number = Anzahl_Bilder-1;
         if (number!=max_number) {
                         var div_rechts = document.createElement("div");
                         div_rechts.id = "gal_pfeil_rechts";
                         var button_rechts = document.createElement("a");
                         var number_rechts = number_x+1;
                         var link_rechts = document.getElementById(gal_table_id).getElementsByTagName("a")[number_rechts].href;
                         button_rechts.href = link_rechts;
                         div_rechts.appendChild(button_rechts);
                         Ansprechpartner2.appendChild(div_rechts);
                         }
}

function gallerie_spec_close () {
         if (document.getElementById("gal_spec_box")) {
             var Knoten = document.getElementById("gal_spec_box");
             verschwunden = document.getElementsByTagName("body")[0].removeChild(Knoten);
             var BlackBox = document.getElementById("backer");
             BlackBox.style.display = "none";
             }
}
function welche_masse() {
     var myWidth = 0, myHeight = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
         myWidth = window.innerWidth;
         myHeight = window.innerHeight;
     } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
         myWidth = document.documentElement.clientWidth;
         myHeight = document.documentElement.clientHeight;
     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
         myWidth = document.body.clientWidth;
         myHeight = document.body.clientHeight;
     }
     return [ myWidth, myHeight ];
 }

function wo_samma() {
                var x,y;
                if (self.pageYOffset)
                {
                        x = 0;
                        y = 0;
                }
                else if (document.documentElement && document.documentElement.scrollTop)
                {
                        x = document.documentElement.scrollLeft;
                        y = document.documentElement.scrollTop;
                }
                else if (document.body)
                {
                        x = 0;
                        y = 0;
                }
                var xy = new Array(x,y);
                return xy;
}


function gal_img_over(id)

{

document.getElementById(id).style.border = "2px solid #c0c0c0";

}



function gal_img_out(id)

{

document.getElementById(id).style.border = "2px solid #ffffff";


}
