/* ProNet V 2.9.3 built 20090709 */
/*! requires prototype library !*/

/* v293:
 * - toggleClassnames - Schriftstilwechsel für Tabelleneffekte
 * - executeClickAction - Macht Produktlink, Sprachauswahl und Waehrungsauswahl kombinierbar
 * - Produktlink, Sprachauswahl u. Waehrungsauswahl geändert
 */ 






var click_params;
click_params="";

function click (e) {
  if (!e)
    e = window.event;
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
    //if (window.opera)
    //  window.alert("Sorry: Diese Funktion ist deaktiviert.");
    return false;
  }
}

function toggleClassnames(elem,old_classname,new_classname)
{	    
	var d = Element.descendants(elem);	
	d.each(function(item) {		
		if(item.hasClassName(old_classname)) {			
			item.removeClassName(old_classname);
			item.addClassName(new_classname);		
		} else {					
			if(item.hasClassName('L'+old_classname+old_classname+old_classname)) {
	            item.removeClassName('L'+old_classname+old_classname+old_classname);	            
	            item.addClassName('L'+new_classname+new_classname+new_classname);	         
			}
		}			
	});
}
function executeClickAction()
{    
  if(click_params != "") {
	  if (document.getElementById)   {
		document.location.href = "index.php"+click_params;
	  } else {
		document.location.href = "index.php"+click_params;
	  }
	}
}
/* Neuer Frame-Mover */
var frames = new Array();
var resizes = new Array();

function moveSingleFrame(frameentry) {			
	if(frameentry.get('y')>=0) {				
		if ($('L'+frameentry.get('p')).style.visibility!='hidden') {
			if ($('L'+frameentry.get('p')).style.height=="") {
				distance = parseInt($('L'+frameentry.get('p')).style.top) + parseInt($('L'+frameentry.get('p')).offsetHeight) + parseInt(frameentry.get('y'));
			} else {
				distance = parseInt($('L'+frameentry.get('p')).style.top) + parseInt($('L'+frameentry.get('p')).offsetHeight) + parseInt(frameentry.get('y'));
				//distance = parseInt($('L'+frameentry.get('p')).style.top) + parseInt($('L'+frameentry.get('p')).style.height) + parseInt(frameentry.get('y'));
			}				
			$('L'+frameentry.get('c')).style.top = distance;		
		}
	} 
	if(frameentry.get('x'>=0)) {		
		$('L'+frameentry.get('c')).style.left = $('L'+frameentry.get('p')).style.left + $('L'+frameentry.get('p')).offsetWidth + frameentry.get('x');
	}		
}

function resizeSingleFrame(frameentry) {	
	ResizeIE5(frameentry.get('p'));
}

function addXMover(child,parent,x_distance) {
	frames[frames.size()] = new Hash({c: child, p: parent, x: x_distance});
}
function addYMover(child,parent,y_distance) {    
	frames[frames.size()] = new Hash({c: child, p: parent, y: y_distance});
}

function addResize(parent) {	
	resizes[resizes.size()] = new Hash({p: parent});
}

function resizeFrames() {    
	resizes.each(resizeSingleFrame);
	moveFrames();
}

function moveFrames() {		    
	frames.each(moveSingleFrame);	
}

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)
{
	addXMover(child,parent,distance);
}

function FrameMoveY(child,parent,distance)
{
	addYMover(child,parent,distance);
}

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)
{
	addResize(ID);
}

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;    
    var height;
    var width;    
    if (frame.style.visibility!="hidden") {
        parent=frame.offsetParent;               
        if ((parent.style.overflow!="scroll")&&(parent.style.overflow!="auto")) { // LW 20061107 (!)
        	height=parseInt(frame.offsetHeight);        	
        	if( parseInt(frame.style.height)>height) height=parseInt(frame.style.height);        	        	
            if (parseInt(parent.style.height)<parseInt(frame.style.top)+parseInt(height))   {            	
                parent.style.height=parseInt(frame.style.top)+parseInt(height)+5;                    
            } else {
            	
            }
            if (parseInt(parent.style.width)<parseInt(frame.style.left)+parseInt(frame.style.width))   {
                parent.style.width=parseInt(frame.style.left)+parseInt(frame.style.width)+5;    
            }
            if (parent.offsetParent) {
            	if(parent.offsetParent.id.substr(0,1)=='L') {
                	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"; 
    }
	moveFrames();
}

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"; 
    }
	moveFrames();
}

function Produktlink(productid)
{
  if(click_params=="") {click_params="?";} else {click_params+="&";} 
  click_params += "pid="+productid;
  window.location.href = click_params;
}

function Sprachauswahl(languageid,productid)
{
  if(click_params=="") {click_params="?";} else {click_params+="&";}
  if (document.getElementById) {
    click_params += "pid="+productid+"&languageid="+languageid;
  } else {
    click_params += "pid="+productid+"&languageid="+languageid; return;
  }
}

function Waehrungsauswahl(waehrungid,productid)
{
  if(click_params=="") {click_params="?";} else {click_params+="&";}
  if (document.getElementById) {
    click_params += "pid="+productid+"&currencyid="+waehrungid;
  } else {
    click_params += "pid="+productid+"&currencyid="+waehrungid; 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?pid="+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?pid="+productid+"&action="+action;
}

function windowconfirm(text,productid,action){
  Check = confirm(text);
  if(Check == true) top.location.href = "index.php?pid="+productid+"&action="+action;
}

function SetTitle(title)
{
    top.document.title=title;
}

function LoadFlash(url,width,height,options) {
        document.write('<EMBED src="'+url+'" width="'+width+'" height="'+height+'" pluginspage="http://www.macromedia.com/shockwave/download/ingex.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" '+options+'>');
}

function Merken()
{   
  if(click_params=="") {click_params="?";} else {click_params+="&";}
  if (document.getElementById) {
    click_params += "action=40";
  } else {
    click_params += "action=40"; return;
  }
}

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 GetStaticParameters(rahmen)
{
}
