var flowCFmax = 0;
var flowUTmax = 0;
var flowmax = 0;


$(document).ready(function() {
	
  if (flowCFmax == 0) $("#leftCF").css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_links_ki.jpg)");
  if ((flowCFend+3) < 4) $("#rightCF").css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_rechts_ki.jpg)");

    
  $("#leftCF").hover(function (){
		    if (flowCFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_links_aktiv.jpg)"); 
    }, function(){ 
        if (flowCFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_links_inaktiv.jpg)"); 
    });

    
	$("#rightCF").hover(function (){
		    if (flowCFmax < flowCFend) $(this).css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_rechts_aktiv.jpg)"); 
    }, function(){ 
        if (flowCFmax < flowCFend) $(this).css( "background-image", "url(typo3conf/ext/pflow/img/pfeil_rechts_inaktiv.jpg)"); 
    });

    $.preloadImages("typo3conf/ext/pflow/img/pfeil_rechts_ki.jpg",
                    "typo3conf/ext/pflow/img/pfeil_rechts_aktiv.jpg",
                    "typo3conf/ext/pflow/img/pfeil_links_ki.jpg",
                    "typo3conf/ext/pflow/img/pfeil_links_aktiv.jpg");

});

function beLeftCF(was){

  if (flowCFmax <= 0) {
  
  } else {
    $("#rightCF").css({ "backgroundImage": "url(typo3conf/ext/pflow/img/pfeil_rechts_inaktiv.jpg)" });
    $("#flowCF").animate({left: "+=245px"}, 500 );
    flowCFmax--;
    if (flowCFmax == 0) {
      $("#leftCF").css({ "backgroundImage": "url(typo3conf/ext/pflow/img/pfeil_links_ki.jpg)" });
    }
  }
}

function beRightCF(was){

  if (flowCFmax >= flowCFend) {
  
  } else {
    $("#flowCF").animate({left: "-=245px"}, 500 );
    $("#leftCF").css({ "backgroundImage": "url(typo3conf/ext/pflow/img/pfeil_links_inaktiv.jpg)" });
    flowCFmax++;
    if (flowCFmax == flowCFend) {
      $("#rightCF").css({ "backgroundImage": "url(typo3conf/ext/pflow/img/pfeil_rechts_ki.jpg)" });
    }
  }

  
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
