﻿//=============================================== Cookies操作
SiteCookiesName = "fidw0Lk2Yf92";
function getCookie(name) {
  var cookies = document.cookie;
  var start = cookies.indexOf(name + '=');
  if (start == -1) return null;
  var len = start + name.length + 1;
  var end = cookies.indexOf(';',len);
  if (end == -1) end = cookies.length;
  return decodeURI(cookies.substring(len,end));
}
function GetUid()
{
	var re = new RegExp("uid\=([0-9]+)"); 
    if(getCookie(SiteCookiesName)) //已经登录
	{
		var uid = getCookie(SiteCookiesName).match(re)[1];
		return parseInt(uid);
	}
	else
	{
		return -1;
	}
}
function GetUsername()
{
	var re = new RegExp("username\=([^&]+)"); 
    if(getCookie(SiteCookiesName)) //已经登录
	{
		var username = getCookie(SiteCookiesName).match(re)[1];
		return username;
	}
	else
	{
		return "";
	}
}
//=============================================== Cookies操作