$(document).ready(function(){
  setTimeout("walkingclouds()", 300);
//  clouds(1, 180000); // Wolkenanimation via jQuery
//  clouds(2, 190000); // Wolkenanimation via jQuery
//  clouds(3, 200000); // Wolkenanimation via jQuery
});
/***********************************
/* Wolken
/**/
function walkingclouds(){
  // Hier kein jQuery .animate, weil .animate extrem mehr CPU-Last erzeugt!
  clouds = 3;
  //erwartet Werte in position; werden im init gesetzt
  cloudposition[1] += 0.6;
  cloudposition[2] += 0.8;
  cloudposition[3] += 1;
  for(a = 1; a <= clouds; a++){
    positionset = Math.round(cloudposition[a]);
    if(mainwidth > positionset){
      $('#deco_wolke_' + a).css('left', positionset + "px");
    }
    else {
      newposition = -(parseInt($('#deco_wolke_' + a).css('width'))+1);
      $('#deco_wolke_' + a).css('left', newposition);
      cloudposition[a] = newposition;
    }
  }
  setTimeout("walkingclouds()", 300);
}

/***********************************
/* Wolken (jQuery; leider zu viel CPU-Last)
/**/
function clouds(cloud, speed){
  // Wolkenanimation mit jQuery. Nicht aktiv, da sehr hohe CPU-Last!
  $('#deco_wolke_' + cloud).animate({
    left: mainwidth
  }, speed, 'linear', function(){
    $('#deco_wolke_' + cloud).css("left", -cloudwidth[cloud]);
    clouds(cloud, speed);
  });
}

/***********************************
/* Canvasfläche wegblenden
/**/
function canvasFoldOut(content, title, anim){
  if($('#canvas').css('display') != "none" && $('#canvas').css('opacity') != "0"){
    window.setTimeout(function(){
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        if($('#gadget').css('display') != "none") $('#gadget').fadeOut('fast');
        $('#canvas').animate({
          height: 0,
          width: 0,
          left: mainwidth/2,
          top: mainheight/2,
          opacity: 0
        }, 'slow', 'linear', function(){
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
      else{ // IE ohne Opacity
        $('#gadget').hide();
        $('#canvas').animate({
          height: 0,
          width: 0,
          left: mainwidth/2,
          top: mainheight/2
        }, 'slow', 'linear', function(){
          $('#canvas').css('display', "none");
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
    },500);
  }
  else{
    $('#canvas').css('height', "0px");
    $('#canvas').css('width', "0px");
    $('#canvas').css('left', (mainwidth/2) + "px");
    $('#canvas').css('top', (mainheight/2) + "px");
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      $('#canvas').css('opacity', "0");
    }
    else{
      $('#canvas').css('display', "none");
    }
    if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
  }
}

/***********************************
/* Canvasfläche einblenden
/**/
function canvasFoldIn(content, title, anim){
  if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop,
      opacity: 1
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
      $('#gadget').fadeIn('slow');
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
  else{ // IE ohne opacity
    $('#canvas').css('display', 'block');
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
      $('#gadget').show();
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
}

/***********************************
/* Canvasfläche nach Links wegschieben
/**/
function canvasSlideOutLeft(content, title, anim){
  canvaswidth = canvasstandardwidth;
  window.setTimeout(function(){
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      if($('#gadget').css('display') != "none") $('#gadget').fadeOut('fast');
      $('#frontgras').fadeOut('fast');
      $('#frontgras2').fadeOut('fast');
      $('#frontgras3').fadeOut('fast');
      $('#contentgras').fadeOut('fast');
    }
    else{
      $('#gadget').hide();
    }
    $('#deco-landscape').animate({
    left: (parseInt($('#deco-landscape').css('left')) - 30) + "px"
    }, 1500, 'linear');
    $('#deco_camp').animate({
      left: (parseInt($('#deco_camp').css('left')) - 60) + "px"
    }, 1500, 'linear');
    $('#deco_tree_1').animate({
      left: (parseInt($('#deco_tree_1').css('left')) - 150) + "px"
    }, 1500, 'linear');
    if($('#canvas').css('display') != "none" && $('#canvas').css('opacity') != "0"){
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        $('#canvas').animate({
          height: canvasheight - 100,
          width: canvaswidth - 100,
          left: canvaswidth * (-1),
          top: canvastop + 50,
          opacity: 0
        }, 800, 'linear', function(){
          $('#canvasarea').css('width', (canvaswidth - 20) + "px");
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
      else{ // IE ohne Opacity
        $('#canvas').animate({
          height: canvasheight - 100,
          width: canvaswidth - 100,
          left: canvaswidth * (-1),
          top: canvastop + 50
        }, 800, 'linear', function(){
          $('#canvasarea').css('width', (canvaswidth - 20) + "px");
          $('#canvas').css('display', "none");
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
    }
    else{
      $('#canvas').css('height', (canvasheight - 100) + "px");
      $('#canvas').css('width', (canvaswidth - 100) + "px");
      $('#canvas').css('left', (canvaswidth * (-1)) + "px");
      $('#canvas').css('top', (canvastop + 50) + "px");
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        $('#canvas').css('opacity', "0");
      }
      else{ // IE ohne Opacity
        $('#canvas').css('display', "none");
      }
      if(anim.length > 0) window.setTimeout(function(){ eval(anim.shift() + "('" + content + "','" + title + "',anim);") },800);
    }
  },500);
}

/***********************************
/* Canvasfläche nach Links reinschieben
/**/
function canvasSlideInLeft(content, title, anim){
  $('#canvas').css('height', (canvasheight - 100) + "px");
  $('#canvas').css('width', (canvaswidth - 100) + "px");
  $('#canvas').css('left', mainwidth + "px");
  $('#canvas').css('top', (canvastop + 50) + "px");
  if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
    $('#canvas').css('opacity', "0");
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop,
      opacity: 1
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
      $('#gadget').fadeIn('slow');
      $('#frontgras').fadeIn('fast');
      $('#frontgras2').fadeIn('fast');
      $('#frontgras3').fadeIn('fast');
      $('#contentgras').fadeIn('fast');
      navigationFoldIn();
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
  else{ // IE ohne Opacity
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + "png");
      $('#gadget').show();
      navigationFoldIn();
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
}

/***********************************
/* Canvasfläche nach Rechts wegschieben
/**/
function canvasSlideOutRight(content, title, anim){
  canvaswidth = canvasstandardwidth;
  window.setTimeout(function(){
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      if($('#gadget').css('display') != "none") $('#gadget').fadeOut('fast');
      $('#frontgras').fadeOut('fast');
      $('#frontgras2').fadeOut('fast');
      $('#frontgras3').fadeOut('fast');
      $('#contentgras').fadeOut('fast');
    }
    else{
      $('#gadget').hide();
    }
    $('#deco-landscape').animate({
    left: (parseInt($('#deco-landscape').css('left')) + 30) + "px"
    }, 1500, 'linear');
    $('#deco_camp').animate({
      left: (parseInt($('#deco_camp').css('left')) + 60) + "px"
    }, 1500, 'linear');
    $('#deco_tree_1').animate({
      left: (parseInt($('#deco_tree_1').css('left')) + 150) + "px"
    }, 1500, 'linear');
    if($('#canvas').css('display') != "none" && $('#canvas').css('opacity') != "0"){
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        $('#canvas').animate({
          height: canvasheight - 100,
          width: canvaswidth - 100,
          left: mainwidth,
          top: canvastop + 50,
          opacity: 0
        }, 800, 'linear', function(){
          $('#canvasarea').css('width', (canvaswidth - 20) + "px");
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
      else{ // IE ohne Opacity
        $('#canvas').animate({
          height: canvasheight - 100,
          width: canvaswidth - 100,
          left: mainwidth,
          top: canvastop + 50
        }, 800, 'linear', function(){
          $('#canvas').css('display', "none");
          $('#canvasarea').css('width', (canvaswidth - 20) + "px");
          if(anim.length > 0 && currenttype != 'photoindex') eval(anim.shift() + "('" + content + "','" + title + "',anim);");
        });
      }
    }
    else{
      $('#canvas').css('height', "0px");
      $('#canvas').css('width', "0px");
      $('#canvas').css('left', (mainwidth/2) + "px");
      $('#canvas').css('top', (mainheight/2) + "px");
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        $('#canvas').css('opacity', "0");
      }
      else{ // IE ohne Opacity
        $('#canvas').css('display', "none");
      }
      if(anim.length > 0) window.setTimeout(function(){ eval(anim.shift() + "('" + content + "','" + title + "',anim);") },800);
    }
  },500);
}

/***********************************
/* Canvasfläche nach Rechts reinschieben
/**/
function canvasSlideInRight(content, title, anim){
  $('#canvas').css('height', (canvasheight - 100) + "px");
  $('#canvas').css('width', (canvaswidth - 100) + "px");
  $('#canvas').css('left', (canvaswidth * (-1)) + "px");
  $('#canvas').css('top', (canvastop + 50) + "px");
  if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
    $('#canvas').css('opacity', "0");
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop,
      opacity: 1
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
      $('#gadget').fadeIn('slow');
      $('#frontgras').fadeIn('fast');
      $('#frontgras2').fadeIn('fast');
      $('#frontgras3').fadeIn('fast');
      $('#contentgras').fadeIn('fast');
      navigationFoldIn();
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
  else{ // IE ohne Opacity
    $('#canvas').animate({
      height: canvasheight,
      width: canvaswidth,
      left: mainwidth/2 - canvaswidth/2,
      top: canvastop
    }, 'slow', 'linear', function(){
      gadgetstr = content.split(".");
      $('#gadget').hide();
      if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
      $('#gadget').show();
      navigationFoldIn();
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    });
  }
}
/***********************************
/* Canvasfläche expandieren
/**/
function canvasExpand(content, title, anim){
  canvaswidth = mainwidth-200;
  $('#canvasarea').css('width', (canvaswidth - 20) + "px");
  $('#canvas').animate({
    width: canvaswidth,
    left: mainwidth/2 - canvaswidth/2
  }, 'slow', 'linear', function(){
    show_gadget = false;
    if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
  });
}

/***********************************
/* Contentfläche einblenden
/**/
function paperFoldIn(content, title, anim){
  if($('#canvas').css('opacity') > 0 && $('#canvas').css('display') != "none"){
    gadgetstr = content.split(".");
    $('#gadget').hide();
    if(gadgetstr.length == 1 || gadgetstr[1].indexOf("?to=") == (-1)) $('#gadgetimage').attr("src", "images/gadget_" + gadgetstr[0] + ".png");
    window.setTimeout(function(){
      if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
        if(show_gadget) $('#gadget').fadeIn('slow');
        $('.content').animate({
          height: 'toggle',
          padding: 'toggle',
          top: canvasheight/2,
          opacity: 0
        }, 1, 'linear', function(){
          $('.content').animate({
            height: 'toggle',
            padding: 'toggle',
            top: 0,
            opacity: 1
          }, 'slow', 'linear', function(){
            $('#canvasarea').css('overflow-y', "auto");
            if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
          });
        });
      }
      else{ // IE ohne toggle
        if(show_gadget) $('#gadget').show();
        $('.content').css('top', "0px");
        $('#canvasarea').css('overflow-y', "auto");
        if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
      }
    },500);
  }
  else{
    anim = new Array("canvasFoldIn", "paperFoldIn");
    $('#canvas').css('height', "0px");
    $('#canvas').css('width', "0px");
    $('#canvas').css('left', (mainwidth/2) + "px");
    $('#canvas').css('top', (mainheight/2) + "px");
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      $('#canvas').css('opacity', "0");
    }
    if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
  }
}

/***********************************
/* Contentfläche ausblenden
/**/
function paperFoldOut(content, title, anim){
  if($('.content').length){
    $('#canvasarea').css('overflow-y', "hidden");
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      if($('#gadget').css('display') != "none") $('#gadget').fadeOut('fast');
      $('.content').animate({
        height: 'toggle',
        padding: 'toggle',
        top: canvasheight/2,
        opacity: 0
      }, 'slow', 'linear', function(){
        $('#canvasarea').css('overflow-y', "auto");
        show_gadget = true;
        canvaswidth = canvasstandardwidth;
        $('#canvas').animate({
          width: canvaswidth,
          left: mainwidth/2 - canvaswidth/2
        }, 'slow', 'linear', function(){
          $('#canvasarea').css('width', (canvaswidth - 20) + "px");
        });
        if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
      });
    }
    else{ // IE ohne toggle
      $('#gadget').hide();
      $('#canvasarea').css('overflow-y', "auto");
      show_gadget = true;
      canvaswidth = canvasstandardwidth;
      $('#canvas').animate({
        width: canvaswidth,
        left: mainwidth/2 - canvaswidth/2
      }, 'slow', 'linear', function(){
        $('#canvasarea').css('width', (canvaswidth - 20) + "px");
      });
      if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
    }
  }
  else{
    if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
  }
}

/***********************************
/* Thumbnails einfliegen lassen
/**/
function animateThumbsIn(content, title, anim){
  $('#canvasarea').css('overflow-y', "auto");
  randrot = new Array();
  for(a = 0; a < $('.thumb').length; a++){
    randrot.push(Math.round(Math.random() * 10 - 5));
    $('#thumb_' + a).css({
      '-webkit-transform': "rotate(" + randrot[a] + "deg)",
      '-moz-transform': "rotate(" + randrot[a] + "deg)",
      'ms-transform': "rotate(" + randrot[a] + "deg)",
      '-o-transform': "rotate(" + randrot[a] + "deg)",
      'transform': "rotate(" + randrot[a] + "deg)"
    });
    $('#thumb_' + a).animate({
      left: '0px',
      top: '0px'
    }, 1800, 'linear', function(){
      return true;
    });
  }
}

/***********************************
/* Thumbnails ausfliegen lassen
/**/
function animateThumbsOut(content, title, anim){
  if($('#canvas').css('display') != "none" && $('#canvas').css('opacity') != "0"){
    //$('#canvasarea').css('overflow-y', "hidden"); // stört die Rück-Animation!
    for(a = 0; a < $('.thumb').length; a++){
    randrot2 = Math.round(Math.random() * 360 - 180);
      if(Math.round(Math.random() * 1) == 0) randx = -1800;
      else randx = 1800;
      if(Math.round(Math.random() * 1) == 0) randy = -1080;
      else randy = 1080;
      $('#thumb_' + a).css({
        '-webkit-transform': "rotate(" + randrot2 + "deg)",
        '-moz-transform': "rotate(" + randrot2 + "deg)",
        'ms-transform': "rotate(" + randrot2 + "deg)",
        '-o-transform': "rotate(" + randrot2 + "deg)",
        'transform': "rotate(" + randrot2 + "deg)"
      });
      $('#thumb_' + a).animate({
        left: randx + 'px',
        top: randy + 'px'
      }, 1800, 'linear', function(){
        return true;
      });
    }
    if(anim.length > 0) setTimeout(function(){eval(anim.shift() + "('" + content + "','" + title + "',anim);")}, 1000);
  }
  else if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
}

/***********************************
/* Content wechseln - Start der Animationskaskate vom übergebenen Typ
/**/
function changeContent(content, title, type, back){
  changeBack(content, title, type, back);
  anim = (new Array()).concat(animation[type]);
  if(type == "canvas" || type == "canvas_in" || type == "canvas_out"){
    changeNavigation(content);
  }
  if(type != "photoindex"){
    changeLocator(title);
  }
  if(anim.length > 0) eval(anim.shift() + "('" + content + "','" + title + "',anim);");
}

/***********************************
/* Air-Bereich einblenden
/**/
function showAir(){
  $('#airimageframe').animate({
    top: '0px'
  }, 'fast');
  $('#air').animate({
    opacity: 1
  }, 'slow');
}

/***********************************
/* Air-Bereich ausblenden
/**/
function hideAir(){
  $('#air').animate({
    opacity: 0
  }, 'fast', function(){
    $('#air').css('display',"none");
  });
  $('#airimageframe').animate({
    top: (mainheight-190) + 'px'
  }, 'slow');
}

/***********************************
/* Locator umblenden
/**/
function changeLocator(locationstr){
  locationstr = locationstr.replace(/ /g, "&nbsp;");
  $('#locator').animate({
    width: 'toggle'
  }, 'slow', 'linear', function(){
    $('#footer').empty();
    $('#footer').append(locationstr);
    $('#locator').animate({
      width: 'toggle'
    }, 'slow', 'linear', function(){
      return true;
    });
  });
}

/***********************************
/* Navigation ausblenden
/**/
function navigationFoldOut(navi){
  if(cansound){
    if(setupStorage.getItem("sound") != "off") audiochannel['grass-1'].play();
  }
  if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
    $('#frontgras3').fadeIn('fast');
  }
  $('#dock').animate({
    bottom: -160
  }, 'slow', 'linear', function(){
    getNavigation(navi);
  });
}

/***********************************
/* Navigation einblenden
/**/
function navigationFoldIn(){
  if(cansound){
    if(setupStorage.getItem("sound") != "off") audiochannel['grass-2'].play();
 }
  $('#dock').animate({
    bottom: 30
  }, 'slow', 'linear', function(){
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      $('#frontgras3').fadeOut('fast');
    }
//    if(navi != "fotoalbum.php?album=fruher"){
      initDock();
//    }
  });
}

/***********************************
/* Navigation wechseln
/**/
function changeNavigation(navi){
  navigationFoldOut(navi);
}

/***********************************
/* Fix-Navigation wechseln
/**/
function changeBack(content, title, type, back){
  if(back == null && type != 'paper' && type != 'paper_expand' && type != 'photoindex'){
    backstack["content"].push(currentcontent);
    backstack["title"].push(currenttitle);
    backstack["type"].push("canvas_out") // push(currenttype);
  }
  currentcontent = content;
  currenttitle   = title;
  currenttype    = backstack["content"].length == 0? 'canvas_out' : type;
  if(backstack["content"].length == 0){
    if($('#fixnav').css('display') != 'none'){
      $('#fixnav').fadeOut('slow');
    }
  }
  else{
    if($('#fixnav').css('display') == 'none'){
      $('#fixnav').fadeIn('slow');
      $('#fixnav').unbind();
      $('#fixnav').click(function(){
        goBack();
      });
    }
  }
}

/***********************************
/* Lupe
/**/
function checkLupe(){
  if((origphotoheight/photoviewheight) <= 1){
    $('#lupeicon').css('cursor', "auto");
    $('#lupeicon').animate({
      opacity: 0
    },'slow');
  }
  else{
    $('#lupeicon').css('cursor', "pointer");
    $('#lupeicon').animate({
      opacity: 1
    },'slow');
  }
}
function mouseposition(ereignis){
  if(!ereignis) ereignis = window.event;
  mouse_x = ereignis.clientX;
  mouse_y = ereignis.clientY;
  if(lupeaktiv){
    $('#lupe').css('left', (mouse_x - 150) + "px");
    $('#lupe').css('top', (mouse_y - 150) + "px");
    lupenfaktor = origphotoheight/photoviewheight;
    mouse_x_m = mouse_x - (mainwidth/2);
    mouse_y_m = mouse_y - (mainheight/2);
    lupe_x_m = -mouse_x_m * lupenfaktor;
    lupe_y_m = -mouse_y_m * lupenfaktor;
    lupe_x = -((origphotowidth/2) - lupe_x_m - 150);
    lupe_y = -((origphotoheight/2) - lupe_y_m - 105);
    if(!(browsername == "IE" && parseFloat(browserversion) < 9.0)){
      $('#lupe').css('background-position', "0 0, " + Math.round(lupe_x) + "px " + Math.round(lupe_y) + "px");
    }
    else{
      $('#lupe').css('background-position', Math.round(lupe_x) + "px " + Math.round(lupe_y) + "px");
    }
  }
}
