
(
function()
{
	function m(b){return b!=null?'"'+b+'"':'""'}
	function B(b){if(typeof encodeURIComponent=="function"){return encodeURIComponent(b)}else{return escape(b)}}
	function c(b,a){if(a){window.bc_url+="&"+b+"="+a}}
	function f(b,a){if(a){c(b,B(a))}}
	function l(b,a,d){if(a&&typeof a=="object"){a=a[d%a.length]}f("color_"+b,a)}

	function doit()
	{
		var n=null;
		var w=window;
		var d=document;
		var g=new Date;
		var t=g.getTime();
		var n = null;

		if ( w.bc_format == n || w.bc_id == n )
			return;

		w.bc_url = "http://blogcarnival.com/bc/widget_"+w.bc_format+".php?"
		w.onerror = w.bc_error_handler;
		c("id", w.bc_id);
		c("dt",t);
		c("hl", w.bc_language);
		c("oe", w.bc_encoding);
		c("lmt", w.bc_lmt);
		c("output", w.bc_output);
		f("url", w.bc_page_url);
		l("bg", w.bc_color_bg, t);
		l("text", w.bc_color_text, t);
		l("link", w.bc_color_link, t);
		l("url", w.bc_color_url, t);
		l("border", w.bc_color_border, t);
		l("line", w.bc_color_line, t);
		if(z(w,d)&&d.body)
		{
			var u=d.body.scrollHeight;
			var v=d.body.clientHeight;
			if(v&&u)
				f("cc",Math.round(v*100/u));
		}
		var s=w.screen;
		if (s)
		{
			c("u_h",s.height);
			c("u_w",s.width);
			c("u_ah",s.availHeight);
			c("u_aw",s.availWidth);
			c("u_cd",s.colorDepth);
		}
		c("u_tz",-g.getTimezoneOffset());
		c("u_his", history.length);
		c("u_java",navigator.javaEnabled());
		if(navigator.plugins)
			c("u_nplug", navigator.plugins.length);
		if(navigator.mimeTypes)
			c("u_nmime", navigator.mimeTypes.length);

		var u = w.bc_url;
		u=u.substring(0,1000);
		u=u.replace(/%\w?$/,"");
		d.write('<a name="bc_widget"></a>');
		if (w.bc_output=="html")
		{
			var q = "bc_frame_" + ++w.bc_cnt;
			if ( w.name != q )
			{
				d.write('<iframe name='+m(q)+' id='+m(q)+' width='+m(w.bc_width)+' height='+m(w.bc_height)+' frameborder='+m(w.bc_frameborder)+' src='+m(u)+' marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no">');
				d.write("</iframe>")
			}
		}
		else if (w.bc_output=="textlink")
		{
			d.write('<script language="Javascript1.1" src='+m(u)+"><\/script>");
		}

		w.bc_color_bg=n;
		w.bc_color_text=n;
		w.bc_color_link=n;
		w.bc_color_url=n;
		w.bc_color_border=n;
		w.bc_color_line=n;
		w.bc_encoding=n;
		w.bc_error_handler=n;
		w.bc_format=n;
		w.bc_id=n;
		w.bc_frameborder=n;
		w.bc_height=n;
		w.bc_language=n;
		w.bc_lmt=n;
		w.bc_output=n;
		w.bc_page_location=n;
		w.bc_page_url=n;
		w.bc_referrer_url=n;
		w.bc_url=n;
		w.bc_width=n;
	}

	function z(w,d){return w.top.location==d.location}
	function x(w,d)
	{
		if (z(w,d))
			return false;
		if (!w.bc_width || !w.bc_height)
			return true;
		var de = d.documentElement;
		var g = 1;
		var e = 1;
		if (w.innerHeight)
		{
			g=w.innerWidth;
			e=w.innerHeight;
		}
		else if ( de && de.clientHeight )
		{
			g=de.clientWidth;
			e=de.clientHeight;
		}
		else if (d.body)
		{
			g=d.body.clientWidth;
			e=d.body.clientHeight;
		}
		return (!(e>2*w.bc_height || g>2*w.bc_width ));
	}

	function errhandler(b,a,d)
	{
		doit();
		return true;
	}

	function setup()
	{
		var w=window;
		var d=document;
		var l=d.location;
		var g=d.referrer;
		var n=null;
		w.bc_error_handler=w.onerror;
		w.onerror=errhandler;
		if (w.bc_frameborder == n ) w.bc_frameborder = 0;
		if (w.bc_output == n ) w.bc_output = "html";
		if (w.bc_cnt == n ) w.bc_cnt = 0;
		if (w.bc_width == n  || w.bc_width < 152 ) w.bc_width = 152;

		if (w.bc_page_url == n) 
		{
			w.bc_page_url = g;
			if (!x(w,d))
			{
				w.bc_page_url=l;
				w.bc_lmt = Date.parse(d.lastModified)/1000;
				w.bc_referrer_url = g;
			}
		}
		else
		{
			w.bc_page_location = g;
			if (!x(w,d))
				w.bc_page_location = l;
		}
	}
	setup();
	doit();
}
)()
