/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/* document.getElementsBySelector(selector)
   - returns an array of element objects from the current document
     matching the CSS selector. Selectors can contain element names, 
     class names and ids and can be nested. For example:
     
       elements = document.getElementsBySelect('div#main p a.external')
     
     Will return an array of all 'a' elements with 'external' in their 
     class attribute that are contained inside 'p' elements that are 
     contained inside the 'div' element which has id="main"

   New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
   See http://www.w3.org/TR/css3-selectors/#attribute-selectors

   Version 0.4 - Simon Willison, March 25th 2003
   -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
   -- Opera 7 fails 
*/

function getAllChildren(e) {
  // Returns all children of element. Workaround required for IE5/Windows. Ugh.
  return e.all ? e.all : e.getElementsByTagName('*');
}

document.getElementsBySelector = function(selector) {
  // Attempt to fail gracefully in lesser browsers
  if (!document.getElementsByTagName) {
    return new Array();
  }
  // Split selector in to tokens
  var tokens = selector.split(' ');
  var currentContext = new Array(document);
  for (var i = 0; i < tokens.length; i++) {
    token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
    if (token.indexOf('#') > -1) {
      // Token is an ID selector
      var bits = token.split('#');
      var tagName = bits[0];
      var id = bits[1];
      var element = document.getElementById(id);
      if (tagName && element.nodeName.toLowerCase() != tagName) {
        // tag with that ID not found, return false
        return new Array();
      }
      // Set currentContext to contain just this element
      currentContext = new Array(element);
      continue; // Skip to next token
    }
    if (token.indexOf('.') > -1) {
      // Token contains a class selector
      var bits = token.split('.');
      var tagName = bits[0];
      var className = bits[1];
      if (!tagName) {
        tagName = '*';
      }
      // Get elements matching tag, filter them for class selector
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      continue; // Skip to next token
    }
    // Code to deal with attribute selectors
    if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
      var tagName = RegExp.$1;
      var attrName = RegExp.$2;
      var attrOperator = RegExp.$3;
      var attrValue = RegExp.$4;
      if (!tagName) {
        tagName = '*';
      }
      // Grab all of the tagName elements within current context
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      var checkFunction; // This function will be used to filter the elements
      switch (attrOperator) {
        case '=': // Equality
          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
          break;
        case '~': // Match one of space seperated words 
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
          break;
        case '|': // Match start with value followed by optional hyphen
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
          break;
        case '^': // Match starts with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
          break;
        case '$': // Match ends with value - fails with "Warning" in Opera 7
          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
          break;
        case '*': // Match ends with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
          break;
        default :
          // Just test for existence of attribute
          checkFunction = function(e) { return e.getAttribute(attrName); };
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (checkFunction(found[k])) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
      continue; // Skip to next token
    }
    // If we get here, token is JUST an element (not a class or ID selector)
    tagName = token;
    var found = new Array;
    var foundCount = 0;
    for (var h = 0; h < currentContext.length; h++) {
      var elements = currentContext[h].getElementsByTagName(tagName);
      for (var j = 0; j < elements.length; j++) {
        found[foundCount++] = elements[j];
      }
    }
    currentContext = found;
  }
  return currentContext;
}

/* That revolting regular expression explained 
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
  \---/  \---/\-------------/    \-------/
    |      |         |               |
    |      |         |           The value
    |      |    ~,|,^,$,* or =
    |   Attribute 
   Tag
*/


//PSCRAT.JS

/* MISC FUNCTIONS */
function doUnload(webpath, cmpy_cd) {
	if (event.clientY < 0) {
		window.open(webpath + 'form_templates/exit_survey.cfm?cmpy_cd=' + cmpy_cd, 'exit_survey', 'height=400,width=400,scrollbars=yes,location=no,status=no,resizeable=no');
	}
}

function hideSubs() {
	document.getElementById("curriculum_rollover").style.display='none';
	document.getElementById("assessment_rollover").style.display='none';
	document.getElementById("se_info_rollover").style.display='none';
	document.getElementById("ed_learning_rollover").style.display='none';
	document.getElementById("fam_learning_rollover").style.display='none';
	document.getElementById("curriculum_early_rollover").style.display='none';
	document.getElementById("curriculum_elem_rollover").style.display='none';
	document.getElementById("curriculum_second_rollover").style.display='none';
	document.getElementById("assessment_early_rollover").style.display='none';
	document.getElementById("assessment_individual_rollover").style.display='none';
	document.getElementById("ed_professional_rollover").style.display='none';
}

function showSub(subname) {
	document.getElementById(subname + "_rollover").style.display='block';
}

function checkMouse(e) {
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	if (tg.nodeName != 'DIV') return;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg != tg && reltg.nodeName != 'BODY')
		reltg= reltg.parentNode
	if (reltg== tg) return;

	hideSubs();
}

function hideSelect()
{if (document.all){document.all.searchpageselect.style.visibility="hidden";}}

function unhideSelect()
{if (document.all){document.all.searchpageselect.style.visibility="visible";}}


/* Used by Main Navigation drop downs to simulate Hover on an A tag */
sfHover = function() {

	var sfEls = document.getElementById("nav").getElementsByTagName("LI");	
	for (var i=0; i<sfEls.length; i++) {	
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}			
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

//if (window.attachEvent) window.attachEvent("onload", sfHover);


/* IMAGE RELATED CODE */

/* Exchanges Broken images with a hidden alternate and Switches the blank image to a missing image image - Used with PMDb */
function UpdateBrokenImages(img, imgAlt) {

	if(imgAlt) {
		img.hide();
		imgAlt.show();
	}

	img.src = '/live/images/imgNAThumb.gif';

	/* Suppress any further onerror errors if the missing image isn't available */
	img.onerror=null;
}



/* PRODUCT RELATED CODE */

// Used to open and close product descriptions.
function descriptionUpDown(obj) {

	Effect.toggle(obj, 'slide', {duration:0.5, queue: {position:'end', scope: 'eventDropDown', limit:3}});
}



// Used to filter the component product list.
function ProductFilter() {

	this.productFilterList = new Array(); // Contains the classes of all the filters we want to see

	this.toggleFilter = function(criteria) {



		// Loop through filters, to see if the new filter has already been selected or not.

		var foundCriteria = false;

		var criteriaIndex = "";



		for(var i = 0; i < this.productFilterList.length; i++) {

				// If filter is in array, then remember where.

				if (this.productFilterList[i] == criteria) {

					foundCriteria = true;
					criteriaIndex = i;

				}

		}

		// If filter already in array, remove it.

		if(foundCriteria) {

			this.productFilterList.splice(criteriaIndex,1);

			$(criteria).removeClassName('selectedFilter');

		// Else add filter to array.

		} else {

			this.productFilterList.push(criteria);

			$(criteria).addClassName('selectedFilter');

		}


		// If no filters chosen, then show all products.

		if (this.productFilterList.length == 0) {

			// Show all products

			var arrayOfProducts = $$('.prodFilters');

			for(var i = 0; i < arrayOfProducts.length; i++) {

					arrayOfProducts[i].show();

			}

		// Else hide all products, then show the ones with the selected filters.

		} else {

			// Hide all products

			var arrayOfProducts = $$('.prodFilters');

			for(var i = 0; i < arrayOfProducts.length; i++) {

					arrayOfProducts[i].hide();

			}

			// Show selected products

			for(var i = 0; i < this.productFilterList.length; i++) {

				var arrayOfProducts = $$('.' + this.productFilterList[i]);

				for(var j = 0; j < arrayOfProducts.length; j++) {

						arrayOfProducts[j].show();

				}

			}

		}


		return false;

	}
}

//PS_TABS.JS

function getURLVar(urlVarName) {

	//divide the URL in half at the '?'
	var urlHalves = String(document.location).split('?');

	var urlVarValue = '';

	if(urlHalves[1]){

		//load all the name/value pairs into an array
		var urlVars = urlHalves[1].split('&');

		//loop over the list, and find the specified url variable
		for(i=0; i<=(urlVars.length); i++){

			if(urlVars[i]){

				//load the name/value pair into an array
				var urlVarPair = urlVars[i].split('=');

				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {

					//I found a variable that matches, load it's value into the return variable
					urlVarValue = urlVarPair[1];

				}

			}

		}

	}

	return urlVarValue;   

}

var tab_locator = getURLVar('locator') + '_' + getURLVar('PMDbProgramId');

/*==================================================
Cookie functions
==================================================*/
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


/* Tab controller */
TabControl = function(tabId, options) {
	/* JW: First, see if a tab cookie already exists for this locator. */
	/* If so, store it so we show that tab. If not, default to a_page */
	
	var stored_cookie = getCookie('tab_' + tab_locator);
	
	if (!stored_cookie) { stored_cookie = 'a_page'; }

	/* Get the tab we're starting on */
	var id = "#" + tabId;

	var tabList = $$(id + ' div.tabs ul li a');
	
	/* Loop through and find if the default tab we expect to exist does */
	var tabExists = false;
	
	tabList.each(function(a) {
	
		var page = a.getAttribute('href').match(/[-_\w]+$/i)[0];

		if (page == stored_cookie) { tabExists = true; }
		
	});
	
	if (!tabExists) { stored_cookie = 'a_page'; }

	

	/* For each link */
	tabList.each(function(a) {
			
		// Match the value of the href attribute that consistes of any number (not zero) of -_ or characters and then the end of string.
		var page = a.getAttribute('href').match(/[-_\w]+$/i)[0];

		// JW: if current tab matches cookied (or default) tab, show content and tab highlight
		if (page == stored_cookie) {
			$(page).show();
			$(a.parentNode).addClassName('on');
		} else {
			$(a.parentNode).removeClassName('on');
			$(page).hide();
		}

		/*
		if (page != options['current']) {
			$(page).hide()
		} else {
			$(a.parentNode).addClassName('on')
		}
		*/
		
		/* $(options).show() */

		/* Listen for a click on the link... */
		
		Event.observe(a, 'click', function(element) {

			/* Remove any active items */
			$$(id + ' div.tabs ul li.on').each(function(e) {
				e.removeClassName('on');
			})

			/* Everything that isn't our page hide */
			$$(id + ' .PS_tab_page[id!='+page+']').each(function(e) { e.hide() });

			/* Add active to our boy */
			$(a.parentNode).addClassName('on');

			/* JW: Set the cookie for this tab selection */
			setCookie('tab_' + tab_locator, page);

			/* Show the active */
			
			/* alert('ERE' + page); */
			
			$(page).show();

			Event.stop(element);

			});
		});

	
	}
	


//Embed.JS

/**
 * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
 */

function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	if (!p["id"] || p["id"] == "") {
		var divName = "flashcontent";	
	} else {
		var divName = p["id"];
	}
	
	document.write('<div id="' + divName + '">&nbsp;</div>');
	
	/* 1.5 method (using) */
	var so = new SWFObject(p["src"], divName, p["width"], p["height"], "7", "#ffffff");
	so.addParam("quality", "high");
	so.addParam("wmode", "transparent");
	so.addParam("flashvars", p["flashvars"]);
	so.write(divName);	
	
	/* 2.1 method (not using)
	var swfFlashVars = false;

	var swfParams = {};
	swfParams.flashvars = p["flashvars"];
	swfParams.quality = "high";
	swfParams.wmode = "transparent";

	var swfAttribs = {};
	swfAttribs.id = p["id"];
	swfAttribs.name = p["name"];
	swfAttribs.aligm = p["align"];

	swfobject.embedSWF(p["src"], divName, p["width"], p["height"], "7", false, "file=http://pearsondigital.com/videos/web/bio_intro.flv&image=http://www.pearsonschool.com/live/images/custom/biology/movie.jpg&bufferlength=10", swfParams, swfAttribs);
	*/
}

//AC_RunActiveContent.JS

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

//AUTO AJAX SELECT LIST

/* 
NOTES:
Requires Prototype 1.6 if using to update options in a select list. IE 6/7 don't allow element.update of options in select

OBJECT: AutoAJAXSelectList: Takes a text box, monitors if you type in it and AJAX updates a results panel.

ATTRIBUTES:
textBoxObj: Text box to monitor (required)
appendObj: Where the results of the AJAX go (required)
dataApp: The address of the AJAX app (required)
hideSchoolResults: A DOM Obj that is made visible when there are results and hides otherwise
progressObj: A DOM Obj that is made visible during the AJAX call and hides otherwise
leftOffset: Offset of results box
topOffset: Offset of results box
defaultAlignment: 'right' (default), 'left' - alignment of results box.

FUNCTIONS:
reset(): Hides and clears the results panel.
*/

function AutoAJAXSchoolFinder(inputType, restrictToInsts, redirectUserTo, textBoxObj, appendObj, dataApp, hideSchoolResults, hideSchoolDisplay, hideNoSchoolFound, progressObj, leftOffset, topOffset, defaultAlignment, optimostTrackingVar) {
	this.inputType = inputType;
	this.restrictToInsts = restrictToInsts;
	this.redirectUserTo = redirectUserTo;
	this.textBoxObj = textBoxObj;
	this.appendObj = appendObj;
	this.dataApp = dataApp;
	this.hideSchoolResults = hideSchoolResults;
	this.hideSchoolDisplay = hideSchoolDisplay;
	this.hideNoSchoolFound = hideNoSchoolFound;
	this.progressObj = progressObj;
 	this.leftOffset = leftOffset;
	this.topOffset = topOffset;
	this.boxAligned = false;
	this.defaultAlignment = defaultAlignment;
	this.optimostTrackingVar = optimostTrackingVar;
	this.currentSubmissionID = 1;

	/* Start monitoring textbox and turn off autocomplete */
	this.init = function () {
		// hide what needs to be hidden at start
		this.hideSchoolResults.hide();
		this.hideSchoolDisplay.hide();
		this.hideNoSchoolFound.hide();
		this.progressObj.hide();
			
		this.textBoxObj.setAttribute("autocomplete","off");
		
		this.CachedTypeHandler = this.checkAdd.bindAsEventListener(this);
		Event.observe(this.textBoxObj, 'keyup', this.CachedTypeHandler);		
		this.CachedFocusHandler = this.focusHandler.bindAsEventListener(this);
		Event.observe(this.textBoxObj, 'focus', this.CachedFocusHandler);

		this.CachedChangeHandler = this.changeHandler.bindAsEventListener(this);
		Event.observe(this.appendObj, 'click', this.CachedChangeHandler);
	}

	/* Hides and clears results panel */
	this.reset = function () {		
		if (this.hideSchoolResults) {
			this.hideSchoolResults.hide();
		}
		
		while(this.appendObj.childNodes.length > 0) {
			this.appendObj.removeChild(this.appendObj.childNodes[0]);
		}
	}

	/* On a successful update, show results and hide progress */
	this.updateSuccess = function(responseTest) {
		currentResponse = responseTest.responseText.split('CurrentSubmissionID');
		
		if (currentResponse[0] == this.currentSubmissionID) {
		
			this.appendObj.update(currentResponse[1]);
		
			if (this.hideSchoolResults) {
				// this.alignResultsBox();
				this.hideSchoolResults.show();
			}

			if(this.progressObj) {
				this.progressObj.hide();
			}	
			
		}
	}.bind(this);
	
	/* on choosing of an option from the appendObj */
	this.changeHandler = function(event) {
		if (this.redirectUserTo == '') {
			// hide the hideSchoolResults Container
			this.hideSchoolResults.hide();
			
			// just display chosen school on the page (ie part of bigger form
			this.hideSchoolDisplay.innerHTML =  this.appendObj.options[this.appendObj.selectedIndex].innerHTML;
			this.hideSchoolDisplay.show();
		} else {
			// redirect the user
			var thePID = this.appendObj.value.toQueryParams().pid;
			document.location.href = this.redirectUserTo + "&pid=" + thePID;
		}		
	}
	
	/* On a keypress this prompts the AJAX */
	this.checkAdd = function(event) {	
		this.keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

		if(this.keyCode == 13 || this.keyCode == 39 ) { // Keypressed is enter or tab - prevent form submit

			event.cancelBubble = true;
			event.returnValue = false;
			event.stopPropagation(); 

			return false;
			
		} else if (Event.element(event).value.length < 3) {

			this.reset();		
			
		} else if((Event.element(event).value.length) >= 3) {
		
			if(this.progressObj) {
				this.progressObj.show();
			}
			
			this.currentSubmissionID++;
			
			new Ajax.Request(this.dataApp, {
			
				method: 'get',
			
				onSuccess: this.updateSuccess,

				onFailure : function(resp) {
					alert("Oops, there's been an error.");
				},

				parameters : {
					q: Event.element(event).value,
					c: this.inputType,
					returnMode: 'options',
					restrictToInsts: this.restrictToInsts,
					currentSubmissionID: this.currentSubmissionID
				}
			
			});
			
		}

	};


	/* On first focus clear the box, then stop tracking focus. */
	this.focusHandler = function () {
	
		this.textBoxObj.value = "";
		
		Event.stopObserving(this.textBoxObj, 'focus', this.CachedFocusHandler);
	
	}

	this.init();
}



function AutoAJAXSelectList(textBoxObj, appendObj, dataApp, hideSchoolResults, progressObj, leftOffset, topOffset, defaultAlignment, optimostTrackingVar) {

	this.textBoxObj = textBoxObj;

	this.appendObj = appendObj;
	
	this.dataApp = dataApp;
	
	this.hideSchoolResults = hideSchoolResults;
	
	this.progressObj = progressObj;
	
 	this.leftOffset = leftOffset;
 	
 	this.topOffset = topOffset;
	
	this.boxAligned = false;
	
	this.defaultAlignment = defaultAlignment;
	
	this.optimostTrackingVar = optimostTrackingVar;
	
	this.currentSubmissionID = 1;

	/* Start monitoring textbox and turn off autocomplete */
	this.init = function () {
	
		this.textBoxObj.setAttribute("autocomplete","off");
		
		this.CachedTypeHandler = this.checkAdd.bindAsEventListener(this);

		Event.observe(this.textBoxObj, 'keyup', this.CachedTypeHandler);		

		this.CachedFocusHandler = this.focusHandler.bindAsEventListener(this);

		Event.observe(this.textBoxObj, 'focus', this.CachedFocusHandler);
		
	}

	/* Hides and clears results panel */
	this.reset = function () {
		
		if (this.hideSchoolResults) {
			this.hideSchoolResults.hide();
		}
		
		while(this.appendObj.childNodes.length > 0) {
			this.appendObj.removeChild(this.appendObj.childNodes[0]);
		}

	}

	/* On a successful update, show results and hide progress */
	this.updateSuccess = function(responseTest) {
		currentResponse = responseTest.responseText.split('CurrentSubmissionID');
		
		if (currentResponse[0] == this.currentSubmissionID) {

			this.appendObj.update(currentResponse[1]);
		
			if (this.hideSchoolResults) {
				this.alignResultsBox();
				this.hideSchoolResults.show();
			}

			if(this.progressObj) {
				this.progressObj.hide();
			}	
			
		}
		
	}.bind(this);

	/* On a keypress this prompts the AJAX */
	this.checkAdd = function(event) {
		this.keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

		if(this.keyCode == 13 || this.keyCode == 39 ) { // Keypressed is enter or tab - prevent form submit

			event.cancelBubble = true;
			event.returnValue = false;
			event.stopPropagation(); 

			return false;
			
		} else if (Event.element(event).value.length < 3) {

			this.reset();		
			
		} else if((Event.element(event).value.length) >= 3) {
		
			if(this.progressObj) {
				this.progressObj.show();
			}
			
			this.currentSubmissionID++;
			
			new Ajax.Request(this.dataApp, {
			
				method: 'get',
			
				onSuccess: this.updateSuccess,

				onFailure : function(resp) {
					alert("Oops, there's been an error.");
				},

				parameters : { q: Event.element(event).value, currentSubmissionID: this.currentSubmissionID }
			
			});
			
		}

	};


	/* On first focus clear the box, then stop tracking focus. */
	this.focusHandler = function () {
	
		this.textBoxObj.value = "";
		
		Event.stopObserving(this.textBoxObj, 'focus', this.CachedFocusHandler);
	
	}

	/* This function finds the elements offset from the top left corner of the entire page, no mater what it's nested in */
	this.findPos = function(obj) {

		var curleft = curtop = 0;

		if (obj.offsetParent) {
		
			curleft = obj.offsetLeft

			curtop = obj.offsetTop

			while (obj = obj.offsetParent) {

				curleft += obj.offsetLeft

				curtop += obj.offsetTop

			}
		}

		return [curleft,curtop];

	}

	/* Force the results box to align with an offset as input, no matter what it's nested inside of */
	this.alignResultsBox = function() {
	
		if (!this.boxAligned) {

			this.hideSchoolResults.show();

			this.hideSchoolResults.style.top = this.hideSchoolResults.offsetTop - (this.findPos(this.hideSchoolResults)[1] - this.findPos(this.textBoxObj)[1]) + (this.textBoxObj.offsetHeight - 1) + this.topOffset + 'px';

			if (this.defaultAlignment == 'right') {

				this.hideSchoolResults.style.left = this.hideSchoolResults.offsetLeft - (this.findPos(this.hideSchoolResults)[0] - this.findPos(this.textBoxObj)[0]) + this.leftOffset - (this.hideSchoolResults.offsetWidth - this.textBoxObj.offsetWidth) + 'px';
			
			} else {
			
				this.hideSchoolResults.style.left = this.hideSchoolResults.offsetLeft - (this.findPos(this.hideSchoolResults)[0] - this.findPos(this.textBoxObj)[0]) + this.leftOffset + 'px';			
			
			}
			
			this.hideSchoolResults.hide();
			
			this.boxAligned = true;
			
		}
		
	}

	this.init();

}

/* Monitors an option in a select box. When it's pressed it redirects the page to the options value. Used by ProductQuickFind. */

/* function RedirectingOptionList(selectObj, dataApp) { */
function RedirectingOptionList(selectObj, RedesignMode) {

	this.selectObj = selectObj;
	
	this.dataApp = '/admin/ajax/productRedirect2.cfm?RedesignMode=' + RedesignMode;
	
	this.selectedOption = '';
	
	this.init = function () {
	
		this.CachedChangeHandler = this.changeHandler.bindAsEventListener(this);

		Event.observe(this.selectObj, 'click', this.CachedChangeHandler);
	
	}



	this.redirectByAjaxHandler = function(t) {

		document.location.href = t.responseText;

	}.bind(this);	
	
	
	

	this.changeHandler = function (event) {
		
		this.selectedOption = Event.element(event);
		
		if (this.selectedOption.value.length > 0) {
		
		
			// If result needs further processing look for the AJAX: Flag
			if (this.selectedOption.value.indexOf("AJAX:") == 0) {
				
				new Ajax.Request(this.dataApp, {
				
					method: 'get',

					onSuccess: this.redirectByAjaxHandler,

					onFailure : function(resp) {
						alert("Oops, there's been an error.");
					},

					parameters: { q: this.selectedOption.value }

				});
			
			
			} else {
		
				document.location.href = this.selectedOption.value; 			
				
			}
		
		}
		
	}

	this.init();

}



