function GetAjaxCall(url, functionName) {
  url = url +'&'+esPHPSESSION;
  $.ajax({
     url: url,
     processData: false,
     dataType:  'json',
     success: functionName,
     type: 'POST'
   });
}
function GetAjaxCallTogetLibriSearch(url, functionName, bInit){
  var $productsListParent = $('.MTLibriSearch .standard .ajaxreplace');
  if(!bInit){
    height = $productsListParent.height();
    $productsListParent.hide();
    $productsListParent.parent().append('<div style="text-align:center;height:'+height+'px"><img src="/images/libriwait.gif" class="libriwait"/><br /> Bitte gedulden Sie sich einen Moment</div>');
  }else{
    $productsListParent.parent().append('<div style="text-align:center;"><img src="/images/libriwait.gif" class="libriwait"/><br /> Bitte gedulden Sie sich einen Moment</div>');
  }
  librisearchinit = bInit;
  url = url +'&'+esPHPSESSION;
  $.ajax({
     url: url,
     processData: false,
     dataType:  'json',
     success: functionName,
     type: 'POST'
   });
}
var librisearchinit = false;

function ChangePageLibriSearch(data,responseMessage){
  var container = document.createElement("div");
  container.innerHTML = data.html;
  $container = $(container);

  var $productsListParent = $('.MTLibriSearch .standard .ajaxreplace').parent();
  $productsListParent.parent().append($container);
  $productsListParent.parent().fadeIn(800);
  $productsListParent.remove();
  if(!librisearchinit){
    SmothScroll($("a[name='"+data.anchor+"']").get(0));
  }
}

function ShowListItems(data,responseMessage) {
  var container = document.createElement("div");
  container.innerHTML = data.sItemPage;
  $container = $(container);

  var $productsListParent = $('#key'+data.iListKey).parent();
  $productsListParent.parent().hide();
  $productsListParent.parent().append($container);
  $productsListParent.parent().fadeIn(800);
  $productsListParent.remove();

  //orgProducts.animate({width:0},1000);
}

var showreviewmessage ="Nur die letzten <span>3</span> Kundenmeinungen ansehen";

$(document).ready(function(){
  $(".reviewshowall").click(function(){
    $(".TShopArticleReview#reviewhide").toggleClass('reviewhide');
    tmpshowreviewmessage=showreviewmessage;
    showreviewmessage =$(".reviewshowall").html();
    $(".reviewshowall").html(tmpshowreviewmessage);
  });
  $("#reviewFormLinkmake").click(function()
  {
    $("#reviewForm").toggle();
    $(".TShopArticleReviewList .list").toggle();
  });
  $("#reviewFormLinkread").click(function()
  {
    $("#reviewForm").toggle();
    $(".TShopArticleReviewList .list").toggle();

  });
  $("#infotooluser").click(function(){
    $("#trinfotooluser").toggle();
  });
  $("#infotoolemail").click(function(){
    $("#trinfotoolemail").toggle();
  });
  $(".clicktab").click(function(){
    $(".tabhigh").addClass("tab");
    $(".tabhigh").removeClass("tabhigh");
    $(this).addClass("tabhigh");
    $(this).removeClass("tab");
    $(".tabcontenthigh").addClass("tabcontent");
    $(".tabcontenthigh").removeClass("tabcontenthigh");
    $("."+this.id).removeClass("tabcontent");
    $("."+this.id).addClass("tabcontenthigh");
  });
  $(".MTShopArticleList .imagehoverlist .product").hover(
    function(){
      $(this).children(".relativecontainer").children(".articledetailhover").fadeIn(500);
    }
    ,
    function(){
      $(this).children(".relativecontainer").children(".articledetailhover").hide();
    }
  );

  $(".textsizer .textsizer_inner").hover(
    function(){
      $(".textsizer .textsizer_text").show();
    },
    function(){
      $(".textsizer .textsizer_text").hide();
    });


    $("#quicksearch .buttoninput").hover(
    function(){
      $("#quicksearch .searchtext_inner").show();
    },
    function(){
      $("#quicksearch .searchtext_inner").hide();
    });

  $(".articletab").click(function(){
    if(!$(this).hasClass("hightab")){
      $(".hightab").removeClass("hightab");
      $(this).addClass("hightab");
      $(".articletabcontent").hide();
      $("."+this.id).fadeIn(700);
    }
    return false;
  });
  $(".TPkgShopListfilterItem .valuelist .listFilterName").click(function(){
    if( $(this).parent(".valuelist").children(".listofvalues").is(".valueitems")){
     $(this).parent(".valuelist").children(".listofvalues").slideDown();
     $(this).parent(".valuelist").children(".listofvalues").addClass("valueitems_high");
     $(this).parent(".valuelist").children(".listofvalues").removeClass("valueitems");
     $(this).addClass("listFilterName_high");
    }else{
      $(this).parent(".valuelist").children(".listofvalues").slideUp();
      $(this).parent(".valuelist").children(".listofvalues").addClass("valueitems");
      $(this).parent(".valuelist").children(".listofvalues").removeClass("valueitems_high");
      $(this).removeClass("listFilterName_high");
    }
  });
  ShowHideNoticeList();

});

function ShowHideNoticeList(){
  $(".MTShopArticleList .noticeclosed").parent().siblings(".noticewrapper").children(".reallist").hide();
  $(".MTShopArticleList .headerbox").toggle(
    function(){
      if($(".MTShopArticleList .headerbox .header").hasClass("noticeopen")){
        $(".MTShopArticleList .headerbox .header").addClass("noticeclosed");
        $(".MTShopArticleList .headerbox .header").removeClass("noticeopen");
        $(".MTShopArticleList .headerbox .header").parent().siblings(".noticewrapper").children(".reallist").fadeOut();
      }else{
        $(".MTShopArticleList .headerbox .header").addClass("noticeopen");
        $(".MTShopArticleList .headerbox .header").removeClass("noticeclosed");
        $(".MTShopArticleList .headerbox .header").parent().siblings(".noticewrapper").children(".reallist").fadeIn();
      }
    },
    function(){
      if($(".MTShopArticleList .headerbox .header").hasClass("noticeclosed")){
        $(".MTShopArticleList .headerbox .header").addClass("noticeopen");
        $(".MTShopArticleList .headerbox .header").removeClass("noticeclosed");
        $(".MTShopArticleList .headerbox .header").parent().siblings(".noticewrapper").children(".reallist").fadeIn();
      }else{
        $(".MTShopArticleList .headerbox .header").addClass("noticeclosed");
        $(".MTShopArticleList .headerbox .header").removeClass("noticeopen");
        $(".MTShopArticleList .headerbox .header").parent().siblings(".noticewrapper").children(".reallist").fadeOut();
      }
    }
  );
}

function WritereviewFormDipno()
{
  document.write('<di' + 'v id="reviewForm" class="reviewForm" style="display:none">');
}
function WritereviewFormDipyes()
{
  document.write('<di'+'v id="reviewForm" class="reviewForm">');
}
function WriterreviewFormLinkread()
{
  document.write('<di'+'v id="reviewFormLinkread" class="reviewFormLink">Bewertungen lesen</div>');
}
function WritereviewFormLinkmake()
{
  document.write('<di'+'v id="reviewFormLinkmake" class="reviewFormLink">Artikel bewerten</div>');
}
function Writeclosediv()
{
  document.write('</div>');
}

function ChangeListPageWithHistory(data, e) {
 $('#articlelisthistory'+data.sModuleSpotName).parent().parent().html(data.sItemPage);

}

function ChangeListPageArticleListWithHistory(data, e) {
 $('#articlelisthistory'+data.sModuleSpotName).parent().html(data.sItemPage);
}
