
// load external google analytics file
function loadScript(url) {document.write('<script src="', url, '" type="text/javascript"></script>');}
loadScript("http://www.google-analytics.com/urchin.js");

//*************** Begin browser sniffer and CSS deployment ***************
//////////////////////////////////////////////////////////
// Platform and browser sniffer

// determine platform
if (navigator.platform.indexOf("Mac") != -1 ) {myPlat = "mac";}
if (navigator.platform.indexOf("Win" ) != -1 ) {myPlat = "pc";}

// determine browser version number and associate to it's equivalent to reduce CSS file overhead
if (myPlat=="mac") {
if (navigator.appVersion.indexOf("3.") != -1 ) {myBv = "4";} //mac nn3
if (navigator.appVersion.indexOf("4.") != -1 ) {myBv = "4";} // mac nn4
if (navigator.appVersion.indexOf("5.") != -1 ) {myBv = "5";} // mac nn6
if (navigator.appVersion.indexOf("MSIE 3.") != -1 ) {myBv = "4";} // mac ie3
if (navigator.appVersion.indexOf("MSIE 4.") != -1 ) {myBv = "4";} // mac ie4
if (navigator.appVersion.indexOf("MSIE 5.") != -1 ) {myBv = "5";} // mac ie5
if (navigator.appVersion.indexOf("MSIE 6.") != -1 ) {myBv = "5";} // mac ie6
// support future standards-compliant versions with default value of 5
else {  {myBv = "5";}  }
}

// use single .css file for pc
if (myPlat=="pc") { {myBv = "";}  }

// failsafe for unix, linux etc.
if (myPlat==""){ {myPlat = "pc";} {myBv = "";}  }	

// concatonate variables and write css filename
document.write("<LINK REL='Stylesheet' HREF='" + myRoot + "css/" + myPlat + myBv + ".css'>");

//*************** End browser sniffer and CSS deployment ***************

//*************** script to fix the NN4 CSS resize bug ***************
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
if (Nav4) {
	var startWidth = window.innerWidth 
	var startHeight = window.innerHeight
}
function restorePage() {
	if (Nav4) {
		if(startWidth != window.innerWidth || startHeight != window.innerHeight) {
			location.reload()
		}
	}
}
window.onresize = restorePage
//******************** end NN4 CSS resize fix *************************

 //spawn flashcards function
function opnflashcards() { 
 window.open('../flashcards/flashcards.html','myFlash','toolbar=0,location=0,status=0,menubar=0,scrollbars=auto,resizable=1,width=600,height=500');
}

//spawn footnotes
function opnFn(whichFoot) { 
  window.open(whichFoot,'myFoot','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=340,height=170');
}
 
//open a window, then write to it  for thumbnails
function getProperties(whichFigure,imageName,imageSource,imgWidth,imgHeight) { 
   var  properties = "<html><head><style type='text/css'>.figure_caption {color:#000000; font-family: Arial, Helvetica, sans-serif; font-size:11px; font-weight: normal;} .text {color:#000000; font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight: normal;}</style><title>" + whichFigure + "</title></head><body bgColor='#ffffff' leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'><img src='"+imageName+"'  border='0' name='bigFigure' /><br><br><div align='right' class='text'><a href='javascript:window.close();'><img src='../img/close.gif' width='42' height='18' border='0' alt='close window'></a>&nbsp;&nbsp;</div></body></html>";
   return properties; 
   } 
   
function bigFig(whichFigure,imageName,imageSource,imgWidth,imgHeight) {
//determine what popup window size should be based on thumbnail size
var figHeight= eval(imgHeight/imgWidth*imgWidth*3+40)
var figWidth= eval(imgWidth*3)

var newWindow = window.open("","video","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=1,height="+figHeight+",width="+figWidth+"");
newWindow.document.write(getProperties(whichFigure,imageName,imageSource,imgWidth,imgHeight));
newWindow.document.close();
newWindow.focus();
   }
   
function openmovie(mUrl)
{
mov_window =
window.open(mUrl,'mov_window','toolbar=0,location=0,status=0,menubar=0,scrollbars=auto,resizable=1,width=370,height=180');
//mov_window.moveTo(0,0);
}
   
function opentutorial(tUrl)
{
tut_window =
window.open(tUrl,'tut_window','toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=800,height=600');
//tut_window.moveTo(0,0);
}

function openSmtutorial(tUrl)
{
tut_window =
window.open(tUrl,'tut_window','toolbar=0,location=0,status=0,menubar=0,scrollbars=auto,resizable=1,width=370,height=180');
//tut_window.moveTo(0,0);
}
 
//open a window, then write to it for glossary
function glossProperties(gLetter) { 
   var  gProperties = "<html><head><meta http-equiv='content-type' content='text/html;charset=iso-8859-1'><title>The Cosmic Perspective 2e - Glossary</title></head><frameset rows='50,*,30' framespacing='0' border='1' frameborder='NO'><frame src='../gloss/top.htm' name='top' scrolling='no' noresize><frame src='../gloss/main.htm#" + gLetter + "' name='main' scrolling='auto'><frame src='../gloss/bottom.htm' name='bottom' scrolling='no' noresize></frameset><noframes><body bgcolor='#ffffff'><center><table border='0' cellpadding='0' cellspacing='0' ><tr><td><font face='arial,helvetica' size='2' >This page uses frames.<br>Please download the latest version of <ahref='http://www.microsoft.com/ie/download' target='new'>Internet Explorer</a>or <a href='http://home.netscape.com/computing/download/' target='new'>Netscape</a>.Thank you.</td></tr></table></body></noframes></html>";
   return gProperties; 
   } 
   
function openGloss(gLetter) {

var gWindow = window.open("","gloss","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=1,height=500,width=500");
gWindow.document.write(glossProperties(gLetter));
gWindow.document.close();
gWindow.focus();
   }

   
   
   
   //
   //ACTIVITY SERVER STUFF
   //
   //
   function stoperror() { return true }
window.onerror=stoperror

function bcPopActivity(crmt4eActId)
{
	if(crmt4eActId.length<3)
	{
		crmt4eActLet = crmt4eActId.substr(1)
		crmt4eActChap = '0' + crmt4eActId.substr(0,1)
	}
	else
	{
		crmt4eActLet = crmt4eActId.substr(2)
		crmt4eActChap = crmt4eActId.substr(0,2)
	}
	switch(crmt4eActLet.toUpperCase())
	{
		case 'A':
			crmt4eActNum = '01'
			break
		case 'B':
			crmt4eActNum = '02'
			break
		case 'C':
			crmt4eActNum = '03'
			break
		case 'D':
			crmt4eActNum = '04'
			break
		case 'E':
			crmt4eActNum = '05'
			break
		case 'F':
			crmt4eActNum = '06'
			break
		case 'G':
			crmt4eActNum = '07'
			break
		case 'H':
			crmt4eActNum = '08'
			break
		case 'I':
			crmt4eActNum = '09'
			break
		case 'J':
			crmt4eActNum = '10'
			break
		case 'K':
			crmt4eActNum = '11'
			break
		case 'L':
			crmt4eActNum = '12'
			break
		case 'M':
			crmt4eActNum = '13'
			break
		case 'N':
			crmt4eActNum = '14'
			break
		case 'O':
			crmt4eActNum = '15'
			break
		case 'P':
			crmt4eActNum = '16'
			break
	}
initChapter()
var crmt4eActCode = "a" + crmt4eActChap + crmt4eActNum
popSharedMedia(crmt4eActCode)
}


/*
////////////////////////////////////////////////////////////////////////
Master conversion for crmt activities:
prodName = original product from which activity is being redeployed
chapNum = chap # in original product
actNum = activity # in original product
title = title in NEW product
(array contains approximately 192 activities)
////////////////////////////////////////////////////////////////////////
*/

function activity(prodName, chapNum, actNum, title)
{
this.prodName = prodName
this.chapNum = chapNum
this.actNum = actNum
this.title = title
}

var activities = new Array()

function initChapter()
{

// create new activity objects, storing the 4 related properties of each

activities.a1201 = new activity("c6e", "20", "01", "12A Applications of DNA Technology")
activities.a1202 = new activity("c6e", "20", "08", "12B DNA Technology and Golden Rice")
activities.a1203 = new activity("cmr3e", "12", "01", "12C Cloning a Gene in Bacteria")
activities.a1204 = new activity("c6e", "20", "02", "12D Restriction Enzymes")
activities.a1205 = new activity("c6e", "20", "07", "12E DNA Fingerprinting")
activities.a1206 = new activity("c6e", "20", "04", "12F Gel Electrophoresis of DNA")
activities.a1207 = new activity("c6e", "20", "05", "12G Analyzing DNA Fragments Using Gel Electrophoresis")
activities.a1208 = new activity("c6e", "20", "06", "12H The Human Genome Project: Human Chromosome 17")

activities.a2201 = new activity("c6e", "42", "04", "22A The Human Respiratory System ")
activities.a2202 = new activity("c6e", "42", "05", "22B Transport of Respiratory Gases")
activities.a2301 = new activity("cmr3e", "23", "01", "23A Mammalian Cardiovascular System Structure")
activities.a2302 = new activity("cmr3e", "23", "02", "23B Path of Blood Flow in Mammals")
activities.a2303 = new activity("c6e", "42", "03", "23C Mammalian Cardiovascular System Function")

}

//////////////////////////////////////////////////////////////////
// this code taken from sharedmedia.js and slightly modified

//useOnlinePaths: Flag to indicate if media is being accessed online or from CD
var useOnlinePaths = true //true=online;false=localCD
//onlinePaths: Paths to online ActivityServer pages for all products
var onlinePaths = new Array()
onlinePaths.crmt4e = "/bookbind/pubbooks/bc_campbell_concepts_4/medialib/assets/interactivemedia/activities/CRMT4eActivityServer.html"
onlinePaths.c6e = "http://media.pearsoncmg.com/bc/bc_campbell_biology_6/medialib/assets/interactivemedia/activities/C6eActivityServer.html"
onlinePaths.cmr3e = "http://media.pearsoncmg.com/bc/bc_campbell_bioconcept_3/isp_media/activities/CMR3eActivityServer.html"
onlinePaths.eb1e = "http://media.pearsoncmg.com/bc/bc_campbell_essenbio_1/eb_place_media/activities/EB1eActivityServer.html"

//cdPaths: Paths to ActivityServer pages for all products on the CD
var cdPaths = new Array()
cdPaths.crmt4e = "../../medialib/assets/interactivemedia/crmt4e/activities/CRMT4eActivityServer.html"
cdPaths.c6e = "../../medialib/assets/interactivemedia/c6e/activities/C6eActivityServer.html"
cdPaths.cmr3e = "../../medialib/assets/interactivemedia/cmr3e/activities/CMR3eActivityServer.html"
cdPaths.eb1e = "../../medialib/assets/interactivemedia/eb1e/activities/EB1eActivityServer.html"


function popSharedMedia(crmt4eActCode)
{
var myAct = activities[crmt4eActCode]
	//choose base url...read about defining and accessing "horizontal" arrays
	baseUrl = useOnlinePaths?onlinePaths[myAct.prodName]:cdPaths[myAct.prodName]
	//build query string...url encode the title
	query = "?" + myAct.chapNum + "&" + myAct.actNum + "&" + escape(myAct.title)
	//load the activity
	winURL = baseUrl + query
	winString = 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=700,height=520' 
	popWin = window.open(winURL, "popWin",winString)
	//popWin.moveTo(0,0)
	popWin.focus()
}


//////////////////////////////////////////////////
///FOR ROLLOVER SUBNAVIGATION IN VARIOUS CHAPTERS


  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_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;
  }



