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);
}

function changepriv()
{
	if (document.getElementById("tbno1").style.display=="")
	{
		document.getElementById("tbno1").style.display="none"
		document.getElementById("tbno4").style.display=""
	}
	else if (document.getElementById("tbno2").style.display=="")
	{
		document.getElementById("tbno2").style.display="none"
		document.getElementById("tbno1").style.display=""
	}
	else if (document.getElementById("tbno3").style.display=="")
	{
		document.getElementById("tbno3").style.display="none"
		document.getElementById("tbno2").style.display=""
	}
	else if (document.getElementById("tbno4").style.display=="")
	{
		document.getElementById("tbno4").style.display="none"
		document.getElementById("tbno3").style.display=""
	}	
}

function changenext()
{
	if (document.getElementById("tbno1").style.display=="")
	{
		document.getElementById("tbno1").style.display="none"
		document.getElementById("tbno2").style.display=""
	}
	else if (document.getElementById("tbno2").style.display=="")
	{
		document.getElementById("tbno2").style.display="none"
		document.getElementById("tbno3").style.display=""
	}
	else if (document.getElementById("tbno3").style.display=="")
	{
		document.getElementById("tbno3").style.display="none"
		document.getElementById("tbno4").style.display=""
	}
	else if (document.getElementById("tbno4").style.display=="")
	{
		document.getElementById("tbno4").style.display="none"
		document.getElementById("tbno1").style.display=""
	}
}

function chgfocuspriv()
{
	if (document.getElementById("kofocustbl1").style.display=="")
	{
		document.getElementById("kofocustbl1").style.display="none"
		document.getElementById("kofocustbl4").style.display=""
	}
	else if (document.getElementById("kofocustbl2").style.display=="")
	{
		document.getElementById("kofocustbl2").style.display="none"
		document.getElementById("kofocustbl1").style.display=""
	}
	else if (document.getElementById("kofocustbl3").style.display=="")
	{
		document.getElementById("kofocustbl3").style.display="none"
		document.getElementById("kofocustbl2").style.display=""
	}
	else if (document.getElementById("kofocustbl4").style.display=="")
	{
		document.getElementById("kofocustbl4").style.display="none"
		document.getElementById("kofocustbl3").style.display=""
	}
}

function chgfocusnext()
{
	if (document.getElementById("kofocustbl1").style.display=="")
	{
		document.getElementById("kofocustbl1").style.display="none"
		document.getElementById("kofocustbl2").style.display=""
	}
	else if (document.getElementById("kofocustbl2").style.display=="")
	{
		document.getElementById("kofocustbl2").style.display="none"
		document.getElementById("kofocustbl3").style.display=""
	}
	else if (document.getElementById("kofocustbl3").style.display=="")
	{
		document.getElementById("kofocustbl3").style.display="none"
		document.getElementById("kofocustbl4").style.display=""
	}
	else if (document.getElementById("kofocustbl4").style.display=="")
	{
		document.getElementById("kofocustbl4").style.display="none"
		document.getElementById("kofocustbl1").style.display=""
	}
}

//function MakeFlashString(source,id,width,height,wmode, otherParam)
//{	
//	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width='"+width+"' height='"+height+"' id="+id+"><param name=wmode value="+wmode+" /><param name=movie value="+source+" /><param name=quality value=high />"+otherParam+"<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+width+" height="+height+"></embed></object>";
//}

function MakeFlashString(source,id,width,height,wmode, otherParam) 
{   
	return "<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\"  allowScriptAccess=always width="+width+" height="+height+"></embed>";
}
function MakeObjectString(classid, codebase, name, id, width,height, param) 
{  
	return "<object classid="+classid+" codebase="+codebase+" name="+name+" width="+width+" height="+height+" id="+id+"><param name=allowScriptAccess value=always><param name=wmode value="+wmode+" />"+param+"</object>"; 
}
// innerHTML Type function SetInnerHTML(target, code) {  target.innerHTML = code; }
// Direct Write Type function DocumentWrite(src) {  document.write(src); }

function trim(str){
	return str.replace(/(^\s+)|(\s+)$/,"");
}

function trandpriv()
{
	if (document.getElementById("trand1").style.display=="")
	{
		document.getElementById("trand1").style.display="none"
		document.getElementById("trand3").style.display=""
	}
	else if (document.getElementById("trand3").style.display=="")
	{
		document.getElementById("trand3").style.display="none"
		document.getElementById("trand2").style.display=""
	}
	else if (document.getElementById("trand2").style.display=="")
	{
		document.getElementById("trand2").style.display="none"
		document.getElementById("trand1").style.display=""
	}
}

function trandnext()
{
	if (document.getElementById("trand1").style.display=="")
	{
		document.getElementById("trand1").style.display="none"
		document.getElementById("trand2").style.display=""
	}
	else if (document.getElementById("trand2").style.display=="")
	{
		document.getElementById("trand2").style.display="none"
		document.getElementById("trand3").style.display=""
	}
	else if (document.getElementById("trand3").style.display=="")
	{
		document.getElementById("trand3").style.display="none"
		document.getElementById("trand1").style.display=""
	}
}

function layerRia()
{
	//document.getElementById("ria").style.display="";
	popyet();
}
function riaclose()
{
	document.getElementById("ria").style.display="none";
}
function popmile()
{
	window.open("./newmain/popmile.html", "popup_win", 'width=700, height=600, status=no, scrollbars=no, top=100,left =100');
}
function popmeta()
{
	window.open("./newmain/popmeta.html", "popup_win", 'width=1000, height=2640, status=no, scrollbars=yes, top=100,left =100');
}

function popyet()
{
	window.open("./newmain/popyet.html", "popup_win", 'width=320, height=300, status=no, scrollbars=no, top=100,left =100');
}
