// js10 top bits
virt_host = ""
gt = unescape("%3e"); // greater than sign


// v.3 functions
if (window.noFunc != null){
	// document.write('stm found')
	if (typeof(Title) == "string"){
		document.writeln("\<TITLE" + gt + Title + "\</TITLE" + gt)
	}
}
// <TITLE>EU-OSHA NETWORK</TITLE>

//virt_dom = "osha.eu.int"
//Changing virt-dom to a conditional, depending on the current host - ER 12-12-00
if (location.host == "www.arbo.nl")
{virt_land = ""
virt_dom = "www.arbo.nl"}
else {virt_dom = "osha.eu.int";
virt_land = "europe."}
var expDays = 120
var exp = new Date()
exp.setTime(exp.getTime() + (expDays*24*60*60*1000))
CookiePath = "/"
CookieDomain = virt_dom
TableWidth = "100%"
TableMin = "100%"
TableMax = "100%"
TableIncr = 50
current_num = 0
doc_domain = window.location.host
doc_url = document.URL
loc_href = location.href
loc_protocol = location.protocol
loc_host = location.host
LowPath = '/'
LowPathNumber = 1

if(loc_host.indexOf("test.") != -1) {virt_host = "test."}
if(loc_host.indexOf("local.") != -1) {virt_host = "local."}
if(loc_host.indexOf("localtest.") != -1) {virt_host = "localtest."}

loc_hostName = location.hostName
loc_pathname = location.pathname
loc_hash = location.hash
doclastmod_date = document.lastModified; // get string of last modified date
sendmailto = "webmaster";                // the default mailto user
CopyrightURL = "http://europe." + virt_host + "osha.eu.int/disclaimer.stm"
LangBarAlt = "Select Language"
CountryAltAppendBefore = "Information_on___"
CountryAltAppendAfter = "___"
SectionAltAppendBefore = "Information_on___"
SectionAltAppendAfter = "___"
FooterInfoBy = "Information provided by"
FooterThisDoc = "This document"
FooterComment = "Comments"
FooterModified = "Last Modified"
FooterCopyright = "Copyright"
FooterVisits = "Pages visited"
FooterPrev = "Previous visit"
AltWidthMore = "Increase width"
AltWidthLess = "Decrease width"
AltWidthSet = "Input display width"
SearchLang = "en"
Agency_info= "http://agency.osha.eu.int/"
Agency_info_link = "Agency info"
Osha_eu_int = "http://osha.eu.int/"
Osha_eu_int_link = "osha.eu.int"
logo_path = "http://" + loc_host + "/gifs/logo/";
//from top
var n = 0
function MakeArray(n) {
this.length = parseInt(n)
//   this.length = n;
for (var j = 1; j <= n; j++) { this[j] = 0 }
return this
}

function Site(Num, Din, Name, Url, Host) {
this.Num = Num
this.Din = Din
this.Name = Name
this.Url = Url
this.Host = Host
}

function Secti(Num, Name, Path, Alt, Butt) {
this.Num = Num
this.Name = Name
this.Path = Path
this.Alt = Alt
this.Butt = Butt
}

Sites = 36
var i = 0
site = new MakeArray(Sites)
i++; site[i] = new Site(i, "<IMG SRC=\"http://" + loc_host + "/gifs/globeth.gif\" border='0' align='absmiddle'>", "&nbsp;Europe&nbsp;", "europe." + virt_host + "osha.eu.int", "EU OSH Information")
//i++; site[i] = new Site(i, "Global&nbsp;&nbsp;", "Global Gateway", "global.osha.eu.int", "Global Gateway")
topic_path = "http://" + site[i].Url + "/gifs/topic/"
din_path = "http://" + site[i].Url + "/gifs/din/"	// gifs at eu site
i++; site[i] = new Site(i, "A&nbsp;", "&nbsp;Austria", "at." + virt_host + "osha.eu.int", "Focal Point, Austria")
i++; site[i] = new Site(i, "B&nbsp;", "&nbsp;Belgium", "be." + virt_host + "osha.eu.int", "PREVENT, Belgium")
i++; site[i] = new Site(i, "D&nbsp;", "&nbsp;Germany", "de." + virt_host + "osha.eu.int", "Focal Point, Germany")
i++; site[i] = new Site(i, "DK&nbsp;", "&nbsp;Denmark", "dk." + virt_host + "osha.eu.int", "Focal Point, Denmark")
i++; site[i] = new Site(i, "E&nbsp;", "&nbsp;Spain",  "es." + virt_host + "osha.eu.int", "Focal Point, Spain")
i++; site[i] = new Site(i, "F&nbsp;", "&nbsp;France", "fr." + virt_host + "osha.eu.int", "Point focal, France")
i++; site[i] = new Site(i, "FIN&nbsp;", "&nbsp;Finland", "fi." + virt_host + "osha.eu.int", "ttkk, Finland")
i++; site[i] = new Site(i, "GR&nbsp;", "&nbsp;Greece", "gr." + virt_host + "osha.eu.int", "Focal Point, Greece")
i++; site[i] = new Site(i, "I&nbsp;", "&nbsp;Italy", "it." + virt_host + "osha.eu.int", "Focal Point, Italy")
i++; site[i] = new Site(i, "IRL&nbsp;", "&nbsp;Ireland", "ie." + virt_host + "osha.eu.int", "Focal Point, Ireland")
i++; site[i] = new Site(i, "LUX&nbsp;", "&nbsp;Luxembourg", "lu." + virt_host + "osha.eu.int", "Focal Point, Luxembourg")
i++; site[i] = new Site(i, "NL&nbsp;", "&nbsp;Netherlands", "nl." + virt_host + "osha.eu.int", "Focal Point, The Netherlands")
//Added extra line for www.arbo.nl - nodename - ER, 12-12-00
i++; site[i] = new Site(i, "P&nbsp;", "&nbsp;Portugal", "pt." + virt_host + "osha.eu.int", "Focal Point, Portugal")
i++; site[i] = new Site(i, "S&nbsp;", "&nbsp;Sweden", "se." + virt_host + "osha.eu.int", "Focal Point, Sweden")
i++; site[i] = new Site(i, "UK&nbsp;", "&nbsp;United Kingdom", "uk." + virt_host + "osha.eu.int", "Focal Point, The United Kingdom")
//i++; site[i] = new Site(i, "", "", "int." + virt_host + "osha.eu.int", "")
i++; site[i] = new Site(i, "CH&nbsp;", "&nbsp;Switzerland", "www.osha-focalpoint.ch", "Switzerland")
i++; site[i] = new Site(i, "IS&nbsp;", "&nbsp;Iceland", "www.vinnueftirlit.is", "Iceland")
i++; site[i] = new Site(i, "NO&nbsp;", "&nbsp;Norway", "www.arbeidsplassen.no", "Norway")

// CANDIDATES
i++; site[i] = new Site(i, "BG&nbsp;", "&nbsp;Bulgaria", "osha.mlsp.government.bg", "Focal Point, Bulgaria")
//i++; site[i] = new Site(i, "CY&nbsp;", "&nbsp;Cyprus", "URL goes here", "Focal Point, Cyprus")
i++; site[i] = new Site(i, "CZ&nbsp;", "&nbsp;Czech Republic", "osha.mpsv.cz", "Focal Point, Czech Republic")
i++; site[i] = new Site(i, "EE&nbsp;", "&nbsp;Estonia", "osh.sm.ee", "Focal Point, Estonia")
i++; site[i] = new Site(i, "HU&nbsp;", "&nbsp;Hungary",  "www.focalpoint.hu", "Focal Point, Hungary")
i++; site[i] = new Site(i, "LV&nbsp;", "&nbsp;Latvia", "osha.lv", "Focal Point, Latvia")
i++; site[i] = new Site(i, "LT&nbsp;", "&nbsp;Lithuania", "osha.vdi.lt", "Focal Point, Lithuania")
i++; site[i] = new Site(i, "MT&nbsp;", "&nbsp;Malta", "mt.osha.eu.int", "Focal Point, Malta")
i++; site[i] = new Site(i, "PL&nbsp;", "&nbsp;Poland", "www.bp.edu.pl", "Focal Point, Poland")
i++; site[i] = new Site(i, "RO&nbsp;", "&nbsp;Romania", "www.protectiamuncii.ro", "Focal Point, Romania")
i++; site[i] = new Site(i, "SK&nbsp;", "&nbsp;Slovakia", "osha.safework.gov.sk", "Focal Point, Slovakia")
i++; site[i] = new Site(i, "SI&nbsp;", "&nbsp;Slovenia", "vzd.gov.si", "Focal Point, Slovenia")
//i++; site[i] = new Site(i, "TR&nbsp;", "&nbsp;Turkey", "URL goes here", "Focal Point, Turkey")

// END CANDIDATES

i++; site[i] = new Site(i, "INT&nbsp;", "&nbsp;International", "int." + virt_host + "osha.eu.int", "EU-OSHA: International Info")
i++; site[i] = new Site(i, "ILO&nbsp;", "&nbsp;ILO", "www.ilo.org/public/english/protection/euportal/en", "ILO")
i++; site[i] = new Site(i, "WHO&nbsp;", "&nbsp;World Health Organisation &nbsp;", "www.who.int/oeh/WHOEU/web", "WHO")
i++; site[i] = new Site(i, "AU&nbsp;", "&nbsp;Australia", "www.nohsc-eu.gov.au", "Australia")
i++; site[i] = new Site(i, "CAN&nbsp;", "&nbsp;Canada&nbsp;", "www.eu-ccohs.org", "Canada-EU Cooperation on Workplace Safety and Health")
i++; site[i] = new Site(i, "US&nbsp;", "&nbsp;USA", "europe.osha.eu.int/eu-us", "EU-US collaboration")

Sections = 13  // Without the tools (02-09-2002, MCA)
var i = 0
sect = new MakeArray(Sections)
i++; sect[i] = new Secti(i, "Welcome&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/", "Welcome text", "welcome")
i++; sect[i] = new Secti(i, "News & Events&nbsp;", "/news/", "Current OSH news, press releases and links to OSH newsletters and magazines, events etc.", "news")
i++; sect[i] = new Secti(i, "Legislation&nbsp;&nbsp;&nbsp;&nbsp;", "/legislation/", "Legislation, Standards, Guidelines", "legislation")
i++; sect[i] = new Secti(i, "Good&nbsp;Practice&nbsp;&nbsp;", "/good_practice/", "Good Practice", "good_practice")
i++; sect[i] = new Secti(i, "Research&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/research/", "Research", "research")
i++; sect[i] = new Secti(i, "Statistics&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/statistics/", "Statistics", "statistics")
i++; sect[i] = new Secti(i, "Systems&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/systems/", "Systems and Programmes: Description of the national OSH system infrastructure", "systems")
i++; sect[i] = new Secti(i, "Training&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/training/", "Training", "training")
i++; sect[i] = new Secti(i, "Topics&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/topics/", "Topics", "topics")
i++; sect[i] = new Secti(i, "Publications&nbsp;&nbsp;", "/publications/", "Publications and Documentation: Includes information on publications, campaigns and bibliographic databases", "publications")
i++; sect[i] = new Secti(i, "Discussion&nbsp;&nbsp;&nbsp;&nbsp;", "/discussion/", "Discussion", "discussion")
i++; sect[i] = new Secti(i, "FAQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/faq/", "Frequently Asked Questions", "faq")
//i++; sect[i] = new Secti(i, "Who is Who&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/whoiswho/", "Who is who in OSH", "whoiswho")
i++; sect[i] = new Secti(i, "About our network&nbsp;", "/about/", "About our network", "About our network")

i++; sect[i] = new Secti(i, "Search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/search/", "Search function that covers the whole network", "search")
SearchNum = i
i++; sect[i] = new Secti(i, "Help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/help/", "Advice on how to use the system", "help")
i++; sect[i] = new Secti(i, "Comments&nbsp;&nbsp;&nbsp;&nbsp;", "/comments/", "User comments and feedback of the site and information content", "comments")
i++; sect[i] = new Secti(i, "Sitemap&nbsp;&nbsp;&nbsp;&nbsp;", "/sitemap/", "Overview of the site structure and navigation to different sections", "sitemap")
//i++; sect[i] = new Secti(i, "Index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/index/", "Subject index to the site information", "index")
i++; sect[i] = new Secti(i, "Whats&nbsp;New&nbsp;&nbsp;&nbsp;", "/whats_new/", "Whats New", "whats_new")
i++; sect[i] = new Secti(i, "Translation&nbsp;Help&nbsp;&nbsp;&nbsp;", "/translations/", "Translation Help", "translations")

// make listing of current site variables
for (var i = 1; i <= Sites; i++){
if (doc_domain == site[i].Url) {
current_din = site[i].Din;
current_name = site[i].Name;
current_url = site[i].Url;
current_host = site[i].Host;
//node_name = current_host
node_name = current_name
current_num = parseInt(site[i].Num);
}
}
if (typeof (current_url) == "undefined") {current_url = site[1].Url}
if (typeof (current_host) == "undefined") {current_host = site[1].Host}
if (typeof (current_din) == "undefined") {current_din = site[1].Din}
if (typeof (current_name) == "undefined") {current_name = site[1].Name}
if (typeof (current_num) == "undefined") {current_num = site[1].Num}
// convert path to lowest commonly agreed path
LowPath = location.pathname
now_sect_path = "notfound"
for (var i = 1; i <= Sections; i++) {
	var j = (Sections+1) - i

if (now_sect_path == "notfound"){
  	if (LowPath.indexOf(sect[j].Path) != -1){
	now_sect_path = "found"
	LowPath = sect[j].Path
	LowPathNumber = j
	}
}
}
if (now_sect_path == "notfound") {
	LowPath = '/'
	LowPathNumber = 1; // replace to root if not identified
	}

// browser detection
navigator_useragent = navigator.userAgent
if(navigator.userAgent.indexOf("Mozilla") != -1) {browserused = "Mozilla"}
if(navigator.userAgent.indexOf("Opera") != -1) {browserused = "Opera"}
if(navigator.userAgent.indexOf("MSIE") != -1) {browserused = "MSIE"}

// js_level set to 10
js_level=10

function DrawWidthButt(dir, link, alt){
document.write("\<A HREF=\"JavaScript:" + link + "(\'" + dir + "\')\"\>")
//document.writeln("\<IMG SRC=\"http://europe." + virt_host + virt_dom + "/gifs/" + dir + ".gif\" width=34 height=21 ALT=\"" + alt + "\" BORDER=0 ALIGN=left VSPACE=1 HSPACE=1\>\</A\>")
document.writeln("\<IMG SRC=\"http://" + loc_host + "/gifs/" + dir + ".gif\" width=34 height=21 ALT=\"" + alt + "\" BORDER=0 ALIGN=left VSPACE=1 HSPACE=1\>\</A\>")
}

function DispWidthButt(){
// more set & less
DrawWidthButt("newless", "increment", AltWidthLess)
DrawWidthButt("newset", "set", AltWidthSet)
DrawWidthButt("newmore", "increment", AltWidthMore)
}

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset)
if (endstr == -1) {endstr = document.cookie.length }
return unescape(document.cookie.substring(offset+1, endstr))
}

function GetCookie (name) {
var arg = name
var alen = arg.length
var clen = document.cookie.length
var i = 0
while (i < clen) {
var j = i + alen
if (document.cookie.substring(i, j) == arg) {return getCookieVal (j)}
i = document.cookie.indexOf(" ", i) + 1
	if (i == 0) break }
return null
}

function SetCookie (name, value) {
var argv = SetCookie.arguments
var argc = SetCookie.arguments.length
var expires = (argc > 2) ? argv[2] : null
var path = (argc > 3) ? argv[3] : null
var domain = (argc > 4) ? argv[4] : null
var secure = (argc > 5) ? argv[5] : false
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "")
}

function show_props(obj, obj_name) {
var result = ""
for (var i in obj)
	result += obj_name + "." + i + " = " + obj[i] + "\n"
return result
}

function ValidWidth(){
if (TableWidth < TableMin) {TableWidth = TableMin}
if (TableWidth > TableMax) {TableWidth = TableMax}
}

function set(){
TableWidth = prompt("Current Width =" + TableWidth + ". ENTER New Width (" + TableMin + "-" + TableMax + ")",TableWidth);
ValidWidth(TableWidth)
SetCookie ('TableWidth', TableWidth, exp, CookiePath, CookieDomain)
history.go(0)
}

function increment(direction){
TableWidth = parseInt(TableWidth);
if (direction == "more") {TableWidth += TableIncr}
if (direction == "less") {TableWidth -= TableIncr}
ValidWidth(TableWidth)
SetCookie ('TableWidth', TableWidth, exp, CookiePath, CookieDomain)
history.go(0)
}

function Width(info){
TableWidth = GetCookie('TableWidth')
AdminNote ("<BR>in function Width: TableWidth GetCookie = " + TableWidth)
if (TableWidth == null) {
	AdminNote ("<BR>in function Width: TableWidth set to default = 800")
	TableWidth = "100%"
	SetCookie ('TableWidth', TableWidth, exp, CookiePath, CookieDomain);
	}
}

function When(info){
var rightNow = new Date()
var WWHTime = 0
WWHTime = GetCookie('WWhenH')
WWHTime = WWHTime * 1
var lastHereFormatting = new Date(WWHTime);  // Date-i-fy that number
var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
var lastHereInDateFormat = "" + lastHereFormatting;  // Gotta use substring functions
var dayOfWeek = lastHereInDateFormat.substring(0,3)
var dateMonth = lastHereInDateFormat.substring(4,11)
var timeOfDay = lastHereInDateFormat.substring(11,16)
var year = lastHereInDateFormat.substring(23,25)
var WWHText = dayOfWeek + ", " + dateMonth + " at " + timeOfDay // display
WhenLast = WWHText
SetCookie ("WWhenH", rightNow.getTime(), exp, CookiePath, CookieDomain)
return WWHText;
}

function Count(info){
WWHCount = 0
WWHCount = GetCookie('WWHCount')
if (typeof(WWHCount) == "NaN") {WWHCount = 0}
if (WWHCount == null) {WWHCount = 0}
else {WWHCount++}
CountLast = WWHCount
SetCookie ('WWHCount', WWHCount, exp, CookiePath, CookieDomain)
return WWHCount
}

function DrawFPLogo() {
if (typeof (FPLogoHeight) != "undefined") {
	var height = FPLogoHeight
	if (height > 60) {height = 60}
	}
else {var height=60}
if (typeof (FPLogoWidth) != "undefined") {
	var width = FPLogoWidth
	if (width > 60) {width = 60}
	}
else {var width=60}
if (typeof (FPLogoAlt) != "undefined") {var alt = FPLogoAlt}
else {var alt=""}
if (typeof (FPLogoUrl) != "undefined") {var url = FPLogoUrl}
else {var url="http://europe.osha.eu.int/"}
document.write("\<A HREF=\"" + url + "\"\>\<IMG SRC=\"" + FPLogo + "\" WIDTH=" + width + " HEIGHT=" + height + " align=\"bottom\" BORDER=0 ALT=\"" + alt + "\"\>\</A\>")
}

// Admin Notes parser
function AdminNote(addme){
if (typeof (AdminNotes) == "undefined") {AdminNotes = addme}
else {AdminNotes += addme}
}

// Important call to init cookies, dont del.
//Width()
