//————Url————
urlsplit = document.URL.split("/");
var Url = Replace(urlsplit[urlsplit.length - 1].split("?")[0],"#","");//not toLowerCase

//————HideV/ShowV/HideD/ShowD————
function HideV(_s){
	if (findObj(_s) == null) return;
	findObj(_s).style.visibility = "hidden";
}
function ShowV(_s){
	if (findObj(_s) == null) return;
	findObj(_s).style.visibility = "visible";
}
function HideD(_s){
	if (findObj(_s) == null) return;
	findObj(_s).style.display = "none";
}
function ShowD(_s){
	if (findObj(_s) == null) return;
	findObj(_s).style.display = "inline";
}
//————AddHtml/GetHtml/AddText————
function AddHtml(_n,_s)
{	
	if (findObj(_n) != null) document.getElementById(_n).innerHTML = _s;
}
function GetHtml(_n)
{
	if (findObj(_n) != null) return document	.getElementById(_n).innerHTML;
}
//Only For IE5.0+
function AddText(_n,_s)
{	
	document.getElementById(_n).innerText = _s;
}
//————Replace————
function Replace(_s , _cs , _rs )
{return _s.split(_cs).join(_rs);}
//————findObj————
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)

{

  var p, i, foundObj;

  

  if(!theDoc) theDoc = document;

  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)

  {

    theDoc = parent.frames[theObj.substring(p+1)].document;

    theObj = theObj.substring(0,p);

  }

  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 

    foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 

    foundObj = findObj(theObj,theDoc.layers[i].document);

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  

  return foundObj;

}
//————UNCDATA/CDATA————
function UNCDATA(_s){
	_s = Replace(_s,"&lt;","<");
	_s = Replace(_s,"&gt;",">");
	_s = Replace(_s,"&amp;","&");
	_s = Replace(_s,"&apos;","'");
	_s = Replace(_s,"&quot;",'"');
	return _s;
}
function CDATA(_s){
	_s = Replace(_s,"<","&lt;");
	_s = Replace(_s,">","&gt;");
	_s = Replace(_s,"&","&amp;");
	_s = Replace(_s,"'","&apos;");
	_s = Replace(_s,'"',"&quot;");
	return _s;
}
//————Request————
/*
*--------------- Read.htm -----------------
* Request[key]
* 功能:实现ASP的取得URL字符串,Request("AAA")
* 参数:key,字符串.
* 实例:alert(Request["AAA"])
*--------------- Request.htm -----------------
*/
var passurl=location.search;
var str="";
if (document.URL.split("?")[1] != undefined){
	str = Replace(document.URL.split("?")[1],"#","");
}
var Request = new Object();
if(passurl.indexOf("?")!=-1)
{
	strs = str.split("&");
	for(var i=0;i<strs.length;i++)
	{
		Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
	}
}
//————readCookie/writeCookie————
// Example:

// alert( readCookie("myCookie") );

function readCookie(name)

{

  var cookieValue = "";

  var search = name + "=";

  if(document.cookie.length > 0)

  { 

    offset = document.cookie.indexOf(search);

    if (offset != -1)

    { 

      offset += search.length;

      end = document.cookie.indexOf(";", offset);

      if (end == -1) end = document.cookie.length;

      cookieValue = unescape(document.cookie.substring(offset, end))

    }

  }

  return cookieValue;

}

// Example:

// writeCookie("myCookie", "my name", 24);

// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, sec)

{

  var expire = "";

  if(sec != null)

  {

    expire = new Date((new Date()).getTime() + sec * 1000);

    expire = "; expires=" + expire.toGMTString();

  }

  document.cookie = name + "=" + escape(value) + expire;

}


