function facebookShare( local, coupon_id){
	url = "http://" + location.hostname + "/" + local + "/coupons/share.php?coupon="+coupon_id;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url),'sharer', 'toolbar=0, status=0, width=626, height=436');  
	pageTracker._trackPageview('/share/facebook/');
}

function twitterShare( local, value, name ){
	
	name = cutString( name, "<sup>", "</sup>" );
	name = cutString( name, "<sup>", "</sup>" );
	
	status = "Save $" +value.toFixed(2) + " on " + name + " at http://webSaver.ca!";
	window.open('http://twitter.com/home?status='+encodeURIComponent(status),'sharer' );
	pageTracker._trackPageview('/share/twitter/');
} 

//Cut a the section of str out between needle_beg and needle_end 
function cutString( str, needle_beg, needle_end ){
	pos1 = str.search( needle_beg );
	if ( pos1 > -1 ){
		pos2 = str.search( needle_end );
		part1 = str.slice( 0, pos1 );
		part2 = str.slice( pos2 + 6 );
		str = part1 + part2
	}
	return str;
}
