//Article Tools
//article_tools.js
//Author: Matt King
//Date: 2/14/2008 (happy valentine's day!)
//Purpose: Create a general purpose, platform agnostic article tools display "box" that can be shared across all CMP Medica Sites. 
//(it should be fairly easy to modify as well)


//variables used throughout the article_tools javascript
var myUrl=document.location.href;
var myTitle=encodeURIComponent(document.title);
var openTableRow="<tr>";
var closeTableRow="</tr>";

//Article Tools
//Currently: email, print, delicious, digg, technorati, reddit, yahoo, google
//To remove one, comment out it's document.write command
//To add a new one, add a new variable here, construct the proper html, and create a new document.write command with the others
//it may help to look at an existing link for help
//NOTE: Make sure to add the proper number of <tr> and </tr> tags for however you want this table to be built (2x3, 3x2, etc)

var emailText;
var printText;
var deliciousText;
var diggText;
var technoratiText;
var redditText;
var yahooText;
var googleText;

//Email this page link
mySubject = ('Found an article you might be interested in');
myBody= (myTitle + ': ' + myUrl);
emailText= '<td width="50%">' +
	'<a href="mailto:?subject='+mySubject+'&body='+myBody+'" style="color:black;text-decoration:none;"> <img border="0" title="Email this story to a friend" alt="Email icon" src="http://imaging.cmpmedica.com/CME/pt/content/email.gif"/> <span>Send as email</span></a> ' +
	'</td>';

//Print this page link
printText = '<td width="50%">' +
	'<a href="#" onClick="javascript:window.print()" linkindex="37" style="color:black;text-decoration:none;">' +
	'<img width="15" height="18" border="0" alt="" src="http://imaging.cmpmedica.com/CME/pt/content/print.gif"/>' +
	' <span>Print this page</span></a> ' +
	'</td>';

//Delicious link
deliciousText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://del.icio.us/post?url='+myUrl+'&title='+myTitle+'\')" linkindex="31"> <img border="0" title="Bookmark with del.icio.us" alt="del.icio.us icon" src="http://imaging.cmpmedica.com/CME/pt/content/delicious.gif"/></a> <span>delicious</span>' +
	'</td>';

//Digg link
diggText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://digg.com/submit?phase=2&url='+myUrl+'&title='+myTitle+'\')" linkindex="32"> <img border="0" title="Digg This" alt="Digg icon" src="http://imaging.cmpmedica.com/CME/pt/content/digg.gif"/></a> <span>Digg</span>' +
	'</td>';

//Technorati link
technoratiText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://www.technorati.com/faves?add='+myUrl+'\')" linkindex="34"> <img border="0" title="Technorati" alt="Technorati icon" src="http://imaging.cmpmedica.com/CME/pt/content/technorati.gif"/></a> <span>Technorati</span>' +
	'</td>';

//Reddit link
redditText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://reddit.com/submit?url='+myUrl+'&title='+myTitle+'\')" linkindex="33" ><img border="0" title="Submit to reddit" alt="reddit icon" src="http://imaging.cmpmedica.com/CME/pt/content/reddit.gif"/></a> <span>reddit</span>' +
	'</td>';

//Yahoo link
yahooText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+myUrl+'&t='+myTitle+'\')" linkindex="36"> <img border="0" title="Bookmark with Yahoo" alt="Yahoo icon" src="http://imaging.cmpmedica.com/CME/pt/content/yahoo.gif"/></a> <span>Yahoo</span>' +
	'</td>';

//Google link
googleText= '<td>' +
	'<a href="#" onClick="javascript:window.open(\'http://www.google.com/bookmarks/mark?op=add&title='+myTitle+'&bkmk='+myUrl+'\')" linkindex="35" set="yes"> <img border="0" title="Bookmark with Google" alt="Google icon" src="http://imaging.cmpmedica.com/CME/pt/content/google.gif"/></a> <span>Google</span>' +
	'</td>';

//Ozmosis link
ozmosisText = '<td colspan="2">' +
	'<a href="#" onClick="javascript:window.open(\'https://www.ozmosis.com/bookmark?reference_item[uri]=\'+encodeURIComponent(location.href)+\'&pid=5&bookmark[title]=\'+encodeURIComponent(document.title))" style="color:black;text-decoration:none;"> <img border="0" title="Bookmark with Ozmosis" alt="Ozmosis icon" src="http://imaging.cmpmedica.com/CME/pt/content/ozmosisbookmark.gif"/> <span>Discuss this article on Ozmosis</span></a>'+
	'</td>';


//beginning of html structure for this box, contains one <tr> tag
document.write('<table width="100%" cellspacing="3" cellpadding="3"> <tbody>');
document.write(openTableRow);

//Write all the html to the page
document.write(emailText);
document.write(printText);

document.write(closeTableRow);
document.write(openTableRow);

//document.write(deliciousText);
//document.write(diggText);

document.write(closeTableRow);
document.write(openTableRow);

//document.write(technoratiText);
document.write(ozmosisText);
//document.write(redditText);

//document.write(closeTableRow);
//document.write(openTableRow);

//document.write(yahooText);
//document.write(googleText);

//Close the rest of the html structure
document.write(closeTableRow);
document.write("</tbody></table>");
