<!-- // begin hiding

//	Function: LoadHomepageFlash()
//	Developer: GBC
//	Description:	This function is a work-around to the new Internet Explorer behavior
//	whereby any embedded objects (Flash, Java Applets, ActiveX controls, etc.) are
//	loaded in an "inactive" state.  In order to use these controls, the user would need to
//	click on the cotrol to put it into an "activated" state.  See the following for further details:
//
//	http://www.adobe.com/devnet/activecontent/articles/devletter.html
//	and
//	http://support.microsoft.com/kb/912945/en-us
//
//	Embedded controls will work fine as long as they are created progamatically, hence this function.
//	If the user has JavaScript disabled in their browser, the homepage will not display the Flash 
//	animation and the homepage will become far less functional.  Reason #212 that Flash is Evil(TM).
function loadHomepageFlash()
{
	var flashDiv = document.getElementById("flashContainer");
	var sFlashContent;
	
	flashDiv.innerHTML = '';
  sFlashContent = '								<object type="application/x-shockwave-flash" data="/flash/HPmenu.swf" width="850" height="335" id="movie1">\n'
  sFlashContent += '								<param name="movie" value="/flash/HPmenu.swf" />\n'
	sFlashContent += '								<param name="autoStart" value="-1" />\n'
	sFlashContent += '								<table width="100%" cellpadding="0" cellspacing="0" border="0">\n'
	sFlashContent += '									<tr>\n'
	sFlashContent += '										<td>\n'
	sFlashContent += '<!-- BEGIN Segment Nav * -->\n'
	sFlashContent += '<div id="nav_segment"><a href="/advancing/" title="Universities, Research Institutions, Government Agencies" >Advancing Outcomes</a><a href="/developing/" title="Pharmaceutical, Biotechnology, Medical Device Companies" class="center_nav">Developing &amp; Evaluating New Treatments</a><a href="/improving/" title="Improving Care Delivery">Improving Care Delivery</a></div>\n'
	sFlashContent += '<!-- END Segment Nav * -->\n'
	sFlashContent += '										</td>\n'
	sFlashContent += '									</tr>\n'
	sFlashContent += '									<tr>\n'
	sFlashContent += '										<td class="noFlash">\n'
	sFlashContent += '											<h5>Flash Player Plugin not detected</h5>\n'
  sFlashContent += '											<p>\n'
  sFlashContent += '												In order to use all of the interactive features found on the QualityMetric.com website, you will need to have the Adobe Flash Player plugin installed and enabled in your web browser.\n'
  sFlashContent += '												<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank" title="Download Adobe Flash Player">You may download the Flash Player plugin from Adobe.com.</a>\n'
  sFlashContent += '												Once you have the Flash Player installed, return to the QualityMetric.com site, refresh the page, and you will now be able to use the interactive features of the site.\n'
  sFlashContent += '											</p>\n'
	sFlashContent += '										</td>\n'
	sFlashContent += '									</tr>\n'
	sFlashContent += '								</table>\n'
  sFlashContent += '							</object>\n'
	document.write(sFlashContent);
	flashDiv.outerHTML = '';
	//flashDiv.innerHTML = sFlashContent;
}

// NOTE: Carried over from 'main.js'.
//================================================================
var nWidth;var nHeight;
if (navigator.appName.substring(0,1)+navigator.appVersion.substring(0,1)=="N3")
{nWidth = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width; 
nHeight = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height;}
else
{nWidth = screen.width; nHeight = screen.height;}
nWidth = (nWidth - 620)/2 + 620;nHeight = (nWidth/2.042);

function openWindowSize(theURL,winName,size)
{window.open(theURL,winName,"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,"+size);}

function openWindowSizeScroll(theURL,winName,size)
{window.open(theURL,winName,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,"+size);}

function openWindowNScroll(URL, Title){
window.open(URL,Title,"width="+nWidth+",height="+nHeight+",resizable=yes,status=yes,toolbar=no,directories=no,menubar=no");}

function openWindowScroll(URL, Title){
window.open(URL,Title,"width="+nWidth+",height="+nHeight+",resizable=yes,status=yes,toolbar=no,directories=no,menubar=no, scrollbars=yes");}

function CheckoutStart(){
	document.location.href='/products/CheckoutAddress.aspx';
}

function AdminCheckoutStart(){
	document.location.href='/admin/order_placement/AdminCheckoutAddress.aspx';
}
//================================================================
function styleSetter() {

	var os; 
	var browser;
	
	document.write("<link rel=\"alternate\" title=\"RSS Feed\" href=\"/rss/qm_rss.rss\" type=\"application/rss+xml\">");
	
	if (navigator.userAgent.indexOf("Mac")!=-1)
	{
		os="mac"
	} 
	else 
	{
		os="win"
	};
	
	if (navigator.userAgent.indexOf("Microsoft Internet Explorer")!=-1 || navigator.appName.indexOf("IE")!=-1 || navigator.appName.indexOf("Internet Explorer")!=-1) 
	{
		browser="ie"
	} 
	else if (navigator.userAgent.indexOf("Opera")!=-1)
	{
		browser="opera"
	}
	else if (navigator.userAgent.indexOf("WebKit")!=-1)
	{
		browser="safari"
	}
	else
	{
		browser="netscape"
	};

	if (os=="mac") 
	{ 
		document.write("<link rel=\"StyleSheet\" href=\"/css/mac_styles.css\" type=\"text/css\">");
		if (navigator.userAgent.indexOf("Firefox")!=-1) 
		{
			document.write("<link rel=\"StyleSheet\" href=\"/css/mac_firefox_styles.css\" type=\"text/css\">");
		};
	}
	else if (browser=="netscape") 
	{
		document.write("<link rel=\"StyleSheet\" href=\"/css/mozilla_styles.css\" type=\"text/css\">");
	}
	
	else if (browser=="opera") 
	{
		document.write("<link rel=\"StyleSheet\" href=\"/css/non_IE_styles.css\" type=\"text/css\">");
	}
	else if (browser=="safari") 
	{
		document.write("<link rel=\"StyleSheet\" href=\"/css/mac_styles.css\" type=\"text/css\">");
	}
}

function clearText(form)	{
	form.Terms.value='';
}

function checkSearchTerm(form) {
	if (form.Terms.value=='Search QualityMetric' || form.Terms.value=='') {
		alert('Please enter your search terms.');
		form.Terms.value='';
		form.Terms.focus();
	}
	else {
		document.forms['searchform'].submit();
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i< changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadImages() {
	if (document.images) {
		search_over = newImage("/images/search_over.gif");
		preloadFlag = true;
	}
}

var timeCount = 0;
var opacityId;
function expandStory(storyID){
	var storyDiv = document.getElementById(storyID);
	var opacityLevel;
	if (timeCount == 0)
	{	
		storyDiv.style.display = "block";
		storyDiv.style.filter = "alpha(opacity=0)";
		storyDiv.style.opacity = 0;
	}	
	if (timeCount <= 100)
	{
		timeCount += 18;
		storyDiv.style.filter = "alpha(opacity=" + timeCount + ")";
		storyDiv.style.opacity = timeCount/100;

		opacityId = setTimeout("expandStory('" + storyID + "')", 100);
	}
	return true;
}

function closeStory(storyID){
	var storyDiv = document.getElementById(storyID);

	clearTimeout(opacityId);
	storyDiv.style.display = "none";
	timeCount = 0
	
	return true;
}

function expandDiv(divID, imgID){
	var divDiv = document.getElementById(divID);
	var imageDiv = document.getElementById(imgID);
	
	if (divDiv.style.display == "none")
	{
		divDiv.style.display = "inline";
		imageDiv.setAttribute('src', '/images/expand.gif');
	}
	else
	{
		divDiv.style.display = "none";
		imageDiv.setAttribute('src', '/images/collapse.gif');
	}
	return true;
}

function expandDemoDiv(divID, imgID, tableID){
	var divDiv = document.getElementById(divID);
	var imageDiv = document.getElementById(imgID);
	var table = document.getElementById(tableID);
	
	if (divDiv.style.display == "none")
	{
		divDiv.style.display = "inline";
		imageDiv.setAttribute('src', '/images/expand.gif');
		table.className = "demo_survey_top_expanded";
	}
	else
	{
		divDiv.style.display = "none";
		imageDiv.setAttribute('src', '/images/collapse.gif');
		table.className = "demo_survey_top";
	}
	return true;
}


function setFocus(){
	if (document.forms['Form1'].txtLoginName){
		document.forms['Form1'].txtLoginName.focus();
	}
}

function loginScript() {
	setFocus(); 
	preloadImages();
}
/****************************************************************************************
Author: Roland Thorburn
Created: 10/04/2001
Overview:
  Creates a popup window.
-----------------------------------------------------------------------------------------
Modified:
-----------------------------------------------------------------------------------------
Parameters:
1. Link (string)
2. Unique window name (string)
3. Window width (number)
4. Window height (number)
5. Show scrollbars (boolean)
6. Show menu bar (boolean)
****************************************************************************************/
function createPopupWindow(mylink, windowname, width, height, has_scrollbars, has_menubar)
{
var href;
var window_features;

  //*********************************
	//* Parameter validation *
	// Verify that a valid link was supplied
	if (!mylink) return false;

  // NOTE: The following validation sets defaults ONLY for parameters not supplied	
	// Verify that a width was supplied
	if (!width) width = 400;

	// Verify that a height was supplied
	if (!height) height = 300;

	// Verify whether or not to display scrollbars
	if (!has_scrollbars) has_scrollbars = 0;

	// Verify whether or not to display a menubar
	if (!has_menubar) has_menubar = 0;
	//*********************************

	// Verify that the window has focus
  if (!window.focus) return true;


	// Define window features
  window_features = 'width=' + width +
                    ',height=' + height +
                    ',scrollbars=' + has_scrollbars +
                    ',menubar=' + has_menubar +
                    ',resizable=1'

  if (typeof(mylink) == 'string') href=mylink;
  else href=mylink.href;

  // Create popup window	
  window.open(href, windowname, window_features);

	return false;
}

function preloadImages() {
	if (document.images) {
		search_over = newImage("/images/search_over.gif");
		preloadFlag = true;
	}
}


function expandCasePoint(divID){
	
		var divDiv = document.getElementById(divID);
	
		
		if (divDiv.style.display == "none")
		{
			divDiv.style.display = "inline";
		}
		else
		{
			divDiv.style.display = "none";
		
		}
	
	}
	
	function Set_Cookie( name, value, expires, path, domain, secure ) 
	{
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );

		/*
		if the expires variable is set, make the correct 
		expires time, the current script below will set 
		it for x number of days, to make it for hours, 
		delete * 24, for minutes, delete * 60 * 24
		*/
		if ( expires )
		{
			expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );

		document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
	}
//=======================================================================================
/*
Author: Roland Thorburn
Created: 10/23/2002
Function: validateDateInput
Parameters:
	1. Form input object.
	2. Suppress message boolean flag.
Return value: Boolean
Overview:
	Validates a form input as being in a 'mm/dd/yyyy' else 'mm/dd/yyyy' format. 
------------------------------------------------------------------------------------------
Modifications:
*/
function validateDateInput(objInput, bSuppressMsg)
{
//Variable declarations.
var four_digit_year_date_pattern = /\d{2}\/\d{2}\/\d{4}$/;  // 4-digit year date format mask.
var two_digit_year_date_pattern = /\d{2}\/\d{2}\/\d{2}$/;  // 2-digit year date format mask.
var non_empty_string_pattern = /\w/; // Any non-whitespace else non-empty string.

  // Perform validation on only non-empty inputs.
  if (non_empty_string_pattern.test(objInput.value))
  {
    // Validate the date.
    // Determine whether the date is in a 'mm/dd/yyyy' else 'mm/dd/yy' format.
    if (!four_digit_year_date_pattern.test(objInput.value) && !two_digit_year_date_pattern.test(objInput.value))
    {
      // Invalid date format.
      if (!bSuppressMsg)
      {
        alert("Please enter a date in 'mm/dd/yyyy' or 'mm/dd/yy' format.");
        objInput.focus();
        objInput.select();
      }
      return false;
    }
  }

  // Date validation passed.
  return true;
}
//=======================================================================================
/*
Author: Roland Thorburn
Created: 10/24/2002
Function: isNumericInput
Parameters:
	1. Form input object.
	2. Suppress message boolean flag.
Return value: Boolean
Overview:
	Validates a form input value as being numeric.
------------------------------------------------------------------------------------------
Modifications:
*/
function isNumericInput(objInput, bSuppressMsg)
{
//Variable declarations.
var charpos;
var non_empty_string_pattern = /\w/; // Any non-whitespace else non-empty string.

  // Perform validation on only non-empty inputs.
  if (non_empty_string_pattern.test(objInput.value))
  {
    // Search for any non-numeric characters.
    charpos = objInput.value.search("[^0-9]");
    if (charpos >= 0)
    {
      // Non-numeric character found.
      if (!bSuppressMsg)
      {
        alert("Please enter a numeric value.");
        objInput.focus();
        objInput.select();
      }
      return false;
    }
  }

	// Numeric form input value.	
	return true;
}
//=======================================================================================
/*
Author: Roland Thorburn
Created: 10/24/2002
Function: isMonetaryInput
Parameters:
	1. Form input object.
	2. Suppress message boolean flag.
Return value: Boolean
Overview:
	Validates a form input value as being monetary.
------------------------------------------------------------------------------------------
Modifications:
*/
function isMonetaryInput(objInput, bSuppressMsg)
{
//Variable declarations.
var charpos;
var non_empty_string_pattern = /\w/; // Any non-whitespace else non-empty string.
var monetary_pattern = /^\d+.\d{2}$/; // Monetary format mask.

  // Perform validation on only non-empty inputs.
  if (non_empty_string_pattern.test(objInput.value))
  {
    // Determine whether the form input value is in a monetary format.
    if (!monetary_pattern.test(objInput.value) && !isNumericInput(objInput, true))
    {
      // Invalid monetary format.
      if (!bSuppressMsg)
      {
        alert("Please enter a monetary value.");
        objInput.focus();
        objInput.select();
      }
      return false;
    }
  }

	// Monetary form input value.	
	return true;
}
/****************************************************************************************
Author: Roland Thorburn
Created: 11/11/2003
Overview:
  Creates a printer friendly popup window version of the specified content.
-----------------------------------------------------------------------------------------
Modified:
-----------------------------------------------------------------------------------------
Parameters:
1. HTML content (string)
2. Unique window name (string)
3. Window width (number)
4. Window height (number)
5. Show scrollbars (boolean)
6. Show menu bar (boolean)
7. Window resizable (boolean)
8. Show status bar (boolean)
****************************************************************************************/
function createPrinterPopupWindow(mycontent, windowname, width, height, has_scrollbars, has_menubar, is_resizable, has_statusbar, top, left)
{
var window_features;
var print_window;

  //*********************************
	//* Parameter validation *
	// Verify that HTML content was supplied
	if (!mycontent) return false;

  // NOTE: The following validation sets defaults ONLY for parameters not supplied	
	// Verify that a width was supplied
	if (!width) width = 400;

	// Verify that a height was supplied
	if (!height) height = 300;

	// Verify whether or not to display scrollbars
	if (!has_scrollbars) has_scrollbars = 0;

	// Verify whether or not to display a menubar
	if (!has_menubar) has_menubar = 0;
	
	// Verify whether or not to make window resizable
	if (!is_resizable) is_resizable = 0;
	
	// Verify whether or not to display a status bar
	if (!has_statusbar) has_statusbar = 0;
	
	// Verify that a top-most window position was supplied.
	if (!top) top = 0;

	// Verify that a left-most window position was supplied.
	if (!left) left = 0;
	//*********************************

	// Verify that the window has focus
  if (!window.focus) return true;

	// Define window features
  window_features = 'width=' + width +
                    ',height=' + height +
                    ',scrollbars=' + has_scrollbars +
                    ',menubar=' + has_menubar +
                    ',resizable=' + is_resizable +
                    ',status=' + has_statusbar +
                    ',top=' + top +
                    ',left=' + left +
                    ',alwaysRaised=1'

  // Create popup window
  print_window = window.open('', windowname, window_features);
  print_window.document.write(mycontent);
  print_window.document.close();
  print_window.focus();
}
function QMPopUp(url,w,h)
{
	var options = "toolbar=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + w + ",height=" + h;

	window.open( url, "", options );
}

function demoSetFocus(elementName)
{
	document.forms[0].elements[elementName].focus();
}
// end hiding -->

