/////////////////////////////////////////////////////////////////////////////////////// 
var _bpDev = new BpDev();


///////////////////////////////////////////////////////////////////////////////////////
function BpDev() {
	this._debug = true;
	this.isDebug = __isDebug;

	function __isDebug() {
		return this._debug;
	}


}


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];}}
}

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;
}

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;
}

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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Toggels images
// parm: targetImageName : String - the name of the image to replace
// parm: newImgSource : String - the name and path of the image to replate the target image with
//
// return: void
function toggleImage(targetImageName, newImgSource) {
	
	if (_bpDev.isDebug()) {
		if (targetImageName == null || newImgSource == null || targetImageName == "" || 
			newImgSource == "") {
			alert("Error : toggleImage : targetImageName parm or newImgSource parm is null or empty.");
		}
	}
	document.images[targetImageName].src = newImgSource;
}


function thirdParty(theURL) { 
	var myURL = "/interstitials/3rd_party.jsp?redirect="+encodeUrl(theURL);
	window.open(myURL,'myWin','scrollbars=yes, width=450,height=400');
}

function allianceLink(theURL) { 
	var myURL = "/interstitials/alliance_link.jsp?redirect="+encodeUrl(theURL);
	window.open(myURL,'myWin','scrollbars=yes, width=450,height=400');
}

function thirdPartySpa(theURL) { 
	var myURL = "/interstitials/3rd_party_spa.jsp?redirect="+encodeUrl(theURL);
	window.open(myURL,'myWin','scrollbars=yes, width=450,height=400');
}

function encodeUrl(url) {
	return escape(url);
}

function withinLilly(theURL){
	var myURL = "/interstitials/within_lilly.jsp?redirect="+theURL;
	window.open(myURL,'myWin','scrollbars=yes, width=400,height=350');
}

function withinLillyTFI(theURL){
	var myURL = "/interstitials/within_lilly_tfi.jsp?redirect="+theURL;
	window.open(myURL,'myWin','scrollbars=yes, width=400,height=350');
}

function withinLillySpa(theURL){
	var myURL = "/interstitials/within_lilly_spa.jsp?redirect="+theURL;
	window.open(myURL,'myWin','scrollbars=yes, width=400,height=350');
}

function disclaimerHCP(theURL){
	var myURL = "/interstitials/lillydiabetes_hcp.jsp?redirect="+theURL;
	window.open(myURL,'myWin','scrollbars=yes, width=450,height=360');
}

// Swap Image Script

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;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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];}}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// Email a Friend Script

function emailafriend() {
        var currentSite = window.location.href;
        var url = "";
  if (currentSite.indexOf("-d.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-d.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else if (currentSite.indexOf("-d6.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-d6.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else if (currentSite.indexOf("-qa.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-qa.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else {
          url = "https://emailafriend.lilly.com/index.jsp?url=" + currentSite;
        }
        window.open(url, 'EmailAFriend', 'height=500, resizable=yes, scrollbars=yes, width=650');
}

//Autotmatic updating copyright year in footer files.
function copyear() {
	dt = new Date();
	var str = dt.getFullYear()
	document.write(str)
	}

//below is the hash table for inline linking

var myHashTable = new Object();
//section 1 - About Diabetes
myHashTable['/about_diabetes/about_diabetes.jsp'] = '1.0';
myHashTable['/about_diabetes/diabetes_basics.jsp'] = '1.1';
myHashTable['/about_diabetes/types.jsp'] = '1.1.1';
myHashTable['/about_diabetes/symptoms.jsp'] = '1.1.2';
myHashTable['/about_diabetes/screening_type_2.jsp'] = '1.1.3';
myHashTable['/about_diabetes/how_treated.jsp'] = '1.1.4';
myHashTable['/about_diabetes/treatment_stages_type_2.jsp'] = '1.1.5';
myHashTable['/about_diabetes/oral_medicines_type_2.jsp'] = '1.1.6';
myHashTable['/about_diabetes/self_managed_disease.jsp'] = '1.1.7';
myHashTable['/about_diabetes/feelings_and_support.jsp'] = '1.1.8';
myHashTable['/about_diabetes/education.jsp'] = '1.1.9';
myHashTable['/about_diabetes/goals_and_targets.jsp'] = '1.1.10';
myHashTable['/about_diabetes/what_is_an_a1c.jsp'] = '1.1.11';
myHashTable['/about_diabetes/blood_sugar_testing.jsp'] = '1.2';
myHashTable['/about_diabetes/food.jsp'] = '1.3';
myHashTable['/about_diabetes/good_nutrition.jsp'] = '1.3.1';
myHashTable['/about_diabetes/how_different_foods.jsp'] = '1.3.2';
myHashTable['/about_diabetes/which_foods_have_carb.jsp'] = '1.3.3';
myHashTable['/about_diabetes/counting_carbs.jsp'] = '1.3.4';
myHashTable['/about_diabetes/sugar_free_foods.jsp'] = '1.3.5';
myHashTable['/about_diabetes/how_much_to_eat.jsp'] = '1.3.6';
myHashTable['/about_diabetes/how_much_overall.jsp'] = '1.3.7';
myHashTable['/about_diabetes/how_much_at_one_time.jsp'] = '1.3.8';
myHashTable['/about_diabetes/can_i_adjust.jsp'] = '1.3.9';
myHashTable['/about_diabetes/alcohol_and_blood_sugar.jsp'] = '1.3.10';
myHashTable['/about_diabetes/exercise.jsp'] = '1.4';
myHashTable['/about_diabetes/getting_started.jsp'] = '1.4.1';
myHashTable['/about_diabetes/making_it_safe.jsp'] = '1.4.2';
myHashTable['/about_diabetes/making_it_last.jsp'] = '1.4.3';
myHashTable['/about_diabetes/highs.jsp'] = '1.5';
myHashTable['/about_diabetes/high_blood_sugar_feel.jsp'] = '1.5.1';
myHashTable['/about_diabetes/why_is_it_a_problem.jsp'] = '1.5.2';
myHashTable['/about_diabetes/what_can_i_do.jsp'] = '1.5.3';
myHashTable['/about_diabetes/very_high_blood_sugars.jsp'] = '1.5.4';
myHashTable['/about_diabetes/lows.jsp'] = '1.6';
myHashTable['/about_diabetes/what_do_lows_feel_like.jsp'] = '1.6.1';
myHashTable['/about_diabetes/what_causes_lows.jsp'] = '1.6.2';
myHashTable['/about_diabetes/but_i_feel_fine.jsp'] = '1.6.3';
myHashTable['/about_diabetes/how_can_i_prevent_lows.jsp'] = '1.6.4';
myHashTable['/about_diabetes/best_way_to_treat_lows.jsp'] = '1.6.5';
myHashTable['/about_diabetes/what_is_glucagon.jsp'] = '1.6.6';
myHashTable['/about_diabetes/staying_healthy.jsp'] = '1.7';
myHashTable['/about_diabetes/it_takes_a_team.jsp'] = '1.7.1';
myHashTable['/about_diabetes/standards_of_care.jsp'] = '1.7.2';
myHashTable['/about_diabetes/talking_to_your_team.jsp'] = '1.7.3';
myHashTable['/about_diabetes/care_of_skin.jsp'] = '1.7.4';
myHashTable['/about_diabetes/care_of_feet.jsp'] = '1.7.5';
myHashTable['/about_diabetes/care_of_eyes.jsp'] = '1.7.6';
myHashTable['/about_diabetes/care_of_teeth_gums.jsp'] = '1.7.7';
//section 2 - Deciding to take insulin
myHashTable['/deciding_insulin/deciding_to_take_insulin.jsp'] = '2.0';
myHashTable['/deciding_insulin/why_take_insulin.jsp'] = '2.1';
myHashTable['/deciding_insulin/have_concerns.jsp'] = '2.2';
myHashTable['/deciding_insulin/how_do_i_know_time.jsp'] = '2.3';
myHashTable['/deciding_insulin/how_does_it_work.jsp'] = '2.4';
myHashTable['/deciding_insulin/making_the_decision.jsp'] = '2.5';
//section 3 - Using Insulin
myHashTable['/using_insulin/using_insulin.jsp'] = '3.0';
myHashTable['/using_insulin/what_is_insulin.jsp'] = '3.1';
myHashTable['/using_insulin/how_body_uses_insulin.jsp'] = '3.2';
myHashTable['/using_insulin/what_types_of_insulin.jsp'] = '3.3';
myHashTable['/using_insulin/which_type_is_right.jsp'] = '3.4';
myHashTable['/using_insulin/background.jsp'] = '3.4.1';
myHashTable['/using_insulin/premixed.jsp'] = '3.4.2';
myHashTable['/using_insulin/two_mixed.jsp'] = '3.4.3';
myHashTable['/using_insulin/three_mixed.jsp'] = '3.4.4';
myHashTable['/using_insulin/multiple.jsp'] = '3.4.5';
myHashTable['/using_insulin/more_injections.jsp'] = '3.5';
myHashTable['/using_insulin/how_much_will_i_need.jsp'] = '3.6';
myHashTable['/using_insulin/what_will_i_use.jsp'] = '3.7';
myHashTable['/using_insulin/insulin_alone.jsp'] = '3.8';
//section 4 - Getting the most from insulin
myHashTable['/getting_the_most/getting_the_most_from_insulin.jsp'] = '4.0';
myHashTable['/getting_the_most/high_a1c.jsp'] = '4.1';
myHashTable['/getting_the_most/find_the_problem_a1c.jsp'] = '4.1.1';
myHashTable['/getting_the_most/troubleshoot_food_a1c.jsp'] = '4.1.2';
myHashTable['/getting_the_most/troubleshoot_insulin_a1c.jsp'] = '4.1.3';
myHashTable['/getting_the_most/other_causes_a1c.jsp'] = '4.1.4';
myHashTable['/getting_the_most/high_ppg.jsp'] = '4.2';
myHashTable['/getting_the_most/find_the_problem_ppg.jsp'] = '4.2.1';
myHashTable['/getting_the_most/troubleshoot_food_ppg.jsp'] = '4.2.2';
myHashTable['/getting_the_most/troubleshoot_insulin_ppg.jsp'] = '4.2.3';
myHashTable['/getting_the_most/other_causes_ppg.jsp'] = '4.2.4';
//section 5 - Products
myHashTable['/product/products.jsp'] = '5.0';
myHashTable['/product/actos.jsp'] = '5.1';
myHashTable['/product/byetta.jsp'] = '5.2';
myHashTable['/product/cialis.jsp'] = '5.3';
myHashTable['/product/cymbalta.jsp'] = '5.4';
myHashTable['/product/humalog.jsp'] = '5.5';
myHashTable['/product/humalog_mix_75_25.jsp'] = '5.6';
myHashTable['/product/humulin_family.jsp'] = '5.7';
myHashTable['/product/glucagon.jsp'] = '5.8'; 
myHashTable['/product/insulin_pens.jsp'] = '5.9'; 
myHashTable['/product/pen_faqs.jsp'] = '5.9.1';
myHashTable['/product/insulin_faqs.jsp'] = '5.10';
myHashTable['/product/bar_coding.jsp'] = '5.11';
myHashTable['/product/discontinued.jsp'] = '5.12';
myHashTable['/common_pages/safety_information.jsp'] = '5';
//section 6 - Lilly for life
myHashTable['/lilly_for_life/lilly_for_life.jsp'] = '6.0';
myHashTable['/lilly_for_life/lilly_for_life.jsp'] = '6.1';
myHashTable['/lilly_for_life/lfl_jack_mccarthy.jsp'] = '6.2';
myHashTable['/lilly_for_life/insulin_25_year_award.jsp'] = '6.3';
myHashTable['/lilly_for_life/insulin_50_year_award.jsp'] = '6.4';
myHashTable['/lilly_for_life/insulin_75_year_award.jsp'] = '6.5';
myHashTable['/lilly_for_life/lilly_for_life_ambassador.jsp'] = '6.6';
myHashTable['/lilly_for_life/freeman_straight.jsp'] = '6.6.1';
myHashTable['/lilly_for_life/freeman_articles.jsp'] = '6.6.2';
//the following are common pages, (and the index), and do not require a NavID
myHashTable['/common_pages/resources.jsp'] = '';
myHashTable['/common_pages/ask_lilly.jsp'] = '';
myHashTable['/common_pages/site_map.jsp'] = '';
myHashTable['index.jsp'] = '';

/////////////////// S P A N I S H   S E C T I O N  /////////////////// 

//section 1 - About Diabetes
myHashTable['/spa/about_diabetes/about_diabetes.jsp'] = '1.0';
myHashTable['/spa/about_diabetes/diabetes_basics.jsp'] = '1.1';
myHashTable['/spa/about_diabetes/types_of_diabetes.jsp'] = '1.1.1';
myHashTable['/spa/about_diabetes/symptoms_of_diabetes.jsp'] = '1.1.2';
myHashTable['/spa/about_diabetes/how_treated.jsp'] = '1.1.3';
myHashTable['/spa/about_diabetes/goals_targets.jsp'] = '1.1.4';
myHashTable['/spa/about_diabetes/support.jsp'] = '1.1.5';
myHashTable['/spa/about_diabetes/blood_sugar_testing.jsp'] = '1.2';
myHashTable['/spa/about_diabetes/food_nutrition.jsp'] = '1.3';
myHashTable['/spa/about_diabetes/different_foods.jsp'] = '1.3.1';
myHashTable['/spa/about_diabetes/how_much.jsp'] = '1.3.2';
myHashTable['/spa/about_diabetes/exercise.jsp'] = '1.4';
myHashTable['/spa/about_diabetes/highs_lows.jsp'] = '1.5';
myHashTable['/spa/about_diabetes/staying_healthy.jsp'] = '1.6';
myHashTable['/spa/about_diabetes/care_guidelines.jsp'] = '1.6.1';
myHashTable['/spa/about_diabetes/talking_with_team.jsp'] = '1.6.2';
myHashTable['/spa/about_diabetes/taking_care.jsp'] = '1.6.3';
//section 2 - About Insulin
myHashTable['/spa/about_insulin/about_insulin.jsp'] = '2.0';
myHashTable['/spa/about_insulin/what_is_insulin.jsp'] = '2.1';
myHashTable['/spa/about_insulin/what_type.jsp'] = '2.2';
myHashTable['/spa/about_insulin/what_will_i_use.jsp'] = '2.3';
myHashTable['/spa/about_insulin/deciding_to_take.jsp'] = '2.4';
//section 3 - Products
myHashTable['/spa/products/products.jsp'] = '3.0';
myHashTable['/spa/products/humalog.jsp'] = '3.1';
myHashTable['/spa/products/humalog_mix_75_25.jsp'] = '3.2';
myHashTable['/spa/products/humulin_family.jsp'] = '3.3';
myHashTable['/spa/products/insulin_pens.jsp'] = '3.4';
myHashTable['/spa/products/products_faqs.jsp'] = '3.5';
//common pages
myHashTable['/spa/common_pages/site_map.jsp'] = '';
myHashTable['/spa/common_pages/resources.jsp'] = '';
myHashTable['/spa/common_pages/ask_lilly.jsp'] = '';
myHashTable['/spa/common_pages/safety_information.jsp'] = '';


/////////////////// H C P   S E C T I O N  /////////////////// 

//section 1 - Patient Education Downloads
myHashTable['/hcp/patient-education.jsp'] = '1.0';
myHashTable['/hcp/patient-education.jsp'] = '1.1';
//section 2 - Treatment Products
myHashTable['/hcp/treatments.jsp'] = '2.0';
myHashTable['/hcp/treatments.jsp'] = '2.1';
myHashTable['/hcp/insulin_resistance.jsp'] = '2.2';
myHashTable['//hcp/incretins.jsp'] = '2.3';
myHashTable['/hcp/insulins.jsp'] = '2.4';
myHashTable['/hcp/related_conditions.jsp'] = '2.5';
//section 3 - Reimbursement Information
myHashTable['/hcp/reimbursement.jsp'] = '3.0';
myHashTable['/hcp/reimbursement.jsp'] = '3.1';
//section 4 - Resources and Other Links
myHashTable['/hcp/resources.jsp'] = '4.0';
myHashTable['/hcp/resources.jsp'] = '4.1';


//function name: getNavId
//function: called from getID, takes in page name, returns pageNavId	
//function name: getNavId
//function: called from getID, takes in page name, returns pageNavId	
function getNavId (whatPage) {
	var myNavId = myHashTable[whatPage];
	return myNavId;
}
//function name: getID
//function: is called from the links in order to call getNavId function and determine the links navigation ID
function getID(pageName) {
	//only capture up to the .jsp", and do not capture characters after
	//getDot returns the number where the dot hits
	var getDot = pageName.indexOf('.');
	//add 4 to get dot to get the first char after the dot
	getDot+=4;
	var newString = pageName.substring(0,getDot);
	var appendString = pageName.substring(getDot);
	var appendMe = getNavId(newString);
	if(appendMe!=''){
		var finalURL = newString + "?reqNavId=" + appendMe + appendString;
	}else{
		var finalURL = pageName + appendString;
	}
	window.location.href = finalURL;
}


