
function openLarge(thePic){
window.open('browse_showpic.asp?productID='+thePic,'','height=500,width=500')
}

function openCTLLarge(thePic){
window.open('browse_showCTLpic.asp?pic='+thePic,'','height=400,width=400')
}

function openReminder(thePic){
window.open('basket_showpic.asp?productID='+thePic,'item'+thePic,'height=250,width=250,scrolling=no,left=300,top=300')
}

function specoffPopper(thePic){
window.open('browse_specpopper.html','','height=150,width=150,scrolling=yes')
}

function openHelp_imagesize(){
window.open('../admin/help_imagesize.html','','height=400,width=250,scrolling=yes')
}


function openHelp_resize(){
window.open('../admin/help_imageresize.htm','','height=400,width=600,scrollbars=yes,resizable=yes')
}

function openHelp_products(){
window.open('../admin/help_products.html','','height=400,width=250,scrolling=yes')
}

function openHelp_themes(){
window.open('../admin/help_themes.html','','height=400,width=250,scrolling=yes')
}
function addToBasket(productID,senderPageName){
window.location = 'basket.asp?basketAction=additem&productID=' + productID + "&quantity=" +  eval('document.thisForm.quantity'+productID+'.value') + "&senderPageName=" + senderPageName
}

function addToBasketSelect(senderPageName){
window.location = 'basket.asp?basketAction=additem&productID=' + eval('document.thisForm.product.value') + "&quantity=" +  eval('document.thisForm.quantity.value') + "&senderPageName=" + senderPageName
}


function deleteitem(productID){
var deleteThat = confirm('Are you sure you wish to remove this product?')
if(deleteThat != 0 ){
	document.deleteItem.productID.value = productID
	document.deleteItem.submit();
	}
}


function intOnly(i) {
	if(i.value.length>0) {
		i.value = i.value.replace(/[^\d]+/g, '');
	}
}

function intOnBlur(i){
if(i.value.length==0) 
	{
	i.value = 0;
	}
}

function alertDelRestrictions(){
window.open('deliveryrestrictions.html','delrestr','width=400,height=300,srollbars=yes')
}

function CheckEmail(str) {
	var index=0;
	var rejected=false
	var testresults=true
	var filter=/^.+@.+\..{2,3}$/
	if (filter.test(str)){
		var tempstring = str.split("@")
		tempstring = tempstring[1].split(".")
	} else {
		testresults=false
	}
	return (testresults)
}

function copyAddress(){
document.thisForm.billingAddress1.value = document.thisForm.shippingAddress1.value
document.thisForm.billingAddress2.value = document.thisForm.shippingAddress2.value
document.thisForm.billingAddress3.value = document.thisForm.shippingAddress3.value
document.thisForm.billingTown.value = document.thisForm.shippingTown.value
document.thisForm.billingCounty.value = document.thisForm.shippingCounty.value
document.thisForm.billingPostcode.value = document.thisForm.shippingPostcode.value
}

function wrongPostcode(){
alert('It would appear that you have specified a non-existent postocode.\n\nPlease return to the previous page and ensure that you have entered your postcode correctly.')

}

function checkForm(){
if (document.thisForm.firstName.value == "")
 {
 alert('Please enter your first name')
 }
else if (document.thisForm.lastName.value == "")
 {
 alert('Please enter your last name')
 }
else if  (CheckEmail(document.thisForm.shopperEmailAddress.value)==false)
 {
 alert('Please enter a valid email address')
 }
else  if  (document.thisForm.telephoneNumber.value == "")
 {
 alert('Please enter a contact telephone number')
 }
else if(wrongPostcode == 1 )
 {
 alert('Please return to the previous page and enter a valid postcode')
 }
else if (document.thisForm.shippingAddress2.value == "")
 {
 alert('Please enter a delivery street')
 }
else if (document.thisForm.billingAddress2.value == "")
 {
 alert('Please enter a billing street')
 }
else if (document.thisForm.billingTown.value == "")
 {
 alert('Please enter a billing town')
 }
else if (document.thisForm.billingCounty.value == "")
 {
 alert('Please enter a billing county')
 }
else if (document.thisForm.billingPostcode.value == "")
 {
 alert('Please enter a billing postcode')
 }
else {
 document.thisForm.action = "checkout.asp"
 document.thisForm.submit();
//alert(document.thisForm.deliverCharge.value);
 }
}

varPicNumber = 1
function showPic(inc){
varPicNumber += inc
varPicNumber = varPicNumber%17
if (varPicNumber== 0)
 {
 varPicNumber = 1
 } 
document.shopPic.src = "../pix/shop" + varPicNumber + ".jpg"
}

function clearIt(){
if(document.searchForm.keyword.value == "Search for...")
	{
	document.searchForm.keyword.value = ""
	}
}

function fillIt(){
if(document.searchForm.keyword.value == "")
	{
	document.searchForm.keyword.value = "Search for..."
	}
}

function checkSearch(){
if(document.searchForm.keyword.value == "Search for...")
	{
	alert("Please add a search word!")
	}
	else
	{
	document.searchForm.action = "../shop/search.asp"
	document.searchForm.submit();
	}
}
