/*--------------------------------------------------------------------------
 *  YOJA-WEB.COM : patch carousel
 *  Copyright (c) Jamal Chaqouri, Yohann Fontaine, of yoja team (http://www.yoja-web.com)
 *
 *  patch carousel is a yoja-web.com work.
 *  For details, see the yoja web site: http://www.yoja-web.com
/*--------------------------------------------------------------------------*/

var carouselPatchParameters = new Array();

var clickManuel = true;



	var timer = null;

    function rotation(){
		    clickManuel=false;
            $j("#featuredHighlight .jcarousel-next").trigger('click');
            timer = window.setTimeout(rotation, carouselPatchParameters.timeout || 4000);
    }


    function patchCarousel(){
        timer = window.setTimeout(rotation, carouselPatchParameters.timeout || 4000);
    
	
		$j("#featuredHighlight .jcarousel-next, #featuredHighlight .jcarousel-prev, #featuredHighlight .pagination a").click(
			function(){
				if(clickManuel&&carouselPatchParameters.stopOnClick){
					window.clearTimeout(timer);
				} else {
					clickManuel = true;
				}
			}
		);
		
		if(carouselPatchParameters.waitOnMouseOver){
				$j("#featuredHighlight .highlight_content").hover(
					function(){
							window.clearTimeout(timer);
					},
					function (){
						timer = window.setTimeout(rotation, carouselPatchParameters.timeout || 4000);
					}
				);
		}
	
	}




addEventYoja(window,'load',patchCarousel);