//variables used to center pop-up windows
var width = screen.width;
var height = screen.height;
var popUpWidth = 0;
var popUpHeight = 0;
var positionTop = 0;
var positionLeft = 0;

function openWindow(pageURL,windowName,pWidth,pHeight,pResize,pScrollbars) {
  //alert(pWidth);
  //alert(pHeight);
  positionTop = ((height/2) - (pHeight/2));
  positionLeft = ((width/2) - (pWidth/2));
  popup=window.open(pageURL,windowName, config='width=' + pWidth + ',height=' + pHeight + ',left=' + positionLeft + ',top=' + positionTop + ',resizable=' + pResize + ',menubar=0,location=0,directories=0,toolbar=0,scrollbars=' + pScrollbars + ',status=1'); 
	popup.focus();
}


function queryString(val){
	var q  = unescape(location.search.substr(1)).split('&');

	for(var i=0; i<q.length; i++) {
		var t=q[i].split('=');
		if (t[0].toLowerCase()==val.toLowerCase()) return t[1];
	}
	return '';
}


/*===================================
--end window popup function
=====================================*/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function readUserTextPreference() {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

function storeUserTextPreference() {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

function displayTextZoom() {
	document.writeln("TEXT ZOOM <span style=\"letter-spacing:-0.5px;\"><a href=\"javascript:void(0);\" onclick=\"setActiveStyleSheet('Small Text', 1); return false;\" title=\"Switch to Small Text Size\" id=\"text-small\">A</a> <a href=\"javascript:void(0);\" onclick=\"setActiveStyleSheet('Medium Text', 1); return false;\" title=\"Switch to Medium Text Size\" id=\"text-medium\"><span style=\"font-size:13px;\">A</span></a> <a href=\"javascript:void(0);\" onclick=\"setActiveStyleSheet('Large Text', 1); return false;\" title=\"Switch to Large Text Size\" id=\"text-large\"><span style=\"font-size:15px;\">A</span></a></span>");
}

function printerFriendlyPage(siteStyle)
{ 
  var display_setting="toolbar=yes,location=no,directories=yes,menubar=yes,resizable=yes,"; 
      display_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
      
  var docprint=window.open("","",display_setting); 
   docprint.document.open(); 
   docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
   

     docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
   docprint.document.write('<html><head><title>' + document.title + '</title>'); 
   docprint.document.writeln('<link rel="stylesheet" type="text/css" href="' + siteStyle + 'bpv3.css"/>');
   docprint.document.writeln('<link type="text/javascript" href="' + siteStyle + 'common.css"/>');
   docprint.document.writeln('<link media="screen" rel="stylesheet" type="text/css" href="' + siteStyle + 'print.css"/>');
   docprint.document.writeln('<link media="print" rel="stylesheet" type="text/css" href="' + siteStyle + 'print.css"/>');
   docprint.document.write('</head><body onLoad="self.print()">');          
   docprint.document.write('<table width=\"100%\" border=\"0\">');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id=\"printHeader\">');
   docprint.document.write(document.getElementById('header').innerHTML);   
   docprint.document.write('</div>');
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id=\"printContent\" >');
   docprint.document.write(document.getElementById('printContent').innerHTML);  
    docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
      docprint.document.write('<div id="printFooter">');
   docprint.document.write(document.getElementById('printFooter').innerHTML);    
     docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
         docprint.document.write('<div id="printSubfooter">');
   docprint.document.write(document.getElementById('printSubfooter').innerHTML);   
     docprint.document.write('</div>');         
   docprint.document.write('</tr></td>');
   docprint.document.write('</table>');
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus();
}



function bpv3OnLoad()
{
    ChangeSearchImage(document);
    var thisURL = window.location.host;
    
    if(thisURL!= null & thisURL.indexOf("lillypatientone-public.lilly.com") == 0)
    {
        var hiddendiv = document.all['site_actions'];
        if(hiddendiv != null)
        {
	        hiddendiv.style.visibility = "hidden";
        }
    }
    
    applyFunction(document);
    
    setActive();
    
    CheckFlashPlayer();
}
function bpv3OnUnload()
{
  
}


/*===================================
--start RadEditor button js
=====================================*/
// java script for web trend integration
function applyPopup( node )
{   
	if ( node.nodeType == 1 && node.tagName == "A" && node.id.indexOf("popup_") == 0)
	{
		var linkNode = document.getElementById(node.id);
		linkNode.url = linkNode.href;
//		linkNode.href="#";
		//linkNode.onclick=myOpenWindowForPopup;
		linkNode.onclick=myOpenWindow;

	}
}

function applyInline( node )
{
	if ( node.nodeType == 1 && node.tagName == "A" && node.id.indexOf("inline_") == 0)
	{
		var linkNode = document.getElementById(node.id);
	}
}

function myOpenWindowForPopup(e)
{
	var linkNode;
    if(e==null)
    {
	    linkNode = window.event.srcElement;
    }
    else
    {
	    linkNode=e.target;
    }	
	while(linkNode!=null)
	{		   
	    if(linkNode.tagName=="A")
	    {	
		      
	        window.showModalDialog(linkNode.url,'','dialogHeight:450px;dialogWidth:500px;dialogTop:px;dialogLeft:px;dialogRight:px;center:Yes;scroll:no;resizable:yes;status:no;');
	        
	        break;
	    }
	    else
	    {
	        linkNode=linkNode.parentNode;
	    }
	}
	return false;
}

function myOpenWindow(e)
{
	var linkNode;
    if(e==null)
    {
	    linkNode = window.event.srcElement;
    }
    else
    {
	    linkNode=e.target;
    }	
	while(linkNode!=null)
	{		   
	    if(linkNode.tagName=="A")
	    {
		
	        openWindow(linkNode.url,'',450,425,'no','no');
	        break;
	    }
	    else
	    {
	        linkNode=linkNode.parentNode;
	    }
	}
	return false;
}

function applyWebTrends( node )
{
    if ( node.nodeType == 1 && node.tagName == "A" && node.id.indexOf("webtrends_") == 0)
    {
	    var linkNode = document.getElementById(node.id);
	    linkNode.url = linkNode.href;
	    linkNode.href="#";
	    linkNode.onclick=myCallWebTrends;
    }
}

function myCallWebTrends(e)
{
    var linkNode;
    if(e==null)
    {
	    linkNode = window.event.srcElement;
    }
    else
    {
	    linkNode=e.target;
    }

    while(linkNode!=null)
    {		   
        if(linkNode.tagName=="A")
        {
        
        try{	               
            dcsMultiTrack('DCS.dcsuri',linkNode.url,'WT.ti',linkNode.innerText,'DCS.dcssip','');
            }
            catch(e)
            {
            }
            
            window.location=linkNode.url;
            break;
        }
        else
        {
            linkNode=linkNode.parentNode;
        }
    }
}

function getParams( name )
{  
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
    var regexS = "[\\?&]"+name+"=([^&#]*)";  
    var regex = new RegExp( regexS );  
    var results = regex.exec( window.location.href );  
    if( results == null )   
    {
	    return "";
    }
    else
    {
	    return results[1];
    }	
}

function myOpenWin(e)
{
    var linkNode;
    if(e==null)
    {
	    if(window.event.srcElement.tagName == "A")
	    {
	     linkNode = window.event.srcElement;
	    }
	    else
	    {
	     linkNode = window.event.srcElement.parentNode;
	    }
	    
    }
    else
    {
	    linkNode=e.target;
    }
    window.history.go(-1);
    
    openWindow(linkNode.url,'',640,480,'yes','yes');	
    return false;
}
		
function applyURL( node )
{
    var navigateurl = unescape(getParams('URL'));
    var interstitialType = getParams('InterstitialType');

    if (interstitialType == "inline")
    {
        if ( node.nodeType == 1 && node.tagName == "A" && node.id.toUpperCase().indexOf("YES") == 0)
        {
	        var linkNodeYes = document.getElementById(node.id);
	        linkNodeYes.href = "#";
	        linkNodeYes.url = navigateurl;
	        linkNodeYes.onclick = myOpenWin;
        }
    	
        if ( node.nodeType == 1 && node.tagName == "A" && node.id.toUpperCase().indexOf("NO") == 0)
        {
	        var linkNodeNo = document.getElementById(node.id);
	        linkNodeNo.href = "#";
	        linkNodeNo.onclick = goBack;
        }
    }
    else
    {
        if ( node.nodeType == 1 && node.tagName == "A" && node.id.toUpperCase().indexOf("YES") == 0)
        {
	        var linkNodeYes = document.getElementById(node.id);
	        linkNodeYes.href = navigateurl;
	         //Below code is used for IE browser to close the Interstitial Window. In other browsers, the interstital popup remains open
	       // var ua = navigator.userAgent.toLowerCase();
	        //if ( ua.indexOf( "msie" ) != -1 ) {
	        //linkNodeYes.onclick = closeWin;
	        //}
	        linkNodeYes.onclick = openExternalLink;
        }
    	
        if ( node.nodeType == 1 && node.tagName == "A" && node.id.toUpperCase().indexOf("NO") == 0)
        {
	        var linkNodeNo = document.getElementById(node.id);
	        linkNodeNo.href = "#";
	        linkNodeNo.onclick = closeWin;
        }
    }

}	

function openExternalLink(e)
{
    var linkNode;
    if(e==null)
    {
	    linkNode = window.event.srcElement;
    }
    else
    {
	    linkNode=e.target;
    }

	        //Below code is used for IE browser to close the Interstitial Window. In other browsers, the interstital popup remains open
	        var ua = navigator.userAgent.toLowerCase();
	        if ( ua.indexOf( "firefox" ) > -1 ) 
	        {
				window.open(linkNode.parentNode)
			}
	closeWin();
}



function goBack()
{
    window.history.go(-1);
    return false;
}

function closeWin()
{
  window.close();
}

function applyFunction( node )
{
    applyPopup(node);
    applyInline(node);
    applyWebTrends(node);
    applyURL(node);

    var children = node.childNodes;
    for ( var i = 0; i < children.length; i++ )
    {
        applyFunction( children[i] );
    }
}
function ShowForm(url)
{
    var rtnValue = window.showModalDialog(url,'','dialogHeight:130px;dialogWidth:450px;dialogTop:px;dialogLeft:px;dialogRight:px;center:Yes;scroll:yes;resizable:no;status:no;');
    return rtnValue;
}


/*===================================
--end RadEditor button
=====================================*/

function ChangeSearchImage(node)
{
	if((node.tagName == "A") || (node.tagName == "a"))
	{
	    
	    if(node.title == "Advanced Search")
	    {
	    
	       node.style.display = "none";
	       
	     
	    }
	}
	if((node.tagName == "IMG") || (node.tagName == "img"))
	{
	    if(node.title == "Go Search")
	    {
	        node.onmouseover="this.src='/PublishingImages/btn_search.gif'";
	        node.onmouseout="this.src='/PublishingImages/btn_search.gif'";
	        node.src = "/PublishingImages/btn_search.gif";
	        node.parentNode.parentNode.className = "ms-sbgo-bpv3";
	    }
	}
	
	
	if(window.location.href.toLowerCase().indexOf(window.location.host.toLowerCase()+"/pages/default.aspx")>0)
	{

	    if((node.tagName == "SPAN") || (node.tagName == "span"))
	    {
    	    
	        if(node.className == "breadcrumbCurrent")
	        {

    	     //  node.innerHTML = "<a class=\"ms-sitemapdirectional\" href=\"/Pages/default.aspx\">"+node.innerText+"</a>";
    	       node.style.display = "none";
	   
    	       
    	     
	        }
	    }
    	
    }
	//if((node.tagName == "DIV") || (node.tagName == "div"))
	//{
	    
	//    if(node.id == "bpv3_toolbar")
	//    {
	    
	//       node.style.display = "none";
	       
	//     
	//    }
	//      if(node.id == "breadcrumb")
	//    {
	//    
	//       node.style.display = "none";
	//       
	//     
	//    }

	//}
	
	var children = node.childNodes;
    for ( var i = 0; i < children.length; i++ )
    {
        ChangeSearchImage(children[i]);
    }
}


/*===================================
-- Flash detection start
=====================================*/

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function DetectFlashFiles(node)
{
    var embeds = node.embeds;
	
	if(embeds != null)
	{
	    for(var i = 0; i < embeds.length; i++)
	    {
	        var embedContent = embeds[i].outerHTML;
	        
	        if(embedContent.search('application/x-shockwave-flash') > 0)
	        {
	            return true;
	        }
	    }
	}
	
	var children = node.childNodes;
	for(var i = 0; i < children.length; i++)
	{
	    DetectFlashFiles(children[i]);
	}
	
	return false;
}

function CheckFlashPlayer()
{
    // Major version of Flash required
    var requiredMajorVersion = 8;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    
    if(DetectFlashFiles(document))
    {
        // Version check based upon the values entered above in "Globals"
        var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

        // Check to see if the version meets the requirements for playback
        if (hasReqestedVersion) {
            // if we've detected an acceptable version
            // do nothing
        }
        else
        {  // flash is too old or we can't detect the plugin
            if(window.confirm('This content requires the Adobe Flash Player. Click OK to get.'))
            {
                window.open('http://www.adobe.com/go/getflash/', '_blank');
            }
        }
    }
}

/*===================================
-- Flash detection end
=====================================*/




/*===================================
-- Begin image rollover functions
====================================*/
//Preload specified images on the page
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//Restore the specified image to its original state
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//Find image objects with specified IDs
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//Swap oringal image with specifed image
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*===================================
-- End image rollover functions
====================================*/




function setActive() {
if(document.getElementById('navLevel2')!=null)
{
  aObj = document.getElementById('navLevel2').getElementsByTagName('a');
  for(i=0;i<aObj.length;i++) {
  var pagelocation = document.location.href.toLowerCase();

    if(pagelocation.indexOf(aObj[i].href.toLowerCase())>=0) {
      //aObj[i].className='active';
	aObj[i].style.backgroundColor="#edeeef";

    }
  }
}
}



/* Code for lillyPatientone site  leftnav flyover.......................................................*/

var over;

function show_i_need_to ()
{
	over = 1;
	//$('i-need-to').show();
	document.getElementById('i-need-to').style.display="block";
}

//hide the i need to layer
function hide_i_need_to ()
{
	if(over == 0)
	{
		//$('i-need-to').hide();
		document.getElementById('i-need-to').style.display="none";
	}
}








/* ====================================
-- lillypatientone center dropdown
======================================== */



//extras (added by eric prugh)
var found_the_state;

	function do_search()
	{
	var e = document.getElementById("state-abbreviation"); // select element
	var str = e.options[e.selectedIndex].value.toUpperCase();
	//alert(e.options[2].value.toUpperCase());
	//alert(str); 
	//var $F = Form.Element.getValue;
	//value = $(element).getValue();
	
 
		var states = new Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "PR");
			

		for(var i=0; i<52; i++){
			if(states[i] == str)
			{
				
				if(states[i] !="")
				{
					//alert(str);
					//$('states[i]').show();
					var aa=document.getElementById(str);
					//alert(aa);
					aa.style.display='block'; 
					found_the_state = 1;
					
				}
			}
			else
			{
				if(states[i] !="")

				{
					// $(states[i]).hide();
					
					document.getElementById(states[i]).style.display='none';
					
				}
			}
			
			

		}
		
//alert(found_the_state);
//alert('hello');

		if(str=="")
		{
			
			//alert('hi');
			
			
			document.getElementById('err_message').innerHTML = "<div id= 'aligntop'><p>No state has that abbreviation. Please try again.</p></div>";
			document.getElementById('err_message').style.display= 'block';
			
		}
		else
		{
			//$('error').hide();
			document.getElementById('err_message').style.display= 'none';
			found_the_state = 0;
		}
		return false;
	}


function hide_links()
{
// document.getElementById('optional').style.visibility='hidden';
var states = new Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "PR");
		for(var i=0; i<52; i++){
document.getElementById(states[i]).style.display='none';
}
}

/*===================================
-- End Drop-down menu function
====================================*/









/*========================================
-- Default MOSS Search Functionality 
===========================================*/



function searchfunc()
{

 var searchValue = document.getElementById('searchInputField').value; 
 document.getElementById('ctl00_head_PlaceHolderSearchArea_ctl01_SABFBB873_InputKeywords').value = searchValue; 
 SABFBB873_Submit();
 	
}


/*========================================
-- End of MOSS Search 
===========================================*/




// 1. Apply the 'sfhover' class to li elements in the 'nav' id'd ul element when they are 'moused over'
// 2. Remove the 'sfhover' class from li elements in the 'nav' id'd ul element when 'moused out'

// 1. Apply the 'sfhover' class to li elements in the 'nav' id'd ul element when they are 'moused over'
// 2. Remove the 'sfhover' class from li elements in the 'nav' id'd ul element when 'moused out'
sfHover = function() {
        var pagename = window.location.pathname;
	//if((pagename.indexOf("interstitial")==-1) && (pagename.indexOf("/index.aspx")==-1) && (pagename.indexOf("Results.aspx")==-1))
	  if(document.getElementById("nav")!=null)	
{
	
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);






/*========================================
--  Left Navaigation Mouse hover Function 
===========================================*/


LeftNavLinks = function() {
  //alert('hi');
  //sObj = document.getElementById('searchContainer_patient');
  //sObj.style.position = "absolute";
  

  var pagename = window.location.pathname;

  //if((pagename.indexOf("interstitial")==-1) && (pagename.indexOf("/index.aspx")==-1) && (pagename.indexOf("Results.aspx")==-1) )
	  if(document.getElementById("navLevel2")!=null)	
    
  {
   	
   aObj = document.getElementById('navLevel2').getElementsByTagName('a');
   for(i=0;i<aObj.length;i++) {
	
    aObj[i].onmouseover= function() {
			this.style.backgroundColor="#edeeef";
			
			
		}
    if(document.location.href.indexOf(aObj[i].href) == -1)
{
    aObj[i].onmouseout= function() {
			this.style.backgroundColor="transparent";
			
			
		}
}
    

    aObj[i].onclick= function() {
			this.style.backgroundColor="#edeeef";
		
			
			
		}



 
   }
 }
 

}
if (window.attachEvent) window.attachEvent("onload", LeftNavLinks);



/*================================================
--  End of Left Navaigation Mouse hover Function 
==================================================*/





/*=====================================
--  Left Navaigation Selected option
=======================================*/


setLinkActive = function() {
  //alert('hi');
  var pagename = window.location.pathname; 
  //if((pagename.indexOf("interstitial")==-1) && (pagename.indexOf("/index.aspx")==-1) && (pagename.indexOf("Results.aspx")==-1) )
	  if(document.getElementById("navLevel2")!=null)	
  {
  	
  aObj = document.getElementById('navLevel2').getElementsByTagName('a');
  for(i=0;i<aObj.length;i++) {
    if(document.location.href.indexOf(aObj[i].href)>=0) {
      //aObj[i].className='active';
	aObj[i].style.backgroundColor="#edeeef";

    }
  }
 }

}

//if (window.attachEvent) window.attachEvent("onload", setLinkActive);


/*=============================================
--  End of Left Navaigation Selected option 
===============================================*/






/*============================================================
--  Triggering Search Functionality on Clicking Enter Key 
=============================================================*/


function checkEnter(event1) { 
var kCode = String.fromCharCode(event1.keyCode);
if(kCode == "\n" || kCode == "\r")
{   
searchfunc();
}
}

/*==========================================
--  End of  Triggering Search Functionality
============================================*/