var ArticleURL = location.href;
if (location.href.search("\\?") != -1) {
	ArticleURL = location.href.split("?")[0];
}

function shareHelp_ru() {
		commonPopup('/share_help_ru.html', 500, 250, 1, 'Help');
}
function shareHelp_en() {
		commonPopup('/share_help_en.html', 500, 250, 1, 'Help');
}
function shareHelp_az() {
		commonPopup('/share_help_az.html', 500, 250, 1, 'Help');
}
function shareHelp_fa() {
		commonPopup('/share_help_fa.html', 500, 250, 1, 'Help');
}
function shareHelp_ar() {
		commonPopup('/share_help_ar.html', 500, 250, 1, 'Help');
}

function shareBobrdobr() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://bobrdobr.ru/addext.html', 900, 600, 2, 'BobrdobrPopup');
}

function shareFacebook() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.facebook.com/sharer.php?u='+encodeURIComponent(ArticleURL)+'&t='+encodeURIComponent(ArticleTitle), 626, 436, 2, 'facebookPopup');
}

function shareLinkstore() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.linkstore.ru/servlet/LinkStore?a=add&url='+encodeURIComponent(ArticleURL), 800, 600, 2, 'Linkstore');
}

function shareLiveJournal() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.livejournal.ru/', 800, 600, 2, 'LiveJournalPopup');
}

function shareMemori() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://memori.ru/link/', 800, 600, 2, 'Memori');
}

function shareMoemesto() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://moemesto.ru/', 800, 600, 2, 'Moemesto');
}

function shareReddit() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://reddit.com/submit?url='+encodeURIComponent(ArticleURL), 626, 436, 2, 'RedditPopup');
}

function shareStumbleUpon() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.stumbleupon.com/submit?url='+encodeURIComponent(ArticleURL), 800, 400, 2, 'StumbleUponPopup');
}

function shareTwitter() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://twitter.com/home?status=Currently reading '+encodeURIComponent(ArticleURL), 800, 400, 2, 'TwitterPopup');
}

function shareDonbaleh() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://donbaleh.com/submit.php?url='+encodeURIComponent(ArticleURL)+'&title='+encodeURIComponent(ArticleTitle), 800, 400, 2, 'Donbaleh');
}

function shareBalatarin() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://balatarin.com/links/submit?phase=2&amp;url='+encodeURIComponent(ArticleURL)+'&title='+encodeURIComponent(ArticleTitle), 800, 400, 2, 'Balatarin');
}








function shareDelicious() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(ArticleURL)+'&title='+encodeURIComponent(ArticleTitle)+'&notes='+encodeURIComponent(ArticleTeaser)+'&tags=news', 540, 500, 2, 'deliciousPopup');
}

function shareNewsvine() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.newsvine.com/_wine/save?aff=reuters&h='+encodeURIComponent(ArticleTitle)+'&t=world-news&u='+encodeURIComponent(ArticleURL)+'&e='+encodeURIComponent(ArticleTeaser), 650, 445, 2, 'newsvinePopup');
}

function shareMixx() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://www.mixx.com/submit/story?title='+encodeURIComponent(ArticleTitle)+'&page_url='+encodeURIComponent(ArticleURL+"?rpc=62")+'&description='+encodeURIComponent(ArticleTeaser), 1024, 640, 2, 'mixxPopup');
}

function shareDigg() {
	if (typeof(ArticleTitle) != 'undefined')
		commonPopup('http://digg.com/remote-submit?phase=2&url='+encodeURIComponent(ArticleURL)+'&title='+encodeURIComponent(ArticleTitle)+'&bodytext='+encodeURIComponent(ArticleTeaser)+'&topic=world_news', 540, 500, 2, 'diggPopup');
}

function shareLinkedIn() {
	if (typeof(ArticleTitle) != 'undefined')		
		commonPopup('http://www.linkedin.com/shareArticle?mini=true&url='+encodeURIComponent(ArticleURL)+'&title='+encodeURIComponent(ArticleTitle)+'&summary='+encodeURIComponent(ArticleTeaser)+'&source=Trend News Agency', 520, 570, 2, 'linkedinPopup');
}



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 += ",menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes";
            break;
        case 3:
            options += ",top=50,left=50,resizable=yes,scrollbars=yes,status=no,menubar=no,toolbar=no,location=yes";
            break;
        case 4:
            options += ",top=50,left=50,resizable=yes,scrollbars=no,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();
    }
}

