﻿function playVideo(id, width, height) {
    document.getElementById("videoPlayerDiv").innerHTML = '<object width="' + width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + id + '&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + id + '&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '"></embed></object>';
}

function closeDiv(id) {
        parent.document.getElementById(id).style.display='none';
}

function itemClicked(obj, itemId) {
    try{
    itemTitle = document.getElementById(itemId + '_title').innerHTML;
    itemDescription = document.getElementById(itemId + '_item').innerHTML;
    itemDescription = removeHTMLTags(itemDescription);
    itemDescription = itemDescription.replace(itemTitle, '');
    itemDescription = itemDescription.substring(1,200) + '...';
    if(itemTitle.length == 0) {
        itemTitle = document.title;
    }
    if(itemDescription.length <= 3) {
        itemDescription = '';
    }
    }
    catch(e) {}
    tags = 'vedasri.com';
    
    //return addthis_open(obj, '', pageUrl, itemTitle);
    var delicious = 'http://delicious.com/save?jump=yes&v=2&url='+ pageUrl + '&notes=' + encodeURIComponent(itemDescription) + '&tags=' + encodeURIComponent(tags) + '&title=' + encodeURIComponent(itemTitle);
    var digg = 'http://digg.com/submit?url=' + pageUrl + '&title=' + encodeURIComponent(itemTitle) + '&bodytext=' + encodeURIComponent(itemDescription);
    var facebook = 'http://www.facebook.com/sharer.php?u='+ pageUrl + '&t=' + encodeURIComponent(itemTitle);
    var reddit = 'http://www.reddit.com/submit?url='+ pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var stumbleupon = 'http://www.stumbleupon.com/submit?url='+ pageUrl + '%26title%26' + encodeURIComponent(itemTitle);
    var yahoobuzz = 'http://buzz.yahoo.com/buzz?targetUrl='+ pageUrl + '&headline=' + encodeURIComponent(itemTitle) + '&summary=' + encodeURIComponent(itemDescription);
    var twitter = 'http://twitthat.com/go?url='+ pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var google = 'http://www.google.com/bookmarks/mark?op=edit&output=popup&title=' + encodeURIComponent(itemTitle) + '&bkmk=' + pageUrl;
    var myspace = 'http://www.myspace.com/Modules/PostTo/Pages/?l=2&u=' + pageUrl + '&t=' + encodeURIComponent(itemTitle) + '&c=' + encodeURIComponent(itemDescription);
    var mixx = 'http://www.mixx.com/submit?page_url=' + pageUrl;
    var linkedin = 'http://www.linkedin.com/shareArticle?mini=true&title=' + encodeURIComponent(itemTitle) + '&url=' + pageUrl + '&summary=' + encodeURIComponent(itemDescription) + '&source=vedasri.com'
    var propeller = 'http://www.propeller.com/story/submit/?url=' + pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var newsvine = 'http://www.newsvine.com/_tools/seed&save?u=' + pageUrl + '&h=' + encodeURIComponent(itemTitle);
    var live = 'https://skydrive.live.com/sharefavorite.aspx%2f.SharedFavorites??marklet=1&mkt=en-us&url=' + pageUrl + '&title=' + encodeURIComponent(itemTitle) + '&top=1';
    
    document.getElementById('share_delicious').href = delicious;
    document.getElementById('share_digg').href = digg;
    document.getElementById('share_facebook').href = facebook;
    document.getElementById('share_reddit').href = reddit;
    document.getElementById('share_stumbleupon').href = stumbleupon;
    document.getElementById('share_yahoobuzz').href = yahoobuzz;
    document.getElementById('share_twitter').href = twitter;
    document.getElementById('share_google').href = google;
    document.getElementById('share_myspace').href = myspace;
    document.getElementById('share_mixx').href = mixx;
    document.getElementById('share_linkedin').href = linkedin;
    document.getElementById('share_propeller').href = propeller;
    document.getElementById('share_newsvine').href = newsvine;
    document.getElementById('share_live').href = live;
    
    
    document.getElementById('shareItDiv').style.display='inline';
    document.getElementById('shareItDiv').style.top= (yMousePos + 22) + 'px';
    document.getElementById('shareItDiv').style.left=(((xMousePos<950)?xMousePos:950) - 60) + 'px';
    
}
function removeHTMLTags(strInputCode){
        strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 	        return (p1 == "lt")? "<" : ">";
        });
        var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
        return strTagStrippedText;	
}

function handleOnload()
{
    var delicious = 'http://delicious.com/save?jump=yes&v=2&url='+ pageUrl + '&notes=' + encodeURIComponent(itemDescription) + '&tags=' + encodeURIComponent(tags) + '&title=' + encodeURIComponent(itemTitle);
    var digg = 'http://digg.com/submit?url='+ pageUrl + '&title=' + encodeURIComponent(itemTitle) + '&bodytext=' + encodeURIComponent(itemDescription);
    var facebook = 'http://www.facebook.com/sharer.php?u='+ pageUrl + '&t=' + encodeURIComponent(itemTitle);
    var reddit = 'http://www.reddit.com/submit?url='+ pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var stumbleupon = 'http://www.stumbleupon.com/submit?url='+ pageUrl + '%26title%26' + encodeURIComponent(itemTitle);
    var yahoobuzz = 'http://buzz.yahoo.com/buzz?targetUrl='+ pageUrl + '&headline=' + encodeURIComponent(itemTitle) + '&summary=' + encodeURIComponent(itemDescription);
    var twitter = 'http://twitthat.com/go?url='+ pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var google = 'http://www.google.com/bookmarks/mark?op=edit&output=popup&title=' + encodeURIComponent(itemTitle) + '&bkmk=' + pageUrl;
    var myspace = 'http://www.myspace.com/Modules/PostTo/Pages/?l=2&u=' + pageUrl + '&t=' + encodeURIComponent(itemTitle) + '&c=' + encodeURIComponent(itemDescription);
    var mixx = 'http://www.mixx.com/submit?page_url=' + pageUrl;
    var linkedin = 'http://www.linkedin.com/shareArticle?mini=true&title=' + encodeURIComponent(itemTitle) + '&url=' + pageUrl + '&summary=' + encodeURIComponent(itemDescription) + '&source=vedasri.com'
    var propeller = 'http://www.propeller.com/story/submit/?url=' + pageUrl + '&title=' + encodeURIComponent(itemTitle);
    var newsvine = 'http://www.newsvine.com/_tools/seed&save?u=' + pageUrl + '&h=' + encodeURIComponent(itemTitle);
    var live = 'https://skydrive.live.com/sharefavorite.aspx%2f.SharedFavorites??marklet=1&mkt=en-us&url=' + pageUrl + '&title=' + encodeURIComponent(itemTitle) + '&top=1';
    
    document.getElementById('share_delicious').href = delicious;
    document.getElementById('share_digg').href = digg;
    document.getElementById('share_facebook').href = facebook;
    document.getElementById('share_reddit').href = reddit;
    document.getElementById('share_stumbleupon').href = stumbleupon;
    document.getElementById('share_yahoobuzz').href = yahoobuzz;
    document.getElementById('share_twitter').href = twitter;
    document.getElementById('share_google').href = google;
    document.getElementById('share_myspace').href = myspace;
    document.getElementById('share_mixx').href = mixx;
    document.getElementById('share_linkedin').href = linkedin;
    document.getElementById('share_propeller').href = propeller;
    document.getElementById('share_newsvine').href = newsvine;
    document.getElementById('share_live').href = live;
    
}
function bookmark_us(url, title){

    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }
    else if(document.all)// ie
        window.external.AddFavorite(url, title);
}
var fontSize = 11;
function increaseFontSize() {
    if(fontSize<=24) {
        fontSize = fontSize + 2;
        document.body.style.fontSize = fontSize + 'px';
    }
}
function decreaseFontSize() {
    if(fontSize>=6) {
        fontSize = fontSize - 2;
        document.body.style.fontSize = fontSize + 'px';
    }
}