/**
 * Airtours Phase II: Liquid Layouts & C.Components
 * JavaScript Helper
 */

helper = {}

/**
 * Default initialization for slider (Carousel banner)
 */
helper.initSlider = function(comp_cell_id, autoScrollValue, isArrowsVisible, isPagingVisible) {
	$('#'+comp_cell_id).infiniteCarousel({								
		displayThumbnails: isPagingVisible,		
		autoStart: (autoScrollValue > 0),
		showControls: isArrowsVisible,
		autoHideControls: false,
		displayTime: autoScrollValue,		
		sliderId : comp_cell_id				
	});
}
/**
 * 
 */
helper.sendAsyncRequest = function(url,comp_cell_id) {	
	$.get(url, function(data) {
		var banner = $('#' + comp_cell_id);
		banner.replaceWith(data);

		banner = $('#' + comp_cell_id);
		banner.children("div.click").each(function(){
			var aLink = $(this).find("a"); 
			if (aLink.length > 0){
				$(this).click(function(){
					if (aLink.attr("target") == "_blank") {
						window.open(aLink.attr("href")); 
						return false;
					} else {
						window.location = aLink.attr("href"); 
						return false;
					}
				});
				$(this).css("cursor", "pointer");
			}
		});
	});
}
