/*var timer = 5000; // set low at first to cycle through and reload quickly

var auto_refresh = setInterval(
    function()
    {
	if ()
	updateData();
    }, timer);

function updateData()
{
    // todo - reload.php needs to have session name added to it
    mydata = $('#updatedInfo').fadeOut('fast').load('reload.php').fadeIn("fast");
    //document.getElementById(boxName).style.display='none';
    //var weatherData = ($('#updatedInfo').get()).split(",");
    var weatherData = mydata.text().split(",");
    if (weatherData[0].length > 0)
    {
	document.getElementById('currentTemp').innerHTML = weatherData[0];
	document.getElementById('currentHumidity').innerHTML = weatherData[1];
	document.getElementById('maxTempToday').innerHTML = weatherData[2];
	document.getElementById('minTempToday').innerHTML = weatherData[3];
	refreshImage();
	timer = 1000;
    }
}*/

//var imageCount = document.getElementById('imageCount').value;
var skip = 9999; // don't ski'
function refreshImage()
{
    if (skip > 5) // skip 5 times
    {
	var imageList = document.getElementById('imageList').value.split(",");
	randomAppend = new Date();
	randomAppend = "?" + randomAppend.getTime();
	//alert (imageList.length);
	for (i = 0; i < imageList.length; i++)
	{
	    //alert(imageList[i] + randomAppend);
	    document.images["webImage"+i].src = imageList[i] + randomAppend;
	}
	skip = 0;
	//alert("not skipping");
    }
    else
	skip++;
    //setTimeout("refreshImage()", imageTimer);
}

var imageTimer = 5000;
/*
var imageSource = "uploads/image.<?php echo $uid ?>.jpg";
function refreshImage()
{
    temp = new Date();
    temp = "?" + temp.getTime();
    document.images["webImage"].src = imageSource + temp;
    //setTimeout("refreshImage()", imageTimer);
}*/
//dojo.addOnLoad(updateData);

function gotofriendlyname()
{
    if (document.getElementById('friendlyname').value.length == 0)
    {
	alert("Please specify a weather station to visit first!");
	return;
    }
    newstationpage = document.getElementById('friendlyname').value;
    window.location = newstationpage;
}

function gotofriendlynamemobile()
{
    if (document.getElementById('friendlyname').value.length == 0)
    {
	document.getElementById('friendlyname').value = 'please specify a station';
	return;
    }
    newstationpage = document.getElementById('friendlyname').value;
    window.location = newstationpage;
}
