if (!SHARETHIS) {

/*
 *    Sharelet
 *
 *    The thing being shared. There can be zero or more sharelets per page.
 *    Share buttons can optionally be created here requiring the DOM parent
 *    to exist.
 */

function SHARETHIS_merge(){
	var mix = {};
	for (var i = 0, l = arguments.length; i < l; i++){
		var object = arguments[i];
		if (typeof(object) != 'object') continue;
		for (var key in object){
			var op = object[key], mp = mix[key];
			mix[key] = (mp && typeof(op) == 'object' && typeof(mp) == 'object') ? SHARETHIS_merge(mp, op) : SHARETHIS_unlink(op);
		}
	}
	return mix;
};


function SHARETHIS_unlink(object){
	var SHARETHIS_unlinked;	
	switch (typeof(object)){
		case 'object':
			SHARETHIS_unlinked = {};
			for (var p in object) SHARETHIS_unlinked[p] = SHARETHIS_unlink(object[p]);
		break;
		case 'hash':
			SHARETHIS_unlinked = SHARETHIS_unlink(object.getClean());
		break;
		case 'array':
			SHARETHIS_unlinked = [];
			for (var i = 0, l = object.length; i < l; i++) SHARETHIS_unlinked[i] = SHARETHIS_unlink(object[i]);
		break;
		default: return object;
	}
	return SHARETHIS_unlinked;
};


var Sharelet = {
    node:   null,    // DOM parent node.
    button: null,
    properties: {
        type:       '',
        title:      document.title,
        summary:    '',
        content:    '',
        url:        document.URL,
        icon:       '',
        category:   '',
        updated:    document.lastModified,
        published:  '',
        author:     ''
    },
    options: {
        button: true,
        buttonText: 'ShareThis'
    },
    initialize: function(options){
        this.options = SHARETHIS_merge(this.options, options);
    },
    bind: function(node){
        if (this.node !== null && this.node !== node) {
            try {this.node.removeChild(this.button)} catch(err){
                
            }
        }
        if (this.options.button == true) {
            try{node.appendChild(this.button)} catch(err){
               
            }
        }
        this.node = node;
    }
}

/*
 *    ShareThisWidget
 *
 *    Handles creation of the widget, positioning and visibility.
 */
var ShareThisWidget = {
    visible:    0,
    wrapper:    null,
    iframe:     null,
    close:      null,
    sharelet:   null,
    left:       0,
    top:        0,
    hiddenEmbeds: false,
    loaderHTML: '<html><head><style>body{background:#eee url(http://w.sharethis.com/widget/1.15/load.gif) center center no-repeat;color:#bbb;font:bold 18px Arial,Helvetica,sans-serif;padding:50px 20px;text-align:center;}</style></head><body>Getting ready to share!</body></html>',
    initialize: function(options){
        this.options = options;
        var d = document.createElement('div');
        d.className = 'stwrapper';
        d.style.visibility = 'hidden';
        this.wrapper = d;
        
        try {
            var f = document.createElement('<iframe name="stframe" allowTransparency="true" style="body{background:transparent;}"></iframe>');
        } catch(err) {
            var f = document.createElement('iframe');
            f.allowTransparency="true";
            f.setAttribute("allowTransparency", "true");
        }
        f.id = 'stframe';
        f.className = 'stframe';
        f.name = 'stframe';
        f.frameBorder = '0';
        f.scrolling = 'no';
        f.width = '354px';
        f.height = '437px';
        d.appendChild(f);
        this.iframe = f;

        var a = document.createElement('a');
        a.href = '#';
        a.title = 'close';
        a.className = 'stclose';
        a.onclick = this.hide;
        a.style.color = '#fff';
        var t = document.createTextNode('X');
        a.appendChild(t);
        d.appendChild(a);
        this.close = a;
    },
    show: function(opts){
        SHARETHIS.widget.visible = 1;
        SHARETHIS.widget.wrapper.style.left = this.left+'px';
        SHARETHIS.widget.wrapper.style.top = this.top+'px';
        if (SHARETHIS.widget.wrapper.parentNode == null
            || typeof(SHARETHIS.widget.wrapper.parentNode.tagName) == 'undefined'){
            document.body.appendChild(SHARETHIS.widget.wrapper);
        }
        SHARETHIS.widget.wrapper.style.visibility = 'visible';
        if (opts && Boolean(opts.embeds) != true) {
            SHARETHIS.widget.hiddenEmbeds = true;
            SHARETHIS.widget.hideEmbeds();
        }
        return false;
    },
    hide: function(opts){
        SHARETHIS.widget.visible = 0;
        SHARETHIS.widget.wrapper.style.visibility = 'hidden';
        if (Boolean(SHARETHIS.widget.hiddenEmbeds) == true || (opts && Boolean(opts.embeds) != true)) {
            SHARETHIS.widget.hiddenEmbeds = false;
            SHARETHIS.widget.showEmbeds();
        }
        return false;
    },
    hideEmbeds: function() {
        var embeds = document.getElementsByTagName('embed');
        for (var i=0; i< embeds.length; i++) {
            embeds[i].style.visibility = "hidden";
        }
    },
    showEmbeds: function() {
        var embeds = document.getElementsByTagName('embed');
        for (var i=0; i< embeds.length; i++) {
            embeds[i].style.visibility = "visible";
        }
    },
    loading: function(){
        var w = parent.frames['stframe'];
        try {
        w.window.document.open();
        w.window.document.clear();
        w.window.document.write(this.loaderHTML);
        w.window.document.close();
        } catch(err) {}
    }
}

/*
 *    ShareThis
 *
 *    This global object implements the ShareThis API and binding sharelets and the widget
 *    together.
 */
var ShareThis = {
    version:    '1.22',
    ready:      false,
    readyList:  [],
    toolbar:    false,
    counter:    0,
    widget:     null,
    sharelets:  [],
    page:       {},
    query:      {},
	lastUrl:     'blank',
	logFlag:		true,
    meta: {
        publisher : '',
        hostname  : location.host,
        location  : location.pathname
    },
    initialize: function(options){
        var options = options || {};
        this.options = options;
        if (options.publisher) {
            this.meta.publisher = options.publisher;
        }
		this.page=Sharelet;
        this.page.initialize(SHARETHIS_merge(options,{button:false}));
		this.widget=ShareThisWidget;
        this.widget.initialize();
        if (options.headerbg) {
            var l = this.luminescence(options.headerbg);
            this.widget.close.style.color = l > 0.5 ? '#000' : '#fff';
        }
        var css = 'http://w.sharethis.com/widget/' + this.version + '/sharethis.css';
        this.load('link', {
            href : (this.options.css ? this.options.css : css),
            rel  : 'stylesheet',
            type : 'text/css'
        });
        if (typeof(window.addEventListener) != 'undefined') {
            window.addEventListener("load", this.onReady, false);
        } else if (typeof(document.addEventListener) != 'undefined') {
            document.addEventListener("load", this.onReady, false);
        } else if (typeof window.attachEvent != 'undefined') {
            window.attachEvent("onload", this.onReady);
        }
    },
    selection: function(){
        if (window.getSelection) {
            this.page.properties.selection = window.getSelection();
        } else if (document.getSelection) {
            this.page.properties.selection = document.getSelection();
        } else if (document.selection && document.selection.createRange) {
            this.page.properties.selection = document.selection.createRange().text;
        }
    },
    luminescence: function(color) {
        var rgb = {};
        if (color.length == 7) {
  	    rgb = [parseInt('0x' + color.substring(1, 3)) / 255,
  	           parseInt('0x' + color.substring(3, 5)) / 255,
  		   parseInt('0x' + color.substring(5, 7)) / 255];
        } else if (color.length == 4) {
  	    rgb =  [parseInt('0x' + color.substring(1, 2)) / 15,
  		    parseInt('0x' + color.substring(2, 3)) / 15,
  		    parseInt('0x' + color.substring(3, 4)) / 15];
        }
        var r = rgb[0], g = rgb[1], b = rgb[2];
        var min = Math.min(r, Math.min(g, b));
        var max = Math.max(r, Math.max(g, b));
        return (min + max) / 2;
    },
    defer: function(f) {
        if (this.ready) {
            f.apply(document, [SHARETHIS]);
        } else {
            this.readyList.push( function() { return f.apply(this, [SHARETHIS]) } );
            //this.readyList.push(f);
        }
    },
    onReady: function() {
        SHARETHIS.ready = true;
        for (var i = 0; i < SHARETHIS.readyList.length; ++i)
            SHARETHIS.readyList[i].apply(document, [SHARETHIS]);

    },
    load: function(t, opts) {
        var e = document.createElement(t);
        for (var i in opts) {
            e.setAttribute(i, opts[i]);
        }
        try {
            document.getElementsByTagName('head')[0].appendChild(e);
        } catch (err) {
            document.body.appendChild(e);
        }
    },
    pageSize: function() {
        var pScroll = [0,0];
        if (typeof(window.pageYOffset) == 'number') {
            //Netscape compliant
            pScroll = [window.pageXOffset, window.pageYOffset];
        } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            //DOM compliant
            pScroll = [document.body.scrollLeft, document.body.scrollTop];
        } else if (document.documentElement
          && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            //IE6 standards compliant mode
            pScroll = [document.documentElement.scrollLeft,
                       document.documentElement.scrollTop];
        }
        return pScroll;
    },
    addEntry: function(properties, options){
        var options = options || {};
	try{properties.url=properties.url.toString();}
	catch(err){
		//noop
	}
        if (typeof(options.button) == "undefined") {
            options.button = true;
        }
        if (typeof(options.bind) == "undefined") {
            options.bind = true;
        }
		var s=Sharelet;
        s.initialize(SHARETHIS_merge(this.options, options));
        s.properties = SHARETHIS_merge(s.properties, properties);
        s.idx = this.sharelets.push(s) - 1;
        s.sharethis = this;
        s.widget = this.widget;
		
		if(s.properties.url!==this.lastUrl){
			this.lastUrl=s.properties.url;
		}
		else{
			this.logFlag=false;
		}

        s.popup = function(e){
             if (s.options.onclick) {
                  var res = s.options.onclick.apply(document, [s]);
                  if (res == false) {
                      return false;
                  }
             }
             SHARETHIS.selection();
			var query_str=[];

			for (var j in SHARETHIS.meta) {
				var tmp="meta_"+j+"="+encodeURIComponent(encodeURIComponent(SHARETHIS.meta[j]));
				if(SHARETHIS.meta[j]!==""){
					query_str.push(tmp);
				}
			}
			for (var j in SHARETHIS.page.properties) {
				var tmp="page_"+j+"="+encodeURIComponent(encodeURIComponent(SHARETHIS.page.properties[j]));
				if( (j==="url" || j==="title" || j==="summary") ){
					if(SHARETHIS.page.properties[j]!==""){
						query_str.push(tmp);
					}
				}
			}
			var olist=[s];
			for (var i=0; i < olist.length; i++) {
				obj = olist[i];
				for (var j in obj.properties) {
					var tmp=j+"[]="+encodeURIComponent(encodeURIComponent(obj.properties[j]));
					if(obj.properties[j]!==""){
						query_str.push(tmp);
					}
				}
				for (var j in obj.options) {
					var tmp="opts_"+j+"="+encodeURIComponent(encodeURIComponent(obj.options[j]));
					if(obj.options[j]!==""){
						query_str.push(tmp);
					}
				}
			}
			for (var j in SHARETHIS.query) {
				var tmp="query_"+j+"="+encodeURIComponent(encodeURIComponent(SHARETHIS.query[j]));
				/*if(j==="tabs" || j==="services" || j==="ireg" || j==="reg" || j==){
					query_str.push(tmp)//lightbox only uses: tabs, services, ireg, reg but sending everything
				}*/
				query_str.push(tmp)//lightbox only uses: tabs, services, ireg, reg but sending everything
			}
			var qry_str=query_str.join('&');
		//	qry_str=qry_str.replace(/%3B/,'');
		//	console.log(qry_str);
			var p = window.open("http://sharethis.com/share/lightbox.php?"+qry_str, "stframe","status=1,toolbar=0,width=354,height=437");
             s.widget.popup = p;
             return false;
        };
        s.attachButton = function(a){
            a.onclick = (Boolean(s.options.popup) == true ? s.popup : s.onClick);
        };
        s.onClick = function(e){
            if (s.options.onclick) {
                 var res = s.options.onclick.apply(document, [s]);
                 if (res == false) {
                     return false;
                 }
            }
            findPos = function(obj) {
                var obj = obj || {};
                if (obj.parentNode && obj.parentNode.className.indexOf('stbutton') != -1) {
                    obj = obj.parentNode;
                }
                var pScroll = SHARETHIS.pageSize();
                var pos = pScroll;
                var widgetWidth = 354;
                if (obj.offsetParent) {
                    odims = {offsetLeft:obj.offsetLeft, scrollWidth:obj.scrollWidth};
                    pos = [obj.offsetLeft+obj.scrollWidth,obj.offsetTop+obj.scrollHeight];
                    while (obj = obj.offsetParent) {
                        pos[0] += obj.offsetLeft;
                        pos[1] += obj.offsetTop;
                    }
                    if (s.options.offsetLeft) {
                        pos[0] += parseInt(s.options.offsetLeft);
                    }
                    if (s.options.offsetTop) {
                        pos[1] += parseInt(s.options.offsetTop);
                    }
                    if (!s.options.offsetLeft && !s.options.offsetTop) {
                        pos[0] -= odims.scrollWidth;
                        if (pos[0] + widgetWidth > document.body.scrollWidth) {
                            pos[0] -= widgetWidth - odims.scrollWidth;
                        }
                    }
                }
                return pos;
            };
            if (!e) var e = window.event;
            var el = e.target || e.srcElement;
            var coords = findPos(el);
            s.widget.left = coords[0];
            s.widget.top = coords[1];
            
            if (s.widget.visible) {
                if (s == s.widget.sharelet) {
                    s.widget.hide(s.options);
                } else {
                    s.widget.loading();
                    s.share();
                }
            } else {
                if (s == s.widget.sharelet) {
                    s.widget.show(s.options);
                } else {
                    s.widget.show(s.options);
                    s.widget.loading();
                    s.share();
                }
            }
            return false;
        };
        s.share = function(){
            return s.sharethis.share(s);
        };
        if (typeof(s.options.button) == "undefined" || Boolean(s.options.button) != false) {
            var a = document.createElement("a");
            a.className = 'stbutton stico_' + (s.options.style ? s.options.style : (SHARETHIS.options.style ? SHARETHIS.options.style : 'default'));
            a.title = "ShareThis via email, AIM, social bookmarking and networking sites, etc.";
            a.href = "#";
            a.onclick = (Boolean(s.options.popup) == true ? s.popup : s.onClick);
            var t = document.createElement("span");
            t.className = 'stbuttontext';
            t.appendChild(document.createTextNode(s.options.buttonText));
            a.appendChild(t);
            s.button = a;
            if (typeof(s.options.bind) == "undefined" || Boolean(s.options.bind) != false) {
                var id = 'sharethis_' + s.idx;
                document.write('<span id="' + id + '"></span>');
                var x = document.getElementById(id);
                if (x) {
                    x.appendChild(a);
                }
            }
        }
        if(this.logFlag){this.defer(function(){SHARETHIS.log('view', s)});}
        return s;
    },
    share: function(sharelet){
        this.selection();
        this.widget.sharelet = sharelet;
        this.widget.show(sharelet.options);
        var f = SHARETHIS.form([sharelet]);
        document.body.appendChild(f);
        f.submit();
    },
    form: function(olist) {
		field = function(k, v, brackets) {
            var f   = document.createElement("input");
            f.type  = "hidden";
            f.name  = (brackets == true ? k + "[]" : k);
            f.value = v;
            return f;
        }
        normalize = function(s){
            if (s == null) {
                return '';
            }
            return encodeURIComponent(s);
        }

        var f    = document.createElement("form");
        //f.className  = "stform";
        f.method = "post";
        f.action = "http://sharethis.com/share/lightbox.php";
        f.target = "stframe";
        for (var j in this.meta) {
            f.appendChild(field("meta_" + j, normalize(this.meta[j])));
        }
        for (var j in this.page.properties) {
            f.appendChild(field("page_" + j, normalize(this.page.properties[j])));
        }
        for (var j in this.query) {
            f.appendChild(field("query_" + j, normalize(this.query[j])));
        }
        for (var i=0; i < olist.length; i++) {
            obj = olist[i];
            for (var j in obj.properties) {
                f.appendChild(field(j, normalize(obj.properties[j]), true));
            }
            for (var j in obj.options) {
                f.appendChild(field("opts_"+j, normalize(obj.options[j]), false));
            }
        }
        return f;
    },
    log: function(event, obj) {
        var url = "http://r.sharethis.com/log?event=" + event
            + "&publisher=" + encodeURIComponent(SHARETHIS.meta.publisher)
            + "&hostname=" + encodeURIComponent(SHARETHIS.meta.hostname)
            + "&location=" + encodeURIComponent(SHARETHIS.meta.location)
            + "&url=" + encodeURIComponent(obj.properties.url)
            + "&ts" + (new Date()).getTime() + "." + SHARETHIS.counter++;

        var logger = new Image(1,1);
        logger.src = url;
        logger.onload = function(){return;};
    }
}

var _query = [];
_query.tabs = 'web,post,email';
_query.charset = 'utf-8';
_query.services = 'reddit,digg,facebook,myspace,delicious,stumbleupon,technorati,propeller,newsvine,blinklist,furl,mixx,current,google_bmarks,windows_live,yahoo_myweb';
_query.style = 'default';
_query.publisher = 'd17e3f55-ddc0-4679-9229-f11416ab3108';
var SHARETHIS=ShareThis;
SHARETHIS.initialize(_query);
SHARETHIS.log('pview', SHARETHIS.page);
SHARETHIS.query = _query;
var st = SHARETHIS;

} // end if !SHARETHIS

// Don't run if called from HEAD, or if toolbar has been run
var _slist = document.getElementsByTagName('script');
var _s = _slist[_slist.length - 1];
if (_s && _s.parentNode.tagName != "HEAD" && typeof(_sttoolbar) == "undefined") {
    var obj = SHARETHIS.addEntry(null,SHARETHIS_merge(_query,{bind:false}));
    var id = 'sharethis_' + obj.idx;
    document.write('<span id="' + id + '"></span>');
    var x = document.getElementById(id);
    obj.bind(x);
}
