
catPages		= 276
catIssue 		= "Winter 2008/09"
catPagesHw 	= 60
catPiecesHw	= 1000
catIssueHw	= "Winter 2008/09"

var devUrl = 'rutlands.peaknet.ltd.uk'



/* Catalogue Form validator */

function validate()
{
if(document.forms.catalogue.referrer.value == 'unspecified')
	{
	alert('\nPlease tell us how you heard about Rutlands before continuing.\n\nThank you.');
	}
	
else 	{
	document.forms.catalogue.submit();
	}	
}



/* _________________________________________________________________________________________________________________________

Detect browser
__________________________________________________________________________________________________________________________*/
	
if (document.all)							{ browser="ie"; }
else if (document.layers)		 				{ browser="n4"; }   
else if (!document.all && document.getElementById)	{ browser="n6"; }



/* _________________________________________________________________________________________________________________________

Change page url
__________________________________________________________________________________________________________________________*/

function go(destUrl)
{
top.location=destUrl;
}

/* _______________________________________________________

Register Function
_______________________________________________________ */

function register(email)
	{
	winHref = "/cgi-bin/psRegister.cgi/" + reg.email.value;
	document.location = winHref;
	//winName = "Register";
	//winFeatures = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=250,width=250";
	//var reg_window = window.open(winHref,winName,winFeatures);
	}

/* _______________________________________________________

Left Menu Roll-over FX 
_______________________________________________________ */

function mON(slot)	{ slot.className='menuON';		}
function mOFF(slot)	{ slot.className='menuslot';		}
function sON(slot)	{ slot.className='shopslotON';		}
function sOFF(slot)	{ slot.className='shopslot';		}	
function storeON(slot)	{ slot.className='storemenuslotON';	}
function storeOFF(slot)	{ slot.className='storemenuslot';	}

/* ____________________________________________________

Show Basket Code
_______________________________________________________ */

function showcart()
	{
		top.location =  '/psShowCart.htm';
	//var cart_window = window.open("/psShowCart.htm","shopping_cart","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,height=500,width=750");
	}



/* _________________________________________________________________________________________________________________________

Unsubscribe from Email Club
__________________________________________________________________________________________________________________________*/

function unSub()
{
if (document.unsub.email.value != "")
	{
	alert('The address: ' + document.unsub.email.value + ' will be removed from our database.');
	return true;
	//top.location = document.unsub.action+document.unsub.email.value;
	}
else {alert('Please enter an email address..');return false;}
}



/* ____________________________________________________

Special Functions for psProdDet.htm
_______________________________________________________ */

function prodPanel(toReveal)
{
document.getElementById('specgrid').className='hidden';
document.getElementById('descgrid').className='hidden';
document.getElementById('reviewsgrid').className='hidden';
document.getElementById('composer').className='hidden';
document.getElementById('deliveryGrid').className='hidden';
document.getElementById(toReveal).className='visible';
}



function CleverBasket(prod_code, item)
{
	objQty = eval("document.forms[2].qty" + item);
	intQty = objQty.value;
	
	if(intQty > 0)
	{
	
		document.forms[2].prod_code.value = prod_code;
		document.forms[2].qty.value       = intQty;
		document.forms[2].submit();
	}
}



/* ____________________________________________________

Send Button unlocker - Catalogue page
_______________________________________________________ */

function unlockSendButton()
{
	if (document.catalogue.email.value == 0)
	{
		document.catalogue.sendButton.disabled = true;
	}
	else
	{
		document.catalogue.sendButton.disabled = false;
	}
}

function checkEmail()
{
	var email_string = document.catalogue.email.value;
	var regex_pattern = /\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi;
	
	//if (email_string.match(regex_pattern))
	//{
	//	alert("EMAIL OK!");
		return true;
	//}
	//else
	//{
	//	alert("You have not entered a valid email address.  Please re-enter your email address.");
	//	return false;
	//}
}

/* _________________________________________________________________________________________________________________________

Show/Hide Development Server Banner
__________________________________________________________________________________________________________________________*/

function loaded()
{
}

function hideThis(pagePart)
{
document.getElementById(pagePart).className='hidden';
}

function revealThis(pagePart)
{
document.getElementById(pagePart).className='visible';
}

/* _________________________________________________________________________________________________________________________

Change or Remove a "class" - controlled via the id
__________________________________________________________________________________________________________________________*/

function reClass(pageItem,nuClass)
{
document.getElementById(pageItem).className=nuClass;
}

function deClass(pageItem)
{
pageItem.className='';
}


/*
	Popup window to subscribe to mail list, this window needs to appear in the centre of the screen.
*/
function ShowMailList()
{
	strCookie = document.cookie;
	arrCookie = strCookie.split('; ');
	arrCookies = new Array();
	
	arrCookies['HIDEMAILLIST'] = 0;
	
	for(intCookie in arrCookie)
	{
		arrThisCookie = arrCookie[intCookie].split('=');
		arrCookies[arrThisCookie[0]] = arrThisCookie[1];
	}
	

	if(arrCookies['HIDEMAILLIST'] != 1)
	{
		objSignup = document.getElementById('signup');
		objSignup.style.display = 'block';
	}
}

function HideMailList()
{
	document.cookie = 'HIDEMAILLIST=1; expires=Thu, 2 Aug 2021 20:47:11 UTC; path=/';
	
	objSignup = document.getElementById('signup');
	objSignup.style.display = 'none';
}



/* Ensure that no "Search..." searches can occur Jnm 27-05-2009 */

function zapDefaultSearch()
{
	if (document.prodfind.search_text.value == 'Search...')
		{
		document.prodfind.search_text.value = '';
		}
}
