$(document).ready(function() {

	if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
		$('.fixPng, #sideTopShadow, .miniformBanner, .formError, .fieldError, #sidebar h2.companyName, .companySideQuotes').supersleight({shim: '/images/blank.gif'});
	}

	/* Breadcrumb reverse - calls custom plugin*/
	if ($('#breadCrumbContainer ul').length > 0) {
		$('#breadCrumbContainer ul').children().reverseOrder();
	}

	/*Hide Hero on 404 message*/
	if (($('#bodyContent h2.globalErrorMessage').length == 1) && ($('#hero').length == 1)) {
		$('#hero').hide();
	}

	/*Leadform fix for long selects*/
	if ($.browser.msie) {
		$("#leadForm select").each(function() {
			//alert($(this).width());
			if ($(this).width() > 595) {
				var innerSelect = $(this);
				innerSelect.css('width', '500px').css({position: "absolute"}).wrap("<span>")
				 .parent().css({position: "relative", display: "block", height: "48px"});

				innerSelect.not("#leadForm ul.pInfo select").mousedown(
				 function() {
					 if ($(this).css("width") != "auto") {
						 $(this)
						  .data("origWidth", $(this).css("width"))
						  .css("width", "auto");
					 }
					 //alert($(this).width());
				 }).change(function() {
					 $(this).css("width", $(this).data("origWidth"));
				 });
			}
		});
	}

	/*Set the absolute position for Recommended Schools  based on the height of H1 and Breadcrumb*/
	var insetContentTop = ($('#articleContent h1').height() + $('#breadCrumbContainer').height() + 40);
	$('#insetContent').css('top', insetContentTop);

	//Set Recommended Schools default open/close settings
	recommendedModReset();

	var recModTrig = $('#recommendedMod .acc_trigger');
	var recModH6 = $(recModTrig).find('h6');
	$(recModH6).click(function() {
		if (!$(this).parent().next('.acc_container').hasClass('active')) {
			$(recModTrig).removeClass('active').next('.acc_container').hide().removeClass('active');
			$(this).parent().toggleClass('active').next('.acc_container').show().addClass('active');
			$(this).text('Click to hide').css('display', 'none');
			$(recModH6).not(this).text('Expand to get more info').css('display', 'block');
			doMiniformReq($(this).parent());
		}
		else {
			$(this).parent().toggleClass('active').next('.acc_container').toggle();
			$(this).text('Expand to get more info').css('display', 'block');
		}

		adjustInset(); // needs to be the last action
	});

	/*Submit Recommended Mod on select change*/
	$('#recommendedMod .miniformSelect, .contentSearchList .miniformSelect').change(function() {
		$(this).closest('.miniform').submit();
	});

	/*jqtransform form styles */
	$('form.formStyles, form#searchHeader, form#schoolCat').jqTransform({imgPath:'/images/forms/'});


	/*SWFObject Attributes and Parameters used for VIdeo Overlays*/
	//http://flowplayer.org/tools/overlay/index.html
	function displayVideo(multimediaId, playerWidth, playerHeight, imagePath, filePath) {
		var playerURL = '/embed/flvplayer/flvplayer.swf';
		var playerHeightAdj = playerHeight + 19;
		var imagePathLarge = imagePath.replace('videopreview-small/', '');
		var flashvars = {autostart: true, width: playerWidth, height:playerHeightAdj, bufferlength:2, showfsbutton:false, backcolor:"055192", frontcolor:"FFFFFF", displayheight:120.0, streamer: 'rtmp://interactive.degreedirectory.org/videos/flv/', file: filePath, image: imagePathLarge, stretching: 'fill', skin: '/embed/simple-t2.swf'};

		var params = {play:"true"};
		var attributes = {id:'overlayPlayerElementId' + multimediaId};
		swfobject.embedSWF(playerURL, 'overlayPlayer' + multimediaId, playerWidth, playerHeightAdj, '7.0.0', false,
		 flashvars, params, attributes);
	}

	/*Var necessary to refill content after iframOverlay*/
	var videoOverlayHtml = '<p><span><a class=\"close\">Close Window <img src=\"/images/closeWindow.gif\" /></a></span>Video Preview - <a href=\"\">View Full Page</a></p>'
	 + '<div class=\"overlayBox\">'
	 + '<div id=\"overlayPlayer\">'
	 + '</div>'
	 + '</div>'
	 + '<h2></h2>';

	/*Add to page div for an overlay */
	if ($('div#overlayVideo').length == 0) {
		$('body').append('<div id=\"overlayVideo\">' + videoOverlayHtml + '</div>');
	}

	// Overlay Triggered by an a-tag
	$('a.previewTrigger').click(function() {

		var videoAttr = $(this).find('img').attr('rel').split('+');
		$('div#overlayVideo a:nth-child(2)').attr('href', $(this).attr('href'));
		$('div#overlayVideo h2').replaceWith('<h2>' + $(this).find('img').attr('alt') + '</h2>'); //Overlay title
		$('div#overlayPlayer').replaceWith('<div id=\"overlayPlayer' + videoAttr[0]
		 + '\"><span class=\"getFlash\">Download Flash Player</span> to view video.</div>');
		displayVideo(videoAttr[0], parseInt(videoAttr[1]), parseInt(videoAttr[2]), videoAttr[3], videoAttr[4]);

		$(this).overlay({
			load: true,
			target: '#overlayVideo',
			mask: {color: '#000000', opacity: 0.5},
			effect: 'default',
			closeOnClick: true,
			closeOnEsc: true,
			left: 'center',
			top:'10%',
			speed: 'fast',
			onLoad: function() {
				$('.videoPlayer, #relatedWages object').css('visibility', 'hidden'); //hides inline Flash when overlay is active

				//for ie6 hide all select elements when overlay is active
				if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
					$('select').css('visibility', 'hidden');
				}
			},
			onClose: function () {
				$('.videoPlayer, #relatedWages object').css('visibility', 'visible');

				//make ie6 form select visible
				if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
					$('select').css('visibility', 'visible');
				}
				swfobject.removeSWF('overlayPlayerElementId' + videoAttr[0]); //remove SWF object
				//For IE7 without Flash plugin
				if ($('#overlayPlayer').length == 0) {
					$('div.overlayBox').append('<div id=\"overlayPlayer\"></div>'); //replace overlayPlayer div
				}
			}
		});

		/*Overlay consolidation in progress*/
		/*	var overlayNum = videoAttr[0];
		 videoOverlayDisplay(overlayNum);*/
	});

	/*Overlay Triggered by Span containing Video play button graphic*/
	$('span.relatedVidBodPlay').click(function() {

		var videoAttr = $(this).parent().find('img.previewTrigger').attr('rel').split('+');
		$('div#overlayVideo a:nth-child(2)').attr('href', videoAttr[5]);
		$('div#overlayVideo h2').replaceWith('<h2>' + $(this).parent().find('img.previewTrigger').attr('alt') + '</h2>'); //Overlay title
		$('div#overlayPlayer').replaceWith('<div id=\"overlayPlayer' + videoAttr[0]
		 + '\"><span class=\"getFlash\">Download Flash Player</span> to view video.</div>');
		displayVideo(videoAttr[0], parseInt(videoAttr[1]), parseInt(videoAttr[2]), videoAttr[3], videoAttr[4]);

		$(this).overlay({
			load: true,
			target: '#overlayVideo',
			mask: {color: '#000000', opacity: 0.5},
			effect: 'default',
			closeOnClick: true,
			closeOnEsc: true,
			left: 'center',
			top:'10%',
			speed: 'fast',
			onLoad: function() {
				$('.videoPlayer, #relatedWages object').css('visibility', 'hidden'); //hides inline Flash when overlay is active

				/*for ie6 hide all select elements when overlay is active*/
				if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
					$('select').css('visibility', 'hidden');
				}
			},
			onClose: function () {
				$('.videoPlayer, #relatedWages object').css('visibility', 'visible');  //shows inline Flash when overlay is inactive

				/*make ie6 form select visible*/
				if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
					$('select').css('visibility', 'visible');
				}
				swfobject.removeSWF('overlayPlayerElementId' + videoAttr[0]); //remove SWF object
				/*For IE7 without Flash plugin*/
				if ($('#overlayPlayer' + videoAttr[0]).length == 0) {
					$('div.overlayBox').append('<div id=\"overlayPlayer\"></div>'); //replace overlayPlayer div
				}
			}
		});


	});

	/*remove href for iFrame overlays on a-tags*/
	$("a.iframeOverlay").removeAttr('href');

	/* Overlay Containing iFrame+URL  */
	if ($("a.iframeOverlay, div.companyComplianceLink span").length >= 1) {
		$('body').append('<div id=\"overlayIframe\">'
		 + '<p><span><a class=\"close\">Close Window <img src=\"/images/closeWindow.gif\" /></a></span><p>'
		 + '<iframe width=\"100%" height=\"300px" scrolling=\"auto\" src=\"\"></iframe>'
		 + '</div>');
		$(".companyComplianceLink span").css({cursor: "pointer"});
	}

	$("div.companyComplianceLink span").click(function() {
		__utmTrackEvent('DisclosureLink', 'Click ' + location.href, $("div.companyComplianceLink span").attr('rel'));
	});

	/*company page iFrame overlay - see ai-ground*/
	$("a.iframeOverlay, div.companyComplianceLink span").click(function() {
		var pageURL = $(this).attr('rel');

		$(this).overlay({
			load: true,
			target: '#overlayIframe',
			mask: {color: '#000000', opacity: 0.5},
			effect: 'default',
			closeOnClick: true,
			closeOnEsc: true,
			left: 'center',
			top:'10%',
			speed: 'fast',

			onBeforeLoad: function() {
				$('object').css('visibility', 'hidden');
				$('#overlayIframe iframe').attr('src', pageURL);
				if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
					$('select').css('visibility', 'hidden');
				}
			},
			onClose: function() {
				$('select, object').css('visibility', 'visible');
			}
		});
	});


	//Prevent location select object from submitting form
	$('#locationSelect').closest('.jqTransformSelectWrapper').find('ul li:nth-child(1) a').addClass('locationNoSubmit');

	//Find Schools - school search. This script doesn't work at the top of this doc
	//.not('#srchBox .jqTransformSelectWrapper ul a.locationNoSubmit') for  pulldown location list
	$('#srchBox .jqTransformSelectWrapper ul a').not('#srchBox .jqTransformSelectWrapper ul a.locationNoSubmit').click(function() {
		/*Listening for event Change does not work. onchange event must be added to select object */
		/*see bottom of file for resetting select object*/
		/*submit form*/
		$('#srchBox form').submit();
	});

	function srchBoxRadioSubMenu(reload) {
		if (
		 ($('#srchBox a.jqTransformRadio:eq(1)').attr('rel', 'schoolType').hasClass('jqTransformChecked')) || ($('#srchBox input[name=schoolType]:checked').val()
		  == 'nearMe')
		 ) {
			$('#srchBox #locationAsub').css('display', 'block');
			$('#srchBox fieldset p:first').css('margin-bottom', '0');
		}
		else {
			if (($('select#locationSelect').length != 1)) {
				$('#srchBox #locationAsub').css('display', 'none');
				$('#srchBox fieldset p:first').css('margin-bottom', '2px');
				$('#srchBox .findBtn').hover(); //makes button line up in ie6
				//alert($('select#locationSelect').length+' -- '+'beep');
				if (reload == 'true') {

					$('#topZip').val('');
					$('#topState option').removeAttr("selected");
                    $('select[name=state]').val('ALL');

					document.topSearchForm.submit();
				}
			}
		}
	}

	srchBoxRadioSubMenu('false');
	pullDownBehavior();

	$('#srchBox a.jqTransformRadio').attr('rel', 'schoolType').click(function() {
		srchBoxRadioSubMenu('true');
	});

	$('input[name=zip]').click(function() {
		if ($(this).val() == 'zip') {
			$(this).val('');
		}
	});


	$('#srchBox form').submit(function() {
		/*if (($('input[name=schoolType]:checked').val() != 'nearMe') && (!$('select#locationSelect'))) {
		 $('select[name=state]').find('option:first').attr('selected', 'selected');
		 $('input[name=zip]').val('');
		 }
		 if (($('input[name=schoolType]:checked').val() == 'nearMe' ) && ($('input[name=zip]') != '') && ($('input[name=zip]').val().length == 5)) {
		 $('select[name=state]').find('option:first').attr('selected', 'selected');
		 }*/

		//pulldown resets
		if (($('select#locationSelect').length > 0) && ($('select#locationSelect').val() != 'nearMe')) {
			$('input[name=zip]').val('');
			//$('select[name=state]').find('option:first').attr('selected', 'selected');
		}

	});

	/*Highlights Degree menu*/
	$('#srchBox select option').each(function() {
		if ($(this).hasClass('qual1')) {
			var selectIndexVal = $(this).index();
			$(this).parents('div.jqTransformSelectWrapper').find('li').eq(selectIndexVal).addClass('optionGray');
		}
	});

	/*Highlights Subject menu*/
	$('#srchBox select option').each(function() {
		if ($(this).hasClass('optionGray')) {
			//alert($(this).index()+' -- '+$(this).attr('value'));
			var selectIndexVal = $(this).index();
			$(this).parents('div.jqTransformSelectWrapper').find('li').eq(selectIndexVal).addClass('optionGray');
			//alert('li '+$(this).parent().find('li').index(selectIndexVal).html());
		}
	});

	/* Accordion function for company programs, locations, learning, and financial aid  -- calls plugin*/
	$("div.accordion").remAccordion();

	/* This accordion is for the Search Results (Matching Schools) accordion*/
	if (($('div.schoolLocationAccordion').length > 0) && !($.browser.msie && $.browser.version.substr(0, 1) == 6)) {
		$('div.schoolLocationAccordion ul').hide();
		$('div.schoolLocationAccordion h5').click(function() {
			$(this).parent('div.schoolLocationAccordion').toggleClass('openAccordion');
			$(this).next('ul').slideToggle('fast');
		});
	}

	/*Popular Articles*/
	function articleGroupTog() {
		$('ul.toggleGroup').each(function(index) {
			var elems = $(this).find('li');

			elems.hide();
			elems.slice(0, 5).show();
		})
	}

	articleGroupTog();

	var toggleP = $('p.toggle');

	if (toggleP.length > 0) {
		toggleP.css('display', 'block');
	}

	toggleP.click(function() {
		if ($(this).text() == 'View More Articles') {
			$(this).parent().find('ul.toggleGroup li').show();
			$(this).text('View Fewer Articles');
			$(this).css('background-position', '-10px -38px');
		}
		else {
			if ($(this).text() == 'View Fewer Articles') {
				articleGroupTog();
				$(this).text('View More Articles');
				$(this).css('background-position', '-10px -8px');
			}
		}
	});

	var imageTable = $('.wikiContent .imageplugin img'); //article image
	$(imageTable).css('visibility', 'hidden'); //hide article image until the image loads but allow placeholder
	$(window).load(function() {
		$(imageTable).css('visibility', 'visible'); //display image when fully loaded
		if ($('.wikiContent .imageplugin img').length > 0) {
			resizeBlogImages(imageTable); //window load makes sure the images are loaded
			//Text wrapping is dependant on scaling DES-432
		}
	});

	/*Default text for the Newsletter signup form*/
	$("#newsletterForm input.inputEmail, #subscribeToUs input.shareEmail").hint();

	/* company pages HTML tables*/
	$(".wikitable tr").mouseover(
	 function() {$(this).addClass("over");}).mouseout(function() {
		$(this).removeClass("over");
	});
	$(".wikitable tr:even").addClass("alt");
	$(".wikitable tr td:nth-child(1)").css("border-right", "1px solid #BFBFBF");

	/*Education and Career Research Sidebar expanding bullet lists */
	$('#sideNav li.current ul').addClass('expanded');
	$('#sideNav li').children('ul').parent().children('a').click(function(ev) {
		$(this).parent().addClass('sideNavSelected');
		ev.preventDefault();
		$(this).parent().children('ul').toggleClass('expanded');
	});

	/*Leadform fix for long selects*/
	if ($.browser.msie) {
		$("#leadForm select").each(function() {

			if ($(this).width() > 540) {
				var innerSelect = $(this);
				innerSelect.css('width', '500px').css({position: "absolute"}).wrap("<span>")
				 .parent().css({position: "relative", display: "block", height: "48px"});

				innerSelect.not("#leadForm ul.pInfo select").mousedown(
				 function() {
					 if ($(this).css("width") != "auto") {
						 $(this)
						  .data("origWidth", $(this).css("width"))
						  .css("width", "auto");
					 }
				 }).change(function() {
					 $(this).css("width", $(this).data("origWidth"));
				 });
			}
		});
	}


	//$('#recomendedMod').bgiframe();


	/*Hide mini menu in Rec Mod when dropdown search menus are activated -- IE 6 only */
	if (($.browser.msie && $.browser.version.substr(0, 1) == 6) && ($('#sidebar #recommendedMod').length > 0)) {
		visibleSelect = 'true';

		var activeDropDown = $('#srchBox .jqTransformSelectWrapper');
		activeDropDown.click(function() {
			if (visibleSelect == 'true') {
				$('#recommendedMod select').css('visibility', 'hidden');
				visibleSelect = 'false';
			}

			$('#testing').remove();
			$('body').append('<div id=\"testing\" style=\"position:absolute;top:0;right:0;background:#fff;padding:10px;\">' + visibleSelect + '</div>');
			return false;
		});

		$(document.body).click(function() {
			if (visibleSelect == 'false') {
				$('#recommendedMod select').css('visibility', 'visible');
				visibleSelect = 'true';
			}
		});
	}

	/*newsletter*/
	$("#subscribe form").submit(function (e) {

		$.post($(this).attr("action"), $(this).serialize(), function(data) {
			$("#subscribe p").addClass("subscribeResult").text(data)
		}, 'html');

		e.preventDefault();
	});

	$("#subscribeToUs form").submit(function (e) {
		$.post($(this).attr("action"), $(this).serialize(), function(data) {
			$("#subscribeToUs p.ajaxMsg").text(data)
		}, 'html');

		e.preventDefault();
	});
});


/*Beginning of  Functions*/

function pullDownBehavior() {
	var locationOptions = $('#srchBox .jqTransformSelectWrapper ul a.locationNoSubmit');
	$(locationOptions).click(function() {
		if ($(this).attr('index') == "0") {
			$('#srchBox #locationAsub').css('display', 'block');
		}
		else {
			$('#srchBox #locationAsub').css('display', 'none');
		}
	});
	if (($('select[name=state]').val() == 'ALL') && ($('input[name=zip]').val() == 'zip')) {
		$('#srchBox #locationAsub').css('display', 'none');
	}
}

function resizeBlogImages(imageTable) {
	$(imageTable).each(function() {

		var blogImage = $(this);
		var defaultWidth = $(blogImage).width();
		var defaultHeight = $(blogImage).height();
		var twoThirdColWidth = parseInt($('.wikiContent').parent().width() * 0.67); // Large images are not scaled
		var maxWidth = parseInt($('.wikiContent').parent().width() - 30); //should be slightly less that article column width to allow for image margins

		if (defaultWidth > maxWidth) {
			$(blogImage).width(maxWidth);
			$(blogImage).height(parseInt((defaultHeight * maxWidth) / defaultWidth));
		}
		else if (defaultWidth < twoThirdColWidth) {
			blogImage.closest('table').before('<br clear=all />');
			enableTextWrappingOnArticleImage();
		}
	});
}
function enableTextWrappingOnArticleImage() {
	/*make text wrap around table*/
	$('table.imageplugin:even').css({float:'left',margin:'0 20px 10px 0'}).attr('align', 'left');
	$('table.imageplugin:odd').css({float:'right',margin:'0 0 10px 20px'}).attr('align', 'right');
}


function recommendedModReset() {
	$('#recommendedMod .acc_container').hide(); //Hide/close all containers
	// the following 2 lines are commented out so the first form is not open upon pageload
	//$('#recommendedMod .acc_trigger:first').addClass('active').next().addClass('loaded').addClass('active').show(); //Add 'active' class to first trigger, then show/open the immediate next container
	//$('#recommendedMod .acc_trigger:first').find('h6').text('Click to hide').css('display','none');
	adjustInset();
}

/*set the height of right sidebar text wrap (insetRight)  based on the height of the insetContent */
/* IMPORTANT this code must follow the JS collapsing the recommendedMod */
function adjustInset() {
	var insetContentHeight = $('#insetContent').height();
	$('span.insetRight').css('height', insetContentHeight);
}

function doMiniformReq(triggerElem) {
	var formIdAndLoc = triggerElem.attr("rel");
	var elem = triggerElem.next('.acc_container');
	var formIdAndLocArr = formIdAndLoc.split("+");

	// we don't make a request if this container already has a miniform in it
	var miniform = elem.find(".miniform");

	if (miniform.length == 0) {
		elem.find(".spinner").show();

		elem.load("/form/m/form.xml", { 'formId': formIdAndLocArr[0], 'pageLoc': formIdAndLocArr[1],
			'companyPageURL' : "/" + formIdAndLocArr[2]}, function() {
			elem.find(".spinner").hide();
			elem.addClass("loaded");
			adjustCompanyInset();
		});
	}
}


/*set the height of right sidebar text wrap (insetRight)  based on the height of the insetContent */
/* IMPORTANT this code must follow the JS collapsing the recommendedMod */
function adjustCompanyInset() {
	var insetContentHeight = $('#insetContent').height();
	$('span.insetRight').css('height', insetContentHeight);
}

// Hide/Show default field names for keyword form at the top
function fieldOnFocus(formField, formDefault) {
	if (formField.value == formDefault) {
		formField.value = '';
	}
	return false;
}
function fieldOnBlur(formField, formDefault) {
	if (formField.value == '') {
		formField.value = formDefault;
	}
	return false;
}

jQuery.cookie = function(name, value, options) {
	if (typeof value != 'undefined') { // name and value given, set cookie
		options = options || {};
		if (value === null) {
			value = '';
			options.expires = -1;
		}
		var expires = '';
		if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
			var date;
			if (typeof options.expires == 'number') {
				date = new Date();
				date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
			}
			else {
				date = options.expires;
			}
			expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
		}
		// CAUTION: Needed to parenthesize options.path and options.domain
		// in the following expressions, otherwise they evaluate to undefined
		// in the packed version for some reason...
		var path = options.path ? '; path=' + (options.path) : '';
		var domain = options.domain ? '; domain=' + (options.domain) : '';
		var secure = options.secure ? '; secure' : '';
		document.cookie = [
			name, '=', encodeURIComponent(value), expires, path, domain, secure
		].join('');
	}
	else { // only name given, get cookie
		var cookieValue = null;
		if (document.cookie && document.cookie != '') {
			var cookies = document.cookie.split(';');
			for (var i = 0; i < cookies.length; i++) {
				var cookie = jQuery.trim(cookies[i]);
				// Does this cookie string begin with the name we want?
				if (cookie.substring(0, name.length + 1) == (name + '=')) {
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
					break;
				}
			}
		}
		return cookieValue;
	}
};

function resetC2() {
	if ($('#topC2').length == 1) {
		$('#topC2').find('option:first').attr('selected', 'selected');
	}
	if ($('#topC3').length == 1) {
		$('#topC3').find('option:first').attr('selected', 'selected');
	}
}

function resetC3() {
	if ($('#topC3').length == 1) {
		$('#topC3').find('option:first').attr('selected', 'selected');
	}
}

function enhanceVideoPerformance() {
	return false;
}

/* Overlay consolidation in progress*/
/*function videoOverlayDisplay(overlayNum) {
 $(this).overlay({
 load: true,
 target: '#overlayVideo',
 mask: {color: '#000000', opacity: 0.5},
 effect: 'default',
 closeOnClick: true,
 closeOnEsc: true,
 left: 'center',
 top:'10%',
 speed: 'fast',
 onLoad: function() {
 $('.videoPlayer, #relatedWages object').css('visibility', 'hidden'); //hides inline Flash when overlay is active

 //for ie6 hide all select elements when overlay is active
 if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
 $('select').css('visibility', 'hidden');
 }
 },
 onClose: function () {
 $('.videoPlayer, #relatedWages object').css('visibility', 'visible');  //shows inline Flash when overlay is inactive

 //make ie6 form select visible
 if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
 $('select').css('visibility', 'visible');
 }
 swfobject.removeSWF('overlayPlayerElementId' + overlayNum); //remove SWF object
 //For IE7 without Flash plugin
 if ($('#overlayPlayer').length == 0) {
 $('div.overlayBox').append('<div id=\"overlayPlayer\"></div>'); //replace overlayPlayer div
 }
 }
 });
 }*/


/* Beginning of Custom Plugins */

/* =breadcrumb -- reverse the order */
(function($) {
	$.fn.reverseOrder = function() {
		return this.each(function() {
			$(this).prependTo($(this).parent());
		});
	};
})(jQuery);

(function($) {
	/* requirement: containing div with class 'accordion' */
	/* requirement: must have an h5 for the trigger */
	/* requirement: must have an ul for the expanding element*/
	$.fn.extend({
		remAccordion: function() {
			return this.each(function() {
				$(this).find('ul').hide();
				$(this).find('ol h5').click(function () {
					$(this).parent('li').toggleClass('openAccordion');
					$(this).next('ul').slideToggle('fast');
					$('div.accordion ol h5').not(this).next('ul').hide().parent('li').removeClass('openAccordion');
				});
			});
		}
	});
})(jQuery);

/*
 * jQuery hashchange event - v1.3 - 7/21/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($, e, b) {
	var c = "hashchange",h = document,f,g = $.event.special,i = h.documentMode,d = "on" + c in e && (i === b || i > 7);

	function a(j) {
		j = j || location.href;
		return"#" + j.replace(/^[^#]*#?(.*)$/, "$1")
	}

	$.fn[c] = function(j) {return j ? this.bind(c, j) : this.trigger(c)};
	$.fn[c].delay = 50;
	g[c] = $.extend(g[c], {setup:function() {
		if (d) {return false}
		$(f.start)
	},teardown:function() {
		if (d) {return false}
		$(f.stop)
	}});
	f = (function() {
		var j = {},p,m = a(),k = function(q) {return q},l = k,o = k;
		j.start = function() {p || n()};
		j.stop = function() {
			p && clearTimeout(p);
			p = b
		};
		function n() {
			var r = a(),q = o(m);
			if (r !== m) {
				l(m = r, q);
				$(e).trigger(c)
			}
			else {if (q !== m) {location.href = location.href.replace(/#.*/, "") + q}}
			p = setTimeout(n, $.fn[c].delay)
		}

		$.browser.msie && !d && (function() {
			var q,r;
			j.start = function() {
				if (!q) {
					r = $.fn[c].src;
					r = r && r + a();
					q = $('<iframe tabindex="-1" title="empty"/>').hide().one("load",
					 function() {
						 r || l(a());
						 n()
					 }).attr("src", r || "javascript:0").insertAfter("body")[0].contentWindow;
					h.onpropertychange = function() {
						try {if (event.propertyName === "title") {q.document.title = h.title}}
						catch(s) {}
					}
				}
			};
			j.stop = k;
			o = function() {return a(q.location.href)};
			l = function(v, s) {
				var u = q.document,t = $.fn[c].domain;
				if (v !== s) {
					u.title = h.title;
					u.open();
					t && u.write('<script>document.domain="' + t + '"<\/script>');
					u.close();
					q.location.hash = v
				}
			}
		})();
		return j
	})()
})(jQuery, this);$(document).ready(function() {

	//set these for each site, rest of JS should be generic
	var bigAdElement = "ul.contentSearchList > li";
	var bigAdRelativeSchoolName = "h2 > a";
	var littleAdElement = "div#recommendedMod > div.acc_trigger";
	var littleAdRelativeSchoolName = "h3 > a";

	var pageViewGuid = guidGenerator();
	logLoad(pageViewGuid);

	var beginTime;
	var currentCompany;
	var currentType;
	var timeMap = {};

	//big ads
	$(bigAdElement).mouseenter(function() {
		currentCompany = $.trim($(this).find(bigAdRelativeSchoolName).text());
		currentType = "big";
		beginTime = new Date().getTime();
	});

	//big ads
	$(bigAdElement).mouseleave(function() {
		mouseOutResult();
	});

	// little ads
	$(littleAdElement).mouseenter(function() {
		currentCompany = $.trim($(this).find(littleAdRelativeSchoolName).text());
		currentType = "little";
		beginTime = new Date().getTime();
	});

	// little ads
	$(littleAdElement).mouseleave(function() {
		mouseOutResult();
	});

	function mouseOutResult() {
		var timeDiff = new Date().getTime() - beginTime;
		if (timeMap[currentCompany + "REMILON_SEPARATOR" + currentType] == null) {
			timeMap[currentCompany + "REMILON_SEPARATOR" + currentType] = 0;
		}
		timeMap[currentCompany + "REMILON_SEPARATOR" + currentType] += timeDiff;
		currentCompany = null;
	}

	var maxScroll = 0;
	var intervalsWithMovement = 0;
	var intervalsWithoutMovement = 0;

	var lastX = 10000;
	var lastY = 10000;
	var currentX = 0;
	var currentY = 0;

	$(document).mousemove(function(e) {
		currentX = e.pageX;
		currentY = e.pageY;
		if (lastX == 10000 && lastY == 10000) {
			lastX = currentX;
			lastY = currentY;
		}
	});

	function guidGenerator() {
		return jQuery.Guid.New();
	}

	function logPageView(pageView) {
		
		//safari is dumb
		useAsync = navigator.userAgent.toLowerCase().indexOf('safari') == -1;

		$.ajax({
			async: useAsync,
			cache: false,
			type: "POST",
			url: "/logging/pageView",
			data: JSON.stringify(pageView),
			contentType: "application/json",
			dataType: "json"
		});
	}

	function logUnload(pageViewGuid) {
		var pageViewObject = {};
		pageViewObject.impressionGuid = pageViewGuid;
		pageViewObject.action = "unload";
		pageViewObject.maxScrollPixels = maxScroll;
		pageViewObject.intervalsWithMouseMovement = intervalsWithMovement;
		pageViewObject.intervalsWithoutMouseMovement = intervalsWithoutMovement;
		pageViewObject.mouseOverTimes = timeMap;
		logPageView(pageViewObject);
	}

	function logLoad(pageViewGuid) {
		var pageViewObject = {};
		pageViewObject.impressionGuid = pageViewGuid;
		pageViewObject.action = "load";
		pageViewObject.url = document.URL;
		pageViewObject.pageHeight = $(document).height();
		pageViewObject.requestGuid = document.getElementById("requestGuid").value;
		logPageView(pageViewObject);
	}

	function checkForMouseMovement() {
		if (lastX == 10000 && lastY == 10000) {
			//case no movement event has fired yet, for now do nothing
		}
		else if (currentX != lastX || currentY != lastY) {
			intervalsWithMovement++;
		}
		else {
			intervalsWithoutMovement++;
		}
		lastX = currentX;
		lastY = currentY;
	}

	setInterval(checkForMouseMovement, 100);

	//ajax call on navigate away
	$(window).unload(function() {
		if (currentCompany != null) {
			mouseOutResult();
		}
		logUnload(pageViewGuid);
	});

	$(window).scroll(function() {
		if ($(window).scrollTop() > maxScroll) {
			maxScroll = $(window).scrollTop();
		}
	});
});

/**
 * jQuery Guid v1.0.0-1
 * Requires jQuery 1.2.6+ (Not tested with earlier versions).
 * Copyright (c) 2010 Aaron E. [jquery at happinessinmycheeks dot com]
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 *	Usage:
 *		jQuery.Guid.Value() // Returns value of internal Guid. If no guid has been specified, returns a new one (value is then stored internally).
 *		jQuery.Guid.New() // Returns a new Guid and sets it's value internally. Also accepts GUID, Sets it internally.
 *		jQuery.Guid.Empty() // Returns an empty Guid 00000000-0000-0000-0000-000000000000.
 *		jQuery.Guid.IsEmpty() // Returns boolean. True if empty/undefined/blank/null.
 *		jQuery.Guid.IsValid() // Returns boolean. True valid guid, false if not.
 *		jQuery.Guid.Set() // Retrns Guid. Sets Guid to user specified Guid, if invalid, returns an empty guid.
 *
 */

jQuery.extend({
	Guid: {
		Set: function(val) {
			var value;
			if (arguments.length == 1) {
				if (this.IsValid(arguments[0])) {
					value = arguments[0];
				}
				else {
					value = this.Empty();
				}
			}
			$(this).data("value", value);
			return value;
		},

		Empty: function() {
			return "00000000-0000-0000-0000-000000000000";
		},

		IsEmpty: function(gid) {
			return gid == this.Empty() || typeof (gid) == 'undefined' || gid == null || gid == '';
		},

		IsValid: function(value) {
			rGx = new RegExp("\\b(?:[A-F0-9]{8})(?:-[A-F0-9]{4}){3}-(?:[A-F0-9]{12})\\b");
			return rGx.exec(value) != null;
		},

		New: function() {
			if (arguments.length == 1 && this.IsValid(arguments[0])) {
				$(this).data("value", arguments[0]);
				value = arguments[0];
				return value;
			}

			var res = [
			], hv;
			var rgx = new RegExp("[2345]");
			for (var i = 0; i < 8; i++) {
				hv = (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
				if (rgx.exec(i.toString()) != null) {
					if (i == 3) { hv = "6" + hv.substr(1, 3); }
					res.push("-");
				}
				res.push(hv.toUpperCase());
			}
			value = res.join('');
			$(this).data("value", value);
			return value;
		},

		Value: function() {
			if ($(this).data("value")) {
				return $(this).data("value");
			}
			var val = this.New();
			$(this).data("value", val);
			return val;
		}
	}
})();

/*
 http://www.JSON.org/json2.js
 2011-10-19

 Public Domain.

 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

 See http://www.JSON.org/js.html


 This code should be minified before deployment.
 See http://javascript.crockford.com/jsmin.html

 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
 NOT CONTROL.


 This file creates a global JSON object containing two methods: stringify
 and parse.

 JSON.stringify(value, replacer, space)
 value       any JavaScript value, usually an object or array.

 replacer    an optional parameter that determines how object
 values are stringified for objects. It can be a
 function or an array of strings.

 space       an optional parameter that specifies the indentation
 of nested structures. If it is omitted, the text will
 be packed without extra whitespace. If it is a number,
 it will specify the number of spaces to indent at each
 level. If it is a string (such as '\t' or '&nbsp;'),
 it contains the characters used to indent at each level.

 This method produces a JSON text from a JavaScript value.

 When an object value is found, if the object contains a toJSON
 method, its toJSON method will be called and the result will be
 stringified. A toJSON method does not serialize: it returns the
 value represented by the name/value pair that should be serialized,
 or undefined if nothing should be serialized. The toJSON method
 will be passed the key associated with the value, and this will be
 bound to the value

 For example, this would serialize Dates as ISO strings.

 Date.prototype.toJSON = function (key) {
 function f(n) {
 // Format integers to have at least two digits.
 return n < 10 ? '0' + n : n;
 }

 return this.getUTCFullYear()   + '-' +
 f(this.getUTCMonth() + 1) + '-' +
 f(this.getUTCDate())      + 'T' +
 f(this.getUTCHours())     + ':' +
 f(this.getUTCMinutes())   + ':' +
 f(this.getUTCSeconds())   + 'Z';
 };

 You can provide an optional replacer method. It will be passed the
 key and value of each member, with this bound to the containing
 object. The value that is returned from your method will be
 serialized. If your method returns undefined, then the member will
 be excluded from the serialization.

 If the replacer parameter is an array of strings, then it will be
 used to select the members to be serialized. It filters the results
 such that only members with keys listed in the replacer array are
 stringified.

 Values that do not have JSON representations, such as undefined or
 functions, will not be serialized. Such values in objects will be
 dropped; in arrays they will be replaced with null. You can use
 a replacer function to replace those with JSON values.
 JSON.stringify(undefined) returns undefined.

 The optional space parameter produces a stringification of the
 value that is filled with line breaks and indentation to make it
 easier to read.

 If the space parameter is a non-empty string, then that string will
 be used for indentation. If the space parameter is a number, then
 the indentation will be that many spaces.

 Example:

 text = JSON.stringify(['e', {pluribus: 'unum'}]);
 // text is '["e",{"pluribus":"unum"}]'


 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

 text = JSON.stringify([new Date()], function (key, value) {
 return this[key] instanceof Date ?
 'Date(' + this[key] + ')' : value;
 });
 // text is '["Date(---current time---)"]'


 JSON.parse(text, reviver)
 This method parses a JSON text to produce an object or array.
 It can throw a SyntaxError exception.

 The optional reviver parameter is a function that can filter and
 transform the results. It receives each of the keys and values,
 and its return value is used instead of the original value.
 If it returns what it received, then the structure is not modified.
 If it returns undefined then the member is deleted.

 Example:

 // Parse the text. Values that look like ISO date strings will
 // be converted to Date objects.

 myData = JSON.parse(text, function (key, value) {
 var a;
 if (typeof value === 'string') {
 a =
 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
 if (a) {
 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
 +a[5], +a[6]));
 }
 }
 return value;
 });

 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
 var d;
 if (typeof value === 'string' &&
 value.slice(0, 5) === 'Date(' &&
 value.slice(-1) === ')') {
 d = new Date(value.slice(5, -1));
 if (d) {
 return d;
 }
 }
 return value;
 });


 This is a reference implementation. You are free to copy, modify, or
 redistribute.
 */

/*jslint evil: true, regexp: true */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
 call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
 lastIndex, length, parse, prototype, push, replace, slice, stringify,
 test, toJSON, toString, valueOf
 */


// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

var JSON;
if (!JSON) {
	JSON = {};
}

(function () {
	'use strict';

	function f(n) {
		// Format integers to have at least two digits.
		return n < 10 ? '0' + n : n;
	}

	if (typeof Date.prototype.toJSON !== 'function') {

		Date.prototype.toJSON = function (key) {

			return isFinite(this.valueOf())
			 ? this.getUTCFullYear() + '-' +
			 f(this.getUTCMonth() + 1) + '-' +
			 f(this.getUTCDate()) + 'T' +
			 f(this.getUTCHours()) + ':' +
			 f(this.getUTCMinutes()) + ':' +
			 f(this.getUTCSeconds()) + 'Z'
			 : null;
		};

		String.prototype.toJSON =
		 Number.prototype.toJSON =
		  Boolean.prototype.toJSON = function (key) {
			  return this.valueOf();
		  };
	}

	var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
	 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
	 gap,
	 indent,
	 meta = {    // table of character substitutions
		 '\b': '\\b',
		 '\t': '\\t',
		 '\n': '\\n',
		 '\f': '\\f',
		 '\r': '\\r',
		 '"' : '\\"',
		 '\\': '\\\\'
	 },
	 rep;


	function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

		escapable.lastIndex = 0;
		return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
			var c = meta[a];
			return typeof c === 'string'
			 ? c
			 : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
		}) + '"' : '"' + string + '"';
	}


	function str(key, holder) {

// Produce a string from holder[key].

		var i,          // The loop counter.
		 k,          // The member key.
		 v,          // The member value.
		 length,
		 mind = gap,
		 partial,
		 value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

		if (value && typeof value === 'object' &&
		 typeof value.toJSON === 'function') {
			value = value.toJSON(key);
		}

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

		if (typeof rep === 'function') {
			value = rep.call(holder, key, value);
		}

// What happens next depends on the value's type.

		switch (typeof value) {
			case 'string':
				return quote(value);

			case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

				return isFinite(value) ? String(value) : 'null';

			case 'boolean':
			case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

				return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

			case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

				if (!value) {
					return 'null';
				}

// Make an array to hold the partial results of stringifying this object value.

				gap += indent;
				partial = [
				];

// Is the value an array?

				if (Object.prototype.toString.apply(value) === '[object Array]') {

// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

					length = value.length;
					for (i = 0; i < length; i += 1) {
						partial[i] = str(i, value) || 'null';
					}

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

					v = partial.length === 0
					 ? '[]'
					 : gap
					 ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
					 : '[' + partial.join(',') + ']';
					gap = mind;
					return v;
				}

// If the replacer is an array, use it to select the members to be stringified.

				if (rep && typeof rep === 'object') {
					length = rep.length;
					for (i = 0; i < length; i += 1) {
						if (typeof rep[i] === 'string') {
							k = rep[i];
							v = str(k, value);
							if (v) {
								partial.push(quote(k) + (gap ? ': ' : ':') + v);
							}
						}
					}
				}
				else {

// Otherwise, iterate through all of the keys in the object.

					for (k in value) {
						if (Object.prototype.hasOwnProperty.call(value, k)) {
							v = str(k, value);
							if (v) {
								partial.push(quote(k) + (gap ? ': ' : ':') + v);
							}
						}
					}
				}

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

				v = partial.length === 0
				 ? '{}'
				 : gap
				 ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
				 : '{' + partial.join(',') + '}';
				gap = mind;
				return v;
		}
	}

// If the JSON object does not yet have a stringify method, give it one.

	if (typeof JSON.stringify !== 'function') {
		JSON.stringify = function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

			var i;
			gap = '';
			indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

			if (typeof space === 'number') {
				for (i = 0; i < space; i += 1) {
					indent += ' ';
				}

// If the space parameter is a string, it will be used as the indent string.

			} else if (typeof space === 'string') {
				indent = space;
			}

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

			rep = replacer;
			if (replacer && typeof replacer !== 'function' &&
			 (typeof replacer !== 'object' ||
			  typeof replacer.length !== 'number')) {
				throw new Error('JSON.stringify');
			}

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

			return str('', {'': value});
		};
	}


// If the JSON object does not yet have a parse method, give it one.

	if (typeof JSON.parse !== 'function') {
		JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

			var j;

			function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

				var k, v, value = holder[key];
				if (value && typeof value === 'object') {
					for (k in value) {
						if (Object.prototype.hasOwnProperty.call(value, k)) {
							v = walk(value, k);
							if (v !== undefined) {
								value[k] = v;
							}
							else {
								delete value[k];
							}
						}
					}
				}
				return reviver.call(holder, key, value);
			}


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

			text = String(text);
			cx.lastIndex = 0;
			if (cx.test(text)) {
				text = text.replace(cx, function (a) {
					return '\\u' +
					 ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
				});
			}

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

			if (/^[\],:{}\s]*$/
			 .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
			 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
			 .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

				j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

				return typeof reviver === 'function'
				 ? walk({'': j}, '')
				 : j;
			}

// If the text is not JSON parseable, then a SyntaxError is thrown.

			throw new SyntaxError('JSON.parse');
		};
	}
}());/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
