function save_article(page, zoom){
	if( g_isLoggedIn ){
		switch(g_type){
			case 'compilation':
				saveToFavorites(g_id, g_type, "alert");
				break;
			case 'issue':
				switch(g_issueType){
					case 'T':
						saveToFavorites(g_id, g_type, "alert");
						break;
					default:
						loadTB("save article", g_webroot + "utils/select_article/"+g_type+"/"+g_id+"/"+page+"/"+zoom+"?next_url=/compilations/add/article&next_title=save%20article&next_height=530&next_width=700&width=320&height=200");										
						break;
				}
				break;
		}
	} else {
		showLogin(page);
	}
}
function rate_article(page, zoom){
	if( g_isLoggedIn ){
		switch(g_issueType){
			case 'T':
				loadTB("rate this issue", g_webroot + "/utils/rate_article?width=320&height=260");
				break;
			default:		
				loadTB("rate article", g_webroot + "utils/select_article/"+g_type+"/"+g_id+"/"+page+"/"+zoom+"?next_url=/utils/rate_article&next_title=rate%20article&next_height=260&next_width=320&width=320&height=200");
				break;
			}
	} else {
		showLogin(page);
	}
}
function comment_article(page, zoom){
	if( g_isLoggedIn ){		
		loadTB("comment on article", g_webroot + "utils/select_article/"+g_type+"/"+g_id+"/"+page+"/"+zoom+"?next_url=/utils/comment/article&next_title=comment%20on%20article&next_height=400&next_width=600&width=320&height=200");
	} else {
		showLogin(page);
	}
}
function share_article(page, zoom){
	if( g_isLoggedIn ){
		switch(g_type){
			case 'compilation':
				shareWithFriends(g_id, g_type, "alert");
				break;
			case 'issue':
				switch(g_issueType){
					case 'T':
						shareWithFriends(g_id, g_type, "alert");
						break;
					default:
						loadTB("share article", g_webroot + "utils/select_article/"+g_type+"/"+g_id+"/"+page+"/"+zoom+"?next_url=/utils/share_friends/article&next_title=share%20article&next_height=400&next_width=650&width=320&height=200");					
						break;
				}
				break;
		}
	} else {
		showLogin(page);
	}
}
function tag_article(page, zoom){
	if( g_isLoggedIn ){
		loadTB("tag an article", g_webroot + "utils/select_article/"+g_type+"/"+g_id+"/"+page+"/"+zoom+"?next_url=/utils/tag/article&next_title=tag%20an%20article&next_height=400&next_width=760&width=320&height=200");
	}  else {
		showLogin(page);
	}
}
function showLogin(page){
	var currUrl = window.location.href + "&login=true";
	if(page!=null)
		currUrl = currUrl + "&pageNum="+page;
	loadTB("please login first", g_webroot + "users/login?&width=420&height=370&next_url="+encodeURIComponent(currUrl));
}