// JavaScript Document
var menuTop = 0;

function menuScroll() {
	var i, menu, hr, ha;
	if (document.getElementById) {
		menu = document.getElementById('menu');
		if (menu) {
			menu.style.top = document.getElementById('ciaa2006').scrollTop + menuTop;
		}
	}
}

function menuInit() {
	var i, menu, hr, ha;
	if (document.getElementById) {
		menu = document.getElementById('menu');
		if (menu) {
			var cut;
			menuTop = menu.style.top;
			hr = window.location.href;
			cut = hr.length;
			ppos = hr.indexOf("#");
			qpos = hr.indexOf("?");
			if (ppos != -1 || qpos != -1) {
				if (ppos == -1)
					cut = qpos;
				else if (qpos == -1)
					cut = ppos;
				else
					cut = min(ppos, qpos);
			}
			hr = hr.substring(0, cut);

			ha = menu.getElementsByTagName("A");
			if (ha && ha.length) {
				for (i=0; i<ha.length; i++) {
					var upperUL = ha[i].parentNode.parentNode;
					if (ha[i].href && hr.indexOf(ha[i].href) > -1 && upperUL.className == "level1") {
						ha[i].className = "currentmark";
						upperUL.style.display = "block";
						if (upperUL.firstChild && upperUL.firstChild.tagName == "A") {
							upperUL.firstChild.className = "expanded";
						}
						break;
					}
				}
			}
		}
	}
	window.onscroll = menuScroll; 
}

function toggleThis(clickedA) {
	var i, j, uncles, parent, siblings;
	if (document.getElementById) {
		if (clickedA.parentNode && clickedA.parentNode.childNodes) {
			parent = clickedA.parentNode;
		}
		else {
			return;
		}

		if (parent.parentNode && parent.parentNode.childNodes) {	//close all parent's siblings
			uncles = parent.parentNode.childNodes;
			for (i=0; i<uncles.length; i++) {
				if (uncles[i] != parent) {
					siblings = uncles[i].childNodes;
					for (j=0; j<siblings.length; j++) {
						if (siblings[j].tagName == "A" && siblings[j].className == "expanded") {
							siblings[j].className = "collapsed";
						} else if (siblings[j].tagName == "UL") {
							siblings[j].style.display = "none";
						}
					}
				}
			}
		}

		siblings = parent.childNodes;
		if (clickedA.className == "collapsed") {
			clickedA.className = "expanded";
			for (i=0; i<siblings.length; i++) {
				if (siblings[i].tagName == "UL") {
					siblings[i].style.display = "block";
					break;
				}
			}
		}
		else if (clickedA.className == "expanded") {
			clickedA.className = "collapsed";
			for (i=0; i<siblings.length; i++) {
				if (siblings[i].tagName == "UL") {
					siblings[i].style.display = "none";
					break;
				}
			}
		}
	}
}

/*

var swidth=90
var sheight=160
var imgsrc="http://ad4.udn.com/RealMedia/ads/adstream_nx.ads/udn.com/watermark-top@Top"
var logolink="http://ad4.udn.com/RealMedia/ads/click_nx.ads/udn.com/watermark-top@Top" 
function logoit2(){
	staticimage.left=pageXOffset+window.innerWidth-swidth-15
	staticimage.top=pageYOffset+window.innerHeight-sheight
}
function staticitns(){
	setInterval("logoit2()",90)
}
function logomove(){ 
	staticimage.left=window.innerWidth-staticimage.document.width-15
	staticimage.top=window.innerHeight-staticimage.document.height
}
function createlogo(){
	staticimage=new Layer(100)
	staticimage.left=300
	staticimage.top=10
	staticimage.document.write('<a href="'+logolink+'" TARGET="_blank"><img src="'+imgsrc+'" border=0 alt="CLICK"></a>')
	staticimage.document.close()
	staticimage.visibility="show"
	window.onresize=logomove
	staticitns()
}
function insertimage(){
	logo.innerHTML='<a href="'+logolink+'" TARGET="_blank"><img src="'+imgsrc+'" border=0 alt="CLICK"></a>'
}
function logoit(){
	var w2=document.body.scrollLeft+w
	var h2=document.body.scrollTop+h
	logo.style.left=w2
	logo.style.top=h2
}
function logoresize(){
	w=document.body.clientWidth-logo.style.pixelWidth-5
	h=document.body.clientHeight-logo.style.pixelHeight-5
	logo.style.left=w
	logo.style.top=h
}
if (document.all){
	document.write('<span id="logo" style="position:absolute;top:100;width:'+swidth+';height:'+sheight+'"></span>')
	w=document.body.clientWidth-logo.style.pixelWidth-5
	h=document.body.clientHeight-logo.style.pixelHeight-5
	logo.style.left=w
	logo.style.top=h
	window.onscroll=logoit 
	window.onresize=logoresize
	window.onload=insertimage
}
if (document.layers){
	window.onload=createlogo;
}
*/