// Skycam Javascript

cameraURL=new Array();
cameraURL[0] ='http://www.wgme.com/newsroom/wx/skycams/images/port.jpg';
cameraURL[1] ='http://www.wgme.com/newsroom/wx/skycams/images/newshot.jpg';
cameraURL[2] ='http://www.wgme.com/newsroom/wx/skycams/images/Ray.jpg';
cameraURL[3] ='http://www.wgme.com/newsroom/wx/skycams/images/unim.jpg';

labels_small = new Array();
labels_small[0] = "http://www.wgme.com/newsroom/wx/skycams/images/sm_portland.jpg";
labels_small[1] = "http://www.wgme.com/newsroom/wx/skycams/images/sm_oob.jpg";
labels_small[2] = "http://www.wgme.com/newsroom/wx/skycams/images/sm_raymond.jpg";
labels_small[3] = "http://www.wgme.com/newsroom/wx/skycams/images/sm_unum.jpg";

labels_large = new Array();
labels_large[0] = "http://www.wgme.com/newsroom/wx/skycams/images/lg_portland.jpg";
labels_large[1] = "http://www.wgme.com/newsroom/wx/skycams/images/lg_oob.jpg";
labels_large[2] = "http://www.wgme.com/newsroom/wx/skycams/images/lg_raymond.jpg";
labels_large[3] = "http://www.wgme.com/newsroom/wx/skycams/images/lg_unum.jpg";

map = new Array();
map[0] = "http://www.wgme.com/newsroom/wx/skycams/images/map_portland.jpg";
map[1] = "http://www.wgme.com/newsroom/wx/skycams/images/map_oob.jpg";
map[2] = "http://www.wgme.com/newsroom/wx/skycams/images/map_raymond.jpg";
map[3] = "http://www.wgme.com/newsroom/wx/skycams/images/map_unum.jpg";

theTime = 60;

function initCameras ()
{
    now = new Date();
	
	document.getElementById('wc_main').src=cameraURL[0]+ '?' + now.getTime();
	document.getElementById('wc_sm1').src=cameraURL[1]+ '?' + now.getTime();
	document.getElementById('wc_sm2').src=cameraURL[2]+ '?' + now.getTime();
	document.getElementById('wc_sm3').src=cameraURL[3]+ '?' + now.getTime();
	
	document.getElementById('label_main').src = labels_large[0];
	document.getElementById('label_sm1').src = labels_small[1];
	document.getElementById('label_sm2').src = labels_small[2];
	document.getElementById('label_sm3').src = labels_small[3];
	
	document.getElementById('wc_map').src = map[0];

}

function swapCamera(cam1, cam2)
{
	temp=cameraURL[cam1];
	cameraURL[cam1] = cameraURL[cam2];
	cameraURL[cam2] = temp;
	
	temp=labels_small[cam1];
	labels_small[cam1] = labels_small[cam2];
	labels_small[cam2] = temp;
	
	temp=labels_large[cam1];
	labels_large[cam1] = labels_large[cam2];
	labels_large[cam2] = temp;
	
	temp=map[cam1];
	map[cam1] = map[cam2];
	map[cam2] = temp;
	
}

function cycleCameras ()
{
	theTimer = document.getElementById('timer');
	theTimer.value = theTime
	theTime=theTime-1;
	
	if (theTime==0)
	{
		temp=cameraURL[0];
		for (var i = 0; i < 3; i++)
		{ 
			cameraURL[i]=cameraURL[i+1]
		}
		cameraURL[3]=temp;

		initCameras();
		theTime=60;
	}
}

function showTimer ()
{
	theTimer = document.getElementById('timer');
	theTimer.value = theTime
	theTime=theTime-1;
	
	if (theTime==0)
	{
		initCameras();
		theTime=60;
	}
	
}

