window.addEvent('domready',function(){

//    $('top_lang').getElements('li').set('tween', {'duration': 'short'});
//
//    $('top_lang').getElement('select').addEvent('focus', function(){
//        $('top_lang').getElements('li').each(function(obj){
//            if(!obj.hasClass('selected')){
//                obj.setStyle('display', 'block')
//            }
//        });
//    });
//
//    $('top_lang').getElement('select').addEvent('blur', function(){
//        $('top_lang').getElements('li').each(function(obj){
//            if((!obj.hasClass('selected'))){
//                obj.setStyle('display', 'none')
//            }
//        });
//    });
    
    $('divShare').set('tween', {
        'duration': 'short'
    });//.tween('opacity', 0);
    
    if ($('share') != null) {
        $('share').addEvent('mouseover',showShare).addEvent('mouseleave', hideShare);
    }

    if ($('shareFav') != null) {
        $('shareFav').addEvent('click',addFav);
    }
    if ($('shareGBook') != null) {
        $('shareGBook').addEvent('click',function() {
            shareIt("http://www.google.com/bookmarks/mark?op=add&&bkmk=http://www.vscyber.com&title=" + shareItText.title);
        });
    }
    if ($('shareYMW') != null) {
        $('shareYMW').addEvent('click',function() {
            shareIt("http://myweb.yahoo.com/myresults/bookmarklet?ei=UTF-8&d="+ shareItText.description +"&t="+ shareItText.title);
        });
    }
    if ($('shareFaceBook') != null) {
        $('shareFaceBook').addEvent('click',function() {
            shareIt("http://www.facebook.com/sharer.php?u="+encodeURIComponent(top.location.href)+"&t="+encodeURIComponent(top.document.title));
        });
    }
    if ($('shareMySpace') != null) {
        $('shareMySpace').addEvent('click',function() {
            shareIt("http://us.myspace.com/Modules/PostTo/Pages/?&c="+ shareItText.description +"&t=" + shareItText.title);
        });
    }
    if ($('shareMyAol') != null) {
        $('shareMyAol').addEvent('click',function() {
            shareIt("http://favorites.my.aol.com/ffclient/webroot/0.4.5/src/html/addBookmarkDialog.html?favelet=true&url="+encodeURIComponent(top.location.href)+"&title="+encodeURIComponent(top.document.title));
        });
    }
    if ($('shareYBM') != null) {
        $('shareYBM').addEvent('click',function() {
//            shareIt("http://bookmarks.yahoo.com/toolbar/savebm/opener?tb=amp&u="+encodeURIComponent(top.location.href)+"&t="+encodeURIComponent(top.document.title));
            shareIt("http://bookmarks.yahoo.com/toolbar/savebm/opener?tb=amp&d="+ shareItText.description +"&t="+ shareItText.title);
        });
    }
    if ($('shareDel') != null) {
        $('shareDel').addEvent('click',function() {
            shareIt("http://del.icio.us/post?v=4&noui&jump=close&url=http://www.vscyber.com&title="+ shareItText.title);
        });
    }
    if ($('shareLive') != null) {
        $('shareLive').addEvent('click',function() {
            shareIt("https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&top=1&url="+encodeURIComponent(top.location.href)+"&title="+encodeURIComponent(top.document.title));
        });
    }
    if ($('shareTwitter') != null) {
        $('shareTwitter').addEvent('click',function() {
            shareIt("http://twitter.com/home/?status=" + shareItText.description);
        });
    }
    if ($('shareEmail') != null) {
        $('shareEmail').addEvent('click',function() {
            sendEmail();
        });
    }
});

function showShare() {
    $('divShare').tween('opacity',1);
}

function hideShare() {
    $('divShare').tween('opacity',0);
}

function addFav(){
    var url      = "http://www.vitesoft.com";
    var title    = "ViteSoft - Soluções em Software - 2010";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){
        window.external.AddFavorite(url, title);
    }
    hideShare();
}

function shareIt(link) {
    window.open(link);
    hideShare();
}

function sendEmail() {
    window.location = "mailto:?body="+ shareItText.description +"&subject="+ shareItText.title;
    hideShare();
}