ACTLG_HOST_CGI = "http://www.leisuregames.com/cgi-bin/"
//ACTLG_HOST_CGI = "http://www.evernight.org.uk/cgi/"
ACTLG_CGI_SCRIPT_ID = "1"

/***********************************************************************
*
* ACTLG_DropListBox -	returns a string containing the HTML for the SELECT listbox
*
************************************************************************/

function ACTLG_DropListBox(ar)
	{
	var s = ''
	
	s += '<table cellspacing=0 cellpadding=0 border=0>'
	s += '<form name="Act_SectionDroplist">'
	s += '<tr>'
	s += '<td valign=middle noWrap align=right>'
	s += '	<span class="actlgsearchbar">Browse&nbsp;:&nbsp;</span>'

	s += '	<SELECT SIZE="1" CLASS="actxxsmall" NAME="ACT_droplstbox" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">'
  	s += '	<OPTION SELECTED VALUE="">Select a Section</OPTION>'
  	for (var i=1;i<=ar.length;i++)
  		{
		if (ar[i].sURL !=null)
			{
			s += '	<OPTION VALUE="' + ar[i].sURL + '">' + ar[i].sName + '</OPTION>'

// This is the original line from above that includes the ACTINIC_REFERRER line. Maybe need it in the brochure primary template??
//			strIDs += '<OPTION VALUE="' + ar[i].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '">' + ar[i].sName + '</OPTION>'

			}
  		}
	s += '	</SELECT>'

 	s += '</td>'
 	s += '</tr>'
 	s += '</form>'
 	s += '</table>'
 	
  	return s;
  	}

/***********************************************************************
*
* ACTLG_SimpleSearchBox -	returns a string containing the HTML for the Quick Search Box
*
************************************************************************/
function ACTLG_SimpleSearchBox()
{
var s =  '<table cellspacing=0 cellpadding=0 border=0 align=left>'
  	s += '<form name=simplesearch action="' + ACTLG_HOST_CGI + 'ss00000' + ACTLG_CGI_SCRIPT_ID + '.pl" METHOD="GET">'
	s += '<tr>'
	s += '<td valign=middle noWrap align=right>'
	s += '	<span class="actlgsearchbar">Search&nbsp;:&nbsp;</span>'
	s += '	<input CLASS="actxxsmall" type="TEXT" name="SS" size="15" maxsize="125" value="Product name" onFocus="this.value=\'\';this.style.background=\'#FFFFFF\'">&nbsp;'
	s += '</td>'
    s += '<td noWrap valign=bottom align=left> '
    s += '	<!-- <input type=SUBMIT name=ACTION value="NETQUOTEVAR:QUICKSEARCHBUTTONTEXT"> -->'
    s += '	<input type="image" border="0" name="ACTION" src="' + ACTLG_PrefixButtonImagePath('Go_Norm.gif') + '">';
	s += '	<input TYPE=HIDDEN NAME="PR" VALUE="-1">'
	s += '	<input TYPE=HIDDEN NAME="TB" VALUE="A">'
	s += '	<input TYPE=HIDDEN NAME="SHOP" VALUE="">'
	s += '</td>'
	s += '<td nowrap>'
	s += 	ACTLG_MenuText('AdvancedSearch', 'actxxsmall', true);
	s += '</td>'
	s += '</tr>'
	s += '</form>'
	s += '</table>';
return s;
}

/***********************************************************************
*
* ACTLG_LinkToProductText -	returns HTML string to jump to a product reference
*
************************************************************************/
function ACTLG_LinkToProductText(productRef, linkText)
{
var s =  ''
	if(productRef && (productRef + "" != "0"))
	{
		s += '<A HREF="' + ACTLG_HOST_CGI + 'ss00000' + ACTLG_CGI_SCRIPT_ID + '.pl?PRODREF=' + productRef +'&NOLOGIN=1">';
	  	s += '<span class="actxsmall">' + linkText + '</span>';
	  	s += '</A>';
  	}
return s;
}

/*
http://www.evernight.org.uk/cgi/ss000001.pl?PRODREF=7678&NOLOGIN=1

<A HREF="http://www.evernight.org.uk/cgi/ss000001.pl?PRODREF=7678&NOLOGIN=1">More&#46;&#46;&#46;</A>
</span>
*/

/***********************************************************************
*
* ACTLG_ShoppingBasket -	writes the HTML for the shopping basket summary
*
************************************************************************/
function ACTLG_ShoppingBasket()
{
var s =  '<table border="0" cellspacing="0" cellpadding="5" align="center">';
	s += '<tr>';
	s += '<td nowrap align="center" class=actlgbasket>';
	s += '<span class="actlgbasket">';
	s += '	Shopping Basket<br><br>';
	s += '	Items: ' + getCartItem(3) + '<BR>';
	s += '	Total Value: ' + getCartItem(1);
	s += '</span>';
	s += '</td>';
	s += '</tr>';
	s += '</table>';
	
return s;
}

/***********************************************************************
*
* ACTLG_PrefixButtonImagePath -	return string of image file with path
*
************************************************************************/
function ACTLG_PrefixButtonImagePath(imagefile)
{
	var res=imagefile;
	if(res)
	{
		if(ACTLG_PREVIEW_MODE) res ='../images/Buttons/' + res;
		else if(ACTLG_IS_HOME) res ='acatalog/' + res;
	}
	return res;
}

/***********************************************************************
*
* ACTLG_InitMenuData -	set html filenames and image filenames for menu buttons
*
************************************************************************/
function ACTLG_InitMenuData()
{
	ACTLG_MenuData = new Object();

	ACTLG_MenuData.Home = new Object();
	ACTLG_MenuData.Home.textLabel = 'Home'
	ACTLG_MenuData.Home.link = 'index.html'
	ACTLG_MenuData.Home.previewLink = 'P_SiteRoot_index.html'
	ACTLG_MenuData.Home.pathFromHome = ''
	ACTLG_MenuData.Home.pathFromNotHome = '../'
	ACTLG_MenuData.Home.buttonNormFile = 'Home_Norm.gif';
	ACTLG_MenuData.Home.buttonNormImage = new Image();
	ACTLG_MenuData.Home.buttonRollFile = 'Home_Roll.gif';
	ACTLG_MenuData.Home.buttonRollImage = new Image();

	ACTLG_MenuData.NewReleases = new Object();
	ACTLG_MenuData.NewReleases.textLabel = 'New Releases'
	ACTLG_MenuData.NewReleases.link = 'NewReleases.html'
	ACTLG_MenuData.NewReleases.previewLink = 'NewReleases.html'
	ACTLG_MenuData.NewReleases.pathFromHome = 'acatalog/'
	ACTLG_MenuData.NewReleases.pathFromNotHome = ''
	ACTLG_MenuData.NewReleases.buttonNormFile = 'NewReleases_Norm.gif';
	ACTLG_MenuData.NewReleases.buttonNormImage = new Image();
	ACTLG_MenuData.NewReleases.buttonRollFile = 'NewReleases_Roll.gif';
	ACTLG_MenuData.NewReleases.buttonRollImage = new Image();

	ACTLG_MenuData.Shopping = new Object();
	ACTLG_MenuData.Shopping.textLabel = 'Shopping'
	ACTLG_MenuData.Shopping.link = 'index.html'
	ACTLG_MenuData.Shopping.previewLink = 'P_index.html'
	ACTLG_MenuData.Shopping.pathFromHome = 'acatalog/'
	ACTLG_MenuData.Shopping.pathFromNotHome = ''
	ACTLG_MenuData.Shopping.buttonNormFile = 'Shopping_Norm.gif';
	ACTLG_MenuData.Shopping.buttonNormImage = new Image();
	ACTLG_MenuData.Shopping.buttonRollFile = 'Shopping_Roll.gif';
	ACTLG_MenuData.Shopping.buttonRollImage = new Image();

	ACTLG_MenuData.Notices = new Object();
	ACTLG_MenuData.Notices.textLabel = 'Notice Board'
	ACTLG_MenuData.Notices.link = 'Notices.html'
	ACTLG_MenuData.Notices.previewLink = 'P_Notices.html'
	ACTLG_MenuData.Notices.pathFromHome = 'acatalog/'
	ACTLG_MenuData.Notices.pathFromNotHome = ''
	ACTLG_MenuData.Notices.buttonNormFile = 'Notices_Norm.gif';
	ACTLG_MenuData.Notices.buttonNormImage = new Image();
	ACTLG_MenuData.Notices.buttonRollFile = 'Notices_Roll.gif';
	ACTLG_MenuData.Notices.buttonRollImage = new Image();

	ACTLG_MenuData.Features = new Object();
	ACTLG_MenuData.Features.textLabel = 'Features'
	ACTLG_MenuData.Features.link = 'Features.html'
	ACTLG_MenuData.Features.previewLink = 'P_Features.html'
	ACTLG_MenuData.Features.pathFromHome = 'acatalog/'
	ACTLG_MenuData.Features.pathFromNotHome = ''
	ACTLG_MenuData.Features.buttonNormFile = 'Features_Norm.gif';
	ACTLG_MenuData.Features.buttonNormImage = new Image();
	ACTLG_MenuData.Features.buttonRollFile = 'Features_Roll.gif';
	ACTLG_MenuData.Features.buttonRollImage = new Image();

	ACTLG_MenuData.ContactUs = new Object();
	ACTLG_MenuData.ContactUs.textLabel = 'Contact Us'
	ACTLG_MenuData.ContactUs.link = 'ContactUs.html'
	ACTLG_MenuData.ContactUs.previewLink = 'P_ContactUs.html'
	ACTLG_MenuData.ContactUs.pathFromHome = 'acatalog/'
	ACTLG_MenuData.ContactUs.pathFromNotHome = ''
	ACTLG_MenuData.ContactUs.buttonNormFile = 'ContactUs_Norm.gif';
	ACTLG_MenuData.ContactUs.buttonNormImage = new Image();
	ACTLG_MenuData.ContactUs.buttonRollFile = 'ContactUs_Roll.gif';
	ACTLG_MenuData.ContactUs.buttonRollImage = new Image();

	ACTLG_MenuData.ViewBasket = new Object();
	ACTLG_MenuData.ViewBasket.textLabel = 'View Basket'
	ACTLG_MenuData.ViewBasket.link = ACTLG_HOST_CGI + 'ca00000' + ACTLG_CGI_SCRIPT_ID + '.pl?ACTION=SHOWCART'
	ACTLG_MenuData.ViewBasket.previewLink = '../../../Act_PreviewWarningPage.html?ACTION=SHOWCART'
	ACTLG_MenuData.ViewBasket.pathFromHome = ''
	ACTLG_MenuData.ViewBasket.pathFromNotHome = ''
	ACTLG_MenuData.ViewBasket.buttonNormFile = 'ViewBasket_Norm.gif';
	ACTLG_MenuData.ViewBasket.buttonNormImage = new Image();
	ACTLG_MenuData.ViewBasket.buttonRollFile = 'ViewBasket_Roll.gif';
	ACTLG_MenuData.ViewBasket.buttonRollImage = new Image();

	ACTLG_MenuData.Checkout = new Object();
	ACTLG_MenuData.Checkout.textLabel = 'Checkout'
	ACTLG_MenuData.Checkout.link = ACTLG_HOST_CGI + 'os00000' + ACTLG_CGI_SCRIPT_ID + '.pl?ACTION=Start'
	ACTLG_MenuData.Checkout.previewLink = '../../../Act_PreviewWarningPage.html?ACTION=Start'
	ACTLG_MenuData.Checkout.pathFromHome = ''
	ACTLG_MenuData.Checkout.pathFromNotHome = ''
	ACTLG_MenuData.Checkout.buttonNormFile = '';
	ACTLG_MenuData.Checkout.buttonNormImage = new Image();
	ACTLG_MenuData.Checkout.buttonRollFile = '';
	ACTLG_MenuData.Checkout.buttonRollImage = new Image();

	ACTLG_MenuData.AboutUs = new Object();
	ACTLG_MenuData.AboutUs.textLabel = 'About Us'
	ACTLG_MenuData.AboutUs.link = 'AboutUs.html'
	ACTLG_MenuData.AboutUs.previewLink = 'P_AboutUs.html'
	ACTLG_MenuData.AboutUs.pathFromHome = 'acatalog/'
	ACTLG_MenuData.AboutUs.pathFromNotHome = ''
	ACTLG_MenuData.AboutUs.buttonNormFile = '';
	ACTLG_MenuData.AboutUs.buttonNormImage = new Image();
	ACTLG_MenuData.AboutUs.buttonRollFile = '';
	ACTLG_MenuData.AboutUs.buttonRollImage = new Image();

	ACTLG_MenuData.Sitemap = new Object();
	ACTLG_MenuData.Sitemap.textLabel = 'Sitemap'
	ACTLG_MenuData.Sitemap.link = 'sitemap.html'
	ACTLG_MenuData.Sitemap.previewLink = 'P_sitemap.html'
	ACTLG_MenuData.Sitemap.pathFromHome = 'acatalog/'
	ACTLG_MenuData.Sitemap.pathFromNotHome = ''
	ACTLG_MenuData.Sitemap.buttonNormFile = '';
	ACTLG_MenuData.Sitemap.buttonNormImage = new Image();
	ACTLG_MenuData.Sitemap.buttonRollFile = '';
	ACTLG_MenuData.Sitemap.buttonRollImage = new Image();

	ACTLG_MenuData.AdvancedSearch = new Object();
	ACTLG_MenuData.AdvancedSearch.textLabel = 'Advanced Search'
	ACTLG_MenuData.AdvancedSearch.link = 'search.html'
	ACTLG_MenuData.AdvancedSearch.previewLink = 'P_search.html'
	ACTLG_MenuData.AdvancedSearch.pathFromHome = 'acatalog/'
	ACTLG_MenuData.AdvancedSearch.pathFromNotHome = ''
	ACTLG_MenuData.AdvancedSearch.buttonNormFile = '';
	ACTLG_MenuData.AdvancedSearch.buttonNormImage = new Image();
	ACTLG_MenuData.AdvancedSearch.buttonRollFile = '';
	ACTLG_MenuData.AdvancedSearch.buttonRollImage = new Image();

	ACTLG_MenuData.Info = new Object();
	ACTLG_MenuData.Info.textLabel = 'Terms & Conditions'
	ACTLG_MenuData.Info.link = 'info.html'
	ACTLG_MenuData.Info.previewLink = 'P_info.html'
	ACTLG_MenuData.Info.pathFromHome = 'acatalog/'
	ACTLG_MenuData.Info.pathFromNotHome = ''
	ACTLG_MenuData.Info.buttonNormFile = '';
	ACTLG_MenuData.Info.buttonNormImage = new Image();
	ACTLG_MenuData.Info.buttonRollFile = '';
	ACTLG_MenuData.Info.buttonRollImage = new Image();

	ACTLG_MenuData.ViewBasketTiny = new Object();
	ACTLG_MenuData.ViewBasketTiny.textLabel = 'View Basket'
	ACTLG_MenuData.ViewBasketTiny.link = ACTLG_HOST_CGI + 'ca00000' + ACTLG_CGI_SCRIPT_ID + '.pl?ACTION=SHOWCART'
	ACTLG_MenuData.ViewBasketTiny.previewLink = '../../../Act_PreviewWarningPage.html?ACTION=SHOWCART'
	ACTLG_MenuData.ViewBasketTiny.pathFromHome = ''
	ACTLG_MenuData.ViewBasketTiny.pathFromNotHome = ''
	ACTLG_MenuData.ViewBasketTiny.buttonNormFile = 'ViewBasketTiny_Norm.jpg';
	ACTLG_MenuData.ViewBasketTiny.buttonNormImage = new Image();
	ACTLG_MenuData.ViewBasketTiny.buttonRollFile = 'ViewBasketTiny_Norm.jpg';
	ACTLG_MenuData.ViewBasketTiny.buttonRollImage = new Image();

	// Now set the correct file paths for the links and images depending on
	// whether we are previewing, and whether the current file is the home page.

	var name;
	
	for(name in ACTLG_MenuData)
	{
		var x = ACTLG_MenuData[name];
		
		if(ACTLG_PREVIEW_MODE)
		{
			x.link = x.previewLink;
		} 
		else
		{
			if(ACTLG_IS_HOME)
			{
				x.link = x.pathFromHome + x.link;
			}
			else
			{
				x.link = x.pathFromNotHome + x.link;
			}
		}

		x.buttonNormFile = ACTLG_PrefixButtonImagePath(x.buttonNormFile);
		x.buttonRollFile = ACTLG_PrefixButtonImagePath(x.buttonRollFile);
		
		if(x.buttonNormFile) x.buttonNormImage.src = x.buttonNormFile;
		if(x.buttonRollFile) x.buttonRollImage.src = x.buttonRollFile;
	}

}

/***********************************************************************
*
* ACTLG_MenuButton -	returns a string containing the HTML for one menu item as a button
*
************************************************************************/
function ACTLG_MenuButton(name)
{
	var s = '';
		
	s += '<A HREF="' + ACTLG_MenuData[name].link + '" TARGET="_self" ';
	s += 'onMouseover="document.' + name + '.src=ACTLG_MenuData.' + name + '.buttonRollImage.src" ';
	s += 'onMouseout="document.' + name + '.src=ACTLG_MenuData.' + name + '.buttonNormImage.src" ';
	s += '>';
	s += '<IMG SRC="' + ACTLG_MenuData[name].buttonNormFile +'" ALT="' + ACTLG_MenuData[name].textLabel + '" BORDER=0 NAME="' + name + '">';
	s += '</A>';
	s += '\n';

  	return s;
}

/***********************************************************************
*
* ACTLG_MenuText -	returns a string containing the HTML for one menu item as a text link
*
************************************************************************/
function ACTLG_MenuText(name, textclass, brackets)
{
	var s = '';
		
	if(brackets) s += '<span class="' + textclass +'">[</span>&nbsp;';
	s += '<A HREF="' + ACTLG_MenuData[name].link + '" TARGET="_self" >';
	s += '<span class="' + textclass +'"><b>' + ACTLG_MenuData[name].textLabel + '</b></span>';
	s += '</A>';
	if(brackets) s += '&nbsp;<span class="' + textclass +'">]</span>';
	s += '\n';

  	return s;
}

/***********************************************************************
*
* ACTLG_EmailListSubscribe -	returns HTML string for Email list subscription form
*
************************************************************************/
function ACTLG_EmailListSubscribe()
{
	var s = '';
	s += '<form method=GET action="http://games.groups.yahoo.com/subscribe/New-Releases">'
	s += '<br>'
	s += '<table width=130 cellspacing=3 cellpadding=0 border=0 bgcolor="#4094C8">'
	s += '  <tr>'
	s += '    <td align=center>'
	s += '      <b>Subscribe to Leisure Games New Releases emails</b>'
	s += '    </td>'
	s += '  </tr>'
	s += '  <tr>'
	s += '    <td align=center>'
	s += '      <input type=text name="user" value="enter email" size=12>'
	s += '    </td>'
	s += '  </tr>'
	s += '  <tr>'
	s += '    <td align=center>'
	s += '      <INPUT TYPE=SUBMIT VALUE="Subscribe">'
	s += '    </td>'
	s += '  </tr>'
	s += '</table>'
	s += '</form>'

	return s;
}

/***********************************************************************
*
* ACTLG_MainMenu -	writes the HTML for the complete main menu
*
************************************************************************/
function ACTLG_MainMenu()
{
	document.write('<br><br>');
	document.write('<table width=160 border="0" cellspacing="0" cellpadding="4">');

	document.write('<tr><td align=center>' + ACTLG_MenuButton('Home') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('NewReleases') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('Shopping') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('Features') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('Notices') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('ContactUs') + '</td></tr>')
	document.write('<tr><td align=center>' + ACTLG_MenuButton('ViewBasket') + '</td></tr>')

	document.write('<tr><td align=center>' + ACTLG_EmailListSubscribe() + '</td></tr>')

	document.write('</table>');
}

/***********************************************************************
*
* ACTLG_ShoppingMenu -	writes the HTML for the shopping buttons
*
************************************************************************/
function ACTLG_ShoppingMenu()
{
	document.write('<table border="0" cellspacing="0" cellpadding="5"')
	document.write('<tr>')

	document.write('<td nowrap align="center">')
	document.write(		ACTLG_MenuText('ViewBasketTiny', 'actxsmall', false));
	document.write('</td>')
	document.write('<td nowrap align="center">')
	document.write(		ACTLG_MenuButton('ViewBasketTiny'));
	document.write('</td>')

	document.write('</tr>')
	document.write('</table>');
}
