var isIE = (navigator.appName.indexOf("Microsoft") > -1);
var d = document;

if (!levelArray)	var levelArray = new Array();


function init()
{
	
	if (levelArray.length == 0)	getLevel();
	if (levelArray.length > 0)	highlightTopNav();
	if (levelArray.length > 1)	highlightLeftNav();
	
	if (levelArray.length > 0)	genBreadcrumbs();
	
	setFieldFocus();
	setBtnOver();	

}

function getLevel()
{
	var url = location.pathname;
	var array = url.split('/');
	
	for (var i=0; i<array.length; i++)
	{
		if (array[i].indexOf('_') >= 0)
		{
			
			var array1 = array[i].split('_');
			for (var j=0; j<array1.length; j++)
			{
				levelArray.push(array1[j]);
			}
			
		}
		else
		{
			levelArray.push(array[i]);
			
		}
	}
	
	
	levelArray.shift();
	levelArray.shift();
	
	var obj = levelArray[levelArray.length-1];
	if (obj != 'index.html')
	{
		levelArray[levelArray.length-1] = obj.replace('.shtml', '');
	}
	else
	{
		levelArray.pop();
	}
	//alert(levelArray);
}

function showPulldown(btn, id)
{
	//if (btn.className.indexOf('active') >= 0)	return;
	
	var menu = d.getElementById(id + 'Pulldown');
	


	showLayer(1);
	btn.onmouseover		= function() {menu.hit = true;	showLayer(1);};
	menu.onmouseover	= function() {menu.hit = true;	showLayer(1);};
	btn.onmouseout		= function() {menu.hit = false;	showLayer(0);};
	menu.onmouseout		= function() {menu.hit = false;	showLayer(0);};
	
	function showLayer(over)
	{
		if (over == 1)
		{
			//if (btn.id != levelArray[0] && btn.className.indexOf('mouseon') < 0)	btn.className += ' mouseon';
			if (btn.className.indexOf('over') < 0)	btn.className += ' over';
			menu.style.display = 'block';
			
		}
		else
		{
			//if (btn.id != levelArray[0])	btn.className = btn.className.replace('mouseon', '');
			btn.className = btn.className.replace('over', '');
			
			
			setTimeout(function()
			{
				if (!menu.hit) {menu.style.display = 'none';}
			}, 10);
		}
	}
}

function onClickPulldown(btn, id)
{
	
	var menu = d.getElementById(id + 'Pulldown');

	showLayer(1);
	btn.onclick		= function() {menu.hit = true;	showLayer(1);};
	menu.onmouseover	= function() {menu.hit = true;	showLayer(1);};
	btn.onmouseout		= function() {menu.hit = false;	showLayer(0);};
	menu.onmouseout		= function() {menu.hit = false;	showLayer(0);};
	
	function showLayer(over)
	{
		if (over == 1)
		{
			//if (btn.id != levelArray[0] && btn.className.indexOf('mouseon') < 0)	btn.className += ' mouseon';
			//if (btn.className.indexOf('mouseon') < 0)	btn.className += ' mouseon';
			if (btn.className.indexOf('onclick') < 0)	btn.className += ' onclick';
			menu.style.display = 'block';
			
		}
		else
		{
			//if (btn.id != levelArray[0])	btn.className = btn.className.replace('mouseon', '');
			btn.className = btn.className.replace('onclick', '');			
			
			setTimeout(function()
			{
				if (!menu.hit) {menu.style.display = 'none';}
			}, 10);
		}
	}
}

function highlightTopNav()
{
	var obj = levelArray[0];
	
	if (!d.getElementById(obj))	return;
	
	var btn = d.getElementById(obj);
	btn.className += ' active';
	
	if (!d.getElementById(obj + '_menu'))	return;
	
	var menu = d.getElementById(obj + '_menu');
	menu.style.display = 'block';
}


function highlightLeftNav()
{	
	var obj = levelArray[1];
	//level 1 has landing page need this code
	if (!d.getElementById('leftNav')) return;
	//end level 1 has landing page
	
	if (!getElementByRel('leftNav', obj))	return;
	
	//var btn = d.getElementById(obj);
	var btn = getElementByRel('leftNav', obj);
	btn.className += ' active';
	
	if (d.getElementById(obj + '_menu')) {
		var menu = d.getElementById(obj + '_menu');
		menu.style.display = 'block';
	}
	
	if (!levelArray[2])	return;
	
	var obj1 = levelArray[2];	
	
	if (!d.getElementById(obj + '_menu'))	return;
	if (!getElementByRel('leftNav', obj1))	return;
	
	//var menu = d.getElementById(obj + '_menu');
	//menu.style.display = 'block';
	
	var btn1 = getElementByRel('leftNav', obj1);
	btn1.className += ' active';
	
	if (!levelArray[3])	return;	
	
	var obj2 = levelArray[3];
	var subMenu = d.getElementById(obj1 + '_menu');
	subMenu.style.display = 'block';
	var btn2 = getElementByRel('leftNav', obj2);
	btn2.className += ' active';	
}

function getElementByRel(parent, obj)
{
	var a = d.getElementById(parent).getElementsByTagName('a');
	for (var i=0; i<a.length; i++)
	{
		if (a[i].rel == obj)
		{
			return a[i];
		}
	}
}


function genBreadcrumbs()
{
	if (!d.getElementById('breadcrumb'))	return;
	var breadcrumbs = d.getElementById('breadcrumb');
	
	var a = createA('/en/index.shtml', '_self', 'Home');
	breadcrumbs.appendChild(a);
	
	for (var i=0; i<levelArray.length; i++)
	{
		if (!levelArray[i])	break;
		
		var obj = levelArray[i];
		if (d.getElementById(levelArray[i]))
		{			
			var btn = d.getElementById(levelArray[i]);			
		}
		else
		{		
				var btn = getElementByRel('leftNav', levelArray[i]);
		}
		if (!btn) break;
		var txt = (isIE)	?	btn.innerText	:	btn.textContent;
		
		var link = btn.href;
		
		breadcrumbs.innerHTML += ' > ';
		/*display breadcrumb till level 3*/
		
		if (i== 2 || levelArray[i] == 'annual') {
			breadcrumbs.innerHTML += txt;	
			break;
		}
		
		if (levelArray[i] == 'corporate' || levelArray[i] == 'contact' || levelArray[i] == 'others') {
				breadcrumbs.innerHTML += txt;	
				break;
		}
	
		if (i < levelArray.length-1)
		{
			var a = createA(link, '_self', txt);
			breadcrumbs.appendChild(a);
		}
		else
		{			
			breadcrumbs.innerHTML += txt;			
		}
		
	}
}


function checkURL(array)
{
	var url = window.top.location.href;
	var id;
	var va = [["/", "/"], ["=", ""]];
	
	for (var item=0; item<va.length; item++)
	{
		for (var i=0; i<array.length; i++)
		{
			if (url.indexOf((va[item][0] + array[i] + va[item][1])) >= 0)
			{
				id = array[i];
				break;
			}
		}
	}
	
	return id;
}

/*Change language*/
function changeLanguage(target)
{
	var array = new Array("en", "tc", "sc");
	var nowL = checkURL(array);
	var va = [["/", "/"], ["=", ""]];
	var url = window.top.location.href;
	for (var item=0; item<va.length; item++)
	{
		if (url.indexOf((va[item][0] + nowL + va[item][1])) >= 0)
		{
			url = url.replace((va[item][0] + nowL + va[item][1]), (va[item][0] + target + va[item][1]));
			break;
		}
	}
	if (url.substring((url.length-1), url.length) == '#')	url = url.substring(0, (url.length-1))
	
	window.top.location.href = url;
}

/*Popup a new window*/
function NewWindow(mypage, myname, w, h, scroll,resizable) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+','
	win = window.open(mypage, myname, winprops)
	win.self.focus()
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function createImg(src, alt, w, h, link, t, className)
{
	var img = d.createElement('img');
	if (src)	img.setAttribute('src', src);
	if (alt)	img.setAttribute('alt', alt);
	if (w)	img.setAttribute('width', w);
	if (h)	img.setAttribute('height', h);
	if (className)	img.className = className;
	
	if (link)
	{
		img.setAttribute('border', 0);
		
		var a = d.createElement('a');
		a.setAttribute('href', link);
		if (t && typeof(t) != 'undefined')	a.setAttribute('target', t);
		a.appendChild(img);
		return a;
	}
	else
	{	
		return img;
	}
}

function createA(link, t, txt, id, className)
{		
	var a = d.createElement('a');
	if (link)	a.setAttribute('href', link);
	if (t && typeof(t) != 'undefined')	a.setAttribute('target', t);
	
	//if (txt)	a.appendChild(d.createTextNode(txt));
	if (txt)	a.innerHTML = txt;
	if (id)	a.setAttribute('id', id);
	if (className)	a.className = className;
	
	return a;
}

function createDiv(id, className, txt)
{		
	var div = d.createElement('div');
	if (id)	div.setAttribute('id', id);
	if (className)	div.className = className;
	//if (txt)	div.appendChild(d.createTextNode(txt));
	if (txt)	div.innerHTML = txt;
	return div;
}

function createTag(tag, id, className)
{		
	var div = d.createElement(tag);
	if (id)	div.setAttribute('id', id);
	if (className)	div.className = className;
	return div;
}

function createInput(name, type, value, className)
{		
	var input = d.createElement('input');
	if (name)	input.setAttribute('name', name);
	if (type)	input.setAttribute('type', type);
	if (value)	input.setAttribute('value', value);
	if (className)	input.className = className;
	return input;
}

function startFading(el)
{
  if (el.fadinTimeout)	clearTimeout(el.fadinTimeout);
  el.style.visibility = 'visible';
  el.style.zIndex = 2;
  setOpacity(el, 0);
  fadeImage(el, 0);
}

function fadeImage(el, currentOpacity)
{
  currentOpacity += 20;

  if (currentOpacity > 100)
  {
    setOpacity(el, 100);
    el.style.zIndex = 1;
	if (el.fadinTimeout)	clearTimeout(el.fadinTimeout);
  }
  else
  {
    setOpacity(el, currentOpacity);
    el.fadinTimeout = setTimeout(function() { fadeImage(el, currentOpacity); }, 20);
  }
}

function setOpacity(el, opacity)
{
	opacity /= 100;
	el.style.opacity = opacity;
	el.style.MozOpacity = opacity;
	el.style.filter = "alpha(opacity=" + (opacity*100) + ")";
}

function setBtnOver()
{
	var img = d.getElementsByTagName('img');
	
	for (var i=0; i<img.length; i++)
	{
		if (img[i].className.indexOf('btnOver') < 0)	continue;
		if (img[i].src.indexOf('_over') >= 0)			img[i].clicked = true;
		
		img[i].onmouseover = function()
		{
			if (this.clicked)	return;
			var ext = this.src.substring(this.src.length-4, this.src.length);
			this.src = this.src.replace(ext, '_over' + ext);
		}
		
		img[i].onmouseout = function()
		{
			if (this.clicked)	return;
			var ext = this.src.substring(this.src.length-4, this.src.length);
			this.src = this.src.replace('_over' + ext, ext);
		}
	}
}

function setFieldFocus()
{
	var input = d.getElementsByTagName('input');
	
	for (var i=0; i<input.length; i++)
	{
		if (input[i].type != 'text')			continue;
		//if (input[i].className == 'routeField')	continue;
		
		input[i].onfocus = function()
		{
			if (this.value == this.defaultValue)	this.value = '';
		}
		
		input[i].onblur = function()
		{
			if (this.value == '')	this.value = this.defaultValue;
		}
	}
}

function setChildNodes(obj, tagName)
{
	var array = new Array();
	
	for (var i=0; i<obj.childNodes.length; i++)
	{
		if (tagName)
		{
			//alert(obj.childNodes[i].tagName)
			if (obj.childNodes[i].tagName != tagName)	continue;
		}
		if (obj.childNodes[i].toString().toLowerCase().indexOf('text') >= 0)	continue;
		array.push(obj.childNodes[i]);
	}
	
	return array;
}

/*change fontsize*/
//Specify spectrum of different font sizes:
var szs = new Array('82%', '100%', '120%');
//var szs = new Array('x-small', 'small', 'medium');
//var szs = new Array('1em', '1.05em', '1.10em', '1.15em');
var startSz = sz = 0;

function getFontSize()
{	
	if (getCookie('fontSize') == null)
	{		
		startSz = 0;
	}
	else
	{ 
		startSz = getCookie('fontSize');
		if (startSz == "NaN")	startSz = 0;
	}	
	changeFontSize(startSz, true);
}

function changeFontSize(inc, start)
{
	if (!document.getElementById) return;
	var d = document,cEl = null,sz = eval(startSz),i,j,cTags;
	
	if (!start)
	{
		sz += inc;
		
		if ( sz < 0 ) sz = 0;
		if ( sz > (szs.length-1) ) sz = (szs.length-1);
		startSz = sz;
	}
	else
	{
		sz = inc;
	}
	
	cEl = d.getElementsByTagName('body')[0];
	cEl.style.fontSize = szs[ sz ];	
	setCookie("fontSize", sz, nd, cpath, cdomain);

}

var nd= new Date();
nd.setTime(nd.getTime()+(365*24*60*60*1000));
//cdomain = (location.domain) ? location.domain : null;
var cdomain = (location.domain) ? location.domain : null;
var cpath = "/";

function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");

  document.cookie = curCookie;
}

function getCookie(name)
{
	if (document.cookie.indexOf(name) < 0)
	{		
		return null;
	}
	else
	{	
		var startStr = document.cookie.indexOf(name) + name.length + 1;
		var endStr = document.cookie.indexOf(";", startStr);
		if (endStr == -1)	endStr = document.cookie.length;
		return unescape(document.cookie.substring(startStr, endStr));
	}
}
/*end of change fontsize*/


function showHideDiv(obj, num)
{
	var div = setChildNodes(d.getElementById(obj), 'DIV');
	
	for (var i=0; i<div.length; i++)
	{
		div[i].style.display = 'none';
	}
	
	div[num].style.display = 'block';
}

function showAll(obj)
{
	var div = setChildNodes(d.getElementById(obj), 'DIV');
	
	for (var i=0; i<div.length; i++)
	{
		div[i].style.display = 'block';
	}
}

function showHideObj(obj, self, objType, num)
{
	var child = setChildNodes(d.getElementById(obj), objType);
	var btns = setChildNodes(d.getElementById(self), 'A');
	
	for (var i=0; i<child.length; i++)
	{
		child[i].style.display = 'none';
	}
	
	child[num].style.display = 'block';
	
	for (var i=0; i<btns.length; i++)
	{
		btns[i].className = btns[i].className.replace(/active/, '');
	}
	
	btns[num].className += ' active';
}

function GetParam(name)
{
	var start=location.search.indexOf("?"+name+"=");
	if (start<0) start=location.search.indexOf("&"+name+"=");
 	if (start<0) return '';
 	start += name.length+2;
 	var end=location.search.indexOf("&",start)-1;
 	if (end<0) end=location.search.length;
 	var result=location.search.substring(start,end);
 	var result='';
 	for(var i=start;i<=end;i++)
 	{
 		var c=location.search.charAt(i);
 		result=result+(c=='+'?' ':c);
 	}
 	//alert(unescape(result));
 	return unescape(result);
}

function checkParam(v, id)
{
	if (!GetParam(v))	return;
	var q = GetParam(v) - 1;
	
	showHideDiv(id, q);
}

var setPromotion = 
{
	init:	function (obj, obj2)
	{
		this.leftContainer = d.getElementById(obj);
		this.container = d.getElementById(obj2);
		this.setA(this.leftContainer, this.container);
	},
	
	setA:	function (obj, obj2)
	{
		var leftDiv = setChildNodes (obj, 'A');
		var contentDiv = setChildNodes (obj2, 'DIV');
		
		//alert(leftDiv.length);
		for (var i=0; i<leftDiv.length; i++)
		{
			leftDiv[i].num = i;
			leftDiv[i].div = contentDiv[i];
			leftDiv[i].className = leftDiv[i].className.replace('active', '');
			
			leftDiv[i].onclick = function()
			{
				if (this.className.indexOf('active') >= 0)	return;
				setPromotion.changeA(this, true);
			}
		}
		
		for (var i=0; i<contentDiv.length; i++)
		{
			contentDiv[i].style.display = 'none';
		}
		
		setPromotion.highlightA = leftDiv[0];
		setPromotion.highlightDiv = contentDiv[0];
		
		setPromotion.changeA(leftDiv[0], false);
	},
	
	changeA:	function (obj, fadeIn)
	{
		var highlightA = setPromotion.highlightA;
		highlightA.className = highlightA.className.replace('active', '');
		obj.className += ' active';
		setPromotion.highlightA = obj;
		
		var div = obj.div;
		setPromotion.highlightDiv.style.display = 'none';
		div.style.display = 'block';
		setPromotion.highlightDiv = div;
		
		if (fadeIn)	startFading(div);
		//obj2.style.display = 'block';
	}
}

function emailAFriend()
{
	var emailMsg = new Array();
	emailMsg[0] = "Click the following to access the sent link:%0A%0A";
	emailMsg[1] = "You have received the following link to the Henderson Investment Limited";
	var winEF = window.open("mailto:?body="+ emailMsg[0] + escape((window.top.location.href).replace("?","!")) + "&subject=" + emailMsg[1], '_self');
}

function genSwf(id, file, w, h, xml, wmode)
{
	var flashvars = {};
	flashvars.path = '/en/';
	flashvars.imagePath = 'images/';
	flashvars.swfPath = 'swf/';
	if (xml)	flashvars.xmlPath = xml;

	var params = {};
	params.allowscriptaccess = 'sameDomain';
	if (wmode)	params.wmode = wmode;
	
	var attributes = {};
	
	swfobject.embedSWF(file, id, w, h, '9.0.45', false, flashvars, params, attributes);
}

//gen the annual list item
var annualArray = new Array(
	{name:"Interim Report 2011", id:"12", link:"/en/pdf/investor/annual/hi_interim_2011.pdf", target:"_blank"},
	{name:"Annual Report 2010", id:"11", link:"/en/investor/annual_10.shtml", target:"_self"},
	{name:"Interim Report 2010", id:"10", link:"/en/pdf/investor/annual/hi_interim_2010.pdf", target:"_blank"},
	{name:"Annual Report 2009", id:"09", link:"/en/investor/annual_09.shtml", target:"_self"},
	{name:"Second Interim Report 2009", id:"09b", link:"/en/pdf/investor/annual/hi_interim_2008-2009_2.pdf", target:"_blank"},
	{name:"Interim Report 2009",id:"09c", link:"/en/pdf/investor/annual/hi_interim_2008-2009.pdf", target:"_blank"},
	{name:"Annual Report 2008",id:"08", link:"/en/investor/annual_08.shtml", target:"_self"},
	{name:"Interim Report 2008",id:"08b", link:"/en/pdf/investor/annual/2007/hid_interim_2007-2008.pdf", target:"_blank"},
	{name:"Annual Report 2007",id:"07", link:"/en/investor/annual_07.shtml", target:"_self"},
	{name:"Interim Report 2007",id:"07b", link:"/en/pdf/investor/annual/2006/hi.pdf", target:"_blank"},
	{name:"Annual Report 2006",id:"06", link:"/en/investor/annual_06.shtml", target:"_self"},
	{name:"Interim Report 2006",id:"06b", link:"/en/pdf/investor/annual/2005/hi200506.pdf", target:"_blank"},
	{name:"Annual Report 2005",id:"05", link:"/en/investor/annual_05.shtml", target:"_self"},
	{name:"Interim Report 2005",id:"05b", link:"/en/pdf/investor/annual/2005/hi.pdf", target:"_blank"},
	{name:"Annual Report 2004",id:"04", link:"/en/investor/annual_04.shtml", target:"_self"},
	{name:"Interim Report 2004",id:"04b", link:"/en/pdf/investor/annual/2004/hi.pdf", target:"_blank"},
	{name:"Annual Report 2003",id:"03", link:"/en/investor/annual_03.shtml", target:"_self"},
	{name:"Interim Report 2003",id:"03b", link:"/en/pdf/investor/annual/2003/hi.pdf", target:"_blank"},
	{name:"Annual Report 2002",id:"02", link:"/en/investor/annual_02.shtml", target:"_self"},
	{name:"Interim Report 2002",id:"02b", link:"/en/pdf/investor/annual/2002/hi.pdf", target:"_blank"},
	{name:"Annual Report 2001",id:"01", link:"/en/investor/annual_01.shtml", target:"_self"},
	{name:"Interim Report 2001",id:"01b", link:"/en/pdf/investor/annual/2001/hi.pdf", target:"_blank"},
	{name:"Annual Report 2000",id:"00", link:"/en/investor/annual_00.shtml", target:"_self"},
	{name:"Interim Report 2000",id:"00b", link:"/en/pdf/investor/annual/2000/hi.pdf", target:"_blank"},
	{name:"Annual Report 1999",id:"99", link:"/en/investor/annual_99.shtml", target:"_self"},
	{name:"Interim Report 1999",id:"99b", link:"/en/pdf/investor/annual/1999/hi.pdf", target:"_blank"}
);

function genAnnualList(num) {
	var total = annualArray.length;
	var str = '';	
	str += '<ul>';
	for (i=num; i<total; i++) {
		str += '<li id="yr20' + annualArray[i].id + '">';
		str += '<a href="' + annualArray[i].link + '" target="' + annualArray[i].target + '">' + annualArray[i].name + '</a>';
		str += '</li>';		
	}
	str += '</ul>';
	d.write(str);	
}



//highlight the dropdownlist
function getDropDown() {	

	if (levelArray[2]) {
		
		var year = levelArray[2];		
		var yearList = d.getElementById('currentYear');
		if (isIE) {
			yearList.innerText = d.getElementById('yr20'+year).innerText;
		} else {
				yearList.textContent = d.getElementById('yr20'+year).textContent;
		}
	}	
}



//display annual cover
function displayCover() {
	
	if (levelArray[1] == 'annual') {
		 if (levelArray[2]) {		 		
		 			
					str = '';	
					str += '</li>';
					if (levelArray[2] == '11' || levelArray[2] == '10' || levelArray[2] == '09' || levelArray[2] == '08' || levelArray[2] == '07' || levelArray[2] == '06') {
							str += '<li id="annualLeft">';
							str += '<img src="/en/images/investor/report_20'+ levelArray[2] +'_thumb.gif" alt="" id="report_' + levelArray[2] + '" />';
							str += '</li>';
					}
					str += '<li class="annualLeftLast">Other Report:';
						str += '<div id="annualLeftDD" onclick="onClickPulldown(this, \'annualLeftDD\');"><div id="currentYear">Please select</div>';
							str += '<div id="annualLeftDDPulldown">';
							str += '<script type="text/javascript">';
							str += 'genAnnualList(0);';
							str += '</script>';
							str += '</div>';
						str += '</div>';					
					
						str += '<script type="text/javascript">';
						str += 'getDropDown();';
						str += '</script>	';
					d.write(str);
					
		 } 
	}
}

//gen home scroller
function genScroller(id1, id2)
{
	
	var scroller;
	var scrollbar;
	var scrollContainer = d.getElementById(id1);
	var scroll = d.getElementById(id2);
	
	if (!scroller)
	{
		scroller  = new Scrolling.Scroller(scrollContainer, scroll.offsetWidth, scroll.offsetHeight);
		scrollbar = new Scrolling.Scrollbar(scroll, scroller, new Scrolling.ScrollTween());
	}
	else
	{
		scroller.reset();
		scrollbar.reset();
		scrollbar.swapContent(scrollContainer);
	}
}

//display the detail when click the btn plus
function displayDetail() {
	var detailPart  = d.getElementById('reportDetail');
	var btn  = d.getElementById('plus');
	
	btn.hit = true;	
	detailPart.style.display = 'block';
	btn.style.background = 'url(/en/images/home/btn_min_2.gif) no-repeat 0 4px';
	
}

function getElementsByClassName(p, c)
{
	var array = new Array();
	var tags = p.getElementsByTagName('*');
	
	for (var i=0; i<tags.length; i++)
	{
		if (!tags[i].className)	continue;
		if (tags[i].className.indexOf(c) >= 0)	array.push(tags[i]);
	}
	
	return array;
}

//select circular year
function selectYear(month, year) {
	
	
	//alert(month +'_'+ year);
	var currentM = d.getElementById('m' + month + '_' + year);
	var currentY = d.getElementById('year' + year);
	
	var currentPart = d.getElementById('content');
	var tableTotal = currentPart.getElementsByTagName('table');
	
	for (i=1; i< tableTotal.length; i++) {
		tableTotal[i].style.display = 'none';
	}
	
	if (d.getElementById('year' + year)) {
		var tableTotal2 = currentY.getElementsByTagName('table');
		
		if (month == 0) {
			for (i=0; i< tableTotal2.length; i++) {				
				tableTotal2[i].style.display = 'block';
			}
		}else {			
			if (d.getElementById('m' + month + '_' + year)) {
				currentM.style.display = 'block';
			}
		}
	}
	
	if (year == 0) {
		for (i=1; i< tableTotal.length; i++) {
			tableTotal[i].style.display = 'block';
		}
	}
}











