document.observe('dom:loaded', function() {
	
	//alternate row colors
var rows = $$('.profile-info-row');
var color1 = '#f9f9f9';
var color2 = '#fcfcfc';
if (rows.length > 0) {
	bgColor = color1;
	for (i = 0; i < rows.length; i++) {
		rows[i].style.backgroundColor = bgColor;
		bgColor = (bgColor == color1) ? color2 : color1;
	}
}

//buttons on left side
if ( $('manage-files') ) {
	$('manage-files').observe('click', function () {
		openCenteredWindow('/dyn/mng/' + $('profile-id').value);
	});
}
if ( $('edit-profile') )
{
	$('edit-profile').observe('click', function() {
		window.location = '/dyn/actions/manageProfile';
	});
}


/*	
	function activatePages(dataStyle, dataParent, maxPages, itemsPerPage, pagePrefixName) {
		
		//attach event handlers to each child
		$$(dataStyle).each(function(page) {
			page.childElements().each(function(el) {
				el.observe('click', function paginate(event) {
					var element = event.element();

					var oldCurrent = 0;
					var hashloc = parent.location.hash;
					if (hashloc != '') {
						oldCurrent = parseInt(hashloc.substring(1));
					}
					var current = 0;
					if (element.innerHTML == String.fromCharCode(171)) {
						current = 0;
					} else if (element.innerHTML == String.fromCharCode(187)) {
						current = maxPages;
					} else if (element.innerHTML == '&lt; Previous') {
						current = Math.max(0, oldCurrent - 1);
					} else if (element.innerHTML == 'Next &gt;'){
						current = Math.min(maxPages, oldCurrent + 1);
					} else {
						current = parseInt(element.innerHTML)-1;
					}
					
					$$(dataStyle).each(function(p) {
						p.childElements().each(function(act) {
							act.removeClassName("active");
							act.removeClassName("disabled");
						});
					});
					
					$(pagePrefixName+current).addClassName("active");
					
					parent.location.hash=current;
					var start = current*itemsPerPage;
					var end = current*itemsPerPage+itemsPerPage;
					
					children = $(dataParent).childElements();
					children.each(function(el, index) {
						if ((index >= start && index < end)) {
							el.show();
						} else {
							el.hide();
						}
					})
					
					return false;
				});
			});
		});
	};
*/	
	
})