<!--
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toGMTString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toGMTString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

$(document).ready(function(){
	$('.boxy').boxy();		/*弹出框*/
	//getArea_Province();		/*加载地区*/
});

/********二级菜单************/
function showMenu(para){
if(para == 1){
	$("#subNav").css("display","block");
	}else{
	$("#subNav").css("display","none");
	}
};

/********显示发票抬头************/
function showInvoice(){
	var state = $("#checkInvoice").attr('checked');
	if(state){
		$("#invoice").css("display","block");
	}else{
		$("#invoice").css("display","none");
	}
};

var domain = document.domain;

function checkOrder()
{
	var userName = $('#userName').val();
	var shipping_address = $('#shipping_address').val();
	var postCode = $('#postCode').val();
	var areaCode = $('#areaCode').val();
	var telNum = $('#telNum').val();
	var mobile = $('#mobile').val();
	
	var userNameLen = userName.length;
	var addressLen = shipping_address.length;
	
	if(userName == ''){
		Boxy.alert('请填写收货人姓名.',null,{title: '提示信息'});
		return false;
	}else {
		if(userNameLen >20){
			Boxy.alert('请正确填写收货人姓名,长度不超过20个字符.',null,{title: '提示信息'});
			return false;
			}
	}
	
	if(shipping_address == ''){
		Boxy.alert('请填写收货人详细地址.',null,{title: '提示信息'});
		return false;
	}else {
		if(addressLen >20){
			Boxy.alert('请正确填写收货地址,长度不超过20个字符.',null,{title: '提示信息'});
			return false;
			}
	}
	
	if(postCode != ''){
		var reg = /^[0-9]{6}$/;
		if(!reg.test(postCode)){
			Boxy.alert('请正确填写邮政编码.',null,{title: '提示信息'});
			return false;
		}
	}
	
	if(telNum == '' && mobile == ''){
		Boxy.alert('收货人固定电话和手机号码必须要填一个,以保证货物能准确送达.',null,{title: '提示信息'});
		return false;
	}else{
		if(telNum != ''){
			if(areaCode == ''){
				Boxy.alert('请填写固定电话区号.',null,{title: '提示信息'});
				return false;
			}else{
				var reg = /^[0-9]{3,4}$/;
				if(!reg.test(areaCode)){
					Boxy.alert('固定电话区号为3-4个数字.',null,{title: '提示信息'});
					return false;
				}
			}
			
			var reg = /^[0-9]{7,8}$/;
			if(!reg.test(telNum)){
				Boxy.alert('电话号码为7-8个数字.',null,{title: '提示信息'});
				return false;
			}
		}
		
		if(mobile != ''){
			var reg2 = /^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
			if(!reg2.test(mobile)){
				Boxy.alert('请正确填写收货人的手机号码.',null,{title: '提示信息'});
				return false;
			}
		}
		
	}
}

function clearCookies()
{
	//$.cookie('mobile',null, {expires: 1, path: '/', domain:domain});
}
//-->