$(document).ready(function() {
	$(".topmenu").find(".greenBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#53BB4E' });
																			   	$(this).children("A").css({ 'background-color': '#53BB4E', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });
	$(".topmenu").find(".orangeBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#F9A95C' });
																			   	$(this).children("A").css({ 'background-color': '#F9A95C', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });
	$(".topmenu").find(".redBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#EA2839' });
																			   	$(this).children("A").css({ 'background-color': '#EA2839', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });
	$(".topmenu").find(".purpleBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#9A3795' });
																			   	$(this).children("A").css({ 'background-color': '#9A3795', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });
	$(".topmenu").find(".blueBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#00ADD0' });
																			   	$(this).children("A").css({ 'background-color': '#00ADD0', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });
	$(".topmenu").find(".darkBlueBack").parent("LI").hover(
																			   function() {
																			   	$(this).css({ 'background-color': '#002395' });
																			   	$(this).children("A").css({ 'background-color': '#002395', 'color': '#FFFFFF' })
																			   },
																			   function() {
																			   	$(this).css({ 'background-color': '#FFFFFF' });
																			   	$(this).children("A").css({ 'background-color': '#FFFFFF', 'color': '#908371' })
																			   });

	$(".sidemenu").find(".ekflexmenu_submenu_items_hidden").parent(".ekflexmenu_menu_level_1").css({ 'display': 'none' });

	$(".courseContent").hide();
	$("#whyStudyHeader").next(".courseContent").show();
	$("#summaryHeader").next(".courseContent").show();

	$("h2 > a").click(function(event) {

		$(this).parents("h2").next(".courseContent").slideToggle(1000);
		$(this).children("span").fadeOut(500, function() {

			if ($(this).hasClass("expanded")) {
				$(this).removeClass("expanded");
				$(this).addClass("contracted");
			}
			else {
				$(this).removeClass("contracted");
				$(this).addClass("expanded");
			}

			$(this).fadeIn(500);
		});

		return false;

	});

	//The entire image of a feature/news item can be clicked.	
	$(".feature img, .newsItem img").mouseover(function() {
		$(this).next("a").css({ 'text-decoration': 'underline' });
		window.status = $(this).next("a").attr("href");
	});

	$(".feature, .newsItem").mouseout(function() {
		$(this).find("a").css({ 'text-decoration': 'none' });
		window.status = "";
	});

	$(".feature a, .newsItem a").mouseover(function() {
		$(this).css({ 'text-decoration': 'underline' });
	});

	$(".feature img, .newsItem img").click(function() {

		var targetType = $(this).next("a").attr("target");
		var url = $(this).next("a").attr("href");

		if (targetType == "_blank") {
			window.open(url);
		}
		else {
			window.location.href = url;
		}

	});

	/*	//Chelgate holding page
	$('iframe').click(function(event) {
	var iFrameUrl = $(this).attr("src").val();
	alert(iFrameUrl);
	alert('hello');
	});

	jquery iframe click
	getSourceUrl?
	loadChelgateFrame
	scroll page to top
	*/
});

function loadChelgateFrame(chelgatePageSrc) {

   // Keep track of the iframe height.  
   var if_height,  
    
   // Pass the parent page URL into the Iframe in a meaningful way (this URL could be  
   // passed via query string or hard coded into the child page, it depends on your needs).     
   src = chelgatePageSrc + encodeURIComponent( document.location.href ),      
    
   // Append the Iframe into the DOM.    
   iframe = $( '<iframe src="' + src + '" width="474" height="100" scrolling="no" frameborder="0"></iframe>' )      
   .appendTo( '#iframe' ); 
  
   // Setup a callback to handle the dispatched MessageEvent event. In cases where  
   // window.postMessage is supported, the passed event will have .data, .origin and  
   // .source properties. Otherwise, this will only have the .data property.

   $.receiveMessage(function(e){  
   
     // Get the height from the passsed data.    
     var h = Number( e.data.replace( /.*if_height=(\d+)(?:&|$)/, '$1' ) );      
     
     if ( !isNaN( h ) && h > 0 && h !== if_height ) {       
       // Height has changed, update the iframe.       
       iframe.height( if_height = h );     
     }      
  
     // An optional origin URL (Ignored where window.postMessage is unsupported).
    }, 'http://www.pressrooms.net');

};

//Removes the Ektron Editor Markers image (silver bubble) and its associated menu from the DOM
function removeEditorsMarkers() {

	//function passed as an argument to the jQuery constructor is bound to the document ready event. 
	$(function() {		
		$("[class^='EktronEditorsMenu']").remove();	
	})
	
}




