function isValidContactForm(objForm)
{
	strAlert = "";

	if (objForm.strFullName.value == "") {
		strAlert += "> Your name\n";
	}
	
	if ( (objForm.strEmailAddress.value == "") || (objForm.strEmailAddress.value.indexOf("@") == -1) ) {
		strAlert += "> E-mail address\n";
	}
	
	if (objForm.strMessage.value == "") {
		strAlert += "> Message\n";
	}
	
	if (strAlert != "") {
		alert("The following field are not completed:\n"+ strAlert);
		return false;
	} else {
		return true;
	}
}

function isValidCheckOutForm(objForm)
{
	strAlert = "";

	if (objForm.Name_First.value == "") {
		strAlert += "> Your first name\n";
	}
	
	if (objForm.Name_Last.value == "") {
		strAlert += "> Your last name\n";
	}
	
	if ( (objForm.Email.value == "") || (objForm.Email.value.indexOf("@") == -1) ) {
		strAlert += "> E-mail \n";
	}
	
	if (objForm.Street_line1.value == "") {
		strAlert += "> Address \n";
	}
	
	if (objForm.City.value == "") {
		strAlert += "> City \n";
	}
	
	
	if (strAlert != "") {
		alert("The following field are not completed:\n"+ strAlert);
		return false;
	} else {
		return true;
	}
}


function removeItemFromBasket(id)
{
	objForm = document.basketform;
	
	if (confirm("Are you sure you want to delete this item from your basket?")) {
		window.location.href = "/index.php?action=deleteitem&product_id="+ id;
	} else {
		//do nothing
	}
}


function setZoomLink(zoomImage)
{
	objZoomLink = document.getElementById("zoomlink");

	curHref = objZoomLink.href;
	partOne = curHref.substring(0, curHref.indexOf("image=")+6);
	partTwo = curHref.substring(curHref.indexOf("product_id=")-1);
	
	newHref = partOne + zoomImage + partTwo;
	
	objZoomLink.href = newHref;
}


function setMainImage(newSource)
{
	curSource     = ""+ document.mainimage.src;
	cuttedSource  = curSource.substring(0, curSource.lastIndexOf("/")+1);
	
	newSource     = cuttedSource + newSource;
	
	document.mainimage.src = newSource;
}
