// Sets text cookie value to "text" if user switches to text mode. Sources for code http://www.javascriptguide.com/cookies.html http://www.netkontoret.dk/jscookies.htm and http://www.angelfire.com/yt/jmyers/get/js/cookies.htm

//suppress error messages
function stopError() {
  return true;
}
window.onerror = stopError;


function setCookie(Name,Value,Expiry,Path,Domain,Secure) 
{
if (Expiry != null && !isNaN(Expiry)) 
{
var datenow = new Date();
datenow.setTime(datenow.getTime() + Math.round(86400000*Expiry));
Expiry = datenow.toGMTString();
}

Expiry = (Expiry) ? '; expires='+Expiry : '';
Path = (Path)?'; path='+Path:'';
Domain = (Domain) ? '; domain='+Domain : '';
Secure = (Secure) ? '; secure' : '';
document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;
}

    function getCookie(Name,Value,Expiry,Path,Domain,Secure) 
    {
        var search = name + "="
        if (document.cookie.length > 0) { 
            // if there are any cookies
            offset = document.cookie.indexOf(search)
            if (offset != -1) { 
                // if cookie exists
                offset += search.length

                // set index of beginning of value
                end = document.cookie.indexOf(";", offset)

                // set index of end of cookie value
                if (end == -1)
                    end = document.cookie.length

                return unescape(document.cookie.substring(offset, end))
            }
        }
    }

function eraseCookie(Name,Value,Expiry,Path,Domain,Secure) 
{

// The function checks if the cookie is set.
// If so the expiredate is set to Jan. 1st 1970.

  if (getCookie(Name)) 
{
  setCookie("visitor", "text", -1, '/', 'rangifer.net')
}
}

function setTextreload(Name,Value,Expiry,Path,Domain,Secure)
{
setCookie("visitor", "text", 1, '/', 'rangifer.net');
window.location.reload();
}

function eraseTextreload(Name,Value,Expiry,Path,Domain,Secure)
{
eraseCookie("visitor", "text", 1, '/', 'rangifer.net');
window.location.reload();
}

function Start(page) { 

	OpenWin = this.open(page, "CtrlWindow", "width=600,height=570,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes"); 
}

<!-- Begin implementation -->

//document.write("cookie value is" +getCookie('visitor'));
getCookie('visitor')

//check for the value of cookie
if (getCookie('visitor')=='text')
{
var ID=getCookie('visitor')
}

else
{
<!-- Check if the search string is set to text. If so, the cookie is set to "text". This piece not implemented, but can be implemented in the site by simple ?=text after any file.  Source for code is http://www.htmlgoodies.com/beyond/jspass.html --> 

document.write('<FORM NAME="joe"><INPUT TYPE="hidden" NAME="burns"></FORM>')

var locate = window.location;
document.joe.burns.value = locate;
var text = document.joe.burns.value;

function delineate(str)
{
point = str.lastIndexOf("=");
return(str.substring(point+1,str.length));
}

var ID=delineate(text);

//document.write("ID is " +ID);

if (ID=='text')
{
function saveVisitor()
    {
      //  var visitorName = ID;
        setCookie("visitor", "text", 1, '/', 'rangifer.net');
    }
saveVisitor()
}
}

<!-- Header here including stylesheet selection. Stylesheet noimg.css turns off all images on a page -->
function writeHeader()
{
if (ID=='text') 
{
document.write('<META http-equiv="content-type" content="text/html; charset=windows-1251"><link rel="stylesheet" href="http://www.rangifer.net/rangifer/noimg.css"><table border="0" cellspacing="2" cellpadding="0" align="center"><tr><td width="79" class="rangifer-title2"><div align="center"><a href="http://www.rangifer.net/rangifer/index_text.cfm" target=_top>Home</a></div></td><td width="79" class="rangifer-title2"><div align="center"><a href="http://www.rangifer.net/rangifer/about.cfm" target=_top>About</a></div></td><td width="79" class="rangifer-title2"><div align="center"><a href="http://www.rangifer.net/rangifer/new.cfm" target=_top>New</a></div></td><td width="79" class="rangifer-title2"><div align="center"><a href="http://www.rangifer.net/rangifer/contact.cfm" target=_top>Contact</a></div></td><td width="79" class="rangifer-title2"><div align="center"><a href="http://www.rangifer.net/rangifer/search.cfm" target=_top>Search</a></div></td><td rowspan="2" width="71" valign="top"><div align="center"><b></b></div></td><td rowspan="2" width="269" valign="top"><div align="right"><font face="Times New Roman, Times, serif" size="+1" color="#000066">Human Role in <br>Reindeer / Caribou Systems</font><br><span class="location"><a href="http://www.rangifer.net/rangifer/sitemap.cfm" target=_top>Site map</a></span><span class="location"> | <a href="javascript:eraseTextreload()">Full graphics</a> | <a href="http://www.rangifer.net/rangifer/index_rus.html">По-русски</a></span></div></td></tr><tr><td width="396" colspan="5" valign="top"></td></tr></table>')
}

else 
{
document.write('<META http-equiv="content-type" content="text/html; charset=windows-1251"><link rel="stylesheet" href="http://www.rangifer.net/rangifer/text.css"><SCRIPT LANGUAGE ="JavaScript" src="http://www.rangifer.net/rangifer/javahead.js"></SCRIPT><TABLE BORDER=0 align="center"><TR><TD WIDTH=396><IMG USEMAP="#map1" SRC="http://www.rangifer.net/rangifer/images/navbar.gif" WIDTH=384 HEIGHT=20 X-SAS-UseImageWidth X-SAS-UseImageHeight BORDER=0 ALIGN=bottom></TD><TD ROWSPAN=2 WIDTH=64><IMG SRC="http://www.rangifer.net/rangifer/images/deer.gif" WIDTH=64 HEIGHT=40 X-SAS-UseImageWidth X-SAS-UseImageHeight ALIGN=bottom></TD><TD ROWSPAN=2 WIDTH=258><div align="right"><IMG SRC="http://www.rangifer.net/rangifer/images/title.gif" WIDTH=258 HEIGHT=40 X-SAS-UseImageWidth X-SAS-UseImageHeight ALIGN=bottom><br><span class="location"><a href="http://www.rangifer.net/rangifer/sitemap.cfm"  target=_top>Site map</a></span><span class="location">  | <a href="javascript:setTextreload()">Text only</a> | <a href="http://www.rangifer.net/rangifer/index_rus.html">По-русски</a> <a href="http://www.rangifer.net/rangifer/index_rus.html"><img src="http://www.rangifer.net/rangifer/images/flag_rus.gif" align="absmiddle" border="0"></a></span></div></TD></TR><TR> <TD WIDTH=396> <IMG SRC="http://www.rangifer.net/rangifer/images/blank.gif" WIDTH=384 HEIGHT=20 X-SAS-UseImageWidth X-SAS-UseImageHeight ALIGN=bottom name="text"></TD></TR></TABLE>')
}
}

<!-- Footer here -->
function writeFooter()
{
if (ID=='text') 
{
document.write('<table align="center" border=0 width="718" cellpadding="0" cellspacing="3" bordercolor="#990099"><tr><td colspan="3"><hr color="#9999cc" noshade size="1"></td></tr><tr><td width=65><div align="center"><a href="http://mercury.bio.uaf.edu/iab/" target="_blank"><span class="location">Institute of Arctic Biology</span></a></div></td><td valign="top"><table border=0 align="center" cellspacing="0" cellpadding="0"><tr valign="top"><td><div align="center"><a href="http://www.rangifer.net/rangifer/resplan/" target="_top"><span class="navbottom">Research planning</span></a><span class="navbottom"> | <a href="http://www.rangifer.net/rangifer/resprojects/" target="_top">Research projects</a> | <a href="http://www.rangifer.net/rangifer/herds/" target="_top">Profile of herds</a> | <a href="http://www.carmanetwork.com/" target="_top">CARMA monitoring program</a> | <a href="http://www.rangifer.net/rangifer/people/" target="_top">People in Human-Rangifer systems</a> | <a href="http://www.rangifer.net/rangifer/resresources/" target="_top">Rangifer resources</a> | <a href="http://www.rangifer.net/rangifer/news/" target="_top">Current events and news</a> | <a href="http://www.rangifer.net/rangifer/discuss.cfm" target="_top">Join the discussion</a> </span></div></td></tr><tr valign="top"><td><div align="center"><a href="http://www.rangifer.net/rangifer/index_text.cfm" target="_top"><span class="navbottom">Home</span></a><span class="navbottom"> | <a href="http://www.rangifer.net/rangifer/about.cfm" target="_top">About</a> | <a href="http://www.rangifer.net/rangifer/new.cfm" target="_top">New</a> | <a href="http://www.rangifer.net/rangifer/contact.cfm" target="_top">Contact</a> | <a href="http://www.rangifer.net/rangifer/search.cfm" target="_top">Search</a> | <a href="mailto:rangifer@dartmouth.edu">Webmaster</a>&nbsp;|&nbsp;<a href="http://mercury.bio.uaf.edu/iab/" target="_blank">Institute of Arctic Biology</a>&nbsp;|&nbsp;<a href="http://www.uaf.edu/" target="_blank">University of Alaska Fairbanks</a></span></div></td></tr><tr valign="top"><td><div align="center"><span class="copyright">Last Update: November 2003</span></div></td></tr> <tr valign="top"><td><div align="center" class="copyright">&copy; 1999-2003 University of Alaska Fairbanks &amp; Institute of Arctic Biology</div></td></tr></table></td><td width=65><div align="center"><a href="http://www.uaf.edu/" target="_blank"><span class="location">University of Alaska Fairbanks</span></a></div></td></tr></table>')
}

else
{
document.write('<table align="center" border=0 width="718" cellpadding="0" cellspacing="3" bordercolor="#990099"><tr> <td colspan="3"><hr color="#9999cc" noshade size="1"></td></tr><tr><td width=65><a href="http://mercury.bio.uaf.edu/iab/" target="_blank"><img src="http://www.rangifer.net/rangifer/images/iab_logo.gif" alt="Institute of Arctic Biology - University of Alaska Fairbanks" width="88" height="88" border=0 align=middle></a></td><td valign="top"><table border=0 align="center" cellspacing="0" cellpadding="0"><tr valign="top"><td><div align="center"><a href="http://www.rangifer.net/rangifer/resplan/" target="_top"><span class="navbottom">Research planning</span></a><span class="navbottom"> | <a href="http://www.rangifer.net/rangifer/resprojects/" target="_top">Research projects</a> | <a href="http://www.rangifer.net/rangifer/herds/" target="_top">Profile of herds</a> | <a href="http://www.carmanetwork.com/" target="_top">CARMA monitoring program</a> | <a href="http://www.rangifer.net/rangifer/people/" target="_top">People in Human-Rangifer systems</a> | <a href="http://www.rangifer.net/rangifer/resresources/" target="_top">Rangifer resources</a> | <a href="http://www.rangifer.net/rangifer/news/" target="_top">Current events and news</a> | <a href="http://www.rangifer.net/rangifer/discuss.cfm" target="_top">Join the discussion</a> </span></div></td></tr><tr valign="top"><td><div align="center"><a href="http://www.rangifer.net/rangifer/" target="_top"><span class="navbottom">Home</span></a><span class="navbottom"> | <a href="http://www.rangifer.net/rangifer/about.cfm" target="_top">About</a> | <a href="http://www.rangifer.net/rangifer/new.cfm" target="_top">New</a> | <a href="http://www.rangifer.net/rangifer/contact.cfm" target="_top">Contact</a> | <a href="http://www.rangifer.net/rangifer/search.cfm" target="_top">Search</a> | <a href="mailto:rangifer@dartmouth.edu">Webmaster</a>&nbsp;|&nbsp;<a href="http://mercury.bio.uaf.edu/iab/" target="_blank">Institute of Arctic Biology</a>&nbsp;|&nbsp;<a href="http://www.uaf.edu/" target="_blank">University of Alaska Fairbanks</a></span></div></td></tr><tr valign="top"><td><div align="center"><span class="copyright">Last Update: November 2003</span></div></td></tr><tr valign="top"><td><div align="center" class="copyright">&copy; 1999-2003 University of Alaska Fairbanks &amp; Institute of Arctic Biology</div></td> </tr></table></td><td width=65><a href="http://www.uaf.edu/" target="_blank"><img src="http://www.rangifer.net/rangifer/images/uaf_logo.gif" alt="University of Alaska Fairbanks" width="88" height="88" border=0 align=middle></a></td></tr></table>')
}
}
