
// /////////////////////////////////////////////////////////////////////////////////////////////
//
//      SCRIPT NAME:	ebm.js
//    SCRIPT AUTHOR:	Mark Vega
//      SCRIPT DATE:	February 2006
//  SCRIPT LOCATION:	helios.lib.uci.edu/target6/medical/ebm/scripts/
//  SCRIPT FUNCTION:	
//     SCRIPT NOTES:	Javascript 1.3	
// OTHER FILES USED:
//    LAST MODIFIED:
//	
// /////////////////////////////////////////////////////////////////////////////////////////////
//
// ////////////////////////////////////////////
// INITIALIZE VARIABLES
// ////////////////////////////////////////////
//
var infoWin = '';
var linkWin = '';
var mapWin = '';
//
// ////////////////////////////////////////////
// DETECT BROWSER FAMILY AND LOAD STYLES
// ////////////////////////////////////////////
//
// this script serves two purposes in calling php script: to force mime type text/css
// for stylesheet (helios otherwise sends as text/plain while xhtml dtd declaration 
// restricts stylesheet mime type to text/css; and to load browser-specific stylesheets 
// that adjust for page formatting differences between ie and netscape models.
//
// get browser name
var agent = navigator.appName;
// if internet explorer
if (agent == 'Microsoft Internet Explorer') {
// use ie stylesheets
document.write('<link rel="stylesheet" href="scripts/ebm_ie.css.php" type="text/css" />');
document.write('<link rel="stylesheet" href="scripts/ebm_ie_print.css.php" type="text/css" media="print" />');
// if netscape, safari, firefox, mozilla
} else {
// use netscape stylesheet
document.write('<link rel="stylesheet" href="scripts/ebm_ns.css.php" type="text/css" />');
document.write('<link rel="stylesheet" href="scripts/ebm_ns_print.css.php" type="text/css" media="print" />');
}
//
// ////////////////////////////////////////////
// BREAK TAG ONLY NEEDED IN MSIE
// ////////////////////////////////////////////
//
function ieBreaks() {
if (agent == 'Microsoft Internet Explorer') {
document.write('<br />')
}
}
//
// ////////////////////////////////////////////
// OPEN NEW LINK WINDOW
// ////////////////////////////////////////////
//
// this script takes two parameters: url to open (can be relative or absolute) 
// and window type (offsite link, map, or ebooks info) to generate new window 
// of a defined size.  size, position, and feature attributes for each type can 
// be altered by editing the variable values.
//
function newWin(theurl,thewindow) {
// if link window
if (thewindow == 'link') {
// set width and height
var the_width=740;
var the_height=500;
// set window position
var from_top=30;
var from_left=30;
// set other attributes
var has_toolbar='yes';
var has_location='yes';
var has_directories='no';
var has_status='no';
var has_menubar='yes';
var has_scrollbars='yes';
var is_resizable='yes';
// atrributes put together
var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;
// see if window already open
if (!linkWin.closed && linkWin.location) {
linkWin.location.href = theurl;
linkWin.focus();
} else {
linkWin = window.open(theurl,'',the_atts);
linkWin.focus();
}
// if information window
} else if (thewindow == 'info') {
// set width and height
var the_width=450;
var the_height=250;
// set window position
var from_top=30;
var from_left=30;
// set other attributes
var has_toolbar='no';
var has_location='no';
var has_directories='no';
var has_status='no';
var has_menubar='no';
var has_scrollbars='yes';
var is_resizable='no';
// atrributes put together
var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;
// see if window already open
if (!infoWin.closed && infoWin.location) {
infoWin.location.href = theurl;
infoWin.focus();
} else {
infoWin = window.open(theurl,'',the_atts);
infoWin.focus();
}
// if map window
} else if (thewindow == 'map') {
// set width and height
var the_width=450;
var the_height=300;
// set window position
var from_top=30;
var from_left=30;
// set other attributes
var has_toolbar='yes';
var has_location='no';
var has_directories='no';
var has_status='no';
var has_menubar='yes';
var has_scrollbars='yes';
var is_resizable='yes';
// atrributes put together
var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;
// see if window already open
if (!mapWin.closed && mapWin.location) {
mapWin.location.href = theurl;
mapWin.focus();
} else {
mapWin = window.open(theurl,'',the_atts);
mapWin.focus();
}
}
}
//
// ////////////////////////////////////////////
// IMAGE ROLLOVER - BORROWED FROM UCI LIBS HOME
// ////////////////////////////////////////////
//
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;
}
//
// END