function imgEffect(name, imgName) {
	document.images[name].src = imgName;
}

function imgSwap(oImg)
{
   var strOver  = "_over";    // image to be used with mouse over
   var strOff = "_off";    // normal image
   var strImg = oImg.src;
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff);
   else
      oImg.src = strImg.replace(strOff,strOver);
}
function imgSwapfade(oImg)
{
   var strOver  = "_over";    // image to be used with mouse over
   var strOff = "_off";    // normal image
   var strImg = oImg.src;
   $(oImg).fadeTo(0, 0.5, imgSwapfade2);
   function imgSwapfade2()
   {
   if (strImg.indexOf(strOver) != -1)
   {
      oImg.src = strImg.replace(strOver,strOff);
   $(oImg).fadeTo(300, 1);
   }
   else
   {
      oImg.src = strImg.replace(strOff,strOver);
   $(oImg).fadeTo(300, 1);
	}
	}
}

function imgSwap2(oImg)
{
   var strOver  = "_over";    // image to be used with mouse over
   var strOff = "_over";    // normal image
   var strImg = oImg.src;
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff);
   else
      oImg.src = strImg.replace(strOff,strOver);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

rootlocation = 'http://'+document.location.hostname;
rootlocation2 = document.location.hostname;
function eng1()
{
	document.location.href=rootlocation+document.location.pathname.replace('en', 'b5');
}
function eng2()
{
	document.location.href='http://sc.lcsd.gov.hk/gb/'+rootlocation2+document.location.pathname.replace('en', 'b5');
}
function chi1()
{
	var cur_loc=document.location.pathname;
	if(location.href.toString().search('/gb/')!=-1)	
	{
	document.location.href=(location.href.toString().replace('sc.lcsd.gov.hk/gb/',''));
	}
	else
	{
		if(location.href.toString().search('www')!=-1)
		{
		document.location.href='http://sc.lcsd.gov.hk/gb/'+rootlocation2+document.location.pathname;
		}
		else
		{
		document.location.href='http://sc.lcsd.gov.hk/gb/'+rootlocation2+document.location.pathname;
		}
	}
}
function chi2()
{
	var cur_loc=document.location.pathname;
	if(location.href.toString().search('/gb/')!=-1)
	{
		document.location.href=(location.href.toString().replace('sc.lcsd.gov.hk/gb/','').replace('b5', 'en'));
	}
	else
	{
	document.location.href=rootlocation+document.location.pathname.replace('b5', 'en');
	}
}
