

function fixscroll()
{
	if (document.location.hash)
	{
		if (document.location.hash.charAt(0) == 'I')
		{
			self.pageYOffset = parseInt((''+document.location.hash).substr(2));
		}
		else
		{
			if (document.documentElement)	document.documentElement.scrollTop = parseInt((''+document.location.hash).substr(2));
			else document.body.scrollTop = parseInt((''+document.location.hash).substr(2));
		}
	}
}

function init()
{
	res();
	fixscroll();

	/* inline-block incapable Gecko only */
	if (!window.opera && !document.all && navigator.appName=="Netscape" && parseInt(navigator.appVersion)==5)
	{
		var prod = document.getElementById('product');
		if (prod)
		{
			/* removing nodes from getElementsByTagName opens can of BUGS in gecko */
			var secs0 = prod.getElementsByTagName('span');
			var secs = new Array();
			for(var l=0; l<secs0.length; l++)
			{
				secs[l] = secs0[l];
			}

			for(var l=0; l<secs.length; l++)
			{
				if (secs[l].className=='imgdesc')
				{
					var parnode = secs[l].parentNode;

					var but = document.createElement('button');
					but.style.width = secs[l].style.width;
					secs[l].parentNode.removeChild(secs[l]);
					but.className = 'imgdesc';
					but.innerHTML = secs[l].innerHTML;
					parnode.appendChild(but);
					but.onclick = function() {this.blur();return false;}
				}
			}
		}
	}

	var cu = document.getElementById('callus');
	if (cu)
	{
		cu.className = 'js';
		var cuc = document.getElementById('callusclick');
		cuc.onclick = function() {cu.className = cu.className!='js'?'js':'js open';return false;}
		cuc.ondbclick = function() {return false;}
		cuc.onmouseover = function() {this.className='hover';}
		cuc.onmouseout = function() {this.className='';}
	}

	var a = document.getElementsByTagName('form');
	for(var i=0;i<a.length;i++)
	{
		a[i].onsubmit = function()
		{
			var y;
			if (self.pageYOffset) // all except Explorer
			{
				y = '#I' + self.pageYOffset;
			}
			else if (document.documentElement && document.documentElement.scrollTop)
			{
				y = '#l' + document.documentElement.scrollTop;
			}
			else if (document.body)
			{
				y = '#l' + document.body.scrollTop;
			}

			if (y) {
				var url = this.action+'';
				if (url.indexOf('#')>0) url = url.substr(0,url.indexOf('#')-1);
				this.action = url;
			}
			return true;
		}

		if (window.ActiveXObject && !window.opera)
		{
			var b = a[i].getElementsByTagName('button');
			for(u=0;u<b.length;u++)
			{
				b[u].onclick = function()
				{
					window.onresize = null;
					var w = this.offsetWidth;
					var h = this.offsetHeight;
					this.style.width = w + 'px';
					this.style.height = h + 'px';
					this.style.border = 'none';
					this.style.padding = '0px';
					this.innerHTML = '1';
					return true;
				}
			}
		}
	}
}



function res()
{
	var w= self.innerWidth || (document.body && document.body.clientWidth) || self.screen.width;
	if (!w) return;

	var cn = w>1000?'thick':w<770?'thin':'';
	if (document.body.className != cn) document.body.className = cn; // prevent ie flicker
}

window.onresize=res;

window.onload = function ()
{
	res();
	fixscroll();

	//var x = document.getElementById('FSubmitsCancel');
	//if (x) x.onclick = function() {return confirm('Are you sure?');}

	var selects = document.getElementsByTagName('select');
	for(var i=0;i<selects.length;i++)
	{
		if (selects[i].className=='postback')
		{
			selects[i].onchange = function()
			{
				var n = this.nextSibling;
				while(n.nodeType==3) n = n.nextSibling;
				n.value="Setting...";
				n.style.display='';
				this.form.submit();
			}
			var n = selects[i].nextSibling;
			while(n.nodeType==3) n = n.nextSibling;
			n.style.display = 'none';
		}
	}
}

