/* 
 *  Copyright 2010 enric.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

function facebook(url,title){
    window.open(
    'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(url) + '&t=' + title,
    'facebook',
    'width=640,height=480');
}


function twitter(url,msg) {
    window.open(
    'http://twitter.com/home?status=' + msg + ': ' + encodeURIComponent(url),
    'twitter',
    'width=800,height=480,scrollbars=yes'
    );
}

function myspace(title,content,url) {
    window.open(
    // Mirar http://www.zen-cart.com/forum/showthread.php?p=573223
    //'http://www.myspace.com/Modules/PostTo/Pages/?' +
    //'t=' + encodeURIComponent(T) +
    //'&c=' + encodeURIComponent(C) +
    //'&u=' + encodeURIComponent(U) +
    //'&l=' + L;
    'http://www.myspace.com/Modules/PostTo/Pages/?' +
        't=' + encodeURIComponent(title) +
        '&c=' + encodeURIComponent(content) + 
        '&u=' + encodeURIComponent(url) + 
        '&l=5', // L=5 Location L = 5 => Interests
    'myspace',
    'width=640,height=480'
    );
}

function delicious(url,msg) {
    window.open(
    'http://delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(msg),
    'delicious',
    'width=640,height=480'
    );
}

function linkedin(url,title,articleSummary,src) {
    // <a href=”http://www.linkedin.com/shareArticle?mini=true&url=<?phpthe_permalink(); ?>&title=<?php the_title(); ?>&source=ADD_YOUR_BLOG_URL_HERE”><img src=”ADD_IMAGE_URL_HERE”></a>
    var linkedin = 'http://www.linkedin.com/shareArticle?mini=true';
    if (url != null) {
        linkedin += '&url=' + encodeURIComponent(url);
    }
    if (title != null) {
        linkedin += '&title=' + encodeURIComponent(title);
    }
    if (articleSummary != null) {
        linkedin += '&summary=' + encodeURIComponent(articleSummary);
    }
    if (src != null) {
        linkedin += '&source=' + encodeURIComponent(src);
    }
    window.open(
    linkedin,
    'linkedin',
    'width=640,height=540,scrollbars=yes'
    );
}

function googlemaps(lat,lon) {
    window.open(
    'http://maps.google.com/maps?q=' + lat + ',' + lon,
    'googlemaps',
    'width=640,height=480'
    );
}
