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

DTech.Functions = {
	
	init : function() {
		Event.onDOMReady(function() {
			DTech.Functions.formatNavigation();
			DTech.Functions.formatLists();
			
			if ($('movie')) {
				swfobject.embedSWF("Includes/swf/" + DTech.Functions.rand(6) + ".swf", "movie", "752", "176", "9.0.28", "Includes/swf/expressInstall.swf");
			}
		});
	},
	
	formatNavigation : function() {
		if ($('content')) {
			if ($A($('content').classNames()).length > 0) {
				$('nav' + $A($('content').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++;
			});
		});
	},
	
	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);
	},
	
	rnd : function() {
		var seed = new Date().getTime();
		seed = ((seed * 9301 + 49297) % 233280);
		
		return (seed / (233280.0));
	},
	
	rand : function(number) {
		return Math.ceil(DTech.Functions.rnd() * number);
	},

	map: function() {
		var domains = new Array(
			new Array('hofffuneralhomes.com', 'ABQIAAAAYzKLIBt1dfSh_WmX5OrvEhQDroRr20i9XYhUhJGJhRMrCUr5GBRcAS01zLYdk7eYRl2fbsSpv__xXw'),
			new Array('www.hofffuneralhomes.com', 'ABQIAAAAYzKLIBt1dfSh_WmX5OrvEhQPvzKDnWwBBSlFv3sO1YBWc-5PTxRfiTt-LD82_z8qhaReZ-JzsjlF4A')
		);
		
		DT.Maps.insert(domains);
	},

	slide: function(e) {
		Effect.toggle($(e).next('div.menu_body'), 'slide');

		//alert("Test");
		//if($(e).visible()){
		//	Effect.SlideUp($(e).next('div.menu_body'));
		//}
		//else {
			//alert("hidden");
		//	Effect.SlideDown($(e).next('div.menu_body'));
		//}
		//Effect.SlideDown($(e).next('div.menu_body'));
	}
};
/*
$(function() {alert('test');
	//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
	$("a.menu_head").click(function() {
		alert("Test");
		//e.preventDefault();
		//$(this).next("div.menu_body").slideToggle(300);
		//$(this).siblings().css({backgroundImage:"url(left.png)"});
	});
});
*/
DTech.Functions.init();