if (document.images) {
		
		faculty_off = new Image();
		faculty_off.src = "../images/main/c1182_m_faculty_off.gif";
		faculty_on = new Image();
		faculty_on.src = "../images/main/c1182_m_faculty_on.gif";
		
		help_off = new Image();
		help_off.src = "../images/main/c1182_m_help_off.gif";
		help_on = new Image();
		help_on.src = "../images/main/c1182_m_help_on.gif";
		
		home_off = new Image();
		home_off.src = "../images/main/c1182_m_home_off.gif";
		home_on = new Image();
		home_on.src = "../images/main/c1182_m_home_on.gif";
		
		outline_off = new Image();
		outline_off.src = "../images/main/c1182_m_outline_off.gif";
		outline_on = new Image();
		outline_on.src = "../images/main/c1182_m_outline_on.gif";
		
		
	}
	
	var popUpBottomFr;
	
var n;
var e;
var pc;
var mac;

	
if (document.layers) {n=1;e=0}
if (document.all) {n=0;e=1}
if (navigator.userAgent.indexOf("Mac") != -1) {
	pc=0;
	mac=1;
} else {
	pc=1;
	mac=0;
}	
	
	
// BEGIN VIDEO VARIABLES
var spacerH = 157;
var vidSource = '';
var viSource = '';
var rate = '';
var vidName = '';
var vidCapName ='';
var vidCrName = '';
var vidWinW = null;
var vidWinH = null;
var realPlayWinW = null;
var realPlayWinH = null;
var positionFieldW = null;
var elgWinH;
var elgWinW;
// END VIDEO VARIABLES

// BEGIN ENLARGE VARIABLES
var imgEnlarge;
var imgEnlargeW;
var imgEnlargeH;
var enlargeCaption;
var enlargeCredit;
// END ENLARGE VARIABLES

// BEGIN GLOSSARY VARIABLES
var trans2;
var firstT = 1;
var anc = "hi";
// END GLOSSARY VARIABLES

// BEGIN CHAPTERIZED VIDEO ARRAYS AND VARIABLES

//titles and subtitles for each subsection
var vidTitles = ['Disease Progression','Ginkgo Biloba','Impact on Caregivers','Symptoms and Signs of Atypical Dementia','Predicting Decline','Source and Resolution','Risk Factors for AD','Limits of the Living Will'];

//titles of the video windows
var chapterTitles = ['Disease Progression','Ginkgo Biloba','Impact on Caregivers','Symptoms and Signs of Atypical Dementia','Predicting Decline','Source and Resolution','Risk Factors for AD','Limits of the Living Will'];

//partial address of the videos, used for matching the proper video with content
var vidUrls = ['sect_2/c1182_v_s2_2','sect_3/c1182_v_s3_4','sect_4/c1182_v_s4_2','sect_5/c1182_v_s5_2','sect_6/c1182_v_s6_4','sect_7/c1182_v_s7_1','sect_8/c1182_v_s8_1','sect_9/c1182_v_s9_3'];

//if no subsections enter '0' or enter the section number once for each subsection
var vidChapter = ['0','0','0','0','0','0','0','0'];
var currentVid;
var currentTitle;
var currentChapter;
var currentUrl;
var numberOfChapters = 0;
var additionalHeight = 0;
var chapterString = '';
var intraVidLink = '';

// END CHAPTERIZED VIDEO ARRAYS AND VARIABLES

//DECIDE IF MULTIPLE CHAPTERS
function multiChapter(urlOfVideo) {
	var s = urlOfVideo;
	var tempS = s.substr(0,9);
	
	if (tempS == '../video/') {
		urlOfVideo = s.substr(9);
	
	} 
	
	chapterString = '';
	intraVidLink = '';
	additionalHeight = 0;
	numberOfChapters = 0;
	for (i=0; i<vidUrls.length; i++) {
		if (urlOfVideo == vidUrls[i]) {
			if (vidChapter[i] != 0) {
				currentChapter = vidChapter[i];
				for (j=0; j<vidChapter.length; j++) {
					if (currentChapter == vidChapter[j]) {
						numberOfChapters++;
						if (vidTitles[i] == vidTitles[j]){
							chapterString += '<tr><td align="left" valign="top"><table cellpadding="0" cellspacing="0" border="0" align="left" width="340"><tr><td align="left" valign="top" width="20" height="16"><img src="../images/main/spacer.gif" width="20" height="16" border="0" alt="" hspace="0" vspace="0" /></td><td align="left" valign="top" width="320"><span class="vidSubnavAt">' + vidTitles[j] + '</span></td></tr></table></td></tr>';
							currentTitle =chapterTitles[i];
						} else {
							intraVidLink = vidUrls[j];
							chapterString += '<tr><td align="left" valign="top"><table cellpadding="0" cellspacing="0" border="0" align="left" width="340"><tr><td align="left" valign="top" width="20" height="16"><img src="../images/main/spacer.gif" width="20" height="16" border="0" alt="" hspace="0" vspace="0" /></td><td align="left" valign="top" width="320"><a href="javascript:intraplayvideo(\'' + intraVidLink + '\')"><span class="vidSubnavLink">' + vidTitles[j] + '</span></a></td></tr></table></td></tr>';
						
						}
					
					}
				
				}
				if (numberOfChapters != 0) {
					chapterString = '<tr><td align="left" valign="top" height="27"><img src="../images/main/spacer.gif" width="1" height="15" border="0" alt="" hspace="0" vspace="0" /></td></tr>' + chapterString;
					
					additionalHeight = (16 * numberOfChapters) + 26;
				}
				
			} else {
				currentTitle = vidTitles[i];
			
			}
			
		}
	
	}
	
	vidCapName = currentTitle;


}


//PLAY VIDEO FUNCTION
function playvideo(viSource) {
	//alert('Hit ' + viSource);
	multiChapter(viSource);
	vidSource = "../video/" + viSource;
	vidCapName = currentTitle;
	if (vidCapName == null) vidCapName = "";
		if (document.cookie.indexOf('1182video') != -1 || document.cookie == -1) {
			if (document.cookie.indexOf('1182video=hi') != -1) {
				spacerH1 = 15;
				spacerH2 = 10;
				vidWinW = 360;
				vidWinH = (410 + additionalHeight); 
				realPlayWinW = 320;
				realPlayWinH = 240; 
				positionFieldW = 260; 
				rate = "_fast.rpm"; 
				} else {
				//keeping the same size for closed captions
				//spacerH1 = 15;
				//spacerH2 = 10;
				//vidWinW = 360;
				//vidWinH = (410 + additionalHeight); 
				//realPlayWinW = 320;
				//realPlayWinH = 240; 
				//positionFieldW = 260; 
				//for small size 
				spacerH1 = 85;
				spacerH2 = 33;
				vidWinW = 360;
				vidWinH = (410 + additionalHeight); 
				realPlayWinW = 160;
				realPlayWinH = 120; 
				positionFieldW = 100; 
				rate = "_slow.rpm"; 
			}
			openVWin("../main/c1182_videoshell.html",vidWinW,vidWinH);
		} else {
			openVPWin("videoPref");  
		}
 	}	


//END PLAYVIDEO FUNCTION


//BEGIN INTRAPLAYVIDEO FUNCTION
function 	intraplayvideo(viSource) {
	window.opener.multiChapter(viSource);
	window.opener.vidSource = "../video/" + viSource;
	vidCapName = currentTitle;
	window.location = "../main/c1182_videoshell.html";

}

//END INTRAPLAYVIDEO FUNCTION

//OPEN VIDEO WINDOW
function openVWin(url,w,h) { 
	topWin = (screen.availHeight - h) / 2;
	leftWin = (screen.availWidth - w) / 2;
	props="status=no,width="+w+",height="+h+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin+",resizable=no";
	var myVideo = window.open(url,"vidWin",props);
	myVideo.focus();
}
//END OPEN VIDEO WINDOW

// VIDEO PREFERENCE WINDOW
function openVPWin(vPrefname) { 
	topWin = (screen.availHeight - 350) / 2;
	leftWin = (screen.availWidth - 400) / 2;
	props="status=yes,width=400,height=350,top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin+",resizable=no";
	myVPref = window.open("../main/c1182_vidpref.html",vPrefname,props);
	myVPref.focus();
}

// VIDEO CLOSED CAPTION INFO POPUP
function openVCCWin() { 
	topWin = (screen.availHeight - 465) / 2;
	leftWin = (screen.availWidth - 400) / 2;
	props="status=yes,width=400,height=465,top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin+",resizable=no";
	myVPref = window.open("../main/c1182_vidccinfo.html",'ClosedCaptions',props);
	myVPref.focus();
}
	
	
	
function chgimg(imgField,newImg) {
	
	if(document.images) {
		document[imgField].src = eval(newImg + ".src");
		
	}
}


function launchwin(url,w,h) {
				topWin = (screen.availHeight - h) / 2;
				leftWin = (screen.availWidth - w) / 2;
				props = "resizable=yes,width="+w+",height="+h+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin;
				var win = window.open(url,'ColumbiaInteractive',props);
				win.focus();
			}
			
function launchscrollwin(url,w,h) {
				topWin = (screen.availHeight - h) / 2;
				leftWin = (screen.availWidth - w) / 2;
				props = "scrollbars=yes,resizable=yes,width="+w+",height="+h+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin;
				var win = window.open(url,'ColumbiaInteractive',props);
				win.focus();
			}

function gohere(bottomLoc) {
	popUpBottomFr = bottomLoc;
	framePage = '../main/c1182_go_fr.html';
	var frmWnd = window.open(framePage, '_blank', "statusbar,status,menubar,titlebar,toolbar,location,width=760,height=400,resizable=yes,scrollbars=yes");
	frmWnd.focus();
}

//FUNCTION TO OPEN PDF WINDOW

	function launchpdf(pSource) {
	
	pdfSource = pSource;
		
	var pdfWin = window.open('../main/c1182_pdf_fset.html','_blank');

	}


// ENLARGE WINDOW
function launchenlarge(imgurl,imgwidth,imgheight,eCaption,eCredit) {
	imgEnlarge = imgurl;
	imgEnlargeW = imgwidth;
	imgEnlargeH = imgheight;
	enlargeCaption = eCaption;
	enlargeCredit = eCredit;
	
	if (imgEnlargeW < imgEnlargeH) {
		extraSpace = 25;
	} else {
		extraSpace = 0;
	}
	
	
	elgWinW = (imgwidth + 40);
	elgWinH = (imgheight + 100 + extraSpace);
	topWin = (screen.availHeight - elgWinW) / 2;
	leftWin = (screen.availWidth - elgWinH) / 2;
	//05.17.02 removes height limit
	/*if (elgWinH > 480) {
		elgWinH = 480;
	}*/
	
	props="scrollbars,status=no,width="+elgWinW+",height="+elgWinH;
	openewin("../main/c1182_m_enlarge.html",'Enlarged',props);
}

//OPEN FLASH WINDOW
function openewin(url,w,h) {
	topWin = (screen.availHeight - h) / 2;
	leftWin = (screen.availWidth - w) / 2;
	props="status=no,width="+w+",height="+h+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin+",resizable=no";
	var myEng = window.open(url,"engWin",props);
	myEng.focus();
}
//END OPEN FLASH WINDOW


function openciwin() {
topWin = (screen.availHeight - 580) / 2;
leftWin = (screen.availWidth - 780) / 2;
props = "location=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width="+780+",height="+480+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin;
var win = window.open('http://ci.columbia.edu/ci/','theName',props);
win.focus();
}

function openbook(url) {
	topWin = (screen.availHeight - 500) / 2;
	leftWin = (screen.availWidth - 600) / 2;
	props = "location=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes,width="+600+",height="+500+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin;
	var win = window.open(url,'Readings',props);
	win.focus();
}
			

//OPENS WINDOW FOR CREDITS PAGE		
function opendkvwin(url) {
topWin = (screen.availHeight - 480) / 2;
leftWin = (screen.availWidth - 800) / 2;
props = "location=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width="+leftWin+",height="+topWin+",top="+topWin+",screenY="+topWin+",left="+leftWin+",screenX="+leftWin;
var win = window.open(url,'theName',props);
win.focus();
}

//DYNAMIC CONTENT FOR BOOKS

var bottomFrameLocation = '';

function frameWriter2(bottomFrame){	
	frameWrite2 = '';
	
	frameWrite2 += "<html><head><title>Dementia: Update for the Practitioner</title>"
	frameWrite2 += "<script language='JavaScript'>"
	frameWrite2 += "var bottomUrl = '"+bottomFrame+"'"
	frameWrite2 += "<\/script>"

	frameWrite2 += "</head>\n"
	frameWrite2 += "\n<frameset rows=\"40,*\" framespacing=\"0\" frameborder=\"0\" border=\"0\">\n"
	frameWrite2 +=    "\n<frame name=\"top\" marginwidth=\"10\" marginheight=\"10\" src=\"ci_top.html\" scrolling=\"no\" framespacing=\"0\" frameborder=\"0\" border=\"0\">\n"
	frameWrite2 +=    "\n<frame name=\"mainfr\" marginwidth=\"10\" marginheight=\"10\" src=\""+bottomFrame+"\" scrolling=\"auto\" framespacing=\"0\" frameborder=\"0\" border=\"0\">\n"
	frameWrite2 +=   "\n</frameset>"
	frameWrite2 += "\n</html>"

}
// END DYNAMIC CONTENT FOR BOOKS

//Function for External  Book Links

function goHere(bottomLoc){
	frameWriter2(bottomLoc);
	framePage = 'c1182_bk_frameset.html';
	var frmWnd = window.open(framePage, '_blank', "statusbar,status,menubar,titlebar,toolbar,location,width=760,height=400,resizable=yes,scrollbars=yes");
	frmWnd.focus();
}
//End Function for External Book Links

function printit() {
	if (window.print) window.print();
	else alert('Your browser does not support this print function.');
}