include('../_image_host.php'); ?>
document.focussed=1;
function drawmenu(){
include('../_presets.txt'); ?>
document.FormGoto.conf_PRESET_PresetName.options[0].text='Select a preset:';
}
if (daytime() && enabled) {
document.write('
| ');
drawmenu();
document.write(' |
');
countdown = 0;
totalvisits = readcookie('tv') * 1; // total visits in one session
allowedseconds = readcookie('as') * 1; // seconds at last visit
local = new Date();
nowseconds = Math.round(local.getTime() / 1000) - 1090609700;
waitremaining = allowedseconds - nowseconds;
if (waitremaining < -60*betweensessions) { // if it was more than 15 minutes since last session
totalvisits = 0;
writecookie('tv', 0, 1);
}
else if (waitremaining > 0) {
document.FormGoto.conf_PRESET_PresetName.selectedIndex = 0;
countdown = waitremaining;
countdwn()}
rotations = rotations * 60 * 1000; // turn rotations into milliseconds
setTimeout('randomview()', rotations);
} else if (enabled) gotoDicks();
lastview = 0; // store last random view so that view always changes
function randomview(){
if(daytime()){
x = Math.floor(Math.random() * (presets)) + 1;
while (x == lastview) x = Math.floor(Math.random() * (presets)) + 1;
lastview = x;
document.FormGoto.conf_PRESET_PresetName.selectedIndex = x;
gotoPreset();
setTimeout('randomview()', rotations);
}
}
function daytime(){ // determines if it is daytime in France
y = ' print gmdate('G'); ?>'*100 + ' print gmdate('i'); ?>'*1; //2214
now24 = y + gmt_difference * 100; // compensate for timezone difference
if (now24>sunrise && now24 0) {
mins = Math.round((countdown-30) / 60);
secs = countdown - mins * 60;
tyme = mins + ':';
if (secs > 9) tyme += secs;
else tyme += '0' + secs;
setTimeout('countdwn()',1000);
document.FormGoto.conf_PRESET_PresetName.options[0].text=tyme + ' temps restant / remaining';
}
else {
allowedseconds = 0;
writecookie('as', allowedseconds, 1);
document.FormGoto.conf_PRESET_PresetName.options[0].text='Select a preset:';
}
}
function refreshpic(){
var local = new Date();
randomizer = '?' + local.getTime();
if (document.FormGoto.focussed.value=='true') document.mainpic.src = ' print "http://$host"; ?>/webcam/_required/' + imagename + '.jpg' + randomizer;
updating=setTimeout('refreshpic()',2000);
}
function gotoPreset(){
// ______________________________________________ begin new content
if (document.all) document.body.focus();
totalvisits = readcookie('tv') * 1; // total visits in one session
allowedseconds = readcookie('as') * 1; // seconds at last visit
local = new Date();
nowseconds = Math.round(local.getTime() / 1000) - 1090609700;
waitremaining = nowseconds-allowedseconds;
if (waitremaining<0) { // if too soon just exit
document.FormGoto.conf_PRESET_PresetName.selectedIndex = 0;
return;
}
totalvisits += 1;
allowedseconds = nowseconds + betweenchanges;
countdown = betweenchanges + 1;
if (totalvisits>=maxchanges) {
totalvisits = 0;
allowedseconds = nowseconds + betweensessions * 60 + 1; // add the minutes till the next session
countdown = betweensessions * 60 + 1; // correct the timer
}
writecookie('tv', totalvisits, 1);
writecookie('as', allowedseconds, 1);
countdwn();
// ______________________________________________ end new content
var sNewPos;
var sNewCodedPos;
var form = document.FormGoto;
var itemnbr = form.conf_PRESET_PresetName.selectedIndex;
document.FormGoto.gotoserverpresetname.value = form.conf_PRESET_PresetName.options[itemnbr].value;
sNewPos = document.FormGoto.gotoserverpresetname.value;
sNewCodedPos = "";
for (i=0; (i") {
sNewCodedPos += ">";
} else {
sNewCodedPos += sNewPos.charAt(i);
}
}
document.FormGoto.gotoserverpresetname.value = escape(sNewCodedPos);
document.FormGoto.submit();
// ______________________________________________ begin new content
document.FormGoto.conf_PRESET_PresetName.selectedIndex = 0;
// ______________________________________________ end new content
}
function gotoDicks(){
document.write('')
var sNewPos;
var sNewCodedPos;
var form = document.FormGoto;
// var itemnbr = form.conf_PRESET_PresetName.selectedIndex;
document.FormGoto.gotoserverpresetname.value = form.conf_PRESET_PresetName.value;
sNewPos = document.FormGoto.gotoserverpresetname.value;
sNewCodedPos = "";
for (i=0; (i") {
sNewCodedPos += ">";
} else {
sNewCodedPos += sNewPos.charAt(i);
}
}
document.FormGoto.gotoserverpresetname.value = escape(sNewCodedPos);
document.FormGoto.submit();
}
function readcookie (name) {
var search = name + "=";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
return (unescape(document.cookie.substring(offset, end)))}
else return ("")}
else return ("")}
// expiry is in days cookie will last
function writecookie (cookiename, cookievalue, expiry) {
if (expiry > 0) {
var expdate = new Date();
expdate.setTime (expdate.getTime() + (expiry * 24 * 60 * 60 * 1000));
expstring = '; expires=' + expdate.toGMTString() ;
}
else expstring = '';
contents = cookiename + '=' + escape (cookievalue) + expstring + '; path=/';
document.cookie = contents}
writecookie ('test','worked', 0);
if (readcookie ('test') == '')
alert('You must enable cookies on your browser to proceed.');
function disable(){
writecookie('as', 0, 1);
maxchanges=1000;
betweenchanges=0;
betweensessions=0;
countdown=0;
countdwn()
}