/* ProNet V 2.7.2 built 20030605 */
/* now supports multiple frame relations */

/* FrameMove-Routinen */

function GetBrowserID()
{
    var browser;
    
    browser="2"; // default
    if (navigator.appName=="Netscape") {
        if (navigator.appVersion.substr(0,3)=="4.7") {
            browser="1";
        }
        if (navigator.appVersion.substr(0,1)=="5") {
            browser="3";
        }
    } 
    return browser;
}

function FrameMoveX(child,parent,distance)
{
    switch (GetBrowserID()) {
        case "1":
            if (parent.hauptframe) {
                d=parent.hauptframe.document;
            } else {
                d=document;
            }
            
            doc=GetFrameByID(parent,d);
            xpos=doc.layers["L"+parent].left+doc.layers["L"+parent].clip.width+distance;

            if (doc.layers["L"+child].left<xpos) {
                doc.layers["L"+child].left=xpos;
                LayerResizeNS4(doc.layers["L"+child]);
            }
            break;
        case "3":
            childframe=document.getElementById("L"+child);
            parentframe=document.getElementById("L"+parent);
            if (parentframe.style.minWidth=="") {
                xpos=parseInt(parentframe.style.left)+parseInt(parentframe.style.width)+distance;
            } else {
                xpos=parseInt(parentframe.style.left)+parseInt(parentframe.style.minWidth)+distance;
            }
            if (parseInt(childframe.style.left)<xpos) {
                childframe.style.left=xpos;
            }
            break;
        default:
            childframe=document.getElementById("L"+child);
            parentframe=document.getElementById("L"+parent);
            xpos=parseInt(parentframe.style.left)+parseInt(parentframe.offsetWidth)+distance;
            if (parseInt(childframe.style.left)<xpos) {
                childframe.style.left=xpos;
            }
            break;
    }
}

function FrameMoveY(child,parent,distance)
{
    childframe=document.getElementById("L"+child);
    parentframe=document.getElementById("L"+parent);
	
	switch (GetBrowserID()) {
        case "1":
            if (parent.hauptframe) {
                d=parent.hauptframe.document;
            } else {
                d=document;
            }
            
            doc=GetFrameByID(parent,d);
            ypos=doc.layers["L"+parent].top+doc.layers["L"+parent].clip.height+distance;

            if (doc.layers["L"+child].top<ypos) {
                doc.layers["L"+child].top=ypos;
                LayerResizeNS4(doc.layers["L"+child]);
            }
            break;
        case "3":
            if (parentframe.style.height=="") {
                ypos=(parentframe.offsetTop)+(parentframe.offsetHeight)+distance;
            } else {
                ypos=parseInt(parentframe.style.top)+parseInt(parentframe.style.height)+distance;
            }
            if (parseInt(childframe.style.top)<ypos) {
                childframe.style.top=ypos;
            }
            break;
        default:
            ypos=parseInt(parentframe.offsetTop)+parseInt(parentframe.offsetHeight)+distance;
            if (parseInt(childframe.style.top)<ypos) {
                childframe.style.top=ypos;
            }
            break;
    }
}

function SetVisibility(frame)
{
    switch (GetBrowserID()) {
        case "1":
            var d;
            var doc;
            if (parent.hauptframe) {
                d=parent.hauptframe.document;
            } else {
                d=document;
            }
            doc=GetFrameByID(frame,d);
            doc.layers["L"+frame].visibility="show";
            break;
        default:
            document.getElementById("L"+frame).style.visibility="visible";
            break;
    }
}

function GetFrameByID(id,d)
{
    var i;
    for (i=0;i<=d.layers.length-1;i++) {
        if(d.layers[i].id=="L"+id) {
            return d;
        } else {
            doc=GetFrameByID(id,d.layers[i].document);
        }
    }
    return doc;
}

/* Resize-Routinen */

function Resize(ID)
{
    switch (GetBrowserID()) {
        case "1":
            break;
        case "3":
            ResizeIE5(ID);
            break;
        default:
            ResizeIE5(ID);
            break;
    }
}

function LayerResizeNS4(layer) 
{
    // resizing of the parent layer
    var width;
    var height;
    var parent;    
    
    parent=layer.parentLayer;

    if (parent.clip) {
        width=layer.left+layer.clip.width;
        height=layer.top+layer.clip.height;
        if (width<parent.clip.width) width=parent.clip.width;
        if (height<parent.clip.height) height=parent.clip.height;
               
        parent.resizeTo(width,height);
        
    }
    if (parent.parentLayer) {
        LayerResizeNS4(parent);
    }
}

function ResizeIE5(ID)
{

    frame=document.getElementById('L'+ID).firstChild;
    if (frame) {
        do {
            if (frame.id) {
                if (frame.id.substr(0,1)=='L') {
                    LayerResizeIE5(frame);
                }
            }
            frame=frame.nextSibling;
        }
        while (frame);
    }
    return;
}

function LayerResizeIE5(frame) 
{
    var parent;
    if (frame.style.visibility!="hidden") {
        parent=frame.offsetParent;
        if (parseInt(parent.offsetHeight)<parseInt(frame.style.top)+parseInt(frame.offsetHeight))   {
            parent.style.height=parseInt(frame.style.top)+parseInt(frame.offsetHeight)+5;    
        }
        if (parseInt(parent.offsetWidth)<parseInt(frame.style.left)+parseInt(frame.offsetWidth))   {
            parent.style.width=parseInt(frame.style.left)+parseInt(frame.offsetWidth)+5;    
        }
        if (parent.offsetParent) {
            LayerResizeIE5(parent);
        }
    }
}


/* Action-Routinen */

function PopOn(elementid)
{
    if (document.getElementById) {
        if (document.getElementById("L"+elementid)) {
            document.getElementById("L"+elementid).style.visibility='visible';
            document.getElementById("L"+elementid).style.zIndex='10000';
        }
    } else {
        if (parent.hauptframe.document) {
            d=parent.hauptframe.document;
        } else {
            d=document;
        }
        doc=GetFrameByID(elementid,d);
        doc.layers["L"+elementid].visibility="show"; 
    }
}

function PopOff(elementid)
{
    if (document.getElementById) {
        if (document.getElementById("L"+elementid)) {
            document.getElementById("L"+elementid).style.visibility='hidden';
        }
    } else {
        if (parent.hauptframe.document) {
            d=parent.hauptframe.document;
        } else {
            d=document;
        }
        doc=GetFrameByID(elementid,d);
        doc.layers["L"+elementid].visibility="hide"; 
    }
}

function Produktlink(productid)
{
  window.location.href = "index.php?productid="+productid;  
}

function Merken()
{   
    if( window.location.href.indexOf("?")==-1) {
        window.location.href = window.location.href+"?action=40";
    } else {
        window.location.href = window.location.href+"&action=40";
    } 
}

function MerkzettelLeeren()
{
    if( window.location.href.indexOf("?")==-1) {
        window.location.href = window.location.href+"?action=41";

    } else {
        window.location.href = window.location.href+"&action=41";
    }
}

function MerkzettelSenden()
{
    if( window.location.href.indexOf("?")==-1) {
        window.location.href = window.location.href+"?action=42";

    } else {
        window.location.href = window.location.href+"&action=42";
    }
}

function Sprachauswahl(languageid,productid)
{
  if (document.getElementById) {
    window.location.href = "index.php?productid="+productid+"&languageid="+languageid;
  } else {
    window.location.href = "index.php?productid="+productid+"&languageid="+languageid; return;
  }
}

function Externerlink(link)
{
  window.location.href = link;
}

function Drucken()
{
  window.print(); return;
}

function Download(file)
{
  window.location.href = file;
}

function Zurueck()
{
  history.back(); return;
}

function OpenWin(productid, width, height) {
  window.open("index.php?productid="+productid,"Info","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+width+",height="+height+"");
}

function OpenWinLink(link) {
  window.open(link,"Info","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=580,height=560");
}

function OpenWinMax(productid, width, height) {
  width=screen.availWidth-12;
  height=screen.availHeight-30;
  window.open("index.php?productid="+productid,"Vorschau","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height+",left=0,top=0");
}

function ProduktlinkWarenkorb(productid, action) {
  window.location.href = "index.php?productid="+productid+"&action="+action;
}

function windowconfirm(text,productid,action){
  Check = confirm(text);
  if(Check == true) top.location.href = "index.php?productid="+productid+"&action="+action;
}

function SetTitle(title)
{
    top.document.title=title;
}


