/*  this code is bilalis made (c) 2006 (www.bilalis.com)
	Phone:	210 922 3035
	Fax:	210 922 3030
	E-mail:	info@bilalis.com
*/

function paintColn(colori) {
	if ( !document.getElementById || !document.getElementsByTagName ) return;
	var c = colori.length;
	var ci = 0;
	var m = document.getElementById('sections').getElementsByTagName('li');
	document.write('<style type="text/css">');
	for ( var i = 0; i < c; i++ ) {
		document.write('#sections li.colora' + i + 'off		{border-left-color:#' + colori[i] + '}');
		document.write('#sections li.colora' + i + 'on		{border-left-color:#' + colori[i] + ';background-color:#BEBEBE;cursor:pointer}');
		document.write('#sections li.colora' + i + 'on a	{color:#000}');
		document.write('#sections li.colora' + i + 'here	{color:#FFF;background-color:#' + colori[i] + ';border-left-color:#' + colori[i] + ';cursor:default}');
	}
	document.write('</style>');
	ci--;
	for ( var i = 0; i < m.length; i++ ) {
		if ( m[i].parentNode.id == 'sections' ) ci++;
		if ( ci > (c - 1) ) ci = 0;
		m[i].colori = ci;
		if ( m[i].firstChild.nodeName == 'A' ) {
			m[i].className = 'colora' + ci + 'off';
			m[i].onmouseover = coln_on;
			m[i].onmouseout = coln_off;
			m[i].onclick = coln_go;
		} else {
			m[i].className = 'colora' + ci + 'here';
		}
	}
}
function coln_on() {this.className	= 'colora' + this.colori + 'on'}
function coln_off() {this.className	= 'colora' + this.colori + 'off'}
function coln_go(e) {
	var trg;
	if ( !e ) var e = window.event;
	if ( e.target ) {
		trg = e.target;
	} else if ( e.srcElement ) {
		trg = e.srcElement;
	}
	if ( trg.nodeType == 3 ) trg = trg.parentNode; // Safari gets text
	if ( trg.nodeName == 'LI' ) trg = trg.firstChild;
	if ( trg.nodeName == 'A' ) {
		window.location = trg.href;
		return false;
	}
}

function paintsizeLine(colori) {
	if ( !document.getElementById || !document.getElementsByTagName ) return;
	var c = colori.length;
	var ci = 0;
	var m = document.getElementById('sectionsline').getElementsByTagName('li');
	var wm0	= document.getElementById('header').offsetWidth;
	var wm1	= 0;
	for ( var i = 0; i < m.length; i++ ) {
		wm1 += m[i].offsetWidth;
	}
	document.write('<style type="text/css">');
	document.write('	#sectionslinebox 					{width:100%}');
	var pd2sum = wm0 - wm1;
	if ( pd2sum > m.length ) {
		var pd2 = Math.floor(pd2sum / m.length);
		if ( pd2 * m.length == pd2sum ) pd2--;
		var pdL = Math.floor(pd2 / 2);
		var pdR = pd2 - pdL;
		document.write('#sectionsline li 					{padding-left:' + pdL + 'px;padding-right:' + pdR + 'px}');
	}
	for ( var i = 0; i < c; i++ ) {
		document.write('#sectionsline li.colori' + i + 'off	{background-color:#FFF;border-top-color:#FFF;border-bottom-color:#' + colori[i] + '}');
		document.write('#sectionsline li.colori' + i + 'on	{background-color:#' + colori[i] + ';border-top-color:#' + colori[i] + ';border-bottom-color:#' + colori[i] + ';cursor:pointer}');
		document.write('#sectionsline li.colori' + i + 'on a {color:#FFF}');
	}
	document.write('</style>');
	for ( var i = 0; i < m.length; i++ ) {
		if ( m[i].firstChild.nodeName == 'A' ) {
			m[i].colori = ci;
			m[i].className = 'colori' + ci + 'off';
			m[i].onmouseover = line_on;
			m[i].onmouseout = line_off;
			m[i].onclick = line_go;
			ci++;
		}
		if ( ci > (c - 1) ) ci = 0;
	}
}
function line_on() {this.className	= 'colori' + this.colori + 'on'}
function line_off() {this.className	= 'colori' + this.colori + 'off'}
function line_go() {window.location	= this.firstChild.href; return false;}

function headerlast() {
	var paint = ['447C8A','AF563B','9EC54C','E8B646','037AB2','DD902F','5ABBEF'];
	paintColn(paint);
	paintsizeLine(paint);
}
headerlast();