// JavaScript Document

var timeout = new Array();
var one = false;
var maximum = 4;

function getObject(int){
	var rawr = document.getElementById('dropdown_'+int);
	if (rawr){
		return rawr;
	}else{
		return false;
	}
}

function dropdown(int){
	var dropdown = getObject(int);
	for (i = 1; i <= maximum; i++){
		del = getObject(i+1);
		del.style.display = 'none';
	}
	if (int == 1){
		one = true;
		document.getElementById('dropdown_1').style.borderRightWidth = '2px';
	}else{
		document.getElementById('dropdown_1').style.borderRightWidth = '0px';
	}
	if (int > 2){
		document.getElementById('border').style.visibility = 'visible';
		pixels = (int - 2) * 10 + 2;
		document.getElementById('border').style.height = pixels + 'px';
	}else{
		document.getElementById('border').style.visibility = 'hidden';
	}
	clearTimeout(timeout[int]);
	if (dropdown){
		dropdown.style.display = 'inline';
	}
}
function dropdown2(int){
	if (int == 1){
		one = true;
	}
	for (i = 0; i <= maximum; i++){
		clearTimeout(timeout[i+1]);
	}
}
function rollout2(int){
	if (int != 1){
		var dropdown = getObject(int);
		if (dropdown){
			dropdown.style.display = 'none';
		}
		var dropdown = getObject(1);
		if (false == one){
			if (dropdown){
				dropdown.style.display = 'none';
			}
		}else{
			dropdown.style.backgroundImage = '';
			dropdown.style.borderRightWidth = '2px';
		}
	}else{
		dropdown = getObject(1);
		dropdown.style.display = 'none';
		for (i = 1; i <= maximum; i++){
			dropdown = getObject(i+1);
			dropdown.style.display = 'none';
		}
	}
}
function rollout(int){
	one = false;
	timeout[int] = setTimeout('rollout2('+int+')', 500);
}

function validate(string){
	if (confirm(string)){
		return true;
	}else{
		return false;
	}
}