function ShopBlockProduktIndex ( cBlockId ) {
   // --- Toogle
   oObj    = document.getElementById("PICONTENT_" + cBlockId)
   oObjImg = document.getElementById("IMAGE_" + cBlockId)
   if ( oObj != null ) {
      if (oObj.style.display=='none') {
         oObj.style.display='block';
         oObjImg.src = "fileadmin/products/img/minusicon.gif";
      }
      else {
         oObj.style.display='none';
         oObjImg.src = "fileadmin/products/img/plusicon.gif";
      }
   }
}

function GotoUrl( cUrl ) {
  //document.location.href="http://wera.co-de.de/" + cUrl;
  document.location.href="http://" + window.location.hostname+ "/" + cUrl;
}

function NaviImageIn ( cID, cRolloverImage ) {

 oObj = document.getElementById(cID)
 if ( oObj != null ) {
       oObj.style.backgroundImage = "url(/fileadmin/products/img/category/60/" + cRolloverImage + ")";
 }
}
function NaviImageOut ( cID, cImage ) {

 oObj = document.getElementById(cID)
 if ( oObj != null ) {
       oObj.style.backgroundImage = "url(/fileadmin/products/img/category/60/" + cImage + ")";
 }
}
function ChangeImage ( cID, cImage ) {

 oObj = document.getElementById(cID)
 if ( oObj != null ) {
       oObj.src = "/fileadmin/products/img/" + cImage;
 }
}

function DisplayElement ( cID ) {
 oObj = document.getElementById(cID)
 if ( oObj != null ) {
    if (oObj.style.display=='none') {
       oObj.style.display='block';
    }
    else {
       oObj.style.display='none';
    }
 }
}

function HideElement ( cID ) {
}

// --- products_pulldown (START) ---------------
var cLastId = "";
var oLastObj = null;
function Popup1In(oObj, cPopupID) {
	
  // --- Delay setzen
  warten(250);
  
  // --- Letztes Menu schliessen
  if ( cLastId != '' ) {
     oPopUp = document.getElementById(cLastId);
     if ( oPopUp != null ) {
        oPopUp.style.display = "none";
     }
  }
  if ( oLastObj != null )
     oLastObj.className="passiv";
  
  // --- Aktuelle Menu merken und oeffnen
  cLastId = cPopupID;
  oLastObj = oObj
  oObj.className="aktiv";
  oPopUp = document.getElementById(cPopupID);
  if ( oPopUp != null ) {
     oPopUp.style.display = "block";
	 
	 // --- Bild anzeigen
     oDivImg = document.getElementById(cPopupID +'_popup2');
     if ( oDivImg != null ) {
        oDivImg.style.display = "block";
		
        //oDivImg.style.backgroundImage = "url(/fileadmin/products/img/trans.gif)";
		
        oDivImg.style.backgroundImage = "url(upfiles/" + oObj.id + ")";
     }
  }
 
 return false;
}

function Popup2In(oObj, cPopupID) {

   oDivImg = document.getElementById(cPopupID + '_popup2');
   if ( oDivImg != null ){
      oDivImg.style.backgroundImage = "url(upfiles/" + oObj.id + ")";
   }
   oObj.className="aktiv";
 
 return false;
}
function Popup2Out(oObj, cPopupID) {

   oDivImg = document.getElementById(cPopupID + '_popup2');
   //if ( oDivImg != null ){
   //   oDivImg.style.backgroundImage = "url(/fileadmin/products/img/trans.gif)";
   //}
   oObj.className="passiv";
 
 return false;
}
function warten(prmSec)
  {
  //prmSec *= 1000;
  var eDate = null;
  var eMsec = 0;
  var sDate = new Date();
  var sMsec = sDate.getTime();

  do {
      eDate = new Date();
      eMsec = eDate.getTime();

  } while ((eMsec-sMsec)<prmSec);
}
// --- products_pulldown (ENDE) ---------------

function printIframe( cId ) {
	if ( parent!=null && cId!=null && parent.frames[cId]!=null ) {
		parent.frames[cId].focus(); 
		parent.frames[cId].print(); 
	} else {
		alert('Your browser does not support the required objects and functions.');
	}
}

// --- category_overview (START) ---------------
function transferValue( cIdSrc, cIdDest ) {

   // --- Value holen
   cHtmlSnippet = _getTitle ( cIdSrc );

   // --- Value ersetzen
   oObj = document.getElementById( cIdDest );
   if ( oObj != null ) {
   	   oObj.title =cHtmlSnippet;
   	   oObj.alt =cHtmlSnippet;
   }
}
function _getTitle ( cIdSrc ) {
   // --- Value holen
   cHtmlSnippet = "";
   oObj = document.getElementById( cIdSrc );
   if ( oObj != null )
      cHtmlSnippet = oObj.title;
   return cHtmlSnippet;
}
function ReloadIframe( nAktId ) {

   // --- Iframe holen und laden
   cUrl = _getTitle('PI_' + nAktId);
   oObj = document.getElementById( 'popup_iframe' );
   if ( oObj != null )
	oObj.src = '/fileadmin/products/snippet/' + cUrl;
   	
   // --- Hole Gesamtanzahl an Bloecke
   oObj = document.getElementById( 'PI_gesamt' );
   if ( oObj != null )
      nLastId = oObj.title - 1;
      
   // --- Pfeil links holen und setzen
   nPrevId = nAktId - 1;
   if ( nPrevId <= 0 ) nPrevId = nLastId;
   oObj = document.getElementById( 'PI_' + nPrevId );
   if ( oObj != null )
      cHtmlSnippet = oObj.title;
   oObj = document.getElementById( 'popup_prev' );
   if ( oObj != null ){
   	   oObj.href="javascript:ReloadIframe(" + nPrevId + ")";
   }
   
   // --- Pfeil rechts holen und setzen
   nNextId = nAktId + 1;
   if ( nNextId > nLastId ) nNextId = 1;
   oObj = document.getElementById( 'PI_' + nNextId );
   if ( oObj != null )
      cHtmlSnippet = oObj.title;
   oObj = document.getElementById( 'popup_next' );
   if ( oObj != null ){
   	   oObj.href="javascript:ReloadIframe(" + nNextId + ")";
   }
   
   // --- Artikel von / bis anpassen
   oObj = document.getElementById( 'art_von' );
   if ( oObj != null ) {
   	   oObj.innerHTML =nAktId;
   	   oObj.text=nAktId;
   }
   
   // --- Nummer Artikel-bis
   oObj = document.getElementById( 'art_bis' );
   if ( oObj != null ) {
   	   oObj.innerHTML =nLastId;
   	}

   // --- Ausgabe der Serie   
   oObj = document.getElementById( 'serie' );
   if ( oObj != null ) {
      cText = oObj.title;
      oObj = document.getElementById( 'serie_output' );
      if ( oObj != null ) {
   	      oObj.innerHTML = cText;
   	   }
   	}
}

// --- Detailseite fuer Produktindex
function ShowProductIndexPopup( nAktId, nLastId ) {
   
   // --- Iframe fuellen
   ReloadIframe( nAktId, nLastId );
   
   // --- Popup anzeigen
   oObj = document.getElementById('popup_product_index');
   if ( oObj != null ) {
      oObj.style.display="block";
      if (navigator.appName.indexOf('Netscape') != -1) { 
	FensterBreite = self.innerWidth;
	oObj.style.left = ((FensterBreite - 630) / 2) + "px";
	oObj.style.top = window.pageYOffset + "px";
      } else {
      	if ( navigator.appName.indexOf('Microsoft') != -1 ) {
      	   FensterBreite = document.body.clientWidth;
   	   oObj.style.left = (FensterBreite - 630) / 2;
   	   var toppos = (mousey >= 300) ? mousey - 300 : 0;
	   if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
		toppos = document.documentElement.scrollTop;
	   } else if (typeof document.body != 'undefined') {
   		toppos = document.body.scrollTop;
	   }
   	   oObj.style.top = toppos;
        }
      }
   }
      
   // --- Hintergrund ausblenden
   oObj = document.getElementById('page');
   if ( oObj != null ){
   	  oObj.className="opacity_on";
   }

}

function ShowProductPopup( nAktId ) {
	
   // --- Haendlersuche
   txtdetailhaendlerlink  = _getTitle ( 'txt_detail_haendlerlink' );
   oObj = document.getElementById( 'popup_detail_haendlersuche' );
   oObj.onclick = new Function("window.location.href='" + txtdetailhaendlerlink +"';");

   // --- Restliche Localisierungen aus Hybris uebernehmen
   transferValue( "txt_detail_haendlersuche", "hs" );
   transferValue( "txt_detail_drucken", "print" );
   transferValue( "txt_detail_weiterleiten", "send" );
   transferValue( "txt_detail_close", "close" );
  
   
   // --- Iframe fuellen
   ReloadIframe( nAktId );
   
   
   // --- Popup anzeigen
   oObj = document.getElementById('popup_product');
   if ( oObj != null ) {
      oObj.style.display="block";
      if (navigator.appName.indexOf('Netscape') != -1) { 
	FensterBreite = self.innerWidth;
	oObj.style.left = ((FensterBreite - 630) / 2) + "px";
	oObj.style.top = window.pageYOffset + "px";
      } else {
      	if ( navigator.appName.indexOf('Microsoft') != -1 ) {
      	   FensterBreite = document.body.clientWidth;
   	   oObj.style.left = (FensterBreite - 630) / 2;
   	   var toppos = (mousey >= 300) ? mousey - 300 : 0;
	   if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
		toppos = document.documentElement.scrollTop;
	   } else if (typeof document.body != 'undefined') {
   		toppos = document.body.scrollTop;
	   }
   	   oObj.style.top = toppos;
        }
      }
   }
      
   // --- Hintergrund ausblender
   oObj = document.getElementById('page');
   if ( oObj != null ){
   	  oObj.className="opacity_on";
   }
}

function HideProductPopup(elem) {
   oObj = document.getElementById(elem);
   if ( oObj != null ){
   	  oObj.style.display="none";
   }
   oObj = document.getElementById('page');
   if ( oObj != null ){
   	  oObj.className="opacity_off";
   }
}

var mousex;
var mousey;
function getXY(e) {
    if(!e) e = window.event;
    var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ? window.document.documentElement : window.document.body || null; 
    mousey = e.pageY ? e.pageY : e.clientY + body.scrollTop;
    mousex = e.pageX ? e.pageX : e.clientX + body.scrollLeft;
}

function init() {
    if (window.event) {
        if (document.captureEvents){
          document.captureEvents(Event.MOUSEMOVE);
        } else {
          window.captureEvents(Event.MOUSEMOVE);
        }
    }
  document.onmousemove = getXY;
}
init();


// --- category_overview (ENDE) ---------------


