
function ShowThis(obj)
{
    var left = GetAbsoluteLeft(obj);
	var top  = GetAbsoluteTop(obj);
	var bookmark = document.getElementById('bookmarkshow');
	
	bookmark.style.left = left + "px";
	bookmark.style.top  = top + obj.offsetHeight + 0 + "px";	
		
	if(bookmark.style.display == 'block')
	{
        bookmark.style.display = "none"; 
    }
    else 
    {
        bookmark.style.display = "block";         
    }  
}

function DisplayIframe(obj)
{
    var left = GetAbsoluteLeft(obj);
    var top  = GetAbsoluteTop(obj);
    var bookmark = document.getElementById('myiframe');
    
    if(navigator.appName == 'Netscape')
        bookmark.style.left = left - 7 + "px";
    else
        bookmark.style.left = left + "px";
    bookmark.style.top  = top + obj.offsetHeight + 0 + "px";
    
    if(bookmark.style.display == "block")
    {
        bookmark.style.display = "none";
    }
    else
    {
        bookmark.style.display = "block";
    }
}

function hiddenmark(id)
{
    document.getElementById(id).style.display = "none";   
}

function OverThis(obj)
{
    obj.style.display = "block";
}

function HideThis(obj)
{
    obj.style.display = "none";
}

function LinkToPage(name)
{ 
    var url = null;
    var localurl = encodeURIComponent(location.href);
    var title = "&" + encodeURIComponent("title=Microsoft adCenter Labs");
    var json = { "Live":"http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1208845556&rver=4.0.1534.0&wp=MBI&wreply=https:%2F%2Ffavorites.live.com%2Fquickadd.aspx%3Fmarklet%3D1%26mkt%3Den-us%26url%3D",
        "Facebook":"http://www.facebook.com/share.php?url=",
        "Twitter":"http://twitter.com/login?url=",
        "Technorati":"http://www.technorati.com/faves?add=",
        "Favorites":"",
        "Del_icio_us":"http://del.icio.us/post?url=",
        "My_Space":"http://www.myspace.com/Modules/PostTo/Pages/?href=",
        "Stumble_Upon":"http://www.stumbleupon.com/submit?url=",
        "Reddit":"http://reddit.com/submit?url="};
        
    switch(name)
    {
        case 'Live':
            url = json[name] + localurl + title;
            break;
        case 'Facebook':
            url = json[name] + localurl + title;
            break;
        case 'Twitter':
            url = json[name] + localurl + title;
            break;
        case 'Technorati':
            url = json[name] + localurl + title;
            break;
        case 'Favorites':                     
            break;
        case 'Del_icio_us':
            url = json[name] + localurl + title;
        case 'My_Space':
            url = json[name] + localurl + title;
            break;
        case 'Stumble_Upon':
            url = json[name] + localurl + title;
            break;
        case 'Reddit':
            url = json[name] + localurl + title;
            break;
        default:
            break;
    }
    
    if(url != null)
        window.open(url);
}
String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}

function AddFavorite()
{
    var toolName = document.getElementById('MyMaster_lblTitle');
       if (window.sidebar) { // firefox
              window.sidebar.addPanel(toolName.innerHTML.Trim(), location.href,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite( location.href, toolName.innerHTML);
        } else {
               alert("Sorry, your browser doesn't support this");
        }  
}

function AdjustEmailPosition(obj)
{
    var left = GetAbsoluteLeft(obj);
    var mail = document.getElementById('myiframe');    
    
    mail.style.left = left - (mail.offsetWidth - obj.offsetWidth) + 'px';
    if(navigator.appName == 'Netscape')
    {
        mail.style.left = left - (mail.offsetWidth - obj.offsetWidth) - 8 + 'px';
        mail.style.width = mail.offsetWidth + 8 + 'px';
    }
}

function AdjustBookmarkPosition(obj)
{
    var left = GetAbsoluteLeft(obj);
    var bookmark = document.getElementById('bookmarkshow');
    
    bookmark.style.left = left - (bookmark.offsetWidth - obj.offsetWidth) + 'px';
}