var flowCFmax = 0;
var flowUTmax = 0;
var flowmax = 0;


$(document).ready(function() {

  if (flowCFmax == 0) $("#leftCF").css( "background-image", "url(typo3conf/ext/tp_test/img/schalter_coverflow_links_ki.gif)");
  if ((flowCFend+3) < 4) $("#rightCF").css( "background-image", "url(typo3conf/ext/tp_test/img/schaltercoverflow_rechts_ki.gif)");

    
  $("#leftCF").hover(function (){
		    if (flowCFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/tp_test/img/schalter_coverflow_links_aktiv.gif)"); 
    }, function(){ 
        if (flowCFmax > 0) $(this).css( "background-image", "url(typo3conf/ext/tp_test/img/schalter_coverflow_links_inaktiv.gif)"); 
    });

    
	$("#rightCF").hover(function (){
		    if (flowCFmax < flowCFend) $(this).css( "background-image", "url(typo3conf/ext/tp_test/img/schalter_coverflow_rechts_aktiv.gif)"); 
    }, function(){ 
        if (flowCFmax < flowCFend) $(this).css( "background-image", "url(typo3conf/ext/tp_test/img/schalter_coverflow_rechts_inaktiv.gif)"); 
    });

    $.preloadImages("typo3conf/ext/tp_test/img/schalter_coverflow_rechts_aktiv.gif",
                    "typo3conf/ext/tp_test/img/schalter_coverflow_links_aktiv.gif",
                    "typo3conf/ext/tp_test/img/schalter_coverflow_rechts_ki.gif",
                    "typo3conf/ext/tp_test/img/schalter_coverflow_links_ki.gif",
                    "typo3conf/ext/tp_test/img/schalter_coverflow_rechts_inaktiv.gif",
                    "typo3conf/ext/tp_test/img/schalter_coverflow_links_inaktiv.gif");

});

function beLeftCF(was){

  if (flowCFmax <= 0) {
  
  } else {
    $("#rightCF").css({ "backgroundImage": "url(typo3conf/ext/tp_test/img/schalter_coverflow_rechts_inaktiv.gif)" });
    $("#flowCF").animate({top: "+=100px"}, 500 );
    flowCFmax--;
    if (flowCFmax == 0) {
      $("#leftCF").css({ "backgroundImage": "url(typo3conf/ext/tp_test/img/schalter_coverflow_links_ki.gif)" });
    }
  }
}

function beRightCF(was){

  if (flowCFmax >= flowCFend) {
  
  } else {
    $("#flowCF").animate({top: "-=100px"}, 500 );
    $("#leftCF").css({ "backgroundImage": "url(typo3conf/ext/tp_test/img/schalter_coverflow_links_inaktiv.gif)" });
    flowCFmax++;
    if (flowCFmax == flowCFend) {
      $("#rightCF").css({ "backgroundImage": "url(typo3conf/ext/tp_test/img/schalter_coverflow_rechts_ki.gif)" });
    }
  }

  
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}


