// JavaScript Document
function showComments(article) {
	$.facebox("<iframe src=http://www.ucemag.com/14/"+article+".html scrolling=auto width=590 height=670 frameborder=0></iframe>");
}	
function showVideoPlayer(video, vidwidth, vidheight) {
	$.facebox2("<iframe src=http://www.ucemag.com/14/video/"+video+".html scrolling=auto width="+vidwidth+" height="+vidheight+" frameborder=0></iframe>");
}
function showVideoPlayer2(video, vidwidth, vidheight) {
	$.facebox("<iframe src=http://www.ucemag.com/14/video/"+video+".html scrolling=auto width="+vidwidth+" height="+vidheight+" frameborder=0></iframe>");
}	
function emailFriend(pgurl, pgtitle, pgdesc) {
	$.facebox("<iframe src=http://www.ucemag.com/pages/email-friend.html?pgurl="+encodeURIComponent(pgurl)+"&pgtitle="+encodeURIComponent(pgtitle)+"&pgdesc="+encodeURIComponent(pgdesc)+" scrolling=auto width=310 height=480 frameborder=0></iframe>");
}
function callExternalInterface() {
    /* Call a function registered as playMovie in the SWF named myMovie. */
     document["uce14"].playMovie(); 
}
function shareOnFacebook(issue, article, pgtitle) {
	articlelink = "http://www.ucemag.com/"+issue+"/"+article+".html";
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(articlelink)+'&t='+encodeURIComponent(pgtitle),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}
function tweetThis(pgurl, pgdesc) {
	BitlyCB.myShortenCallback = function(data) {
		// this is how to get a result of shortening a single url
		var result;
		for (var r in data.results) {
			result = data.results[r];
			result['longUrl'] = r;
			break;
		}
		var pgshorturl = result['shortUrl'];
		window.open('http://twitter.com/home/?status=Check out: '+pgdesc+' '+pgshorturl+'');
		return false;
	}
	BitlyClient.shorten(pgurl, 'BitlyCB.myShortenCallback');
}
function showAlert(flashvar) {
    alert(flashvar); 
}