function cart_remove(name)
{
	document.getElementById(name).value = 0;
}
function calculate_price(print_price)
{
	document.buyform.price_estimate.value = document.buyform.print_price.value * document.buyform.quantity.value;
	//console.log(document.buyform.price_estimate.value)
}


function change_price(obj)
{
	document.buyform.print_size.value=obj[obj.selectedIndex].text; //SHOULD BE TEXT!
	calculate_price()
}


function click_image(obj)
{
	//document.getElementById('mainpic').src=obj.href;
	document.buyform.photo_file.value=obj.href;

	document.getElementById("mainframe").innerHTML="<img id='mainpic' src='"+obj.href+"' alt='' />"

	var j=0;
	for (j=0; j<photos.length; j++)
	{
		if (photos[j]==obj.href)
		{
			i=j;
		}
	}

	window.location="#";
}




//http://www.regular-expressions.info/email.html
function validate_email(email)
{
	if (email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i))
	{
		//alert("Email Address is Valid");
		return true;
	}
	else
	{
		//alert(email + " is not a valid email address");
		return false;
	}
}


function validate_request_login()
{
	if  (!validate_email(document.getElementById('email').value)) { alert('A valid email address is mandatory'); return false; }
	
	if  (!document.getElementById('city').value) { alert('City is mandatory'); return false; }
	
	if (!document.getElementById('country').value) { alert('Country is mandatory'); return false; }
	if (!document.getElementById('password').value) { alert('Password is mandatory'); return false; }
	
	return true;
}
