﻿//Error handler
function silentHandler()  {return true}
window.onerror=silentHandler


/*
     Ajax
*/
   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }

      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('story_panel_response').innerHTML = result;
         } else {
            alert('There was a problem with the request.');
         }
      }
   }

   function get(obj) {
      var poststr = "firstname=" + encodeURI( document.getElementById("firstname").value ) +
                    "&lastname=" + encodeURI( document.getElementById("lastname").value ) +
                    "&email=" + encodeURI( document.getElementById("email").value ) +
                    "&title=" + encodeURI( document.getElementById("title").value ) +
                    "&storyTitle=" + encodeURI( document.getElementById("storyTitle").value ) +
                    "&storyContent=" + encodeURI( document.getElementById("story_content").value ) ;
      makePOSTRequest('saveYourStory.asp', poststr);
   }



//---------------------------------------------------
function GetXmlHttpObject()
{
     var xmlHttp=null;
     try
       {
       // Firefox, Opera 8.0+, Safari
       xmlHttp=new XMLHttpRequest();
       }
     catch (e)
       {
       // Internet Explorer
       try
         {
         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
         }
       catch (e)
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
       }
     return xmlHttp;
}
function getTestimonials()
{
     xmlHttp=GetXmlHttpObject();

     if (xmlHttp==null)
     {
       alert ("Your browser does not support AJAX!");
       return;
     }
     var url="getStories.asp";

         url=url+"?sid="+Math.random();


    // xmlHttp.onreadystatechange=stateChanged;
     xmlHttp.open("GET",url,true);
     xmlHttp.send(null);

     xmlHttp.onreadystatechange=function()
     {
          if(xmlHttp.readyState==4)
          {
               document.getElementById("testimonial_content_panel").innerHTML=xmlHttp.responseText;
          }
     }
}
function saveYourStory(str)
{

     if (str.length==0)
     {
       document.getElementById("story_panel_response").innerHTML="";
       return;
     }

     xmlHttp=GetXmlHttpObject();

     if (xmlHttp==null)
     {
       alert ("Your browser does not support AJAX!");
       return;
     }
     var url="saveYourStory.asp";
         url=url+"?q="+str;
         url=url+"&sid="+Math.random();


    // xmlHttp.onreadystatechange=stateChanged;
     xmlHttp.open("POST",url,true);
     xmlHttp.send(null);

     xmlHttp.onreadystatechange=function()
     {
          if(xmlHttp.readyState==4)
          {
               document.getElementById("story_panel_response").innerHTML=xmlHttp.responseText;
          }
     }
}

//---------------------------------------------------












/***********************************************
* Floating Top Bar script- © Dynamic Drive (www.dynamicdrive.com)
* Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 45 //set x offset of bar in pixels
var startY = 0 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}

function closebar(){
	if (persistclose)
		document.cookie="remainclosed=1"
	document.getElementById("large_video_holder").style.visibility="hidden"
}

function staticbar(){
	barheight=document.getElementById("large_video_holder").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
			el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
			el.y = startY;
		else{
			el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
			el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		if (verticalpos=="fromtop"){
			var pY = ns ? pageYOffset : iecompattest().scrollTop;
			ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
			var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
			ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("large_video_holder");
	stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar

function playMovie(index,holder)
{
     if(holder == undefined) holder = 'video_holder';
     document.getElementById(holder).innerHTML = this["movie" + index + "_html"];
}
function toggleLayer( whichLayer ){

          var elem, vis;
          if( document.getElementById ) // this is the way the standards work
          elem = document.getElementById( whichLayer );
          else if( document.all ) // this is the way old msie versions work
          elem = document.all[whichLayer];
          else if( document.layers ) // this is the way nn4 works
          elem = document.layers[whichLayer];
          vis = elem.style;  // if the style.display value is blank we try to figure it out here
          vis.left="45px";
          vis.top ="50px";
          vis.height = "620px";
          vis.width = "900px";
          if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
               vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function closeViewWindow()
{
     toggleLayer('large_video_holder');
}



var movie1_html, movie2_html, movie3_html

     movie1_html = '';
     movie1_html = movie1_html + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
     movie1_html = movie1_html + '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"';
     movie1_html = movie1_html + '  width="483"';
     movie1_html = movie1_html + '  height="271"';
     movie1_html = movie1_html + '  id="flv_player_1"';
     movie1_html = movie1_html + '  align="middle">';
     movie1_html = movie1_html + '  <param name="allowScriptAccess" value="sameDomain" />';
     movie1_html = movie1_html + '  <param name="allowFullScreen" value="false" />';
     movie1_html = movie1_html + '  <param name="movie" value="flv_player_1.swf" />';
     movie1_html = movie1_html + '  <param name="quality" value="high" />';
     movie1_html = movie1_html + '  <param name="bgcolor" value="#000000" />';
     movie1_html = movie1_html + '  <param name="wmode" value="transparent" />;'
     movie1_html = movie1_html + '  <embed';
     movie1_html = movie1_html + '       src="flv_player_1.swf"';
     movie1_html = movie1_html + '       quality="high"';
     movie1_html = movie1_html + '       bgcolor="#000000"';
     movie1_html = movie1_html + '       width="483"';
     movie1_html = movie1_html + '       height="271"';
     movie1_html = movie1_html + '       name="flv_player_1"';
     movie1_html = movie1_html + '       align="middle"';
     movie1_html = movie1_html + '       allowScriptAccess="sameDomain"';
     movie1_html = movie1_html + '       allowFullScreen="false"';
     movie1_html = movie1_html + '       type="application/x-shockwave-flash"';
     movie1_html = movie1_html + '       pluginspage="http://www.macromedia.com/go/getflashplayer"';
     movie1_html = movie1_html + '  />';
     movie1_html = movie1_html + '</object>';


     // Movie 2
     movie2_html = '';
     movie2_html = movie2_html + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
     movie2_html = movie2_html + '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"';
     movie2_html = movie2_html + '  width="483"';
     movie2_html = movie2_html + '  height="271"';
     movie2_html = movie2_html + '  id="flv_player_2"';
     movie2_html = movie2_html + '  align="middle">';
     movie2_html = movie2_html + '  <param name="allowScriptAccess" value="sameDomain" />';
     movie2_html = movie2_html + '  <param name="allowFullScreen" value="false" />';
     movie2_html = movie2_html + '  <param name="movie" value="flv_player_2.swf" />';
     movie2_html = movie2_html + '  <param name="quality" value="high" />';
     movie2_html = movie2_html + '  <param name="wmode" value="transparent" />;'
     movie2_html = movie2_html + '  <param name="bgcolor" value="#000000" />';
     movie2_html = movie2_html + '  <embed';
     movie2_html = movie2_html + '       src="flv_player_2.swf"';
     movie2_html = movie2_html + '       quality="high"';
     movie2_html = movie2_html + '       bgcolor="#000000"';
     movie2_html = movie2_html + '       width="483"';
     movie2_html = movie2_html + '       height="271"';
     movie2_html = movie2_html + '       name="flv_player_2"';
     movie2_html = movie2_html + '       align="middle"';
     movie2_html = movie2_html + '       allowScriptAccess="sameDomain"';
     movie2_html = movie2_html + '       allowFullScreen="false"';
     movie2_html = movie2_html + '       type="application/x-shockwave-flash"';
     movie2_html = movie2_html + '       pluginspage="http://www.macromedia.com/go/getflashplayer"';
     movie2_html = movie2_html + '  />';
     movie2_html = movie2_html + '</object>';

     movie3_html = '';
     movie3_html = movie3_html + '<img src="images/view_placeholder.jpg" width="483" height="295" alt=';
     movie3_html = movie3_html + '"I love the durability of my Onyx. It\'s nice to know that I do not have to worry when it gets bumped or ';
     movie3_html = movie3_html + 'accidentally dropped. - Rachel K., RN" />';

     // Movie 4
     movie4_html = '';
     movie4_html = movie4_html + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
     movie4_html = movie4_html + '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"';
     movie4_html = movie4_html + '  width="900"';
     movie4_html = movie4_html + '  height="600"';
     movie4_html = movie4_html + '  id="oximetery_challenge"';
     movie4_html = movie4_html + '  align="middle">';
     movie4_html = movie4_html + '  <param name="allowScriptAccess" value="sameDomain" />';
     movie4_html = movie4_html + '  <param name="allowFullScreen" value="false" />';
     movie4_html = movie4_html + '  <param name="movie" value="video/oximetery_challenge.swf" />';
     movie4_html = movie4_html + '  <param name="quality" value="high" />';
     movie4_html = movie4_html + '  <param name="wmode" value="transparent" />';
     movie4_html = movie4_html + '  <param name="bgcolor" value="#000000" />';
     movie4_html = movie4_html + '  <embed';
     movie4_html = movie4_html + '       src="video/oximetery_challenge.swf"';
     movie4_html = movie4_html + '       quality="high"';
     movie4_html = movie4_html + '       bgcolor="#000000"';
     movie4_html = movie4_html + '       width="900"';
     movie4_html = movie4_html + '       height="600"';
     movie4_html = movie4_html + '       name="oximetery_challenge"';
     movie4_html = movie4_html + '       align="middle"';
     movie4_html = movie4_html + '       allowScriptAccess="sameDomain"';
     movie4_html = movie4_html + '       allowFullScreen="false"';
     movie4_html = movie4_html + '       type="application/x-shockwave-flash"';
     movie4_html = movie4_html + '       pluginspage="http://www.macromedia.com/go/getflashplayer"';
     movie4_html = movie4_html + '  />';
     movie4_html = movie4_html + '</object>';


     // Movie 5
     var cr = '';
     movie5_html = '';
     movie5_html = movie5_html + '<div id="dialogbox">' + cr;
     movie5_html = movie5_html + '     <div class="content">' + cr;
     movie5_html = movie5_html + '           <h2>Nonin Medical Onyx: U.S. Military Certified</h2>' + cr;
     movie5_html = movie5_html + '           <br />' + cr;




     movie5_html = movie5_html + '<table summary="Onyx Certificates - FDA and Aeromedical" cellpadding="0" cellspacing="0" border="0">' + cr;
     movie5_html = movie5_html + ' <tr>' + cr;
     movie5_html = movie5_html + '      <td align="center">' + cr;
     movie5_html = movie5_html + '            <img src="images/Aeromedical%20Plaque1.jpg" width="140" height="135" border="0" alt="Aeromedical Plaque" />' + cr;
     movie5_html = movie5_html + '      </td>' + cr;
     movie5_html = movie5_html + ' </tr>' + cr;
     movie5_html = movie5_html + ' <tr>' + cr;
     movie5_html = movie5_html + '      <td class="certLabel">' + cr;
     movie5_html = movie5_html + '           Aeromedical Certification' + cr;
     movie5_html = movie5_html + '      </td>' + cr;
     movie5_html = movie5_html + ' </tr>' + cr;
     movie5_html = movie5_html + '</table>' + cr;


     var movie5_html = '';

     movie5_html = movie5_html + '           The Onyx<sup>&reg;</sup> fingertip oximeter from Nonin Medical is the only fingertip oximeter' + cr;
     movie5_html = movie5_html + '           approved for usage aboard U.S. military aircraft. To achieve this certification, the Onyx' + cr;
     movie5_html = movie5_html + '           had to pass a series of required tests in order to receive its Joint Airworthiness' + cr;
     movie5_html = movie5_html + '           Certification (JAC) and safe-to-fly letter from the U.S. Air Force; as well as a' + cr;
     movie5_html = movie5_html + '           Fleet Airworthiness Release (AWR) and Aeromedical Certification Letter from the U.S.' + cr;
     movie5_html = movie5_html + '           Army.<br />' + cr;
     movie5_html = movie5_html + '           <br />' + cr;
     movie5_html = movie5_html + '           To receive military certification, the Onyx had to pass the following tests:' + cr;

     movie5_html = movie5_html + '            <div class="content">' + cr;

     movie5_html = movie5_html + '           <ul>' + cr;

     movie5_html = movie5_html + '                <li>Baseline Performance Assessment</li>' + cr;
     movie5_html = movie5_html + '                <li>Electrical Safety Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Vibration Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Electromagnetic Interference Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Climatic Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Altitude Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Rapid Decompression Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Explosive Atmosphere Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Acceleration Testing</li>' + cr;
     movie5_html = movie5_html + '                <li>Flight Testing</li>' + cr;
     movie5_html = movie5_html + '           </ul>' + cr;
     movie5_html = movie5_html + '           </div>' + cr;

     movie5_html = movie5_html + '     </div>' + cr;
     movie5_html = movie5_html + '</div>' + cr;






var cr = '\n'; //char(10);
var html_str = '';

html_str = html_str + '<div id="military">' + cr;
html_str = html_str + '     <h1>Nonin Medical Onyx 9500 and 9550: U.S. Military Airworthiness Certifications</h1>' + cr;
html_str = html_str + '     <table cellpadding="0" cellspacing="0" border="0">' + cr;
html_str = html_str + '          <tr>' + cr;
html_str = html_str + '               <td valign="top" width="600"><p>The Onyx 9500 and 9550 fingertip oximeters from Nonin Medical are the only fingertip oximeters approved for use aboard' + cr;
html_str = html_str + '                    U.S. military aircraft. To achieve U.S. military airworthiness from both the U.S. Air Force and U.S. Army, the Onyx 9500 and 9550 had' + cr;
html_str = html_str + '                    to maintain performance and pass ALL of the following required tests.</p></td>' + cr;
html_str = html_str + '               <td align="right" width="220"><img src="images/Aeromedical Plaque1.jpg" width="140" height="135" border="0" alt="Aeromedical Plaque" caption="Aeromedical Plaque""/></td>' + cr;
html_str = html_str + '          </tr>' + cr;
html_str = html_str + '     </table>' + cr;
html_str = html_str + '     <h2>U.S. Military Airworthiness Certifications: Required Testing</h2>' + cr;
html_str = html_str + '     <ul>' + cr;
html_str = html_str + '          <li><strong>Baseline Performance Assessment</strong></li>' + cr;
html_str = html_str + '          <li><strong>Electrical Safety Testing:</strong> to ensure safety of patients in harsh environments</li>' + cr;
html_str = html_str + '          <li><strong>Vibration Testing:</strong> must operate during extreme vibration conditions in helicopters</li>' + cr;
html_str = html_str + '          <li><strong>Electromagnetic Interference Testing:</strong> extensive testing to assure operations through interference from radio and radar transmitters</li>' + cr;
html_str = html_str + '          <li><strong>Climatic Testing:</strong> must operate in extreme hot, cold and humid conditions</li>' + cr;
html_str = html_str + '          <li><strong>Altitude Testing:</strong> must operate in non-pressurized environments at high altitudes (up to 40,000 ft.)</li>' + cr;
html_str = html_str + '          <li><strong>Rapid Decompression Testing:</strong> must operate while withstanding immediate decompression to 40,000 ft. without damage</li>' + cr;
html_str = html_str + '          <li><strong>Explosive Atmosphere Testing:</strong> must operate safely in an environment filled with explosive vapors without igniting</li>' + cr;
html_str = html_str + '          <li><strong>Flight Testing:</strong> in-flight performance test in military aircraft</li>' + cr;
html_str = html_str + '     </ul>' + cr;
html_str = html_str + '     (Note: Detailed results from U.S. Military-conducted tests are not publicly available.)' + cr;
html_str = html_str + '</div>' + cr;
var movie6_html = html_str;

html_str = '';
html_str = html_str + '<div id="tradeup">' + cr;
html_str = html_str + '     <img name="tradeuptemp2" src="images/tradeup%20temp2.jpg" width="483" height="586" border="0" id="tradeuptemp2" usemap="#m_tradeup20temp2" alt="" /><map name="m_tradeup20temp2" id="m_tradeup20temp2">' + cr;
html_str = html_str + '     <area shape="rect" coords="39,556,124,564" href="http://www.nonin.com/onyx" target="_blank" title="Oximeter Challenge Page" alt="Oximeter Challenge Page" />' + cr;
html_str = html_str + '     <area shape="rect" coords="364,450,432,462" href="http://www.nonin.com/documents/M-2108 Onyx Real Deal Order Form (b&w).pdf" target="_blank" title="Onyx Real Deal Order Form" alt="Onyx Real Deal Order Form" />' + cr;
html_str = html_str + '     </map>' + cr;
html_str = html_str + '</div>' + cr;
var movie7_html = html_str;


//--------------------------------------------------------
var requiredField_array = new Array();
var style_obj = new class_style_obj();
var requiredField_array = new Array();

function class_style_obj()
{
	this.required = new Object();
	this.failed = new Object();
	this.normal = new Object();
	this.passed = new Object();

}

function setStyle(p_status, p_border_width, p_border_color)
{
         style_obj[p_status].border_width =  p_border_width;
         style_obj[p_status].border_color =  p_border_color;

}

function applyStyle(p_status, p_fieldName)
{
	var fld = document.forms[0][p_fieldName] ;
	var color =    style_obj[p_status].border_color;
	var width =    style_obj[p_status].border_width;

	fld.style.backgroundColor  = "#" + color;
	//fld.style.border  = width + "px solid #" + color;
}
function initRequiredFields()
{

  //This section sets up the required fields


         //setStyle(status, borderWidth, backgroundColor)
         setStyle("failed", 2, "f9a8ae");
         setStyle("required", 2, "d8e8f8");
         setStyle("passed", 2, "ffffff");
         setStyle("normal", 1, "ffffff");

         var frm = document.getElementById("frmTellUsYourStory");
         //addRequiredField((formObject, fieldName, promptMessage);
         addRequiredField(frm, 'firstname', 'Please enter a first name.');
         addRequiredField(frm, 'lastname', 'Please enter a last name.');
        // addRequiredField(frm, 'title', 'Please enter a title.');                                                                                    ../response - status 0.inc
         addRequiredField(frm, 'email', 'Please enter an email address.');
         addRequiredField(frm, 'story_content', 'Please enter your story.');

}
function addRequiredField(p_form, p_fieldName, p_prompt)
{
	var temp_obj        = new Object();
	temp_obj.form       = p_form;
	temp_obj.fieldName  = p_fieldName;
	temp_obj.prompt     = p_prompt;
	requiredField_array.push(temp_obj);

	applyStyle("required", p_fieldName)
}

function submitForm(form)
{
	if(checkFields(form))
	{
		form.submit();
	}
}



function checkFields(form)
{

    var i = 0;
    var msg_str	,failFlag, cr,tb
    cr = '\n';
    tb = '\t';
     msg_str = '' ;
	failFlag = false;
	var focusFieldName = "";
   
    for(i = 0; i <  requiredField_array.length; i ++)
    {
    	var temp_obj

    	temp_obj = requiredField_array[i];


    	var fld = requiredField_array[i].form[requiredField_array[i].fieldName];
    	if(fld.value == undefined || fld.value == "")
    	{
			if(focusFieldName == "")
			{
				focusFieldName = 	 requiredField_array[i].fieldName;
			}
    		msg_str = msg_str + tb + requiredField_array[i].prompt + cr + cr;
			applyStyle("failed", requiredField_array[i].fieldName)
    		failFlag = true;
    	}	 else	{

    		//alert(fld.name + ": " + fld.value);
			applyStyle("passed", requiredField_array[i].fieldName)
    	}
    }
    if (failFlag)
    {
		document.forms[0][focusFieldName].focus();
    	alert("One or more required fields must be completed:" + cr + cr + msg_str)
    	return false;
    } else {
    	return true;
    }
}