/* PLUG-IN CHECK */
var requiredVersion = 5;   

var flash2Installed = false;    
var flash3Installed = false;    
var flash4Installed = false;    
var flash5Installed = false;    
var flash6Installed = false;    
var flash7Installed = false;    
var flash8Installed = false;    
var flash9Installed = false;    
var maxVersion = 9;             
var actualVersion = 0;          
var hasRightVersion = false;    
var jsVersion = 1.0;            



var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;

jsVersion = 1.1;

if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); 
}


function detectFlash() {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
     
      var flashVersion = parseInt(flashDescription.substring(16));

      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  

  if (actualVersion >= requiredVersion) {
    hasRightVersion = true;                
  }
}

detectFlash();


/* PLUG-IN CHECK END */



function runFlash(swfFile,width,height,id) { 
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="' + width + '" HEIGHT="'+ height + '" id="' + id + '" ALIGN="">\n');
document.write('<PARAM NAME=movie VALUE="' + swfFile + '">\n');
document.write('<PARAM NAME=quality VALUE=high>\n');
document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>\n');
document.write('<EMBED src="' + swfFile + '" quality=high bgcolor=#FFFFFF  WIDTH="' + width +'" HEIGHT="'+ height + '" NAME="' + id + '" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');  
}


function popUp(URL, attributes){
  var popUp = window.open(URL, 'newWindow', attributes)
  popUp.focus();
} 


function changeFormAction(theForm, newAction){
  document.forms[theForm].action = newAction;
  document.forms[theForm].submit();
}


function featureTopics(theForm){
  topics = new Array();            //All the topics form elements
  topicsIndex = 0;                 //Topics elements array index
  topicsChkd = new Array();        //Checked topics
  topicsChkdIndex = 0;             //Check topics index
  
  var hivesChkd = false;               
  var qaChkd= false;
  
  formElements = document.forms[theForm].elements.length;
  
  // Gather all form elements named 'topics'
  for (i=0; i<formElements; i++){
    if(document.forms[theForm].elements[i].name == "topics") {
      topics[topicsIndex] = document.forms[theForm].elements[i];
      topicsIndex++;
    }
    
  }
  
  //Gather how many topics elements checked  
  for (i=0; i<topics.length; i++){
    if (topics[i].checked){
      topicsChkd[topicsChkdIndex] = topics[i];
      topicsChkdIndex++;
    }       
  }

  //One topic selected, if it's hives or q&a, select clarinex info
  if (topicsChkd.length == 1) {  
      for (i=0; i<topicsChkd.length; i++){
        if (topicsChkd[i].value == "hives") hivesChkd = true;
        if (topicsChkd[i].value == "q_and_a") qaChkd = true;      
      }
      
      if( hivesChkd || qaChkd){
        for (i=0; i<topics.length; i++){
          if (topics[i].value == "clarinex_inf") topics[i].checked = true;
        }
      }  
  }
}



function pollenAlertCheck(theForm, mainChk){
  theForm = document.forms[theForm];  // Syntax shortcut
  sectionElements = new Array ();      // Section form elements
  var elementChkd;                    // Section form element checked flag

  
  //Gather section elements
  numSectionElements = pollenAlertCheck.arguments.length - 2;
  for (i=0; i<numSectionElements; i++){
    sectionElements[i] = pollenAlertCheck.arguments[i+2]; // Add 2 to bypass first 2 parameters of function
  }
  
  //Check element type and if checked
  for (i=0; i<sectionElements.length; i++){
    if ( sectionElements[i].type == "checkbox" && sectionElements[i].checked) {
      elementChkd = true;
    }
    else if (sectionElements[i].type == "text" && sectionElements[i].value != ""){
      elementChkd = true;
    }
    else if ( sectionElements[i].type == "radio" && sectionElements[i].checked ){
      elementChkd = true;
    }
  }
  
  if (elementChkd) theForm.elements[mainChk].checked = true;
}


function clearPollenAlert(chkbox){
  if (!chkbox.checked){
    
    numSectionElements = clearPollenAlert.arguments.length - 1; //Gather section elements
    sectionElements = new Array (); // Section form elements
 
    for (i=0; i<numSectionElements; i++){
      sectionElements[i] = clearPollenAlert.arguments[i+1]; // to bypass first 1
    }
  
    for (i=0; i<sectionElements.length; i++){
      if (sectionElements[i].type == "text"){
        sectionElements[i].value = "";
      }
      else if (sectionElements[i].type == "radio" || sectionElements[i].type == "checkbox"){
        sectionElements[i].checked = false;
      }
    } //end type check
    
  }  //end if not checked 

} // end function

function preloadImgs() {
  imgs = preloadImgs.arguments.length;
  
  for (i=0; i<imgs; i++){
    loadedImage = new Image();
    loadedImage.src = preloadImgs.arguments[i];
  }

}			

function checkHiddenField(theForm, chkbox, hiddenField){
  if (chkbox.checked) {
      hiddenField.value = true;
  } else {
    hiddenField.value = tempValue;
  }
  theForm.submit();
}


function usImgSwap(imgPath){
  document.images.USMAP.src = imgPath;
} 

function usThumbnailImgSwap(imgPath){
  document.images.THUMBNAIL.src = imgPath;
}

function openNationalWeatherMap(mapImg){
  var mapWindow = open("", "mapWindow", 'width=660,height=525,resizable');
  mapWindow.focus();
  mapWindow.document.open();
  mapWindow.document.writeln("<html><body><center><img src=" + mapImg + "><br><a href='javascript:window.close()'>Close Window</a></center></body></html>");
  mapWindow.document.close();
}
 
 
 /*
function linkOffSite(URL){
  if ( confirm("You are now leaving the PegIntron web site.\n\nIf you DO NOT wish to leave this site, click Cancel, or click OK to leave PegIntron.\n\nIF YOU ARE USING A POP-UP BLOCKER, YOU WILL NEED TO DISABLE IT TO VIEW THE WEB SITE YOU ARE ATTEMPTING TO ACCESS.") ){
    popUp(URL,'width=640,height=480,location,scrollbars,menubar,toolbar,resizable,directories,status')
  } 
} */

function linkOffSite(URL){
	newURL="/bic/application?namespace=leave_site&origin=template_lower.jsp&event=leave_site&url="+URL;
	window.location=newURL;
} 


function validateMonths(theForm, monthGroupNames, yearValue){
  months = new Array();            //All the month form elements
  monthsIndex = 0;                 //Topics elements array index
  monthsChkd = new Array();        //Checked topics
  monthsChkdIndex = 0;             //Check topics index
  
  formElements = theForm.elements.length;
  
  // Gather all form elements named monthGroupNames
  for (i=0; i<formElements; i++){
    if(theForm.elements[i].name == monthGroupNames) {
      months[monthsIndex] = theForm.elements[i];
      monthsIndex++;
    }
  }

  // If yearround is checked, uncheck all individual months
  for (i=0; i<months.length; i++){
    if (months[i].value == yearValue && months[i].checked){
      for (j=0; j<months.length; j++) {
        if (months[j].value != yearValue && months[j].checked) {
         months[j].checked = false;
        }
      }
    break;
    }
  }
  
  //Submit form
  theForm.submit();
}



function bCanPrint(){
  if (window.print){
    window.print();
  } else {
    alert('Please select Print under the File menu to print this page.');
  }
}

/* Date and Time Functions */
var date = new Date();
var day  = date.getDate();
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;	

var tmp = date.getHours();
var hour = (tmp <= 12) ? tmp : (tmp-12);
hour = ( hour < 10 ) ? "0" + hour : hour;
var sym = (tmp < 12) ? "am" : "pm";
if (hour == "00"){hr=12;}

var minutes = (( date.getMinutes() < 10) ? "0" : "" ) + date.getMinutes();



/* ------------ */
function toggleElementDisplay(eId) {
	//obj = document.getElementById(eId);
//		if (obj.style.display="block") obj.style.display="none";
//		else obj.style.display="block";
//	alert(eId.style.display);
//	obj.style.display="block";
//	alert("toggling " + eId);

	if (document.layers) {
		document.layers[eId].display = (document.layers[eId].display == 'none') ? 'block' : 'none';
	} else if (document.all) {
		document.all[eId].style.display = (document.all[eId].style.display == 'none') ? 'block' : 'none';
	}	else if (document.getElementById) {
		document.getElementById(eId).style.display = (document.getElementById(eId).style.display == 'none') ? 'block' : 'none';
	}
}


function setAssistantDisplay() {
	document.getElementById("assistant").style.cssText = "display:none;";
	document.getElementById("assistant-closed").style.cssText = "display:block;";
	
	if (document.cookie != "") {
		c = document.cookie.split(";");
		for (var i=0; i<c.length; i++) {
			if ( (c[i].split("=")[0] == "assistant") && (c[i].split("=")[1]=="open") ) {
					toggleElementDisplay('assistant');
					toggleElementDisplay('assistant-closed');
					break;
			}
		}
	}
}
/* ------------ */


function setPAminmax(){
	if(document.cookie!=""){
		thisCookie=document.cookie.split(";");
		obj = document.getElementById("persAsst");
		for(i=0;i<1;i++){
			if(thisCookie[i].split("=")[0]=="assistant"&&thisCookie[i].split("=")[1]=="closed"){
				//alert("we have a closed cookie");
				imgSrc=imgPath+ "newbic_maximize.gif"
				document.write("<IMG name=\"bic_lower_pa_minmax\" SRC=\"" + imgSrc + "\" width=\"206\" height=\"12\" alt=\"\" border=\"0\">");
				
			}
			else{
				//alert("we have an open cookie");
				imgSrc=imgPath+ "newbic_minimize.gif"
				document.write("<IMG name=\"bic_lower_pa_minmax\" SRC=\"" + imgSrc + "\" width=\"206\" height=\"12\" alt=\"\" border=\"0\">");
				
			}
		}
	}
}


function collapsePA(){
	obj = document.getElementById("persAsst");
	nav_img = document.getElementById("nav_bic_lower_pa_minmax");
	if(obj.style.display=="block"){
		obj.style.display="none";
		nav_img.innerHTML="<img src='" +imgPath+ "newbic_maximize.gif' width='206' height='12' border='0'>";
		document.cookie="assistant=closed;";
	}
	else{
		obj.style.display="block";
		nav_img.innerHTML="<img src='" +imgPath+ "newbic_minimize.gif' width='206' height='12' border='0'>";
		document.cookie="assistant=open;";
	};
}




function checkAsst(){
	if(document.cookie!=""){
		thisCookie=document.cookie.split(";");
		obj = document.getElementById("persAsst");
		for(i=0;i<1;i++){
			if(thisCookie[i].split("=")[0]=="assistant"&&thisCookie[i].split("=")[1]=="closed"){
				//alert("we have a closed cookie");
				obj.style.display="none";
			}
			else{
				//alert("we have an open cookie");
				obj.style.display="block";
			}
		}
	}
}

function randomTips(){
	tipNum=Math.floor(Math.random()*4);
	switch(tipNum){
		case 0:
			tip = "Injecting around your bedtime might help you to sleep through the \"flu-like\" symptoms of therapy.";
			break;
		case 1: 
			tip = "<a href=\"/bic/application?namespace=enroll_BIC&origin=template_lower.jsp&event=enroll_BIC\">Contact the Be In Charge</a> support program. You will be teamed with your own personal Nurse Counselor at any time on any day. When a nurse speaks with a patient they can have the translation line on the call to provide translation into 150 different languages.";
			break;
		case 2:
			tip = "Your <a href='/bic/application?namespace=main&origin=nav_left.jsp&event=content_display&event_input=diary&category=on_treatment'>Patient Diary</a> is going to be an important part of your treatment. Filling in your Patient Diary will give you a sense of accomplishment as you see the weeks of therapy go by.";
			break;
		case 3: 
			tip = "Drinking plenty of water can help you to manage side effects of therapy. So remember to drink at least 10 to 16 full glasses of water every day.";
			break;
		default:
			tip = "Drinking plenty of water can help you to manage side effects of therapy. So remember to drink at least 10 to 16 full glasses of water every day.";
			break;
	}
	document.write(tip);
}
function changeMonth(){
	text31="<select name='day' id='day' onchange='changeAppt();'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option><option value='31'>31</option></select>";
	text30="<select name='day' id='day' onchange='changeAppt();'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option></select>";
	text29="<select name='day' id='day' onchange='changeAppt();'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option></select>";
	monthBox=document.getElementById("dayDrop");
	if(document.remindapptForm.month.value=="01"||document.remindapptForm.month.value=="03"||document.remindapptForm.month.value=="05"||document.remindapptForm.month.value=="07"||document.remindapptForm.month.value=="08"||document.remindapptForm.month.value=="10"||document.remindapptForm.month.value=="12"){
		monthBox.innerHTML=text31;
	}
	if(document.remindapptForm.month.value=="04"||document.remindapptForm.month.value=="06"||document.remindapptForm.month.value=="09"||document.remindapptForm.month.value=="11"){
		monthBox.innerHTML=text30;
	}
	if(document.remindapptForm.month.value=="02"){
		monthBox.innerHTML=text29;
	}
}

function changeYear(){
	text28="<select name='day' id='day' onchange='changeAppt();'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option></select>";
	dura7="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option><option value='6' >6 Days Before Appointment</option><option value='7' >7 Days Before Appointment</option></select>";	
	dura6="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option><option value='6' >6 Days Before Appointment</option></select>";	
	dura5="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option></select>";	
	dura4="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option></select>";	
	dura3="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option></select>";	
	dura2="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option></select>";	
	dura1="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option></select>";	
	dura0="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option></select>";	
	var right_now=new Date();
	var appt_date = new Date();
	appt_date.setMonth(document.remindapptForm.month.value-1);
	appt_date.setYear(document.remindapptForm.year.value);
	appt_date.setDate(document.remindapptForm.day.value);


	yearBox=document.getElementById("dayDrop");
	grabDay=document.remindapptForm.day.value;
	if(document.remindapptForm.year.value!=2012&&document.remindapptForm.year.value!=2016){
		if(document.remindapptForm.month.value=="02"){
			monthBox.innerHTML=text28;
			if(grabDay==29){
				document.remindapptForm.day.value=28;
			}
			else{
				document.remindapptForm.day.value=grabDay;
			}
		}
	}
	else{
		document.remindapptForm.day.value=grabDay;
	}
	
		durationBox=document.getElementById("duration_drop");

	if (right_now.getTime() < appt_date.getTime()) 
	{
		difference = appt_date.getTime() - right_now.getTime();

		daysdiffer = Math.floor(difference/(1000*60*60*24))-1;

		if (daysdiffer == 0)
		{
			durationBox.innerHTML=dura0;
		} else if (daysdiffer == 1)
		{
			durationBox.innerHTML=dura1;
		} else if (daysdiffer == 2)
		{
			durationBox.innerHTML=dura2;
		} else if (daysdiffer == 3)
		{
			durationBox.innerHTML=dura3;
		} else if (daysdiffer == 4)
		{
			durationBox.innerHTML=dura4;
		} else if (daysdiffer == 5)
		{
			durationBox.innerHTML=dura5;
		} else if (daysdiffer == 6)
		{
			durationBox.innerHTML=dura6;
		} else
		{
			durationBox.innerHTML=dura7;
		}	
	}
}

function changeMonth2(){
	text31="<select name='day' id='day'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option><option value='31'>31</option></select>";
	text30="<select name='day' id='day'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option></select>";
	text29="<select name='day' id='day'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option></select>";
	monthBox=document.getElementById("dayDrop");
	if(document.remindmedsForm.month.value=="01"||document.remindmedsForm.month.value=="03"||document.remindmedsForm.month.value=="05"||document.remindmedsForm.month.value=="07"||document.remindmedsForm.month.value=="08"||document.remindmedsForm.month.value=="10"||document.remindmedsForm.month.value=="12"){
		monthBox.innerHTML=text31;
	}
	if(document.remindmedsForm.month.value=="04"||document.remindmedsForm.month.value=="06"||document.remindmedsForm.month.value=="09"||document.remindmedsForm.month.value=="11"){
		monthBox.innerHTML=text30;
	}
	if(document.remindmedsForm.month.value=="02"){
		monthBox.innerHTML=text29;
	}
}

function changeYear2(){
	text28="<select name='day' id='day'><option value='0'>Day</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option></select>";

	yearBox=document.getElementById("dayDrop");
	grabDay=document.remindmedsForm.day.value;
	if(document.remindmedsForm.year.value!=2004&&document.remindmedsForm.year.value!=2008){
		if(document.remindmedsForm.month.value=="02"){
			monthBox.innerHTML=text28;
			if(grabDay==29){
				document.remindmedsForm.day.value=28;
			}
			else{
				document.remindmedsForm.day.value=grabDay;
			}
		}
	}
	else{
		document.remindmedsForm.day.value=grabDay;
	}

	
}

function phoneTab(original,destination){
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
	destination.focus()
}

function MM_showHideLayers() { //v2.0
  var i, visStr, args, theObj;
  args = MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) { //with arg triples (objNS,objIE,visStr)
    visStr   = args[i+2];
    if (navigator.appName == 'Netscape' && document.layers != null) {
      theObj = eval(args[i]);
      if (theObj) theObj.visibility = visStr;
    } else if (document.all != null) { //IE
      if (visStr == 'show') visStr = 'visible'; //convert vals
      if (visStr == 'hide') visStr = 'hidden';
      theObj = eval(args[i+1]);
      if (theObj) theObj.style.visibility = visStr;
  } }
}

function changeAppt(){
	dura7="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option><option value='6' >6 Days Before Appointment</option><option value='7' >7 Days Before Appointment</option></select>";	
	dura6="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option><option value='6' >6 Days Before Appointment</option></select>";	
	dura5="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option><option value='5' >5 Days Before Appointment</option></select>";	
	dura4="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option><option value='4' >4 Days Before Appointment</option></select>";	
	dura3="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option><option value='3' >3 Days Before Appointment</option></select>";	
	dura2="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option><option value='2' >2 Days Before Appointment</option></select>";	
	dura1="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option><option value='1' >1 Day Before Appointment</option></select>";	
	dura0="<select name='duration'><option value='' >How soon before appointment?</option><option value='0' >Day of the Appointment Itself</option></select>";	
	var right_now=new Date();
	var appt_date = new Date();
	appt_date.setMonth(document.remindapptForm.month.value-1);
	appt_date.setYear(document.remindapptForm.year.value);
	appt_date.setDate(document.remindapptForm.day.value);
	
	durationBox=document.getElementById("duration_drop");
	
	if (right_now.getTime() < appt_date.getTime()) 
	{
		difference = appt_date.getTime() - right_now.getTime();

		daysdiffer = Math.floor(difference/(1000*60*60*24))-1;

		if (daysdiffer == 0)
		{
			durationBox.innerHTML=dura0;
		} else if (daysdiffer == 1)
		{
			durationBox.innerHTML=dura1;
		} else if (daysdiffer == 2)
		{
			durationBox.innerHTML=dura2;
		} else if (daysdiffer == 3)
		{
			durationBox.innerHTML=dura3;
		} else if (daysdiffer == 4)
		{
			durationBox.innerHTML=dura4;
		} else if (daysdiffer == 5)
		{
			durationBox.innerHTML=dura5;
		} else if (daysdiffer == 6)
		{
			durationBox.innerHTML=dura6;
		} else
		{
			durationBox.innerHTML=dura7;
		}	
	}
}



  function nav_action_lev1(menu) {
    obj = document.getElementById(menu);
    nav_img = document.getElementById("nav_" + menu);
    if (obj.style.display!="none") {  // when we are open
      obj.style.display="none";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_plus_lev1.gif' width='15' height='13' border='0'>";
	}  
    else {
      obj.style.display="block";    //when we are collapsed
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_minus_lev1.gif' width='15' height='13' border='0'>";
	  collapseAll(menu);
    }  
  }

  	function collapseAll(menu){
		switch(menu){
			case 'hepatitis_c_basics':
				collapseOne('considering_treatment');
				collapseOne('on_treatment');
				collapseOne('for_hcp');
				collapseOne('for_caregivers');
				break;
				
			case 'considering_treatment': 
				collapseOne('hepatitis_c_basics');
				collapseOne('on_treatment');
				collapseOne('for_hcp');
				collapseOne('for_caregivers'); 
				break;
				
			case 'on_treatment': 
				collapseOne('hepatitis_c_basics');
				collapseOne('considering_treatment');
				collapseOne('for_hcp');
				collapseOne('for_caregivers'); 
				break;
				
			case 'for_hcp': 
				collapseOne('hepatitis_c_basics');
				collapseOne('considering_treatment');
				collapseOne('on_treatment');
				collapseOne('for_caregivers'); 
				break;
				
			case 'for_caregivers': 
				collapseOne('hepatitis_c_basics');
				collapseOne('considering_treatment');
				collapseOne('on_treatment');
				collapseOne('for_hcp'); 
				break;
				
			default: 
				collapseOne('hepatitis_c_basics');
				collapseOne('considering_treatment');
				collapseOne('on_treatment');
				collapseOne('for_hcp');
				collapseOne('for_caregivers'); 
				break;
		}
	}

	function collapseOne(menu){
    obj = document.getElementById(menu);
    nav_img = document.getElementById("nav_" + menu);
    if (obj.style.display!="none") {  // when we are open
      obj.style.display="none";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_plus_lev1.gif' width='15' height='13' border='0'>";
	}  
	}
	
    function nav_action_lev2(menu) {
    obj = document.getElementById(menu);
    nav_img = document.getElementById("nav_" + menu);
    if (obj.style.display!="none") {
      obj.style.display="none";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_arrow_lev2_up.gif' width='13' height='10' border='0'>";      
	}  
    else {
      obj.style.display="block";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_arrow_lev2_down.gif' width='13' height='10' border='0'>"; 
    }  
  }

    function nav_action_lev3(menu) {
    obj = document.getElementById(menu);
    nav_img = document.getElementById("nav_" + menu);
    if (obj.style.display!="none") {
      obj.style.display="none";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_arrow_lev2_up.gif' width='13' height='10' border='0'>";      
	}  
    else {
      obj.style.display="block";
      nav_img.innerHTML="<img src='" +imgPath+ "all_ln_arrow_lev2_down.gif' width='13' height='10' border='0'>"; 
    }  
  }

//initialize global layer-related variables and check browser type
	//var atHome = where=="98.0.0.0"?true:false;
    var extra_1 = ".";
    var extra_2 = ".";
	
	var nn = false; var ie = false; var ns6 = false; var nolayer = false;
	if (document.all) { 
	
		//browser is ie4+
		ie = true;
        extra_1 = ".all.";
        extra_2 = ".style.";
	
	} else if (document.layers) {
	  	
    // browser is NS4+ 
    nn = true;
	 
	} else if (document.getElementById) {
	 // browser NS6+ code (ie5+ also supports this syntax)
    ns6 = true;
        extra_1 = ".getElementById('";
        extra_2 = "').style.";
	} 
	else {
		// old non-layer browser
		nolayer = true;
	
	}

	if (nolayer) alert ("Your browser must be version 4.0 or higher (Internet Explorer or Netscape) to use the menus at the left to navigate Clarinex.com.");

function which_layer(showLayer) {
  for (i=0; i<leftNavLayers.length; i++){
      if (leftNavLayers[i] == showLayer) {
        eval("document" + extra_1 + leftNavLayers[i] + extra_2 + "visibility = 'visible'");
      }
      else {
        eval("document" + extra_1 + leftNavLayers[i] + extra_2 + "visibility = 'hidden'");
      }    
  }  
}


function topNavShowHide(which, vis) {
    eval("document" + extra_1 + which + extra_2 + "visibility = '" + vis + "'");
}

function doNothing() {}


