﻿function $(n){return document.getElementById(n);}
function xmlHttp()
{var xmlhttp = null; 
if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); 
} else if (window.ActiveXObject) { 
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
} catch (e1) { 
try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
} catch (e2) { 
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
} } } 
return xmlhttp; 
}

function DataPost(method,urlstr,sendData){
var Ajax = new xmlHttp();
if(method.toLowerCase()=="get"){
Ajax.open("GET",urlstr+"?"+sendData,true);
Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
Ajax.send(null);
}
else
{
Ajax.open("POST",urlstr,true);
Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
Ajax.send(sendData);
}
}

function RequestText(Url,QueryString,Method,O,xmlHttp)
{
if(Method.toLowerCase() == "get"){
xmlHttp.open("GET",Url+QueryString,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(null);
}else{
xmlHttp.open("POST",Url,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(QueryString);}
xmlHttp.onreadystatechange = new Function("returnText("+O+")");
}
function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf(";",offset);
	if(endstr==-1)
		endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset,endstr));
}
function getCookie(name)
{
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while(i<clen)
	{
		var j=i+alen;
		if(document.cookie.toLowerCase().substring(i,j)==arg)
		return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if(i==0)
			break;
	}
	return null;
}
function createObject(Tag)//创建对象
{
	return document.createElement(Tag);
}
function createImage(src)
{
    var o = new Image();
    o.src = src;
    return o;
}
function appendObj(P,S)//插入对象
{
	P.appendChild(S);
}