var supersleight = function() { 
	var root=false;
	var applyPositioning=false;
	var shim='fileadmin/novaa/templates/js/x.gif';
	var shim_pattern=/x\.gif$/i;
	var fnLoadPngs=function(){
		if(root) {
			root=document.getElementById(root);
		} else {
			root=document;
		}
		for(var i=root.all.length-1,obj=null;(obj=root.all[i]);i--) {
			if(obj.currentStyle.backgroundImage.match(/\.png/i)!==null) {
				bg_fnFixPng(obj);
			}
			if(obj.tagName=='IMG'&&obj.src.match(/\.png$/i)!==null){
				el_fnFixPng(obj);
			}
			if(applyPositioning&&(obj.tagName=='A'||obj.tagName=='INPUT')&&obj.style.position==='') {
				obj.style.position='relative';
			}
		}
	};
	var bg_fnFixPng=function(obj){
		var mode='scale';
		var bg=obj.currentStyle.backgroundImage;
		var src=bg.substring(5,bg.length-2);
		if(obj.currentStyle.backgroundRepeat=='no-repeat'){
			mode='crop';
		}
		if (jQuery) var j = jQuery(obj);
		if (jQuery && obj.nodeName == 'DIV' && (j.width() > 150 || j.height() > 150)) {
			replacedInteger++;
			
			var p = j.position();
			var div = Array(
				'<div id="replacedDiv',replacedInteger,'"',
				' style="position: absolute; left: ', p.left, 'px; top: ',p.top,'px; width: ',j.width(),'px; height: ',j.height(),'px; z-index: ',(100-replacedInteger),'; '
			);
			
			if (obj.currentStyle.marginLeft) div.push('margin-left: '+obj.currentStyle.marginLeft+';');
			if (obj.currentStyle.marginTop) div.push('margin-top: '+obj.currentStyle.marginTop+';');
			div.push("filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='"+mode+"')");
			div.push('"></div>');
			
			jQuery(obj.parentNode).before(div.join(''));
			j.css('background', 'none');
			j.css('position', 'relative');
			j.css('z-index', 100+replacedInteger);
		} else {
			obj.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='"+mode+"')";
			obj.style.backgroundImage='url('+shim+')';
		}
	};
	var el_fnFixPng=function(img){
		var src=img.src;
		img.style.width=img.width+"px";
		img.style.height=img.height+"px";
		img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')";
		img.src=shim;
	};
	var addLoadEvent=function(func){
		var oldonload=window.onload;
		if(typeof window.onload!='function'){
			window.onload=func;
		} else { 
			window.onload=function() {
				if(oldonload){
					oldonload();
				}
				func();
			};
		}
	};
	return{
		init:function(){
			if (jQuery) fnLoadPngs();
			else addLoadEvent(fnLoadPngs);
		},
		limitTo:function(el){
			root=el;
		},
		run:function(){
			fnLoadPngs();
		}
	};
}();
/*if (jQuery) {
	var replacedInteger = 0;
	jQuery(document).ready(function(){
		supersleight.init();
	});
} else supersleight.init();
*/
function IE6TabFix(obj, act) {
	if (act == 'over') {
		obj.backupfilter = obj.style.filter;
		obj.backupbackgroundImage = obj.style.backgroundImage;
		obj.style.filter = '';
		obj.style.backgroundImage = '';
		bg_fnFixPng(obj);
	} else {
		obj.style.filter = obj.backupfilter;
		obj.style.backgroundImage = obj.backupbackgroundImage;
	}
}
var bg_fnFixPng = function(obj) {
	var mode = 'scale';
	var bg	= obj.currentStyle.backgroundImage;
	var src = bg.substring(5,bg.length-2);
	if (obj.currentStyle.backgroundRepeat == 'no-repeat') {
		mode = 'crop';
	}
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')";
	obj.style.backgroundImage = 'url(fileadmin/novaa/templates/js/x.gif)';
};
