   var currentImg = 3;
   
	function setCarousel() {
	
		$("QLprevious").style.display = "none";
		$("QLnext").style.display = "none";	

		if( typeof( quickLookImages1 ) != "undefined"){
		
		   if(quickLookImages1.length >= 5){
				$("carouselImg1").style.width = "10px";
			   	$("carouselImg2").style.width = "128px";
			   	$("carouselImg3").style.width = "288px";
			   	$("carouselImg4").style.width = "128px";
			   	$("carouselImg5").style.width = "10px";
			   	
			   	$("carouselImg1").style.height = "10px";
			   	$("carouselImg2").style.height = "96px";
			   	$("carouselImg3").style.height = "216px";
			   	$("carouselImg4").style.height = "96px";
			   	$("carouselImg5").style.height = "10px";
			   	
			   	$("carouselImg1").style.left = "-50px";
			   	$("carouselImg2").style.left = "40px";
			   	$("carouselImg3").style.left = "180px";
			   	$("carouselImg4").style.left = "480px";
			   	$("carouselImg5").style.left = "650px";
			   		
			   	$("carouselImg1").style.top = "100px";
			   	$("carouselImg2").style.top = "60px";
			   	$("carouselImg3").style.top = "0";
			   	$("carouselImg4").style.top = "60px";
			   	$("carouselImg5").style.top = "100px";
				
				
				$("QLprevious").style.display = "block";
				$("QLnext").style.display = "block";	
			}
			else if(quickLookImages1.length == 1){
				$("carouselImg1").style.width = "288px";
				$("carouselImg1").style.height = "216px";
				$("carouselImg1").style.left = "180px";
				$("carouselImg1").style.top = "0";	
			}
			else if(quickLookImages1.length == 2){
				$("carouselImg1").style.width = "288px";
				$("carouselImg1").style.height = "216px";
				$("carouselImg1").style.left = "20px";
				$("carouselImg1").style.top = "0";
				
				$("carouselImg2").style.width = "288px";
				$("carouselImg2").style.height = "216px";
				$("carouselImg2").style.left = "340px";
				$("carouselImg2").style.top = "0";			
			}
			
		}
		else{
			var currentQuickLookOverlay = $( "quickLookOverlay1" );
			var nodes = getElementsByClassName( currentQuickLookOverlay, "*", "carousel" );
			nodes[0].style.display = "none";
		}
		
		
	}



   function carouselPrevious() {
   	if(currentImg > 2){
   	
   	img1 = "carouselImg" + (currentImg -2);
   	img2 = "carouselImg" + (currentImg -1);
   	img3 = "carouselImg" + (currentImg);
   	img4 = "carouselImg" + (currentImg + 1);
     	
     	new Rico.Effect.SizeAndPosition( $(img1), 40, 60, 128, 96, 5, 5, null );
     	new Rico.Effect.SizeAndPosition( $(img2), 180, 1, 288, 216, 5, 5, null );
     	new Rico.Effect.SizeAndPosition( $(img3), 480, 60, 128, 96, 5, 5, null );
     	new Rico.Effect.SizeAndPosition( $(img4), 650, 100, 1, 1, 3, 5, null );  	
     	
     	currentImg = currentImg -1;
     	
     	if (currentImg < 3){
			$("QLprevious").style.display = "none";
     	}
     	if (currentImg < (quickLookImages1.length - 1)){
			$("QLnext").style.display = "block";
     	}

     	carouselDetails('carouselDetails1');
     	}
   }
   
      function carouselNext() {
      	if(currentImg < (quickLookImages1.length - 1)){
      	
      	img2 = "carouselImg" + (currentImg - 1);
      	img3 = "carouselImg" + (currentImg);
      	img4 = "carouselImg" + (currentImg + 1);
      	img5 = "carouselImg" + (currentImg + 2);
        	
	new Rico.Effect.SizeAndPosition( $(img2), -50, 100, 1, 1, 3, 5, null );
	new Rico.Effect.SizeAndPosition( $(img3), 40, 60, 128, 96, 5, 5, null );
	new Rico.Effect.SizeAndPosition( $(img4), 180, 1, 288, 216, 5, 5, null );
	new Rico.Effect.SizeAndPosition( $(img5), 480, 60, 128, 96, 5, 5, null );
	
	currentImg = currentImg + 1;
	
     	if (currentImg > (quickLookImages1.length - 2)){
     	$("QLnext").style.display = "none";
     	}
     	if (currentImg > 2){
	$("QLprevious").style.display = "block";
     	}

	carouselDetails('carouselDetails1');
	}
   }
   
function carouselDetails(unitID){
	if ($(unitID) != null){
	$(unitID).innerHTML = (currentImg-1) + " of " + ((quickLookImages1.length)-2) + ": <strong>" + quickLookImages1[currentImg-1][1] + "</strong>";
} 
}

function setCarouselDetails(){

	if( typeof( quickLookImages1 ) != "undefined"){

		if(quickLookImages1.length >= 5){
			$("carouselDetails2").style.display = "none";
			$("carouselDetails1").innerHTML = (currentImg-1) + " of " + ((quickLookImages1.length)-2) + ": <strong>" + quickLookImages1[currentImg-1][1] + "</strong>";
		}
		else if(quickLookImages1.length == 1){
			$("carouselDetails2").style.display = "none";
			$("carouselDetails1").style.left = "180px";
			$("carouselDetails1").innerHTML = "<strong>" + quickLookImages1[0][1] + "</strong>";
		}
		else if(quickLookImages1.length == 2){
			$("carouselDetails1").style.left = "20px";
			$("carouselDetails1").innerHTML = "<strong>" + quickLookImages1[0][1] + "</strong>";
			$("carouselDetails2").style.display = "block";
			$("carouselDetails2").style.left = "50px";
			$("carouselDetails2").innerHTML = "<strong>" + quickLookImages1[1][1] + "</strong>";
		}
		
	}
	
}



function getQuickLook()
{
	var anchors = document.getElementsByTagName('a');
	for(i=0; i<anchors.length; i++)
	{
		if(anchors[i].className=="quickLookLink")
		{
			anchors[i].onclick = quickLook;
		}
	}
}

var quickLookImages1;
var quickLookButtons;

function quickLook()
{
	currentImg = 3;
	var parentDiv = this.parentNode;
	var linkList = parentDiv.getElementsByTagName('li');
	var hotelName = '<span class="padder">Quick look - '+linkList.item(0).innerHTML+'</span>';
	
	quickLookImages1 = new Array(linkList.length+1);

	for (i=0; i<linkList.length+1; i++){
		quickLookImages1[i]= new Array(2);
	}
	
	quickLookImages1[0][0] = "/images/search_results/quick_look/carousel/first.gif";
	quickLookImages1[0][1] = "No previous images";
	quickLookImages1[linkList.length-1][0] = "/images/search_results/quick_look/carousel/last.gif";
	quickLookImages1[linkList.length-1][1] = "No further images";
	

	for(i=1; i<linkList.length; i++)
	{
		quickLookImages1[i][0] = linkList[i].childNodes[0].href;
		quickLookImages1[i][1] = linkList[i].childNodes[0].innerHTML;
	}
	if( typeof( quickLookImages1 ) != "undefined"){
		var divs = document.getElementsByTagName("div");
		for (var n=0; n<divs.length; n++) {
			if (divs[n].className == "carousel") {
				if( typeof(quickLookImages1) != "undefined"){
					if(divs[n].getElementsByTagName('img').length>2)
					{
						divs[n].innerHTML = quickLookButtons;
					}
					else
					{
						quickLookButtons = divs[n].innerHTML;	
					}
					for (var i=0; i<quickLookImages1.length; i++) {
						var img = document.createElement("img");
						img.src = quickLookImages1[i][0];
						img.className = "carouselImg";
						img.id = "carouselImg" + (i+1);
						divs[n].appendChild(img);
					}
					if( quickLookImages1.length >= 5){
						$("carouselImg1").style.border = "0";
						$("carouselImg" + (quickLookImages1.length)).style.border = "0";
					}
				}
				divs[n].style.display = "block";
			}
		}
	}
	setCarousel();
	setCarouselDetails();
	$("quickLookHotelName").innerHTML=hotelName;
	stickyShow(this, 'quickLookOverlay1');
}

function closeQuickLook(id)
{
	stickyHide(id);
}


   
