function showSocial(){

    var tmpTop = $('fav').cumulativeOffset().top - 25;
    var tmpLeft = $('fav').cumulativeOffset().left;
    
    $('scbookmarkbox').setStyle({
        top: tmpTop + 'px',
        left: tmpLeft + 'px',
        display: 'static'
    });
    $('scbookmarkbox').show();
}

function hideSocial(){
    $('scbookmarkbox').hide();
}

function showAllSocial(){
    $('sbpage_2_col1').show();
    
    return false;
}




// Suche abfragen
/*
$('sbpage_find').observe('change', function() {
	
	var domElem = $('sbpage_cols_container').getElementsByClassName('sb_i');
	var textValue = $('sbpage_find').value;
	
	for (var x = 0; x < domElem.length; x++) {
		
		if (domElem[x]) {
			
			// Auslesen des aktuellen Dienstes
			var socialC = domElem[x].readAttribute('id').split("_")[1];
			
			// Suchen nach Eingabe
			var erg = socialC.search(textValue);
			if (erg >= 0){	
				domElem[x].setAttribute('style', "display:inline;");	
				console.log(domElem[x]);			
			} else {
				domElem[x].setAttribute('style', "display:none;");
				
			}
			
		}

	}
});*/

// Setzen der Links
Event.observe(window, 'load', function() {
	var domElem = Array();
    if ($('sbpage_cols_container')) {
        domElem = $('sbpage_cols_container').getElementsByClassName('sb_i');
    }
	
	var mostCol1 = new Array(
		["Facebook", "facebook", 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&amp;t='+encodeURIComponent(document.title), "facebook"], 
		["Delicious", "delicious", 'http://del.icio.us/post?v=2&amp;url='+encodeURIComponent(location.href)+'&amp;notes=&amp;tags=&amp;title='+encodeURIComponent(document.title), "delicious"], 
		["Google Bookmarks", "google_bookmarks",'http://www.google.com/bookmarks/mark?op=add&amp;hl=de&amp;bkmk='+encodeURIComponent(location.href)+'&amp;annotation=&amp;labels=&amp;title='+encodeURIComponent(document.title), "google"], 
		["MySpace", "myspace", 'http://www.myspace.com/Modules/PostTo/Pages/default.aspx?u='+encodeURIComponent(location.href)+'&aq=f&aqi=&aql=&oq=&gs_rfai=', "myspace"], ["Yahoo Buzz", "yahoo_buzz", "http://buzz.yahoo.com/", "buzz"], 
		["StumbleUpon", "stumbleupon", 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), "stumbleupon"], 
		["Bebo", "bebo", "http://www.bebo.com/", "bebo"], 
		["WordPress", "wordpress", "http://wordpress.com/", "wordpress"], 
		["Orkut", "orkut", "http://www.orkut.com/", "orkut"], 
		["Netvibes Share", "netvibes_share", "http://www.netvibes.com/", "netvibes"], 
		["Strands", "strands", "http://www.strands.com/", "strands"], 
		["DailyMe", "dailyme", "http://dailyme.com/", "dailyme"], 
		["TechNet", "technet", "http://social.technet.microsoft.com/", "technet"], 
		["Arto", "arto", "http://www.arto.com/", "arto"], 
		["SmakNews", "smaknews", "http://smaknews.com/", "smaknews"], 
		["AIM", "aim", "http://www.aim.com/", "aim"], 
		["Identi.ca", "identi_ca", "http://identi.ca/", "identica"], 
		["Blogger Post", "blogger_post", "http://www.blogger.com/", "blogger"], 
		["Box.net", "box_net", "https://www.box.net/", "box"], 
		["Netlog", "netlog", "http://www.netlog.com/", "netlog"], 
		["Shoutwire", "shoutwire", "http://www.shoutwire.com/", "shoutwire"], 
		["Jumptags", "jumptags", "http://www.jumptags.com/", "jumptags"], 
		["Hemidemi", "hemidemi", "http://www.hemidemi.com/", "hemidemi"], 
		["Instapaper", "instapaper", "http://www.instapaper.com/", "instapaper"], 
		["Xerpi", "xerpi", "http://www.xerpi.com/", "xerpi"], 
		["Wink", "wink", "http://www.wink.com/", "wink"], 
		["BibSonomy", "bibsonomy", "http://www.bibsonomy.org/", "bibsonomy"], 
		["BlogMarks", "blogmarks", "http://blogmarks.net/", "blogmarks"], ["StartAid", "startaid", "http://www.startaid.com/", "startaid"], ["Khabbr", "khabbr", "http://www.khabbr.com/", "khabbr"], ["Yoolink", "yoolink", "http://www.yoolink.fr/", "yoolink"], ["Technotizie", "technotizie", "http://www.technotizie.it/", "technotizie"], ["Multiply", "multiply", "http://multiply.com/", "multiply"], ["Plaxo Pulse", "plaxo_pulse", "http://pulse.plaxo.com/pulse/", "plaxo"], ["Squidoo", "squidoo", "http://www.squidoo.com/", "squidoo"], ["Blinklist", "blinklist", "http://www.blinklist.com/", "blinklist"], ["YiGG", "yigg", "http://www.yigg.de/", "yigg"], ["Segnalo", "segnalo", "http://segnalo.alice.it/", "segnalo"], ["YouMob", "youmob", "http://youmob.com/", "youmob"], ["Fark", "fark", "http://www.fark.com/", "fark"], ["Jamespot", "jamespot", "http://www.jamespot.com/", "jamespot"], ["Twiddla", "twiddla", "http://www.twiddla.com/", "twiddla"], ["MindBodyGreen", "mindbodygreen", "http://www.mindbodygreen.com/", "mindbodygreen"], ["Hugg", "hugg", "http://www.hugg.com/", "hugg"], ["NowPublic", "nowpublic", "http://www.nowpublic.com/", "nowpublic"], ["Tumblr", "tumblr", "http://www.tumblr.com/", "tumblr"], ["Current", "current", "http://current.com/", "current"], ["Spurl", "spurl", "http://www.spurl.net/", "spurl"], ["Oneview", "oneview", "http://www.oneview.de/", "oneview"], ["Simpy", "simpy", "http://www.simpy.com/", "simpy"], ["BuddyMarks", "buddymarks", "http://www.buddymarks.com/", "buddymarks"], ["Viadeo", "viadeo", "http://www.viadeo.com/", "viadeo"], ["Wists", "wists", "http://www.wists.com/", "wists"], ["Backflip", "backflip", "http://www.backflip.com/", "backflip"], ["SiteJot", "sitejot", "http://www.sitejot.com/", "sitejot"], ["DZone", "dzone", "http://www.dzone.com/", "dzone"], ["Hyves", "hyves", "http://www.hyves.nl/", "hyves"], ["Bitty Browser", "bitty_browser", "http://www.bitty.com/", "bitty"], ["Symbaloo Feeds", "symbaloo_feeds", "http://www.symbaloo.com/", "symbaloo"], ["Foxiewire", "foxiewire", "http://www.foxiewire.com/", "foxiewire"], ["VodPod", "vodpod", "http://vodpod.com/", "default"], ["Amazon Wish List", "amazon_wish_list", "http://www.amazon.com/", "amazon"], ["Read It Later", "read_it_later", "http://readitlaterlist.com/", "default"]);
	var mostCol2 = new Array(
		["Twitter", "twitter", 'http://www.twitter.com/home?status='+encodeURIComponent(location.href)+'', "twitter"], 
		["Digg", "digg", 'http://digg.com/submit?phase=2&amp;url='+encodeURIComponent(location.href)+'&amp;bodytext=&amp;tags=&amp;title='+encodeURIComponent(document.title), "digg"], 
		["Google Buzz", "google_buzz", "http://mail.google.com/mail/", "google_buzz"], 
		["Reddit", "reddit", 'http://reddit.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title), "reddit"], 
		["Windows Live Favorites", "windows_live_favorites", 'http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1276264102&rver=5.5.4177.0&wp=MBI&wreply=https://skydrive.live.com/sharefavorite.aspx/.SharedFavorites?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&jump=1&lc=1031&id=250206&cbcxt=sky', "live"], 
		["Yahoo Bookmarks", "yahoo_bookmarks", 'http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&amp;d=&amp;tag=&amp;u='+encodeURIComponent(location.href), "yahoo"], 
		["Mister-Wong",'mister_wong', 'http://www.mister-wong.de/index.php?action=addurl&amp;bm_url='+encodeURIComponent(location.href)+'&amp;bm_notice=&amp;bm_description='+encodeURIComponent(document.title)+'&amp;bm_tags=', "mister-wong"], 
		["Google Reader", "google_reader", "http://www.google.com/reader/", "reader"], ["Evernote", "evernote", "http://www.evernote.com/", "evernote"], ["Stumpedia", "stumpedia", "http://www.stumpedia.com/", "stumpedia"], 
		["Posterous", "posterous", "http://posterous.com", "posterous"], 
		["MSDN", "msdn", "http://social.msdn.microsoft.com/", "msdn"], 
		["Expression", "expression", "http://social.expression.microsoft.com/", "expression"], 
		["Tipd", "tipd", "http://tipd.com/", "tipd"], 
		["Plurk", "plurk", "http://www.plurk.com/", "plurk"], ["Yahoo Messenger", "yahoo_messenger", "http://messenger.yahoo.com/", "yim"], ["Mozillaca", "mozillaca", "http://www.mozillaca.com/", "mozillaca"], 
		["TypePad Post", "typepad_post", "http://www.typepad.com/", "typepad"], ["Mixx", "mixx", "http://mixx.com/", "mixx"], 
		["Technorati Favorites", "technorati_favorites", 'http://technorati.com/faves?add='+encodeURIComponent(location.href)+'&amp;tag=', "technorati"], 
		["CiteULike", "citeulike", "http://www.citeulike.org/", "citeulike"], 
		["Windows Live Spaces", "windows_live_spaces", "http://spaces.live.com/", "spaces"], 
		["FunP", "funp", "http://funp.com/", "funp"], 
		["PhoneFavs", "phonefavs", "http://phonefavs.com/", "phonefavs"], 
		["Netvouz", "netvouz", "http://www.netvouz.com/", "netvouz"], 
		["Diigo", "diigo", "http://www.diigo.com/", "diigo"], 
		["Taggly", "taggly", "http://www.taggly.com/", "taggly"], 
		["Tailrank", "tailrank", "http://www.tailrank.com/", "tailrank"], 
		["Kledy", "kledy", "http://www.kledy.de/", "kledy"], 
		["Meneame", "meneame", "http://meneame.net/", "meneame"], 
		["Bookmarks.fr", "bookmarks_fr", "http://www.bookmarks.fr/", "bookmarks_fr"], 
		["NewsVine", "newsvine", "http://www.newsvine.com/", "newsvine"], 
		["FriendFeed", "friendfeed", "http://friendfeed.com/", "friendfeed"], 
		["Ping", "ping", "http://ping.fm/", "ping"], 
		["Protopage Bookmarks", "protopage_bookmarks", "http://www.protopage.com/", "protopage"], 
		["Faves", "faves", "http://faves.com/", "faves"], ["Webnews", "webnews", "http://www.webnews.de/", "webnews"], ["Pusha", "pusha", "http://www.pusha.se/", "pusha"], ["Slashdot", "slashdot", "http://slashdot.org/", "slashdot"], ["Allvoices", "allvoices", "http://www.allvoices.com/", "allvoices"], ["Imera Brazil", "imera_brazil", "http://imera.com.br/", "imera"], ["LinkaGoGo", "linkagogo", "http://www.linkagogo.com/", "linkagogo"], ["unalog", "unalog", "http://unalog.com/", "unalog"], ["Diglog", "diglog", "http://www.diglog.com/", "diglog"], ["Propeller", "propeller", "http://www.propeller.com/", "propeller"], ["LiveJournal", "livejournal", "http://www.livejournal.com/", "livejournal"], ["HelloTxt", "hellotxt", "http://hellotxt.com", "hellotxt"], ["Yample", "yample", "http://yample.com/", "yample"], ["Linkatopia", "linkatopia", "http://www.linkatopia.com/", "linkatopia"], ["LinkedIn", "linkedin", "http://www.linkedin.com/", "linkedin"], ["Ask.com MyStuff", "ask_com_mystuff", "http://mystuff.ask.com/", "ask"], ["Maple", "maple", "http://www.maple.nu/", "maple"], ["Connotea", "connotea", "http://www.connotea.org/", "connotea"], ["MyLinkVault", "mylinkvault", "http://www.mylinkvault.com/", "mylinkvault"], ["Sphinn", "sphinn", "http://sphinn.com/", "sphinn"], ["Care2 News", "care2_news", "http://www.care2.com/news/", "care2"], ["Sphere", "sphere", "http://www.sphere.com/", "sphere"], ["Gabbr", "gabbr", "http://www.gabbr.com/", "gabbr"], ["Tagza", "tagza", "http://www.tagza.com/", "tagza"], ["Folkd", "folkd", "http://www.folkd.com/", "folkd"], ["NewsTrust", "newstrust", "http://newstrust.net/", "newstrust"], ["PrintFriendly", "printfriendly", "http://www.printfriendly.com", "printfriendly"]);

	var linkurl = document.URL;
	var linkname = document.getElementsByTagName("title")[0].innerHTML;

	for (var x = 0; x < domElem.length; x++) {
		
		if (domElem[x]) {

			// Auslesen des aktuellen Dienstes
			var subStart = domElem[x].readAttribute('id').indexOf('_');
			var socialC = domElem[x].readAttribute('id').substr(subStart+1, domElem[x].readAttribute('id').length);
			
			for (var y = 0; y < mostCol1.length; y++) {
				if (mostCol1) {
					if (socialC == mostCol1[y][1]){										
						var sbHref = mostCol1[y][2];						
					}
				}
			}
			
			for (var y = 0; y < mostCol2.length; y++) {
				if (mostCol2) {
					if (socialC == mostCol2[y][1]){											
						var sbHref = mostCol2[y][2];						
					}
				}
			}			
			domElem[x].setAttribute('href', sbHref);
		}

	}
});

