//*************** 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
	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
	}
 	// default back to standards compliant for future releases
	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='/bookbind/pubbooks/bc_webdev/medialib/css/" + myPlat + myBv + ".css'>");

//*************** End browser sniffer and CSS deployment ***************

//spawn window function
function spawnWindow(theURL,winName,properties) { 
  window.open(theURL,winName,properties);
  //window.moveTo(400, 200)
}

//*************** 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 *************************

/////////////////////////////////////////////
//******* open flashcards window 1 **********
function openFlashCards(tUrl) {
cc_window =
window.open(tUrl,'cc_window','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=580,height=475');
}


 //spawn flashcards 2
function opnflashcards() { 
 window.open('../flashcards/flashcards.html','myFlash','toolbar=0,location=0,status=0,menubar=0,scrollbars=auto,resizable=1,width=600,height=500');
}
// end flashcards
/////////////////////////////////////////////

//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 if this is a place holder image and do nothing if it is
	if (imgHeight+imgWidth==190) { 
	} else {
//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=auto,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();
   }
