
function bookmark()
{
window.external.AddFavorite('http://www.afuchina.com', 'www.AFUChina.Com')

}

function myhomepage(objthis){
    objthis.style.behavior='url(#default#homepage)';
    objthis.sethomepage('http://www.afuchina.com');
}

function showObj(oid){
	var obj =  document.getElementById(oid);
	obj.style.display="";
}
function hideObj(oid){
	var obj =  document.getElementById(oid);
	obj.style.display="none";
}

/* This function is used to open a pop-up window */
function openWindow(url, winTitle, winParams) {
    if (!winParams) {
        winParams = "width=400,height=400,left=350,top=150,toolbar=no,scrollbars=auto,scrollbars=yes,resizable=yes,status=yes";
    }
	winName = window.open(url, winTitle, winParams);
    winName.focus();
}

function centerPopUpWindow(openurl,w,h)
{
	var chasm = screen.availWidth;
	var mount = screen.availHeight;
    var intPos = openurl.indexOf("?");
    var strRight = openurl.substr(intPos + 1);
    var arrTmp = strRight.split("&");
    var inputname=arrTmp[0].split("=")[1];
    var rv=window.showModalDialog(openurl,'','dialogWidth=310px;dialogHeight=140px;dialogLeft=' + ((chasm - w - 10) * .5) + 'px;dialogTop=' + ((mount - h - 30) * .5)+ 'px;toolbar =no; menubar=no; scrollbars=no; resizable=yes;location=no; status=no;');

    if(rv!=undefined){
      document.getElementById(inputname).value=rv;
    }
}

	function Undo(undoUri){
	      window.location.href=undoUri; 
	}   
     
	 	function getCookie(name) {
	   var search = name + "=";
	   if(document.cookie.length > 0) {
	      var offset = document.cookie.indexOf(search);
	      if(offset != -1) {
	         offset += search.length;
	         var end = document.cookie.indexOf(";", offset);
	         if(end == -1) end = document.cookie.length;
	         return unescape(document.cookie.substring(offset, end));
	      }
	      else return "";
	   }
	}
	function RemoveCookie(name)
	{
		if(getCookie(name)=="")
			return;
		else{
			var exp = new Date();
			exp.setTime (exp.getTime() - 1);
			var cval = getCookie (name);
			document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
		}
	} 
	
	function GetObj(s)
		{
			return window.document.getElementById(s);
		}
		
	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 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 GetCookie(sName)
	{
		var aCookie = document.cookie.split("; ");
		for (var i=0; i < aCookie.length; i++)
		{
	   		var aCrumb = aCookie[i].split("=");
	   		if (sName == aCrumb[0]) 
	    	return unescape(aCrumb[1]);
		}
		return null;		
	}
	function GetUserName()
	{
		var uid=GetCookie("userid");
		var unm=GetCookie("jcusername");
		if(uid==null||uid=="")
		{
		//	GetObj('liwlc').style.display="none";		
			GetObj('lilg').style.display="";
			GetObj('lirg').style.display=""	
		}
		else
		{
			if(unm!=null&&unm!=undefined&&unm!="")
			{
				GetObj('lilg').style.display="none";
				GetObj('lirg').style.display="none";
				var wlc=GetObj('liwlc');
				var wlc2=GetObj('liwlc2');
				var wlc3=GetObj('liwlc3'); 
				var url=document.location;
				wlc.style.display="";		
				wlc.innerHTML= "<strong>"+unm+"</strong>"+"&nbsp;ÄúºÃ!&nbsp;"			
				wlc2.innerHTML="<a href='http://www.jctrans.com/office/sywl_ly_sd.aspx?ly=sd' class='a1'>ÎÒµÄÁôÑÔ</a>";
				wlc3.innerHTML="<a href='http://www.jctrans.com/office/login.html?flag=1&forward="+url+"' class='a2'>ÍË³öµÇÂ¼</a>"		
			}
			else
			{
				GetObj('liwlc').style.display="none";
				GetObj('liwlc2').style.display="none";
				GetObj('liwlc3').style.display="none";		
				GetObj('lilg').style.display="";
				GetObj('lirg').style.display=""		
			}
		}
	}
	function Trim(inputString) 
	{
		return inputString.replace(/^ +/,"").replace(/ +$/,"");
	}
	function RemoveSp(str)
	{ 
		var re =/(!)|(@)|(&amp)|(#)|,|'|(\^)|(\$)|(\.)|(\*)|(\")|(\|)|(\-)/gim
		str = str.replace(re,"");
		return str;
	}	
	function TxtString(obj,s)
	{
	  var os = Trim(obj.value);
	 if(os==s){obj.value='';}
	 else if(os==''){ obj.value=s;}
	}
	function ReTxtString(obj,s)
	{
		var os = Trim(obj.value);
	 	if(os==s){return "";}
	 	else{return obj.value;}
	}	
