var menu1_items = [
	['Home', SITE_URL + 'index.html', ''],
	['Company', SITE_URL + 'company-profile.html', '',
		['Our Company', SITE_URL + 'ourcompany.html',''],
		['Message from Management', SITE_URL + 'message-management.html',''],
		['Company Profile', SITE_URL + 'company-profile.html',''],
		['Quality', SITE_URL + 'quality.html',''],
		['Philosophy', SITE_URL + 'corporate-philosophy.html',''],
		['History', SITE_URL + 'company-history.html',''],
		['Relationship with Customer', SITE_URL + 'customer-relations.html',''],
		['Relationship with Society', SITE_URL + 'society-relations.html',''],
		['Contribution to Environment', SITE_URL + 'contribution-to-environment.html',''],
		['Global Network', SITE_URL + 'global-network.html',''],
	],
	['Products', SITE_URL + 'products-list.html', '',
		['Minimum Intervention', '', '',
		['Identify', '', '',
			['Saliva Check', SITE_URL + 'products.html/id/1', ''],
			['Plaque Check', SITE_URL + 'products.html/id/2', ''],
		],
		['Prevent', '', '',
			['GC Tooth Mousse', SITE_URL + 'products.html/id/3', ''],
			['GC Tooth Mousse Plus', SITE_URL + 'products.html/id/4', ''],
			['GC Dry Mouth Gel', SITE_URL + 'products.html/id/5', ''],
			['Orthoprox', SITE_URL + 'products.html/id/6', ''],
			['Interproximal brushes', SITE_URL + 'products.html/id/7', ''],			
			['GC Fuji VII', SITE_URL + 'products.html/id/8', ''],
		],
	],
	['Glass Ionomer Cements', '', '',
		['Restorative', '', '',
			['Gold Label 2 ', SITE_URL + 'products.html/id/9', ''],
			['Gold Label 2 LC ', SITE_URL + 'products.html/id/10', ''],
			['Fuji Filling LC ', SITE_URL + 'products.html/id/11', ''],
			['Gold Label 9 GP', SITE_URL + 'products.html/id/12', ''],
			['Miracle Mix', SITE_URL + 'products.html/id/13', ''],
		],
		['Luting ', '', '',
			['Gold Label 1', SITE_URL + 'products.html/id/14', ''],
			['Fuji CEM', SITE_URL + 'products.html/id/15', ''],
			['Fuji Ortho Band', SITE_URL + 'products.html/id/16', ''],
			['GC Fuji Ortho LC', SITE_URL + 'products.html/id/17', ''],
			['GC Fuji Ortho', SITE_URL + 'products.html/id/18', ''],
		],
		['Bonding', '', '',
			['Fuji Bond LC', SITE_URL + 'products.html/id/19', ''],
			],
		['Lining', '', '',
			['Fuji Lining cement', SITE_URL + 'products.html/id/20', ''],
			['Fuji Lining LC', SITE_URL + 'products.html/id/21', ''],
			['Fuji Lining LC paste pak', SITE_URL + 'products.html/id/22', ''],
			],
		['Acessories', '', '',
			['GC Varnish', SITE_URL + 'products.html/id/23', ''],
			['GC Fuji Coat LC', SITE_URL + 'products.html/id/24', ''],
			['Cavity Conditioner', SITE_URL + 'products.html/id/25', ''],
			['Dentin Conditioner', SITE_URL + 'products.html/id/26', ''],
			],
			],
	['Composites', '', '',
		['Restorative', '', '',
			['Solare ', SITE_URL + 'products.html/id/27', ''],
			['Solare P', SITE_URL + 'products.html/id/28', ''],
			],
		['Bonding ', '', '',
			['Unifil Bond', SITE_URL + 'products.html/id/29', ''],
			['G-Bond', SITE_URL + 'products.html/id/30', ''],
			],
	],
	['Finishing Strips', '', '',
		['GC Epitex', SITE_URL + 'products.html/id/31', ''],
		['GC Metal Strips', SITE_URL + 'products.html/id/32', ''],
	],
	['Impression Material', '', '',
		['Alginates', '', '',
			['Aroma Fine', SITE_URL + 'products.html/id/33', ''],
			],
		['A Silicones ', '', '',
			['Exaflex ', SITE_URL + 'products.html/id/34', ''],
			['Examix NDS ', SITE_URL + 'products.html/id/35', ''],
		],
		['Registration Material', '', '',
			['GC EXABITE II NDS', SITE_URL + 'products.html/id/36', ''],
			['Fit checker II', SITE_URL + 'products.html/id/37', ''],
		],
		],
	['Temporary Crown and Bridge Material', '', '',
		['Tempory Luting Cement', '', '',
			['Freegenol', SITE_URL + 'products.html/id/38', ''],
		],
		['Revotek LC', SITE_URL + 'products.html/id/39', ''],
		['Unifast Trad', SITE_URL + 'products.html/id/40', ''],
		['Unifast LC ', SITE_URL + 'products.html/id/41', ''],
		['GC Temporon ', SITE_URL + 'products.html/id/42', ''],
		],
	['Relining Materials', '', '',
		['Acrylic', '', '',
		['Soft Liner', SITE_URL + 'products.html/id/43', ''],
		['Coe Soft', SITE_URL + 'products.html/id/44', ''],
		['Coe Comfort', SITE_URL + 'products.html/id/45', ''],
		['Kooliner', SITE_URL + 'products.html/id/46', ''],
		],
		['Silicone', '', '',
			['GC Reline Soft/ Extra soft ', SITE_URL + 'products.html/id/47', ''],
			],
	],
			
	['Periodontal Dressing material', '', '',
		['Coe pack', SITE_URL + 'products.html/id/48', ''],
	],
	['Laboratory Products', '', '',
			['Dental Stone', '', '',
			['Fuji Rock ', SITE_URL + 'products.html/id/49', ''],
			],
		['Waxes  ', '', '',
			['Inlay Wax soft ', SITE_URL + 'products.html/id/50', ''],
			['Inlay Wax medium ', SITE_URL + 'products.html/id/51', ''],
			['Inlay Wax hard ', SITE_URL + 'products.html/id/52', ''],
			],
		['Pattern Resin', SITE_URL + 'products.html/id/53', ''],
		],
	['Loupes', SITE_URL + 'products.html/id/54', '',
		['Mini Loupes', SITE_URL + 'products.html/id/54',''],
		['Standard Loupes', SITE_URL + 'products.html/id/55',''],
	],
	],
	['News', SITE_URL + 'NewsAndEvents.html', ''],
	['Clinical Updates', SITE_URL + 'clinical-updates.html',''],
	['Events', SITE_URL + 'events-calendar.html', ''],
	['Contact', SITE_URL + 'contactus.html', '',
		['GC India', SITE_URL + 'contactus.html',''],
		['Dealers', SITE_URL + 'dealers.html',''],
		['Sales Managers', SITE_URL + 'sales-managers.html',''],
		['Enquiry', SITE_URL + 'enquiry.html',''],
	],
];

function addLoadEvent(func) {		// menu uses onLoad event - to have another onLoad event, add it right after BODY tag (eg <SCRIPT>addLoadEvent(function() { javascript:alert('yebagogo'); });</SCRIPT> or <SCRIPT>addLoadEvent(init);</SCRIPT>)
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}

var menu_layers = new Array(); var ol = ''; var or = ''; renderMenu('1');
function renderMenu(mnr) {
	window['menu' + mnr + '_old_main_pos'] = 0; window['menu' + mnr + '_new_main_pos'] = 0; window['menu' + mnr + '_to']; window['menu' + mnr + '_opened'];
	menu_start(mnr);		// make position relative
	menu_read(mnr, '', '');		// read menu and build layers
	menu_resize(mnr, '');		// give all relevant layers equal width
	menu_resize(mnr, 'andPosition');	// twice since layers prior to widest may not have been resized yet + place layers at the right position
	menu_end();		// close menu container layer
	ol += "document.getElementById('menu" + mnr + "_container').style.left = document.getElementById('menu" + mnr + "_ref').offsetLeft; document.getElementById('menu" + mnr + "_container').style.top = document.getElementById('menu" + mnr + "_ref').offsetTop; ";
	or += "document.getElementById('menu" + mnr + "_container').style.left = document.getElementById('menu" + mnr + "_ref').offsetLeft; document.getElementById('menu" + mnr + "_container').style.top = document.getElementById('menu" + mnr + "_ref').offsetTop; ";
	if (typeof(menu2_items) != 'undefined' && typeof(menu2_new_main_pos) == 'undefined') renderMenu('2');
}
addLoadEvent(function() { eval(ol); }); 	// if the menu will be placed inside a table, it must be created outside the table
window.onresize= function() { eval(or); }	// if not, all menu layers will have a width of 0px (layer.offsetWidth)

function menu_start(mnr) {
	document.write('<DIV ID="menu' + mnr + '_container" STYLE="position:relative; top:-40px; width:0px; height:0px; z-index:1">');
}

function menu_read(mnr, level, rm_main) {
	if (!level) { level = 'menu' + mnr + '_items'; menu_layers[mnr] = new Array(); }
	var i = 0; var rm_sub = 0;
	while (i < eval(level).length) {
		if (typeof(eval(level)[i]) == 'object') {
			rm_sub++; rm_pos = (rm_main)?(rm_main + '_' + rm_sub):(rm_sub + '');
			document.write('<DIV ID="menu' + mnr + '_' + rm_pos + '" STYLE="position:absolute; padding:3px 2px; border-left:1px solid #FFFFFF; ' + ((rm_main)?('background-color:#139C83; '):(''))  + 'cursor:' + ((eval(level)[i][1] != '')?('pointer'):('default')) + '" onMouseOver="menu_open(\'' + mnr + '\', \'' + rm_pos + '\', \'1\'); menu_highlight(\'' + mnr + '\', \'on\', \'' + rm_pos + '\')" onMouseOut="menu_close(\'' + mnr + '\', \'' + rm_pos + '\', \'delayed\'); menu_highlight(\'' + mnr + '\', \'off\', \'' + rm_pos + '\')"' + ((eval(level)[i][1] != '')?(' onClick="menu_open_link(\'' + eval(level)[i][1] + '\', \'' + eval(level)[i][2] + '\')"'):('')) + '><NOBR STYLE="font-size:15px; color:#FFFFFF">&nbsp;' + eval(level)[i][0] + '&nbsp;</NOBR></DIV>');
			var mll = menu_layers[mnr].length; menu_layers[mnr][mll] = new Array(); 	menu_layers[mnr][mll]['pos'] = rm_pos; menu_layers[mnr][mll]['width'] = document.getElementById('menu' + mnr + '_' + rm_pos).offsetWidth;
			if (eval(level)[i].length != 3) menu_read(mnr, level + '[' + i + ']', rm_pos);
		}
	i++;
	}
}

function menu_resize(mnr, position) {
	for (i=0; i<menu_layers[mnr].length; i++) {
		var mparent = menu_layers[mnr][i]['pos'].substring(0, menu_layers[mnr][i]['pos'].lastIndexOf('_'));
		if (mparent != '') {
			if (window['m' + mnr + '_' + mparent] >= menu_layers[mnr][i]['width']) {
				menu_layers[mnr][i]['width'] = window['m' + mnr + '_' + mparent];
				document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.width = menu_layers[mnr][i]['width'] + 'px';
			}
			window['m' + mnr + '_' + mparent] = menu_layers[mnr][i]['width'];
		} else {
			if (menu_layers[mnr][i]['width'] > window['m' + mnr + '_' + menu_layers[mnr][i]['pos']]) window['m' + mnr + '_' + menu_layers[mnr][i]['pos']]  = menu_layers[mnr][i]['width'];
		}
		if (position) menu_position(mnr, menu_layers[mnr][i]['pos']);
	}
}

function menu_position(mnr, position) {
	var pos_split = position.split('_');
	if (pos_split.length == 1) {
		document.getElementById('menu' + mnr + '_' + position).style.left = window['menu' + mnr + '_new_main_pos'];
		document.getElementById('menu' + mnr + '_' + position).style.top = '0';
		window['menu' + mnr + '_old_main_pos'] = window['menu' + mnr + '_new_main_pos'];
		window['menu' + mnr + '_new_main_pos'] += document.getElementById('menu' + mnr + '_' + position).offsetWidth;
	} else {
		document.getElementById('menu' + mnr + '_' + position).style.visibility = 'hidden';
		if (pos_split.length ==2) {
			document.getElementById('menu' + mnr + '_' + position).style.left = window['menu' + mnr + '_old_main_pos'];
		} else {
			var one_up = position.substring(0, position.lastIndexOf('_'));
			document.getElementById('menu' + mnr + '_' + position).style.left = document.getElementById('menu' + mnr + '_' + one_up).offsetLeft + document.getElementById('menu' + mnr + '_' + one_up).offsetWidth;
		}
		var sumt = 0; for (j=1; j<pos_split.length; j++) { sumt += (pos_split[j]*1); }
		document.getElementById('menu' + mnr + '_' + position).style.top = document.getElementById('menu' + mnr + '_' + position).offsetHeight * (sumt-(pos_split.length-2));
	}
}

function menu_end() {
	document.write('</DIV>');
}

function menu_open(mnr, position, cnt) {
	if (window['menu' + mnr + '_to']) clearTimeout(window['menu' + mnr + '_to']);
	if (document.getElementById('menu' + mnr + '_' + position + '_' + cnt)) {
		document.getElementById('menu' + mnr + '_' + position + '_' + cnt).style.visibility = 'visible';
		cnt++; menu_open(mnr, position, cnt);
	} else menu_close(mnr, position, 'direct');
}

function menu_close(mnr, position, timing) {
	if (timing == 'delayed') { if (window['menu' + mnr + '_to']) clearTimeout(window['menu' + mnr + '_to']); window['menu' + mnr + '_to'] = setTimeout('menu_close(\'' + mnr + '\', \'0\', \'direct\')', 2000); }
	else {
		for (i=0; i<menu_layers[mnr].length; i++) {
			if (menu_layers[mnr][i]['pos'].indexOf('_') != '-1') {
				if (position == '0') document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden';
				else {
					if (position.indexOf('_') != -1) { if ((menu_layers[mnr][i]['pos'].split('_').length > position.split('_').length) && (menu_layers[mnr][i]['pos'].indexOf(position) != 0)) document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden'; }
					else { if (menu_layers[mnr][i]['pos'].substring(0, menu_layers[mnr][i]['pos'].indexOf('_')) != position) document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden'; }
				}
			}
		}
	}
}

function menu_open_link(link, target) {
	link = this.location.href.substring(0, this.location.href.indexOf('')) + '' + link;

	if (!target || target == '_self') document.location.href = link;
	else {
		if (window.parent.frames[target]) window.parent.frames[target].location.href = link;
		else if (target == '_top') top.location.href = link;
		else if (target == '_parent') parent.location.href = link;
		else window.open (link);
	}
}

function menu_highlight(mnr, status, position) {
	var menu_bgc = (position.indexOf('_') != '-1')?('#139C83'):('');
	document.getElementById('menu' + mnr + '_' + position).style.backgroundColor = (status == 'on')?('#6BBBA9'):(menu_bgc);
}