
/* > > > > > > > > > > > > > > > > > > > > > >#

Programmer: Midium - Tecnologia da Informação
WebSite:    www.midium.com.br
E-mail:     contato@midium.com.br
Date:       11/10/2010
Comments:   Class "Engine Resources"

#< < < < < < < < < < < < < < < < < < < < < < */

var $isIE = navigator . appName == 'Microsoft Internet Explorer';

var Midium_EngineResources = {
	LinkEvent : {
		Select : function(id)
		{
			this['ObjectSet_' + id] = 1;
			Midium_EngineResources . AlphaMotion . Opacity(Midium_EngineResources . Miscellaneous . Element . $id(id), 9);
		},
		Go : function(href)
		{
			href = href . toString() . split('#');

			if(href[1]){
				document . cookie = '__RELOAD=REQUIRE;';
				document . cookie = '__ARCHOR=' + href[1] + ';';
				window . location . replace('Main');
				return false;
			}
		},
		Set : function(element, alphaOut, alphaOver, hitElement)
			{
			var hitid = hitElement ? hitElement . id : element . id;

			var alphaA = alphaOut  ? alphaOut : 0;
			var alphaB = alphaOver ? alphaOver : 15;

			var allow = !this['ObjectSet_' + hitid];

			if(allow)
			{
				this['ObjectSet_' + hitid] = 1;
				this['ObjectVal_' + hitid] = alphaA;
				this['ObjectAlp_' + hitid] = alphaB;
				this['ObjectAll_' + hitid] != 'disable' ? (this['ObjectAll_' + hitid] = 1) : null;
				this['ObjectInt_' + hitid] = setInterval('if(Resources.LinkEvent["ObjectAll_' + hitid + '"] != \'disable\'){ Resources.LinkEvent["ObjectVal_' + hitid + '"] += (Resources.LinkEvent["ObjectAlp_' + hitid + '"]-Resources.LinkEvent["ObjectVal_' + hitid + '"])/5; Resources.LinkEvent.Opacity(' + element . id + ',Resources.LinkEvent["ObjectVal_' + hitid + '"]); }', 10);
				//
				hitid == 'MM_3' ? prodFlapControl(1) : null;
				hitid == 'MM_5' ? careerFlapControl(1) : null;
			}
			Midium_EngineResources . Miscellaneous . Element . $id(hitid) . onmouseout = function()
			{
				Resources . LinkEvent['ObjectAlp_' + this . id] = alphaA;
				//
				var id = this . id . split('_');
				//
				this . id == 'MM_3' ? prodFlapControl(0) : null;
				this . id == 'MM_5' ? careerFlapControl(0) : null;
			}
			Midium_EngineResources . Miscellaneous . Element . $id(hitid) . onmouseover = function()
			{
				Resources . LinkEvent['ObjectAlp_' + this . id] = alphaB;
				//
				this . id == 'MM_3' ? prodFlapControl(1) : null;
				this . id == 'MM_5' ? careerFlapControl(1) : null;
			}
			Midium_EngineResources . Miscellaneous . Element . $id(hitid) . style . cursor = 'pointer';
		},
		Opacity : function(element, value)
			{
			element . style . opacity = value / 101;
			element . style . MozOpacity = value / 101;
			element . style . KhtmlOpacity = value / 101;
			element . style . filter = "alpha(opacity=" + value + ")";
		}
	},
	WindowOutside : {
		Get : function(innerHtml, width, height, alphaScreen, roll, disableExternalExit, reloadContent, disableContentOpacity)
		{
			if(this . isOn && !reloadContent){ return false } else { this . isOn = true }
			//
			Midium_EngineResources . Miscellaneous . Element . $css('WOSlot','display:block');
			//
			if(reloadContent){
				this . slot . removeChild(Midium_EngineResources . Miscellaneous . Element . $id('WOContainer'));
			} else {
				this . slot = document . getElementById('WOSlot');
			}
			this . slot . innerHTML += '<div id="WOContainer">' + innerHtml + '</div>';
			//
			!$isIE && !disableContentOpacity ? Midium_EngineResources . AlphaMotion . Opacity(Midium_EngineResources . Miscellaneous . Element . $id('WOContainer'), 0) : null;
			Midium_EngineResources . Miscellaneous . Element . $css('WOContainer', 'display:none,position:absolute,left:50%,top:50%,width:' + width + ',height:' + height + ',marginLeft:-' + (width/2) + 'px,marginTop:-' + (height/2) + 'px,zIndex:100');
			//
			if(reloadContent && !disableExternalExit)
			{
				Midium_EngineResources . Miscellaneous . Element . $id('AlphaScreen') . onclick = function()
				{
					Midium_EngineResources . WindowOutside . Exit();
				}
			}
			setTimeout(function()
			{
				Midium_EngineResources . Miscellaneous . Element . $css('WOContainer', 'display:block');
				!$isIE && !disableContentOpacity ? Midium_EngineResources . AlphaMotion . Fade('WOContainer', 'in', 100, 70) : null;
				//
				if(!reloadContent)
				{
					if(roll){
						Midium_EngineResources . WindowOutside . Roll(height);
					}
				}
			}, reloadContent ? 1 : 300);
			!reloadContent ? this . AlphaScreen(alphaScreen, disableExternalExit) : null;
		},
		AlphaScreen : function(opacity,disableExternalExit)
		{
			this . slot . innerHTML += '<div id="AlphaScreen"></div>'; 
			//
			Midium_EngineResources . AlphaMotion . Opacity(Midium_EngineResources . Miscellaneous . Element . $id('AlphaScreen'), 0);
			Midium_EngineResources . AlphaMotion . Fade('AlphaScreen','in', opacity, 25);
			//
			if(!disableExternalExit)
			{
				Midium_EngineResources . Miscellaneous . Element . $id('AlphaScreen') . onclick = function()
				{
					Midium_EngineResources . WindowOutside . Exit();
				}
			}
			var windowWidth = document . body . scrollWidth;
			var windowHeight = document . body . scrollHeight;
			//
			Midium_EngineResources . Miscellaneous . Element . $css('AlphaScreen', 'position:absolute,top:0px,width:100%,width:' + windowWidth + ',height:' + windowHeight + ',backgroundColor:#000000,zIndex:99');
		},
		Roll : function(slotHeight)
		{
			var scrollPos;
			document.all ? (scrollPos = !document . documentElement . scrollTop ? document . body . scrollTop : document . documentElement . scrollTop) : (scrollPos = window . pageYOffset);
			//
			var pageHeight = document . body . clientHeight;
			var objPos = (-(slotHeight / 2)) + scrollPos;
			//
			this . rollInterval = setInterval(function()
			{
				document.all ? (scrollPos = !document . documentElement . scrollTop ? document . body . scrollTop : document . documentElement . scrollTop) : (scrollPos = window . pageYOffset);
				objPos += (((-(slotHeight / 2)) + scrollPos) - objPos) / 10;
				Midium_EngineResources . Miscellaneous . Element . $css('WOContainer', 'top:' + (objPos + (pageHeight / 2) + (slotHeight / 2)) + 'px');
			},10);
		},
		Exit : function()
		{
			clearInterval(this . rollInterval);
			//
			Midium_EngineResources . Miscellaneous . Element . $id('AlphaScreen') . onclick = function()
			{
				return false;
			}
			Midium_EngineResources . AlphaMotion . Fade('WOContainer', 'out', 0, 80);
			//
			delete Midium_EngineResources . WindowOutside . rollInterval;
			//
			setTimeout(function()
			{
				Midium_EngineResources . Miscellaneous . Element . $css('WOContainer', 'display:none');
				Midium_EngineResources . AlphaMotion . Fade('AlphaScreen', 'out', 0, 40);
				//
			},200);
			//
			var object = this . slot;
			//
			setTimeout(function()
			{
				Midium_EngineResources . Miscellaneous . Element . $css('WOSlot','display:none');
				//
				setTimeout(function()
				{
					object . removeChild(document . getElementById('WOContainer'));
					object . removeChild(document . getElementById('AlphaScreen'));
					Midium_EngineResources . WindowOutside . isOn = 0;
				},200);
			},800);
		},
		isOn : 0
	},
	AlphaMotion : {
		Fade : function(object, method, alpha, speed, timeout)
		{
			var oldValue;
			var randomValue = Math . random();
			var progress = speed / 100 * 15;
			var timeCounter = 0;
			//
			switch(method)
			{
				case 'in':
				method = 1; 
				this['alphaValue_' + object] = alpha;
				break;
				//
				case 'out':
				method = 0;
				oldValue = this['alphaValue_' + object];
				alpha = alpha + (oldValue ? oldValue : 100);
				break;

				default:
				return false;
			}
			timeout = !timeout ? 0 : timeout;
			this['element_' + randomValue] = Midium_EngineResources . Miscellaneous . Element . $id(object);
			//
			for(counter = (method ? 0 : alpha + (method ? 5 : -5)); counter <= alpha + (method ? 5 : -5) && counter + 11 >= 0; method ? (counter += progress) : (counter -= progress))
			{
				setTimeout('Midium_EngineResources . AlphaMotion . Opacity(' + object + ',' + counter + ',' + randomValue + ')', (timeCounter * 9) + timeout); 
				timeCounter++;
			}
		},
		Opacity : function(object, value, randomValue)
		{
			value  = value > 100 ? 100 : (value < 0 ? 0 : value);
			//
			object = randomValue ? this['element_' + randomValue] . style : object . style;
			//
			object . opacity = value / 101;
			object . MozOpacity = value / 101;
			object . KhtmlOpacity = value / 101;
			object . filter = "alpha(opacity=" + value + ")";
		}
	},
	Miscellaneous : {
		Element : {
			$id : function(strid)
			{
				return document . getElementById(strid);
			},
			$css : function(strid, values)
			{
				var boo = true;
				var object = this . $id(strid);
				//
				if(object){
					//
					values = values . split(',');
					//
					for(i = 0; i < values . length; i++){
						strs = values[i] . split(':');
						object . style[strs[0]] = strs[1];
					}
				} else {
					 boo = false;
				}
				return boo;
			}
		}
	}
}
var Resources = Midium_EngineResources;

//Print Window Outside Slot
document.write('<div id="WOSlot" style="display:none;"></div>');

/* FUNCTIONS */

var $elmt = function(e)
{
	return document . getElementById(e);
}
var $importscript = function(url)
{
	var e = document . createElement('script');
	//
	e . src = url;
	//
	document . body . appendChild(e);
}
var $geturl = function(url)
{
	window . location . replace(url);
}
var $gethtml = function(e, html, add)
{
	if(add){
		//
		$elmt(e).innerHTML += html;
		//
	} else {
		//
		$elmt(e).innerHTML = html;
	}
}
var $style = function(e, type, value)
{
	$elmt(e).style[type] = value;
}
var getObjectSwf = function(target, src, width, height, fv)
{
	$elmt(target) . innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="' + target + '_objswf" width="' + width + '" height="' + height + '"><param name="movie" value="' + src + '" /><param name="wmode" value="transparent" /><param name="scaleMode" value="noscale" /><param name="allowScriptAccess" value="always"><param name="quality" value="best" /><param name="menu" value="false" /><param name="flashVars" value="' + fv +'" /><embed src="' + src + '" name="' + target + '_name" quality="best" wmode="transparent" allowScriptAccess="always" flashVars="' + fv + '" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed></object>';

}
function conversation()
{
	Midium_EngineResources . WindowOutside . Get('<div style="position:absolute; width:276px; height:42px; margin-top:1px; background-image:url(Includes/Images/Main/receptionOnline_logo.gif);"></div><a href="javascript:Midium_EngineResources.WindowOutside.Exit();" style="position:absolute; width:auto; right:66px; top:16px; font:11 Arial; color:#333333; text-decoration:none;" title="Sair da conversa"> Sair </a><iframe src="http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=" width="300" height="300" style="width:500px; height:500px; background-color:#FFFFFF;" frameborder="0" scrolling="no"></iframe>',500,500,80); 
}
function showNewsletterForm()
{
	Midium_EngineResources . WindowOutside . Get('<a href="javascript:Midium_EngineResources.WindowOutside.Exit()" style="z-index:2; margin-left:420px; width:60px; color:white; text-decoration:none; font: bold 12 Arial;"><font color="red"> x </font> Sair </a><iframe style="position:absolute; width:454px; height:138px; left:0px; top:15px;" src="newsletterForm.php" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" allowtransparency="true" title="Cadastre em nossa newsletter e receba nossas promoções, notícias e lançamentos"></iframe>', 454, 138, 80, 1);
}
function showDealerForm(id)
{
	Midium_EngineResources . WindowOutside . Get('<iframe src="representanteForm.php" width="626" height="550" allowtransparency="true" frameborder="0" scrolling="no"></iframe>', 626, 550, 80, 1);
}

/* CLASS */

var $winevent = {
	add : function(attr, funct){
		
		var newfunct = 'funct' + Math.floor(Math.random()*1000);
		
		window[newfunct] = funct;

		attr  = attr  . split(' & ');

		for(i1 = 0; i1 < attr . length; i1++){
			actarr = $winevent . actarr[attr[i1] . toUpperCase()];
			actarr[(actarr . length + 1) - 1] = newfunct;
		}
	},
	actarr : {
		LOAD  : new Array(),
		RESIZE : new Array(),
		ERROR : new Array(),
		UNLOAD : new Array(),
		BEFOREUNLOAD : new Array()
	},
	events : {
		winonload : function(){

			actarr = $winevent . actarr . LOAD;

			for(i = 0; i < actarr . length; i++){
				window[actarr[i]]();
			}
		},
		winonresize : function(){

			actarr = $winevent . actarr . RESIZE;

			for(i = 0; i < actarr . length; i++){
				window[actarr[i]]();
			}
		},
		winonerror : function(){

			actarr = $winevent . actarr . ERROR;

			for(i = 0; i < actarr . length; i++){
				window[actarr[i]]();
			}
		},
		winonunload : function(){

			actarr = $winevent . actarr . UNLOAD;

			for(i = 0; i < actarr . length; i++){
				window[actarr[i]]();
			}
		},
		winonbeforeunload : function(){

			actarr = $winevent . actarr . BEFOREUNLOAD;

			for(i = 0; i < actarr . length; i++){
				window[actarr[i]]();
			}
		}
	}
}
window . onload         = $winevent . events . winonload;
window . onresize       = $winevent . events . winonresize;
window . onerror        = $winevent . events . winonerror;
window . onunload       = $winevent . events . winonunload;
window . onbeforeunload = $winevent . events . winonbeforeunload;

/* MISCELLANEOUS */

$winevent.add('error',function()
	{
		return false;		   
	}
);

/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
**/

if($isIE){

	var DD_belatedPNG = {
		ns: 'DD_belatedPNG',
		imgSize: {},
		delay: 10,
		nodesFixed: 0,
		createVmlNameSpace: function () {
			if (document.namespaces && !document.namespaces[this.ns]) {
				document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
			}
		},
		createVmlStyleSheet: function () {
			var screenStyleSheet, printStyleSheet;
			screenStyleSheet = document.createElement('style');
			screenStyleSheet.setAttribute('media', 'screen');
			document.documentElement.firstChild.insertBefore(screenStyleSheet, document.documentElement.firstChild.firstChild);
			if (screenStyleSheet.styleSheet) {
				screenStyleSheet = screenStyleSheet.styleSheet;
				screenStyleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
				screenStyleSheet.addRule(this.ns + '\\:shape', 'position:absolute;');
				screenStyleSheet.addRule('img.' + this.ns + '_sizeFinder', 'behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;');
				this.screenStyleSheet = screenStyleSheet;
				printStyleSheet = document.createElement('style');
				printStyleSheet.setAttribute('media', 'print');
				document.documentElement.firstChild.insertBefore(printStyleSheet, document.documentElement.firstChild.firstChild);
				printStyleSheet = printStyleSheet.styleSheet;
				printStyleSheet.addRule(this.ns + '\\:*', '{display: none !important;}');
				printStyleSheet.addRule('img.' + this.ns + '_sizeFinder', '{display: none !important;}');
			}
		},
		readPropertyChange: function () {
			var el, display, v;
			el = event.srcElement;
			if (!el.vmlInitiated) {
				return;
			}
			if (event.propertyName.search('background') != -1 || event.propertyName.search('border') != -1) {
				DD_belatedPNG.applyVML(el);
			}
			if (event.propertyName == 'style.display') {
				display = (el.currentStyle.display == 'none') ? 'none' : 'block';
				for (v in el.vml) {
					if (el.vml.hasOwnProperty(v)) {
						el.vml[v].shape.style.display = display;
					}
				}
			}
			if (event.propertyName.search('filter') != -1) {
				DD_belatedPNG.vmlOpacity(el);
			}
		},
		vmlOpacity: function (el) {
			if (el.currentStyle.filter.search('lpha') != -1) {
				var trans = el.currentStyle.filter;
				trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
				el.vml.color.shape.style.filter = el.currentStyle.filter;
				el.vml.image.fill.opacity = trans;
			}
		},
		handlePseudoHover: function (el) {
			setTimeout(function () {
				DD_belatedPNG.applyVML(el);
			}, 1);
		},
		fix: function (selector) {
			if (this.screenStyleSheet) {
				var selectors, i;
				selectors = selector.split(','); 
				for (i=0; i<selectors.length; i++) {
					this.screenStyleSheet.addRule(selectors[i], 'behavior:expression(DD_belatedPNG.fixPng(this))');
				}
			}
		},
		applyVML: function (el) {
			el.runtimeStyle.cssText = '';
			this.vmlFill(el);
			this.vmlOffsets(el);
			this.vmlOpacity(el);
			if (el.isImg) {
				this.copyImageBorders(el);
			}
		},
		attachHandlers: function (el) {
			var self, handlers, handler, moreForAs, a, h;
			self = this;
			handlers = {resize: 'vmlOffsets', move: 'vmlOffsets'};
			if (el.nodeName == 'A') {
				moreForAs = {mouseleave: 'handlePseudoHover', mouseenter: 'handlePseudoHover', focus: 'handlePseudoHover', blur: 'handlePseudoHover'};
				for (a in moreForAs) {			
					if (moreForAs.hasOwnProperty(a)) {
						handlers[a] = moreForAs[a];
					}
				}
			}
			for (h in handlers) {
				if (handlers.hasOwnProperty(h)) {
					handler = function () {
						self[handlers[h]](el);
					};
					el.attachEvent('on' + h, handler);
				}
			}
			el.attachEvent('onpropertychange', this.readPropertyChange);
		},
		giveLayout: function (el) {
			el.style.zoom = 1;
			if (el.currentStyle.position == 'static') {
				el.style.position = 'relative';
			}
		},
		copyImageBorders: function (el) {
			var styles, s;
			styles = {'borderStyle':true, 'borderWidth':true, 'borderColor':true};
			for (s in styles) {
				if (styles.hasOwnProperty(s)) {
					el.vml.color.shape.style[s] = el.currentStyle[s];
				}
			}
		},
		vmlFill: function (el) {
			if (!el.currentStyle) {
				return;
			} else {
				var elStyle, noImg, lib, v, img, imgLoaded;
				elStyle = el.currentStyle;
			}
			for (v in el.vml) {
				if (el.vml.hasOwnProperty(v)) {
					el.vml[v].shape.style.zIndex = elStyle.zIndex;
				}
			}
			el.runtimeStyle.backgroundColor = '';
			el.runtimeStyle.backgroundImage = '';
			noImg = true;
			if (elStyle.backgroundImage != 'none' || el.isImg) {
				if (!el.isImg) {
					el.vmlBg = elStyle.backgroundImage;
					el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
				}
				else {
					el.vmlBg = el.src;
				}
				lib = this;
				if (!lib.imgSize[el.vmlBg]) {
					img = document.createElement('img');
					lib.imgSize[el.vmlBg] = img;
					img.className = lib.ns + '_sizeFinder';
					img.runtimeStyle.cssText = 'behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;';
					imgLoaded = function () {
						this.width = this.offsetWidth;
						this.height = this.offsetHeight;
						lib.vmlOffsets(el);
					};
					img.attachEvent('onload', imgLoaded);
					img.src = el.vmlBg;
					img.removeAttribute('width');
					img.removeAttribute('height');
					document.body.insertBefore(img, document.body.firstChild);
				}
				el.vml.image.fill.src = el.vmlBg;
				noImg = false;
			}
			el.vml.image.fill.on = !noImg;
			el.vml.image.fill.color = 'none';
			el.vml.color.shape.style.backgroundColor = elStyle.backgroundColor;
			el.runtimeStyle.backgroundImage = 'none';
			el.runtimeStyle.backgroundColor = 'transparent';
		},
		vmlOffsets: function (el) {
			var thisStyle, size, fudge, makeVisible, bg, bgR, dC, altC, b, c, v;
			thisStyle = el.currentStyle;
			size = {'W':el.clientWidth+1, 'H':el.clientHeight+1, 'w':this.imgSize[el.vmlBg].width, 'h':this.imgSize[el.vmlBg].height, 'L':el.offsetLeft, 'T':el.offsetTop, 'bLW':el.clientLeft, 'bTW':el.clientTop};
			fudge = (size.L + size.bLW == 1) ? 1 : 0;
			makeVisible = function (vml, l, t, w, h, o) {
				vml.coordsize = w+','+h;
				vml.coordorigin = o+','+o;
				vml.path = 'm0,0l'+w+',0l'+w+','+h+'l0,'+h+' xe';
				vml.style.width = w + 'px';
				vml.style.height = h + 'px';
				vml.style.left = l + 'px';
				vml.style.top = t + 'px';
			};
			makeVisible(el.vml.color.shape, (size.L + (el.isImg ? 0 : size.bLW)), (size.T + (el.isImg ? 0 : size.bTW)), (size.W-1), (size.H-1), 0);
			makeVisible(el.vml.image.shape, (size.L + size.bLW), (size.T + size.bTW), (size.W), (size.H), 1 );
			bg = {'X':0, 'Y':0};
			if (el.isImg) {
				bg.X = parseInt(thisStyle.paddingLeft, 10) + 1;
				bg.Y = parseInt(thisStyle.paddingTop, 10) + 1;
			}
			else {
				for (b in bg) {
					if (bg.hasOwnProperty(b)) {
						this.figurePercentage(bg, size, b, thisStyle['backgroundPosition'+b]);
					}
				}
			}
			el.vml.image.fill.position = (bg.X/size.W) + ',' + (bg.Y/size.H);
			bgR = thisStyle.backgroundRepeat;
			dC = {'T':1, 'R':size.W+fudge, 'B':size.H, 'L':1+fudge};
			altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'W'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'H'} };
			if (bgR != 'repeat' || el.isImg) {
				c = {'T':(bg.Y), 'R':(bg.X+size.w), 'B':(bg.Y+size.h), 'L':(bg.X)};
				if (bgR.search('repeat-') != -1) { 
					v = bgR.split('repeat-')[1].toUpperCase();
					c[altC[v].b1] = 1;
					c[altC[v].b2] = size[altC[v].d];
				}
				if (c.B > size.H) {
					c.B = size.H;
				}
				el.vml.image.shape.style.clip = 'rect('+c.T+'px '+(c.R+fudge)+'px '+c.B+'px '+(c.L+fudge)+'px)';
			}
			else {
				el.vml.image.shape.style.clip = 'rect('+dC.T+'px '+dC.R+'px '+dC.B+'px '+dC.L+'px)';
			}
		},
		figurePercentage: function (bg, size, axis, position) {
			var horizontal, fraction;
			fraction = true;
			horizontal = (axis == 'X');
			switch(position) {
				case 'left':
				case 'top':
					bg[axis] = 0;
					break;
				case 'center':
					bg[axis] = 0.5;
					break;
				case 'right':
				case 'bottom':
					bg[axis] = 1;
					break;
				default:
					if (position.search('%') != -1) {
						bg[axis] = parseInt(position, 10) / 100;
					}
					else {
						fraction = false;
					}
			}
			bg[axis] = Math.ceil(  fraction ? ( (size[horizontal?'W': 'H'] * bg[axis]) - (size[horizontal?'w': 'h'] * bg[axis]) ) : parseInt(position, 10)  );
			if (bg[axis] % 2 === 0) {
				bg[axis]++;
			}
			return bg[axis];
		},
		fixPng: function (el) {
			el.style.behavior = 'none';
			var lib, els, nodeStr, v, e;
			if (el.nodeName == 'BODY' || el.nodeName == 'TD' || el.nodeName == 'TR') {
				return;
			}
			el.isImg = false;
			if (el.nodeName == 'IMG') {
				if(el.src.toLowerCase().search(/\.png$/) != -1) {
					el.isImg = true;
					el.style.visibility = 'hidden';
				}
				else {
					return;
				}
			}
			else if (el.currentStyle.backgroundImage.toLowerCase().search('.png') == -1) {
				return;
			}
			lib = DD_belatedPNG;
			el.vml = {color: {}, image: {}};
			els = {shape: {}, fill: {}};
			for (v in el.vml) {
				if (el.vml.hasOwnProperty(v)) {
					for (e in els) {
						if (els.hasOwnProperty(e)) {
							nodeStr = lib.ns + ':' + e;
							el.vml[v][e] = document.createElement(nodeStr);
						}
					}
					el.vml[v].shape.stroked = false;
					el.vml[v].shape.appendChild(el.vml[v].fill);
					el.parentNode.insertBefore(el.vml[v].shape, el);
				}
			}
			el.vml.image.shape.fillcolor = 'none';
			el.vml.image.fill.type = 'tile';
			el.vml.color.fill.on = false;
			lib.attachHandlers(el);
			lib.giveLayout(el);
			lib.giveLayout(el.offsetParent);
			el.vmlInitiated = true;
			lib.applyVML(el);
		}
	};
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(r) {}
	
	DD_belatedPNG.createVmlNameSpace();
	DD_belatedPNG.createVmlStyleSheet();
	DD_belatedPNG.fix('div, a, span, img');
}
