function openWindow(strFile, strWidth, strHeight)
	{
		//create URL
		var strLocation;
		strLocation = 'zoom_window.asp?imgsrc=' + strFile + '&strWidth=' + strWidth + '&strHeight=' + strHeight ;
		
		var intScreenX, intScreenY;
		var intImageX, intImageY;
		var intWidth, intHeight;
		
		intScreenX = parseInt((screen.width)*.90); //minus margin
		intScreenY = parseInt((screen.height)*.90); //minus margin
		
		intImageX = parseInt(strWidth) + 50; //plus padding
		intImageY = parseInt(strHeight) + 80; //plus padding (including button)
		
		//if the screen is wider than the image, go with the image
		//otherwise, go with the screen width
		if (intScreenX > intImageX) {
			intWidth = intImageX
		} else {
			intWidth = intScreenX
		}
			
		//if the screen is taller than the image, go with the image
		//otherwise, go with the screen height
		if (intScreenY > intImageY) {
			intHeight = intImageY
		}
		else	{
			intHeight = intScreenY
		}

		
		var strOptions = "status=yes,scrollbars=yes,resizable=yes,width=" + intWidth + ",height=" + intHeight + ",screenX=0,screenY=0";
		//Open the window.
		window.top.open(strLocation,'jsOpen',strOptions);

	}
	
function initTabs() {
		
}
	
function tabChange(tabNumber) {
	
	var tabNodes = document.getElementById('contents').getElementsByTagName('div');
	
	for (var i = 0; i<=tabNodes.length; i++) {
		
		var objectName = "tabContent" + [i];
		if (document.getElementById(objectName)) {
			if (i == tabNumber) {
				document.getElementById(objectName).style.display = 'block';
			} else {
				document.getElementById(objectName).style.display = 'none';
			}
		}	
	}
	
	colorCurrentTab(tabNumber);
}

function hideTabs() { 
	
	if (document.getElementById('contents')) {
	
		//Hide any tab items
		var tabNodes = document.getElementById('contents').getElementsByTagName('div');
		
		for (var i = 1; i<=tabNodes.length; i++) {
			
			var objectName = "tabContent" + [i];
			
			if (document.getElementById(objectName)) {
				document.getElementById(objectName).style.display = 'none';
			}
		}
	}
}

function colorCurrentTab(tabNumber) {
	
	if (document.getElementById('tab_container')) {
		 
		//Get tab items
		var tabNodes = document.getElementById('tab_container').getElementsByTagName('a');
		var objectName;
		
		for (var i = 0; i<=tabNodes.length; i++) {
		
			objectName = "tab" + [i];
			if (document.getElementById(objectName)) {
				if (i == tabNumber) {
					document.getElementById(objectName).childNodes[0].className = 'current';
				} else {
					document.getElementById(objectName).childNodes[0].className = '';
				}
			}	
		}
	}
}

function linkTypes() {
	/*var links = window.document.getElementsByTagName("a");
	
	for(var i = links.length - 1; i > -1; i-- ) {

		var currentLink = links[i];
		var anyImages = currentLink.getElementsByTagName("img");
		
		if (anyImages.length != 0) return false;

		var currentLinkHref = currentLink.href;
		var currentLinkParts = currentLinkHref.split(".");
		var currentLinkExtension = currentLinkParts[currentLinkParts.length - 1];
		currentLinkExtension = currentLinkExtension.replace("/", "");
		currentLinkExtension = currentLinkExtension.toLowerCase()
		
		if( currentLinkExtension in { doc:1, pdf:1, ppt:1, txt:1, xls:1, zip:1, xlt:1, dot:1 } ){
			
			var newImage = document.createElement("img")
			var imgSrc = "http://www.preferred-mfg.com/images/icons/inline_" + currentLinkExtension + ".gif";
			var imgTitle = "This link points to a " + currentLinkExtension.toUpperCase() + " file.";
			var imgAlt = currentLinkExtension.toUpperCase() + " icon";
			newImage.setAttribute("src",imgSrc);
			newImage.setAttribute("class","inlineImg");
			newImage.setAttribute("alt",imgAlt);
			newImage.setAttribute("title",imgTitle);
			
			//currentLink.parentNode.insertBefore(newImage,currentLink.nextSibling);
			currentLink.parentNode.insertBefore(newImage,currentLink);
		}
	}*/
}

function clearSearchBox() {
	if ($('search_input').value="Search our site") { $('search_input').value=""; }
}

function pageInit() {
	hideTabs();
	//var firsttime = new Date().getTime();
	linkTypes();
	//var lasttime = new Date().getTime();
	//var time = lasttime - firsttime;
	//document.getElementById("footer").innerHTML = time;
	var search_input = $('search_input');
	if (search_input) {
		Event.observe(search_input, 'focus', clearSearchBox);
	}
}

// Event.observe(element, name, observer, [useCapture]);
Event.observe(window, 'load', pageInit);


