//Resize iframe
function reSize(){
  try{
    var objBody = ifrm.document.body;
    var objFrame = document.all["ifrm"];
    ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
    if(ifrmHeight > 150){ objFrame.style.height = ifrmHeight }
    else{ objFrame.style.height = 150; }
    objFrame.style.width = '100%'
  }
  catch(e){}
}

function init_iframe(){
  reSize();
  setTimeout('init_iframe()',200)
}
init_iframe();

//Round Table
function roundTable(objID) {
  var obj = document.getElementById(objID);
  var Parent, objTmp, Table, TBody, TR, TD;
  var bdcolor, bgcolor, Space;
  var trIDX, tdIDX, MAX;
  var styleWidth, styleHeight;

  // get parent node
  Parent = obj.parentNode;
  objTmp = document.createElement('SPAN');
  Parent.insertBefore(objTmp, obj);
  Parent.removeChild(obj);

  // get attribute
  bdcolor = obj.getAttribute('rborder');
  bgcolor = obj.getAttribute('rbgcolor');
  radius = parseInt(obj.getAttribute('radius'));
  if (radius == null || radius < 1) radius = 1;
  else if (radius > 6) radius = 6;
  MAX = radius * 2 + 1;
  
  //create table {{
  Table = document.createElement('TABLE');
  TBody = document.createElement('TBODY');
  Table.cellSpacing = 0;
  Table.cellPadding = 0;

  for (trIDX=0; trIDX < MAX; trIDX++) {
    TR = document.createElement('TR');
    Space = Math.abs(trIDX - parseInt(radius));
    for (tdIDX=0; tdIDX < MAX; tdIDX++) {
      TD = document.createElement('TD');
      styleWidth = '1px'; styleHeight = '1px';
      if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
      else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
      else if (radius > 2) {
        if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
        if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
      }
      if (styleWidth != null) TD.style.width = styleWidth;
      if (styleHeight != null) TD.style.height = styleHeight;
      if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
      else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
      if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
      TR.appendChild(TD);
    }
    TBody.appendChild(TR);
  }
  //}}

  Table.appendChild(TBody);
  // insert table and remove original table
  Parent.insertBefore(Table, objTmp);
}

//Round Table #2
function top_round(w,c) {
var top_html;
top_html="<table cellpadding=0 cellspacing=0 border=0 width="+w+">";
top_html+="<tr height=1><td rowspan=4 width=1></td><td rowspan=3 width=1></td>";
top_html+="<td rowspan=2 width=1></td><td width=2></td><td bgcolor="+c+"></td>";
top_html+="<td width=2></td><td rowspan=2 width=1></td><td rowspan=3 width=1></td>";
top_html+="<td rowspan=4 width=1></td></tr><tr height=1><td bgcolor="+c+"></td>";
top_html+="<td bgcolor="+c+"></td><td bgcolor="+c+"></td></tr>";
top_html+="<tr height=1><td bgcolor="+c+"></td><td colspan=3 bgcolor="+c+"></td>";
top_html+="<td bgcolor="+c+"></td></tr><tr height=2><td bgcolor="+c+"></td>";
top_html+="<td colspan=5 bgcolor="+c+"></td><td bgcolor="+c+"></td></tr></table>";
document.write(top_html);
}

function bottom_round(w,c) {
var bottom_html;
bottom_html="<table cellpadding=0 cellspacing=0 border=0 width="+w+">";
bottom_html+="<tr height=2><td rowspan=4 width=1></td><td width=1 bgcolor="+c+"></td><td width=1 bgcolor="+c+"></td>";
bottom_html+="<td width=2 bgcolor="+c+"></td><td bgcolor="+c+"></td><td width=2 bgcolor="+c+"></td>";
bottom_html+="<td width=1 bgcolor="+c+"></td><td width=1 bgcolor="+c+"></td><td rowspan=4 width=1></td></tr>";
bottom_html+="<tr height=1><td rowspan=3></td><td bgcolor="+c+"></td><td colspan=3 bgcolor="+c+"></td>";
bottom_html+="<td bgcolor="+c+"></td><td rowspan=3></td> </tr><tr height=1><td rowspan=2></td>";
bottom_html+="<td bgcolor="+c+"></td><td bgcolor="+c+"></td><td bgcolor="+c+"></td><td rowspan=2></td></tr>";
bottom_html+="<tr height=1><td></td><td bgcolor="+c+"></td><td></td></tr></table>";
document.write(bottom_html);
}
