﻿// If content on page changes, adjust these variables to move line positions
var lineAdjX = 0;
var lineAdjY = 0;

var lineNo = 1000;
function outFeature( n,asToolTip ) {

	if( !n && n!=0)
		return;

	lineNo = n;
	
	if( typeof asToolTip != 'boolean' )
		asToolTip = false;

	var	feature,
			html	= (
				"<div class=\"popupContent\">$img"				
				+			"$txt</div>"				
			);

	var height = 330;
	
	switch( n ) {
		case 0:
			feature = {
				img: '<img src="assets/base/perifix/image/windows_tip.jpg" alt="" />',
				txt: "<p><strong>Flashback windows (distal and proximal)</strong></p><ul><li>Two flashback windows in the catheter body that permit easy visualization of blood or CSF upon aspiration.</li></ul>"						 
			};
			break;
		case 1:
			feature = {
				img: '<img src="assets/base/perifix/image/cath_tip.jpg" alt="" />',
				txt:"<p>Embedded spring in polyamide body enables easy insertion and removal reducing the threat of breakage or uncoiling.</p><p><strong>Benefits:</strong></p><ul><li>Less epidural needle adjustments.</li><li>Designed to decrease the chance of repeating the epidural procedure which subjects the patient to the risks of epidural placement for the second time.</li><li>Increases workflow and cost efficiencies (e.g. for use of a second tray) by decreasing the chance of above maneuvers.</li></ul>"
			};
			height = 0;
			break;
		case 2:
			feature = {
				img: '<img src="assets/base/perifix/image/sping_tip.jpg" alt="" />',
				txt: "<p>Inner spring less tightly wound at tip, making distal tip softer and atraumatic. Designed to reduce paresthesia and vessel puncture.</p><p><strong>Benefits:</strong></p><ul><li>Less discomfort for the patient.</li><li>Less complications that could lead to potential neurological deficits.</li><li>Designed to decrease the chance of repeating the epidural procedure due to vessel puncture which subjects the patient to the risks of epidural placement for the second time.</li><li>Increases workflow and cost efficiencies (e.g. for use of a second tray) by reducing the chance of above maneuvers.</li></ul>"
			};
			height = 0;
			break;
		case 3:
			feature = {
				img: '',
				txt: "<p>Stable yet flexible polyamide design makes Perifix FX easier to insert and advance and minimizes incidences of catheter repositioning resulting in better analgesia quality.</p><p><strong>Benefits:</strong></p><ul><li>Decrease the chance of catheter withdrawal and/or additional local anesthetic injections.</li><li>Decrease the chance of replacing the catheter thus repeating the epidural procedure which subjects the patient to the risks of epidural placement for the second time.</li><li>Increases workflow and cost efficiencies (e.g. for use of a second tray) by reducing the chance of above maneuvers.</li></ul>"
			};
			break;
		case 4:
			feature = {
				img: '<img src="assets/base/perifix/image/tipped_tip.jpg" alt="" />',
				txt: "<p>Closed tip multi-port with three lateral holes designed for optimal drug spread, fewer unilateral blocks and a potentially higher detection rate of intravascular catheter placement.</p><p><strong>Benefits:</strong></p><ul><li>Decrease the chance of catheter withdrawal and/or additional local anesthetic injections.</li><li>Decrease the chance of replacing the catheter thus repeating the epidural procedure which subjects the patient to the risks of epidural placement for the second time.</li><li>Increases workflow and cost efficiencies (e.g. for use of a second tray) by reducing the chance of above maneuvers.</li></ul><p><br/><strong><em>Also available in an open tip, uni-port version.</em></strong></p>"
			};
			height = 0;
			break;
		case 5:
			feature = {
				img: '',
				txt: "<p>Minimal variation in tip deflection designed for consistent feel and performance.</p>"
			};
			break;
		case 6:
			feature = {
				img: '',
				txt: "<p><strong>Radiopacity</strong></p><ul><li>Surgical grade stainless steel continuous spring designed to be radiopaque. </li></ul><p><br/><strong><em>Due to the stainless steel component this and other springwound catheters are not MR safe.</em></strong></p>"
			};
			break;
		case 7:
			feature = {
				img: '<img src="assets/base/perifix/image/windows_tip.jpg" alt="" />',
				txt: "<p><strong>Flashback windows (distal and proximal)</strong></p><ul><li>Two flashback windows in the catheter body that permit easy visualization of blood or CSF upon aspiration.</li></ul>"						 
			};
			break;
		case 8:
			feature = {
				img: '',
				txt: "<p><strong>Centimeter markings</strong></p><ul><li>Easier determination of catheter insertion depth.</li></ul>"
			};
			break;
		case 9:
			feature = {
				img: '',
				txt: "<p><strong>Perifix Catheter Connector</strong></p><ul><li>Securely fixes catheter in, reducing the chance of disconnection.</li><li>Audible \"click\" verifies solid connection has been made.</li><li>Easy one-handed, smooth operation.</li></ul>"
			};
			break;
			case 10:
			feature = {
				img: '',
				txt: "<p><strong>Perifix Epidural Needle</strong></p><ul><li>Polished inner bevel to minimize risk of catheter shearing.</li><li>Precision fit stylet to minimize tissue coring.</li><li>Clear hub provides solid grip and easy blood or CSF visualization.</li><li>Most durable of needles tested in a stiffness and malleability test.<sup>1,2</sup></li></ul><p class='footnote'>1. Dunn, SM, Goolishian, WT. All epidural needles are not created equal. Anesth Analg. 1996;83(3):659.<br />2. Dunn, S., et al. A fractured epidural needle: case report and study. Anesth Analg. 1992;75:1050-1052.</p>"
			};
			break;
		default:
			return;
	}	// switch( n )

	html = html
		.replace( /\$img/,feature.img )
		.replace( /\$txt/,feature.txt );

	
		
	if( asToolTip )
		Tip(
			html,
			BGCOLOR,		'#CCF0E6',
			BORDERSTYLE,	'solid',
			BORDERCOLOR,	'#12A682',
			BORDERWIDTH,	2,
			CENTERMOUSE,	false,
			CLICKCLOSE,		true,
			CLICKSTICKY,	false,
			FADEIN,			0,
			FADEOUT,		0,
			JUMPHORZ,		true,
			FIX,			['content',478,-375],
			STICKY,			true,
			WIDTH,			266,
			HEIGHT,			height
		);
}

function loadLine()
{
	var loc = 'assets/base/perifix/image/lines/line'+lineNo+'.gif';
	var imgDiv = document.getElementById('lineImgDiv');
	var roDiv = document.getElementById('plusRODiv');
	if(!imgDiv) {
		// No div defined, so create it
		imgDiv = document.createElement('div');
		imgDiv.id = 'lineImgDiv';
		imgDiv.style.position = 'absolute';
		imgDiv.style.zIndex = 20;
		imgDiv.innerHTML = '<img src="'+loc+'" alt="" />';
		var afta = document.getElementById('cathImg');
		afta.parentNode.insertBefore(imgDiv, afta.nextSibling);
		
		// Additional stuff for rollover
		roDiv = document.createElement('div');
		roDiv.id = 'plusRODiv';
		roDiv.style.position = 'absolute';
		roDiv.style.zIndex = 40;
		roDiv.innerHTML = '<img src="assets/base/perifix/image/pOver.gif" alt="" />';
		afta.parentNode.insertBefore(roDiv, afta.nextSibling);
	} 
	
	if(imgDiv) {
		// ok, do the stuff
		var oX = 0, oY = 0; // line offsets
		var rX = 0, rY = 0; // rollover offsets
		switch(lineNo) {
			case 0:  oX = 219; oY =  11; rX = 207; rY =   4; break;
			case 1:  oX =  10; oY = 236; rX =   3; rY = 230; break;
			case 2:  oX = 435; oY =  62; rX = 428; rY = 113; break;
			case 3:  oX = 169; oY =  31; rX = 162; rY = 134; break;
			case 4:  oX = 292; oY =  31; rX = 285; rY =  75; break;
			case 5:  oX = 368; oY =  31; rX = 361; rY =  78; break;
			case 6:  oX = 155; oY = 286; rX = 148; rY = 274; break;
			case 7:  oX =  78; oY =  32; rX =  71; rY =  86; break;
			case 8:  oX = 442; oY = 249; rX = 430; rY = 242; break;
			case 9:  oX = 370; oY = 202; rX = 358; rY = 195; break;
			case 10: oX = 355; oY = 305; rX = 349; rY = 293; break;
		}
		imgDiv.style.left = (oX + lineAdjX)+'px';
		imgDiv.style.top = (oY + lineAdjY)+'px';
		if(imgDiv.childNodes.length > 0)
		{
			imgDiv.removeChild(imgDiv.childNodes[0]);
		}
		var imgNode = document.createElement('img');
		imgNode.src = loc;
		imgNode.alt = '';
		imgDiv.appendChild(imgNode);
		//imgDiv.innerHTML = '<img src="'+loc+'" alt="" />';
		imgDiv.style.display = 'block';
		
		roDiv.style.left = (rX + lineAdjX)+'px';
		roDiv.style.top = (rY + lineAdjY)+'px';
		roDiv.style.display = 'block';
	}
}

function hideLine()
{
	var imgDiv = document.getElementById('lineImgDiv');
	var roDiv = document.getElementById('plusRODiv');
	if(imgDiv) {
		imgDiv.style.display = 'none';
		roDiv.style.display = 'none';
	}

}


var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
