function setcookie(cookiename,content)
    {
    var cookdate = new Date();
    cookdate.setTime(cookdate.getTime() + 1000*60*60*1);
    document.cookie = cookiename + "=" + content + "; expires=" + cookdate.toGMTString() + "; path=/";
    }

function get_cookie(cookiename,id)
    {
    var cookiestring = new String(document.cookie);
    var startpos = cookiestring.indexOf(cookiename);
    var endpos = cookiestring.indexOf(";", startpos);
    var nodeObj = document.getElementById(id);
    if (startpos != -1)
    {
      if (endpos != -1)
      {
        nodeObj.value = cookiestring.substring(startpos + cookiename.length, endpos);
      } else {
        nodeObj.value = cookiestring.substring(startpos + cookiename.length);
      }
    }
    else
    {
      nodeObj.value = 'Cookie not found';
    }
    }

function del_cookie(cookiename)
    {
    var cookiestring = new String(document.cookie);
    var startpos = cookiestring.indexOf(cookiename);
    if (startpos != -1)
    {
      document.cookie =  cookiename + "=0" + "; expires=Mon,20-Jan-03 00:00:01GMT;";
    }
    }

function chk_cookie() {
	if (document.cookie != "")
	  {
	    location.href = "index.html";
	  }
else
{
		alert ("Please set your browser to allow cookies for this site.\nYou will enjoy your visit more.\nWithout cookies site navigation is minimal.\nPlease reload the page once you\'ve enabled cookies.");
		}
	}

function chk_mem_cookie() {
	if (document.cookie != "")
	  {
	    location.href = "../index.html";
	  }
else
{
		alert ("You have cookies disabled.\nYou can only enter via the member\'s entrance\nif your browser is set to allow cookies for this site.\nPlease enable cookies for this site.\nThen reload the page once you\'ve done so.");
		}
	}

function chk_ph_cook() 
{
	if (document.cookie == "")
	  {
	    alert ("Viewing the photos in large format is only possible if cookies are enabled.\nPlease set your browser to allow cookies for this site\nand afterwards try again.");
	  }
}

function loadIframe(theURL)
	{
	  document.getElementById('content-frm').src = theURL;
	}
function fetch_page()
{
    var cookiestring = new String(document.cookie);
    var startpos = cookiestring.indexOf('load_me');
    var endpos = cookiestring.indexOf(";", startpos);
		  if (startpos != -1)
		  {
		    if (endpos == -1) endpos = cookiestring.length;
		    var loadmevalue = cookiestring.substring(startpos+8, endpos);
		    loadIframe(loadmevalue);
		    del_cookie('load_me');
		  }
}
//***** Set cookie to match the display size.

function cook_match()
	{
	  var w = get_width();
	  var cookiename = 'size_me';
	  if ((w >= 1014))
	    {
		setcookie(cookiename,'normal');
	    }
	  else if ((w >= 800) && (w < 1014))
	    {
		setcookie(cookiename,'small');
	    }
	  else if ((w >= 640) && (w < 800))
	    {
		setcookie(cookiename,'smaller');
	    }
	  else if ((w < 640 ))
	    {
		setcookie(cookiename,'tiny');
	    }
	}

/* Get the style sheet to match the visitor's browser resolution and screen size */
function fetch_style()
{
    var cookiestring = new String(document.cookie);
    var startpos = cookiestring.indexOf('size_me');
    var endpos = cookiestring.indexOf(";", startpos);
		  if (startpos != -1)
		  {
		    if (endpos == -1) endpos = cookiestring.length;
		    var loadmevalue = cookiestring.substring(startpos+8, endpos);
		    document.writeln("<style type='text/css'>@import 'css/" + loadmevalue + ".css';</style>");
		  }
}
/* Provide member access to input boxes */
function member_login(id)
{
    var cookiestring = new String(document.cookie);
    var startpos = cookiestring.indexOf('allow_me');
		  if (startpos != -1)
		  {
		    var nodeObj = document.getElementById(id);
		    nodeObj.style.display = 'block';
		  }
}
/* Change style sheet according to browser name for photo sizing in iframe */
function pic_style()
	{
	  var cl = navigator.appName;
	  if ((cl == 'Microsoft Internet Explorer'))
	    {
		document.writeln("<style type='text/css'>@import 'css/photostyle_ie.css';</style>");
	    }
	}

