function myfunc()
{
alert(1)
}

function rp_openContactWindow(l,t)
{
	var x = window.open(l,t,"width=400,height=300,scrollbars=yes,resizable=yes,menubar=yes");
	if (x.focus) x.focus();
}

function rp_openBookCoverWindow(l,t)
{
	var x = window.open("/richmondspain/catalogue/book-popup.asp?i="+l,t,"width=610,height=420,scrollbars=yes,resizable=yes,menubar=yes");
	if (x.focus) x.focus();
}

function rp_openLegalText(l,t)
{
	var x = window.open(l,t,"width=380,height=200,scrollbars=yes,resizable=yes");
	if (x.focus) x.focus();
}

function rp_openAuthorWindow(l,t)
{
	rp_popupWindow(l,'author',320,350,'rs');
}

function emailInvalid(email)
{
	var atPos = email.indexOf("@");
	if (atPos < 1) return true;
	var dotPos = email.lastIndexOf(".");
	if (dotPos < atPos) return true;
	if (dotPos-atPos < 2) return true;
	if (dotPos >= (email.length-2)) return true;
	return false;
}

function onsubmitNewsletter(form)
{
	if (document.location.toString().substring(0,7) != "http://")
	{
		alert("Sorry, this is only available online.");
		return false;
	}
	if (emailInvalid(form.email.value))
	{
		alert("Please enter a valid email address.");
		form.email.focus();
		return false;
	}

	rp_popupWindow(form.action,'newsletter',500,300,'xrs');
	return true;
}

function onlyOnline()
{
	if (document.location.toString().substring(0,7) != "http://")
	{
		alert("Sorry, this is only available online.");
		return false;
	}
	return true;
}

function onchangeNewsletter(textbox)
{
}

function onfocusNewsletter(textbox)
{
	if (textbox.value == "your email here")
	{
		textbox.value = ""
	}
}

function onblurNewsletter(textbox)
{
	if (textbox.value == "")
	{
		textbox.value = "your email here"
	}
}

function onsubmitSearch(form)
{
	if (document.location.toString().substring(0,7) != "http://")
	{
		alert("Sorry, this is only available online.");
		return false;
	}
	return true;
}

/*******************************************************************/
function rp_popupWindow(url,target,width,height,opts)
/*
	Returns: (nothing)

	Required parameters:
	·	url: address of page to load in popup window, usually: this.href
	·	target: the name to give to the new window (for reusing windows)

	Optional parameters:
	·	width: (integer) only used if height is also specified
	·	height: (integer)
	·	opts: (string) specify which elements to display in the window:
			l - location (or address) bar
			m - menu bar (useful for access to the file menu for printing)
			r - resizable (usually this should be specified)
			s - scroll bars (usually this should be specified)
			t - tool bar (back, forward, reload, stop, etc)
			x - status bar

			e.g. 'mrs' means display menu bar, allow window to be resized
			and display scrollbars if content is too big for window
********************************************************************/
{
	var p = null;
	if (width == null || height == null) {
		p = null
	}
	else if (opts == null) {
		p = "width="+width+",height="+height
	}
	else
	{
		p = "width="+width+",height="+height

		opts = opts.toString().toLowerCase();

		if (opts.indexOf("l") >= 0) p += ",location=1"
		if (opts.indexOf("m") >= 0) p += ",menubar=1"
		if (opts.indexOf("r") >= 0) p += ",resizable=1"
		if (opts.indexOf("s") >= 0) p += ",scrollbars=1"
		if (opts.indexOf("t") >= 0) p += ",toolbar=1"
		if (opts.indexOf("x") >= 0) p += ",statusbar=1"
	}

	var x = window.open(url,target,p)
	if (x.focus) x.focus();
}
/*******************************************************************/
