
var bgsleight	= function() {
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (window.attachEvent) {
			window.attachEvent("onload", func) ;
		} else if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			}
		}
	}
	
	function fnLoadPngs() {
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7.0);
		for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
			if (obj.tagName.toLowerCase() == "body") continue ;
			try {
				if (obj.className.toLowerCase().indexOf("ui-") != -1) continue ;
			} catch (e) {}
			if (false && itsAllGood && obj.currentStyle.backgroundImage.match(/box_[\d{3}]_(top|mid|bottom)\.gif/i) != null) {
				//fixBoxBg(obj);
			} else if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
				fnFixPng(obj);
				obj.attachEvent("onpropertychange", fnPropertyChanged);
			}
		}
		/*for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
			if (obj.tagName.toLowerCase() != "a") continue ;
			obj.style.position = "relative" ;
			obj.style.zIndex = 1 ;
		}*/
	}

	function fnPropertyChanged() {
		if (window.event.propertyName == "style.backgroundImage") {
			var el = window.event.srcElement;
			if (!el.currentStyle.backgroundImage.match(/x\.gif/i)) {
				var bg	= el.currentStyle.backgroundImage;
				el.filters.item(0).src = bg.substring(5,bg.length-2);
				el.style.backgroundImage = "url(x.gif)";
			}
		}
	}

	function fnFixPng(obj) {
		var bg	= obj.currentStyle.backgroundImage;
		var src = bg.substring(5,bg.length-2);
		var objBackgroundRepeat = obj.currentStyle.backgroundRepeat ;
		var sizingMethod = (objBackgroundRepeat.indexOf("repeat-") != -1) ? "scale" : "crop" ;
		//if (sizingMethod == "scale") alert(obj.id + " - " + objBackgroundRepeat) ;
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";// scale || crop || image
		obj.style.backgroundImage = "none";//"url(x.gif)";
	}
	
	/*function fixBoxBg(obj) {
		var bgImage	= obj.currentStyle.backgroundImage;
		obj.style.backgroundImage = bgImage;
	}*/
	
	
	return {
		init: function() {
			if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
				addLoadEvent(fnLoadPngs);
			}
		}
	}
	
}();

bgsleight.init();

jQuery(document).ready(function($) {
	$('#leftmenu .tdLeft img').fadeTo(0, 0.7) ;
	$('#leftmenu a[id^=linkA]').hover(
	  function () {
		  var id = $(this).attr('id').replace(/[^\d]/g, '') ;
		  $('#linkB' + id).addClass('hover') ;
	    $('#linkA' + id + ' img').fadeTo(10, 1) ;
	  }, 
	  function () {
		  var id = $(this).attr('id').replace(/[^\d]/g, '') ;
		  $('#linkB' + id).removeClass('hover') ;
	    $('#linkA' + id + ' img').fadeTo(10, 0.7) ;
	  }
	) ;
	$('#leftmenu a[id^=linkB]').hover(
	  function () {
		  var id = $(this).attr('id').replace(/[^\d]/g, '') ;
	    $('#linkA' + id + ' img').fadeTo(10, 1) ;
	  }, 
	  function () {
		  var id = $(this).attr('id').replace(/[^\d]/g, '') ;
	    $('#linkA' + id + ' img').fadeTo(10, 0.7) ;
	  }
	) ;
	if ($('#leftspace').height() < 450) {
		$('#leftspace img').height(450) ;
	}
}) ;

function easterEgg(event, metaId) {
	if (event && (event.shiftKey || event.ctrlKey)) {
		document.location = '/login?next_meta=' + metaId ;
		return false ;
	}
	return true ;
}

function initAll() {
	menuInit() ;
	menuInit2() ;
}
try {
	menuArrow = new Image(10, 12);
	menuArrow.src = "/images/gui/nav/menu_arrow.gif";
} catch (e) {}

function topLeftOver(el,linkId) {
	if (document.getElementById) {
		if (el.className != "navTopLeftActive") {
			el.className = "navTopLeftOver" ;
			//document.getElementById(linkId).style.color = "#ffffff" ;
		}
	}
}
function topLeftOut(el,linkId) {
	if (document.getElementById) {
		if (el.className != "navTopLeftActive") {
			el.className = "navTopLeft" ;
			//document.getElementById(linkId).style.color = "#000000" ;
		}
	}
}
function topRightOver(el,linkId) {
	if (document.getElementById) {
		if (el.className != "navTopRightActive") {
			el.className = "navTopRightOver" ;
			//document.getElementById(linkId).style.color = "#ffffff" ;
		}
	}
}
function topRightOut(el,linkId) {
	if (document.getElementById) {
		if (el.className != "navTopRightActive") {
			el.className = "navTopRight" ;
			//document.getElementById(linkId).style.color = "#000000" ;
		}
	}
}

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll) {
	if (screen) {
		if ((screen.height - winH) < 150) {
			var winX = (screen.width - winW) / 2;
			var winY = 0;
		} else {
			var winX = (screen.width - winW) / 2;
			var winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=yes,menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH);
	}
}

//<A HREF="javascript: popWinOpen(600,560,'/path/file.ext','myWin',0,0)">Linktext</A>

