function currencyConverter(){
var amount = document.converterform.amount.value;
var currency = document.converterform.currency_type.value;
var curr_result = document.getElementById("curr_result");

if(amount==""){
	alert("½Ð¿é¤J»È½X");
	document.converterform.amount.focus();
	return false;
}else{
	if(currency=="HKD"){
		curr_result.value = ("$ "+ Math.round(amount / 0.082)+" JPY");
		return false;
	}else{
		curr_result.value = ("$ "+ Math.round(amount * 0.082)+" HKD");
		return false;
	}
}
}

function selChange(theSel,baseURL,targetWin)
{
  var currSel=theSel.selectedIndex;

  if(currSel==0)
        return;
     var currURL=theSel.options[currSel].value;
  baseURL=baseURL.substring(0,baseURL.lastIndexOf("/")+1);
  targetWin.location.href=baseURL+currURL;

  theSel.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function winResizeTo(){
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
   window.resizeTo(myWidth,myHeight);
   alert(myWidth + " " +myHeight );
}

function bidSite(theURL,winName) { //v2.0
  window.open(theURL,winName,'toolbar=yes,location=yes,status=no,menubar=no,scrollbars=yes,resizable=yes');
}


function SetCurrentSelectedNode(ContainerName, nodeID )
{
	var Container = document.getElementById(ContainerName);
	
	if (Container)
	{
		Container.value = nodeID;
	}
	HightLight(nodeID)	;
}

function HightLight( id )
{	
	var tree = document.getElementById(TreeControlID);
	var Nodelist = tree.getElementsByTagName('table');
	
	for (i=0; i < Nodelist.length; i++)
	{
		Nodelist[i].style.backgroundColor = '';
	}

	var SelectedNode = document.getElementById(TreeControlID + "_NodeSet_" + id);
	if (SelectedNode){
		SelectedNode.style.backgroundColor = '#F3F3F3';
	}
}

function getCat(page){
	var cattype = document.form1.cattype.value; 
	document.location.href=page + '.php?cat='+ cattype ;
}