<!--

//Opens "Ask A Librarian" form
function AskLibrarian()
{
   this.open('http://142.207.144.130/forms/ask_librarian.htm', 'AskLibrarianWindow', 					'height=650,width=700,resizable')
}

//Opens "Library Collection Reserve Request" form
function ReserveRequest()
{
   this.open('http://library.unbc.ca/forms/reserve_libmat.htm', 'LCReserveRequest', 					'height=550,width=550,resizable,scrollbars=yes')
}
//Opens "Electronic Reserve Request" form
function ReserveRequestElectronic()
{
   this.open('http://library.unbc.ca/forms/reserve_electmat.htm', 'ElectReserveRequest', 					'height=550,width=550,resizable,scrollbars=yes')
}
//Opens "Contact the Regional Services Librarian" form
function ContactRegional()
{
   this.open('http://142.207.144.130/forms/contact_reg_librarian.htm', 'ContactRegionalWindow',
	'height=500,width=600')
}

//Opens "Regional Article/Book Request" form
function RegionalRequest()
{
   this.open('http://142.207.144.130/forms/regional_request.htm', 'RegionalRequestWindow',
	'height=800,width=800')
}

//Opens "Regional Request Article" form
function RegionalRequestArticle()
{
   this.open('http://142.207.144.130/forms/regional_request_article.htm', 'RegionalRequestWindow',
	'height=850,width=850,resizable')
}

//Opens "Regional Request Book" form
function RegionalRequestBook()
{
   this.open('http://142.207.144.130/forms/regional_request_book.htm', 'RegionalRequestWindow',
	'height=700,width=750,resizable,scrollbars=yes')
}

//Opens "Request for Items from Storage" form
function StorageRequest()
{
   this.open('http://library.unbc.ca/forms/storage_request.htm', 'StorageRequestWindow',
	'height=400,width=700,resizable,scrollbars=yes')
}

//Opens "Distance Library Services Account Application" form
function RegionalAccount()
{
   this.open('http://142.207.144.130/forms/distanceaccountapplication.htm', 'RegionalAcctWindow',
	'height=850,width=700,resizable')
}

//Opens "Your Suggestions" form
function Suggest()
{
   this.open('http://142.207.144.130/forms/suggest.htm', 'YourSuggestionsWindow', 
	'height=450,width=550')
}

//Opens "Request for Items from Cataloguing" form
function CataloguingRequest()
{
   this.open('http://library.unbc.ca/forms/cataloguing_request.htm', 'CataloguingRequestWindow', 
	'height=400,width=500,resizable, scrollbars=yes')
}

//Opens "Interlibrary Loans Video Request" form
function ILLVideoRequest()
{
   this.open('http://142.207.144.130/forms/interlib_video.htm', 'ILLVideoRequstWindow', 
	'height=400,width=720,resizable,scrollbars=yes')
}

//Opens "Services you would like to see" form
function creative()
{
   this.open('http://142.207.144.130/forms/creative_info.htm', 'YourSuggestionsWindow', 
	'height=400,width=700,resizable')
}
//Opens "Abacus" 

function openAbacus()

{
   this.open('http://library.unbc.ca:2048/login?url=http://abacus.library.ubc.ca/jspui/', 'openAbacus')
}


//Opens "CdnCensus" 

function openCdnCensus()

{
   this.open('http://library.unbc.ca:2048/login?url=http://dc.chass.utoronto.ca/census', 'openCdnCensus')
}

//Opens "CANSIM" 

function openCANSIM()

{
   this.open('http://library.unbc.ca:2048/login?url=http://dc.chass.utoronto.ca/chasscansim/', 'openCANSIM')
}


//Opens "ICPSR" 

function openICPSR()

{
   this.open('http://library.unbc.ca:2048/login?url=http://www.icpsr.umich.edu', 'openICPSR', 
  	'height=800,width=800,resizable, scrollbars=yes')
}


//Opens "Landru" 


function openlandru()

{
   this.open('http://library.unbc.ca:2048/login?url=http://webapps6.ucalgary.ca/~landru/cgi-bin/Landru.pl?STATE=index', 'openlandru', 
  	'height=800,width=800,resizable, scrollbars=yes')

}
//Opens "SDA" 

function openSDA()
{
   this.open('http://library.unbc.ca:2048/login?url=http://r1.chass.utoronto.ca/sdaweb/index.html', 'openSDA')

}
//Opens "TRADE" 

function openTRADE()

{
   this.open('http://library.unbc.ca:2048/login?url=http://dc.chass.utoronto.ca/trade/', 'openTRADE')
}



//chass.utoronto.ca/datalib/major/sda.htm

//adds a favourite

function addBookmark(title,url) {
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}


//Launches a Viewlet
function LaunchViewlet( url, id, width, height )
    {
       //extract the url parameters if any, and pass them to the called html
       var tempvar=document.location.toString(); // fetch the URL string
       var passedparams = tempvar.lastIndexOf("?");
       if(passedparams > -1)
          url += tempvar.substring(passedparams);
      popup = window.open( url, id, 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=' + width + ',height=' + height + '' );
      popup.focus();
    }
    
    
//Change stylesheet opton
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
    
    
//-->