var flowCFmax = 0;
var flowIFmax = 0;
var flowmax = 0;
var activeShow = new Object();
var activeBorder = 0;




$(document).ready(function() {
  // alert(flowIFmax+"/"+flowIFend);
  if (flowIFmax == 0) $("#leftIF").css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_links_ki.jpg)");
  if ((flowIFend+10) < 10) $("#rightIF").css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_rechts_ki.jpg)");

    
  $("#leftIF").hover(function (){
		    if (flowIFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_links_aktiv.jpg)"); 
    }, function(){ 
        if (flowIFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_links_inaktiv.jpg)"); 
    });

    
	$("#rightIF").hover(function (){
		    if (flowIFmax < flowIFend) $(this).css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_rechts_aktiv.jpg)"); 
    }, function(){ 
        if (flowIFmax < flowIFend) $(this).css( "background-image", "url(typo3conf/ext/iconflow/img/schalter_iconflow_rechts_inaktiv.jpg)"); 
    });
 

});

function beLeftIF(was){

  if (flowIFmax <= 0) {
  
  } else {
    $("#rightIF").css({ "backgroundImage": "url(typo3conf/ext/iconflow/img/schalter_iconflow_rechts_inaktiv.jpg)" });
    $("#flowIF").animate({left: "+=92px"}, 500 );
    flowIFmax--;
    if (flowIFmax == 0) {
      $("#leftIF").css({ "backgroundImage": "url(typo3conf/ext/iconflow/img/schalter_iconflow_links_ki.jpg)" });
    }
  }
}

function beRightIF(was){

  if (flowIFmax >= flowIFend) {
  
  } else {
    $("#flowIF").animate({left: "-=92px"}, 500 );
    $("#leftIF").css({ "backgroundImage": "url(typo3conf/ext/iconflow/img/schalter_iconflow_links_inaktiv.jpg)" });
    flowIFmax++;
    if (flowIFmax == flowIFend) {
      $("#rightIF").css({ "backgroundImage": "url(typo3conf/ext/iconflow/img/schalter_iconflow_rechts_ki.jpg)" });
    }
  }

  
}

function hightLight(id){

  if (id==1) { var idBefore = 11; } else { var idBefore = id-1; }
  if (id==11) { var idNext = 1; } else { var idNext = id+1; }
  
  var imgNext = "#showIF"+idNext;
  var imgBefore = "#showIF"+idBefore;

  var image = "#img"+id;
  var border = "#showIF"+id;
  $(border).animate({width: 100, height:59, left: "-=10px", top: "-=10px"} , 100 );
  $(image).animate({ width: "+=20px", height: "+=20px"}, 100);
  $(imgNext).animate({ opacity: 0.4, left: "+=5px"}, 100);
  $(imgBefore).animate({ opacity: 0.4,  left: "-=5px"}, 100);

}

function lowLight(id){

  if (id==1) { var idBefore = 11; } else { var idBefore = id-1; }
  if (id==11) { var idNext = 1; } else { var idNext = id+1; }
  
  var imgNext = "#showIF"+idNext;
  var imgBefore = "#showIF"+idBefore;

  var image = "#img"+id;
  var border = "#showIF"+id;
  $(border).animate({width: 80, height:39, left: "+=10px", top: "+=10px"} , 100 );
  $(image).animate({ width: "-=20px", height: "-=20px"}, 100);
  $(imgNext).animate({ opacity: 1,  left: "-=5px"}, 1);
  $(imgBefore).animate({ opacity: 1,  left: "+=5px"}, 1);
}

function switchBorder(id, text, image){

  if (jumpIF[id] != "0") {
    var jumpLink = "/?id="+jumpIF[id];
    document.location.href = jumpLink;
    
    
  } else {
  
    if (jumpBI[id] != "") { 
    
      var fHeight = $(window).height();
      var fWidth = $(window).width();
      $("#layer").animate({ width: fWidth+"px", height: fHeight+"px"}, 5 )
               .animate({ opacity: 1 }, 500);
      $("#layer").html("<div id='stageT'></div><div id='stageV' style='top:"+((fHeight-300)/2)+"px; left:"+((fWidth-400)/2)+"px;'><div class='iconflowDetail' style='margin: 0 auto; width: 100%; height: 300px; width: 400px; background-image: url(uploads/tx_iconflow/"+image+"); opacity: 1; filter: alpha(opacity = 100);'><img src='uploads/tx_iconflow/"+image+"'></div><div onClick='closeDetail();' style='margin: 0 auto; width: 92px; height: 17px; margin-top: 20px; background-image: url(fileadmin/mm2010/bilder/button_schliessen.png); cursor: pointer;'></div></div>");
      $("#stageT").animate({ width: fWidth+"px", height: fHeight+"px"}, 5 )
               .animate({ opacity: 0.9 }, 500);
    }
  
  }
}

function closeDetail() {
  
  $("#stageT").animate({ opacity: 0 }, 500);
  $("#layer").animate({ opacity: 0 }, 500)
             .animate({ width: "0px", height: "0px"}, 500 )
             .html("");  
  
}