// xurun 2006-2-15
//数据持久的一些js方法，主要是数据有效的验证和页面控制等

document.ondragstart = function(){
	return false;
}

var fieldname;
var grandchilds;
var defaultValue;



function openWindow(url,width,height){
	var left = (window.screen.availWidth-width)/2;
	var top = (window.screen.availHeight-height)/2;	

	var openthiswin = window.open(url,"self",'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,left='+left+',top='+top+',width='+width+',height='+height);
	if(openthiswin!=null)openthiswin.focus();
}

function changeDeptOption(fieldname,defaultValue,optionvalue){
	this.defaultValue = defaultValue;
	this.fieldname = fieldname;
	var url="/process/sys/system/getSubDept.jsp?math="+Math.random()+"&supercode="+optionvalue;	
	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = subDetpt;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = subDetpt;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function subDetpt(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("==请选择==","");
		subobj.options.length=selStr.length;
		var selectedindex = 0;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			if(oneItem[0]==defaultValue){
				selectedindex = i;
			}
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}

		if(defaultValue=="0")			
			subobj.selectedIndex  = 0;
		else
			subobj.selectedIndex  = selectedindex+1;
	}
}

//权限相关部门显示开始
function powerChangeDeptOption(fieldname,defaultValue,optionvalue){
	this.defaultValue = defaultValue;
	this.fieldname = fieldname;
	var url="/process/sys/system/getSubDept.jsp?math="+Math.random()+"&supercode="+optionvalue+"&depttype=1";	
	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = powerSubDetpt;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = powerSubDetpt;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function powerSubDetpt(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("==请选择==","");
		subobj.options.length=selStr.length;
		var selectedindex = 0;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			if(oneItem[0]==defaultValue){
				selectedindex = i;
			}
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}
		//subobj.selectedIndex  = selectedindex+1;
		subobj.selectedIndex  =0;
	}
}
//权限相关部门显示结束


function changeOption_xr(slaveCodeGroup,fieldname,optionvalue,grandchilds){
	this.grandchilds = grandchilds;
	this.fieldname = fieldname
	var url="process/common/getSlaveCodeItem.jsp?math="+Math.random()+"&groupValue="+slaveCodeGroup+"&supercode="+optionvalue;	

	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = callback;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = callback;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function callback(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("","");
		subobj.options.length=selStr.length;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}

		if(grandchilds!="" && grandchilds!=null &&  grandchilds!="null"){
			var divgrandchilds = grandchilds.split(",");
			var grandchildsobj;
			for(var i=0;i<divgrandchilds.length;i++){
				grandchildsobj = eval("document.forms[0]."+divgrandchilds[i]);
				grandchildsobj.options.length = 1;		
			}
		}
	}
}


function isIE(){  //ie?
	/*if (window.navigator.userAgent.indexOf("MSIE")>=1)
		return true;
	else
		return false;*/
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);  //主版本号
  this.minor = parseFloat(navigator.appVersion);//全版本号
  if((agent.indexOf("mozilla")!=-1)||(agent.indexOf("msie")!=-1)||(agent.indexOf("opera")!=-1)||(agent.indexOf("win")!=-1)||(agent.indexOf("mac")!=-1)
  ||(agent.indexOf("x11")!=-1))
  {
     return true;
  }
  else
  {
     return false;
  }
}

function uploadFile(par){
	var url = "process/common/upload/upload.jsp?fieldName=" + par+"&forward=process/common/upload/uploadOpenSuccess";
	window.open(url);
}

function uploadFormSubmit(){
	if(document.forms[0].file.value==""){
		alert("select file ,please");
	}else{
		document.forms[0].submit();
	}
}

/*图片预览*/
function clientpreview(picvalue){
	var obj = document.getElementById("picpreview");
	obj.src = picvalue;
}


function suffixCheck(objString){
	var file = document.forms[0].file.value;
	if(file==""){
		alert("请选定文件");
		return false
	}else if(file.indexOf(".")==-1){
			alert("请选择有效的文件");
			return false;
	}else{
		var tempObj = eval(objString);
		//var permissionSuffix = ",bmp,gif,jpeg,jpg,";
		var permissionSuffix = ","+tempObj.value+",";
		var factSuffix="";
		 for (i=file.length-1;i>=0;i--) 
		{ 
			 if(file.charCodeAt(i)==46){
				break;
			 }else{
				 factSuffix=file.charAt(i)+factSuffix;
			 }
		} 
		if(factSuffix==""  || file == factSuffix){
			alert("无效的文件名");
			return false;
		}else{
			if(permissionSuffix.toLowerCase().indexOf(","+factSuffix.toLowerCase()+",")==-1){
				alert("只允许上传"+permissionSuffix+"格式的文件");
				return false;
			}
		}
	}
}


function openPic(url){
	window.open(url);
}

function dateValidator(dateString){
	alert(dateString);
}

if(!isIE()){ //firefox  innerText define ,xurun  
	HTMLElement.prototype.__defineGetter__ 
	( 
	"innerText", 
	function () 
	{ 
	 var anyString = ""; 
	 
	 var childS = this.childNodes; 
	 for(var i=0; i<childS.length; i++) 
	 { 
	  if(childS[i].nodeType==1) 
	  anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText; 
	  else if(childS[i].nodeType==3) 
	  anyString += childS[i].nodeValue; 
	 } 
	 return anyString; 
	} 
	); 
}

function getTipFrame(color,msg)
{
    var remsg="";
	    if(color=='blue')
        remsg="<table width=350 border=0 cellPadding=0  cellSpacing=0 bgcolor='#E2F5FF'  style='BORDER-RIGHT: #00A8FF 1px solid; BORDER-TOP: #00A8FF 1px solid; BORDER-LEFT: #00A8FF 1px solid; BORDER-BOTTOM: #00A8FF 1px solid'><TR><TD width='21' height='20' class=l20><div align='left'><img src='/process/online/images/01.gif' width='14' height='14'></div></TD> <TD width='332' class=l20>"+msg+"</TD> </TR> </TABLE>";
        else if(color=='red')
		remsg="<table  border=0 cellPadding=0 cellSpacing=0 bgcolor='#FFF2E9' style='BORDER-RIGHT: #FF6600 1px solid; BORDER-TOP: #FF6600 1px solid; BORDER-LEFT: #FF6600 1px solid; BORDER-BOTTOM: #FF6600 1px solid'><TR><TD width='27' height='20' class=l20><div align='left'>&nbsp;<img src='/process/online/images/02.gif' width='14' height='14'></div></TD><TD  class=style4>"+msg+"</TD></TR> </TABLE>";
        else if(color=='right')
		remsg="<table width=177 border=0 cellPadding=0 cellSpacing=0 bgcolor='#ffffff' style='BORDER-RIGHT: #F3F3F3 1px solid; BORDER-TOP: #F3F3F3 1px solid; BORDER-LEFT: #F3F3F3 1px solid; BORDER-BOTTOM: #F3F3F3 1px solid'><TR><TD width='21' height='20' align='right' class=l20><div align='left'><img src='/process/online/images/03.gif' width='14' height='14'></div></TD><TD width='160' class=style5>"+msg+"</TD> </TR> </TABLE>";
		else
		remsg="<font class='show'>"+msg+"</font>";
    return remsg;
}

function getWidthTipFrame(color,msg,allwidth)
{
    var remsg="";
	    if(color=='blue')
        remsg="<table width="+allwidth+" border=0 cellPadding=0  cellSpacing=0 bgcolor='#E2F5FF'  style='BORDER-RIGHT: #00A8FF 1px solid; BORDER-TOP: #00A8FF 1px solid; BORDER-LEFT: #00A8FF 1px solid; BORDER-BOTTOM: #00A8FF 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/01.gif' width='14' height='14'></div></TD> <TD  class=l20>"+msg+"</TD> </TR> </TABLE>";
        else if(color=='red')
		remsg="<table width="+allwidth+" border=0 cellPadding=0 cellSpacing=0 bgcolor='#FFF2E9' style='BORDER-RIGHT: #FF6600 1px solid; BORDER-TOP: #FF6600 1px solid; BORDER-LEFT: #FF6600 1px solid; BORDER-BOTTOM: #FF6600 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/02.gif' width='14' height='14'></div></TD><TD  class=style4>"+msg+"</TD></TR> </TABLE>";
        else if(color=='right')
		remsg="<table width="+allwidth+" border=0 cellPadding=0 cellSpacing=0 bgcolor='#ffffff' style='BORDER-RIGHT: #F3F3F3 1px solid; BORDER-TOP: #F3F3F3 1px solid; BORDER-LEFT: #F3F3F3 1px solid; BORDER-BOTTOM: #F3F3F3 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/03.gif' width='14' height='14'></div></TD><TD  class=style5>"+msg+"</TD> </TR> </TABLE>";
		else
		remsg="<span class='r1_2'>"+msg+"</span>";
    return remsg;
}
function focusdis(ti,msg)
{
   var ti = eval(ti);
   ti.innerHTML=getTipFrame("blue",msg);
}
function dis(ti,color,msg)
{
   var ti = eval(ti);
   if(ti.innerHTML=="")
     ti.innerHTML=getWidthTipFrame("blue",msg+"&nbsp;");
	else if(color.indexOf("blue")==0)
	  ti.innerHTML=getWidthTipFrame("blue",msg+"&nbsp;");
	else if(color.indexOf("red")==0)
	  ti.innerHTML=getWidthTipFrame("red",msg+"&nbsp;");
	else if(color.indexOf("right")==0)
	  ti.innerHTML=getWidthTipFrame("right",msg+"&nbsp;");
	 
}

function widthdis(ti,color,msg,allwidth)
{
   var ti = eval(ti);
   if(ti.innerHTML=="")
     ti.innerHTML=getWidthTipFrame("blue",msg,allwidth);
	else if(color.indexOf("blue")==0)
	  ti.innerHTML=getWidthTipFrame("blue",msg,allwidth);
	else if(color.indexOf("red")==0)
	  ti.innerHTML=getWidthTipFrame("red",msg,allwidth);
	else if(color.indexOf("right")==0)
	  ti.innerHTML=getWidthTipFrame("right",msg,allwidth);
	 
}

/* *************************** 
** Most of this code was kindly 
** provided to me by 
** Andrew Clover (and at doxdesk dot com) 
** http://and.doxdesk.com/ ; 
** in response to my plea in my blog at 
** http://worldtimzone.com/blog/date/2002/09/24 
** It was unclear whether he created it. 
*/ 
function utf8(wide) { 
var c, s; 
var enc = ""; 
var i = 0; 
while(i<wide.length) { 
c= wide.charCodeAt(i++); 
// handle UTF-16 surrogates 
if (c>=0xDC00 && c<0xE000) continue; 
if (c>=0xD800 && c<0xDC00) { 
if (i>=wide.length) continue; 
s= wide.charCodeAt(i++); 
if (s<0xDC00 || c>=0xDE00) continue; 
c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000; 
} 
// output value 
if (c<0x80) enc += String.fromCharCode(c); 
else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F)); 
else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F)); 
else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F)); 
} 
return enc; 
} 

var hexchars = "0123456789ABCDEF"; 

function toHex(n) { 
return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF); 
} 

var okURIchars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"; 

function encodeURIComponentNew(s) { 
var s = utf8(s); 
var c; 
var enc = ""; 
for (var i= 0; i<s.length; i++) { 
if (okURIchars.indexOf(s.charAt(i))==-1) 
enc += "%"+toHex(s.charCodeAt(i)); 
else 
enc += s.charAt(i); 
} 
return enc; 
} 

function URLEncode(fld) 
{ 
if (fld == "") return false; 
var encodedField = ""; 
var s = fld; 
if (typeof encodeURIComponent == "function") 
{ 
// Use javascript built-in function 
// IE 5.5+ and Netscape 6+ and Mozilla 
encodedField = encodeURIComponent(s); 
} 
else 
{ 
// Need to mimic the javascript version 
// Netscape 4 and IE 4 and IE 5.0 
encodedField = encodeURIComponentNew(s); 
} 
//alert ("New encoding: " + encodeURIComponentNew(fld) + 
// "\n escape(): " + escape(fld)); 
return encodedField; 
} 

// xurun 2006-2-15
//数据持久的一些js方法，主要是数据有效的验证和页面控制等

document.ondragstart = function(){
	return false;
}

var fieldname;
var grandchilds;
var defaultValue;



function openWindow(url,width,height){
	var left = (window.screen.availWidth-width)/2;
	var top = (window.screen.availHeight-height)/2;	

	var openthiswin = window.open(url,"self",'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,left='+left+',top='+top+',width='+width+',height='+height);
	if(openthiswin!=null)openthiswin.focus();
}

function changeDeptOption(fieldname,defaultValue,optionvalue){
	this.defaultValue = defaultValue;
	this.fieldname = fieldname;
	var url="/process/sys/system/getSubDept.jsp?math="+Math.random()+"&supercode="+optionvalue;	
	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = subDetpt;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = subDetpt;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function subDetpt(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("==请选择==","");
		subobj.options.length=selStr.length;
		var selectedindex = 0;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			if(oneItem[0]==defaultValue){
				selectedindex = i;
			}
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}

		if(defaultValue=="0")			
			subobj.selectedIndex  = 0;
		else
			subobj.selectedIndex  = selectedindex+1;
	}
}

//权限相关部门显示开始
function powerChangeDeptOption(fieldname,defaultValue,optionvalue){
	this.defaultValue = defaultValue;
	this.fieldname = fieldname;
	var url="/process/sys/system/getSubDept.jsp?math="+Math.random()+"&supercode="+optionvalue+"&depttype=1";	
	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = powerSubDetpt;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = powerSubDetpt;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function powerSubDetpt(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("==请选择==","");
		subobj.options.length=selStr.length;
		var selectedindex = 0;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			if(oneItem[0]==defaultValue){
				selectedindex = i;
			}
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}
		//subobj.selectedIndex  = selectedindex+1;
		subobj.selectedIndex  =0;
	}
}
//权限相关部门显示结束


function changeOption_xr(slaveCodeGroup,fieldname,optionvalue,grandchilds){
	this.grandchilds = grandchilds;
	this.fieldname = fieldname
	var url="process/common/getSlaveCodeItem.jsp?math="+Math.random()+"&groupValue="+slaveCodeGroup+"&supercode="+optionvalue;	

	if (window.XMLHttpRequest) {
	   req = new XMLHttpRequest();

	   req.open("GET", url, true);
	   req.onreadystatechange = callback;
	   req.send(null);
	} else if (window.ActiveXObject) {
	   req = new ActiveXObject("Microsoft.XMLHTTP");

	   req.open("GET", url, true);	
	   req.onreadystatechange = callback;
	    //req.onreadystatechange = callback2;
	   req.send();
	}

}


function callback(){
    if (req.readyState == 4) {
		selStr=req.responseText.split("~~");
		var subobj = eval("document.forms[0]."+fieldname);

		subobj.options.length=1;
		subobj.options[0]=new Option("","");
		subobj.options.length=selStr.length;
		for(var i=0;i<selStr.length-1;i++)
		{
			var oneItem=selStr[i].split("~_");
			subobj.options[i+1]=new Option(oneItem[1],oneItem[0]);
		}

		if(grandchilds!="" && grandchilds!=null &&  grandchilds!="null"){
			var divgrandchilds = grandchilds.split(",");
			var grandchildsobj;
			for(var i=0;i<divgrandchilds.length;i++){
				grandchildsobj = eval("document.forms[0]."+divgrandchilds[i]);
				grandchildsobj.options.length = 1;		
			}
		}
	}
}


function isIE(){  //ie?
	/*if (window.navigator.userAgent.indexOf("MSIE")>=1)
		return true;
	else
		return false;*/
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);  //主版本号
  this.minor = parseFloat(navigator.appVersion);//全版本号
  if((agent.indexOf("mozilla")!=-1)||(agent.indexOf("msie")!=-1)||(agent.indexOf("opera")!=-1)||(agent.indexOf("win")!=-1)||(agent.indexOf("mac")!=-1)
  ||(agent.indexOf("x11")!=-1))
  {
     return true;
  }
  else
  {
     return false;
  }
}

function uploadFile(par){
	var url = "process/common/upload/upload.jsp?fieldName=" + par+"&forward=process/common/upload/uploadOpenSuccess";
	window.open(url);
}

function uploadFormSubmit(){
	if(document.forms[0].file.value==""){
		alert("select file ,please");
	}else{
		document.forms[0].submit();
	}
}

/*图片预览*/
function clientpreview(picvalue){
	var obj = document.getElementById("picpreview");
	obj.src = picvalue;
}


function suffixCheck(objString){
	var file = document.forms[0].file.value;
	if(file==""){
		alert("请选定文件");
		return false
	}else if(file.indexOf(".")==-1){
			alert("请选择有效的文件");
			return false;
	}else{
		var tempObj = eval(objString);
		//var permissionSuffix = ",bmp,gif,jpeg,jpg,";
		var permissionSuffix = ","+tempObj.value+",";
		var factSuffix="";
		 for (i=file.length-1;i>=0;i--) 
		{ 
			 if(file.charCodeAt(i)==46){
				break;
			 }else{
				 factSuffix=file.charAt(i)+factSuffix;
			 }
		} 
		if(factSuffix==""  || file == factSuffix){
			alert("无效的文件名");
			return false;
		}else{
			if(permissionSuffix.toLowerCase().indexOf(","+factSuffix.toLowerCase()+",")==-1){
				alert("只允许上传"+permissionSuffix+"格式的文件");
				return false;
			}
		}
	}
}


function openPic(url){
	window.open(url);
}

function dateValidator(dateString){
	alert(dateString);
}

if(!isIE()){ //firefox  innerText define ,xurun  
	HTMLElement.prototype.__defineGetter__ 
	( 
	"innerText", 
	function () 
	{ 
	 var anyString = ""; 
	 
	 var childS = this.childNodes; 
	 for(var i=0; i<childS.length; i++) 
	 { 
	  if(childS[i].nodeType==1) 
	  anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText; 
	  else if(childS[i].nodeType==3) 
	  anyString += childS[i].nodeValue; 
	 } 
	 return anyString; 
	} 
	); 
}

function getTipFrame(color,msg)
{
    var remsg="";
	    if(color=='blue')
        remsg="<table width=350 border=0 cellPadding=0  cellSpacing=0 bgcolor='#E2F5FF'  style='BORDER-RIGHT: #00A8FF 1px solid; BORDER-TOP: #00A8FF 1px solid; BORDER-LEFT: #00A8FF 1px solid; BORDER-BOTTOM: #00A8FF 1px solid'><TR><TD width='21' height='20' class=l20><div align='left'><img src='/process/online/images/01.gif' width='14' height='14'></div></TD> <TD width='332' class=l20>"+msg+"</TD> </TR> </TABLE>";
        else if(color=='red')
		remsg="<table  border=0 cellPadding=0 cellSpacing=0 bgcolor='#FFF2E9' style='BORDER-RIGHT: #FF6600 1px solid; BORDER-TOP: #FF6600 1px solid; BORDER-LEFT: #FF6600 1px solid; BORDER-BOTTOM: #FF6600 1px solid'><TR><TD width='27' height='20' class=l20><div align='left'>&nbsp;<img src='/process/online/images/02.gif' width='14' height='14'></div></TD><TD  class=style4>"+msg+"</TD></TR> </TABLE>";
        else if(color=='right')
		remsg="<table width=177 border=0 cellPadding=0 cellSpacing=0 bgcolor='#ffffff' style='BORDER-RIGHT: #F3F3F3 1px solid; BORDER-TOP: #F3F3F3 1px solid; BORDER-LEFT: #F3F3F3 1px solid; BORDER-BOTTOM: #F3F3F3 1px solid'><TR><TD width='21' height='20' align='right' class=l20><div align='left'><img src='/process/online/images/03.gif' width='14' height='14'></div></TD><TD width='160' class=style5>"+msg+"</TD> </TR> </TABLE>";
		else
		remsg="<font class='show'>"+msg+"</font>";
    return remsg;
}

function getWidthTipFrame(color,msg,allwidth)
{
    var remsg="";
	    if(color=='blue')
        remsg="<table width="+allwidth+" border=0 cellPadding=0  cellSpacing=0 bgcolor='#E2F5FF'  style='BORDER-RIGHT: #00A8FF 1px solid; BORDER-TOP: #00A8FF 1px solid; BORDER-LEFT: #00A8FF 1px solid; BORDER-BOTTOM: #00A8FF 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/01.gif' width='14' height='14'></div></TD> <TD  class=l20>"+msg+"</TD> </TR> </TABLE>";
        else if(color=='red')
		remsg="<table width="+allwidth+" border=0 cellPadding=0 cellSpacing=0 bgcolor='#FFF2E9' style='BORDER-RIGHT: #FF6600 1px solid; BORDER-TOP: #FF6600 1px solid; BORDER-LEFT: #FF6600 1px solid; BORDER-BOTTOM: #FF6600 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/02.gif' width='14' height='14'></div></TD><TD  class=style4>"+msg+"</TD></TR> </TABLE>";
        else if(color=='right')
		remsg="<table width="+allwidth+" border=0 cellPadding=0 cellSpacing=0 bgcolor='#ffffff' style='BORDER-RIGHT: #F3F3F3 1px solid; BORDER-TOP: #F3F3F3 1px solid; BORDER-LEFT: #F3F3F3 1px solid; BORDER-BOTTOM: #F3F3F3 1px solid'><TR><TD width='21' height='20' class=l20><div align='center'><img src='/process/online/images/03.gif' width='14' height='14'></div></TD><TD  class=style5>"+msg+"</TD> </TR> </TABLE>";
		else
		remsg="<span class='r1_2'>"+msg+"</span>";
    return remsg;
}
function focusdis(ti,msg)
{
   var ti = eval(ti);
   ti.innerHTML=getTipFrame("blue",msg);
}
function dis(ti,color,msg)
{
   var ti = eval(ti);
   if(ti.innerHTML=="")
     ti.innerHTML=getWidthTipFrame("blue",msg+"&nbsp;");
	else if(color.indexOf("blue")==0)
	  ti.innerHTML=getWidthTipFrame("blue",msg+"&nbsp;");
	else if(color.indexOf("red")==0)
	  ti.innerHTML=getWidthTipFrame("red",msg+"&nbsp;");
	else if(color.indexOf("right")==0)
	  ti.innerHTML=getWidthTipFrame("right",msg+"&nbsp;");
	 
}

function widthdis(ti,color,msg,allwidth)
{
   var ti = eval(ti);
   if(ti.innerHTML=="")
     ti.innerHTML=getWidthTipFrame("blue",msg,allwidth);
	else if(color.indexOf("blue")==0)
	  ti.innerHTML=getWidthTipFrame("blue",msg,allwidth);
	else if(color.indexOf("red")==0)
	  ti.innerHTML=getWidthTipFrame("red",msg,allwidth);
	else if(color.indexOf("right")==0)
	  ti.innerHTML=getWidthTipFrame("right",msg,allwidth);
	 
}

/* *************************** 
** Most of this code was kindly 
** provided to me by 
** Andrew Clover (and at doxdesk dot com) 
** http://and.doxdesk.com/ ; 
** in response to my plea in my blog at 
** http://worldtimzone.com/blog/date/2002/09/24 
** It was unclear whether he created it. 
*/ 
function utf8(wide) { 
var c, s; 
var enc = ""; 
var i = 0; 
while(i<wide.length) { 
c= wide.charCodeAt(i++); 
// handle UTF-16 surrogates 
if (c>=0xDC00 && c<0xE000) continue; 
if (c>=0xD800 && c<0xDC00) { 
if (i>=wide.length) continue; 
s= wide.charCodeAt(i++); 
if (s<0xDC00 || c>=0xDE00) continue; 
c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000; 
} 
// output value 
if (c<0x80) enc += String.fromCharCode(c); 
else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F)); 
else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F)); 
else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F)); 
} 
return enc; 
} 

var hexchars = "0123456789ABCDEF"; 

function toHex(n) { 
return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF); 
} 

var okURIchars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"; 

function encodeURIComponentNew(s) { 
var s = utf8(s); 
var c; 
var enc = ""; 
for (var i= 0; i<s.length; i++) { 
if (okURIchars.indexOf(s.charAt(i))==-1) 
enc += "%"+toHex(s.charCodeAt(i)); 
else 
enc += s.charAt(i); 
} 
return enc; 
} 

function URLEncode(fld) 
{ 
if (fld == "") return false; 
var encodedField = ""; 
var s = fld; 
if (typeof encodeURIComponent == "function") 
{ 
// Use javascript built-in function 
// IE 5.5+ and Netscape 6+ and Mozilla 
encodedField = encodeURIComponent(s); 
} 
else 
{ 
// Need to mimic the javascript version 
// Netscape 4 and IE 4 and IE 5.0 
encodedField = encodeURIComponentNew(s); 
} 
//alert ("New encoding: " + encodeURIComponentNew(fld) + 
// "\n escape(): " + escape(fld)); 
return encodedField; 
} 

