

// **********************************************************************
// **********************************************************************
//BCS_Mod_PremTree_

function BCS_Draw_PageContent () {
	BCS_CtrlWin.BCS_if_loaded = false;
var msg = '<br/>BCS_Draw_PageContent<br/>';
try {
BFWDATA.logDebug(msg);
BFWDATA.dumpDebug();
} catch(e) {
var msg = '<br/>ERROR :: '+ e.lineNumber +' - '+ e.message;
BFWDATA.logDebug(msg);
BFWDATA.dumpDebug();
}
	$('#BCS_breadcrumb').hide();
	$('#BCS_pageContentDiv_Home').hide();
	$('#BCS_pageContentDiv_Interior').hide();
	$('#BCS_pageContentDiv_Premium').hide();
	$('#BCS_pageContentDiv_Scorecard').hide();
	$('#BCS_pageInstructorDiv').hide();
	$('#BCS_pageContentDiv_IR').hide();

	BCS_Draw_PageUser();
	if (BCS_UserViewMode == 'i') {
		BCS_UserViewMode = '';
		BCS_Draw_PageMod_IR();
		$('#BCS_pageContentDiv_IR').show();

// ----------------------------------------------------------------------------------------------
	} else if (BCS_current_tab.type=='BCS TABX' && BCS_current_tab.subtype=='INSTRUCTOR') {

		BCS_Draw_PageMod_IR();
		$('#BCS_pageContentDiv_IR').show();

// ----------------------------------------------------------------------------------------------
	} else if (BCS_current_tab.type=='BCS TAB' && BCS_current_tab.subtype=='SCORECARD') {

		BCS_Draw_PageMod_ScBreadcrumb();
		//alert("testscre"+BCS_current_tab.subtype);
		$('#BCS_breadcrumb').show();
		$('#BCS_pageContentDiv_Scorecard').show();
		BCS_Draw_PageMod_ScUser();

// ----------------------------------------------------------------------------------------------
	} else if (BCS_current_tab.type=='BCS TAB' && BCS_current_tab.subtype=='PREMIUM') {

		BCS_Draw_PageMod_PremBreadcrumb();
		BCS_Draw_PageMod_PremInfo();
		BCS_Draw_PageMod_PremUser();
		BCS_Draw_PageMod_PremTrees();
		$('#BCS_breadcrumb').show();
		//alert("test"+BCS_current_tab.subtype);
		$('#BCS_pageContentDiv_Premium').show();

// ----------------------------------------------------------------------------------------------
	} else if (BCS_current_tab.type=='BCS TAB' && BCS_current_tab.subtype=='HOME' && BCS_current_content != null) {

		BCS_Draw_PageContent_Content();
		//alert("testhme"+BCS_current_tab.subtype);
		$('#BCS_breadcrumb').show();
		$('#BCS_pageContentDiv_Content').show();

//prompt('',$('#BCS_pageContentDiv_Home').html());
// ----------------------------------------------------------------------------------------------
	} else {

//		BCS_Draw_PageMod_HomeUser();
//		BCS_Draw_PageMod_HomeContent();
//		BCS_Draw_PageMod_HomeProducts();
		if (true && !jQuery.support.cssFloat) {
			$('#BCS_pageTabsDiv').hide();
			$('#BCS_pageBodyDivInner').hide();
			$('#BCS_pageBodyDiv').hide();
		}
		if (true && !jQuery.support.cssFloat) {
			$('#BCS_pageBodyDiv').show();
			$('#BCS_pageBodyDivInner').show();
			$('#BCS_pageTabsDiv').show();
		}
		for (var i in BCS_Callouts) {if (BCS_Callouts.hasOwnProperty(i)) {
			var _if = $('#BCS_callout_if'+i)[0];
			_if.src = BCS_Callouts[i];
			$('#BCS_callout_div'+i).show();
		}}
		$('#BCS_pageContentDiv_Home').show();

	}
if (!RA_CtrlWin.RA.dev_check()) 	BCS_historyRecord();
}


// **********************************************************************
// **********************************************************************

function BCS_Draw_PageUser () {
	
	//debugger;
	var hasProducts_ct = 0;
	var products_ct = 0;

	for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
		switch (RA_CtrlWin.RA.Products[iprod].Type) {
		case 'RA CONTENT' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		case 'RA SITE' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		case 'RA PACKAGE' :
			break;
		case 'RA PACKAGE SITE' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		default :
		}
	}}

	var html = '';
	var html2 = '';
	if (RA_CtrlWin.RA.CurrentSiteAccess() <= 10) {
	html += '&nbsp;';
	html2 += '&nbsp;';
	} else {
	html += ''+RA_CtrlWin.RA.CurrentUser.FName+' '+RA_CtrlWin.RA.CurrentUser.LName+'';
	html2 += '&nbsp;';
		if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
	html2 += 'You are logged in as an instructor.';
		} else if (RA_CtrlWin.RA.CurrentSiteAccess() >= 20 && RA_CtrlWin.RA.CurrentUser.OnyxStatus == 1) {
	html2 += 'Your request for instructor access is pending.';
		} else if (RA_CtrlWin.RA.CurrentSiteAccess() >= 20) {
	html2 += 'You are logged in as a student.';
		} else {
	html2 += '';
		}
/*
*/
	}
	$('*.BCS_RA_UserName').html( html );
	$('*.BCS_RA_UserAccess').html( html2 );
	try {
	$('#BCS_Mod_Interior_QuizRecord_InstEmail').html( RA_CtrlWin.RA.CurrentUser.SiteLogins[RA_CtrlWin.RA.CurrentSite.ID].InstructorEmail );
	} catch(e) {}
	html = '';
	if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
		$('*.BCS_RA_UserLoginLink').hide();
		$('*.BCS_RA_UserRegisterLink').hide();
		html += '<a class="BCS_RA_Link" href="JavaScript:BCS_TopBar_Account(BCS_site_co);">YOUR ACCOUNT</a>';
		$('*.BCS_RA_UserUpdateLink').html( html );
		$('*.BCS_RA_UserUpdateLink').show();
		$('*.BCS_RA_UserLogoutLink').show();
		$('#Log_out').show();
		$('#Log_in').hide();
		$('#Instructor_login').show();
			$('#register_user').hide();
		$('#BCS_banner_HelloInner').show();
		
	} else if (RA_CtrlWin.RA.CurrentSiteAccess() > 10) {
		$('*.BCS_RA_UserLoginLink').hide();
		$('*.BCS_RA_UserRegisterLink').hide();
		html += '<a class="BCS_RA_Link" href="JavaScript:BCS_RAif_init(\'updateprofile\');">YOUR PROFILE</a>';
		$('*.BCS_RA_UserUpdateLink').html( html );
		$('*.BCS_RA_UserUpdateLink').show();
		$('*.BCS_RA_UserLogoutLink').show();
		$('#Log_out').show();
		$('#Log_in').hide();
		$('#student_login').show();
		$('#register_user').hide();
		$('#BCS_banner_HelloInner').show();
	} else {
		$('*.BCS_RA_UserUpdateLink').hide();
		$('*.BCS_RA_UserLogoutLink').hide();
		$('*.BCS_RA_UserLoginLink').show();
		$('#Log_out').hide();
		$('#Log_in').show();
		$('#student_login').hide();
		$('#register_user').show();
		$('#Instructor_login').hide();
		$('*.BCS_RA_UserRegisterLink').show();
		$('#BCS_banner_HelloInner').hide();
	}
}


// **********************************************************************
// **********************************************************************

function BCS_UserViewModeToggle () {
	if (BCS_UserViewMode == 'i') {
		BCS_UserViewMode = '';
	} else {
		BCS_UserViewMode = 'i';
	}
	BCS_Draw_PageContent();
}


// **********************************************************************
// **********************************************************************


function BCS_RandomOverlay (msgLink) {
	var BCS_msg = '';
	BCS_msg += '';
	var BCS_msg = '';
	BCS_msg = ''
		+ '<div style="text-align: center; background-color:#ffffff; width:50%;padding:5px 20px 30px 30px;">'
		+ '    <table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>'
		+ '    <tr><td></td>'
		+ '    <td width="10" align="right" valign="top" style="padding:5px 5px 0px 0px; cursor:default"><nobr><a href="JavaScript:void(0);" onclick="BCS_RandomOverlay_Close();" style="color:#000;font-size:8pt;font-family:Arial;text-decoration:none;">Close&nbsp;<img height="16" src="'+ BCS_tpl_version +'images/close_1.gif" width="16" align="top" border="0"/></a></nobr></td>'
		+ '    </tr>'
		+ '    <tr><td>'
		+ '<iframe src="'+msgLink+'" style="position:relative; width:450px; height:450px" frameBorder="0" scrolling="no" allowTransparency/>'
		+ '    </td>'
		+ '    <td width="10" valign="top">&nbsp;</td>'
		+ '    </tr></table>'
		+ '</div>'

	var x = $('#BCS_page_grayed')[0];
	var y = $('#BCS_loading_msg')[0];
	var z = $('#BCS_page_msg')[0];

	$('#BCS_page_msg').html( BCS_msg );
	x.style.display='block';
	y.style.display='none';
	z.style.display='block';

//	BCS_main_Resize();
}
function BCS_RandomOverlay_Close () {
	$('#BCS_page_msg').html( '' );
	$('#BCS_page_msg')[0].style.display='none';
	$('#BCS_loading_msg')[0].style.display='none';
	$('#BCS_page_grayed')[0].style.display='none';
}


// **********************************************************************
// **********************************************************************


function BCS_Draw_SiteInfo () {
/*
	var siteinfoDiv = $('#BCS_siteInfoDiv')[0];
	if ( false || ( RA_CtrlWin.RA.CurrentSiteAccess() < 90 ) ) {
		$('#BCS_siteInfoDiv').html( '' );
		siteinfoDiv.style.display = 'none';
//		siteinfoDiv.style.display = 'block';
//		siteinfoDiv.innerHTML = window.location.host.indexOf('bcs.bfwpub.com') +' &amp; '+ RA_CtrlWin.RA.CurrentSiteAccess();
		return;
	}
	var html = '';

	html += '<div style="margin: 10px;">';
	html += 'BCS for : <b>'+ BCSBSI_items.root.title +'</b>';
	html += '<table><tr><td>Currently in <b><span id="modeDescription">';
//	html += 'Edit';
	html += BCSBSI_items.DisplayMode;
	html += ' Mode</span></b>&nbsp;&nbsp;</td>';
	if (BCSBSI_items.DisplayMode=='Edit') {
		html += '<td><a class="squarebutton" href="javascript:BCSBSI_items.SetDisplayMode(\'Display\');BCS_RedrawAll();"><span id="modeButton">Switch to Display Mode</span></a></td>';
	} else {
		html += '<td><a class="squarebutton" href="javascript:BCSBSI_items.SetDisplayMode(\'Edit\');BCS_RedrawAll();"><span id="modeButton">Switch to Edit Mode</span></a></td>';
	}
	html += '<td><a class="squarebutton" href="javascript:BCS_ShowPopInWindow_SiteItems();"><span id="modeButton">Show All BCS Site Items</span></a></td>';
	html += '</tr></table>';
	html += '</div>';

	$('#BCS_siteInfoDiv').html( html );
	siteinfoDiv.style.display = 'block';
*/
	return
}


// **********************************************************************
// **********************************************************************


function BCS_Set_ToolBar_RA () {
		if (RA_CtrlWin.RA.CurrentUser!=null) {
			var html = '';
			if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
				html += '<a href="JavaScript:BCS_TopBar_Account(BCS_site_co);" style="text-decoration:none;"><b>Update my account</b></a>';
			} else {
				html += '<a href="JavaScript:BCS_RAif_init(\'updateprofile\');" style="text-decoration:none;"><b>Update my profile</b></a>';
			}
			$('#BCS_toolbarTDRA2').html(html);
			$('#BCS_toolbarTDRA1').show();
			$('#BCS_toolbarTDRA2').show();
			$('#BCS_toolbarTDRA3').show();
			$('#BCS_toolbarTDRA4').show();
		} else {
			$('#BCS_toolbarTDRA1').hide();
			$('#BCS_toolbarTDRA2').hide();
			$('#BCS_toolbarTDRA3').hide();
			$('#BCS_toolbarTDRA4').hide();
		}
}


// **********************************************************************
// **********************************************************************


function BCS_Draw_ToolBar () {
	return;
	var html = '';
	html += '<TD id="BCS_toolbarTDRA1" class="divider">|</TD>';
	html += '<TD id="BCS_toolbarTDRA2"><a href="JavaScript:BCS_TopBar_Account(BCS_site_co);" style="text-decoration:none;"><b>Update my account</b></a></TD>';
	html += '<TD id="BCS_toolbarTDRA3" class="divider">|</TD>';
	html += '<TD id="BCS_toolbarTDRA4"><a href="JavaScript:BCS_RAif_init(\'dologout\');" style="text-decoration:none;"><b>LOG OUT</b></a></TD>';

	$('#BCS_toolbarTable > TBODY > TR > TD:last').before( html );

	BCS_Set_ToolBar_RA();
}


// **********************************************************************
// **********************************************************************



function BCS_ReDraw_Tabs () {
var msg = '<br/>BCS_ReDraw_Tabs';
msg += '<br/>';
try {
	for (var i=0; i<BCSBSI_site_tabs.length; i++) {
msg += '<br/>'+ BCSBSI_site_tabs[i].ID +' - '+ $('#BCS_tab_'+ BCSBSI_site_tabs[i].ID +'').length;
		var tabTD = $('#BCS_tab_'+ BCSBSI_site_tabs[i].ID +'')[0];
		var tabStat = 'tabOff';
		if (BCS_current_tab.ID == BCSBSI_site_tabs[i].ID) tabStat = 'tabOn';
		tabTD.innerHTML = BCS_getTabHTML( BCSBSI_site_tabs[i], tabStat );
	}
} catch (e) {
	msg += '<br/>ERROR :: '+ e.lineNumber +' - '+ e.message;
}
BFWDATA.logDebug(msg);
BFWDATA.dumpDebug();
}


// **********************************************************************
// **********************************************************************



function BCS_getTabHTML ( tabItem, tabStat ) {
	var html = '';
/*
	if (tabItem.subtype=='INSTRUCTOR') {
		html += '<TABLE class="'+ tabStat +'" onclick="BCS_changeLocation(\''+ BCS_current_tab.ID +'\',\'';
		if (BCS_current_content) {
			html += BCS_current_content.ID;
		}
		html += '\',\'i\')">';
	} else {
		html += '<TABLE class="'+ tabStat +'" onclick="BCS_switchTabs(\''+ tabItem.ID +'\');BCS_historyRecord();">';
	}
*/
	html += '<TABLE class="'+ tabStat +'" onclick="BCS_switchTabs(\''+ tabItem.ID +'\');BCS_historyRecord();">';
	html += '<TBODY>';
	html += '<TR>';
	html += '<TD class="tabLeft" style="BACKGROUND: url('+ BCS_tpl_version +'images/'+ tabStat +'_l.jpg) no-repeat;"></TD>';
	html += '<TD class="tabCenter" style="BACKGROUND: url('+ BCS_tpl_version +'images/'+ tabStat +'_m.jpg) #fff repeat-x;">&nbsp;';
	if (tabItem.subtype!='HOME' && tabItem.subtype!='SCORECARD' && tabItem.subtype!='INSTRUCTOR') {
		var foundAccess = false;
		for (var i=0; i<tabItem.data.length; i++) {
			if (tabItem.data[i].i_d_n=='tab_product') {
				for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
					if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
					if ( tabItem.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID && RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
						foundAccess = true;
					}
					}
				}}
			}
		}
		if (foundAccess) {
			html += '<img border="0" src="'+ BCS_tpl_version +'images/'+ tabStat +'_Unlocked.gif"/>&nbsp;&nbsp;';
		} else {
			html += '<img border="0" src="'+ BCS_tpl_version +'images/'+ tabStat +'_Locked.gif"/>&nbsp;&nbsp;';
		}
	} else if (tabItem.subtype=='SCORECARD') {
		html += '<img border="0" src="'+ BCS_tpl_version +'images/'+ tabStat +'_Scorecard.gif"/>&nbsp;&nbsp;';
	} else if (tabItem.subtype=='INSTRUCTOR') {
		html += '<img border="0" src="'+ BCS_tpl_version +'images/'+ tabStat +'_IR.gif"/>&nbsp;&nbsp;';
	}
	html += tabItem.title;
	html += '&nbsp;</TD>';
	html += '<TD class="tabRight" style="BACKGROUND: url('+ BCS_tpl_version +'images/'+ tabStat +'_r.jpg) no-repeat left top;"></TD>';
	html += '</TR></TBODY></TABLE>';
	return html;
}


// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_HomeUser () {
 // debugger;
	if (BCS_tpl_style != 'B') {
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// USER MODULE

		var hasProducts_ct = 0;
		var products_ct = 0;

		for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				products_ct ++;
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
					hasProducts_ct ++;
				}
				break;
			case 'RA SITE' :
				products_ct ++;
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
					hasProducts_ct ++;
				}
				break;
			case 'RA PACKAGE' :
				break;
			case 'RA PACKAGE SITE' :
				products_ct ++;
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
					hasProducts_ct ++;
				}
				break;
			default :
			}
		}}

		var html = '';

		html = '';

		if (RA_CtrlWin.RA.CurrentSiteAccess(20) <= 10) {

			$('#BCS_Mod_HomeUser_Loading').hide();
			$('#BCS_Mod_HomeUser_Login').show();
			$('#BCS_Mod_HomeUser_LoggedIn').hide();

		} else { //RA_CtrlWin.RA.CurrentSiteAccess(20) > 10

			// ---------------------------------------------------------------------------------
			if (hasProducts_ct == 0) {

html += BCS_GetHTML_UpgradePrompt();

			// ---------------------------------------------------------------------------------
			} else if (hasProducts_ct == products_ct) {

				var tmpct = 0;
				var displayRowsArr = new Array();
				for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
					if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
						switch (RA_CtrlWin.RA.Products[iprod].Type) {
						case 'RA CONTENT' :
							if ( tmpct==0 ) {
								displayRowsArr[displayRowsArr.length] = new Array();
							}
							displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

							tmpct ++;
							if (tmpct==2) tmpct = 0;
							break;
						case 'RA SITE' :
							if ( tmpct==0 ) {
								displayRowsArr[displayRowsArr.length] = new Array();
							}
							displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

							tmpct ++;
							if (tmpct==2) tmpct = 0;
							break;
						case 'RA PACKAGE' :
							break;
						case 'RA PACKAGE SITE' :
							if ( tmpct==0 ) {
								displayRowsArr[displayRowsArr.length] = new Array();
							}
							displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

							tmpct ++;
							if (tmpct==2) tmpct = 0;
							break;
						default :
						}
					}
				}}
html += '<table class="BCS_tabModv1_TBL" width="100%" border="0" cellpadding="0" cellspacing="0">';
				for (var i=0; i<displayRowsArr.length; i++) {
					if (i==0) {
html += '<tr>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" width="50%" style="padding-left:5px">';

html += displayRowsArr[i][0].DisplayAll('unlocked');

html += '</td>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" style="padding-left:35px">';
						if (displayRowsArr[i][1]) {

html += displayRowsArr[i][1].DisplayAll('unlocked');

						} else {
	html += '&nbsp;';
						}
html += '</td>';
html += '</tr>';


					} else {
html += '<tr>';
html += '<td width="50%" class="BCS_tabModv1_TBL_TD_nospace" style="padding-left:5px">';

html += displayRowsArr[i][0].DisplayAll('unlocked');

html += '</td>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" style="padding-left:35px">';
						if (displayRowsArr[i][1]) {

html += displayRowsArr[i][1].DisplayAll('unlocked');

						} else {
	html += '&nbsp;';
						}
html += '</td>';
html += '</tr>';
					}
				}
html += '</table>';


			// ---------------------------------------------------------------------------------
			} else { //hasProducts_ct != 0 && hasProducts_ct != products_ct

html += '<table class="BCS_tabModv1_TBL" width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" width="50%" style="padding-left:5px">';
				var tmpct = 0;
				for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
					if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
						switch (RA_CtrlWin.RA.Products[iprod].Type) {
						case 'RA CONTENT' :
							tmpct ++;
							if (tmpct == 1) {
	html += RA_CtrlWin.RA.Products[iprod].DisplayAll('unlocked');
							}
							break;
						case 'RA SITE' :
							tmpct ++;
							if (tmpct == 1) {
	html += RA_CtrlWin.RA.Products[iprod].DisplayAll('unlocked');
							}
							break;
						case 'RA PACKAGE' :
							break;
						case 'RA PACKAGE SITE' :
							tmpct ++;
							if (tmpct == 1) {
	html += RA_CtrlWin.RA.Products[iprod].DisplayAll('unlocked');
							}
							break;
						default :
						}
					}
				}}
html += '</td>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" style="text-align:right;padding-right:10px;">';

html += BCS_GetHTML_UpgradePrompt_2();

html += '</td>';
html += '</tr>';

				tmpct = 0;
				var firstct = true;
				var displayRowsArr = new Array();
				for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
					if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
						if (firstct) {
							firstct = false;
						} else {
							switch (RA_CtrlWin.RA.Products[iprod].Type) {
							case 'RA CONTENT' :
								if ( tmpct==0 ) {
									displayRowsArr[displayRowsArr.length] = new Array();
								}
								displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

								tmpct ++;
								if (tmpct==2) tmpct = 0;
								break;
							case 'RA SITE' :
								if ( tmpct==0 ) {
									displayRowsArr[displayRowsArr.length] = new Array();
								}
								displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

								tmpct ++;
								if (tmpct==2) tmpct = 0;
								break;
							case 'RA PACKAGE' :
								break;
							case 'RA PACKAGE SITE' :
								if ( tmpct==0 ) {
									displayRowsArr[displayRowsArr.length] = new Array();
								}
								displayRowsArr[displayRowsArr.length-1][tmpct] = RA_CtrlWin.RA.Products[iprod];

								tmpct ++;
								if (tmpct==2) tmpct = 0;
								break;
							default :
							}
						}
					}
				}}
				for (var i=0; i<displayRowsArr.length; i++) {
html += '<tr>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" width="50%" style="padding-left:5px">';

html += displayRowsArr[i][0].DisplayAll('unlocked');

html += '</td>';
html += '<td class="BCS_tabModv1_TBL_TD_nospace" style="padding-left:35px">';
						if (displayRowsArr[i][1]) {
	html += '<DIV class="BCS_productBox_topDiv">';
	html += '<DIV class="BCS_productBox_topDivInner">';
			html += '<TABLE class="BCS_productBox_Tbl" border="0"><TBODY>';
			html += '<TR>';
				if (i==0) {
			html += '<TD class="BCS_productBox_txlr">&nbsp;</TD>';
			html += '<TD class="BCS_productBox_txc">&nbsp;</TD>';
			html += '<TD class="BCS_productBox_txyr">&nbsp;</TD>';
				} else {
			html += '<TD class="BCS_productBox_t_Xlr">&nbsp;</TD>';
			html += '<TD class="BCS_productBox_t_Xc">&nbsp;</TD>';
			html += '<TD class="BCS_productBox_tyr">&nbsp;</TD>';
				}
			html += '</TR>';
			html += '</TBODY></TABLE>';
	html += '</DIV>';
	html += '</DIV>';
	html += '<DIV class="BCS_productBox_botDiv">';
	html += '<DIV class="BCS_productBox_botDivInner">';
			html += '<TABLE class="BCS_productBox_Tbl" border="0"><TBODY>';
			html += '<TR>';
			html += '<TD class="BCS_productBox_bxlr">&nbsp;</TD>';
			html += '<TD class="BCS_productBox_bxc">';
html += displayRowsArr[i][1].DisplayAll('unlocked');
			html += '</TD>';
			html += '<TD class="BCS_productBox_bxyr">&nbsp;</TD>';
			html += '</TR>';
			html += '</TBODY></TABLE>';
	html += '</DIV>';
	html += '</DIV>';
						} else {
	html += '&nbsp;';
						}
html += '</td>';
html += '</tr>';

				}
html += '</table>';


			}//hasProducts_ct != 0 && hasProducts_ct != products_ct
			// ---------------------------------------------------------------------------------
			// ---------------------------------------------------------------------------------
           //alert("Check Html"+html);
		   $('#BCS_Mod_HomeUser_Loading').hide();
            
			
			$('#BCS_Mod_HomeUser_Login').hide();
			$('#BCS_Mod_HomeUser_LoggedIn').html( html );
			$('#BCS_Mod_HomeUser_LoggedIn').show();

			$('#BCS_Mod_HomeUser_Loading_check').hide();
            
			
			$('#BCS_Mod_HomeUser_Login_check').hide();
			$('#BCS_Mod_HomeUser_LoggedIn_check').html( html );
			$('#BCS_Mod_HomeUser_LoggedIn_check').show();
             if(hasProducts_ct!=0)
			{
			$('#BCS_Mod_User_Check').show();
			}

			

		} //RA_CtrlWin.RA.CurrentSiteAccess(20)


	} //if (BCS_tpl_style != 'B')

}


// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_HomeContent () {
//debugger;
	var x = BFWDATA.findItemsByType('BCS TAB MODULE','CONTENT');
//alert(x.length);
	var tmpMod_Content = x[0];
//alert(tmpMod_Content.ID);

	var html = '';

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// EXPAND/COLLAPSE MODULE
	html = '';
	html += '<div style="display:inline;padding-top:1px;vertical-align:middle"><a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(1,'+tmpMod_Content.ID+')">';
	html += '<img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/expand.gif" border="0"/></a></div>';
	html += '&nbsp;<a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(1,'+tmpMod_Content.ID+')">expand all</a>';
	html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	html += '<div style="display:inline;padding-top:1px;vertical-align:middle"><a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(0,'+tmpMod_Content.ID+')">';
	html += '<img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/collapse.gif" border="0"/></a></div>';
	html += '&nbsp;<a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(0,'+tmpMod_Content.ID+')">collapse all</a>';
	$('#BCS_Mod_HomeExpCol').html( html );
//	$('#BCS_Mod_HomeExpCol').show();

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TREES
// ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** 
// CREATE TREE NODES FOR TAB MOD TREES TOP-LEVEL CHILDREN
//BFWDATA.resetDebug();
	for (var i=0; i<tmpMod_Content.items.length; i++) {
//alert( i +' - '+ tmpMod_Content.items[i] +' - '+ tmpMod_Content.items[i].ID );
		setTimeout('BCS_GetHTML_ModTree( \''+ tmpMod_Content.items[i].ID +'\',\''+ tmpMod_Content.items[i].ID +'\', 0 );', 50);
//		BCS_GetHTML_ModTree( tmpMod_Content.items[i].ID, tmpMod_Content.items[i], 0 );
	}

}


// **********************************************************************

function BCS_GetHTML_UpgradePrompt () {
	var html = '';
html += '<table class="BCS_premUpgrade_Tbl"><tr>';
html += '<td>';
html += '<div><p>';
html += '<img src="'+ BCS_tpl_version +'images/BCS_premium_unlock.jpg" border="0"/>';
html += '</p>';
html += '</div>';
html += '</td>';
html += '</tr></table>';
	return html;
}


// **********************************************************************

function BCS_GetHTML_UpgradePrompt_2 () {
	var html = '';
html += '<TABLE class="BCS_premUnlockMore_Table"><TBODY>';
html += '<TR>';
html += '<TD class="BCS_premUnlockMore_Table_l">&nbsp;</TD>';
html += '<TD class="BCS_premUnlockMore_Table_r">';
html += '<nobr>To unlock additional<br/>Premium Resources, upgrade<br/>your access here.</nobr>';
html += '</TD>';
html += '</TR>';
html += '</TBODY></TABLE>';
	return html;
}


// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_HomeProducts () {
//debugger;
if (BCS_tpl_style != 'B') {

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// PRODUCTS MODULE

	var hasProducts_ct = 0;
	var products_ct = 0;

	for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
		switch (RA_CtrlWin.RA.Products[iprod].Type) {
		case 'RA CONTENT' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		case 'RA SITE' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		case 'RA PACKAGE' :
			products_ct ++;
			if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
				hasProducts_ct ++;
			}
			break;
		case 'RA PACKAGE SITE' :
			break;
		default :
		}
	}}

	var html = '';
 
	if (hasProducts_ct == products_ct) {

		$('#BCS_Mod_HomeProducts_NotUnlocked').hide();
		//$('#BCS_Mod_HomeProducts_AllUnlocked').show();
		$('#BCS_Mod_User').show();
       $('#BCS_Mod_User_Check').hide();

	   var Margin_Reset_Callout= document.getElementById("BCS_callout_div1");
	  
	 /*  if(Margin_Reset_Callout!=null)
		{
				$('#BCS_Mod_User').hide();
			 $('#BCS_Mod_User_Check').show();

			 Margin_Reset_Callout.style.margin='0px';
		}*/


		 if(hasProducts_ct==0 && products_ct==0)
		{
	  
				$('#BCS_Mod_User').hide();
				 if(Margin_Reset_Callout!=null)
					{
						$('#BCS_Mod_User').hide();
					// $('#BCS_Mod_User_Check').show();

					 Margin_Reset_Callout.style.margin='0px';
				}
		}
		else
		{

			 if(Margin_Reset_Callout!=null)
					{
						$('#BCS_Mod_User').hide();
					 $('#BCS_Mod_User_Check').show();

					 Margin_Reset_Callout.style.margin='0px';
				}
			 

		}

	} else { //hasProducts_ct != products_ct

		html = '';

		$('#BCS_Mod_HomeProducts_AllUnlocked').hide();
		$('#BCS_Mod_HomeProducts_Loading').hide();
		$('#BCS_Mod_HomeUser_Loading').hide();
		$('#BCS_Mod_HomeUser_Loading_check').hide();
		$('#BCS_Mod_HomeProducts_NotUnlocked').show();


   

		var buttonhtml='<table border="0" cellpadding="0" cellspacing="0"><TR>'
	buttonhtml+= '<td align="center" valign="middle" style="padding: 16px 0px 3px 3px;">'
buttonhtml+='<a href="JavaScript:void(0);" onclick="BCS_CtrlWin.BCS_RAif_init(\'checkcode\');"><img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/BCS_upgrade_code.jpg" border="0"/></a>'
buttonhtml+='</td><td width="5" rowspan="2" align="center" valign="middle" style=" text-align:center; vertical-align:middle;padding: 3px 3px 3px 8px;">'
buttonhtml+='<img src="images/BCS_upgrade_divider.jpg" border="0"/>'
buttonhtml+='</td><td align="center" valign="middle" style="padding: 16px 3px 3px 3px;">'
buttonhtml+='<a href="JavaScript:void(0);" onclick="PurchaseOnline()"><img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/BCS_upgrade_purchase.jpg" border="0"/></a>'
buttonhtml+='</td></TR>'
buttonhtml+='<TR><td align="center" valign="top" style="padding: 3px 0px 3px 0px;">'
buttonhtml+='<p align="center" style="margin:0px;padding:7px 0px 14px 0px;text-align:center;font-size:11px;font-weight:normal;">'
buttonhtml+='<a href="JavaScript:void(0);" onclick="BCS_CtrlWin.BCS_Help(\'card\');">What is an<br/>access card?</a>'
buttonhtml+='</p>'
buttonhtml+='</td><td align="center" valign="top" style="padding: 3px;">'
buttonhtml+='<p align="center" style="margin:0px;padding:7px 0px 14px 0px;text-align:center;font-size:11px;font-weight:normal;">'
buttonhtml+='<a href="JavaScript:void(0);" onclick="BCS_CtrlWin.BCS_Help(\'purchase\');">What is this?</a>'
buttonhtml+='</p>'
buttonhtml+='</td></TR></table>'
		
		$('#BCS_Mod_HomeProducts_Buttons').html( buttonhtml );
		$('#BCS_Mod_HomeProducts_Buttons').show();
		
			//$('#BCS_Mod_User').show();
		

		html = '';

if (BCS_useCarousel && BCS_carousel_vars!='') {

/*
		html += '<TABLE class="BCS_tabModv2_midDivTable"><TBODY>';
		html += '<TR>';
		html += '<TD class="BCS_tabModv2_midDivLeftTop">&nbsp;</TD>';
		html += '<TD rowspan="2" class="BCS_tabModv2_midDivCenter">';
*/
		html += '<div style="padding:0px;margin:0px;width:238px;">';

		var iprod_ct = 0;
		var iprod_ct2 = 0;
		for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA SITE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA PACKAGE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA PACKAGE SITE' :
				break;
			default :
			}
		}}

		var var1str = '';
		var cboxstr = '';
		iprod_ct2 = 0;
		for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA SITE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA PACKAGE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA PACKAGE SITE' :
				break;
			default :
			}
		}}
//prompt('',var1str);
		var objStr = AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '238',
			'height', '160',
			'src', 'carousel3_HTMLparams_ColorCustom',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'carousel3_HTMLparams_ColorCustom',
			'bgcolor', '#ffffff',
			'name', 'carousel3_HTMLparams_ColorCustom',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'carousel/carousel3_HTMLparams_ColorCustom',
			'flashvars', "var1="+ var1str +"&"+ BCS_carousel_vars +"",
			'salign', ''
		); //end AC code
//prompt('',objStr);
html += objStr;
//alert(objStr);
//html += '<textarea>';
//html += objStr.replace('<','&lt;').replace('>','&gt;');
//html += '</textarea>';
html += '<div id="BCS_carousel_msgBox">'+ cboxstr +'</div>';

if (false) {
html += '<noscript>';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="';
html += '238';
html += '" height="';
html += '286';
html += '" id="carousel3_HTMLparams_ColorCustom" align="middle">';
html += '<param name="allowScriptAccess" value="sameDomain" />';
html += '<param name="allowFullScreen" value="false" />';
html += '<param name="movie" value="'+ BCS_tpl_version +'carousel/carousel3_HTMLparams_ColorCustom.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />';
html += '<param name="flashvars" value="';
html += '';
html += 'var1='+ var1str +'&var2=0xcccccc&var3='+ BCS_tpl_version +'carousel/img/bar.jpg&var4=0x999999" />';
html += '<embed src="'+ BCS_tpl_version +'carousel/carousel3_HTMLparams_ColorCustom.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="';
html += '238';
html += '" height="';
html += '286';
html += '" name="carousel3_HTMLparams_ColorCustom" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
html += 'flashvars="';
html += 'var1='+ var1str +'&var2=0xcccccc&var3='+ BCS_tpl_version +'carousel/img/bar.jpg&var4=0x999999" />';
html += '</object>';
html += '</noscript>';
}

		html += '</div>';
/*
		html += '</TD>';
		html += '<TD class="BCS_tabModv2_midDivRightTop">&nbsp;</TD>';
		html += '</TR>';
		html += '<TR>';
		html += '<TD class="BCS_tabModv2_midDivLeftBot">&nbsp;</TD>';
		html += '<TD class="BCS_tabModv2_midDivRightBot">&nbsp;</TD>';
		html += '</TR>';
		html += '</TBODY></TABLE>';
*/

} else {//!BCS_useCarousel

		for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
			var show = false;
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					show = true;
				}
				break;
			case 'RA SITE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					show = true;
				}
				break;
			case 'RA PACKAGE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					show = true;
				}
				break;
			case 'RA PACKAGE SITE' :
				break;
			default :
			}

			if ( show ) {

		html += '<TABLE class="BCS_tabModv2_midDivTable"><TBODY>';
		html += '<TR>';
		html += '<TD class="BCS_tabModv2_midDivLeftTop">&nbsp;</TD>';
		html += '<TD rowspan="2" class="BCS_tabModv2_midDivCenter">';


html += RA_CtrlWin.RA.Products[iprod].DisplayAll('locked');

		html += '</TD>';
		html += '<TD class="BCS_tabModv2_midDivRightTop">&nbsp;</TD>';
		html += '</TR>';
		html += '<TR>';
		html += '<TD class="BCS_tabModv2_midDivLeftBot">&nbsp;</TD>';
		html += '<TD class="BCS_tabModv2_midDivRightBot">&nbsp;</TD>';
		html += '</TR>';
		html += '</TBODY></TABLE>';

			} else {

		html += '<!-- '+ RA_CtrlWin.RA.Products[iprod].Title +' - ['+ RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() +'] - ';
		html += RA_CtrlWin.RA.Products[iprod].CurrentUserAccess()<20;
		html += ' -->';
			}
		}}

}

		$('#BCS_Mod_HomeProducts_List').html( html );
		$('#BCS_Mod_HomeProducts_List').show();
		// $('#BCS_Mod_User_Check').show();

	} //hasProducts_ct != products_ct
}//if (BCS_tpl_style != 'B')


}


function PurchaseOnline()
{

	BCS_CtrlWin.BCS_RAif_init('cart');
}

// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_InteriorJumpTo () {
 //debugger;
 
	var html = '';
	var html_secondDropDown='';
	var trees = BFWDATA.findItemsByType('BCS TAB MOD TREE');
   	
		for (var i=0; i< trees.length; i++) {
			var xi = BFWDATA.BSIItems[trees[i].PID];
					if (xi.subtype!='PREM TREE') {
						 if( i==0 )
									{
					                    if(trees[i].title && trees[i].title!='')
											{
												 var setValue=document.getElementById('BCS_jumpBox');
												  if(setValue!=null)
													{
													 setValue.options[0].text=trees[i].title;
													}

												 try
												 {
												 var setValue_ContentPopUpPage=document.getElementById('BCS_jumpBox_ContentPopUpPage');
                                                  if(setValue_ContentPopUpPage!=null)
													{
													 setValue_ContentPopUpPage.options[0].text=trees[i].title;
													}
												 }
												 catch (e)
												 {
												 }

												 
											}

										 if(trees[i].title=='')
											{
												 var setValue=document.getElementById('BCS_jumpBox');
												  if(setValue!=null)
													{
												 setValue.options[0].text='select a resource';
													}

												  try
												  {
												  var setValue_ContentPopUpPage=document.getElementById('BCS_jumpBox_ContentPopUpPage');
												   if(setValue_ContentPopUpPage!=null)
													{
												 setValue_ContentPopUpPage.options[0].text='select a resource';
													}
												  }
												  catch (e)
												  {
												  }
											}
									}
								else
									{
										 if(trees[i].title && trees[i].title!='')
											{
												 var setValue=document.getElementById('BCS_jumpBox_second');
												  if(setValue!=null)
													{
												 setValue.options[0].text=trees[i].title;
													}

												 var setValue_ContentPopUpPage=document.getElementById('BCS_jumpBox_second_ContentPopUpPage');
												 if(setValue_ContentPopUpPage!=null)
													{
												 setValue_ContentPopUpPage.options[0].text=trees[i].title;
													}
											}
									}

							for (var j=0; j< trees[i].items.length; j++) {

						             if( i==0 )
										{
											var FinalTitle='';
											var Title=trees[i].items[j].title;

											var TitleIndex=Title.indexOf('<a');
											
											if(TitleIndex!=-1)
											{
												

											  FinalTitle=Title.substring(Title.indexOf('>')+1,Title.indexOf('</a>'));
												
											}
											else
											{
												FinalTitle=Title;
											}
											var TitleLength=FinalTitle.length;
										    var CompressTitle='';
										   
											if(TitleLength>60)
												{
													CompressTitle=FinalTitle.substring(0,60);
											   
													CompressTitle=CompressTitle+"...";
												}

											else
												{
													CompressTitle=FinalTitle;
												}
											
											html += '<OPTION value="'+ trees[i].ID +'_'+ trees[i].items[j].ID +'" title="'+ FinalTitle +'">'+ CompressTitle +'</OPTION>';
											

											}
										else
											{
													var FinalTitle='';
													var Title=trees[i].items[j].title;

													var TitleIndex=Title.indexOf('<a');
											
													if(TitleIndex!=-1)
													{
													  FinalTitle=Title.substring(Title.indexOf('>')+1,Title.indexOf('</a>'));
													}
													else
													{
														FinalTitle=Title;
													}

													var TitleLength=FinalTitle.length;
												    var CompressTitle='';
													 if(TitleLength>60)
														{
														  CompressTitle=FinalTitle.substring(0,60);
														   CompressTitle=CompressTitle+"...";
														}

													else	
														{
								                           CompressTitle=FinalTitle;
														}
											
											
											html_secondDropDown += '<OPTION value="'+ trees[i].ID +'_'+ trees[i].items[j].ID +'" title="'+ FinalTitle +'">'+ CompressTitle +'</OPTION>';
										}

						}
			}
	}


	for (var i=0; i<BCSBSI_site_tabs.length; i++) {
		if ( BCSBSI_site_tabs[i].subtype != 'HOME') {

		}
	}
  if(html!='')
	{
   $('#BCS_jumpBox').show();
	$('#BCS_jumpBox').append( html );

	 $('#BCS_jumpBox_ContentPopUpPage').show();
	$('#BCS_jumpBox_ContentPopUpPage').append( html );
	}

	if(html_secondDropDown!='')
	{
		
   $('#BCS_jumpBox_second').show();
		   $('#BCS_jumpBox_second_ContentPopUpPage').show();
    var second_drpdown= document.getElementById("BCS_jumpBox_second");
 var second_drpdown_ContentPopUpPage= document.getElementById("BCS_jumpBox_second_ContentPopUpPage");
 if(second_drpdown!=null)
		{
			 second_drpdown.style.marginLeft='15px';
		}

		if(second_drpdown_ContentPopUpPage!=null)
		{
			 second_drpdown_ContentPopUpPage.style.marginLeft='15px';
		}


	$('#BCS_jumpBox_second').append( html_secondDropDown );
	$('#BCS_jumpBox_second_ContentPopUpPage').append( html_secondDropDown );
	}
}

// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_InteriorBreadcrumb () {
//alert( BCS_current_content +' - '+ BCS_current_content +' - '+ BCS_current_content.ID +' - '+ BCS_current_content.PID +' - '+ BCS_current_content.PID +' - '+ BFWDATA.BSIItems[BCS_current_content.PID] );
	var htmlCrumb = '';
	htmlCrumb += '<nobr>'+ BCS_current_content.title +'</nobr>';

	var xi = BFWDATA.BSIItems[BCS_current_content.PID];
	//alert("asdas"+BCS_current_tab.subtype + "dsgg"+BCSBSI_home_tab.subtype);
	if (BCS_current_tab != BCSBSI_home_tab) {
		//BCS_Draw_PageMod_Premium();
//		while ( BFWDATA.BSIItems[xi.PID] && (xi.type=='bfw_toc_document' && xi.subtype !='root') || xi.type=='BCS TAB MODULE' || xi.type=='BCS TAB MOD TREE' ) {
		while ( BFWDATA.BSIItems[xi.PID] && (xi.type=='bfw_toc_document' && xi.subtype !='root') ) {
			if (xi.title) {
			if (xi.title != '') {
				htmlCrumb = '<nobr><a class="NavTree_'+ xi.ID +'_loadNodeBreadcrumb" id="NavTree_'+ xi.ID +'_loadNodeBreadcrumb_'+ xi.ID +'" href="JavaScript:BCS_NavTree_LoadNode2(\''+ xi.ID +'\', '+ xi.ID +', 0)">'+ xi.title + '</a></nobr> / '+ htmlCrumb;
				//alert("Prem bredcrumb"+htmlCrumb);
			}
			}
			xi = BFWDATA.BSIItems[xi.PID];
		}
		htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCS_current_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCS_current_tab.title + '</a> / '+ htmlCrumb;
	$('#BCS_breadcrumb').html( htmlCrumb );
	} else {
		
		while ( BFWDATA.BSIItems[xi.PID] && xi.type=='bfw_toc_document' && xi.subtype !='root' ) {
			htmlCrumb = '<nobr><a class="NavTree_'+ xi.ID +'_loadNodeBreadcrumb" id="NavTree_'+ xi.ID +'_loadNodeBreadcrumb_'+ xi.ID +'" href="JavaScript:BCS_NavTree_LoadNode2(\''+ xi.ID +'\', '+ xi.ID +', 0)">'+ xi.title + '</a></nobr> / '+ htmlCrumb;
			xi = BFWDATA.BSIItems[xi.PID];
		}
	//	htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCSBSI_home_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCSBSI_home_tab.title + '</a> / '+ htmlCrumb;
	//$('#BCS_breadcrumb').html( htmlCrumb );

	}

	htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCSBSI_home_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCSBSI_home_tab.title + '</a> / '+ htmlCrumb;
	$('#BCS_breadcrumb').html( htmlCrumb );

}


// **********************************************************************


function BCS_Draw_PageMod_ScBreadcrumb () {

	var htmlCrumb = '';
	htmlCrumb += '<nobr>'+ BCS_current_tab.title +'</nobr>';

	htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCSBSI_home_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCSBSI_home_tab.title + '</a> / '+ htmlCrumb;

	$('#BCS_breadcrumb').html( htmlCrumb );

}


// **********************************************************************


function BCS_Draw_PageMod_IRBreadcrumb () {

	var htmlCrumb = '';
	htmlCrumb += '<nobr>'+ BCS_current_tab.title +'</nobr>';

	htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCSBSI_home_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCSBSI_home_tab.title + '</a> / '+ htmlCrumb;

	$('#BCS_breadcrumb').html( htmlCrumb );

}


// **********************************************************************


function BCS_Draw_PageMod_IR () {
	if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
		var the_if = $('#BCS_IR_if')[0];
		var url = '/cache/IR/'+ BCS_CtrlWin.BCS_site_catalogISBN +'.InstructorResource.html'
//alert( the_if +' - '+ url );
		the_if.src = url;
		$('#BCS_Mod_IR_Anonymous').hide();
		$('#BCS_Mod_IR_Basic').hide();
		$('#BCS_Mod_IR_Instructor').show();
	} else if (RA_CtrlWin.RA.CurrentSiteAccess() > 10) {
		$('#BCS_Mod_IR_Anonymous').hide();
		$('#BCS_Mod_IR_Instructor').hide();
		var html = '';
		if (RA_CtrlWin.RA.CurrentSiteAccess() >= 20 && RA_CtrlWin.RA.CurrentUser.OnyxStatus == 1) {
	html += '<p>Hello '+ RA_CtrlWin.RA.CurrentUser.FName+' '+RA_CtrlWin.RA.CurrentUser.LName +'. We&#x0027;ve received your request for an instructor account &mdash; it can take up to 48 hours to approve. You should receive an e-mail with log-in information soon. </p>';
	html += '<p>If you requested instructor access more than 48 hours ago, please contact tech support at [<a href="mailto:techsupport@bfwpub.com">techsupport@bfwpub.com</a>] or 800-936-6899.</p>';
		} else if (RA_CtrlWin.RA.CurrentSiteAccess() >= 20) {
	html += '<p>Hi '+ RA_CtrlWin.RA.CurrentUser.FName+' '+RA_CtrlWin.RA.CurrentUser.LName +'. You are logged in as a student. You need an instructor account to download PDFs, order complimentary exam copies, and access all your student and instructor resources; it can take up to 48 hours to verify your instructor status. Create an instructor account or <a href="JavaScript:BCS_IR_ILogin_go()">log in here.</a></p>';
		} else {
	html += '';
		}
		$('#BCS_Mod_IR_Basic').html(html);
		$('#BCS_Mod_IR_Basic').show();
	} else {
		setTimeout('BCS_IR_ILogin_go();',500);
	}
}

function BCS_IR_ILogin_go () {
	var the_if = $('#BCS_IR_ILogin_if')[0];
	var url = BCS_GetILoginURL('it');
//alert( the_if +' - '+ url );
	the_if.src = url;
	$('#BCS_Mod_IR_Basic').hide();
	$('#BCS_Mod_IR_Instructor').hide();
	$('#BCS_Mod_IR_Anonymous').show();
}

// **********************************************************************


function BCS_Draw_PageMod_InstUser () {
//alert('BCS_Draw_PageMod_InstUser: '+ RA_CtrlWin.RA.CurrentSiteAccess());
	if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
		$('#BCS_Mod_IB_Anonymous').hide();
		$('#BCS_Mod_IB_Basic').hide();
		$('#BCS_Mod_IB_Instructor').show();
		$('#BCS_Mod_IB_GB_Anonymous').hide();
		$('#BCS_Mod_IB_GB_Instructor').show();
		$('#BCS_Mod_IB_MS_Anonymous').hide();
		$('#BCS_Mod_IB_MS_Instructor').show();
	} else if (RA_CtrlWin.RA.CurrentSiteAccess() > 10) {
		$('#BCS_Mod_IB_Anonymous').hide();
		$('#BCS_Mod_IB_Basic').show();
		$('#BCS_Mod_IB_Instructor').hide();
		$('#BCS_Mod_IB_GB_Anonymous').show();
		$('#BCS_Mod_IB_GB_Instructor').hide();
		$('#BCS_Mod_IB_MS_Anonymous').show();
		$('#BCS_Mod_IB_MS_Instructor').hide();
	} else {
		$('#BCS_Mod_IB_Anonymous').show();
		$('#BCS_Mod_IB_Basic').hide();
		$('#BCS_Mod_IB_Instructor').hide();
		$('#BCS_Mod_IB_GB_Anonymous').show();
		$('#BCS_Mod_IB_GB_Instructor').hide();
		$('#BCS_Mod_IB_MS_Anonymous').show();
		$('#BCS_Mod_IB_MS_Instructor').hide();
	}
}


// **********************************************************************

var BCS_if_loaded = false;
function BCS_Draw_PageMod_ScUser () {
	if (RA_CtrlWin.RA.CurrentSiteAccess() > 10) {
		$('#BCS_Mod_Sc_Anonymous').hide();
		if (RA_CtrlWin.RA.CurrentSiteAccess() >= 40) {
			$('#BCS_Mod_Sc_Instructor').show();
		} else {
			$('#BCS_Mod_Sc_Instructor').hide();
		}
		$('#BCS_Mod_Sc').show();
		var scurl = BCS_GetURL_Scorecard();
		if (!jQuery.support.isIE7) {
			var Sc = $('#BCS_Sc_if')[0];
//if (RA_CtrlWin.RA.dev_check()) {
//alert( Sc +' - '+ scurl );
//}
			BCS_if_loaded = true;
			Sc.src = scurl;
		} else {
			$('#BCS_Sc_if').hide();
			var html = '';
			if ($('#BCS_Sc_IE7').length == 0) {
				html = '<p id="BCS_Sc_IE7"></p>';
				$('#BCS_Sc_if').after( html );
			}
			html = 'If your scorecard doesn\'t open in a new window in a few seconds, <a href="'+ scurl +'" target="sc">click here</a>.';
			$('#BCS_Sc_IE7').html( html );
			var sc_win = null;
			sc_win = window.open(scurl,'sc');
			sc_win.focus();
		}
	} else {
		$('#BCS_Mod_Sc_Instructor').hide();
		$('#BCS_Mod_Sc').hide();
		$('#BCS_Mod_Sc_Anonymous').show();
	}
}


// **********************************************************************
// **********************************************************************


function BCS_Draw_PageMod_PremBreadcrumb () {

	var htmlCrumb = '';
	htmlCrumb += '<nobr>'+ BCS_current_tab.title +'</nobr>';

	htmlCrumb = '<a href="JavaScript:BCS_CtrlWin.BCS_changeLocation('+ BCSBSI_home_tab.ID +', \'\', \''+ BCS_UserViewMode +'\')">'+ BCSBSI_home_tab.title + '</a> / '+ htmlCrumb;

	$('#BCS_breadcrumb').html( htmlCrumb );

}

// **********************************************************************

function BCS_Draw_PageMod_PremInfo () {
	var tmpTitle = BCS_current_tab.title;
	var tmpText = '';
	for (var i=0; i<BCS_current_tab.data.length; i++) {
		switch (BCS_current_tab.data[i].i_d_n) {
//		case 'tab_longtitle' :
//			tmpTitle = BCS_current_tab.data[i].i_d_v;
//			break;
		case 'tab_text' :
			tmpText = BCS_current_tab.data[i].i_d_v;
			break;
		}
	}
//	$('#BCS_Mod_Prem_Title').html( tmpTitle );
	$('#BCS_Mod_Prem_Text').html( tmpText );
}

// **********************************************************************

function BCS_Draw_PageMod_PremUser () {

	debugger;
	var hasProducts_ct = 0;
	var products_ct = 0;
	var treeProducts_ct = 0;
	var hasNonTreeProducts_ct = 0;

	for (var i=0; i<BCS_current_tab.data.length; i++) {
		if (BCS_current_tab.data[i].i_d_n=='tab_product') {
			for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
				switch (RA_CtrlWin.RA.Products[iprod].Type) {
				case 'RA CONTENT' :
					if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
					if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
						products_ct ++;
						treeProducts_ct ++;
						if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
							hasProducts_ct ++;
						}
					}
					}
					break;
				case 'RA SITE' :
					if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
					if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
						products_ct ++;
						if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
							hasProducts_ct ++;
							hasNonTreeProducts_ct ++;
						}
					}
					}
					break;
				case 'RA PACKAGE' :
					break;
				case 'RA PACKAGE SITE' :
					if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
					for (var ipack in RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments) {if (RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments.hasOwnProperty(ipack)) {
						if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments[ipack].Package.ID ) {
							products_ct ++;
							if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() > 20 ) {
								hasProducts_ct ++;
								hasNonTreeProducts_ct ++;
							}
						}
					}}
					}
					break;
				default :
				}
			}}
		}
	}

	var html = '';

if (BCS_useCarousel && BCS_carousel_vars!='') {

		html += '<div style="padding:0px;margin:0px;width:238px;">';

		var iprod_ct = 0;
		var iprod_ct2 = 0;
		for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA SITE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA PACKAGE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct ++;
				}
				break;
			case 'RA PACKAGE SITE' :
				break;
			default :
			}
		}}

		var var1str = '';
		var cboxstr = '';
		iprod_ct2 = 0;
	for (var i=0; i<BCS_current_tab.data.length; i++) {
		if (BCS_current_tab.data[i].i_d_n=='tab_product') {
			for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
				if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
				if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
			switch (RA_CtrlWin.RA.Products[iprod].Type) {
			case 'RA CONTENT' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox2');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA SITE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox2');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA PACKAGE' :
				if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() <= 20 ) {
					iprod_ct2 ++;
var1str += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselvars');
cboxstr += RA_CtrlWin.RA.Products[iprod].DisplayAll('carouselbox2');
					if (iprod_ct2<iprod_ct) {
var1str += ';';
					}
				}
				break;
			case 'RA PACKAGE SITE' :
				break;
			default :
			}
				}
				}
			}}
		}
	}
		var objStr = AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '238',
			'height', '160',
			'src', 'carousel3_HTMLparams_ColorCustom',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'carousel3_HTMLparams_ColorCustom',
			'bgcolor', '#ffffff',
			'name', 'carousel3_HTMLparams_ColorCustom',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'carousel/carousel3_HTMLparams_ColorCustom',
			'flashvars', "var1="+ var1str +"&"+ BCS_carousel_vars +"",
			'salign', ''
		); //end AC code
html += objStr;
//alert(objStr);
//html += '<textarea>';
//html += objStr.replace('<','&lt;').replace('>','&gt;');
//html += '</textarea>';
html += '<div id="BCS_carousel_msgBox_PremTab">'+ cboxstr +'</div>';

if (false) {
html += '<noscript>';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="';
html += '238';
html += '" height="';
html += '286';
html += '" id="carousel3_HTMLparams_ColorCustom" align="middle">';
html += '<param name="allowScriptAccess" value="sameDomain" />';
html += '<param name="allowFullScreen" value="false" />';
html += '<param name="movie" value="'+ BCS_tpl_version +'carousel/carousel3_HTMLparams_ColorCustom.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />';
html += '<param name="flashvars" value="';
html += '';
html += 'var1='+ var1str +'&var2=0xcccccc&var3='+ BCS_tpl_version +'carousel/img/bar.jpg&var4=0x999999" />';
html += '<embed src="'+ BCS_tpl_version +'carousel/carousel3_HTMLparams_ColorCustom.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="';
html += '238';
html += '" height="';
html += '286';
html += '" name="carousel3_HTMLparams_ColorCustom" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
html += 'flashvars="';
html += 'var1='+ var1str +'&var2=0xcccccc&var3='+ BCS_tpl_version +'carousel/img/bar.jpg&var4=0x999999" />';
html += '</object>';
html += '</noscript>';
}

		html += '</div>';

} else {//!BCS_useCarousel

	for (var i=0; i<BCS_current_tab.data.length; i++) {
		if (BCS_current_tab.data[i].i_d_n=='tab_product') {
			for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
				if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
				if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
					if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() < 30 ) {
	html += '<TABLE class="BCS_tabModv2_midDivTable"><TBODY>';
	html += '<TR>';
	html += '<TD class="BCS_tabModv2_midDivLeftTop">&nbsp;</TD>';
	html += '<TD rowspan="2" class="BCS_tabModv2_midDivCenter">';
html += RA_CtrlWin.RA.Products[iprod].DisplayAll('locked');
	html += '</TD>';
	html += '<TD class="BCS_tabModv2_midDivRightTop">&nbsp;</TD>';
	html += '</TR>';
	html += '<TR>';
	html += '<TD class="BCS_tabModv2_midDivLeftBot">&nbsp;</TD>';
	html += '<TD class="BCS_tabModv2_midDivRightBot">&nbsp;</TD>';
	html += '</TR>';
	html += '</TBODY></TABLE>';
					}
				}
				}
			}}
		}
	}

}//BCS_useCarousel

	$('#BCS_Mod_PremProducts_List').html( html );
	$('#BCS_Mod_PremProducts_List').show();
	$('#BCS_Mod_PremProducts_Loading').hide();

	if (RA_CtrlWin.RA.CurrentSiteAccess(20) <= 10) {

		$('#BCS_Mod_PremProducts_AllUnlocked').hide();
		$('#BCS_Mod_PremProducts_NotUnlocked').show();
		$('#BCS_Mod_PremProducts_Buttons').show();
		$('#BCS_Mod_PremUser_Login').show();

	} else { //RA_CtrlWin.RA.CurrentSiteAccess(20) > 10

		$('#BCS_Mod_PremUser_Login').hide();

		if (hasProducts_ct == products_ct) {
if (RA_CtrlWin.RA.dev_check('prem')) alert(1);

			$('#BCS_Mod_PremProducts_NotUnlocked').hide();
			$('#BCS_Mod_PremProducts_Buttons').hide();
			//$('#BCS_Mod_PremProducts_AllUnlocked').show();
			try
			{
				var SetWidth_Prem=document.getElementById('BCS_Mod_PremTree_width');
				SetWidth_Prem.style.width="950px";
			}
			catch (e)
			{
			}

		} else if (hasProducts_ct == products_ct && treeProducts_ct == products_ct ) {
if (RA_CtrlWin.RA.dev_check('prem')) alert(2);

			$('#BCS_Mod_PremProducts_NotUnlocked').hide();
			$('#BCS_Mod_PremProducts_Buttons').hide();
			$('#BCS_Mod_PremProducts_AllUnlocked').show();

		} else { //hasProducts_ct != products_ct
if (RA_CtrlWin.RA.dev_check('prem')) alert(3);

			$('#BCS_Mod_PremProducts_NotUnlocked').show();
			$('#BCS_Mod_PremProducts_AllUnlocked').hide();
			$('#BCS_Mod_PremProducts_Buttons').show();

		} //hasProducts_ct != products_ct

	html = '';

if (RA_CtrlWin.RA.dev_check('prem')) alert(products_ct +' - '+ treeProducts_ct +' - '+ hasProducts_ct +' - '+ hasNonTreeProducts_ct );

		if (treeProducts_ct > 0 && (hasProducts_ct == treeProducts_ct == products_ct)) {

			$('#BCS_Mod_PremUser_List').hide();
			$('#BCS_Mod_PremUser_LoggedIn').hide();
			$('#BCS_Mod_PremUser_Login').hide();

		} else if (hasNonTreeProducts_ct == 0) {

	html += BCS_GetHTML_UpgradePrompt();

			$('#BCS_Mod_PremUser_List').html( html );

			$('#BCS_Mod_PremUser_List').show();
			$('#BCS_Mod_PremUser_LoggedIn').show();

			$('#BCS_Mod_PremUser_Login').hide();

		} else {

	html = '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr>';
			var tmpct = 0;
var shown = new Object();
var shownct = 0;
var str = '';
			for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
shown[RA_CtrlWin.RA.Products[iprod].ID] = false;
			}}
			for (var i=0; i<BCS_current_tab.data.length; i++) {
				if (BCS_current_tab.data[i].i_d_n=='tab_product') {
					for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
str += shownct +' - |'+ RA_CtrlWin.RA.Products[iprod].ID +'| - '+ shown[RA_CtrlWin.RA.Products[iprod].ID] +' - '+ !shown[RA_CtrlWin.RA.Products[iprod].ID];
						switch (RA_CtrlWin.RA.Products[iprod].Type) {
						case 'RA CONTENT' :
							break;
						case 'RA SITE' :
							if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
							if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
								tmpct ++;
								if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() >= 30 ) {
									if (tmpct != 1 && tmpct % 2 != 0) {
	html += '</tr><tr>';
									}
	html += '<td width="50%" style="padding-bottom:20px">';
	html += RA_CtrlWin.RA.Products[iprod].DisplayAll('tab');
	html += '</td>';
shownct++;
shown[RA_CtrlWin.RA.Products[iprod].ID] = true;
str += shown[RA_CtrlWin.RA.Products[iprod].ID] +'\n';
								}
							}
							}
							break;
						case 'RA PACKAGE' :
str += shownct +' - |'+ RA_CtrlWin.RA.Products[iprod].ID +'| - '+ shown[RA_CtrlWin.RA.Products[iprod].ID] +' - '+ !shown[RA_CtrlWin.RA.Products[iprod].ID] +'\n';
							break;
						case 'RA PACKAGE SITE' :
							if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
							for (var ipack in RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments) {if (RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments.hasOwnProperty(ipack)) {
								if ( BCS_current_tab.data[i].i_d_v == RA_CtrlWin.RA.Products[iprod].TypeObj.PackageAssignments[ipack].Package.ID ) {
									tmpct ++;
									if ( RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() >= 30 ) {
if (!shown[RA_CtrlWin.RA.Products[iprod].ID]) {

											if (tmpct != 1 && tmpct % 2 != 0) {
	html += '</tr><tr>';
											}
	html += '<td width="50%" style="padding-bottom:20px">';
	html += RA_CtrlWin.RA.Products[iprod].DisplayAll('tab');
	html += '</td>';
shownct++;
shown[RA_CtrlWin.RA.Products[iprod].ID] = true;
str += shown[RA_CtrlWin.RA.Products[iprod].ID] +'\n';
}
									}
								}
							}}
							}
							break;
						default :
						}
					}}
				}
			}
			if (tmpct % 2 != 0) {
	html += '<td width="20%">&nbsp;</td>';
			}
	html += '</tr></tbody></table>';

for (var i in shown) {if (shown.hasOwnProperty(i)) {
str += i +' - '+ shown[i] +'\n';
}}
//alert(str);

			$('#BCS_Mod_PremUser_List').html( html );

			$('#BCS_Mod_PremUser_List').show();
			$('#BCS_Mod_PremUser_LoggedIn').show();

			$('#BCS_Mod_PremUser_Login').hide();

		}



	} //RA_CtrlWin.RA.CurrentSiteAccess(20) > 10

	$('#BCS_Mod_PremUser_Loading').hide();

}

// **********************************************************************

function BCS_Draw_PageMod_PremTrees () {
	//debugger;
var msg = '<br/>BCS_Draw_PageMod_PremTrees<br/>';
	var x = BFWDATA.findItemsByType('BCS TAB MODULE','PREM TREE');


	var tmpMod_Trees = x;

//alert(tmpMod_Trees.length);

	var html = '';
	for (var i=0; i<tmpMod_Trees.length; i++) {
//alert( '#BCS_Mod_PremTree_'+ tmpMod_Trees[i].ID +' --- '+ $('#BCS_Mod_PremTree_'+ tmpMod_Trees[i].ID ).length );
		if ( BCS_current_tab.ID == tmpMod_Trees[i].PID ) {
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// EXPAND/COLLAPSE MODULE
			html = '';
			html += '<div style="display:inline;padding-top:1px;vertical-align:middle"><a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(1,'+tmpMod_Trees[i].ID+')">';
			html += '<img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/expand.gif" border="0"/></a></div>';
			html += '&nbsp;<a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(1,'+tmpMod_Trees[i].ID+')">expand all</a>';
			html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
			html += '<div style="display:inline;padding-top:1px;vertical-align:middle"><a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(0,'+tmpMod_Trees[i].ID+')">';
			html += '<img src="'+ BCS_CtrlWin.BCS_tpl_version +'images/collapse.gif" border="0"/></a></div>';
			html += '&nbsp;<a href="JavaScript:BCS_CtrlWin.BCS_ExpColAll(0,'+tmpMod_Trees[i].ID+')">collapse all</a>';
			$('#BCS_Mod_PremExpCol_'+ tmpMod_Trees[i].ID).html( html );

          
			$('#BCS_Mod_PremTree_'+ tmpMod_Trees[i].ID ).show()
					$('#BCS_Mod_PremTree_width').show();

			var treeProdID = 0;
			var hasAccess = false;
			for (var j=0; j<tmpMod_Trees[i].data.length; j++) {
	msg += 'i_d_n ('+ tmpMod_Trees[i].data[j].i_d_n +') = '+ tmpMod_Trees[i].data[j].i_d_v;
	msg += '<br/>';
				if (tmpMod_Trees[i].data[j].i_d_n=='tree_product') {
					treeProdID = tmpMod_Trees[i].data[j].i_d_v;
				}
			}
	msg += 'treeProdID :: '+ treeProdID;
	msg += '<br/>';
			for (var iprod in RA_CtrlWin.RA.Products) {if (RA_CtrlWin.RA.Products.hasOwnProperty(iprod)) {
//str += shownct +' - |'+ RA_CtrlWin.RA.Products[iprod].ID +'| - '+ shown[RA_CtrlWin.RA.Products[iprod].ID] +' - '+ !shown[RA_CtrlWin.RA.Products[iprod].ID];
				switch (RA_CtrlWin.RA.Products[iprod].Type) {
				case 'RA CONTENT' :
	msg += 'RA CONTENT :: ';
					if (RA_CtrlWin.RA.Products[iprod].TypeObj) {
	msg += 'has TypeObj :: '+ RA_CtrlWin.RA.Products[iprod].TypeObj.ID +' :: ';
					if ( treeProdID == RA_CtrlWin.RA.Products[iprod].TypeObj.ID ) {
	msg += 'matches treeProdID';
						hasAccess = RA_CtrlWin.RA.Products[iprod].CurrentUserAccess() >= 30 ? true : false;
					}
					}
				default :
				}
	msg += '<br/>';
			}}
			html = '';
			if ( hasAccess ) {
		html += '<img src="'+ BCS_tpl_version +'images/BCS_premium_unlocked.gif" border="0" alt="unlocked icon"/>';
			} else {
		html += '<img src=\''+ BCS_tpl_version +'images/BCS_upgrade_locked2.gif\' border=\'0\' alt=\'locked icon\'>';
			}
$('#BCS_Mod_PremTree_TitleLock_'+ tmpMod_Trees[i].ID ).html( html );
$('#BCS_Mod_PremTree_TitleLock_'+ tmpMod_Trees[i].ID ).show();
try {
BFWDATA.logDebug(msg);
BFWDATA.dumpDebug();
} catch(e) {
var msg = '<br/>ERROR :: '+ e.lineNumber +' - '+ e.message;
BFWDATA.logDebug(msg);
BFWDATA.dumpDebug();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TREES
// ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** 
// CREATE TREE NODES FOR TAB MOD TREES TOP-LEVEL CHILDREN
//BFWDATA.resetDebug();
			for (var j=0; j<tmpMod_Trees[i].items.length; j++) {
//alert( j +' - '+ tmpMod_Trees[i].items[j] +' - '+ tmpMod_Trees[i].items[j].ID );
				setTimeout('BCS_GetHTML_ModTree( \''+ tmpMod_Trees[i].items[j].ID +'\',\''+ tmpMod_Trees[i].items[j].ID +'\', 0 );', 50);
//				BCS_GetHTML_ModTree( tmpMod_Trees[i].items[j].ID, tmpMod_Trees[i].items[j], 0 );
			}

/*
*/
		} else {
			$('#BCS_Mod_PremTree_'+ tmpMod_Trees[i].ID ).hide()
				$('#BCS_Mod_PremTree_width').hide();
		}

	}

}


// **********************************************************************
// **********************************************************************


function BCS_GetFormatText (i_full_format) {
	var formatTxt = '';
	switch (i_full_format) {
		case 'jpeg_th' : 
			formatTxt = 'JPEG (thumbnail)';
			break;
		case 'jpeg_story' : 
			formatTxt = 'JPEG (small)';
			break;
		case 'jpeg_lres' : 
			formatTxt = 'JPEG (medium)';
			break;
		case 'pdf' : 
			formatTxt = 'PDF';
			break;
		case 'html' : 
			formatTxt = 'HTML';
			break;
		case 'msw8' : 
			formatTxt = 'Microsoft Word';
			break;
		case 'xml' : 
			formatTxt = 'XML';
			break;
		default :
			formatTxt = i_full_format;
	}
	return formatTxt;
}


// **********************************************************************

function BCS_SkipClassPrompt () {
	if (!RA_CtrlWin.RA.UseClasses) {
		RA_CtrlWin.RA.CurrentUser.SiteLogins[RA_CtrlWin.RA.CurrentSite.ID].InstructorEmail = '';
	}
	RA_CtrlWin.RA.CurrentUser.ClassPrompt = 0;
//	BCS_Draw_PageContent();
	BCS_NavTree_LoadItem2( BCS_CtrlWin.BCS_current_content.ID );
	BCS_setPageContentHelp();
}



