
	/*  
	Function: setTabs 
		Write listings tabs into page element. 
		Not used presently, as the tabs are written in via gloader.load below.
	*/
	function setTabs(tabsEl,tabsContent){
		
		if(document.getElementById(tabsEl)){
			document.getElementById(tabsEl).innerHTML = tabsContent;
		}
		
		return false;
	}	

	

	/* 
	gloader load (async to resolve js/glow clash)
		* Glow carousel
		* Set listings tabs
	*/
	gloader.load(
        ["glow", "1.3","glow.widgets.Carousel"],
        {
			async: true,
            onLoad: function(glow) {
                //use Glow here:

				//Carousel
				if(document.getElementById('carousel-highlights')){
					glow.ready(function(){
						var carouselHighlights = new glow.widgets.Carousel("#carousel-highlights", {
							loop: true,
					        size: 3,
					        step: 1,
					        pageNav: true,
							id: "comedyCarousel"
						});
					});
				}	
				
            }			
        }
    );

	/* 
	Function: (JSTools) Handle onclick events for complaints links:
	params:
		* e - the event;
	*/
	function handleComplaintLinkClick(e){  
		
		//Extend complaintWin object definition:
		complaintWin.features.top = 50;
		complaintWin.features.left = 50;
		complaintWin.features.toolbar = "no";

		//Open popup window:
		complaintWin.open(this.href); 
		return bbcjs.dom.stopEvent(e);
		
	}


	
	/* 
	(JSTools) Create event handlers for complaints links:
	*/
	var complaintlinks = new Array();
	//Create var and put array of elements with this classname in it:
	complaintlinks = bbcjs.dom.getElementsByClassName('complaintlink');
	if (complaintlinks.length > 0){
		//Go through the array and create an event listener for each item:
		for(var i = 0; i < complaintlinks.length; i++){
			bbcjs.dom.addEventListener( $((complaintlinks[i].id).toString()), 'click', handleComplaintLinkClick ); 	
		}
	}	
