var bub_timeout_id = 0;
var wide_pop = '';

function getPopFileInfo (ext) {
	var doc_str = '<p class="pop_link" style="padding-top: 7px; padding-bottom: 0px; margin-bottom: 0px">';
	switch (ext) {
		case 'PDF':
			doc_str += '<a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank"><img src="/images/acrobat_logo.gif" width="20" height="20" align="absmiddle" border="0" style="padding-right: 3px" alt="Download FREE Acrobat Reader" title="Download FREE Acrobat Reader"></a>' + 'requires <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">Acrobat Reader</a></p>';
			break;
		case 'DOC':
			doc_str += '<img src="/images/word_logo.gif" width="20" height="20" align="absmiddle" border="0" style="padding-right: 3px" alt="Microsoft Word Document" title="Microsoft Word Document">MS Word Document</p>';
			break;
		case 'TXT':
			doc_str += 'Plain Text Document</p>';
			break;
		default:
			doc_str = '';
			break;
		}
	return (doc_str);
	}
	
function trainingBub (info_id, bub_id, orientation) {
	wide_pop = false;
	var id = 0;
	var res_title = 1;
	var filename = 2;
	var res_desc = 3;
	var capture = 4;
	var filesize = 5;
	var ext = 6;
	var doc_str = getPopFileInfo (bub_arr[info_id][ext]);
	doc_str = bub_arr[info_id][res_title] + "<br>" + bub_arr[info_id][ext] + ' file | size: ' + bub_arr[info_id][filesize] + 'Kb' + doc_str;
	if (!orientation) orientation = 'right_bot';
	bubbleOn(bub_id, doc_str, orientation);
	}
	
function clientCaseBub (bub_id, feat, bub_size) {
	if (bub_size) wide_pop = true;
		else wide_pop = false;
	var id = 0;
	var name = 1;
	var featured = 2;
	var url = 3;
	var content = 4;
	var photo_id = 5;
	var sml_wth = 6;
	var sml_hgt = 7;
	var ext = 10;
	var case_id = 11;
	var case_cont = 12;
	var file_id = 13;
	var filename = 14;
	var file_ext = 15;
	var filesize = 16;
	var file_title = 17;
	doc_str = '<p><b>SUCCESS STORY<br>' + bub_arr[bub_id][name] + '</b></p><p>';
	if (bub_arr[bub_id][photo_id]) {
		doc_str += '<img src="/photos/photo_' + bub_arr[bub_id][photo_id];
		if (bub_arr[bub_id][sml_wth] > 180) {
			doc_str += '_thm.';
			}
		else {
			doc_str += '_sml.';
			}
		doc_str += bub_arr[bub_id][ext] + '" align="right" style="border: solid 1px #558994; margin-left: 7px; margin-bottom: 5px; margin-top: 7px">';
		}
	doc_str += bub_arr[bub_id][case_cont] + "</p>";
	if (bub_arr[bub_id][filename]) {
		doc_str += '<p class="pop_link"><b>Download Full Success Story:</b><br><a href="#" onClick="trackDownload(' + bub_arr[bub_id][file_id] + ', false); return (false)">' + bub_arr[bub_id][file_title] + "</a><br>" + bub_arr[bub_id][file_ext] + ' file | size: ' + bub_arr[bub_id][filesize] + 'Kb';
		doc_str += getPopFileInfo (bub_arr[bub_id][file_ext]) + '</p>';
		}
//	alert (doc_str);
//	var tmp = document.getElementById ('debug4');
//	tmp.innerHTML = doc_str;
	if (feat) bubbleOn("case_feat_" + bub_id, doc_str, 'left_top');
		else bubbleOn("case_" + bub_id, doc_str, 'right_top');
	}
	
function clientBub (bub_id, feat) {
	wide_pop = false;
	var id = 0;
	var name = 1;
	var featured = 2;
	var url = 3;
	var content = 4;
	var photo_id = 5;
	var sml_wth = 6;
	var sml_hgt = 7;
	var ext = 10;
	doc_str = '<p><b>' + bub_arr[bub_id][name] + '</b></p><p>';
	if (bub_arr[bub_id][photo_id]) {
		doc_str += '<img src="/photos/photo_' + bub_arr[bub_id][photo_id];
		if (bub_arr[bub_id][sml_wth] > 180) {
			doc_str += '_thm.';
			}
		else {
			doc_str += '_sml.';
			}
		doc_str += bub_arr[bub_id][ext] + '" align="right" style="border: solid 1px #558994; margin-left: 7px; margin-bottom: 5px; margin-top: 7px">';
		}
	doc_str += bub_arr[bub_id][content] + "</p>";
//	alert (doc_str);
//	var tmp = document.getElementById ('debug4');
//	tmp.innerHTML = doc_str;
	if (feat) bubbleOn("feat_" + bub_id, doc_str, 'left_top');
		else bubbleOn(bub_id, doc_str, 'right_top');
	}
	
function team_bub (bub_id, str) {
	wide_pop = false;
	var id = 0;
	var full_name = 1;
	var job_title = 2;
	var name = 3;
	doc_str = '<p><b>' + bub_arr[bub_id][full_name] + '</b> (' + bub_arr[bub_id][job_title] + ')</p><p>';
	if (bub_arr[bub_id][name]) doc_str += bub_arr[bub_id][name] + '</p><p>';
	doc_str += str + "</p>";
	bubbleOn(bub_id, doc_str, 'right_top');
	}
	
function bubbleOn (bub_id, bub_str, align) {
	var popup = "bubble_div";
	var popcontent = "bub_content";
	if (wide_pop) {
		popup = "bubble_div2";
		popcontent = "bub_content2";
		}
	clearTimeout (bub_timeout_id);
	if (bub_id != 99) {
		var offset_x = 20;
		var offset_y = -20;
		var tmp = 'bub_' + bub_id;
		switch (align) {
			case 'right_top':
				var x = getX (tmp) + 20;
				var y = getY (tmp) - 60;
				break;
			case 'right_bot':
				var x = getX (tmp) + 20;
				var y = getY (tmp) - 20;
				break;
			case 'left_top':
				if (wide_pop) var x = getX (tmp) - 310;
					else var x = getX (tmp) - 210;
				var y = getY (tmp) - 60;
				break;
			case 'left_bot':
				if (wide_pop) var x = getX (tmp) - 310;
					else var x = getX (tmp) - 210;
				var y = getY (tmp) - 20;
				break;
			}
		moveItSimple (popup, x, y);
		tmp = document.getElementById (popcontent);
		tmp.innerHTML = bub_str;
		}
//	var tmp = document.getElementById ('debug');
//	tmp.innerHTML = x + '  ' + y;
	MM_showHideLayers(popup,'','show');
	}

function bubbleOff () {
	var popup = "bubble_div";
	if (wide_pop) popup = "bubble_div2";
	MM_showHideLayers(popup,'','hide');
	}