
var releaseVersion = "1.0.1120";
// version for js, css, jpg, etc.
var siteVersion = "1.0";

// This is the product configuration file

var ON = true;
var OFF = false;
var DEFAULT_PATH_TO_FIFTY_LESSONS_CLIPS = "flash/";
var DEFAULT_PATH_TO_FIFTY_LESSONS_XML = "xml/";
var DEFAULT_FIFTY_LESSONS_FILE_TYPE = "flv";
var DEFAULT_FIFTY_LESSONS_WIDTH = "384";
var DEFAULT_FIFTY_LESSONS_HEIGHT = "251";
var DEFAULT_FIFTY_LESSONS_BG = "#fff";
var FLASH_VIDEO_VERSION = "7,0,0,0";

// Preferences
var DISPLAY_FIFTY_LESSONS_CLIPS = ON;
var DISPLAY_FLASH_CONTENT = ON;
var DISPLAY_RELATED_TOPIC_CALLOUTS = ON;
var DISPLAY_CUSTOM_MENU_TAB = OFF;
var SHOW_CAPTIONS_BY_DEFAULT = OFF;
var PLAY_AUDIO_BY_DEFAULT = ON;
var DISABLE_EXPLORE_FURTHER_LINKS= OFF;

// Menu tab settings
var CUSTOM_MENU_TAB_LABEL = "6th Tab Test";
var CUSTOM_MENU_TAB_LINK = "http://www.hbsp.com";
var SINGLE_TOPIC = OFF;

// FIFTY Lessons parameters
var PATH_TO_FIFTY_LESSONS_CLIPS = DEFAULT_PATH_TO_FIFTY_LESSONS_CLIPS;
var PATH_TO_FIFTY_LESSONS_XML = DEFAULT_PATH_TO_FIFTY_LESSONS_XML;
var FIFTY_LESSONS_FILE_TYPE = DEFAULT_FIFTY_LESSONS_FILE_TYPE;
var FIFTY_LESSONS_WIDTH = DEFAULT_FIFTY_LESSONS_WIDTH;
var FIFTY_LESSONS_HEIGHT = DEFAULT_FIFTY_LESSONS_HEIGHT;
var FIFTY_LESSONS_BG = "#fff";

// Preference actions
function removeCallout(myChildName) {
	var relatedCheck = document.getElementById("CONTENT_BODY");
	var aCallDivTags = relatedCheck.getElementsByTagName("div");
	for (i=0;i<aCallDivTags.length;i++) {
	    if (aCallDivTags[i].id == "CALLOUTS") {
		aCallDlTags = aCallDivTags[i].getElementsByTagName("dl");
		for (j=0;j<aCallDlTags.length;j++) {
			if (aCallDlTags[j].id == myChildName) {
			   aCallDivTags[i].removeChild(aCallDlTags[j]);
			}
		}
	    }
	}
}
// Display an additional tab not found in Source Doc that is an anchor with a link
function displayCustomTab() { 
    var navItems = document.getElementById("NAV_ITEMS");
    var customTab = document.createElement("li");
    var customLink = document.createElement("a");
    customLink.className="button";
    customLink.href=CUSTOM_MENU_TAB_LINK;
    customLink.innerHTML = CUSTOM_MENU_TAB_LABEL;
    customTab.appendChild(customLink);
    navItems.appendChild(customTab);
}
// Automatically toggle the text version of any Flash movie, and remove the button to toggle back
function hideFlash() {
    var foundFlash = false;
    var textDiv = document.getElementById("CONTENT_BODY");
    if (textDiv.innerHTML.indexOf("M_PLAYER") != -1) {
	txtToggle('ALT_TEXT', 'M_PLAYER');
	var altDiv = document.getElementById("ALT_TEXT");
	var viewMediaSpan = document.getElementById("VIEW_MEDIA_PLAYER");
	altDiv.removeChild(viewMediaSpan);
    }
    if (textDiv.innerHTML.indexOf("INTACTV") != -1) {
	txtToggle('ALT_TEXT', 'INTACTV');
    }
}

function setVersion() {
    var versionDiv = document.getElementById("releaseVersion");
    if (versionDiv) {
        versionDiv.innerHTML = releaseVersion;
    }
    versionDiv = document.getElementById("siteVersion");
    if (versionDiv) {
        versionDiv.innerHTML = siteVersion;
    }
}

//Execute the preferences
function checkPrefs() {
    setVersion();
	if (!DISPLAY_RELATED_TOPIC_CALLOUTS) {
	    removeCallout("CALLOUT_RELATED_TOPICS");
	}
	if (DISPLAY_CUSTOM_MENU_TAB) {
	    displayCustomTab();
	}
	if (!DISPLAY_FLASH_CONTENT) {
	    hideFlash();
	}
	var logo = document.getElementById("LOGO_LINK");
    var menuButton = document.getElementById("ITEM_MENU");
	// If we're in an LMS or using a stand-alone topic
	if (parent.lmstracking || SINGLE_TOPIC) {
		removeCallout("CALLOUT_RELATED_TOPICS");
		if (logo) {
		    logo.href = "get_started.html";
		}
	} else {
	if (menuButton) {
    	menuButton.style.display = "block";
    }
	if (logo) {
	    logo.href = "../index.html";
	}
	}
	// if we're in an LMS, also add the exit button and hide the menu button
	if (parent.lmstracking){
	     var exitButton = document.getElementById("ITEM_EXIT");
	     if (exitButton) {
	         exitButton.style.display = "block";
	     }
	}
}


// These two variables allow you to control when
// an LMS reports completion of the topic.

// true = LMS will not report completion until 
// the "Check Your Knowledge" section is completed
// false = LMS will not take the existence of
// a completed "Check Your Knowledge" section into account
// when determining completion
var completion_require_testyourself = true;

// number = percentage of the pages in the topic
// that must be viewed before LMS will allow the
// topic to be marked complete.
// Should be a number between 0 and 100, inclusive.
var completion_require_percentage = 0;

