

document.write("<style type='text/css'>");
document.write("/* wikio trigger button */");
document.write("a#wikio-popup-button{ position: relative; z-index: 2; text-indent:-9999px; background:url(http://www.wikio.com/shared/images/wikiothis/buttons/wikio_btn_abo-univ_rounded-open-blue_en.png) no-repeat 0 0; display:block; width:91px; height:22px; text-decoration:none;}");
    
document.write("/* wikio popup container */");  
document.write("#wikio-popup{ display: block; position: absolute; width:250px; border:1px solid #D3D5D8; position:absolute;  background:url(http://www.wikio.com/shared/images/wikiothis/popup/wikio-popup-bg.jpg) no-repeat 100% 100% white; /**/ left:10px; top:32px; z-index:99;}");
document.write("#wikio-popup *{ margin:0; border:0; padding:0; font:12px Arial; text-align:left;}");
document.write("#wikio-popup a{ color:#005AAC; text-decoration:none; }");
document.write("#wikio-popup span{ display:block; padding:5px; }");
document.write("#wikio-popup span.wikio-option{ font:bold 11px Arial; color:#7B7976; clear:both; }");

document.write("/* wikio popup header/footer */");
document.write("#wikio-popup span#wikio-head{ color:#FF9213; background:#EDEEF0 url(http://www.wikio.com/shared/images/wikiothis/popup/wikio-popup-head-bg.gif) repeat-x 0 0; display:block; }");
document.write("#wikio-popup span#wikio-footer{ clear:both; background:#EDEEF0 url(http://www.wikio.com/shared/images/wikiothis/popup/wikio.gif) no-repeat 100% 50%; display:block; font:normal 10px/14px Arial; color:#7B7976; text-align:right; padding:0; padding-right:40px; }");


document.write("/* wikio popup list of choices */");
document.write("#wikio-popup ul.wikio-choice{ list-style:none; padding-left:10px; float:left; padding-bottom:15px; }");
document.write("#wikio-popup ul.wikio-choice li{ display:block; width:110px; padding-right:10px; float:left; }");
document.write("#wikio-popup ul.wikio-choice li a{ display:block; line-height:22px; padding-left:20px; background-repeat:no-repeat; background-position:0 50%; }");
document.write("/* #wikio-popup ul.wikio-choice li a:hover{ background-color:#F5F5F5; } */");

document.write("/* wikio popup newsletter */");
document.write("#wikio-popup span.wikioalert {margin:5px;}");
document.write("#wikio-popup span.wikioalert input[type=button]{background:transparent url(http://www.wikio.com/shared/images/button_validate_bg.gif) repeat-x scroll 0 0;border:1px solid #FF3800;color:#FFFFFF;font-weight:bold;height:20px;text-decoration:none;}");
document.write("</style>");

// JavaScript Document
(function(){

	// document.wready
	var ie  = !!(window.attachEvent && !window.opera);
	var wk  = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
	var fn  = [];
	var run = function () { for (var i = 0; i < fn.length; i++) fn[i](); };
	var d   = document;
	d.wready = function (f) {
		if (!ie && !wk && d.addEventListener)
			return d.addEventListener('DOMContentLoaded', f, false);
		if (fn.push(f) > 1) return;
		if (ie)
			(function () {
				try { d.documentElement.doScroll('left'); run(); }
				catch (err) { setTimeout(arguments.callee, 0); }
			})();
		else if (wk)
			var t = setInterval(function () {
				if (/^(loaded|complete)$/.test(d.readyState))
					clearInterval(t), run();
			}, 0);
	};
	
	// addEventSimple
	function addEventSimple(obj,evt,fn) {
		if (obj.addEventListener)
			obj.addEventListener(evt,fn,false);
		else if (obj.attachEvent)
			obj.attachEvent('on'+evt,fn);
	}
	
	function removeEventSimple(obj,evt,fn) {
		if (obj.removeEventListener)
			obj.removeEventListener(evt,fn,false);
		else if (obj.detachEvent)
			obj.detachEvent('on'+evt,fn);
	}
	// findPos (thanks, PPK)
	function findPos( obj ) {
		var curleft = curtop = 0;
		if( obj.offsetParent ) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while( obj = obj.offsetParent );
		}
		return { left: curleft, top: curtop };
	}
	// windowSize (thanks, www.howtocreate.co.uk)
	function windowSize() {
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		return { width: myWidth, height: myHeight };
	}
	// scrollOffset (thanks, www.howtocreate.co.uk)
	function scrollOffset() {
		var scrOfX = 0, scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
		return { left: scrOfX, top: scrOfY };
	}
	
	function popupFactory( listRss, listGadget ) {
	
		// helper factory
		function listFactory( list ) {
			var t1, t2, t3;
			t1 = document.createElement( "ul" );
			t1.className = "wikio-choice";
			for( i = 0; i < list.length; i++ ) {
				t2 = document.createElement( "li" );
				t3 = document.createElement( "a" );
				t3.setAttribute( "href", list[i].href );
				t3.style.backgroundImage = "url(http://www.wikio.com/shared/images/wikiothis/popup/" + list[i].img + ")";
				t3.appendChild( document.createTextNode( list[i].title ) );
				t2.appendChild( t3 );
				t1.appendChild( t2 );
			}
			return t1;
		}
	
	
		var res, t1, i;
		res = document.createElement( "div" );
		res.id = "wikio-popup";
		t1 = document.createElement( "span" );
		t1.id = "wikio-head";
		t1.appendChild( document.createTextNode( "Subscribe and share" ) );
		res.appendChild( t1 );
		t1.className = "wikio-option";
		if( listRss.length > 0 ) {
			t1 = document.createElement( "span" );
			t1.appendChild( document.createTextNode( "Choose your regular RSS reader:" ) );
			res.appendChild( t1 );
			res.appendChild( listFactory( listRss ) );
		}
		if(listGadget.length > 0 ) {
			t1 = document.createElement( "span" );
			t1.appendChild( document.createTextNode( "No need for an RSS reader! You can subscribe directly on your Vista or Mac desktop:" ) );
			res.appendChild( t1 );
			res.appendChild( listFactory( listGadget ) );
		}	
		
		t1 = document.createElement( "span" );
		t1.className="wikioalert";
		wikioalertlink = document.createElement( "a" );
		wikioalertlink.setAttribute( "href", "http://alerts.wikio.com/subscribe.php?feed=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787&lang=en" );
		wikioalertbutton = document.createElement( "input" );
		wikioalertbutton.setAttribute("type","button");
		wikioalertbutton.setAttribute("value","Subscribe by e-mail");
		wikioalertlink.appendChild( wikioalertbutton );
		t1.appendChild( wikioalertlink );
		res.appendChild( t1 );
		
		t1 = document.createElement( "span" );
		t1.id = "wikio-footer";
		t1.setAttribute("onClick","javascript:location='http://www.wikio.com/tools/universalsubscription';");
		t1.style.cursor = "pointer";
		t1.appendChild( document.createTextNode( "Service powered by" ) );
		res.appendChild( t1 );
		res.style.visibility = "hidden";
		res.style.display = "none";
	
		return res;	
	}
	
	// animateShadow
	var shadow;
	function cancelShadow() {
		if( shadow.AP && shadow.AP.timer != null ) {
			clearInterval( shadow.AP.timer );
			shadow.AP.timer = null;
			shadow.style.display = "none";
		}
	}
	function animateShadow( r1, r2, cb ) {
		if( ! shadow ) {
			shadow = document.createElement( "div" );
			shadow.style.position = "absolute";
			shadow.style.display = "none";
			shadow.style.border = "solid 1px #a0a0a0";
			shadow.style.overflow = "hidden";
			shadow.style.padding = "0px";
			shadow.style.zIndex = 1;
			document.body.appendChild( shadow );
		} else
			cancelShadow();
		var s = 7,
			dw = Math.round( ( r2.width - r1.width ) / s ),
			dh = Math.round( ( r2.height - r1.height ) / s ),
			dl = Math.round( ( r2.left - r1.left ) / s ),
			dt = Math.round( ( r2.top - r1.top ) / s );
		shadow.style.left = r1.left + "px";
		shadow.style.top = r1.top + "px";
		shadow.style.width = r1.width + "px";
		shadow.style.height = r1.height + "px";
		shadow.style.display = "block";
		shadow.AP = { timer: null, rect: { left: r1.left, top: r1.top, width: r1.width, height: r1.height }, rect1: r1, rect2: r2, dw: dw, dh: dh, dl: dl, dt: dt };
		shadow.AP.timer = setInterval( function() {
			shadow.style.left = ( shadow.AP.rect.left += shadow.AP.dl ) + "px";
			shadow.style.top = ( shadow.AP.rect.top += shadow.AP.dt ) + "px";
			shadow.style.width = ( shadow.AP.rect.width += shadow.AP.dw ) + "px";
			shadow.style.height = ( shadow.AP.rect.height += shadow.AP.dh ) + "px";
			--s;
			if( s == 0 ) {
				cancelShadow();
				cb();
			}
		}, 30 );
	}
	
	var popup, button, shadow;
	
	document.wready( function() {
		
		popup = popupFactory( [

				{ title: "Wikio", href: "http://www.wikio.com/forward?from=subscribethispopup&go=wikio&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-wikio.gif" },				

				{ title: "Netvibes", href: "http://www.wikio.com/forward?from=subscribethispopup&go=netvibes&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-netvibes.gif" },				

				{ title: "Google", href: "http://www.wikio.com/forward?from=subscribethispopup&go=google&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-google.gif" },				

				{ title: "My Yahoo", href: "http://www.wikio.com/forward?from=subscribethispopup&go=yahoo&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-yahoo.gif" },				

				{ title: "Bloglines", href: "http://www.wikio.com/forward?from=subscribethispopup&go=bloglines&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-bloglines.gif" },				

				{ title: "My AOL", href: "http://www.wikio.com/forward?from=subscribethispopup&go=aol&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-aol.gif" },				

				{ title: "Newsgator", href: "http://www.wikio.com/forward?from=subscribethispopup&go=newsgator&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-newsgator.gif" },				

				{ title: "Windows Live", href: "http://www.wikio.com/forward?from=subscribethispopup&go=live&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-live.gif" },				

				{ title: "RSS", href: "http://www.wikio.com/forward?from=subscribethispopup&go=rss&url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-rss.gif" },				

				{ title: "More...", href: "http://www.wikio.com/subscribethis?url=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-more.gif" }
			], [

			{ title: "vista", href: "http://www.wikio.com/tools/widget?action=get&wtype=vista&wstyle=blogblue&wlocale=en_US&feed=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-vista.gif" }		

			,{ title: "macos", href: "http://www.wikio.com/tools/widget?action=get&wtype=macos&wstyle=blogblue&wlocale=en_US&feed=http%3A%2F%2Fcre.ations.net%2Frss%2Fcreator%2F787", img: "icon-macos.gif" }

			] );
		document.body.appendChild( popup );
		
		// popup show/hide
		button = document.getElementById( "wikio-popup-button" );
		if(button){
			button.innerHTML='';
			var f1 = function() {
				cancelShow();
				cancelHide();
				if( popup.style.visibility != "visible" && ! ( shadow && shadow.AP.timer != null ) )
					showTimer = setInterval( showPopup, 100 );
			}
			var f2 = function() {
				cancelShow();
				cancelHide();
				hideTimer = setInterval( hidePopup, 300 );
			}
			addEventSimple( button, "mouseover", f1 );
			addEventSimple( popup, "mouseover", f1 );
			addEventSimple( button, "mouseout", f2 );
			addEventSimple( popup, "mouseout", f2 );
		}
	} );
	
	var showTimer, hideTimer;
	
	function showPopup() {
		cancelShow();
		popup.style.display = "block";
		// position popup (to avoid leaking it off the screen)
		var pos = findPos( button );
		var wsize = windowSize();
		var pageoff = scrollOffset();
		wsize.width -= 20; wsize.height -= 20;  // scrollbars
		var bottom = pageoff.top + wsize.height;
		var right = pageoff.left + wsize.width;
		var top, left;
		if( pos.top + button.offsetHeight + popup.offsetHeight > bottom )
			if( pos.top - popup.offsetHeight < pageoff.top )
				top = pageoff.top;
			else
				top = pos.top - popup.offsetHeight;
		else
			top = pos.top + button.offsetHeight;
		if( pos.left + popup.offsetWidth > right )
			left = right - popup.offsetWidth;
		else
			left = pos.left;
		popup.style.left = left + "px";
		popup.style.top = top + "px";
		// show animation and then popup
		animateShadow( { left: pos.left, top: pos.top, width: button.offsetWidth, height: button.offsetHeight },
			{ left: left, top: top, width: popup.offsetWidth, height: popup.offsetHeight },
			function() {
				popup.style.visibility = "visible";
			} );
	}
	
	function hidePopup() {
		cancelHide();
		popup.style.visibility = "hidden";
		popup.style.display = "none";
	}
	
	function cancelShow() {
		if( showTimer != null ) {
			clearInterval( showTimer );
			showTimer = null;
		}
	}
	function cancelHide() {
		if( hideTimer != null ) {
			clearInterval( hideTimer );
			hideTimer = null;
		}
	}
	
	

})();
