// stylesheet loader
// simplest version, I have others
// content area stylesheet is controlled by a generic css
if (navigator.appName.indexOf("Explorer") != -1)
	{
	document.write("<LINK REL='STYLESHEET' HREF='/Experience/~css/footprint.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/header.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/leftnav.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/content.css' TYPE='text/css'>");
	}
else  // Browser is not MSIE - loads NS6 style sheet
	{  
	document.write("<LINK REL='STYLESHEET' HREF='/Experience/~css/NS6_footprint.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/NS6_header.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/NS6_leftnav.css' TYPE='text/css'>");
	document.write("<LINK REL='STYLESHEET' HREF='/~css/content.css' TYPE='text/css'>");
	}
	
//reloads the window if Nav4 resized (not really supported, but...)
function reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
	
// perfect popup window opener, so content can be accessed by SEs.
// also makes sure the window comes to front if already open.
// link syntax: <a href="url.htm" onclick="popUp(this.href,'image');return false;" target="newWin"> 
var newWin = null; 
function popUp(strURL,strType,strHeight,strWidth) {
if (newWin != null && !newWin.closed) 
   newWin.close(); 
	var strOptions="";
	if (strType=="kiosk") // Your Lindal folder and resource center 
		strHeight="500"
		strWidth="785"
		strOptions="scrollbars=yes,resizable,height="+strHeight+",width="+strWidth;
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

// Image enlargement popup
// link syntax: <a href="javascript:popImage('image/url.gif','Image title','doscript_URL.htm')">

// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;

// autoclose false to allow multiple popup windows
var AutoClose = false;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle,imageSaveURL){
	/*
	if (isNN){imgWin=window.open('/_apps/gallery/enlargeImage.cfm?imageName=' + imageURL + '&saveURL=' + imageSaveURL,'',optNN);}
	if (isIE){imgWin=window.open('/_apps/gallery/enlargeImage.cfm?imageName=' + imageURL + '&saveURL=' + imageSaveURL,'',optIE);}
	exec(imgWin);
	*/
	if (isNN){imgWin=function() {window.open('/_apps/gallery/enlargeImage.cfm?imageName=' + imageURL + '&saveURL=' + imageSaveURL,'',optNN);}}
	if (isIE){imgWin=function() {window.open('/_apps/gallery/enlargeImage.cfm?imageName=' + imageURL + '&saveURL=' + imageSaveURL,'',optIE);}}
	imgWin();
}

// Image enlargement popup WITHOUT save function
// link syntax: <a href="javascript:popImageAlt('image/url.gif','Image title','doscript_URL.htm')">


function popImageAlt(imageURL,imageTitle,imageSaveURL){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript>'); // had to hack the word "script"
writeln('var isNN,isIE;');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=(100-(document.body.clientHeight-document.images[0].height) + 30);'); // 30 is padding
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');       
writeln('window.innerWidth=document.images["lindal"].width;');
writeln('window.innerHeight=(document.images["lindal"].height) + 30;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose) 
	writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else 
	writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="lindal" src='+imageURL+' style="display:block">');
writeln('<a href="javascript:window.close()"><img src="/~img/homes/gallery/btn_gallery_close.gif" border="0"></a></body></html>'); // had to hack the word "close"
close();		
}}


// Print content window popup
// link syntax: <a href="javascript:printContent('/~content/content_2column.htm','Page title')">
// autoclose false to allow multiple popup windows
var AutoClose = false;
var printWin;
function printContent(contentURL,pageTitle){
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='toolbar=yes,resizable=no,menubar=yes,scrollbars=yes,width=609,height=400,left='+PositionX+',top='+PositionY;
	var optIE='toolbar=yes,resizable=no,menubar=yes,scrollbars=yes,width=624,height=400,left='+PositionX+',top='+PositionY;

	if (isNN){printWin=window.open('/_apps/print/default.cfm?pu=' + contentURL + '&pt=' + pageTitle,'',optNN);}
	if (isIE){printWin=window.open('/_apps/print/default.cfm?pu=' + contentURL + '&pt=' + pageTitle,'',optIE);}

}

// Print content window popup
// link syntax: <a href="javascript:printContent('/~content/content_2column.htm','Page title')">
// autoclose false to allow multiple popup windows
function printContent_Dynamic(contentURL,queryString,pageTitle){
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='toolbar=yes,resizable=no,menubar=yes,scrollbars=yes,width=609,height=400,left='+PositionX+',top='+PositionY;
	var optIE='toolbar=yes,resizable=no,menubar=yes,scrollbars=yes,width=624,height=400,left='+PositionX+',top='+PositionY;

	if (isNN){printWin=window.open('/_apps/print/default.cfm?' + queryString + '&pu=' + contentURL + '&pt=' + pageTitle,'',optNN);}
	if (isIE){printWin=window.open('/_apps/print/default.cfm?' + queryString + '&pu=' + contentURL + '&pt=' + pageTitle,'',optIE);}

}

//Image rollovers
//Preloads go in body tag with syntax onLoad="imgPreload('/~img/filename.gif')"
function imgPreload() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=imgPreload.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function swap() { 
  var i,j=0,x,a=swap.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapBack() { 
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function findObj(n, d) { 
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

// Adding this to sanify adding onload thingies
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
