﻿function $(id) {
return document.getElementById(id);
}
//重设所有图片宽高
function ResetImagesSize()
{
var shitImages=document.getElementsByTagName("img");
for(var ii=0;ii<shitImages.length;ii++) {
shitImages[ii].width=shitImages[ii].width;
shitImages[ii].height=shitImages[ii].height;
}
}
//设置左右高度自适应
function SameHigh2(div1,div2) {
try {
var a=Math.max($(div1).offsetHeight,$(div2).offsetHeight);
$(div1).style.height = a + "px";
$(div2).style.height = a + "px";
}
catch(e){
//alert("error of SameHigh2: \n"+e.message);
}
}
//设置左中右高度自适应
function SameHigh3(div1,div2,div3) {
try {
var a=Math.max(document.getElementById(div1).offsetHeight,document.getElementById(div2).offsetHeight,document.getElementById(div3).offsetHeight);
document.getElementById(div1).style.height = a + "px";
document.getElementById(div2).style.height = a + "px";
document.getElementById(div3).style.height = a + "px";
}
catch(e){
//alert("error of SameHigh3: \n"+e.message);
}
}
//设置内容页面左右高度自适应
function SameAContHigh(div1,div2,div3) {
try {
var a=document.getElementById(div1)
var b=document.getElementById(div2)
var c=document.getElementById(div3)
if (a.offsetHeight+b.offsetHeight+12<c.offsetHeight) {
a.style.height=(c.offsetHeight-b.offsetHeight-12) + "px";
}
else {
c.style.height=(a.offsetHeight+b.offsetHeight+8) + "px";
}
}
catch(e){
//alert("error of SameAContHigh: \n"+e.message);
}
}
//最小文章内容高度
function MinHigh(id,h) {
if ($(id).offsetHeight<h) {
$(id).style.height=h+"px";
}
}
//切换主菜单
var oldClassID=0;
function ShowMenu(i)
{
document.getElementById("Menu2").innerHTML=menu[i];
if(oldClassID!=0) document.getElementById("class" + oldClassID).className="";
document.getElementById("class" + i).className="in";
oldClassID=i;
}
//切换选项卡
function switchTab(identify,index,count) {
for(i=0;i<count;i++) {
var CurTabObj = document.getElementById("Tab_"+identify+"_"+i) ;
var CurListObj = document.getElementById("List_"+identify+"_"+i) ;
if (i != index) {
fRemoveClass(CurTabObj , "upH3") ;
fRemoveClass(CurListObj , "upBox") ;
}
}
fAddClass(document.getElementById("Tab_"+identify+"_"+index),"upH3") ;
fAddClass(document.getElementById("List_"+identify+"_"+index),"upBox") ;
}
function fAddClass(XEle, XClass)
{/* shawl.qiu code, void return */
if(!XClass) throw new Error("XClass 不能为空!");
if(XEle.className!="")
{
var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
XEle.className = XEle.className.replace(Re, "");
var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
if (OldClassName == "" ) {
XEle.className = XClass;
}
else {
XEle.className = OldClassName + " " + XClass;
}
}
else XEle.className = XClass;
}/* end function fAddClass(XEle, XClass) */
function fRemoveClass(XEle, XClass)
{/* shawl.qiu code, void return */
if(!XClass) throw new Error("XClass 不能为空!");
var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
if(OldClassName!="")
{
var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
XEle.className = OldClassName.replace(Re, "");
}
}/* function fRemoveClass(XEle, XClass) */
//切换选项卡end
//清除错误
function killErrors(){return true;}
//浮动窗口
var Obj='';
document.onmouseup=MUp;
document.onmousemove=MMove;
function MDown(Object){
Obj=Object.id;
document.all(Obj).setCapture();
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}
function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}
function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
function open_msgbox(){
var clientWidth = document.body.clientWidth;
var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
$("msg_box").style.left = (clientWidth-520)/2 + 'px';
$("msg_box").style.top = ((clientHeight - 410) / 2 + scrollTop) + 'px';
$("msg_mask").style.visibility='visible';
$("msg_box").style.visibility='visible';
return false;
}
function close_msgbox(){
$("msg_box").style.visibility='hidden';
$("msg_mask").style.visibility='hidden';
$("msg_box").style.left = '0px';
$("msg_box").style.top = '0px';
return false;
}
//Talk
function OpenClose(o,id){
if ($('ct' + id).style.height!="auto") {
$('ct' + id).style.height="auto";
o.src="images/talk/bClose.gif";
}else{
$('ct' + id).style.height="35px";
o.src="images/talk/bOpen.gif";
}
}

