/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** BEGIN - GLOBALS ************************************************************************* */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ////////////////////////////////////////////////// */

/* ********** BEGIN - TAG *************************** */

/* ////////////////////////////////////////////////// */

/*
 
     =====================
     .....................
     ... .................
     .. + ................
     ... ...... ..........
     ......... ^ .........
     .......... ..........
     ......... ^ .........          
     ........ ^^^ ........
     ....... ^^^^^ .......
     ...... ^^^^^^^ ......
     ..... ^^^^^^^^^ .....     
     =====================
     SIMON CORRY BA(HONS.)
     SCIENCE 'N CREATIVITY
     =====================
          
     http://simoncorry.com
               
*/

/* ////////////////////////////////////////////////// */

/* ********** END - TAG ***************************** */

/* ////////////////////////////////////////////////// */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** END - GLOBALS *************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** BEGIN - LINKS *************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

$(document).ready(function() {

    encodedUrl = encodeURIComponent("http://acumenfund.org");
    encodedUrl2 = encodeURIComponent("http://www.acumenfund.org/ten/#ten-things-box");
    tweetString = "Inspiring what @acumenfund's accomplished in 10 years! Changing the way the world tackles poverty: http://www.acumenfund.org";
    tweetString2 = "For their 10-year anniversary, @acumenfund just released 10 lessons on tackling poverty. Great read: http://www.acumenfund.org/ten/#ten-things-box";

    $("#fb-button-bg").click(function(){ window.open('http://www.facebook.com/sharer.php?u='+encodedUrl+'&t=Acumen%20Fund', "Share", 'height=350,width=700'); });
    $("#tr-button-bg").click(function(){ window.open('http://twitter.com/home?status='+encodeURIComponent(tweetString), "Tweet"); });
    
    $("#fb-button-bg-2").click(function(){ window.open('http://www.facebook.com/sharer.php?u='+encodedUrl2+'&t=Acumen%20Fund', "Share", 'height=350,width=700'); });
    $("#tr-button-bg-2").click(function(){ window.open('http://twitter.com/home?status='+encodeURIComponent(tweetString2), "Tweet"); });

    // Get number of tweets about this page.
    $.getJSON(
        'http://api.tweetmeme.com/url_info.jsonc?url='+encodedUrl+'&callback=?',
        function(data) { if(data.story.url_count > 0) $("#twitterbubble").show().text(data.story.url_count); }
    );

    // Get number of facebook shares of this page.
    facebookFetch = encodeURIComponent('http://api.facebook.com/restserver.php?method=links.getStats&urls='+encodedUrl),
    $.get(
        "/_includes/crossFetch.php?url="+facebookFetch,
        function(data) {
            var shareCount = $(data).find('share_count').text();
            if(shareCount > 0) $("#facebookbubble").show().text(shareCount);
        }
    );   
    
/*  $("#gp-button").mouseover(function(){
        $("#gp-button").animate({opacity:'100',width:'0'}).$("#gp-button").animate({opacity:'100',width:'66'});
    });
    $("#gp-button-bg").mouseout(function(){
        $("#gp-button").animate({opacity:'100',width:'66'});
    }); */
    
    $("#fb-button").mouseover(function(){
        $("#fb-button").animate({opacity:'100',width:'0'}).$("#fb-button").animate({opacity:'100',width:'66'});
    });
    $("#fb-button-bg").mouseout(function(){
        $("#fb-button").animate({opacity:'100',width:'66'});
    });
    
    $("#tr-button").mouseover(function(){
        $("#tr-button").animate({opacity:'100',width:'0'}).$("#tr-button").animate({opacity:'100',width:'66'});
    });
    $("#tr-button-bg").mouseout(function(){
        $("#tr-button").animate({opacity:'100',width:'66'});
    });    
	
    // CHAPTERS LINKS

    $("#grid_point_11").click(function(){ window.open('http://community.acumenfund.org/notes/Acumen_Fund_Chapters', '_blank'); });
    
    // 10 THINGS
    
    $("#pdf-link").click(function(){ window.open('http://www.acumenfund.org/ten/_media/downloads/10things.pdf', '_self'); });
    
    // BUY TICKETS   			
	
	$("#buy-link").click(function(){ window.open('https://secure3.convio.net/acumen/site/Ticketing?view=Tickets&id=100481', '_blank'); });
	
	// DONATE AND SUPPORT  			
	
	$("#donate-1-link").click(function(){ window.open('https://secure3.convio.net/acumen/custom/donate10.html', '_blank'); });
	$("#donate-2-link").click(function(){ window.open('https://secure3.convio.net/acumen/custom/donate10.html', '_blank'); });
	$("#donate-button-3").click(function(){ window.open('https://secure3.convio.net/acumen/custom/donate10.html', '_blank'); });
	$("#support-button-1").click(function(){ window.open('https://secure3.convio.net/acumen/custom/donate10.html', '_blank'); });
	
	// SIGN UP
	
	$("#sign-up").click(function(){ window.open('http://support.acumenfund.org/site/PageServer?pagename=sign_up&__utma=1.232091803.1309886470.1314997841.1315007864.30&__utmb=1.11.10.1315007864&__utmc=1&__utmx=-&__utmz=1.1309886470.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)&__utmv=-&__utmk=131638159', '_blank'); });	
	
	// GIVE A GIFT
	
	$("#celebrate-button").click(function(){ window.open('http://www.acumenfund.org/give-2011/', '_blank'); });
	$("#celebrate-button-2").click(function(){ window.open('http://www.acumenfund.org/give-2011/', '_blank'); });
	$("#celebrate-button-3").click(function(){ window.open('http://www.acumenfund.org/give-2011/', '_blank'); });
	
});

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** END - LINKS ***************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */
