/*---------------------------------------------*/
/*          Main Menu Activation               */
/*---------------------------------------------*/

function showMenu(menuItem, subMenu){
if ( document.getElementById(subMenu) ) {
	document.getElementById(subMenu).className='subMenu';
}
if (document.getElementById(menuItem)){
	document.getElementById(menuItem).className='activeItem';
}
	}
	
function hideMenu(menuItem, subMenu){
if (document.getElementById(subMenu)){
	document.getElementById(subMenu).className='hideObj';
}
if (document.getElementById(menuItem)){
	document.getElementById(menuItem).className='';
}
	}	
/*onMouseOver="showMenu('menuItem', 'subMenu')"onMouseOut="hideMenu('menuItem', 'subMenu')"*/

/*---------------------------------------------*/
/*          Share funtions		               */
/*---------------------------------------------*/

function resettoggle() {
var e = document.getElementById('foo');
e.style.display = 'none';
}

function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->

function commonPopup(url, width, height, toolsInd, wname)
{
    var options = "width=" + width + ",height=" + height + ",top=" + ((screen.height - height) / 4).toString() + ",left=" + ((screen.width - width) / 2).toString();

    switch (toolsInd)
    {
        case 1:
            options += ",toolbar=no,status=no,resizable=no,scrollbars=yes";
            break;
        case 2:
            options += ",resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,directories=no,location=no";
            break;
        case 3:
            options += ",menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes";
            break;
        case 4:
            options += ",top=50,left=50,resizable=yes,scrollbars=yes,status=no,menubar=no,toolbar=no,location=yes";
            break;
        default:
            //do nothing
            break;
    }

    if (!wname)
    {
        wname = "reutersPopup";
    }

    popupWindow = window.open(url, wname, options);

    if (popupWindow)
    {
        popupWindow.focus();
    }
}

var articleURL = location.href;
//add
var articleTitle = document.title;
var articleBlurb = "";

if (location.href.search("\\?") != -1) {
	articleURL = location.href.split("?")[0];
}

//Google
function shareGoogle() {
	commonPopup('http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(articleURL)+'&title='+encodeURIComponent(articleTitle)+'&annotation='+encodeURIComponent(articleBlurb)+'&labels=', 860, 640, 1, 'googlePopup');
}

//Delicious
function shareDelicious() {
	commonPopup('http://del.icio.us/post?url='+encodeURIComponent(articleURL)+'&title='+encodeURIComponent(articleTitle)+'&notes='+encodeURIComponent(articleBlurb)+'&tags=news', 860, 640, 1, 'deliciousPopup');
}

//Favorites (of your browser)
function shareFavorites() {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(articleTitle, articleURL,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( articleURL, articleTitle); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }

//Facebook
function shareFacebook() {
	commonPopup('http://www.facebook.com/sharer.php?u='+encodeURIComponent(articleURL)+'&t='+encodeURIComponent(articleTitle), 860, 640, 1, 'facebookPopup');
}

//Live
function shareLive() {
	commonPopup('http://spaces.msn.com/BlogIt.aspx?SourceURL='+encodeURIComponent(articleURL)+'&Title='+encodeURIComponent(articleTitle), 860, 640, 1, 'livePopup');
}

//Digg
function shareDigg() {
	commonPopup('http://digg.com/remote-submit?phase=2&url='+encodeURIComponent(articleURL)+'&title='+encodeURIComponent(articleTitle)+'&bodytext='+encodeURIComponent(articleBlurb), 860, 640, 1, 'diggPopup');
}

//Yahoo MyWeb
function shareYahoo() {
	commonPopup('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(articleTitle)+'&u='+encodeURIComponent(articleURL)+'&ei=UTF-8'+'&d='+encodeURIComponent(articleBlurb)+'&tag=news', 860, 640, 1, 'yahooPopup');
}

//Furl
function shareFurl() {
	commonPopup('http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(articleURL)+'&t='+encodeURIComponent(articleTitle), 860, 640, 1, 'furlPopup');
}

//StumbleUpon
function shareStumble() {
	commonPopup('http://www.stumbleupon.com/submit?url='+encodeURIComponent(articleURL)+'&title='+encodeURIComponent(articleTitle), 860, 640, 1, 'stumbleUponPopup');
}


function shareNewsvine() {
	commonPopup('http://www.newsvine.com/_wine/save?aff=reuters&h='+encodeURIComponent(articleTitle)+'&t=world-news&u='+encodeURIComponent(articleURL)+'&e='+encodeURIComponent(articleBlurb), 860, 640, 1, 'newsvinePopup');
}

function shareMixx() {
	commonPopup('http://www.mixx.com/submit/story?title='+encodeURIComponent(articleTitle)+'&page_url='+encodeURIComponent(articleURL)+'&partner=REU&description='+encodeURIComponent(articleBlurb), 860, 640, 1, 'mixxPopup');
}

function shareTwitter() {
	commonPopup('http://twitter.com/home?status='+encodeURIComponent(articleTitle)+'%20-%20'+encodeURIComponent(articleURL), 860, 640, 1, 'twitterPopup');
}


function shareTechnorati() {
	commonPopup('http://technorati.com/favorites/?sub=addfavbtn&add='+encodeURIComponent(articleURL), 860, 640, 1, 'TechnoratiPopup');
}

function shareReddit() {
	commonPopup('http://www.reddit.com/login?dest=%2Fsubmit%3Furl%3D'+encodeURIComponent(articleURL)+'%26title%3D'+encodeURIComponent(articleTitle), 860, 640, 1, 'RedditPopup');
	}

function shareZoomit() {
	commonPopup('http://www.zoomit.ca/login.php?return=/submit.php?url='+encodeURIComponent(articleURL), 960, 640, 1, 'zoomitPopup');
}

var arrShareLinks = new Array(
	"Google","javascript:shareGoogle();",
	"Delicious","javascript:shareDelicious();",
	"Favorites","javascript:shareFavorites();",
	"Facebook","javascript:shareFacebook();",
	"Live","javascript:shareLive();",
	"Digg","javascript:shareDigg();",		
	"Yahoo!","javascript:shareYahoo();"
);

