//new news page
function js_callpage(htmlurl) 
{
	window.open(htmlurl,"newwin","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=auto,height=auto");
	return false;
}
//new page small
function js_callpage_s(htmlurl) 
{
	window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=350");

}

//Change Cell Content
function switchCell(n) {
	for(i=0;i<navcell.length;i++){
		navcell[i].className="tab-off";
		tb[i].style.display="none";
	}
	navcell[n].className="tab-on";
	tb[n].style.display="block";
}

//Change List Content
function switchList(n) {
	if(listDetails[n].style.display=="none"){
	for(i=0;i<listDetails.length;i++){
		listDetails[i].style.display="none";
	}
		listDetails[n].style.display="";
	}else{
		listDetails[n].style.display="none";	
	}
}

//guestBook Content words Limit
function gbcount(message,total,used,remain)
{
  var max;
  max = total.value;
  if(message.value.length > max){
    message.value = message.value.substring(0,max);
    used.value = max;
    remain.value = 0;
    alert('¨¢???2??¨¹3?1y1??¡§¦Ì?¡Á?¨ºy!');
  }
  else{
    used.value = message.value.length;
    remain.value = max - used.value;
  }
}

//****************************
// submenu expend begin
scores = new Array(1);
var numTotal=0;
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

if (ver4) {
    with (document) {
        write("<STYLE TYPE='text/css'>");
        if (NS4) {
            write(".parent {position:absolute; visibility:visible}");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        }
        else {
            write(".child {display:none}")
        }
        write("</STYLE>");
    }
}

function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}

function arrange() {
    nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}

function initIt(){
    if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1 ) 
            {
	            if(whichEl.id.indexOf("KB1") == -1)
	            	whichEl.visibility = "hide";
	            else
	            	whichEl.visibility = "show";
            }
       }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);
            if (whichEl.className == "child") 
            {
	            if(whichEl.id != "KB1Child")
	            	whichEl.style.display = "none";
	            else
	            	whichEl.style.display = "block";
            }
        }
    }
}

function expandIt(el) {
   
	if (!ver4) return;
   
    if (IE4) {
        whichEl1 = eval(el + "Child");
       
		for(i=1;i<=numTotal;i++){
			
			whichEl = eval(scores[i] + "Child");
			
			if(whichEl!=whichEl1) {
				whichEl.style.display = "none";
			}
		}
        whichEl1 = eval(el + "Child");
        
        if (whichEl1.style.display == "none") {
            whichEl1.style.display = "block";
        }
        else {
            whichEl1.style.display = "none";
        }
    }
    else {
        whichEl = eval("document." + el + "Child");
		for(i=1;i<=numTotal;i++){
			whichEl = eval("document." + scores[i] + "Child");
			if(whichEl!=whichEl1) {
				whichEl.visibility = "hide";
			}
		}
        if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
        }
        else {
            whichEl.visibility = "hide";
        }
        arrange();
    }
}
onload = initIt;
// submenu expend end

// iframe ????????
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 

function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}

// show/hide the divisions begin
// quick browser tests
	var ns4 = (document.layers) ? true : false;
	var ie4 = (document.all && !document.getElementById) ? true : false;
	var ie5 = (document.all && document.getElementById) ? true : false;
	var ns6 = (!document.all && document.getElementById) ? true : false;
	
	function show(sw,obj) {
		if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
		if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
		if (sw && ns4) document.layers[obj].visibility = 'visible';
		if (!sw && ns4) document.layers[obj].visibility = 'hidden';
	}
// show/hide the divisions end	