  // Miscellaneous site functions, etc
  function resize_align_window(width,height)
		{
			var winLeft = (screen.width - width) / 2;
			var winTop 	= (screen.height - height) / 2;
			window.resizeTo(width,height);
			window.moveTo(winLeft,winTop);
		}
	function hidepopwindow()
		{
			document.getElementById('pop-target').innerHTML = '';
		}
	function clearLink(objId)
		{
			//This enables browsers with javascript to remove an href value
			//from a tab button. This href allows for non-js enabled browsers to 
			//navigate the tabs.
			btnObj = document.getElementById(objId);
			htmlString = btnObj.innerHTML;
			//replace link with a non-navigating link.
			regExp = /href="[^>]*"/;
			newHTML = htmlString.replace(regExp,"href='javascript:void(0);'");
			btnObj.innerHTML = newHTML;	 
		}
  
  	function setStyle(objId,pcStyle,pcValue)
		{
			//setStyle('content','overflow','visible')
			document.getElementById(objId).style[pcStyle] = pcValue;
		}
	function setClass(objId,className)
		{
			document.getElementById(objId).className = className;
		}
  	function swapVis(idOn, idOff){
		var obj = document.getElementById(idOn);
		obj.style.visibility = "visible";
		obj.style.display = "block";
		
		var obj = document.getElementById(idOff);
		obj.style.visibility = "hidden";
		obj.style.display = "none";
	}
	function toggleDisplay(layerid){
		var obj = document.getElementById(layerid);
		var newdisplay;
		if(obj.style.display != "none"){
				 newdisplay = "none";
			 }else{
				 newdisplay = "";	
			 }
		obj.style.display = newdisplay;	
	}


			function showTab(objId,pbUpdateFormAction,pb_clear_link)
		{
			//if(pb_clear_link !== false) clearLink(objId);
			// Control a group of tabbed buttons 
			// Hide all groups first in case the selected group is included in the hide list
			splitName = objId.split("-");
			groupNum = splitName[splitName.length-1];
			splitName.pop(); //Remove the number Id for the tab group
			splitName.shift(); //Remove the "btn" part of the btn element id 
			tabNavGroupName = splitName[splitName.length-1];
			groupName = splitName.join("-");
			if(pbUpdateFormAction) setFormTabAction(tabNavGroupName+"-"+groupNum, tabNavGroupName);
		
			hideAllTabs(groupName); 	
			show(groupName + "-" + groupNum);	
				
			//Set all standard button CSS before the selected
			
			for(var i=1;i<=100;i++)
				{
					nextBtn = "btn-" + groupName + "-" + i;
					if(!document.getElementById(nextBtn))
						{
							break;
						}
					 document.getElementById(nextBtn).className = "btn-tab tabs_b";
				}
			//Set CSS for selected Button
			if(document.getElementById(objId))
				document.getElementById(objId).className = "btn-tab-selected tabs_b_selected";
		}
	
		
	function setFormTabAction(pcTabGroupId, pcGroupName)
		{
			//UPDATE FORM ACTIONS:
			/*
				For javascript enabled browsers, we want to update all the forms on a 
				page to target the current page AND tab, so the resulting display
				is not confusing to the user. (ie, the default tab displaying on post
			*/
			for(i=0;i<=100;i++)
				{
					if(!document.forms[i])
						{
							//Stop if there is no more forms
							break;
						}
					//FORCE THIS FORM TO SUBMIT TO A TAB
					formAction = document.forms[i].action;
					splitAction = formAction.split("?");
					//SET THE BASE ACTION TO THE CURRENT PAGE IF ONE IS SET
					document.forms[i].action = splitAction[0];
					//splitAction[1] contains the QUERY STRING
					if(splitAction[1]!= undefined)
						{
							//Tab has been added, so remove it, then add it again.
							//Add back all the parameters except the tab
							actionElements = splitAction[1].split("&");
							for(m=0;m<actionElements.length;m++)
								{
									//determine if the current tab group has a value value.
									if(actionElements[m].indexOf(pcGroupName)!=-1)
										{
											//REMOVE the OLD tab group value from the query string
											actionElements.splice(m,1);
											break;
										}
								}
							//ADD NEW GROUP VALUE
							document.forms[i].action += "?" + actionElements.join("&");
						}
					//ADD THE TAB TO THE ACTION
					//Each group can have one tab showing.
					document.forms[i].action += "&"+pcGroupName+"="+pcTabGroupId;
					// document.getElementById(nextBtn).className = "btn-tab";
				}
		}

  	function tabGrp(selectedGroup,hideGroups,btnId,allBtns,btnSelectedCss,btnCss)
	//'distributors',tabGroup,this.id,tabBtnGroup,'btn-tab-selected','btn-tab'
		{
			/* Control a group of tabbed buttons */
			// Hide all groups first in case the selected group is included in the hide list
			
			hideGroup(hideGroups); 
			
			show(selectedGroup);
			
			//Set all standard button CSS before the selected in case the selected is included in the list
			if(!void(btnCss))
				 {
					btnList = allBtns.split(",");
					count=(btnList.length-1);
					for(i=1;i<=count;i++)
						{
							 document.getElementById(btnList[i]).className = btnCss;
						}
				 }
			//Set CSS for selected Button
			if(!void(btnSelectedCss))
				 {
					 document.getElementById(btnId).className = btnSelectedCss;
				 }
				/* */
		}
	if (!window.Element) var Element = new Object();
	if(!window.Element.show)
	{
		Element.show = function(elementID)
		{
			document.getElementById(elementID).style.visibility = 'visible';
			document.getElementById(elementID).style.display = '';
		}
		Element.hide = function(elementID)
		{
			document.getElementById(elementID).style.visibility = 'hidden';
			document.getElementById(elementID).style.display = 'none';
		}
	}
	function show(elementID)
		{
			/* Show a hidden element */
			document.getElementById(elementID).style.visibility = 'visible';
			document.getElementById(elementID).style.display = '';
		}
	function hide(elementID)
		{
			/* Hide an element */
			document.getElementById(elementID).style.visibility = 'hidden';
			document.getElementById(elementID).style.display = 'none';
		}
	function hideAllTabs(groupName)
		{
			for(tabcount=1;tabcount<=100;tabcount++)
				{
					nextTabGroup = groupName + "-" + tabcount;
					if(!document.getElementById(nextTabGroup))
						{
							break;
						}
					hide(nextTabGroup);
				}
		}
		
	function hideGroup(elementIDList)
		{
			//DEPRECATED: Use hideAllTabs()
			/* Hide a list of elements */
			elementList = elementIDList.split(",");
			count = (elementList.length-1);
			for(i=0;i<=count;i++)
			{
				hide(elementList[i]);
			}
		}

	function OpenWin(URL, winName, width, height, scroll)
	{
		var winLeft = (screen.width - width) / 2;
		var winTop 	= (screen.height - height) / 2;
													
		winData = 'height='+height+',width='+width+',top='+winTop+',left='+winLeft+',scrollbars='+scroll+',resizable';
		win = window.open(URL, winName, winData);
													
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
	
winName = '';
var popwin;
function openWindow(URL, winName, width, height, scroll,modal)
	{
		 if(popwin != null) popwin.close();
		//alert(winName);
		var winLeft = (screen.width - width) / 2;
		var winTop 	= (screen.height - height) / 2;
													
		winData = 'height='+height+',width='+width+',top='+winTop+',left='+winLeft+',scrollbars='+scroll+',resizable,modal='+modal+',status=false';
		popwin = window.open(URL, winName, winData);
			//alert(winData);										
		popwin.focus(); 
	}		
