function BilderVorladen()
{
    document.Vorladen = new Array();
	if(document.images)
	{
	    for(var i=0; i<BilderVorladen.arguments.length; i++)
	    {
	        document.Vorladen[i] = new Image();
	        document.Vorladen[i].src = BilderVorladen.arguments[i];
        }
	}
}


function autark_gal1_change_pics(picsrc,url)
{
    var newpic2 = '<img src="' +url+ '" border="0">';
    div = document.getElementById(picsrc);
    div.innerHTML = newpic2;
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;

  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";

  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;

  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;

  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function initImage() {
  imageId = 'ToolTip';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}





// Get base url
url  = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);
//standard ajax: hole url/datei
function ajax_do(url)
{
        // Does URL begin with http?
        if (url.substring(0, 4) != 'http') {
              url = base_url + url;
   }

        // Create new JS element
        var jsel = document.createElement('SCRIPT');
        jsel.type = 'text/javascript';
        jsel.src = url;

        // Append JS element (therefore executing the 'AJAX' call)
        document.body.appendChild (jsel);
}


function show_lawyer(div_id)
{
    document.getElementById(div_id).style.display = 'block';
}


function save_mail_values(div)
{
    div_inhalt = document.getElementById(div).innerHTML;
}


function change_pictos(id_image, new_image)
{
    document.getElementById(id_image).src = 'images/' + new_image;
}


function show_form(id_form)
{
    active = document.getElementById(id_form).style.display;

    if(active=='none')
    {
        document.getElementById(id_form).style.display = 'block';
    }
    else
    {
        document.getElementById(id_form).style.display = 'none';
    }
}


function show_subnavi(name_subnavi, id_link_main_navi)
{
    active = document.getElementById(name_subnavi).style.display;
    
    if(active=='none')
    {
        document.getElementById(name_subnavi).style.display = 'block';
        document.getElementById(id_link_main_navi).style.background = '#C6CCCC';
    }
    else
    {
        document.getElementById(name_subnavi).style.display = 'none';
    }
}



function change_pics(picsrc,url,width_grossdarst,height_grossdarst,width_maxdarst,height_maxdarst)
{
    var newpic2 = '<a href="javascript:newwin(\'php/show_pic.php?file_path=../' + url + '\',\'bild_grossdarstellung\',\'' + width_maxdarst + '\',\'' + height_maxdarst + '\')" alt="Klick: Maximaldarstellung" title="Klick: Maximaldarstellung">';
    newpic2     = newpic2 + '<img src="' + url + '" border="0" width="' + width_grossdarst + '" height="' + height_grossdarst + '"></a>';
    div = document.getElementById(picsrc);
    div.innerHTML = newpic2;
}

function animation(bildname, dateiname)
{
    document.getElementById(bildname).src = dateiname;
}

function ani_time(bildname, dateiname, time, hoehe)
{
    window.setTimeout("animation('"+bildname+"','"+dateiname+"',"+hoehe+")", time);
}

function change_height(bildname, hoehe)
{
    document.getElementById(bildname).height = hoehe;
}

var process_fadein  = null;
var process_fadeout = null;
var bilder_ids      = new Array('navi_start', 'navi_mich', 'navi_show', 'navi_kinder', 'navi_walk', 'navi_stelze', 'navi_xmas');
//var bilder_ids  = new Array(navi_start, navi_mich, navi_show, navi_kinder, navi_walk, navi_stelze);
var anzahl_ids  = bilder_ids.length;

function control_fadeout(bilder_ids,anzahl_ids)
{
check_navi();

              for(i=0; i<anzahl_ids; i++)
              {
                  var pic_id = bilder_ids[i];
                  //if(pic_id!=bild_id)
                  //{
                      var id_height      = document.getElementById(pic_id).height;
                      //alert(small_pic_name);
                      if(id_height>=152)
                      {
                          //alert(small_pic_name);
                          var small_pic_name = 'images/'+pic_id+'_klein.gif';
                          pic_fadeout1(pic_id,small_pic_name,2,152,197,0);
                      }
                  //}
              }

}

function pic_fadein(bild_id,bild_gross,time,size_small,size_big,changed_pic)
{
    var new_source  = bild_gross;
    var mittel_wert = (size_big-size_small)/2;
        mittel_wert = Math.round(mittel_wert+size_small);

    var actual_height = document.getElementById(bild_id).height;
    //verhindert flackern
    //document.getElementById(bild_id).height = actual_height;

    if(actual_height==size_small)
    {
        window.clearTimeout(process_fadein);
        process_fadein=null;
        window.clearTimeout(process_fadeout);
        process_fadeout=null;
    }

    //wie mouseout, um sicherzustellen, dass alles zurückgesetzt wird
    for(i=0; i<anzahl_ids; i++)
    {
        var pic_id = bilder_ids[i];
        if(pic_id!=bild_id)
        {
            var id_height      = document.getElementById(pic_id).height;
            var small_pic_name = 'images/'+pic_id+'_klein.gif';
            //alert(small_pic_name);
            if(id_height>152)
            {
                pic_fadeout(pic_id,small_pic_name,2,152,197,0);
            }
        }
    }

    height_new  = actual_height+3;

    if(actual_height<size_big)
    {
        if(changed_pic==0)
        {
            if(height_new>=mittel_wert)
            {
                 var changed_pic = 1;
                 animation(bild_id,new_source);
            }
        }
        //window.clearTimeout(process_fadeout);
        if(actual_height>size_big) height_new=size_big;
        document.getElementById(bild_id).height = height_new;
        process_fadein = window.setTimeout("pic_fadein('"+bild_id+"','"+bild_gross+"',"+time+","+size_small+","+size_big+","+changed_pic+")", time);

    }
    if(actual_height==size_big || actual_height>size_big)
    {
        document.getElementById(bild_id).height = size_big;
        clearTimeout(process_fadein);
        process_fadein=null;
    }

}


function check_navi()
{
     document.getElementById('navi_trans').style.height = '4px';

     window.clearTimeout(process_fadein);
     process_fadein=null;
//
//
//
//        window.clearTimeout(process_fadeout);
//        process_fadeout=null;



//      var actual_height = document.getElementById('navi_start').height;
//      if(actual_height>152) pic_fadeout('navi_start','images/navi_start_klein.gif',2,152,197,0);
//      var actual_height = document.getElementById('navi_mich').height;
//      if(actual_height>152) pic_fadeout('navi_mich','images/navi_mich_klein.gif',2,152,197,0);
//      var actual_height = document.getElementById('navi_show').height;
//      if(actual_height>152) pic_fadeout('navi_show','images/navi_show_klein.gif',2,152,197,0);
//      var actual_height = document.getElementById('navi_kinder').height;
//      if(actual_height>152) pic_fadeout('navi_kinder','images/navi_kinder_klein.gif',2,152,197,0);
//      var actual_height = document.getElementById('navi_walk').height;
//      if(actual_height>152) pic_fadeout('navi_walk','images/navi_walk_klein.gif',2,152,197,0);
//      var actual_height = document.getElementById('navi_stelze').height;
//      if(actual_height>152) pic_fadeout('navi_stelze','images/navi_stelze_klein.gif',2,152,197,0);

    //wie mouseout, um sicherzustellen, dass alles zurückgesetzt wird
//      for(i=0; i<anzahl_ids; i++)
//      {
//          var pic_id = bilder_ids[i];
//          //if(pic_id!=bild_id)
//          //{
//              var id_height      = document.getElementById(pic_id).height;
//              //alert(small_pic_name);
//              if(id_height>152)
//              {
//                  //alert(small_pic_name);
//                  var small_pic_name = 'images/'+pic_id+'_klein.gif';
//                  pic_fadeout(pic_id,small_pic_name,2,152,197,0);
//              }
//          //}
//      }



}


function pic_fadein1(bild_id,bild_gross,time,size_small,size_big,changed_pic)
{
    //setTimeout("pic_fadein('"+bild_id+"','"+bild_gross+"',"+time+","+size_small+","+size_big+","+changed_pic+","+height_new+")", 400);
    if(!process_fadein) pic_fadein(bild_id,bild_gross,time,size_small,size_big,changed_pic)
}


function pic_fadeout1(bild_id,bild_klein,time,size_small,size_big,changed_pic)
{
        if(!process_fadeout) pic_fadeout(bild_id,bild_klein,time,size_small,size_big,changed_pic);
}

function pic_fadeout(bild_id,bild_klein,time,size_small,size_big,changed_pic)
{
    var new_source = bild_klein;

    var mittel_wert = (size_big-size_small)/2;
        mittel_wert = Math.round(mittel_wert+size_small);

        var actual_height = document.getElementById(bild_id).height;
        //verhindert flackern
        //document.getElementById(bild_id).height = actual_height;


        height_new  = actual_height-3;
        
        if(actual_height>size_small)
        {
            if(changed_pic==0)
            {
                if(actual_height<=mittel_wert)
                {
                     var changed_pic = 1;
                     animation(bild_id,new_source);
                }
            }
            if(actual_height<size_small) height_new=size_small;
            document.getElementById(bild_id).height = height_new;
            process_fadeout = window.setTimeout("pic_fadeout('"+bild_id+"','"+bild_klein+"',"+time+","+size_small+","+size_big+","+changed_pic+")", time);
        }
        if(actual_height==size_small || actual_height<size_small)
        {
            document.getElementById(bild_id).height = size_small;
            //:workaround:
              for(i=0; i<anzahl_ids; i++)
              {
                  var pic_id = bilder_ids[i];
                  if(pic_id!=bild_id)
                  {
                      var id_height      = document.getElementById(pic_id).height;
                      //alert(small_pic_name);
                      if(id_height>152)
                      {
                          //alert(small_pic_name);
                          var small_pic_name = 'images/'+pic_id+'_klein.gif';
                          pic_fadeout(pic_id,small_pic_name,2,152,197,0);
                      }
                  }
              }
            clearTimeout(process_fadeout);
            process_fadeout=null;
        }

}


function newwin(wurl,wname,width,height)
{
    fenster=window.open(wurl,wname,
    "status=no,"+
    "toolbar=no,"+
    "resizable=no,"+
    "scrollbars=no,"+
    "menubar=no,"+
    "width="+width+","+
    "top=10,"+
    "left=10,"+
    "height="+height+"");
    fenster.focus();
}


function newwin_scroll(wurl,wname,width,height)
{
    fenster=window.open(wurl,wname,
    "status=no,"+
    "toolbar=no,"+
    "resizable=no,"+
    "scrollbars=yes,"+
    "menubar=no,"+
    "width="+width+","+
    "top=10,"+
    "left=10,"+
    "height="+height+"");
    fenster.focus();
}


function fenster_route()
{
    fenster_neu =
    window.open("route.php", "zweitfenster", "width=470,height=270,scrollbars,toolbar=yes,menubar=yes,resizable=yes");
    fenster_neu.focus();
}



var Initialisierung = 0
var Ex, Ey, TitelFarbe, TextFarbe, ContentInfo;

TitelFarbe = "#FF891F"
TextFarbe = "white"


function ToolTipBewegen(layerName, FromTop, FromLeft, e)
{
	document.getElementById(layerName).style.top = FromTop - 190 +'px';
	document.getElementById(layerName).style.left = FromLeft + 15 +'px';
}

function Aktivieren()
{
	Initialisierung=1;
}

function Deaktivieren()
{
	Initialisierung=0;
}

function Starten(e)
{
	if(Initialisierung)
	{

        Ex = document.all ? document.body.scrollLeft+event.clientX : e.pageX;
		Ey = document.all ? document.body.scrollTop+event.clientY : e.pageY;

        ToolTipBewegen("ToolTip", Ey, Ex, e);
		document.getElementById('ToolTip').style.visibility = "visible";
	}
	else
	{
		ToolTipBewegen("ToolTip", 0, 0);
		document.getElementById('ToolTip').style.visibility = "hidden";
	}
}

function ToolTip(layerName, TTitel, TInhalt)
{
	ContentInfo = '<table border="0" width="160" cellspacing="0" cellpadding="0">'+'<tr><td width="100%" bgcolor="#000000">'+'<table border="0" width="100%" cellspacing="1" cellpadding="0">'+'<tr><td width="100%" bgcolor='+TitelFarbe+'>'+'<table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">'+'<tr><td width="100%">'+'<span class="ToolTipTitel"> '+TTitel+'</span>'+'</td></tr>'+'</table>'+'</td></tr>'+'<tr><td width="100%" bgcolor='+TextFarbe+'>'+'<table border="0" width="90%" cellpadding="0" cellspacing="1" align="center">'+'<tr><td width="100%">'+'<span class="ToolTipInhalt">'+TInhalt+'</span>'+'</td></tr>'+'</table>'+'</td></tr>'+'</table>'+'</td></tr>'+'</table>';
	document.getElementById(layerName).innerHTML = ContentInfo;
}

