function init()
{ SetStyleSheetInternal(); bmode = ReadCookie("browsermode", false); if (bmode == "text" ) { HideImages();}
}
function HideImages()
{ var rows=document.getElementsByTagName("img"); for (var i=0; i < rows.length; i++) { rows[i].style.display="none";}
}
function getStyle()
{ var x=document.getElementById("style"); var title=(x.options[x.selectedIndex].value); SetStyleSheet(title);}
function SetStyleSheet(newtitle)
{ SetStyleSheetInternal(newtitle); if (navigator.userAgent.indexOf('MSIE') != -1 &&
!window.opera &&
navigator.product != 'Gecko')
{ history.go(0);} }
function SetStyleSheetInternal(newtitle)
{ if (!document.getElementsByTagName)
{ return;}
var i; var savedtitle = ''; var links = document.getElementsByTagName("link"); if (!newtitle)
{ newtitle = savedtitle = ReadCookie("ALTISSstyle", false);}
if (!newtitle)
{ newtitle = GetPreferredStyleSheet();}
var activesheet = null; for (i = 0; i < links.length; i++)
{ var a = links[i]; var rel = a.getAttribute('rel'); var title = a.getAttribute('title'); if (rel.indexOf("style") != -1 && title)
{ a.disabled = true; if (title == newtitle)
{ activesheet = a;}
}
}
if (activesheet)
{ activesheet.disabled = false;}
if (newtitle != savedtitle)
{ CreateCookie("ALTISSstyle", newtitle, 365, false);}
}
function GetActiveStyleSheet()
{ if (!document.getElementsByTagName)
{ return null;}
var i; var links = document.getElementsByTagName("link"); for(i = 0; i < links.length; i++)
{ var a = links[i]; var rel = a.getAttribute('rel'); var title = a.getAttribute('title'); if (rel.indexOf("style") != -1 && title && !a.disabled)
{ return title;}
}
return null;}
function GetPreferredStyleSheet()
{ if (!document.getElementsByTagName)
{ return null;}
var i, a; var links = document.getElementsByTagName("link"); for (i = 0; i < links.length; i++)
{ a = links[i]; var rel = a.getAttribute('rel'); var title = a.getAttribute('title'); if (rel.indexOf("style") != -1 && rel.indexOf("alt") == -1 && title)
{ return title;}
}
return null;}
function CreateCookie(name,value,days,useLang)
{ var langString = useLang ? GetLang() : ""; var cookie = name + langString + "=" + value + ";"; if (days)
{ var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); cookie += " expires=" + date.toGMTString() + ";";}
cookie += " path=/"; document.cookie = cookie;}
function ReadCookie(name, useLang)
{ var langString = useLang ? GetLang() : ""; var nameEQ = name + langString + "="; 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;}
function SetTheme()
{ SetStyleSheetInternal(); return true;}
function GetLang()
{ var langString = ""; if (document.documentElement){ langString = document.documentElement.lang; if (langString != ""){ langString = "-" + langString;}
}
return langString;}

