
function mkVote(){
    showDisplay('voting');
    if (document.getElementById('voting').style.display == 'none'){
        hideMessageDiv('message');
    }
}

function hideMessageDiv(obj){
    if (document.getElementById(obj).style.display == 'block'){
        document.getElementById(obj).style.display = 'none';
    }
}

function storeBewertung(obj){
     if (ajaxReturn != ''){
         //showDisplay('saveText');
         //document.getElementById('saveText').innerHTML = ajaxReturn;
         document.getElementById('message').style.display = 'block';
         document.getElementById('message').innerHTML = ajaxReturn;
         setTimeout(function (){hideMessageDiv('message');hideMessageDiv('voting')}, 5000);
     } else {
        showDisplay(obj.id);
        showDisplay('waiter'); 
        setTimeout(function (){showStore(obj)},1000);
     }
     
}
function showStore(){
    setTimeout(function (){hideWaiter()},1000);
}

function hideWaiter(){
    showDisplay('waiter');
    showDisplay('votingText');
    showDisplay('voting');
    document.getElementById('votingDiv').innerHTML = 'Vielen Dank für das Voting!<br>Falls Sie einen Kommentar dazu verfassen möchten, klicken Sie <a href="'+ location.href+'?addC=;&js=1#addC"><b>hier</b></a>';
    showDisplay('votingDiv');
    //window.location.href = location.href+'?addC=1&js=1#addC';
}


function zoomInit(e){
   elem = document.getElementById('detailPic');
   var curleft=0, curtop=0;

    if (elem.offsetParent) {
        curleft = elem.offsetLeft;
        curtop  = elem.offsetTop;

        while (elem = elem.offsetParent) {
            curleft += elem.offsetLeft;
            curtop  += elem.offsetTop;
        }
    }
   
    zoom.x = e.pageX - curleft;
    zoom.y = e.pageY - curtop;
    zoom.startZoom();
}


{function Zoom(w,h,n,b){
    this.zoomWidth  = w;
    this.zoomHeight = h;
    this.normSize = n;
    this.bigSize  = b;  
}



Zoom.prototype.startZoom = function(){

    this.container = $('detailPicZoom');
    $('zoomer').style.width = this.zoomWidth - 20 + 'px';
    faktor = (this.bigSize / this.normSize);
    
    this.newX = -Math.round(this.x * faktor) + ($('zoomer').offsetWidth/2 );
    this.newY = -Math.round(this.y * faktor) + ($('zoomer').offsetHeight/2);
    $('zoomer').style.display = 'block';
    $('zoomer').style.width  = this.zoomWidth + 'px';
    $('zoomer').style.height = this.zoomHeight + 'px';
    $('zoomDetail').style.margin = ''+ this.newY +'px 0px 0px '+ this.newX + 'px'; 
    this.counter = this.container.offsetWidth;
    $('detailPic').onmouseout = function (){
        var instanz = new Zoom();
        instanz.counter = 100;
        instanz.timeouts = setInterval(function (){instanz.closeCont()},10); 
    }
 
    
}
Zoom.prototype.closeCont = function (){

    if (this.counter > 0){
        this.counter = this.counter - 5;
        $('zoomer').style.width  = this.counter + 'px';
        $('zoomer').style.height = this.counter + 'px';
    }
    if (this.counter < 1){
        clearInterval(this.timeouts);
        $('zoomer').style.display = 'none';  
    }
    document.getElementById('detailPic').onmousemove= setZoom; 
}
}
function CheckSelects(){
   formreturn = true;
   formObj = document.form1;
   len  = formObj.elements.length;
   for(i=0;i<len;i++){
       feld = formObj.elements[i];
       if(feld.name.indexOf("OPT_") > -1){
          if(feld.selectedIndex == 0){
             formreturn = false;
             feld.setAttribute('class','shop red');
             document.getElementById('optionsAlert').style.display = 'block';
          }
       }
   }

   
   return formreturn;
}


 function show_me(a)
 {
 alert(a);
 }
 
         function checkImg(){
          if(NS4 || IE4){
             w = window.open('<?=$cfg[url]?>Tools/Shop/inc/bigImages.php?bild='+document.all.detailPic.src,'fenster','width=400,height=300');
          }else{
           urls = document.getElementById('detailPic').src;
           urls = urls.split("/");
           urls.reverse();
           feld1 =  urls[0];
           feld = feld1.replace(".","");
           obj = document.getElementById(feld);

           if(obj){
              val = obj.value;
              values = val.split(",");
              grossbild('shop/'+feld1,'','',values[0],values[1]);
           }
           }

         }
         function findField(val){
           
            if (document.form1.OPT_Farbe){
                len = document.form1.OPT_Farbe.options.length;
                for(s=0 ; s < len ; s++){
                    if(document.form1.OPT_Farbe.options[s].text == val){
                       document.form1.OPT_Farbe.selectedIndex= s;
                    }
                }
            }
            
         }
 

       function setAndHideDivs(showedDivName){
           containerDiv = document.getElementById('infoContainer');
           childDivs = containerDiv.getElementsByTagName('DIV');
           for(i=0;i < childDivs.length;i++){
              classer = childDivs[i].getAttribute('class');
              if (childDivs[i].getAttribute('id') != showedDivName && classer == 'inBox'){
                  childDivs[i].style.display = 'none';
                  divID = childDivs[i].getAttribute('id');
                  menuID = 'menu'+divID;
                  document.getElementById(menuID).setAttribute('class','detailMenu');
              }
              
              
           } 
           document.getElementById(showedDivName).style.display = 'block';
           menuID = 'menu'+showedDivName;
           document.getElementById(menuID).setAttribute('class','detailMenuActive');
           document.getElementById(showedDivName).childNodes[1].style.display = 'none';
            
       }

       

