﻿/* handle medical disclaimer message */

//var disclaimerMessage = "* This product is a medical food for use as directed by a medical professional. It is not intended to diagnose, treat, cure or prevent disease";

var disclaimerMessage_1 = "* NOT FOR IV USE. This product is a medical food for use as directed by a medical professional. It is not intended to diagnose, treat, cure or prevent disease.";

var disclaimerMessage_2 = "* NOT FOR IV USE. This product is a medical food for use as directed by a medical professional. It is not intended to diagnose, treat, cure or prevent disease. This product is not intended as a sole source of nutrition.";

var disclaimerMessage_3 = "* NOT FOR IV USE. This product is a medical food for use as directed by a medical professional. It is not intended to diagnose, treat, cure or prevent disease. Not a complete feeding. Use of this product requires careful monitoring due to negligible electrolyte content.";

var disclaimerMessage_4 = "* NOT FOR IV USE. This product is a medical food for use as directed by a medical professional. It is not intended to diagnose, treat, cure or prevent disease. This is a high-nitrogen and high-phosphorus product that may not be appropriate for individuals with kidney problems. This product is not intended as a sole source of nutrition.";

var disclaimerAppend		= new Object();
disclaimerAppend["DBSRAC+C250"] = "\
<div style='padding-top:6px;'>\
1.Parisi GC et al.Diq Dis Sci 2002;47(8):1697-1704.<br>\
2.Nakao M et al.Nutrition 2002;18:35-39.<br>\
3.Velazquez M et al.Anaerobe 2000;6:87-92.<br>\
4.Soriano CV et al.J Am Diet Assoc 2000S;100(9):A82.<br>\
5.Alam NH et al.J Pediatr Gastroenterol Nutr 2000;31:503-507.<br>\
6.Alam NH et al.Clin Nutr 1998;17:125-129.<br>\
7.Homann H et al.JPEN 1994;18(6):486-490.<br>\
8.Meier R et al.JPEN 1993:17(3):231-235.\
</div>";
disclaimerAppend["IMPT15+UNFL+C250"] = "\
<div style='padding-top:6px;'>\
1.Bower, Cerra et al. Crit Care Med 1995;23:436-449.<br>\
2.Daly et al. Ann Surg 1995;221:327-338.<br>\
3.Gianotti et al. Gastroenterology 2002;122:1763-1770.<br>\
4.Braga et al. Arch Surg 2002;137:174-180.<br>\
</div>";
disclaimerAppend["IMPTRG+UNFL+C250"] = "\
<div style='padding-top:6px;'>\
1.Bower, Cerra et al. Crit Care Med 1995;23:436-449.<br>\
2.Daly et al. Ann Surg 1995;221:327-338.<br>\
3.Gianotti et al. Gastroenterology 2002;122:1763-1770.<br>\
4.Braga et al. Arch Surg 2002;137:174-180.<br>\
</div>";


var excludedMedicalFoodProducts						= new Object();
excludedMedicalFoodProducts["BSTREG+CHOC+24BT"]		= "BSTREG+CHOC+24BT";
excludedMedicalFoodProducts["BSTPLUS+VANI+24BT"]	= "BSTPLUS+VANI+24BT";
excludedMedicalFoodProducts["BSTHPR+VANI+24BT"]		= "BSTHPR+VANI+24BT";
excludedMedicalFoodProducts["BSTGLC+CHOC+24BT"]		= "BSTGLC+CHOC+24BT";
excludedMedicalFoodProducts["BSTPUD+BTSC+48CS"]		= "BSTPUD+BTSC+48CS";
excludedMedicalFoodProducts["BENEPRT+75EN"]			= "BENEPRT+75EN";
excludedMedicalFoodProducts["JCETHK+AP+HO+27CS"]	= "JCETHK+AP+HO+27CS";
excludedMedicalFoodProducts["DRYTHK+VA+HO+27CS"]	= "DRYTHK+VA+HO+27CS";
excludedMedicalFoodProducts["COFTHK+HO+CS75"]		= "COFTHK+HO+CS75";
excludedMedicalFoodProducts["THKWTR+HONY+27CS"]		= "THKWTR+HONY+27CS";
excludedMedicalFoodProducts["CIBNSA+CHOC+12CN"]		= "CIBNSA+CHOC+12CN";
excludedMedicalFoodProducts["CIBPWD+CHOC+60PK"]		= "CIBPWD+CHOC+60PK";
excludedMedicalFoodProducts["OPTVIT+CITR+12CB"]		= "OPTVIT+CITR+12CB";
excludedMedicalFoodProducts["NTRMTR+BANA+CN12"]		= "NTRMTR+BANA+CN12";
excludedMedicalFoodProducts["CIBRTD+RMCH+12BT"]		= "CIBRTD+RMCH+12BT";
excludedMedicalFoodProducts["CIBRTDN+RMCH+12BT"]	= "CIBRTDN+RMCH+12BT";


var specialMedicalProducts							= new Object();
var specialMedicalProductsMsg						= new Object();
specialMedicalProducts["MICRLP+UNFL+48JR"]			= "MICRLP+UNFL+48JR";	
specialMedicalProductsMsg["MICRLP+UNFL+48JR"]		= disclaimerMessage_2;
specialMedicalProducts["OPTDRK+CRML+27CS"]			= "OPTDRK+CRML+27CS";
specialMedicalProductsMsg["OPTDRK+CRML+27CS"]		= disclaimerMessage_2;
specialMedicalProducts["GLUSOLV+4CTN"]				= "GLUSOLV+4CTN";
specialMedicalProductsMsg["GLUSOLV+4CTN"]			= disclaimerMessage_2;
specialMedicalProducts["RESBRZP+ORNG+27CS"]			= "RESBRZP+ORNG+27CS";
specialMedicalProductsMsg["RESBRZP+ORNG+27CS"]		= disclaimerMessage_2;
specialMedicalProducts["RENCAL+UNFL+24CS"]			= "RENCAL+UNFL+24CS";
specialMedicalProductsMsg["RENCAL+UNFL+24CS"]		= disclaimerMessage_3;	
specialMedicalProducts["DBSHLD+MXBR+27CS"]			= "DBSHLD+MXBR+27CS";
specialMedicalProductsMsg["DBSHLD+MXBR+27CS"]		= disclaimerMessage_4;
specialMedicalProducts["DBSRAC+C250"]				= "DBSRAC+C250";
specialMedicalProductsMsg["DBSRAC+C250"]			= disclaimerMessage_1;
specialMedicalProducts["IMPT15+UNFL+C250"]				= "IMPT15+UNFL+C250";
specialMedicalProductsMsg["IMPT15+UNFL+C250"]			= disclaimerMessage_1;
specialMedicalProducts["IMPTRG+UNFL+C250"]				= "IMPTRG+UNFL+C250";
specialMedicalProductsMsg["IMPTRG+UNFL+C250"]			= disclaimerMessage_1;


	
function checkExcludedMedicalFoodProducts(str)
{
	var regobj	

	for (var item in excludedMedicalFoodProducts )
	{
		regobj = new RegExp( encodeURIComponent( excludedMedicalFoodProducts[item] ), "i")		
		
		//alert( encodeURIComponent(str) + " --- " + encodeURIComponent( excludedMedicalFoodProducts[item] ) )		
		if( regobj.test(encodeURIComponent(str)) )
		{
			return true
		}
	}
	return false
}
function checkSpecialMedicalFoodProducts(str)
{
	var regobj	

	for (var item in specialMedicalProducts )
	{
		regobj = new RegExp( encodeURIComponent( specialMedicalProducts[item] ), "i")		
		
		//alert( encodeURIComponent(str) + " --- " + encodeURIComponent( excludedMedicalFoodProducts[item] ) )		
		if( regobj.test(encodeURIComponent(str)) )
		{
			return item;
		}
	}
	return null;
}
function handleExcludedMedicalFoodProducts(isItemDetail)
{
	var taglist		= document.getElementsByTagName("a");
	var taglist2	= document.getElementsByTagName("h1");
	var displayDisclaimer = false
	var myNodes;
	
	var disclaimerMessage = disclaimerMessage_1;
	
	var regobj = new RegExp("itemdetail.asp", "i")	

	if ( ! regobj.test(getScriptName()) ) 
	{
		for(var elem in taglist)
		{
			if ( taglist[elem].className == "viewProduct"  )
			{
				if( ! checkExcludedMedicalFoodProducts( taglist[elem].href ) )
				{
					displayDisclaimer	= true;					
					//alert("debug: " + taglist[elem].parentNode.parentNode.className);
					//break;
					myNodes				= taglist[elem].parentNode.childNodes;					
					if ( taglist[elem].parentNode.className.match(/productOralTube/) )
					{
						myNodes				= taglist[elem].parentNode.parentNode.childNodes;
					}				
					for(var n=0; n <  myNodes.length; n++ )
					{
						//alert(myNodes[n].className)
						if ( typeof(myNodes[n].className) != 'undefined')
						{
							if( myNodes[n].className == "darkblue" )
							{
								myNodes[n].innerHTML = myNodes[n].innerHTML + "<span class='medicalDisclaimer'>*</span>"
								break;
							}
						}					
					}				
				}
			}
		}
	}
	else
	{
		for ( var elem in taglist2 )
		{
			if( taglist2[elem].id == "ItemDescSection" )
			{
				if( ! checkExcludedMedicalFoodProducts( escape( taglist2[elem].title ) ) )
				{			
					displayDisclaimer	= true
					taglist2[elem].innerHTML = taglist2[elem].innerHTML + "<sup class='medicalDisclaimer'>*</sup>";			
					
					var str = checkSpecialMedicalFoodProducts( escape( taglist2[elem].title ) ); 
					if(str) {
						disclaimerMessage = specialMedicalProductsMsg[str];
						disclaimerMessage = disclaimerMessage + disclaimerAppend[str];
					}
										
					break;
				}
			}
		}
	}
	if (displayDisclaimer)
	{
		document.write(disclaimerMessage)
	}
}


/* handle medical disclaimer message */


