var d = document;

function pageInit() {
	solve_captcha();
	fixLayoutHeights();
}

function fixLayoutHeights() {
	var divs = new Array("side","main"); //list of DIV ids
	var h = 0;
	for (i = 0; i < divs.length; i++) {
		if (d.getElementById(divs[i]).offsetHeight > h) {
			h = d.getElementById(divs[i]).offsetHeight;
			//alert(h);
		}
	}
	
	/*for (x = 0; x < divs.length; x++){
		h = d.getElementById(divs[x]).offsetHeight;
		for (y = 0; y < divs.length; y++){
			test_h = d.getElementById(divs[y]).offsetHeight;
			if (h < test_h) h = test_h;
		}
	}*/
	for (i = 0; i < divs.length; i++) {
		d.getElementById(divs[i]).style.height = h +"px"; //set the height of all divs to the tallest
	}
}

function setMainBoxWidth(width) {
	d.getElementById('main').style.width = width;
}

function random_password(length) {
	if (length == null) length = 8;
	var a = 'abcdefghijklmnopqrstuvwxyz0123456789';
	var pass = '';
	for (var i = 0; i <= length; i++) {
		pass = pass + a.substr(Math.round(35*Math.random()),1);
	}
	return pass;
}

function solve_captcha() {
	var antispam = d.getElementById('antispam');
	if (antispam) {
		antispam.value = 'speider';
	}
	var captcha = d.getElementById('captcha');
	if (captcha) {
		captcha.style.display = 'none';
	}
}
