// JavaScript Document

function setCheckboxes(the_form)
{
	var elts = document.getElementById(the_form).elements;
	var x = document.getElementById("checkboxAll");
	for (var i = 0; i < elts.length; i++)
	{
		if (elts[i].type == 'checkbox')
		{
			if (x.checked)
			{
				elts[i].checked = true;
			}
			else
			{
				elts[i].checked = false;
			}
		}
	}
}


function cancelSelAll()
{
	var x = document.getElementById("checkboxAll");
	x.checked = false;
}


function openFullWin()
{
	this.resizeTo(screen.availWidth, screen.availHeight);
	this.moveTo(0, 0);
	this.focus();
}


var termsWin = 0;
function openTerms(url)
{
	var xcen = (screen.availWidth - 500) / 2;
	var ycen = (screen.availHeight - 300) / 2;
	if(termsWin)
	{
		if(!termsWin.closed) termsWin.close();
	}
	termsWin = open(url, 'termsWin', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no, height=300, width=500, screenX=' + xcen + ', screenY=' + ycen + ', left=' + xcen + ', top='+ycen);
}


function OpenThumb(spicURL,sTitle)
{
	var xcen = (screen.availWidth-100)/2;
	var ycen = (screen.availHeight-100)/2;
	window.open("thumbviewer.html?" + spicURL + "?" + sTitle, "", "status=yes,resizable=1,height=100,width=100,left=" + xcen + ",top=" + ycen);
}


var arrTemp = self.location.href.split("?");
var picURL = (arrTemp.length > 1)? arrTemp[1]:"";
var iTitle = (arrTemp.length > 2)? arrTemp[2]:"";
var NS = (navigator.appName == "Netscape")? true:false;


function FitPic()
{
	iWidth = (NS)? window.innerWidth:document.body.clientWidth;
	iHeight = (NS)? window.innerHeight:document.body.clientHeight;

	iWidth = document.images[0].width - iWidth;
    iHeight = document.images[0].height - iHeight;
    window.resizeBy(iWidth+30, iHeight-1+30);

	var xcen = (screen.availWidth-document.body.clientWidth)/2;
	var ycen = (screen.availHeight-document.body.clientHeight)/2;
	window.moveTo(xcen,ycen);
    self.focus();
}


var siteMapWin=0;


function siteMap(URLStr, width)
{
	self.name = "topnavigation";
	w = screen.availWidth-width-3;
	h = screen.availHeight;
	self.resizeTo (w, h);
	self.moveTo (0, 0);
	if (siteMapWin)
	{
    	if (!siteMapWin.closed) siteMapWin.close();
	}
	siteMapWin = open(URLStr, 'siteMapWin', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+screen.availHeight+',left='+w+', top='+0+',screenX='+w+',screenY='+screen.availHeight+'');
	siteMapWin.focus();
}


function siteMapCloser()
{
	opener.resizeTo (screen.availWidth, screen.availHeight);
	opener.moveTo (0, 0);
}