/* RangeCheck (c)odbc3@hotmail.com
After linking to this file, add items to check as:
rangelist[0]=new rangeok(id,lowest, upper);
rangelist[1]=new rangeok('mying1',400, 99999);
*/

/* make sure the check is done at load and on change of width */
window.onresize=checkwidth
window.onload=checkwidth

function innerwidth()
{
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  return window.innerWidth;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  return document.body.offsetWidth;
	 }
	}
	return 0;
}

/* Work out which items are still in range to be displayed */
function checkwidth()
{
	var winW = innerwidth();
	if (winW==0)
	{
		return;
	}
	for(i=0;i<rangelist.length;i++) {
		displaystate = (winW >= rangelist[i].lower && winW <= rangelist[i].upper) ? 'block' : 'none';
		setdisplay(rangelist[i].id,displaystate);
		//alert(rangelist[i].id+':'+displaystate);
	}
}

/* Will set the object to a state (block/none) */
function setdisplay(id, state)
{
	if (document.layers)
	{
		document.layers[id].display = state;
	}
	else if (document.all)
	{
		document.all[id].style.display = state;
	}
	else if (document.getElementById)
	{
		document.getElementById(id).style.display = state;
	}
}

/* Structure to hold each ID and range parameters */
function rangeok(id, lower, upper) {
	this.id = id
	this.lower = lower
	this.upper = upper
}

/* initial list of ranges */
var rangelist = new Array()

