// ====================== Single Sign On Site-Wide JavaScript ====================== //

// ------------- JQuery-Based ------------- //

$(document).ready(function(){
	try {
		
		// --- Tabs --- //
		$(".tabbed > ul.tab-navigation").tabs();
	
		// --- Toggle Flag Comments On/Off --- //
		var $flagcontent = $("#profile-flag").hide();
	
		// add in toggle button
		$('.user-profile #title').append('<a class="button button-flag flag-toggle" href=""><span>Flag This Profile</span></a>');
	
		// toggles the flag form
		$('.flag-toggle').click(function(){

			// slowly expand/collapse
			$('#profile-flag').slideToggle('slow');

			// toggles class on toggle button
			$(this).toggleClass('flag-toggle-opened')

			// disables the default html behavior of the <a> element
			return false;
		});
	
		// --- New Window --- //
	
		// Adding a title to each link that opens in a new window
		$('a[@rel*="external"]').attr({
				title: "This link will open in a new browser window"
			});
	
		// Opening the link in a new window
		$('a[@rel*="external"]').click(function() {
		 var eLink = this.href;
		 window.open(eLink);
	
		// removing the default behavior of the link
		 return false;
		});
	}
	catch(e) { }
});


// ------------- <iframe> hack ------------- //
	function getElement(aID)
	   {
	       return (document.getElementById) ?
	           document.getElementById(aID) : document.all[aID];
	   }

	   function adjustMyFrameHeight(val)
	   {
	       var frame = getElement("myFrame");       
	       frame.height = val;
		// alert("Step #3 - resizing my iframe");
	   }