function newWin(url)
{
	url = "bigpic.asp?pic=" + url;

	var nw = window.open(url,nw,'width=350,height=450,scrollbars=no');
	nw.focus();
}

function FormSubmit(nId)
{
	document.frmProducts.target = '_blank';
	document.frmProducts.ProductId.value = nId;
	document.frmProducts.submit();
}

function ViewCart(nProduct, nCat)
{
	var sUrl = 'AddToCart.asp?';

	if (nProduct > 0)
		sUrl += 'ProductId=' + nProduct + '&';

	sUrl += 'cat=' + nCat;

	var newwindow = window.open(sUrl, 'theCart', 'scrollbars,titlebar,resizable,statusbar,height=720,width=850');
	newwindow.focus();
}

function ProcessFunction(sFunction)
{
	if (sFunction == 'Shop')
	{
		close();
	}
else
	{
		document.frmCart.Function.value = sFunction
		document.frmCart.submit();
	}
}

function ProcessFunctionLogin(sFunction)
{
	document.frmLogin.Function.value = sFunction
	document.frmLogin.submit();
}

function ProcessFunctionReg(sFunction)
{
	document.frmRegister.Function.value = sFunction
	document.frmRegister.submit();
}

function ProcessFunctionCC(sFunction)
{
	document.frmCartCheck.Function.value = sFunction
	document.frmCartCheck.submit();
}

function ProcessFunctionFP(sFunction)
{
	document.frmForgot.Function.value = sFunction
	alert('You have been sent an email with your password details.');
}


function setupsize()
{
	window.moveTo(100,50);
	//window.resizeTo(675, 750);
}

function validateCompetitionForm()
{
	var myform = document.forms.winbc;

	if (myform.title.value == "")
	{
		alert ("You must enter your Title before submitting this form.");
		myform.title.focus();
		return false;
	}

	if (myform.forename.value == "")
	{
		alert ("You must enter your Forename(s) before submitting this form.");
		myform.forename.focus();
		return false;
	}

	if (myform.surname.value == "")
	{
		alert ("You must enter your Surname before submitting this form.");
		myform.surname.focus();
		return false;
	}

	if (myform.address1.value == "")
	{
		alert ("You must enter your Address before submitting this form.");
		myform.address1.focus();
		return false;
	}

	if (myform.town.value == "")
	{
		alert ("You must enter your Town before submitting this form.");
		myform.town.focus();
		return false;
	}

	if (myform.county.value == "")
	{
		alert ("You must enter your County before submitting this form.");
		myform.county.focus();
		return false;
	}

	if (myform.postcode.value == "")
	{
		alert ("You must enter your Postcode before submitting this form.");
		myform.postcode.focus();
		return false;
	}

	if (myform.tel.value == "")
	{
		alert ("You must enter your Telephone Number before submitting this form.");
		myform.tel.focus();
		return false;
	}

	if (myform.email.value > "")
	{
		if (myform.email.value.search(/^[\w\.-]+@{1}([\w-]+\.{1})+[a-z]{2,3}(a-z)?$/i) == -1)
		{
			alert ("Your Email address does not appear to be valid. \nPlease correct it before submitting this form.");
			myform.email.focus();
			return false;
		}
	}
	else
	{
		alert ("You must enter your Email Address before submitting this form.");
		myform.email.focus();
		return false;
	}

	if (myform.readtc.checked == false)
	{
		alert ("You must read and agree to the terms & conditions before submitting this form.");
		myform.readtc.focus();
		return false;
	}

	myform.submit;
}
