/* FUNCTION FOR SIDEBAR MENU*/
//GET STRING URL
function getUrl()
{
	var url = window.location.pathname;
	return url;	
}
//SET A CLASS TO A  SIDEBAR LINK (see style.css)
function hideLink()
{
	hideLink = parseUrl();
	if(document.getElementById(hideLink))//hideLink exist
	{
		/* ALSO IN THIS SECTION LINKS RULES */
		//'WHY HTM' people section special rules
		if(hideLink =='japan_team' || hideLink =='japan_management')
		{
			document.getElementById('sideBarPeople').className='sideBarSelected'; 
		}
		//'JAPAN INFO' articles section special rules
		if(hideLink.charAt(0) =='B')//business link filename begins with the character 'B'
		{
			document.getElementById('sideBarArticles').className='sideBarSelected';
		}
		//'JAPAN INFO' business link section special rules
		if(hideLink.charAt(0) =='F')//business link filename begins with the character 'F'
		{
			document.getElementById('sideBarBusiness').className='sideBarSelected';
		}
		//'JAPAN INFO' case studies section special rules
		if(hideLink.charAt(0) =='A')//case studies filename begins with the character 'A'
		{
			document.getElementById('sideBarCaseStudies').className='sideBarSelected';
		}
		/*ALL SIDEBAR LINKS*/
		document.getElementById(hideLink).className='sideBarSelected'; 
	}	
}
//RETURN FILENAME
function parseUrl()
{
	//this function parse the url then return  the filename without extension
	s = getUrl();//get pathname (example : www.htm.co.jp/index.htm)
	slash = s.lastIndexOf("/")+1;//get the index of the first filename character
	dot = s.lastIndexOf(".");//get the last dot index (here dot extension)
	s = s.substring(slash,dot);//get the filename
	return s
}

//OPEN Popup Window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function linkSelect()
{
    var lnks = document.getElementById('lnk_sidebar').getElementsByTagName('a');
    for (var i = 0; i < lnks.length; i++)
    {
        if (window.location.href.indexOf(lnks[i].href.replace('../', '')) > -1)
        {
            lnks[i].className='selected';
        }
    }
}

//Embed the flash file into the page. It fixed a problem with IE6 that force you to click on the flash animation to run it. (SEE http://www.kirupa.com/developer/flash8/flash_fix.htm)
function cz(w,h, filename, param) { 
document.write("<object  type=\"application/x-shockwave-flash\" data=\"flash/container.swf?path=flash/"+filename+param+"\" width=\""+w+"\" height=\""+h+"\">")
document.write("						<param name=\"movie\" value=\"flash/container.swf?path=flash/"+filename+param+"\" />")
document.write("						<param name=\"wmode\" value=\"transparent\" />  ")
document.write("						<img src=\"noflash.gif\" width=\"200\" height=\"100\" alt=\"\" />")
document.write("					</object>")
}
