// common.js
// standard helper functions for use throughout the site

// hide h1 and h2 tags
function hideHeaders()
{
 if (document.getElementsByTagName("h1")[0]) document.getElementsByTagName("h1")[0].style.display="none";
 if (document.getElementsByTagName("h2")[0]) document.getElementsByTagName("h2")[0].style.display="none";
}

// popup functions
// v2.0
function MM_openBrWindow(theURL,winName,features)
{ 
	window.open(theURL,winName,features);
}

// opens a new window and forces IE not to resize the picture
function popup(source,width,height,scrollers)
{
	var is_scroller = 0;

	if(scrollers == 1) is_scroller = 1;

	var dev_width = screen.availWidth-10;
	var dev_height = screen.availHeight-30;

	if(dev_width < width)
	{
		var width = dev_width;
		is_scroller = 1;
	}

	if(dev_height < height)
	{
		var height = dev_height;
		is_scroller = 1;
	}

	var X = (dev_width-width)/2;
	var Y = (dev_height-height)/2;
	var params = "width="+width+",innerWidth="+width;

	params+= ",height="+height+",innerHeight="+height;
	params+= ",left="+X+",screenX="+X;
	params+= ",top="+Y+",screenY="+Y;
	params+= ",resizable=yes";

	if(is_scroller == 1) params += ",scrollbars";

	window.open("/images/popup.asp?path="+escape(source)+"&width="+width+"&height="+height,"_blank",params);

}

//use to set default button
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
}