// v1.1.3
// 27/5/01 cro - Factored out GetCSS()
// 11/7/01 cro - Dropped Mac IE5 from the IE custom stylesheet because it was flaky. These users now get the generic stylesheet.
// 21/8/01 pjn - Borrowed from "http://www.nngroup.com/script/nng.js

var gStyleServer	= "www.anne.regourd.org/";
var gStylePath		= "css/"; 
var gCounterURL	= "http://www.anne.regourd.org/cgi-bin/articker.cgi?";
var gBaseURL		= "http://www.anne.regourd.org/";

var gDefaultCss  = "fa.css";     // default
var gIECss       = "fa-ie.css";     // ie non-mac   
var gNNCss       = "fa-nn.css";     // nn non-mac
var gIEMacCss    = "fa-mac-ie.css";     // ie mac
var gNNMacCss    = "fa-mac-nn.css";     // nn mac
var gNNMacOldCss = "fa-mac-nn-old.css";     // nn old-mac 
var gIEOldCss    = "fa-ie-old.css";   // old ie all plats
var gNNMacVer    = 4;            // Mac version which is 'new' (for nscape)
var gIENewVer    = 5;            // IE version which is 'new' 
//  Get Platform and version for browser
var isNav = navigator.appName.indexOf("Netscape") != -1;
var isIE  = navigator.appName.indexOf("Microsoft") != -1;
var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0);
var gBrowser = navigator.appName;
var gAppVersion = navigator.appVersion;
var gPlatform = navigator.platform;
var gVersion = GetVersion();

var gPageURL = document.location;

//	Returns the URL to the custom stylesheet for the client.  For IE, if the
//	client is not a Mac, they get a custom stylesheet.  For Netscape, if the
//	client is a Mac with Mozilla they get the same custom stylesheet other
//	Netscape users get.  Other Macs and (and other platforms and browsers)
//	will get the generic stylesheet, on the offhand hope that they will 
//	respect it.

function GetCSS() 	// Determine which platform stylesheet to use...
{
	var sCSS;
	
	if (isIE)       	                     // ie                
	{
		 if (gVersion < gIENewVer)
		 	sCSS = gIEOldCss;	
		else if (!isMac)
			sCSS = gIECss;	        	         // ie non-mac 				              	        	         			              	        	         	
		else
			sCSS = gIEMacCss;                // ie mac		
	}
	
	
	else if (isNav)                        // nav
	{                		 
		if (!isMac) 
			sCSS = gNNCss;                   // nav non-mac			
		else if (gVersion >= gNNMacVer)
			sCSS = gNNMacCss;                // nav mac newer
		else
			sCSS = gNNMacOldCss;             // nav mac  older			
	}
	else sCSS = gDefaultCss;               // default as none of above
	sCSS = "http://" + gStyleServer + gStylePath + sCSS;
	return (sCSS);
}

//	Includes text, for debug purposes

function DebugWriteCSS() 
{
	var sCSS = GetCSS();
	var sString = "";	
//	if (sCSS.length > 0) document.write("nng.js writes: &lt;link rel=\"stylesheet\" href=\"" + sCSS + "\"&gt;");
// if (sCSS.length > 0) 	
//document.write("pjn nng.js writes: &lt;link rel=\"stylesheet\" href=\"" + sCSS +	"\"&gt;" +	"gVersion is " + gVersion);	
sString = "platform: " + gPlatform + "\r appversion " + gAppVersion + "\r css: " + sCSS ;
document.write(sString);
}

//	Includes the correct stylesheet in the HTML
function WriteCSS() 
{
	var sCSS = GetCSS();
	if (sCSS.length > 0) document.write("<link rel=\"stylesheet\" href=\"" + sCSS + "\">");
}

// write the counter calling html for the logging script
function WriteCounter()
{
        var sPageURL = window.location;
        var sReferrerURL = document.referrer;
        var sHTML = "";
		  var sParameterString = "";
		  sParameterString = ( sPageURL.pathname   + "-ZZ-" + sReferrerURL  + "-ZZ-" + gBrowser+ "-ZZ-" + gVersion  + "-ZZ-" + gPlatform );

// form html string to write into page
sHTML = "<IMG SRC=\"" +  gCounterURL +  sParameterString + "\" ALT=\"Counter\"  WIDTH=\"1\" HEIGHT=\"1\"  BORDER=\"0\"  >";

// if (sHTML.length > 0) document.write(sHTML);
        document.writeln(sHTML);       
  }
// **************************************************************
function WriteDate()
{
        var sToday = new Date();
        document.write(sToday.toLocaleString());        
}
// **************************************************************
// **************************************************************
function WriteTime()
{
        var sToday = new Date();
        document.write(sToday.toLocaleString());        
}
// **************************************************************
function WriteRevised()
{
        var sToday = new Date();
        
 //       if (date.Parse(document.lastModified) != 0)
        
        document.write("Last altered: " + document.lastModified );     
}
// **************************************************************
function WriteCSSType()
{
        var sCSS = GetCSS();
        document.write(sCSS);     
}
// **************************************************************
function WriteVersion()
{        
        document.write(gVersion);     
}
// **************************************************************
function WriteBrowser()
{        
        document.write(gBrowser);     
}
// **************************************************************
function WritePlatform()
{        
        document.write(gPlatform);     
}
// **************************************************************
// Get the browser version.  Digs into appVersion for IE, since MS doesn't 
// understand what version numbers are for. Otherwise just parses the appVersion.

function GetVersion() {
	var s = navigator.appVersion;
	var n = s.indexOf("MSIE");
	var v = 0;
// Grab the first number appearing after "MSIE"
	if (n != -1) { v = parseFloat(s.substr(n + 4)); }
	else { v = parseFloat(s); }
	return v;
}
// **************************************************************
// Some cookie stuff. Calls functions from library.js
//
// **************************************************************
//  Global to set expiry time for cookie - adjust 
    var gToday = new Date();
//    var gExpiry = new Date(gToday.getTime() + 365 * 24 * 60 * 60 * 1000);
    var gExpiry = new Date(gToday.getTime() +  5 * 24 * 60 * 60 * 1000);
	 var gCookieName = 'Trail';	 
// *************************************************************
 function HrefMarkup(anchorText, url)
 {
     var sMarkup = "";
     sMarkup = "<a href=" + url + ">" + anchorText + "<\/a>";
     return sMarkup;
 } 
// ************************************************************* 
function writeCrumbs() 
{
	 var nTrailString = "";
	 var sParts = new Array(6);
	 var sTrailString = "x||x||x||x||x||x";
	 var sTemp = "";
	 


    if (GetCookie(gCookieName) == null)	 {
//		  document.write('no cookie');
		  SetCookie (gCookieName,sTrailString,gExpiry,"/" )
    }
	 else
	 {    
		  sTrailString = GetCookie(gCookieName);

	 }

    sParts = sTrailString.split("||");
//	 document.write('<a href=\"http:\/\/www.leeds.ac.uk\/fine_art\/\">Home3<\/a>');
	 

	 if (sParts[4] != "x") { document.write ("&nbsp;>&nbsp;[" + HrefMarkup(sParts[4],sParts[5]) + "]" );  }    
	 if (sParts[2] != "x") { document.write ("&nbsp;>&nbsp;[" + HrefMarkup(sParts[2],sParts[3]) + "]" );  }  
	 if (sParts[0] != "x") { document.write ("&nbsp;>&nbsp;[" + HrefMarkup(sParts[0],sParts[1]) + "]" );  }
	 document.write("&nbsp;>&nbsp;" + document.title);
	 
	 sParts[5] = sParts[3];
    sParts[4] = sParts[2];
    sParts[3] = sParts[1];
    sParts[2] = sParts[0];
	 
	 sTemp     = window.location;
    sParts[1] = sTemp + "#" + "cr";	 
    sParts[0] = document.title;
	 
	 sTrailString = sParts.join("||");
    sTrailString = sTrailString;
	 SetCookie (gCookieName,sTrailString,gExpiry,"/" )

}
// *************************************************************

var gXlatorURL = "http:\/\/translate.google.com\/translate?";
// **************************************************************

function xLink(theURL, inLang, outLang)
{
	 var linkText = "";	 
	 linkText = ( gXlatorURL + "u=" + theURL + "&langpair=" + inLang + "%7C" + outLang + "&hl=en&ie=ISO-8859-1&prev=%2Flanguage_tools" );	
return linkText;	 	 
}



function WriteXlatorLine()
{
		 
	 if (top.location.href == self.location.href)  	
	 {	 
		  
	 var pageURL = self.location.href;
	 var sGerman = HrefMarkup("German", xLink(pageURL, "en", "de"))
	 var sFrench = HrefMarkup("French", xLink(pageURL, "en", "fr"))
	 var sSpanish = HrefMarkup("Spanish", xLink(pageURL, "en", "es"))
	 var sItalian = HrefMarkup("Italian", xLink(pageURL, "en", "it"))
	 var sPortuguese = HrefMarkup("Portuguese", xLink(pageURL, "en", "pt"))

	 var sJapanese = HrefMarkup("Japanese", xLink(pageURL, "en", "ja"))
	 var sKorean = HrefMarkup("Korean", xLink(pageURL, "en", "ko"))
	 var sChinese = HrefMarkup("Chinese", xLink(pageURL, "en", "zh-CN"))

	
	
	
	
	 document.write("Google Translate: &nbsp;");
	 document.write("[" + sGerman + "]");
	 document.write("[" + sFrench + "]");
	 document.write("[" + sSpanish + "]");
	 document.write("[" + sItalian + "]");
	 document.write("[" + sPortuguese + "]");
	 

	 document.write("[" + sJapanese + "]");
	 document.write("[" + sKorean + "]");
	 document.write("[" + sChinese + "]");

	 }	 
	 else
// We're  enclosed in the google translator framer	 
 {
		  
		  document.write("to english");
	 }
}


function xWriteXlatorLine()
{
}

