//------------------------ Browser Sniff & Div Funcs ----------------------------------
// Mac sniff
var agt=navigator.userAgent.toLowerCase();
var is_mac = (agt.indexOf("mac")!=-1);

function BrowserCheck()
{
var agt=navigator.userAgent.toLowerCase();
var b = navigator.appName;
// *** BROWSER VERSION ***
if (b=="Netscape") this.b = "ns";
else if (b=="Microsoft Internet Explorer") this.b = "ie";
else this.b = b;
this.v = parseInt(navigator.appVersion);
this.ns = (this.b=="ns" && this.v>=4);
this.ns4 = (this.b=="ns" && this.v==4);
this.ns5 = (this.b=="ns" && this.v==5);
this.ie = (this.b=="ie" && this.v>=4);
this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
if (this.ie5) this.v = 5;
this.min = (this.ns||this.ie);
// *** PLATFORM ***
this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
this.mac = (agt.indexOf("mac")!=-1);
}
// automatically create the "is" object
is = new BrowserCheck();


// Useful MM funcs ---------------------------------------------------
function MM_findObj(n, d)
{ //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

// Image swap functions -----------------------------------------------
var imgReady = 0;


function revealing(which,non,how)
{
var i,p,v;
if ((!is.ns5)||(!is.ns6))
    {
	for (i=0; i<(revealing.arguments.length-2); i+=3)
		{
		if ((obj=MM_findObj(revealing.arguments[i]))!=null) 
			{
			v=revealing.arguments[i+2];
			if (obj.style)
				{ 
				obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;
				}
			obj.visibility=v;
			}
		}
	}
else
	{
	if (how=='show') how2 = 'visible';
	else how2 = 'hidden';
	document.getElementById(which).style.visibility=how2;
	}
}

function hideAll()
{
	revealing('eduSubNav','','hide');
	revealing('slideSubNav','','hide');
	revealing('trialsSubNav','','hide');
	revealing('infoSubNav','','hide');
	revealing('resourcesSubNav','','hide');
	revealing('navNet','','hide');
}

// Footnote Popup Funcs

var agt = navigator.userAgent.toLowerCase();
var isIE = (agt.indexOf('msie') != -1 ) ? true : false;
var isGecko = (agt.indexOf('gecko') != -1) ? true : false;
//
				
function popShow(e)
{
	var footnote = document.getElementById('footnote');
	var refNumber = document.getElementById('refNumber');
	var reference = document.getElementById('reference');
	
	footnote.style.visibility = 'visible';
	//
	var oEvent, oSrcElement;
	var pageX, pageY;
	if (isIE)
	{
		oEvent = event;
		oSrcElement = event.srcElement;
		pageX = oEvent.x - 180;
		pageY = oEvent.y + document.body.scrollTop - 7;
	} 
	else if (isGecko)
	{
		oEvent = e;
		oSrcElement = e.currentTarget;
		pageX = oEvent.pageX - 185;
		pageY = oEvent.pageY - 8;
	}
	//
	if (isIE || isGecko)
	{
		footnote.style.left = (pageX) + 'px';
		footnote.style.top  = (pageY) + 'px';
		//
		for (var i=0; i<arrPops.length; i++)
		{
			if (oSrcElement == document.getElementById(arrPops[i].id))
			{
				refNumber.innerHTML = arrPops[i].refNum;
				
				if (arrPops[i].id.indexOf('x') == -1)
				{
					reference.innerHTML = document.getElementById(arrPops[i].id + 'note').innerHTML;
				}
				else
				{
					var thisOneArray = arrPops[i].id.split('x');
					var foundIt = thisOneArray[0] + 'note';
					reference.innerHTML = document.getElementById(foundIt).innerHTML
				}
			}
		}
	}
}
//
function popHide(e)
{
	var footnote = document.getElementById('footnote');
	footnote.style.visibility = 'hidden';
}


function loadPoppers()
{
	if (!document.layers)
	{
		for (var i=0; i<arrPops.length; i++)
		{
			var o = document.getElementById(arrPops[i].id)
			//ie
			if (isIE)
			{
			//alert(o.id);
				o.onmouseover = popShow;
				o.onmouseout  = popHide;
			}
			//gecko
			if (isGecko)
			{
				o.addEventListener('mouseover', popShow, true);
				o.addEventListener('mouseout', popHide, true);
			}
			
		}
	}
}

var goodBlurb = 'Placing your cursor over footnote callouts throughout the text will pop up the reference citation. The full reference list is at the <a href="#References">bottom of the page</a>.';
var badBlurb = 'Clicking on footnote callouts throughout the text will bring you to the reference citation at the <a href="#References">bottom of the page</a>.';

function leaveSite(site) {
        var msg = 'Please note: You are about to leave the Bristol-Myers Squibb Company Cetuximab.com site.\nThe site we are linking to is not controlled or endorsed by Bristol-Myers Squibb Company, \nand we are not responsible for the content provided on that site. \nYour linking to any other off-site pages or other sites is at your own risk.';
		
        if (confirm(msg) == 1)
		{
        window.open(site,'_new','scrollbars,toolbar,menubar,resizable,status,width=750,height=500');
		}
		else
		{
		return false;
		}
}

function addtoFaves(url,title)
{
	if (isIE == true)
	{
		document.write(' | <a href="javascript:window.external.AddFavorite(\'' + url + '\',\'' + title + '\');">Add to Favorites</a>');
	}
}

function openFig(which)
{
	window.open('/hcp/' + which + '.html','_blank','width=600,height=485');
}

function flipper(what,how)
{
	if (!is.ns)
	{
		if (how == 'on')
		{
			what.style.background = '#EB7C38';
		}
		if (how == 'off')
		{
			what.style.background = '#ffffff';
		}
	}
}
