$(function(){
//when key is pressed in the textbox
	$("#quantity").keypress(function (e){  
		//if the letter is not digit then display error and don't type anything  
		if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))  {    
		//display error message    
			$("#errmsg").html("Digits Only").fadeIn("slow").fadeOut("slow");    
			return false;  
		}});	
	$("#quantity").keyup(function(e){
				var dElem = $("table.planBox");
				dElem.removeClass("orangeBorder");
				var quan = $("#quantity").val();
				var price;
				var packName;
				var baseDesc ="100MB Each Email, Attachment Upto 20MB, SMTP/POP3, Blackberry Email Support, World Client Email System, All standard Features Included, 24x7 support by Phone, by Email, by various Messengers ( Skype, Yahoo), 99.9% uptime guarantee, Online support portal"; 
				var locDesc;
				var upDollar=46.91496062992126 ; // Unit Price of Dollar
				if (quan==0) {
					price=0;
					}
				if (quan >=1 && quan<=25) {
					price = 200;
					packName = "EES-BP";
					dElem.eq(0).addClass("orangeBorder");
					}
				else if(quan >=26 && quan <=50) { 
					price = 175;
					packName = "EES-BS";
					dElem.eq(1).addClass("orangeBorder");
					}
				else if (quan >= 51 && quan<=100) {
					price = 150;
					packName = "EES-EP";
					dElem.eq(2).addClass("orangeBorder");
					}
				else if(quan>=101) { 
					price = 125;
					packName ="EES-BL";
					dElem.eq(3).addClass("orangeBorder");
				}
				
				$("#lblRs").text(price*quan);
				$("#lblDollar").text(parseInt((price*quan*100)/upDollar)/100);
				$("#amount").val(price*quan);
				$("#description").val(packName + " : " + quan + " Emails@Rs." + price + "/- with the following features: " + baseDesc +" including standard features." )
		})	
		
		$("#frmSubmitter").click(function(){
			$("#frmEMS").submit();
			return false;
			})
			
		$("#frmEMS").submit(function(){
			var quan = $("#quantity").val();
			if (quan=="" || quan=="0") {
				$("#errmsg").html("Blank or Zero").fadeIn("slow").fadeOut("slow");
				return false;
			} else return true;
			})

	})

