function validatePaymentInfo()
{
	//Billing Address Validation
	if(obj.b_first_name.value == "")
	{
		alert("Please enter your First Name in Billing Information.");
		obj.b_first_name.focus();
		return false;
	}
	if(obj.b_last_name.value == "")
	{
		alert("Please enter your Last Name in Billing Information.");
		obj.b_last_name.focus();
		return false;
	}
	if(obj.b_address.value == "")
	{
		alert("Please enter the Address in Billing Information.");
		obj.b_address.focus();
		return false;
	}
	if(obj.b_city.value == "")
	{
		alert("Please enter the City in Billing Information.");
		obj.b_city.focus();
		return false;
	}
	if(obj.b_zip.value == "")
	{
		alert("Please enter the Zip in Billing Information.");
		obj.b_zip.focus();
		return false;
	}
	
	if(obj.b_state.selectedIndex == 0 || obj.b_state.selectedIndex == 52)
	{
		alert("Please select a US or Canada State in Billing Information.");
		obj.b_state.focus();
		return false;
	}	
	if(obj.password.value == "")
	{
		alert("Please enter the Password For further login.");
		obj.password.focus();
		return false;
	}	
	if(obj.email.value == "")
	{
		alert("Please enter the Email in Billing Information.");
		obj.email.focus();
		return false;
	}
	if(!chkEmail(obj.email.value))
	{
		alert("Please enter a valid Email Address in Billing Information.");
		obj.email.focus();
		obj.email.select();
		return false;
	}
	if(obj.b_phone.value == "")
	{
		alert("Please enter the Phone Number in Billing Information.");
		obj.b_phone.focus();
		return false;
	}	
	if(!chkPhone(obj.b_phone.value))
	{
		alert("Please enter a valid Phone Number.\nFormat should be XXX-XXX-XXXX.");
		obj.b_phone.focus();
		obj.b_phone.select();
		return false;
	}		
	if(obj.cc_type.selectedIndex == 0)
	{
		alert("Please select Credit Card Type.");
		obj.cc_type.focus();
		return false;
	}
	if(obj.cc_num.value == '')
	{
		alert("Please enter Credit Card #.");
		obj.cc_num.focus();
		return false;
	}
	if(obj.cc_num.value.length < 15)
	{
		alert("Invalid Credit Card Number.\nPlease check and enter a valid Credit Card Number.");
		obj.cc_num.focus();
		obj.cc_num.select();
		return false;
	}
	if(obj.exp_month.selectedIndex == 0)
	{
		alert("Please select Expiration Month.");
		obj.exp_month.focus();
		return false;
	}
	if(obj.exp_year.selectedIndex == 0)
	{
		alert("Please select Expiration Year.");
		obj.exp_year.focus();
		return false;
	}
	if(obj.exp_year.value == currYear)
	{
		if(obj.exp_month.selectedIndex < currMonth)
		{
			alert("The Credit Card has already expired.\nPlease enter a valid Expiration Date.");
			obj.exp_month.focus();
			return false;
		}
	}
	if(obj.security_code.value == "")
	{
		alert("Please enter the Security Code.");
		obj.security_code.focus();
		return false;
	}
	return true;
}

//Display Security Code help window
function showWindow(fName)
{
	window.open(fName, '', 'width=500,height=560,left=200,scrollbars=0,top=30,toolbar=0,menubar=0,location=0');
}

function allowNumberOnly(evt)
{
	var charCode = (evt.which) ? evt.which : evt.keyCode;
	if(charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}

//Gets customer info - by AJAX call
function getInfo()
{

	if(obj.old_email.value == "")
	{
		alert("Please enter your Email Address.");
		obj.old_email.focus();
		return;
	}
	if(!chkEmail(obj.old_email.value))
	{
		alert("Please enter a valid Email Address.");
		obj.old_email.focus();
		obj.old_email.select();
		return;
	}
	if(obj.old_password.value == "")
	{
		alert("Please enter your Password.");
		obj.old_password.focus();
		return;
	}
	alert("Please wait while we fetch your information from our database.");
	$('#loader_blk')[0].innerHTML = '<img src="img/ajax-loader.gif" alt="Loader" style="vertical-align:middle"> Please wait...';
	var arrParam = new Array();
	arrParam['email'] = obj.old_email.value;
	arrParam['password'] = obj.old_password.value;

	$.ajax({
	   type: "GET",
	   data: "email="+obj.old_email.value+"&password="+obj.old_password.value+'&hash='+parseInt(Math.random() * 10000000000),
	   url: "/advertising/getcustomerinfo/",
	   success: function(retVal){

		    //Shows the effect
			if(retVal == 'FAILURE')
			{
				alert('Sorry we could not retrieve any records of this Email Address and Password.\nPlease check if you have entered the correct values and try again.');
				obj.old_email.focus();
				obj.old_email.select();
			}
			else if(retVal == 'BAD_PASSWORD')
			{
				alert("Invalid password! Please type the correct password.\nNote that the password is case-sensitive.");
				obj.old_password.focus();
				obj.old_password.select();
			}
			else
			{
				var arrTemp = retVal.split("~~");
				var arr_keys = arrTemp[0].split("|");				
				var arr_values = arrTemp[1].split("|");
				for(var i = 0; i<arr_keys.length-1; i++)
				  eval('obj.'+arr_keys[i]).value = arr_values[i];
				//Re-type password box
				obj.conf_password.value = obj.password.value;
			}
			$('#loader_blk')[0].innerHTML = '<a href="javascript:void(0)" onclick="javascript:getInfo()" value="Retrieve &raquo;" class="btn1">Retrieve &raquo;</a>';
	   }
    });
}
