var objHttp = false;
/*
function KillError()
{
	return true;
}
window.onerror=KillError();
*/

function $(id)
{
	return document.getElementById(id);
}

function CreateXMLHttp()
{
	var objHttp = false;
	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		objHttp = new XMLHttpRequest();
		if (objHttp.overrideMimeType)
		{
			objHttp.overrideMimeType('text/xml');
		}
	}
	else if (window.ActiveXObject)
	{ // IE
		try
		{
			objHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				objHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{}
		}
	}
	return objHttp;
}


/*
// 创那httpRequest对象
var xmlHttp;
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
		return xmlHttp;
}
*/


// 通过httpRequest对象绑定数据
function bindValueByXmlHttp(strObject, strTagName, objXmlHttp)
{
	var strValue = "";
	try{
	strValue = objXmlHttp.getElementsByTagName(strTagName)[0].firstChild.nodeValue;
	}
	catch(err){
	strValue = "";
	}
	SetObjectInnerHtml(strObject, strValue);
}

// 读取httpRequest对象指定数据
function getValueByXmlHttp(strTagName, objXmlHttp)
{
	var strValue = "";
	try{
	strValue = objXmlHttp.getElementsByTagName(strTagName)[0].firstChild.nodeValue;
	}
	catch(err){
	strValue = "";
	}
	return strValue;
}

// 通过httpRequest对象绑定数据
function BindObjectInnerHtmlByXmlAttribute(strObject, objXmlDoc, strAttribute)
{
	var strValue = objXmlDoc.getAttribute(strAttribute);
	BindObjectInnerHtml(strObject, strValue);
}

// onchange时重新绑定第二级Select
function ReBindSecondLevelClass(strValue, strObjIDKey)
{
	if(strValue!="0")
	{
		var strSubClass = PUserServices.GetSubClassListString(strValue).value;
		var arrSubClass = strSubClass.split(',');
		var obj = document.getElementById(strObjIDKey)
		obj.length = 0;
		obj.length++;
		obj.options[0].selected=true;
		obj.options[0].value = strValue;
		obj.options[0].text = strValue;
		
		for(var i=1; i<=arrSubClass.length; i++)
		{
			obj.length++;
			obj.options[i].text = arrSubClass[i-1];
			var strValue = arrSubClass[i-1];
			strValue = strValue.substring(2, strValue.length)
			obj.options[i].value = strValue;
		}
	}
}
//绑定2级联动的Select
function Bind2LevelClass(strRootClassIDKey, str2SubClassIDKey, strValue)
{
	var arrValue = strValue.split("-")
	var objRootClass = document.getElementById(strRootClassIDKey);
	var objSubClass = document.getElementById(str2SubClassIDKey);
	objRootClass.value = arrValue[0];
	ReBindSecondLevelClass(arrValue[0], str2SubClassIDKey);
	objSubClass.value = arrValue[1];
}

// 重新设置图片大小
function ResizeImage(strObjIDKey, iWidth, iHeight)
{
	var obj = document.getElementById(strObjIDKey);

	if (obj.width>iWidth)
	{
		if (iWidth!=null && iWidth!=0)
		{
			obj.width = iWidth;
		}
	}

	if (obj.height>iHeight)
	{
		if (iHeight!=null && iHeight!=0)
		{
			obj.height = iHeight;
		}
	}
}

// 通过类别字符串绑定Select, 
// strObjIDKey 控件名称
// strItemTag 各Opation之间的分隔符
// strKeyValueTag 各Key, Value之间的分隔符
function BindSelectByListString(strListString, strObjIDKey, strItemTag, strKeyValueTag)
{
	var obj = document.getElementById(strObjIDKey)
	if (obj!=null)
	{
		var arrItem = strListString.split(strItemTag);
		obj.length = 0;
		for(var i=0; i<arrItem.length; i++)
		{
			obj.length++;
			if (strKeyValueTag!="" && strKeyValueTag!=null)
			{
					var arrKeyValue = arrItem[i].split(strKeyValueTag);
					obj.options[i].text = arrKeyValue[0];
					obj.options[i].value = arrKeyValue[1];
			}
			else
			{
				obj.options[i].text = arrItem[i];
				obj.options[i].value = arrItem[i];
			}
		}
	}
}

function GetObjectChecked(strObj)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		return obj.checked;
	}
	else
	{
		return false;
	}
}


function GetObjectInnerHtml(strObj)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		return obj.innerHTML;
	}
	else
	{
		return "";
	}
}

function GetObjectValue(strObj)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		return obj.value;
	}
	else
	{
		return "";
	}
}



function SetObjectValue(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		obj.value = strValue;
	}
}


function SetObjectInnerHtml(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		obj.innerHTML = strValue;
	}
}

function SetObjectHref(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		obj.href = strValue;
	}
}


function XmlString2HtmlString(strValue)
{
	strValue = strValue.replace(/&lt;br&gt;/g, "<BR>");
	return strValue;
}
															
// 绑定数据到对象.innerHtml
function BindObjectInnerHtml(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		obj.innerHTML = strValue;
	}
}

// 绑定数据到对象.value
function BindObjectChecked(strObj, bValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		if(bValue=="True")
		{
			obj.checked = true;
		}
		else
		{
			obj.checked = false;
		}

	}
}

// 绑定数据到对象.value
function BindObjectValue(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		obj.value = strValue;
	}
}

// 绑定数据到对象.value
function BindObjectValue4Xml(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		strValue = strValue.replace(/&lt;BR&gt;/gi, "<br>");
		strValue = strValue.replace(/\\r\\n/gi, "\r\n");
//		strValue = strValue.replace(/<BR>/gi, "\r\n");
		obj.value = strValue;
	}
}


// 绑定数据到对象.value
function BindObjectInnerHtml4Xml(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null)
	{
		strValue = strValue.replace(/&lt;BR&gt;/gi, "<br>");
		obj.innerHTML = FormatXml4Html(strValue);
	}
}

// 绑定数据到对象.value
function FormatXml4Html(strValue)
{
//	strValue = strValue.replace(/&lt;BR&gt;/gi, "<br>");
	strValue = strValue.replace(/\\\\r\\\\n/gi, "<br>");
	return strValue;
}

// 从Xml还原到text
function FormatXml2Text(strValue)
{
	strValue = strValue.replace(/&amp;/gi, "&");
	strValue = strValue.replace(/&quot;/gi, "\"");
	strValue = strValue.replace(/&gt;/gi, ">");
	strValue = strValue.replace(/&lt;/gi, "<");
	strValue = strValue.replace(/&#xD;/gi, "\r");
	strValue = strValue.replace(/&#xA;/gi, "\n");
	strValue = strValue.replace(/&nbsp;/gi, " ");

	return strValue;
}

// 绑定数据到对象.value
function BindObjectSrc(strObj, strValue)
{
	var obj = document.getElementById(strObj);
	if (obj!=null && strValue!="")
	{
		obj.src = strValue;
	}
}


// 从Hmtl字符串中分离javascript代码,并运行
function EvalScript(strValue)
{
//	alert(GetRegexString(strValue, 2));
eval(GetRegexString(strValue, 2));
}

// 通过Regex分离数据
function GetRegexString(strValue, strRegex, iRegexIndex)
{
	var re = new RegExp(strRegex, "gi");
	r = strValue.match(re);
	if (r!=null)
	{
		switch(iRegexIndex)
		{
			case 1 :
				return unescape(RegExp.$1);
			case 2 :
				return unescape(RegExp.$2);
			case 3 :
				return unescape(RegExp.$3);
		}
	}
	else
	{
		return "";
	}
}

// 通过Regex分离数据
function GetJavaScriptStringByRegex(strValue, iRegexIndex)
{
	var strRegex = "<SCRIPT([^>]*)>([^<]*)</SCRIPT>";
	var re = new RegExp(strRegex, "gi");
	r = strValue.match(re);
	if (r!=null)
	{
		switch(iRegexIndex)
		{
			case 1 :
				return unescape(RegExp.$1);
			case 2 :
				return unescape(RegExp.$2);
			case 3 :
				return unescape(RegExp.$3);
		}
	}
	else
	{
		return "";
	}
}

/*
// 标签页切换
//var iTabCount = 0;
function ShowTabPage(iTabIndex, iTabCount)
{
	var strTabStrip = "";
	var strTabPage = "";
	for(var i=1; i<=iTabCount; i++)
	{
		strTabStrip = "TabStrip" + i;
		strTabPage = "TabPage" + i;
		
		if (iTabIndex==i)
		{
			document.getElementById(strTabStrip).className = "TabStripStyle1";
			document.getElementById(strTabPage).style.display = "block";
		}
		else
		{
			document.getElementById(strTabStrip).className = "TabStripStyle2";
			document.getElementById(strTabPage).style.display = "none";
		}
	}
//	ResetIframeSize();
}
*/

function ShowTabPager(strGroupName, iTabIndex, iTabCount)
{
	var strTabStrip = "";
	var strTabPage = "";
	for(var i=1; i<=iTabCount; i++)
	{
		strTabStrip = strGroupName +"TabStrip"+ i;
		strTabPage = strGroupName +"TabPage"+ i;
		
		if (iTabIndex==i)
		{
			document.getElementById(strTabStrip).className = "active";
			document.getElementById(strTabPage).style.display = "block";
		}
		else
		{
			document.getElementById(strTabStrip).className = "other";
			document.getElementById(strTabPage).style.display = "none";
		}
	}
}

/*
function BindListPager(iPageIndex, iPageSize, iRecordCount, strPagePerfix)
{
	document.write ("共"+iRecordCount+"条 每页"+iPageSize+"条 第 ");
	var iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize + 1;

	document.write (" <select id=\"ListPager\" name=\"ListPager\" class=\"ListPager\" onChange=\"parent.location=this.options[this.selectedIndex].value\">");
	for(var i=1; i<=iPageCount; i++)
	{
		if(iPageIndex==i)
		{
			document.write ("<option value=\""+strPagePerfix+"_"+i+ ".aspx\" selected=\"selected\">"+i+"/"+iPageCount+"</option>");
		}
		else
		{
			document.write ("<option value=\""+strPagePerfix+"_"+i+ ".aspx\">"+i+"/"+iPageCount+"</option>");
		}
	}
//	<select id="ListPager" name="ListPager" class="ListPager" onChange="parent.location=this.options[this.selectedIndex].value">
	document.write ("</select> 页 ");

	if (iPageIndex>1)
	{
		document.write ("<a href=\""+strPagePerfix+"_"+(iPageIndex-1)+".aspx\">上一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">上一页</span> ");
	}
	
	if (iPageIndex<iPageCount)
	{
		document.write ("<a href=\""+strPagePerfix+"_"+(iPageIndex+1)+".aspx\">下一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">下一页</span> ");
	}
}
*/




function BindListPager(iPageIndex, iPageSize, iRecordCount, strPagePerfix)
{
	document.write ("共"+iRecordCount+"条 每页"+iPageSize+"条 第 ");
	var iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize + 1;

	document.write (" <select id=\"ListPager\" name=\"ListPager\" class=\"ListPager\" onChange=\"parent.location=this.options[this.selectedIndex].value\">");
	for(var i=1; i<=iPageCount; i++)
	{
		if(iPageIndex==i)
		{
			document.write ("<option value=\""+strPagePerfix+"_"+i+ ".html\" selected=\"selected\">"+i+"/"+iPageCount+"</option>");
		}
		else
		{
			document.write ("<option value=\""+strPagePerfix+"_"+i+ ".html\">"+i+"/"+iPageCount+"</option>");
		}
	}
//	<select id="ListPager" name="ListPager" class="ListPager" onChange="parent.location=this.options[this.selectedIndex].value">
	document.write ("</select> 页 ");

	if (iPageIndex>1)
	{
		document.write ("<a href=\""+strPagePerfix+"_"+(iPageIndex-1)+".html\">上一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">上一页</span> ");
	}
	
	if (iPageIndex<iPageCount)
	{
		document.write ("<a href=\""+strPagePerfix+"_"+(iPageIndex+1)+".html\">下一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">下一页</span> ");
	}
}






function BindListPagerForPager(iPageIndex, iPageSize, iRecordCount)
{
	var strLocation = window.location.href;
	strLocation = strLocation.replace(/http:\/\//g, "");
	
	var arrValue = strLocation.split('\/');
	strLocation = "";
	for(var i=0; i<arrValue.length-2; i++)
	{
		strLocation += "/" + arrValue[i];
	}
	strLocation = "http:/" +strLocation;

	document.write ("<div class='ListPagerForPager'>");

	var iPageCount = 0;
	if (iRecordCount % iPageSize==0)
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize;
	}
	else
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize + 1;
	}


	if (iPageIndex>1)
	{
		document.write ("<a href=\""+strLocation+"/"+(iPageIndex-1)+"/default.aspx\">上一页</a> ");
	}
	
	if (iPageIndex<iPageCount)
	{
		document.write ("<a href=\""+strLocation+"/"+(iPageIndex+1)+"/default.aspx\">下一页</a> ");
	}
	
	document.write ("</div>");

/*
var strLocation = window.location;
	alert(strLocation);
	var strLocation2 = strLocation;
	var strLocation2 = strLocation2.replace(/http/g, "");
	alert(strLocation2);
	return;
*/
	return;
}



function BindListPagerForRewrite(iPageIndex, iPageSize, iRecordCount)
{
	var strLocation = window.location.href;
	strLocation = strLocation.replace(/http:\/\//g, "");
	
	var arrValue = strLocation.split('\/');
	strLocation = "";
	for(var i=0; i<arrValue.length-2; i++)
	{
		strLocation += "/" + arrValue[i];
	}
	strLocation = "http:/" +strLocation;

	document.write ("<div class='ListPager'>");
	document.write ("共"+iRecordCount+"条 每页"+iPageSize+"条 第 ");
	
	var iPageCount = 0;
	if (iRecordCount % iPageSize==0)
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize;
	}
	else
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize + 1;
	}

	document.write (" <select id=\"ListPager\" name=\"ListPager\" class=\"ListPager\" onChange=\"parent.location=this.options[this.selectedIndex].value\">");

	for(var i=1; i<=iPageCount; i++)
	{
		if(iPageIndex==i)
		{
			document.write ("<option value=\""+strLocation+"/"+i+ "/default.aspx\" selected=\"selected\">"+i+"/"+iPageCount+"</option>");
		}
		else
		{
			document.write ("<option value=\""+strLocation+"/"+i+ "/default.aspx\">"+i+"/"+iPageCount+"</option>");
		}
	}
	document.write ("</select> 页 ");

	if (iPageIndex>1)
	{
		document.write ("<a href=\""+strLocation+"/"+(iPageIndex-1)+"/default.aspx\">上一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">上一页</span> ");
	}
	
	if (iPageIndex<iPageCount)
	{
		document.write ("<a href=\""+strLocation+"/"+(iPageIndex+1)+"/default.aspx\">下一页</a> ");
	}
	else
	{
		document.write ("<span class=\"NoAction\">下一页</span> ");
	}
	
	document.write ("</div>");

/*
var strLocation = window.location;
	alert(strLocation);
	var strLocation2 = strLocation;
	var strLocation2 = strLocation2.replace(/http/g, "");
	alert(strLocation2);
	return;
*/
	return;
}



function BindListPager2(iPageIndex, iPageCount, strPagePerfix)
{
	var objPageSelect = document.getElementById("ListPager")
	objPageSelect.length = 0;
	var i;

	for (i=1 ; i <= iPageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i-1].text = i+"/"+iPageCount;
		objPageSelect.options[i-1].value = strPagePerfix + "_" + i + ".aspx";
		if (iPageIndex == i)
		{
			objPageSelect[i-1].selected=true;
		}
	}
}

// 绑定分页代码中 Page 的下拉选框 用户于模版生成的列表页面
function BuildPageForTemplate(strPageCount, strPagePerfix)
{
	objPageSelect = document.getElementById("Page")
	objPageSelect.length=0;
	var i;

	for (i=0 ; i < strPageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i].text = i+1;
		objPageSelect.options[i].value = i+1;
		if (Page == (i+1))
		{
			objPageSelect[i].selected=true;
		}
	}
}

// 绑定分页代码中 Page 的下拉选框 用户于模版生成的列表页面
function BuildPageForAspxHtmlPager(p_iPageIndex, p_iPageCount, p_iAspxCount, p_strAspxUrl, p_strHtmlUrl)
{
	objPageSelect = document.getElementById("idPager")
	objPageSelect.length=0;
	var i;

	for (i=0 ; i < p_iPageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i].text = i+1;
		
		var strUrl = ((i+1)<=p_iAspxCount) ? p_strAspxUrl : p_strHtmlUrl ;
		strUrl = strUrl.replace(/\$pi\$/gi, (i+1));
		objPageSelect.options[i].value = strUrl;
		
		if (p_iPageIndex == (i+1))
		{
			objPageSelect[i].selected=true;
		}
	}
	
	var strObj = "p"+p_iPageIndex;
	try{
		var strValue = document.getElementById(strObj).innerHTML;
		document.getElementById(strObj).innerHTML = "["+strValue+"]";
	}
	catch(err){}

}

// 绑定分页代码中 Page 的下拉选框 用户于模版生成的列表页面
function BuildPageForAspxHtmlPagerMode2(p_iPageIndex, p_iPageCount, p_iAspxCount, p_strAspxUrl, p_strHtmlUrl)
{
	p_iPageIndex = p_iPageCount - p_iPageIndex + 1;
	objPageSelect = document.getElementById("idPager")
	objPageSelect.length=0;
	var i;

	for (i=1 ; i <= p_iPageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i-1].text = i;
		
		var strUrl = (i<=p_iAspxCount) ? p_strAspxUrl : p_strHtmlUrl ;
		if (i==1)
		{
			strUrl = strUrl.replace(/\$pi\$/gi, "index");
		}
		else
		{
			strUrl = strUrl.replace(/\$pi\$/gi, (p_iPageCount-i+1));
		}
		objPageSelect.options[i-1].value = strUrl;
	}

/*
		if (p_iPageIndex == (p_iPageCount-i+1))
		{
			objPageSelect[i-1].selected=true;
		}
*/

	objPageSelect[p_iPageCount - p_iPageIndex].selected=true;

	var strObj = "p"+ (p_iPageCount - p_iPageIndex + 1);
	try{
		var strValue = document.getElementById(strObj).innerHTML;
		document.getElementById(strObj).innerHTML = "["+strValue+"]";
	}
	catch(err){}

}



// 绑定分页代码中 Page 的下拉选框 用户于模版生成的列表页面
function BuildPageForMode3(p_iPageIndex, p_iPageCount, p_strUrl)
{
	objPageSelect = document.getElementById("idPager")
	objPageSelect.length=0;
	var i;

	for (i=0 ; i < p_iPageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i].text = i+1;
		
		var strUrl = p_strUrl;
		strUrl = strUrl.replace(/\$pi\$/gi, (i+1));
		objPageSelect.options[i].value = strUrl;
		
		if (p_iPageIndex == (i+1))
		{
			objPageSelect[i].selected=true;
		}
	}
	
	var strObj = "p"+p_iPageIndex;
	try{
		var strValue = document.getElementById(strObj).innerHTML;
		document.getElementById(strObj).innerHTML = "["+strValue+"]";
	}
	catch(err){}

}


// 读取.Net(C#)中设置的Cookies
function GetCSharpCookie(strKeyName, strKeyGroup)
{
	var strRegex = ""
	if (strKeyGroup!=null)
	{
		strRegex = strKeyGroup + "=[^;]*[&]?" + strKeyName + "=([^&;]*)(&|;|\s)"
	}
	else
	{
		strRegex = strKeyName + "=([^&;]*)(&|;)"
	}
//	alert(strRegex)
	var strCookie = document.cookie;
	var re = new RegExp(strRegex, "g");
	r = strCookie.match(re);
	if (r!=null)
	{
		return unescape(RegExp.$1);
	}
	else
	{
		return "";
	}
}

function GetASPCookie2(name)
{
	var search;
	
	search = name + "="
	offset = document.cookie.indexOf(search) 
	if (offset != -1)
	{
		offset += search.length ;
		end = document.cookie.indexOf("&", offset) ;
		if (end == -1)
		{
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(offset, end));
	}
	else
	{
		return "";
	}
}


//获得Cookie解码后的值
function GetCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

//设定Cookie值
/*
function SetCookie(name, value)
{
	var expdate = new Date();
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
//	var domain = (argc > 4) ? argv[4] : null;
	var domain = "pet67.com";
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
	+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
	+((secure == true) ? "; secure" : "");
}
*/

/*
function SetCookie(name, value, expires, path, domain, secure)
{ 
	document.cookie= name + "=" + escape(value) + 
	((expires) ? "; expires=" + expires.toGMTString() : "") + 
	((path) ? "; path=" + path : "") + 
	((domain) ? "; domain=" + domain : "") + 
	((secure) ? "; secure" : "");
} 


//删除Cookie
function DelCookie(name)
{
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}

//获得Cookie的原始值
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.substring(i, j) == arg)
		return GetCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}
*/

/*
function SetCookie(name,value)
{
	var Days = 30; //此 cookie 将被保存 30 天
	var exp?= new Date();?//new Date("December 31, 9998");
	exp.setTime(exp.getTime() + Days*24*60*60*1000);
	document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString() + ";path=/";
}
function GetCookie(name)
{
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr != null) return unescape(arr[2]); 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 GetCookie( name )
{ 
	var start = document.cookie.indexOf( name + "=" ); 
	var len = start + name.length + 1; 
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{ 
		return null; 
	} 
	if ( start == -1 ) return null; 
	var end = document.cookie.indexOf( ';', len ); 
	if ( end == -1 ) end = document.cookie.length; 
	return unescape( document.cookie.substring( len, end ) ); 
} 

function SetCookie( name, value, expires, path, domain, secure )
{ 
	var today = new Date(); 
	today.setTime( today.getTime() ); 
	if ( expires ) { 
		expires = expires * 1000 * 60 * 60 * 24; 
	} 
	var expires_date = new Date( today.getTime() + (expires) ); 
	document.cookie = name+'='+escape( value ) + 
	( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString() 
	( ( path ) ? ';path=' + path : '' ) + 
	( ( domain ) ? ';domain=' + domain : '' ) + 
	( ( secure ) ? ';secure' : '' ); 
} 

function DeleteCookie( name, path, domain )
{ 
	if ( getCookie( name ) ) document.cookie = name + '=' + 
	( ( path ) ? ';path=' + path : '') + 
	( ( domain ) ? ';domain=' + domain : '' ) + 
	';expires=Thu, 01-Jan-1970 00:00:01 GMT'; 
} 

// 模态对话框
function OpenModalDialog(strUrl)
{
	return window.showModalDialog(strUrl, "","edge:raised;status:no;scroll:no;help:no;resizable:no;unadorned:yes;dialogWidth:600px;dialogHeight:350px");
} 
// 模态对话框 By Param
function OpenModalDialogByParam(strUrl, strName, strParam)
{
	return window.showModalDialog(strUrl, strName, strParam);
} 

// 模态对话框 By Param
function OpenModalDialogByWH(strUrl, iWidth, iHeight)
{
	var strParam = "edge:raised;status:no;scroll:no;help:no;resizable:no;unadorned:yes;dialogWidth:"+iWidth+"px;dialogHeight:"+iHeight+"px";
	return window.showModalDialog(strUrl, "", strParam);
} 


// 非模态对话框
function OpenModelessDialog(strUrl)
{
	return window.showModelessDialog(strUrl, "","edge:raised;status:no;scroll:no;help:no;resizable:no;unadorned:yes;dialogWidth:600px;dialogHeight:350px");
} 
// 非模态对话框 By Param
function OpenModelessDialogByParam(strUrl, strName, strParam)
{
	return window.showModelessDialog(strUrl, strName, strParam);
} 

function GetLoadingHtmlCode()
{
	return "<div style=\"width:100%; height:26px;\"><strong>Loading...</strong><img src=\"/Images/Loading.gif\" alt=\"Loading\" width=\"16\" height=\"16\" /></div>"
	
}
// 弹出新窗口
function OpenNewWindnow(strUrl)
{
	return window.open(strUrl);
}


//弹出页面, 防止IE工具对window.open的拦截
window._open = window.open;
window.open = window_new_open;
function window_new_open( a,b,c )
{
	var win;
	if( c ) win=window._open( a,b,c );
	else if( b ) win=window._open( a,b );
	else win=window._open( a );
	if( win!=null&&!win.closed ) return win;
	var option='status:0;help:0;dialogleft:10000px;dialogtop:10000px;dialogheight:0px;dialogwidth:0px';
	win=showModalDialog( 'open.htm',[a,b,c],option );
	return win;
}

//弹出页面
function popup(weburl,w,h)
{
		window.open(weburl,w,"toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=no,width="+w+",height="+h+",left=100,top=10");
}

//弹出页面can be resized
function popup1(weburl,w,h)
{
window.open(weburl,"mybox","toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,scrollbars=no,width="+w+",height="+h+",left=100,top=10")
}

// 替换字符串中文字
function ReplaceString(inputString, fromString, toString)
{
	var temp = inputString;
	if (fromString == "")
	{
		return inputString;
	}
	if (toString.indexOf(fromString) == -1)
	{
		while (temp.indexOf(fromString) != -1)
		{
			var toTheLeft = temp.substring(0, temp.indexOf(fromString));
			var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
			temp = toTheLeft + toString + toTheRight;
		}
	}
	else
	{
		var midStrings = new Array("~", "`", "_", "^", "#");
		var midStringLen = 1;
		var midString = "";
		while (midString == "")
		{
			for (var i=0; i < midStrings.length; i++)
			{
				var tempMidString = "";
				for (var j=0; j < midStringLen; j++)
				{
					tempMidString += midStrings;
				}
				if (fromString.indexOf(tempMidString) == -1)
				{
					midString = tempMidString;
					i = midStrings.length + 1;
				}
			}
		}
		while (temp.indexOf(fromString) != -1)
		{
			var toTheLeft = temp.substring(0, temp.indexOf(fromString));
			var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
			temp = toTheLeft + midString + toTheRight;
		}
		while (temp.indexOf(midString) != -1)
		{
			var toTheLeft = temp.substring(0, temp.indexOf(midString));
			var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
			temp = toTheLeft + toString + toTheRight;
		}
	}
	return temp;
}
function XMLHttp(strUrl)
{
	var strText = "";
	eval ('try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {xmlhttp = null;}');
	if (xmlhttp != null)
	{
		xmlhttp.Open("GET", strUrl, false);
		xmlhttp.Send();
		if (xmlhttp.status==200)
		{
			strText = xmlhttp.responseText;
		}
		else
		{
			strText=-1;
		}
	}
	return strText;
}

function checkRegExp(src, regE)
{
	return regE.test(src.trim());
}

//删除空格
String.prototype.lTrim = function () {
return this.replace(/^\s*/, "");
}
// remove trailing whitespace
String.prototype.rTrim = function () {
return this.replace(/\s*$/, "");
}
// remove leading and trailing whitespace
String.prototype.trim = function () {
return this.rTrim().lTrim();
}


function AlertFocus(strObj, msg)
{
	alert(msg);
	try
	{
		
		var obj = document.getElementById(strObj);
		if (obj!=null)
		{
			obj.focus()
		}
	}
	catch(e)
	{
	}
}

/*function AlertFocus(obj, msg)
{
	alert(msg);
	try
	{
		obj.focus()
	}
	catch(e)
	{
	}
}*/

// 读取用户提交的地址栏中的指定参数
function GetQueryString(priStrQueryName)
{
	priStrValue = "";
	priIsFound = false;
	if (this.location.search.indexOf("?")==0&&this.location.search.indexOf("=")>1)
	{
		priArraySource = unescape(this.location.search).substring(1,this.location.search.length).split("&");
		priGetQSi = 0;
		while (priGetQSi<priArraySource.length&&!priIsFound)
		{
			if (priArraySource[priGetQSi].indexOf("=")>0)
			{
				if (priArraySource[priGetQSi].split("=")[0].toLowerCase()==priStrQueryName.toLowerCase())
				{
					priStrValue = priArraySource[priGetQSi].split("=")[1];
					priIsFound = true;
				}
			} 
			priGetQSi ++ ;
		}	
	}
	return priStrValue;
} 

// 绑定分页代码中 Page 的下拉选框
function BuildPage(Page,PageCount)
{
	objPageSelect = document.getElementById("Page")
	objPageSelect.length=0;
	var i;

	for (i=0 ; i < PageCount ; i++)
	{
		objPageSelect.length += 1;
		objPageSelect.options[i].text = i+1;
		objPageSelect.options[i].value = i+1;
		if (Page == (i+1))
		{
			objPageSelect[i].selected=true;
		}
	}
}

function GetShowPagesQueryString()
{
	var strReturn = "";
	priStrValue = "";
	if (this.location.search.indexOf("?")==0&&this.location.search.indexOf("=")>1)
	{
		priArraySource = unescape(this.location.search).substring(1,this.location.search.length).split("&");
		priGetQSi = 0;
		while (priGetQSi<priArraySource.length)
		{
			if (priArraySource[priGetQSi].indexOf("=")>0)
			{
				if (priArraySource[priGetQSi].split("=")[0].toLowerCase()!="page")
				{
					// priStrValue = priArraySource[priGetQSi].split("=")[1];
					strReturn += "&" + priArraySource[priGetQSi].split("=")[0] + "=" + priArraySource[priGetQSi].split("=")[1];
				}
			}
			priGetQSi ++ ;
		}	
	}
	return strReturn;
}
// 生成分页代码
function ShowPages(iPageSize, iPageIndex, iRecordCount)
{
	iPageSize = parseInt(iPageSize)
	iPageIndex = parseInt(iPageIndex)
	iRecordCount = parseInt(iRecordCount)
	
	if (iRecordCount> iPageSize)
	{
		iPageCount = parseInt((iRecordCount+iPageSize-1) / iPageSize);
	}
	else if (iRecordCount>0)
	{
		iPageCount = 1;
	}
	else
	{
		iPageCount = 0;
	}
	var reString = "" ;
	
	
	reString += "<table width='100%' cellspacing='0' cellpadding='0' border='0'>";
	reString += "<tr><td align='center' class='ShowPage'>共 " + iRecordCount + " 条 每页 " + iPageSize + " 条 第 <select name=Page class='PageShowSelect' id='Page' onChange=\"MM_jumpMenu('self',this,0)\" ></select> 页";
	var iPerPage = iPageIndex - 1;
	if (iPerPage>0)
	{
		reString += "&nbsp;<a href=\"?page=" + iPerPage + GetShowPagesQueryString() + "\">上一页</a>";
	}
	else
	{
		reString += "&nbsp;<font color=\"#CCCCCC\">上一页</font>";
	//	reString += "&nbsp;上一页";
	}
	
	var iNextPage = iPageIndex + 1;
	if (iNextPage<=iPageCount)
	{
		reString += "&nbsp;<a href=\"?page=" + iNextPage + GetShowPagesQueryString() + "\">下一页</a>";
	}
	else
	{
		reString += "&nbsp;<font color=\"#CCCCCC\">下一页</font>";
		//reString += "&nbsp;";
	}
	reString += "</td></tr></table>";

	document.write(reString);
	BuildPage(iPageIndex , iPageCount);
}


// 绑定控件
function BindObject(strObjID, strValue, iMode)
{
	var obj = document.getElementById(strObjID);

	if (obj!=null)
	{
		if (iMode==null)
		{
			switch (obj.type)
			{
				case "text" : case "select-one" :
				{
					iMode = 3;
					break;
				}
				default :
				{
					try
					{
						obj.innerHTML;
						iMode = 1;
					}
					catch(e)
					{
						try
						{
							obj.text;
							iMode = 2;
						}
						catch(e)
						{
							try
							{
								obj.value;
								iMode = 3;
							}
							catch(e)
							{
								try
								{
									obj.src;
									iMode = 4;
								}
								catch(e)
								{
									
								}
							}
						}
					}
				}
			}
		}

		switch (iMode)
		{
			case 1 :
			{
				obj.innerHTML = strValue;
				break;
			}
			case 2 :
			{
				obj.text= strValue;
				break;
			}
			case 3 :
			{
				obj.value= strValue;
				break;
			}
			case 4 :
			{
				if (strValue!=null && strValue!="")
				{
					obj.src= strValue;
				}
				break;
			}
			default :
				break;
		}
	}
}



// 读取ASP中设置的Cookies
function GetASPCookie(name)
{
	var search;
	
	search = name + "="
	offset = document.cookie.indexOf(search) 
	if (offset != -1)
	{
		offset += search.length ;
		end = document.cookie.indexOf("&", offset) ;
		if (end == -1)
		{
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(offset, end));
	}
	else
	{
		GoBackToLogin();
		return "";
	}
}

// 通过cookie提取Url参数
function GetUrlByCookie()
{
//	var strUrl = "200602,25,ReallyNet";
	var strReturn = "", strPerfix = "";
	strReturn = GetCSharpCookie("CookiePUserXmlPath")
	arrStr = strReturn.split("/")
	for (var i=1; i<arrStr.length-1; i++)
	{
		strReturn += strPerfix + arrStr[i];
		strPerfix = ",";
	}
	
//	return strReturn;
//	strReturn = strUrl;
/*	strReturn = strUrl.replace(/,/g, "/");
	strReturn = "/PUserXml/" + strReturn + "/Music.xml";*/
	return strReturn;
}

// 重整frame
function reszieFrame(strFrame)
{
	/*
	if (parent.document.getElementById(strFrame))
	{
		parent.document.getElementById(strFrame).height=document.body.scrollHeight
	}
*/
/*
a[i].parentNode.style.height = a[i].offsetHeight +"px";
	a[i].style.height = "10px";
*/
	var h1=0, h2=0;
	if(document.documentElement&&document.documentElement.scrollHeight)
	{
		h1=document.documentElement.scrollHeight;
	}
	if(document.body) h2=document.body.scrollHeight;
	
	var h=Math.max(h1, h2);
	if(document.all) {h += 4;}
	if(window.opera) {h += 1;}

	parent.document.getElementById(strFrame).style.height = h +"px";
//	a[i].style.height = a[i].parentNode.style.height = h +"px";

/*
	var h1=0, h2=0;
	a[i].parentNode.style.height = a[i].offsetHeight +"px";
	a[i].style.height = "10px";
	if(document.documentElement&&document.documentElement.scrollHeight)
	{
	h1=document.documentElement.scrollHeight;
	}
	if(document.body) h2=document.body.scrollHeight;
	
	var h=Math.max(h1, h2);
	if(document.all) {h += 4;}
	if(window.opera) {h += 1;}
	a[i].style.height = a[i].parentNode.style.height = h +"px";
*/

	/*
  var pTar = null;
  if (document.getElementById)
	{
    pTar = parent.document.getElementById(strFrame);
  }
  else
	{
    eval('pTar = parent.'+strFrame+';');
  }
  if (pTar && !window.opera)
	{
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight)
		{
      //ns6 syntax
			// pTar.width = pTar.contentDocument.body.offsetWidth
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight)
		{
      //ie5+ syntax
			// pTar.width = pTar.Document.body.scrollWidth;
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
	*/
	
	/*
  var pTar = null;
  if (document.getElementById)
	{
    pTar = parent.document.getElementById(strFrame);
  }
  else
	{
    eval('pTar = parent.'+strFrame+';');
  }
  if (pTar && !window.opera)
	{
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight)
		{
      //ns6 syntax
			pTar.width = pTar.contentDocument.body.offsetWidth
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight)
		{
      //ie5+ syntax
			pTar.width = pTar.Document.body.scrollWidth;
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
	*/
}


// loading 条控制
function operLoadingBar(p_strMode)
{
	switch(p_strMode)
	{
		case "init":
		{
			document.write("<DIV id=\"idLoading\"><table height=\"100%\" width=\"100%\"><tr><td align=\"center\"><DIV class=\"txt\"><div><IMG height=\"19\" src=\"/images/member/loader.gif\" width=\"220\"></div><div>Loading...</div></DIV></td></tr></table></DIV>");
			break;
		}
		case "hidden" :
		{
		  if (document.getElementById("idLoading")!=null)
		  {
			   document.getElementById("idLoading").style.display = "none";
			 }
			break;
		}
		case "show" :
		{
		  if (document.getElementById("idLoading")!=null)
		  {
  			document.getElementById("idLoading").style.display = "block";
			 }
			break;
		}
	}
}


function resizepic(p_obj)
{
}



// 复制内容
function copyUrl(p_strObjId, p_strMsg)
{
	try{
	clipboardData.setData('Text',document.getElementById(p_strObjId).value);
	alert(p_strMsg);
	return false;
	}
	catch(e)
	{
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// 跳转选择框
function MM_jumpMenu(targ,selObj,restore)
{
	var strReturn = "";
	priStrValue = "";
	if (this.location.search.indexOf("?")==0&&this.location.search.indexOf("=")>1)
	{
		priArraySource = unescape(this.location.search).substring(1,this.location.search.length).split("&");
		priGetQSi = 0;
		while (priGetQSi<priArraySource.length)
		{
			if (priArraySource[priGetQSi].indexOf("=")>0)
			{
				if (priArraySource[priGetQSi].split("=")[0].toLowerCase()!="page")
				{
					// priStrValue = priArraySource[priGetQSi].split("=")[1];
					strReturn += "&" + priArraySource[priGetQSi].split("=")[0] + "=" + priArraySource[priGetQSi].split("=")[1];
				}
			}
			priGetQSi ++ ;
		}	
	}

	eval(targ+".location='?page="+selObj.options[selObj.selectedIndex].value+ strReturn + "'");
	if (restore)
		selObj.selectedIndex=0;
}


function BindListPagerForRewritePageSize(iMode, iPageIndex, iPageSize, iRecordCount, strUrl)
{
	var iPageCount = 0;
	if (iRecordCount % iPageSize==0)
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize;
	}
	else
	{
		iPageCount = (iRecordCount - iRecordCount % iPageSize) / iPageSize + 1;
	}

	var strTemplate = "";
	strTemplate += "<div id=\"idListPagerPageSize\">";
	strTemplate += "<div class=\"PageSizeBlock\"><span class=\"txt\">每页显示数量：</span><span><img src=\"/images/common/page_20.gif\" width=\"18\" height=\"15\" border=\"0\" /> <img src=\"/images/common/page_40.gif\" width=\"18\" height=\"15\" border=\"0\"/> <img src=\"/images/common/page_80.gif\" width=\"18\" height=\"15\" border=\"0\"/></span></div>";
	strTemplate += "<div class=\"PagerBlock\">共有<span class=\"count\">$RecordCount$</span>条信息 <a href=\"$FirstPager$\"><img src=\"/images/common/btn_pageback.gif\" width=\"16\" height=\"15\" align=\"absmiddle\" border=\"0\"/></a> $PageLinkBlock$ <a href=\"$NextPager$\"><img src=\"/images/common/btn_pagenext.gif\" width=\"46\" height=\"17\" align=\"absmiddle\" border=\"0\"/></a> 到第$SelectPager$页</div><div class=\"split\"></div>";
	strTemplate += "</div>";
	
	if (iMode!=1)
	{
		strTemplate = strTemplate.replace("class=\"PageSizeBlock\"", "class=\"PageSizeBlock\" style='display:none'");
	}
	var strSelectCode = "<select id=\"ListPager\" name=\"ListPager\" class=\"ListPager\" onChange=\"parent.location=this.options[this.selectedIndex].value\">";
	
	for(var i=1; i<=iPageCount; i++)
	{
		if(iPageIndex==i)
		{
			strSelectCode += "<option value=\""+strUrl.replace("$pi$",i)+"\" selected=\"selected\">"+i+"/"+iPageCount+"</option>";
		}
		else
		{
			strSelectCode += "<option value=\""+strUrl.replace("$pi$",i)+"\">"+i+"/"+iPageCount+"</option>";
		}
	}
	strSelectCode += "</select>";

	
	var iBegin = 0, iEnd = 0;
	iPageCount = ((iRecordCount + iPageSize) - 1) / iPageSize;
	iBegin = (iPageIndex - ((iPageIndex - 1) % 10));
	iBegin = (iBegin < 1) ? 1 : iBegin;
	iEnd = iBegin + 9;
	iEnd = (iEnd > iPageCount) ? iPageCount : iEnd;

	var strPagerLinkCode = "";
	for (var i = iBegin; i <= iEnd; i++)
	{
		if (i==iPageIndex)
		{
			strPagerLinkCode +="<span class=\"cur\">["+i+"]</span>";
		}
		else
		{
			var strUrlItem = strUrl; 
			strUrlItem = strUrlItem.replace("$pi$", i);
			strPagerLinkCode +="<a href=\"" + strUrlItem + "\" id=\"p" + i + "\">"+i+"</a>";
		}
	}

	strTemplate = strTemplate.replace("$SelectPager$", strSelectCode)
	strTemplate = strTemplate.replace("$RecordCount$", iRecordCount)
	strTemplate = strTemplate.replace("$PageLinkBlock$", strPagerLinkCode)

	var strNextPager = (iPageIndex<iPageCount)?strUrl.replace("$pi$", iPageIndex+1):"#";
	strTemplate = strTemplate.replace("$NextPager$", strNextPager); 

	var strFirstPager = (iPageIndex>1)?strUrl.replace("$pi$", 1):"#";
	strTemplate = strTemplate.replace("$FirstPager$", strFirstPager); 
	
	document.write(strTemplate);
	
	return;
}


function getDiffTime(startDate)
{
 //分解年、月、日
 DateTime = new Array(); 
 DateTime = startDate.split("-");
 
 arrTemp = new Array(); 
 arrTemp = startDate.split(" ");
 
 arrValue = new Array(); 
 arrValue = arrTemp[0].split("-");
 var year = arrValue[0];
 var month = arrValue[1];
 var day = arrValue[2];
 
 arrValue = arrTemp[1].split(":");
 var hour = arrValue[0];
 var minitue = arrValue[1];
 var second = arrValue[2];
 
 //用得到的年、月、日生成日期对象
 var Time = new Date(year,month - 1,day,hour,minitue,second);

 //得到当前日期
 var now = new Date();

 //计算出当前日期与发布日期之间的毫秒差值
 var diff = now.getTime() - Time.getTime();
 var days = Math.floor(diff/(1000*3600*24));
 var hours = Math.floor((diff - days*1000*3600*24)/(1000*3600));
 var minitues = Math.floor((diff - days*1000*3600*24 - hours*1000*3600)/(1000*60));
 var seconds = Math.floor((diff - days*1000*3600*24 - hours*1000*3600 -minitues*1000*60)/1000)
 
	var strResult = "";
	if (days>0)
	{
		strResult = days + "天";
	}
	else if (hours>0)
	{
		strResult = hours + "小时";
	}
	else if (minitues>0)
	{
		strResult = minitues + "分钟";
	}
	else if (seconds>0)
	{
		strResult = seconds + "秒";
	}
	
 return strResult;
}

function getDiffTimeForBlog(startDate)
{
	document.write(getDiffTime(startDate) + "前");
}