// CTL banner ads multiple rotating
var ctlb_vCurrent = 0;
var ctlb_vTotal = 0;
var ctlb_vDuration = 5000;
var ctlb_intInterval = 0;
var ctlb_vGo = 1;
var ctlb_vIsPause = false;
var ctlb_tmp = 20;
var ctlb_title;

jQuery(document).ready(function() {	
	ctlb_vTotal = $(".ctlb_slides").children().size() -1;
	$(".ctlb_info").text($(".ctlb_slide").attr("title"));	
	ctlb_intInterval = setInterval(ctlb_fnLoop, ctlb_vDuration);
			
	$("#ctlb_object").find(".ctlb_slide").each(function(i) { 
		ctlb_tmp = ((i - 1)*145) - ((ctlb_vCurrent -1)*145);
		$(this).animate({"left": ctlb_tmp+"px"}, 500);
		
	});
	
	$("#btn_pauseplay").click(function() {
		if(ctlb_vIsPause){
			ctlb_fnChange();
			ctlb_vIsPause = false;
			$("#btn_pauseplay").removeClass("ctlb_btn_play");
			$("#btn_pauseplay").addClass("ctlb_btn_pause");
		} else {
			clearInterval(ctlb_intInterval);
			ctlb_vIsPause = true;
			$("#btn_pauseplay").removeClass("ctlb_btn_pause");
			$("#btn_pauseplay").addClass("ctlb_btn_play");
		}
	});
	$("#btn_prev").click(function() {
		ctlb_vGo = -1;
		ctlb_fnChange();
	});
		
	$("#btn_next").click(function() {
		ctlb_vGo = 1;
		ctlb_fnChange();
	});
});

function ctlb_fnChange(){
	clearInterval(ctlb_intInterval);
	ctlb_intInterval = setInterval(ctlb_fnLoop, ctlb_vDuration);
	ctlb_fnLoop();
}

function ctlb_fnLoop(){
	if(ctlb_vGo == 1){
		ctlb_vCurrent == ctlb_vTotal ? ctlb_vCurrent = 0 : ctlb_vCurrent++;
	} else {
		ctlb_vCurrent == 0 ? ctlb_vCurrent = ctlb_vTotal : ctlb_vCurrent--;
	}
	
	$("#ctlb_object").find(".ctlb_slide").each(function(i) { 
		
		if(i == ctlb_vCurrent){
			ctlb_title = $(this).attr("title");
			$(".ctlb_info").animate({ opacity: 'hide', "left": "-50px"}, 200,function(){
				$(".ctlb_info").text(ctlb_title).animate({ opacity: 'show', "left": "0px"}, 500);
			});
		} 
		

		//Horizontal Scrolling
		ctlb_tmp = ((i - 1)*145) - ((ctlb_vCurrent -1)*145);
		$(this).animate({"left": ctlb_tmp+"px"}, 500);
		
		/*
		//Fade In & Fade Out
		if(i == ctlb_vCurrent){
			$(".ctlb_info").text($(this).attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 500);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 500);
		}
		*/
		
	});


}


/*********************************/
// Second Rotating banner small
var ctlb2_vCurrent = 0;
var ctlb2_vTotal = 0;
var ctlb2_vDuration = 5000;
var ctlb2_intInterval = 0;
var ctlb2_vGo = 1;
var ctlb2_vIsPause = false;
var ctlb2_tmp = 20;
var ctlb2_title;

jQuery(document).ready(function() {	
	ctlb2_vTotal = $(".ctlb2_slides").children().size() -1;
	$(".ctlb2_info").text($(".ctlb2_slide").attr("title"));	
	ctlb2_intInterval = setInterval(ctlb2_fnLoop, ctlb2_vDuration);
			
	$("#ctlb2_object").find(".ctlb2_slide").each(function(i) { 
		ctlb2_tmp = ((i - 1)*145) - ((ctlb2_vCurrent -1)*145);
		$(this).animate({"left": ctlb2_tmp+"px"}, 500);
		
	});
	
	$("#btn_pauseplay").click(function() {
		if(ctlb2_vIsPause){
			ctlb2_fnChange();
			ctlb2_vIsPause = false;
			$("#btn_pauseplay").removeClass("ctlb2_btn_play");
			$("#btn_pauseplay").addClass("ctlb2_btn_pause");
		} else {
			clearInterval(ctlb2_intInterval);
			ctlb2_vIsPause = true;
			$("#btn_pauseplay").removeClass("ctlb2_btn_pause");
			$("#btn_pauseplay").addClass("ctlb2_btn_play");
		}
	});
	$("#btn_prev").click(function() {
		ctlb2_vGo = -1;
		ctlb2_fnChange();
	});
		
	$("#btn_next").click(function() {
		ctlb2_vGo = 1;
		ctlb2_fnChange();
	});
});

function ctlb2_fnChange(){
	clearInterval(ctlb2_intInterval);
	ctlb2_intInterval = setInterval(ctlb2_fnLoop, ctlb2_vDuration);
	ctlb2_fnLoop();
}

function ctlb2_fnLoop(){
	if(ctlb2_vGo == 1){
		ctlb2_vCurrent == ctlb2_vTotal ? ctlb2_vCurrent = 0 : ctlb2_vCurrent++;
	} else {
		ctlb2_vCurrent == 0 ? ctlb2_vCurrent = ctlb2_vTotal : ctlb2_vCurrent--;
	}
	
	$("#ctlb2_object").find(".ctlb2_slide").each(function(i) { 
		
		if(i == ctlb2_vCurrent){
			ctlb2_title = $(this).attr("title");
			$(".ctlb2_info").animate({ opacity: 'hide', "left": "-50px"}, 200,function(){
				$(".ctlb2_info").text(ctlb2_title).animate({ opacity: 'show', "left": "0px"}, 500);
			});
		} 
		

		//Horizontal Scrolling
		ctlb2_tmp = ((i - 1)*145) - ((ctlb2_vCurrent -1)*145);
		$(this).animate({"left": ctlb2_tmp+"px"}, 500);
		
		/*
		//Fade In & Fade Out
		if(i == ctlb2_vCurrent){
			$(".ctlb2_info").text($(this).attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 500);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 500);
		}
		*/
		
	});


}

/*********************************/
// Third Rotating banner small
var ctlb3_vCurrent = 0;
var ctlb3_vTotal = 0;
var ctlb3_vDuration = 5000;
var ctlb3_intInterval = 0;
var ctlb3_vGo = 1;
var ctlb3_vIsPause = false;
var ctlb3_tmp = 20;
var ctlb3_title;

jQuery(document).ready(function() {	
	ctlb3_vTotal = $(".ctlb3_slides").children().size() -1;
	$(".ctlb3_info").text($(".ctlb3_slide").attr("title"));	
	ctlb3_intInterval = setInterval(ctlb3_fnLoop, ctlb3_vDuration);
			
	$("#ctlb3_object").find(".ctlb3_slide").each(function(i) { 
		ctlb3_tmp = ((i - 1)*145) - ((ctlb3_vCurrent -1)*145);
		$(this).animate({"left": ctlb3_tmp+"px"}, 500);
		
	});
	
	$("#btn_pauseplay").click(function() {
		if(ctlb3_vIsPause){
			ctlb3_fnChange();
			ctlb3_vIsPause = false;
			$("#btn_pauseplay").removeClass("ctlb3_btn_play");
			$("#btn_pauseplay").addClass("ctlb3_btn_pause");
		} else {
			clearInterval(ctlb3_intInterval);
			ctlb3_vIsPause = true;
			$("#btn_pauseplay").removeClass("ctlb3_btn_pause");
			$("#btn_pauseplay").addClass("ctlb3_btn_play");
		}
	});
	$("#btn_prev").click(function() {
		ctlb3_vGo = -1;
		ctlb3_fnChange();
	});
		
	$("#btn_next").click(function() {
		ctlb3_vGo = 1;
		ctlb3_fnChange();
	});
});

function ctlb3_fnChange(){
	clearInterval(ctlb3_intInterval);
	ctlb3_intInterval = setInterval(ctlb3_fnLoop, ctlb3_vDuration);
	ctlb3_fnLoop();
}

function ctlb3_fnLoop(){
	if(ctlb3_vGo == 1){
		ctlb3_vCurrent == ctlb3_vTotal ? ctlb3_vCurrent = 0 : ctlb3_vCurrent++;
	} else {
		ctlb3_vCurrent == 0 ? ctlb3_vCurrent = ctlb3_vTotal : ctlb3_vCurrent--;
	}
	
	$("#ctlb3_object").find(".ctlb3_slide").each(function(i) { 
		
		if(i == ctlb3_vCurrent){
			ctlb3_title = $(this).attr("title");
			$(".ctlb3_info").animate({ opacity: 'hide', "left": "-50px"}, 200,function(){
				$(".ctlb3_info").text(ctlb3_title).animate({ opacity: 'show', "left": "0px"}, 500);
			});
		} 
		

		//Horizontal Scrolling
		ctlb3_tmp = ((i - 1)*145) - ((ctlb3_vCurrent -1)*145);
		$(this).animate({"left": ctlb3_tmp+"px"}, 500);
		
		/*
		//Fade In & Fade Out
		if(i == ctlb3_vCurrent){
			$(".ctlb3_info").text($(this).attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 500);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 500);
		}
		*/
		
	});


}

/*********************************/
// Forth Rotating banner small
var ctlb4_vCurrent = 0;
var ctlb4_vTotal = 0;
var ctlb4_vDuration = 5000;
var ctlb4_intInterval = 0;
var ctlb4_vGo = 1;
var ctlb4_vIsPause = false;
var ctlb4_tmp = 20;
var ctlb4_title;

jQuery(document).ready(function() {	
	ctlb4_vTotal = $(".ctlb4_slides").children().size() -1;
	$(".ctlb4_info").text($(".ctlb4_slide").attr("title"));	
	ctlb4_intInterval = setInterval(ctlb4_fnLoop, ctlb4_vDuration);
			
	$("#ctlb4_object").find(".ctlb4_slide").each(function(i) { 
		ctlb4_tmp = ((i - 1)*145) - ((ctlb4_vCurrent -1)*145);
		$(this).animate({"left": ctlb4_tmp+"px"}, 500);
		
	});
	
	$("#btn_pauseplay").click(function() {
		if(ctlb4_vIsPause){
			ctlb4_fnChange();
			ctlb4_vIsPause = false;
			$("#btn_pauseplay").removeClass("ctlb4_btn_play");
			$("#btn_pauseplay").addClass("ctlb4_btn_pause");
		} else {
			clearInterval(ctlb4_intInterval);
			ctlb4_vIsPause = true;
			$("#btn_pauseplay").removeClass("ctlb4_btn_pause");
			$("#btn_pauseplay").addClass("ctlb4_btn_play");
		}
	});
	$("#btn_prev").click(function() {
		ctlb4_vGo = -1;
		ctlb4_fnChange();
	});
		
	$("#btn_next").click(function() {
		ctlb4_vGo = 1;
		ctlb4_fnChange();
	});
});

function ctlb4_fnChange(){
	clearInterval(ctlb4_intInterval);
	ctlb4_intInterval = setInterval(ctlb4_fnLoop, ctlb4_vDuration);
	ctlb4_fnLoop();
}

function ctlb4_fnLoop(){
	if(ctlb4_vGo == 1){
		ctlb4_vCurrent == ctlb4_vTotal ? ctlb4_vCurrent = 0 : ctlb4_vCurrent++;
	} else {
		ctlb4_vCurrent == 0 ? ctlb4_vCurrent = ctlb4_vTotal : ctlb4_vCurrent--;
	}
	
	$("#ctlb4_object").find(".ctlb4_slide").each(function(i) { 
		
		if(i == ctlb4_vCurrent){
			ctlb4_title = $(this).attr("title");
			$(".ctlb4_info").animate({ opacity: 'hide', "left": "-50px"}, 200,function(){
				$(".ctlb4_info").text(ctlb4_title).animate({ opacity: 'show', "left": "0px"}, 500);
			});
		} 
		

		//Horizontal Scrolling
		ctlb4_tmp = ((i - 1)*145) - ((ctlb4_vCurrent -1)*145);
		$(this).animate({"left": ctlb4_tmp+"px"}, 500);
		
		/*
		//Fade In & Fade Out
		if(i == ctlb4_vCurrent){
			$(".ctlb4_info").text($(this).attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 500);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 500);
		}
		*/
		
	});


}



/*********************************/
// Fifth Rotating banner Large
var ctlb5_vCurrent = 0;
var ctlb5_vTotal = 0;
var ctlb5_vDuration = 5000;
var ctlb5_intInterval = 0;
var ctlb5_vGo = 1;
var ctlb5_vIsPause = false;
var ctlb5_tmp = 20;
var ctlb5_title;

jQuery(document).ready(function() {	
	ctlb5_vTotal = $(".ctlb5_slides").children().size() -1;
	$(".ctlb5_info").text($(".ctlb5_slide").attr("title"));	
	ctlb5_intInterval = setInterval(ctlb5_fnLoop, ctlb5_vDuration);
			
	$("#ctlb5_object").find(".ctlb5_slide").each(function(i) { 
		ctlb5_tmp = ((i - 1)*145) - ((ctlb5_vCurrent -1)*145);
		$(this).animate({"left": ctlb5_tmp+"px"}, 500);
		
	});
	
	$("#btn_pauseplay").click(function() {
		if(ctlb5_vIsPause){
			ctlb5_fnChange();
			ctlb5_vIsPause = false;
			$("#btn_pauseplay").removeClass("ctlb5_btn_play");
			$("#btn_pauseplay").addClass("ctlb5_btn_pause");
		} else {
			clearInterval(ctlb5_intInterval);
			ctlb5_vIsPause = true;
			$("#btn_pauseplay").removeClass("ctlb5_btn_pause");
			$("#btn_pauseplay").addClass("ctlb5_btn_play");
		}
	});
	$("#btn_prev").click(function() {
		ctlb5_vGo = -1;
		ctlb5_fnChange();
	});
		
	$("#btn_next").click(function() {
		ctlb5_vGo = 1;
		ctlb5_fnChange();
	});
});

function ctlb5_fnChange(){
	clearInterval(ctlb5_intInterval);
	ctlb5_intInterval = setInterval(ctlb5_fnLoop, ctlb5_vDuration);
	ctlb5_fnLoop();
}

function ctlb5_fnLoop(){
	if(ctlb5_vGo == 1){
		ctlb5_vCurrent == ctlb5_vTotal ? ctlb5_vCurrent = 0 : ctlb5_vCurrent++;
	} else {
		ctlb5_vCurrent == 0 ? ctlb5_vCurrent = ctlb5_vTotal : ctlb5_vCurrent--;
	}
	
	$("#ctlb5_object").find(".ctlb5_slide").each(function(i) { 
		
		if(i == ctlb5_vCurrent){
			ctlb5_title = $(this).attr("title");
			$(".ctlb5_info").animate({ opacity: 'hide', "left": "-50px"}, 600,function(){
				$(".ctlb5_info").text(ctlb5_title).animate({ opacity: 'show', "left": "0px"}, 500);
			});
		} 
		

		//Horizontal Scrolling
		ctlb5_tmp = ((i - 1)*145) - ((ctlb5_vCurrent -1)*145);
		$(this).animate({"left": ctlb5_tmp+"px"}, 500);
		
		/*
		//Fade In & Fade Out
		if(i == ctlb5_vCurrent){
			$(".ctlb5_info").text($(this).attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 500);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 500);
		}
		*/
		
	});


}

