// JavaScript Document


var pre_qty = 0;

function setpreqty(val){
	pre_qty = val;
}

function askDel()
	{
		var answer = false;
		answer = confirm('Are you sure you want to delete this Item?');
		if (answer)
			{
				answer=true;
			}
		return answer;
	}

function calculate(num)
{
qty = eval("document.frm.qty_" + num);
qty.value = qty.value;

	if (qty.value == '')
	{
		qty.value = pre_qty;
	}
	
	if (qty.value == '0')
	{
		qty.value = pre_qty;
	}
	/*if (isNaN(qty.value))
	{
		qty.value = pre_qty;
		return false
	}*/
	var valid = "0123456789"
	for (var i=0; i<qty.value.length; i++) 
	{
		if (valid.indexOf(qty.value.substr(i,1)) == "-1") 
		{
			//alert("Alert")
			qty.value = pre_qty;
		}
	
	}
	if (parseInt(qty.value)==0){
		qty.value = pre_qty;
	}
}

function redirectpg()
{
	if (document.frm.hdredirect.value != '')
	{
	location.href = document.frm.hdredirect.value;
	}
	else
	{
	location.href = "http://www.photonicshop.co.uk/";	
	}
}

