text: 	var deliveryInfo={
  	  "desc":{
  	  	"name_en": "The selected area distribution day is ",
  	    "name_cn": "所选地区送货日为",
  	    "name": "所選地區送货日為"
  	  },
  	  "Order": {
  	    "Order_ASC": {
  	      "name_en": "Every ",
  	      "name_cn": "逢",
  	      "name": "逢"
  	    },
  	    "Order_DESC": {
  	      "name_en": "The Last ",
  	      "name_cn": "每月最后",
  	      "name": "每月最後"
  	    }
  	  },
  	  "week": {
  	    "name_en": " ",
  	    "name_cn": "星期",
  	    "name": "星期"
  	  },
  	  "weekday": {
  	    "1": {
  	      "name_en": "Mon",
  	      "name_cn": "一",
  	      "name": "一"
  	    },
  	    "2": {
  	      "name_en": "Tues",
  	      "name_cn": "二",
  	      "name": "二"
  	    },
  	    "3": {
  	      "name_en": "Wed",
  	      "name_cn": "三",
  	      "name": "三"
  	    },
  	    "4": {
  	      "name_en": "Thurs",
  	      "name_cn": "四",
  	      "name": "四"
  	    },
  	    "5": {
  	      "name_en": "Fri",
  	      "name_cn": "五",
  	      "name": "五"
  	    },
  	    "6": {
  	      "name_en": "Sat",
  	      "name_cn": "六",
  	      "name": "六"
  	    },
  	    "7": {
  	      "name_en": "Sun",
  	      "name_cn": "日",
  	      "name": "日"
  	    }
  	  }
  	};
  	var provinceList=[
    {
      "name": "港島",
      "translate": "港島",
      "id": 1,
      "sub": [
        {
          "name": "東區",
          "translate": "東區",
          "id": 1,
          "sub": [
            {
              "name": "北角",
              "translate": "北角",
              "id": 1,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "天后",
              "translate": "天后",
              "id": 2,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "鰂魚涌",
              "translate": "鰂魚涌",
              "id": 3,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "太古",
              "translate": "太古",
              "id": 4,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "西灣河",
              "translate": "西灣河",
              "id": 5,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "筲簊灣",
              "translate": "筲簊灣",
              "id": 6,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "小西灣",
              "translate": "小西灣",
              "id": 7,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "杏花邨",
              "translate": "杏花邨",
              "id": 8,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "柴灣",
              "translate": "柴灣",
              "id": 9,
              "weekday": 48927,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "中西區",
          "translate": "中西區",
          "id": 2,
          "sub": [
            {
              "name": "堅尼地城",
              "translate": "堅尼地城",
              "id": 1,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "石塘咀",
              "translate": "石塘咀",
              "id": 2,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "西營盤",
              "translate": "西營盤",
              "id": 3,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "上環",
              "translate": "上環",
              "id": 4,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "中環",
              "translate": "中環",
              "id": 5,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "金鐘",
              "translate": "金鐘",
              "id": 6,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "山頂",
              "translate": "山頂",
              "id": 7,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "西環",
              "translate": "西環",
              "id": 8,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "薄扶林",
              "translate": "薄扶林",
              "id": 9,
              "weekday": 48907,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "灣仔區",
          "translate": "灣仔區",
          "id": 3,
          "sub": [
            {
              "name": "灣仔",
              "translate": "灣仔",
              "id": 1,
              "weekday": 48917,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "銅鑼灣",
              "translate": "銅鑼灣",
              "id": 2,
              "weekday": 48917,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "砲台山",
              "translate": "砲台山",
              "id": 3,
              "weekday": 48917,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "跑馬地",
              "translate": "跑馬地",
              "id": 4,
              "weekday": 48917,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "大坑",
              "translate": "大坑",
              "id": 5,
              "weekday": 48917,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "南區",
          "translate": "南區",
          "id": 4,
          "sub": [
            {
              "name": "香港仔",
              "translate": "香港仔",
              "id": 1,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "黃竹坑",
              "translate": "黃竹坑",
              "id": 2,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "鴨利洲",
              "translate": "鴨利洲",
              "id": 3,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "數碼港",
              "translate": "數碼港",
              "id": 4,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "淺水灣",
              "translate": "淺水灣",
              "id": 5,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "赤柱",
              "translate": "赤柱",
              "id": 6,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            }
          ]
        }
      ]
    },
    {
      "name": "九龍",
      "translate": "九龍",
      "id": 2,
      "sub": [
        {
          "name": "油尖旺",
          "translate": "油尖旺",
          "id": 1,
          "sub": [
            {
              "name": "尖沙咀",
              "translate": "尖沙咀",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "油麻地",
              "translate": "油麻地",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "旺角",
              "translate": "旺角",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "旺角東",
              "translate": "旺角東",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "太子",
              "translate": "太子",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "大角咀",
              "translate": "大角咀",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "佐敦",
              "translate": "佐敦",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "柯士甸",
              "translate": "柯士甸",
              "id": 8,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "尖東",
              "translate": "尖東",
              "id": 9,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "深水埗",
          "translate": "深水埗",
          "id": 2,
          "sub": [
            {
              "name": "美孚",
              "translate": "美孚",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "荔枝角",
              "translate": "荔枝角",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "長沙灣",
              "translate": "長沙灣",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "深水埗",
              "translate": "深水埗",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "石硤尾",
              "translate": "石硤尾",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "昂船州",
              "translate": "昂船州",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "南昌",
              "translate": "南昌",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "九龍城",
          "translate": "九龍城",
          "id": 3,
          "sub": [
            {
              "name": "紅磡",
              "translate": "紅磡",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "土瓜灣",
              "translate": "土瓜灣",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "馬頭角",
              "translate": "馬頭角",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "馬頭圍",
              "translate": "馬頭圍",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "啟德",
              "translate": "啟德",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "九龍城",
              "translate": "九龍城",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "何文田",
              "translate": "何文田",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "九龍塘",
              "translate": "九龍塘",
              "id": 8,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "筆架山",
              "translate": "筆架山",
              "id": 9,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "黃大仙",
          "translate": "黃大仙",
          "id": 4,
          "sub": [
            {
              "name": "新蒲崗",
              "translate": "新蒲崗",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "黃大仙",
              "translate": "黃大仙",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "東頭",
              "translate": "東頭",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "橫頭磡",
              "translate": "橫頭磡",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "樂富",
              "translate": "樂富",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "鑽石山",
              "translate": "鑽石山",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "慈雲山",
              "translate": "慈雲山",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "牛池灣",
              "translate": "牛池灣",
              "id": 8,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "觀塘",
          "translate": "觀塘",
          "id": 5,
          "sub": [
            {
              "name": "彩虹",
              "translate": "彩虹",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "九龍灣",
              "translate": "九龍灣",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "牛頭角",
              "translate": "牛頭角",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "觀塘",
              "translate": "觀塘",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "秀茂坪",
              "translate": "秀茂坪",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "藍田",
              "translate": "藍田",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "油塘",
              "translate": "油塘",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "鯉魚門",
              "translate": "鯉魚門",
              "id": 8,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "葵全青",
          "translate": "葵全青",
          "id": 6,
          "sub": [
            {
              "name": "葵涌",
              "translate": "葵涌",
              "id": 1,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "青衣",
              "translate": "青衣",
              "id": 2,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "荃灣",
              "translate": "荃灣",
              "id": 3,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "大窩口",
              "translate": "大窩口",
              "id": 4,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "葵興",
              "translate": "葵興",
              "id": 5,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "葵芳",
              "translate": "葵芳",
              "id": 6,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "荔景",
              "translate": "荔景",
              "id": 7,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "荃灣西",
              "translate": "荃灣西",
              "id": 8,
              "weekday": 48959,
              "times": "*",
              "weight": "*"
            }
          ]
        }
      ]
    },
    {
      "name": "新界",
      "translate": "新界",
      "id": 3,
      "sub": [
        {
          "name": "北區",
          "translate": "北區",
          "id": 1,
          "sub": [
            {
              "name": "上水",
              "translate": "上水",
              "id": 1,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "粉嶺",
              "translate": "粉嶺",
              "id": 2,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "聯合墟",
              "translate": "聯合墟",
              "id": 3,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "石湖墟",
              "translate": "石湖墟",
              "id": 4,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "沙頭角",
              "translate": "沙頭角",
              "id": 5,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "大埔",
          "translate": "大埔",
          "id": 2,
          "sub": [
            {
              "name": "大埔墟",
              "translate": "大埔墟",
              "id": 1,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "大埔",
              "translate": "大埔",
              "id": 2,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "太和",
              "translate": "太和",
              "id": 3,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "沙田",
          "translate": "沙田",
          "id": 3,
          "sub": [
            {
              "name": "大學",
              "translate": "大學",
              "id": 1,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "沙田",
              "translate": "沙田",
              "id": 2,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "大圍",
              "translate": "大圍",
              "id": 3,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "火炭",
              "translate": "火炭",
              "id": 4,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "馬料水",
              "translate": "馬料水",
              "id": 5,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "烏溪沙",
              "translate": "烏溪沙",
              "id": 6,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "馬鞍山",
              "translate": "馬鞍山",
              "id": 7,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "第一城",
              "translate": "第一城",
              "id": 8,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "石門",
              "translate": "石門",
              "id": 9,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "沙田圍",
              "translate": "沙田圍",
              "id": 10,
              "weekday": 48905,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "屯門/元朗",
          "translate": "屯門/元朗",
          "id": 4,
          "sub": [
            {
              "name": "屯門",
              "translate": "屯門",
              "id": 1,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "元朗",
              "translate": "元朗",
              "id": 2,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "天水圍",
              "translate": "天水圍",
              "id": 3,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "錦上路",
              "translate": "錦上路",
              "id": 4,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "洪水橋",
              "translate": "洪水橋",
              "id": 5,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "流浮山",
              "translate": "流浮山",
              "id": 6,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "落馬洲",
              "translate": "落馬洲",
              "id": 7,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "朗屏",
              "translate": "朗屏",
              "id": 8,
              "weekday": 48898,
              "times": "*",
              "weight": "*"
            }
          ]
        },
        {
          "name": "西貢",
          "translate": "西貢",
          "id": 5,
          "sub": [
            {
              "name": "調景嶺",
              "translate": "調景嶺",
              "id": 1,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "將軍澳",
              "translate": "將軍澳",
              "id": 2,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "坑口",
              "translate": "坑口",
              "id": 3,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "寶琳",
              "translate": "寶琳",
              "id": 4,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "清水灣",
              "translate": "清水灣",
              "id": 5,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "西貢",
              "translate": "西貢",
              "id": 6,
              "weekday": 48912,
              "times": "*",
              "weight": "*"
            }
          ]
        }
      ]
    },
    {
      "name": "大嶼山",
      "translate": "大嶼山",
      "id": 4,
      "sub": [
        {
          "name": "東涌",
          "translate": "東涌",
          "id": 1,
          "sub": [
            {
              "name": "機場",
              "translate": "機場",
              "id": 1,
              "weekday": 16644,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "博覽館",
              "translate": "博覽館",
              "id": 2,
              "weekday": 16644,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "東涌",
              "translate": "東涌",
              "id": 3,
              "weekday": 16644,
              "times": "*",
              "weight": "*"
            },
            {
              "name": "欣澳",
              "translate": "欣澳",
              "id": 4,
              "weekday": 16644,
              "times": "*",
              "weight": "*"
            }
          ]
        }
      ]
    }
  ];
  	function checkweekday(val){
  		var high= val >> 8;
  		var low= val & 0xff;
  		var weekdays=[];
  		var weeks=[];
  		var text="";
  		var order="";
  		var week="";
  		var weekday=[];
  		var code="";
  		if(getCookie('lang_code')){
  			var code="_"+getCookie('lang_code');
  		}
  		
  		if(deliveryInfo["week"]["name"+code]){
  			week=deliveryInfo["week"]["name"+code];
  		}else{
  			week=deliveryInfo["week"]["name"];
  		}
  		for(var i=7,j=1;i>0;--i,++j){
  			
  			if((low & 1)){
  				weekdays.push(j);
  				if(deliveryInfo["weekday"][j]["name"+code]){
  					weekday.push(deliveryInfo["weekday"][j]["name"+code]);
  				}else{
  					weekday.push(deliveryInfo["weekday"][j]["name"]);
  				}
  			
  			}
  			low=low>>1;
  			if((high & 1)){
  				weeks.push(j);
  				if(j==7){
  					
  					if(deliveryInfo["Order"]["Order_DESC"]["name"+code]){
  						order=deliveryInfo["Order"]["Order_DESC"]["name"+code];
  					}else{
  						order=deliveryInfo["Order"]["Order_DESC"]["name"];
  					}
  				}
  				
  			}else{
  				if(j==7){
  					
  					if(deliveryInfo["Order"]["Order_ASC"]["name"+code]){
  						order=deliveryInfo["Order"]["Order_ASC"]["name"+code];
  					}else{
  						order=deliveryInfo["Order"]["Order_ASC"]["name"];
  					}
  				}
  			}
  			high=high>>1;
  		}
  		if(deliveryInfo["desc"]["name"+code]){
  			desc=deliveryInfo["desc"]["name"+code];
  		}else{
  			desc=deliveryInfo["desc"]["name"];
  		}
  		text=desc+order+week+weekday.join(',');
  		//console.log(text);
  		return {"weekdays":weekdays,"weeks":weeks,"text":text};
  	}
  	function doPost(to, p) { // to:提交动作（action）,p:参数
  	    var myForm = document.createElement("form");
  	    myForm.method = "post";
  	    myForm.action = to;
  	    for (var i in p){
  	        var myInput = document.createElement("input");
  	        myInput.setAttribute("name", i); // 为input对象设置name
  	        myInput.setAttribute("value", p[i]); // 为input对象设置value
  	        myForm.appendChild(myInput);
  	    }
  	    document.body.appendChild(myForm);
  	    myForm.submit();
  	    document.body.removeChild(myForm); // 提交后移除创建的form
  	}
  	function setCookie(cname, cvalue, exdays) {
  			var d = new Date();
  			d.setTime(d.getTime() + (exdays*24*60*60*1000));
  			var expires = "expires="+ d.toUTCString();
  			document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  		} 
  	function getCookie(cname) {
  		var name = cname + "=";
  		var decodedCookie = decodeURIComponent(document.cookie);
  		var ca = decodedCookie.split(';');
  		for(var i = 0; i <ca.length; i++) {
  			var c = ca[i];
  			while (c.charAt(0) == ' ') {
  				c = c.substring(1);
  			 }
  			 if (c.indexOf(name) == 0) {
  				return c.substring(name.length, c.length);
  			 }
  		 }
  		return "";
  	} 
      
  	 
  	 function datedone(value, date){
  	 	//获取允许周期
  	 	$weekday=$('#weekday').val();
  	 	
  	 	test=checkweekday($weekday);
  	 	weeks=test['weeks'];
  	 	weekdays=test['weekdays'];
  	 	
  	 	//判断当前选择日期是否属于允许日期星期几
  	 	dates=new Date(date.year,date.month-1,date.date);
  	 	
  	 	day=dates.getDay(0);
  	    if(day==0){
  	    	day=7;
  	    }
  	    //判断第几周
  	    demoweek=getMonthWeek(date.year,date.month,date.date);
  	   
  	    //判断星期
  	    if(weekdays.indexOf(day)<0){
  	    	//判断是否是所有周都可以
  	    	
  	    	$.alert(test.text);	
  	    	$('#isday').val('false');
  	    	$('#date_warm').val(test.text);
  	    	return false;
  	    	
  	    }
  	    if(weeks.indexOf(8) >-1 ){
  	    	
  		    	if(weeks.indexOf(demoweek.getWeek)<0){
  		    		$.alert(test.text);	
  			    	$('#isday').val('false');
  			    	$('#date_warm').val(test.text);
  			    	return false;
  		    	}
  	    	
  	    }
  	    
  	    if(weeks.indexOf(7) >-1 ){
  	    	$x=getWeeks(date.year,date.month);
  	    	 //最后一天星期几
  	    	lastDay=lastDayOfTheMonth(date.year,date.month);
  	    	
  	    	if(lastDay<day){
  				
  	    		if(weeks.indexOf($x-demoweek.getWeek)>-1){
  		    		
  		    	}else{
  					$.alert(test.text);	
  			    	$('#isday').val('false');
  			    	$('#date_warm').val(test.text);
  			    	return false;
  				}
  	    	}else{
  	    		
  		    	if(weeks.indexOf(($x-demoweek.getWeek+1))>-1){
  		    		
  		    	}else{
  					$.alert(test.text);	
  			    	$('#isday').val('false');
  			    	$('#date_warm').val(test.text);
  			    	return false;
  				}
  	    	}
  	    }
  	    
  	    	if(($weekday >> 16)&1){
  	    		var shippingdate=value;
  	    		if( $("input[name='address_id']:checked").val()){
  					
  					var country=$("input[name='address_id']:checked").data('country');
  					var state=$("input[name='address_id']:checked").data('state');
  					var city=$("input[name='address_id']:checked").data('city');
  					
  				}else{
  					var country=$("#province").val();
  					var state=$("#city").val();
  					var city=$("#district").val();
  				}
  				$.post(
  					"/mytest/customer/test",
  					{'country':country,'state':state,'city':city,'shipping_date':shippingdate}
  					,function(data){
  						if(data.status!='success'){
  							$.alert(data.content);
  							return false;
  						}else{
  							return true;
  						}
  					},'json');
  	    	}
  	    	$('#isday').val('true');
  	    	return true;
  		
  	}
  	function getRecentDay(day){
          var today = new Date();
          var tYear = today.getFullYear();
          var tMonth = today.getMonth()+1;
          var tDate = today.getDate()+1;
          
          return tYear+"-"+tMonth+"-"+tDate;
      }
  	function getMonthWeek(a, b, c) {
          /**
          * a = d = 当前日期
          * b = 6 - w = 当前周的还有几天过完(不算今天)
          * a + b 的和在除以7 就是当天是当前月份的第几周
          */
  		var date = new Date(a, parseInt(b) - 1, 1),
              w1 = date.getDay();
  		var counts=0;
  		if(w1==0){
  			counts=1;
  		}
          var date = new Date(a, parseInt(b) - 1, c),
              w = date.getDay(),
              d = date.getDate();
          if(w==0){
              w=7;
          }
  		
          var config={
              getMonth:date.getMonth()+1,
              getYear:date.getFullYear(),
              getWeek:counts+Math.ceil((d + 6 - w) / 7),
          }
          return config;
      };
      function getWeeks(year,month) {
          /*var d = new Date();
          // 该月第一天
          d.setFullYear(year, month-1, 1);
          console.log(d);
          var w1 = d.getDay();
          console.log(w1);
          if (w1 == 0) w1 = 7;
          // 该月天数
          d.setFullYear(year, month, 1);
          var dd = d.getDay();
          console.log(dd);
          // 第一个周一
          let d1;
          if (w1 != 1) d1 = 7 - w1 + 2;
          else d1 = 1;
          let week_count = Math.ceil((dd-d1+1)/7);
          
          return week_count;*/
          //当月有几天
          $count=get_day(year,month);
  		$demo=getMonthWeek(year,month,$count);
          
          return $demo.getWeek;
          
      }
      function get_day( $year,$month )   
  
  	{
  		let arr=[1 , 3 , 5 , 7 , 8 , 01 , 03 , 05 , 07 , 08 , 10 , 12];
  	    if(arr.indexOf($month)>-1)
  	
  	    {
  	
  	        $text =31;
  	
  	    }
  	
  	    else if( $month == 2 )
  	
  	    {
  	
  	        if ( $year%400 == 0  || ($year%4 == 0 && $year%100 !== 0) )        //判断是否是闰年
  	
  	        {
  	
  	            $text = 29;
  	
  	        }
  	
  	        else{
  	
  	            $text = 28;
  	
  	        }
  	
  	    }
  	
  	    else{
  	
  	        $text =30;
  	
  	    }
  	
  	    return $text;
  	
  	}
      function lastDayOfTheMonth(year,month){
      	var firstDayOfTheMonth = (new Date(year, month, 1)).getDay();
      	if(firstDayOfTheMonth==0){
      		firstDayOfTheMonth=7;
      	}
      	if(firstDayOfTheMonth==1){
      		firstDayOfTheMonth=8;
      	}
      	return firstDayOfTheMonth-1;
      }
  $(document).ready(function(){
  	
      $("img.lazy").each(function(){
          src = $(this).attr("data-src");
          $(this).attr("src",src);
      });
     
      $(document).on('click','.open-menu', function () {
  	  $.popup('#panel-left-menu');
  	});
  	
         /* $("#city-picker").cityPicker({
              toolbarTemplate: '<header class="bar bar-nav">\
              <button class="button button-link pull-right close-picker">确定</button>\
              <h1 class="title">选择所在地址</h1>\
              </header>',
              date: '#date',//省输入框,一般都是隐藏的，获取身份ID
              city: '#city', //城市输入框，一般都是隐藏的，获取城市ID
  			district: '#district' //城市输入框，一般都是隐藏的，获取城市ID
          });*/
      
      
  });
  