<%
function isPaid(orderid) {

	var order = session.get("o" + orderid);
	if(order != null) {
		print(order.PAY);
	} else {
		print({
			"Infor" : "Sorry, Order is not exsiting"
		});
	}
}

function pay(orderid) {

	var order = session.get("o" + orderid);
	//checking order is there
	if(order != null) {
		//Order is existing
		if(order.PAY) {
			print({
				"Infor" : "Sorry, Order was paid"
			});
		} else {
			order.PAY = true;
			order.STATUS = "Complete";
			session.put("o" + orderid, order);
			print(order);
		}
	} else {

		print({
			"Infor" : "Sorry, Order is not exsiting"
		});
	}

}

%>