
function change_hover(el){
	document.getElementById(el.id).style.backgroundImage='url(/assets/templates/riamax/images/checkbox_active.png)';
}
function change_hover_out(el){
	if (document.getElementById(el.id).className=='my_checkbox checked'){
		document.getElementById(el.id).style.backgroundImage='url(/assets/templates/riamax/images/checkbox_checked.png)';
	} else {
		document.getElementById(el.id).style.backgroundImage='url(/assets/templates/riamax/images/checkbox.png)';
	}
}

$(document).ready(function() {
	var autoPlayTime=1000;
	autoPlayTimer = setInterval( autoPlay, autoPlayTime);
	function autoPlay(){
		Slidebox4('next');
	}
	$('#slidebox4 .next').click(function () {
		Slidebox4('next','stop');
	});
	$('#slidebox4 .previous').click(function () {
		Slidebox4('previous','stop');
	});
	var yPosition=$('#slidebox4').height()/2-$('#slidebox4 .next').height()/2;
	$('#slidebox4 .next').css('top',yPosition);
	$('#slidebox4 .previous').css('top',yPosition);
});
//slide page to id
function Slidebox4(slideTo,autoPlay){
    var animSpeed=4000; //animation speed
    var easeType='easeInOutExpo'; //easing type
	var sliderWidth=$('#slidebox4').height();
	var leftPosition=$('#slidebox4 .container').css("top").replace("px", "");
	$("#slidebox4 .content").each(function (i) {
		totalContent=i*sliderWidth;
		$('#slidebox4 .container').css("width",totalContent+sliderWidth);
	});
	if( !$("#slidebox4 .container").is(":animated")){
		if(slideTo=='next'){ //next
			if(autoPlay=='stop'){
				clearInterval(autoPlayTimer);
			}
			if(leftPosition==-totalContent){
				$('#slidebox4 .container').animate({top: 0}, animSpeed, easeType); //reset
			} else {
				$('#slidebox4 .container').animate({top: '-='+sliderWidth}, animSpeed, easeType); //next
			}
		} else if(slideTo=='previous'){ //previous
			if(autoPlay=='stop'){
				clearInterval(autoPlayTimer);
			}
			if(leftPosition=='0'){
				$('#slidebox4 .container').animate({top: '-'+totalContent}, animSpeed, easeType); //reset
			} else {
				$('#slidebox4 .container').animate({top: '+='+sliderWidth}, animSpeed, easeType); //previous
			}
		} else {
			var slide2=(slideTo-1)*sliderWidth;
			if(leftPosition!=-slide2){
				clearInterval(autoPlayTimer);
				$('#slidebox4 .container').animate({top: -slide2}, animSpeed, easeType); //go to number
			}
		}
	}
}
