var mapsedge = function(){
	return {
		buttonSetup: function(){
			$$('#mainmenu a').each(function(c){
				Event.observe(c, 'mouseover', function(){
					new Effect.Morph(c, {style: 'background: #666666; color: #FFFFFF', duration: 0.4});
					return false;
				});
				Event.observe(c, 'mouseout', function(){
					new Effect.Morph(c, {style: 'background: #000000; color: #FFFFFF', duration: 0.4});
					return false;
				});
			});
			$$('#servicesMenu a').each(function(c){
				Event.observe(c, 'mouseover', function(){
					new Effect.Morph(c, {style: 'background: #006; color: #FFD; width: 140;', duration: 0.4});
					return false;
				});
				Event.observe(c, 'mouseout', function(){
					new Effect.Morph(c, {style: 'background: #FFF; color: #008; width: 100;', duration: 0.4});
					return false;
				});
			});
			
		},
		recolorRows:function(){
			var even = false;
			$$('[recolor=1]').each(function(currentTable){
				var currentBody = currentTable.getElementsByTagName('tbody')
				var even = false;
				if(currentBody){
					var trs = currentBody[0].getElementsByTagName('tr')
					if(trs){
						for(var i = 0; i < trs.length; i++){
							if(trs[i].style.display != 'none'){
								if(even){
									trs[i].className = '';
								} else {
									trs[i].className = 'everyOther';
								}
								even = !even;
							}
						}
					}
				}
			})
		},

		sysFixPNG: function(){
			var arVersion = navigator.appVersion.split("MSIE");
			var version = parseFloat(arVersion[1]);
			var hspaceVal
			
			if ((version <= 6.0) && (document.body.filters)) {
				var img = $$('img').each(function(C){
					var imgName = C.src.toUpperCase();
				  if (imgName.indexOf('IMAGEPROC.ASP?') != -1) return;
					if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
						var imgID = (C.id) ? "id='" + C.id + "' " : "";
						var imgClass = (C.className) ? "class='" + C.className + "' " : "";
						var imgTitle = (C.title) ? "title='" + C.title + "' " : "title='" + C.alt + "' ";
						var imgStyle = "display:inline-block;" + C.style.cssText;
						if (C.align == "left") imgStyle = "float:left;" + imgStyle;
						if (C.align == "right") imgStyle = "float:right;" + imgStyle;
						if (C.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
						hspaceVal = C.hspace;
						if (hspaceVal != '') imgStyle = 'margin-left:' + hspaceVal + ';margin-right:' + (hspaceVal * 2) + ';' + imgStyle;
			         var strNewHTML = "<span " + imgID + imgClass + imgTitle
						+ " style=\"" + "width:" + C.width + "px; height:" + C.height + "px;" + imgStyle + ";"
			         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
						+ "(src=\'" + C.src + "\', sizingMethod='scale');\"></span>" 
						C.outerHTML = strNewHTML;
			      }
				});
			}
		},
		
		showPrivacy:function(){
			var win = new Window({className: "dialog", title: "Privacy Policy", width:600, height:400, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, url:'privacy-sm.asp', showEffectOptions:{duration:1.0}});
			win.showCenter();
		}
		
	};
}();

Event.observe(window, "load", function(){
	mapsedge.buttonSetup();
	mapsedge.recolorRows();
	mapsedge.sysFixPNG();
});


// ________________________________________________________________________________

