//替换字符串内所有空格
String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
var TimeoutStatusBar = null;
function   disableStatus()   
{   
	window.status=self.top.SiteName;   
	return   true;   
}   
function SetPage(){ 
	document.write("<body topmargin=\"0\" leftmargin=\"0\" oncontextmenu=\"return false;\" onmouseover=\"disableStatus();\" onload=\"SetMain();\">");
	//document.onload = SetMain;
	document.onmouseover   =   disableStatus;   
	document.onmouseout   =   disableStatus;
	HiddStatusBar();
	//document.write("<body topmargin=\"0\" leftmargin=\"0\">");
	document.write("<center>");
}
function HiddStatusBar(){
	window.status = self.top.SiteName;
	TimeoutStatusBar = setTimeout("HiddStatusBar();",0);
}
function GetAbsoluteLocation(element) 
{ 
	try{
    if ( arguments.length != 1 || element == null ) 
    { 
        return null; 
    } 
    var offsetTop = element.offsetTop; 
    var offsetLeft = element.offsetLeft; 
    var offsetWidth = element.offsetWidth; 
    var offsetHeight = element.offsetHeight; 
    while( element = element.offsetParent ) 
    { 
        offsetTop += element.offsetTop; 
        offsetLeft += element.offsetLeft; 
    } 
	}catch(err){alert("元素绝对位置获取失败！");}
    return { absoluteTop: offsetTop, absoluteLeft: offsetLeft, 
        offsetWidth: offsetWidth, offsetHeight: offsetHeight }; 
} 
function ClassClick(ClassID,LinkUrl){
	
}
function HiddMenu(ParentPath){
    var MenuList = ParentPath.substring(2).split(",");
    var Menu = null;
    for(var i=0;i<MenuList.length;i++){
        Menu = self.document.all["Menu"+MenuList[i]];
        if(i==0){
            
        }
        Menu.style.visibility="hidden";
    }
}
function ShowMenu(ParentPath){
    var MenuList = ParentPath.substring(2).split(",");
    var Menu = null;
    for(var i=0;i<MenuList.length;i++){
        Menu = self.document.all["Menu"+MenuList[i]];
        if(Menu.style.visibility=="visible")
            continue;
        if(i==0){
            Menu.style.pixelLeft = GetAbsoluteLocation(Menu.parentNode).absoluteLeft-7;
            Menu.style.pixelTop = GetAbsoluteLocation(Menu.parentNode).absoluteTop+GetAbsoluteLocation(Menu.parentNode).offsetHeight-1;
        }else{
            Menu.style.pixelLeft = GetAbsoluteLocation(Menu.parentNode).offsetWidth+3;
            Menu.style.pixelTop = GetAbsoluteLocation(Menu.parentNode).absoluteTop-40;
        }
        Menu.style.visibility="visible";
        Menu = null;
    }
}
function ShowSelectMenu(SelectName){
    var SelectMenu = self.document.all[SelectName+"SelectMenu"];
    SelectMenu.style.pixelLeft = GetAbsoluteLocation(SelectMenu.parentNode).absoluteLeft-1;
    SelectMenu.style.pixelTop = GetAbsoluteLocation(SelectMenu.parentNode).absoluteTop+GetAbsoluteLocation(SelectMenu.parentNode).offsetHeight;
    SelectMenu.style.visibility="visible";
    SelectMenu = null;
}
function HiddSelectMenu(SelectName){
    
    var SelectMenu = self.document.all[SelectName+"SelectMenu"];
    SelectMenu.style.visibility="hidden";
    SelectMenu = null;
}
function SetSelectNameValue(SelectName,Name,Value){
    var SelectMenu = self.document.all[SelectName+"SelectMenu"];
    var oSelect = self.document.all[SelectName];
    var SelectText = self.document.all[SelectName+"SelectText"];
    SelectText.innerText = Name;
    oSelect.value = Value;
}
function CommScrollTransfer(DestName){
	var ScrollBar = event.srcElement;
	var positionY = event.clientY;
	var ScrollPad = ScrollBar.parentNode;
	var BarHeight = ScrollBar.offsetHeight;
	var PadHeight = ScrollPad.clientHeight;
	var PadTop    = GetAbsoluteLocation(ScrollPad).absoluteTop;
	positionY = positionY - BarHeight/2;
	if(positionY<PadTop)
		positionY = PadTop;
	if(positionY>(PadTop+PadHeight-BarHeight))
		positionY = PadTop+PadHeight-BarHeight;
	var ScrollPer = (positionY-PadTop)/(PadHeight-BarHeight);
	ScrollBar.style.pixelTop = positionY;
	var DestTarge = document.getElementById(DestName);
	var DestChild = DestTarge.firstChild;
	var DestHeight= DestTarge.clientHeight;
	var DestScrollHeight = DestChild.clientHeight-DestHeight;
	DestTarge.scrollTop = DestScrollHeight*ScrollPer;
}
function SetMain(){
	try{
		self.parent.document.all.main.style.pixelHeight = self.document.body.scrollHeight;
	}catch(err){}
}
function ReplaceBadChar(str){
	var Result = str;
	var RegExp0 = / /g;
	var RegExp1 = />/g;
	var RegExp2 = /</g;
	var RegExp3 = /'/g;
	var RegExp4 = /"/g;
	var RegExp5 = /%/g;
	Result = Result.replace(RegExp0,"&nbsp;");
	Result = Result.replace(RegExp1,"&gt;");
	Result = Result.replace(RegExp2,"&lt;");
	Result = Result.replace(RegExp3,"’");
	Result = Result.replace(RegExp4,"〃");
	Result = Result.replace(RegExp5,"﹪");
	return Result;
}
//通用日期选择方法 CommSelectDate
//间隔符不能为,号
function CommSelectDate(intervalYear,intervalMonth,intervalDay,showModal){
	var intervalList = intervalYear + "," +intervalMonth + "," + intervalDay + "," + showModal;
	var date = self.showModalDialog("CommDialog/Dialog_Calender.jsp",intervalList,"dialogWidth:177px;dialogHeight:200px;scroll:no;resizable:no;status:no;help:no;center:yes;edge:raised;");
	if(date==null||date==""||date.length==-1){return "";}
	return date;
}
