// when the document is ready:
$(document).ready(function(){
	
	$("div#tertiaryNav ul li a").hover(function() {
		$(this).addClass("hover");
	},function(){
		// remove it on roll off
		$(this).removeClass("hover");
	});	
	
	$("div#contentArea div.titleBar ul li:last").addClass("noBorder");
	
	$("div#contentArea div.titleBar ul li").not(".noBorder").append("&nbsp;|");
	$("div#contentArea div.titleBar").append('<br class="floatClear" />');
	
	// PNG IE6 hack
	// http://khurshid.com/jquery/iepnghack/
	$('img[@src$=.png]').IEPNGHack();	
});


// this function search and replaces a string and returns the new string
// http://www.daveshuck.com/blog/index.cfm/2006/12/13/Javascript-examples--removeElement-and-replaceAll
function replaceAll( str, searchTerm, replaceWith, ignoreCase )   {
   var regex = "/"+searchTerm+"/g";
   if( ignoreCase ) regex += "i";
   return str.replace( eval(regex), replaceWith );
}


// rel = external to open in new window
$(function(){
	// fix for target=”_blank”
	$("a[@rel~=’external’]").click(function(){
		window.open($(this).attr("href"));
		return false;
	});
});

// full screen video player
function flashFullScreen() {
	var urlToOpen = "/flashVideoPop.htm?videoVar=" + videoVar;
	window.open(urlToOpen,'McCallumLayton','width=720,height=576');
}