function setCookie(name, value, expires, path, domain, secure)
{
	document.cookie = name + "=" + value + "; path=/";
}
function getCookie(name)
{
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1)
		return null;
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length;
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

var sLocation = document.location.href;
sLocation = sLocation.toLowerCase();
var tmpVar = 1;
var bPromoInput = true;

if(sLocation.indexOf("id=r3vpzgfuy2vszxnvdxjjzxmgt25saw5l&cid=z3jjmnproa")>0)
{
	document.cookie = "sPromoCode=" +escape("GRO_LINK") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=r3vpzgfuy2vszxnvdxjjzxmgt25saw5l&cid=z3jjmnproa"));
	bPromoInput = false;
}
else if(sLocation.indexOf("id=q29tuhn5y2g=&cid=y3ayejnncg==")>0)
{
	document.cookie = "sPromoCode=" +escape("GRO_LINK") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=q29tuhn5y2g=&cid=y3ayejnncg=="));
	bPromoInput = false;
}
else if(sLocation.indexOf("id=sg91z2h0b24gtwlmzmxpbibdb21wyw55&cid=qlu0ndmztq==")>0)
{
	document.cookie = "sPromoCode=" +escape("BU4433M") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=sg91z2h0b24gtwlmzmxpbibdb21wyw55&cid=qlu0ndmztq=="));
	bPromoInput = false;
}
else if(sLocation.indexOf("id=txkgr3vpzgfuy2vszxnvdxjjzxm=&cid=tudsmzex")>0)
{
	document.cookie = "sPromoCode=" +escape("MGR311") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=txkgr3vpzgfuy2vszxnvdxjjzxm=&cid=tudsmzex"));
	bPromoInput = false;
}
else if(sLocation.indexOf("id=u3vuiexpzmugrmluyw5jawfs&cid=wkizmdqyuq==")>0)
{
	document.cookie = "sPromoCode=" +escape("ZB3042Q") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=u3vuiexpzmugrmluyw5jawfs&cid=wkizmdqyuq"));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=VGFyZ2V0IENvcnBvcmF0aW9u&cid=bGlmZXJlc291cmNlcw==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("liferesources") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=VGFyZ2V0IENvcnBvcmF0aW9u&cid=bGlmZXJlc291cmNlcw=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=T21uaWNvbSBHcm91cA==&cid=TUg1NDcyRg==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("MH5472F") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=T21uaWNvbSBHcm91cA==&cid=TUg1NDcyRg=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=RmluYW5jaWFsIEluc2lkZXIgTmV0d29yaw==&cid=bGVnYWw=").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("legal") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=RmluYW5jaWFsIEluc2lkZXIgTmV0d29yaw==&cid=bGVnYWw="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=Q0RXIENvbXB1dGVyIENlbnRlcnM=&cid=Y2R3NzI1").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("cdw725") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=Q0RXIENvbXB1dGVyIENlbnRlcnM=&cid=Y2R3NzI1"));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=Qmxvb2QgU3lzdGVtcw==&cid=RUFQNEJTSQ==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("EAP4BSI") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=Qmxvb2QgU3lzdGVtcw==&cid=RUFQNEJTSQ=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=Qmxvb2QgQ2VudGVycyBvZiB0aGUgUGFjaWZpYw==&cid=RUFQNEJDUA==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("EAP4BCP") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=Qmxvb2QgQ2VudGVycyBvZiB0aGUgUGFjaWZpYw==&cid=RUFQNEJDUA=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=Rm9zdGVyJ3MgV2luZSBFc3RhdGVz&cid=SVc5NTk5RA==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("IW9599D") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=Rm9zdGVyJ3MgV2luZSBFc3RhdGVz&cid=SVc5NTk5RA=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=U3VuIExpZmUgRmluYW5jaWFs&cid=WkIzMDQyUQ==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("upmk0522") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=U3VuIExpZmUgRmluYW5jaWFs&cid=WkIzMDQyUQ=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=TUVEUkFE&cid=TUVEUkFE").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("MEDRAD") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=TUVEUkFE&cid=TUVEUkFE"));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=TUdJUyBDb21wYW5pZXM=&cid=SFY3Mjc1Sg==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("HV7275J") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=TUdJUyBDb21wYW5pZXM=&cid=SFY3Mjc1Sg=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=TWFzcyBNdXR1YWwgTG9uZyBUZXJtIERpc2FiaWxpdHk=&cid=NE1BU1NMVEM=").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("4MASSLTC") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=TWFzcyBNdXR1YWwgTG9uZyBUZXJtIERpc2FiaWxpdHk=&cid=NE1BU1NMVEM="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=VVNBYmxlIExpZmU=&cid=dXNhbDkwMw==").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("USAL903") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id=VVNBYmxlIExpZmU=&cid=dXNhbDkwMw=="));
	bPromoInput = false;
}
else if(sLocation.indexOf(("id=").toLowerCase())>0 && sLocation.indexOf(("cid=").toLowerCase())>0)
{
	document.cookie = "sPromoCode=" +escape("arbitrary") + "; path=/";
	document.cookie = "bPromoAdd=" + escape("yes") + "; path=/";
	sLocation = sLocation.sub(0, sLocation.indexOf("id="));
	bPromoInput = false;
}

if(getCookie("sPromoCode") == "GRO_LINK" || getCookie("sPromoCode") == "BU4433M" || getCookie("sPromoCode") == "MGR311" || getCookie("sPromoCode") == "ZB3042Q" || getCookie("sPromoCode") == "liferesources" || getCookie("sPromoCode") == "MH5472F" || getCookie("sPromoCode") == "legal" || getCookie("sPromoCode") == "cdw725" || getCookie("sPromoCode") == "arbitrary" || getCookie("sPromoCode") == "IW9599D" || getCookie("sPromoCode") == "EAP4BSI" || getCookie("sPromoCode") == "EAP4BCP" || getCookie("sPromoCode") == "MEDRAD" || getCookie("sPromoCode") == "HV7275J" || getCookie("sPromoCode") == "4MASSLTC" || getCookie("sPromoCode") == "USAL903")
{
	bPromoInput = false;
}


var bHome = false;
var bMain = false;
var bProductDetail = false;
sSearch = window.location.search;
var sLocationSplitter = "/";
var saLocation = sLocation.split("/");

saCheckDirectories = saLocation[1].split("law_library/");
if(saCheckDirectories.length == 2) {
	if(saCheckDirectories[1]=="")
		bHome = true;
}

saCheckDirectories = saLocation[1].split("legalzip/");
if(saCheckDirectories.length == 2) {
	if(saCheckDirectories[1]=="")
		bHome = true;
}
var saCheckDirectories = saLocation[1].split("/");
if(saCheckDirectories.length == 1) {
	bHome = true;
	bMain = true;
}
var saCheckDirectories = saLocation[1].split("pricing/");
if(saCheckDirectories.length != 1) {
	if(saCheckDirectories[1]!="will_pricing.html")
		bProductDetail = true;
}
var saCheckDirectories = saLocation[1].split("legalzip/");
if(saCheckDirectories.length != 1) {
	if(saCheckDirectories[1] != "")
		bProductDetail = true;
}

var saMenuArray = new Array();
saMenuArray[0] = new Array();
saMenuArray[0][0] = "Home";
saMenuArray[0][1] = "/";
saMenuArray[1] = new Array();
saMenuArray[1][0] = "Services";
saMenuArray[1][1] = "/legalzip/";
saMenuArray[2] = new Array();
saMenuArray[2][0] = "Education";
saMenuArray[2][1] = "/law_library/";
saMenuArray[3] = new Array();
saMenuArray[3][0] = "Customer Service";
//saMenuArray[3][1] = sLocationSplitter + "support/";
saMenuArray[3][1] = "/support/";
sMenu = "";
if(getCookie("bLand")=="" || getCookie("bLand")==null)
{
	setCookie("bLand", "yes")
}
else if(getCookie("bLand")=="yes" && sLocation.indexOf("/compsychwills/") != -1) 
{
	bHome = false;
}

//if(bHome) {
//	var iLoopCt = 3
//} else {
	var iLoopCt = saMenuArray.length;
//}

for(iIter = 0; iIter < iLoopCt; iIter++) {
	var bSelected = false;
	var saDirectories = saMenuArray[iIter][1].split(",");
	for(iIter2 = 0; iIter2 < saDirectories.length; iIter2++) {
		if(sLocation.indexOf(saDirectories[iIter2]) != -1) {
			bSelected = true;
		}
	}
	sMenu += '<TD CLASS="MainMenuCell"><A HREF="'+saDirectories[0]+'" CLASS="MainMenuTable"';
	if((bSelected && iIter != 0) || (bMain == true && iIter == 0)) {
		sMenu += ' STYLE="text-decoration:underline;"';
	}
	sMenu += '>'+saMenuArray[iIter][0]+'</A></TD>';
	if(iIter != iLoopCt-1) {
		sMenu += '<TD>|</TD>';
	}
}
document.write('	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="750">');
document.write('	<TR>');
document.write('	<TD COLSPAN=2 CLASS="HeaderCol"><A HREF="/"><IMG SRC="/images/estateguidanceHeader.jpg" BORDER="0"></A></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('	<TD BGCOLOR="#E7EEFF" CLASS="MainMenu" COLSPAN=2>');
document.write('		<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%"><TR><TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 CLASS="MainMenuTable">');
document.write('		<TR>');
document.write(sMenu);
document.write('		</TR>');
document.write('		</TABLE></TD><TD ALIGN=RIGHT><A HREF="javascript:SingIn()"><IMG SRC="/images/MemberSignIn.gif" BORDER=0></A></TD></TR></TABLE>');
document.write('	</TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('	<TD COLSPAN=2><IMG SRC="/images/spacer.gif" BORDER=0 HEIGHT=10 WIDTH=1><img src="/includes/hit_tracking.asp?sReferrer=' + document.referrer + '&sURL=' + document.location + '" width=1 height=1" width=0 height=0 border=0></TD>');
document.write('	</TR>');

function LeftMenu() {
	document.write('	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width="100%" CLASS="LeftMenuTable">');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuTitle"><B>Services</B></TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuItem">');
	document.write('		<A HREF="/legalzip/wills.html" CLASS="LeftMenuLink"><B>Wills</B></A>');
	document.write('	</TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuItem">');
	document.write('		<A HREF="/legalzip/livingwills.html" CLASS="LeftMenuLink"><B>Living Wills</B></A>');
	document.write('	</TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuTitle"><B>Contact Information</B></TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuItem">');
	
	
	if(!bProductDetail || sLocation.indexOf('/lw_') > 0 || sLocation.indexOf('/livingwill'))
		document.write('		EMAIL:<BR><A HREF="mailto:help@estateguidance.com?subject=Customer Inquiry to EstateGuidance.com&body=Thank you for choosing EstateGuidance as a resource for your legal documents.  EstateGuidance is a resource for general information not intended to be legal advice and is not provided in the course of an attorney-client relationship. This information should not be used as a substitute for obtaining legal advice from a local attorney. In the event you would like a referral to a local attorney, please send us a request by e-mail to help@estateguidance.com." CLASS="LeftMenuLink" STYLE="font-size:2.7mm"><B>help@estateguidance.com</B></A>');
	else
		document.write('		EMAIL:<BR><A HREF="mailto:estateguidance@legalzoom.com" CLASS="LeftMenuLink" STYLE="font-size:2.7mm"><B>estateguidance@legalzoom.com</B></A>');	
	document.write('	</TD>');
	document.write('	</TR>');
	document.write('	</TABLE>');
	document.write('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width="100%" CLASS="LeftMenuTable">');
	document.write('	<TR>');
	document.write('	<TD CLASS="LeftMenuTitle"><B>Protected By</B></TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD ALIGN=CENTER><IMG SRC="/images/spacer.gif" WIDTH="1" HEIGHT="10" BORDER="0" ALT=""></TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD ALIGN=CENTER><a href="https://seal.godaddy.com:443/verifySeal?sealID=kXfNPK99D7PhZpA7qQlYHGYcNKyqAcqw7K56plh3pkQJBI7XDhdHTYb0WdJT" target=_new><IMG SRC="/images/imageSecure.gif" BORDER="0" ALT=""></a></TD>');
	document.write('	</TR>');
	document.write('	<TR>');
	document.write('	<TD ALIGN=CENTER><IMG SRC="/images/imageSecure_bbb.gif" BORDER="0" ALT="" USEMAP="#Security"><MAP NAME="Security"><AREA ALT="" SHAPE="circle" COORDS="28,29,27" HREF="javascript:PopOpen(\'http://www.bbbonline.org/cks.asp?id=103080897811941\');"><AREA ALT="" SHAPE="circle" COORDS="90,29,27" HREF="javascript:PopOpen(\'/includes/inc_verisign.asp\')"></MAP></TD>');

	document.write('	</TR>');
	document.write('	</TABLE>');
	
	
}
function PromoCodeInputZone()
{
	if(bPromoInput)
	{
		document.write('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR="#F2F5FB" ALIGN=CENTER>');
		document.write('<TR>');
		document.write('<TD COLSPAN=3><IMG SRC="/images/Box1.gif" BORDER=0></TD>');
		document.write('</TR>');
		document.write('<TR><form name=frmMain>');
		document.write('<TD width=1><IMG SRC="/images/Box2.gif" BORDER=0></TD>');
		document.write('<TD>');
		document.write('	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>');
		document.write('	<TR>');
		document.write('	<TD style="padding-right:10px"><SPAN STYLE="color:#555555; font-family:verdana; font-size:2.8mm; font-weight:bold;">Enter Promotional Code:</SPAN></TD>');
		document.write('	<TD style="padding-right:10px"><INPUT TYPE="TEXT" NAME="sPromocode"SIZE=5 onChange="javascript:checkpromocode(this.value)"></TD>');
		document.write('	<TD><a href="javascript:checkpromocode(document.frmMain.sPromocode.value)"><IMG SRC="/images/submit_code1.gif" BORDER=0></a></TD>');
		document.write('	</TR>');
		document.write('	</TABLE>');
		document.write('</TD>');
		document.write('<TD align=right><IMG SRC="/images/Box3.gif" BORDER=0></TD>');
		document.write('</TR></form>');
		document.write('<TR>');
		document.write('<TD COLSPAN=3><IMG SRC="/images/Box4.gif" BORDER=0></TD>');
		document.write('</TR>');
		document.write('</TABLE>');
	}
}
