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

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_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 page in the web site environment and call the relevant menus */
function set_menu()
	{
	  var tim1 = setTimeout("view('m-call','hidden')",1000);
	  var tim2 = setTimeout("call_m()",6000);
	  var tim3 = setTimeout("call_sm()",12000);
	}
function set_menu1()
	{
	  var tim1 = setTimeout("view('m-call','hidden')",1000);
	  var tim2 = setTimeout("call_m()",6000);
	  var tim3 = setTimeout("call_sm1()",12000);
	}
function set_menu2()
	{
	  var tim1 = setTimeout("view('m-call','hidden')",1000);
	  var tim2 = setTimeout("call_m()",6000);
	  var tim3 = setTimeout("call_sm2()",12000);
	}
/* 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>");
		  }
}
/* Change style sheet according to browser name for photo sizing in iframe */
function pic_style()
	{
	  var cl = navigator.appName;
	  if ((cl == 'Microsoft Internet Explorer') || (cl == 'Opera'))
	    {
		document.writeln("<style type='text/css'>@import 'css/photostyle_ie.css';</style>");
	    }
	}
