var win = 0;
var today = new Date();
document.cookie = 'slibguestbook' + "=" + escape('set');

FixCookieDate(today);

function cc()
{
	if (document.cookie == "") 
	{
		alert("To use this site your web browser must have \'cookies\' enabled!");
//		document.form1.cke.value ="false";
	}
	else
	{
//		document.form1.cke.value ="true";
	}
}


function maps(pc,lat,long,hint)
{
if (pc)
{
	url = "http://www.multimap.com/map/browse.cgi?client=public&&pc=" + pc;
}
else
{
	if (hint)
	{
 		alert('HINT!\nWhen the map loads, change the scale to 1:4000 to see the relevant detail.');
	}
	url = "http://www.magic.gov.uk/website/magic/viewer.htm?startTopic=maggb&latlongref=" + lat + "%2C" + long;
}
var width = parseInt( screen.width * 0.9 );
var height = parseInt( screen.height * 0.6 );
var left = parseInt( ( screen.width - width ) /2 );
if (win){win.close();}win=window.open(url,"Map","toolbar=1,menubar=0,location=0,status=1,scrollbars=1,resizable=1,height=" + height + ",width=" + width + ",left=" + left + ",top=0");
}

function c(url)
{
root = "http://www.currency-convertor.com/cgi-bin/c?a=" + url + "&l=44&x=UKA01029";
if (win){win.close();}win=window.open(root,"Currency","toolbar=0,menubar=0,scrollbars=0,resizable=0,width=588,height=252");
}

function bookmark(url,name)
{
if (document.all)
{window.external.AddFavorite(url,name);}
}

function contact(page,user)
{
mail_str = "mailto:" + user;
mail_str = mail_str + "@stencil-library.com";
mail_str = mail_str + "&subject=Enquiry";
if (page){mail_str = mail_str + "%20from%20" + page;}
mail_str = mail_str + "&body=";
var width = parseInt(screen.width * 0.9);
var height = parseInt(screen.height * 0.6 );
var left = parseInt((screen.width - width) /2 );
if (win){win.close();}
win=window.open(mail_str,"Mail","toolbar=1,menubar=0,location=0,status=1,scrollbars=1,resizable=1,height=" + height + ",width=" + width + ",left=" + left + ",top=0");
}

function FixCookieDate(date)
{
var base = new Date(0);
var skew = base.getTime();	 				// dawn of (Unix) time - should be 0 
if (skew > 0)							// Except on the Mac - ahead of its time 
{date.setTime(date.getTime() - skew)};
}

//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
//	function SetCookie (name,value,expires,path,domain,secure) {
//	  document.cookie = name + "=" + escape (value) +
//    ((expires) ? "; expires=" + expires.toGMTString() : "") +
//    ((path) ? "; path=" + path : "") +
//    ((domain) ? "; domain=" + domain : "") +
//    ((secure) ? "; secure" : "");
// }

function setcookie(session)
{
var time = today.valueOf();					// elapsed milliseconds since 01 Jan 1970
var data = 'SB' + time + form1.id.value + session; 
document.cookie = "sbadmin=" + data + ";path=/";
return true;
}

function GetCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break; 
}
return null;
}

function DeleteCookie (name,path,domain)
{
if (GetCookie(name))
{
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
