
function getContent(content, title, anim){
//  if(content != "home"){
    $.ajax({
      url:         "_getcontent.php",
      contentType: "text/html; charset=utf-8",
      type:        "GET",
      data:        "content="+content,
      success:     function(data){
        if(data != ""){
          if($('#canvasarea')){
            $('#canvasarea').empty();
            $('#canvasarea').append(data);
          }
          if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        }
        else{
          if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
            $('#frontgras').fadeIn('fast');
            $('#frontgras2').fadeIn('fast');
            $('#frontgras3').fadeIn('fast');
            $('#contentgras').fadeIn('fast');
          }
          navigationFoldIn();
        }
      }
    });
//  }
}

function getNavigation(navi){
  $.ajax({
    url:         "_getnavigation.php",
    contentType: "text/html; charset=utf-8",
    type:        "GET",
    data:        "navi="+navi+"&screenwidth="+mainwidth+"&output=true",
    success:     function(data){
      if($('#dock')){
        $('#dock').empty();
        $('#dock').append(data);
//        if(navi != "fotoalbum.php?album=fruher"){
          initDock();
//        }
      }
    }
  });
}

function getPhoto(path, image, type){
  if(!type) type = "photo";
  if((browsername == "IE" && parseFloat(browserversion) < 9.0) || (browsername == "FIREFOX" && parseFloat(browserversion) < 6.0) || (browsername == "SAFARI" && parseFloat(browserversion) < 5.0) || (browsername == "CHROME" && parseFloat(browserversion) < 9.0) || (browsername == "OPERA" && parseFloat(browserversion) < 11.5)) type = type + "_old";
  viewedimage = path + "/" + image;
  temp_textfile = image.split(".");
  textfile = temp_textfile[0];
  lupenImg = new Image();
  lupenImg.src = viewedimage;
  hideAir();
  setTimeout(function(){
    $('#air').empty();
    $('#air').append('<div class="' + type + '" id="airimageframe" onclick="hideAir();" style="top:' + mainheight + 'px;"><img id="airimage" class="' + type + '" src="' + viewedimage + '" onload="getPhotoSize(); getPhotoText(\'' + path + '\',\'' + textfile + '\'); showAir();" style="max-height:' + photoviewheight + 'px;  max-width:' + photoviewwidth + 'px;"></div>');
  }, 700);
}
function getPhotoSize(){
  setTimeout(function(){
    origphotoheight = lupenImg.height;
    origphotowidth  = lupenImg.width;
    checkLupe();
  }, 100);
}
function getPhotoText(path, textfile){
  setTimeout(function(){
    viewwidth = (photoviewheight * origphotowidth) / origphotoheight;
    if((browsername == "IE" && parseFloat(browserversion) < 9.0) || (browsername == "FIREFOX" && parseFloat(browserversion) < 6.0) || (browsername == "SAFARI" && parseFloat(browserversion) < 5.0) || (browsername == "CHROME" && parseFloat(browserversion) < 9.0) || (browsername == "OPERA" && parseFloat(browserversion) < 11.5)){
      $('#airimageframe').css('width', viewwidth + "px");
    }
    $.ajax({
      url:         "_getphototext.php",
      contentType: "text/html; charset=utf-8",
      type:        "GET",
      data:        "path="+path+"&text="+textfile+"&viewwidth="+(Math.round(viewwidth))+"&mainwidth="+mainwidth,
      success:     function(data){
        $('#airimageframe').append(data);
        $('.photo_old').css('background-image', "url(http://www.mellynennorath.de/_scaleimage.php?image=images/mask_photo_frame_1.png&width=" + (viewwidth + 43) + "&height=" + (document.getElementById("airimageframe").offsetHeight) + ")");
        $('.presse_old').css('background-image', "url(http://www.mellynennorath.de/_scaleimage.php?image=images/mask_scan.png&width=" + (viewwidth + 43) + "&height=" + (document.getElementById("airimageframe").offsetHeight) + ")");
      }
    });
  }, 200);
}

function getGuestbookcomments(){
  $.ajax({
    url:         "_getguestbookcomments.php",
    contentType: "text/html; charset=utf-8",
    type:        "GET",
    data:        "",
    success:     function(data){
      $('#guestbookcomments').empty();
      $('#guestbookcomments').append(data);
    }
  });
}

function goBack(){
  // alert(backstack["type"]);
  content = backstack["content"].pop();
  title   = backstack["title"].pop();
  type    = backstack["type"].pop();
  hideAir();
  changeContent(content, title, type, true);
}
