function numbersonly(obj,e)
{
	var evtobj=window.event? event : e;
	var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode
	var actualkey=String.fromCharCode(unicode)
	var quantity = document.getElementById(obj.name);

	if(unicode == '190') {
		alert('Decimal values not allowed.');
		quantity.value= '';
		return false;
	}

	if(isNaN(quantity.value)==true) {
		alert('Plese enter numbers only.');
		quantity.value= '';
		return false;
	}
}

function price_val(str)
{
	return str.match(/^\d+([\.]\d\d)?$/);
}

function view_image()
{
	//var new_win_src_loc=document.ShippingBillingForm.tmp_path_4_common_d4b.value+'cvv-help.html'; 
	var new_win_src_loc = "templates/middle/view_image.php"; 
	abc = window.open(new_win_src_loc,"newwin1","toolbar=0,scrollbars=1,location=0,status=0,menubars=0,resizable=0,width=560,height=360,top=250,left=250,maximize=yes");
}


function add_to_cart(obj)
{
	var qty = document.getElementById('qnty');
	var stock = document.getElementById('stock').innerHTML;
	
	if(qty.value!="") {
		if(!price_val(qty.value)) {
			alert ('Please enter a valid quantity');
			qty.value = "";
			qty.focus();
			return false;
		}
		if(stock=="Out of Stock") {
			var r=confirm("This product is out of stock.\nAre you sure you want to continue?");
			if(r==false) {
				return false;
			}
		}
	}
}

function add_to_favourite(login, pid)
{
	if(login) {
		window.location.href ='add_to_favourite.html?prod_id='+pid;
	}else{
		alert('Please login first to add your favourite product.');
	}
}

function add_to_notify()
{
	var notify_address = document.getElementById("stock");
	alert(notify_address.innerHTML);

}