function $(id){
	return document.getElementById(id);
}

function initNav(){
	var nav = document.getElementById('nav');
	nav.parentNode.style.zIndex = '99';
	var el = document.createElement('div');
	var sp = el.cloneNode(true);
	el.className = 'nav';
	sp.className = 'sp1';
	for (var i = 0 ; i < nav_data.length ; i ++ ){
		nav.appendChild(sp.cloneNode(true));
		var nv = el.cloneNode(true);
		nv.setAttribute('pid',i);
		nv.innerHTML = '<a href="' + nav_data[i].URL + '">' + nav_data[i].text + '</a>';
		nav.appendChild(nv);
		if (nav_data[i].Items){
			var sub = document.createElement('div');
			sub.className = 'sub';
			sub.id = 'Pop_' + i;
			for (j = 0 ; j < nav_data[i].Items.length ; j ++ ){
				var pop = el.cloneNode(true);
				pop.className = 'pop';
				pop.innerHTML = '<a href="' + nav_data[i].Items[j].URL + '">' + nav_data[i].Items[j].text + '</a>';
				sub.appendChild(pop);
			}
			nv.appendChild(sub);
			nv.onmouseover = function(){
				this.style.zIndex += 1;
				document.getElementById('Pop_' + this.getAttribute('pid')).style.display = 'block';
			}
			nv.onmouseout = function(){
				this.style.zIndex -= 1;
				document.getElementById('Pop_' + this.getAttribute('pid')).style.display = 'none';
			}
		}
	}
}

initNav();