Hello guys. I am new to Java scripting please excuse me for my silly questions.

When i minimize the window the tabs present in that window are dislocated from there position and again when i maximize they come back to the normal positions.

I think that this can be solved by using:
window.onresize = selectDay15731;

But i dont know but for some reason its not working for me.
I am sending my code please have a look at it and advice me .

Code:
<script type="text/javascript">
 function selectTab( tabId )  // 1: DAY, 2: WEEK, 3: MONTH
  {
    document.getElementById('calDay1').className="";
    document.getElementById('calDay5').className="";
    document.getElementById('calDay7').className="";
    document.getElementById('calDay31').className="";
    document.getElementById('calDayList').className="";

    if ( tabId == calDay1 )      { document.getElementById('calDay1').className="here";  }
    else if ( tabId == calDay5 ) { document.getElementById('calDay5').className="here";  }
    else if ( tabId == calDay7 ) { document.getElementById('calDay7').className="here";  }
    else if ( tabId == calDay31 ) { document.getElementById('calDay31').className="here";  }
    else if ( tabId == calDayList ) { document.getElementById('calDayList').className="here";  }

    _gCalCurrentTab = tabId;
    selectDay15731();
    return;
  }

   window.onresize = selectDay15731;

  function selectDay15731()  // This is when users click on the "1 day", "5 day", "7 day", "31 day"
  {
    if ( fcCalRefreshInProgress == 1 )
      return;

    // calDay1, calDay5, calDay7, calDay31 are the 4 icons. We hightlight the the one they selected
    $('calDay1').className='';
    $('calDay5').className='';
    $('calDay7').className='';
    $('calDay31').className='';
    $('calDayList').className='';
    $(_gCalCurrentTab).className='genTblContentCellCal';

    var bsx = getBrowserSizeX() - 570;
    if ( browser.isIE ) bsx += 20;
    var sa = 'N';  // sa = Show All
    if ( gShowAllDay == 1 )
      sa = 'Y';

    $('fcApptDailyHdr').style.display = "block";
    var calMode = '';
    if ( _gCalCurrentTab == 'calDay1' )      calMode = 'PPOL_DAY';
    else if ( _gCalCurrentTab == 'calDay5' ) calMode = 'PPOL_W5';
    else if ( _gCalCurrentTab == 'calDay7' ) calMode = 'PPOL_W7';
    else if (_gCalCurrentTab == 'calDay31')  calMode = 'PPOL_MONTH';
    else if ( _gCalCurrentTab == 'calDayList') calMode = 'PPOL_LIST';
    SimpleAJAXCall ( '<%=submitUrlCalH%>&day='+_gCurrentDayStr+'&cm='+calMode+'&bsx='+bsx, refreshFcApptHdr, 'POST', '' );

    SimpleAJAXCall ( '<%=submitUrlCalAD%>&day='+_gCurrentDayStr+'&cm='+calMode+'&bsx='+bsx, calRefreshAlldayArea, 'POST', '' );

    var fcCalRefreshInProgress = 1;
    if ( _gCalCurrentTab == 'calDay1' )
    {
      _lastSubmitUrl = '<%=submitUrlApptD%>&day='+_gCurrentDayStr+'&bsx='+bsx+'&sa='+sa+gXtraParam;
      SimpleAJAXCall ( _lastSubmitUrl+'&refreshview=Y', refreshFcApptView, 'POST', '' );
    }
    else if ( _gCalCurrentTab == 'calDay5' )
    {
      _lastSubmitUrl = '<%=submitUrlApptW5%>&day='+_gCurrentDayStr+'&bsx='+bsx+'&sa='+sa+gXtraParam;
      SimpleAJAXCall ( _lastSubmitUrl+'&refreshview=Y', refreshFcApptView, 'POST', '' );
    }
    else if ( _gCalCurrentTab == 'calDay7' )
    {
      _lastSubmitUrl = '<%=submitUrlApptW7%>&day='+_gCurrentDayStr+'&bsx='+bsx+'&sa='+sa+gXtraParam;
      SimpleAJAXCall ( _lastSubmitUrl+'&refreshview=Y', refreshFcApptView, 'POST', '' );
    }
    else if ( _gCalCurrentTab == 'calDay31' ) // calDay31
    {
      _lastSubmitUrl = '<%=submitUrlApptM%>&day='+_gCurrentDayStr+'&bsx='+bsx+'&sa='+sa+gXtraParam;
      SimpleAJAXCall ( _lastSubmitUrl+'&refreshview=Y', refreshFcApptView, 'POST', '' );
    }
    else {
      _lastSubmitUrl = '<%=submitUrlCalL%>&day='+_gCurrentDayStr+'&bsx='+bsx+'&sa='+sa+gXtraParam;
      SimpleAJAXCall ( _lastSubmitUrl+'&refreshview=Y', refreshFcApptView, 'POST', '' );
    }
  }
</script>

<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
 <% if ( !_ahsPage.getSP("T4P").equals("Y") ) { %>
<tr><td colspan=4 height=4 class=fcCalDayBanner><img src="graphics/z0.gif" width=100% height=4></td></tr> <!-- Orange FC Color Banner -->
  <% } else { %>
      <tr><td colspan=4 height=4 class=t4PfcCalDayBanner><img src="graphics/z0.gif" width=4 height=4></td></tr>
 <% } %>
<tr>
  <td width=99% nowrap background="graphics/barbkg.gif" align=left>
    <table width=99% cellspacing=0 cellpadding=1 border=0>

    <!-- <tr>
      <td>&nbsp;</td>
      <td id=calDay1 class=genTblContentCellCal><img src="graphics/ozIconCal1.gif" style="cursor: pointer;" onClick="javascript:_gCalCurrentTab='calDay1';selectDay15731();"></td>
      <td id=calDay5><img src="graphics/ozIconCal5.gif"   style="cursor: pointer;" onClick="javascript:_gCalCurrentTab='calDay5';selectDay15731();"></td>
      <td id=calDay7><img src="graphics/ozIconCal7.gif"   style="cursor: pointer;" onClick="javascript:_gCalCurrentTab='calDay7';selectDay15731();"></td>
      <td id=calDay31><img src="graphics/ozIconCal31.gif" style="cursor: pointer;" onClick="javascript:_gCalCurrentTab='calDay31';selectDay15731();"></td>
    </tr>   -->

    <!-- Buttons (CalDay1, CalDay5, CalDay7, CalDay31) are changed into Tabs  (Day, 5-Day, 7-Day, Month, List)    -->

    <td nowrap colspan=3>
		<ul id="midnav">
			<li>
			   <a id="calDay1"
                  style="cursor: pointer;"
                  href="javascript:selectTab('calDay1');"
                  class="<%=(_gCalCurrentTab=="calDay1")?"here":""%>"> <%=_prompt.get("day_main")%>
               </a>
		    </li>
			<li>
               <a id="calDay5"
                  style="cursor: pointer;"
                  href="javascript:selectTab('calDay5');"
                  class="<%=(_gCalCurrentTab=="calDay5")?"here":""%>"> <%=_prompt.get("5_day")%>
               </a>
            </li>
            <li>
                <a id="calDay7"
                  style="cursor: pointer;"
                  href="javascript:selectTab('calDay7');"
                  class="<%=(_gCalCurrentTab=="calDay7")?"here":""%>"> <%=_prompt.get("7_day")%>
               </a>
			</li>
            <li>
               <a id="calDay31"
                  style="cursor: pointer;"
                  href="javascript:selectTab('calDay31');"
                  class="<%=(_gCalCurrentTab=="calDay31")?"here":""%>"> <%=_prompt.get("month")%>
			   </a>
		    </li>
            <li>
               <a id="calDayList"
                  style="cursor:pointer;"
                  href="javascript:selectTab('calDayList');"
                  class="<%=(_gCalCurrentTab=="calDayList")?"here":""%>"> <%=_prompt.get("list_main")%>
               </a>
            </li>
        </ul>
	</td>


    </table>
  </td>

 <td background="graphics/barbkg.gif" valign=top align=right><a href=# onClick="goCalendarMax();" class=verySmall>Max</a></td> 
</tr>
</table>

  <table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
  <tr><td valign=top>
    <div id=fcApptDailyHdr style="display:block; position: relative; display: block; border-style: none; border-width: 0px; overflow: none;"><%=FcApptUtil.renderDailyHdr( _ahsPage, ozDay )%> </div>
  </td></tr>
  <tr><td valign=top>
    <div id=divCalAlldayArea style="display:block; -moz-user-select: none; overflow: none;" unselectable="on" ></div>
  </td></tr>
  </table>

  <table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
  <tr><td height=1><img src="graphics/z0.gif" height=1 id="fcApptDailyStartIndicator"></td></tr>
  <tr><td valign=top>
    <div id=fcApptDaily  style="display:block; height:100px; position: relative; overflow: auto; VERTICAL-ALIGN: top;"> </div>
  </td></tr>
  </table>
Thanks in Advance