function setCookie(name,value,exp){if(exp!=null){document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();}else{document.cookie = name + "="+ escape (value);}}
function getCookie(name){var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg)){return unescape(arr[2]);}else{return null};}
function delCookie(name) {var exp = new Date();exp.setTime(exp.getTime() - 1);var cval=getCookie(name);if(cval!=null){document.cookie= name + "="+cval+";expires="+exp.toGMTString();}}
function Map(){
this.elements = new Array();
this.size = function(){return this.elements.length;}
this.isEmpty = function(){return (this.elements.length < 1);}
this.clear = function(){this.elements = new Array();}
this.put = function(_key, _value){this.elements.push({key:_key, value:_value});}
this.remove = function(_key){var bln = false;try{for (i = 0; i < this.elements.length; i++){if(this.elements[i].key == _key){this.elements.splice(i, 1);return true;}}}catch(e){bln = false;}return bln;}
this.get = function(_key){try{for (i = 0; i < this.elements.length; i++){if (this.elements[i].key == _key){return this.elements[i].value;}}}catch(e) {return null;}}
this.element = function(_index){if (_index < 0 || _index >= this.elements.length){return null;}return this.elements[_index];}
this.containsKey =function(_key){var bln = false;try {for (i = 0; i < this.elements.length; i++){if (this.elements[i].key == _key){bln = true;}}}catch(e){bln = false;}return bln;}
this.containsValue = function(_value){var bln = false;try{for(i = 0; i < this.elements.length; i++){if (this.elements[i].value == _value){bln = true;}}}catch(e){bln = false;}return bln;}
this.values = function(){var arr = new Array();for(i = 0; i < this.elements.length; i++){arr.push(this.elements[i].value);}return arr;}
this.keys = function(){var arr = new Array();for(i = 0; i < this.elements.length; i++){arr.push(this.elements[i].key);}return arr;}}

function AlertMsg(title,content,msgw,msgh){
var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg;
//弹出窗口设置
if (!msgw) msgw = 300;		//默认宽度
if (!msgh) msgh = 200;		//默认高度
msgbg = "#FFF";				//内容背景
msgcolor = "#000";			//内容颜色
bordercolor = "#000";		//边框颜色
titlecolor = "#000";		//标题颜色
titlebg = "#D9F2B9";			//标题背景
//遮罩背景设置
var sWidth,sHeight;
sWidth = document.documentElement.clientWidth;
if(document.documentElement.clientHeight > document.body.scrollHeight){
	sHeight = document.documentElement.clientHeight;	//少于一屏
}else{
	sHeight = document.documentElement.scrollHeight;	//多于一屏
}
//创建遮罩背景
var maskObj = document.createElement("div");
maskObj.setAttribute('id','maskdiv');
maskObj.style.position = "absolute";
maskObj.style.top = "0";
maskObj.style.left = "0";
maskObj.style.background = "#777";
maskObj.style.filter = "Alpha(opacity=30);";
maskObj.style.opacity = "0.3";
maskObj.style.width = sWidth + "px";
maskObj.style.height = sHeight + "px";
maskObj.style.zIndex = "10000";
document.body.appendChild(maskObj);
//创建弹出窗口
var msgObj = document.createElement("div")
msgObj.setAttribute("id","msgdiv");
msgObj.style.position ="absolute";
msgObj.style.top = (document.documentElement.clientHeight - msgh) / 2 + "px";
msgObj.style.left = (document.documentElement.clientWidth - msgw) / 2 + "px";
msgObj.style.width = msgw + "px";
//msgObj.style.height = msgh + "px";
msgObj.style.fontSize = "12px";
msgObj.style.background = msgbg;
msgObj.style.border = "1px solid " + bordercolor;
msgObj.style.zIndex = "10001";
//创建标题
var thObj = document.createElement("div");
thObj.setAttribute("id","msgth");
thObj.className = "DragAble";
//thObj.title = "按住鼠标左键可以拖动窗口！";
//thObj.style.cursor = "move";
thObj.style.padding = "6px";
thObj.style.color = titlecolor;
thObj.style.background = titlebg;
thObj.style.textAlign = "left";
var titleStr = "<a style='float:right;cursor:pointer;color:#ff0000' title='Close' onclick='CloseMsg();'>关闭</a>"+"<span>"+ title +"</span>";
thObj.innerHTML = titleStr;
//创建内容
var bodyObj = document.createElement("div");
bodyObj.setAttribute("id","msgbody");
bodyObj.style.padding = "10px";
bodyObj.style.lineHeight = "1.5em";
bodyObj.style.textAlign = "left";
bodyObj.innerHTML = content;
//生成窗口
document.body.appendChild(msgObj);
ge("msgdiv").appendChild(thObj);
ge("msgdiv").appendChild(bodyObj);
}
function ge(e){return document.getElementById(e);}
function CloseMsg(){
document.body.removeChild(ge("maskdiv"));
ge("msgdiv").removeChild(ge("msgth"));
ge("msgdiv").removeChild(ge("msgbody"));
document.body.removeChild(ge("msgdiv"));
}
