function showsubmenu(sid)
{

whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
}
}

function message()
{
window.open('default.aspx', 'Login', 'fullscreen=0, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
}
function Loginout()
{
window.open('default.aspx', 'Login', 'fullscreen=0, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
}


function aa(Dir)
{tt.doScroll(Dir);Timer=setTimeout('aa("'+Dir+'")',100)}//这里100为滚动速度
function StopScroll(){if(Timer!=null)clearTimeout(Timer)}

function initIt(){
divColl=document.all.tags("DIV");
for(i=0; i<divColl.length; i++) {
whichEl=divColl(i);
if(whichEl.className=="child")whichEl.style.display="none";}
}
function expands(el) {
whichEl1=eval(el+"Child");
if (whichEl1.style.display=="none"){
initIt();
whichEl1.style.display="block";
}else{whichEl1.style.display="none";}
}
var tree= 0;
function loadThreadFollow(){
if (tree==0){
document.frames["hiddenframe"].location.replace("tree.asp");
tree=1
}
}

function switchSysBar()
{ 
  if(switchPoint.innerText==3){
     switchPoint.innerText=4
   //document.all("frmTop").style.display="none""frmTitle
   }else{
}
}

// 以下为显示日历
// create by rainie
var dDate = new Date();
var dCurMonth = dDate.getMonth();
var dCurDayOfMonth = dDate.getDate();
var dCurYear = dDate.getFullYear();
var objPrevElement = new Object();

function fToggleColor(myElement)
{
    var toggleColor = "#ff0000";
    if (myElement.id == "calDateText") 
    {
        if (myElement.color == toggleColor) 
        {
            myElement.color = "";
        } 
        else 
        {
            myElement.color = toggleColor;
        }
    } 
    else if (myElement.id == "calCell") 
    {
        for (var i in myElement.children) 
        {
            if (myElement.children[i].id == "calDateText") 
            {
                if (myElement.children[i].color == toggleColor) 
                {
                    myElement.children[i].color = "";
                } 
                else 
                {
                    myElement.children[i].color = toggleColor;
                }
            }
         }
    }
}
function fSetSelectedDay(myElement)
{
    if (myElement.id == "calCell") 
    {
        if (!isNaN(parseInt(myElement.children["calDateText"].innerText))) 
        {
            myElement.bgColor = "#c0c0c0";
            objPrevElement.bgColor = "";
            document.all.calSelectedDate.value = parseInt(myElement.children["calDateText"].innerText);
            objPrevElement = myElement;
        }
   }
}
function fGetDaysInMonth(iMonth, iYear) 
{
    var dPrevDate = new Date(iYear, iMonth, 0);
    return dPrevDate.getDate();
}
function getMonth(iMonth)
{
    var Month;
    switch (iMonth)
    {
        case 1:
            Month = "January";
            break;
        case 2:
            Month = "February";
            break;
        case 3:
            Month = "March";
            break;
        case 4:
            Month = "April";
            break;
        case 5:
            Month = "May";
            break;
        case 6:
            Month = "June";
            break;
        case 7:
            Month = "July";
            break;
        case 8:
            Month = "August";
            break;
        case 9:
            Month = "September";
            break;
        case 10:
            Month = "October";
            break;
        case 11:
            Month = "November";
            break;
        case 12:
            Month = "December";
            break;
        default:
            break;
    }
    return Month;
}
function fBuildCal(iYear, iMonth, iDayStyle) 
{
    var aMonth = new Array();
    aMonth[0] = new Array(7);
    aMonth[1] = new Array(7);
    aMonth[2] = new Array(7);
    aMonth[3] = new Array(7);
    aMonth[4] = new Array(7);
    aMonth[5] = new Array(7);
    aMonth[6] = new Array(7);
    var dCalDate = new Date(iYear, iMonth-1, 1);
    var iDayOfFirst = dCalDate.getDay();
    var iDaysInMonth = fGetDaysInMonth(iMonth, iYear);
    var iVarDate = 1;
    var i, d, w;
    if (iDayStyle == 2) 
    {
        aMonth[0][0] = "Sunday";
        aMonth[0][1] = "Monday";
        aMonth[0][2] = "Tuesday";
        aMonth[0][3] = "Wednesday";
        aMonth[0][4] = "Thursday";
        aMonth[0][5] = "Friday";
        aMonth[0][6] = "Saturday";
    } 
    else if (iDayStyle == 1) 
    {
        aMonth[0][0] = "Sun";
        aMonth[0][1] = "Mon";
        aMonth[0][2] = "Tue";
        aMonth[0][3] = "Wed";
        aMonth[0][4] = "Thu";
        aMonth[0][5] = "Fri";
        aMonth[0][6] = "Sat";
    } 
    else 
    {
        aMonth[0][0] = "Su";
        aMonth[0][1] = "Mo";
        aMonth[0][2] = "Tu";
        aMonth[0][3] = "We";
        aMonth[0][4] = "Th";
        aMonth[0][5] = "Fr";
        aMonth[0][6] = "Sa";
    }
    for (d = iDayOfFirst; d < 7; d++) 
    {
        aMonth[1][d] = iVarDate;
        iVarDate++;
    }
    for (w = 2; w < 7; w++) 
    {
        for (d = 0; d < 7; d++) 
        {
            if (iVarDate <= iDaysInMonth) 
            {
                aMonth[w][d] = iVarDate;
                iVarDate++;
            }
        }
    }
    return aMonth;
}

function fDrawCal(iYear, iMonth, iCellWidth, iCellHeight, sDateTextSize, sDateTextWeight, iDayStyle,syear,smon,num,color,year,mon,day) 
{
    var myMonth;
    myMonth = fBuildCal(iYear, iMonth, iDayStyle);
    var Month = getMonth(iMonth);
    var sdate_y = syear.split(",");
    var sdate_m = smon.split(",");
    var sdate_d = num.split(",");
    var edate_y = year.split(",");
    var edate_m = mon.split(",");
    var edate_d = day.split(",");
    var cl;
    var bcl = "#ffffff";
    var col = color.split(",");
    document.write("<table width='100%' border='0' cellspacing='0', cellpadding='0' class='ash_11'>")
    document.write("<tr><td bgcolor='#999999'height='17' colspan='7' align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold;COLOR:#ffffff'>" + Month + " " + iYear);
    document.write("</td></tr>");
    document.write("<tr>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][0] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][1] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][2] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][3] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][4] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][5] + "</td>");
    document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:11px;FONT-WEIGHT: bold'>" + myMonth[0][6] + "</td>");
    document.write("</tr>");
    document.write("<tr><td bgcolor='#999999' height='1' colspan='7'></td></tr>");
    for (w = 1; w < 7; w++) 
    {
    document.write("<tr>")
        for (d = 0; d < 7; d++) 
        {
            for(i = 0 ;i < col.length ; i++)
            {
                if(sdate_m[i] == edate_m[i])
                {
                    if( iYear == sdate_y[i] && iMonth == sdate_m[i] && myMonth[w][d] == sdate_d[i] )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    if( iYear == edate_y[i] && iMonth == edate_m[i] && myMonth[w][d]-1 == edate_d[i] )
                    {
                        cl = "";
                        bcl = "#ffffff";
                        continue;
                    }
                }
                else if(sdate_m[i] < edate_m[i])
                {
                    if( iYear == sdate_y[i] && iMonth == sdate_m[i] && myMonth[w][d] == sdate_d[i] )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    if( iYear == sdate_y[i] && iMonth > sdate_m[i] && iMonth <= edate_m[i] && myMonth[w][d] == 1 )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    if( iYear == edate_y[i] && iMonth == edate_m[i] && myMonth[w][d]-1 == edate_d[i] )
                    {
                        cl = "";
                        bcl = "#ffffff";
                        continue;
                    }
                }
                
                if(sdate_y[i] < edate_y[i])
                {
                    if( iYear == sdate_y[i] && iMonth == sdate_m[i] && myMonth[w][d] == sdate_d[i] )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    if( iYear == sdate_y[i] && iMonth > sdate_m[i] && iMonth <= 12 && myMonth[w][d] == 1 )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    if( iYear == edate_y[i] && iMonth >= 1 && iMonth <= edate_m[i] && myMonth[w][d] == 1 )
                    {
                        cl = col[i];
                        bcl = "#E0E5EF";
                        continue;
                    }
                    else if( iYear == edate_y[i] && iMonth == edate_m[i] && myMonth[w][d]-1 == edate_d[i] )
                    {
                        cl = "";
                        bcl = "#ffffff";
                        continue;
                    }
                }
            }
            document.write("<td align='center' valign='top' bgcolor='" + bcl + "' width='" + iCellWidth + "' height='" + iCellHeight + "' id=calCell>");
            if (!isNaN(myMonth[w][d])) 
            {
                document.write("<font id=calDateText style='FONT-FAMILY:Arial;FONT-SIZE:" + sDateTextSize + ";color:"+ cl +";FONT-WEIGHT:" + sDateTextWeight + "'>" + myMonth[w][d] + "</font>");
            } 
            else 
            {
                document.write("<font id=calDateText style='FONT-FAMILY:Arial;FONT-SIZE:" + sDateTextSize + ";color:"+ cl +";FONT-WEIGHT:" + sDateTextWeight + "'></font>");
            }
            document.write("</td>")
        }
        document.write("</tr>");
    }
    document.write("</table>")
}
function fUpdateCal(iYear, iMonth) 
{
    myMonth = fBuildCal(iYear, iMonth);
    objPrevElement.bgColor = "";
    document.all.calSelectedDate.value = "";
    for (w = 1; w < 7; w++) 
    {
        for (d = 0; d < 7; d++) 
        {
            if (!isNaN(myMonth[w][d])) 
            {
                calDateText[((7*w)+d)-7].innerText = myMonth[w][d];} 
            else 
            {
                calDateText[((7*w)+d)-7].innerText = " ";}
        }
    }
}
