﻿var BaseURL = "http://livecam.mora.se/";

// This is the filepath to the image generating file inside the camera itself
var Image1 = "image.jpg";
var Image2 = "imagez.jpg";
var Image3 = "image2.jpg"

// Force an immediate image load
var theTimer = setTimeout("reloadImage()",1);

function reloadImage() {
    theDate = new Date();
    var url1 = BaseURL;
    url1 += Image1;
    url1 += "?timestmap=";
    url1 += theDate.getTime().toString(10);
    
    var url2 = BaseURL;
    url2 += Image2;
    url2 += "?timestmap=";
    url2 += theDate.getTime().toString(10);
    
    var url3 = BaseURL;
    url3 += Image3;
    url3 += "?timestmap=";
    url3 += theDate.getTime().toString(10);
    
    // The above dummy cgi-parameter enforce a bypass of the browser image cache.
    // Here we actually load the image
    try {
        $("img#Kyrkan").attr('src',url1);
        $("img#KyrkanZorn").attr('src',url2);
        $("img#Skidstadion").attr('src',url3);   
    } catch(e) {}

    // Reload the image every 10 seconds (10000 ms)
    theTimer1 = setTimeout("reloadImage()",5000);   
}