﻿var u=location.href;
u=u.toLowerCase();
u=u.replace("uvtc.com/sweden", "universal.se");

var t=document.title;
var d="";

function checkMeta() {

    var metas = document.getElementsByTagName('meta');
    var i;
    var desc=d;
    for (i = 0; i < metas.length; i++) {
        if (metas[i].getAttribute('name')== "description"){
           var desc = metas[i].getAttribute('content');
           var desc =metas[i].getAttribute('content');
        }  
    }
    return(desc);
}

var descPage=checkMeta();


// default behavior to show/hide menu
function showBookmarklets() {
     new Effect.Appear("shareThis", {from: 0.0, to: 1.0, duration: 0.1, delay: 0.1, fps: 30});
}

function closeBookmarklets() {
    new Effect.Fade("shareThis", {from: 1.0, to: 0.0, duration: 0.1, delay: 0.1, fps: 30});
}

// secondary share menus- for ad hoc placement
function showBookmarklets2() {
     new Effect.Appear("shareThis2", {from: 0.0, to: 1.0, duration: 0.1, delay: 0.1, fps: 30});
}

function closeBookmarklets2() {
    new Effect.Fade("shareThis2", {from: 1.0, to: 0.0, duration: 0.1, delay: 0.1, fps: 30});
}

// specific network functions

function fbs_click() {
    pageTracker._trackEvent('Share', 'facebook',u);
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
}

function reddit() {
    window.open('http://reddit.com/submit?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=700,height=600');
}

function GetThis() {
    
    window.open('http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(t) + '&u=' + encodeURIComponent(u),'sharer','toolbar=0,status=0,width=700,height=600');
}

function delicious() {
    pageTracker._trackEvent('Share', 'delcious',u);
    window.open('http://del.icio.us/post?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=800,height=600');
}

function furl() {
	    window.open('http://www.furl.net/storeIt.jsp?t='+encodeURIComponent(t)+'&u='+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=700,height=600');
}

function stumble() {
        
	    window.open('http://www.stumbleupon.com/submit?url='+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=700,height=600');
}

function digg() {
         pageTracker._trackEvent('Share', 'digg',u);
	    window.open('http://digg.com/submit?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t)+'&bodytext='+encodeURIComponent(d)+'&media=news&topic=hardware','sharer','toolbar=0,status=0,width=900,height=600');
}

function blogger() {
         pageTracker._trackEvent('Share', 'blogger',u);
        window.open('http://www.blogger.com/blog_this.pyra?t='+encodeURIComponent(t)+'&u='+encodeURIComponent(u)+'&n='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=700,height=600');
}


function pusha() {
        pageTracker._trackEvent('Share', 'pusha',u);
       window.open('http://www.pusha.se/posta?title='+encodeURIComponent(t)+'&url='+encodeURIComponent(u)+'&description='+descPage,'sharer','toolbar=0,status=0,width=700,height=600');
}
function google() {
        
        pageTracker._trackEvent('Share', 'google',u);
        window.open('https://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=700,height=600');
}

//function mouseLeaves(element, evt) {
//    if (typeof evt.toElement != 'undefined' && evt.toElement && typeof element.contains != 'undefined') {
//        return !element.contains(evt.toElement);
//    }
//    else if (typeof evt.relatedTarget != 'undefined' && evt.relatedTarget) {
//        return !contains(element, evt.relatedTarget);
//    }
//}

//function contains(container, containee) {
//    while (containee) {
//        if (container == containee) {
//            return true;
//        }
//        containee = containee.parentNode;
//    }
//    return false;
//}

//function hideElement(element) {
//    if (element.style) {
//        element.style.display = 'none';
//    }
//}

//function mouseOutEvent(element, event) {
//    if (mouseLeaves(element, event)) {
//        hideElement(element)
//    }
//}
