 var Car_Border_Color="white";
    var imageBorderStyle = "solid"
    var stopFlag=false
    var reverseFlag = false;
    var forwardFlag = true;
    var carouselImage = 6;
    var reverseCarouselImage = 9;
	function carousel(){

    Carousel_Div = document.getElementById("Carousel");

    for(count = 0; count <= carouselImageList.length/2; count++){
        imageLinkList[count] = document.createElement("a");
        carouselTrack[count] = document.createElement("img");
        imageLinkList[count].appendChild(carouselTrack[count]);
        Carousel_Div.appendChild(imageLinkList[count]);
        imageLinkList[count].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[count] + "&navigationPage="+navigationPage;
        imageLinkList[count].style.cursor="pointer";
        carouselTrack[count].style.position="absolute";
        carouselTrack[count].title=propertyImagesDescList[count];


        carouselTrack[count].style.borderStyle= imageBorderStyle;
        carouselTrack[count].style.borderWidth=2+"px";
        carouselTrack[count].style.borderColor=Car_Border_Color

        //Adding the price of the property
        /*carouselPriceTrack[count] = document.createElement("text");
        carouselPriceTrack[count].style.color="#963497";
        carouselPriceTrack[count].style.position="absolute";
		carouselPriceTrack[count].style.fontFamily="Verdana,Arial,Helvetica,sans-serif"
        carouselPriceTrack[count].style.fontSize="11px";
        carouselPriceTrack[count].style.textAlign="center";
        carouselPriceTrack[count].appendChild(document.createTextNode('\u00A3'+carouselPriceList[count]));*/

        //Carousel_Div.appendChild(carouselPriceTrack[count]);
        
        //Adding the location of the property
        carouselLocationTrack[count] = document.createElement("text");
        carouselLocationTrack[count].style.color="#963497";
        carouselLocationTrack[count].style.position="absolute";
        carouselLocationTrack[count].style.fontFamily="Verdana,Arial,Helvetica,sans-serif"
		carouselLocationTrack[count].style.fontSize="11px";
        carouselLocationTrack[count].style.textAlign="center";
        carouselLocationTrack[count].appendChild(document.createTextNode(carouselLocationList[count]));
        carouselLocationTrack[count].appendChild(document.createElement("br"));
        carouselLocationTrack[count].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[count])));

        Carousel_Div.appendChild(carouselLocationTrack[count]);

        //Adding the image and mouse event to the property image
        carouselTrack[count].src = (carouselImageList[count]);
        carouselTrack[count].onmouseover=stopCarousel;
        carouselTrack[count].onmouseout=restartCarousel;
        //carouselTrack[count].ondblclick=loadPropertyDetails;

    }


    //Setting the position of the zeroth property element
    carouselTrack[0].style.height=60+"px";
    carouselTrack[0].style.width=90+"px";
    carouselTrack[0].style.top=41+"px";
    carouselTrack[0].style.left=11;

    carouselLocationTrack[0].style.height=10+"px";
    carouselLocationTrack[0].style.width=90+"px";
    carouselLocationTrack[0].style.top=110+"px";
    carouselLocationTrack[0].style.left=11;

    /*carouselPriceTrack[0].style.height=10+"px";
    carouselPriceTrack[0].style.width=90+"px";
    carouselPriceTrack[0].style.top=125+"px";
    carouselPriceTrack[0].style.left=11;*/

    //Setting the position of the first property image element
    carouselTrack[1].style.height=80+"px";
    carouselTrack[1].style.width=118+"px";
    carouselTrack[1].style.top=26+"px";
    carouselTrack[1].style.left=112;

    carouselLocationTrack[1].style.height=10+"px";
    carouselLocationTrack[1].style.width=118+"px";
    carouselLocationTrack[1].style.top=115+"px";
    carouselLocationTrack[1].style.left=112;


    /*carouselPriceTrack[1].style.height=10+"px";
    carouselPriceTrack[1].style.width=118+"px";
    carouselPriceTrack[1].style.top=130+"px";
    carouselPriceTrack[1].style.left=112;*/

    //Setting the position of the second property image element
    carouselTrack[2].style.height=101+"px";
    carouselTrack[2].style.width=144+"px";
    carouselTrack[2].style.top=18+"px";
    carouselTrack[2].style.left=241;

    carouselLocationTrack[2].style.height=10+"px";
    carouselLocationTrack[2].style.width=144+"px";
    carouselLocationTrack[2].style.top=128+"px";
    carouselLocationTrack[2].style.left=241;

    /*carouselPriceTrack[2].style.height=10+"px";
    carouselPriceTrack[2].style.width=144+"px";
    carouselPriceTrack[2].style.top=143+"px";
    carouselPriceTrack[2].style.left=241;*/

    //Setting the position of the third property image element
    carouselTrack[3].style.height=80+"px";
    carouselTrack[3].style.width=118+"px";
    carouselTrack[3].style.top=29+"px";
    carouselTrack[3].style.left=396;

    carouselLocationTrack[3].style.height=10+"px";
    carouselLocationTrack[3].style.width=118+"px";
    carouselLocationTrack[3].style.top=118+"px";
    carouselLocationTrack[3].style.left=396;

    /*carouselPriceTrack[3].style.height=10+"px";
    carouselPriceTrack[3].style.width=118+"px";
    carouselPriceTrack[3].style.top=133+"px";
    carouselPriceTrack[3].style.left=396;*/

    //Setting the position of the fourth property image element
    carouselTrack[4].style.height=60+"px";
    carouselTrack[4].style.width=90+"px";
    carouselTrack[4].style.top=41+"px";
    carouselTrack[4].style.left=525;

    carouselLocationTrack[4].style.height=10+"px";
    carouselLocationTrack[4].style.width=90+"px";
    carouselLocationTrack[4].style.top=110+"px";
    carouselLocationTrack[4].style.left=525;

    /*carouselPriceTrack[4].style.height=10+"px";
    carouselPriceTrack[4].style.width=90+"px";
    carouselPriceTrack[4].style.top=125+"px";
    carouselPriceTrack[4].style.left=525;*/

    //Setting the position of the fifth property image element (hidden)
    carouselTrack[5].style.height=0+"px";
    carouselTrack[5].style.width=0+"px";
    carouselTrack[5].style.top=71+"px";
    carouselTrack[5].style.left=615;
    carouselTrack[5].style.borderStyle= imageBorderStyle;
    carouselTrack[5].style.borderWidth=2+"px";
    carouselTrack[5].style.borderColor=Car_Border_Color
    carouselTrack[5].style.visibilty="hidden";

    carouselLocationTrack[5].style.height=0+"px";
    carouselLocationTrack[5].style.width=0+"px";
    carouselLocationTrack[5].style.top=71+"px";
    carouselLocationTrack[5].style.left=615;
    carouselLocationTrack[5].style.display="none";

    /*carouselPriceTrack[5].style.height=0+"px";
    carouselPriceTrack[5].style.width=0+"px";
    carouselPriceTrack[5].style.top=71+"px";
    carouselPriceTrack[5].style.left=615;
    carouselPriceTrack[5].style.display="none";*/

    if(reverseFlag){
        carouselTrack[5].src = (carouselImageList[reverseCarouselImage]);
        carouselLocationTrack[5].appendChild(document.createTextNode(carouselLocationList[reverseCarouselImage]));
        carouselLocationTrack[5].appendChild(document.createElement("br"));
        carouselLocationTrack[5].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[reverseCarouselImage])));
        imageLinkList[5].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[reverseCarouselImage] + "&navigationPage="+navigationPage;

        //carouselLocationTrack[5].value = (carouselLocationList[reverseCarouselImage]);
        //carouselPriceTrack[5].value = (carouselPriceList[reverseCarouselImage]);
    }
    setPosition(myIndex);
}

var myIndex = 1;

function setPosition(iii){
    var ind = iii
    var left0 = 10;
    var left1 = 110;
    var left2 = 238;
    var left3 = 392;
    var left4 = 520;
    var left5 = 610;
    if(!stopFlag){
        if(forwardFlag){
            //Setting the left position for image, location and price
            carouselTrack[0].style.left=(left0 - Math.round(1.1*ind)) +"px";
            carouselTrack[1].style.left=(left1 - Math.round((10.1*ind))) +"px";
            carouselTrack[2].style.left=(left2 - Math.round((12.9*ind))) +"px";
            carouselTrack[3].style.left=(left3 - Math.round((15.5*ind))) +"px";
            carouselTrack[4].style.left=(left4 - Math.round((12.9*ind))) +"px";
            carouselTrack[5].style.left=(left5 - Math.round((9*ind))) +"px";

            carouselLocationTrack[0].style.left=(left0 - Math.round(1.1*ind)) + "px";
            carouselLocationTrack[1].style.left=(left1 - Math.round((10.1*ind))) +"px";
            carouselLocationTrack[2].style.left=(left2 - Math.round((12.9*ind))) +"px";
            carouselLocationTrack[3].style.left=(left3 - Math.round((15.5*ind))) +"px";
            carouselLocationTrack[4].style.left=(left4 - Math.round((12.9*ind))) +"px";
            carouselLocationTrack[5].style.left=(left5 - Math.round((9*ind))) + "px";

            /*carouselPriceTrack[0].style.left=(left0 - Math.round(1.1*ind)) + "px";
            carouselPriceTrack[1].style.left=(left1 - Math.round((10.1*ind))) +"px";
            carouselPriceTrack[2].style.left=(left2 - Math.round((12.9*ind))) +"px";
            carouselPriceTrack[3].style.left=(left3 - Math.round((15.5*ind))) +"px";
            carouselPriceTrack[4].style.left=(left4 - Math.round((12.9*ind))) +"px";
            carouselPriceTrack[5].style.left=(left5 - Math.round((9*ind))) + "px";*/

            //Setting the width for image, location and price
            carouselTrack[0].style.width=(90 - Math.round((9.0*ind))) +"px";
            carouselTrack[1].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselTrack[2].style.width=(144 - Math.round((2.6*ind))) +"px";
            carouselTrack[3].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselTrack[4].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselTrack[5].style.width=(Math.round((9*ind))) +"px";

            carouselLocationTrack[0].style.width=(90 - Math.round((9.0*ind))) +"px";
            carouselLocationTrack[1].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselLocationTrack[2].style.width=(144 - Math.round((2.6*ind))) +"px";
            carouselLocationTrack[3].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselLocationTrack[4].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselLocationTrack[5].style.width=(Math.round((9*ind))) +"px";

            /*carouselPriceTrack[0].style.width=(90 - Math.round((9.0*ind))) +"px";
            carouselPriceTrack[1].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselPriceTrack[2].style.width=(144 - Math.round((2.6*ind))) +"px";
            carouselPriceTrack[3].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselPriceTrack[4].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselPriceTrack[5].style.width=(Math.round((9*ind))) +"px";*/

            //Setting the top of image, location and price
            carouselTrack[0].style.top=(41 + Math.round((3*ind)))+"px";
            carouselTrack[1].style.top=(29 + Math.round((1.2*ind)))+"px";
            carouselTrack[2].style.top=(18 + Math.round((1.1*ind)))+"px";
            carouselTrack[3].style.top=(29 - Math.round((1.1*ind)))+"px";
            carouselTrack[4].style.top=(41 - Math.round((1.2*ind)))+"px";
            carouselTrack[5].style.top=(71 - Math.round((3*ind))) +"px";

            carouselLocationTrack[0].style.top=(41 + Math.round((3*ind))+9 +30)+"px";
            carouselLocationTrack[1].style.top=(29 + Math.round((1.2*ind))+9 + 80 - Math.round(2*ind))+"px";
            carouselLocationTrack[2].style.top=(18 + Math.round((1.1*ind))+9 + 101 - Math.round(2.1*ind))+"px";
            carouselLocationTrack[3].style.top=(29 - Math.round((1.1*ind))+9 + 80 + Math.round(2.1*ind))+"px";
            carouselLocationTrack[4].style.top=(41 - Math.round((1.2*ind))+9 + 80)+"px";
            carouselLocationTrack[5].style.top=(71 +9 + 30) +"px";

            /*carouselPriceTrack[0].style.top=(41 + Math.round((3*ind)) + 14 + 10 + 30)+"px";
            carouselPriceTrack[1].style.top=(29 + Math.round((1.2*ind)) + 14 + 10 + 80 - Math.round(2*ind))+"px";
            carouselPriceTrack[2].style.top=(18 + Math.round((1.1*ind)) + 14 + 10 + 101 - Math.round(2.1*ind))+"px";
            carouselPriceTrack[3].style.top=(29 - Math.round((1.1*ind)) + 14 + 10 + 80 + Math.round(2.1*ind))+"px";
            carouselPriceTrack[4].style.top=(41 - Math.round((1.2*ind)) + 14+ 10+ 80)+"px";
            carouselPriceTrack[5].style.top=(71 + 14 + + 10 +  30  ) +"px";*/

            //Setting the height of image, location and price
            carouselTrack[0].style.height=(60 - Math.round(6*ind)) +"px";
            carouselTrack[1].style.height=(80 - Math.round(2*ind)) +"px";
            carouselTrack[2].style.height=(101 - Math.round(2.1*ind)) +"px";
            carouselTrack[3].style.height=(80 + Math.round(2.1*ind)) +"px";
            carouselTrack[4].style.height=(60 + Math.round(2*ind)) +"px";
            carouselTrack[5].style.height=(Math.round((6*ind))) +"px";

            carouselLocationTrack[0].style.height=(10 - Math.round(ind)) +"px";
            carouselLocationTrack[1].style.height=10 +"px";
            carouselLocationTrack[2].style.height=10 +"px";
            carouselLocationTrack[3].style.height=10 +"px";
            carouselLocationTrack[4].style.height=10 +"px";
            carouselLocationTrack[5].style.height=10 +"px";

            /*carouselPriceTrack[0].style.height=(10 - Math.round(ind)) +"px";
            carouselPriceTrack[1].style.height=10 +"px";
            carouselPriceTrack[2].style.height=10 +"px";
            carouselPriceTrack[3].style.height=10 +"px";
            carouselPriceTrack[4].style.height=10 +"px";
            carouselPriceTrack[5].style.height=10 +"px";*/

            if(myIndex == 0){
                carouselTrack[5].style.borderWidth=2+"px";

                carouselLocationTrack[0].style.display="none";
                //carouselPriceTrack[0].style.display="none";
                
                carouselLocationTrack[5].style.display="none";
                //carouselPriceTrack[5].style.display="none";
            }
            //alert("index " + myIndex);
            myIndex = myIndex + 1;
            if(myIndex <= 10){
                setTimeout("setPosition(myIndex)", 60);
            } else {
                carouselTrack[0].style.borderWidth=0+"px";
                carouselLocationTrack[0].style.display="none";
                //carouselPriceTrack[0].style.display="none";
   
                //carouselLocationTrack[0].style.display="inline";
                //carouselPriceTrack[0].style.display="inline";

                if(carouselImage==carouselImageList.length){
                    carouselImage=0;
                }

                carouselTrack[6]=carouselTrack[0];
                imageLinkList[6]=imageLinkList[0];
                carouselLocationTrack[6]=carouselLocationTrack[0];
                //carouselPriceTrack[6]=carouselPriceTrack[0];

                carouselLocationTrack[6].style.display="inline";
                //carouselPriceTrack[6].style.display="inline";

                for(i=0;i < carouselImageList.length/2+1;i++){
                    carouselTrack[i]=carouselTrack[i+1];
                    carouselLocationTrack[i]=carouselLocationTrack[i+1];
                    //carouselPriceTrack[i]=carouselPriceTrack[i+1];
                    carouselLocationTrack[i].style.display="inline";
                    //carouselPriceTrack[i].style.display="inline";
                    imageLinkList[i]=imageLinkList[i+1];

                }

                carouselTrack[6].src=carouselImageList[carouselImage];
				imageLinkList[6].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[carouselImage] + "&navigationPage="+navigationPage;

                while(carouselLocationTrack[6].childNodes[0]){
                	carouselLocationTrack[6].removeChild(carouselLocationTrack[6].childNodes[0]);
                }
                //carouselLocationTrack[6].removeChild(carouselLocationTrack[6].firstChild);
              //carouselPriceTrack[6].removeChild(carouselPriceTrack[6].firstChild);
                carouselLocationTrack[6].appendChild(document.createTextNode(carouselLocationList[carouselImage]));
                carouselLocationTrack[6].appendChild(document.createElement("br"));
                carouselLocationTrack[6].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[carouselImage])));
		        imageLinkList[6].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[carouselImage] + "&navigationPage="+navigationPage;
                carouselLocationTrack[6].style.display="none";
                //carouselPriceTrack[6].style.display="none";

                carouselImage = carouselImage +1;

                myIndex = 0;
                setTimeout("setPosition(myIndex)", 3000);
            }
        }

        if(reverseFlag){

            //Setting the left position for image, location and price
            carouselTrack[5].style.left=(ind) +"px";
            carouselTrack[0].style.left=(left0 + Math.round(10.0*ind)) +"px";
            carouselTrack[1].style.left=(left1 + Math.round((12.8*ind))) +"px";
            carouselTrack[2].style.left=(left2 + Math.round((15.4*ind))) +"px";
            carouselTrack[3].style.left=(left3 + Math.round((12.8*ind))) +"px";
            carouselTrack[4].style.left=(left4 + Math.round((9.0*ind))) +"px";

            carouselLocationTrack[5].style.left=(ind) +"px";
            carouselLocationTrack[0].style.left=(left0 + Math.round(10.0*ind)) +"px";
            carouselLocationTrack[1].style.left=(left1 + Math.round((12.8*ind))) +"px";
            carouselLocationTrack[2].style.left=(left2 + Math.round((15.4*ind))) +"px";
            carouselLocationTrack[3].style.left=(left3 + Math.round((12.8*ind))) +"px";
            carouselLocationTrack[4].style.left=(left4 + Math.round((9.0*ind))) +"px";

            /*carouselPriceTrack[5].style.left=(ind) +"px";
            carouselPriceTrack[0].style.left=(left0 + Math.round(10.0*ind)) +"px";
            carouselPriceTrack[1].style.left=(left1 + Math.round((12.8*ind))) +"px";
            carouselPriceTrack[2].style.left=(left2 + Math.round((15.4*ind))) +"px";
            carouselPriceTrack[3].style.left=(left3 + Math.round((12.8*ind))) +"px";
            carouselPriceTrack[4].style.left=(left4 + Math.round((9.0*ind))) +"px";*/

            //Setting the width for image, location and price
            carouselTrack[5].style.width=(Math.round((9*ind))) +"px";
            carouselTrack[0].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselTrack[1].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselTrack[2].style.width=(144 - Math.round((2.8*ind))) +"px";
            carouselTrack[3].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselTrack[4].style.width=(90 - Math.round((9*ind))) +"px";

            carouselLocationTrack[5].style.width=(Math.round((9*ind))) +"px";
            carouselLocationTrack[0].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselLocationTrack[1].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselLocationTrack[2].style.width=(144 - Math.round((2.8*ind))) +"px";
            carouselLocationTrack[3].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselLocationTrack[4].style.width=(90 - Math.round((9*ind))) +"px";

            /*carouselPriceTrack[5].style.width=(Math.round((9*ind))) +"px";
            carouselPriceTrack[0].style.width=(90 + Math.round((2.8*ind))) +"px";
            carouselPriceTrack[1].style.width=(118 + Math.round((2.6*ind))) +"px";
            carouselPriceTrack[2].style.width=(144 - Math.round((2.8*ind))) +"px";
            carouselPriceTrack[3].style.width=(118 - Math.round((2.8*ind))) +"px";
            carouselPriceTrack[4].style.width=(90 - Math.round((9*ind))) +"px";*/

            //Setting the top position for image, location and price
            carouselTrack[5].style.top=(71 - Math.round((3*ind))) +"px";
            carouselTrack[0].style.top=(41 - Math.round((1.2*ind)))+"px";
            carouselTrack[1].style.top=(29 - Math.round((1.1*ind)))+"px";
            carouselTrack[2].style.top=(18 + Math.round((1.1*ind)))+"px";
            carouselTrack[3].style.top=(29 + Math.round((1.2*ind)))+"px";
            carouselTrack[4].style.top=(41 + Math.round((3*ind)))+"px";

            carouselLocationTrack[5].style.top=120 +"px";
            carouselLocationTrack[0].style.top=122+"px";
            carouselLocationTrack[1].style.top=127+"px";
            carouselLocationTrack[2].style.top=127+"px";
            carouselLocationTrack[3].style.top=122+"px";
            carouselLocationTrack[4].style.top=120+"px";

            /*carouselPriceTrack[5].style.top=133 +"px";
            carouselPriceTrack[0].style.top=135+"px";
            carouselPriceTrack[1].style.top=140+"px";
            carouselPriceTrack[2].style.top=140+"px";
            carouselPriceTrack[3].style.top=135+"px";
            carouselPriceTrack[4].style.top=133+"px";*/

            //Setting the height for image, location and price
            carouselTrack[5].style.height=(Math.round((6*ind))) +"px";
            carouselTrack[0].style.height=(60 + Math.round(2*ind)) +"px";
            carouselTrack[1].style.height=(80 + Math.round(2.1*ind)) +"px";
            carouselTrack[2].style.height=(101 - Math.round(2.1*ind)) +"px";
            carouselTrack[3].style.height=(80 - Math.round(2*ind)) +"px";
            carouselTrack[4].style.height=(60 - Math.round(6*ind)) +"px";

            if(myIndex == 0){
                carouselTrack[5].style.borderWidth=2+"px";
                
                carouselLocationTrack[4].style.display="none";
                //carouselPriceTrack[4].style.display="none";

                carouselLocationTrack[5].style.display="none";
                //carouselPriceTrack[5].style.display="none";
            }

            myIndex = myIndex + 1;
            if(myIndex <= 10){
                setTimeout("setPosition(myIndex)", 60);
            } else {
                carouselTrack[4].style.borderWidth=0+"px";
                carouselLocationTrack[4].style.display="none";
                //carouselPriceTrack[4].style.display="none";
                if(reverseCarouselImage == 0){
                    reverseCarouselImage=10;
                }

                carouselTrack[6]=carouselTrack[5];
                imageLinkList[6]=imageLinkList[5];
				
                carouselLocationTrack[6]=carouselLocationTrack[5];
                //carouselPriceTrack[6]=carouselPriceTrack[5];

                carouselLocationTrack[6].style.display="inline";
                //carouselPriceTrack[6].style.display="inline";


                for(i=carouselImageList.length/2;i > 0;i--){
                    carouselTrack[i]=carouselTrack[i-1];
					imageLinkList[i]=imageLinkList[i-1];

                    carouselLocationTrack[i]=carouselLocationTrack[i-1];
                    //carouselPriceTrack[i]=carouselPriceTrack[i-1];

                    carouselLocationTrack[i].style.display="inline";
                    //carouselPriceTrack[i].style.display="inline";

                }

                carouselTrack[0]=carouselTrack[6];
                imageLinkList[0]=imageLinkList[6];
				
                carouselLocationTrack[0]=carouselLocationTrack[6];
                //carouselPriceTrack[0]=carouselPriceTrack[6];
                
                reverseCarouselImage = reverseCarouselImage -1;
                
                carouselTrack[5].src=carouselImageList[reverseCarouselImage];
                while(carouselLocationTrack[5].childNodes[0]){
                	carouselLocationTrack[5].removeChild(carouselLocationTrack[5].childNodes[0]);
                }
                //carouselLocationTrack[5].removeChild(carouselLocationTrack[5].firstChild);
              //carouselPriceTrack[5].removeChild(carouselPriceTrack[5].firstChild);
                carouselLocationTrack[5].appendChild(document.createTextNode(carouselLocationList[reverseCarouselImage]));
                carouselLocationTrack[5].appendChild(document.createElement("br"));
                carouselLocationTrack[5].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[reverseCarouselImage])));
			    imageLinkList[5].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[reverseCarouselImage] + "&navigationPage="+navigationPage;
                carouselLocationTrack[5].style.display="none";
                //carouselPriceTrack[5].style.display="none";

                myIndex = 0;
                setTimeout("setPosition(myIndex)", 2000);
            }
        }
    }

    if(stopFlag){
        setTimeout("setPosition(myIndex)", 50);
    }
}



function stopCarousel(){

    //this.style.cursor=this.link?"pointer":"default";
    stopFlag=true;
}
function restartCarousel(){
    stopFlag=false

}

function carouselReverse(){

    var r_button = document.getElementById("rightCarouselButton");
    r_button.src = "/tridentportal/propertystar/images/ps-car-right-arrow-dactive.png";
    r_button.style.cursor="auto";
    r_button.onclick="";

    var l_button = document.getElementById("leftCarouselButton");
    l_button.src = "/tridentportal/propertystar/images/ps-car-left-arrow.png";
    l_button.style.cursor="pointer";
    l_button.onclick=carouselForward;


    reverseCarouselImage = carouselImage + 3;

    if(reverseCarouselImage > 9){
        reverseCarouselImage = reverseCarouselImage - 10;
    }

    carouselTrack[5].src=carouselImageList[reverseCarouselImage];
    
    while(carouselLocationTrack[5].childNodes[0]){
    	carouselLocationTrack[5].removeChild(carouselLocationTrack[5].childNodes[0]);
    }

    //carouselLocationTrack[5].removeChild(carouselLocationTrack[5].firstChild);
    //carouselPriceTrack[5].removeChild(carouselPriceTrack[5].firstChild);
    carouselLocationTrack[5].appendChild(document.createTextNode(carouselLocationList[reverseCarouselImage]));
    carouselLocationTrack[5].appendChild(document.createElement("br"));
    carouselLocationTrack[5].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[reverseCarouselImage])));
    imageLinkList[5].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[reverseCarouselImage] + "&navigationPage="+navigationPage;

    //reverseCarouselImage = reverseCarouselImage - 1;
    reverseFlag = true;
    forwardFlag = false;
}

function carouselForward(){

    var r_button = document.getElementById("rightCarouselButton");
    r_button.src = "/tridentportal/propertystar/images/ps-car-right-arrow.png";
    r_button.style.cursor="pointer";
    r_button.onclick=carouselReverse;

    var l_button = document.getElementById("leftCarouselButton");
    l_button.src = "/tridentportal/propertystar/images/ps-car-left-arrow-dactive.png";
    l_button.style.cursor="auto";
    l_button.onclick="";


    //alert("reverse " + reverseCarouselImage);
    carouselImage = reverseCarouselImage - 3;

    if(carouselImage <= 0  ){
        carouselImage = 9 + carouselImage;
    }else {
        carouselImage = carouselImage - 1;
    }
    //alert("forward " + carouselImage);
    carouselTrack[5].src=carouselImageList[carouselImage];
    while(carouselLocationTrack[5].childNodes[0]){
    	carouselLocationTrack[5].removeChild(carouselLocationTrack[5].childNodes[0]);
    }
    
    //carouselLocationTrack[5].removeChild(carouselLocationTrack[5].firstChild);
  //carouselPriceTrack[5].removeChild(carouselPriceTrack[5].firstChild);
    carouselLocationTrack[5].appendChild(document.createTextNode(carouselLocationList[carouselImage]));
    carouselLocationTrack[5].appendChild(document.createElement("br"));
    carouselLocationTrack[5].appendChild(document.createTextNode('\u00A3'+addCommas(carouselPriceList[carouselImage])));
    imageLinkList[5].href="property-details/propertyDetails.htm?action=propertyDetails&propertyId=" + propertyIdsList[carouselImage] + "&navigationPage="+navigationPage;

    carouselImage = carouselImage +1;


    forwardFlag = true;
    reverseFlag = false;
}


function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	
	return (x1);
}
