
//Static Slide Menu 

NS6 = (document.getElementById&&!document.all)
IE = (document.all)
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")

tempBar='';barBuilt=0;ssmItems=new Array();

moving=setTimeout('null',1)
function moveOut() {
if ((NS6||NS)&&parseInt(ssm.left)<0 || IE && ssm.pixelLeft<0) {
clearTimeout(moving);moving = setTimeout('moveOut()', slideSpeed);slideMenu(10)}
else {clearTimeout(moving);moving=setTimeout('null',1)}};
function moveBack() {clearTimeout(moving);moving = setTimeout('moveBack1()', waitTime)}
function moveBack1() {
if ((NS6||NS) && parseInt(ssm.left)>(-menuWidth) || IE && ssm.pixelLeft>(-menuWidth)) {
clearTimeout(moving);moving = setTimeout('moveBack1()', slideSpeed);slideMenu(-10)}
else {clearTimeout(moving);moving=setTimeout('null',1)}}
function slideMenu(num){
if (IE) {ssm.pixelLeft += num;}
if (NS||NS6) {ssm.left = parseInt(ssm.left)+num;}
if (NS) {bssm.clip.right+=num;bssm2.clip.right+=num;}}

function makeStatic() {
if (NS||NS6) {winY = window.pageYOffset;}
if (IE) {winY = document.body.scrollTop;}
if (NS6||IE||NS) {
if (winY!=lastY&&winY>YOffset-staticYOffset) {
smooth = .2 * (winY - lastY - YOffset + staticYOffset);}
else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) {
smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));}
else {smooth=0}
if(smooth > 0) smooth = Math.ceil(smooth);
else smooth = Math.floor(smooth);
if (IE) bssm.pixelTop+=smooth;
if (NS6||NS) bssm.top=parseInt(bssm.top)+smooth
lastY = lastY+smooth;
setTimeout('makeStatic()', 1)}}

function buildBar() {
if(barText.indexOf('<IMG')>-1) {tempBar=barText}
else{for (b=0;b<barText.length;b++) {tempBar+=barText.charAt(b)+"<BR>"}}
document.write('<td align="center" rowspan="100" width="'+barWidth+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'"><p align="center"><font face="'+barFontFamily+'" Size="'+barFontSize+'" COLOR="'+barFontColor+'"><B>'+tempBar+'</B></font></p></TD>')}

function initSlide() {
if (NS6){ssm=document.getElementById("thessm").style;bssm=document.getElementById("basessm").style;
bssm.clip="rect(0 "+document.getElementById("thessm").offsetWidth+" "+document.getElementById("thessm").offsetHeight+" 0)";ssm.visibility="visible";}
else if (IE) {ssm=document.all("thessm").style;bssm=document.all("basessm").style
bssm.clip="rect(0 "+thessm.offsetWidth+" "+thessm.offsetHeight+" 0)";bssm.visibility = "visible";}
else if (NS) {bssm=document.layers["basessm1"];
bssm2=bssm.document.layers["basessm2"];ssm=bssm2.document.layers["thessm"];
bssm2.clip.left=0;ssm.visibility = "show";}
if (menuIsStatic=="yes") makeStatic();}

function buildMenu() {
if (IE||NS6) {document.write('<DIV ID="basessm" style="visibility:hidden;Position : Absolute ;Left : '+XOffset+' ;Top : '+YOffset+' ;Z-Index : 20;width:'+(menuWidth+barWidth+10)+'"><DIV ID="thessm" style="Position : Absolute ;Left : '+(-menuWidth)+' ;Top : 0 ;Z-Index : 20;" onmouseover="moveOut()" onmouseout="moveBack()">')}
if (NS) {document.write('<LAYER name="basessm1" top="'+YOffset+'" LEFT='+XOffset+' visibility="show"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+(-menuWidth)+'" onmouseover="moveOut()" onmouseout="moveBack()">')}
if (NS6){document.write('<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'"><TR><TD>')}
document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'">');
for(i=0;i<ssmItems.length;i++) {
if(!ssmItems[i][3]){ssmItems[i][3]=menuCols;ssmItems[i][5]=menuWidth-1}
else if(ssmItems[i][3]!=menuCols)ssmItems[i][5]=Math.round(menuWidth*(ssmItems[i][3]/menuCols)-1);
if(ssmItems[i-1]&&ssmItems[i-1][4]!="no"){document.write('<TR>')}
if(!ssmItems[i][1]){
document.write('<td bgcolor="'+hdrBGColor+'" HEIGHT="'+hdrHeight+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'">&nbsp;<font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')}
else {if(!ssmItems[i][2])ssmItems[i][2]=linkTarget;
document.write('<TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV  ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'" COLOR="'+linkFontColor+'">&nbsp;<A HREF="'+ssmItems[i][1]+'" target="'+ssmItems[i][2]+'" CLASS="ssmItems">'+ssmItems[i][0]+'</DIV></LAYER></ILAYER></TD>')}
if(ssmItems[i][4]!="no"&&barBuilt==0){buildBar();barBuilt=1}
if(ssmItems[i][4]!="no"){document.write('</TR>')}}
document.write('</table>')
if (NS6){document.write('</TD></TR></TABLE>')}
if (IE||NS6) {document.write('</DIV></DIV>')}
if (NS) {document.write('</LAYER></ILAYER></LAYER>')}
theleft=-menuWidth;lastY=0;setTimeout('initSlide();', 1)}




//show NEW UPDATE icon
function shownewicon(icon, theyear, themonth, theday) {

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()

//today's date
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec

//updated date
var modifiedstring=montharray[themonth-1]+" "+theday+", "+theyear

//calculate difference of current date and updated date
dd=Date.parse(todaystring)-Date.parse(modifiedstring)
dday=Math.floor(dd/(60*60*1000*24)*1)

//based on date difference show new icon
//document.write("modifiedstring:" + modifiedstring + "todaystring:" + todaystring + "dday:" + dday)
if (dday<=14){
	if (document.all||document.getElementById){
		if (icon=="new"){
			document.write('<span id="newicon"><img src="/images/shared/new.gif" width="24" height="13"></span>')
		}
		else if (icon=="update"){
			document.write('<span id="updateicon"><img src="/images/shared/updated.gif" width="45" height="20"></span>')
		}
	}
}
}





//Choose topics from Available topics list

function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }
}



AvailableTopicList = new Array(
new Array(
new Array("Andropause (Feb. 2002)", 1),
new Array("Atrial Fibrillation* (Nov. 2004)", 2),
new Array("Back Pain—Approaches to Acute Low Back Pain (Nov. 2004)", 3),
new Array("Behavioral Challenges of Dementia (June 2003)", 4),
new Array("Breast Cancer Screening (Mar. 2003)", 5),
new Array("Breastfeeding (Aug. 2001)", 6),
new Array("Cervical Spine Trauma* (Dec. 2002)", 7),
new Array("Child Behaviour (June 2004)", 8),
new Array("Child Maltreatment (Dec. 2002)", 9),
new Array("Chronic Non-Cancer Pain Part 1 Aug. (2003)", 10),
new Array("Chronic Non-Cancer Pain Part 2 Aug. (2003)", 11),
new Array("Chronic Obstructive Pulmonary Disease* (Mar. 2004)", 12),
new Array("Cognitive Behavioural Therapy (Dec. 2003)", 13),
new Array("Colorectal Cancer Screening (June 2003)", 14),
new Array("Community-Acquired Pneumonia (Nov. 2001)", 15),
new Array("Contraception (Aug. 2002)", 16),
new Array("Croup* (Jan. 2001)", 17),
new Array("Depressive Disorder: Treatment Challenges (Aug. 2002)", 18),
new Array("Diabetes: Managing Microvascular Complications of Type 2* (Aug. 2004)", 19),
new Array("Diabetes: Screening and Prevention of Type 2 (Mar. 2004)", 20),
new Array("Drug Use Disorders: Illicit and Prescription Drugs* (Dec. 2003)", 21),
new Array("Dying at Home - Planning and Preparing (Aug. 2002)", 22),
new Array("Dyspepsia (Aug. 2003)", 23),
new Array("Eating Disorders (May 2002)", 24),
new Array("Elder Abuse* (Nov. 2004)", 25),
new Array("Falls in the Elderly (Aug. 2003)", 26),
new Array("Genetic Screening for Hereditary Breast/Ovarian and Colorectal Cancers (May 2002)", 27),
new Array("Head Injury* (Dec. 2002)", 28),
new Array("Healthy Hearts (Apr. 2001)", 29),
new Array("Hepatitis C (May 2002)", 30),
new Array("HIV Screening in Pregnancy (Aug. 2002)", 31),
new Array("Hypertensive Disorders of Pregnancy (Nov. 2001)", 32),
new Array("Irritable Bowel Syndrome (June 2004)", 33),
new Array("Migraine Headaches* (Jan. 2001)", 34),
new Array("Miscarriage* (Aug. 2004)", 35),
new Array("Myocardial Infarction—Secondary Prevention (Aug. 2001)", 36),
new Array("New Vaccines (Canada only) (Dec. 2002)", 37),
new Array("Osteoarthritis (revised) (Jan. 2001)", 38),
new Array("Osteoporosis and Fragility Fractures (Mar. 2003)", 39),
new Array("Pap Smears—Effective Management of the 'Abnormal Pap' (Mar. 2003)", 40),
new Array("Parkinson's Disease—Diagnosis and Management (Dec. 2003)", 41),
new Array("Patient Safety: Disclosure & Prevention of Medical Errors* (Mar. 2004)", 42),
new Array("Pharyngitis (Mar. 2004)", 43),
new Array("Physical Activity for Children and Youth (June 2003)", 44),
new Array("Planning for End-of-Life Care (Aug. 2001)", 45),
new Array("Postpartum Mood Disorders (Mar. 2003)", 46),
new Array("Prenatal Genetic Screening Tests—What's New (Nov. 2004)", 47),
new Array("Prenatal Screening for Genetic Conditions (June 2003)", 48),
new Array("Prevention: Putting it into practice (Dec. 2003)", 49),
new Array("PSA Screening for Prostate Cancer (Feb. 2002)", 50),
new Array("Renal Colic* (Apr. 2001)", 51),
new Array("Sexually Transmitted Infections (Feb. 2002)", 52),
new Array("Spouse/Partner Abuse (Apr. 2001)", 53),
new Array("Starting Insulin in Type 2 Diabetes (Feb. 2002)", 54),
new Array("Stroke - Emergency Treatment* (Apr. 2001)", 55),
new Array("Stroke/TIA—Primary and Secondary Prevention(Oct. 2003)", 56),
new Array("Travel Medicine (Aug. 2002)", 57),
new Array("Tuberculosis (Nov. 2001)", 58),
new Array("Venous Thromboembolism* (Aug. 2004)", 59),
new Array("Well Baby Visit at 18 Months (Nov. 2001)", 60),
new Array("Work-related Asthma (Aug. 2004)", 61)
),
new Array(
new Array("New Group Member Module 01", 1),
new Array("New Group Member Module 02", 2),
new Array("New Group Member Module 03", 3),
new Array("New Group Member Module 04", 4),
new Array("New Group Member Module 05", 5),
new Array("New Group Member Module 06", 6),
new Array("New Group Member Module 07", 7),
new Array("New Group Member Module 08", 8),
new Array("New Group Member Module 09", 9)
),
new Array(
new Array("PBIL Option A Module 01", 1),
new Array("PBIL Option A Module 02", 2),
new Array("PBIL Option A Module 03", 3),
new Array("PBIL Option A Module 04", 4),
new Array("PBIL Option A Module 05", 5),
new Array("PBIL Option A Module 06", 6),
new Array("PBIL Option A Module 07", 7),
new Array("PBIL Option A Module 08", 8),
new Array("PBIL Option A Module 09", 9),
new Array("PBIL Option A Module 10", 10),
new Array("PBIL Option A Module 11", 11),
new Array("PBIL Option A Module 12", 12),
new Array("PBIL Option A Module 13", 13),
new Array("PBIL Option A Module 14", 14),
new Array("PBIL Option A Module 15", 15)
),
new Array(
new Array("PBIL Option B&C Module 02", 2),
new Array("PBIL Option B&C Module 01", 1),
new Array("PBIL Option B&C Module 03", 3),
new Array("PBIL Option B&C Module 05", 5),
new Array("PBIL Option B&C Module 10", 10),
new Array("PBIL Option B&C Module 04", 4),
new Array("PBIL Option B&C Module 06", 6),
new Array("PBIL Option B&C Module 07", 7),
new Array("PBIL Option B&C Module 08", 8),
new Array("PBIL Option B&C Module 09", 9),
new Array("PBIL Option B&C Module 11", 11),
new Array("PBIL Option B&C Module 12", 12)
),
null,
null,
null
)




function fillSelectFromArray(selectCtrl, itemArray, cleanCtrl) {
var i, j;
var prompt;
// empty existing items in selectCtrl
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null; 
}

//clean selected list
for (i = cleanCtrl.options.length; i >= 0; i--) {
cleanCtrl.options[i] = null; 
}


//sort items
AvailableTopicList[0].sort();
AvailableTopicList[1].sort();
AvailableTopicList[2].sort();
AvailableTopicList[3].sort();
//AvailableTopicList[4].sort();

prompt = (itemArray != null) ? "ListAvailable" : "List is not available.";
if (prompt == "ListAvailable") {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1]; 
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
   }
}


function QuickLocate(selectCtrl, letter) {
var i;
var tmpstr;

  if (selectCtrl != null) {
    for (i = 0; i < selectCtrl.length; i++) {
      tmpstr = selectCtrl.options[i].text;
      if (tmpstr[0] == letter) {
        // select first item (prompt) for sub list
	if (selectCtrl.options[i].selected) {
	  //navigate to the bottom of the list
	  if (selectCtrl.options[selectCtrl.length-1].selected) {
            selectCtrl.options[selectCtrl.length-1].selected = false;
            selectCtrl.options[selectCtrl.length-1].selected = true;
	  }
  	  else {
	    selectCtrl.options[selectCtrl.length-1].selected = true;
            selectCtrl.options[selectCtrl.length-1].selected = false;
	  }
	  //navigate to the one match "letter"
          selectCtrl.options[i].selected = false;
          selectCtrl.options[i].selected = true;
	}
	else {
	  //navigate to the bottom of the list
	  if (selectCtrl.options[selectCtrl.length-1].selected) {
            selectCtrl.options[selectCtrl.length-1].selected = false;
            selectCtrl.options[selectCtrl.length-1].selected = true;
	  }
  	  else {
	    selectCtrl.options[selectCtrl.length-1].selected = true;
            selectCtrl.options[selectCtrl.length-1].selected = false;
	  }
	  //navigate to the one match "letter"
	  selectCtrl.options[i].selected = true;
          selectCtrl.options[i].selected = false;
	}
        break;
      }
    }
  }
}