// green #99cc66

/* use in case text link instead of chagosislands.gif */
active_header = "#ffffff";  /* font colour in top menu for current page */

slogan = 'The Virtual Republic of Chagos'

default_theme = 'blue';

/* read cookie: if cookie exist, check value substring, reset default theme */

if(document.cookie){

if (document.cookie.indexOf('blue') != -1){
default_theme = 'blue';
}

if (document.cookie.indexOf('yellow') != -1){
default_theme = 'yellow'; }
}

//---------------------------------------------------------------------------//

if(location.search)location.replace(location.search.substring(1))


//---------------------------------------------------------------------------//

/* write cookie: set cookie/date and reset colours dynamically */
function setTheme(myTheme){

var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() +1);
document.cookie = "display="+ myTheme +";expires="+ nextyear.toGMTString();

default_theme = myTheme;
resetTheme();
}

function resetTheme(){
themeCollections()
//alert(themeCollections)

document.getElementById("top_header_bgcolor").style.background=top_header_bgcolor;
document.images.tooth.src=tooth;
document.images.logo.src=logo;
document.getElementById("slogan_font_color").style.color=slogan_font_color;

document.getElementById("sky").style.backgroundImage="url("+header_background_image+")"

document.getElementById("header_bgcolor").style.background=header_bgcolor;
document.getElementById("highlight1").style.background=highlight1;
document.getElementById("highlight2").style.background=highlight2;
document.getElementById("shadow1").style.background=shadow1;
document.getElementById("shadow2").style.background=shadow2;
document.images.top_right_corner.src=top_right_corner;
document.images.top_left_corner.src=top_left_corner;

/* the 3 cells in patienteninfo box header and font colour */
document.getElementById("top_bar_bgcolor1").style.background=top_bar_bgcolor;
document.getElementById("top_bar_bgcolor2").style.background=top_bar_bgcolor;
document.getElementById("top_bar_bgcolor3").style.background=top_bar_bgcolor;
document.getElementById("top_bar_font_color").style.color=top_bar_font_color;

/* collect all links by class and change their colour */
var link_classes = document.getElementsByTagName('a');
for (var i=0;i<link_classes.length;i++)
if (link_classes[i].className == 'link'){
link_classes[i].style.color = link_colour;
}

/* check if style declaration exists before executing these */
if (document.getElementById("active_arrow") != null){
document.getElementById("active_arrow").style.color=active_arrow;
document.getElementById("active_arrow_bgcolor").style.background=active_arrow_bgcolor;
document.getElementById("active_menu").style.color=active_menu;
document.getElementById("active_bgcolor").style.background=active_bgcolor;
}

/* collect classes for colour behind inactive subjects */
var inactive_arrow_bgcolor_classes = document.getElementsByTagName('td');
for (var i=0;i<inactive_arrow_bgcolor_classes.length;i++)
if (inactive_arrow_bgcolor_classes[i].className == 'inactive_arrow_bgcolor'){
inactive_arrow_bgcolor_classes[i].style.background = inactive_arrow_bgcolor;
}


/* collect classes for colour of arrow for inactive subjects */
var inactive_arrow_classes = document.getElementsByTagName('font');
for (var i=0;i<inactive_arrow_classes.length;i++)
if (inactive_arrow_classes[i].className == 'inactive_arrow'){
inactive_arrow_classes[i].style.color = inactive_arrow;
}

/* collect classes for background colour for inactive subjects */
var inactive_bgcolor_classes = document.getElementsByTagName('td');
for (var i=0;i<inactive_bgcolor_classes.length;i++)
if (inactive_bgcolor_classes[i].className == 'inactive_bgcolor'){
inactive_bgcolor_classes[i].style.background = inactive_bgcolor;
}


document.getElementById("table_border_color1").style.background=table_border_color1;
document.getElementById("table_border_color2").style.background=table_border_color2;

document.getElementById("bottom_left_table_color").style.background=bottom_left_table_color;
document.getElementById("bottom_left_text_color").style.color=bottom_left_text_color;
document.getElementById("last_sentence").style.color=last_sentence;

/* reset form background colour in theme and font switch */
document.getElementById("switch1").style.background=header_bgcolor;
document.getElementById("switch2").style.background=header_bgcolor;
document.getElementById("switch3").style.background=header_bgcolor;
}


preload1 = new Image(235,19); preload1.src = "images/chagosislands2.gif";
preload2 = new Image(76,45); preload2.src = "images/moonjellyfish2.gif";
preload3 = new Image(8,8); preload3.src = "images/topleftcorner2.gif";
preload4 = new Image(8,8); preload4.src = "images/toprightcorner2.gif";

preload5 = new Image(235,19); preload5.src = "images/chagosislands1.gif";
preload6 = new Image(67,45); preload6.src = "images/coconut1.gif";
preload7 = new Image(8,8); preload7.src = "images/topleftcorner1.gif";
preload8 = new Image(8,8); preload8.src = "images/toprightcorner1.gif";


function themeCollections(){
if (default_theme == "yellow"){

top_header_bgcolor = "#ffcc66"; /* background colour of top header */
tooth = "images/coconut1.gif";
logo = 'images/chagosislands1.gif';
slogan_font_color = "#954e00";
header_background_image = "images/header1.jpg";

highlight1 = "#ffd78e"; /* upper highlight */
highlight2 = "#ff9900"; /* lower highlight */
header_bgcolor = "#ff9900"; /* background colour of link menu */
shadow1 = "#d89331"; /* upper shaddow */
shadow2 = "#ffffff"; /* lower shaddow */

top_left_corner = "images/topleftcorner1.gif";
top_right_corner = "images/toprightcorner1.gif";
top_bar_bgcolor = "#ff9900"; /* background colour of patienteninformation part */
top_bar_font_color = "#ffffff"; /* color of left menu font */

link_colour = "#663300"; /* link colours incl. visited link of both menus */
hover_links = "#993300";

active_arrow = "#993300"; /* colour of arrow for present page */
active_arrow_bgcolor = "#ffe7b7"; /* bgcolor behind the arrow for present page */
active_menu = "#993300"; /* text colour in left menu for present page */ 
active_bgcolor = "#ffe7b7"; /* table cell colour behind text for present page */

inactive_arrow_bgcolor = "#ffcc66"; /* colour behind arrow of inactive subjects */
inactive_arrow = "#663300"; /* colour of arrow for inactive subjects */
inactive_bgcolor = "#ffcc66"; /* table cell colour behind inactive subjects */

table_border_color1 = "#ff9900"; /* define border colour around left menu table 1 */
table_border_color2 = "#ff9900"; /* define border colour around left menu table 2 */

bottom_left_table_color = "#ffcc66";

bottom_left_text_color = "#663300";

last_sentence = "#993300";
}


if (default_theme == "blue"){

top_header_bgcolor = "#022a7a"; /* background colour of top header */
tooth = "images/moonjellyfish2.gif";
logo = 'images/chagosislands2.gif'
slogan_font_color = "#94aed5";
header_background_image = "images/header2.jpg";


highlight1 = "#c5daf6"; /* upper highlight */
highlight2 = "#94aed5"; /* lower highlight */
header_bgcolor = "#94aed5"; /* backgrond colour of link menu */
shadow1 = "#94aed5"; /* upper shaddow */
shadow2 = "#203862"; /* lower shaddow */

top_left_corner = "images/topleftcorner2.gif";
top_right_corner = "images/toprightcorner2.gif";
top_bar_bgcolor = "#00287a"; /* background colour of info menu header part */
top_bar_font_color = "#ffffff"; /* color of info menu font */

link_colour = "#39306a"; /* link colours incl. visited link of both menus */
hover_links = "#0000ff";

active_arrow = "#39306a"; /* colour of arrow for present page */
active_arrow_bgcolor = "#f5f5f5"; /* bgcolor behind the arrow for present page */
active_menu = "#7ba5c5"; /* text colour in left menu for present page */ 
active_bgcolor = "#f5f5f5"; /* table cell colour behind text for present page */
inactive_arrow_bgcolor = "#f5f5f5"; /* colour behind arrow of inactive subjects */
inactive_arrow = "#7ba5c5"; /* colour of arrow for inactive subjects */
inactive_bgcolor = "#eeeeee"; /* table cell colour behind inactive subjects */

table_border_color1 = "#bec2bf"; /* define border colour around left menu table 1 */
table_border_color2 = "#bec2bf"; /* define border colour around left menu table 2 */

bottom_left_table_color = "#eeeeee";

bottom_left_text_color = "#000000";

last_sentence = "#0000ff";

}
}

themeCollections()

/* both menus */

active_link = "#ffe9b2"; /*  active link onclick */

menu_font_face = "helvetica";
menu_font_size = "2";

/* header part */

d = document;

/* Display image and/or email address whether position contains value */
/* display image, email link, align */
/* ('image','prefix','left|right') */
/* display email address link */
/* ('prefix') */

function display(image,email,position){
parts = 'praxis' + 'weller'; /* bot safe address display */

if (position == null){
email = image;
}

hspace = '0';
if(position=='right'){ hspace = '5' }

if (position != null){

d.write('<a href="mailto:'+email+'@'+parts+'.de">');
d.write('<img src="images/'+image+'" width="75" height="100" align="'+position+'" border="1" hspace='+hspace+'>');
d.write('</a>');

if(position=='left'){
d.write('<img src="images/trans.gif" width="5" height="102" align="left" hspace="0" border="0">');
}

}
else{
complete = email+'@'+parts+'.de';
d.write('<a href="mailto:');
d.write(complete);
d.write('">');
d.write(complete);
d.write('</a>');
}
}
/* end */



///////////////////////////////////


/* check if cookie containing fontSize exist read and define delimators */
if(document.cookie.indexOf("fontSize") != -1){
var cookie_position = document.cookie.indexOf("fontSize=");
var cookie_start = cookie_position + 9;
var cookie_end = document.cookie.indexOf("term");

/* read cookie substring and convert to value by -0 */
default_body_font_size = document.cookie.substring(cookie_start,cookie_end) -0;

}
else{
default_body_font_size = 90;
}

function set_font_size(){

default_body_font_size = document.fontForm.fontSelection.options[document.fontForm.fontSelection.selectedIndex].value

var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() +1);
document.cookie = "fontSize="+default_body_font_size+"term; expires="+ nextyear.toGMTString();


document.getElementById("body_table").style.fontSize=default_body_font_size+"%";

}

/////////////////////////////


d.write('<style type="text/css">')
d.write('#body_table {font-family:helvetica;color:#000000;font-size:'+default_body_font_size+'%;}')
d.write('#body_table H2 {font-size:140%;letter-spacing:+2px}')
d.write('.caption {font-size:80%;color:#666666;text-align:center;}') /* image captions */
d.write('a:link {color: '+link_colour+'; text-decoration: none; }')
//d.write('a:active {color: '+active_link+'; text-decoration: none; }')
d.write('a:visited {color: '+link_colour+'; text-decoration: none;}')
d.write('a:hover {color: '+hover_links+'; text-decoration: none;}')
d.write('#left_menu a {display: block;}')
d.write('.infobox {border: 1px dotted #bec2bf;background:#f5f5f5;}')
d.write('#header_bgcolor") {font-weight: bold;}')
d.write('</style>')
d.write('<link rel="icon" href="images/icon.png" type="image/png">')
d.write('</head>')
d.write('<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#ffffff">')
d.write('<table width="100%" cellpadding="0" cellspacing="0" border="0">')
d.write('<tr bgcolor="'+top_header_bgcolor+'" id="top_header_bgcolor">')
d.write('<td align="left" style="background-image:url('+header_background_image+')" id="sky">')

d.write('<table width="100%" align="left" height="59" cellpadding="0" cellspacing="0" border="0"><tr><td width="65">')
d.write('<img src="'+tooth+'" align="left" valign="middle" name="tooth" hspace="10" border="0"></td><td>')
d.write('<img src="'+logo+'" width="235" height="19" vspace="3" name="logo" border="0"><br>')
d.write('<font size="2" face="helvetica" style="letter-spacing:0.5px" color="'+slogan_font_color+'" id="slogan_font_color">'+slogan+'<font>')
d.write('</td><td align="right" valign="bottom">')
//d.write('+ - C')

d.write('<table cellpadding="2" cellspacing="0" border="0"><tr><td>')

/*
d.write('<form style="margin-bottom:0px;">')

if (default_theme=='yellow'){
d.write('<select onchange="toggle_theme();" id="switch2" style="background-color:'+header_bgcolor+'">')
d.write('<option>yellow')
d.write('<option>blue')
}

else{
d.write('<select onchange="toggle_theme();" id="switch2" style="background-color:'+header_bgcolor+'">')
d.write('<option>blue')
d.write('<option>yellow')
}
d.write('</select>')
d.write('</form>')
*/

d.write('</td><td>')

function check_font_size(fontsize){
if (default_body_font_size==fontsize)
return ["selected"]
}

/*d.write('<form name="fontForm" style="margin-bottom:0px;">')
d.write('<select onchange="set_font_size();" name="fontSelection" id="switch3" style="background-color:'+header_bgcolor+'">')
d.write('<option value="50" '+check_font_size('50')+'>small text')
d.write('<option value="90" '+check_font_size('90')+'>normal text')
d.write('<option value="150" '+check_font_size('150')+'>large text')
d.write('<option value="200" '+check_font_size('200')+'>XXL text')
d.write('</select>')
//d.write('<input type="button" value="display" onclick="alert(default_body_font_size)">')
d.write('</form>')
*/
d.write('</td></tr></table>')
d.write('')
d.write('')
d.write('')
d.write('')
d.write('')

/*
d.write('<a href="javascript:void(0);" onmouseover="toggle_hoover();" onmouseout="toggle_off();" onclick="toggle_theme();"><img src="images/trans.gif" width="7" height="7" id="switch2" border="1"></a>')
d.write('<a href="javascript:void(0)" onclick="set_font_size(\'increase\');" onmouseover="document.increase.src=\'images/increase2.gif\'" onmouseout="document.increase.src=\'images/increase1.gif\'"><img src="images/increase1.gif" width="9" height="9" border="0" hspace="2" name="increase"></a>')
d.write('<a href="javascript:void(0)" onclick="set_font_size(\'decrease\');" onmouseover="document.decrease.src=\'images/decrease2.gif\'" onmouseout="document.decrease.src=\'images/decrease1.gif\'"><img src="images/decrease1.gif" width="9" height="9" border="0" name="decrease"></a><img src="images/trans.gif" width="2" height="1" border="0"><br>')
*/
d.write('<img src="images/trans.gif" width="1" height="2" border="0"></td></tr></table>')


d.write('</td></tr>')
d.write('<tr><td colspan="2" bgcolor="'+highlight1+'" id="highlight1"><img src="images/trans.gif" width="1" height="1" border="0"></td></tr>')
d.write('<tr><td colspan="2" bgcolor="'+highlight2+'" id="highlight2"><img src="images/trans.gif" width="1" height="1" border="0"></td></tr>')
d.write('<tr><td align="right" bgcolor="'+header_bgcolor+'" colspan="2" id="header_bgcolor"><img src="images/trans.gif" width="1" height="2" border="0"><br>')
d.write('<font face="'+menu_font_face+'" size="'+menu_font_size+'" color="'+active_header+'" style=\"font-weight:bold\">')

f = window.location.href;
file = f.substring (f.lastIndexOf('/') +1);

var headerURLs = new Array

("index.html",
 "news.html",
 "links.html",
 "map.html",
 "history.html",
 "beaches.html",
// "travel.html",
 "vote.shtml",
 "people.html");
 
var headerNames = new Array

("Home",
 "News",
 "Links",
 "Map",
 "History",
 "Beaches",
// "Travel",
 "Vote",
 "People");

for(var i = 0; i <headerURLs.length; i++)

if(f.indexOf(headerURLs[i]) != -1){
d.write(" &nbsp; <nobr><span style=\"vertical-align: +0.2ex;\"> »</span> "+headerNames[i]+"</nobr> ");
}
else{
d.write(" &nbsp; <nobr><span style=\"vertical-align: +0.2ex;\"> »</span> <a href="+headerURLs[i]+" class=\"link\">"+headerNames[i]+"</a></nobr> ")

}
d.write('<img src="images/trans.gif" width="1" height="1" border="0" hspace="10"><br><img src="images/trans.gif" width="1" height="2" border="0"><br></font></td></tr>')
d.write('<tr><td colspan="2" bgcolor="'+shadow1+'" id="shadow1"><img src="images/trans.gif" width="1" height="1" border="0"></td></tr>')
d.write('<tr><td colspan="2" bgcolor="'+shadow2+'" id="shadow2"><img src="images/trans.gif" width="1" height="1" border="0"></td></tr>')
d.write('</table>')

/*---------------------------------*/


/* left menu */

var menuURLs = new Array

("diego_garcia.html", 
 "peros_banhos.html",
 "salomon_islands.html",
 "eagle_islands.html",
 "egmont_islands.html",
 "three_brothers.html", 
 "nelsons_island.html",
 "danger_island.html");

var menuNames = new Array

("Diego Garcia", 
 "Peros Banhos",
 "Salomon Islands",
 "Eagle Islands",
 "Egmont Islands",
 "Three Brothers", 
 "Nelsons Island",
 "Danger Island");

/* open enclosing table */
d.write('<table cellpadding="0" cellspacing="0" align="left" border="0"><tr><td colspan="2">')
d.write('<img src="images/trans.gif" width="1" height="20" border="0">')
d.write('</td></tr><tr><td><img src="images/trans.gif" width="10" height="1" border="0"></td><td>')
/* open 1st table to hold both boxes */

d.write('<table cellpadding="0" cellspacing="0" border="0"><tr>')
d.write('<td bgcolor="'+top_bar_bgcolor+'" align="left" valign="top" id="top_bar_bgcolor1">')
d.write('<img src="'+top_left_corner+'" width="8" height="8" name="top_left_corner" border="0"></td>')
d.write('<td bgcolor="'+top_bar_bgcolor+'" align="center" id="top_bar_bgcolor2">')
d.write('<font color="'+top_bar_font_color+'" face="helvetica" size="1" id="top_bar_font_color"><div style="margin-bottom:3px;margin-top:3px;"><b>The Islands</b></span></font></td>')
d.write('<td bgcolor="'+top_bar_bgcolor+'" align="right" valign="top" id="top_bar_bgcolor3">')
d.write('<img src="'+top_right_corner+'" width="8" height="8" name="top_right_corner" border="0"></td></tr>')

d.write('<tr><td colspan="3" bgcolor="'+table_border_color1+'" id="table_border_color1">')

/* open 2nd table w/subjects inside */
d.write('<table id="left_menu" width="100%" cellpadding="3" cellspacing="1" border="0">')


for(var i = 0; i <menuURLs.length; i++)
if(f.indexOf(menuURLs[i]) != -1){
d.write('<tr><td align="center" bgcolor="'+active_arrow_bgcolor+'" id="active_arrow_bgcolor">');
d.write('<font face="'+menu_font_face+'" size="'+menu_font_size+'" color="'+active_arrow+'" id="active_arrow" style="font-weight:bold;">»</font></td>');
d.write('<td bgcolor="'+active_bgcolor+'" id="active_bgcolor">');
d.write('<font face="'+menu_font_face+'" size="'+menu_font_size+'" color="'+active_menu+'" id="active_menu" style="font-weight:bold;"><nobr>'+menuNames[i]+' </nobr></font></td></tr>');
}

else{
d.write('<tr><td align="center" bgcolor="'+inactive_arrow_bgcolor+'" class="inactive_arrow_bgcolor">')
d.write('<font face="'+menu_font_face+'" size="'+menu_font_size+'" color="'+inactive_arrow+'" class="inactive_arrow" style="font-weight:bold;">»</font></td>')
d.write('<td bgcolor="'+inactive_bgcolor+'" class="inactive_bgcolor">')
d.write('<font face="'+menu_font_face+'" size="'+menu_font_size+'" style="font-weight:bold;">')
d.write('<a href='+menuURLs[i]+' class="link"><nobr>'+menuNames[i]+' </nobr></a></font></td></tr>')
}

d.write('</table>')
/* close 2nd table w/subjects */

d.write('</td></tr>')
d.write('<tr><td colspan="3"><img src="images/trans.gif" width="1" height="15" border="0"></td></tr>')
d.write('<tr><td colspan="3" bgcolor="'+table_border_color2+'" id="table_border_color2">')


/* open 3rd table w/address */
d.write('<table width="100%" cellpadding="5" cellspacing="1" border="0">')
d.write('<tr><td bgcolor="'+bottom_left_table_color+'" id="bottom_left_table_color">')
d.write('<font size="2" face="helvetica" color="'+bottom_left_text_color+'" id="bottom_left_text_color">')
//d.write('<span style="letter-spacing:1.5px">Chagos Islands</span><br>')
d.write('<img src="images/worldmap.gif" width="75" height="36" border="1" style="margin-bottom:2px"><br>')
d.write('Latitude 7°<br>')
d.write('Longitude 72°<br>')

//d.write('Chagos<br><img src="images/trans.gif" width="1" height="3" border="0"><br>')
//d.write('<a href="mailto:webmaster@chagosislands.com" class="link">info@chagosislands.com</a><br><img src="images/trans.gif" width="1" height="3" border="0"><br>')
//d.write('Tel. <br>')
//d.write('Fax N/A<br><img src="images/trans.gif" width="1" height="3" border="0"><br>')

/*
if(file == 'impressum.html'){
d.write('<font color="#993300">Imprint</font>')
}
else{
d.write('<a href="impressum.html" class="link">Imprint</a>')

}

d.write('<br><img src="images/trans.gif" width="1" height="8" border="0"><br>')


*/
d.write('<font color="'+last_sentence+'" id="last_sentence"></font>')

d.write('</font></td></tr></table>')

/* close 3rd table w/address */

d.write('</td></tr>')
d.write('</table>')
d.write('<img src="images/trans.gif" width="1" height="5" border="0">')
/* close 1st table holding boxes */

d.write('</td></tr>')
d.write('</table>')
/* close enclosing table */

d.write('<table width="70%" align="left" cellpadding="0" cellspacing="0" id="body_table" border="0">')
d.write('<tr><td colspan="2"><img src="images/trans.gif" width="1" height="20" border="0"></td></tr>')
d.write('<tr><td><img src="images/trans.gif" width="20" height="1" border="0"></td><td>')


