﻿document.write('<script type="text/javascript" src="../js/mootools-release-1.11.js"></script>'); 

var offstate = new Array('thumb1_off','thumb2_off','thumb3_off','thumb4_off');
var onstate = new Array('thumb1_on','thumb2_on','thumb3_on','thumb4_on');
var test = new Array('ourshop','ourcottage','ourfilm','ourbar');


// global variables

var pics_on = new Array();
var pics_off = new Array();   
var movies = new Array();    
var movie_titles = new Array();
var imagepath = '/img/thumbnails/on/';
var imagepathOff = '/img/thumbnails/off/';
var moviepath = '/img/movies/';



// preload mouse ON thumbnails

pics_on[0] = new Image(162,95);
pics_on[0].src = imagepath + 'ourshop.jpg';

pics_on[1] = new Image(162,95);
pics_on[1].src = imagepath + 'ourcottages.jpg';

pics_on[2] = new Image(162,95);
pics_on[2].src = imagepath + 'ourfilm.jpg';

pics_on[3] = new Image(162,95);
pics_on[3].src = imagepath + 'ourbar.jpg';


// preload mouse OFF thumbnails

pics_off[0] = new Image(337,199);
pics_off[0].src = imagepathOff + 'ourshop.jpg';

pics_off[1] = new Image(337,199);
pics_off[1].src = imagepathOff + 'ourcottages.jpg';

pics_off[2] = new Image(337,199);
pics_off[2].src = imagepathOff + 'ourfilm.jpg';

pics_off[3] = new Image(337,199);
pics_off[3].src = imagepathOff + 'ourbar.jpg';

// preload movies

movies[0] = new Image();
movies[0].src = moviepath + 'movie_ourshop.gif';

movies[1] = new Image();
movies[1].src = moviepath + 'movie_ourcottages.gif';

movies[2] = new Image();
movies[2].src = moviepath + 'movie_ourfilm.gif';

movies[3] = new Image();
movies[3].src = moviepath + 'movie_ourbar.gif';

defaultmovie = new Image();
defaultmovie.src = '/img/test/whitemore.jpg';

// preload movie titles

movie_titles[0] = new Image();
movie_titles[0].src = moviepath + 'shop.gif';

movie_titles[1] = new Image();
movie_titles[1].src = moviepath + 'cottages.gif';

movie_titles[2] = new Image();
movie_titles[2].src = moviepath + 'film.gif';

movie_titles[3] = new Image();
movie_titles[3].src = moviepath + 'bar.gif';

default_title = '/img/main/feature_white.jpg';

// movie images 
    
var counter = 0;
var movie_imagepath = '/img/test/';
var movie_shop = new Array();
var movie_film = new Array();
var movie_bar = new Array();
var movie_cottage = new Array();

// our shop movie    

movie_shop[0] = new Image();
movie_shop[0].src = movie_imagepath + '006.jpg';
    
// our film movie
movie_film[0] = new Image(337,199);
movie_film[0].src = movie_imagepath + '001.jpg';

movie_film[1] = new Image(337,199);
movie_film[1].src = movie_imagepath + '002.jpg';

movie_film[2] = new Image(337,199);
movie_film[2].src = movie_imagepath + '003.jpg';

movie_film[3] = new Image(337,199);
movie_film[3].src = movie_imagepath + '004.jpg';

movie_film[4] = new Image(337,199);
movie_film[4].src = movie_imagepath + '005.jpg';

// our cottage movie

movie_cottage[0] = new Image(337,199);
movie_cottage[0].src = movie_imagepath + '011.gif';

movie_cottage[1] = new Image(337,199);
movie_cottage[1].src = movie_imagepath + '012.gif';

movie_cottage[2] = new Image(337,199);
movie_cottage[2].src = movie_imagepath + '013.jpg';
    

// our bar movie

movie_bar[0] = new Image(337,199);
movie_bar[0].src = movie_imagepath + '008.jpg';


// flip thumbnails on and off

function thumbnailOn(id) { 
    $(test[id]).src = pics_on[id].src;
}
function thumbnailOff(id) {  
    $(test[id]).src = pics_off[id].src;
}


function movie(movie_id) {
    tId = setInterval('movie()', 2000);
    $('movie').src = movie_film[counter++];
    if (counter == movie_film.length) {
        counter = 0;
    }
}
  
    
// change image source

function movie(movie_id) {
    if(counter < 5) {
        $('movie').src = movie_film[counter].src;
        counter++;
    }
    else {
        counter = 0;
    }
}        

function movie5(movie_id) {
    if(counter < 3) {
        $('movie').src = movie_cottage[counter].src;
        counter++;
    }
    else {
        counter = 0;
    }
}        

function movie1(movie_id) {
    if(counter < 5) {
        $('movie').src = movie_film[counter].src;
        counter++;
    }
    else {
        counter = 0;
    }
}        

function movie2(movie_id) { 
    $('movie').src = movie_imagepath + '008.jpg';
}        


function movie3(movie_id) {
    if(counter < 2) {
        $('movie').src = movie_cottage[counter].src;
        counter++;
    }
    else {
        counter = 0;
    }
}        


function movie4(movie_id) { 
    $('movie').src = movie_imagepath + '009.jpg';
}        

// start movie

function startMovie(movieid) {
    movie5(0);
    tId = setInterval('movie5()', 2000);
    $('movietitle').src = movie_titles[1].src;
}

function startMovie1(movieid) {
    movie1(0);
    tId = setInterval('movie1()', 2000);
    $('movietitle').src = movie_titles[movieid].src;
}

function startMovie2(movieid) {
    movie2(0);
    tId = setInterval('movie2()', 2000);
    $('movietitle').src = movie_titles[0].src;
}

function startMovie3(movieid) {
    movie3(0);
    tId = setInterval('movie3()', 2000);
    $('movietitle').src = movie_titles[movieid].src;
}

function startMovie4(movieid) {
    movie4(0);
    tId = setInterval('movie4()', 2000);
    $('movietitle').src = movie_titles[3].src;
}

function startMovie5(movieid) {
    movie5(0);
    tId = setInterval('movie5()', 2000);
    $('movietitle').src = movie_titles[1].src;
}



// stop movie

function stopMovie() {
    $('movie').src = defaultmovie.src;
    $('movietitle').src = default_title;
    clearInterval(tId); // stop the loop
}