/********************************************************************
These are scripts designed for the shaunwagner.com website.
All scripts have been written by CS Wagner and are copyrighted.
Please feel free to use what you can from these scripts if you like.
You will not receive any support if you need help making them work
for your own website.
*********************************************************************/

function kainaw_init()
{
	var maindiv = document.getElementById("maindiv");
	var footerdiv = document.getElementById("foot");

	// Make the main div take up the whole display area.
	diff = footerdiv.offsetTop - maindiv.offsetTop - maindiv.offsetHeight;
	maindiv.style.height = (maindiv.offsetHeight+diff-3)+"px";

	// Make the main div take up the whole display width.
	diff = footerdiv.offsetWidth - maindiv.offsetWidth - 50;
	maindiv.style.width = (maindiv.offsetWidth+diff)+"px";
}

window.onresize=kainaw_init;

var rw = 60;
function reload_webcam()
{
	var webcam = document.getElementById("webcam");
	if(webcam == null) return;
	var seconds = document.getElementById("seconds");
	if(seconds == null) return;
	seconds.innerHTML = rw;
	rw--;
	if(rw == 0)
	{
		// This will reload the image withe a unique get string appended.
		// The purpose of the get string is to avoid caching.
		var src = webcam.src;
		var pos = src.indexOf('?');
		if(pos >= 0)
			src = src.substr(0,pos);
		var date = new Date();
		webcam.src = src+"?v="+date.getTime();
		rw = 60;
	}
	else
	{
		setTimeout("reload_webcam()", 1000);
	}
}

