function popupImage(file,width,height)
{
    var x = (screen.availWidth - width)/2;
    var y = (screen.availHeight - height)/2;
    
    var win = window.open("galerie.htm?file="+file,"popup","width="+width+",height="+height+",left="+x+",top="+y+"");
    win.focus();
}

var popup = null;

/**
 * Popup wieder schließen
 *
 * @access public
 */
function popdown()
{
  if (popup && !popup.closed)
  {
      popup.close();
  }
}

/**
 * Popup erstellen und öffnen
 *
 * @param obj
 * @param int w
 * @param int h
 * @access public
 */
function doPopup(url, width, height)
{
    var args = 'width=' + width + ',height=' + height + ',resizable, scrollbars=yes';
    //popdown();
    popup = window.open(url, '', args);
    //return (popup) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;

//überprüft ob SSL oder nicht
function chkFormAction(number)
{  
   if(number==0)
   {
       aktion = document.getElementById("bestellung").getAttribute("action");
       if(document.getElementById("setSSL").checked)
       {
           if(aktion.indexOf("http:")==-1)
           {
                document.getElementById("bestellung").setAttribute("action","https://www.laola-zentralkueche.de"+document.getElementById("bestellung").getAttribute("action"));      
           }
           else
           {
               document.getElementById("bestellung").setAttribute("action",aktion.replace(/http:/g,"https:")); 
           }
       }
       else
       {
           if(aktion.indexOf("https:")==-1)
           {
                document.getElementById("bestellung").setAttribute("action","http://www.laola-zentralkueche.de"+document.getElementById("bestellung").getAttribute("action")); 
           }
           else
           {
               document.getElementById("bestellung").setAttribute("action",aktion.replace(/https:/g,"http:")); 
           }
       }      
   } 
   if(number==1) 
   {
       aktion = document.getElementById("login1").getAttribute("action");
       if(document.getElementById("setSSL1").checked)
       {
           if(aktion.indexOf("http:")==-1)
           {
                document.getElementById("login1").setAttribute("action","https://www.laola-zentralkueche.de"+document.getElementById("login1").getAttribute("action"));      
           }
           else
           {
               document.getElementById("login1").setAttribute("action",aktion.replace(/http:/g,"https:")); 
           }
       }
       else
       {
           if(aktion.indexOf("https:")==-1)
           {
                document.getElementById("login1").setAttribute("action","http://www.laola-zentralkueche.de"+document.getElementById("login1").getAttribute("action")); 
           }
           else
           {
               document.getElementById("login1").setAttribute("action",aktion.replace(/https:/g,"http:")); 
           }
       }      
   }
   
}

function checkCustomerTyp(obj)
{
    if(obj.value == 1) {
        //Firmenkunde
        document.getElementById('kontonr_required').innerHTML = '';
        document.getElementById('kontoinhaber_required').innerHTML = '';
        document.getElementById('blz_required').innerHTML = '';
        document.getElementById('bank_required').innerHTML = '';
    } else if (obj.value == 2) {
        //Selbstzahler
        document.getElementById('kontonr_required').innerHTML = '*';
        document.getElementById('kontoinhaber_required').innerHTML = '*';
        document.getElementById('blz_required').innerHTML = '*';
        document.getElementById('bank_required').innerHTML = '*';
    }
}
