//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; }
	
	return true;
}


var cat_img = [];

function swap_cat_image(cat_id, sub_file)
{
	cat_img[cat_id] = document.getElementById("cat_image_"+cat_id).src;

	if (!sub_file) return false;

	document.getElementById("cat_image_"+cat_id).src = "admin/cat_images/"+sub_file;
}

function restore_cat_image(cat_id)
{
	document.getElementById("cat_image_"+cat_id).src = cat_img[cat_id];
}