/*
	Web Ads JavaScript Library
	Copyright 2011 Zontera srl, All Rights Reserved.
*/


X1_AdReqPg = 'http://core.ad20.net/ad';
X1_CommonFilesDir = 'http://content.ad20.net/CommonFiles';
X1_TplDir = 'http://content.ad20.net/LibTemplates/';
X1_GlobalSkinId = 'ad20';
X1_Preview = false;



if (typeof(X1_PgId) == "undefined")
{
	var X1_PgId = parseInt(Math.random() * Math.pow(10,17)),
		X1_Time = 0,
		X1_Rnd = 0,
		X1_Info = {UA:1, WIN:1, OP:1, IE:1, IE50:1, IE55:1, IE6:1, IE7:1, IE8:1, IE9:0, FF:1, CH:1, ShortUrls:1, EncUrl:1, EncRef:1, Cookie:1, FlashVer:1, 
					FixedPos:1, InitWidth:1, InitHeight:1, Dbg:1, SelectsMask:0, UseFn:true, AS3OpenMode:0, IsHttps:false},
		X1_Tags = [],
		X1_TagIdx = -1,
		X1_DbgData = {},
		X1_ZIdxLevels = {Normal:50000, Expandable:60000, Peel:70000, Sticky:50000, Floating:1000000000, Toolbar:2000000000, Debug:2100000000},
		X1_IsHttps = false
	;
	

	if (document.URL.indexOf('mobile.ro') > -1)
	{
		X1_ZIdxLevels.Normal = 5000;
		X1_ZIdxLevels.Expandable = 6000;
	}
	else if (document.URL.indexOf('femeia.ro') > -1)
	{
		X1_ZIdxLevels.Normal = 5000000;
		X1_ZIdxLevels.Expandable = 6000000;
	}



	/* Begin - General use functions */
	
	
	function X1_Init()
	{
		var i,
			u = document.URL?document.URL:null,
			r = document.referrer?document.referrer:null,
			d = new Date(),
			a = navigator.userAgent?navigator.userAgent.toLowerCase():'';
		
		
		if (u && X1_Trim(u.toLowerCase()).indexOf("file://") != 0)
		{
			u=u.replace(/ /g, "%20").replace(/\+/g, "%2b");
			i=u.indexOf("#");if(i>-1)u=u.substring(0,i);
		}
		
		if (r && X1_Trim(r.toLowerCase()).indexOf("file://") != 0)
		{
			r=r.replace(/ /g, "%20").replace(/\+/g, "%2b");
			i=r.indexOf("#");if(i>-1)r=r.substring(0,i);
		}

		
		if (u == null)
			u = '';
			
		if (r == null)
			r = '';

		
		d.setTime(d.getTime()+1000);
		document.cookie = 'X1testck=1; expires=' + d.toGMTString() + '; path=/';

		
		
		X1_Info = 
		{
			UA:a,
			WIN:a.indexOf("windows")>=0,
			OP:a.indexOf('opera')>=0,
			EncUrl:X1_Enc(u),
			EncRef:X1_Enc(r),
			Cookie:document.cookie && document.cookie.indexOf('X1testck') > -1,
			FlashVer:X1_FVer(),
			FixedPos:typeof(document.compatMode)!='undefined'&&document.compatMode.toLowerCase()!='backcompat'&&(new RegExp("msie 7|msie 8|msie 9|firefox|chrome|opera/9|opera/10")).test(a),
			InitWidth:1,
			InitHeight:1,
			ShortUrls:1,
			Dbg:a.indexOf("windows nt") > -1 && (new RegExp("msie|firefox|chrome|opera")).test(a),
			UseFn:true,
			AS3OpenMode:0,
			IsHttps:X1_Trim(u).toLowerCase().indexOf('https') == 0
		};

		
		if (!X1_Info.OP)
		{
			X1_Info.IE = a.indexOf('msie')>=0;
			if (X1_Info.IE)
			{
				X1_Info.IE50 = a.indexOf('msie 5.0') >= 0;
				X1_Info.IE55 = a.indexOf('msie 5.5') >= 0;
				X1_Info.IE6 = a.indexOf('msie 6.') >= 0;
				X1_Info.IE7 = a.indexOf('msie 7.') >= 0;
				X1_Info.IE8 = a.indexOf('msie 8.') >= 0;
				X1_Info.IE9 = a.indexOf('msie 9.') >= 0;

				if (X1_Info.IE50)
					X1_Info.SelectsMask = 1;
				else
					if (X1_Info.IE55 || X1_Info.IE6)
						X1_Info.SelectsMask = location.protocol == "http:" ? 2 : 1;
				
				if (!X1_Info.IE9)
					X1_Info.UseFn = false;
			}
			else
			{
				if (a.indexOf('chrome')>=0)
					X1_Info.CH = true;
				else
					X1_Info.FF = true;
			}
		}
		
		
		if (X1_Info.IE)
			X1_Info.AS3OpenMode = 1;
		else 
			if (a.indexOf('firefox') > -1)
				X1_Info.AS3OpenMode = 2;
		
		
		X1_Info.InitWidth = X1_GetWinW();
		X1_Info.InitHeight = X1_GetWinH();
		
		X1_Dbg_Init();
	}
	
	
	

	

	function X1_TagRequest()
	{
		if (typeof(X1_InitCalled) == "undefined")
		{
			X1_InitCalled = true;
			X1_Init();
		}
	
	
		if (!X1_IsBrowserSizeOk())
			return;


		if (X1_Info.IsHttps)
		{
			X1_AdReqPg = 'https' + X1_AdReqPg.substring(4);
			X1_CommonFilesDir = 'https' + X1_CommonFilesDir.substring(4);
			X1_TplDir = 'https' + X1_TplDir.substring(4);
		}


		X1_Time = (new Date()).getTime();
		X1_Rnd = Math.random()*Math.pow(10,17);
		X1_TagIdx++;

		
		X1_StoreAdTagParams(X1_TagIdx);
		
	
		var sP, sAd = "", i, sQ, sIfrTags = window == top ? 0 : X1_CountTags();


		if (typeof(X1_AdParams) == "object")
		{
			for (sP in X1_AdParams)
			{
				if (typeof(X1_AdParams[sP]) == "object")
				{
					for (i=0; i<X1_AdParams[sP].length; i++)
					{
						if (typeof(X1_AdParams[sP][i]) == 'string')
							sAd += "&" + X1_Enc(sP.toString().toLowerCase()) + "[]=" + X1_Enc(X1_AdParams[sP][i]);
					}
				}
				else
				{	
					if (typeof(X1_AdParams[sP]) == 'string')
						sAd += "&" + X1_Enc(sP.toString().toLowerCase()) + "=" + X1_Enc(X1_AdParams[sP]);
				}
			}
		}
		else
		{
			sAd = "&sadparamsaremissing=true";
		}

		
		sQ = X1_AdReqPg + '?snocache=' + X1_CacheBuster() + '&spgid=' + X1_PgId + '&sww=' + X1_Info.InitWidth + '&swh=' + X1_Info.InitHeight +
			'&sck=' + (X1_Info.Cookie ? 'y' : 'n') + '&sfver=' + X1_Info.FlashVer + '&sifr=' + sIfrTags + '&f1pgad=' + X1_TagIdx + sAd;

		
		if (X1_Info.ShortUrls && sQ.length + X1_Info.EncUrl.length > 2000)
			sQ += '&surl=';
		else 
			sQ += '&surl=' + X1_Info.EncUrl;


		if (X1_Info.ShortUrls && sQ.length + X1_Info.EncRef.length > 2000)
			sQ += '&sref=';
		else
			sQ += '&sref=' + X1_Info.EncRef;


		document.write('<scr'+'ipt src="'+ sQ +'"><\/scr'+'ipt>');
	}
	

	

	
	
	function X1_StoreAdTagParams(i)
	{
		X1_Tags[i] = {AdParams:X1_AdParams, ZIdx:X1_ZIdxLevels};
		
		
		if (typeof(X1_CloseZIndex) != "undefined")
		{
			X1_Tags[i].ZIdx.Normal = X1_CloseZIndex;
			X1_CloseZIndex = undefined;
		}
		
		if (typeof(X1_OpenZIndex) != "undefined")
		{
			X1_Tags[i].ZIdx.Expandable = X1_OpenZIndex;
			X1_OpenZIndex = undefined;
		}

		if (typeof(X1_DisplayParams) != "undefined")
		{
			X1_Tags[i].DisplayParams = X1_DisplayParams;
			X1_DisplayParams = undefined;
		}
		
		if (typeof(X1_Underline_DisplayParams) != "undefined")
		{
			X1_Tags[i].Underline_DisplayParams = X1_Underline_DisplayParams;
			X1_Underline_DisplayParams = undefined;
		}

		if (typeof(X1_FormRequiredField_DisplayParams) != "undefined")
		{
			X1_Tags[i].FormRequiredField = {oDP:X1_FormRequiredField_DisplayParams};
			X1_FormRequiredField_DisplayParams = undefined;
		}

		if (typeof(X1_ToolbarFloating_OnMarginTopChange) != "undefined")
		{
			X1_Tags[i].ToolbarFloating_OnMarginTopChange = X1_ToolbarFloating_OnMarginTopChange;
			X1_ToolbarFloating_OnMarginTopChange = undefined;
		}
		
		if (typeof(X1_TextAndImage_DisplayParams) != "undefined")
		{
			X1_Tags[i].TextAndImage_DisplayParams = X1_TextAndImage_DisplayParams;
			X1_TextAndImage_DisplayParams = undefined;
		}
		
		if (typeof(X1_TextAndImageParams) != "undefined")
		{
			X1_Tags[i].TextAndImage_DisplayParams = X1_TextAndImageParams;
			X1_TextAndImageParams = undefined;
		}
		
		if (typeof(X1_SiteSplitFlash_Resize) != "undefined")
		{
			X1_Tags[i].SiteSplitFlash_Resize = X1_SiteSplitFlash_Resize;
			X1_SiteSplitFlash_Resize = undefined;
		}

		if (typeof(X1_AdZoneCallbackCode) != "undefined")
		{
			X1_Tags[i].CallbackCode = X1_AdZoneCallbackCode;
			X1_AdZoneCallbackCode = undefined;
		}

		if (typeof(X1_EmptyAdZoneCallbackCode) != "undefined")
		{
			X1_Tags[i].EmptyCallbackCode = X1_EmptyAdZoneCallbackCode;
			X1_EmptyAdZoneCallbackCode = undefined;
		}

		if (typeof(X1_DestinationClickUrl) != "undefined")
		{
			X1_Tags[i].DCU = X1_DestinationClickUrl;
			X1_DestinationClickUrl = undefined;
		}
		
		if (typeof(X1_YahooPublisherClickTrack) != "undefined")
		{
			X1_Tags[i].DCU = X1_YahooPublisherClickTrack;
			X1_YahooPublisherClickTrack = undefined;
		}
	}
	
	
	function X1_IsBrowserSizeOk()
	{
		var ok = true, ws = X1_Info.InitWidth, hs = X1_Info.InitHeight;
		
		if (typeof(X1_BrowserSizeMin) != "undefined")
		{
			var v = X1_BrowserSizeMin.toLowerCase().split('x'), i;
			if (v.length > 1)
			{
				i = parseInt(v[0]);	if (!isNaN(i) && ws < i) ok = false;
				i = parseInt(v[1]);	if (!isNaN(i) && hs < i) ok = false;
			}
			
			X1_BrowserSizeMin = undefined;
		}
		
		if (typeof(X1_BrowserSizeMax) != "undefined")
		{
			var v = X1_BrowserSizeMax.toLowerCase().split('x'), i;
			if (v.length > 1)
			{
				i = parseInt(v[0]);	if (!isNaN(i) && ws > i) ok = false;
				i = parseInt(v[1]);	if (!isNaN(i) && hs > i) ok = false;
			}
			
			X1_BrowserSizeMax = undefined;
		}
		
		return ok;
	}
	
	
	function X1_FVer()
	{
		var o, i, ver = null, n = window.navigator, FFS = "Shockwave Flash", IES = "ShockwaveFlash.ShockwaveFlash";

		if (!n)
			n = navigator;


		if (n && n.plugins && n.plugins.length)
		{
			for (i = 0; i < n.plugins.length; i++)
			{
				o = n.plugins[i];
				
				if (o.name.indexOf(FFS) > -1)
					ver = parseInt(o.description.split(FFS)[1], 10);
			}
		}


		if (ver == null && window.ActiveXObject)
		{
			try
			{
				o = new ActiveXObject(IES + ".7");
				
				if (!o)
				{
					o = new ActiveXObject(IES + ".6");
					o.Lc = "always";
				}
				
				if (!o)
					o = new ActiveXObject(IES);
				
				ver = parseInt(o.GetVariable("$version").split(" ")[1], 10);
			}
			catch(e) {}
		}
		
		
		if (ver == null)
			ver = 0;
		
		return ver;
	}
	
	
	function X1_GetElem(s){return document.getElementById(s);}
	function X1_Debug(s){if(typeof(Debug)=="function")Debug(s);}
	function X1_Enc(s){return window.encodeURIComponent?encodeURIComponent(s):escape(s);}
	function X1_Show(id){var o=X1_GetElem(id);if(o)o.style.display='';}
	function X1_Hide(id){var o=X1_GetElem(id);if(o)o.style.display='none';}
	
	
	function X1_FSCmd(id)
	{
		var a=navigator.appName,u=navigator.userAgent;
		if(a&&a.indexOf("Microsoft")>=0&&u.indexOf("Windows")>=0&&u.indexOf("3.1")<0)
		{
			return "<script language=VBScript>on error resume next\n Sub "+id+"_FSCommand(ByVal c,ByVal a)\n call "+id+"Fn(c, a)\n end sub<\/script>";
		}
		return "";
	}


	function X1_HideSelects(z)
	{
		var i,o,v=document.getElementsByTagName('SELECT');
		for(i=0;i<v.length; i++)
		{
			o=v[i];if(!o||!o.offsetParent)continue;
			if(z){o.x1_pv=o.style.visibility;o.style.visibility='hidden';}
			else{o.style.visibility=o.x1_pv;}
		}
	}


	function X1_CacheBuster()
	{
		return escape(X1_Time+'_'+X1_Rnd);
	}


	function X1_Trim(s)
	{
		if(typeof(s)=="undefined")return "";
		else return s.toString().replace(/^\s+|\s+$/g, '');
	}


	function X1_JsEncLight(s)
	{
		if (typeof(s) == "undefined" || !s) return "";
		
		var i, iLen = s.length, c, iC, v = [];

		for (i = 0; i < iLen; i++)
		{
			c = s.charAt(i);
			iC = s.charCodeAt(i);

			if (c == "'")	v[v.length] = "\\'";	else
			if (c == "\"")	v[v.length] = "\\\"";	else
			if (c == "\b")	v[v.length] = "\\b";	else
			if (c == "\t")	v[v.length] = "\\t";	else
			if (c == "\n")	v[v.length] = "\\n";	else
			if (c == "\r")	v[v.length] = "\\r";	else
			
			v[v.length] = c;
		}
		
		return v.join("");
	}


	function X1_HtmlEncode(s)
	{
		if (typeof(s) == "number") return s.toString();
		if (typeof(s) == "undefined" || !s) return "";
	
		var i, iLen = s.length, c, iC, v = [];

		for (i = 0; i < iLen; i++)
		{
			c = s.charAt(i);
			iC = s.charCodeAt(i);

			if (c == "<")	v[v.length] = "&#60;";	else
			if (c == ">")	v[v.length] = "&#62;";	else
			if (c == "'")	v[v.length] = "&#39;";	else
			if (c == "\"")	v[v.length] = "&#34;";	else
			if (c == "&")	v[v.length] = "&#38;";	else
			if (iC <= 126)	v[v.length] = c;
			else
				v[v.length] = "&#"+ iC +";";
		}
		
		return v.join("");
	}


	function X1_HtmlEncodeCustom1(s)
	{
		if (typeof(s) == "undefined" || !s) return "";
		
		return X1_HtmlEncode(s).replace(/  /g, ' ').replace(/\n\r/g, '<br/>').replace(/\r\n/g, '<br/>').replace(/[\n|\r]/g, '<br/>');
	}


	function X1_HtmlEncodeCustom2(s)
	{
		if (typeof(s) == "undefined" || !s) return "";

		var i, iLen = s.length, c, iC, v = [];

		for (i = 0; i < iLen; i++)
		{
			c = s.charAt(i);
			iC = s.charCodeAt(i);

			if (c == "<")	v[v.length] = "&#60;";	else
			if (iC <= 126)	v[v.length] = c;
			else
				v[v.length] = "&#"+ iC +";";
		}
		
		var s = 
			v.join("").
			replace(/&#60;b>/gi,'<b>').replace(/&#60;\/b>/gi,'</b>').replace(/&#60;b /gi,'<b ').
			replace(/&#60;strong>/gi,'<strong>').replace(/&#60;\/strong>/gi,'</strong>').replace(/&#60;strong /gi,'<strong ').
			replace(/&#60;i>/gi,'<i>').replace(/&#60;\/i>/gi,'</i>').replace(/&#60;i /gi,'<i ').
			replace(/&#60;table/gi,'<table').replace(/&#60;\/table/gi,'</table').
			replace(/&#60;tr/gi,'<tr').replace(/&#60;\/tr/gi,'</tr').
			replace(/&#60;td/gi,'<td').replace(/&#60;\/td/gi,'</td').
			replace(/&#60;div/gi,'<div').replace(/&#60;\/div/gi,'</div').
			replace(/&#60;span/gi,'<span').replace(/&#60;\/span/gi,'</span').
			replace(/\s+on[a-z0-9]+\s*=/gi,' EvNA=').
			replace(/"+on[a-z0-9]+\s*=/gi,' EvNA=').
			replace(/'+on[a-z0-9]+\s*=/gi,' EvNA=').
			replace(/  /g, '&nbsp; ').replace(/\n\r/g, '<br/>').replace(/\r\n/g, '<br/>').replace(/[\n|\r]/g, '<br/>')
		;
		
		return s;
	}

	
	function X1_TrkHtmlCode(idx, S, html)
	{
		var clickPrefix = X1_GetClickPrefix(S.click, S.params),
			tag = X1_Tags[idx];

		html = html.
			replace(/\$creative_id\$/gi, S.id).
			replace(/\$display_time\$/gi, X1_Time).
			replace(/\$display_random\$/gi, X1_Rnd).
			replace(/\$files_dir\$/gi, S.dir).
			replace(/\$click_tracking_url\$/gi, clickPrefix).
			replace(/\$ad_params_site\$/gi, escape(tag.AdParams.site)).
			replace(/\$ad_params_zone\$/gi, escape(tag.AdParams.zone))
		;
		
		var i, vUrls = html.split('$click_url_begin$'), v, sCU;
		
		if (vUrls.length > 1)
		{
			for (i = 0; i < vUrls.length; i++)
			{
				v = vUrls[i].split('$click_url_end$');
				
				if (v.length > 1)
				{
					sCU = v[0];
					sCU = tag.DCU ? tag.DCU.replace(/\$destination_click_url\$/gi, escape(sCU)) : sCU;
					vUrls[i] = clickPrefix + escape(sCU) + v[1];
				}
			}
			html = vUrls.join('');
		}
		
		
		vUrls = html.split('$encode_begin$');
		
		if (vUrls.length > 1)
		{
			for (i = 0; i < vUrls.length; i++)
			{
				v = vUrls[i].split('$encode_end$');
				
				if (v.length > 1)
					vUrls[i] = escape(v[0]) + v[1];
			}
			html = vUrls.join('');
		}


		vUrls = html.split('$decode_begin$');
		
		if (vUrls.length > 1)
		{
			for (i = 0; i < vUrls.length; i++)
			{
				v = vUrls[i].split('$decode_end$');
				
				if (v.length > 1)
					vUrls[i] = unescape(v[0]) + v[1];
			}
			html = vUrls.join('');
		}
		
		return(html);
	}


	function X1_Params(sQ,sP)
	{
		sP='&'+sP;
		if(sQ.length+sP.length>2000)
		{
			sP=sP.replace(/\&sref=[^\&]+/gi,'&sref=');
			if(sQ.length+sP.length>2000)
			{
				sP=sP.replace(/\&surl=[^\&]+/gi,'&surl=');
				if(sQ.length+sP.length>2000)sP='&s2000c=1';
			}
		}
		return sP.substr(1);
	}


	function X1_ParamsE(sQ,sP)
	{
		sP='%26'+sP;
		if(sQ.length+sP.length>2000)
		{
			sP=escape(unescape(sP).replace(/\&sref=[^\&]+/gi,'&sref='));
			if(sQ.length+sP.length>2000)
			{
				sP=escape(unescape(sP).replace(/\&surl=[^\&]+/gi,'&surl='));
				if(sQ.length+sP.length>2000)sP=escape('&s2000c=1');
			}
		}
		return sP.substr(3);
	}
	
	function X1_GetFileUrl(dir, file)
	{
		return file.indexOf('://') > 0 ? file : dir + file;
	}
	
	function X1_GetClickPrefix(click, params)
	{
		var q = click + '?scprnd=' + escape(Math.random());
		return q + '&' + X1_Params(q, params) + '&sclickurl=';
	}
	
	function X1_ReplaceRules(idx, url)
	{
		var t = X1_Tags[idx],
			s = url.
				replace(/\$ad_params_site\$/gi, escape(t.AdParams.site)).
				replace(/\$ad_params_zone\$/gi, escape(t.AdParams.zone))
		;
		
		if (t.DCU)
			s = t.DCU.replace(/\$destination_click_url\$/gi, escape(s));
		
		return s;
	}
		
	function X1_GetClickUrl(idx, u, S)
	{
		var ru = X1_ReplaceRules(idx, u),
			clickPrefix = X1_GetClickPrefix(S.click, S.params),
			clickTAG = clickPrefix + escape(ru);
		
		return clickTAG;
	}
	
	function X1_GetFlashVars(idx, fid, u, ut, S, setFn, bnrId)
	{
		var ru = X1_ReplaceRules(idx, u),
			clickPrefix = X1_GetClickPrefix(S.click, S.params),
			clickTAG = clickPrefix + escape(ru),
			c = escape(clickTAG),
			t = X1_Tags[idx];

		if (typeof(bnrId) == 'undefined' || !bnrId || bnrId == '')
			bnrId = fid;
		
		var	f = 'clickTAG=' + c +
				'&Scp=' + escape(clickPrefix) +
				'&Stg=' + ut +
				'&Sfn=' + (setFn ? fid + 'Fn' : '') +
				'&Sdir=' + escape(S.dir) +
				'&SAdParamsSite=' + escape(t.AdParams.site) +
				'&SAdParamsZone=' + escape(t.AdParams.zone) +
				'&SPgId=' + escape(X1_PgId) +
				'&SBnrId=' + escape(bnrId) +
				'&SAS3OM=' + X1_Info.AS3OpenMode +
				'&SAS3CMDFN=' + fid + 'Fn' +
				'&ClickTAG=' + c +
				'&ClickTag=' + c +
				'&clickTag=' + c +
				'&clicktag=' + c;

		return f;
	}
	
	function X1_GetFlashHtml(id, file, width, height, flashVars, sceneScale, sceneAlign)
	{
		var f = (X1_Info.FlashVer < 6 ? '' : flashVars),
			q = (X1_Info.FlashVer > 5 ? '' : flashVars),
			ss = (sceneScale ? sceneScale : 'showall'),
			sa = (sceneAlign ? sceneAlign : 'lt'),
			s =
			'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + id + '" width="' + width + '" height="' + height + '">' +
			' <param name="movie" value="' + file + q + '" />' +
			' <param name="flashvars" value="' + f + '" />' +
			' <param name="quality" value="high" />' +
			' <param name="wmode" value="transparent" />' +
			' <param name="allowScriptAccess" value="always" />' +
			' <param name="scale" value="' + ss + '" />' +
			' <param name="salign" value="' + sa + '" />' +
			' <embed type="application/x-shockwave-flash" id="' + id + '" width="' + width + '" height="' + height + '" ' + 
			'  src="' + file + q + '" flashvars="' + f + '" ' + 
			'  quality="high" wmode="transparent" allowScriptAccess="always" scale="' + ss + '" salign="' + sa + '"></embed>' +
			'</object>';
		
		return s;
	}
	
	function X1_GetImgHtml(id, file, width, height, clickCode, style, title)
	{
		var s = 
			'<img ' + 
			(id ? 'id="' + id + '" ' : '') +
			'src="' + file + '" width="' + width + '" height="' + height + '" border="0" alt="' + X1_HtmlEncode(title) + '" ' +
			(clickCode ? 'onClick="' + X1_JsEncLight(clickCode) + '" ' : '') +
			(style ? 'style="' + style + '"' : '') + 
			'/>';
		
		return s;
	}
	
	function X1_DT(S)
	{
		if(S.trk<1)return;
		var sQ=S.trkimg+'?sdtrnd='+escape(Math.random());
		document.write('<img src="'+(sQ+'&'+X1_Params(sQ,S.params))+'" width="1" height="1" border="0" style="position:absolute !important; left:-100px !important; top:-100px !important; width:1px !important; height:1px !important;"/>');
		
		
		var sETrkC = '';
		
		if (typeof(S.etrkm) != "undefined" && typeof(S.etrkc) != "undefined")
		{
			var t = X1_Trim(S.etrkc);
			if (t == '') return;
		
			switch (S.etrkm)
			{
				case 1:
					var v = t.split(/\s*[\n|\r]\s*/), i, sLow, sSrc;
					for (i = 0; i < v.length; i++)
					{
						sLow = v[i].toLowerCase();
						if (sLow.indexOf('http://') == 0 || sLow.indexOf('https://') == 0)
						{
							sSrc = v[i].replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
							sETrkC = sETrkC + '<img src="'+sSrc+'" width="1" height="1" border="0"/>';
						}
					}
					document.write('<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;">'+ sETrkC +'</div>');
					break;
				
				case 2:
					t = t.replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
					document.write('<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;">'+t+'</div>');
					break;			
				
				default:
					break;
			}
		}
	}


	function X1_DT2(S)
	{
		if(S.trk<1)return;
		
		
		var sETrkC = '';
		
		if (typeof(S.etrkm) != "undefined" && typeof(S.etrkc) != "undefined")
		{
			var t = X1_Trim(S.etrkc);
			if (t != '')
			{
				switch (S.etrkm)
				{
					case 1:
						var v = t.split(/\s*[\n|\r]\s*/), i, sLow, sSrc;
						for (i = 0; i < v.length; i++)
						{
							sLow = v[i].toLowerCase();
							if (sLow.indexOf('http://') == 0 || sLow.indexOf('https://') == 0)
							{
								sSrc = v[i].replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
								sETrkC = sETrkC + '<img src="'+sSrc+'" width="1" height="1" border="0"/>';
							}
						}
						break;
						
					case 2:
						sETrkC = sETrkC + t.replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
						break;			
					
					default:
						break;
				}
			}
		}
		
		
		var oD = document.createElement("DIV");
		if (oD)
		{
			oD.style.position = 'absolute';
			oD.style.top = '0px';
			oD.style.left = '0px';
			oD.style.width = '1px';
			oD.style.height = '1px';
			oD.style.display = '';
			 				
			var sQ=S.trkimg+'?sdtrnd='+escape(Math.random());
			var sTrkC='<img src="'+(sQ+'&'+X1_Params(sQ,S.params))+'" width="1" height="1" border="0"/>';
			oD.innerHTML = '<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;">'+ sTrkC + sETrkC +'</div>';
			
			document.body.insertBefore(oD, document.body.firstChild)
		}
	}
	
	
	function X1_EDT(m,t)
	{
		t = X1_Trim(t); 
		if (t == '') return;
		
		if (m == 1)
		{
			if (t.toLowerCase().indexOf('http://') == 0 || t.toLowerCase().indexOf('https://') == 0)
			{
				t = t.replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
				document.write('<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;"><img src="'+t+'" width="1" height="1" border="0"></div>');
			}
		}
		else
		{
			t = t.replace(/\$display_time\$/gi, X1_Time).replace(/\$display_random\$/gi, X1_Rnd);
			document.write('<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;">'+t+'</div>');
		}
	}


	function X1_UQ(idx, B,S)
	{
		var tag = X1_Tags[idx],
			sQ = S.dir + B.f +
			'?id='+escape(S.id)+'&dir='+escape(S.dir)+'&trk='+escape(S.trk)+'&trkimg='+escape(S.trkimg)+'&click='+escape(S.click)+
			'&site='+escape(tag.AdParams.site)+'&zone='+escape(tag.AdParams.zone);
		
		if (tag.DCU)
		{
			var sEDCU = escape(tag.DCU);
			if (sQ.length + sEDCU.length < 2000)
				sQ = sQ + '&dcu=' + sEDCU;
		}
		
		return sQ+'&params='+X1_ParamsE(sQ,escape(S.params));
	}
	
	
	function X1_GetXY(ObjRefOrId)
	{
		var oR = {x:-10000, y:-10000};

		var o = typeof(ObjRefOrId) == 'string' ? document.getElementById(ObjRefOrId) : ObjRefOrId;
		if(!o) return oR;

		if(o.getBoundingClientRect && !document.getBoxObjectFor)
		{
			var r = o.getBoundingClientRect(), 
				x = document.documentElement.scrollLeft || document.body.scrollLeft,
				y = document.documentElement.scrollTop || document.body.scrollTop;
			
			var noB = (new RegExp("msie 6|msie 8|firefox|chrome")).test(X1_Info.UA);
			
			if (noB)
				oR = {x: r.left + x, y: r.top + y};
			else
				oR = {x: r.left + x - 2, y: r.top + y - 2};
		}
		else
		{
			if(document.getBoxObjectFor)
			{
				var r = document.getBoxObjectFor(o);
				oR = {x: r.x, y: r.y};
			}
			else
			{
				if (o.offsetParent)
				{
					oR.x = o.offsetLeft
					oR.y = o.offsetTop
					
					while (o = o.offsetParent)
					{
						oR.x += o.offsetLeft
						oR.y += o.offsetTop
					}
				}
			}
		}
		
		return oR;
	}
	

	function X1_GetWH(ObjRefOrId)
	{
		var oR = {w:0, h:0}, o = typeof(ObjRefOrId) == 'string' ? document.getElementById(ObjRefOrId) : ObjRefOrId;
		if(!o) return oR;
		
		if(o.style.display == 'none')
		{
			o.style.display = '';
			oR.w = o.offsetWidth;
			oR.h = o.offsetHeight;
			o.style.display = 'none';
		}
		else
		{
			oR.w = o.offsetWidth;
			oR.h = o.offsetHeight;
		}

		return oR;
	}
	
	
	function X1_GetWinW()
	{
		var w = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,
			e = document.documentElement;
		
		if (!(X1_Info.IE6 || X1_Info.IE7 || X1_Info.IE8) && e && e.scrollHeight && e.clientHeight && e.scrollHeight > e.clientHeight)
			w = w - 18;
		
		return w;
	}
	
	function X1_GetWinH()
	{
		var h = window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,
			e = document.documentElement;
		
		if (!(X1_Info.IE6 || X1_Info.IE7 || X1_Info.IE8) && e && e.scrollWidth && e.clientWidth && e.scrollWidth > e.clientWidth)
			h = h - 17;

		return h;
	}
	
	
	function X1_GetComputedZIndex(ObjRefOrId)
	{
		var iR = 0;
		var o = typeof(ObjRefOrId) == 'string' ? document.getElementById(ObjRefOrId) : ObjRefOrId;
		if(!o) return iR;
		
		var iSig = 0;
		var s = '';
		
		while (o && o != document.body && iSig < 100)
		{
			s = X1_GetStyleValue(o, 'z-index');
			
			if (!isNaN(parseInt(s)))
			{
				iR = parseInt(s);
				break;
			}
			
			o = o.parentNode;
			iSig++;
		}

		return iR;
	}
	
	
	function X1_GetStyleValue(ObjRefOrId, HPName)
	{
		var sV = '', oDV, oCS, o = typeof(ObjRefOrId) == 'string' ? document.getElementById(ObjRefOrId) : ObjRefOrId;
		if(!o) return '';
		
		var v = /(-[a-z])/i.exec(HPName), CPName = HPName.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());

		if (o.currentStyle && o.currentStyle[CPName])
		{
			sV = o.currentStyle[CPName];
		}
		else
		{
			oDV = document.defaultView;
			
			if (oDV && oDV.getComputedStyle)
			{
				oCS = oDV.getComputedStyle(o, '');

				if (oCS && oCS.getPropertyValue)
					sV = oCS.getPropertyValue(HPName);
			}
		}

		if (sV == null)
			sV = '';

		return sV;
	}
	

	function X1_GetCCN(w,h)
	{
		if (typeof(w) == 'undefined') w = '0';
		if (typeof(h) == 'undefined') h = '0';
		
		var s = 'x1_banner' +
			' x1_' + X1_AdParams.section + '_' + X1_AdParams.zone + 
			' x1_w' + w + 
			' x1_h' + h + 
			' x1_' + w + 'x' + h;
		
		return s;
	}
	
	function X1_GetBaseStyle(width, height, bgColor)
	{
		var s = 
			'width:' + width + 'px !important; ' + 
			'height:' + height + 'px !important; ' + 
			'display:block !important; visibility:visible !important; float:none !important; margin:0px auto; ' +
			(bgColor ? 'background-color:' + bgColor + ';' : '')
		;

		return s;
	}

	function X1_GetMaskStyle(width, height, zIndex)
	{
		var s = 
			'position:absolute !important; top:-1000px; left:-1000px; z-index:' + zIndex + '; width:' + width + 'px !important; height:' + height + 'px !important; ' +
			'display:block !important; visibility:visible !important; float:none !important; ' +
			'cursor:pointer; border:solid 1px gray !important; background-color:white !important; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;'
		;
		return s;
	}
	
	
	
	function X1_StripBR(s)
	{
		if (typeof(s) == "undefined" || !s) return "";
		return s.replace(/\<br\/\>/gi, ' ');
	}
	
	
	function X1_GetColorCode(s,d)
	{
		if (typeof(s) == 'undefined') return;
		s = X1_Trim(s);
		return (new RegExp("[^#a-zA-Z0-9]")).test(s) || s.length < 4 || s.length > 250 ? d : s;
	}
	
	var X1_Dbg_New_callNumber = 0;
	
	function X1_Dbg_New(i, t, b, s, idx, ib)
	{
		if (!X1_Info.Dbg) return;
		
		X1_DbgData[i] = {idx:X1_Dbg_New_callNumber, t:t, b:b, s:s, tagIdx:idx, ib:ib, m:[{d:new Date(), s:'Init'}]};
		X1_Dbg_New_callNumber++;
	}
	
	function X1_Dbg_Msg(i, s)
	{
		if (!X1_Info.Dbg) return;
		
		if (window.X1_Dbg_MsgL)
		{
			X1_Dbg_MsgL(i, s);
		}
		else
		{
			var o = X1_DbgData[i];
			if (o)
				o.m.push({d:new Date(), s:s});
		}
	}
	
	function X1_Dbg_Init()
	{
		if (!X1_Info.Dbg) return;
		
		if (document.body && document.body.firstChild)
		{
			var o = document.createElement("DIV");
			if (o)
			{
				o.id = 'X1DbgActivateMask';
				o.style.position = 'absolute';
				o.style.left = '0px';
				o.style.top = '0px';
				o.style.width = '10px';
				o.style.width = '10px';
				o.style.display = 'block';
				o.style.overflow = 'hidden';
				o.style.zIndex = X1_ZIdxLevels.Debug;
				o.innerHTML = '<div style="width:10px; height:10px; background-color:white; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01; " onclick="X1_Dbg_Load();"></div>';
				o = document.body.insertBefore(o, document.body.firstChild);
				
				if (X1_Preview)
					setTimeout('X1_Dbg_Load();', 2000);
			}
		}
		else
		{
			setTimeout("X1_Dbg_Init();", 1000);
		}
	}
	
	function X1_Dbg_Load()
	{
		if (typeof(X1_Dbg_Open) == 'function')
		{
			X1_Dbg_Open();
			return;
		}
		
		var v, s = document.createElement('script');
		if (s)
		{
			s.type = 'text/javascript';
			s.src = X1_TplDir + 'Dbg.js';
			
			v = document.getElementsByTagName('head');
			if (v.length > 0)
			{
				v[0].appendChild(s);
			}
			else if (document.body && document.body.firstChild)
			{
				document.body.insertBefore(s, document.body.firstChild);
			}
		}
	}
	
	function X1_SendMsgToFlash(sId, sMsg)
	{
		var o = document.embeds && document.embeds[sId] ? document.embeds[sId] : document.getElementById(sId);
		if(o)
		{
			try
			{
				if (typeof(o.PercentLoaded) != 'undefined')
				{
					if (o.PercentLoaded() < 20)
						setTimeout('X1_SendMsgToFlash("'+ sId +'", "' + X1_JsEncLight(sMsg) + '");', 50);
					else
						o.SetVariable("X1_JSMsg",sMsg);
				}
				else
					o.SetVariable("X1_JSMsg",sMsg);
			}
			catch (ex){}
		}
	}
	
	
	function X1_ExecuteCallbackCode(idx, id, w, h)
	{
		var tag = X1_Tags[idx];
		
		if (!w && !h)
		{
			if (tag.EmptyCallbackCode)
			{
				X1_Dbg_Msg(id, 'Call callback code for empty ad zone.');
				
				if (typeof(tag.EmptyCallbackCode) == 'function')
					tag.EmptyCallbackCode();
				else
					eval(tag.EmptyCallbackCode);
			}
		}
		else
		{
			if (tag.CallbackCode)
			{
				X1_Dbg_Msg(id, 'Call callback code for ad zone.');
				
				if (typeof(tag.CallbackCode) == 'function')
					tag.CallbackCode(w, h);
				else
					eval(tag.CallbackCode);
			}
		}
	}
	
	
	var X1_TraverseTags_count = 1;
	
	function X1_TraverseTags(oN)
	{
		var i, iL, oT;
		
		if (oN.hasChildNodes())
		{
			iL = oN.childNodes.length;
			
			for (i = 0; i < iL; i++)
			{
				oT = oN.childNodes[i];
				if (oT)
				{
					X1_TraverseTags_count++;
					X1_TraverseTags(oT);
				}
			}
		}
	}
	
	
	function X1_CountTags()
	{
		X1_TraverseTags(document.body);
	
		return X1_TraverseTags_count;
	}
	
	
	function X1_AddWinEvt(evtName, fncRef)
	{
		if (window.attachEvent)
		{
			window.attachEvent("on" + evtName, fncRef);
		}
		else if (window.addEventListener)
		{
			window.addEventListener(evtName, fncRef, false);
		}
	}
	
	
	function X1_CreateClickMask(id, width, height, clickCode, zIndex)
	{
		o = document.createElement("DIV");
		if (o)
		{
			o.id = id;
			o.style.position = 'absolute';
			o.style.left = '-10000px';
			o.style.top = '-10000px';
			o.style.width = width + 'px';
			o.style.height = height + 'px';
			o.style.display = 'block';
			o.style.visibility = 'visible';
			o.style.overflow = 'hidden';
			o.style.zIndex = zIndex;
			o.innerHTML = '<div style="width:' + width + 'px !important; height:' + height + 'px !important; border:solid 1px gray; cursor:pointer !important; background-color:white; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01; " onClick="' + clickCode + '"></div>';
			o = document.body.insertBefore(o, document.body.firstChild);
		}			
	}
	
	
	function X1_SendAction(S, actionName)
	{
		var u = S.trkimg + '?sdtrnd=' + escape(Math.random());
		
		u = u + '&' + X1_Params(u, S.params) + '&suref=' + escape(actionName);
		
		setTimeout(function(){X1_SendActionLate(u);}, 200);
	}
	
	function X1_SendActionLate(url)
	{
		var oD = document.createElement("DIV");
		if (oD)
		{
			oD.style.position = 'absolute';
			oD.style.top = '0px';
			oD.style.left = '0px';
			oD.style.width = '1px';
			oD.style.height = '1px';
			oD.style.display = 'block';
			 				
			oD.innerHTML =
				'<div style="position:absolute !important; top:0px; left:0px; width:1px !important; height:1px !important; z-index:1 !important;' +
				' overflow:hidden !important; display:block; visibility:visible; filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;">' +
				' <img src="' + url + '" width="1" height="1" border="0"/>' +
				'</div>';
			
			document.body.insertBefore(oD, document.body.firstChild)
		}
	}
	
	
	/* End - General use functions */







	


	
	







	/* Begin - In-Page: Image Ad */


	function X1_Image(B,S)
	{
		var idx = X1_TagIdx,
			id = 'X1Img' + idx,
			tag = X1_Tags[idx],
			clickUrl = X1_GetClickUrl(idx, B.u, S),
			imgFile = X1_GetFileUrl(S.dir, B.f);

		X1_Dbg_New(id, 'Image', B, S, idx, id + 'B');
		X1_ExecuteCallbackCode(idx, id, B.w, B.h);
		
		var sEmptyClass = !B.w && !B.h ? ' x1_empty_zone' : '';
		
		window[id + 'Click'] = function(){window.open(clickUrl, B.ut);}
		
		document.write
		(
			'<div id="' + id + 'B" class="' + X1_GetCCN(B.w, B.h) + sEmptyClass + '" style="' + X1_GetBaseStyle(B.w, B.h) + '">' +
				X1_GetImgHtml(null, imgFile, B.w, B.h, (B.u ? 'window.'+id+'Click();' : ''), (B.u ? 'cursor:pointer;' : ''), B.tit) +
			'</div>'
		);
		
		X1_Dbg_Msg(id, 'Send display tracking request.');
		X1_DT(S);
		
		if (B.backup)
			X1_SendAction(S, S.id + '__show_backup_for_flash_' + X1_Info.FlashVer);
	}


	/* End - In-Page: Image ad */










	/* Begin - In-Page: Flash ad */


	function X1_Flash(B,S)
	{
		if (!B.u) B.u = unescape(B.fvars.clickTAG.substr(4));
		if (!B.ut) B.ut = B.fvars.Stg;
			
	
		if (B.backupimg && X1_Info.FlashVer < B.fv)
		{
			X1_Image({backup:1, f:B.backupimg, w:B.w, h:B.h, tit:'', u:B.u, ut:B.ut}, S);
			return;
		}
	
		var idx = X1_TagIdx,
			id = 'X1Fla' + idx,
			tag = X1_Tags[idx],
			clickUrl = X1_GetClickUrl(idx, B.u, S),
			flashUrl = X1_GetFileUrl(S.dir, B.f),
			flashVars = X1_GetFlashVars(idx, id, B.u, B.ut, S, true),
			ZIdxM = tag.ZIdx.Normal + 1,
			bgColor = (B.bg ? X1_Trim(B.bg) : '') 
		;

		X1_Dbg_New(id, 'Flash', B, S, idx, id + 'B');
		X1_ExecuteCallbackCode(idx, id, B.w, B.h);
		
		
		if (B.prfstrg)
			flashVars = flashVars + '&prfstrg=' + X1_Enc(B.prfstrg);
		
		if (bgColor == '')
			bgColor = null;

		document.write
		(
			'<div id="' + id + 'B" class="' + X1_GetCCN(B.w, B.h) + '" style="' + X1_GetBaseStyle(B.w, B.h, bgColor) + '">' +
				X1_GetFlashHtml(id, flashUrl, B.w, B.h, flashVars) +
			'</div>'
		);


		if (B.cm)
		{
			X1_Dbg_Msg(id, 'Enable click mask.');
			window[id + 'Click'] = function() {window.open(clickUrl, B.ut);}
			X1_CreateClickMask(id + 'M', B.w, B.h, 'window.' + id + 'Click();', ZIdxM);
	
			window[id + 'Pos'] = function()
			{
				var b = X1_GetElem(id + 'B'), m = X1_GetElem(id + 'M'), co;
				
				if (!b || !m) return;
				
				co = X1_GetXY(b);
				
				m.style.left = co.x + 'px';
				m.style.top = co.y + 'px';
				m.style.zIndex = ZIdxM;
			}
			
			X1_AddWinEvt('resize', window[id + 'Pos']);
			X1_AddWinEvt('scroll', window[id + 'Pos']);
			setInterval('window.' + id + 'Pos();', 500);
		}

		X1_Dbg_Msg(id, 'Send display tracking request.');
		X1_DT(S);
	}


	/* End - In-Page: Flash Ad */










	/* Begin - Over-the-Page: Expandable Flash Ad */


	function X1_ExpandableFlash(B,S)
	{
		if (!B.u) B.u = unescape(B.fvars.clickTAG.substr(4));
		if (!B.ut) B.ut = B.fvars.Stg;

		
		var idx = X1_TagIdx,
			id = 'X1ExpFla' + idx,
			tag = X1_Tags[idx],
			clickUrl = X1_GetClickUrl(idx, B.u, S),
			flashUrl = X1_GetFileUrl(S.dir, B.f),
			flashVars = X1_GetFlashVars(idx, id, B.u, B.ut, S, X1_Info.UseFn),
			Open = B.start.toLowerCase() == 'open',
			ZIdxClose = tag.ZIdx.Normal,
			ZIdxOpen = tag.ZIdx.Expandable,
			iSM = B.sm ? B.sm : 0,
			zFixedPos = X1_Info.FixedPos && iSM == 3,
			ws = X1_GetWinW(),
			hs = X1_GetWinH(),
			showBackup = (B.backupimg && B.backupimg != '' && X1_Info.FlashVer < B.fv)
		;

		X1_Dbg_New(id, 'Expandable Flash', B, S, idx, id + 'E');
		X1_ExecuteCallbackCode(idx, id, B.wclose, B.hclose);
		
		
		if (B.minw && B.minw >= ws)
		{
			X1_Dbg_Msg(id, 'This banner is not showed because the browser width is too small.');
			return;
		}
		if (B.minh && B.minh >= hs)
		{
			X1_Dbg_Msg(id, 'This banner is not showed because the browser height is too small.');
			return;
		}

		
		var RClose='',ROpen='auto auto auto auto',ETop=0,ELeft=0;

		switch(B.di.toLowerCase())
		{
			case 'up':
				ETop=B.hclose-B.hopen;
				RClose=(B.hopen-B.hclose) +'px auto auto auto';
				break;
			
			case 'left':
				ELeft=B.wclose-B.wopen;
				RClose='auto auto auto '+ (B.wopen - B.wclose) + 'px';
				break;
			
			case 'down':
				RClose='auto auto '+ B.hclose +'px auto';
				break;

			case 'right':
				RClose='auto '+ B.wclose +'px auto auto';
				break;
			
			case 'all':
				ETop=-B.yclose;
				ELeft=-B.xclose;
				RClose=B.yclose +'px '+ (B.xclose + B.wclose) +'px '+ (B.yclose + B.hclose) +'px '+ B.xclose +'px ';
				break;
			
			
			default:
				break;
		}


		document.write('<div id="' + id + 'B" class="' + X1_GetCCN(B.wclose, B.hclose) + '" style="' + X1_GetBaseStyle(B.wclose, B.hclose) + '"></div>');
		
		if (X1_Info.IE && !showBackup)
			document.write(X1_FSCmd(id));
		
		
		
		window[id+'CB'] = function()
		{
			var oD;
			
			if (X1_Info.SelectsMask == 2)
			{
				oD = document.createElement("DIV");
				if (oD)
				{
					oD.id = id + 'I';
					oD.style.position = zFixedPos?'fixed':'absolute';
					oD.style.left = '-10000px';
					oD.style.top = '-10000px';
					oD.style.width = B.wopen + 'px';
					oD.style.height = B.hopen + 'px';
					oD.style.clip = 'rect('+ (Open ? ROpen : RClose) +')';
					oD.style.display = '';
					oD.style.overflow = 'visible';
					oD.style.zIndex = (Open ? ZIdxOpen : ZIdxClose) - 1;
					oD.innerHTML = '<iframe src="" style="position:absolute; top:0px; left:0px; width:'+B.wopen+'px; height:'+B.hopen+'px; z-index: '+(oD.style.zIndex)+'; visibility:visible; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';
					oD = document.body.insertBefore(oD, document.body.firstChild);
				}
			}
			
			
			var htmlCode = '';
			
			
			
			if (showBackup)
			{
				var hasCloseImg = B.backupimgclose && B.backupimgclose != '';
			
				window[id + 'BIOOvr'] = function()
				{
					if (!hasCloseImg)
						window[id + 'Fn']('open', '');
				}
			
				window[id + 'BIOOut'] = function()
				{
					if (hasCloseImg)
					{
						X1_Show(id + 'bic');
						X1_Hide(id + 'bio');
					}
				
					window[id + 'Fn']('close', '');
				}
				
				window[id + 'BICOvr'] = function()
				{
					X1_Hide(id + 'bic');
					X1_Show(id + 'bio');
						
					window[id + 'Fn']('open', '');
				}
			
				window[id + 'BICOut'] = function()
				{
				}

				window[id + 'BIClick'] = function()
				{
					window.open(clickUrl, B.ut);
				}

				
				htmlCode = 
					'<img id="' + id + 'bio" src="' + X1_GetFileUrl(S.dir, B.backupimg) + '" width="' + B.wopen + '" height="' + B.hopen + '" border="0" alt="" ' +
					' style="cursor:pointer; ' + (hasCloseImg ? 'display:none;' : '') + '" ' +
					' onMouseOver="window.' + id + 'BIOOvr();" onMouseOut="window.' + id + 'BIOOut();" onClick="window.' + id + 'BIClick();"/>'
				;
				
				if (hasCloseImg)
					htmlCode += 
						'<img id="' + id + 'bic" src="' + X1_GetFileUrl(S.dir, B.backupimgclose) + '" width="' + B.wclose + '" height="' + B.hclose + '" border="0" alt="" style="cursor:pointer;" ' +
						' onMouseOver="window.' + id + 'BICOvr();" onMouseOut="window.' + id + 'BICOut();" onClick="window.' + id + 'BIClick();"/>';
				
				X1_SendAction(S, S.id + '__show_backup_for_flash_' + X1_Info.FlashVer);
			}
			else
			{
				htmlCode = X1_GetFlashHtml(id, flashUrl, B.wopen, B.hopen, flashVars);
			}
			
			

			oD = document.createElement("DIV");
			if (oD)
			{
				oD.id = id + 'E';
				oD.style.position = zFixedPos?'fixed':'absolute';
				oD.style.left = '-10000px';
				oD.style.top = '-10000px';
				oD.style.width = B.wopen + 'px';
				oD.style.height = B.hopen + 'px';
				oD.style.clip = 'rect('+ (Open ? ROpen : RClose) +')';
				oD.style.display = '';
				oD.style.overflow = 'visible';
				oD.style.zIndex = Open ? ZIdxOpen : ZIdxClose;
				oD.innerHTML = htmlCode;
				oD = document.body.insertBefore(oD, document.body.firstChild);
			}
		}

		window[id+'Fn'] = function(c,a)
		{
			if (a != 'auto')
				X1_Dbg_Msg(id, 'Cmd: '+ c + ' ' + a);
		
			var oE = document.getElementById(id+'E'), oI = document.getElementById(id+'I');
			
			if (oE)
			{
				c=c.toLowerCase();
				
				if (c=="open")
				{
					window[id+'FnOpen'] = true;
					
					if (X1_Info.SelectsMask == 1)
					{
						X1_HideSelects(true);
					}
					else if (X1_Info.SelectsMask == 2)
					{
						oI.style.clip = 'rect('+ROpen+')';
						oI.style.zIndex = ZIdxOpen - 1;
					}

					oE.style.clip = 'rect('+ROpen+')';
					oE.style.zIndex = ZIdxOpen;
					
					if(B.opentime>0)
					{
						if(window[id+'TId'])clearTimeout(window[id+'TId']);
						window[id+'TId']=setTimeout('window["'+id+'Fn"]("close","");',B.opentime*1000);
						X1_Dbg_Msg(id, 'Switch to close state in ' + B.opentime + ' seconds.');
					}
				}
				else if (c=="close")
				{
					window[id+'FnOpen'] = false;
					
					if(window[id+'TId'])clearTimeout(window[id+'TId']);
					
					oE.style.zIndex = ZIdxClose;
					oE.style.clip = 'rect('+RClose+')';

					if (X1_Info.SelectsMask == 1)
					{
						X1_HideSelects(false);
					}
					else if (X1_Info.SelectsMask == 2)
					{
						oI.style.clip = 'rect('+RClose+')';
						oI.style.zIndex = ZIdxClose - 1;
					}
				}
			}
		}


		window[id+'Pos'] = function()
		{
			var o = document.getElementById(id+'B');
			if (!o) return;
			
			
			var ws = X1_GetWinW();
			var hs = X1_GetWinH();
			var oXY = X1_GetXY(id + 'B');
			
			if (B.minw || B.minh)
			{
				if (B.minw >= ws || B.minh >= hs)
				{
					if (!window[id+'BannerBecomeInvisible'])
					{
						X1_Dbg_Msg(id, 'This banner is no more visible because the browser is too small.');
						window[id+'BannerBecomeInvisible'] = true;
					}
					o.style.display = 'none';
				}
				else
				{
					if (window[id+'BannerBecomeInvisible'])
					{
						X1_Dbg_Msg(id, 'This banner is visible again.');
						window[id+'BannerBecomeInvisible'] = false;
					}
				
					o.style.display = '';
				}
			}
			
			if (oXY.x >= -1000 && oXY.y >= -1000)
			{
				var iL = 0, iT = 0, zOpen = window[id+'FnOpen'] ? true : false, iSM = B.sm ? B.sm : 0;
				
				if (iSM > 0 && ((iSM == 1 && zOpen) || (iSM == 2 && !zOpen) || iSM == 3))
				{
					if (!zFixedPos)
					{
						iL = document.pageXOffset?document.pageXOffset:document.documentElement.scrollLeft||document.body.scrollLeft;
						iT = document.pageYOffset?document.pageYOffset:document.documentElement.scrollTop||document.body.scrollTop;
					}
				}
				
				
				o = document.getElementById(id+'I');
				if (o)
				{
					o.style.left = iL + ELeft + oXY.x + 'px';
					o.style.top = iT + ETop + oXY.y + 'px';
					
					if (B.minw || B.minh)
					{
						o.style.display = B.minw >= ws || B.minh >= hs ? 'none' : '';
					}
				}
				
				o = document.getElementById(id+'E');
				if (o)
				{
					o.style.left = iL + ELeft + oXY.x + 'px';
					o.style.top = iT + ETop + oXY.y + 'px';
					
					if (B.minw || B.minh)
					{
						o.style.display = B.minw >= ws || B.minh >= hs ? 'none' : '';
					}
				}
			}
		}
		
		
		window[id+'Load'] = function()
		{
			X1_SendMsgToFlash(id, "window_onload_event");
		}
		
		
		window[id+'CB']();
		
		
		if (Open)
		{
			X1_Dbg_Msg(id, 'Start in open state.');
			setTimeout('window.'+id+'Fn("open","auto");',100);
		}
		else
		{
			X1_Dbg_Msg(id, 'Start in close state.');
			setTimeout('window.'+id+'Fn("close","auto");',100);
		}
		
		if (iSM > 0)
			X1_Dbg_Msg(id, 'Enable sticky mode.');
		

		setTimeout('window.'+id+'Pos();',100);
		
		X1_AddWinEvt('load', function(){setTimeout('window.'+id+'Load();',2000);});
		X1_AddWinEvt('resize', window[id+'Pos']);
		X1_AddWinEvt('scroll', window[id+'Pos']);
		setInterval('window.'+id+'Pos();',200);

		X1_Dbg_Msg(id, 'Send display tracking request.');
		X1_DT(S);
	}


	/* End - Over-the-Page: Expandable Flash Ad */










	/* Begin - Over-the-Page: Floating Flash Ad */


	function X1_FloatingFlash(B,S)
	{
		if (!B.u) B.u = unescape(B.fvars.clickTAG.substr(4));
		if (!B.ut) B.ut = B.fvars.Stg;


		var idx = X1_TagIdx,
			id = 'X1FloatFla' + idx,
			tag = X1_Tags[idx],
			clickUrl = X1_GetClickUrl(idx, B.u, S),
			flashUrl = X1_GetFileUrl(S.dir, B.f),
			flashVars = X1_GetFlashVars(idx, id, B.u, B.ut, S, X1_Info.UseFn),
			ZIdxOpen = tag.ZIdx.Floating,
			iSM = B.scroll ? B.scroll : 0,
			zFixedPos = X1_Info.FixedPos && iSM > 0,
			iCen = 0,
			showBackup = (B.backupimg && B.backupimg != '' && X1_Info.FlashVer < B.fv),
			isClosed = false
		;


		X1_Dbg_New(id, 'Floating Flash', B, S, idx, id + 'B');


		if (showBackup && B.fsc)
		{
			B.mrg = {h:2,v:2,hp:0,vp:0};
			
			switch (B.fsc.h)
			{
				case 'l':B.mrg.h=1;B.mrg.hp=B.fsc.l;break;
				case 'c':break;
				case 'r':B.mrg.h=3;B.mrg.hp=B.fsc.r;break;
			}

			switch (B.fsc.v)
			{
				case 't':B.mrg.v=1;B.mrg.vp=B.fsc.t;break;
				case 'm':break;
				case 'b':B.mrg.v=3;B.mrg.vp=B.fsc.b;break;
			}			
			
			B.fsc = null;
		}


		window[id+'PosDim'] = function()
		{
			var w=0,h=0,t=0,l=0;

			var ws = X1_GetWinW();
			var hs = X1_GetWinH();
			
			if(B.cen)
			{
				l=parseInt((ws-B.w)/2);
				t=parseInt((hs-B.h)/2);
				w=B.w;
				h=B.h;
			}
			else if(B.fsc)
			{
				l=B.fsc.l;
				t=B.fsc.t;
				w=ws-B.fsc.r-B.fsc.l;
				h=hs-B.fsc.t-B.fsc.b;
			}
			else if(B.mrg)
			{
				switch(B.mrg.h)
				{
					case 1:l=B.mrg.hp;break;
					case 2:l=parseInt((ws-B.w)/2); iCen++; break;
					case 3:l=ws-B.w-B.mrg.hp;break;
				}

				switch(B.mrg.v)
				{
					case 1:t=B.mrg.vp;break;
					case 2:t=parseInt((hs-B.h)/2); iCen++; break;
					case 3:t=hs-B.h-B.mrg.vp;break;
				}

				w=B.w;
				h=B.h;
			}

			if (!zFixedPos)
			{
				l+=document.pageXOffset?document.pageXOffset:document.documentElement.scrollLeft||document.body.scrollLeft;
				t+=document.pageYOffset?document.pageYOffset:document.documentElement.scrollTop||document.body.scrollTop;
			}

			return {w:w,h:h,t:t,l:l};
		}


		
		var oD = document.createElement("DIV"), pd = window[id+'PosDim'](), salign='lt', sHtml = '', w = pd.w + 'px', h = pd.h + 'px', scale = 'showall';
		if (oD)
		{
			if (X1_Info.IE && !showBackup)
				document.write(X1_FSCmd(id));
			
			oD.id = id + 'B';
			oD.style.position = zFixedPos?'fixed':'absolute';
			oD.style.left = pd.l + 'px';
			oD.style.top = pd.t + 'px';
			oD.style.width = w;
			oD.style.height = h;
			oD.style.display = 'block';
			oD.style.overflow = 'visible';
			oD.style.zIndex = ZIdxOpen;
			
			if(B.fsc){w=h="100%";salign=B.fsc.h+B.fsc.v;scale='noscale';}

			if (X1_Info.SelectsMask == 2)
			{
				if (B.mm && (iCen == 2 || B.cen))
					sHtml = '<iframe src="" id="'+id+'I" style="position:absolute; left:-80px; top:-80px; width:'+(pd.w+160)+'px; height:'+(pd.h+160)+'px; visibility:visible; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';
				else
					sHtml = '<iframe src="" id="'+id+'I" style="position:absolute; left:0px; top:0px; width:'+w+'; height:'+h+'; visibility:visible; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';
			}
			
			if (B.mm && (iCen == 2 || B.cen))
				sHtml = sHtml + '<div style="position:absolute; left:-80px; top:-80px; width:'+(pd.w+160)+'px; height:'+(pd.h+160)+'px; visibility:visible; display:block; background-color:#000000; filter:alpha(opacity=50); -moz-opacity:0.50; opacity:0.50;"></div>';
			
			
			var htmlCode = '';
			
			if (showBackup)
			{
				window[id + 'BIClose'] = function(){window[id + 'Fn']('close', '');}
				window[id + 'BIClick'] = function(){window.open(clickUrl, B.ut);}
				
				htmlCode = 
					'<img src="' + X1_GetFileUrl(S.dir, B.backupimg) + '" width="' + B.w + '" height="' + B.h + '" border="0" alt="" ' +
					' style="cursor:pointer; position:absolute; left:0px; top:0px;" onClick="window.' + id + 'BIClick();"/>' +
					
					'<div style="width:' + B.bkw + 'px; height:' + B.bkh + 'px; position:absolute; left:' + B.bkx + 'px; top:' + B.bky + 'px; ' +
					' overflow:hidden; display:block; visibility:visible; cursor:pointer; background-color:#ffffff; ' + 
					(X1_Preview ? ' filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7;' : ' filter:alpha(opacity=1); -moz-opacity:0.01; opacity:0.01;') +
					'font-size:9px;" onClick="window.' + id + 'BIClose();">' +
					(X1_Preview ? 'This close button mask is shown only in Preview.' : '') +
					'</div>'
				;
			
				X1_SendAction(S, S.id + '__show_backup_for_flash_' + X1_Info.FlashVer);
			}
			else
			{
				htmlCode = X1_GetFlashHtml(id, flashUrl, w, h, flashVars, scale, salign);
			}
			
			
			
			oD.innerHTML = sHtml + 
				'<div id="'+id+'E" style="position:absolute; left:0px; top:0px; width:'+w+'; height:'+h+'; visibility:visible;">' +
					htmlCode +
				'</div>';
			
			oD = document.body.insertBefore(oD, document.body.firstChild);
		}
		

		if(B.land)
		{
			X1_Dbg_Msg(id, 'Enable Landing Zone.');
			
		
			var htmlCode = '';
			
			if (showBackup)
			{
				window[id + 'LZBIOpen'] = function(){window[id + 'LZFn']('open', '');}
				window[id + 'LZBIClose'] = function(){window[id + 'LZFn']('close', '');}
				window[id + 'LZBIClick'] = function(){window.open(clickUrl, B.ut);}
				
				htmlCode = 
					'<img src="' + X1_GetFileUrl(S.dir, B.land.backupimg) + '" width="' + B.land.w + '" height="' + B.land.h + '" border="0" alt="" ' +
					' style="cursor:pointer; positionx:absolute; left:0px; top:0px;" onClick="window.' + id + 'LZBIOpen();"/>'
				;
			}
			else
			{
				if (X1_Info.IE)
					document.write(X1_FSCmd(id+'LZ'));
					
				flashUrl = X1_GetFileUrl(S.dir, B.land.f);
				flashVars = X1_GetFlashVars(idx, id + 'LZ', B.u, B.ut, S, X1_Info.UseFn);
			
				htmlCode = X1_GetFlashHtml(id+'LZ', flashUrl, B.land.w, B.land.h, flashVars);
			}
			
			
			document.write
			(
				'<div id="'+id+'L" class="'+X1_GetCCN(B.land.w,B.land.h)+'" style="width:'+B.land.w+'px !important; height:'+B.land.h+'px !important; ' +
					'display:block !important; float:none !important; visibility:'+(B.land.show?'visible':'hidden')+'; margin:0px auto;">' +
					htmlCode +
				'</div>'
			);
		}


		window[id+'Fn'] = function(c,a)
		{
			X1_Dbg_Msg(id, 'Cmd: ' + c + ' ' + a);

			var oB = document.getElementById(id+'B');
			
			if (!oB)
				return;
				
			c=c.toLowerCase();
			
			
			if (B.land)
			{
				if(c=="open")
				{
					if(!B.land.show)
					{
						var oL=document.getElementById(id+'L');
						if(oL)oL.style.visibility="hidden";
					}

					if (X1_Info.SelectsMask == 1)
						X1_HideSelects(true);

					oB.style.zIndex=ZIdxOpen;
					oB.style.display="";
				}
				else if(c=="close"||c=="close_both")
				{
					clearInterval(window[id+'RFnIntervalId']);
					
					oB.style.display = "none";
					
					if (X1_Info.SelectsMask == 1)
						X1_HideSelects(false);

					if(!B.land.show)
					{
						var oL=document.getElementById(id+'L');
						if(oL)oL.style.visibility="visible";
					}
				}
			}
			else
			{
				if(c=="open" && isClosed == false)
				{
					if (X1_Info.SelectsMask == 1)
						X1_HideSelects(true);

					oB.style.zIndex=ZIdxOpen;
					oB.style.display="";
				}
				else if(c=="close"||c=="close_both")
				{
					isClosed = true;
					
					clearInterval(window[id+'RFnIntervalId']);
					
					oB.style.display = "none";
					oB.innerHTML = "&nbsp;";
					
					if (X1_Info.SelectsMask == 1)
						X1_HideSelects(false);
				}
			}
		}

		window[id+'LZFn'] = function(c,a)
		{
			window[id+'Fn'](c,a);	
		}

		window[id+'RFn'] = function()
		{
			var o = document.getElementById(id+'B'), p;
			
			if (o && o.style.display != "none")
			{
				p=window[id+'PosDim']();
				o.style.width=p.w+'px';o.style.height=p.h+'px';o.style.left=p.l+'px';o.style.top=p.t+'px';
			}
		}

		setTimeout(function(){window[id + 'Fn']('open', 'auto')}, 500);
		X1_AddWinEvt('resize', window[id + 'RFn']);
		
		if (B.scroll)
		{
			X1_Dbg_Msg(id, 'Enable sticky mode.');
			window[id + 'RFnIntervalId'] = setInterval('window.'+ id +'RFn();', 500);
			X1_AddWinEvt('scroll', window[id + 'RFn']);
		}

		if (B.secs > 0)
		{
			X1_Dbg_Msg(id, 'Switch to close state in ' + B.secs + ' seconds.');
			setTimeout('window.' + id + 'Fn("close", "auto");', B.secs * 1000);
		}

		X1_Dbg_Msg(id, 'Send display tracking request.');
		X1_DT(S);
	}


	/* End - Over-the-Page: Floating Flash Ad */







	/* Begin - In-Page: Html Ad */


	function X1_Html(B,S)
	{
		var idx = X1_TagIdx,
			id = 'X1Html' + idx,
			tag = X1_Tags[idx];
		
		if (!B.width) B.width = 0;
		if (!B.height) B.height = 0;
		
		
		if (X1_Info.FlashVer < B.fv && B.backupimg && B.backupimg != '' && B.width > 0 && B.height > 0)
		{
			X1_Image({backup:1, f:B.backupimg, w:B.width, h:B.height, tit:'', u:B.url, ut:'_blank'}, S);
			return;
		}
		
		
		X1_ExecuteCallbackCode(idx, id, B.width, B.height);
		
		X1_Dbg_New(id, 'Html Code', B, S, idx, id + 'B');
		X1_Dbg_Msg(id, 'Send display tracking request.');
		X1_DT(S);

		B.center = document.URL ? (document.URL.toLowerCase().indexOf('mobile.ro') < 0) : true;
		

		if (B.noc)
		{
			if (B.center)
				document.write('<div id="' + id + 'Before" style="height:1px !important; width:1px !important; overflow:hidden !important; position:relative !important; left:-1px !important; top:0px !important;"></div>');
			document.write(X1_TrkHtmlCode(idx, S, B.h));
		}
		else
		{
			document.write('<div id="' + id + 'B" class="' + X1_GetCCN(B.width, B.height) + '">' + X1_TrkHtmlCode(idx, S, B.h) + '</div>');
		}
		
		
		if (!B.center)
			return;
		
		
		window[id + 'Center'] = function()
		{
			var i = 0, d, o;
			
			if (B.noc)
			{
				o = X1_GetElem(id + 'Before');
			}
			else if (X1_Info.IE)
			{
				o = X1_GetElem(id + 'B');
			}
			else
			{
				o = X1_GetElem(id + 'B');
				if (o)
					o = o.firstChild;
			}
			
			if (!o)
				return;
			
			d = o.nextSibling;
			
			while (d && i < 50)
			{
				if (d.nodeName && d.nodeName.toUpperCase() != 'SCRIPT' && d.nodeName.toUpperCase() != 'NOSCRIPT' && d.style)
				{
					d.style.margin = '0px auto';
					break;
				}
				
				d = d.nextSibling;
				
				i++;
			}
		}
		
		setTimeout('window.' + id + 'Center();', 100);
		setTimeout('window.' + id + 'Center();', 300);
		setInterval('window.' + id + 'Center();', 500);
	}


	/* End - In-Page: Html Ad */










	/* Begin - In-Page: Iframe Ad */


	function X1_Iframe(B,S)
	{
		var idx = X1_TagIdx,
			id = 'X1Iframe' + idx;

		
		if (X1_Info.FlashVer < B.fv && B.backupimg && B.backupimg != '')
		{
			X1_Image({backup:1, f:B.backupimg, w:B.w, h:B.h, tit:'', u:B.url, ut:'_blank'}, S);
			return;
		}
		
		
		X1_ExecuteCallbackCode(idx, id, B.w, B.h);
		
		X1_Dbg_New(id, 'Html Restricted Code (IFRAME)', B, S, idx, id + 'B');
		X1_Dbg_Msg(id, 'Display tracking request is sent by the IFRAME.');
	
		document.write
		(
			'<div id="' + id + 'B" class="' + X1_GetCCN(B.w, B.h) + '" style="' + X1_GetBaseStyle(B.w, B.h) + '">' + 
				'<iframe src="' + X1_UQ(idx, B, S) + '" width="' + B.w + '" height="' + B.h + '" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>' +
			'</div>'
		);
	}


	/* End - In-Page: Iframe Ad */










	/* Begin - In-Page: Pop Ad */


	function X1_Pop(B,S)
	{
		var idx = X1_TagIdx,
			id = 'X1Pop' + idx;

		X1_Dbg_New(id, 'Pop', B, S, idx);
		X1_Dbg_Msg(id, 'Display tracking request is sent by the Pop window. When opening the window is blocked request is not sent.');


		var ws=screen.availWidth,hs=screen.availHeight,l=0,t=0;

		switch(B.p.h)
		{
			case 1:l=B.p.hp;break;
			case 2:l=Math.round((ws-B.w-10)/2);break;
			case 3:l=ws-B.w-B.p.hp-10;break;
		}

		switch(B.p.v)
		{
			case 1:t=B.p.vp;break;
			case 2:t=Math.round((hs-B.h-30)/2);break;
			case 3:t=hs-B.h-B.p.vp-30;break;
		}

		var a=B.attr,s="width="+B.w+",height="+B.h+",left="+l+",top="+t+",location="+a.l+",menubar="+a.m+",resizable="+a.r+",scrollbars="+a.b+",status="+a.s+",toolbar="+a.t;

		window.open(X1_UQ(idx, B, S), 'popid' + parseInt(Math.random() * Math.pow(10,17)), s);
		if (!B.t)window.focus();
	}


	/* End - In-Page: Pop Ad */










	/* Begin - In-Page: Transitional Ad */


	function X1_Transitional(B,S)
	{
		var idx = X1_TagIdx,
			id = 'X1Trans' + idx,
			clk = S.click.toLowerCase(),
			vDU = [], vN = [], vM = [], sD='__',
			oHrefRE = /\.as|\.js|\.swf|\.flv|\.zip|\.rar|\.dll|\.exe|\.m3u|\.mp3|\.wav|\.mpeg|\.jpg|\.jpeg|\.gif|\.png/,
			oClassRE = /x1_skip_this_link|skip_this_link/,
			oSkipFunction = null;
		
		X1_Dbg_New(id, 'Transitional', B, S, idx);
		X1_Dbg_Msg(id, 'Display tracking request is sent when the transitional page is seen.');

		if (typeof(X1_Trans_SkipFunction) == 'function')
			oSkipFunction = X1_Trans_SkipFunction;
		

		var Q = X1_UQ(idx, B, S) + '&dtime=' + escape(B.dtime);
		
		
		window[id+'Ov'] = function(){window.status=this[id+'h'];return true;}
		window[id+'Ou'] = function(){window.status="";return true;}
		window[id+'M']	= function(u)
		{
			var i,z,d='',v=u.split('://');
			
			if(v.length>1){v=v[1].split('/');d=X1_Trim(v[0]);}
			
			if(!d)return false;
			
			if(d==sD&&document.URL&&u.indexOf(document.URL.toLowerCase()+'#')>-1)return false;
			
			for(i=0;i<vN.length;i++){if(d.indexOf(vN[i])>-1)return false;}
			for(i=0;i<vM.length;i++){if(d.indexOf(vM[i])>-1)return true;}
			
			switch(parseInt(B.mode))
			{
				case 1:z=d.indexOf(sD)>-1;break;
				case 2:z=d.indexOf(sD)<0;break;
				default:z=true;break;
			}
			
			return z;
		}


		window[id+'L'] = function(o)
		{
			if(!o.href)return;

			var u=o.href.toLowerCase(),h,cn;
			if(u.indexOf("javascript:")<0&&u.indexOf(clk)<0)
			{
				if (oSkipFunction)
				{
					if (oSkipFunction(o))return;
				}
				else
				{
					if (oHrefRE.test(u))return;
					if (o.className && o.className.toLowerCase && oClassRE.test(o.className.toLowerCase()))return;
				}
			
				if(window[id+'M'](u))
				{
					vDU[vDU.length] = '<br/>' + u + ' &nbsp; &nbsp; &nbsp; &nbsp; ' + o.innerHTML;
					
					if(X1_Info.IE)h=o.innerHTML;
					o[id+'h']=o.href;
					o.href=Q+'&url='+escape(o.href);
					if(X1_Info.IE&&h!="")o.innerHTML=h;
					if(!o.onmouseover)o.onmouseover=window[id+'Ov'];
					if(!o.onmouseout)o.onmouseout=window[id+'Ou'];
				}
			}
		}

		window[id+'A'] = function()
		{
			X1_Dbg_Msg(id, 'Page loading is completed. Start replacing URLs.');
		
			var i,v,o,s;
			
			if(document.URL){v=document.URL.split('://');if(v.length>1){v=v[1].split('/');sD=X1_Trim(v[0]).toLowerCase();}}
			
			if(B.no){v=B.no.toLowerCase().split(/\s+/);		for(i=0;i<v.length;i++)vN[vN.length]=v[i];}
			if(B.must){v=B.must.toLowerCase().split(/\s+/);	for(i=0;i<v.length;i++)vM[vM.length]=v[i];}
			
			v=document.getElementsByTagName("A");for(i=0;i<v.length;i++)window[id+'L'](v[i]);
			v=document.getElementsByTagName("AREA");for(i=0;i<v.length;i++)window[id+'L'](v[i]);
			
			X1_Dbg_Msg(id, 'URLs that display the transitional page:<br/>' + vDU.join('') + '<br/><br/>');
		}

		X1_AddWinEvt('load', window[id+'A']);
	}


	/* End - In-Page: Transitional Ad */











	/* Dynamic loaded templates */
	var X1_DLT = {};
	
	function X1_DL(name, B, S, B2)
	{
		var send = false;
	
		if (!X1_DLT[name])
		{
			X1_DLT[name] = [];
			send = true;
		}
		
		if (S && typeof(S.etrkc) != "undefined")
		{
			var re = /(\<script|\<scr)/i, scriptTrack = re.test(S.etrkc);
			if (scriptTrack)
			{
				X1_DT(S);
				S.trk = 0;
			}
		}
		
		X1_DLT[name].push({B:B, B2:B2, S:S, AdTagIdx:X1_TagIdx});

		if (send)
			X1_DLI(name);
	}
	
	function X1_DLF(name, B, S, B2)
	{
		var send = false;
	
		if (!X1_DLT[name])
		{
			X1_DLT[name] = [];
			send = true;
		}
		
		if (S && typeof(S.etrkc) != "undefined")
		{
			var re = /(\<script|\<scr)/i, scriptTrack = re.test(S.etrkc);
			if (scriptTrack)
			{
				X1_DT(S);
				S.trk = 0;
			}
		}

		var id = 'X1AD'+X1_TagIdx+'B';
		document.write('<div id="'+id+'" style="display:block; visibility:visible; margin:0px auto;"></div>');
		
		X1_DLT[name].push({B:B, B2:B2, S:S, AdTagIdx:X1_TagIdx, ContainerId:id});
		
		if (send)
			X1_DLI(name);
	}
	
	function X1_DLI(name)
	{
		var v, s = document.createElement('script');
		if (s)
		{
			s.type = 'text/javascript';
			s.src = X1_TplDir + name + '.js?v=1';
			
			v = document.getElementsByTagName('head');
			if (v.length > 0)
			{
				v[0].appendChild(s);
			}
			else if (document.body && document.body.firstChild)
			{
				document.body.insertBefore(s, document.body.firstChild);
			}
		}
	}
	
	
	
	
	function X1_UnderlineMultipleLinks(B,S){B.load = 1;X1_Underline(B,S);}
	function X1_Underline(B,S){X1_DL('Underline',B,S);}
	function X1_Text(B,S){X1_DL('Text',B,S);}
	function X1_TextBegin(){X1_DL('Text',null,null);}
	function X1_TextEnd(){X1_DLF('Text',null,null);}
	function X1_PeelAway(B,S){X1_DL('PeelAway',B,S);}
	function X1_FloatingExpandableFlash(B,S){X1_DL('FloatingExpandableFlash',B,S);}
	function X1_SiteSplitFlash(B,S){X1_DLF('SiteSplitFlash',B,S);}
	function X1_FormRequiredField(B,S){X1_DLF('FormRequiredField',B,S);}
	function X1_FloatingImage(B,S){X1_DL('FloatingImage',B,S);}
	function X1_FloatingHtml(B,S){X1_DL('FloatingHtml',B,S);}
	function X1_ExpandableFlashKick(B,S){X1_DLF('ExpandableFlashKick',B,S);}
	function X1_ExpandableIframe(B,S){X1_DLF('ExpandableIframe',B,S);}
	function X1_ScrollingFloatingFlash(B,S){X1_DL('ScrollingFloatingFlash',B,S);}
	function X1_ToolbarFloatingFlash(B,S){X1_DL('ToolbarFloatingFlash',B,S);}
	function X1_TextAndImage(B,S){X1_DL('TextAndImage',B,S);}
	function X1_TextAndImageBegin(){X1_DL('TextAndImage',null,null);}
	function X1_TextAndImageEnd(){X1_DLF('TextAndImage',null,null);}
	function X1_LeftTopRightBranding(B,S){X1_DLF('LeftTopRightBranding',B,S);}
	function X1_FloatingFlash2(B,S){X1_DL('FloatingFlash2',B,S);}
	function X1_TwoFloatingFlash(B,B2,S){X1_DL('TwoFloatingFlash',B,S,B2);}
	function X1_LTRBrandingFloatingFlash(B,S){X1_DLF('LTRBrandingFloatingFlash',B,S);}
	function X1_Sidekick(B,S){X1_DLF('Sidekick',B,S);}
}



X1_TagRequest();







