var IE="IE";
function getNavigator(){
if(window.navigator.userAgent.indexOf("MSIE")>=1){
return IE;
}else if(window.navigator.userAgent.indexOf("Firefox")>=1){
return MOZILLA;
}else{
return MOZILLA;
}
}
function getRandom(){
try{
time = new Date();
return time.getTime() + "" +Math.random();
} catch(e){
now = new Date();
return now.getTime() ;
}
}
function LoadJS(file){
try{
var head=document.getElementsByTagName('HEAD').item(0);
var script=document.createElement('SCRIPT');
script.src=file;
script.language="JScript";
head.appendChild(script);
}catch(E){
}
}
function LoadCss(CssFile){
try{
var head=document.getElementsByTagName('HEAD').item(0);
var style=document.createElement('link');
style.href=CssFile;
style.rel='stylesheet'
style.type='text/css';
head.appendChild(style);
}catch(E){
alert(E);
}
}
function loadShadow(){
var shadowDiv=document.getElementById("shadowDiv");
var mainTable=document.getElementById("mainTable");
var mainDiv=document.getElementById("mainDiv");
if(getNavigator()==IE){
shadowDiv.style.position="absolute";
shadowDiv.style.left=mainTable.clientLeft+6;
shadowDiv.style.top=mainTable.clientTop+6;
shadowDiv.style.width='100%';
shadowDiv.style.height='96%';
shadowDiv.style.zIndex=-1;
shadowDiv.style.display="";
}else{
}
}
function showDiv(obj){
if(obj.style.display=="none"){
obj.style.display="";
}else{
obj.style.display="none";
}
}
function open_win(filename,title,width,height,left,top){
var win_obj=window.open(filename,title,"location=no,titlebar=no,scrollbars=yes,status=auto,menubar=no,resizable=no,toolbar=no,top="+top+",left="+left+",width="+width+",height="+height);
win_obj.focus();
}
function ctlDic_Item_Click(g_xDic_Obj){
if(g_xDic_Obj.currentText!=""){
try{
document.getElementById(g_xDic_Obj.parentobj_id).value=g_xDic_Obj.currentText;
if(g_xDic_Obj.idvalue_obj!=""){
document.getElementById(g_xDic_Obj.idvalue_obj).value=g_xDic_Obj.currentCode;
}
}catch(E){
}
g_xDic_Obj.xWinObj.close();
}
}
function SetContent(g_xDic_Obj)
{
try{
if(g_xDic_Obj.currentText!=""){
if(g_xDic_Obj.parentobj_id!=""){
if(g_xDic_Obj.items==1){
document.getElementById(g_xDic_Obj.parentobj_id).value=g_xDic_Obj.currentText;
if(g_xDic_Obj.idvalue_obj!=""){
document.getElementById(g_xDic_Obj.idvalue_obj).value=g_xDic_Obj.currentCode;
}
g_xDic_Obj.xWinObj.close();
return false;
}
}
}
}catch(e){
}
}
function seeXML(sXML)
{
var w=window.open("");
w.document.write("
"+sXML+"");
}
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g,"")
}
String.prototype.trimL=function(){
return this.replace(/(^\s*)/g,"")
}
String.prototype.trimR=function(){
return this.replace(/(\s*$)/g,"")
}
String.prototype.stripBlanks=function(){
return this.replace(/\s/g,"")
}
String.prototype.lenB=function(){
try{
return this.match(/[^\x00-\xff]/g).length+this.length
}catch(e){
return this.length
}
}
String.prototype.contain=function(str){
return(this.indexOf(str)!=-1)?true:false
}
function isLeapYear(iYear){
return((!(iYear%4)&&(iYear%100))||!(iYear%400))?true:false
}
function y2k(iYear){
return(iYear<1000)?iYear+1900:iYear
}
function getNowDate()
{
var today=new Date();
var y=today.getFullYear()+"";
var m=today.getMonth()+1+"";
m=m.length==1?"0"+m:m;
var d=today.getDate()+"";
d=d.length==1?"0"+d:d;
return y+"-"+m+"-"+d;
}
function getNowTime()
{
var today=new Date();
var h=today.getHours()+"";
h=h.length==1?"0"+h:h;
var m=today.getMinutes()+"";
m=m.length==1?"0"+m:m;
var s=today.getSeconds()+"";
s=s.length==1?"0"+s:s;
return h+":"+m+":"+s;
}
function verifyDate(day,month,year)
{
if(!day)return false;
var iToday=new Date();
month=month?month-1:iToday.getMonth();
year=year?y2k(parseInt(year)):iToday.getFullYear();
var iDate=new Date(year,month,day);
if((iDate.getFullYear()==year)&&(iDate.getMonth()==month)&&(iDate.getDate()==day))
return true;
else
return false;
}
function verifyTime(hh,mm,ss)
{
var iDate=new Date(1977,10,27,hh,mm,ss);
if((iDate.getHours()==hh)&&(iDate.getMinutes()==mm)&&(iDate.getSeconds()==ss))
return true;
else
return false;
}
function verifyDateTime(year,month,day,hh,mm,ss)
{
if(!verifyDate(day,month,year))return false;
var iToday=new Date();
return verifyTime(hh,mm,ss);
}
function CalID_17to18(sId)
{
var aW=new Array(1,2,4,8,5,10,9,7,3,6,1,2,4,8,5,10,9,7);
var aA=new Array("1","0","X","9","8","7","6","5","4","3","2");
var aP=new Array(17);
var aB=new Array(17);
var i,iSum=0;
for(i=1;i<18;i++)
aP[i]=sId.substr(17-i,1);
for(i=1;i<18;i++){
aB[i]=parseInt(aP[i])*parseInt(aW[i]);
iSum+=aB[i];
}
return sId+aA[iSum%11];
}
function CalID_15to18(sId)
{
return CalID_17to18(sId.substr(0,6)+"19"+sId.substr(6));
}
function UpID(sId)
{
var s=sId.trim();
if(s.length==15){
if(isNaN(sId))return false;
if(verifyDate(s.substr(10,2),s.substr(8,2),s.substr(6,2)))
return CalID_15to18(s);
else
return false;
}
else if(s.length==17){
if(isNaN(s))return false;
if(verifyDate(s.substr(12,2),s.substr(10,2),s.substr(6,4)))
return CalID_17to18(s);
else
return false;
}
else if(s.length==18){
if(isNaN(s.substr(0,17)))return false;
if(verifyDate(s.substr(12,2),s.substr(10,2),s.substr(6,4))){
if(CalID_17to18(s.substr(0,17))==s)
return s;
else
return false;
}
else
return false;
}
return false;
}
function getBirthday(sId)
{
var s=UpID(sId);
return s?s.substr(6,8):false;
}
function getSex(sId)
{
var s=UpID(sId);
return s?(parseInt(s.substr(16,1))%2?"1":"2"):"0";
}
function isIDCard(sValue)
{
return UpID(sValue)?true:false;
}
function isDate(sValue)
{
var s=sValue.trim();
if(s.length!=8)
return false;
else if(isNaN(s))
return false;
else
return verifyDate(s.substr(6),s.substr(4,2),s.substr(0,4));
}
function isTime(sValue)
{
var s=sValue.trim();
if(s.length!=6)
return false;
else if(isNaN(s))
return false;
else
return verifyTime(s.substr(0,2),s.substr(2,2),s.substr(4,2));
}
function isDateTime(sValue)
{
var s=sValue.trim();
if(s.length!=14)
return false;
else if(isNaN(s))
return false;
else
return verifyDateTime(s.substr(0,4),s.substr(4,2),s.substr(6,2),
s.substr(8,2),s.substr(10,2),s.substr(12,2));
}
function isInt(sValue)
{
return/^\d*$/.test(sValue);
}
function isFloat(sValue)
{
return(/^\d*\.\d+$/.test(sValue)||/^\d*$/.test(sValue));
}
function isNumber(sValue)
{
return isInt(sValue)||isFloat(sValue);
}
function isLetter(sValue)
{
return/^[A-Za-z]*$/.test(sValue);
}
function isLetterOrNumber(sValue)
{
return/^\w*$/.test(sValue);
}
function isBlank(sValue)
{
return/^\s*$/.test(sValue);
}
function G(elementId){
return document.getElementById(elementId);
}
function getXMLReqest(){
var xmlHttpReq;
if(window.XMLHttpRequest)
xmlHttpReq=new XMLHttpRequest();
else
try{
xmlHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
}
}
return xmlHttpReq;
}
function doRequestWait(url){
var x="";
var uuUrl;
if(url.indexOf("?")>=0)
uuUrl=url+"&"+Math.random()+"&xcharset=中文";
else
uuUrl=url+"?"+Math.random()+"&xcharset=中文";
try{
var xmlHttpReq=getXMLReqest();
xmlHttpReq.open("GET",uuUrl,false);
xmlHttpReq.send(null);
x=xmlHttpReq.responseText;
}catch(e){
alert(e);
}
return x;
}
function doRequest(url,windowDiv,callbackAction,info){
var uuUrl;
//alert(url+windowDiv.innerText);
if(info){
if(info==" "){
}else{
windowDiv.innerHTML=info;
}
}else{
windowDiv.innerHTML=""+
""+
"| 系统加载中,请稍候.... | "+
"
"+
"
";
}
if (url.indexOf("?") >= 0){
uuUrl = url + "&" + getRandom() + "&xcharset=中文";
}else {
uuUrl = url + "?" + getRandom() + "&xcharset=中文";
}
try{
var xmlHttpReq=getXMLReqest();
xmlHttpReq.onreadystatechange=function(){
if(xmlHttpReq.readyState==4){
var x=xmlHttpReq.responseText;
windowDiv.innerHTML=x;
if(callbackAction){
var actionList=callbackAction.split(";");
var len=actionList.length;
if(len>1){
for(m=0;m"+
" 超时,请重试或刷新页面 | "+
""+
"";
}
}
function doRequestPost(url, windowDiv, callbackAction,info,param){
var uuUrl;
if (info){
if(info==" "){
}else{
windowDiv.innerHTML = info ;
}
}else{
windowDiv.innerHTML = "" +
"" +
"| 系统加载中,请稍候.... | " +
"
" +
"
";
}
if(param!=""){
param = param+"&curTime="+Math.random();
}else {
param = "curTime="+Math.random();
}
try {
var xmlHttpReq = getXMLReqest();
xmlHttpReq.onreadystatechange = function () {
if (xmlHttpReq.readyState == 4) {
var x = xmlHttpReq.responseText;
windowDiv.innerHTML = x;
//document.getElementById(windowDivId).style.display = "";
if (callbackAction) {
var actionList = callbackAction.split(";");
var len = actionList.length;
if(len>1){
for(m=0;m0){
param=param+"&" + url.substr( url.indexOf("?")+1,url.length) ;
uuUrl = url.substr(0,url.indexOf("?"));
} else {
uuUrl = url ;
}
xmlHttpReq.open("POST", uuUrl, true);
xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
xmlHttpReq.send(param);
} catch(e) {
windowDiv.innerHTML = "" +
"" +
"| 超时,请重试或刷新页面 | " +
"
" +
"
";
}
}
function getXMLReqestQQ(){
var xmlHttpReq;
if(window.XMLHttpRequest)
xmlHttpReq=new XMLHttpRequest();
else
try{
xmlHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
}
}
return xmlHttpReq;
}
function doRequestQQ(url,windowDiv,callbackAction){
var uuUrl;
if(windowDiv){
windowDiv.innerHTML=""+
""+
" 系统加载中,请稍候.... | "+
"
"+
"
";
}
if(url.indexOf("?")>=0)
uuUrl=url+"&"+Math.random()+"&xcharset=中文";
else
uuUrl=url+"?"+Math.random()+"&xcharset=中文";
try{
var xmlHttpReq=getXMLReqestQQ();
xmlHttpReq.onreadystatechange=function(){
if(xmlHttpReq.readyState==4){
var x=xmlHttpReq.responseText;
if(windowDiv){
windowDiv.innerHTML=x;
}else{
}
if(callbackAction){
eval(callbackAction);
}
xmlHttpReq =null ;
x=null;
return;
}
};
xmlHttpReq.open("GET",uuUrl,true);
xmlHttpReq.send(null);
}catch(e){
alert(e);
}
}
function makeRequest(method,url,parameters,windowDiv,callbackAction){
var xmlHttpReq=getXMLReqest();
var time1=new Date().getTime();
if(windowDiv!=null){
windowDiv.innerHTML= windowDiv.innerHTML = " " +
" | 正在提交信息,请稍后..... |
";
}
xmlHttpReq.onreadystatechange=function(){;
if(xmlHttpReq.readyState==4){
var x=xmlHttpReq.responseText;
if(windowDiv!=null){
windowDiv.innerHTML=x
};
if(callbackAction){
eval(callbackAction);
}
return;
}
}
if(method=="post"){
xmlHttpReq.open('POST',url,true);
xmlHttpReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttpReq.setRequestHeader("Content-length",parameters.length);
xmlHttpReq.setRequestHeader("If-Modified-Since","0");
xmlHttpReq.send(parameters);
}else if(method=="get"){
if(url.indexOf("?")>0){
url=url+"&"+Math.random()+"&"+parameters;
}else{
url=url+"?"+Math.random()+"&"+parameters;
}
xmlHttpReq.open('GET',url,true);
xmlHttpReq.send(null);
}else{
if(url.indexOf("?")>0){
url=url+"&"+Math.random()+"&"+parameters;
}else{
url=url+"?"+Math.random()+"&"+parameters;
}
xmlHttpReq.open('GET',url,true);
xmlHttpReq.send(null);
}
}
function convertFormDataToPostContent(form_name){
var content_to_submit='';
var form_element;
var last_element_name='';
for(i=0;iheight&&width>1){
this.PicObj.height=image.height/width;
this.PicObj.width=this.defaultWidth;
}else if(width<=height&&height>1){
this.PicObj.width=image.width/height;
this.PicObj.height=this.defaultHeight;
}else if(width<1&&height<1){
this.PicObj.width=image.width;
this.PicObj.height=image.height;
}else{
this.PicObj.width=this.defaultWidth;
this.PicObj.height=this.defaultHeight;
}
this.PicObj.style.border="1px solid black";
this.PicObj.src=this.PicPath;
this.isLoaded=true;
}else{
setTimeout("load()",100);
}
}
if(!this.isLoaded&&getNavigator()==IE){load();}
if(getNavigator()!=IE){
PicObj.src=this.PicPath;
PicObj.style.display="";
alert(PicObj.parentNode.innerHTML);
}
}
function resizeImg(_oObj,_iWidth,iHeight){
var tMark=true;
var sOuterHtml;
var aNode=_oObj.attributes;
for(var i=0;i_iWidth){
_oObj.width=_iWidth;
}
}
}
function resize(image,iWidth,iHeight) {
if(!iWidth){
iWidth = 117 ;
}
if(!iHeight) {
iHeight = 90 ;
}
if(image) {
if (image.readyState=="complete") {
var width=image.width/iWidth;
var height=image.height/iHeight;
//alert(image.width+" "+ width+" " +height) ;
if(width>height&&width>1){
image.height=image.height/width;
image.width=iWidth;
}else if(width<=height&&height>1){
image.width=image.width/height;
image.height=iHeight;
}else if(width<1&&height<1){
//image.width=image.width;
//image.height=image.height;
}else{
image.width=iWidth;
image.height=iHeight;
}
//alert(image.width+" " + image.height);
}else {
setTimeout("resize("+image+","+iWidth+","+iHeight,100) ;
}
}
}
function setObjValue(obj,value){
try{if(obj){obj.value=value;}}catch(e){}
}
function downloadFile(file){
try{window.location.href(file);}catch(e){}
}
function createDOMDocument()
{
try{
if(getNavigator()=="IE"){
var objXML=new ActiveXObject("Msxml2.DOMDocument");
objXML.async=false;
return objXML
}else{
var xmlDoc=document.implementation.createDocument("","",null);
return xmlDoc;
}
}
catch(e){
return null;
}
}
function createXSLDocument(){
try{
if(getNavigator()=="IE"){
var objXML=new ActiveXObject("Msxml2.DOMDocument");
objXML.async=false;
return objXML
}else{
var xslDoc=new XSLTProcessor();
return xslDoc;
}
}
catch(e){
return null;
}
}
function loadXMLFromStr(xmlDoc,xmlStr){
if(getNavigator()==IE){
xmlDoc.loadXML(xmlStr);
}else{
var parser=new DOMParser();
xmlDoc=parser.parseFromString(xmlStr,"text/xml");
}
//alert(xmlDoc.xml);
return xmlDoc;
}
function selectNodes(xmlDoc,xPath){
if(getNavigator()==IE){
return xmlDoc.selectNodes(xPath);
}else{
this.rowNodes_Mozilla=new Array();
try{
var xPathResult=xmlDoc.evaluate(xPath,xmlDoc,
xmlDoc.createNSResolver(xmlDoc.documentElement),XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
if(xPathResult){
var oNode=xPathResult.iterateNext();
while(oNode){
this.rowNodes_Mozilla[this.rowNodes_Mozilla.length]=oNode;
oNode=xPathResult.iterateNext();
}
}
}catch(e){
}
return rowNodes_Mozilla;
}
}
function selectSingleNode(xmlDoc,xPath){
if(!xmlDoc) {
return null ;
}
if(getNavigator()==IE){
return xmlDoc.selectSingleNode(xPath);
}else{
try{
var xPathResult=xmlDoc.evaluate(xPath,xmlDoc,
xmlDoc.createNSResolver(xmlDoc.documentElement),9,null);
if(xPathResult&&xPathResult.singleNodeValue){
return xPathResult.singleNodeValue;
}
}catch(e){
}
return null;
}
}
function selectSingleNodeFromNode(FromNode,xPath){
if(getNavigator()==IE){
return FromNode.selectSingleNode(xPath);
}else{
try{
var xPathResult=FromNode.ownerDocument.evaluate(xPath,FromNode,
FromNode.ownerDocument.createNSResolver(FromNode),9,null);
if(xPathResult&&xPathResult.singleNodeValue){
return xPathResult.singleNodeValue;
}
}catch(e){
}
return null;
}
}
//原来都是在main_ 中
function do_tdmouseover(obj){
if(obj){ obj.style.backgroundColor = "silver";}
}
function do_tdmouseout(obj){
if(obj){obj.style.backgroundColor = "transparent"; }
}
function disableButton(button_id) { //按钮disable
try{ if(!button_id){G("submit_button").disabled = true; }
else { G(button_id).disabled = true;} }catch(e){}
}
function enableButton(button_id) { //按钮enable
try{ if(!button_id){G("submit_button").disabled = false; }
else { G(button_id).disabled = false;} }catch(e){}
}
//***************窗口操作模块开始 **********************************/
//需要打开的url 标题 是否新窗口 宽 高 左 上 返回ACTION
function openUrl(url, title, isnewwin, _width, _height, _left, _top, callbackAction) {
var wintemp = null ;
if(!callbackAction){
callbackAction = "" ;
}
if (!isnewwin) {
isnewwin = false;
}
if (isnewwin == true) {
wintemp = mywin_list;
//callbackAction = "mywin_main.setFocus(getzIndexMax()+2);mywin_main.show();" + callbackAction;
} else {
wintemp = mywin_main;
callbackAction = "mywin_main.setFocus(getzIndexMax()+2);mywin_main.show();" + callbackAction;
}
if (!_left) {
_left = left;
}
if (!_top) {
_top = top;
}
if (!_width) {
_width = win_width;
}
if (!_height) {
_height = win_height;
}
wintemp.setTitle(title);
if (wintemp._isshow == false) {
wintemp.setPosition(_left, _top);
wintemp.setSize(_width, _height);
} else if (wintemp._isshow == true && _width != wintemp.width) {
wintemp.setPosition(_left, _top);
wintemp.setSize(_width, _height);
}
if (callbackAction) {
doRequest(url, wintemp.client, callbackAction, "加载中,请稍侯..
")
} else {
doRequest(url, wintemp.client, null, "加载中,请稍侯..
")
}
wintemp.setFocus(getzIndexMax()+2);
wintemp.show();
}
function showWindow(event, _width, _height, title, content) {
var oEvent = window.event ? window.event : event;
var x = oEvent.clientX;
var y = oEvent.clientY;
position_mywin.setPosition(x, y);
position_mywin.setBeginPosition(x, y);
if (!_width) {
_width = win_width;
}
if (!_height) {
_height = win_height;
}
position_mywin.setSize(_width, _height);
if (!title) {
title = "";
}
position_mywin.setTitle(title);
if (!content) {
content = "";
}
position_mywin.setContentStr(content, "0px", "0px");
position_mywin.show();
}
// 点击处打开一个页面 (根据URL)
function openUrlWindow(event, _width, _height, title, url) {
if (position_mywin._isshow == true) {
position_mywin.close();
}
var oEvent = window.event ? window.event : event;
var x = oEvent.clientX;
var y = oEvent.clientY;
position_mywin.setPosition(x, y);
position_mywin.setBeginPosition(x, y);
if (!_width) {
_width = win_width;
}
if (!_height) {
_height = win_height;
}
position_mywin.setSize(_width, _height);
if (!title) {
title = "";
}
position_mywin.setTitle(title);
if (!url) {
url = "";
}
position_mywin.show();
doRequest(url, position_mywin.client, "", "加载中,请稍侯..
");
}
//直接打开页面,在FRAME中
function openUrlinFrame(url, title, isnewwin, _width, _height, _left, _top, callbackAction){
var wintemp = null ;
if (!isnewwin) {
isnewwin = false;
}
if (isnewwin == true) {
wintemp = mywin_temp;
//callbackAction = "mywin_temp.setFocus(getzIndexMax()+2);" + callbackAction;
} else {
wintemp = mywin_main;
//callbackAction = "mywin_main.setFocus(getzIndexMax()+2);" + callbackAction;
}
if (!_left) {
_left = left;
}
if (!_top) {
_top = top;
}
if (!_width) {
_width = win_width;
}
if (!_height) {
_height = win_height;
}
if(url.indexOf("?")>=0)
url =url+"&"+Math.random();
else
url =url+"?"+Math.random();
wintemp.setTitle(title);
wintemp.setcontent(url);
//alert(getzIndexMax()+2);
if (wintemp._isshow == false) {
wintemp.setPosition(_left, _top);
wintemp.setSize(_width, _height);
} else if (wintemp._isshow == true && _width != wintemp.width) {
wintemp.setPosition(_left, _top);
wintemp.setSize(_width, _height);
}mywin_temp.setFocus(getzIndexMax()+2);
wintemp.setFocus(getzIndexMax()+2);
wintemp.show();
}
function newMsg(msg){
return " | "+msg+" |
";
}
function submitUploadForm(form_id, checkAction, showDiv_Id) {
try {
if (checkAction == null || eval(checkAction) == true) { //提交
G(showDiv_Id).innerHTML = " " +
" | 正在提交信息,请稍后..... |
";
document.getElementById(form_id).submit();
} else {
return false;
}
} catch(e) {
}
}
function submitFormByAjax(form_id,checkAction,showDiv_Id,callbackAction) {
try {
if (checkAction == null || eval(checkAction) == true) { //提交
str = convertFormDataToPostContent(G(form_id));
var editUrl = G(form_id).action ;
if (showDiv_Id!=null){
makeRequest("get", editUrl, str, G(showDiv_Id), callbackAction);
}else{
makeRequest("get", editUrl, str,null, callbackAction);
}
} else {
return false;
}
} catch(e) {
}
}