


// singleton
if( ! document.wikioPopupButton ) {
	(function(){

        var ext = { buttons: {}, popups: {} };

        document.write("<style type='text/css'>");
        /* wikio trigger button */
        document.write("a.wikio-popup-button, 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;}");

        /* 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; }");

        /* 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; }");


        /* 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; } */");

        /* 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>");
        // document.ready
        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;

        ext.ready = 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, function() { fn.call( obj, window.event ) } );
        }

        function removeEventSimple(obj,evt,fn) {
        	if (obj.removeEventListener)
        		obj.removeEventListener(evt,fn,false);
        	else if (obj.detachEvent)
        		obj.detachEvent('on'+evt,fn);
        }

        ext.addEventSimple = addEventSimple;
        ext.removeEventSimple = removeEventSimple;

        // 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 };
        }

        ext.findPos = findPos;
        // 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 };
        }

        ext.windowSize = windowSize;
        // 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 };
        }

        ext.scrollOffset = scrollOffset;
        // 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 );
        }

        ext.cancelShadow = cancelShadow;
        ext.animateShadow = animateShadow;
        function showPopup( t ) {
            var b = ext.buttons[t.key];
        	cancelShow( t );
        	t.style.display = "block";
        	// position popup (to avoid leaking it off the screen)
        	var pos = findPos( b );
        	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 + b.offsetHeight + t.offsetHeight > bottom )
        		if( pos.top - t.offsetHeight < pageoff.top )
        			top = pageoff.top;
        		else
        			top = pos.top - t.offsetHeight;
        	else
        		top = pos.top + b.offsetHeight;
        	if( pos.left + t.offsetWidth > right )
        		left = right - t.offsetWidth;
        	else
        		left = pos.left;
        	t.style.left = left + "px";
        	t.style.top = top + "px";
        	// show animation and then popup
        	animateShadow( { left: pos.left, top: pos.top, width: b.offsetWidth, height: b.offsetHeight },
        		{ left: left, top: top, width: t.offsetWidth, height: t.offsetHeight },
        		function() {
        			t.style.visibility = "visible";
        		} );
        }

        function hidePopup( t ) {
        	cancelHide( t );
        	t.style.visibility = "hidden";
        	t.style.display = "none";
        }

        function cancelShow( t ) {
        	if( t.showTimer != null ) {
        		clearInterval( t.showTimer );
        		t.showTimer = null;
        	}
        }
        function cancelHide( t ) {
        	if( t.hideTimer != null ) {
        		clearInterval( t.hideTimer );
        		t.hideTimer = null;
        	}
        }

        var f1 = function( e ) {
            var t = ext.popups[this.key ? this.key : this.href];
            cancelShow( t );
            cancelHide( t );
            if( t.style.visibility != "visible" && ! ( shadow && shadow.AP.timer != null ) )
                t.showTimer = setInterval( function(){showPopup(t);}, 140 );  //open popup delay
        }

        var f2 = function( e ) {
            var el = e ? this : window.event.srcElement;
            var t = ext.popups[el.key ? el.key : el.href];
            cancelShow( t );
            cancelHide( t );
            t.hideTimer = setInterval( function(){hidePopup(t);}, 300 );  //hide popup delay
        }
        function pushPopup( key, a0, a1 ) {
            ext.popups[key] = document.wikioPopupButton.popupFactory( key, a0, a1 );
        }

        ext.pushPopup = pushPopup;
        function popupFactory( key, 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, foot;
        	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%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss&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.appendChild( document.createTextNode( "Service powered by" ) );
        	foot=document.createElement( "a" );
        	foot.href= "http://www.wikio.com/tools/universalsubscription";
        	foot.appendChild( t1 ); 	
        	res.appendChild( foot );
        	res.style.visibility = "hidden";
        	res.style.display = "none";

            // res.showPopup = showPopup;
            // res.hidePopup = hidePopup;
            // res.cancelShow = cancelShow;
            // res.cancelHide = cancelHide;
            res.showTimer = null;
            res.hideTimer = null;
            res.key = key;
            res.f1 = f1;
            res.f2 = f2;

        	return res;	
        }

        ext.popupFactory = popupFactory;

        document.wikioPopupButton = ext;
        var shadow;

        document.wikioPopupButton.ready( function() {
            var popup,
                ext = document.wikioPopupButton,
                lnk, i, b;

            var ls = [];
            for( i = 0; i < document.links.length; i++ )
                ls.push( document.links[i] );
            for( i = 0; i < ls.length; i++ ) {
                lnk = ls[i];
                if( lnk.href && ( lnk.id == "wikio-popup-button" || lnk.className == "wikio-popup-button" ) ) {
                    popup = ext.popups[lnk.href];
                    b = ext.buttons[lnk.href] = lnk;
                    if( !popup ) {
                    	//alert( "error!\n" + lnk.href );
                    }
                    else {
                        document.body.appendChild( popup );
                        addEventSimple( b, "mouseover", popup.f1 );
                        addEventSimple( popup, "mouseover", popup.f1 );
                        addEventSimple( b, "mouseout", popup.f2 );
                        addEventSimple( popup, "mouseout", popup.f2 );

                    }
                }
            }
        } );





	})();
}

// feed URL dependant information
document.wikioPopupButton.pushPopup( "http://www.wikio.com/subscribethis?url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss",
	[

				{ title: "Wikio", href: "http://www.wikio.com/forward?from=subscribethispopup&go=wikio&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-wikio.gif" },				

				{ title: "Netvibes", href: "http://www.wikio.com/forward?from=subscribethispopup&go=netvibes&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-netvibes.gif" },				

				{ title: "Google", href: "http://www.wikio.com/forward?from=subscribethispopup&go=google&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-google.gif" },				

				{ title: "My Yahoo", href: "http://www.wikio.com/forward?from=subscribethispopup&go=yahoo&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-yahoo.gif" },				

				{ title: "Bloglines", href: "http://www.wikio.com/forward?from=subscribethispopup&go=bloglines&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-bloglines.gif" },				

				{ title: "RSS", href: "http://www.wikio.com/forward?from=subscribethispopup&go=rss&url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-rss.gif" },				

				{ title: "More...", href: "http://www.wikio.com/subscribethis?url=http%3A%2F%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", 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%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", 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%2Frss.wikio.com%2Fsearch%2FHector%2BLavoe.rss", img: "icon-macos.gif" }

    ] );

