﻿if (seo == null || typeof(seo) != "object") var seo = new Object();
seo = {
	ce:function(t){return document.createElement(t)},
	ac:function(p,c){p.appendChild(c)},
	ae:function(o,et,fn){if(o.addEventListener)o.addEventListener(et,fn,false);else if(o.attachEvent)o.attachEvent("on"+et,fn);},
	gte:function(e){if (window.event && window.event.srcElement) var r=window.event.srcElement;else if(e && e.target)r=e.target;if(!r)return null;if(r.nodeType == 3)r=r.parentNode; /*Saf 1.3*/ return r;},
	ct:function(s){return document.createTextNode(s)},
	gc:function(n){var a=document.getElementsByTagName('*'),m=[];for(var i=0,l=a.length;i<l;i++)if(a[i].className.search('(\\b)'+n+'(\\b)')>-1)m[m.length]=a[i];return m;}
}
if (seo.bl == null || typeof(seo.bl) != "object") seo.bl = new Object();
seo.bl = {
	init: function(){
		var URL=document.location.href, title = document.title;
		var blURL=encodeURIComponent(URL), blTitle=encodeURIComponent(title), blAnch='<a href="'+URL+'">'+title+'</a>';
		var de = 'http://del.icio.us/post?url='+blURL+'&title='+blTitle;
		var di = 'http://digg.com/submit?phase=2&url='+blURL;
		var ne = 'http://reddit.com/submit?url='+blURL+'&title='+blTitle;
		var bl = seo.gc('seo-bl');
		for (var i=0,l=bl.length;i < l;i++){
			var o = document.createDocumentFragment();
			
			seo.ac(o,seo.ct('Share: '));
			seo.ac(o,seo.bl.anch('de',de,'Add this link to the del.icio.us social bookmarking network',' Del.icio.us',function(){seo.bl.popup(de);return false;}));
			seo.ac(o,seo.ct(' | '));
			seo.ac(o,seo.bl.anch('di',di,'Post this to the Digg community','Digg',function(){seo.bl.popup(di);return false;}));
			seo.ac(o,seo.ct(' | '));
			seo.ac(o,seo.bl.anch('ne',ne,'Post this to the Reddit community','Reddit',function(){seo.bl.popup(ne);return false;}));
			


/*
seo.ac(o,seo.ct(' | '));
			seo.ac(o,seo.bl.anch('my','#','Click to display the code snippet to add this to your site',' My Site',seo.bl.mysite));
*/
			var p=seo.ce('p');
			seo.ac(p,seo.ct('Use the code snippet below to link back to this page:'));
			seo.ac(p,seo.ce('br'));
			var t=seo.ce('textarea');
			seo.ac(bl[i],o);
			t.readonly=true;
			seo.ae(t,'click',function(e){seo.gte(e).select()});
			t.value=blAnch;
			seo.ac(p,t);
			var c=seo.ce('i');
			seo.ac(c,seo.ct(blAnch));
			seo.ac(p,c);
			seo.ac(o,p);
		}
	},
	anch: function(c,h,t,s,f,p){
		var a=seo.ce('a');
		a.className=c;
		a.href=h;
		a.title=t;
		seo.ac(a,seo.ct(s));
		if (typeof f != 'undefined') a.onclick=f;
		return a;
	},
	popup: function(u){
		window.open(u,'blPopup','width=1000px,height=520px,status=0,location=0,resizable=1,scrollbars=1',0)
	},
	mysite: function(e){
		var a=seo.gte(e); 
		a.removeAttribute('href');
		var p=a.nextSibling;
		p.style.display='block';
		a.removeAttribute('onclick');
		seo.bl.size();
	},
	size: function(){
		var a = seo.gc('seo-bl');
		for (var i=0,l=a.length;i < l;i++){
			var text = a[i].getElementsByTagName('textarea')[0], code = a[i].getElementsByTagName('i')[0];
			text.style.height = code.offsetHeight+'px';
			text.style.width = code.offsetWidth+'px';
		}
	}
}
seo.ae(window,'load',seo.bl.init);



