﻿//js class lab from www.tifoo.com
//The last update date: 2008-9-6
//self.onerror = function(){return true;}
function cBrowser(){this.agt = navigator.userAgent.toLowerCase(); this.isW3C = document.getElementById ? true : false; this.isIE = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1) && (this.agt.indexOf("omniweb") == -1)); this.isIE7 = (this.isIE && this.agt.indexOf('msie 7.') != -1); this.isOpera = this.agt.indexOf("opera") != -1; this.bodyWidth = this.isIE ? this.isIE7 ? document.documentElement.offsetWidth : document.body.offsetWidth : document.documentElement.clientWidth;this.bodyHeight = this.isIE ? this.isIE7 ? document.documentElement.offsetHeight : document.documentElement.clientHeight : document.documentElement.clientHeight; this.tbodyWidth = document.body.offsetWidth < this.bodyWidth ? this.bodyWidth : document.body.offsetWidth; this.tbodyHeight = document.body.offsetHeight < this.bodyHeight ? this.bodyHeight : document.body.offsetHeight;} window.$ = function(_id){return typeof(_id) == "string" ? document.getElementById(_id) : _id;}
function new_open(url, width, height, fs){ var t_left = window.screen.width/2-width/2, t_top = window.screen.height/2-height/2; window.open(url, 'TIFOO_'+(Math.floor(Math.random()*10000)+1), 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable='+fs+',width='+ width +',height='+ height +',left='+ t_left +',top='+ t_top +''); }
function sonwin_open(url, sonWinName){ if(sonWinName == null || sonWinName == "") sonWinName = "TIFOO"; var sonwinwidth = window.screen.width * 0.75, sonwinheight = window.screen.height * 0.65; window.open(url, sonWinName, 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=1,width='+ sonwinwidth +',height='+ sonwinheight +',top=90,left=200'); }
function modelnew_open(url, wid, hei, scr){scr = scr == null ? "no" : "auto";showModalDialog(url,window,"dialogWidth:"+ wid +"px;dialogHeight:"+ hei +"px;scroll:" + scr + ";resizable:no;");}
function LTrim(str){return str.replace(/^\s+/g,"");}; function RTrim(str){return str.replace(/\s+$/g,"");}; function Trim(str){return str.replace(/^\s+|\s+$/g,"");}; String.prototype.ltrim = function(){return this.replace(/^\s+/g,"");}; String.prototype.rtrim = function(){return this.replace(/\s+$/g,"");}; String.prototype.trim = function(){return this.replace(/^\s+|\s+$/g,"");};
function UrlEncode(str){str = encodeURI(str);str = str.replace(/&/g, "%26");return str;}
String.prototype.htmlEncode = function(){var tempSpan = document.createElement("SPAN");tempSpan.innerText = this; return tempSpan.innerHTML;}
function ajaxMessage(mess,showButton){ if(mess != null){ if($("ajax_mess_div") != null) AjaxMessage(); var newdiv_shadow = document.createElement("DIV"); newdiv_shadow.id = "ajax_mess_div_shadow"; newdiv_shadow.style.display = "block";document.body.appendChild(newdiv_shadow); var _browser = new cBrowser(); newdiv_shadow.style.height = _browser.tbodyHeight; var newdiv_mess = document.createElement("DIV"); newdiv_mess.id = "ajax_mess_div"; if(showButton)  newdiv_mess.innerHTML = "<div><img alt=\"\" src=\"../common/imgs/icons/loading.gif\" style=\"vertical-align:middle;width:18px;height:18px;margin-right:8px;\" />" + mess + "</div><div style=\"text-align:center;padding-top:10px;\"><img src=\"../common/imgs/icons/confirm.gif\" style=\"border:0px; cursor:hand;\" onclick=\"ajaxMessage()\" /></div>"; else newdiv_mess.innerHTML = "<img alt=\"\" src=\"../common/imgs/icons/loading.gif\" style=\"vertical-align:middle;width:18px;height:18px;margin-right:8px;\" />" + mess; newdiv_mess.style.display = "block"; document.body.appendChild(newdiv_mess); newdiv_mess.style.left = (_browser.bodyWidth - newdiv_mess.offsetWidth) / 2; newdiv_mess.style.top = (_browser.bodyHeight - newdiv_mess.offsetHeight) / 2 + document.documentElement.scrollTop; }else{document.body.removeChild($("ajax_mess_div"));document.body.removeChild($("ajax_mess_div_shadow"));}}
var sdwps = {icoPath : "../common/imgs/icons/", obj : null, bg : null, body : null, shadow : null, ifbody : null, iframe : null, left : null, top : null, width : null, height : null, fullWindow : false}
function showDialogWindow(url, wid, hei, title){
var _browser = new cBrowser();var scrollValue = "hidden";
if(url==null){document.body.removeChild(sdwps.obj);document.body.removeChild(sdwps.bg);sdwps.fullWindow = false;HiddenSelect("visible");/*scrollValue=(!_browser.isIE7 && _browser.isIE)?"scroll":"auto";document.documentElement.style.overflow = scrollValue;if(!_browser.isIE7 && _browser.isIE){document.documentElement.style.overflowX="hidden";}*/return;}
/*document.documentElement.style.overflow = scrollValue;
sdwps.bg = document.createElement("div");sdwps.bg.className = "sdw_bg";document.body.appendChild(sdwps.bg);sdwps.bg.style.width = _browser.tbodyWidth + 22 + "px";sdwps.bg.style.height = _browser.tbodyHeight + "px";sdwps.bg.onclick = function(){sdwps.body.style.borderColor = "#fff";setTimeout("sdwps.body.style.borderColor = \"#93b9d7\";",60);setTimeout("sdwps.body.style.borderColor = \"#fff\";",120);setTimeout("sdwps.body.style.borderColor = \"#93b9d7\";",180);}*/
sdwps.bg = document.createElement("div");sdwps.bg.className = "sdw_bg";document.body.appendChild(sdwps.bg);sdwps.bg.style.width = _browser.tbodyWidth + "px";sdwps.bg.style.height = _browser.tbodyHeight + "px";sdwps.bg.onclick = function(){sdwps.body.style.borderColor = "#fff";setTimeout("sdwps.body.style.borderColor = \"#93b9d7\";",60);setTimeout("sdwps.body.style.borderColor = \"#fff\";",120);setTimeout("sdwps.body.style.borderColor = \"#93b9d7\";",180);}
sdwps.obj = document.createElement("div");sdwps.obj.innerHTML = "<div id=\"sdw_body\"><div class=\"title\"><div class=\"text\">"+title+"</div><div class=\"button\"><img alt=\"最大化\" src=\""+sdwps.icoPath+"max.gif\" onclick=\"showDialogWindow.resizeWindow(this)\" /> <img alt=\"关闭\" src=\""+sdwps.icoPath+"close.gif\" onclick=\"showDialogWindow()\" /></div></div><div id=\"sdw_ifbody\" class=\"iframe\"></div></div><div id=\"sdw_shadow\"></div>";
sdwps.obj.className = "sdw";document.body.appendChild(sdwps.obj);sdwps.body = $("sdw_body");sdwps.body.style.width = (sdwps.width = wid) + "px";sdwps.body.style.height = (sdwps.height = hei) + "px";sdwps.body.style.left = (sdwps.left=(_browser.bodyWidth - wid - 8) / 2 + document.documentElement.scrollLeft) + "px";sdwps.body.style.top = (sdwps.top=(_browser.bodyHeight - hei - 30) / 2 + document.documentElement.scrollTop) + "px";sdwps.shadow = $("sdw_shadow");sdwps.shadow.style.width = sdwps.width + "px";sdwps.shadow.style.height = sdwps.height + "px";sdwps.shadow.style.left = sdwps.left + 6 + "px";sdwps.shadow.style.top = sdwps.top + 6 + "px";sdwps.ifbody = $("sdw_ifbody");sdwps.ifbody.innerHTML = "<iframe id=\"sdw_iframe\" frameborder=\"0\" scrolling=\""+(_browser.isIE7? "auto" : "yes") +"\" style=\"width:"+(wid - 10)+"px;height:"+(hei - 33)+"px;\" src=\"" + url + "\"></iframe>";
sdwps.iframe = $("sdw_iframe");HiddenSelect("hidden");}
showDialogWindow.resizeWindow = function(ico){if(sdwps.fullWindow){sdwps.body.style.width = sdwps.width + "px";sdwps.body.style.height = sdwps.height + "px";sdwps.body.style.left = sdwps.left + "px";sdwps.body.style.top = sdwps.top + "px";sdwps.shadow.style.width = sdwps.width + "px";sdwps.shadow.style.height = sdwps.height + "px";sdwps.shadow.style.left = sdwps.left + 6 + "px";sdwps.shadow.style.top = sdwps.top + 6 + "px";sdwps.iframe.style.width = sdwps.width - 10 + "px";sdwps.iframe.style.height = sdwps.height - 33 + "px";ico.src = ico.src.replace("min","max");ico.alt="最大化";sdwps.fullWindow = false; }else{var _browser = new cBrowser();sdwps.body.style.width = _browser.bodyWidth - 20 + "px";sdwps.body.style.height = _browser.bodyHeight - 20 + "px";sdwps.body.style.left = 5+document.documentElement.scrollLeft+"px";sdwps.body.style.top = 5+document.documentElement.scrollTop+"px";sdwps.shadow.style.width = _browser.bodyWidth - 20 + "px";sdwps.shadow.style.height = _browser.bodyHeight - 20 + "px";sdwps.shadow.style.left = 11 + document.documentElement.scrollLeft + "px";sdwps.shadow.style.top = 11 + document.documentElement.scrollTop + "px";sdwps.iframe.style.width = _browser.bodyWidth - 30 + "px";sdwps.iframe.style.height = _browser.bodyHeight - 53 + "px";ico.src = ico.src.replace("max","min");ico.alt="最小化"; sdwps.fullWindow = true; }}
function ajaxXmlHttp(){ var xmlhttp;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
      try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) { xmlhttp = null;} }
    @else
     xmlhttp = null;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined'){try{ xmlhttp = new XMLHttpRequest(); } catch (e){ xmlhttp = null; } }  return xmlhttp;
}
function loadXmlDocument(sXml){try{if(sXml.trim() == "") return null; var oXml = new ActiveXObject("Msxml2.DOMDocument"); oXml.async = false; oXml.resolveExternals = false; oXml.loadXML(sXml); return oXml;} catch(e){try{ var oParser = new DOMParser(); var oXmlDom = oParser.parseFromString(sXml,"text/xml"); return oXmlDom; }catch(E){return null;}}}
function getQueryString(key){ if(key == null){ var urlGet = /.+\?(.*)/ig; if(urlGet.test(location.href)) return location.href.replace(urlGet, "$1"); else return "";} var urlReg = new RegExp(".+[\?&]{1}" + key + "=(.*)", "ig");if(urlReg.test(location.href)){ key = location.href.replace(urlReg, "$1"); return key.split("&")[0];} else return "";}
String.prototype.replaceAndChar = function(){var tstr = this.replace(/&/g, "%26"); tstr = tstr.replace(/\+/g, "%2B"); return tstr;};
var regexPatterns = { number : /^\d+$/g, time : /^([0-1]{0,1}[0-9]|[2][0-3]):([0-5][0-9])$/g, money : /^\d{1,15}(\.\d{1,4})?$/g, date : /^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-(((([1-9])|(1[0-2]))-(([1-9])|(1[0-9])|(2[0-8])))|(((([13578])|(1[02]))-31)|((([1,3-9])|(1[0-2]))-(29|30)))))$/g }
function delConfirm(url){ if(confirm("确定要删除吗？操作将不可恢复。")) location.href=url; }




//隐藏页面中的select
function HiddenSelect(style) 
{
    var tags = document.getElementsByTagName("select")
   
    for(var i = 0; i < tags.length; i++) 
    {
        
          tags[i].style.visibility = style;
      
        
    }
}