var actual_nav_id=0;
var a_nav_ids={1: ['magazin', 'archive'],
               2: ['news', 'tipps'],
               3: ['shop', 'shop_detail', 'shop_basket', 'shop_cash', 'shop_agb'],
               4: ['abo', 'gift', 'agb'],
               5: ['links']};               
var delivery_address = false;


// function display delivery-adddress form in order-summary
function show_delivery_address_form()
  {
  if(document.getElementById("delivery_address_form").style.display == 'none')
    {
    document.getElementById("delivery_address_form").style.display = 'block';
    document.getElementById("delivery_address_form").style.visibility = 'visible';
    delivery_address = true;
    }
  else
    {
    document.getElementById("delivery_address_form").style.display = 'none';
    document.getElementById("delivery_address_form").style.visibility = 'hidden';
    delivery_address = false;
    }
  }


// function check if a delivery_address is required
function check_order_form()
  {
  var alert_basic='Bitte ergänzen Sie die Lieferadresse:\n\n';
  var alert_add='';
  
  if(delivery_address)
    {
    if(document.form.firstname.value=='')
      alert_add = alert_add+'-Vorname\n';
    if(document.form.surname.value=='')
      alert_add = alert_add+'-Nachname\n';
    if(document.form.street.value=='')
      alert_add = alert_add+'-Strasse\n';  
    if(document.form.zip.value=='')
      alert_add = alert_add+'-Postleitzahl\n';
    if(document.form.place.value=='')
      alert_add = alert_add+'-Stadt\n ';
    
    if (alert_add)
      {
      alert(alert_basic+alert_add);
      return false;
      }
    }
    
  document.form.submit();
  return false;
  }


// submit search
function ch_garten_search()
  {
  document.form.action='search';
  document.form.submit();

  return false;
  }


// popup the menu for a certain chapter
function ch_garten_popup(id, mode)
  {
  actual_nav_id=id;
  
  var pos=get_image_pos('chg_'+id);
  
  // clear menu timeout
  nexmenu_popup(id, null, pos.x+25, pos.y+32);
  
  //if(!mode)
  //  nav_out(actual_nav_id);
  
  //alert(id);
  //document.images['chg_'+id].src='../design/spring/nav_on_'+id+'.png';
  }


function nav_out(actual_nav_id)
  {
  var mode='';
  alert("out");

  for(var i=1; i<=5; i++)
    {
    if(i!=actual_nav_id)
      {
      mode=(find_in_array(nav_id, a_nav_ids[i])==-1) ? 'off' : 'on';
      document.images['chg_'+i].src='../design/spring/nav_'+mode+'_'+i+'.png';
      }
    }
  }


  
var img_root;
var enlarge_win;
var win_options = 'width=318,height=80,menubar=0,toolbar=0,location=0,status=0,resizable=1,scrollbars=0';

// called to open a window with an image
function enlarge_image(url, pid)
  {
  if(enlarge_win && !enlarge_win.closed) enlarge_win.close();

  enlarge_win = window.open('../../shop/products/enlarge.html?path='+escape(url)+'&pid='+pid,'gnsEnlargeWin',win_options);
  enlarge_win.focus();
  }
  
 
/* 
function init()
  {
  var obj=document.getElementById('bg_img');

  if(obj)
    {
    var width=bw.ie ? document.body.clientWidth ? document.body.clientWidth : document.documentElement.clientWidth : window.innerWidth

    obj.width=width<1024 ? 1024 : width;
    obj.height=724;



  var container=new layer_object('content_container');
  container.set_opacity(93);

  document.onclick=function(e)
    {
    if(!e)
    e=window.event;

    var target=(e.target) ? e.target : e.srcElement;
    
    if((target.id).indexOf('nxmitm')==-1)
      {
      actual_nav_id=0;
      nav_out();
      }
    };
  }

} */


//window.onresize=init;
