var scrollContent = null;
var scrollIcon = null;
var last_scrollContent = null;
var last_scrollIcon = null;

Fisch_Open = new Image(13,13);
Fisch_Open.src = "images/slider_open.gif";

Fisch_Closed = new Image(13,13);
Fisch_Closed.src = "images/slider_close.gif";

function AniVert(content, ico){

	var interval = 10;
	var step = 10;

    if (scrollContent == null)
    {
        scrollContent = document.getElementById(content);
        scrollIcon = document.getElementById(ico);
        
        var expand = (document.getElementById(content).style.display == "none");
        
        if (last_scrollContent != null)
        {
            last_scrollContent.style.display = "none";
            last_scrollIcon.src = Fisch_Open.src;
        }

        if (expand)
            document.getElementById(content).style.display = "block";

        var max_height = document.getElementById(content).offsetHeight;
        var step_height = step + (expand ? 0 : -max_height);
 
        document.getElementById(content).style.height = Math.abs(step_height) + "px";
        
        scrollIcon.src = Fisch_Closed.src;

        setTimeout("PannelAniVert("
            + interval + "," + step
            + "," + max_height + "," + step_height + ")", interval);

    }
}


function PannelAniVert(interval, step, max_height, step_height)
{
    var step_height_abs = Math.abs(step_height);

    if (step_height_abs>=step && step_height_abs<=(max_height-step))
    {
        step_height += step;
        scrollContent.style.height = Math.abs(step_height) + "px";
        setTimeout("PannelAniVert("
            + interval + "," + step
            + "," + max_height + "," + step_height + ")", interval);
    }
    else
    {
        if (step_height_abs<step)
            scrollContent.style.display = "none";

        scrollContent.style.height = "";

        last_scrollContent = scrollContent;
        last_scrollIcon = scrollIcon;
        
        scrollContent = null;
        scrollIcon = null;
    }
}






function FensterOeffnen (Adresse) 
{
  Fenster1 = window.open(Adresse, "_blank", "width=500,height=519,left=200,top=100"); Fenster1.focus();
  Fenster1.focus();
}

  function FensterOeffnen_460x379 (Adresse) 
{ Fenster1 = window.open(Adresse, "_blank", "width=460,height=379,left=200,top=100"); Fenster1.focus(); } 
 
function fensteropen_560x393 (Adresse) 
{ Fenster1 = window.open(Adresse, "_blank", "width=560,height=393,left=200,top=100"); Fenster1.focus(); } 
 

function FensterOeffnenAdr (Zip,Town,Town2,Street,Country) 
{
  if (Zip.length==0 && Town.length==0 && Town2.length==0 && Street.length==0)
  {
    alert("Bitte füllen Sie mindestens eines der Felder aus");
  }
  else
  {
    if (Country == "P" || Country == "E")
    {
      Fenster1 = window.open("http://www.yellowmap.de/Filialfinder/HTML/POIIsoPartner.aspx?Partner=Aldi-Nord&SecurityID=ZjP1IF/WCnhs4Sq0X5k13A==&GeoFormatDatabase=3&GeoFormatIn=3&Radius=1000000&BC=ALDI&Search=1Locale=de-DE&Country="+Country+"&Zip="+Zip+"&Town="+Town+"&Town2="+Town2+"&Street="+Street, "Zweitfenster", "width=800,height=600,left=200,top=100,scrollbars=yes"); Fenster1.focus();
      Fenster1.focus();
    }
    else
    {
      Fenster1 = window.open("http://www.yellowmap.de/Filialfinder/HTML/POIIsoPartner.aspx?Partner=Aldi-Nord&SecurityID=ZjP1IF/WCnhs4Sq0X5k13A==&Radius=250000&BC=ALDI&Search=1Locale=de-DE&Country="+Country+"&Zip="+Zip+"&Town="+Town+"&Town2="+Town2+"&Street="+Street, "Zweitfenster", "width=800,height=600,left=200,top=100,scrollbars=yes"); Fenster1.focus();
      Fenster1.focus();
    }
  }
  return false;
}

function FensterOeffnenEmail (email) 
{
  if (email.length==0)
  {
    alert("Bitte geben Sie Ihre Email Adresse an.");
  }
  else
  {
    document.newsletterform.submit();
  }
  return false;
}
function filename(path)
{
	var thefile= path.substring( path.lastIndexOf('/') +1, path.length  );
	if (thefile == "") { thefile = "index.shtml" };
	return thefile;
}

function pathname(path)
{
	return path.substring( 0,path.lastIndexOf('/') );
}

function drucken()
{
	var path = document.location.pathname ; 
	var printfile = pathname(path)+"/P_"+filename(path) ;
	printfile = printfile + document.location.search ;
	Fenster1 = window.open(printfile,"ALDIdrucken","width=760,height=500,left=50,top=50,scrollbars=yes,location=no,menubar=no,resizeable=yes,status=no,toolbar=no");
  Fenster1.focus();
}

function drucken2(server)
{
	Fenster2 = window.open("http://"+server+"/EINKAUFSZETTEL_D/P_index.shtml","ALDIdrucken","width=760,height=500,left=50,top=50,scrollbars=yes,location=no,menubar=no,resizeable=yes,status=no,toolbar=no");
  Fenster2.focus();
}

function empfehlen()
{
	Fenster3 = window.open("/PHP/empfehlen.php?page="+document.location.pathname,"ALDIempfehlen","width=400,height=550,left=50,top=50");
  Fenster3.focus();	
}

function FensterOeffnen3 (Adresse) 
{
  Fenster4 = window.open(Adresse, "Zweitfenster", "width=400,height=550,left=200,top=100");
  Fenster4.focus();
}
