var DTech = new Object();
var win = null;

DTech.Functions = {
	
	init : function() {
		Event.onDOMReady(function() {			
			DTech.Functions.formatNavigation();
			DTech.Functions.formatLists();
			DTech.Functions.matchColumn();
		});
	},
	
	formatNavigation : function() {
		if ($('content_left')) {
			if ($A($('content_left').classNames()).length > 0) {
				$('nav' + $A($('content_left').classNames())[0].split('-')[1]).addClassName('current');
			}
		}
	},
	
	formatLists : function() {
		$A(document.getElementsByClassName('records')).each(function(obj) {
			var count = 0;
			
			$A($(obj).getElementsByTagName($(obj).tagName.toLowerCase() == 'dl' ? 'dd' : 'tr')).each(function(dd) {
				if (count % 2 != 0) {
					$(dd).addClassName('alt');
				}
				
				count++;
			});
		});
		
		$A(document.getElementsByClassName('sidebar')).each(function(obj) {
			var count = 0;
			
			$A($(obj).getElementsByTagName($(obj).tagName.toLowerCase() == 'ul' ? 'li' : 'tr')).each(function(li) {
				if (count % 2 != 0) {
					$(li).addClassName('alt');
				}
				
				count++;
			});
		});
	},
	
	popWindow : function(mypage, myname, w, h, scroll) {
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
		settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable';
		win = window.open(mypage, myname, settings);
	},

	map: function() {
		var domains = new Array(
			new Array('heritagefuneralchapels.com', 'ABQIAAAAYzKLIBt1dfSh_WmX5OrvEhRT8mtAOe1iK8wfVfqVfevT6thIRxS1MMOtScJWkolfMPSxFC5vD6c63w'),
			new Array('www.heritagefuneralchapels.com', 'ABQIAAAAYzKLIBt1dfSh_WmX5OrvEhR28GKHxmpIcflC_xCYO1bWlUCGYRSWL_efSVNhtjgyxymMvaZ4hL8esQ')
		);
		
		DT.Maps.insert(domains);
	},
	
	matchColumn : function ()	{
		
		var leftcolumn = $('content_left_inner');
		var rightcolumn = $('content_right');

		if ($(leftcolumn).getHeight() < $(rightcolumn).getHeight()) {
			$(leftcolumn).setStyle({
				height: ($(rightcolumn).getHeight() + 10) + 'px'
			});
		}
		
	}
}

DTech.Functions.init();
