// BEGIN: Non-encapsulated variable initialization

Array.prototype.push = function(value) {this[this.length] = value; };

var ie=document.all;
var ns6=document.getElementById && !document.all;		

if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}

var findSuppliesDiv=document.getElementById('findSupplies');
var EFWindow=document.getElementById('suppliesSearchWindow');
var EFWindowOrigin=0;

var oPoint=0;
var myLeft=0;
var myTop=0;

// END: Non-encapsulated variable initialization

// BEGIN: Function Declarations
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function updateVerticalScrollbar(){
	if (window.pageYOffset){
	  scrollbarY=window.pageYOffset;
	}else if (document.documentElement && document.documentElement.scrollTop){
	  scrollbarY=document.documentElement.scrollTop;
	}else if (document.body){
	  scrollbarY=document.body.scrollTop;
	}
	return scrollbarY;
  }

function hideEquipmentFinder(whichCopy)
{
	EFWindow.style.display='none';

	for (f = 0; f < document.forms.length; f++)
	{
		var elements = document.forms[f].elements;
		// looping through all elements on certain form
		for (e = 0; e < elements.length; e++)
		{
			if (elements[e].type == "select-one")
			{
				elements[e].style.display = 'inline';
			}
		}
	}
}

function showEquipmentFinder()
{
	EFWindow.style.display='block';	
	for (f = 0; f < document.forms.length; f++)
	{
		var elements = document.forms[f].elements;
		// looping through all elements on certain form
		for (e = 0; e < elements.length; e++)
		{
			if (elements[e].type == "select-one")
			{
				elements[e].style.display = 'none';
			}
		}
	}

	if (oPoint==0) { oPoint=findPos(findSuppliesDiv)[1]; }
	// if (myLeft==0) { myLeft = (x/2)-234; }
	if (myLeft==0) { myLeft = 154; }
	if (myTop==0) { myTop=oPoint+findSuppliesDiv.offsetHeight-EFWindow.offsetHeight; }
	EFWindow.style.left=myLeft+"px";
	EFWindow.style.top=myTop+"px";
}
// END: Function Declarations

// BEGIN: Page load activities

EFWindow.className='jsCompliantFinder';
// END: Page load activities
