/*------------------------------------------------------------------------------------------
checkout.verify.js
da peng
dp165137419@163.com
------------------------------------------------------------------------------------------*/



(function ($) {
    $(document).ready(function () {				
				
				$('#sub').click(function () {
				    	if ($('#user').val() == '') {
						    alert('Customers must fill in columns marked "*"');
								$('#user').focus();
								return false;
						}
						if ($('#password').val() == '') {
						    alert('Customers must fill in columns marked "*"');
								$('#password').focus();
								return false;
						}
						var username = $('#user').val();
						var password = $('#password').val();
						var salesProductPrice = $('#salesProductPrice').val();
						
						
						$.post("configs/ajax/checkout.customer.ajax.php",{'username':username,'password':password,'salesProductPrice':salesProductPrice},function(data){
							
							if(data['flag']==0){
								alert("Incorrect email or password");
							}else if(data['flag']==1){
								
								var user = data['user'];
								$('#username').val(user);
								$('#salesProductPrice').val(data['Price']);
								$('#fitOriginalPrice').val(data['Price']);
								$('#fitDiscountedPrice').html(data['Price']);
								/*
								$('#uss').html(user);
								$('#balance').html(data['balance']);
								$('#integral').html(data['integral']);	
								*/
								$('#tab11').hide();

								
								$('#welcome').html("<div class='huanyin'><font color='#ff9900' ><b>"+ user +"</b></font><br />You are welcome here, members will enjoy more  ... </div>");
								

								
								
							}else if(data['flag']==2){
								alert("This user is pending, please wait for a moment");
							}
							
						},"json");		
						
						$.post("../configs/ajax/checkout.customer.ajax.php",{'username':username,'password':password,'salesProductPrice':salesProductPrice},function(data){
													
							if(data['flag']==0){
								alert("Incorrect email or password");
							}else if(data['flag']==1){
								
								var user = data['user'];
								$('#username').val(user);
								$('#salesProductPrice').val(data['Price']);
								$('#fitOriginalPrice').val(data['Price']);
								$('#fitDiscountedPrice').html(data['Price']);
								
								/*
								$('#uss').html(user);
								$('#balance').html(data['balance']);
								$('#integral').html(data['integral']);								
								*/
								$('#tab11').hide();
								
								$('#welcome').html("<div class='huanyin'><font color='#ff9900' > <b>" + user + "</b> </font><br />You are welcome here, members will enjoy more  ... </div>");
								
							}else if(data['flag']==2){
								alert("This user is pending, please wait for a moment");
							}
							
						},"json");
						
				});
		});
})(jQuery)



function getClientTimeZone(){
   var d, tz, s = "GMT ";
   d = new Date();
   tz = d.getTimezoneOffset();
   if (tz < 0)
      s += "+" + Math.abs(tz / 60);
   else if (tz == 0)
      s += "GMT";
   else
      s += "-" + Math.abs(tz / 60);
   return s;
}
