


var images = new Array();

images[0]= new Image();
images[0].src="images/"+hotel_name+"/1.jpg";
images[1]= new Image();

images[2]= new Image();


var curr=1;
var moving_div;
var interval;
var test=1;
var speed=40;
var pas=1;
var delai=50;



function swapImages(image,name,turning) {

    if(!name) name='turn-image';
    if(!turning) {
        clearInterval(interval);
        moving_div.style.display="none";
     }
    


    if(document.images) {
        document.images[name].src=images[image].src;
    }
}



function move() {
    

    var left= parseInt(moving_div.style.left);
    left-=pas;
    moving_div.style.left=left+"px";
    if(left==0) {
        clearInterval(interval);
        swapImages(curr,'turn-image',1);
        moving_div.style.left="250px";
        interval = setTimeout("beginMove()",delai);
    }
}



function beginMove() {
        clearTimeout(interval);
        curr=(curr+1)%3;
        swapImages(curr,'moving-image',1);
        interval=setInterval("move()",speed);
}




window.onload= function () {



    moving_div=document.getElementById('moving-image');
    moving_div.style.left= "250px";
    images[1].onload= function() { interval= setInterval("move()",speed); }
    images[1].src="images/"+hotel_name+"/2.jpg";
    images[2].src="images/"+hotel_name+"/3.jpg";
    


}

window.onunload = function () {
    clearInterval(interval);
}